Author: rr
Date: Mon Mar  8 13:31:39 2010
New Revision: 920318

URL: http://svn.apache.org/viewvc?rev=920318&view=rev
Log:
ODE-778: Added bundle activator for SMX4 + example (big thanks to Maciej 
Prochniak), switching to maven only builds for ode-jbi-karaf

Added:
    ode/branches/APACHE_ODE_1.X/distro/src/examples-jbi/maven2/ping-pong-osgi/
    
ode/branches/APACHE_ODE_1.X/distro/src/examples-jbi/maven2/ping-pong-osgi/osgi.bnd
    
ode/branches/APACHE_ODE_1.X/distro/src/examples-jbi/maven2/ping-pong-osgi/pom.xml
   (with props)
    
ode/branches/APACHE_ODE_1.X/distro/src/examples-jbi/maven2/ping-pong-osgi/src/
    
ode/branches/APACHE_ODE_1.X/distro/src/examples-jbi/maven2/ping-pong-osgi/src/main/
    
ode/branches/APACHE_ODE_1.X/distro/src/examples-jbi/maven2/ping-pong-osgi/src/main/java/
    
ode/branches/APACHE_ODE_1.X/distro/src/examples-jbi/maven2/ping-pong-osgi/src/main/java/org/
    
ode/branches/APACHE_ODE_1.X/distro/src/examples-jbi/maven2/ping-pong-osgi/src/main/java/org/apache/
    
ode/branches/APACHE_ODE_1.X/distro/src/examples-jbi/maven2/ping-pong-osgi/src/main/java/org/apache/ode/
    
ode/branches/APACHE_ODE_1.X/distro/src/examples-jbi/maven2/ping-pong-osgi/src/main/java/org/apache/ode/ping/
    
ode/branches/APACHE_ODE_1.X/distro/src/examples-jbi/maven2/ping-pong-osgi/src/main/java/org/apache/ode/ping/AttachPing.java
   (with props)
    
ode/branches/APACHE_ODE_1.X/distro/src/examples-jbi/maven2/ping-pong-osgi/src/main/resources/
    
ode/branches/APACHE_ODE_1.X/distro/src/examples-jbi/maven2/ping-pong-osgi/src/main/resources/META-INF/
    
ode/branches/APACHE_ODE_1.X/distro/src/examples-jbi/maven2/ping-pong-osgi/src/main/resources/META-INF/spring/
    
ode/branches/APACHE_ODE_1.X/distro/src/examples-jbi/maven2/ping-pong-osgi/src/main/resources/META-INF/spring/xbean.xml
   (with props)
    
ode/branches/APACHE_ODE_1.X/distro/src/examples-jbi/maven2/ping-pong-osgi/src/main/resources/Ping.bpel
   (with props)
    
ode/branches/APACHE_ODE_1.X/distro/src/examples-jbi/maven2/ping-pong-osgi/src/main/resources/Ping.wsdl
   (with props)
    
ode/branches/APACHE_ODE_1.X/distro/src/examples-jbi/maven2/ping-pong-osgi/src/main/resources/Ping.xsd
   (with props)
    
ode/branches/APACHE_ODE_1.X/distro/src/examples-jbi/maven2/ping-pong-osgi/src/main/resources/Pong.bpel
   (with props)
    
ode/branches/APACHE_ODE_1.X/distro/src/examples-jbi/maven2/ping-pong-osgi/src/main/resources/Pong.wsdl
   (with props)
    
ode/branches/APACHE_ODE_1.X/distro/src/examples-jbi/maven2/ping-pong-osgi/src/main/resources/Pong.xsd
   (with props)
    
ode/branches/APACHE_ODE_1.X/distro/src/examples-jbi/maven2/ping-pong-osgi/src/main/resources/common.wsdl
   (with props)
    
ode/branches/APACHE_ODE_1.X/distro/src/examples-jbi/maven2/ping-pong-osgi/src/main/resources/deploy.xml
   (with props)
    ode/branches/APACHE_ODE_1.X/jbi-karaf/src/main/java/
    ode/branches/APACHE_ODE_1.X/jbi-karaf/src/main/java/org/
    ode/branches/APACHE_ODE_1.X/jbi-karaf/src/main/java/org/apache/
    ode/branches/APACHE_ODE_1.X/jbi-karaf/src/main/java/org/apache/ode/
    ode/branches/APACHE_ODE_1.X/jbi-karaf/src/main/java/org/apache/ode/jbi/
    ode/branches/APACHE_ODE_1.X/jbi-karaf/src/main/java/org/apache/ode/jbi/osgi/
    
ode/branches/APACHE_ODE_1.X/jbi-karaf/src/main/java/org/apache/ode/jbi/osgi/ServiceUnitActivator.java
   (with props)
Modified:
    ode/branches/APACHE_ODE_1.X/Rakefile
    ode/branches/APACHE_ODE_1.X/jbi-karaf/pom.xml
    ode/branches/APACHE_ODE_1.X/pom.xml

Modified: ode/branches/APACHE_ODE_1.X/Rakefile
URL: 
http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.X/Rakefile?rev=920318&r1=920317&r2=920318&view=diff
==============================================================================
--- ode/branches/APACHE_ODE_1.X/Rakefile (original)
+++ ode/branches/APACHE_ODE_1.X/Rakefile Mon Mar  8 13:31:39 2010
@@ -424,63 +424,63 @@
     end
   end
 
-  desc "ODE Commmands for Karaf"
-  define "jbi-karaf-commands" do
-    compile.with projects("bpel-schemas", "jbi"), JBI, KARAF, XMLBEANS, 
COMMONS.logging
-    libs = artifacts(projects("bpel-schemas", "jbi"), JBI, KARAF, XMLBEANS, 
COMMONS.logging)
-    package(:bundle).tap do |bnd|
-      bnd.bnd_file = _("org.apache.ode.commands.bnd")
-      bnd.sourcepath = _("src/main/java")
-      bnd.classpath = _("target/classes") + File::PATH_SEPARATOR + 
libs.join(File::PATH_SEPARATOR)
-      bnd.properties.update(BUNDLE_VERSIONS)
-    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, 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 Commmands for Karaf"
+#  define "jbi-karaf-commands" do
+#    compile.with projects("bpel-schemas", "jbi"), JBI, KARAF, XMLBEANS, 
COMMONS.logging
+#    libs = artifacts(projects("bpel-schemas", "jbi"), JBI, KARAF, XMLBEANS, 
COMMONS.logging)
+#    package(:bundle).tap do |bnd|
+#      bnd.bnd_file = _("org.apache.ode.commands.bnd")
+#      bnd.sourcepath = _("src/main/java")
+#      bnd.classpath = _("target/classes") + File::PATH_SEPARATOR + 
libs.join(File::PATH_SEPARATOR)
+#      bnd.properties.update(BUNDLE_VERSIONS)
+#    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, 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

Added: 
ode/branches/APACHE_ODE_1.X/distro/src/examples-jbi/maven2/ping-pong-osgi/osgi.bnd
URL: 
http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.X/distro/src/examples-jbi/maven2/ping-pong-osgi/osgi.bnd?rev=920318&view=auto
==============================================================================
--- 
ode/branches/APACHE_ODE_1.X/distro/src/examples-jbi/maven2/ping-pong-osgi/osgi.bnd
 (added)
+++ 
ode/branches/APACHE_ODE_1.X/distro/src/examples-jbi/maven2/ping-pong-osgi/osgi.bnd
 Mon Mar  8 13:31:39 2010
@@ -0,0 +1,4 @@
+Bundle-Activator: org.apache.ode.jbi.osgi.ServiceUnitActivator
+Export-Package: org.apache.ode.ping
+Import-Package: 
org.apache.ode.jbi.osgi,org.apache.servicemix.http,org.apache.servicemix.common.osgi
+Include-Resource: src/main/resources

Added: 
ode/branches/APACHE_ODE_1.X/distro/src/examples-jbi/maven2/ping-pong-osgi/pom.xml
URL: 
http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.X/distro/src/examples-jbi/maven2/ping-pong-osgi/pom.xml?rev=920318&view=auto
==============================================================================
--- 
ode/branches/APACHE_ODE_1.X/distro/src/examples-jbi/maven2/ping-pong-osgi/pom.xml
 (added)
+++ 
ode/branches/APACHE_ODE_1.X/distro/src/examples-jbi/maven2/ping-pong-osgi/pom.xml
 Mon Mar  8 13:31:39 2010
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/maven-v4_0_0.xsd"; 
xmlns="http://maven.apache.org/POM/4.0.0"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";>
+
+  <modelVersion>4.0.0</modelVersion>
+  <groupId>org.apache.ode.examples</groupId>
+  <artifactId>ping-pong-bundle</artifactId>
+  <version>1.0.0</version>
+  <packaging>bundle</packaging>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.felix</groupId>
+        <artifactId>maven-bundle-plugin</artifactId>
+        <version>1.4.3</version>
+        <extensions>true</extensions>
+        <configuration>
+          <instructions>
+            
<Bundle-SymbolicName>${project.groupId}-${project.artifactId}</Bundle-SymbolicName>
+            <Bundle-Version>${project.version}</Bundle-Version>
+            <_include>-osgi.bnd</_include>
+          </instructions>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+</project>

Propchange: 
ode/branches/APACHE_ODE_1.X/distro/src/examples-jbi/maven2/ping-pong-osgi/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: 
ode/branches/APACHE_ODE_1.X/distro/src/examples-jbi/maven2/ping-pong-osgi/src/main/java/org/apache/ode/ping/AttachPing.java
URL: 
http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.X/distro/src/examples-jbi/maven2/ping-pong-osgi/src/main/java/org/apache/ode/ping/AttachPing.java?rev=920318&view=auto
==============================================================================
--- 
ode/branches/APACHE_ODE_1.X/distro/src/examples-jbi/maven2/ping-pong-osgi/src/main/java/org/apache/ode/ping/AttachPing.java
 (added)
+++ 
ode/branches/APACHE_ODE_1.X/distro/src/examples-jbi/maven2/ping-pong-osgi/src/main/java/org/apache/ode/ping/AttachPing.java
 Mon Mar  8 13:31:39 2010
@@ -0,0 +1,28 @@
+/*
+ * 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.
+ */
+
+package org.apache.ode.ping;
+
+public class AttachPing {
+
+  public static String attachPing(String ping) {
+       return "Java attached ping to: "+ping;
+  }
+
+}

Propchange: 
ode/branches/APACHE_ODE_1.X/distro/src/examples-jbi/maven2/ping-pong-osgi/src/main/java/org/apache/ode/ping/AttachPing.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: 
ode/branches/APACHE_ODE_1.X/distro/src/examples-jbi/maven2/ping-pong-osgi/src/main/resources/META-INF/spring/xbean.xml
URL: 
http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.X/distro/src/examples-jbi/maven2/ping-pong-osgi/src/main/resources/META-INF/spring/xbean.xml?rev=920318&view=auto
==============================================================================
--- 
ode/branches/APACHE_ODE_1.X/distro/src/examples-jbi/maven2/ping-pong-osgi/src/main/resources/META-INF/spring/xbean.xml
 (added)
+++ 
ode/branches/APACHE_ODE_1.X/distro/src/examples-jbi/maven2/ping-pong-osgi/src/main/resources/META-INF/spring/xbean.xml
 Mon Mar  8 13:31:39 2010
@@ -0,0 +1,44 @@
+<?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:http="http://servicemix.apache.org/http/1.0";
+       xmlns:ping="urn:/Ping.wsdl"
+       xmlns:pong="urn:/Pong.wsdl"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+       xsi:schemaLocation="
+         http://www.springframework.org/schema/beans
+         http://www.springframework.org/schema/beans/spring-beans.xsd
+         http://servicemix.apache.org/http/1.0
+         http://servicemix.apache.org/http/1.0/servicemix-http.xsd";>
+    <http:endpoint 
+        service="ping:PingService"
+        endpoint="http" 
+       targetService="ping:PingService"
+       targetEndpoint="PingPort"
+        defaultOperation="Ping"
+        role="consumer"
+        locationURI="http://localhost:8192/PingHttp/";
+        defaultMep="http://www.w3.org/2004/08/wsdl/in-out"; 
+       wsdlResource="classpath:Ping.wsdl"
+       soapVersion="1.1"
+        soap="true" />
+    
+    <bean class="org.apache.servicemix.common.osgi.EndpointExporter" />
+</beans>

Propchange: 
ode/branches/APACHE_ODE_1.X/distro/src/examples-jbi/maven2/ping-pong-osgi/src/main/resources/META-INF/spring/xbean.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: 
ode/branches/APACHE_ODE_1.X/distro/src/examples-jbi/maven2/ping-pong-osgi/src/main/resources/Ping.bpel
URL: 
http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.X/distro/src/examples-jbi/maven2/ping-pong-osgi/src/main/resources/Ping.bpel?rev=920318&view=auto
==============================================================================
--- 
ode/branches/APACHE_ODE_1.X/distro/src/examples-jbi/maven2/ping-pong-osgi/src/main/resources/Ping.bpel
 (added)
+++ 
ode/branches/APACHE_ODE_1.X/distro/src/examples-jbi/maven2/ping-pong-osgi/src/main/resources/Ping.bpel
 Mon Mar  8 13:31:39 2010
@@ -0,0 +1,121 @@
+<?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.
+  -->
+<process
+        name="Ping"
+        xmlns="http://docs.oasis-open.org/wsbpel/2.0/process/executable";
+        targetNamespace="urn:/Ping.bpel"
+        xmlns:xsd="http://www.w3.org/2001/XMLSchema";
+        xmlns:tns="urn:/Ping.bpel"
+        xmlns:ping="urn:/Ping.wsdl"
+        xmlns:pong="urn:/Pong.wsdl"
+           xmlns:fun="java:org.apache.ode.ping.AttachPing"
+        expressionLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath2.0">
+
+    <import location="common.wsdl"
+            namespace="http://www.example.org/common/";
+            importType="http://schemas.xmlsoap.org/wsdl/"; />
+
+    <partnerLinks>
+        <partnerLink name="PingPartnerLink"
+                partnerLinkType="ping:PingPartnerLinkType"
+                myRole="Provider" />
+        <partnerLink name="PongPartnerLink"
+                partnerLinkType="pong:PongPartnerLinkType"
+                partnerRole="Provider"
+                initializePartnerRole="yes" />
+    </partnerLinks>
+
+    <variables>
+        <variable messageType="ping:PingRequest" name="pingRequest"/>
+        <variable messageType="ping:PingResponse" name="pingResponse"/>
+        <variable messageType="pong:PongRequest" name="pongRequest"/>
+        <variable messageType="pong:PongResponse" name="pongResponse"/>
+        <variable type="xsd:string" name="text" />
+    </variables>
+
+    <sequence name="Main">
+        <receive name="pingReceive"
+                createInstance="yes"
+                operation="Ping"
+                partnerLink="PingPartnerLink"
+                portType="ping:PingPortType"
+                variable="pingRequest"/>
+
+        <assign name="assignPongRequest">
+            <!-- add "ping" text to the input text -->
+            <copy>
+                <from>fun:attachPing($pingRequest.body/ping:text/text())</from>
+                <to variable="text"/>
+            </copy>
+            <!-- initialize pongRequest -->
+            <copy>
+                <from>
+                    <literal>
+                        <pong:PongRequest>
+                            <pong:text/>
+                        </pong:PongRequest>
+                    </literal>
+                </from>
+                <to>$pongRequest.body</to>
+            </copy>
+            <!-- copy new text into pongRequest -->
+            <copy>
+                <from>$text</from>
+                <to>$pongRequest.body/pong:text</to>
+            </copy>
+        </assign>
+        
+        <invoke name="invokePong"
+                operation="Pong"
+                inputVariable="pongRequest"
+                outputVariable="pongResponse"
+                partnerLink="PongPartnerLink"
+                portType="pong:PongPortType"/>
+        
+        <assign name="assignPingResponse">
+            <copy>
+                <from>$pongResponse.body/pong:text</from>
+                <to>$text</to>
+            </copy>
+            <!-- initialize pingResponse -->
+            <copy>
+                <from>
+                    <literal>
+                        <ping:PingResponse>
+                            <ping:text/>
+                        </ping:PingResponse>
+                    </literal>
+                </from>
+                <to>$pingResponse.body</to>
+            </copy>
+            <!-- copy new text into pingResponse -->
+            <copy>
+                <from>$text</from>
+                <to>$pingResponse.body/ping:text</to>
+            </copy>
+        </assign>
+
+        <reply name="pingReply"
+                partnerLink="PingPartnerLink"
+                portType="ping:PingPortType"
+                operation="Ping"
+                variable="pingResponse"/>
+    </sequence>
+</process>

Propchange: 
ode/branches/APACHE_ODE_1.X/distro/src/examples-jbi/maven2/ping-pong-osgi/src/main/resources/Ping.bpel
------------------------------------------------------------------------------
    svn:eol-style = native

Added: 
ode/branches/APACHE_ODE_1.X/distro/src/examples-jbi/maven2/ping-pong-osgi/src/main/resources/Ping.wsdl
URL: 
http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.X/distro/src/examples-jbi/maven2/ping-pong-osgi/src/main/resources/Ping.wsdl?rev=920318&view=auto
==============================================================================
--- 
ode/branches/APACHE_ODE_1.X/distro/src/examples-jbi/maven2/ping-pong-osgi/src/main/resources/Ping.wsdl
 (added)
+++ 
ode/branches/APACHE_ODE_1.X/distro/src/examples-jbi/maven2/ping-pong-osgi/src/main/resources/Ping.wsdl
 Mon Mar  8 13:31:39 2010
@@ -0,0 +1,60 @@
+<?xml version="1.0"?>
+<!--
+  ~ 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.
+  -->
+<definitions name="Ping"
+        targetNamespace="urn:/Ping.wsdl"
+        xmlns:tns="urn:/Ping.wsdl"
+        xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/";
+        xmlns:plnk="http://docs.oasis-open.org/wsbpel/2.0/plnktype";
+        xmlns="http://schemas.xmlsoap.org/wsdl/";>
+
+    <types>
+        <schema xmlns="http://www.w3.org/2001/XMLSchema";>
+            <import namespace="urn:/Ping.wsdl" 
schemaLocation="Ping.xsd"></import>
+        </schema>
+    </types>
+
+    <message name="PingRequest">
+        <part name="body" element="tns:PingRequest"/>
+    </message>
+
+    <message name="PingResponse">
+        <part name="body" element="tns:PingResponse"/>
+    </message>
+
+    <portType name="PingPortType">
+        <operation name="Ping">
+            <input message="tns:PingRequest"/>
+            <output message="tns:PingResponse"/>
+        </operation>
+    </portType>
+
+    <plnk:partnerLinkType name="PingPartnerLinkType">
+        <plnk:role name="Provider" portType="tns:PingPortType"/>
+    </plnk:partnerLinkType>
+    
+    <!--
+    
+    This is an abstract interface/portType definition.  Note the lack of 
+    binding and service: these are defined by the HTTP binding component.
+    See ping-http/Ping.wsdl for details.
+    
+    -->
+
+</definitions>

Propchange: 
ode/branches/APACHE_ODE_1.X/distro/src/examples-jbi/maven2/ping-pong-osgi/src/main/resources/Ping.wsdl
------------------------------------------------------------------------------
    svn:eol-style = native

Added: 
ode/branches/APACHE_ODE_1.X/distro/src/examples-jbi/maven2/ping-pong-osgi/src/main/resources/Ping.xsd
URL: 
http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.X/distro/src/examples-jbi/maven2/ping-pong-osgi/src/main/resources/Ping.xsd?rev=920318&view=auto
==============================================================================
--- 
ode/branches/APACHE_ODE_1.X/distro/src/examples-jbi/maven2/ping-pong-osgi/src/main/resources/Ping.xsd
 (added)
+++ 
ode/branches/APACHE_ODE_1.X/distro/src/examples-jbi/maven2/ping-pong-osgi/src/main/resources/Ping.xsd
 Mon Mar  8 13:31:39 2010
@@ -0,0 +1,35 @@
+<?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.
+  -->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"; 
targetNamespace="urn:/Ping.wsdl" xmlns:tns="urn:/Ping.wsdl" 
elementFormDefault="qualified">
+  <element name="PingRequest">
+    <complexType>
+      <all>
+        <element name="text" type="string"/>
+      </all>
+    </complexType>
+  </element>
+  <element name="PingResponse">
+    <complexType>
+      <all>
+        <element name="text" type="string"/>
+      </all>
+    </complexType>
+  </element>
+</schema>

Propchange: 
ode/branches/APACHE_ODE_1.X/distro/src/examples-jbi/maven2/ping-pong-osgi/src/main/resources/Ping.xsd
------------------------------------------------------------------------------
    svn:eol-style = native

Added: 
ode/branches/APACHE_ODE_1.X/distro/src/examples-jbi/maven2/ping-pong-osgi/src/main/resources/Pong.bpel
URL: 
http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.X/distro/src/examples-jbi/maven2/ping-pong-osgi/src/main/resources/Pong.bpel?rev=920318&view=auto
==============================================================================
--- 
ode/branches/APACHE_ODE_1.X/distro/src/examples-jbi/maven2/ping-pong-osgi/src/main/resources/Pong.bpel
 (added)
+++ 
ode/branches/APACHE_ODE_1.X/distro/src/examples-jbi/maven2/ping-pong-osgi/src/main/resources/Pong.bpel
 Mon Mar  8 13:31:39 2010
@@ -0,0 +1,83 @@
+<?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.
+  -->
+<process
+        name="Pong"
+        xmlns="http://docs.oasis-open.org/wsbpel/2.0/process/executable";
+        targetNamespace="urn:/Pong.bpel"
+        xmlns:xsd="http://www.w3.org/2001/XMLSchema";
+        xmlns:tns="urn:/Pong.bpel"
+        xmlns:pong="urn:/Pong.wsdl"
+        expressionLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath1.0">
+
+    <import location="common.wsdl"
+            namespace="http://www.example.org/common/";
+            importType="http://schemas.xmlsoap.org/wsdl/"; />
+
+    <partnerLinks>
+        <partnerLink name="PongPartnerLink"
+                partnerLinkType="pong:PongPartnerLinkType"
+                myRole="Provider" />
+    </partnerLinks>
+
+    <variables>
+        <variable messageType="pong:PongRequest" name="pongRequest"/>
+        <variable messageType="pong:PongResponse" name="pongResponse"/>
+        <variable type="xsd:string" name="text" />
+    </variables>
+
+    <sequence name="Main">
+        <receive name="pongReceive"
+                createInstance="yes"
+                operation="Pong"
+                partnerLink="PongPartnerLink"
+                portType="pong:PongPortType"
+                variable="pongRequest"/>
+
+        <assign name="assignPongRequest">
+            <!-- add "ping" text to the input text -->
+            <copy>
+                <from>concat($pongRequest.body/pong:text, ' pong')</from>
+                <to>$text</to>
+            </copy>
+            <!-- initialize pongResponse -->
+            <copy>
+                <from>
+                    <literal>
+                        <pong:PongRequest>
+                            <pong:text/>
+                        </pong:PongRequest>
+                    </literal>
+                </from>
+                <to>$pongResponse.body</to>
+            </copy>
+            <!-- copy new text into pongResponse -->
+            <copy>
+                <from>$text</from>
+                <to>$pongResponse.body/pong:text</to>
+            </copy>
+        </assign>
+        
+        <reply name="pongReply"
+                partnerLink="PongPartnerLink"
+                portType="pong:PongPortType"
+                operation="Pong"
+                variable="pongResponse"/>
+    </sequence>
+</process>

Propchange: 
ode/branches/APACHE_ODE_1.X/distro/src/examples-jbi/maven2/ping-pong-osgi/src/main/resources/Pong.bpel
------------------------------------------------------------------------------
    svn:eol-style = native

Added: 
ode/branches/APACHE_ODE_1.X/distro/src/examples-jbi/maven2/ping-pong-osgi/src/main/resources/Pong.wsdl
URL: 
http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.X/distro/src/examples-jbi/maven2/ping-pong-osgi/src/main/resources/Pong.wsdl?rev=920318&view=auto
==============================================================================
--- 
ode/branches/APACHE_ODE_1.X/distro/src/examples-jbi/maven2/ping-pong-osgi/src/main/resources/Pong.wsdl
 (added)
+++ 
ode/branches/APACHE_ODE_1.X/distro/src/examples-jbi/maven2/ping-pong-osgi/src/main/resources/Pong.wsdl
 Mon Mar  8 13:31:39 2010
@@ -0,0 +1,60 @@
+<?xml version="1.0"?>
+<!--
+  ~ 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.
+  -->
+<definitions name="Pong"
+        targetNamespace="urn:/Pong.wsdl"
+        xmlns:tns="urn:/Pong.wsdl"
+        xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/";
+        xmlns:plnk="http://docs.oasis-open.org/wsbpel/2.0/plnktype";
+        xmlns="http://schemas.xmlsoap.org/wsdl/";>
+
+    <types>
+        <schema xmlns="http://www.w3.org/2001/XMLSchema";>
+            <import namespace="urn:/Pong.wsdl" 
schemaLocation="Pong.xsd"></import>
+        </schema>
+    </types>
+
+    <message name="PongRequest">
+        <part name="body" element="tns:PongRequest"/>
+    </message>
+
+    <message name="PongResponse">
+        <part name="body" element="tns:PongResponse"/>
+    </message>
+
+    <portType name="PongPortType">
+        <operation name="Pong">
+            <input message="tns:PongRequest"/>
+            <output message="tns:PongResponse"/>
+        </operation>
+    </portType>
+
+    <plnk:partnerLinkType name="PongPartnerLinkType">
+        <plnk:role name="Provider" portType="tns:PongPortType"/>
+    </plnk:partnerLinkType>
+    
+    <!--
+    
+    This is an abstract interface/portType definition.  Note the lack of 
+    binding and service.  Since Pong is only exposed on the JBI bus, the
+    JBI endpoint is defined in Pong.dd.
+
+    -->
+
+</definitions>

Propchange: 
ode/branches/APACHE_ODE_1.X/distro/src/examples-jbi/maven2/ping-pong-osgi/src/main/resources/Pong.wsdl
------------------------------------------------------------------------------
    svn:eol-style = native

Added: 
ode/branches/APACHE_ODE_1.X/distro/src/examples-jbi/maven2/ping-pong-osgi/src/main/resources/Pong.xsd
URL: 
http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.X/distro/src/examples-jbi/maven2/ping-pong-osgi/src/main/resources/Pong.xsd?rev=920318&view=auto
==============================================================================
--- 
ode/branches/APACHE_ODE_1.X/distro/src/examples-jbi/maven2/ping-pong-osgi/src/main/resources/Pong.xsd
 (added)
+++ 
ode/branches/APACHE_ODE_1.X/distro/src/examples-jbi/maven2/ping-pong-osgi/src/main/resources/Pong.xsd
 Mon Mar  8 13:31:39 2010
@@ -0,0 +1,35 @@
+<?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.
+  -->
+<schema targetNamespace="urn:/Pong.wsdl" 
xmlns="http://www.w3.org/2001/XMLSchema";>
+  <element name="PongRequest">
+    <complexType>
+      <all>
+        <element name="text" type="string"/>
+      </all>
+    </complexType>
+  </element>
+  <element name="PongResponse">
+    <complexType>
+      <all>
+        <element name="text" type="string"/>
+      </all>
+    </complexType>
+  </element>
+</schema>

Propchange: 
ode/branches/APACHE_ODE_1.X/distro/src/examples-jbi/maven2/ping-pong-osgi/src/main/resources/Pong.xsd
------------------------------------------------------------------------------
    svn:eol-style = native

Added: 
ode/branches/APACHE_ODE_1.X/distro/src/examples-jbi/maven2/ping-pong-osgi/src/main/resources/common.wsdl
URL: 
http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.X/distro/src/examples-jbi/maven2/ping-pong-osgi/src/main/resources/common.wsdl?rev=920318&view=auto
==============================================================================
--- 
ode/branches/APACHE_ODE_1.X/distro/src/examples-jbi/maven2/ping-pong-osgi/src/main/resources/common.wsdl
 (added)
+++ 
ode/branches/APACHE_ODE_1.X/distro/src/examples-jbi/maven2/ping-pong-osgi/src/main/resources/common.wsdl
 Mon Mar  8 13:31:39 2010
@@ -0,0 +1,23 @@
+<?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.
+  -->
+<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"; 
xmlns:tns="http://www.example.org/common/"; 
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"; 
xmlns:xsd="http://www.w3.org/2001/XMLSchema"; name="common" 
targetNamespace="http://www.example.org/common/";>
+  <wsdl:import location="Ping.wsdl" namespace="urn:/Ping.wsdl"/>
+  <wsdl:import location="Pong.wsdl" namespace="urn:/Pong.wsdl"/>
+</wsdl:definitions>

Propchange: 
ode/branches/APACHE_ODE_1.X/distro/src/examples-jbi/maven2/ping-pong-osgi/src/main/resources/common.wsdl
------------------------------------------------------------------------------
    svn:eol-style = native

Added: 
ode/branches/APACHE_ODE_1.X/distro/src/examples-jbi/maven2/ping-pong-osgi/src/main/resources/deploy.xml
URL: 
http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.X/distro/src/examples-jbi/maven2/ping-pong-osgi/src/main/resources/deploy.xml?rev=920318&view=auto
==============================================================================
--- 
ode/branches/APACHE_ODE_1.X/distro/src/examples-jbi/maven2/ping-pong-osgi/src/main/resources/deploy.xml
 (added)
+++ 
ode/branches/APACHE_ODE_1.X/distro/src/examples-jbi/maven2/ping-pong-osgi/src/main/resources/deploy.xml
 Mon Mar  8 13:31:39 2010
@@ -0,0 +1,42 @@
+<?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.
+  -->
+<deploy xmlns="http://www.apache.org/ode/schemas/dd/2007/03";
+        xmlns:pingProcess="urn:/Ping.bpel"
+        xmlns:pongProcess="urn:/Pong.bpel"
+        xmlns:ping="urn:/Ping.wsdl"
+        xmlns:pong="urn:/Pong.wsdl">
+
+       <process name="pingProcess:Ping">
+               <active>true</active>
+               <provide partnerLink="PingPartnerLink">
+                       <service name="ping:PingService" port="PingPort"/>
+               </provide>
+               <invoke partnerLink="PongPartnerLink">
+                       <service name="pong:PongService" port="PongPort"/>
+               </invoke>
+       </process>
+       <process name="pongProcess:Pong">
+               <active>true</active>
+               <provide partnerLink="PongPartnerLink">
+                       <service name="pong:PongService" port="PongPort"/>
+               </provide>
+       </process>
+    
+</deploy>

Propchange: 
ode/branches/APACHE_ODE_1.X/distro/src/examples-jbi/maven2/ping-pong-osgi/src/main/resources/deploy.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: ode/branches/APACHE_ODE_1.X/jbi-karaf/pom.xml
URL: 
http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.X/jbi-karaf/pom.xml?rev=920318&r1=920317&r2=920318&view=diff
==============================================================================
--- ode/branches/APACHE_ODE_1.X/jbi-karaf/pom.xml (original)
+++ ode/branches/APACHE_ODE_1.X/jbi-karaf/pom.xml Mon Mar  8 13:31:39 2010
@@ -26,6 +26,10 @@
     <packaging>bundle</packaging>
     <modelVersion>4.0.0</modelVersion>
 
+   <properties>
+    <jbi.version>1.1.0</jbi.version>
+    </properties>
+
   <parent>
     <groupId>org.apache.ode</groupId>
     <artifactId>ode</artifactId>
@@ -110,6 +114,24 @@
             <artifactId>ode-dao-jpa</artifactId>
             <version>${project.version}</version>
         </dependency>
-
+        <dependency>
+            <groupId>org.apache.ode</groupId>
+            <artifactId>ode-jbi</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.osgi</groupId>
+            <artifactId>org.osgi.core</artifactId>
+            <version>4.2.0</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.servicemix.specs</groupId>
+            <artifactId>org.apache.servicemix.specs.jbi-api-1.0</artifactId>
+            <version>${jbi.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>commons-io</groupId>
+            <artifactId>commons-io</artifactId>
+        </dependency>
     </dependencies>
 </project>

Added: 
ode/branches/APACHE_ODE_1.X/jbi-karaf/src/main/java/org/apache/ode/jbi/osgi/ServiceUnitActivator.java
URL: 
http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.X/jbi-karaf/src/main/java/org/apache/ode/jbi/osgi/ServiceUnitActivator.java?rev=920318&view=auto
==============================================================================
--- 
ode/branches/APACHE_ODE_1.X/jbi-karaf/src/main/java/org/apache/ode/jbi/osgi/ServiceUnitActivator.java
 (added)
+++ 
ode/branches/APACHE_ODE_1.X/jbi-karaf/src/main/java/org/apache/ode/jbi/osgi/ServiceUnitActivator.java
 Mon Mar  8 13:31:39 2010
@@ -0,0 +1,119 @@
+/*
+ * 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.
+ */
+
+package org.apache.ode.jbi.osgi;
+
+import java.io.File;
+import java.io.FileWriter;
+import java.io.InputStream;
+import java.net.URL;
+import java.util.Enumeration;
+
+import javax.jbi.component.Component;
+import javax.jbi.component.ServiceUnitManager;
+
+import org.apache.commons.io.IOUtils;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceReference;
+
+/**
+ * @author mproch
+ * 
+ */
+public class ServiceUnitActivator implements BundleActivator {
+
+    File rootDir;
+    String generatedName;
+
+    public void start(BundleContext context) throws Exception {
+        generatedName = context.getBundle().getSymbolicName();
+        rootDir = context.getDataFile("bpelData");
+        rootDir.mkdirs();
+        Enumeration<?> en = context.getBundle().findEntries("/", "*", false);
+        while (en.hasMoreElements()) {
+            copyOne(rootDir, (URL) en.nextElement());
+        }
+        ServiceReference[] refs = context.getAllServiceReferences(
+                "javax.jbi.component.Component", "(&(NAME=OdeBpelEngine))");
+        if (refs == null || refs.length != 1) {
+            throw new RuntimeException("no appropriate service :(");
+        }
+        ServiceUnitManager suM = ((Component) context.getService(refs[0]))
+                .getServiceUnitManager();
+        ClassLoader l = Thread.currentThread().getContextClassLoader();
+        try {
+            ClassLoader suL = suM.getClass().getClassLoader();
+            Thread.currentThread().setContextClassLoader(new 
BundleClassLoader(suL, context.getBundle()));
+            suM.deploy(generatedName, rootDir.getAbsolutePath());
+            suM.init(generatedName, rootDir.getAbsolutePath());
+            suM.start(generatedName);
+        } finally {
+            Thread.currentThread().setContextClassLoader(l);
+        }
+
+    }
+
+    private void copyOne(File dest, URL url) throws Exception {
+        File d = new File(dest, url.getPath());
+        InputStream str = url.openStream();
+        if (str != null) {
+            FileWriter wr = new FileWriter(d);
+            try {
+                IOUtils.copy(str, wr);
+            } finally {
+                wr.flush();
+                wr.close();
+            }
+        }
+    }
+
+    public void stop(BundleContext context) throws Exception {
+        ServiceReference[] refs = context.getAllServiceReferences(
+                "javax.jbi.component.Component", "(&(NAME=OdeBpelEngine))");
+        if (refs == null || refs.length != 1) {
+            throw new RuntimeException("no appropriate service :(");
+        }
+        ServiceUnitManager suM = ((Component) context.getService(refs[0]))
+                .getServiceUnitManager();
+        suM.shutDown(generatedName);
+        suM.undeploy(generatedName, rootDir.getAbsolutePath());
+
+    }
+
+    public class BundleClassLoader extends ClassLoader {
+        private final Bundle delegate;
+
+        public BundleClassLoader(ClassLoader parent, Bundle delegate) {
+            super(parent);
+            this.delegate = delegate;
+        }
+
+        @Override
+        public Class<?> loadClass(String name) throws ClassNotFoundException {
+            try {
+                return getParent().loadClass(name);
+            } catch (Exception e) {
+                return delegate.loadClass(name);
+            }
+        }
+    }
+
+}

Propchange: 
ode/branches/APACHE_ODE_1.X/jbi-karaf/src/main/java/org/apache/ode/jbi/osgi/ServiceUnitActivator.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: ode/branches/APACHE_ODE_1.X/pom.xml
URL: 
http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.X/pom.xml?rev=920318&r1=920317&r2=920318&view=diff
==============================================================================
--- ode/branches/APACHE_ODE_1.X/pom.xml (original)
+++ ode/branches/APACHE_ODE_1.X/pom.xml Mon Mar  8 13:31:39 2010
@@ -130,6 +130,7 @@
          <module>bpel-test</module>
          <module>axis2</module>
          <module>jbi</module>
+         <module>jbi-karaf</module>
          <module>axis2-war</module>
          <module>distro</module>
     </modules>


Reply via email to