servicemix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gno...@apache.org
Subject svn commit: r579258 - in /incubator/servicemix/branches/servicemix-4.0: ./ apache-servicemix/ apache-servicemix/src/main/installers/ daemon/src/main/java/org/apache/felix/daemon/ examples/intermediary/src/main/java/org/apache/servicemix/examples/interm...
Date Tue, 25 Sep 2007 14:28:43 GMT
Author: gnodet
Date: Tue Sep 25 07:28:42 2007
New Revision: 579258

URL: http://svn.apache.org/viewvc?rev=579258&view=rev
Log:
Simplify the startup config by not including the list of jars but using all the bundles in
./bundle

Added:
    incubator/servicemix/branches/servicemix-4.0/main/
    incubator/servicemix/branches/servicemix-4.0/main/pom.xml
      - copied, changed from r579245, felix/releases/main-1.0.1/pom.xml
    incubator/servicemix/branches/servicemix-4.0/main/src/
    incubator/servicemix/branches/servicemix-4.0/main/src/main/
    incubator/servicemix/branches/servicemix-4.0/main/src/main/java/
    incubator/servicemix/branches/servicemix-4.0/main/src/main/java/org/
    incubator/servicemix/branches/servicemix-4.0/main/src/main/java/org/apache/
    incubator/servicemix/branches/servicemix-4.0/main/src/main/java/org/apache/felix/
    incubator/servicemix/branches/servicemix-4.0/main/src/main/java/org/apache/felix/main/
    incubator/servicemix/branches/servicemix-4.0/main/src/main/java/org/apache/felix/main/Main.java
      - copied, changed from r579246, felix/releases/main-1.0.1/src/main/java/org/apache/felix/main/Main.java
    incubator/servicemix/branches/servicemix-4.0/main/src/main/resources/
    incubator/servicemix/branches/servicemix-4.0/main/src/main/resources/config.properties
      - copied unchanged from r579246, felix/releases/main-1.0.1/src/main/resources/config.properties
Modified:
    incubator/servicemix/branches/servicemix-4.0/apache-servicemix/pom.xml
    incubator/servicemix/branches/servicemix-4.0/apache-servicemix/src/main/installers/config.properties
    incubator/servicemix/branches/servicemix-4.0/apache-servicemix/src/main/installers/servicemix.sh
    incubator/servicemix/branches/servicemix-4.0/daemon/src/main/java/org/apache/felix/daemon/Service.java
    incubator/servicemix/branches/servicemix-4.0/examples/intermediary/src/main/java/org/apache/servicemix/examples/intermediary/IntermediaryRoutes.java
    incubator/servicemix/branches/servicemix-4.0/pom.xml

Modified: incubator/servicemix/branches/servicemix-4.0/apache-servicemix/pom.xml
URL: http://svn.apache.org/viewvc/incubator/servicemix/branches/servicemix-4.0/apache-servicemix/pom.xml?rev=579258&r1=579257&r2=579258&view=diff
==============================================================================
--- incubator/servicemix/branches/servicemix-4.0/apache-servicemix/pom.xml (original)
+++ incubator/servicemix/branches/servicemix-4.0/apache-servicemix/pom.xml Tue Sep 25 07:28:42
2007
@@ -53,9 +53,9 @@
 
     <!-- Felix Dependencies -->
     <dependency>
-      <groupId>org.apache.felix</groupId>
+      <groupId>org.apache.servicemix</groupId>
       <artifactId>org.apache.felix.main</artifactId>
-      <version>${felix.version}</version>
+      <version>${pom.version}</version>
     </dependency>
     <dependency>
       <groupId>org.apache.servicemix</groupId>
@@ -184,7 +184,7 @@
             <exclude>xerces:xercesImpl</exclude>
 			<exclude>aopalliance:aopalliance</exclude>
 			<exclude>commons-logging:commons-logging</exclude>
-            <exclude>org.apache.felix:org.apache.felix.main</exclude>
+            <exclude>org.apache.servicemix:org.apache.felix.main</exclude>
             <exclude>org.apache.felix:org.apache.felix.framework</exclude>
             <exclude>org.apache.felix:org.apache.felix.shell</exclude>
             <exclude>org.apache.felix:org.apache.felix.shell.tui</exclude>
@@ -324,7 +324,7 @@
             </packagedFile>
             <packagedFile>
               <dependency>true</dependency>
-              <source>org.apache.felix:org.apache.felix.main</source>
+              <source>org.apache.servicemix:org.apache.felix.main</source>
               <destinationPath>
                 bin/servicemix.jar
               </destinationPath>

Modified: incubator/servicemix/branches/servicemix-4.0/apache-servicemix/src/main/installers/config.properties
URL: http://svn.apache.org/viewvc/incubator/servicemix/branches/servicemix-4.0/apache-servicemix/src/main/installers/config.properties?rev=579258&r1=579257&r2=579258&view=diff
==============================================================================
--- incubator/servicemix/branches/servicemix-4.0/apache-servicemix/src/main/installers/config.properties
(original)
+++ incubator/servicemix/branches/servicemix-4.0/apache-servicemix/src/main/installers/config.properties
Tue Sep 25 07:28:42 2007
@@ -25,29 +25,12 @@
  org.osgi.service.url; version=1.0.0, \
  ${jre-${java.specification.version}}
 #org.osgi.framework.bootdelegation=sun.*,com.sun.*
-felix.auto.start.1= \
-   "file:${servicemix.home}/bundle/org.apache.felix.shell-1.0.0.jar" \
-   "file:${servicemix.home}/bundle/org.apache.felix.shell.tui-1.0.0.jar" \
-   "file:${servicemix.home}/bundle/org.apache.felix.bundlerepository-1.0.0.jar" \
-   "file:${servicemix.home}/bundle/telnetd.jar" \
-   "file:${servicemix.home}/bundle/org.springframework.spring-osgi-extender-1.0-m3-SNAPSHOT.jar"
\
-   "file:${servicemix.home}/bundle/org.springframework.spring-osgi-core-1.0-m3-SNAPSHOT.jar"
\
-   "file:${servicemix.home}/bundle/org.springframework.spring-osgi-io-1.0-m3-SNAPSHOT.jar"
\
-   "file:${servicemix.home}/bundle/org.springframework.spring-context-2.1-m4.jar" \
-   "file:${servicemix.home}/bundle/org.springframework.spring-beans-2.1-m4.jar" \
-   "file:${servicemix.home}/bundle/org.springframework.spring-core-2.1-m4.jar" \
-   "file:${servicemix.home}/bundle/org.springframework.spring-aop-2.1-m4.jar" \
-   "file:${servicemix.home}/bundle/org.apache.servicemix.nmr-4.0-SNAPSHOT.jar" \
-   "file:${servicemix.home}/bundle/org.apache.servicemix.spring-4.0-SNAPSHOT.jar" \
-   "file:${servicemix.home}/bundle/org.apache.servicemix.core-4.0-SNAPSHOT.jar" \
-   "file:${servicemix.home}/bundle/org.apache.servicemix.api-4.0-SNAPSHOT.jar" \
-   "file:${servicemix.home}/bundle/org.apache.camel.core-1.1-SNAPSHOT.jar" \
-   "file:${servicemix.home}/bundle/org.apache.geronimo.specs.activation_1.1_spec-1.0.1-SNAPSHOT.jar"
\
-   "file:${servicemix.home}/bundle/org.apache.servicemix.bundles.jaxb-api-2.0-4.0-SNAPSHOT.jar"
\
-   "file:${servicemix.home}/bundle/org.apache.servicemix.bundles.jaxb-impl-2.0.3-4.0-SNAPSHOT.jar"
\
-   "file:${servicemix.home}/bundle/org.apache.servicemix.bundles.commons-logging-1.1-4.0-SNAPSHOT.jar"
\
-   "file:${servicemix.home}/bundle/org.apache.servicemix.bundles.log4j-1.2.14-4.0-SNAPSHOT.jar"
\
-   "file:${servicemix.home}/bundle/org.apache.servicemix.bundles.aopalliance-1.0-4.0-SNAPSHOT.jar"
+felix.auto.start=true
+#felix.auto.start.1= \
+#   "file:${servicemix.home}/bundle/org.apache.felix.shell-1.0.0.jar" \
+#   "file:${servicemix.home}/bundle/org.apache.felix.shell.tui-1.0.0.jar" \
+#   "file:${servicemix.home}/bundle/org.apache.felix.bundlerepository-1.0.0.jar" \
+#   "file:${servicemix.home}/bundle/telnetd.jar"
 felix.startlevel.framework=1
 felix.startlevel.bundle=1
 felix.cache.profiledir=${servicemix.home}/var/cache

Modified: incubator/servicemix/branches/servicemix-4.0/apache-servicemix/src/main/installers/servicemix.sh
URL: http://svn.apache.org/viewvc/incubator/servicemix/branches/servicemix-4.0/apache-servicemix/src/main/installers/servicemix.sh?rev=579258&r1=579257&r2=579258&view=diff
==============================================================================
--- incubator/servicemix/branches/servicemix-4.0/apache-servicemix/src/main/installers/servicemix.sh
(original)
+++ incubator/servicemix/branches/servicemix-4.0/apache-servicemix/src/main/installers/servicemix.sh
Tue Sep 25 07:28:42 2007
@@ -233,7 +233,7 @@
     cd "$SERVICEMIX_HOME"
     if [ "x$1" = "x" ] ; then
         #exec $JAVA $JAVA_OPTS -Dservicemix.home="$SERVICEMIX_HOME" -jar "$JAR" "$SERVICEMIX_HOME"
start 
-        exec $JAVA $JAVA_OPTS -Dlog4j.configuration=file:$SERVICEMIX_HOME/conf/log4j.xml
-Dfelix.config.properties=file:$SERVICEMIX_HOME/conf/config.properties -Dservicemix.home="$SERVICEMIX_HOME"
-jar bin/servicemix.jar
+        exec $JAVA $JAVA_OPTS -Dlog4j.configuration=file:$SERVICEMIX_HOME/conf/log4j.xml
-Dservicemix.home="$SERVICEMIX_HOME" -jar bin/servicemix.jar
     else
         exec $JAVA $JAVA_OPTS -Dservicemix.home="$SERVICEMIX_HOME" -jar "$JAR" "$SERVICEMIX_HOME"
"$1" 
     fi

Modified: incubator/servicemix/branches/servicemix-4.0/daemon/src/main/java/org/apache/felix/daemon/Service.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/branches/servicemix-4.0/daemon/src/main/java/org/apache/felix/daemon/Service.java?rev=579258&r1=579257&r2=579258&view=diff
==============================================================================
--- incubator/servicemix/branches/servicemix-4.0/daemon/src/main/java/org/apache/felix/daemon/Service.java
(original)
+++ incubator/servicemix/branches/servicemix-4.0/daemon/src/main/java/org/apache/felix/daemon/Service.java
Tue Sep 25 07:28:42 2007
@@ -23,9 +23,7 @@
 import org.apache.felix.framework.cache.BundleCache;
 import org.apache.felix.framework.util.StringMap;
 
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.InputStream;
+import java.io.*;
 import java.net.MalformedURLException;
 import java.net.URL;
 import java.util.Enumeration;
@@ -47,6 +45,8 @@
     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 property for auto-discovering the bundles **/
+    public static final String PROPERTY_AUTO_START = "felix.auto.start";
 
     /** the instance of Felix managed by this daemon/service */
     private Felix instance;
@@ -72,8 +72,10 @@
         {
             this.layout = ( FelixLayout ) suppliedLayout;
         }
-        
+
+        new Exception().printStackTrace();
         configationProperties = readConfigProperties();
+        processConfigurationProperties(configationProperties);
         instance = new Felix(new StringMap(configationProperties, false ), null );
     }
 
@@ -216,6 +218,29 @@
         }
 
         return props;
+    }
+
+    /**
+     * Process properties to customize default felix behavior
+     */
+    protected void processConfigurationProperties(Properties props) {
+        if (Boolean.parseBoolean(props.getProperty(PROPERTY_AUTO_START))) {
+            File[] bundles = layout.getBundleDirectory().listFiles(new FileFilter() {
+                public boolean accept(File pathname) {
+                    return pathname.toString().endsWith(".jar");
+                }
+            });
+            StringBuffer sb = new StringBuffer();
+            for (int i = 0; i < bundles.length; i++) {
+                try {
+                    sb.append("\"").append(bundles[i].toURL().toString()).append("\" ");
+                } catch (MalformedURLException e) {
+                    System.err.print( "Ignoring " + bundles[i].toString() + " (" + e + ")"
);
+                }
+            }
+            props.setProperty("felix.auto.start.1", sb.toString());
+            props.remove(PROPERTY_AUTO_START);
+        }
     }
 
     

Modified: incubator/servicemix/branches/servicemix-4.0/examples/intermediary/src/main/java/org/apache/servicemix/examples/intermediary/IntermediaryRoutes.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/branches/servicemix-4.0/examples/intermediary/src/main/java/org/apache/servicemix/examples/intermediary/IntermediaryRoutes.java?rev=579258&r1=579257&r2=579258&view=diff
==============================================================================
--- incubator/servicemix/branches/servicemix-4.0/examples/intermediary/src/main/java/org/apache/servicemix/examples/intermediary/IntermediaryRoutes.java
(original)
+++ incubator/servicemix/branches/servicemix-4.0/examples/intermediary/src/main/java/org/apache/servicemix/examples/intermediary/IntermediaryRoutes.java
Tue Sep 25 07:28:42 2007
@@ -32,7 +32,7 @@
         Predicate isNack           = bean(Predicate.class, name + ".isNackExpression");
 
         from(request).
-            group(name + ": Route 1").
+            group(name + ": Client Request").
             tryBlock().
                 to(requestStorage).
                 setOutBody(constant(ack)).
@@ -40,7 +40,7 @@
                 setFaultBody(constant(nack));
 
         from(requestStorage).
-            group(name + ": Route 2").
+            group(name + ": Backend request").
             to(requestTransformer).
             to(requestProvider).
             filter(isNack).
@@ -48,7 +48,7 @@
             to(dbStorer);
 
         from(responseConsumer).
-            group(name + ": Route 3").
+            group(name + ": Backend response").
             tryBlock().
                 to(responseStorage).
                 setOutBody(constant(ack)).
@@ -56,12 +56,12 @@
                 setFaultBody(constant(nack));
 
         from(responseStorage).
-            group(name + ": Route 4").
+            group(name + ": Response processing").
             to(responseTransformer).
             to(dbStorer);
 
         from(response).
-            group(name + ": Route 5").
+            group(name + ": Client response").
             to(dbLoader);
     }
 

Copied: incubator/servicemix/branches/servicemix-4.0/main/pom.xml (from r579245, felix/releases/main-1.0.1/pom.xml)
URL: http://svn.apache.org/viewvc/incubator/servicemix/branches/servicemix-4.0/main/pom.xml?p2=incubator/servicemix/branches/servicemix-4.0/main/pom.xml&p1=felix/releases/main-1.0.1/pom.xml&r1=579245&r2=579258&rev=579258&view=diff
==============================================================================
--- felix/releases/main-1.0.1/pom.xml (original)
+++ incubator/servicemix/branches/servicemix-4.0/main/pom.xml Tue Sep 25 07:28:42 2007
@@ -1,41 +1,44 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
 <!--
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements.  See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership.  The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License.  You may obtain a copy of the License at
-
-    http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied.  See the License for the
- specific language governing permissions and limitations
- under the License.
+
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You under the Apache License, Version 2.0
+    (the "License"); you may not use this file except in compliance with
+    the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
 -->
-<project>
- <parent>
-    <groupId>org.apache.felix</groupId>
-    <artifactId>felix</artifactId>
-    <version>1.0.0</version>
-    <relativePath>../pom/pom.xml</relativePath>
-  </parent>
+
   <modelVersion>4.0.0</modelVersion>
+
+  <parent>
+    <groupId>org.apache.servicemix</groupId>
+    <artifactId>servicemix</artifactId>
+    <version>4.0-SNAPSHOT</version>
+  </parent>
+
+  <artifactId>org.apache.felix.main</artifactId>
   <packaging>bundle</packaging>
   <name>Apache Felix Main</name>
-  <artifactId>org.apache.felix.main</artifactId>
-  <version>1.0.1</version>
+
   <dependencies>
     <dependency>
-      <groupId>${pom.groupId}</groupId>
+      <groupId>org.apache.felix</groupId>
       <artifactId>org.apache.felix.framework</artifactId>
-      <version>1.0.1</version>
+      <version>${felix.version}</version>
       <exclusions>
         <exclusion>
-          <groupId>${pom.groupId}</groupId>
+          <groupId>org.apache.felix</groupId>
           <artifactId>org.osgi.core</artifactId>
         </exclusion>
         <!--exclusion>
@@ -47,34 +50,34 @@
       </exclusions>
     </dependency>
     <dependency>
-      <groupId>${pom.groupId}</groupId>
+      <groupId>org.apache.felix</groupId>
       <artifactId>org.apache.felix.shell</artifactId>
-      <version>1.0.0</version>
+      <version>${felix.version}</version>
       <exclusions>
         <exclusion>
-          <groupId>${pom.groupId}</groupId>
+	      <groupId>org.apache.felix</groupId>
           <artifactId>org.osgi.core</artifactId>
         </exclusion>
       </exclusions>
     </dependency>
     <dependency>
-      <groupId>${pom.groupId}</groupId>
+      <groupId>org.apache.felix</groupId>
       <artifactId>org.apache.felix.shell.tui</artifactId>
-      <version>1.0.0</version>
+      <version>${felix.version}</version>
       <exclusions>
         <exclusion>
-          <groupId>${pom.groupId}</groupId>
+	      <groupId>org.apache.felix</groupId>
           <artifactId>org.osgi.core</artifactId>
         </exclusion>
       </exclusions>
     </dependency>
     <dependency>
-      <groupId>${pom.groupId}</groupId>
+      <groupId>org.apache.felix</groupId>
       <artifactId>org.apache.felix.bundlerepository</artifactId>
-      <version>1.0.0</version>
+      <version>${felix.version}</version>
       <exclusions>
         <exclusion>
-          <groupId>${pom.groupId}</groupId>
+	      <groupId>org.apache.felix</groupId>
           <artifactId>org.osgi.core</artifactId>
         </exclusion>
         <exclusion>
@@ -92,7 +95,7 @@
       <plugin>
         <groupId>org.apache.felix</groupId>
         <artifactId>maven-bundle-plugin</artifactId>
-        <version>1.0.0</version>
+        <version>${felix.version}</version>
         <extensions>true</extensions>
         <configuration>
           <instructions>
@@ -117,12 +120,12 @@
               <goal>unpack</goal>
             </goals>
             <configuration>
-               <outputDirectory>${project.build.outputDirectory}</outputDirectory>
+              <outputDirectory>${project.build.outputDirectory}</outputDirectory>
               <artifactItems>
                 <artifactItem>
-                  <groupId>${pom.groupId}</groupId>
+			      <groupId>org.apache.felix</groupId>
                   <artifactId>org.apache.felix.framework</artifactId>
-                  <version>1.0.1</version>
+                  <version>${felix.version}</version>
                 </artifactItem>
               </artifactItems>
             </configuration>
@@ -136,25 +139,25 @@
             <configuration>
                 <artifactItems>
                   <artifactItem>
-                     <groupId>${pom.groupId}</groupId>
+			      <groupId>org.apache.felix</groupId>
                      <artifactId>org.apache.felix.shell</artifactId>
-                     <version>1.0.0</version>
+                     <version>${felix.version}</version>
                      <type>jar</type>
                      <overWrite>true</overWrite>
                      <outputDirectory>${project.build.directory}/bundle</outputDirectory
>
                    </artifactItem>
                    <artifactItem>
-                     <groupId>${pom.groupId}</groupId>
+				     <groupId>org.apache.felix</groupId>
                      <artifactId>org.apache.felix.shell.tui</artifactId>
-                     <version>1.0.0</version>
+                     <version>${felix.version}</version>
                      <type>jar</type>
                      <overWrite>true</overWrite>
                      <outputDirectory>${project.build.directory}/bundle</outputDirectory
>
                    </artifactItem>
                    <artifactItem>
-                     <groupId>${pom.groupId}</groupId>
+				     <groupId>org.apache.felix</groupId>
                      <artifactId>org.apache.felix.bundlerepository</artifactId>
-                     <version>1.0.0</version>
+                     <version>${felix.version}</version>
                      <type>jar</type>
                      <overWrite>true</overWrite>
                      <outputDirectory>${project.build.directory}/bundle</outputDirectory
>

Copied: incubator/servicemix/branches/servicemix-4.0/main/src/main/java/org/apache/felix/main/Main.java
(from r579246, felix/releases/main-1.0.1/src/main/java/org/apache/felix/main/Main.java)
URL: http://svn.apache.org/viewvc/incubator/servicemix/branches/servicemix-4.0/main/src/main/java/org/apache/felix/main/Main.java?p2=incubator/servicemix/branches/servicemix-4.0/main/src/main/java/org/apache/felix/main/Main.java&p1=felix/releases/main-1.0.1/src/main/java/org/apache/felix/main/Main.java&r1=579246&r2=579258&rev=579258&view=diff
==============================================================================
--- felix/releases/main-1.0.1/src/main/java/org/apache/felix/main/Main.java (original)
+++ incubator/servicemix/branches/servicemix-4.0/main/src/main/java/org/apache/felix/main/Main.java
Tue Sep 25 07:28:42 2007
@@ -58,6 +58,10 @@
      * The default name used for the configuration properties file.
     **/
     public static final String CONFIG_PROPERTIES_FILE_VALUE = "config.properties";
+    /*
+     * The property for auto-discovering the bundles 
+     */
+    public static final String PROPERTY_AUTO_START = "felix.auto.start";
 
     private static Felix m_felix = null;
 
@@ -243,7 +247,7 @@
             // out where felix.jar is located on the system class path.
             File confDir = null;
             String classpath = System.getProperty("java.class.path");
-            int index = classpath.toLowerCase().indexOf("felix.jar");
+            int index = classpath.toLowerCase().indexOf("servicemix.jar");
             int start = classpath.lastIndexOf(File.pathSeparator, index) + 1;
             if (index >= start)
             {
@@ -333,6 +337,8 @@
         // installation directory.  Try to load it from one of these
         // places.
 
+        File bundleDir = null;
+
         // See if the property URL was specified as a property.
         URL propURL = null;
         String custom = System.getProperty(CONFIG_PROPERTIES_PROP);
@@ -354,22 +360,26 @@
             // out where felix.jar is located on the system class path.
             File confDir = null;
             String classpath = System.getProperty("java.class.path");
-            int index = classpath.toLowerCase().indexOf("felix.jar");
+            int index = classpath.toLowerCase().indexOf("servicemix.jar");
             int start = classpath.lastIndexOf(File.pathSeparator, index) + 1;
             if (index >= start)
             {
                 // Get the path of the felix.jar file.
                 String jarLocation = classpath.substring(start, index);
                 // Calculate the conf directory based on the parent
-                // directory of the felix.jar directory.
+                // directory of the servicemix.jar directory.
                 confDir = new File(
                     new File(new File(jarLocation).getAbsolutePath()).getParent(),
                     "conf");
+                bundleDir = new File(
+                    new File(new File(jarLocation).getAbsolutePath()).getParent(),
+                    "bundle");
             }
             else
             {
                 // Can't figure it out so use the current directory as default.
                 confDir = new File(System.getProperty("user.dir"));
+                bundleDir = new File(System.getProperty("user.dir"));
             }
 
             try
@@ -420,6 +430,9 @@
                 substVars(props.getProperty(name), name, null, props));
         }
 
+        // Mutate properties
+        Main.processConfigurationProperties(props, bundleDir);
+
         return props;
     }
 
@@ -435,6 +448,29 @@
             {
                 configProps.setProperty(key, System.getProperty(key));
             }
+        }
+    }
+
+    /**
+     * Process properties to customize default felix behavior
+     */
+    protected static void processConfigurationProperties(Properties props, File bundleDir)
{
+        if (Boolean.parseBoolean(props.getProperty(PROPERTY_AUTO_START)) && bundleDir
!= null) {
+            File[] bundles = bundleDir.listFiles(new FileFilter() {
+                public boolean accept(File pathname) {
+                    return pathname.toString().endsWith(".jar");
+                }
+            });
+            StringBuffer sb = new StringBuffer();
+            for (int i = 0; i < bundles.length; i++) {
+                try {
+                    sb.append("\"").append(bundles[i].toURL().toString()).append("\" ");
+                } catch (MalformedURLException e) {
+                    System.err.print( "Ignoring " + bundles[i].toString() + " (" + e + ")"
);
+                }
+            }
+            props.setProperty("felix.auto.start.1", sb.toString());
+            props.remove(PROPERTY_AUTO_START);
         }
     }
 

Modified: incubator/servicemix/branches/servicemix-4.0/pom.xml
URL: http://svn.apache.org/viewvc/incubator/servicemix/branches/servicemix-4.0/pom.xml?rev=579258&r1=579257&r2=579258&view=diff
==============================================================================
--- incubator/servicemix/branches/servicemix-4.0/pom.xml (original)
+++ incubator/servicemix/branches/servicemix-4.0/pom.xml Tue Sep 25 07:28:42 2007
@@ -36,6 +36,7 @@
 	<module>bundles</module>
 	<module>examples</module>
 	<module>itests</module>
+	<module>main</module>
 	<module>daemon</module>
 	<module>apache-servicemix</module>
   </modules>



Mime
View raw message