List of usage examples for org.apache.commons.configuration PropertiesConfiguration containsKey
public boolean containsKey(String key)
From source file:uk.ac.edukapp.server.configuration.SpawsServerConfiguration.java
private SpawsServerConfiguration() { try {/*from w w w . ja va2s .c o m*/ PropertiesConfiguration properties = new PropertiesConfiguration("store.properties"); if (properties.containsKey("spaws.node.location")) nodeUrl = properties.getString("spaws.node.location"); if (properties.containsKey("spaws.node.username")) username = properties.getString("spaws.node.username"); if (properties.containsKey("spaws.node.password")) password = properties.getString("spaws.node.password"); if (properties.containsKey("spaws.submitter.name")) submitterName = properties.getString("spaws.submitter.name"); if (properties.containsKey("spaws.enabled")) enabled = properties.getBoolean("spaws.enabled"); if (properties.containsKey("spaws.cache")) cacheDuration = properties.getLong("spaws.cache"); if (properties.containsKey("spaws.stats.interval")) interval = properties.getInt("spaws.stats.interval", 1); } catch (ConfigurationException e) { // // No store properties found, so use default // _logger.warn("No SPAWS node properties found; using defaults"); } try { node = new Node(new URL(nodeUrl), username, password); } catch (MalformedURLException e) { _logger.warn("SPAWS node URL is invalid; using defaults"); try { node = new Node(new URL("http://alpha.mimas.ac.uk"), username, password); } catch (MalformedURLException e1) { // Should never happen... } } submitter = new Submitter(); submitter.setSubmitter(submitterName); submitter.setSigner(submitterName); submitter.setSubmissionAttribution(submitterName); }
From source file:uk.ac.edukapp.server.configuration.StoreConfiguration.java
private StoreConfiguration() { location = "http://localhost:8080"; try {//from ww w . jav a2 s .co m PropertiesConfiguration properties = new PropertiesConfiguration("store.properties"); if (properties.containsKey("store.location")) location = properties.getString("store.location"); if (properties.containsKey("shindig.server.location")) { shindigLocation = properties.getString("shindig.server.location"); } else { shindigLocation = location + "/shindig"; } } catch (ConfigurationException e) { // // No store properties found, so use default // _logger.warn("No store properties found; using defaults"); } }
From source file:uk.ac.edukapp.server.configuration.WookieServerConfiguration.java
private WookieServerConfiguration() { try {//from w w w . j a v a2 s. com PropertiesConfiguration properties = new PropertiesConfiguration("store.properties"); if (properties.containsKey("wookie.server.location")) url = properties.getString("wookie.server.location"); if (properties.containsKey("wookie.server.apiKey")) apiKey = properties.getString("wookie.server.apiKey"); if (properties.containsKey("wookie.server.username")) username = properties.getString("wookie.server.username"); if (properties.containsKey("wookie.server.password")) password = properties.getString("wookie.server.password"); } catch (ConfigurationException e) { // // No store properties found, so default to "localhost" // _logger.warn( "No store properties found; defaulting to using Wookie server at localhost with TEST api key"); } }
From source file:uk.ac.soton.simulation.jsit.core.ModelVersioningAssistant.java
static ModelVersioningAssistant createAssistantInternal(File modelVersionFile, List<File> simSourceDirs) { // Set up properties from file and check format PropertiesConfiguration versionProps; try {//from ww w. j ava 2 s . c om versionProps = new PropertiesConfiguration(modelVersionFile); } catch (ConfigurationException e) { throw new ModelVersioningException( "Error reading model version file " + modelVersionFile.getAbsolutePath(), e); } String[] requiredProperties = new String[] { MODEL_NAME_PROPERTY, MODEL_VER_PROPERTY, VCS_PROPERTY }; for (String s : requiredProperties) { if (!versionProps.containsKey(s) || versionProps.getString(s).trim().equals("")) { throw new ModelVersioningException( "Model version file " + VERSION_FILE_NAME + " should contain non-blank property " + s); } } VersionControlSystem vcs = vcsFromString(versionProps.getString(VCS_PROPERTY)); if (vcs == null) { throw new ModelVersioningException("Invalid VCS specified in properties file"); } if (vcs == VersionControlSystem.NONE) { return new ModelVersioningAssistantNoVCS(simSourceDirs, modelVersionFile, versionProps); } else if (vcs == VersionControlSystem.SVN_TIGRIS_ONLY_CLIENT) { return new ModelVersioningAssistantSVN_Tigris(simSourceDirs, modelVersionFile, versionProps); } else if (vcs == VersionControlSystem.SVN_APACHE_CLIENT) { return new ModelVersioningAssistantSVN_Apache(simSourceDirs, modelVersionFile, versionProps); } throw new AssertionError(); // Should never get here }