You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicemix.apache.org by gn...@apache.org on 2009/08/26 13:19:20 UTC
svn commit: r807962 [1/2] - in /servicemix/sandbox/karaf/nmr:
assembly/src/main/descriptors/ assembly/src/main/filtered-resources/
assembly/src/main/filtered-resources/etc/ jbi/osgi/
jbi/osgi/src/main/java/org/apache/servicemix/jbi/osgi/ jbi/osgi/src/m...
Author: gnodet
Date: Wed Aug 26 11:19:19 2009
New Revision: 807962
URL: http://svn.apache.org/viewvc?rev=807962&view=rev
Log:
Switch everything but the document url handler to blueprint
Added:
servicemix/sandbox/karaf/nmr/assembly/src/main/filtered-resources/etc/config.properties
servicemix/sandbox/karaf/nmr/jbi/osgi/src/main/java/org/apache/servicemix/jbi/osgi/PassThroughConverter.java
servicemix/sandbox/karaf/nmr/jbi/osgi/src/main/resources/OSGI-INF/
servicemix/sandbox/karaf/nmr/jbi/osgi/src/main/resources/OSGI-INF/blueprint/
servicemix/sandbox/karaf/nmr/jbi/osgi/src/main/resources/OSGI-INF/blueprint/servicemix-jbi.xml
- copied, changed from r807663, servicemix/sandbox/karaf/nmr/jbi/osgi/src/main/resources/META-INF/spring/servicemix-jbi.xml
servicemix/sandbox/karaf/nmr/naming/src/main/java/org/apache/servicemix/naming/Activator.java
servicemix/sandbox/karaf/nmr/naming/src/main/java/org/apache/servicemix/naming/OSGiServicesContext.java
servicemix/sandbox/karaf/nmr/naming/src/main/java/org/apache/servicemix/naming/ProxyInvocationHandler.java
servicemix/sandbox/karaf/nmr/nmr/osgi/src/main/java/org/apache/servicemix/nmr/osgi/PassThroughConverter.java
servicemix/sandbox/karaf/nmr/nmr/osgi/src/main/resources/OSGI-INF/
servicemix/sandbox/karaf/nmr/nmr/osgi/src/main/resources/OSGI-INF/blueprint/
servicemix/sandbox/karaf/nmr/nmr/osgi/src/main/resources/OSGI-INF/blueprint/servicemix-nmr.xml
- copied, changed from r807663, servicemix/sandbox/karaf/nmr/nmr/osgi/src/main/resources/META-INF/spring/servicemix-nmr.xml
servicemix/sandbox/karaf/nmr/transaction/src/main/java/javax/
servicemix/sandbox/karaf/nmr/transaction/src/main/java/javax/resource/
servicemix/sandbox/karaf/nmr/transaction/src/main/java/javax/resource/spi/
servicemix/sandbox/karaf/nmr/transaction/src/main/java/javax/resource/spi/XATerminator.java
servicemix/sandbox/karaf/nmr/transaction/src/main/java/org/apache/servicemix/transaction/Activator.java
servicemix/sandbox/karaf/nmr/transaction/src/main/java/org/apache/servicemix/transaction/TransactionManagerService.java
Removed:
servicemix/sandbox/karaf/nmr/jbi/osgi/src/main/resources/META-INF/
servicemix/sandbox/karaf/nmr/naming/src/main/resources/META-INF/spring/
servicemix/sandbox/karaf/nmr/nmr/osgi/src/main/resources/META-INF/
servicemix/sandbox/karaf/nmr/transaction/src/main/java/org/apache/servicemix/transaction/HowlLogFactoryBean.java
servicemix/sandbox/karaf/nmr/transaction/src/main/java/org/apache/servicemix/transaction/TransactionManagerFactoryBean.java
servicemix/sandbox/karaf/nmr/transaction/src/main/resources/META-INF/spring/
Modified:
servicemix/sandbox/karaf/nmr/assembly/src/main/descriptors/unix-bin.xml
servicemix/sandbox/karaf/nmr/assembly/src/main/descriptors/windows-bin.xml
servicemix/sandbox/karaf/nmr/assembly/src/main/filtered-resources/features.xml
servicemix/sandbox/karaf/nmr/jbi/osgi/pom.xml
servicemix/sandbox/karaf/nmr/naming/pom.xml
servicemix/sandbox/karaf/nmr/naming/src/main/java/org/apache/servicemix/naming/GlobalInitialContextFactoryBuilder.java
servicemix/sandbox/karaf/nmr/naming/src/main/java/org/apache/servicemix/naming/OSGiContext.java
servicemix/sandbox/karaf/nmr/naming/src/main/java/org/apache/servicemix/naming/OSGiInitialContextFactoryBuilder.java
servicemix/sandbox/karaf/nmr/nmr/osgi/pom.xml
servicemix/sandbox/karaf/nmr/transaction/pom.xml
servicemix/sandbox/karaf/nmr/transaction/src/main/java/org/apache/servicemix/transaction/GeronimoPlatformTransactionManager.java
Modified: servicemix/sandbox/karaf/nmr/assembly/src/main/descriptors/unix-bin.xml
URL: http://svn.apache.org/viewvc/servicemix/sandbox/karaf/nmr/assembly/src/main/descriptors/unix-bin.xml?rev=807962&r1=807961&r2=807962&view=diff
==============================================================================
--- servicemix/sandbox/karaf/nmr/assembly/src/main/descriptors/unix-bin.xml (original)
+++ servicemix/sandbox/karaf/nmr/assembly/src/main/descriptors/unix-bin.xml Wed Aug 26 11:19:19 2009
@@ -32,6 +32,7 @@
<exclude>bin/**</exclude>
<exclude>demos/**</exclude>
<exclude>etc/org.apache.felix.karaf.features.cfg</exclude>
+ <exclude>etc/config.properties</exclude>
<exclude>LICENSE.txt</exclude>
<exclude>NOTICE.txt</exclude>
<exclude>README.txt</exclude>
Modified: servicemix/sandbox/karaf/nmr/assembly/src/main/descriptors/windows-bin.xml
URL: http://svn.apache.org/viewvc/servicemix/sandbox/karaf/nmr/assembly/src/main/descriptors/windows-bin.xml?rev=807962&r1=807961&r2=807962&view=diff
==============================================================================
--- servicemix/sandbox/karaf/nmr/assembly/src/main/descriptors/windows-bin.xml (original)
+++ servicemix/sandbox/karaf/nmr/assembly/src/main/descriptors/windows-bin.xml Wed Aug 26 11:19:19 2009
@@ -32,6 +32,7 @@
<exclude>bin/**</exclude>
<exclude>demos/**</exclude>
<exclude>etc/org.apache.felix.karaf.features.cfg</exclude>
+ <exclude>etc/config.properties</exclude>
<exclude>LICENSE.txt</exclude>
<exclude>NOTICE.txt</exclude>
<exclude>README.txt</exclude>
Added: servicemix/sandbox/karaf/nmr/assembly/src/main/filtered-resources/etc/config.properties
URL: http://svn.apache.org/viewvc/servicemix/sandbox/karaf/nmr/assembly/src/main/filtered-resources/etc/config.properties?rev=807962&view=auto
==============================================================================
--- servicemix/sandbox/karaf/nmr/assembly/src/main/filtered-resources/etc/config.properties (added)
+++ servicemix/sandbox/karaf/nmr/assembly/src/main/filtered-resources/etc/config.properties Wed Aug 26 11:19:19 2009
@@ -0,0 +1,355 @@
+################################################################################
+#
+# 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.
+#
+################################################################################
+
+#
+# Framework selection properties
+#
+karaf.framework=felix
+
+karaf.framework.equinox=system/org/eclipse/osgi/3.5.0.v20090520/osgi-3.5.0.v20090520.jar
+karaf.framework.felix=system/org/apache/felix/org.apache.felix.framework/1.9.0-SNAPSHOT/org.apache.felix.framework-1.9.0-SNAPSHOT.jar
+
+#
+# Framework config properties.
+#
+org.osgi.framework.system.packages=org.osgi.framework; version=1.5.0, \
+ org.osgi.framework.launch; version=1.0.0, \
+ org.osgi.framework.hooks.service; version=1.0.0, \
+ org.osgi.service.packageadmin; version=1.2.0, \
+ org.osgi.service.startlevel; version=1.1.0, \
+ org.osgi.service.url; version=1.0.0, \
+ org.osgi.util.tracker; version=1.4.0 \
+ ${jre-${java.specification.version}}
+
+org.osgi.framework.system.packages.extra=\
+ org.apache.felix.karaf.jaas.boot; version=0.9.0, \
+ org.apache.felix.karaf.version; version=0.9.0
+
+org.osgi.framework.bootdelegation=sun.*,com.sun.management*
+
+# To enable the use of the startup.properties file to control the start level:
+karaf.auto.start=startup.properties
+#felix.auto.start=all
+
+org.osgi.framework.startlevel.beginning=100
+karaf.startlevel.bundle=60
+
+#
+# Bundle config properties.
+#
+obr.repository.url=http://svn.apache.org/repos/asf/servicemix/smx4/obr-repo/repository.xml
+
+#
+# FileMonitor properties
+#
+org.apache.felix.karaf.filemonitor.configDir = ${karaf.base}/etc
+org.apache.felix.karaf.filemonitor.monitorDir = ${karaf.base}/deploy
+org.apache.felix.karaf.filemonitor.generatedJarDir = ${karaf.base}/data/generated-bundles
+org.apache.felix.karaf.filemonitor.scanInterval = 500
+
+
+#
+# Java platform package export properties.
+#
+jre-1.5=, \
+ javax.accessibility; \
+ javax.activity; \
+ javax.crypto; \
+ javax.crypto.interfaces; \
+ javax.crypto.spec; \
+ javax.imageio; \
+ javax.imageio.event; \
+ javax.imageio.metadata; \
+ javax.imageio.plugins.bmp; \
+ javax.imageio.plugins.jpeg; \
+ javax.imageio.spi; \
+ javax.imageio.stream; \
+ javax.management; \
+ javax.management.loading; \
+ javax.management.modelmbean; \
+ javax.management.monitor; \
+ javax.management.openmbean; \
+ javax.management.relation; \
+ javax.management.remote; \
+ javax.management.remote.rmi; \
+ javax.management.timer; \
+ javax.naming; \
+ javax.naming.directory; \
+ javax.naming.event; \
+ javax.naming.ldap; \
+ javax.naming.spi; \
+ javax.net; \
+ javax.net.ssl; \
+ javax.print; \
+ javax.print.attribute; \
+ javax.print.attribute.standard; \
+ javax.print.event; \
+ javax.rmi; \
+ javax.rmi.CORBA; \
+ javax.rmi.ssl; \
+ javax.security.auth; \
+ javax.security.auth.callback; \
+ javax.security.auth.kerberos; \
+ javax.security.auth.login; \
+ javax.security.auth.spi; \
+ javax.security.auth.x500; \
+ javax.security.cert; \
+ javax.security.sasl; \
+ javax.sound.midi; \
+ javax.sound.midi.spi; \
+ javax.sound.sampled; \
+ javax.sound.sampled.spi; \
+ javax.sql; \
+ javax.sql.rowset; \
+ javax.sql.rowset.serial; \
+ javax.sql.rowset.spi; \
+ javax.swing; \
+ javax.swing.border; \
+ javax.swing.colorchooser; \
+ javax.swing.event; \
+ javax.swing.filechooser; \
+ javax.swing.plaf; \
+ javax.swing.plaf.basic; \
+ javax.swing.plaf.metal; \
+ javax.swing.plaf.multi; \
+ javax.swing.plaf.synth; \
+ javax.swing.table; \
+ javax.swing.text; \
+ javax.swing.text.html; \
+ javax.swing.text.html.parser; \
+ javax.swing.text.rtf; \
+ javax.swing.tree; \
+ javax.swing.undo; \
+# javax.transaction; \
+# javax.transaction.xa; \
+ javax.xml; \
+ javax.xml.datatype; \
+ javax.xml.namespace; \
+ javax.xml.parsers; \
+ javax.xml.transform; \
+ javax.xml.transform.dom; \
+ javax.xml.transform.sax; \
+ javax.xml.transform.stream; \
+ javax.xml.validation; \
+ javax.xml.xpath; \
+ org.ietf.jgss; \
+ org.omg.CORBA; \
+ org.omg.CORBA_2_3; \
+ org.omg.CORBA_2_3.portable; \
+ org.omg.CORBA.DynAnyPackage; \
+ org.omg.CORBA.ORBPackage; \
+ org.omg.CORBA.portable; \
+ org.omg.CORBA.TypeCodePackage; \
+ org.omg.CosNaming; \
+ org.omg.CosNaming.NamingContextExtPackage; \
+ org.omg.CosNaming.NamingContextPackage; \
+ org.omg.Dynamic; \
+ org.omg.DynamicAny; \
+ org.omg.DynamicAny.DynAnyFactoryPackage; \
+ org.omg.DynamicAny.DynAnyPackage; \
+ org.omg.IOP; \
+ org.omg.IOP.CodecFactoryPackage; \
+ org.omg.IOP.CodecPackage; \
+ org.omg.Messaging; \
+ org.omg.PortableInterceptor; \
+ org.omg.PortableInterceptor.ORBInitInfoPackage; \
+ org.omg.PortableServer; \
+ org.omg.PortableServer.CurrentPackage; \
+ org.omg.PortableServer.POAManagerPackage; \
+ org.omg.PortableServer.POAPackage; \
+ org.omg.PortableServer.portable; \
+ org.omg.PortableServer.ServantLocatorPackage; \
+ org.omg.SendingContext; \
+ org.omg.stub.java.rmi; \
+ org.omg.stub.javax.management.remote.rmi; \
+ org.w3c.dom; \
+ org.w3c.dom.bootstrap; \
+ org.w3c.dom.css; \
+ org.w3c.dom.events; \
+ org.w3c.dom.html; \
+ org.w3c.dom.ls; \
+ org.w3c.dom.ranges; \
+ org.w3c.dom.stylesheets; \
+ org.w3c.dom.traversal; \
+ org.w3c.dom.views; \
+ org.xml.sax; \
+ org.xml.sax.ext; \
+ org.xml.sax.helpers; \
+ version="1.5.0"
+
+jre-1.6=, \
+ javax.accessibility; \
+ javax.activation; \
+ javax.activity; \
+ javax.annotation; \
+ javax.annotation.processing; \
+ javax.crypto; \
+ javax.crypto.interfaces; \
+ javax.crypto.spec; \
+ javax.imageio; \
+ javax.imageio.event; \
+ javax.imageio.metadata; \
+ javax.imageio.plugins.bmp; \
+ javax.imageio.plugins.jpeg; \
+ javax.imageio.spi; \
+ javax.imageio.stream; \
+ javax.jws; \
+ javax.jws.soap; \
+ javax.lang.model; \
+ javax.lang.model.element; \
+ javax.lang.model.type; \
+ javax.lang.model.util; \
+ javax.management; \
+ javax.management.loading; \
+ javax.management.modelmbean; \
+ javax.management.monitor; \
+ javax.management.openmbean; \
+ javax.management.relation; \
+ javax.management.remote; \
+ javax.management.remote.rmi; \
+ javax.management.timer; \
+ javax.naming; \
+ javax.naming.directory; \
+ javax.naming.event; \
+ javax.naming.ldap; \
+ javax.naming.spi; \
+ javax.net; \
+ javax.net.ssl; \
+ javax.print; \
+ javax.print.attribute; \
+ javax.print.attribute.standard; \
+ javax.print.event; \
+ javax.rmi; \
+ javax.rmi.CORBA; \
+ javax.rmi.ssl; \
+ javax.script; \
+ javax.security.auth; \
+ javax.security.auth.callback; \
+ javax.security.auth.kerberos; \
+ javax.security.auth.login; \
+ javax.security.auth.spi; \
+ javax.security.auth.x500; \
+ javax.security.cert; \
+ javax.security.sasl; \
+ javax.sound.midi; \
+ javax.sound.midi.spi; \
+ javax.sound.sampled; \
+ javax.sound.sampled.spi; \
+ javax.sql; \
+ javax.sql.rowset; \
+ javax.sql.rowset.serial; \
+ javax.sql.rowset.spi; \
+ javax.swing; \
+ javax.swing.border; \
+ javax.swing.colorchooser; \
+ javax.swing.event; \
+ javax.swing.filechooser; \
+ javax.swing.plaf; \
+ javax.swing.plaf.basic; \
+ javax.swing.plaf.metal; \
+ javax.swing.plaf.multi; \
+ javax.swing.plaf.synth; \
+ javax.swing.table; \
+ javax.swing.text; \
+ javax.swing.text.html; \
+ javax.swing.text.html.parser; \
+ javax.swing.text.rtf; \
+ javax.swing.tree; \
+ javax.swing.undo; \
+ javax.tools; \
+# javax.transaction; \
+# javax.transaction.xa; \
+ javax.xml; \
+ javax.xml.bind; \
+ javax.xml.bind.annotation; \
+ javax.xml.bind.annotation.adapters; \
+ javax.xml.bind.attachment; \
+ javax.xml.bind.helpers; \
+ javax.xml.bind.util; \
+ javax.xml.crypto; \
+ javax.xml.crypto.dom; \
+ javax.xml.crypto.dsig; \
+ javax.xml.crypto.dsig.dom; \
+ javax.xml.crypto.dsig.keyinfo; \
+ javax.xml.crypto.dsig.spec; \
+ javax.xml.datatype; \
+ javax.xml.namespace; \
+ javax.xml.parsers; \
+ javax.xml.soap; \
+ javax.xml.stream; \
+ javax.xml.stream.events; \
+ javax.xml.stream.util; \
+ javax.xml.transform; \
+ javax.xml.transform.dom; \
+ javax.xml.transform.sax; \
+ javax.xml.transform.stax; \
+ javax.xml.transform.stream; \
+ javax.xml.validation; \
+ javax.xml.ws; \
+ javax.xml.ws.handler; \
+ javax.xml.ws.handler.soap; \
+ javax.xml.ws.http; \
+ javax.xml.ws.soap; \
+ javax.xml.ws.spi; \
+ javax.xml.xpath; \
+ org.ietf.jgss; \
+ org.omg.CORBA; \
+ org.omg.CORBA_2_3; \
+ org.omg.CORBA_2_3.portable; \
+ org.omg.CORBA.DynAnyPackage; \
+ org.omg.CORBA.ORBPackage; \
+ org.omg.CORBA.portable; \
+ org.omg.CORBA.TypeCodePackage; \
+ org.omg.CosNaming; \
+ org.omg.CosNaming.NamingContextExtPackage; \
+ org.omg.CosNaming.NamingContextPackage; \
+ org.omg.Dynamic; \
+ org.omg.DynamicAny; \
+ org.omg.DynamicAny.DynAnyFactoryPackage; \
+ org.omg.DynamicAny.DynAnyPackage; \
+ org.omg.IOP; \
+ org.omg.IOP.CodecFactoryPackage; \
+ org.omg.IOP.CodecPackage; \
+ org.omg.Messaging; \
+ org.omg.PortableInterceptor; \
+ org.omg.PortableInterceptor.ORBInitInfoPackage; \
+ org.omg.PortableServer; \
+ org.omg.PortableServer.CurrentPackage; \
+ org.omg.PortableServer.POAManagerPackage; \
+ org.omg.PortableServer.POAPackage; \
+ org.omg.PortableServer.portable; \
+ org.omg.PortableServer.ServantLocatorPackage; \
+ org.omg.SendingContext; \
+ org.omg.stub.java.rmi; \
+ org.omg.stub.javax.management.remote.rmi; \
+ org.w3c.dom; \
+ org.w3c.dom.bootstrap; \
+ org.w3c.dom.css; \
+ org.w3c.dom.events; \
+ org.w3c.dom.html; \
+ org.w3c.dom.ls; \
+ org.w3c.dom.ranges; \
+ org.w3c.dom.stylesheets; \
+ org.w3c.dom.traversal; \
+ org.w3c.dom.views; \
+ org.w3c.dom.xpath; \
+ org.xml.sax; \
+ org.xml.sax.ext; \
+ org.xml.sax.helpers; \
+ version="1.6.0"
Modified: servicemix/sandbox/karaf/nmr/assembly/src/main/filtered-resources/features.xml
URL: http://svn.apache.org/viewvc/servicemix/sandbox/karaf/nmr/assembly/src/main/filtered-resources/features.xml?rev=807962&r1=807961&r2=807962&view=diff
==============================================================================
--- servicemix/sandbox/karaf/nmr/assembly/src/main/filtered-resources/features.xml (original)
+++ servicemix/sandbox/karaf/nmr/assembly/src/main/filtered-resources/features.xml Wed Aug 26 11:19:19 2009
@@ -18,21 +18,17 @@
-->
<features>
<feature name="naming" version="${version}">
- <feature>spring-dm</feature>
- <bundle>mvn:org.apache.xbean/xbean-naming/${xbean.version}</bundle>
<bundle>mvn:org.apache.servicemix.naming/org.apache.servicemix.naming/${pom.version}</bundle>
</feature>
<feature name="transaction" version="${version}">
- <feature>spring-dm</feature>
- <bundle>mvn:org.apache.geronimo.specs/geronimo-jta_1.1_spec/${geronimo.jta.version}</bundle>
- <bundle>mvn:org.apache.geronimo.specs/geronimo-j2ee-connector_1.5_spec/${geronimo.j2ee.connector.version}</bundle>
- <bundle>mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.howl/${howl.version}</bundle>
- <bundle>mvn:org.apache.geronimo.components/geronimo-transaction/${geronimo.transaction.version}</bundle>
- <bundle>mvn:org.springframework/spring-tx/${spring.version}</bundle>
<bundle>mvn:org.apache.servicemix.transaction/org.apache.servicemix.transaction/${version}</bundle>
</feature>
- <feature name="nmr" version="${version}">
+ <feature name="document" version="${version}">
<feature>spring-dm</feature>
+ <bundle>mvn:org.apache.servicemix.document/org.apache.servicemix.document/${pom.version}</bundle>
+ </feature>
+ <feature name="nmr" version="${version}">
+ <feature>document</feature>
<!-- those two bundles are currently required for servicemix-utils to resolve -->
<bundle>mvn:org.apache.servicemix.specs/org.apache.servicemix.specs.activation-api-1.1/${servicemix.specs.version}</bundle>
<bundle>mvn:org.apache.servicemix.specs/org.apache.servicemix.specs.jbi-api-1.0/${servicemix.specs.version}</bundle>
@@ -66,6 +62,7 @@
</feature>
<feature name="jbi-cluster" version="${version}">
<feature version="${version}">jbi</feature>
+ <feature>spring</feature>
<bundle>mvn:org.apache.geronimo.specs/geronimo-jms_1.1_spec/${geronimo.jms.version}</bundle>
<bundle>mvn:org.springframework/spring-jms/${spring.version}</bundle>
<bundle>mvn:org.apache.servicemix.jbi.cluster/org.apache.servicemix.jbi.cluster.requestor/${pom.version}</bundle>
Modified: servicemix/sandbox/karaf/nmr/jbi/osgi/pom.xml
URL: http://svn.apache.org/viewvc/servicemix/sandbox/karaf/nmr/jbi/osgi/pom.xml?rev=807962&r1=807961&r2=807962&view=diff
==============================================================================
--- servicemix/sandbox/karaf/nmr/jbi/osgi/pom.xml (original)
+++ servicemix/sandbox/karaf/nmr/jbi/osgi/pom.xml Wed Aug 26 11:19:19 2009
@@ -70,6 +70,7 @@
org.apache.geronimo.transaction.manager;resolution:=optional,
org.apache.servicemix.document,
org.apache.servicemix.nmr.api,
+ org.apache.servicemix.nmr.api.service,
org.apache.servicemix.nmr.osgi,
org.apache.servicemix.jbi.runtime,
org.apache.servicemix.jbi.runtime.impl,
@@ -78,7 +79,6 @@
org.osgi.service.url,
*
</Import-Package>
- <Spring-Context>*;publish-context:=false;create-asynchronously:=true</Spring-Context>
</instructions>
</configuration>
</plugin>
Added: servicemix/sandbox/karaf/nmr/jbi/osgi/src/main/java/org/apache/servicemix/jbi/osgi/PassThroughConverter.java
URL: http://svn.apache.org/viewvc/servicemix/sandbox/karaf/nmr/jbi/osgi/src/main/java/org/apache/servicemix/jbi/osgi/PassThroughConverter.java?rev=807962&view=auto
==============================================================================
--- servicemix/sandbox/karaf/nmr/jbi/osgi/src/main/java/org/apache/servicemix/jbi/osgi/PassThroughConverter.java (added)
+++ servicemix/sandbox/karaf/nmr/jbi/osgi/src/main/java/org/apache/servicemix/jbi/osgi/PassThroughConverter.java Wed Aug 26 11:19:19 2009
@@ -0,0 +1,41 @@
+/*
+ * 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.servicemix.jbi.osgi;
+
+import org.osgi.service.blueprint.container.Converter;
+import org.osgi.service.blueprint.container.ReifiedType;
+
+/**
+ * A simple converter to convert generics
+ */
+public class PassThroughConverter implements Converter {
+
+ private Class target;
+
+ public void setTarget(Class target) {
+ this.target = target;
+ }
+
+ public boolean canConvert(Object sourceObject, ReifiedType targetType) {
+ return target.isInstance(sourceObject) &&
+ targetType.getRawClass().equals(target);
+ }
+
+ public Object convert(Object sourceObject, ReifiedType targetType) throws Exception {
+ return sourceObject;
+ }
+}
\ No newline at end of file
Copied: servicemix/sandbox/karaf/nmr/jbi/osgi/src/main/resources/OSGI-INF/blueprint/servicemix-jbi.xml (from r807663, servicemix/sandbox/karaf/nmr/jbi/osgi/src/main/resources/META-INF/spring/servicemix-jbi.xml)
URL: http://svn.apache.org/viewvc/servicemix/sandbox/karaf/nmr/jbi/osgi/src/main/resources/OSGI-INF/blueprint/servicemix-jbi.xml?p2=servicemix/sandbox/karaf/nmr/jbi/osgi/src/main/resources/OSGI-INF/blueprint/servicemix-jbi.xml&p1=servicemix/sandbox/karaf/nmr/jbi/osgi/src/main/resources/META-INF/spring/servicemix-jbi.xml&r1=807663&r2=807962&rev=807962&view=diff
==============================================================================
--- servicemix/sandbox/karaf/nmr/jbi/osgi/src/main/resources/META-INF/spring/servicemix-jbi.xml (original)
+++ servicemix/sandbox/karaf/nmr/jbi/osgi/src/main/resources/OSGI-INF/blueprint/servicemix-jbi.xml Wed Aug 26 11:19:19 2009
@@ -17,17 +17,15 @@
limitations under the License.
-->
-<beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:osgi="http://www.springframework.org/schema/osgi"
- 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/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">
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
+ xmlns:cm="http://www.osgi.org/xmlns/blueprint-cm/v1.0.0"
+ xmlns:ext="http://geronimo.apache.org/blueprint/xmlns/blueprint-ext/v1.0.0">
+
+ <type-converters>
+ <bean class="org.apache.servicemix.nmr.osgi.PassThroughConverter">
+ <property name="target" value="org.apache.servicemix.nmr.api.service.ServiceRegistry"/>
+ </bean>
+ </type-converters>
<!-- JBI Component Registry -->
<bean id="componentRegistry" class="org.apache.servicemix.jbi.runtime.impl.ComponentRegistryImpl">
@@ -61,35 +59,34 @@
</bean>
<!-- Reference to the ServiceMix NMR -->
- <osgi:reference id="nmr"
+ <reference id="nmr"
interface="org.apache.servicemix.nmr.api.NMR" />
<!-- Reference to the DocumentRepository -->
- <osgi:reference id="documentRepository"
+ <reference id="documentRepository"
interface="org.apache.servicemix.document.DocumentRepository" />
<!-- Reference to the Transaction Manager -->
- <osgi:list id="transactionManagers"
- interface="javax.transaction.TransactionManager"
- cardinality="0..N"
- greedy-proxying="true"
- context-class-loader="unmanaged" />
+ <reference-list id="transactionManagers"
+ interface="javax.transaction.TransactionManager"
+ availability="optional"
+ ext:proxy-method="greedy"/>
<!-- Reference to the JMX server -->
- <osgi:list id="mbeanServers"
- interface="javax.management.MBeanServer"
- cardinality="0..N" />
+ <reference-list id="mbeanServers"
+ interface="javax.management.MBeanServer"
+ availability="optional"/>
<!-- The InitialContext -->
<bean id="namingContext" class="javax.naming.InitialContext">
- <constructor-arg><null/></constructor-arg>
+ <argument><null/></argument>
</bean>
<!-- Expose the JBI components registry in OSGi -->
- <osgi:service ref="componentRegistry">
- <osgi:interfaces>
+ <service ref="componentRegistry">
+ <interfaces>
<value>org.apache.servicemix.jbi.runtime.ComponentRegistry</value>
- </osgi:interfaces>
- </osgi:service>
+ </interfaces>
+ </service>
-</beans>
+</blueprint>
Modified: servicemix/sandbox/karaf/nmr/naming/pom.xml
URL: http://svn.apache.org/viewvc/servicemix/sandbox/karaf/nmr/naming/pom.xml?rev=807962&r1=807961&r2=807962&view=diff
==============================================================================
--- servicemix/sandbox/karaf/nmr/naming/pom.xml (original)
+++ servicemix/sandbox/karaf/nmr/naming/pom.xml Wed Aug 26 11:19:19 2009
@@ -31,63 +31,155 @@
<packaging>bundle</packaging>
<name>Apache ServiceMix Naming</name>
+ <properties>
+ <xbean-version>3.5</xbean-version>
+ </properties>
+
<dependencies>
<dependency>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
- </dependency>
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-beans</artifactId>
- </dependency>
- <dependency>
- <groupId>org.springframework.osgi</groupId>
- <artifactId>spring-osgi-core</artifactId>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.osgi.core</artifactId>
+ <version>1.2.0</version>
+ <scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.felix</groupId>
<artifactId>org.osgi.compendium</artifactId>
+ <version>1.2.0</version>
+ <scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.xbean</groupId>
<artifactId>xbean-naming</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.felix</groupId>
- <artifactId>org.osgi.core</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>log4j</groupId>
- <artifactId>log4j</artifactId>
- <scope>test</scope>
+ <version>${xbean-version}</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <source>1.5</source>
+ <target>1.5</target>
+ </configuration>
+ </plugin>
+ <plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
+ <version>2.0.0</version>
+ <extensions>true</extensions>
<configuration>
<instructions>
+ <Export-Package>org.apache.xbean.naming.*;version="${xbean-version}"</Export-Package>
<Bundle-SymbolicName>${pom.artifactId}</Bundle-SymbolicName>
- <Export-Package>${pom.artifactId}*</Export-Package>
+ <Bundle-Activator>org.apache.servicemix.naming.Activator</Bundle-Activator>
+ <Export-Service>javax.naming.spi.InitialContextFactoryBuilder</Export-Service>
<DynamicImport-Package>*</DynamicImport-Package>
- <Spring-Context>*;publish-context:=false</Spring-Context>
</instructions>
</configuration>
</plugin>
- <!-- generate dependencies versions -->
<plugin>
- <groupId>org.apache.servicemix.tooling</groupId>
- <artifactId>depends-maven-plugin</artifactId>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>unpack-sources</id>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>unpack</goal>
+ </goals>
+ <configuration>
+ <artifactItems>
+ <artifactItem>
+ <groupId>org.apache.xbean</groupId>
+ <artifactId>xbean-naming</artifactId>
+ <classifier>sources</classifier>
+ </artifactItem>
+ </artifactItems>
+ <outputDirectory>${project.build.directory}/sources</outputDirectory>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <executions>
+ <execution>
+ <phase>generate-sources</phase>
+ <configuration>
+ <tasks>
+ <copy todir="${project.build.directory}/sources">
+ <fileset dir="${basedir}/src/main/java" />
+ </copy>
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-source-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>attach-sources</id>
+ <phase>package</phase>
+ <goals>
+ <goal>jar</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-javadoc-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>package1</id>
+ <phase>package</phase>
+ <goals>
+ <goal>jar</goal>
+ </goals>
+ <configuration>
+ <minmemory>128m</minmemory>
+ <maxmemory>512m</maxmemory>
+ <sourcepath>${project.build.directory}/sources</sourcepath>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-shade-plugin</artifactId>
+ <version>1.1</version>
<executions>
<execution>
- <id>generate-depends-file</id>
+ <phase>package</phase>
<goals>
- <goal>generate-depends-file</goal>
+ <goal>shade</goal>
</goals>
+ <configuration>
+ <artifactSet>
+ <includes>
+ <include>org.apache.xbean:xbean-naming</include>
+ <include>${project.groupId}:${project.artifactId}</include>
+ </includes>
+ </artifactSet>
+ <filters>
+ <filter>
+ <artifact>org.apache.xbean:xbean-naming</artifact>
+ <excludes>
+ <exclude>org/**</exclude>
+ </excludes>
+ </filter>
+ </filters>
+ <createSourcesJar>true</createSourcesJar>
+ <promoteTransitiveDependencies>true</promoteTransitiveDependencies>
+ <createDependencyReducedPom>true</createDependencyReducedPom>
+ </configuration>
</execution>
</executions>
</plugin>
Added: servicemix/sandbox/karaf/nmr/naming/src/main/java/org/apache/servicemix/naming/Activator.java
URL: http://svn.apache.org/viewvc/servicemix/sandbox/karaf/nmr/naming/src/main/java/org/apache/servicemix/naming/Activator.java?rev=807962&view=auto
==============================================================================
--- servicemix/sandbox/karaf/nmr/naming/src/main/java/org/apache/servicemix/naming/Activator.java (added)
+++ servicemix/sandbox/karaf/nmr/naming/src/main/java/org/apache/servicemix/naming/Activator.java Wed Aug 26 11:19:19 2009
@@ -0,0 +1,52 @@
+/*
+ * 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.servicemix.naming;
+
+import java.util.Properties;
+
+import javax.naming.spi.InitialContextFactoryBuilder;
+
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.Constants;
+import org.osgi.framework.ServiceRegistration;
+import org.apache.xbean.naming.context.WritableContext;
+import org.apache.xbean.naming.global.GlobalContextManager;
+
+/**
+ */
+public class Activator implements BundleActivator {
+
+ private OSGiInitialContextFactoryBuilder osgiIcfb;
+ private GlobalInitialContextFactoryBuilder globalIcfb;
+ private ServiceRegistration registration;
+
+ public void start(BundleContext bundleContext) throws Exception {
+ osgiIcfb = new OSGiInitialContextFactoryBuilder(bundleContext, new OSGiContext(new OSGiServicesContext(bundleContext)));
+ globalIcfb = new GlobalInitialContextFactoryBuilder();
+ GlobalContextManager.setGlobalContext(new WritableContext());
+ Properties props = new Properties();
+ props.put(Constants.SERVICE_RANKING, Integer.valueOf(-1));
+ registration = bundleContext.registerService(InitialContextFactoryBuilder.class.getName(), globalIcfb, props);
+ }
+
+ public void stop(BundleContext bundleContext) throws Exception {
+ registration.unregister();
+ osgiIcfb.destroy();
+ GlobalContextManager.setGlobalContext(null);
+ }
+}
Modified: servicemix/sandbox/karaf/nmr/naming/src/main/java/org/apache/servicemix/naming/GlobalInitialContextFactoryBuilder.java
URL: http://svn.apache.org/viewvc/servicemix/sandbox/karaf/nmr/naming/src/main/java/org/apache/servicemix/naming/GlobalInitialContextFactoryBuilder.java?rev=807962&r1=807961&r2=807962&view=diff
==============================================================================
--- servicemix/sandbox/karaf/nmr/naming/src/main/java/org/apache/servicemix/naming/GlobalInitialContextFactoryBuilder.java (original)
+++ servicemix/sandbox/karaf/nmr/naming/src/main/java/org/apache/servicemix/naming/GlobalInitialContextFactoryBuilder.java Wed Aug 26 11:19:19 2009
@@ -18,39 +18,22 @@
import java.util.Hashtable;
-import javax.naming.spi.InitialContextFactoryBuilder;
-import javax.naming.spi.InitialContextFactory;
import javax.naming.NamingException;
-import javax.naming.Context;
+import javax.naming.spi.InitialContextFactory;
+import javax.naming.spi.InitialContextFactoryBuilder;
-import org.springframework.beans.factory.InitializingBean;
-import org.springframework.beans.factory.DisposableBean;
import org.apache.xbean.naming.global.GlobalContextManager;
/**
* An InitialContextFactoryBuilder used to return an XBean Naming context.
*/
-public class GlobalInitialContextFactoryBuilder implements InitialContextFactoryBuilder, InitializingBean, DisposableBean {
-
- private Context globalContext;
-
- public Context getGlobalContext() {
- return globalContext;
- }
-
- public void setGlobalContext(Context globalContext) {
- this.globalContext = globalContext;
- }
+public class GlobalInitialContextFactoryBuilder implements InitialContextFactoryBuilder {
- public void afterPropertiesSet() throws Exception {
- GlobalContextManager.setGlobalContext(globalContext);
- }
-
- public void destroy() throws Exception {
- GlobalContextManager.setGlobalContext(null);
+ public GlobalInitialContextFactoryBuilder() {
}
public InitialContextFactory createInitialContextFactory(Hashtable<?, ?> environment) throws NamingException {
return new GlobalContextManager();
}
+
}
Modified: servicemix/sandbox/karaf/nmr/naming/src/main/java/org/apache/servicemix/naming/OSGiContext.java
URL: http://svn.apache.org/viewvc/servicemix/sandbox/karaf/nmr/naming/src/main/java/org/apache/servicemix/naming/OSGiContext.java?rev=807962&r1=807961&r2=807962&view=diff
==============================================================================
--- servicemix/sandbox/karaf/nmr/naming/src/main/java/org/apache/servicemix/naming/OSGiContext.java (original)
+++ servicemix/sandbox/karaf/nmr/naming/src/main/java/org/apache/servicemix/naming/OSGiContext.java Wed Aug 26 11:19:19 2009
@@ -19,37 +19,36 @@
import java.util.Collections;
import javax.naming.Context;
-import javax.naming.NamingException;
import javax.naming.NameNotFoundException;
+import javax.naming.NamingException;
import org.apache.xbean.naming.context.ImmutableContext;
-import org.springframework.osgi.service.importer.support.OsgiServiceProxyFactoryBean;
-import org.springframework.osgi.context.BundleContextAware;
-import org.springframework.util.ClassUtils;
-import org.osgi.framework.BundleContext;
/**
* A read-only JNDI context that allows access to OSGi services in the registry.
* The result of a lookup will be a proxy to the filtered OSGi service.
*/
-public class OSGiContext extends ImmutableContext implements BundleContextAware {
+public class OSGiContext extends ImmutableContext {
- private final Context services = new OSGiServicesContext();
- private BundleContext bundleContext;
+ private Context services;
- public OSGiContext() throws NamingException {
+ /**
+ * Create an instanceof <code>OSGiContext</code>
+ * @param osgiServicesContext the context to lookup OSGi services
+ * @throws NamingException
+ */
+ public OSGiContext(Context osgiServicesContext) throws NamingException {
super(Collections.<String, Object>emptyMap());
+ this.services = osgiServicesContext;
}
- public BundleContext getBundleContext() {
- return bundleContext;
- }
-
- public void setBundleContext(BundleContext bundleContext) {
- this.bundleContext = bundleContext;
- }
-
- @Override
+ /**
+ * Retrieves the named object.
+ * See {@link #lookup(javax.naming.Name)} for details.
+ * @param name the name of the object to look up
+ * @return the object bound to <tt>name</tt>
+ * @throws NamingException if a naming exception is encountered
+ */
public Object lookup(String name) throws NamingException {
if (name.startsWith("osgi:")) {
name = name.substring(5);
@@ -65,41 +64,10 @@
} else if (name.startsWith("/services/")) {
return services.lookup(name.substring(10));
} else {
- throw new NameNotFoundException("Unrecognized name, does not start with expected 'services': " + name);
- }
+ throw new NameNotFoundException("Unrecognized name, does not start with expected 'services': " + name);
+ }
}
return super.lookup(name);
}
- public class OSGiServicesContext extends ImmutableContext {
-
- public OSGiServicesContext() throws NamingException {
- super(Collections.<String, Object>emptyMap());
- }
-
- @Override
- public Object lookup(String name) throws NamingException {
- String[] parts = name.split("/");
- if (parts.length == 0 || parts.length > 2) {
- throw new NameNotFoundException("Unrecognized name, should be osgi:services:<interface>[/<filter>]");
- }
- String className = parts[0];
- String filter = parts.length == 2 ? parts[1] : null;
- try {
- ClassLoader classLoader = getClass().getClassLoader();
- OsgiServiceProxyFactoryBean factory = new OsgiServiceProxyFactoryBean();
- factory.setBundleContext(getBundleContext());
- factory.setBeanClassLoader(classLoader);
- factory.setFilter(filter);
- factory.setInterfaces(new Class[] { ClassUtils.resolveClassName(className, classLoader) });
- factory.afterPropertiesSet();
- return factory.getObject();
- } catch (org.springframework.osgi.service.ServiceUnavailableException e) {
- NameNotFoundException ex = new NameNotFoundException(e.getMessage());
- ex.initCause(e);
- throw ex;
- }
- }
-
- }
}
Modified: servicemix/sandbox/karaf/nmr/naming/src/main/java/org/apache/servicemix/naming/OSGiInitialContextFactoryBuilder.java
URL: http://svn.apache.org/viewvc/servicemix/sandbox/karaf/nmr/naming/src/main/java/org/apache/servicemix/naming/OSGiInitialContextFactoryBuilder.java?rev=807962&r1=807961&r2=807962&view=diff
==============================================================================
--- servicemix/sandbox/karaf/nmr/naming/src/main/java/org/apache/servicemix/naming/OSGiInitialContextFactoryBuilder.java (original)
+++ servicemix/sandbox/karaf/nmr/naming/src/main/java/org/apache/servicemix/naming/OSGiInitialContextFactoryBuilder.java Wed Aug 26 11:19:19 2009
@@ -16,67 +16,37 @@
*/
package org.apache.servicemix.naming;
-import java.util.Hashtable;
import java.lang.reflect.Field;
+import java.util.Hashtable;
-import javax.naming.spi.InitialContextFactoryBuilder;
-import javax.naming.spi.InitialContextFactory;
-import javax.naming.spi.NamingManager;
-import javax.naming.NamingException;
import javax.naming.Context;
+import javax.naming.NamingException;
import javax.naming.NoInitialContextException;
+import javax.naming.spi.InitialContextFactory;
+import javax.naming.spi.InitialContextFactoryBuilder;
+import javax.naming.spi.NamingManager;
-import org.osgi.util.tracker.ServiceTracker;
import org.osgi.framework.BundleContext;
-import org.springframework.osgi.context.BundleContextAware;
-import org.springframework.beans.factory.InitializingBean;
-import org.springframework.beans.factory.DisposableBean;
-import org.springframework.util.Assert;
+import org.osgi.util.tracker.ServiceTracker;
/**
* An InitialContextFactoryBuilder which delegates to any InitialContextFactoryBuilder found
- * in the OSGi registry.
+ * in the OSGi registry.
*/
-public class OSGiInitialContextFactoryBuilder implements InitialContextFactoryBuilder, BundleContextAware,
- InitializingBean, DisposableBean {
+public class OSGiInitialContextFactoryBuilder extends ServiceTracker implements InitialContextFactoryBuilder {
- private BundleContext bundleContext;
private Context osgiContext;
- private ServiceTracker tracker;
- public OSGiInitialContextFactoryBuilder() {
- }
-
- public BundleContext getBundleContext() {
- return bundleContext;
- }
-
- public void setBundleContext(BundleContext bundleContext) {
- this.bundleContext = bundleContext;
- }
-
- public Context getOsgiContext() {
- return osgiContext;
- }
-
- public void setOsgiContext(Context osgiContext) {
+ public OSGiInitialContextFactoryBuilder(BundleContext bundleContext, Context osgiContext) throws NamingException {
+ super(bundleContext, InitialContextFactoryBuilder.class.getName(), null);
+ open();
this.osgiContext = osgiContext;
- }
-
- public void afterPropertiesSet() throws NamingException {
- Assert.notNull(bundleContext, "Required 'bundleContext' property was not set.");
- Assert.notNull(osgiContext, "Required 'osgiContext' property was not set.");
- tracker = new ServiceTracker(bundleContext, InitialContextFactoryBuilder.class.getName(), null);
- tracker.open();
-
NamingManager.setInitialContextFactoryBuilder(this);
}
public void destroy() {
// Close the tracker
- tracker.close();
- tracker = null;
-
+ close();
// Try to reset the InitialContextFactoryBuilder on the NamingManager
// As there is no public API to do so, we try using reflection.
// The following code will try to nullify all static fields of type
@@ -94,11 +64,8 @@
}
public InitialContextFactory createInitialContextFactory(Hashtable<?, ?> env) throws NamingException {
- if (tracker == null) {
- throw new IllegalStateException("OSGiInitialContextFactoryBuilder is not initialized");
- }
InitialContextFactory factory = null;
- InitialContextFactoryBuilder factoryBuilder = (InitialContextFactoryBuilder) tracker.getService();
+ InitialContextFactoryBuilder factoryBuilder = (InitialContextFactoryBuilder) getService();
if (factoryBuilder != null) {
factory = factoryBuilder.createInitialContextFactory(env);
}
@@ -116,10 +83,10 @@
}
if (factory == null) {
NoInitialContextException ne = new NoInitialContextException(
- "Need to specify class name in environment or system " +
- "property, or as an applet parameter, or in an " +
- "application resource file: " +
- Context.INITIAL_CONTEXT_FACTORY);
+ "Need to specify class name in environment or system " +
+ "property, or as an applet parameter, or in an " +
+ "application resource file: " +
+ Context.INITIAL_CONTEXT_FACTORY);
throw ne;
}
return new InitialContextFactoryWrapper(factory, osgiContext);
Added: servicemix/sandbox/karaf/nmr/naming/src/main/java/org/apache/servicemix/naming/OSGiServicesContext.java
URL: http://svn.apache.org/viewvc/servicemix/sandbox/karaf/nmr/naming/src/main/java/org/apache/servicemix/naming/OSGiServicesContext.java?rev=807962&view=auto
==============================================================================
--- servicemix/sandbox/karaf/nmr/naming/src/main/java/org/apache/servicemix/naming/OSGiServicesContext.java (added)
+++ servicemix/sandbox/karaf/nmr/naming/src/main/java/org/apache/servicemix/naming/OSGiServicesContext.java Wed Aug 26 11:19:19 2009
@@ -0,0 +1,72 @@
+/*
+ * 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.servicemix.naming;
+
+import java.util.Collections;
+import java.lang.reflect.Proxy;
+
+import javax.naming.NamingException;
+import javax.naming.NameNotFoundException;
+
+import org.apache.xbean.naming.context.ImmutableContext;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.Constants;
+
+/**
+ * The naming context used to access OSGi services
+ */
+public class OSGiServicesContext extends ImmutableContext {
+
+ private BundleContext bundleContext;
+
+ public OSGiServicesContext(BundleContext bundleContext) throws NamingException {
+ super(Collections.<String, Object>emptyMap());
+ this.bundleContext = bundleContext;
+ }
+
+ @Override
+ public Object lookup(String name) throws NamingException {
+ String[] parts = name.split("/");
+ if (parts.length == 0 || parts.length > 2) {
+ throw new NameNotFoundException("Unrecognized name, should be osgi:services:<interface>[/<filter>]");
+ }
+ String className = parts[0];
+ String filter = parts.length == 2 ? parts[1] : null;
+ try {
+ ClassLoader classLoader = getClass().getClassLoader();
+ Class clazz = classLoader.loadClass(className);
+ String clazzFilter = "(" + Constants.OBJECTCLASS + "=" + clazz.getName() + ")";
+ if (filter == null) {
+ filter = clazzFilter;
+ } else {
+ if (filter.startsWith("(")) {
+ filter = "(&" + clazzFilter + filter + ")";
+ } else {
+ filter = "(&" + clazzFilter + "(" + filter + "))";
+ }
+ }
+ ProxyInvocationHandler handler = new ProxyInvocationHandler(bundleContext, filter);
+ handler.getTarget(false);
+ Object instance = Proxy.newProxyInstance(classLoader, new Class[] { clazz }, handler);
+ return instance;
+ } catch (Exception e) {
+ NameNotFoundException ex = new NameNotFoundException(e.getMessage());
+ ex.initCause(e);
+ throw ex;
+ }
+ }
+}
Added: servicemix/sandbox/karaf/nmr/naming/src/main/java/org/apache/servicemix/naming/ProxyInvocationHandler.java
URL: http://svn.apache.org/viewvc/servicemix/sandbox/karaf/nmr/naming/src/main/java/org/apache/servicemix/naming/ProxyInvocationHandler.java?rev=807962&view=auto
==============================================================================
--- servicemix/sandbox/karaf/nmr/naming/src/main/java/org/apache/servicemix/naming/ProxyInvocationHandler.java (added)
+++ servicemix/sandbox/karaf/nmr/naming/src/main/java/org/apache/servicemix/naming/ProxyInvocationHandler.java Wed Aug 26 11:19:19 2009
@@ -0,0 +1,68 @@
+/*
+ * 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.servicemix.naming;
+
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.Method;
+
+import javax.naming.ServiceUnavailableException;
+
+import org.osgi.util.tracker.ServiceTracker;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.InvalidSyntaxException;
+
+/**
+ * A very simple proxy to be used as the return value when looking for an OSGi service.
+ * This proxy is very limited and the ServicerReference of the OSGi service will only
+ * be released when this object is garbage collected.
+ * If the underlying OSGi service is removed from the registry, the proxy will
+ * wait for a new service to come up for a certain amount of time before throwing
+ * an exception.
+ */
+public class ProxyInvocationHandler implements InvocationHandler {
+
+ public static final long TIMEOUT = 5000L;
+
+ private String listenerFilter;
+ private ServiceTracker tracker;
+
+ public ProxyInvocationHandler(BundleContext bundleContext, String filter) throws InvalidSyntaxException {
+ this.listenerFilter = filter;
+ this.tracker = new ServiceTracker(bundleContext, bundleContext.createFilter(filter), null);
+ this.tracker.open();
+ }
+
+ public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
+ return method.invoke(getTarget(true), args);
+ }
+
+ public Object getTarget(boolean wait) throws InterruptedException, ServiceUnavailableException {
+ Object svc = tracker.getService();
+ if (svc == null && wait) {
+ svc = tracker.waitForService(TIMEOUT);
+ }
+ if (svc == null) {
+ throw new ServiceUnavailableException(listenerFilter);
+ }
+ return svc;
+ }
+
+ protected void finalize() throws Throwable {
+ tracker.close();
+ super.finalize();
+ }
+}
Modified: servicemix/sandbox/karaf/nmr/nmr/osgi/pom.xml
URL: http://svn.apache.org/viewvc/servicemix/sandbox/karaf/nmr/nmr/osgi/pom.xml?rev=807962&r1=807961&r2=807962&view=diff
==============================================================================
--- servicemix/sandbox/karaf/nmr/nmr/osgi/pom.xml (original)
+++ servicemix/sandbox/karaf/nmr/nmr/osgi/pom.xml Wed Aug 26 11:19:19 2009
@@ -45,8 +45,9 @@
<artifactId>org.apache.servicemix.nmr.spring</artifactId>
</dependency>
<dependency>
- <groupId>org.springframework.osgi</groupId>
- <artifactId>spring-osgi-core</artifactId>
+ <groupId>org.apache.geronimo</groupId>
+ <artifactId>blueprint-bundle</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.apache.felix</groupId>
@@ -91,7 +92,6 @@
org.apache.servicemix.nmr.osgi,
*
</Import-Package>
-
</instructions>
</configuration>
</plugin>
Added: servicemix/sandbox/karaf/nmr/nmr/osgi/src/main/java/org/apache/servicemix/nmr/osgi/PassThroughConverter.java
URL: http://svn.apache.org/viewvc/servicemix/sandbox/karaf/nmr/nmr/osgi/src/main/java/org/apache/servicemix/nmr/osgi/PassThroughConverter.java?rev=807962&view=auto
==============================================================================
--- servicemix/sandbox/karaf/nmr/nmr/osgi/src/main/java/org/apache/servicemix/nmr/osgi/PassThroughConverter.java (added)
+++ servicemix/sandbox/karaf/nmr/nmr/osgi/src/main/java/org/apache/servicemix/nmr/osgi/PassThroughConverter.java Wed Aug 26 11:19:19 2009
@@ -0,0 +1,41 @@
+/*
+ * 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.servicemix.nmr.osgi;
+
+import org.osgi.service.blueprint.container.Converter;
+import org.osgi.service.blueprint.container.ReifiedType;
+
+/**
+ * A simple converter to convert generics
+ */
+public class PassThroughConverter implements Converter {
+
+ private Class target;
+
+ public void setTarget(Class target) {
+ this.target = target;
+ }
+
+ public boolean canConvert(Object sourceObject, ReifiedType targetType) {
+ return target.isInstance(sourceObject) &&
+ targetType.getRawClass().equals(target);
+ }
+
+ public Object convert(Object sourceObject, ReifiedType targetType) throws Exception {
+ return sourceObject;
+ }
+}
Copied: servicemix/sandbox/karaf/nmr/nmr/osgi/src/main/resources/OSGI-INF/blueprint/servicemix-nmr.xml (from r807663, servicemix/sandbox/karaf/nmr/nmr/osgi/src/main/resources/META-INF/spring/servicemix-nmr.xml)
URL: http://svn.apache.org/viewvc/servicemix/sandbox/karaf/nmr/nmr/osgi/src/main/resources/OSGI-INF/blueprint/servicemix-nmr.xml?p2=servicemix/sandbox/karaf/nmr/nmr/osgi/src/main/resources/OSGI-INF/blueprint/servicemix-nmr.xml&p1=servicemix/sandbox/karaf/nmr/nmr/osgi/src/main/resources/META-INF/spring/servicemix-nmr.xml&r1=807663&r2=807962&rev=807962&view=diff
==============================================================================
--- servicemix/sandbox/karaf/nmr/nmr/osgi/src/main/resources/META-INF/spring/servicemix-nmr.xml (original)
+++ servicemix/sandbox/karaf/nmr/nmr/osgi/src/main/resources/OSGI-INF/blueprint/servicemix-nmr.xml Wed Aug 26 11:19:19 2009
@@ -17,23 +17,14 @@
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">
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
+ xmlns:cm="http://www.osgi.org/xmlns/blueprint-cm/v1.0.0">
+
+ <type-converters>
+ <bean class="org.apache.servicemix.nmr.osgi.PassThroughConverter">
+ <property name="target" value="org.apache.servicemix.nmr.api.service.ServiceRegistry"/>
+ </bean>
+ </type-converters>
<!-- ServiceMix NMR -->
<bean id="servicemix" class="org.apache.servicemix.nmr.core.ServiceMix">
@@ -43,11 +34,7 @@
<property name="wireRegistry" ref="wireRegistry" />
<property name="executorFactory" ref="executorFactory" />
</bean>
- <osgi:service ref="servicemix">
- <osgi:interfaces>
- <value>org.apache.servicemix.nmr.api.NMR</value>
- </osgi:interfaces>
- </osgi:service>
+ <service ref="servicemix" interface="org.apache.servicemix.nmr.api.NMR"/>
<!-- Flow registry and service tracker -->
<bean id="flowRegistry" class="org.apache.servicemix.nmr.core.FlowRegistryImpl">
@@ -55,7 +42,7 @@
<property name="authorizationService" ref="authorizationService" />
<property name="nonOsgiFlows">
<list>
- <bean id="staightThroughFlow" class="org.apache.servicemix.nmr.core.StraightThroughFlow" />
+ <bean class="org.apache.servicemix.nmr.core.StraightThroughFlow" />
</list>
</property>
</bean>
@@ -92,28 +79,28 @@
<!-- AuthorizationService -->
<bean id="authorizationService" class="org.apache.servicemix.nmr.core.security.DefaultAuthorizationService" />
- <osgi:service ref="authorizationService" interface="org.apache.servicemix.nmr.api.security.AuthorizationService" />
+ <service ref="authorizationService" interface="org.apache.servicemix.nmr.api.security.AuthorizationService" />
<!-- AuthorizationEntries -->
- <osgi:list id="authorizationEntries"
- interface="org.apache.servicemix.nmr.api.security.AuthorizationEntry"
- cardinality="0..N">
- <osgi:listener ref="authorizationService" bind-method="register" unbind-method="unregister" />
- </osgi:list>
+ <reference-list id="authorizationEntries"
+ interface="org.apache.servicemix.nmr.api.security.AuthorizationEntry"
+ availability="optional">
+ <reference-listener ref="authorizationService" bind-method="register" unbind-method="unregister" />
+ </reference-list>
<!-- Default authorization entry -->
- <osgi:service interface="org.apache.servicemix.nmr.api.security.AuthorizationEntry">
+ <service interface="org.apache.servicemix.nmr.api.security.AuthorizationEntry">
<bean class="org.apache.servicemix.nmr.core.security.DefaultAuthorizationEntry">
<property name="endpoint" value="*" />
<property name="rank" value="-2147483648" />
<property name="roles" value="*" />
<property name="type" value="Set" />
</bean>
- </osgi:service>
+ </service>
<!-- AuthenticationService -->
<bean id="authenticationService" class="org.apache.servicemix.nmr.core.security.JaasAuthenticationService" />
- <osgi:service ref="authenticationService" interface="org.apache.servicemix.nmr.api.security.AuthenticationService" />
+ <service ref="authenticationService" interface="org.apache.servicemix.nmr.api.security.AuthenticationService" />
<!-- ExecutorFactory -->
<bean id="executorFactory" class="org.apache.servicemix.executors.impl.ExecutorFactoryImpl">
@@ -128,14 +115,15 @@
</property>
</bean>
- <osgix:cm-properties id="cmProps" persistent-id="org.apache.servicemix.nmr">
- <prop key="allowCoreThreadsTimeout">true</prop>
- <prop key="threadPoolCorePoolSize">1</prop>
- <prop key="threadPoolMaximumPoolSize">16</prop>
- <prop key="threadPoolQueueSize">256</prop>
- <prop key="bypassIfSynchronous">true</prop>
- </osgix:cm-properties>
-
- <ctx:property-placeholder properties-ref="cmProps" />
+ <!-- Property place holder -->
+ <cm:property-placeholder persistent-id="org.apache.servicemix.nmr">
+ <cm:default-properties>
+ <cm:property name="allowCoreThreadsTimeout" value="true"/>
+ <cm:property name="threadPoolCorePoolSize" value="1"/>
+ <cm:property name="threadPoolMaximumPoolSize" value="16"/>
+ <cm:property name="threadPoolQueueSize" value="256"/>
+ <cm:property name="bypassIfSynchronous" value="true"/>
+ </cm:default-properties>
+ </cm:property-placeholder>
-</beans>
+</blueprint>
Modified: servicemix/sandbox/karaf/nmr/transaction/pom.xml
URL: http://svn.apache.org/viewvc/servicemix/sandbox/karaf/nmr/transaction/pom.xml?rev=807962&r1=807961&r2=807962&view=diff
==============================================================================
--- servicemix/sandbox/karaf/nmr/transaction/pom.xml (original)
+++ servicemix/sandbox/karaf/nmr/transaction/pom.xml Wed Aug 26 11:19:19 2009
@@ -32,60 +32,202 @@
<packaging>bundle</packaging>
<name>Apache ServiceMix Transaction</name>
+ <properties>
+ <geronimo-transaction-version>2.1.2</geronimo-transaction-version>
+ </properties>
+
<dependencies>
<dependency>
- <groupId>org.apache.geronimo.specs</groupId>
- <artifactId>geronimo-jta_1.1_spec</artifactId>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.osgi.core</artifactId>
+ <version>1.2.0</version>
+ <scope>provided</scope>
</dependency>
<dependency>
- <groupId>org.apache.geronimo.components</groupId>
- <artifactId>geronimo-transaction</artifactId>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.osgi.compendium</artifactId>
+ <version>1.2.0</version>
+ <scope>provided</scope>
</dependency>
<dependency>
- <groupId>org.apache.servicemix.bundles</groupId>
- <artifactId>org.apache.servicemix.bundles.howl</artifactId>
+ <groupId>org.apache.geronimo.components</groupId>
+ <artifactId>geronimo-transaction</artifactId>
+ <version>2.1.2</version>
</dependency>
<dependency>
- <groupId>org.springframework.osgi</groupId>
- <artifactId>spring-osgi-core</artifactId>
+ <groupId>org.objectweb.howl</groupId>
+ <artifactId>howl</artifactId>
+ <version>1.0.1-1</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-tx</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.felix</groupId>
- <artifactId>org.osgi.core</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
- <scope>test</scope>
+ <version>2.5.6</version>
+ <optional>true</optional>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <source>1.5</source>
+ <target>1.5</target>
+ </configuration>
+ </plugin>
+ <plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
+ <version>2.0.0</version>
+ <extensions>true</extensions>
<configuration>
<instructions>
- <Bundle-SymbolicName>${pom.artifactId}</Bundle-SymbolicName>
- <!--
<Import-Package>
- javax.transaction,
- org.apache.geronimo.transaction.manager,
- org.springframework.transaction,
+ org.springframework.*;resolution:=optional,
+ !org.apache.geronimo.transaction*,
+ javax.resource.spi;version="1.5";resolution:=optional,
*
</Import-Package>
- -->
- <Export-Package>${pom.artifactId}*</Export-Package>
- <Spring-Context>*;publish-context:=false</Spring-Context>
+ <Export-Package>
+ org.apache.geronimo.transaction*;version="${geronimo-transaction-version}",
+ javax.transaction*;version="1.1"
+ </Export-Package>
+ <Private-Package>
+ org.objectweb.howl.log*,
+ org.apache.servicemix.transaction
+ </Private-Package>
+ <Bundle-SymbolicName>${pom.artifactId}</Bundle-SymbolicName>
+ <Bundle-Activator>org.apache.servicemix.transaction.Activator</Bundle-Activator>
+ <Export-Service>
+ javax.transaction.TransactionManager,
+ javax.transaction.TransactionSynchronizationRegistry,
+ javax.transaction.UserTransaction,
+ org.apache.geronimo.transaction.manager.RecoverableTransactionManager
+ </Export-Service>
+ <Include-Resource>
+ {maven-resources},
+ javax/resource/spi/XATerminator.class=target/classes/javax/resource/spi/XATerminator.class
+ </Include-Resource>
</instructions>
</configuration>
</plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>unpack-sources</id>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>unpack</goal>
+ </goals>
+ <configuration>
+ <artifactItems>
+ <artifactItem>
+ <groupId>org.apache.geronimo.components</groupId>
+ <artifactId>geronimo-transaction</artifactId>
+ <classifier>sources</classifier>
+ </artifactItem>
+ <artifactItem>
+ <groupId>org.objectweb.howl</groupId>
+ <artifactId>howl</artifactId>
+ <classifier>sources</classifier>
+ </artifactItem>
+ </artifactItems>
+ <outputDirectory>${project.build.directory}/sources</outputDirectory>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <executions>
+ <execution>
+ <phase>generate-sources</phase>
+ <configuration>
+ <tasks>
+ <copy todir="${project.build.directory}/sources">
+ <fileset dir="${basedir}/src/main/java" />
+ </copy>
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-source-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>attach-sources</id>
+ <phase>package</phase>
+ <goals>
+ <goal>jar</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <!--<plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-javadoc-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>package1</id>
+ <phase>package</phase>
+ <goals>
+ <goal>jar</goal>
+ </goals>
+ <configuration>
+ <minmemory>128m</minmemory>
+ <maxmemory>512m</maxmemory>
+ <sourcepath>${project.build.directory}/sources</sourcepath>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin> -->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-shade-plugin</artifactId>
+ <version>1.1</version>
+ <executions>
+ <execution>
+ <phase>package</phase>
+ <goals>
+ <goal>shade</goal>
+ </goals>
+ <configuration>
+ <artifactSet>
+ <includes>
+ <include>org.apache.geronimo.components:geronimo-transaction</include>
+ <include>org.objectweb.howl:howl</include>
+ <include>${project.groupId}:${project.artifactId}</include>
+ </includes>
+ </artifactSet>
+ <filters>
+ <filter>
+ <artifact>org.apache.geronimo.components:geronimo-transaction</artifact>
+ <excludes>
+ <exclude>org/**</exclude>
+ </excludes>
+ </filter>
+ <filter>
+ <artifact>org.objectweb.howl:howl</artifact>
+ <excludes>
+ <exclude>org/**</exclude>
+ </excludes>
+ </filter>
+ </filters>
+ <createSourcesJar>true</createSourcesJar>
+ <promoteTransitiveDependencies>true</promoteTransitiveDependencies>
+ <createDependencyReducedPom>true</createDependencyReducedPom>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
</plugins>
</build>
Added: servicemix/sandbox/karaf/nmr/transaction/src/main/java/javax/resource/spi/XATerminator.java
URL: http://svn.apache.org/viewvc/servicemix/sandbox/karaf/nmr/transaction/src/main/java/javax/resource/spi/XATerminator.java?rev=807962&view=auto
==============================================================================
--- servicemix/sandbox/karaf/nmr/transaction/src/main/java/javax/resource/spi/XATerminator.java (added)
+++ servicemix/sandbox/karaf/nmr/transaction/src/main/java/javax/resource/spi/XATerminator.java Wed Aug 26 11:19:19 2009
@@ -0,0 +1,44 @@
+/*
+ * 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 source code implements specifications defined by the Java
+// Community Process. In order to remain compliant with the specification
+// DO NOT add / change / or delete method signatures!
+//
+
+package javax.resource.spi;
+
+import javax.transaction.xa.XAException;
+import javax.transaction.xa.Xid;
+
+/**
+ * @version $Rev: 467553 $ $Date: 2006-10-25 06:01:51 +0200 (Wed, 25 Oct 2006) $
+ */
+public interface XATerminator {
+ public void commit(Xid xid, boolean onePhase) throws XAException;
+
+ public void forget(Xid xid) throws XAException;
+
+ public int prepare(Xid xid) throws XAException;
+
+ public Xid[] recover(int flag) throws XAException;
+
+ public void rollback(Xid xid) throws XAException;
+}
\ No newline at end of file
Added: servicemix/sandbox/karaf/nmr/transaction/src/main/java/org/apache/servicemix/transaction/Activator.java
URL: http://svn.apache.org/viewvc/servicemix/sandbox/karaf/nmr/transaction/src/main/java/org/apache/servicemix/transaction/Activator.java?rev=807962&view=auto
==============================================================================
--- servicemix/sandbox/karaf/nmr/transaction/src/main/java/org/apache/servicemix/transaction/Activator.java (added)
+++ servicemix/sandbox/karaf/nmr/transaction/src/main/java/org/apache/servicemix/transaction/Activator.java Wed Aug 26 11:19:19 2009
@@ -0,0 +1,101 @@
+/*
+ * 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.servicemix.transaction;
+
+import java.util.Dictionary;
+import java.util.Hashtable;
+import java.util.Map;
+import java.util.Iterator;
+import java.util.HashMap;
+
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.Constants;
+import org.osgi.service.cm.ManagedServiceFactory;
+import org.osgi.service.cm.ConfigurationException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ */
+public class Activator implements BundleActivator, ManagedServiceFactory {
+
+ private static final Logger log = LoggerFactory.getLogger("org.apache.felix.transaction");
+
+ private BundleContext bundleContext;
+ private Map managers = new HashMap<String, TransactionManagerService>();
+
+ public void start(BundleContext bundleContext) throws Exception {
+ this.bundleContext = bundleContext;
+ Hashtable props = new Hashtable();
+ props.put(Constants.SERVICE_PID, getName());
+ bundleContext.registerService(ManagedServiceFactory.class.getName(), this, props);
+
+ Hashtable ht = new Hashtable();
+ updated("initial", ht);
+ }
+
+ private void set(Hashtable ht, String key) {
+ String o = bundleContext.getProperty(key);
+ if (o == null) {
+ o = System.getenv(key.toUpperCase().replaceAll(".", "_"));
+ if (o == null) {
+ return;
+ }
+ }
+ ht.put(key, o);
+ }
+
+ public void stop(BundleContext context) throws Exception {
+ for (Iterator w = managers.values().iterator(); w.hasNext();) {
+ try {
+ TransactionManagerService mgr = (TransactionManagerService) w.next();
+ w.remove();
+ mgr.close();
+ } catch (Exception e) {
+ // Ignore
+ }
+ }
+ }
+
+ public String getName() {
+ return "org.apache.felix.transaction";
+ }
+
+ public void updated(String pid, Dictionary properties) throws ConfigurationException {
+ deleted(pid);
+ TransactionManagerService mgr = new TransactionManagerService(pid, properties, bundleContext);
+ managers.put(pid, mgr);
+ try {
+ mgr.start();
+ } catch (Exception e) {
+ log.error("Error starting transaction manager", e);
+ }
+ }
+
+ public void deleted(String pid) {
+ TransactionManagerService mgr = (TransactionManagerService) managers.remove(pid);
+ if (mgr != null) {
+ try {
+ mgr.close();
+ } catch (Exception e) {
+ log.error("Error stopping transaction manager", e);
+ }
+ }
+ }
+
+}
\ No newline at end of file
Modified: servicemix/sandbox/karaf/nmr/transaction/src/main/java/org/apache/servicemix/transaction/GeronimoPlatformTransactionManager.java
URL: http://svn.apache.org/viewvc/servicemix/sandbox/karaf/nmr/transaction/src/main/java/org/apache/servicemix/transaction/GeronimoPlatformTransactionManager.java?rev=807962&r1=807961&r2=807962&view=diff
==============================================================================
--- servicemix/sandbox/karaf/nmr/transaction/src/main/java/org/apache/servicemix/transaction/GeronimoPlatformTransactionManager.java (original)
+++ servicemix/sandbox/karaf/nmr/transaction/src/main/java/org/apache/servicemix/transaction/GeronimoPlatformTransactionManager.java Wed Aug 26 11:19:19 2009
@@ -16,30 +16,29 @@
*/
package org.apache.servicemix.transaction;
+import java.util.Map;
import java.util.Iterator;
import java.util.List;
-import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
+import javax.transaction.Transaction;
import javax.transaction.Status;
import javax.transaction.SystemException;
-import javax.transaction.Transaction;
import javax.transaction.xa.XAException;
import org.apache.geronimo.transaction.manager.GeronimoTransactionManager;
import org.apache.geronimo.transaction.manager.TransactionLog;
-import org.apache.geronimo.transaction.manager.TransactionManagerMonitor;
import org.apache.geronimo.transaction.manager.XidFactory;
+import org.apache.geronimo.transaction.manager.TransactionManagerMonitor;
import org.springframework.transaction.PlatformTransactionManager;
+import org.springframework.transaction.TransactionStatus;
import org.springframework.transaction.TransactionDefinition;
import org.springframework.transaction.TransactionException;
-import org.springframework.transaction.TransactionStatus;
-import org.springframework.transaction.jta.JtaTransactionManager;
-import org.springframework.transaction.support.TransactionSynchronization;
import org.springframework.transaction.support.TransactionSynchronizationManager;
+import org.springframework.transaction.support.TransactionSynchronization;
+import org.springframework.transaction.jta.JtaTransactionManager;
/**
- * @version $Revision$ $Date$
*/
public class GeronimoPlatformTransactionManager extends GeronimoTransactionManager implements PlatformTransactionManager {