felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rickh...@apache.org
Subject svn commit: r705350 - in /felix/trunk: framework/ framework/src/main/java/org/apache/felix/framework/ framework/src/main/java/org/apache/felix/framework/searchpolicy/ framework/src/main/java/org/apache/felix/framework/util/ framework/src/main/resources...
Date Thu, 16 Oct 2008 20:22:59 GMT
Author: rickhall
Date: Thu Oct 16 13:22:58 2008
New Revision: 705350

URL: http://svn.apache.org/viewvc?rev=705350&view=rev
Log:
Modified framework to have default values for the system packages property,
which also required modifying main to no longer expect to set it. Now it
is really possible to start Felix with no configuration properties. (FELIX-753)

Added:
    felix/trunk/framework/src/main/resources/default.properties
      - copied, changed from r705325, felix/trunk/main/src/main/resources/default.properties
Removed:
    felix/trunk/main/src/main/resources/default.properties
Modified:
    felix/trunk/framework/pom.xml
    felix/trunk/framework/src/main/java/org/apache/felix/framework/ExtensionManager.java
    felix/trunk/framework/src/main/java/org/apache/felix/framework/searchpolicy/R4SearchPolicyCore.java
    felix/trunk/framework/src/main/java/org/apache/felix/framework/util/Util.java
    felix/trunk/main/pom.xml
    felix/trunk/main/src/main/java/org/apache/felix/main/Main.java
    felix/trunk/main/src/main/resources/config.properties

Modified: felix/trunk/framework/pom.xml
URL: http://svn.apache.org/viewvc/felix/trunk/framework/pom.xml?rev=705350&r1=705349&r2=705350&view=diff
==============================================================================
--- felix/trunk/framework/pom.xml (original)
+++ felix/trunk/framework/pom.xml Thu Oct 16 13:22:58 2008
@@ -46,6 +46,9 @@
       </exclusions>
     </dependency>
   </dependencies>
+  <properties>
+    <dollar>$</dollar>
+  </properties>
   <build>
     <plugins>
       <plugin>

Modified: felix/trunk/framework/src/main/java/org/apache/felix/framework/ExtensionManager.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/apache/felix/framework/ExtensionManager.java?rev=705350&r1=705349&r2=705350&view=diff
==============================================================================
--- felix/trunk/framework/src/main/java/org/apache/felix/framework/ExtensionManager.java (original)
+++ felix/trunk/framework/src/main/java/org/apache/felix/framework/ExtensionManager.java Thu
Oct 16 13:22:58 2008
@@ -33,6 +33,7 @@
 import java.util.List;
 import java.util.Map;
 import java.util.NoSuchElementException;
+import java.util.Properties;
 import java.util.Set;
 
 import org.apache.felix.framework.util.FelixConstants;
@@ -166,14 +167,19 @@
         // The system bundle exports framework packages as well as
         // arbitrary user-defined packages from the system class path.
         // We must construct the system bundle's export metadata.
-        // Get system property that specifies which class path
+        // Get configuration property that specifies which class path
         // packages should be exported by the system bundle.
+        String syspkgs = (String) configMap.get(Constants.FRAMEWORK_SYSTEMPACKAGES);
+        // If no system packages were specified, load our default value.
+        syspkgs = (syspkgs == null) ? loadDefaultSystemPackages(m_logger) : syspkgs;
+        // If any extra packages are specified, then append them.
+        String extra = (String) configMap.get(Constants.FRAMEWORK_SYSTEMPACKAGES_EXTRA);
+        syspkgs = (extra == null) ? syspkgs : syspkgs + "," + extra;
         try
         {
             setCapabilities(
                 addModuleCapability(map,
-                    ManifestParser.parseExportHeader(
-                        (String) configMap.get(Constants.FRAMEWORK_SYSTEMPACKAGES))));
+                    ManifestParser.parseExportHeader(syspkgs)));
         }
         catch (Exception ex)
         {
@@ -181,7 +187,7 @@
             m_logger.log(
                 Logger.LOG_ERROR,
                 "Error parsing system bundle export statement: "
-                + configMap.get(Constants.FRAMEWORK_SYSTEMPACKAGES), ex);
+                + syspkgs, ex);
         }
     }
 
@@ -682,4 +688,55 @@
     {
         return null;
     }
+
+    //
+    // Utility methods.
+    //
+
+    /**
+     * The default name used for the default configuration properties file.
+    **/
+    public static final String DEFAULT_PROPERTIES_FILE_VALUE = "default.properties";
+
+    static String loadDefaultSystemPackages(Logger logger)
+    {
+        // If we cannot get configuration properties for any reason, then just
+        // attempt to load resource default.properties instead.
+        URL propURL = ExtensionManager.class.getClassLoader()
+            .getResource(DEFAULT_PROPERTIES_FILE_VALUE);
+        InputStream is = null;
+        try
+        {
+            // Load properties from URL.
+            is = propURL.openConnection().getInputStream();
+            Properties props = new Properties();
+            props.load(is);
+            is.close();
+            // Perform variable substitution for system properties.
+            for (Enumeration e = props.propertyNames(); e.hasMoreElements(); )
+            {
+                String name = (String) e.nextElement();
+                props.setProperty(name,
+                    Util.substVars(props.getProperty(name), name, null, props));
+            }
+            // Return system packages property.
+            return props.getProperty(Constants.FRAMEWORK_SYSTEMPACKAGES);
+        }
+        catch (Exception ex)
+        {
+            // Try to close input stream if we have one.
+            try
+            {
+                if (is != null) is.close();
+            }
+            catch (IOException ex2)
+            {
+                // Nothing we can do.
+            }
+
+            logger.log(
+                Logger.LOG_ERROR, "Unable to load any configuration properties.", ex);
+            return "";
+        }
+    }
 }
\ No newline at end of file

Modified: felix/trunk/framework/src/main/java/org/apache/felix/framework/searchpolicy/R4SearchPolicyCore.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/apache/felix/framework/searchpolicy/R4SearchPolicyCore.java?rev=705350&r1=705349&r2=705350&view=diff
==============================================================================
--- felix/trunk/framework/src/main/java/org/apache/felix/framework/searchpolicy/R4SearchPolicyCore.java
(original)
+++ felix/trunk/framework/src/main/java/org/apache/felix/framework/searchpolicy/R4SearchPolicyCore.java
Thu Oct 16 13:22:58 2008
@@ -3528,7 +3528,7 @@
             sb.append("' is available from the system class loader. There are two fixes:
1) Add package '");
             sb.append(pkgName);
             sb.append("' to the '");
-            sb.append(Constants.FRAMEWORK_SYSTEMPACKAGES);
+            sb.append(Constants.FRAMEWORK_SYSTEMPACKAGES_EXTRA);
             sb.append("' property and modify bundle ");
             sb.append(impId);
             sb.append(" to import this package; this causes the system bundle to export class
path packages. 2) Add package '");

Modified: felix/trunk/framework/src/main/java/org/apache/felix/framework/util/Util.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/apache/felix/framework/util/Util.java?rev=705350&r1=705349&r2=705350&view=diff
==============================================================================
--- felix/trunk/framework/src/main/java/org/apache/felix/framework/util/Util.java (original)
+++ felix/trunk/framework/src/main/java/org/apache/felix/framework/util/Util.java Thu Oct
16 13:22:58 2008
@@ -21,7 +21,10 @@
 import java.io.*;
 
 import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
+import java.util.Properties;
 import org.apache.felix.framework.util.manifestparser.Capability;
 import org.apache.felix.moduleloader.*;
 import org.osgi.framework.Bundle;
@@ -384,4 +387,129 @@
             out.write(0x0a);
         }
     }
+
+
+    private static final String DELIM_START = "${";
+    private static final String DELIM_STOP  = "}";
+
+    /**
+     * <p>
+     * This method performs property variable substitution on the
+     * specified value. If the specified value contains the syntax
+     * <tt>${&lt;prop-name&gt;}</tt>, where <tt>&lt;prop-name&gt;</tt>
+     * refers to either a configuration property or a system property,
+     * then the corresponding property value is substituted for the variable
+     * placeholder. Multiple variable placeholders may exist in the
+     * specified value as well as nested variable placeholders, which
+     * are substituted from inner most to outer most. Configuration
+     * properties override system properties.
+     * </p>
+     * @param val The string on which to perform property substitution.
+     * @param currentKey The key of the property being evaluated used to
+     *        detect cycles.
+     * @param cycleMap Map of variable references used to detect nested cycles.
+     * @param configProps Set of configuration properties.
+     * @return The value of the specified string after system property substitution.
+     * @throws IllegalArgumentException If there was a syntax error in the
+     *         property placeholder syntax or a recursive variable reference.
+    **/
+    public static String substVars(String val, String currentKey,
+        Map cycleMap, Properties configProps)
+        throws IllegalArgumentException
+    {
+        // If there is currently no cycle map, then create
+        // one for detecting cycles for this invocation.
+        if (cycleMap == null)
+        {
+            cycleMap = new HashMap();
+        }
+
+        // Put the current key in the cycle map.
+        cycleMap.put(currentKey, currentKey);
+
+        // Assume we have a value that is something like:
+        // "leading ${foo.${bar}} middle ${baz} trailing"
+
+        // Find the first ending '}' variable delimiter, which
+        // will correspond to the first deepest nested variable
+        // placeholder.
+        int stopDelim = val.indexOf(DELIM_STOP);
+
+        // Find the matching starting "${" variable delimiter
+        // by looping until we find a start delimiter that is
+        // greater than the stop delimiter we have found.
+        int startDelim = val.indexOf(DELIM_START);
+        while (stopDelim >= 0)
+        {
+            int idx = val.indexOf(DELIM_START, startDelim + DELIM_START.length());
+            if ((idx < 0) || (idx > stopDelim))
+            {
+                break;
+            }
+            else if (idx < stopDelim)
+            {
+                startDelim = idx;
+            }
+        }
+
+        // If we do not have a start or stop delimiter, then just
+        // return the existing value.
+        if ((startDelim < 0) && (stopDelim < 0))
+        {
+            return val;
+        }
+        // At this point, we found a stop delimiter without a start,
+        // so throw an exception.
+        else if (((startDelim < 0) || (startDelim > stopDelim))
+            && (stopDelim >= 0))
+        {
+            throw new IllegalArgumentException(
+                "stop delimiter with no start delimiter: "
+                + val);
+        }
+
+        // At this point, we have found a variable placeholder so
+        // we must perform a variable substitution on it.
+        // Using the start and stop delimiter indices, extract
+        // the first, deepest nested variable placeholder.
+        String variable =
+            val.substring(startDelim + DELIM_START.length(), stopDelim);
+
+        // Verify that this is not a recursive variable reference.
+        if (cycleMap.get(variable) != null)
+        {
+            throw new IllegalArgumentException(
+                "recursive variable reference: " + variable);
+        }
+
+        // Get the value of the deepest nested variable placeholder.
+        // Try to configuration properties first.
+        String substValue = (configProps != null)
+            ? configProps.getProperty(variable, null)
+            : null;
+        if (substValue == null)
+        {
+            // Ignore unknown property values.
+            substValue = System.getProperty(variable, "");
+        }
+
+        // Remove the found variable from the cycle map, since
+        // it may appear more than once in the value and we don't
+        // want such situations to appear as a recursive reference.
+        cycleMap.remove(variable);
+
+        // Append the leading characters, the substituted value of
+        // the variable, and the trailing characters to get the new
+        // value.
+        val = val.substring(0, startDelim)
+            + substValue
+            + val.substring(stopDelim + DELIM_STOP.length(), val.length());
+
+        // Now perform substitution again, since there could still
+        // be substitutions to make.
+        val = substVars(val, currentKey, cycleMap, configProps);
+
+        // Return the value.
+        return val;
+    }
 }
\ No newline at end of file

Copied: felix/trunk/framework/src/main/resources/default.properties (from r705325, felix/trunk/main/src/main/resources/default.properties)
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/resources/default.properties?p2=felix/trunk/framework/src/main/resources/default.properties&p1=felix/trunk/main/src/main/resources/default.properties&r1=705325&r2=705350&rev=705350&view=diff
==============================================================================
--- felix/trunk/main/src/main/resources/default.properties (original)
+++ felix/trunk/framework/src/main/resources/default.properties Thu Oct 16 13:22:58 2008
@@ -25,38 +25,433 @@
  org.osgi.util.tracker; version=1.3.3 \
  ${dollar}{jre-${dollar}{java.specification.version}}
 
-# The following property makes specified packages from the class path
-# available to all bundles. You should avoid using this property.
-#org.osgi.framework.bootdelegation=sun.*,com.sun.*
-
-# The following property explicitly specifies the location of the bundle
-# cache, which defaults to "felix-cache" in the current working directory.
-# If this value is not absolute, then the felix.cache.rootdir controls
-# how the absolute location is calculated. (See next property)
-#org.osgi.framework.storage=${dollar}{felix.cache.rootdir}/felix-cache
-
-# The following property is used to convert a relative bundle cache
-# location into an absolute one by specifying the root to prepend to
-# the relative cache path. The default for this property is the
-# current working directory.
-#felix.cache.rootdir=${dollar}{user.dir}
-
-felix.log.level=4
-felix.startlevel.framework=1
-felix.startlevel.bundle=1
-
-# Invalid fragment bundles throw an 'exception' by default, but
-# uncomment the follow line to have them log a 'warning' instead.
-#felix.fragment.validation=warning
-
-# Felix installs a stream and content handler factories by default,
-# uncomment the following line to not install them.
-#felix.service.urlhandlers=false
-
 #
 # Java platform package export properties.
 #
-jre-1.3=${jre-1.3}
-jre-1.4=${jre-1.4}
-jre-1.5=${jre-1.5}
-jre-1.6=${jre-1.6}
+jre-1.3=, \
+ javax.accessibility; \
+ javax.naming; \
+ javax.naming.directory; \
+ javax.naming.event; \
+ javax.naming.ldap; \
+ javax.naming.spi; \
+ javax.rmi; \
+ javax.rmi.CORBA; \
+ javax.sound.midi; \
+ javax.sound.midi.spi; \
+ javax.sound.sampled; \
+ javax.sound.sampled.spi; \
+ javax.swing; \
+ javax.swing.border; \
+ javax.swing.colorchooser; \
+ javax.swing.event; \
+ javax.swing.filechooser; \
+ javax.swing.plaf; \
+ javax.swing.plaf.basic; \
+ javax.swing.plaf.metal; \
+ javax.swing.plaf.multi; \
+ javax.swing.table; \
+ javax.swing.text; \
+ javax.swing.text.html; \
+ javax.swing.text.html.parser; \
+ javax.swing.text.rtf; \
+ javax.swing.tree; \
+ javax.swing.undo; \
+ javax.transaction; \
+ org.omg.CORBA; \
+ org.omg.CORBA_2_3; \
+ org.omg.CORBA_2_3.portable; \
+ org.omg.CORBA.DynAnyPackage; \
+ org.omg.CORBA.ORBPackage; \
+ org.omg.CORBA.portable; \
+ org.omg.CORBA.TypeCodePackage; \
+ org.omg.CosNaming; \
+ org.omg.CosNaming.NamingContextPackage; \
+ org.omg.SendingContext; \
+ org.omg.stub.java.rmi; \
+ version="1.3.0"
+
+jre-1.4=, \
+ javax.accessibility; \
+ javax.crypto; \
+ javax.crypto.interfaces; \
+ javax.crypto.spec; \
+ javax.imageio; \
+ javax.imageio.event; \
+ javax.imageio.metadata; \
+ javax.imageio.plugins.jpeg; \
+ javax.imageio.spi; \
+ javax.imageio.stream; \
+ javax.naming; \
+ javax.naming.directory; \
+ javax.naming.event; \
+ javax.naming.ldap; \
+ javax.naming.spi; \
+ javax.net; \
+ javax.net.ssl; \
+ javax.print; \
+ javax.print.attribute; \
+ javax.print.attribute.standard; \
+ javax.print.event; \
+ javax.rmi; \
+ javax.rmi.CORBA; \
+ javax.security.auth; \
+ javax.security.auth.callback; \
+ javax.security.auth.kerberos; \
+ javax.security.auth.login; \
+ javax.security.auth.spi; \
+ javax.security.auth.x500; \
+ javax.sound.midi; \
+ javax.sound.midi.spi; \
+ javax.sound.sampled; \
+ javax.sound.sampled.spi; \
+ javax.sql; \
+ javax.swing; \
+ javax.swing.border; \
+ javax.swing.colorchooser; \
+ javax.swing.event; \
+ javax.swing.filechooser; \
+ javax.swing.plaf; \
+ javax.swing.plaf.basic; \
+ javax.swing.plaf.metal; \
+ javax.swing.plaf.multi; \
+ javax.swing.table; \
+ javax.swing.text; \
+ javax.swing.text.html; \
+ javax.swing.text.html.parser; \
+ javax.swing.text.rtf; \
+ javax.swing.tree; \
+ javax.swing.undo; \
+ javax.transaction; \
+ javax.transaction.xa; \
+ javax.xml.parsers; \
+ javax.xml.transform; \
+ javax.xml.transform.dom; \
+ javax.xml.transform.sax; \
+ javax.xml.transform.stream; \
+ org.ietf.jgss; \
+ org.omg.CORBA; \
+ org.omg.CORBA_2_3; \
+ org.omg.CORBA_2_3.portable; \
+ org.omg.CORBA.DynAnyPackage; \
+ org.omg.CORBA.ORBPackage; \
+ org.omg.CORBA.portable; \
+ org.omg.CORBA.TypeCodePackage; \
+ org.omg.CosNaming; \
+ org.omg.CosNaming.NamingContextExtPackage; \
+ org.omg.CosNaming.NamingContextPackage; \
+ org.omg.Dynamic; \
+ org.omg.DynamicAny; \
+ org.omg.DynamicAny.DynAnyFactoryPackage; \
+ org.omg.DynamicAny.DynAnyPackage; \
+ org.omg.IOP; \
+ org.omg.IOP.CodecFactoryPackage; \
+ org.omg.IOP.CodecPackage; \
+ org.omg.Messaging; \
+ org.omg.PortableInterceptor; \
+ org.omg.PortableInterceptor.ORBInitInfoPackage; \
+ org.omg.PortableServer; \
+ org.omg.PortableServer.CurrentPackage; \
+ org.omg.PortableServer.POAManagerPackage; \
+ org.omg.PortableServer.POAPackage; \
+ org.omg.PortableServer.portable; \
+ org.omg.PortableServer.ServantLocatorPackage; \
+ org.omg.SendingContext; \
+ org.omg.stub.java.rmi; \
+ org.w3c.dom; \
+ org.w3c.dom.css; \
+ org.w3c.dom.events; \
+ org.w3c.dom.html; \
+ org.w3c.dom.stylesheets; \
+ org.w3c.dom.traversal; \
+ org.w3c.dom.views; \
+ org.xml.sax; \
+ org.xml.sax.ext; \
+ org.xml.sax.helpers; \
+ version="1.4.0"
+
+jre-1.5=, \
+ javax.accessibility; \
+ javax.activity; \
+ javax.crypto; \
+ javax.crypto.interfaces; \
+ javax.crypto.spec; \
+ javax.imageio; \
+ javax.imageio.event; \
+ javax.imageio.metadata; \
+ javax.imageio.plugins.bmp; \
+ javax.imageio.plugins.jpeg; \
+ javax.imageio.spi; \
+ javax.imageio.stream; \
+ javax.management; \
+ javax.management.loading; \
+ javax.management.modelmbean; \
+ javax.management.monitor; \
+ javax.management.openmbean; \
+ javax.management.relation; \
+ javax.management.remote; \
+ javax.management.remote.rmi; \
+ javax.management.timer; \
+ javax.naming; \
+ javax.naming.directory; \
+ javax.naming.event; \
+ javax.naming.ldap; \
+ javax.naming.spi; \
+ javax.net; \
+ javax.net.ssl; \
+ javax.print; \
+ javax.print.attribute; \
+ javax.print.attribute.standard; \
+ javax.print.event; \
+ javax.rmi; \
+ javax.rmi.CORBA; \
+ javax.rmi.ssl; \
+ javax.security.auth; \
+ javax.security.auth.callback; \
+ javax.security.auth.kerberos; \
+ javax.security.auth.login; \
+ javax.security.auth.spi; \
+ javax.security.auth.x500; \
+ javax.security.sasl; \
+ javax.sound.midi; \
+ javax.sound.midi.spi; \
+ javax.sound.sampled; \
+ javax.sound.sampled.spi; \
+ javax.sql; \
+ javax.sql.rowset; \
+ javax.sql.rowset.serial; \
+ javax.sql.rowset.spi; \
+ javax.swing; \
+ javax.swing.border; \
+ javax.swing.colorchooser; \
+ javax.swing.event; \
+ javax.swing.filechooser; \
+ javax.swing.plaf; \
+ javax.swing.plaf.basic; \
+ javax.swing.plaf.metal; \
+ javax.swing.plaf.multi; \
+ javax.swing.plaf.synth; \
+ javax.swing.table; \
+ javax.swing.text; \
+ javax.swing.text.html; \
+ javax.swing.text.html.parser; \
+ javax.swing.text.rtf; \
+ javax.swing.tree; \
+ javax.swing.undo; \
+ javax.transaction; \
+ javax.transaction.xa; \
+ javax.xml; \
+ javax.xml.datatype; \
+ javax.xml.namespace; \
+ javax.xml.parsers; \
+ javax.xml.transform; \
+ javax.xml.transform.dom; \
+ javax.xml.transform.sax; \
+ javax.xml.transform.stream; \
+ javax.xml.validation; \
+ javax.xml.xpath; \
+ org.ietf.jgss; \
+ org.omg.CORBA; \
+ org.omg.CORBA_2_3; \
+ org.omg.CORBA_2_3.portable; \
+ org.omg.CORBA.DynAnyPackage; \
+ org.omg.CORBA.ORBPackage; \
+ org.omg.CORBA.portable; \
+ org.omg.CORBA.TypeCodePackage; \
+ org.omg.CosNaming; \
+ org.omg.CosNaming.NamingContextExtPackage; \
+ org.omg.CosNaming.NamingContextPackage; \
+ org.omg.Dynamic; \
+ org.omg.DynamicAny; \
+ org.omg.DynamicAny.DynAnyFactoryPackage; \
+ org.omg.DynamicAny.DynAnyPackage; \
+ org.omg.IOP; \
+ org.omg.IOP.CodecFactoryPackage; \
+ org.omg.IOP.CodecPackage; \
+ org.omg.Messaging; \
+ org.omg.PortableInterceptor; \
+ org.omg.PortableInterceptor.ORBInitInfoPackage; \
+ org.omg.PortableServer; \
+ org.omg.PortableServer.CurrentPackage; \
+ org.omg.PortableServer.POAManagerPackage; \
+ org.omg.PortableServer.POAPackage; \
+ org.omg.PortableServer.portable; \
+ org.omg.PortableServer.ServantLocatorPackage; \
+ org.omg.SendingContext; \
+ org.omg.stub.java.rmi; \
+ org.omg.stub.javax.management.remote.rmi; \
+ org.w3c.dom; \
+ org.w3c.dom.bootstrap; \
+ org.w3c.dom.css; \
+ org.w3c.dom.events; \
+ org.w3c.dom.html; \
+ org.w3c.dom.ls; \
+ org.w3c.dom.ranges; \
+ org.w3c.dom.stylesheets; \
+ org.w3c.dom.traversal; \
+ org.w3c.dom.views; \
+ org.xml.sax; \
+ org.xml.sax.ext; \
+ org.xml.sax.helpers; \
+ version="1.5.0"
+
+jre-1.6=, \
+ javax.accessibility; \
+ javax.activation; \
+ javax.activity; \
+ javax.annotation; \
+ javax.annotation.processing; \
+ javax.crypto; \
+ javax.crypto.interfaces; \
+ javax.crypto.spec; \
+ javax.imageio; \
+ javax.imageio.event; \
+ javax.imageio.metadata; \
+ javax.imageio.plugins.bmp; \
+ javax.imageio.plugins.jpeg; \
+ javax.imageio.spi; \
+ javax.imageio.stream; \
+ javax.jws; \
+ javax.jws.soap; \
+ javax.lang.model; \
+ javax.lang.model.element; \
+ javax.lang.model.type; \
+ javax.lang.model.util; \
+ javax.management; \
+ javax.management.loading; \
+ javax.management.modelmbean; \
+ javax.management.monitor; \
+ javax.management.openmbean; \
+ javax.management.relation; \
+ javax.management.remote; \
+ javax.management.remote.rmi; \
+ javax.management.timer; \
+ javax.naming; \
+ javax.naming.directory; \
+ javax.naming.event; \
+ javax.naming.ldap; \
+ javax.naming.spi; \
+ javax.net; \
+ javax.net.ssl; \
+ javax.print; \
+ javax.print.attribute; \
+ javax.print.attribute.standard; \
+ javax.print.event; \
+ javax.rmi; \
+ javax.rmi.CORBA; \
+ javax.rmi.ssl; \
+ javax.script; \
+ javax.security.auth; \
+ javax.security.auth.callback; \
+ javax.security.auth.kerberos; \
+ javax.security.auth.login; \
+ javax.security.auth.spi; \
+ javax.security.auth.x500; \
+ javax.security.cert; \
+ javax.security.sasl; \
+ javax.sound.midi; \
+ javax.sound.midi.spi; \
+ javax.sound.sampled; \
+ javax.sound.sampled.spi; \
+ javax.sql; \
+ javax.sql.rowset; \
+ javax.sql.rowset.serial; \
+ javax.sql.rowset.spi; \
+ javax.swing; \
+ javax.swing.border; \
+ javax.swing.colorchooser; \
+ javax.swing.event; \
+ javax.swing.filechooser; \
+ javax.swing.plaf; \
+ javax.swing.plaf.basic; \
+ javax.swing.plaf.metal; \
+ javax.swing.plaf.multi; \
+ javax.swing.plaf.synth; \
+ javax.swing.table; \
+ javax.swing.text; \
+ javax.swing.text.html; \
+ javax.swing.text.html.parser; \
+ javax.swing.text.rtf; \
+ javax.swing.tree; \
+ javax.swing.undo; \
+ javax.tools; \
+ javax.transaction; \
+ javax.transaction.xa; \
+ javax.xml; \
+ javax.xml.bind; \
+ javax.xml.bind.annotation; \
+ javax.xml.bind.annotation.adapters; \
+ javax.xml.bind.attachment; \
+ javax.xml.bind.helpers; \
+ javax.xml.bind.util; \
+ javax.xml.crypto; \
+ javax.xml.crypto.dom; \
+ javax.xml.crypto.dsig; \
+ javax.xml.crypto.dsig.dom; \
+ javax.xml.crypto.dsig.keyinfo; \
+ javax.xml.crypto.dsig.spec; \
+ javax.xml.datatype; \
+ javax.xml.namespace; \
+ javax.xml.parsers; \
+ javax.xml.soap; \
+ javax.xml.stream; \
+ javax.xml.stream.events; \
+ javax.xml.stream.util; \
+ javax.xml.transform; \
+ javax.xml.transform.dom; \
+ javax.xml.transform.sax; \
+ javax.xml.transform.stax; \
+ javax.xml.transform.stream; \
+ javax.xml.validation; \
+ javax.xml.ws; \
+ javax.xml.ws.handler; \
+ javax.xml.ws.handler.soap; \
+ javax.xml.ws.http; \
+ javax.xml.ws.soap; \
+ javax.xml.ws.spi; \
+ javax.xml.xpath; \
+ org.ietf.jgss; \
+ org.omg.CORBA; \
+ org.omg.CORBA_2_3; \
+ org.omg.CORBA_2_3.portable; \
+ org.omg.CORBA.DynAnyPackage; \
+ org.omg.CORBA.ORBPackage; \
+ org.omg.CORBA.portable; \
+ org.omg.CORBA.TypeCodePackage; \
+ org.omg.CosNaming; \
+ org.omg.CosNaming.NamingContextExtPackage; \
+ org.omg.CosNaming.NamingContextPackage; \
+ org.omg.Dynamic; \
+ org.omg.DynamicAny; \
+ org.omg.DynamicAny.DynAnyFactoryPackage; \
+ org.omg.DynamicAny.DynAnyPackage; \
+ org.omg.IOP; \
+ org.omg.IOP.CodecFactoryPackage; \
+ org.omg.IOP.CodecPackage; \
+ org.omg.Messaging; \
+ org.omg.PortableInterceptor; \
+ org.omg.PortableInterceptor.ORBInitInfoPackage; \
+ org.omg.PortableServer; \
+ org.omg.PortableServer.CurrentPackage; \
+ org.omg.PortableServer.POAManagerPackage; \
+ org.omg.PortableServer.POAPackage; \
+ org.omg.PortableServer.portable; \
+ org.omg.PortableServer.ServantLocatorPackage; \
+ org.omg.SendingContext; \
+ org.omg.stub.java.rmi; \
+ org.omg.stub.javax.management.remote.rmi; \
+ org.w3c.dom; \
+ org.w3c.dom.bootstrap; \
+ org.w3c.dom.css; \
+ org.w3c.dom.events; \
+ org.w3c.dom.html; \
+ org.w3c.dom.ls; \
+ org.w3c.dom.ranges; \
+ org.w3c.dom.stylesheets; \
+ org.w3c.dom.traversal; \
+ org.w3c.dom.views; \
+ org.w3c.dom.xpath; \
+ org.xml.sax; \
+ org.xml.sax.ext; \
+ org.xml.sax.helpers; \
+ version=\"1.6.0\"

Modified: felix/trunk/main/pom.xml
URL: http://svn.apache.org/viewvc/felix/trunk/main/pom.xml?rev=705350&r1=705349&r2=705350&view=diff
==============================================================================
--- felix/trunk/main/pom.xml (original)
+++ felix/trunk/main/pom.xml Thu Oct 16 13:22:58 2008
@@ -105,14 +105,15 @@
             <Bundle-Name>Apache Felix</Bundle-Name>
             <Bundle-Description>OSGi R4 framework.</Bundle-Description>
             <Bundle-Vendor>The Apache Software Foundation</Bundle-Vendor>
-            <Private-Package>org.apache.felix.main.*,org.apache.felix.moduleloader.*;org.apache.felix.framework.*;org.osgi.framework;org.osgi.framework.launch;org.osgi.service.packageadmin;org.osgi.service.startlevel;org.osgi.service.url;org.osgi.util.tracker;-split-package:=merge-first</Private-Package>
+            <Embed-Dependency>*;artifactId=org.apache.felix.framework;inline=true</Embed-Dependency>
+            <Private-Package>org.apache.felix.main.*</Private-Package>
             <Import-Package>!*</Import-Package>
             <Include-Resource>META-INF/LICENSE=LICENSE,META-INF/NOTICE=NOTICE,{src/main/resources/}</Include-Resource>
             <!-- Include these properties here because we want them
-                 substituted in the default.properties resource file
+                 substituted in the config.properties resource file
                  so that we only have to maintain one set of properties
-                 and only for that reason. -->
-            <_include>src/main/resources/config.properties</_include>
+                 and only for that reason. 
+            <_include>default.properties</_include> -->
           </instructions>
         </configuration>
       </plugin>

Modified: felix/trunk/main/src/main/java/org/apache/felix/main/Main.java
URL: http://svn.apache.org/viewvc/felix/trunk/main/src/main/java/org/apache/felix/main/Main.java?rev=705350&r1=705349&r2=705350&view=diff
==============================================================================
--- felix/trunk/main/src/main/java/org/apache/felix/main/Main.java (original)
+++ felix/trunk/main/src/main/java/org/apache/felix/main/Main.java Thu Oct 16 13:22:58 2008
@@ -24,6 +24,7 @@
 import java.util.*;
 import org.apache.felix.framework.Felix;
 import org.apache.felix.framework.util.FelixConstants;
+import org.apache.felix.framework.util.Util;
 import org.osgi.framework.Constants;
 
 /**
@@ -55,10 +56,6 @@
      * The default name used for the configuration properties file.
     **/
     public static final String CONFIG_PROPERTIES_FILE_VALUE = "config.properties";
-    /**
-     * The default name used for the default configuration properties file.
-    **/
-    public static final String DEFAULT_PROPERTIES_FILE_VALUE = "default.properties";
 
     private static Felix m_felix = null;
 
@@ -322,7 +319,7 @@
         {
             String name = (String) e.nextElement();
             System.setProperty(name,
-                substVars(props.getProperty(name), name, null, null));
+                Util.substVars(props.getProperty(name), name, null, null));
         }
     }
 
@@ -421,30 +418,7 @@
                 // Nothing we can do.
             }
 
-            // If we cannot the configuration properties for any reason, then just
-            // attempt to load resource default.properties instead.
-            propURL = Main.class.getClassLoader().getResource(DEFAULT_PROPERTIES_FILE_VALUE);
-            try
-            {
-                is = propURL.openConnection().getInputStream();
-                props.load(is);
-                is.close();
-                System.err.println("\nUsing default configuration properties.");
-            }
-            catch (Exception ex2)
-            {
-                // Try to close input stream if we have one.
-                try
-                {
-                    if (is != null) is.close();
-                }
-                catch (IOException ex3)
-                {
-                    // Nothing we can do.
-                }
-                System.err.println("\nUnable to load any configuration properties.");
-                return null;
-            }
+            return null;
         }
 
         // Perform variable substitution for system properties.
@@ -452,7 +426,7 @@
         {
             String name = (String) e.nextElement();
             props.setProperty(name,
-                substVars(props.getProperty(name), name, null, props));
+                Util.substVars(props.getProperty(name), name, null, props));
         }
 
         return props;
@@ -470,128 +444,4 @@
             }
         }
     }
-
-    private static final String DELIM_START = "${";
-    private static final String DELIM_STOP  = "}";
-
-    /**
-     * <p>
-     * This method performs property variable substitution on the
-     * specified value. If the specified value contains the syntax
-     * <tt>${&lt;prop-name&gt;}</tt>, where <tt>&lt;prop-name&gt;</tt>
-     * refers to either a configuration property or a system property,
-     * then the corresponding property value is substituted for the variable
-     * placeholder. Multiple variable placeholders may exist in the
-     * specified value as well as nested variable placeholders, which
-     * are substituted from inner most to outer most. Configuration
-     * properties override system properties.
-     * </p>
-     * @param val The string on which to perform property substitution.
-     * @param currentKey The key of the property being evaluated used to
-     *        detect cycles.
-     * @param cycleMap Map of variable references used to detect nested cycles.
-     * @param configProps Set of configuration properties.
-     * @return The value of the specified string after system property substitution.
-     * @throws IllegalArgumentException If there was a syntax error in the
-     *         property placeholder syntax or a recursive variable reference.
-    **/
-    public static String substVars(String val, String currentKey,
-        Map cycleMap, Properties configProps)
-        throws IllegalArgumentException
-    {
-        // If there is currently no cycle map, then create
-        // one for detecting cycles for this invocation.
-        if (cycleMap == null)
-        {
-            cycleMap = new HashMap();
-        }
-
-        // Put the current key in the cycle map.
-        cycleMap.put(currentKey, currentKey);
-
-        // Assume we have a value that is something like:
-        // "leading ${foo.${bar}} middle ${baz} trailing"
-
-        // Find the first ending '}' variable delimiter, which
-        // will correspond to the first deepest nested variable
-        // placeholder.
-        int stopDelim = val.indexOf(DELIM_STOP);
-
-        // Find the matching starting "${" variable delimiter
-        // by looping until we find a start delimiter that is
-        // greater than the stop delimiter we have found.
-        int startDelim = val.indexOf(DELIM_START);
-        while (stopDelim >= 0)
-        {
-            int idx = val.indexOf(DELIM_START, startDelim + DELIM_START.length());
-            if ((idx < 0) || (idx > stopDelim))
-            {
-                break;
-            }
-            else if (idx < stopDelim)
-            {
-                startDelim = idx;
-            }
-        }
-
-        // If we do not have a start or stop delimiter, then just
-        // return the existing value.
-        if ((startDelim < 0) && (stopDelim < 0))
-        {
-            return val;
-        }
-        // At this point, we found a stop delimiter without a start,
-        // so throw an exception.
-        else if (((startDelim < 0) || (startDelim > stopDelim))
-            && (stopDelim >= 0))
-        {
-            throw new IllegalArgumentException(
-                "stop delimiter with no start delimiter: "
-                + val);
-        }
-
-        // At this point, we have found a variable placeholder so
-        // we must perform a variable substitution on it.
-        // Using the start and stop delimiter indices, extract
-        // the first, deepest nested variable placeholder.
-        String variable =
-            val.substring(startDelim + DELIM_START.length(), stopDelim);
-
-        // Verify that this is not a recursive variable reference.
-        if (cycleMap.get(variable) != null)
-        {
-            throw new IllegalArgumentException(
-                "recursive variable reference: " + variable);
-        }
-
-        // Get the value of the deepest nested variable placeholder.
-        // Try to configuration properties first.
-        String substValue = (configProps != null)
-            ? configProps.getProperty(variable, null)
-            : null;
-        if (substValue == null)
-        {
-            // Ignore unknown property values.
-            substValue = System.getProperty(variable, "");
-        }
-
-        // Remove the found variable from the cycle map, since
-        // it may appear more than once in the value and we don't
-        // want such situations to appear as a recursive reference.
-        cycleMap.remove(variable);
-
-        // Append the leading characters, the substituted value of
-        // the variable, and the trailing characters to get the new
-        // value.
-        val = val.substring(0, startDelim)
-            + substValue
-            + val.substring(stopDelim + DELIM_STOP.length(), val.length());
-
-        // Now perform substitution again, since there could still
-        // be substitutions to make.
-        val = substVars(val, currentKey, cycleMap, configProps);
-
-        // Return the value.
-        return val;
-    }
 }
\ No newline at end of file

Modified: felix/trunk/main/src/main/resources/config.properties
URL: http://svn.apache.org/viewvc/felix/trunk/main/src/main/resources/config.properties?rev=705350&r1=705349&r2=705350&view=diff
==============================================================================
--- felix/trunk/main/src/main/resources/config.properties (original)
+++ felix/trunk/main/src/main/resources/config.properties Thu Oct 16 13:22:58 2008
@@ -18,12 +18,14 @@
 #
 # Framework config properties.
 #
-org.osgi.framework.system.packages=org.osgi.framework; version=1.4.0, \
- org.osgi.service.packageadmin; version=1.2.0, \
- org.osgi.service.startlevel; version=1.1.0, \
- org.osgi.service.url; version=1.0.0, \
- org.osgi.util.tracker; version=1.3.3 \
- ${jre-${java.specification.version}}
+
+# To override the packages the framework exports by default from the
+# class path, set this variable.
+#org.osgi.framework.system.packages=
+
+# To append packages to the default set of exported system packages,
+# set this value.
+#org.osgi.framework.system.packages.extra=
 
 # The following property makes specified packages from the class path
 # available to all bundles. You should avoid using this property.
@@ -51,8 +53,12 @@
  file:bundle/org.apache.felix.shell.tui-1.1.0-SNAPSHOT.jar \
  file:bundle/org.apache.felix.bundlerepository-1.3.0-SNAPSHOT.jar 
 felix.log.level=4
-felix.startlevel.framework=1
-felix.startlevel.bundle=1
+
+# Sets the initial start level of the framework upon startup.
+#org.osgi.framework.startlevel=1
+
+# Sets the start level of newly installed bundles.
+#felix.startlevel.bundle=1
 
 # Invalid fragment bundles throw an 'exception' by default, but
 # uncomment the follow line to have them log a 'warning' instead.
@@ -65,6 +71,7 @@
 #
 # Bundle config properties.
 #
+
 org.osgi.service.http.port=8080
 osgi.shell.telnet=on
 obr.repository.url=http://felix.apache.org/obr/releases.xml
@@ -73,6 +80,7 @@
 #
 # Java platform package export properties.
 #
+
 jre-1.3=, \
  javax.accessibility; \
  javax.naming; \



Mime
View raw message