You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by ak...@apache.org on 2006/03/04 01:23:14 UTC
svn commit: r382979 -
/incubator/felix/sandbox/akarasulu/mavenized/org.apache.felix.framework/src/main/java/org/apache/felix/framework/DaemonService.java
Author: akarasulu
Date: Fri Mar 3 16:23:12 2006
New Revision: 382979
URL: http://svn.apache.org/viewcvs?rev=382979&view=rev
Log:
changes ...
o added some doco
o added section in start to set the profile to "production" if one is not
specified which is the case if started from anything other than the main()
Modified:
incubator/felix/sandbox/akarasulu/mavenized/org.apache.felix.framework/src/main/java/org/apache/felix/framework/DaemonService.java
Modified: incubator/felix/sandbox/akarasulu/mavenized/org.apache.felix.framework/src/main/java/org/apache/felix/framework/DaemonService.java
URL: http://svn.apache.org/viewcvs/incubator/felix/sandbox/akarasulu/mavenized/org.apache.felix.framework/src/main/java/org/apache/felix/framework/DaemonService.java?rev=382979&r1=382978&r2=382979&view=diff
==============================================================================
--- incubator/felix/sandbox/akarasulu/mavenized/org.apache.felix.framework/src/main/java/org/apache/felix/framework/DaemonService.java (original)
+++ incubator/felix/sandbox/akarasulu/mavenized/org.apache.felix.framework/src/main/java/org/apache/felix/framework/DaemonService.java Fri Mar 3 16:23:12 2006
@@ -1,9 +1,11 @@
package org.apache.felix.framework;
+import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
+import java.io.InputStreamReader;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.Enumeration;
@@ -11,6 +13,7 @@
import org.apache.directory.daemon.DaemonApplication;
import org.apache.directory.daemon.InstallationLayout;
+import org.apache.felix.framework.cache.DefaultBundleCache;
import org.apache.felix.framework.util.MutablePropertyResolverImpl;
import org.apache.felix.framework.util.StringMap;
@@ -26,13 +29,16 @@
* property file to be used for the created the framework instance.
*/
public static final String CONFIG_PROPERTIES_PROP = "felix.config.properties";
- /**
- * The default name used for the configuration properties file.
- */
+ /** The default name used for the configuration properties file. */
public static final String CONFIG_PROPERTIES_FILE_VALUE = "config.properties";
+ /** the default profile if no profile name or path is specified */
+ public static final String DEFAULT_PRODUCTION_PROFILE = "production";
+ /** the instance of Felix managed by this daemon/service */
private Felix instance;
+ /** the configuration properties loaded from the configuration file */
private Properties configationProperties;
+ /** the felix installation layout */
private FelixLayout layout;
@@ -54,6 +60,20 @@
public void start()
{
+ // See if the profile name property was specified.
+ String profileName = configationProperties.getProperty( DefaultBundleCache.CACHE_PROFILE_PROP );
+
+ // See if the profile directory property was specified.
+ String profileDirName = configationProperties.getProperty( DefaultBundleCache.CACHE_PROFILE_DIR_PROP );
+
+ // If no profile or profile directory is specified in the properties, then set the
+ // name to the default production mode profile name since this is not started from main()
+ if ( ( profileName == null ) && ( profileDirName == null ) )
+ {
+ configationProperties.setProperty( DefaultBundleCache.CACHE_PROFILE_PROP, DEFAULT_PRODUCTION_PROFILE );
+ }
+
+ // start up the instance using the loaded and possibly altered configuration
instance.start( new MutablePropertyResolverImpl( new StringMap( configationProperties, false ) ), null );
}
@@ -69,6 +89,12 @@
}
+ /**
+ * Exposes configuration properties for potential alteration between load
+ * time at init() and start() by the managing framework or by the main().
+ *
+ * @return the configuration properties loaded by default from conf/config.properties
+ */
public Properties getConfigurationProperties()
{
return configationProperties;