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 2008/02/01 14:44:50 UTC
svn commit: r617498 [1/2] - in /servicemix/smx4: features/trunk/
features/trunk/ejb3/ features/trunk/ejb3/bundles/commons-cli/
features/trunk/ejb3/bundles/swizzle/ features/trunk/ejb3/cxf-binding-nmr/
features/trunk/ejb3/cxf-binding-nmr/src/ features/t...
Author: gnodet
Date: Fri Feb 1 05:44:02 2008
New Revision: 617498
URL: http://svn.apache.org/viewvc?rev=617498&view=rev
Log:
Add EJB3 layer and upgrade to latest versions of spring
Added:
servicemix/smx4/features/trunk/ejb3/bundles/commons-cli/ (with props)
servicemix/smx4/features/trunk/ejb3/bundles/commons-cli/pom.xml
servicemix/smx4/features/trunk/ejb3/bundles/swizzle/ (with props)
servicemix/smx4/features/trunk/ejb3/bundles/swizzle/pom.xml
servicemix/smx4/features/trunk/ejb3/cxf-binding-nmr/ (with props)
servicemix/smx4/features/trunk/ejb3/cxf-binding-nmr/pom.xml
servicemix/smx4/features/trunk/ejb3/cxf-binding-nmr/src/
servicemix/smx4/features/trunk/ejb3/cxf-binding-nmr/src/main/
servicemix/smx4/features/trunk/ejb3/cxf-binding-nmr/src/main/java/
servicemix/smx4/features/trunk/ejb3/cxf-binding-nmr/src/main/java/org/
servicemix/smx4/features/trunk/ejb3/cxf-binding-nmr/src/main/java/org/apache/
servicemix/smx4/features/trunk/ejb3/cxf-binding-nmr/src/main/java/org/apache/servicemix/
servicemix/smx4/features/trunk/ejb3/cxf-binding-nmr/src/main/java/org/apache/servicemix/cxf/
servicemix/smx4/features/trunk/ejb3/cxf-binding-nmr/src/main/java/org/apache/servicemix/cxf/binding/
servicemix/smx4/features/trunk/ejb3/cxf-binding-nmr/src/main/java/org/apache/servicemix/cxf/binding/nmr/
servicemix/smx4/features/trunk/ejb3/cxf-binding-nmr/src/main/java/org/apache/servicemix/cxf/binding/nmr/NMRBinding.java
servicemix/smx4/features/trunk/ejb3/cxf-binding-nmr/src/main/java/org/apache/servicemix/cxf/binding/nmr/NMRBindingFactory.java
servicemix/smx4/features/trunk/ejb3/cxf-binding-nmr/src/main/java/org/apache/servicemix/cxf/binding/nmr/NMRBindingInfo.java
servicemix/smx4/features/trunk/ejb3/cxf-binding-nmr/src/main/java/org/apache/servicemix/cxf/binding/nmr/NMRConstants.java
servicemix/smx4/features/trunk/ejb3/cxf-binding-nmr/src/main/java/org/apache/servicemix/cxf/binding/nmr/NMRFault.java
servicemix/smx4/features/trunk/ejb3/cxf-binding-nmr/src/main/java/org/apache/servicemix/cxf/binding/nmr/NMRMessage.java
servicemix/smx4/features/trunk/ejb3/cxf-binding-nmr/src/main/java/org/apache/servicemix/cxf/binding/nmr/interceptors/
servicemix/smx4/features/trunk/ejb3/cxf-binding-nmr/src/main/java/org/apache/servicemix/cxf/binding/nmr/interceptors/NMRFaultInInterceptor.java
servicemix/smx4/features/trunk/ejb3/cxf-binding-nmr/src/main/java/org/apache/servicemix/cxf/binding/nmr/interceptors/NMRFaultOutInterceptor.java
servicemix/smx4/features/trunk/ejb3/cxf-binding-nmr/src/main/java/org/apache/servicemix/cxf/binding/nmr/interceptors/NMROperationInInterceptor.java
servicemix/smx4/features/trunk/ejb3/cxf-binding-nmr/src/main/java/org/apache/servicemix/cxf/binding/nmr/interceptors/NMRWrapperInInterceptor.java
servicemix/smx4/features/trunk/ejb3/cxf-binding-nmr/src/main/java/org/apache/servicemix/cxf/binding/nmr/interceptors/NMRWrapperOutInterceptor.java
servicemix/smx4/features/trunk/ejb3/cxf-binding-nmr/src/main/resources/
servicemix/smx4/features/trunk/ejb3/cxf-binding-nmr/src/main/resources/org/
servicemix/smx4/features/trunk/ejb3/cxf-binding-nmr/src/main/resources/org/apache/
servicemix/smx4/features/trunk/ejb3/cxf-binding-nmr/src/main/resources/org/apache/servicemix/
servicemix/smx4/features/trunk/ejb3/cxf-binding-nmr/src/main/resources/org/apache/servicemix/cxf/
servicemix/smx4/features/trunk/ejb3/cxf-binding-nmr/src/main/resources/org/apache/servicemix/cxf/binding/
servicemix/smx4/features/trunk/ejb3/cxf-binding-nmr/src/main/resources/org/apache/servicemix/cxf/binding/nmr/
servicemix/smx4/features/trunk/ejb3/cxf-binding-nmr/src/main/resources/org/apache/servicemix/cxf/binding/nmr/interceptors/
servicemix/smx4/features/trunk/ejb3/cxf-binding-nmr/src/main/resources/org/apache/servicemix/cxf/binding/nmr/interceptors/Messages.properties
servicemix/smx4/features/trunk/ejb3/cxf-transport-nmr/ (with props)
servicemix/smx4/features/trunk/ejb3/cxf-transport-nmr/pom.xml
servicemix/smx4/features/trunk/ejb3/cxf-transport-nmr/src/
servicemix/smx4/features/trunk/ejb3/cxf-transport-nmr/src/main/
servicemix/smx4/features/trunk/ejb3/cxf-transport-nmr/src/main/java/
servicemix/smx4/features/trunk/ejb3/cxf-transport-nmr/src/main/java/org/
servicemix/smx4/features/trunk/ejb3/cxf-transport-nmr/src/main/java/org/apache/
servicemix/smx4/features/trunk/ejb3/cxf-transport-nmr/src/main/java/org/apache/servicemix/
servicemix/smx4/features/trunk/ejb3/cxf-transport-nmr/src/main/java/org/apache/servicemix/cxf/
servicemix/smx4/features/trunk/ejb3/cxf-transport-nmr/src/main/java/org/apache/servicemix/cxf/transport/
servicemix/smx4/features/trunk/ejb3/cxf-transport-nmr/src/main/java/org/apache/servicemix/cxf/transport/nmr/
servicemix/smx4/features/trunk/ejb3/cxf-transport-nmr/src/main/java/org/apache/servicemix/cxf/transport/nmr/NMRConduit.java
servicemix/smx4/features/trunk/ejb3/cxf-transport-nmr/src/main/java/org/apache/servicemix/cxf/transport/nmr/NMRConduitOutputStream.java
servicemix/smx4/features/trunk/ejb3/cxf-transport-nmr/src/main/java/org/apache/servicemix/cxf/transport/nmr/NMRDestination.java
servicemix/smx4/features/trunk/ejb3/cxf-transport-nmr/src/main/java/org/apache/servicemix/cxf/transport/nmr/NMRDestinationOutputStream.java
servicemix/smx4/features/trunk/ejb3/cxf-transport-nmr/src/main/java/org/apache/servicemix/cxf/transport/nmr/NMRMessageHelper.java
servicemix/smx4/features/trunk/ejb3/cxf-transport-nmr/src/main/java/org/apache/servicemix/cxf/transport/nmr/NMRTransportFactory.java
servicemix/smx4/features/trunk/ejb3/cxf-transport-nmr/src/main/resources/
servicemix/smx4/features/trunk/ejb3/cxf-transport-nmr/src/main/resources/org/
servicemix/smx4/features/trunk/ejb3/cxf-transport-nmr/src/main/resources/org/apache/
servicemix/smx4/features/trunk/ejb3/cxf-transport-nmr/src/main/resources/org/apache/servicemix/
servicemix/smx4/features/trunk/ejb3/cxf-transport-nmr/src/main/resources/org/apache/servicemix/cxf/
servicemix/smx4/features/trunk/ejb3/cxf-transport-nmr/src/main/resources/org/apache/servicemix/cxf/transport/
servicemix/smx4/features/trunk/ejb3/cxf-transport-nmr/src/main/resources/org/apache/servicemix/cxf/transport/nmr/
servicemix/smx4/features/trunk/ejb3/cxf-transport-nmr/src/main/resources/org/apache/servicemix/cxf/transport/nmr/Messages.properties
servicemix/smx4/features/trunk/ejb3/deployer/src/main/java/org/apache/servicemix/ejb3/deployer/NmrEndpoint.java
servicemix/smx4/features/trunk/ejb3/deployer/src/main/java/org/apache/servicemix/ejb3/deployer/NmrService.java
servicemix/smx4/features/trunk/ejb3/deployer/src/main/java/org/apache/servicemix/ejb3/deployer/cxf/
servicemix/smx4/features/trunk/ejb3/deployer/src/test/resources/log4j.properties
Modified:
servicemix/smx4/features/trunk/ejb3/deployer/pom.xml
servicemix/smx4/features/trunk/ejb3/deployer/src/main/java/org/apache/servicemix/ejb3/deployer/CxfService.java
servicemix/smx4/features/trunk/ejb3/deployer/src/main/java/org/apache/servicemix/ejb3/deployer/OpenEjbFactory.java
servicemix/smx4/features/trunk/ejb3/deployer/src/main/resources/META-INF/spring/openejb-spring.xml
servicemix/smx4/features/trunk/ejb3/deployer/src/test/java/org/apache/servicemix/ejb3/deployer/MyService.java
servicemix/smx4/features/trunk/ejb3/deployer/src/test/java/org/apache/servicemix/ejb3/deployer/MyServiceItf.java
servicemix/smx4/features/trunk/ejb3/deployer/src/test/java/org/apache/servicemix/ejb3/deployer/Test.java
servicemix/smx4/features/trunk/ejb3/pom.xml
servicemix/smx4/features/trunk/pom.xml
servicemix/smx4/kernel/trunk/pom.xml
servicemix/smx4/nmr/trunk/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/impl/Deployer.java
servicemix/smx4/nmr/trunk/pom.xml
Propchange: servicemix/smx4/features/trunk/ejb3/bundles/commons-cli/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Fri Feb 1 05:44:02 2008
@@ -0,0 +1,9 @@
+target
+*.iml
+*.ipr
+*.iws
+.classpath
+.project
+.settings
+
+
Added: servicemix/smx4/features/trunk/ejb3/bundles/commons-cli/pom.xml
URL: http://svn.apache.org/viewvc/servicemix/smx4/features/trunk/ejb3/bundles/commons-cli/pom.xml?rev=617498&view=auto
==============================================================================
--- servicemix/smx4/features/trunk/ejb3/bundles/commons-cli/pom.xml (added)
+++ servicemix/smx4/features/trunk/ejb3/bundles/commons-cli/pom.xml Fri Feb 1 05:44:02 2008
@@ -0,0 +1,57 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+ <!--
+
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.apache.servicemix.ejb3.bundles</groupId>
+ <artifactId>bundles</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ </parent>
+
+ <groupId>org.apache.servicemix.bundles</groupId>
+ <artifactId>org.apache.servicemix.bundles.commons-cli-1.1</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <packaging>bundle</packaging>
+ <name>ServiceMix OSGI Common Bundles: ${pkgArtifactId}</name>
+ <description>
+ This bundle simply wraps ${pkgArtifactId}-${pkgVersion}.jar.
+ </description>
+
+ <properties>
+ <pkgArtifactId>commons-cli</pkgArtifactId>
+ <pkgVersion>1.1</pkgVersion>
+ <servicemix.osgi.export>
+ org.apache.commons.cli*;version=${pkgVersion}
+ </servicemix.osgi.export>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>commons-cli</groupId>
+ <artifactId>commons-cli</artifactId>
+ <version>${pkgVersion}</version>
+ <optional>true</optional>
+ </dependency>
+ </dependencies>
+
+</project>
Propchange: servicemix/smx4/features/trunk/ejb3/bundles/swizzle/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Fri Feb 1 05:44:02 2008
@@ -0,0 +1,9 @@
+target
+*.iml
+*.ipr
+*.iws
+.classpath
+.project
+.settings
+
+
Added: servicemix/smx4/features/trunk/ejb3/bundles/swizzle/pom.xml
URL: http://svn.apache.org/viewvc/servicemix/smx4/features/trunk/ejb3/bundles/swizzle/pom.xml?rev=617498&view=auto
==============================================================================
--- servicemix/smx4/features/trunk/ejb3/bundles/swizzle/pom.xml (added)
+++ servicemix/smx4/features/trunk/ejb3/bundles/swizzle/pom.xml Fri Feb 1 05:44:02 2008
@@ -0,0 +1,57 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+ <!--
+
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.apache.servicemix.ejb3.bundles</groupId>
+ <artifactId>bundles</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ </parent>
+
+ <groupId>org.apache.servicemix.bundles</groupId>
+ <artifactId>org.apache.servicemix.bundles.swizzle-stream-1.0.1</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <packaging>bundle</packaging>
+ <name>ServiceMix OSGI Common Bundles: ${pkgArtifactId}</name>
+ <description>
+ This bundle simply wraps ${pkgArtifactId}-${pkgVersion}.jar.
+ </description>
+
+ <properties>
+ <pkgArtifactId>swizzle-stream</pkgArtifactId>
+ <pkgVersion>1.0.1</pkgVersion>
+ <servicemix.osgi.export>
+ org.codehaus.swizzle*;version=${pkgVersion}
+ </servicemix.osgi.export>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.codehaus.swizzle</groupId>
+ <artifactId>swizzle-stream</artifactId>
+ <version>${pkgVersion}</version>
+ <optional>true</optional>
+ </dependency>
+ </dependencies>
+
+</project>
Propchange: servicemix/smx4/features/trunk/ejb3/cxf-binding-nmr/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Fri Feb 1 05:44:02 2008
@@ -0,0 +1,9 @@
+target
+*.iml
+*.ipr
+*.iws
+.classpath
+.project
+.settings
+
+
Added: servicemix/smx4/features/trunk/ejb3/cxf-binding-nmr/pom.xml
URL: http://svn.apache.org/viewvc/servicemix/smx4/features/trunk/ejb3/cxf-binding-nmr/pom.xml?rev=617498&view=auto
==============================================================================
--- servicemix/smx4/features/trunk/ejb3/cxf-binding-nmr/pom.xml (added)
+++ servicemix/smx4/features/trunk/ejb3/cxf-binding-nmr/pom.xml Fri Feb 1 05:44:02 2008
@@ -0,0 +1,122 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+ <!--
+
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.apache.servicemix.ejb3</groupId>
+ <artifactId>ejb3</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ </parent>
+
+ <groupId>org.apache.servicemix.ejb3</groupId>
+ <artifactId>org.apache.servicemix.cxf.binding.nmr</artifactId>
+ <packaging>bundle</packaging>
+ <version>1.0-SNAPSHOT</version>
+ <name>ServiceMix CXF Binding for NMR</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.servicemix.bundles</groupId>
+ <artifactId>org.apache.servicemix.bundles.cxf-2.0.4</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.servicemix.nmr</groupId>
+ <artifactId>org.apache.servicemix.nmr.api</artifactId>
+ <version>${servicemix.nmr.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-bundle</artifactId>
+ <version>${cxf.version}</version>
+ <optional>true</optional>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <!-- Bundle generation -->
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <configuration>
+ <instructions>
+ <Bundle-SymbolicName>${pom.artifactId}</Bundle-SymbolicName>
+ <Import-Package>
+ javax.xml.rpc*;resolution:=optional,
+ javax.xml.soap,
+ com.ctc.wstx.stax;resolution:=optional,
+ org.apache.axis.soap;resolution:=optional,
+ org.apache.axis2.saaj;resolution:=optional,
+ com.sun.xml.messaging.saaj.soap.ver1_1;resolution:=optional,
+ com.sun.xml.messaging.saaj.client.p2p;resolution:=optional,
+ com.sun.xml.messaging.saaj.soap;resolution:=optional,
+ *
+ </Import-Package>
+ <!-- Needed for jaxb annotations classes -->
+ <DynamicImport-Package>*</DynamicImport-Package>
+ <Export-Package>${pom.artifactId}*</Export-Package>
+ <Private-Package></Private-Package>
+ <Spring-Context>*;publish-context:=false</Spring-Context>
+ </instructions>
+ </configuration>
+ </plugin>
+ <!-- generate dependencies versions -->
+ <plugin>
+ <groupId>org.apache.servicemix.kernel.testing</groupId>
+ <artifactId>depends-maven-plugin</artifactId>
+ <version>${servicemix.kernel.version}</version>
+ <executions>
+ <execution>
+ <id>generate-depends-file</id>
+ <goals>
+ <goal>generate-depends-file</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <forkMode>pertest</forkMode>
+ <systemProperties>
+ <property>
+ <name>javax.xml.parsers.DocumentBuilderFactory</name>
+ <value>com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl</value>
+ </property>
+ <property>
+ <name>javax.xml.datatype.DatatypeFactory</name>
+ <value>com.sun.org.apache.xerces.internal.jaxp.datatype.DatatypeFactoryImpl</value>
+ </property>
+ <property>
+ <name>javax.xml.parsers.SAXParserFactory</name>
+ <value>com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl</value>
+ </property>
+ </systemProperties>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
Added: servicemix/smx4/features/trunk/ejb3/cxf-binding-nmr/src/main/java/org/apache/servicemix/cxf/binding/nmr/NMRBinding.java
URL: http://svn.apache.org/viewvc/servicemix/smx4/features/trunk/ejb3/cxf-binding-nmr/src/main/java/org/apache/servicemix/cxf/binding/nmr/NMRBinding.java?rev=617498&view=auto
==============================================================================
--- servicemix/smx4/features/trunk/ejb3/cxf-binding-nmr/src/main/java/org/apache/servicemix/cxf/binding/nmr/NMRBinding.java (added)
+++ servicemix/smx4/features/trunk/ejb3/cxf-binding-nmr/src/main/java/org/apache/servicemix/cxf/binding/nmr/NMRBinding.java Fri Feb 1 05:44:02 2008
@@ -0,0 +1,50 @@
+/**
+ * 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.cxf.binding.nmr;
+
+import org.apache.cxf.binding.Binding;
+import org.apache.cxf.interceptor.AbstractBasicInterceptorProvider;
+import org.apache.cxf.message.Message;
+import org.apache.cxf.message.MessageImpl;
+import org.apache.cxf.service.model.BindingInfo;
+
+public class NMRBinding extends AbstractBasicInterceptorProvider implements Binding {
+
+ private NMRBindingInfo bindingInfo;
+
+ public NMRBinding(NMRBindingInfo bindingInfo) {
+ this.bindingInfo = bindingInfo;
+ }
+
+ public Message createMessage() {
+ return createMessage(new MessageImpl());
+ }
+
+ public Message createMessage(Message m) {
+ if (!m.containsKey(Message.CONTENT_TYPE)) {
+ m.put(Message.CONTENT_TYPE, "text/xml");
+ }
+ return new NMRMessage(m);
+ }
+
+ public BindingInfo getBindingInfo() {
+ return bindingInfo;
+ }
+
+}
Added: servicemix/smx4/features/trunk/ejb3/cxf-binding-nmr/src/main/java/org/apache/servicemix/cxf/binding/nmr/NMRBindingFactory.java
URL: http://svn.apache.org/viewvc/servicemix/smx4/features/trunk/ejb3/cxf-binding-nmr/src/main/java/org/apache/servicemix/cxf/binding/nmr/NMRBindingFactory.java?rev=617498&view=auto
==============================================================================
--- servicemix/smx4/features/trunk/ejb3/cxf-binding-nmr/src/main/java/org/apache/servicemix/cxf/binding/nmr/NMRBindingFactory.java (added)
+++ servicemix/smx4/features/trunk/ejb3/cxf-binding-nmr/src/main/java/org/apache/servicemix/cxf/binding/nmr/NMRBindingFactory.java Fri Feb 1 05:44:02 2008
@@ -0,0 +1,67 @@
+/**
+ * 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.cxf.binding.nmr;
+
+import javax.xml.namespace.QName;
+
+import org.apache.cxf.binding.AbstractBindingFactory;
+import org.apache.cxf.binding.Binding;
+import org.apache.cxf.interceptor.StaxInInterceptor;
+import org.apache.cxf.interceptor.StaxOutInterceptor;
+import org.apache.cxf.service.model.BindingInfo;
+import org.apache.cxf.service.model.BindingOperationInfo;
+import org.apache.cxf.service.model.OperationInfo;
+import org.apache.cxf.service.model.ServiceInfo;
+import org.apache.servicemix.cxf.binding.nmr.interceptors.NMRFaultInInterceptor;
+import org.apache.servicemix.cxf.binding.nmr.interceptors.NMRFaultOutInterceptor;
+import org.apache.servicemix.cxf.binding.nmr.interceptors.NMROperationInInterceptor;
+import org.apache.servicemix.cxf.binding.nmr.interceptors.NMRWrapperInInterceptor;
+import org.apache.servicemix.cxf.binding.nmr.interceptors.NMRWrapperOutInterceptor;
+
+public class NMRBindingFactory extends AbstractBindingFactory {
+
+ public Binding createBinding(BindingInfo binding) {
+ NMRBinding jb = new NMRBinding((NMRBindingInfo) binding);
+ jb.getInInterceptors().add(new StaxInInterceptor());
+ jb.getInInterceptors().add(new NMROperationInInterceptor());
+ jb.getInInterceptors().add(new NMRWrapperInInterceptor());
+ jb.getOutInterceptors().add(new StaxOutInterceptor());
+ jb.getOutInterceptors().add(new NMRWrapperOutInterceptor());
+ jb.getOutFaultInterceptors().add(new StaxOutInterceptor());
+ jb.getOutFaultInterceptors().add(new NMRFaultOutInterceptor());
+
+ jb.getInFaultInterceptors().add(new NMRFaultInInterceptor());
+ return jb;
+ }
+
+ public BindingInfo createBindingInfo(ServiceInfo service, String namespace, Object config) {
+ NMRBindingInfo info = new NMRBindingInfo(service, NMRConstants.NS_NMR_BINDING);
+ info.setName(new QName(service.getName().getNamespaceURI(),
+ service.getName().getLocalPart() + "NMRBinding"));
+
+ for (OperationInfo op : service.getInterface().getOperations()) {
+ BindingOperationInfo bop =
+ info.buildOperation(op.getName(), op.getInputName(), op.getOutputName());
+ info.addOperation(bop);
+ }
+
+ return info;
+ }
+
+}
Added: servicemix/smx4/features/trunk/ejb3/cxf-binding-nmr/src/main/java/org/apache/servicemix/cxf/binding/nmr/NMRBindingInfo.java
URL: http://svn.apache.org/viewvc/servicemix/smx4/features/trunk/ejb3/cxf-binding-nmr/src/main/java/org/apache/servicemix/cxf/binding/nmr/NMRBindingInfo.java?rev=617498&view=auto
==============================================================================
--- servicemix/smx4/features/trunk/ejb3/cxf-binding-nmr/src/main/java/org/apache/servicemix/cxf/binding/nmr/NMRBindingInfo.java (added)
+++ servicemix/smx4/features/trunk/ejb3/cxf-binding-nmr/src/main/java/org/apache/servicemix/cxf/binding/nmr/NMRBindingInfo.java Fri Feb 1 05:44:02 2008
@@ -0,0 +1,30 @@
+/**
+ * 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.cxf.binding.nmr;
+
+import org.apache.cxf.service.model.BindingInfo;
+import org.apache.cxf.service.model.ServiceInfo;
+
+public class NMRBindingInfo extends BindingInfo {
+
+ public NMRBindingInfo(ServiceInfo service, String bindingId) {
+ super(service, bindingId);
+ }
+
+}
Added: servicemix/smx4/features/trunk/ejb3/cxf-binding-nmr/src/main/java/org/apache/servicemix/cxf/binding/nmr/NMRConstants.java
URL: http://svn.apache.org/viewvc/servicemix/smx4/features/trunk/ejb3/cxf-binding-nmr/src/main/java/org/apache/servicemix/cxf/binding/nmr/NMRConstants.java?rev=617498&view=auto
==============================================================================
--- servicemix/smx4/features/trunk/ejb3/cxf-binding-nmr/src/main/java/org/apache/servicemix/cxf/binding/nmr/NMRConstants.java (added)
+++ servicemix/smx4/features/trunk/ejb3/cxf-binding-nmr/src/main/java/org/apache/servicemix/cxf/binding/nmr/NMRConstants.java Fri Feb 1 05:44:02 2008
@@ -0,0 +1,37 @@
+/**
+ * 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.cxf.binding.nmr;
+
+import javax.xml.namespace.QName;
+
+
+public final class NMRConstants {
+
+ public static final String NS_NMR_BINDING = "http://cxf.apache.org/bindings/nmr";
+
+ public static final String NS_JBI_WRAPPER = "http://java.sun.com/xml/ns/jbi/wsdl-11-wrapper";
+
+ public static final QName JBI_WRAPPER_MESSAGE = new QName(NS_JBI_WRAPPER, "message");
+
+ public static final QName JBI_WRAPPER_PART = new QName(NS_JBI_WRAPPER, "part");
+
+ private NMRConstants() {
+ //utility class
+ }
+}
\ No newline at end of file
Added: servicemix/smx4/features/trunk/ejb3/cxf-binding-nmr/src/main/java/org/apache/servicemix/cxf/binding/nmr/NMRFault.java
URL: http://svn.apache.org/viewvc/servicemix/smx4/features/trunk/ejb3/cxf-binding-nmr/src/main/java/org/apache/servicemix/cxf/binding/nmr/NMRFault.java?rev=617498&view=auto
==============================================================================
--- servicemix/smx4/features/trunk/ejb3/cxf-binding-nmr/src/main/java/org/apache/servicemix/cxf/binding/nmr/NMRFault.java (added)
+++ servicemix/smx4/features/trunk/ejb3/cxf-binding-nmr/src/main/java/org/apache/servicemix/cxf/binding/nmr/NMRFault.java Fri Feb 1 05:44:02 2008
@@ -0,0 +1,64 @@
+/**
+ * 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.cxf.binding.nmr;
+
+import java.util.ResourceBundle;
+
+import org.apache.cxf.common.i18n.Message;
+import org.apache.cxf.interceptor.Fault;
+
+public class NMRFault extends Fault {
+ public static final String NMR_FAULT_PREFIX = "jfns";
+
+ public static final String NMR_FAULT_ROOT = "NMRFault";
+ public static final String NMR_FAULT_STRING = "faultstring";
+
+ public static final String NMR_FAULT_DETAIL = "detail";
+
+ public static final String NMR_FAULT_CODE_SERVER = "SERVER";
+
+ public static final String NMR_FAULT_CODE_CLIENT = "CLIENT";
+
+
+ static final long serialVersionUID = 100000;
+
+ public NMRFault(Message message, Throwable throwable) {
+ super(message, throwable);
+ }
+
+ public NMRFault(Message message) {
+ super(message);
+ }
+
+ public NMRFault(String message) {
+ super(new Message(message, (ResourceBundle) null));
+ }
+
+ public static NMRFault createFault(Fault f) {
+ if (f instanceof NMRFault) {
+ return (NMRFault) f;
+ }
+ Throwable th = f.getCause();
+ NMRFault jbiFault = new NMRFault(new Message(f.getMessage(), (ResourceBundle) null), th);
+ jbiFault.setDetail(f.getDetail());
+ return jbiFault;
+ }
+
+}
Added: servicemix/smx4/features/trunk/ejb3/cxf-binding-nmr/src/main/java/org/apache/servicemix/cxf/binding/nmr/NMRMessage.java
URL: http://svn.apache.org/viewvc/servicemix/smx4/features/trunk/ejb3/cxf-binding-nmr/src/main/java/org/apache/servicemix/cxf/binding/nmr/NMRMessage.java?rev=617498&view=auto
==============================================================================
--- servicemix/smx4/features/trunk/ejb3/cxf-binding-nmr/src/main/java/org/apache/servicemix/cxf/binding/nmr/NMRMessage.java (added)
+++ servicemix/smx4/features/trunk/ejb3/cxf-binding-nmr/src/main/java/org/apache/servicemix/cxf/binding/nmr/NMRMessage.java Fri Feb 1 05:44:02 2008
@@ -0,0 +1,35 @@
+/**
+ * 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.cxf.binding.nmr;
+
+import org.apache.cxf.message.AbstractWrappedMessage;
+import org.apache.cxf.message.Message;
+import org.apache.servicemix.nmr.api.Exchange;
+
+public class NMRMessage extends AbstractWrappedMessage {
+
+ public NMRMessage(Message msg) {
+ super(msg);
+ }
+
+ public Exchange getNmrExchange() {
+ return get(Exchange.class);
+ }
+
+}
Added: servicemix/smx4/features/trunk/ejb3/cxf-binding-nmr/src/main/java/org/apache/servicemix/cxf/binding/nmr/interceptors/NMRFaultInInterceptor.java
URL: http://svn.apache.org/viewvc/servicemix/smx4/features/trunk/ejb3/cxf-binding-nmr/src/main/java/org/apache/servicemix/cxf/binding/nmr/interceptors/NMRFaultInInterceptor.java?rev=617498&view=auto
==============================================================================
--- servicemix/smx4/features/trunk/ejb3/cxf-binding-nmr/src/main/java/org/apache/servicemix/cxf/binding/nmr/interceptors/NMRFaultInInterceptor.java (added)
+++ servicemix/smx4/features/trunk/ejb3/cxf-binding-nmr/src/main/java/org/apache/servicemix/cxf/binding/nmr/interceptors/NMRFaultInInterceptor.java Fri Feb 1 05:44:02 2008
@@ -0,0 +1,71 @@
+/**
+ * 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.cxf.binding.nmr.interceptors;
+
+import java.util.ResourceBundle;
+
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+
+import org.w3c.dom.Element;
+
+import org.apache.cxf.common.i18n.BundleUtils;
+import org.apache.cxf.interceptor.Fault;
+import org.apache.cxf.phase.AbstractPhaseInterceptor;
+import org.apache.cxf.phase.Phase;
+import org.apache.cxf.staxutils.DepthXMLStreamReader;
+import org.apache.cxf.staxutils.FragmentStreamReader;
+import org.apache.cxf.staxutils.StaxUtils;
+import org.apache.servicemix.cxf.binding.nmr.NMRFault;
+import org.apache.servicemix.cxf.binding.nmr.NMRMessage;
+
+
+public class NMRFaultInInterceptor extends AbstractPhaseInterceptor<NMRMessage> {
+
+ private static final ResourceBundle BUNDLE = BundleUtils.getBundle(NMRFaultInInterceptor.class);
+ public NMRFaultInInterceptor() {
+ super(Phase.UNMARSHAL);
+ addBefore("*");
+ }
+
+ public void handleMessage(NMRMessage message) throws Fault {
+ XMLStreamReader xsr = message.getContent(XMLStreamReader.class);
+ DepthXMLStreamReader reader = new DepthXMLStreamReader(xsr);
+
+ try {
+
+ if (!StaxUtils.toNextElement(reader)) {
+ throw new Fault(new org.apache.cxf.common.i18n.Message("ILLEGAL_JBIFAULT_FORMAT", BUNDLE));
+ }
+ Fault fault = new NMRFault(new org.apache.cxf.common.i18n.Message(NMRFault.NMR_FAULT_STRING,
+ (ResourceBundle) null));
+
+ if (StaxUtils.toNextElement(reader)) {
+ // handling detail
+ Element detail = StaxUtils.read(new FragmentStreamReader(reader)).getDocumentElement();
+ fault.setDetail(detail);
+ }
+ message.setContent(Exception.class, fault);
+ } catch (XMLStreamException xse) {
+ throw new Fault(new org.apache.cxf.common.i18n.Message("STAX_READ_EXC", BUNDLE));
+ }
+
+ }
+}
Added: servicemix/smx4/features/trunk/ejb3/cxf-binding-nmr/src/main/java/org/apache/servicemix/cxf/binding/nmr/interceptors/NMRFaultOutInterceptor.java
URL: http://svn.apache.org/viewvc/servicemix/smx4/features/trunk/ejb3/cxf-binding-nmr/src/main/java/org/apache/servicemix/cxf/binding/nmr/interceptors/NMRFaultOutInterceptor.java?rev=617498&view=auto
==============================================================================
--- servicemix/smx4/features/trunk/ejb3/cxf-binding-nmr/src/main/java/org/apache/servicemix/cxf/binding/nmr/interceptors/NMRFaultOutInterceptor.java (added)
+++ servicemix/smx4/features/trunk/ejb3/cxf-binding-nmr/src/main/java/org/apache/servicemix/cxf/binding/nmr/interceptors/NMRFaultOutInterceptor.java Fri Feb 1 05:44:02 2008
@@ -0,0 +1,103 @@
+/**
+ * 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.cxf.binding.nmr.interceptors;
+
+import java.util.ResourceBundle;
+
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.w3c.dom.Element;
+import org.w3c.dom.NodeList;
+
+import org.apache.cxf.common.i18n.BundleUtils;
+import org.apache.cxf.common.i18n.Message;
+import org.apache.cxf.helpers.NSStack;
+import org.apache.cxf.interceptor.Fault;
+import org.apache.cxf.phase.AbstractPhaseInterceptor;
+import org.apache.cxf.phase.Phase;
+import org.apache.cxf.staxutils.StaxUtils;
+import org.apache.servicemix.cxf.binding.nmr.NMRConstants;
+import org.apache.servicemix.cxf.binding.nmr.NMRFault;
+import org.apache.servicemix.cxf.binding.nmr.NMRMessage;
+
+public class NMRFaultOutInterceptor extends AbstractPhaseInterceptor<NMRMessage> {
+
+ private static final ResourceBundle BUNDLE = BundleUtils.getBundle(NMRFaultOutInterceptor.class);
+
+ public NMRFaultOutInterceptor() {
+ super(Phase.MARSHAL);
+ }
+
+ public void handleMessage(NMRMessage message) throws Fault {
+ message.put(org.apache.cxf.message.Message.RESPONSE_CODE, new Integer(500));
+ NSStack nsStack = new NSStack();
+ nsStack.push();
+
+
+
+ try {
+ XMLStreamWriter writer = getWriter(message);
+ Fault fault = getFault(message);
+ NMRFault jbiFault = NMRFault.createFault(fault);
+ nsStack.add(NMRConstants.NS_NMR_BINDING);
+ String prefix = nsStack.getPrefix(NMRConstants.NS_NMR_BINDING);
+ StaxUtils.writeStartElement(writer, prefix, NMRFault.NMR_FAULT_ROOT,
+ NMRConstants.NS_NMR_BINDING);
+ if (!jbiFault.hasDetails()) {
+ writer.writeEmptyElement("fault");
+ } else {
+ Element detail = jbiFault.getDetail();
+ NodeList details = detail.getChildNodes();
+ for (int i = 0; i < details.getLength(); i++) {
+ if (details.item(i) instanceof Element) {
+ StaxUtils.writeNode(details.item(i), writer, true);
+ break;
+ }
+ }
+ }
+ writer.writeEndElement();
+ writer.flush();
+
+ } catch (XMLStreamException xe) {
+ throw new Fault(new Message("XML_WRITE_EXC", BUNDLE), xe);
+ }
+ }
+
+ protected Fault getFault(NMRMessage message) {
+ Exception e = message.getContent(Exception.class);
+ Fault fault;
+ if (e == null) {
+ throw new IllegalStateException(new Message("NO_EXCEPTION", BUNDLE).toString());
+ } else if (e instanceof Fault) {
+ fault = (Fault) e;
+ } else {
+ fault = new Fault(e);
+ }
+ return fault;
+ }
+
+ protected XMLStreamWriter getWriter(NMRMessage message) {
+ XMLStreamWriter writer = message.getContent(XMLStreamWriter.class);
+ if (writer == null) {
+ throw new IllegalStateException(new Message("NO_XML_STREAM_WRITER", BUNDLE).toString());
+ }
+ return writer;
+ }
+}
Added: servicemix/smx4/features/trunk/ejb3/cxf-binding-nmr/src/main/java/org/apache/servicemix/cxf/binding/nmr/interceptors/NMROperationInInterceptor.java
URL: http://svn.apache.org/viewvc/servicemix/smx4/features/trunk/ejb3/cxf-binding-nmr/src/main/java/org/apache/servicemix/cxf/binding/nmr/interceptors/NMROperationInInterceptor.java?rev=617498&view=auto
==============================================================================
--- servicemix/smx4/features/trunk/ejb3/cxf-binding-nmr/src/main/java/org/apache/servicemix/cxf/binding/nmr/interceptors/NMROperationInInterceptor.java (added)
+++ servicemix/smx4/features/trunk/ejb3/cxf-binding-nmr/src/main/java/org/apache/servicemix/cxf/binding/nmr/interceptors/NMROperationInInterceptor.java Fri Feb 1 05:44:02 2008
@@ -0,0 +1,71 @@
+/**
+ * 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.cxf.binding.nmr.interceptors;
+
+import java.util.ResourceBundle;
+import java.util.logging.Logger;
+
+import javax.xml.namespace.QName;
+
+import org.apache.cxf.common.i18n.Message;
+import org.apache.cxf.common.logging.LogUtils;
+import org.apache.cxf.endpoint.Endpoint;
+import org.apache.cxf.interceptor.Fault;
+import org.apache.cxf.message.Exchange;
+import org.apache.cxf.phase.AbstractPhaseInterceptor;
+import org.apache.cxf.phase.Phase;
+import org.apache.cxf.service.model.BindingInfo;
+import org.apache.cxf.service.model.BindingOperationInfo;
+import org.apache.cxf.service.model.MessageInfo;
+import org.apache.cxf.service.model.OperationInfo;
+import org.apache.servicemix.cxf.binding.nmr.NMRMessage;
+
+public class NMROperationInInterceptor extends AbstractPhaseInterceptor<NMRMessage> {
+
+ private static final Logger LOG = LogUtils.getL7dLogger(NMROperationInInterceptor.class);
+
+ private static final ResourceBundle BUNDLE = LOG.getResourceBundle();
+
+ public NMROperationInInterceptor() {
+ super(Phase.PRE_PROTOCOL);
+ }
+
+ public void handleMessage(NMRMessage message) throws Fault {
+ Exchange ex = message.getExchange();
+ Endpoint ep = ex.get(Endpoint.class);
+ BindingOperationInfo boi = ex.get(BindingOperationInfo.class);
+ if (boi == null && message.getNmrExchange().getOperation() != null) {
+ BindingInfo service = ep.getEndpointInfo().getBinding();
+ boi = getBindingOperationInfo(service, message.getNmrExchange().getOperation());
+ if (boi == null) {
+ throw new Fault(new Message("UNKNOWN_OPERATION", BUNDLE,
+ message.getNmrExchange().getOperation().toString()));
+ }
+ ex.put(BindingOperationInfo.class, boi);
+ ex.put(OperationInfo.class, boi.getOperationInfo());
+ ex.setOneWay(boi.getOperationInfo().isOneWay());
+ message.put(MessageInfo.class, boi.getInput().getMessageInfo());
+ }
+ }
+
+ protected BindingOperationInfo getBindingOperationInfo(BindingInfo service, QName operation) {
+ return service.getOperation(operation);
+ }
+
+}
Added: servicemix/smx4/features/trunk/ejb3/cxf-binding-nmr/src/main/java/org/apache/servicemix/cxf/binding/nmr/interceptors/NMRWrapperInInterceptor.java
URL: http://svn.apache.org/viewvc/servicemix/smx4/features/trunk/ejb3/cxf-binding-nmr/src/main/java/org/apache/servicemix/cxf/binding/nmr/interceptors/NMRWrapperInInterceptor.java?rev=617498&view=auto
==============================================================================
--- servicemix/smx4/features/trunk/ejb3/cxf-binding-nmr/src/main/java/org/apache/servicemix/cxf/binding/nmr/interceptors/NMRWrapperInInterceptor.java (added)
+++ servicemix/smx4/features/trunk/ejb3/cxf-binding-nmr/src/main/java/org/apache/servicemix/cxf/binding/nmr/interceptors/NMRWrapperInInterceptor.java Fri Feb 1 05:44:02 2008
@@ -0,0 +1,139 @@
+/**
+ * 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.cxf.binding.nmr.interceptors;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.ResourceBundle;
+import java.util.logging.Logger;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamConstants;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+
+import org.apache.servicemix.cxf.binding.nmr.NMRBindingInfo;
+import org.apache.servicemix.cxf.binding.nmr.NMRConstants;
+import org.apache.servicemix.cxf.binding.nmr.NMRFault;
+import org.apache.cxf.common.logging.LogUtils;
+import org.apache.cxf.databinding.DataReader;
+import org.apache.cxf.endpoint.Endpoint;
+import org.apache.cxf.interceptor.AbstractInDatabindingInterceptor;
+import org.apache.cxf.interceptor.Fault;
+import org.apache.cxf.message.Exchange;
+import org.apache.cxf.message.Message;
+import org.apache.cxf.phase.Phase;
+import org.apache.cxf.service.model.BindingInfo;
+import org.apache.cxf.service.model.BindingMessageInfo;
+import org.apache.cxf.service.model.BindingOperationInfo;
+import org.apache.cxf.service.model.MessageInfo;
+import org.apache.cxf.service.model.MessagePartInfo;
+import org.apache.cxf.staxutils.DepthXMLStreamReader;
+import org.apache.cxf.staxutils.StaxUtils;
+
+public class NMRWrapperInInterceptor extends AbstractInDatabindingInterceptor {
+
+ private static final Logger LOG = LogUtils.getL7dLogger(NMRWrapperInInterceptor.class);
+
+ private static final ResourceBundle BUNDLE = LOG.getResourceBundle();
+
+ public NMRWrapperInInterceptor() {
+ super(Phase.UNMARSHAL);
+ }
+
+ public void handleMessage(Message message) throws Fault {
+ if (isGET(message)) {
+ LOG.info("JbiMessageInInterceptor skipped in HTTP GET method");
+ return;
+ }
+ XMLStreamReader xsr = message.getContent(XMLStreamReader.class);
+
+ DepthXMLStreamReader reader = new DepthXMLStreamReader(xsr);
+
+ Endpoint ep = message.getExchange().get(Endpoint.class);
+ BindingInfo binding = ep.getEndpointInfo().getBinding();
+ if (!(binding instanceof NMRBindingInfo)) {
+ throw new IllegalStateException(
+ new org.apache.cxf.common.i18n.Message("NEED_JBIBINDING", BUNDLE).toString());
+ }
+
+ if (!StaxUtils.toNextElement(reader)) {
+ throw new Fault(new org.apache.cxf.common.i18n.Message("NO_OPERATION_ELEMENT", BUNDLE));
+ }
+
+ Exchange ex = message.getExchange();
+ QName startQName = reader.getName();
+
+ // handling jbi fault message
+ if (startQName.getLocalPart().equals(NMRFault.NMR_FAULT_ROOT)) {
+ message.getInterceptorChain().abort();
+
+ if (ep.getInFaultObserver() != null) {
+ ep.getInFaultObserver().onMessage(message);
+ return;
+ }
+ }
+
+
+ // handling xml normal inbound message
+ if (!startQName.equals(NMRConstants.JBI_WRAPPER_MESSAGE)) {
+ throw new Fault(new org.apache.cxf.common.i18n.Message(
+ "NO_JBI_MESSAGE_ELEMENT", BUNDLE));
+ }
+
+ try {
+ BindingOperationInfo bop = ex.get(BindingOperationInfo.class);
+ DataReader<XMLStreamReader> dr = getDataReader(message);
+ List<Object> parameters = new ArrayList<Object>();
+ reader.next();
+ BindingMessageInfo messageInfo = !isRequestor(message) ? bop.getInput() : bop.getOutput();
+ message.put(MessageInfo.class, messageInfo.getMessageInfo());
+ for (MessagePartInfo part : messageInfo.getMessageParts()) {
+ if (!StaxUtils.skipToStartOfElement(reader)) {
+ throw new Fault(new org.apache.cxf.common.i18n.Message("NOT_ENOUGH_PARTS", BUNDLE));
+ }
+ startQName = reader.getName();
+ if (!startQName.equals(NMRConstants.JBI_WRAPPER_PART)) {
+ throw new Fault(new org.apache.cxf.common.i18n.Message("NO_JBI_PART_ELEMENT", BUNDLE));
+ }
+ if (part.isElement()) {
+ reader.next();
+ if (!StaxUtils.toNextElement(reader)) {
+ throw new Fault(new org.apache.cxf.common.i18n.Message("EXPECTED_ELEMENT_IN_PART", BUNDLE));
+ }
+ }
+ parameters.add(dr.read(part, reader));
+ // skip end element
+ if (part.isElement()) {
+ reader.next();
+ }
+ }
+ int ev = reader.getEventType();
+ while (ev != XMLStreamConstants.END_ELEMENT
+ && ev != XMLStreamConstants.START_ELEMENT
+ && ev != XMLStreamConstants.END_DOCUMENT) {
+ ev = reader.next();
+ }
+ message.setContent(List.class, parameters);
+ } catch (XMLStreamException e) {
+ throw new Fault(new org.apache.cxf.common.i18n.Message("STAX_READ_EXC", BUNDLE), e);
+ }
+ }
+
+}
Added: servicemix/smx4/features/trunk/ejb3/cxf-binding-nmr/src/main/java/org/apache/servicemix/cxf/binding/nmr/interceptors/NMRWrapperOutInterceptor.java
URL: http://svn.apache.org/viewvc/servicemix/smx4/features/trunk/ejb3/cxf-binding-nmr/src/main/java/org/apache/servicemix/cxf/binding/nmr/interceptors/NMRWrapperOutInterceptor.java?rev=617498&view=auto
==============================================================================
--- servicemix/smx4/features/trunk/ejb3/cxf-binding-nmr/src/main/java/org/apache/servicemix/cxf/binding/nmr/interceptors/NMRWrapperOutInterceptor.java (added)
+++ servicemix/smx4/features/trunk/ejb3/cxf-binding-nmr/src/main/java/org/apache/servicemix/cxf/binding/nmr/interceptors/NMRWrapperOutInterceptor.java Fri Feb 1 05:44:02 2008
@@ -0,0 +1,102 @@
+/**
+ * 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.cxf.binding.nmr.interceptors;
+
+import java.util.List;
+import java.util.ResourceBundle;
+import java.util.logging.Logger;
+
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.apache.cxf.common.logging.LogUtils;
+import org.apache.cxf.databinding.DataWriter;
+import org.apache.cxf.interceptor.AbstractOutDatabindingInterceptor;
+import org.apache.cxf.interceptor.Fault;
+import org.apache.cxf.message.Message;
+import org.apache.cxf.phase.Phase;
+import org.apache.cxf.service.Service;
+import org.apache.cxf.service.model.BindingOperationInfo;
+import org.apache.cxf.service.model.MessagePartInfo;
+import org.apache.servicemix.cxf.binding.nmr.NMRConstants;
+
+public class NMRWrapperOutInterceptor extends AbstractOutDatabindingInterceptor {
+
+ private static final Logger LOG = LogUtils.getL7dLogger(NMRWrapperOutInterceptor.class);
+
+ private static final ResourceBundle BUNDLE = LOG.getResourceBundle();
+
+ public NMRWrapperOutInterceptor() {
+ super(Phase.MARSHAL);
+ }
+
+ public void handleMessage(Message message) throws Fault {
+ BindingOperationInfo bop = message.getExchange().get(BindingOperationInfo.class);
+ XMLStreamWriter xmlWriter = getXMLStreamWriter(message);
+ Service service = message.getExchange().get(Service.class);
+
+ DataWriter<XMLStreamWriter> dataWriter = getDataWriter(message, service, XMLStreamWriter.class);
+
+ try {
+ xmlWriter.setPrefix("jbi", NMRConstants.NS_JBI_WRAPPER);
+ xmlWriter.writeStartElement(NMRConstants.NS_JBI_WRAPPER,
+ NMRConstants.JBI_WRAPPER_MESSAGE.getLocalPart());
+ xmlWriter.writeNamespace("jbi", NMRConstants.NS_JBI_WRAPPER);
+
+ List<MessagePartInfo> parts = null;
+ if (!isRequestor(message)) {
+ parts = bop.getOutput().getMessageParts();
+ } else {
+ parts = bop.getInput().getMessageParts();
+ }
+ List<?> objs = (List<?>) message.getContent(List.class);
+ if (objs.size() < parts.size()) {
+ throw new Fault(new org.apache.cxf.common.i18n.Message(
+ "NOT_EQUAL_ARG_NUM", BUNDLE));
+ }
+ for (int idx = 0; idx < parts.size(); idx++) {
+ MessagePartInfo part = parts.get(idx);
+ Object obj = objs.get(idx);
+ if (!part.isElement()) {
+ if (part.getTypeClass() == String.class) {
+ xmlWriter.writeStartElement(NMRConstants.NS_JBI_WRAPPER,
+ NMRConstants.JBI_WRAPPER_PART.getLocalPart());
+ xmlWriter.writeCharacters(obj.toString());
+ xmlWriter.writeEndElement();
+ } else {
+ part = new MessagePartInfo(part.getName(), part.getMessageInfo());
+ part.setElement(false);
+ part.setConcreteName(NMRConstants.JBI_WRAPPER_PART);
+ dataWriter.write(obj, part, xmlWriter);
+ }
+ } else {
+ xmlWriter.writeStartElement(NMRConstants.NS_JBI_WRAPPER,
+ NMRConstants.JBI_WRAPPER_PART.getLocalPart());
+ dataWriter.write(obj, part, xmlWriter);
+ xmlWriter.writeEndElement();
+ }
+ }
+ xmlWriter.writeEndElement();
+
+ } catch (XMLStreamException e) {
+ throw new Fault(new org.apache.cxf.common.i18n.Message("STAX_WRITE_EXC", BUNDLE), e);
+ }
+ }
+
+}
Added: servicemix/smx4/features/trunk/ejb3/cxf-binding-nmr/src/main/resources/org/apache/servicemix/cxf/binding/nmr/interceptors/Messages.properties
URL: http://svn.apache.org/viewvc/servicemix/smx4/features/trunk/ejb3/cxf-binding-nmr/src/main/resources/org/apache/servicemix/cxf/binding/nmr/interceptors/Messages.properties?rev=617498&view=auto
==============================================================================
--- servicemix/smx4/features/trunk/ejb3/cxf-binding-nmr/src/main/resources/org/apache/servicemix/cxf/binding/nmr/interceptors/Messages.properties (added)
+++ servicemix/smx4/features/trunk/ejb3/cxf-binding-nmr/src/main/resources/org/apache/servicemix/cxf/binding/nmr/interceptors/Messages.properties Fri Feb 1 05:44:02 2008
@@ -0,0 +1,61 @@
+#
+# 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.
+#
+NOT.IMPLEMENTED=not yet implemented
+INVOKE.SERVICE=invoking service\t
+CREATE.MESSAGE.EXCHANGE=create message exchange svc:\t
+EXCHANGE.ENDPOINT=exchange endpoint:\t
+NO.MESSAGE=no message yet
+UNABLE.RETRIEVE.MESSAGE=unable to retrieve message
+CONTEXT.MUST.BE=context must be of type JBIOutputStreamMessageContext
+RECEIVED.MESSAGE=received message:\t
+ACTIVE.JBI.SERVER.TRANSPORT=activating JBI server transport
+BUILDING.DOCUMENT=building document from bytes
+CREATE.NORMALIZED.MESSAGE=creating NormalizedMessage
+POST.DISPATCH=postDispatch sending out message to NWR
+ERROR.SEND.MESSAGE=error sending Out message
+DISPATCH.MESSAGE.ON.CALLBACK=dispatching message on callback:\t
+ERROR.PREPARE.MESSAGE=error preparing message
+RECEIVE.THREAD.START=JBIServerTransport message receiving thread started
+DISPATCH.TO.SU=dispatching to CXF service unit
+NO.SU.FOUND=no CXFServiceUnit found
+ERROR.DISPATCH.THREAD=error running dispatch thread
+JBI.SERVER.TRANSPORT.MESSAGE.PROCESS.THREAD.EXIT=JBIServerTransport message processing thread exiting
+CONFIG.DELIVERY.CHANNEL=configuring DeliveryChannel:\t
+CONFIG.SU.MANAGER=configuring ServiceUnitManager:\t
+JBI.TRANSPORT.FACTORY.NOT.INITIALIZED=JBITransportFactory is not properly initialized
+SU.MANAGER=CXFServiceUnitManager:\t
+DELIVERY.CHANNEL=DeliveryChannel:\t
+JBI.TRANSPORT.FACTORY.NOT.FULLY.INITIALIZED=JBITransport factory not fully initialized
+CREATE.SERVER.TRANSPORT=creating JBI server transport
+CREATE.CLIENT.TRANSPORT=creating JBI client transport
+UNKNOWN_OPERATION=unknown operation {0}
+NO_OPERATION_ELEMENT=no operation element
+NO_JBI_MESSAGE_ELEMENT=no jbi message element
+NOT_ENOUGH_PARTS=not enough parts
+NO_JBI_PART_ELEMENT=no jbi part element
+EXPECTED_ELEMENT_IN_PART=expected element in part
+TOO_MANY_PARTS=too many parts
+ILLEGAL_JBIFAULT_FORMAT=illegal jbi fault format
+STAX_READ_EXC=stax read exception
+XML_WRITE_EXC=xml write exception
+STAX_WRITE_EXC=stax write exception
+NOT_EQUAL_ARG_NUM=The number of arguments is not equal
+NEED_JBIBINDING=BindingInfo should be a JbiBindingInfo
+NO_EXCEPTION=No exception on this message
+NO_XML_STREAM_WRITER=No XMLStreamWriter on this message
\ No newline at end of file
Propchange: servicemix/smx4/features/trunk/ejb3/cxf-transport-nmr/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Fri Feb 1 05:44:02 2008
@@ -0,0 +1,9 @@
+target
+*.iml
+*.ipr
+*.iws
+.classpath
+.project
+.settings
+
+
Added: servicemix/smx4/features/trunk/ejb3/cxf-transport-nmr/pom.xml
URL: http://svn.apache.org/viewvc/servicemix/smx4/features/trunk/ejb3/cxf-transport-nmr/pom.xml?rev=617498&view=auto
==============================================================================
--- servicemix/smx4/features/trunk/ejb3/cxf-transport-nmr/pom.xml (added)
+++ servicemix/smx4/features/trunk/ejb3/cxf-transport-nmr/pom.xml Fri Feb 1 05:44:02 2008
@@ -0,0 +1,122 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+ <!--
+
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.apache.servicemix.ejb3</groupId>
+ <artifactId>ejb3</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ </parent>
+
+ <groupId>org.apache.servicemix.ejb3</groupId>
+ <artifactId>org.apache.servicemix.cxf.transport.nmr</artifactId>
+ <packaging>bundle</packaging>
+ <version>1.0-SNAPSHOT</version>
+ <name>ServiceMix CXF Transport for NMR</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.servicemix.bundles</groupId>
+ <artifactId>org.apache.servicemix.bundles.cxf-2.0.4</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.servicemix.nmr</groupId>
+ <artifactId>org.apache.servicemix.nmr.api</artifactId>
+ <version>${servicemix.nmr.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-bundle</artifactId>
+ <version>${cxf.version}</version>
+ <optional>true</optional>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <!-- Bundle generation -->
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <configuration>
+ <instructions>
+ <Bundle-SymbolicName>${pom.artifactId}</Bundle-SymbolicName>
+ <Import-Package>
+ javax.xml.rpc*;resolution:=optional,
+ javax.xml.soap,
+ com.ctc.wstx.stax;resolution:=optional,
+ org.apache.axis.soap;resolution:=optional,
+ org.apache.axis2.saaj;resolution:=optional,
+ com.sun.xml.messaging.saaj.soap.ver1_1;resolution:=optional,
+ com.sun.xml.messaging.saaj.client.p2p;resolution:=optional,
+ com.sun.xml.messaging.saaj.soap;resolution:=optional,
+ *
+ </Import-Package>
+ <!-- Needed for jaxb annotations classes -->
+ <DynamicImport-Package>*</DynamicImport-Package>
+ <Export-Package>${pom.artifactId}*</Export-Package>
+ <Private-Package></Private-Package>
+ <Spring-Context>*;publish-context:=false</Spring-Context>
+ </instructions>
+ </configuration>
+ </plugin>
+ <!-- generate dependencies versions -->
+ <plugin>
+ <groupId>org.apache.servicemix.kernel.testing</groupId>
+ <artifactId>depends-maven-plugin</artifactId>
+ <version>${servicemix.kernel.version}</version>
+ <executions>
+ <execution>
+ <id>generate-depends-file</id>
+ <goals>
+ <goal>generate-depends-file</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <forkMode>pertest</forkMode>
+ <systemProperties>
+ <property>
+ <name>javax.xml.parsers.DocumentBuilderFactory</name>
+ <value>com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl</value>
+ </property>
+ <property>
+ <name>javax.xml.datatype.DatatypeFactory</name>
+ <value>com.sun.org.apache.xerces.internal.jaxp.datatype.DatatypeFactoryImpl</value>
+ </property>
+ <property>
+ <name>javax.xml.parsers.SAXParserFactory</name>
+ <value>com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl</value>
+ </property>
+ </systemProperties>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
Added: servicemix/smx4/features/trunk/ejb3/cxf-transport-nmr/src/main/java/org/apache/servicemix/cxf/transport/nmr/NMRConduit.java
URL: http://svn.apache.org/viewvc/servicemix/smx4/features/trunk/ejb3/cxf-transport-nmr/src/main/java/org/apache/servicemix/cxf/transport/nmr/NMRConduit.java?rev=617498&view=auto
==============================================================================
--- servicemix/smx4/features/trunk/ejb3/cxf-transport-nmr/src/main/java/org/apache/servicemix/cxf/transport/nmr/NMRConduit.java (added)
+++ servicemix/smx4/features/trunk/ejb3/cxf-transport-nmr/src/main/java/org/apache/servicemix/cxf/transport/nmr/NMRConduit.java Fri Feb 1 05:44:02 2008
@@ -0,0 +1,71 @@
+/**
+ * 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.cxf.transport.nmr;
+
+import java.io.IOException;
+import java.io.OutputStream;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import org.apache.cxf.Bus;
+import org.apache.cxf.common.logging.LogUtils;
+import org.apache.cxf.message.Message;
+import org.apache.cxf.transport.AbstractConduit;
+import org.apache.cxf.ws.addressing.EndpointReferenceType;
+import org.apache.servicemix.nmr.api.Channel;
+import org.apache.servicemix.nmr.api.NMR;
+
+
+public class NMRConduit extends AbstractConduit {
+
+ private static final Logger LOG = LogUtils.getL7dLogger(NMRConduit.class);
+
+ private NMR nmr;
+ private Bus bus;
+
+ public NMRConduit(EndpointReferenceType target, NMR nmr) {
+ this(null, target, nmr);
+ }
+
+ public NMRConduit(Bus bus, EndpointReferenceType target, NMR nmr) {
+ super(target);
+ this.nmr = nmr;
+ this.bus = bus;
+ }
+
+ public Bus getBus() {
+ return bus;
+ }
+
+ public NMR getNmr() {
+ return nmr;
+ }
+
+ protected Logger getLogger() {
+ return LOG;
+ }
+
+ public void prepare(Message message) throws IOException {
+ getLogger().log(Level.FINE, "JBIConduit send message");
+
+ message.setContent(OutputStream.class,
+ new NMRConduitOutputStream(message, nmr, target, this));
+ }
+}
Added: servicemix/smx4/features/trunk/ejb3/cxf-transport-nmr/src/main/java/org/apache/servicemix/cxf/transport/nmr/NMRConduitOutputStream.java
URL: http://svn.apache.org/viewvc/servicemix/smx4/features/trunk/ejb3/cxf-transport-nmr/src/main/java/org/apache/servicemix/cxf/transport/nmr/NMRConduitOutputStream.java?rev=617498&view=auto
==============================================================================
--- servicemix/smx4/features/trunk/ejb3/cxf-transport-nmr/src/main/java/org/apache/servicemix/cxf/transport/nmr/NMRConduitOutputStream.java (added)
+++ servicemix/smx4/features/trunk/ejb3/cxf-transport-nmr/src/main/java/org/apache/servicemix/cxf/transport/nmr/NMRConduitOutputStream.java Fri Feb 1 05:44:02 2008
@@ -0,0 +1,166 @@
+/**
+ * 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.cxf.transport.nmr;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.lang.reflect.Member;
+import java.lang.reflect.Method;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.logging.Logger;
+
+import javax.jws.WebService;
+import javax.xml.namespace.QName;
+import javax.xml.transform.Source;
+import javax.xml.transform.stream.StreamSource;
+
+import org.apache.cxf.common.logging.LogUtils;
+import org.apache.cxf.io.CachedOutputStream;
+import org.apache.cxf.message.Exchange;
+import org.apache.cxf.message.Message;
+import org.apache.cxf.message.MessageImpl;
+import org.apache.cxf.service.model.BindingOperationInfo;
+import org.apache.cxf.ws.addressing.EndpointReferenceType;
+import org.apache.cxf.wsdl.EndpointReferenceUtils;
+import org.apache.servicemix.nmr.api.Channel;
+import org.apache.servicemix.nmr.api.Endpoint;
+import org.apache.servicemix.nmr.api.NMR;
+import org.apache.servicemix.nmr.api.Pattern;
+import org.apache.servicemix.nmr.api.Reference;
+import org.apache.servicemix.nmr.api.Status;
+
+public class NMRConduitOutputStream extends CachedOutputStream {
+
+ private static final Logger LOG = LogUtils.getL7dLogger(NMRConduitOutputStream.class);
+
+ private Message message;
+ private boolean isOneWay;
+ private Channel channel;
+ private NMRConduit conduit;
+ private EndpointReferenceType target;
+
+ public NMRConduitOutputStream(Message m, NMR nmr, EndpointReferenceType target,
+ NMRConduit conduit) {
+ message = m;
+ this.channel = nmr.createChannel();
+ this.conduit = conduit;
+ this.target = target;
+
+ }
+
+ @Override
+ protected void doFlush() throws IOException {
+
+ }
+
+ @Override
+ protected void doClose() throws IOException {
+ isOneWay = message.getExchange().isOneWay();
+ commitOutputMessage();
+ if (target != null) {
+ target.getClass();
+ }
+ channel.close();
+ }
+
+ private void commitOutputMessage() throws IOException {
+ try {
+ Member member = (Member) message.get(Method.class.getName());
+ Class<?> clz = member.getDeclaringClass();
+ Exchange exchange = message.getExchange();
+ BindingOperationInfo bop = exchange.get(BindingOperationInfo.class);
+
+ LOG.info(new org.apache.cxf.common.i18n.Message("INVOKE.SERVICE", LOG).toString() + clz);
+
+ WebService ws = clz.getAnnotation(WebService.class);
+ assert ws != null;
+ QName interfaceName = new QName(ws.targetNamespace(), ws.name());
+ QName serviceName;
+ if (target != null) {
+ serviceName = EndpointReferenceUtils.getServiceName(target);
+ } else {
+ serviceName = message.getExchange().get(org.apache.cxf.service.Service.class).getName();
+ }
+
+ LOG.info(new org.apache.cxf.common.i18n.Message("CREATE.MESSAGE.EXCHANGE", LOG).toString() + serviceName);
+ org.apache.servicemix.nmr.api.Exchange xchng;
+ if (isOneWay) {
+ xchng = channel.createExchange(Pattern.InOnly);
+ } else if (bop.getOutput() == null) {
+ xchng = channel.createExchange(Pattern.RobustInOnly);
+ } else {
+ xchng = channel.createExchange(Pattern.InOut);
+ }
+
+ org.apache.servicemix.nmr.api.Message inMsg = xchng.getIn();
+ LOG.info(new org.apache.cxf.common.i18n.Message("EXCHANGE.ENDPOINT", LOG).toString() + serviceName);
+ LOG.info("setup message contents on " + inMsg);
+ inMsg.setBody(getMessageContent(message));
+ LOG.info("service for exchange " + serviceName);
+
+ Map<String,Object> refProps = new HashMap<String,Object>();
+ refProps.put(Endpoint.INTERFACE_NAME, interfaceName);
+ refProps.put(Endpoint.SERVICE_NAME, serviceName);
+ Reference ref = channel.getNMR().getEndpointRegistry().lookup(refProps);
+ xchng.setTarget(ref);
+ xchng.setOperation(bop.getName());
+ LOG.info("sending message");
+ if (!isOneWay) {
+ channel.sendSync(xchng);
+ Source content = null;
+ if (xchng.getFault(false) != null) {
+ content = xchng.getFault().getBody(Source.class);
+ } else {
+ content = xchng.getOut().getBody(Source.class);
+ }
+ Message inMessage = new MessageImpl();
+ message.getExchange().setInMessage(inMessage);
+ InputStream ins = NMRMessageHelper.convertMessageToInputStream(content);
+ if (ins == null) {
+ throw new IOException(new org.apache.cxf.common.i18n.Message("UNABLE.RETRIEVE.MESSAGE", LOG).toString());
+ }
+ inMessage.setContent(InputStream.class, ins);
+ conduit.getMessageObserver().onMessage(inMessage);
+
+ xchng.setStatus(Status.Done);
+ channel.send(xchng);
+ } else {
+ channel.sendSync(xchng);
+ }
+ } catch (IOException e) {
+ throw e;
+ } catch (Exception e) {
+ e.printStackTrace();
+ new IOException(e.toString());
+ }
+ }
+
+ private Source getMessageContent(Message message2) throws IOException {
+ return new StreamSource(this.getInputStream());
+
+ }
+
+ @Override
+ protected void onWrite() throws IOException {
+
+ }
+
+}
Added: servicemix/smx4/features/trunk/ejb3/cxf-transport-nmr/src/main/java/org/apache/servicemix/cxf/transport/nmr/NMRDestination.java
URL: http://svn.apache.org/viewvc/servicemix/smx4/features/trunk/ejb3/cxf-transport-nmr/src/main/java/org/apache/servicemix/cxf/transport/nmr/NMRDestination.java?rev=617498&view=auto
==============================================================================
--- servicemix/smx4/features/trunk/ejb3/cxf-transport-nmr/src/main/java/org/apache/servicemix/cxf/transport/nmr/NMRDestination.java (added)
+++ servicemix/smx4/features/trunk/ejb3/cxf-transport-nmr/src/main/java/org/apache/servicemix/cxf/transport/nmr/NMRDestination.java Fri Feb 1 05:44:02 2008
@@ -0,0 +1,158 @@
+/**
+ * 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.cxf.transport.nmr;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import javax.xml.namespace.QName;
+import javax.xml.transform.Source;
+
+import org.apache.cxf.common.logging.LogUtils;
+import org.apache.cxf.message.Message;
+import org.apache.cxf.message.MessageImpl;
+import org.apache.cxf.service.model.EndpointInfo;
+import org.apache.cxf.transport.AbstractConduit;
+import org.apache.cxf.transport.AbstractDestination;
+import org.apache.cxf.transport.Conduit;
+import org.apache.cxf.transport.MessageObserver;
+import org.apache.cxf.ws.addressing.EndpointReferenceType;
+import org.apache.cxf.wsdl.EndpointReferenceUtils;
+import org.apache.servicemix.nmr.api.Channel;
+import org.apache.servicemix.nmr.api.Endpoint;
+import org.apache.servicemix.nmr.api.Exchange;
+import org.apache.servicemix.nmr.api.NMR;
+import org.apache.servicemix.nmr.api.ServiceMixException;
+
+public class NMRDestination extends AbstractDestination implements Endpoint {
+
+ private static final Logger LOG = LogUtils.getL7dLogger(NMRDestination.class);
+ private NMR nmr;
+ private Channel channel;
+ private Map<String, Object> properties;
+
+ public NMRDestination(EndpointInfo info, NMR nmr) {
+ super(getTargetReference(info, null), info);
+ this.nmr = nmr;
+ this.properties = new HashMap<String, Object>();
+ this.properties.put(Endpoint.NAME, info.getName().toString());
+ this.properties.put(Endpoint.SERVICE_NAME, info.getService().getName());
+ this.properties.put(Endpoint.INTERFACE_NAME, info.getInterface().getName());
+ }
+
+ public void setChannel(Channel dc) {
+ this.channel = dc;
+ }
+
+ public Channel getChannel() {
+ return this.channel;
+ }
+
+ protected Logger getLogger() {
+ return LOG;
+ }
+
+ /**
+ * @param inMessage the incoming message
+ * @return the inbuilt backchannel
+ */
+ protected Conduit getInbuiltBackChannel(Message inMessage) {
+ return new BackChannelConduit(EndpointReferenceUtils.getAnonymousEndpointReference(),
+ inMessage);
+ }
+
+ public void shutdown() {
+ nmr.getEndpointRegistry().unregister(this, properties);
+ }
+
+ public void deactivate() {
+ nmr.getEndpointRegistry().unregister(this, properties);
+ }
+
+ public void activate() {
+ nmr.getEndpointRegistry().register(this, properties);
+ }
+
+ public void process(Exchange exchange) {
+ QName opName = exchange.getOperation();
+ getLogger().fine("dispatch method: " + opName);
+
+ org.apache.servicemix.nmr.api.Message nm = exchange.getIn();
+ try {
+
+ MessageImpl inMessage = new MessageImpl();
+ inMessage.put(Exchange.class, exchange);
+
+ final InputStream in = NMRMessageHelper.convertMessageToInputStream(nm.getBody(Source.class));
+ inMessage.setContent(InputStream.class, in);
+ inMessage.setDestination(this);
+ getMessageObserver().onMessage(inMessage);
+
+ } catch (Exception ex) {
+ getLogger().log(Level.SEVERE, new org.apache.cxf.common.i18n.Message("ERROR.PREPARE.MESSAGE", getLogger()).toString(), ex);
+ throw new ServiceMixException(ex);
+ }
+ }
+
+
+ protected class BackChannelConduit extends AbstractConduit {
+
+ protected Message inMessage;
+ protected NMRDestination nmrDestination;
+
+ BackChannelConduit(EndpointReferenceType ref, Message message) {
+ super(ref);
+ inMessage = message;
+ }
+
+ /**
+ * Register a message observer for incoming messages.
+ *
+ * @param observer the observer to notify on receipt of incoming
+ */
+ public void setMessageObserver(MessageObserver observer) {
+ // shouldn't be called for a back channel conduit
+ }
+
+ /**
+ * Send an outbound message, assumed to contain all the name-value
+ * mappings of the corresponding input message (if any).
+ *
+ * @param message the message to be sent.
+ */
+ public void prepare(Message message) throws IOException {
+ // setup the message to be send back
+ Channel dc = channel;
+ message.put(Exchange.class, inMessage.get(Exchange.class));
+ message.setContent(OutputStream.class,
+ new NMRDestinationOutputStream(inMessage, dc));
+ }
+
+ protected Logger getLogger() {
+ return LOG;
+ }
+ }
+
+}