Author: rr
Date: Fri Nov 20 13:27:56 2009
New Revision: 882542

URL: http://svn.apache.org/viewvc?rev=882542&view=rev
Log:
ODE-705: Provide OSGi packaging and Karaf feature descriptor for deployment to 
ServiceMix 4.1 - inital work by Greg Lucas

Added:
    ode/branches/APACHE_ODE_1.X/jbi-karaf/
    ode/branches/APACHE_ODE_1.X/jbi-karaf/bnd.bnd
    ode/branches/APACHE_ODE_1.X/jbi-karaf/src/
    ode/branches/APACHE_ODE_1.X/jbi-karaf/src/main/
    ode/branches/APACHE_ODE_1.X/jbi-karaf/src/main/filtered-resources/
    
ode/branches/APACHE_ODE_1.X/jbi-karaf/src/main/filtered-resources/features.xml  
 (with props)
    ode/branches/APACHE_ODE_1.X/jbi-karaf/src/main/resources/
    ode/branches/APACHE_ODE_1.X/jbi-karaf/src/main/resources/META-INF/
    ode/branches/APACHE_ODE_1.X/jbi-karaf/src/main/resources/META-INF/spring/
    
ode/branches/APACHE_ODE_1.X/jbi-karaf/src/main/resources/META-INF/spring/ode-jbi.xml
   (with props)
    ode/branches/APACHE_ODE_1.X/tasks/bnd.rake
Modified:
    ode/branches/APACHE_ODE_1.X/Rakefile
    
ode/branches/APACHE_ODE_1.X/bpel-store/src/main/java/org/apache/ode/store/jpa/DbConfStoreConnectionFactory.java
    
ode/branches/APACHE_ODE_1.X/dao-jpa/src/main/java/org/apache/ode/dao/jpa/BPELDAOConnectionFactoryImpl.java
    
ode/branches/APACHE_ODE_1.X/jbi/src/main/java/org/apache/ode/jbi/OdeComponent.java
    
ode/branches/APACHE_ODE_1.X/jbi/src/main/java/org/apache/ode/jbi/OdeConfigProperties.java
    
ode/branches/APACHE_ODE_1.X/jbi/src/main/java/org/apache/ode/jbi/OdeLifeCycle.java

Modified: ode/branches/APACHE_ODE_1.X/Rakefile
URL: 
http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.X/Rakefile?rev=882542&r1=882541&r2=882542&view=diff
==============================================================================
--- ode/branches/APACHE_ODE_1.X/Rakefile (original)
+++ ode/branches/APACHE_ODE_1.X/Rakefile Fri Nov 20 13:27:56 2009
@@ -60,8 +60,8 @@
   :pool             =>"commons-pool:commons-pool:jar:1.2",
   :primitives       =>"commons-primitives:commons-primitives:jar:1.0"
 )
-DERBY               = "org.apache.derby:derby:jar:10.5.3.0"
-DERBY_TOOLS         = "org.apache.derby:derbytools:jar:10.5.3.0"
+DERBY               = "org.apache.derby:derby:jar:10.5.3.0_1"
+DERBY_TOOLS         = "org.apache.derby:derbytools:jar:10.5.3.0_1"
 DOM4J               = "dom4j:dom4j:jar:1.6.1"
 GERONIMO            = struct(
   :kernel           =>"org.apache.geronimo.modules:geronimo-kernel:jar:2.0.1",
@@ -126,7 +126,6 @@
 WSDL4J              = "wsdl4j:wsdl4j:jar:1.6.1"
 XALAN               = "org.apache.ode:xalan:jar:2.7.0-2"
 XERCES              = "xerces:xercesImpl:jar:2.9.0"
-XSTREAM             = "xstream:xstream:jar:1.2"
 WS_COMMONS          = struct(
   :axiom            =>AXIOM,
   :neethi           =>"org.apache.neethi:neethi:jar:2.0.2",
@@ -145,9 +144,18 @@
 repositories.remote << "http://repo1.maven.org/maven2";
 repositories.remote << "http://people.apache.org/repo/m2-snapshot-repository";
 repositories.remote << "http://download.java.net/maven/2";
+repositories.remote << "http://www.aqute.biz/repo";
 repositories.release_to[:url] ||= "sftp://gu...@localhost/home/guest";
 
-Release.find.tag_name = lambda { |version| "APACHE_ODE_#{version.upcase}" }
+BUNDLE_VERSIONS = {
+  "ode.version" => VERSION_NUMBER,
+  "derby.version" => artifact(DERBY).version,
+  "servicemix.nmr.version" => "1.1.0-SNAPSHOT",
+  "servicemix.specs.version" => "1.4-SNAPSHOT",
+  "servicemix.shared.version" => "2009.02-SNAPSHOT",
+  "geronimo.specs.version" => "1.1.1",
+}
+Release.find.tag_name = lambda { |version| "APACHE_ODE_#{version.upcase}" } if 
Release.find
 
 desc "Apache ODE"
 #define "ode", :group=>"org.apache.ode", :version=>VERSION_NUMBER do
@@ -497,7 +505,7 @@
         ANT, AXIOM, BACKPORT, COMMONS.codec, COMMONS.collections, 
COMMONS.dbcp, COMMONS.lang, COMMONS.pool,
         COMMONS.primitives, DERBY, GERONIMO.connector, GERONIMO.transaction, 
JAXEN, JAVAX.connector, 
         JAVAX.ejb, JAVAX.jms, JAVAX.persistence, JAVAX.stream, 
JAVAX.transaction, LOG4J, OPENJPA, 
-        SAXON, TRANQL, XALAN, XERCES, XMLBEANS, XSTREAM, WSDL4J)
+        SAXON, TRANQL, XALAN, XERCES, XMLBEANS, WSDL4J)
 
       jbi.component :type=>:service_engine, :name=>"OdeBpelEngine", 
:description=>self.comment
       jbi.component :class_name=>"org.apache.ode.jbi.OdeComponent", :libs=>libs
@@ -513,7 +521,7 @@
       BACKPORT, COMMONS.lang, COMMONS.collections, DERBY, GERONIMO.connector, 
GERONIMO.kernel,
       GERONIMO.transaction, JAVAX.connector, JAVAX.ejb, JAVAX.persistence, 
JAVAX.stream,
       JAVAX.transaction, JAXEN, JBI, OPENJPA, SAXON, SERVICEMIX, SPRING, 
TRANQL,
-      XALAN, XBEAN, XMLBEANS, XSTREAM,
+      XALAN, XBEAN, XMLBEANS, 
       LOG4J,
       DOM4J,
       HIBERNATE
@@ -527,6 +535,51 @@
       cp_r _("src/test/resources"), _("target/test/resources")
     end
   end
+  desc "ODE JBI Packaging for Karaf"
+  define "jbi-karaf" do
+    ode_libs = artifacts(projects("bpel-api", "bpel-api-jca", "bpel-compiler", 
"bpel-connector", "bpel-dao",
+                                  "bpel-epr", "jca-ra", "jca-server", 
"bpel-obj", "bpel-ql", "bpel-runtime",
+                                  "scheduler-simple", "bpel-schemas", 
"bpel-store", "dao-hibernate", "dao-jpa",
+                                  "jacob", "jacob-ap", "utils", "agents"))
+    libs = artifacts(ANT, AXIOM, BACKPORT, COMMONS.codec, COMMONS.collections, 
COMMONS.dbcp, COMMONS.lang, COMMONS.pool,
+                     COMMONS.primitives, DERBY, GERONIMO.connector, 
GERONIMO.transaction, JAXEN, JAVAX.connector, 
+                     JAVAX.ejb, JAVAX.jms, JAVAX.persistence, JAVAX.stream, 
JAVAX.transaction, LOG4J, OPENJPA, 
+                     SAXON, TRANQL, XALAN, XERCES, XMLBEANS, WSDL4J)
+    package(:bundle).tap do |bnd|
+      bnd.bnd_file = _("bnd.bnd")
+      bnd.classpath = (ode_libs + artifacts(project("jbi").package(:jar)) + 
libs).join(File::PATH_SEPARATOR)
+      bnd.properties.update(BUNDLE_VERSIONS)
+
+      # inline log4j helper classes
+      bnd.properties["log4j.jar"] = artifact(LOG4J).to_s
+
+      # inline dao zip files
+      zips = artifacts(project("dao-hibernate-db").package(:zip), 
project("dao-jpa-ojpa-derby").package(:zip))
+      inlines = zips.map{|item| "@" + item.to_s}
+      bnd.properties["inlines"] = inlines.join(', ')
+
+      # embed jars
+      bnd_libs = ode_libs + artifacts(AXIOM, BACKPORT, COMMONS.codec, 
COMMONS.collections, COMMONS.dbcp,
+                                      COMMONS.lang, COMMONS.pool, 
COMMONS.primitives, GERONIMO.connector,
+                                      JAXEN, JAVAX.connector, 
JAVAX.persistence, JAVAX.ejb, OPENJPA, SAXON, TRANQL, 
+                                      XALAN, XERCES, XMLBEANS, WSDL4J)
+      includes = bnd_libs.map{|item| File.basename(item.to_s)} 
+      bnd.properties["includes"] = includes.join(', ') 
+    end
+
+    # Generate features.xml
+    def package_as_feature(file_name)
+      file file_name  => [_("src/main/filtered-resources/features.xml")] do
+        
filter(_("src/main/filtered-resources")).include("features.xml").into(_("target")).using(BUNDLE_VERSIONS).run
+        mv _("target/features.xml"), file_name
+      end
+    end
+    def package_as_feature_spec(spec)
+      spec.merge({ :type=>:xml, :classifier=>'features' })
+    end
+    package(:feature)
+
+  end
 
   desc "ODE JCA Resource Archive"
   define "jca-ra" do

Modified: 
ode/branches/APACHE_ODE_1.X/bpel-store/src/main/java/org/apache/ode/store/jpa/DbConfStoreConnectionFactory.java
URL: 
http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.X/bpel-store/src/main/java/org/apache/ode/store/jpa/DbConfStoreConnectionFactory.java?rev=882542&r1=882541&r2=882542&view=diff
==============================================================================
--- 
ode/branches/APACHE_ODE_1.X/bpel-store/src/main/java/org/apache/ode/store/jpa/DbConfStoreConnectionFactory.java
 (original)
+++ 
ode/branches/APACHE_ODE_1.X/bpel-store/src/main/java/org/apache/ode/store/jpa/DbConfStoreConnectionFactory.java
 Fri Nov 20 13:27:56 2009
@@ -49,7 +49,7 @@
         initTxMgr(txFactoryClassName);
 
         HashMap<String, Object> propMap = new HashMap<String,Object>();
-        propMap.put("openjpa.Log", "log4j");
+        propMap.put("openjpa.Log", "commons");
         propMap.put("openjpa.ManagedRuntime", new JpaTxMgrProvider(_txMgr));
         propMap.put("openjpa.ConnectionFactory", _ds);
         propMap.put("openjpa.ConnectionFactoryMode", "managed");

Modified: 
ode/branches/APACHE_ODE_1.X/dao-jpa/src/main/java/org/apache/ode/dao/jpa/BPELDAOConnectionFactoryImpl.java
URL: 
http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.X/dao-jpa/src/main/java/org/apache/ode/dao/jpa/BPELDAOConnectionFactoryImpl.java?rev=882542&r1=882541&r2=882542&view=diff
==============================================================================
--- 
ode/branches/APACHE_ODE_1.X/dao-jpa/src/main/java/org/apache/ode/dao/jpa/BPELDAOConnectionFactoryImpl.java
 (original)
+++ 
ode/branches/APACHE_ODE_1.X/dao-jpa/src/main/java/org/apache/ode/dao/jpa/BPELDAOConnectionFactoryImpl.java
 Fri Nov 20 13:27:56 2009
@@ -93,7 +93,7 @@
         HashMap<String, Object> propMap = new HashMap<String,Object>();
 
 //        propMap.put("openjpa.Log", "DefaultLevel=TRACE");
-        propMap.put("openjpa.Log", "log4j");
+        propMap.put("openjpa.Log", "commons");
 //        propMap.put("openjpa.jdbc.DBDictionary", 
"org.apache.openjpa.jdbc.sql.DerbyDictionary");
 
         propMap.put("openjpa.ManagedRuntime", new JpaTxMgrProvider(_tm));

Added: ode/branches/APACHE_ODE_1.X/jbi-karaf/bnd.bnd
URL: 
http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.X/jbi-karaf/bnd.bnd?rev=882542&view=auto
==============================================================================
--- ode/branches/APACHE_ODE_1.X/jbi-karaf/bnd.bnd (added)
+++ ode/branches/APACHE_ODE_1.X/jbi-karaf/bnd.bnd Fri Nov 20 13:27:56 2009
@@ -0,0 +1,35 @@
+Bundle-SymbolicName: org.apache.ode.jbi
+Bundle-Name: Apache ODE Service Engine
+Bundle-Version: ${ode.version}
+
+Export-Package: org.apache.ode.jbi;version=${ode.version}
+Private-Package: org.apache.ode.jbi*;version=${ode.version}
+
+Import-Package: \
+        !com.sun.mirror*, \
+        !junit.framework*, \
+        !org.apache.axis2.client*, \
+        !org.apache.tools.ant*, \
+        javax.jbi*;version="1.0", \
+        javax.transaction*;version="1.1", \
+        org.apache.commons.httpclient*;version="3.0", \
+        org.apache.commons.logging*;version="1.1", \
+        org.apache.geronimo.transaction.manager;version="2.0", \
+        org.osgi.service.command;version="[0.2,1)", \
+        org.springframework.beans.factory.xml;version="2.5", \
+        org.w3c.dom, \
+        org.xml.sax, \
+        org.xml.sax.ext, \
+        org.xml.sax.helpers, \
+        *;resolution:=optional
+
+DynamicImport-Package:javax.*,org.xml.*,org.w3c.*
+
+Include-Resource: ${includes}, \
+                  ${inlines}, \
+                  
@${log4j.jar}!/org/apache/log4j/helpers/AbsoluteTimeDateFormat.class, \
+                  src/main/resources
+
+Bundle-ClassPath: .,${includes}
+
+-removeheaders = Include-Resource, Private-Package

Added: 
ode/branches/APACHE_ODE_1.X/jbi-karaf/src/main/filtered-resources/features.xml
URL: 
http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.X/jbi-karaf/src/main/filtered-resources/features.xml?rev=882542&view=auto
==============================================================================
--- 
ode/branches/APACHE_ODE_1.X/jbi-karaf/src/main/filtered-resources/features.xml 
(added)
+++ 
ode/branches/APACHE_ODE_1.X/jbi-karaf/src/main/filtered-resources/features.xml 
Fri Nov 20 13:27:56 2009
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+     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.
+  -->
+<features>
+    
<repository>mvn:org.apache.servicemix.nmr/apache-servicemix-nmr/${servicemix.nmr.version}/xml/features</repository>
+    <feature name="ode" version="${ode.version}">
+       <feature version="${servicemix.nmr.version}">transaction</feature>
+        
<bundle>mvn:org.apache.geronimo.specs/geronimo-jta_1.1_spec/${geronimo.specs.version}</bundle>
+        
<bundle>mvn:org.apache.geronimo.specs/geronimo-jms_1.1_spec/${geronimo.specs.version}</bundle>
+        
<bundle>mvn:org.apache.servicemix.specs/org.apache.servicemix.specs.stax-api-1.0/${servicemix.specs.version}</bundle>
+        <bundle>mvn:org.apache.derby/derby/${derby.version}</bundle>
+        
<bundle>mvn:org.apache.ode/ode-jbi-karaf/${ode.version}/jar/bundle</bundle>
+    </feature>
+</features>

Propchange: 
ode/branches/APACHE_ODE_1.X/jbi-karaf/src/main/filtered-resources/features.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: 
ode/branches/APACHE_ODE_1.X/jbi-karaf/src/main/resources/META-INF/spring/ode-jbi.xml
URL: 
http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.X/jbi-karaf/src/main/resources/META-INF/spring/ode-jbi.xml?rev=882542&view=auto
==============================================================================
--- 
ode/branches/APACHE_ODE_1.X/jbi-karaf/src/main/resources/META-INF/spring/ode-jbi.xml
 (added)
+++ 
ode/branches/APACHE_ODE_1.X/jbi-karaf/src/main/resources/META-INF/spring/ode-jbi.xml
 Fri Nov 20 13:27:56 2009
@@ -0,0 +1,66 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+     
+     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.
+
+  -->
+<beans xmlns="http://www.springframework.org/schema/beans";
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+       xmlns:ctx="http://www.springframework.org/schema/context";
+       xmlns:osgi="http://www.springframework.org/schema/osgi";
+       xmlns:osgix="http://www.springframework.org/schema/osgi-compendium";
+       xmlns:util="http://www.springframework.org/schema/util";
+       xsi:schemaLocation="
+                          http://www.springframework.org/schema/beans
+                          
http://www.springframework.org/schema/beans/spring-beans.xsd
+                          http://www.springframework.org/schema/context
+                          
http://www.springframework.org/schema/context/spring-context.xsd
+                          http://www.springframework.org/schema/util
+                          
http://www.springframework.org/schema/util/spring-util.xsd
+                          http://www.springframework.org/schema/osgi
+                          
http://www.springframework.org/schema/osgi/spring-osgi.xsd
+                          http://www.springframework.org/schema/osgi-compendium
+                          
http://www.springframework.org/schema/osgi-compendium/spring-osgi-compendium.xsd";>
+
+    <bean id="ode-config-properties" 
class="org.apache.ode.jbi.OdeConfigProperties">
+        <constructor-arg ref="cmProps"/>
+    </bean>
+
+    <bean id="ode-component-lifecycle" class="org.apache.ode.jbi.OdeLifeCycle">
+        <constructor-arg ref="ode-config-properties"/>
+    </bean>
+
+    <bean id="ode-jbi-component" class="org.apache.ode.jbi.OdeComponent">
+        <constructor-arg ref="ode-component-lifecycle"/>        
+    </bean>
+
+    <osgi:service ref="ode-jbi-component" 
interface="javax.jbi.component.Component">
+       <osgi:service-properties>
+           <entry key="NAME" value="OdeBpelEngine" />
+           <entry key="TYPE" value="service-engine" />
+       </osgi:service-properties>
+    </osgi:service>
+
+    <osgix:cm-properties id="cmProps" persistent-id="org.apache.ode.jbi">
+        <prop key="ode-jbi.pidNamespace">urn:ode-jbi</prop>
+        <prop key="ode-jbi.allowIncompleteDeployment">false</prop>
+        <prop key="ode-jbi.db.mode">EMBEDDED</prop>
+        <prop key="ode-jbi.db.ext.dataSource">java:comp/env/jdbc/ode</prop>
+        <prop 
key="ode-jbi.messageMapper">org.apache.ode.jbi.msgmap.ServiceMixMapper,org.apache.ode.jbi.msgmap.JbiWsdl11WrapperMapper</prop>
+        <prop key="ode-jbi.jca.port">0</prop>
+    </osgix:cm-properties>
+    
+</beans>

Propchange: 
ode/branches/APACHE_ODE_1.X/jbi-karaf/src/main/resources/META-INF/spring/ode-jbi.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: 
ode/branches/APACHE_ODE_1.X/jbi/src/main/java/org/apache/ode/jbi/OdeComponent.java
URL: 
http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.X/jbi/src/main/java/org/apache/ode/jbi/OdeComponent.java?rev=882542&r1=882541&r2=882542&view=diff
==============================================================================
--- 
ode/branches/APACHE_ODE_1.X/jbi/src/main/java/org/apache/ode/jbi/OdeComponent.java
 (original)
+++ 
ode/branches/APACHE_ODE_1.X/jbi/src/main/java/org/apache/ode/jbi/OdeComponent.java
 Fri Nov 20 13:27:56 2009
@@ -34,9 +34,13 @@
     private OdeLifeCycle _lifeCycle;
 
     public OdeComponent() {
-        _lifeCycle = new OdeLifeCycle();
+        this(new OdeLifeCycle());        
     }
 
+    public OdeComponent(OdeLifeCycle lifeCycle) {
+        _lifeCycle = lifeCycle;
+    }   
+
     public ComponentLifeCycle getLifeCycle() {
         return _lifeCycle;
     }
@@ -117,4 +121,5 @@
     // We are an engine, so we don't have to worry about this.
         return null;
     }
+
 }

Modified: 
ode/branches/APACHE_ODE_1.X/jbi/src/main/java/org/apache/ode/jbi/OdeConfigProperties.java
URL: 
http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.X/jbi/src/main/java/org/apache/ode/jbi/OdeConfigProperties.java?rev=882542&r1=882541&r2=882542&view=diff
==============================================================================
--- 
ode/branches/APACHE_ODE_1.X/jbi/src/main/java/org/apache/ode/jbi/OdeConfigProperties.java
 (original)
+++ 
ode/branches/APACHE_ODE_1.X/jbi/src/main/java/org/apache/ode/jbi/OdeConfigProperties.java
 Fri Nov 20 13:27:56 2009
@@ -20,6 +20,7 @@
 package org.apache.ode.jbi;
 
 import java.io.File;
+import java.util.Properties;
 
 import org.apache.ode.jbi.msgmap.JbiWsdl11WrapperMapper;
 
@@ -34,13 +35,13 @@
    
     private static final String PROP_MSGMAPPER = "messageMapper";
 
-
-    private String _installDir;
-
     public OdeConfigProperties(File cfgFile) {
         super(cfgFile, "ode-jbi.");
     }
 
+    public OdeConfigProperties(Properties properties) {
+        super(properties, "ode-jbi.");
+    }
 
 
     /**

Modified: 
ode/branches/APACHE_ODE_1.X/jbi/src/main/java/org/apache/ode/jbi/OdeLifeCycle.java
URL: 
http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.X/jbi/src/main/java/org/apache/ode/jbi/OdeLifeCycle.java?rev=882542&r1=882541&r2=882542&view=diff
==============================================================================
--- 
ode/branches/APACHE_ODE_1.X/jbi/src/main/java/org/apache/ode/jbi/OdeLifeCycle.java
 (original)
+++ 
ode/branches/APACHE_ODE_1.X/jbi/src/main/java/org/apache/ode/jbi/OdeLifeCycle.java
 Fri Nov 20 13:27:56 2009
@@ -21,8 +21,6 @@
 
 import java.io.File;
 import java.io.FileNotFoundException;
-import java.util.HashMap;
-import java.util.Map;
 import java.util.concurrent.Executors;
 
 import javax.jbi.JBIException;
@@ -39,7 +37,6 @@
 import org.apache.ode.bpel.dao.BpelDAOConnectionFactoryJDBC;
 import org.apache.ode.bpel.engine.BpelServerImpl;
 import org.apache.ode.bpel.engine.ProcessAndInstanceManagementMBean;
-import org.apache.ode.bpel.engine.ProcessAndInstanceManagementImpl;
 import org.apache.ode.bpel.extvar.jdbc.JdbcExternalVariableModule;
 
 import org.apache.ode.bpel.iapi.BpelEventListener;
@@ -78,6 +75,16 @@
 
     private ObjectName _mbeanName;
 
+    private OdeConfigProperties _config;
+
+    public OdeLifeCycle() {
+        
+    }
+
+    public OdeLifeCycle(OdeConfigProperties config) {
+        _config = config;
+    }
+
     ServiceUnitManager getSUManager() {
         return _suManager;
     }
@@ -104,8 +111,13 @@
             if (_ode.getContext().getWorkspaceRoot() != null)
                 TempFileManager.setWorkingDirectory(new 
File(_ode.getContext().getWorkspaceRoot()));
 
-            __log.debug("Loading properties.");
-            initProperties();
+            if (_config == null) {
+                __log.debug("Loading properties.");
+                initProperties();
+            } else {
+                __log.debug("Applying properties.");
+                _ode._config = _config;
+            }
 
             __log.debug("Initializing message mappers.");
             initMappers();
@@ -183,7 +195,7 @@
 
         _ode._dataSource = _db.getDataSource();
     }
-
+    
     /**
      * Load the "ode-jbi.properties" file from the install directory.
      *

Added: ode/branches/APACHE_ODE_1.X/tasks/bnd.rake
URL: 
http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.X/tasks/bnd.rake?rev=882542&view=auto
==============================================================================
--- ode/branches/APACHE_ODE_1.X/tasks/bnd.rake (added)
+++ ode/branches/APACHE_ODE_1.X/tasks/bnd.rake Fri Nov 20 13:27:56 2009
@@ -0,0 +1,81 @@
+#
+#    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.
+#
+
+# This task creates an OSGi bundle package using the bnd tool. 
+#
+# The classpath and path to a bnd configuration file are required. 
+# Additional properties can be specified using the bnd.properties
+# hash. Refer to the bnd documentation (http://www.aqute.biz/Code/Bnd)
+# for details on the supported properties. 
+#
+# The easiest way to use this task is through the Project#package method. 
+# For example:
+#   package(:bundle).tap do |bnd|
+#     bnd.bnd_file = 'conf/foo.bnd'
+#     bnd.classpath = artifacts(...)
+#     bnd.properties['foo'] = 'bar'
+#   end
+class BndTask < Rake::FileTask
+
+  BND = "biz.aQute:bnd:jar:0.0.379"
+
+  # Classpath string for building the bundle
+  attr_accessor :classpath
+
+  # Path to bnd file
+  attr_accessor :bnd_file
+  
+  # Hash of properties passed to bnd
+  attr_accessor :properties
+
+  def initialize(*args)
+    super
+    @properties = {}
+
+    # Make sure bnd tool is available
+    Buildr.artifact(BND).invoke
+
+    enhance do 
+      Buildr.ant('bnd') do |project|
+        
+        # pass properties to bnd as ant properties
+        properties.each do |key, value|
+          project.property(:name=>key, :value=>value)
+        end
+        
+        project.taskdef :name=>'bnd', :classname=>'aQute.bnd.ant.BndTask', 
:classpath=>Buildr.artifact(BND)
+        project.bnd(:classpath=>classpath, :files=>File.expand_path(bnd_file), 
:output=>name, 
+                    :eclipse=>false, :failok=>false, :exceptions=>true) 
+      end
+    end
+  end
+  
+  
+end
+
+
+class Project
+
+  def package_as_bundle(file_name) #:nodoc
+    BndTask.define_task(file_name)
+  end
+  
+  def package_as_bundle_spec(spec) #:nodoc
+    spec.merge({ :type=>:jar, :classifier=>'bundle' })
+  end
+  
+end


Reply via email to