예제 #1
0
  @Override
  public void updateConfiguration(PropertiesConfiguration configuration) {
    if (configuration.getProperty("database").equals("derby")) {
      String url = (String) configuration.getProperty("database.url");

      if (!StringUtils.contains(url, ";upgrade=")) {
        url += ";upgrade=true";
      }

      configuration.setProperty("database.url", url);
    }
  }
예제 #2
0
 private static void showStartupInfo(
     PropertiesConfiguration buildConfiguration, boolean enableTLS, int appPort) {
   StringBuilder buffer = new StringBuilder();
   buffer.append("\n############################################");
   buffer.append("############################################");
   buffer.append("\n                               Atlas Server (STARTUP)");
   buffer.append("\n");
   try {
     final Iterator<String> keys = buildConfiguration.getKeys();
     while (keys.hasNext()) {
       String key = keys.next();
       buffer
           .append('\n')
           .append('\t')
           .append(key)
           .append(":\t")
           .append(buildConfiguration.getProperty(key));
     }
   } catch (Throwable e) {
     buffer.append("*** Unable to get build info ***");
   }
   buffer.append("\n############################################");
   buffer.append("############################################");
   LOG.info(buffer.toString());
   LOG.info(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>");
   LOG.info("Server starting with TLS ? {} on port {}", enableTLS, appPort);
   LOG.info("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<");
 }
 public static void setProperties(PropertiesConfiguration configuration) {
   configuration.getProperty("");
   getMailProperties()
       .setMailLogin(configuration.getString(MailProperties.getMailType() + ".login"));
   getMailProperties()
       .setMailPass(configuration.getString(MailProperties.getMailType() + ".password"));
   getMailProperties().setMailUrl(configuration.getString(MailProperties.getMailType() + ".url"));
 }
예제 #4
0
 /**
  * Gets the prop attribute as char value from the apache commons cfg component.
  *
  * @param name contains the name of the property.
  * @return contains the value associated with the property or 0 if not not found.
  */
 public char getChar(String name) {
   char value = 0;
   if (config != null) {
     value = (char) config.getProperty(name);
     LOG.debug("getChar name [{}] value [{}]", name, value);
   } else {
     LOG.error("getChar invalid config, can't read prop [{}]", name);
   }
   return value;
 }
예제 #5
0
 /**
  * Gets the prop attribute as String value from the apache commons cfg component.
  *
  * @param name contains the name of the property.
  * @return contains the value associated with the property or null if not not found.
  */
 public String getProperty(String name) {
   String value = null;
   if (config != null) {
     value = (String) config.getProperty(name);
     LOG.debug("getProperty name [{}] value [{}]", name, value);
   } else {
     LOG.error("getProperty invalid config, can't read prop [{}]", name);
   }
   return value;
 }
예제 #6
0
 /**
  * Get the property value from the apache commons config but specify a default value if not found.
  *
  * @param name contains the name of the property.
  * @param defaultValue specified by client will be returned if property value is not found.
  * @return contains the value for the property as a char.
  */
 public char getChar(String name, char defaultValue) {
   char value = 0;
   if (config != null) {
     value = (char) config.getProperty(name);
   } else {
     String warn = "getChar invalid config, can't read prop [" + name + "]";
     LOG.warn(warn);
   }
   if (value == 0) {
     value = defaultValue;
   }
   return value;
 }
예제 #7
0
 /**
  * Get the property value from the apache commons config but specify a default value if not found.
  *
  * @param name contains the name of the property.
  * @param defaultValue specified by client will be returned if property value is not found.
  * @return contains the value for the property as a String.
  */
 public String getProperty(String name, String defaultValue) {
   String value = null;
   if (config != null) {
     value = (String) config.getProperty(name);
   } else {
     String warn = "getProperty invalid config, can't read prop [" + name + "]";
     LOG.warn(warn);
   }
   if (value == null || value.length() == 0) {
     value = defaultValue;
   }
   return value;
 }
예제 #8
0
 @Provides
 @Singleton
 public SSEnvironment getEnvironment() {
   try {
     String systemEnviroment = System.getProperty(Constants.ENVIRONMENT_VARIABLE);
     if (systemEnviroment == null || systemEnviroment.isEmpty()) {
       InputStream stream =
           Thread.currentThread()
               .getContextClassLoader()
               .getResourceAsStream("environment.properties");
       PropertiesConfiguration propsConfig = new PropertiesConfiguration();
       propsConfig.load(stream);
       systemEnviroment = propsConfig.getProperty(Constants.ENVIRONMENT_VARIABLE).toString();
     }
     return SSEnvironment.valueOf(systemEnviroment.toUpperCase());
   } catch (Exception e) {
     return SSEnvironment.LOCAL;
   }
 }