/**
  * Loads the configuration properties in the configuration property file associated with the
  * framework installation; these properties are accessible to the framework and to bundles and are
  * intended for configuration purposes. By default, the configuration property file is located in
  * the <tt>conf/</tt> directory and is called " <tt>config.properties</tt>".
  *
  * @return A <tt>Map<String, Object></tt> instance or <tt>null</tt> if there was an error.
  */
 protected Map<String, String> loadConfigProperties(
     JsonValue configuration, URI projectDirectory) {
   JsonValue systemProperties = configuration.get(CONFIG_PROPERTIES_PROP);
   if (systemProperties.isMap()) {
     // Substitute all variables
     systemProperties = systemProperties.copy();
   } else {
     Properties props =
         loadPropertyFile(
             projectDirectory,
             systemProperties
                 .expect(String.class)
                 .defaultTo(CONFIG_PROPERTIES_FILE_VALUE)
                 .asString());
     if (props == null) return new HashMap<String, String>(0);
     // Perform variable substitution on specified properties.
     systemProperties = (new JsonValue(props, null, Arrays.asList(transformer))).copy();
   }
   Map<String, String> config = new HashMap<String, String>(systemProperties.size());
   for (Map.Entry<String, Object> entry : systemProperties.asMap().entrySet()) {
     if (entry.getValue() instanceof String) {
       // Excluce the null and non String values
       config.put(entry.getKey(), (String) entry.getValue());
     }
   }
   return config;
 }
 /**
  * Loads the properties in the system property file associated with the framework installation
  * into <tt>System.setProperty()</tt>. These properties are not directly used by the framework in
  * anyway. By default, the system property file is located in the <tt>conf/</tt> directory and is
  * called "<tt>system.properties</tt>".
  */
 protected void loadSystemProperties(JsonValue configuration, URI projectDirectory) {
   JsonValue systemProperties = configuration.get(SYSTEM_PROPERTIES_PROP);
   if (systemProperties.isMap()) {
     for (Map.Entry<String, Object> entry : systemProperties.copy().asMap().entrySet()) {
       // The user.dir MUST not be overwritten!!!
       if (entry.getValue() instanceof String && !"user.dir".equals(entry.getKey())) {
         System.setProperty(entry.getKey(), (String) entry.getValue());
       }
     }
   } else {
     Properties props =
         loadPropertyFile(
             projectDirectory,
             systemProperties
                 .expect(String.class)
                 .defaultTo(SYSTEM_PROPERTIES_FILE_VALUE)
                 .asString());
     if (props == null) return;
     // Perform variable substitution on specified properties.
     for (Enumeration e = props.propertyNames(); e.hasMoreElements(); ) {
       String name = (String) e.nextElement();
       if (!"user.dir".equals(name)) {
         Object newValue = ConfigurationUtil.substVars(props.getProperty(name), propertyAccessor);
         if (newValue instanceof String) {
           System.setProperty(name, (String) newValue);
         }
       }
     }
   }
 }
 /**
  * Loads the boot properties in the configuration property file associated with the framework
  * installation; these properties are accessible to the framework and to bundles and are intended
  * for configuration purposes. By default, the configuration property file is located in the
  * <tt>conf/</tt> directory and is called " <tt>config.properties</tt>".
  *
  * @return A <tt>Map<String, Object></tt> instance or <tt>null</tt> if there was an error.
  */
 protected Map<String, Object> loadBootProperties(JsonValue configuration, URI projectDirectory) {
   JsonValue bootProperties = configuration.get(BOOT_PROPERTIES_PROP);
   if (bootProperties.isMap()) {
     // Substitute all variables
     return bootProperties.copy().asMap();
   } else {
     Properties props =
         loadPropertyFile(
             projectDirectory,
             bootProperties.expect(String.class).defaultTo(BOOT_PROPERTIES_FILE_VALUE).asString());
     if (props == null) return new HashMap<String, Object>(0);
     // Perform variable substitution on specified properties.
     return (new JsonValue(props, null, Arrays.asList(transformer)))
         .expect(Map.class)
         .copy()
         .asMap();
   }
 }