Modified the bundle cache to no longer have profiles. Instead, it defaults
to creating a directory called "felix-cache" in the current working directory.
Added a config property to specify the precise location of the cache directory,
as well as a property to control the root directory for creating cache
directories if a relative cache directory is specified. Modified main to
deal with the changes; main is no longer interactive. However, it now accepts
a single argument, which is the bundle cache directory to use. (FELIX-754)


git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@703190 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/main/pom.xml b/main/pom.xml
index 862c9fe..c05044e 100644
--- a/main/pom.xml
+++ b/main/pom.xml
@@ -88,6 +88,7 @@
   </dependencies>
   <properties>
     <property name="install.home" value="${basedir.absolutePath}" />
+    <dollar>$</dollar>
   </properties>
   <build>
     <plugins>
@@ -112,7 +113,6 @@
                  so that we only have to maintain one set of properties
                  and only for that reason. -->
             <_include>src/main/resources/config.properties</_include>
-            <dollar>$</dollar>
           </instructions>
         </configuration>
       </plugin>
diff --git a/main/src/main/java/org/apache/felix/main/Main.java b/main/src/main/java/org/apache/felix/main/Main.java
index 9a68dc7..c98925a 100644
--- a/main/src/main/java/org/apache/felix/main/Main.java
+++ b/main/src/main/java/org/apache/felix/main/Main.java
@@ -166,8 +166,16 @@
      * @throws Exception If an error occurs.
     **/
 
-    public static void main(String[] argv) throws Exception
+    public static void main(String[] args) throws Exception
     {
+        // We support at most one argument, which is the bundle
+        // cache directory.
+        if (args.length > 1)
+        {
+            System.out.println("Usage: [<bundle-cache-dir>]");
+            System.exit(0);
+        }
+
         // Load system properties.
         Main.loadSystemProperties();
 
@@ -177,55 +185,17 @@
         // Copy framework properties from the system properties.
         Main.copySystemProperties(configProps);
 
-        // See if the profile name property was specified.
-        String profileName = configProps.getProperty(BundleCache.CACHE_PROFILE_PROP);
-
-        // See if the profile directory property was specified.
-        String profileDirName = configProps.getProperty(BundleCache.CACHE_PROFILE_DIR_PROP);
-        profileDirName = (profileDirName == null)
-            ? configProps.getProperty(SystemBundle.FRAMEWORK_STORAGE_PROP)
-            : profileDirName;
+        // If there is a passed in bundle cache directory, then
+        // that overwrites anything in the config file.
+        if (args.length > 0)
+        {
+            configProps.setProperty(SystemBundle.FRAMEWORK_STORAGE_PROP, args[0]);
+        }
 
         // Print welcome banner.
         System.out.println("\nWelcome to Felix.");
         System.out.println("=================\n");
 
-        // If no profile or profile directory is specified in the
-        // properties, then ask for a profile name.
-        if ((profileName == null) && (profileDirName == null))
-        {
-            System.out.print("Enter profile name: ");
-            BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
-            try
-            {
-                profileName = in.readLine();
-            }
-            catch (IOException ex)
-            {
-                System.err.println("Could not read input.");
-                System.exit(-1);
-            }
-            System.out.println("");
-
-            // On some platforms readLine() can return null, such as when
-            // control-C is pressed, so check for that case.
-            if (profileName == null)
-            {
-                profileName = "";
-            }
-            else if (profileName.length() != 0)
-            {
-                configProps.setProperty(BundleCache.CACHE_PROFILE_PROP, profileName);
-            }
-        }
-
-        // A profile directory or name must be specified.
-        if ((profileDirName == null) && (profileName.length() == 0))
-        {
-            System.err.println("You must specify a profile name or directory.");
-            System.exit(-1);
-        }
-
         try
         {
             // Create a list for custom framework activators and
diff --git a/main/src/main/resources/config.properties b/main/src/main/resources/config.properties
index 3958c58..9b2d9cc 100644
--- a/main/src/main/resources/config.properties
+++ b/main/src/main/resources/config.properties
@@ -25,8 +25,22 @@
  org.osgi.util.tracker; version=1.3.3 \
  ${jre-${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.*
-#felix.cache.profile=foo
+
+# 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=${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.auto.start.1= \
  file:bundle/org.apache.felix.shell-1.1.0-SNAPSHOT.jar \
  file:bundle/org.apache.felix.shell.tui-1.1.0-SNAPSHOT.jar \
diff --git a/main/src/main/resources/default.properties b/main/src/main/resources/default.properties
index a431179..cef2e2f 100644
--- a/main/src/main/resources/default.properties
+++ b/main/src/main/resources/default.properties
@@ -25,12 +25,33 @@
  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.*
-#felix.cache.profile=foo
+
+# 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=${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
-#framework.service.urlhandlers=false
+
+# 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.