private ManagedIndexMetadata(String serverName, String pid,ComponentContext context){ this.serverName = serverName; this.pid = pid; //this.context = context; //init the Maps for manageing Indexes with the different states for(ManagedIndexState state : ManagedIndexState.values()){ managed.put(state, new HashMap<String,IndexMetadata>()); } File dir = null; if(context != null){ dir = context.getBundleContext().getDataFile(DEFAULT_INDEX_CONFIG_DIR+'/'+pid); //dir might be null if the OSGI environment is missing file system support } if (dir == null) { //outside OSGI or OSGI has no file system support // use config directory relative to the the Managed Solr Directory dir = new File(DEFAULT_INDEX_CONFIG_DIR,pid).getAbsoluteFile(); } log.info("SolrYard Config Directory: "+dir); this.configDir = dir; } /**
private ManagedIndexMetadata(String serverName, String pid,ComponentContext context){ this.serverName = serverName; this.pid = pid; //this.context = context; //init the Maps for manageing Indexes with the different states for(ManagedIndexState state : ManagedIndexState.values()){ managed.put(state, new HashMap<String,IndexMetadata>()); } File dir = null; if(context != null){ dir = context.getBundleContext().getDataFile(DEFAULT_INDEX_CONFIG_DIR+'/'+pid); //dir might be null if the OSGI environment is missing file system support } if (dir == null) { //outside OSGI or OSGI has no file system support // use config directory relative to the the Managed Solr Directory dir = new File(DEFAULT_INDEX_CONFIG_DIR,pid).getAbsoluteFile(); } log.info("SolrYard Config Directory: "+dir); this.configDir = dir; } /**
/** * validates the values of the IndexProperties * @throws IOException */ private void validate(boolean store) throws IOException { if(isSynchronized() && getIndexArchives().isEmpty()){ throw new IOException("Unable to "+(store?"store":"read")+ " IndexPropertis where Synchronized=true and no Index-Archives are defined!"); } ManagedIndexState state = getState(); if(state == null){ throw new IOException("Unable to "+(store?"store":"read")+ " IndexMetadata without the required key '"+STATE+ "' set to one of the values '"+ Arrays.toString(ManagedIndexState.values())+"'!"); } if(isActive()){ if(getDirectory() == null){ throw new IOException("Unable to "+(store?"store":"read")+ " IndexPropertis where Active=true and no Directory is defined!"); } } String name = getIndexName(); if(name == null || name.isEmpty()){ throw new IOException("Unable to "+(store?"store":"read")+ " IndexPropertis where the required key '"+ INDEX_NAME+"' is not defined or empty!"); } }
/** * validates the values of the IndexProperties * @throws IOException */ private void validate(boolean store) throws IOException { if(isSynchronized() && getIndexArchives().isEmpty()){ throw new IOException("Unable to "+(store?"store":"read")+ " IndexPropertis where Synchronized=true and no Index-Archives are defined!"); } ManagedIndexState state = getState(); if(state == null){ throw new IOException("Unable to "+(store?"store":"read")+ " IndexMetadata without the required key '"+STATE+ "' set to one of the values '"+ Arrays.toString(ManagedIndexState.values())+"'!"); } if(isActive()){ if(getDirectory() == null){ throw new IOException("Unable to "+(store?"store":"read")+ " IndexPropertis where Active=true and no Directory is defined!"); } } String name = getIndexName(); if(name == null || name.isEmpty()){ throw new IOException("Unable to "+(store?"store":"read")+ " IndexPropertis where the required key '"+ INDEX_NAME+"' is not defined or empty!"); } }