servicemix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gno...@apache.org
Subject svn commit: r357814 [1/3] - in /incubator/servicemix/trunk/servicemix-wsn2005: ./ src/ src/main/ src/main/java/ src/main/java/org/ src/main/java/org/servicemix/ src/main/java/org/servicemix/wsn/ src/main/java/org/servicemix/wsn/component/ src/main/java...
Date Mon, 19 Dec 2005 22:08:52 GMT
Author: gnodet
Date: Mon Dec 19 14:08:30 2005
New Revision: 357814

URL: http://svn.apache.org/viewcvs?rev=357814&view=rev
Log:
Add WS-Notification 1.3 support

Added:
    incubator/servicemix/trunk/servicemix-wsn2005/   (with props)
    incubator/servicemix/trunk/servicemix-wsn2005/maven.xml
    incubator/servicemix/trunk/servicemix-wsn2005/project.properties
    incubator/servicemix/trunk/servicemix-wsn2005/project.xml
    incubator/servicemix/trunk/servicemix-wsn2005/src/
    incubator/servicemix/trunk/servicemix-wsn2005/src/main/
    incubator/servicemix/trunk/servicemix-wsn2005/src/main/java/
    incubator/servicemix/trunk/servicemix-wsn2005/src/main/java/org/
    incubator/servicemix/trunk/servicemix-wsn2005/src/main/java/org/servicemix/
    incubator/servicemix/trunk/servicemix-wsn2005/src/main/java/org/servicemix/wsn/
    incubator/servicemix/trunk/servicemix-wsn2005/src/main/java/org/servicemix/wsn/AbstractEndpoint.java
    incubator/servicemix/trunk/servicemix-wsn2005/src/main/java/org/servicemix/wsn/AbstractNotificationBroker.java
    incubator/servicemix/trunk/servicemix-wsn2005/src/main/java/org/servicemix/wsn/AbstractPublisher.java
    incubator/servicemix/trunk/servicemix-wsn2005/src/main/java/org/servicemix/wsn/AbstractPullPoint.java
    incubator/servicemix/trunk/servicemix-wsn2005/src/main/java/org/servicemix/wsn/AbstractSubscription.java
    incubator/servicemix/trunk/servicemix-wsn2005/src/main/java/org/servicemix/wsn/EndpointManager.java
    incubator/servicemix/trunk/servicemix-wsn2005/src/main/java/org/servicemix/wsn/EndpointRegistrationException.java
    incubator/servicemix/trunk/servicemix-wsn2005/src/main/java/org/servicemix/wsn/PullPointConsumer.java
    incubator/servicemix/trunk/servicemix-wsn2005/src/main/java/org/servicemix/wsn/component/
    incubator/servicemix/trunk/servicemix-wsn2005/src/main/java/org/servicemix/wsn/component/WSNBootstrap.java
    incubator/servicemix/trunk/servicemix-wsn2005/src/main/java/org/servicemix/wsn/component/WSNComponent.java
    incubator/servicemix/trunk/servicemix-wsn2005/src/main/java/org/servicemix/wsn/component/WSNConfiguration.java
    incubator/servicemix/trunk/servicemix-wsn2005/src/main/java/org/servicemix/wsn/component/WSNConfigurationMBean.java
    incubator/servicemix/trunk/servicemix-wsn2005/src/main/java/org/servicemix/wsn/component/WSNEndpoint.java
    incubator/servicemix/trunk/servicemix-wsn2005/src/main/java/org/servicemix/wsn/component/WSNLifeCycle.java
    incubator/servicemix/trunk/servicemix-wsn2005/src/main/java/org/servicemix/wsn/jbi/
    incubator/servicemix/trunk/servicemix-wsn2005/src/main/java/org/servicemix/wsn/jbi/JbiNotificationBroker.java
    incubator/servicemix/trunk/servicemix-wsn2005/src/main/java/org/servicemix/wsn/jbi/JbiSubscription.java
    incubator/servicemix/trunk/servicemix-wsn2005/src/main/java/org/servicemix/wsn/jms/
    incubator/servicemix/trunk/servicemix-wsn2005/src/main/java/org/servicemix/wsn/jms/JmsNotificationBroker.java
    incubator/servicemix/trunk/servicemix-wsn2005/src/main/java/org/servicemix/wsn/jms/JmsPublisher.java
    incubator/servicemix/trunk/servicemix-wsn2005/src/main/java/org/servicemix/wsn/jms/JmsPullPoint.java
    incubator/servicemix/trunk/servicemix-wsn2005/src/main/java/org/servicemix/wsn/jms/JmsSubscription.java
    incubator/servicemix/trunk/servicemix-wsn2005/src/main/java/org/servicemix/wsn/jms/JmsTopicExpressionConverter.java
    incubator/servicemix/trunk/servicemix-wsn2005/src/main/resources/
    incubator/servicemix/trunk/servicemix-wsn2005/src/main/wsdl/
    incubator/servicemix/trunk/servicemix-wsn2005/src/main/wsdl/b-1.xsd
    incubator/servicemix/trunk/servicemix-wsn2005/src/main/wsdl/bf-1.xsd
    incubator/servicemix/trunk/servicemix-wsn2005/src/main/wsdl/br-1.xsd
    incubator/servicemix/trunk/servicemix-wsn2005/src/main/wsdl/brw-1.wsdl
    incubator/servicemix/trunk/servicemix-wsn2005/src/main/wsdl/bw-1.wsdl
    incubator/servicemix/trunk/servicemix-wsn2005/src/main/wsdl/r-1.xsd
    incubator/servicemix/trunk/servicemix-wsn2005/src/main/wsdl/rw-1.wsdl
    incubator/servicemix/trunk/servicemix-wsn2005/src/main/wsdl/wsa.xsd
    incubator/servicemix/trunk/servicemix-wsn2005/src/main/wsdl/wsn.wsdl
    incubator/servicemix/trunk/servicemix-wsn2005/src/main/wsdl/xml.xsd
    incubator/servicemix/trunk/servicemix-wsn2005/src/test/
    incubator/servicemix/trunk/servicemix-wsn2005/src/test/java/
    incubator/servicemix/trunk/servicemix-wsn2005/src/test/java/org/
    incubator/servicemix/trunk/servicemix-wsn2005/src/test/java/org/servicemix/
    incubator/servicemix/trunk/servicemix-wsn2005/src/test/java/org/servicemix/wsn/
    incubator/servicemix/trunk/servicemix-wsn2005/src/test/java/org/servicemix/wsn/JAXBMarshaller.java
    incubator/servicemix/trunk/servicemix-wsn2005/src/test/java/org/servicemix/wsn/SubscriptionTest.java
    incubator/servicemix/trunk/servicemix-wsn2005/src/test/java/org/servicemix/wsn/component/
    incubator/servicemix/trunk/servicemix-wsn2005/src/test/java/org/servicemix/wsn/component/WSNComponentTest.java
    incubator/servicemix/trunk/servicemix-wsn2005/src/test/java/org/servicemix/wsn/jbi/
    incubator/servicemix/trunk/servicemix-wsn2005/src/test/java/org/servicemix/wsn/jms/
    incubator/servicemix/trunk/servicemix-wsn2005/src/test/resources/
    incubator/servicemix/trunk/servicemix-wsn2005/src/test/resources/log4j.properties
    incubator/servicemix/trunk/servicemix-wsn2005/src/test/resources/org/
    incubator/servicemix/trunk/servicemix-wsn2005/src/test/resources/org/servicemix/
    incubator/servicemix/trunk/servicemix-wsn2005/src/test/resources/org/servicemix/wsn/
    incubator/servicemix/trunk/servicemix-wsn2005/src/test/resources/org/servicemix/wsn/component/
    incubator/servicemix/trunk/servicemix-wsn2005/src/test/resources/org/servicemix/wsn/component/subscribe.xml
    incubator/servicemix/trunk/servicemix-wsn2005/src/test/resources/org/servicemix/wsn/subscribe-abs-itt.xml
    incubator/servicemix/trunk/servicemix-wsn2005/src/test/resources/org/servicemix/wsn/subscribe-empty-itt.xml
    incubator/servicemix/trunk/servicemix-wsn2005/src/test/resources/org/servicemix/wsn/subscribe-epr.xml
    incubator/servicemix/trunk/servicemix-wsn2005/src/test/resources/org/servicemix/wsn/subscribe-nil-itt.xml
    incubator/servicemix/trunk/servicemix-wsn2005/src/test/resources/org/servicemix/wsn/subscribe-no-itt.xml
    incubator/servicemix/trunk/servicemix-wsn2005/src/test/resources/org/servicemix/wsn/subscribe-no-topic.xml
    incubator/servicemix/trunk/servicemix-wsn2005/src/test/resources/org/servicemix/wsn/subscribe-pp.xml
    incubator/servicemix/trunk/servicemix-wsn2005/src/test/resources/org/servicemix/wsn/subscribe-raw.xml

Propchange: incubator/servicemix/trunk/servicemix-wsn2005/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Mon Dec 19 14:08:30 2005
@@ -0,0 +1,5 @@
+.classpath
+.project
+target
+activemq-data
+.settings

Added: incubator/servicemix/trunk/servicemix-wsn2005/maven.xml
URL: http://svn.apache.org/viewcvs/incubator/servicemix/trunk/servicemix-wsn2005/maven.xml?rev=357814&view=auto
==============================================================================
--- incubator/servicemix/trunk/servicemix-wsn2005/maven.xml (added)
+++ incubator/servicemix/trunk/servicemix-wsn2005/maven.xml Mon Dec 19 14:08:30 2005
@@ -0,0 +1,133 @@
+<project default="default" 
+        xmlns:j="jelly:core" 
+        xmlns:ant="jelly:ant" 
+        xmlns:maven="jelly:maven">
+
+	  <preGoal name="java:compile">
+	    <attainGoal name="jaxws:compile"/>
+	  </preGoal>
+
+	  <goal name="jaxws:compile" prereqs="setclasspath" description="generate JAX-WS POJOS from WSDL">
+
+	    <mkdir dir="${jaxws.compiled.java.dir}"/>
+	    <mkdir dir="${jaxws.compiled.classes.dir}"/>
+
+	    <wsimport
+	            fork="true"
+	            debug="${debug}"
+	            verbose="${verbose}"
+	            keep="${keep}"
+	            sourcedestdir="${jaxws.compiled.java.dir}"
+	            destdir="${jaxws.compiled.classes.dir}"
+	            wsdl="${wsdl.home}/wsn.wsdl">
+	    </wsimport>
+
+	  </goal>
+
+	  <goal name="setclasspath">
+	  
+	    <taskdef name="wsimport" classname="com.sun.tools.ws.ant.WsImport">
+	      <classpath refid="maven.dependency.classpath"/>
+	    </taskdef>
+
+	    <taskdef name="wsgen" classname="com.sun.tools.ws.ant.WsGen">
+	      <classpath refid="maven.dependency.classpath"/>
+	    </taskdef>
+
+	    <taskdef name="apt" classname="com.sun.tools.ws.ant.Apt">
+	      <classpath refid="maven.dependency.classpath"/>
+	    </taskdef>
+	  </goal>
+
+  <!--==================================================================-->
+  <!-- Initializations                                                  -->
+  <!--==================================================================-->
+  <goal name="jbi:su-init" 
+    description="Initialise filesystem and other resources for a jbi service unit">
+
+    <ant:available property="jbiSuResourcesPresent" type="dir"
+      file="${maven.jbi.su.src}"/>
+      
+  </goal>
+  
+  <goal name="jbi:su" prereqs="jbi:su-init,jar:jar" description="Build a jbi su file">
+    
+    <!-- Copy resources -->
+    <j:if test="${jbiSuResourcesPresent == 'true'}">
+      <ant:copy todir="${maven.jbi.su.build.dir}" preservelastmodified="true">
+        <ant:fileset dir="${maven.jbi.su.src}"
+          includes="${maven.jbi.su.src.includes}"
+          excludes="${maven.jbi.su.src.excludes},META-INF/jbi.xml,xbean.xml">
+        </ant:fileset>
+      </ant:copy>
+    </j:if>
+
+    <!-- Copy libs -->
+    <j:forEach var="lib" items="${pom.artifacts}">
+      <j:set var="dep" value="${lib.dependency}"/>     
+      <j:if test="${dep.getProperty('jbi.su.bundle')=='true'}">
+         <j:if test="${dep.type =='jar'}"> 
+           <ant:copy todir="${maven.jbi.su.build.lib}" file="${lib.path}"/>  
+         </j:if> 
+      </j:if>  
+    </j:forEach>  
+    <ant:copy todir="${maven.jbi.su.build.lib}" file="${maven.build.dir}/${maven.final.name}.jar"/>        
+
+    <j:file name="${maven.jbi.su.build.dir}/META-INF/jbi.xml"
+            outputMode="xml"
+            prettyPrint="true"
+            encoding="${maven.jbi.su.descriptor.encoding}">
+      <j:import file="${maven.jbi.su.descriptor}" inherit="true" />
+    </j:file>  
+
+    <j:file name="${maven.jbi.su.build.dir}/xbean.xml"
+            outputMode="xml"
+            prettyPrint="true"
+            encoding="${maven.jbi.su.xbean.encoding}">
+      <j:import file="${maven.jbi.su.xbean}" inherit="true" />
+    </j:file>  
+    
+    <ant:jar 
+         destfile="${maven.build.dir}/${maven.jbi.su.final.name}"
+         basedir="${maven.jbi.su.build.dir}">
+    </ant:jar>
+  </goal>
+
+  <!--==================================================================-->
+  <!-- Initializations                                                  -->
+  <!--==================================================================-->
+  <goal name="jbi:sa-init" 
+    description="Initialise filesystem and other resources for a jbi service assembly">
+
+    <ant:available property="jbiSaResourcesPresent" type="dir"
+      file="${maven.jbi.sa.src}"/>
+      
+  </goal>
+  
+  <goal name="jbi:sa" prereqs="jbi:sa-init,jbi:su" description="Build a jbi sa file">
+    
+    <!-- Copy resources -->
+    <j:if test="${jbiSaResourcesPresent == 'true'}">
+      <ant:copy todir="${maven.jbi.sa.build.dir}" preservelastmodified="true">
+        <ant:fileset dir="${maven.jbi.sa.src}"
+          includes="${maven.jbi.sa.src.includes}"
+          excludes="${maven.jbi.sa.src.excludes},META-INF/jbi.xml">
+        </ant:fileset>
+      </ant:copy>
+    </j:if>
+    <ant:mkdir dir="${maven.jbi.sa.build.dir}/META-INF" />
+    <j:file name="${maven.jbi.sa.build.dir}/META-INF/jbi.xml"
+            outputMode="xml"
+            prettyPrint="true"
+            encoding="${maven.jbi.sa.descriptor.encoding}">
+      <j:import file="${maven.jbi.sa.descriptor}" inherit="true" />
+    </j:file>  
+    <ant:copy todir="${maven.jbi.sa.build.dir}" file="${maven.build.dir}/${maven.jbi.su.final.name}" />
+    
+    <ant:jar 
+         destfile="${maven.build.dir}/${maven.jbi.sa.final.name}"
+         basedir="${maven.jbi.sa.build.dir}">
+    </ant:jar>
+  </goal>
+
+</project>

Added: incubator/servicemix/trunk/servicemix-wsn2005/project.properties
URL: http://svn.apache.org/viewcvs/incubator/servicemix/trunk/servicemix-wsn2005/project.properties?rev=357814&view=auto
==============================================================================
--- incubator/servicemix/trunk/servicemix-wsn2005/project.properties (added)
+++ incubator/servicemix/trunk/servicemix-wsn2005/project.properties Mon Dec 19 14:08:30 2005
@@ -0,0 +1,42 @@
+# -------------------------------------------------------------------
+# JAX-WS stuff
+# -------------------------------------------------------------------
+lib.home=lib
+etc.home=etc
+wsdl.home=${basedir}/src/main/wsdl
+
+debug=true
+verbose=false
+keep=true
+server.binding=
+
+jaxws.compiled.classes.dir=${basedir}/target/classes
+jaxws.compiled.java.dir=${basedir}/target/java
+
+maven.eclipse.classpath.include=${jaxws.compiled.java.dir}
+
+# -------------------------------------------------------------------
+# Build Properties
+# -------------------------------------------------------------------
+maven.multiproject.type=jar
+
+maven.compile.source=1.5
+maven.compile.target=1.5
+maven.test.source=1.5
+maven.compile.deprecation=true
+maven.compile.debug=true
+maven.compile.optimize=true
+
+maven.javadoc.source=1.5
+maven.javadoc.additionalparam = -linksource
+
+maven.javadoc.links=\
+http://download.java.net/jdk6/docs/api/,\
+http://java.sun.com/j2ee/1.5/docs/api/,\
+http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent,\
+http://jakarta.apache.org/commons/logging/apidocs
+
+jbi.component.class.name = org.servicemix.wsn.component.WSNComponent
+jbi.bootstrap.class.name = org.servicemix.wsn.component.WSNBootstrap
+jbi.component.type=service-engine
+

Added: incubator/servicemix/trunk/servicemix-wsn2005/project.xml
URL: http://svn.apache.org/viewcvs/incubator/servicemix/trunk/servicemix-wsn2005/project.xml?rev=357814&view=auto
==============================================================================
--- incubator/servicemix/trunk/servicemix-wsn2005/project.xml (added)
+++ incubator/servicemix/trunk/servicemix-wsn2005/project.xml Mon Dec 19 14:08:30 2005
@@ -0,0 +1,220 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<project>
+  <pomVersion>3</pomVersion>
+  <extend>${basedir}/../etc/project.xml</extend>
+
+  <name>ServiceMix :: WS-Notification 2005</name>
+  <id>servicemix-wsn2005</id>
+  <description>
+        ServiceMix implementation of WS Notification 2005
+  </description>
+
+  <package>*</package>
+
+ <packageGroups>
+    <packageGroup>
+      <title>WS-Notification Implementation</title>
+      <packages>org.servicemix.ws.notification</packages>
+    </packageGroup>
+  </packageGroups>
+
+  <siteDirectory>/home/projects/servicemix/public_html/maven/ws/jaxws/wsn</siteDirectory>
+
+  <dependencies>
+
+    <!-- For JAX-WS: only required for Java 5, will be part of Java 6 -->
+    <dependency>
+      <groupId>servicemix</groupId>
+      <artifactId>jsr181-api</artifactId>
+      <version>${jaxws_rt_version}</version>
+    </dependency>
+    <dependency>
+      <groupId>servicemix</groupId>
+      <artifactId>jaxws-api</artifactId>
+      <version>${jaxws_rt_version}</version>
+    </dependency>
+    <dependency>
+      <groupId>servicemix</groupId>
+      <artifactId>jaxws-rt</artifactId>
+      <version>${jaxws_rt_version}</version>
+    </dependency>
+    <dependency>
+      <groupId>servicemix</groupId>
+      <artifactId>jaxb-api</artifactId>
+      <version>${jaxws_rt_version}</version>
+    </dependency>
+    <dependency>
+      <groupId>servicemix</groupId>
+      <artifactId>jaxb-impl</artifactId>
+      <version>${jaxws_rt_version}</version>
+    </dependency>
+    <dependency>
+      <groupId>servicemix</groupId>
+      <artifactId>jaxb-xjc</artifactId>
+      <version>${jaxws_rt_version}</version>
+    </dependency>
+    <dependency>
+      <groupId>servicemix</groupId>
+      <artifactId>saaj-api</artifactId>
+      <version>${jaxws_rt_version}</version>
+    </dependency>
+    <dependency>
+      <groupId>servicemix</groupId>
+      <artifactId>saaj-impl</artifactId>
+      <version>${jaxws_rt_version}</version>
+    </dependency>
+    <dependency>
+      <groupId>servicemix</groupId>
+      <artifactId>jsr181-api</artifactId>
+      <version>${jaxws_rt_version}</version>
+    </dependency>
+    <dependency>
+      <groupId>servicemix</groupId>
+      <artifactId>jsr250-api</artifactId>
+      <version>${jaxws_rt_version}</version>
+    </dependency>
+    <dependency>
+      <groupId>servicemix</groupId>
+      <artifactId>sjsxp</artifactId>
+      <version>${jaxws_rt_version}</version>
+    </dependency>
+    <dependency>
+      <groupId>servicemix</groupId>
+      <artifactId>jaxws-tools</artifactId>
+      <version>${jaxws_rt_version}</version>
+    </dependency>
+    
+    <dependency>
+      <id>stax+api</id>
+      <version>${stax_api_version}</version>
+    </dependency>
+
+    <dependency>
+      <groupId>servicemix</groupId>
+      <artifactId>servicemix-jbi</artifactId>
+      <version>${pom.currentVersion}</version>
+      <properties>
+        <_eclipse.dependency>true</_eclipse.dependency>
+      </properties>
+    </dependency>
+    <dependency>
+      <groupId>servicemix</groupId>
+      <artifactId>servicemix-core</artifactId>
+      <version>${pom.currentVersion}</version>
+      <properties>
+        <_eclipse.dependency>true</_eclipse.dependency>
+      </properties>
+    </dependency>
+    <dependency>
+      <groupId>servicemix</groupId>
+      <artifactId>servicemix-common</artifactId>
+      <version>${pom.currentVersion}</version>
+      <properties>
+        <eclipse.dependency>true</eclipse.dependency>
+      </properties>
+    </dependency>
+    <dependency>
+      <groupId>servicemix</groupId>
+      <artifactId>servicemix-components</artifactId>
+      <version>${pom.currentVersion}</version>
+      <properties>
+        <_eclipse.dependency>true</_eclipse.dependency>
+      </properties>
+    </dependency>
+    <dependency>
+      <groupId>org.xbean</groupId>
+      <artifactId>xbean-spring</artifactId>
+      <version>${xbean_version}</version>
+    </dependency>
+
+    <dependency>
+      <groupId>commons-logging</groupId>
+      <artifactId>commons-logging</artifactId>
+      <version>${commons_logging_version}</version>
+    </dependency>
+    <dependency>
+      <groupId>backport-util-concurrent</groupId>
+      <artifactId>backport-util-concurrent</artifactId>
+      <version>${backport_util_concurrent_version}</version>
+    </dependency>
+    <dependency>
+      <groupId>concurrent</groupId>
+      <artifactId>concurrent</artifactId>
+      <version>${concurrent_version}</version>
+    </dependency>
+    <dependency>
+      <groupId>mx4j</groupId>
+      <artifactId>mx4j-jmx</artifactId>
+      <version>${mx4j_version}</version>
+    </dependency>
+
+    <dependency>
+      <groupId>activemq</groupId>
+      <artifactId>activemq</artifactId>
+      <version>${activemq_version}</version>
+    </dependency>
+    <dependency>
+      <groupId>geronimo-spec</groupId>
+      <artifactId>geronimo-spec-servlet</artifactId>
+      <version>${geronimo_spec_servlet_version}</version>
+    </dependency>
+    <dependency>
+      <groupId>geronimo-spec</groupId>
+      <artifactId>geronimo-spec-activation</artifactId>
+      <version>${geronimo_spec_activation_version}</version>
+    </dependency>
+
+    <dependency>
+      <groupId>springframework</groupId>
+      <artifactId>spring</artifactId>
+      <version>${spring_version}</version>
+    </dependency>
+
+    <!-- for testing -->
+    <dependency>
+      <id>jencks+all</id>
+      <version>${jencks_version}</version>
+    </dependency>
+      <dependency>
+        <groupId>wsdl4j</groupId>
+        <artifactId>wsdl4j</artifactId>
+        <version>${wsdl4j_version}</version>
+      </dependency>
+    <dependency>
+      <groupId>jetty</groupId>
+      <artifactId>org.mortbay.jetty</artifactId>
+      <version>${org.mortbay.jetty_version}</version>
+    </dependency>
+    <dependency>
+      <id>commons-httpclient</id>
+      <version>${commons_httpclient_version}</version>
+    </dependency>
+    <dependency>
+      <id>commons-codec</id>
+      <version>${commons_codec_version}</version>
+    </dependency>
+    <dependency>
+      <id>xalan</id>
+      <version>${xalan_version}</version>
+    </dependency>
+ 
+     <dependency>
+      <id>log4j</id>
+      <version>${log4j_version}</version>
+    </dependency>
+  </dependencies>
+
+
+  <build>
+    <resources>
+      <resource>
+          <directory>src/main/resources</directory>
+        <includes>
+          <include>**/*.xml</include>
+          <include>**/*.properties</include>
+        </includes>
+      </resource>
+    </resources>
+  </build>
+
+</project>

Added: incubator/servicemix/trunk/servicemix-wsn2005/src/main/java/org/servicemix/wsn/AbstractEndpoint.java
URL: http://svn.apache.org/viewcvs/incubator/servicemix/trunk/servicemix-wsn2005/src/main/java/org/servicemix/wsn/AbstractEndpoint.java?rev=357814&view=auto
==============================================================================
--- incubator/servicemix/trunk/servicemix-wsn2005/src/main/java/org/servicemix/wsn/AbstractEndpoint.java (added)
+++ incubator/servicemix/trunk/servicemix-wsn2005/src/main/java/org/servicemix/wsn/AbstractEndpoint.java Mon Dec 19 14:08:30 2005
@@ -0,0 +1,45 @@
+package org.servicemix.wsn;
+
+public abstract class AbstractEndpoint {
+
+	protected String name;
+	protected String address;
+	protected EndpointManager manager;
+	protected Object endpoint;
+	
+	public AbstractEndpoint(String name) {
+		setName(name);
+	}
+	
+	public String getName() {
+		return name;
+	}
+
+	public void setName(String name) {
+		this.name = name;
+		this.address = createAddress();
+	}
+
+	public String getAddress() {
+		return address;
+	}
+	
+	public void register() throws EndpointRegistrationException {
+		endpoint = manager.register(getAddress(), this);
+	}
+	
+	public void unregister() throws EndpointRegistrationException {
+		manager.unregister(endpoint);
+	}
+
+	public EndpointManager getManager() {
+		return manager;
+	}
+
+	public void setManager(EndpointManager manager) {
+		this.manager = manager;
+	}
+	
+	protected abstract String createAddress();
+
+}

Added: incubator/servicemix/trunk/servicemix-wsn2005/src/main/java/org/servicemix/wsn/AbstractNotificationBroker.java
URL: http://svn.apache.org/viewcvs/incubator/servicemix/trunk/servicemix-wsn2005/src/main/java/org/servicemix/wsn/AbstractNotificationBroker.java?rev=357814&view=auto
==============================================================================
--- incubator/servicemix/trunk/servicemix-wsn2005/src/main/java/org/servicemix/wsn/AbstractNotificationBroker.java (added)
+++ incubator/servicemix/trunk/servicemix-wsn2005/src/main/java/org/servicemix/wsn/AbstractNotificationBroker.java Mon Dec 19 14:08:30 2005
@@ -0,0 +1,297 @@
+package org.servicemix.wsn;
+
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+import javax.jws.Oneway;
+import javax.jws.WebMethod;
+import javax.jws.WebParam;
+import javax.jws.WebResult;
+import javax.jws.WebService;
+
+import org.activemq.util.IdGenerator;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.oasis_open.docs.wsn.b_1.CreatePullPoint;
+import org.oasis_open.docs.wsn.b_1.CreatePullPointResponse;
+import org.oasis_open.docs.wsn.b_1.GetCurrentMessage;
+import org.oasis_open.docs.wsn.b_1.GetCurrentMessageResponse;
+import org.oasis_open.docs.wsn.b_1.NoCurrentMessageOnTopicFaultType;
+import org.oasis_open.docs.wsn.b_1.NotificationMessageHolderType;
+import org.oasis_open.docs.wsn.b_1.Notify;
+import org.oasis_open.docs.wsn.b_1.Subscribe;
+import org.oasis_open.docs.wsn.b_1.SubscribeCreationFailedFaultType;
+import org.oasis_open.docs.wsn.b_1.SubscribeResponse;
+import org.oasis_open.docs.wsn.b_1.UnableToCreatePullPointType;
+import org.oasis_open.docs.wsn.br_1.PublisherRegistrationFailedFaultType;
+import org.oasis_open.docs.wsn.br_1.RegisterPublisher;
+import org.oasis_open.docs.wsn.br_1.RegisterPublisherResponse;
+import org.servicemix.wsn.jaxws.InvalidFilterFault;
+import org.servicemix.wsn.jaxws.InvalidMessageContentExpressionFault;
+import org.servicemix.wsn.jaxws.InvalidProducerPropertiesExpressionFault;
+import org.servicemix.wsn.jaxws.InvalidTopicExpressionFault;
+import org.servicemix.wsn.jaxws.InvalidUseRawValueFault;
+import org.servicemix.wsn.jaxws.MultipleTopicsSpecifiedFault;
+import org.servicemix.wsn.jaxws.NoCurrentMessageOnTopicFault;
+import org.servicemix.wsn.jaxws.NotificationBroker;
+import org.servicemix.wsn.jaxws.NotificationConsumer;
+import org.servicemix.wsn.jaxws.PublisherRegistrationFailedFault;
+import org.servicemix.wsn.jaxws.PublisherRegistrationRejectedFault;
+import org.servicemix.wsn.jaxws.PullNotificationNotSupportedFault;
+import org.servicemix.wsn.jaxws.ResourceNotDestroyedFault;
+import org.servicemix.wsn.jaxws.ResourceUnknownFault;
+import org.servicemix.wsn.jaxws.SubscribeCreationFailedFault;
+import org.servicemix.wsn.jaxws.TopicExpressionDialectUnknownFault;
+import org.servicemix.wsn.jaxws.TopicNotSupportedFault;
+import org.servicemix.wsn.jaxws.UnableToCreatePullPoint;
+import org.servicemix.wsn.jaxws.UnableToDestroyPullPoint;
+import org.servicemix.wsn.jaxws.UnableToDestroySubscriptionFault;
+import org.servicemix.wsn.jaxws.UnacceptableInitialTerminationTimeFault;
+import org.w3._2005._03.addressing.AttributedURIType;
+import org.w3._2005._03.addressing.EndpointReferenceType;
+
+@WebService(endpointInterface = "org.servicemix.wsn.jaxws.NotificationBroker")
+public abstract class AbstractNotificationBroker extends AbstractEndpoint implements NotificationBroker, NotificationConsumer {
+
+	private static Log log = LogFactory.getLog(AbstractPullPoint.class);
+	
+    private IdGenerator idGenerator;
+    private AbstractPublisher anonymousPublisher;
+    private Map<String,AbstractPublisher> publishers;
+    private Map<String,AbstractPullPoint> pullPoints;
+    private Map<String,AbstractSubscription> subscriptions;
+
+	public AbstractNotificationBroker(String name) {
+		super(name);
+        idGenerator = new IdGenerator();
+        subscriptions = new ConcurrentHashMap<String,AbstractSubscription>();
+        publishers = new ConcurrentHashMap<String, AbstractPublisher>();
+        pullPoints = new ConcurrentHashMap<String, AbstractPullPoint>();
+	}
+
+    public void init() throws Exception {
+        anonymousPublisher = createPublisher("Anonymous", null);
+        register();
+        anonymousPublisher.register();
+    }
+    
+	protected String createAddress() {
+		return "http://servicemix.org/wsnotification/NotificationBroker/" + getName();
+	}
+	
+    /**
+     * 
+     * @param notify
+     */
+    @WebMethod(operationName = "Notify")
+    @Oneway
+    public void notify(
+        @WebParam(name = "Notify", targetNamespace = "http://docs.oasis-open.org/wsn/b-1", partName = "Notify")
+        Notify notify) {
+    	
+    	log.debug("Notify");
+    	handleNotify(notify);
+    }
+    
+	protected void handleNotify(Notify notify) {
+		for (NotificationMessageHolderType messageHolder : notify.getNotificationMessage()) {
+            EndpointReferenceType producerReference = messageHolder.getProducerReference();
+            AbstractPublisher publisher = getPublisher(producerReference);
+            if (publisher != null) {
+            	publisher.notify(messageHolder);
+            }
+		}
+	}
+
+	protected AbstractPublisher getPublisher(EndpointReferenceType producerReference) {
+		AbstractPublisher publisher = null;
+		if (producerReference != null && 
+			producerReference.getAddress() != null &&
+			producerReference.getAddress().getValue() != null) {
+			String address = producerReference.getAddress().getValue();
+			publishers.get(address);
+		}
+		if (publisher == null) {
+			publisher = anonymousPublisher;
+		}
+		return publisher;
+	}
+	
+    /**
+     * 
+     * @param subscribeRequest
+     * @return
+     *     returns org.oasis_open.docs.wsn.b_1.SubscribeResponse
+     * @throws SubscribeCreationFailedFault
+     * @throws InvalidTopicExpressionFault
+     * @throws TopicNotSupportedFault
+     * @throws InvalidFilterFault
+     * @throws InvalidProducerPropertiesExpressionFault
+     * @throws ResourceUnknownFault
+     * @throws InvalidUseRawValueFault
+     * @throws InvalidMessageContentExpressionFault
+     * @throws TopicExpressionDialectUnknownFault
+     * @throws UnacceptableInitialTerminationTimeFault
+     */
+    @WebMethod(operationName = "Subscribe")
+    @WebResult(name = "SubscribeResponse", targetNamespace = "http://docs.oasis-open.org/wsn/b-1", partName = "SubscribeResponse")
+    public SubscribeResponse subscribe(
+        @WebParam(name = "Subscribe", targetNamespace = "http://docs.oasis-open.org/wsn/b-1", partName = "SubscribeRequest")
+        Subscribe subscribeRequest)
+        throws InvalidFilterFault, InvalidMessageContentExpressionFault, InvalidProducerPropertiesExpressionFault, InvalidTopicExpressionFault, InvalidUseRawValueFault, ResourceUnknownFault, SubscribeCreationFailedFault, TopicExpressionDialectUnknownFault, TopicNotSupportedFault, UnacceptableInitialTerminationTimeFault {
+    	
+    	log.debug("Subscribe");
+    	return handleSubscribe(subscribeRequest);
+    }
+
+	protected SubscribeResponse handleSubscribe(Subscribe subscribeRequest) throws InvalidFilterFault, InvalidMessageContentExpressionFault, InvalidProducerPropertiesExpressionFault, InvalidTopicExpressionFault, InvalidUseRawValueFault, SubscribeCreationFailedFault, TopicExpressionDialectUnknownFault, TopicNotSupportedFault, UnacceptableInitialTerminationTimeFault {
+		AbstractSubscription subscription = null;
+		boolean success = false;
+		try {
+			subscription = createSubcription(idGenerator.generateSanitizedId(), subscribeRequest);
+			subscriptions.put(subscription.getAddress(), subscription);
+			subscription.subscribe(subscribeRequest);
+			subscription.register();
+			SubscribeResponse response = new SubscribeResponse();
+			response.setSubscriptionReference(createEndpointReference(subscription.getAddress()));
+			success = true;
+			return response;
+		} catch (EndpointRegistrationException e) {
+			SubscribeCreationFailedFaultType fault = new SubscribeCreationFailedFaultType();
+			throw new SubscribeCreationFailedFault("Unable to register endpoint", fault, e);
+		} finally {
+			if (!success && subscription != null) {
+				subscriptions.remove(subscription);
+				try {
+					subscription.unsubscribe();
+				} catch (UnableToDestroySubscriptionFault e) {
+					log.info("Error destroying subscription", e);
+				}
+			}
+		}
+	}
+	
+	/**
+     * 
+     * @param getCurrentMessageRequest
+     * @return
+     *     returns org.oasis_open.docs.wsn.b_1.GetCurrentMessageResponse
+     * @throws MultipleTopicsSpecifiedFault
+     * @throws TopicNotSupportedFault
+     * @throws InvalidTopicExpressionFault
+     * @throws ResourceUnknownFault
+     * @throws TopicExpressionDialectUnknownFault
+     * @throws NoCurrentMessageOnTopicFault
+     */
+    @WebMethod(operationName = "GetCurrentMessage")
+    @WebResult(name = "GetCurrentMessageResponse", targetNamespace = "http://docs.oasis-open.org/wsn/b-1", partName = "GetCurrentMessageResponse")
+    public GetCurrentMessageResponse getCurrentMessage(
+        @WebParam(name = "GetCurrentMessage", targetNamespace = "http://docs.oasis-open.org/wsn/b-1", partName = "GetCurrentMessageRequest")
+        GetCurrentMessage getCurrentMessageRequest)
+        throws InvalidTopicExpressionFault, MultipleTopicsSpecifiedFault, NoCurrentMessageOnTopicFault, ResourceUnknownFault, TopicExpressionDialectUnknownFault, TopicNotSupportedFault {
+    	
+    	log.debug("GetCurrentMessage");
+    	NoCurrentMessageOnTopicFaultType fault = new NoCurrentMessageOnTopicFaultType();
+    	throw new NoCurrentMessageOnTopicFault("There is no current message on this topic.", fault);
+    }
+
+    /**
+     * 
+     * @param registerPublisherRequest
+     * @return
+     *     returns org.oasis_open.docs.wsn.br_1.RegisterPublisherResponse
+     * @throws PublisherRegistrationRejectedFault
+     * @throws InvalidTopicExpressionFault
+     * @throws TopicNotSupportedFault
+     * @throws ResourceUnknownFault
+     * @throws PublisherRegistrationFailedFault
+     */
+    @WebMethod(operationName = "RegisterPublisher")
+    @WebResult(name = "RegisterPublisherResponse", targetNamespace = "http://docs.oasis-open.org/wsn/br-1", partName = "RegisterPublisherResponse")
+    public RegisterPublisherResponse registerPublisher(
+        @WebParam(name = "RegisterPublisher", targetNamespace = "http://docs.oasis-open.org/wsn/br-1", partName = "RegisterPublisherRequest")
+        RegisterPublisher registerPublisherRequest)
+        throws InvalidTopicExpressionFault, PublisherRegistrationFailedFault, PublisherRegistrationRejectedFault, ResourceUnknownFault, TopicNotSupportedFault {
+    	
+    	log.debug("RegisterPublisher");
+    	AbstractPublisher publisher = null;
+    	boolean success = false;
+    	try {
+    		publisher = createPublisher(idGenerator.generateSanitizedId(), registerPublisherRequest);
+    		publishers.put(publisher.getAddress(), publisher);
+    		publisher.register();
+    		RegisterPublisherResponse response = new RegisterPublisherResponse(); 
+    		response.setPublisherRegistrationReference(createEndpointReference(publisher.getAddress()));
+    		success = true;
+    		return response;
+    	} catch (EndpointRegistrationException e) {
+    		PublisherRegistrationFailedFaultType fault = new PublisherRegistrationFailedFaultType();
+    		throw new PublisherRegistrationFailedFault("Unable to register new endpoint", fault, e);
+    	} finally {
+			if (!success && publisher != null) {
+				publishers.remove(publisher.getAddress());
+				try {
+					publisher.destroy();
+				} catch (ResourceNotDestroyedFault e) {
+					log.info("Error destroying publisher", e);
+				}
+			}
+    	}
+    }
+
+    /**
+     * 
+     * @param createPullPointRequest
+     * @return
+     *     returns org.oasis_open.docs.wsn.b_1.CreatePullPointResponse
+     * @throws UnableToCreatePullPoint
+     * @throws PullNotificationNotSupportedFault
+     */
+    @WebMethod(operationName = "CreatePullPoint")
+    @WebResult(name = "CreatePullPointResponse", targetNamespace = "http://docs.oasis-open.org/wsn/b-1", partName = "CreatePullPointResponse")
+    public CreatePullPointResponse createPullPoint(
+        @WebParam(name = "CreatePullPoint", targetNamespace = "http://docs.oasis-open.org/wsn/b-1", partName = "CreatePullPointRequest")
+        CreatePullPoint createPullPointRequest)
+        throws PullNotificationNotSupportedFault, UnableToCreatePullPoint {
+    	
+    	log.debug("CreatePullEndpoint");
+    	AbstractPullPoint pullPoint = null;
+    	boolean success = false;
+    	try {
+    		pullPoint = createPullPoint(idGenerator.generateSanitizedId(), createPullPointRequest);
+    		pullPoints.put(pullPoint.getAddress(), pullPoint);
+    		pullPoint.register();
+    		CreatePullPointResponse response = new CreatePullPointResponse(); 
+    		response.setPullPoint(createEndpointReference(pullPoint.getAddress()));
+    		success = true;
+    		return response;
+    	} catch (EndpointRegistrationException e) {
+    		UnableToCreatePullPointType fault = new UnableToCreatePullPointType();
+    		throw new UnableToCreatePullPoint("Unable to register new endpoint", fault, e);
+    	} finally {
+			if (!success && pullPoint != null) {
+				pullPoints.remove(pullPoint.getAddress());
+				try {
+					pullPoint.destroy();
+				} catch (UnableToDestroyPullPoint e) {
+					log.info("Error destroying pullPoint", e);
+				}
+			}
+    	}
+    }
+
+	protected EndpointReferenceType createEndpointReference(String address) {
+		EndpointReferenceType epr = new EndpointReferenceType();
+		AttributedURIType addressUri = new AttributedURIType();
+		addressUri.setValue(address);
+		epr.setAddress(addressUri);
+		return epr;
+	}
+
+	protected abstract AbstractPublisher createPublisher(String name, RegisterPublisher registerPublisherRequest);
+	
+	protected abstract AbstractPullPoint createPullPoint(String name, CreatePullPoint createPullPointRequest);
+	
+	protected abstract AbstractSubscription createSubcription(String name, Subscribe subscribeRequest);
+
+}

Added: incubator/servicemix/trunk/servicemix-wsn2005/src/main/java/org/servicemix/wsn/AbstractPublisher.java
URL: http://svn.apache.org/viewcvs/incubator/servicemix/trunk/servicemix-wsn2005/src/main/java/org/servicemix/wsn/AbstractPublisher.java?rev=357814&view=auto
==============================================================================
--- incubator/servicemix/trunk/servicemix-wsn2005/src/main/java/org/servicemix/wsn/AbstractPublisher.java (added)
+++ incubator/servicemix/trunk/servicemix-wsn2005/src/main/java/org/servicemix/wsn/AbstractPublisher.java Mon Dec 19 14:08:30 2005
@@ -0,0 +1,57 @@
+package org.servicemix.wsn;
+
+import javax.jws.WebMethod;
+import javax.jws.WebParam;
+import javax.jws.WebResult;
+import javax.jws.WebService;
+
+import org.oasis_open.docs.wsn.b_1.NotificationMessageHolderType;
+import org.oasis_open.docs.wsn.br_1.Destroy;
+import org.oasis_open.docs.wsn.br_1.DestroyResponse;
+import org.oasis_open.docs.wsn.br_1.ResourceNotDestroyedFaultType;
+import org.servicemix.wsn.jaxws.PublisherRegistrationManager;
+import org.servicemix.wsn.jaxws.ResourceNotDestroyedFault;
+import org.servicemix.wsn.jaxws.ResourceUnknownFault;
+
+@WebService(endpointInterface = "org.servicemix.wsn.jaxws.PublisherRegistrationManager")
+public abstract class AbstractPublisher extends AbstractEndpoint 
+									    implements PublisherRegistrationManager {
+
+	public AbstractPublisher(String name) {
+		super(name);
+	}
+	
+    /**
+     * 
+     * @param destroyRequest
+     * @return
+     *     returns org.oasis_open.docs.wsn.br_1.DestroyResponse
+     * @throws ResourceNotDestroyedFault
+     * @throws ResourceUnknownFault
+     */
+    @WebMethod(operationName = "Destroy")
+    @WebResult(name = "DestroyResponse", targetNamespace = "http://docs.oasis-open.org/wsn/br-1", partName = "DestroyResponse")
+    public DestroyResponse destroy(
+        @WebParam(name = "Destroy", targetNamespace = "http://docs.oasis-open.org/wsn/br-1", partName = "DestroyRequest")
+        Destroy destroyRequest)
+        throws ResourceNotDestroyedFault, ResourceUnknownFault {
+    	
+    	destroy();
+    	return new DestroyResponse();
+    }
+    
+    public abstract void notify(NotificationMessageHolderType messageHolder);
+
+    protected void destroy() throws ResourceNotDestroyedFault {
+    	try {
+    		unregister();
+    	} catch (EndpointRegistrationException e) {
+    		ResourceNotDestroyedFaultType fault = new ResourceNotDestroyedFaultType();
+    		throw new ResourceNotDestroyedFault("Error unregistering endpoint", fault, e);
+    	}
+    }
+
+	protected String createAddress() {
+		return "http://servicemix.org/wsnotification/Publisher/" + getName();
+	}
+}

Added: incubator/servicemix/trunk/servicemix-wsn2005/src/main/java/org/servicemix/wsn/AbstractPullPoint.java
URL: http://svn.apache.org/viewcvs/incubator/servicemix/trunk/servicemix-wsn2005/src/main/java/org/servicemix/wsn/AbstractPullPoint.java?rev=357814&view=auto
==============================================================================
--- incubator/servicemix/trunk/servicemix-wsn2005/src/main/java/org/servicemix/wsn/AbstractPullPoint.java (added)
+++ incubator/servicemix/trunk/servicemix-wsn2005/src/main/java/org/servicemix/wsn/AbstractPullPoint.java Mon Dec 19 14:08:30 2005
@@ -0,0 +1,109 @@
+package org.servicemix.wsn;
+
+import java.math.BigInteger;
+import java.util.List;
+
+import javax.jws.Oneway;
+import javax.jws.WebMethod;
+import javax.jws.WebParam;
+import javax.jws.WebResult;
+import javax.jws.WebService;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.oasis_open.docs.wsn.b_1.Destroy;
+import org.oasis_open.docs.wsn.b_1.DestroyResponse;
+import org.oasis_open.docs.wsn.b_1.GetMessages;
+import org.oasis_open.docs.wsn.b_1.GetMessagesResponse;
+import org.oasis_open.docs.wsn.b_1.NotificationMessageHolderType;
+import org.oasis_open.docs.wsn.b_1.Notify;
+import org.oasis_open.docs.wsn.b_1.UnableToDestroyPullPointType;
+import org.servicemix.wsn.jaxws.NotificationConsumer;
+import org.servicemix.wsn.jaxws.PullPoint;
+import org.servicemix.wsn.jaxws.ResourceUnknownFault;
+import org.servicemix.wsn.jaxws.UnableToDestroyPullPoint;
+
+@WebService(endpointInterface = "org.servicemix.wsn.PullPointConsumer")
+public abstract class AbstractPullPoint extends AbstractEndpoint 
+										implements PullPoint, NotificationConsumer {
+
+	private static Log log = LogFactory.getLog(AbstractPullPoint.class);
+	
+	public AbstractPullPoint(String name) {
+		super(name);
+	}
+	
+    /**
+     * 
+     * @param notify
+     */
+    @WebMethod(operationName = "Notify")
+    @Oneway
+    public void notify(
+        @WebParam(name = "Notify", targetNamespace = "http://docs.oasis-open.org/wsn/b-1", partName = "Notify")
+        Notify notify) {
+    
+    	log.debug("Notify");
+    	for (NotificationMessageHolderType messageHolder : notify.getNotificationMessage()) {
+    		store(messageHolder);
+    	}
+    }
+    
+    /**
+     * 
+     * @param getMessagesRequest
+     * @return
+     *     returns org.oasis_open.docs.wsn.b_1.GetMessagesResponse
+     * @throws ResourceUnknownFault
+     */
+    @WebMethod(operationName = "GetMessages")
+    @WebResult(name = "GetMessagesResponse", targetNamespace = "http://docs.oasis-open.org/wsn/b-1", partName = "GetMessagesResponse")
+    public GetMessagesResponse getMessages(
+        @WebParam(name = "GetMessages", targetNamespace = "http://docs.oasis-open.org/wsn/b-1", partName = "GetMessagesRequest")
+        GetMessages getMessagesRequest)
+        throws ResourceUnknownFault {
+    	
+    	log.debug("GetMessages");
+    	BigInteger max = getMessagesRequest.getMaximumNumber();
+    	List<NotificationMessageHolderType> messages = getMessages(max != null ? max.intValue() : 0);
+    	GetMessagesResponse response = new GetMessagesResponse();
+    	response.getNotificationMessage().addAll(messages);
+    	return response;
+    }
+    
+    /**
+     * 
+     * @param destroyRequest
+     * @return
+     *     returns org.oasis_open.docs.wsn.b_1.DestroyResponse
+     * @throws UnableToDestroyPullPoint
+     */
+    @WebMethod(operationName = "Destroy")
+    @WebResult(name = "DestroyResponse", targetNamespace = "http://docs.oasis-open.org/wsn/b-1", partName = "DestroyResponse")
+    public DestroyResponse destroy(
+        @WebParam(name = "Destroy", targetNamespace = "http://docs.oasis-open.org/wsn/b-1", partName = "DestroyRequest")
+        Destroy destroyRequest)
+        throws UnableToDestroyPullPoint {
+    	
+    	log.debug("Destroy");
+    	destroy();
+    	return new DestroyResponse();
+    }
+    
+	protected abstract void store(NotificationMessageHolderType messageHolder);
+
+    protected abstract List<NotificationMessageHolderType> getMessages(int max) throws ResourceUnknownFault;
+
+    protected void destroy() throws UnableToDestroyPullPoint {
+    	try {
+    		unregister();
+    	} catch (EndpointRegistrationException e) {
+    		UnableToDestroyPullPointType fault = new UnableToDestroyPullPointType();
+    		throw new UnableToDestroyPullPoint("Error unregistering endpoint", fault, e);
+    	}
+    }
+
+	protected String createAddress() {
+		return "http://servicemix.org/wsnotification/PullPoint/" + getName();
+	}
+}

Added: incubator/servicemix/trunk/servicemix-wsn2005/src/main/java/org/servicemix/wsn/AbstractSubscription.java
URL: http://svn.apache.org/viewcvs/incubator/servicemix/trunk/servicemix-wsn2005/src/main/java/org/servicemix/wsn/AbstractSubscription.java?rev=357814&view=auto
==============================================================================
--- incubator/servicemix/trunk/servicemix-wsn2005/src/main/java/org/servicemix/wsn/AbstractSubscription.java (added)
+++ incubator/servicemix/trunk/servicemix-wsn2005/src/main/java/org/servicemix/wsn/AbstractSubscription.java Mon Dec 19 14:08:30 2005
@@ -0,0 +1,349 @@
+package org.servicemix.wsn;
+
+import java.util.GregorianCalendar;
+
+import javax.jws.WebMethod;
+import javax.jws.WebParam;
+import javax.jws.WebResult;
+import javax.jws.WebService;
+import javax.xml.bind.JAXBElement;
+import javax.xml.datatype.DatatypeConfigurationException;
+import javax.xml.datatype.DatatypeConstants;
+import javax.xml.datatype.DatatypeFactory;
+import javax.xml.datatype.Duration;
+import javax.xml.datatype.XMLGregorianCalendar;
+import javax.xml.namespace.QName;
+
+import org.oasis_open.docs.wsn.b_1.InvalidFilterFaultType;
+import org.oasis_open.docs.wsn.b_1.InvalidMessageContentExpressionFaultType;
+import org.oasis_open.docs.wsn.b_1.InvalidProducerPropertiesExpressionFaultType;
+import org.oasis_open.docs.wsn.b_1.InvalidTopicExpressionFaultType;
+import org.oasis_open.docs.wsn.b_1.InvalidUseRawValueFaultType;
+import org.oasis_open.docs.wsn.b_1.PauseSubscription;
+import org.oasis_open.docs.wsn.b_1.PauseSubscriptionResponse;
+import org.oasis_open.docs.wsn.b_1.QueryExpressionType;
+import org.oasis_open.docs.wsn.b_1.Renew;
+import org.oasis_open.docs.wsn.b_1.RenewResponse;
+import org.oasis_open.docs.wsn.b_1.ResumeSubscription;
+import org.oasis_open.docs.wsn.b_1.ResumeSubscriptionResponse;
+import org.oasis_open.docs.wsn.b_1.Subscribe;
+import org.oasis_open.docs.wsn.b_1.SubscribeCreationFailedFaultType;
+import org.oasis_open.docs.wsn.b_1.TopicExpressionType;
+import org.oasis_open.docs.wsn.b_1.UnableToDestroySubscriptionFaultType;
+import org.oasis_open.docs.wsn.b_1.UnacceptableInitialTerminationTimeFaultType;
+import org.oasis_open.docs.wsn.b_1.UnacceptableTerminationTimeFaultType;
+import org.oasis_open.docs.wsn.b_1.Unsubscribe;
+import org.oasis_open.docs.wsn.b_1.UnsubscribeResponse;
+import org.oasis_open.docs.wsn.b_1.UseRaw;
+import org.servicemix.wsn.jaxws.InvalidFilterFault;
+import org.servicemix.wsn.jaxws.InvalidMessageContentExpressionFault;
+import org.servicemix.wsn.jaxws.InvalidProducerPropertiesExpressionFault;
+import org.servicemix.wsn.jaxws.InvalidTopicExpressionFault;
+import org.servicemix.wsn.jaxws.InvalidUseRawValueFault;
+import org.servicemix.wsn.jaxws.PausableSubscriptionManager;
+import org.servicemix.wsn.jaxws.PauseFailedFault;
+import org.servicemix.wsn.jaxws.ResourceUnknownFault;
+import org.servicemix.wsn.jaxws.ResumeFailedFault;
+import org.servicemix.wsn.jaxws.SubscribeCreationFailedFault;
+import org.servicemix.wsn.jaxws.TopicExpressionDialectUnknownFault;
+import org.servicemix.wsn.jaxws.TopicNotSupportedFault;
+import org.servicemix.wsn.jaxws.UnableToDestroySubscriptionFault;
+import org.servicemix.wsn.jaxws.UnacceptableInitialTerminationTimeFault;
+import org.servicemix.wsn.jaxws.UnacceptableTerminationTimeFault;
+import org.w3._2005._03.addressing.EndpointReferenceType;
+
+@WebService(endpointInterface = "org.servicemix.wsn.jaxws.PausableSubscriptionManager")
+public abstract class AbstractSubscription extends AbstractEndpoint 
+										   implements PausableSubscriptionManager {
+
+	public static final String WSN_URI = "http://docs.oasis-open.org/wsn/b-1";
+	public static final String XPATH1_URI = "http://www.w3.org/TR/1999/REC-xpath-19991116";
+	public static final QName QNAME_TOPIC_EXPRESSION = new QName(WSN_URI, "TopicExpression");
+	public static final QName QNAME_PRODUCER_PROPERTIES = new QName(WSN_URI, "ProducerProperties");
+	public static final QName QNAME_MESSAGE_CONTENT = new QName(WSN_URI, "MessageContent");
+	public static final QName QNAME_USE_RAW = new QName(WSN_URI, "UseRaw");
+	
+	protected DatatypeFactory datatypeFactory;
+	protected XMLGregorianCalendar terminationTime;
+	protected boolean useRaw;
+	protected TopicExpressionType topic;
+	protected QueryExpressionType contentFilter;
+	protected EndpointReferenceType consumerReference;
+	
+	public AbstractSubscription(String name) {
+		super(name);
+		try {
+			this.datatypeFactory = DatatypeFactory.newInstance();
+		} catch (DatatypeConfigurationException e) {
+			throw new RuntimeException("Unable to initialize subscription", e);
+		}
+	}
+	
+    /**
+     * 
+     * @param renewRequest
+     * @return
+     *     returns org.oasis_open.docs.wsn.b_1.RenewResponse
+     * @throws UnacceptableTerminationTimeFault
+     * @throws ResourceUnknownFault
+     */
+    @WebMethod(operationName = "Renew")
+    @WebResult(name = "RenewResponse", targetNamespace = "http://docs.oasis-open.org/wsn/b-1", partName = "RenewResponse")
+    public RenewResponse renew(
+        @WebParam(name = "Renew", targetNamespace = "http://docs.oasis-open.org/wsn/b-1", partName = "RenewRequest")
+        Renew renewRequest)
+        throws ResourceUnknownFault, UnacceptableTerminationTimeFault {
+    	
+    	XMLGregorianCalendar terminationTime = validateTerminationTime(renewRequest.getTerminationTime());
+    	renew(terminationTime);
+    	RenewResponse response = new RenewResponse();
+    	response.setTerminationTime(terminationTime);
+    	response.setCurrentTime(getCurrentTime());
+    	return response;
+    }
+    
+    /**
+     * 
+     * @param unsubscribeRequest
+     * @return
+     *     returns org.oasis_open.docs.wsn.b_1.UnsubscribeResponse
+     * @throws UnableToDestroySubscriptionFault
+     * @throws ResourceUnknownFault
+     */
+    @WebMethod(operationName = "Unsubscribe")
+    @WebResult(name = "UnsubscribeResponse", targetNamespace = "http://docs.oasis-open.org/wsn/b-1", partName = "UnsubscribeResponse")
+    public UnsubscribeResponse unsubscribe(
+        @WebParam(name = "Unsubscribe", targetNamespace = "http://docs.oasis-open.org/wsn/b-1", partName = "UnsubscribeRequest")
+        Unsubscribe unsubscribeRequest)
+        throws ResourceUnknownFault, UnableToDestroySubscriptionFault {
+
+    	unsubscribe();
+    	return new UnsubscribeResponse();
+    }
+    
+    /**
+     * 
+     * @param pauseSubscriptionRequest
+     * @return
+     *     returns org.oasis_open.docs.wsn.b_1.PauseSubscriptionResponse
+     * @throws PauseFailedFault
+     * @throws ResourceUnknownFault
+     */
+    @WebMethod(operationName = "PauseSubscription")
+    @WebResult(name = "PauseSubscriptionResponse", targetNamespace = "http://docs.oasis-open.org/wsn/b-1", partName = "PauseSubscriptionResponse")
+    public PauseSubscriptionResponse pauseSubscription(
+        @WebParam(name = "PauseSubscription", targetNamespace = "http://docs.oasis-open.org/wsn/b-1", partName = "PauseSubscriptionRequest")
+        PauseSubscription pauseSubscriptionRequest)
+        throws PauseFailedFault, ResourceUnknownFault {
+
+    	pause();
+    	return new PauseSubscriptionResponse();
+    }
+
+    /**
+     * 
+     * @param resumeSubscriptionRequest
+     * @return
+     *     returns org.oasis_open.docs.wsn.b_1.ResumeSubscriptionResponse
+     * @throws ResumeFailedFault
+     * @throws ResourceUnknownFault
+     */
+    @WebMethod(operationName = "ResumeSubscription")
+    @WebResult(name = "ResumeSubscriptionResponse", targetNamespace = "http://docs.oasis-open.org/wsn/b-1", partName = "ResumeSubscriptionResponse")
+    public ResumeSubscriptionResponse resumeSubscription(
+        @WebParam(name = "ResumeSubscription", targetNamespace = "http://docs.oasis-open.org/wsn/b-1", partName = "ResumeSubscriptionRequest")
+        ResumeSubscription resumeSubscriptionRequest)
+        throws ResourceUnknownFault, ResumeFailedFault {
+
+    	resume();
+    	return new ResumeSubscriptionResponse();
+    }
+    
+    protected XMLGregorianCalendar validateInitialTerminationTime(String value) throws UnacceptableInitialTerminationTimeFault {
+    	XMLGregorianCalendar tt = parseTerminationTime(value);
+    	if (tt == null) {
+    		UnacceptableInitialTerminationTimeFaultType fault = new UnacceptableInitialTerminationTimeFaultType();
+        	throw new UnacceptableInitialTerminationTimeFault(
+        			"Unable to parse initial termination time: '" + value + "'",
+        			fault);
+    	}
+    	XMLGregorianCalendar ct = getCurrentTime();
+    	int c = tt.compare(ct);
+    	if (c == DatatypeConstants.LESSER || c == DatatypeConstants.EQUAL) {
+    		UnacceptableInitialTerminationTimeFaultType fault = new UnacceptableInitialTerminationTimeFaultType();
+        	fault.setMinimumTime(ct);
+        	throw new UnacceptableInitialTerminationTimeFault(
+        			"Invalid initial termination time",
+        			fault);
+    	}
+    	return tt;
+    }
+    
+    protected XMLGregorianCalendar validateTerminationTime(String value) throws UnacceptableTerminationTimeFault {
+    	XMLGregorianCalendar tt = parseTerminationTime(value);
+    	if (tt == null) {
+        	UnacceptableTerminationTimeFaultType fault = new UnacceptableTerminationTimeFaultType();
+        	throw new UnacceptableTerminationTimeFault(
+        			"Unable to parse termination time: '" + value + "'",
+        			fault);
+    	}
+    	XMLGregorianCalendar ct = getCurrentTime();
+    	int c = tt.compare(ct);
+    	if (c == DatatypeConstants.LESSER || c == DatatypeConstants.EQUAL) {
+        	UnacceptableTerminationTimeFaultType fault = new UnacceptableTerminationTimeFaultType();
+        	fault.setMinimumTime(ct);
+        	throw new UnacceptableTerminationTimeFault(
+        			"Invalid termination time",
+        			fault);
+    	}
+    	return tt;
+    }
+    
+    protected XMLGregorianCalendar parseTerminationTime(String value) {
+    	try {
+    		Duration d = datatypeFactory.newDuration(value);
+    		XMLGregorianCalendar c = getCurrentTime();
+    		c.add(d);
+    		return c;
+    	} catch (Exception e) { }
+    	try {
+    		Duration d = datatypeFactory.newDurationDayTime(value);
+    		XMLGregorianCalendar c = getCurrentTime();
+    		c.add(d);
+    		return c;
+    	} catch (Exception e) { }
+    	try {
+    		Duration d = datatypeFactory.newDurationYearMonth(value);
+    		XMLGregorianCalendar c = getCurrentTime();
+    		c.add(d);
+    		return c;
+    	} catch (Exception e) { }
+    	try {
+    		return datatypeFactory.newXMLGregorianCalendar(value);
+    	} catch (Exception e) { }
+    	return null;
+    }
+    
+    protected XMLGregorianCalendar getCurrentTime() {
+    	return datatypeFactory.newXMLGregorianCalendar(new GregorianCalendar());
+    }
+
+	public XMLGregorianCalendar getTerminationTime() {
+		return terminationTime;
+	}
+
+	public void setTerminationTime(XMLGregorianCalendar terminationTime) {
+		this.terminationTime = terminationTime;
+	}
+	
+	public abstract void subscribe(Subscribe subscribeRequest) throws InvalidFilterFault, InvalidMessageContentExpressionFault, InvalidProducerPropertiesExpressionFault, InvalidTopicExpressionFault, InvalidUseRawValueFault, SubscribeCreationFailedFault, TopicExpressionDialectUnknownFault, TopicNotSupportedFault, UnacceptableInitialTerminationTimeFault;
+	
+	protected abstract void pause() throws PauseFailedFault;
+	
+    protected abstract void resume() throws ResumeFailedFault;
+
+    protected abstract void renew(XMLGregorianCalendar terminationTime) throws UnacceptableTerminationTimeFault;
+
+    protected void unsubscribe() throws UnableToDestroySubscriptionFault {
+    	try {
+    		unregister();
+    	} catch (EndpointRegistrationException e) {
+    		UnableToDestroySubscriptionFaultType fault = new UnableToDestroySubscriptionFaultType();
+    		throw new UnableToDestroySubscriptionFault("Error unregistering endpoint", fault, e);
+    	}
+    }
+
+	protected String createAddress() {
+		return "http://servicemix.org/wsnotification/Subscription/" + getName();
+	}
+
+	protected void validateSubscription(Subscribe subscribeRequest) throws InvalidFilterFault, InvalidMessageContentExpressionFault, InvalidProducerPropertiesExpressionFault, InvalidTopicExpressionFault, InvalidUseRawValueFault, SubscribeCreationFailedFault, TopicExpressionDialectUnknownFault, TopicNotSupportedFault, UnacceptableInitialTerminationTimeFault {
+		// Check consumer reference
+		consumerReference = subscribeRequest.getConsumerReference();
+		// Check terminationTime
+		if (subscribeRequest.getInitialTerminationTime() != null &&
+			subscribeRequest.getInitialTerminationTime().isNil() == false &&
+			subscribeRequest.getInitialTerminationTime().getValue() != null) {
+			String strTerminationTime = subscribeRequest.getInitialTerminationTime().getValue();
+			terminationTime = validateInitialTerminationTime(strTerminationTime.trim());
+		}
+		// Check filter
+		if (subscribeRequest.getFilter() != null) {
+			for (Object f : subscribeRequest.getFilter().getAny()) {
+				JAXBElement e = null;
+				if (f instanceof JAXBElement) {
+					e = (JAXBElement) f;
+					f = e.getValue();
+				}
+				if (f instanceof TopicExpressionType) {
+					if (!e.getName().equals(QNAME_TOPIC_EXPRESSION)) {
+						InvalidTopicExpressionFaultType fault = new InvalidTopicExpressionFaultType();
+						throw new InvalidTopicExpressionFault("Unrecognized TopicExpression: " + e, fault);
+					}
+					topic = (TopicExpressionType) f;
+				} else if (f instanceof QueryExpressionType) {
+					if (e != null && e.getName().equals(QNAME_PRODUCER_PROPERTIES)) {
+						InvalidProducerPropertiesExpressionFaultType fault = new InvalidProducerPropertiesExpressionFaultType();
+						throw new InvalidProducerPropertiesExpressionFault("ProducerProperties are not supported", fault);
+					} else if (e != null && e.getName().equals(QNAME_MESSAGE_CONTENT)) {
+						if (contentFilter != null) {
+							InvalidMessageContentExpressionFaultType fault = new InvalidMessageContentExpressionFaultType();
+							throw new InvalidMessageContentExpressionFault("Only one MessageContent filter can be specified", fault);
+						}
+						contentFilter = (QueryExpressionType) f;
+						// Defaults to XPath 1.0
+						if (contentFilter.getDialect() == null) {
+							contentFilter.setDialect(XPATH1_URI);
+						}
+					} else {
+						InvalidFilterFaultType fault = new InvalidFilterFaultType();
+						throw new InvalidFilterFault("Unrecognized filter: " + (e != null ? e.getName() : f), fault);
+					}
+				} else {
+					InvalidFilterFaultType fault = new InvalidFilterFaultType();
+					throw new InvalidFilterFault("Unrecognized filter: " + (e != null ? e.getName() : f), fault);
+				}
+			}
+		}
+		// Check policy
+		if (subscribeRequest.getSubscriptionPolicy() != null) {
+			for (Object p : subscribeRequest.getSubscriptionPolicy().getAny()) {
+				JAXBElement e = null;
+				if (p instanceof JAXBElement) {
+					e = (JAXBElement) p;
+					p = e.getValue();
+				}
+				if (p instanceof UseRaw) {
+					useRaw = true;
+				} else {
+					InvalidFilterFaultType fault = new InvalidFilterFaultType();
+					throw new InvalidFilterFault("Unrecognized policy: " + p, fault);
+				}
+			}
+		}
+		// Check all parameters
+		if (consumerReference == null) {
+			SubscribeCreationFailedFaultType fault = new SubscribeCreationFailedFaultType();
+			throw new SubscribeCreationFailedFault("Invalid ConsumerReference: null", fault);
+		}
+		// TODO check we can resolve endpoint
+		if (topic == null) {
+			InvalidFilterFaultType fault = new InvalidFilterFaultType();
+			throw new InvalidFilterFault("Must specify a topic to subscribe on", fault);
+		}
+		if (contentFilter != null && !contentFilter.getDialect().equals(XPATH1_URI)) {
+			InvalidMessageContentExpressionFaultType fault = new InvalidMessageContentExpressionFaultType();
+			throw new InvalidMessageContentExpressionFault("Unsupported MessageContent dialect: '" + contentFilter.getDialect() + "'", fault);
+		}
+		if (terminationTime != null) {
+			UnacceptableInitialTerminationTimeFaultType fault = new UnacceptableInitialTerminationTimeFaultType();
+	    	throw new UnacceptableInitialTerminationTimeFault(
+	    			"InitialTerminationTime is not supported",
+	    			fault);
+		}
+		if (useRaw) {
+			InvalidUseRawValueFaultType fault = new InvalidUseRawValueFaultType();
+			throw new InvalidUseRawValueFault("UseRaw mode is not supported", fault);
+		}
+	}
+}

Added: incubator/servicemix/trunk/servicemix-wsn2005/src/main/java/org/servicemix/wsn/EndpointManager.java
URL: http://svn.apache.org/viewcvs/incubator/servicemix/trunk/servicemix-wsn2005/src/main/java/org/servicemix/wsn/EndpointManager.java?rev=357814&view=auto
==============================================================================
--- incubator/servicemix/trunk/servicemix-wsn2005/src/main/java/org/servicemix/wsn/EndpointManager.java (added)
+++ incubator/servicemix/trunk/servicemix-wsn2005/src/main/java/org/servicemix/wsn/EndpointManager.java Mon Dec 19 14:08:30 2005
@@ -0,0 +1,9 @@
+package org.servicemix.wsn;
+
+public interface EndpointManager {
+	
+	Object register(String address, Object service) throws EndpointRegistrationException;
+	
+	void unregister(Object endpoint) throws EndpointRegistrationException;
+
+}

Added: incubator/servicemix/trunk/servicemix-wsn2005/src/main/java/org/servicemix/wsn/EndpointRegistrationException.java
URL: http://svn.apache.org/viewcvs/incubator/servicemix/trunk/servicemix-wsn2005/src/main/java/org/servicemix/wsn/EndpointRegistrationException.java?rev=357814&view=auto
==============================================================================
--- incubator/servicemix/trunk/servicemix-wsn2005/src/main/java/org/servicemix/wsn/EndpointRegistrationException.java (added)
+++ incubator/servicemix/trunk/servicemix-wsn2005/src/main/java/org/servicemix/wsn/EndpointRegistrationException.java Mon Dec 19 14:08:30 2005
@@ -0,0 +1,26 @@
+package org.servicemix.wsn;
+
+public class EndpointRegistrationException extends Exception {
+
+	/**
+	 * Generated serial version UID
+	 */
+	private static final long serialVersionUID = 6365080415473176527L;
+
+	public EndpointRegistrationException() {
+		super();
+	}
+
+	public EndpointRegistrationException(String message, Throwable cause) {
+		super(message, cause);
+	}
+
+	public EndpointRegistrationException(String message) {
+		super(message);
+	}
+
+	public EndpointRegistrationException(Throwable cause) {
+		super(cause);
+	}
+
+}

Added: incubator/servicemix/trunk/servicemix-wsn2005/src/main/java/org/servicemix/wsn/PullPointConsumer.java
URL: http://svn.apache.org/viewcvs/incubator/servicemix/trunk/servicemix-wsn2005/src/main/java/org/servicemix/wsn/PullPointConsumer.java?rev=357814&view=auto
==============================================================================
--- incubator/servicemix/trunk/servicemix-wsn2005/src/main/java/org/servicemix/wsn/PullPointConsumer.java (added)
+++ incubator/servicemix/trunk/servicemix-wsn2005/src/main/java/org/servicemix/wsn/PullPointConsumer.java Mon Dec 19 14:08:30 2005
@@ -0,0 +1,8 @@
+package org.servicemix.wsn;
+
+import org.servicemix.wsn.jaxws.NotificationConsumer;
+import org.servicemix.wsn.jaxws.PullPoint;
+
+public interface PullPointConsumer extends PullPoint, NotificationConsumer {
+
+}

Added: incubator/servicemix/trunk/servicemix-wsn2005/src/main/java/org/servicemix/wsn/component/WSNBootstrap.java
URL: http://svn.apache.org/viewcvs/incubator/servicemix/trunk/servicemix-wsn2005/src/main/java/org/servicemix/wsn/component/WSNBootstrap.java?rev=357814&view=auto
==============================================================================
--- incubator/servicemix/trunk/servicemix-wsn2005/src/main/java/org/servicemix/wsn/component/WSNBootstrap.java (added)
+++ incubator/servicemix/trunk/servicemix-wsn2005/src/main/java/org/servicemix/wsn/component/WSNBootstrap.java Mon Dec 19 14:08:30 2005
@@ -0,0 +1,7 @@
+package org.servicemix.wsn.component;
+
+import org.servicemix.common.BaseBootstrap;
+
+public class WSNBootstrap extends BaseBootstrap {
+
+}

Added: incubator/servicemix/trunk/servicemix-wsn2005/src/main/java/org/servicemix/wsn/component/WSNComponent.java
URL: http://svn.apache.org/viewcvs/incubator/servicemix/trunk/servicemix-wsn2005/src/main/java/org/servicemix/wsn/component/WSNComponent.java?rev=357814&view=auto
==============================================================================
--- incubator/servicemix/trunk/servicemix-wsn2005/src/main/java/org/servicemix/wsn/component/WSNComponent.java (added)
+++ incubator/servicemix/trunk/servicemix-wsn2005/src/main/java/org/servicemix/wsn/component/WSNComponent.java Mon Dec 19 14:08:30 2005
@@ -0,0 +1,23 @@
+package org.servicemix.wsn.component;
+
+import javax.jms.ConnectionFactory;
+
+import org.servicemix.common.BaseComponent;
+import org.servicemix.common.BaseLifeCycle;
+
+public class WSNComponent extends BaseComponent {
+
+	@Override
+	protected BaseLifeCycle createLifeCycle() {
+		return new WSNLifeCycle(this);
+	}
+
+	public ConnectionFactory getConnectionFactory() {
+		return ((WSNLifeCycle) lifeCycle).getConnectionFactory();
+	}
+
+	public void setConnectionFactory(ConnectionFactory connectionFactory) {
+		((WSNLifeCycle) lifeCycle).setConnectionFactory(connectionFactory);
+	}
+	
+}

Added: incubator/servicemix/trunk/servicemix-wsn2005/src/main/java/org/servicemix/wsn/component/WSNConfiguration.java
URL: http://svn.apache.org/viewcvs/incubator/servicemix/trunk/servicemix-wsn2005/src/main/java/org/servicemix/wsn/component/WSNConfiguration.java?rev=357814&view=auto
==============================================================================
--- incubator/servicemix/trunk/servicemix-wsn2005/src/main/java/org/servicemix/wsn/component/WSNConfiguration.java (added)
+++ incubator/servicemix/trunk/servicemix-wsn2005/src/main/java/org/servicemix/wsn/component/WSNConfiguration.java Mon Dec 19 14:08:30 2005
@@ -0,0 +1,27 @@
+package org.servicemix.wsn.component;
+
+public class WSNConfiguration implements WSNConfigurationMBean {
+
+	private String initialContextFactory;
+	private String jndiProviderURL;
+	private String jndiConnectionFactoryName;
+	
+	public String getInitialContextFactory() {
+		return initialContextFactory;
+	}
+	public void setInitialContextFactory(String initialContextFactory) {
+		this.initialContextFactory = initialContextFactory;
+	}
+	public String getJndiConnectionFactoryName() {
+		return jndiConnectionFactoryName;
+	}
+	public void setJndiConnectionFactoryName(String jndiConnectionFactoryName) {
+		this.jndiConnectionFactoryName = jndiConnectionFactoryName;
+	}
+	public String getJndiProviderURL() {
+		return jndiProviderURL;
+	}
+	public void setJndiProviderURL(String jndiProviderURL) {
+		this.jndiProviderURL = jndiProviderURL;
+	}
+}

Added: incubator/servicemix/trunk/servicemix-wsn2005/src/main/java/org/servicemix/wsn/component/WSNConfigurationMBean.java
URL: http://svn.apache.org/viewcvs/incubator/servicemix/trunk/servicemix-wsn2005/src/main/java/org/servicemix/wsn/component/WSNConfigurationMBean.java?rev=357814&view=auto
==============================================================================
--- incubator/servicemix/trunk/servicemix-wsn2005/src/main/java/org/servicemix/wsn/component/WSNConfigurationMBean.java (added)
+++ incubator/servicemix/trunk/servicemix-wsn2005/src/main/java/org/servicemix/wsn/component/WSNConfigurationMBean.java Mon Dec 19 14:08:30 2005
@@ -0,0 +1,14 @@
+package org.servicemix.wsn.component;
+
+public interface WSNConfigurationMBean {
+
+	String getInitialContextFactory();
+	void setInitialContextFactory(String initialContextFactory);
+	
+	String getJndiProviderURL();
+	void setJndiProviderURL(String jndiProviderURL);
+	
+	String getJndiConnectionFactoryName();
+	void setJndiConnectionFactoryName(String jndiConnectionFactoryName);
+	
+}

Added: incubator/servicemix/trunk/servicemix-wsn2005/src/main/java/org/servicemix/wsn/component/WSNEndpoint.java
URL: http://svn.apache.org/viewcvs/incubator/servicemix/trunk/servicemix-wsn2005/src/main/java/org/servicemix/wsn/component/WSNEndpoint.java?rev=357814&view=auto
==============================================================================
--- incubator/servicemix/trunk/servicemix-wsn2005/src/main/java/org/servicemix/wsn/component/WSNEndpoint.java (added)
+++ incubator/servicemix/trunk/servicemix-wsn2005/src/main/java/org/servicemix/wsn/component/WSNEndpoint.java Mon Dec 19 14:08:30 2005
@@ -0,0 +1,168 @@
+package org.servicemix.wsn.component;
+
+import java.io.StringWriter;
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import javax.jbi.component.ComponentContext;
+import javax.jbi.messaging.DeliveryChannel;
+import javax.jbi.messaging.ExchangeStatus;
+import javax.jbi.messaging.MessageExchange;
+import javax.jbi.messaging.NormalizedMessage;
+import javax.jbi.messaging.MessageExchange.Role;
+import javax.jbi.servicedesc.ServiceEndpoint;
+import javax.jws.Oneway;
+import javax.jws.WebMethod;
+import javax.jws.WebService;
+import javax.xml.bind.JAXBContext;
+import javax.xml.namespace.QName;
+
+import org.servicemix.common.Endpoint;
+import org.servicemix.common.ExchangeProcessor;
+import org.servicemix.jbi.jaxp.StringSource;
+
+public class WSNEndpoint extends Endpoint implements ExchangeProcessor {
+
+    protected ServiceEndpoint activated;
+    protected String address;
+    protected Object pojo;
+    protected DeliveryChannel channel;
+    protected JAXBContext jaxbContext;
+    protected Class endpointInterface;
+    
+	public WSNEndpoint(String address, Object pojo) {
+		this.address = address;
+		this.pojo = pojo;
+		String[] parts = split(address);
+		service = new QName(parts[0], parts[1]);
+		endpoint = parts[2];
+	}
+
+	@Override
+	public Role getRole() {
+		return Role.PROVIDER;
+	}
+
+	@Override
+	public void activate() throws Exception {
+        logger = this.serviceUnit.getComponent().getLogger();
+        ComponentContext ctx = this.serviceUnit.getComponent().getComponentContext();
+        activated = ctx.activateEndpoint(service, endpoint);
+        channel = ctx.getDeliveryChannel();
+        jaxbContext = createJAXBContext();
+	}
+	
+	protected JAXBContext createJAXBContext() throws Exception {
+		WebService ws = getWebServiceAnnotation();
+		if (ws == null) {
+			throw new IllegalStateException("Unable to find WebService annotation");
+		}
+		endpointInterface = Class.forName(ws.endpointInterface());
+		List<Class> classes = new ArrayList<Class>();
+		for (Method mth : endpointInterface.getMethods()) {
+			WebMethod wm = (WebMethod) mth.getAnnotation(WebMethod.class);
+			if (wm != null) {
+				classes.add(mth.getReturnType());
+				classes.addAll(Arrays.asList(mth.getParameterTypes()));
+			}
+		}
+		return JAXBContext.newInstance(classes.toArray(new Class[0]));
+	}
+
+	@Override
+	public void deactivate() throws Exception {
+        ServiceEndpoint ep = activated;
+        activated = null;
+        ComponentContext ctx = this.serviceUnit.getComponent().getComponentContext();
+        ctx.deactivateEndpoint(ep);
+	}
+
+	@Override
+	public ExchangeProcessor getProcessor() {
+		return this;
+	}
+
+	public void process(MessageExchange exchange) throws Exception {
+		if (exchange.getStatus() == ExchangeStatus.DONE) {
+			return;
+		} else if (exchange.getStatus() == ExchangeStatus.ERROR) {
+			exchange.setStatus(ExchangeStatus.DONE);
+			channel.send(exchange);
+			return;
+		}
+		Object input = jaxbContext.createUnmarshaller().unmarshal(exchange.getMessage("in").getContent());
+		Method webMethod = null;
+		for (Method mth : endpointInterface.getMethods()) {
+			Class[] params = mth.getParameterTypes();
+			if (params.length == 1 && params[0].isAssignableFrom(input.getClass())) {
+				webMethod = mth;
+				break;
+			}
+		}
+		if (webMethod ==  null) {
+			throw new IllegalStateException("Could not determine invoked web method");
+		}
+		Object output = webMethod.invoke(pojo, new Object[] { input });
+		if (webMethod.getAnnotation(Oneway.class) != null) {
+			exchange.setStatus(ExchangeStatus.DONE);
+			channel.send(exchange);
+		} else {
+			NormalizedMessage msg = exchange.createMessage();
+			exchange.setMessage(msg, "out");
+			StringWriter writer = new StringWriter();
+			jaxbContext.createMarshaller().marshal(output, writer);
+			msg.setContent(new StringSource(writer.toString()));
+			channel.send(exchange);
+		}
+	}
+	
+	protected Method getWebServiceMethod(QName interfaceName, QName operation) throws Exception {
+		WebService ws = getWebServiceAnnotation();
+		if (ws == null) {
+			throw new IllegalStateException("Unable to find WebService annotation");
+		}
+		Class itf = Class.forName(ws.endpointInterface());
+		for (Method mth : itf.getMethods()) {
+			WebMethod wm = (WebMethod) mth.getAnnotation(WebMethod.class);
+			if (wm != null) {
+				
+			}
+		}
+		return null;
+	}
+
+	protected WebService getWebServiceAnnotation() {
+		for (Class cl = pojo.getClass(); cl != null; cl = cl.getSuperclass()) {
+			WebService ws = (WebService) cl.getAnnotation(WebService.class);
+			if (ws != null) {
+				return ws;
+			}
+		}
+		return null;
+	}
+
+	public void start() throws Exception {
+		// Nothing to do
+	}
+
+	public void stop() throws Exception {
+		// Nothing to do
+	}
+
+    protected String[] split(String uri) {
+		char sep;
+		if (uri.indexOf('/') > 0) {
+			sep = '/';
+		} else {
+			sep = ':';
+		}
+		int idx1 = uri.lastIndexOf(sep);
+		int idx2 = uri.lastIndexOf(sep, idx1 - 1);
+		String epName = uri.substring(idx1 + 1);
+		String svcName = uri.substring(idx2 + 1, idx1);
+		String nsUri   = uri.substring(0, idx2);
+    	return new String[] { nsUri, svcName, epName };
+    }
+}

Added: incubator/servicemix/trunk/servicemix-wsn2005/src/main/java/org/servicemix/wsn/component/WSNLifeCycle.java
URL: http://svn.apache.org/viewcvs/incubator/servicemix/trunk/servicemix-wsn2005/src/main/java/org/servicemix/wsn/component/WSNLifeCycle.java?rev=357814&view=auto
==============================================================================
--- incubator/servicemix/trunk/servicemix-wsn2005/src/main/java/org/servicemix/wsn/component/WSNLifeCycle.java (added)
+++ incubator/servicemix/trunk/servicemix-wsn2005/src/main/java/org/servicemix/wsn/component/WSNLifeCycle.java Mon Dec 19 14:08:30 2005
@@ -0,0 +1,123 @@
+package org.servicemix.wsn.component;
+
+import java.util.Hashtable;
+
+import javax.jms.ConnectionFactory;
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+
+import org.servicemix.common.BaseComponent;
+import org.servicemix.common.BaseLifeCycle;
+import org.servicemix.common.ServiceUnit;
+import org.servicemix.wsn.EndpointManager;
+import org.servicemix.wsn.EndpointRegistrationException;
+import org.servicemix.wsn.jbi.JbiNotificationBroker;
+
+public class WSNLifeCycle extends BaseLifeCycle {
+
+	private JbiNotificationBroker notificationBroker;
+	private WSNConfiguration configuration;
+	private ConnectionFactory connectionFactory;
+	private ServiceUnit serviceUnit;
+	
+	public WSNLifeCycle(BaseComponent component) {
+		super(component);
+		configuration = new WSNConfiguration();
+		serviceUnit = new ServiceUnit();
+		serviceUnit.setComponent(component);
+	}
+
+    protected Object getExtensionMBean() throws Exception {
+        return configuration;
+    }
+    
+	@Override
+	protected void doInit() throws Exception {
+		super.doInit();
+		notificationBroker = new JbiNotificationBroker("Broker");
+		notificationBroker.setContext(context);
+		notificationBroker.setManager(new WSNEndpointManager());
+		if (connectionFactory == null) {
+			connectionFactory = lookupConnectionFactory();
+		}
+		notificationBroker.setConnectionFactory(connectionFactory);
+		notificationBroker.init();
+	}
+
+	@Override
+	protected void doShutDown() throws Exception {
+		// TODO Auto-generated method stub
+		super.doShutDown();
+	}
+
+	@Override
+	protected void doStart() throws Exception {
+		super.doStart();
+	}
+
+	@Override
+	protected void doStop() throws Exception {
+		// TODO Auto-generated method stub
+		super.doStop();
+	}
+
+	public WSNConfiguration getConfiguration() {
+		return configuration;
+	}
+
+	public void setConfiguration(WSNConfiguration configuration) {
+		this.configuration = configuration;
+	}
+
+	public ConnectionFactory getConnectionFactory() {
+		return connectionFactory;
+	}
+
+	public void setConnectionFactory(ConnectionFactory connectionFactory) {
+		this.connectionFactory = connectionFactory;
+	}
+	
+	protected ConnectionFactory lookupConnectionFactory() throws NamingException {
+		Hashtable<String,String> props = new Hashtable<String,String>();
+		if (configuration.getInitialContextFactory() != null && configuration.getJndiProviderURL() != null) {
+			props.put(Context.INITIAL_CONTEXT_FACTORY, configuration.getInitialContextFactory());
+			props.put(Context.PROVIDER_URL, configuration.getJndiProviderURL());
+		}
+		InitialContext ctx = new InitialContext(props);
+		ConnectionFactory connectionFactory = (ConnectionFactory) ctx.lookup(configuration.getJndiConnectionFactoryName());
+		return connectionFactory;
+	}
+	
+	public class WSNEndpointManager implements EndpointManager {
+
+		public Object register(String address, Object service) throws EndpointRegistrationException {
+			component.getRegistry().unregisterServiceUnit(serviceUnit);
+			try {
+				WSNEndpoint endpoint = new WSNEndpoint(address, service);
+				endpoint.setServiceUnit(serviceUnit);
+				endpoint.activate();
+				serviceUnit.addEndpoint(endpoint);
+				return endpoint;
+			} catch (Exception e) {
+				throw new EndpointRegistrationException("Unable to activate endpoint", e);
+			} finally {
+				component.getRegistry().registerServiceUnit(serviceUnit);
+			}
+		}
+
+		public void unregister(Object endpoint) throws EndpointRegistrationException {
+			component.getRegistry().unregisterServiceUnit(serviceUnit);
+			try {
+				((WSNEndpoint) endpoint).deactivate();
+			} catch (Exception e) {
+				throw new EndpointRegistrationException("Unable to activate endpoint", e);
+			} finally {
+				serviceUnit.getEndpoints().remove(endpoint);
+				component.getRegistry().registerServiceUnit(serviceUnit);
+			}
+		}
+
+	}
+
+}

Added: incubator/servicemix/trunk/servicemix-wsn2005/src/main/java/org/servicemix/wsn/jbi/JbiNotificationBroker.java
URL: http://svn.apache.org/viewcvs/incubator/servicemix/trunk/servicemix-wsn2005/src/main/java/org/servicemix/wsn/jbi/JbiNotificationBroker.java?rev=357814&view=auto
==============================================================================
--- incubator/servicemix/trunk/servicemix-wsn2005/src/main/java/org/servicemix/wsn/jbi/JbiNotificationBroker.java (added)
+++ incubator/servicemix/trunk/servicemix-wsn2005/src/main/java/org/servicemix/wsn/jbi/JbiNotificationBroker.java Mon Dec 19 14:08:30 2005
@@ -0,0 +1,31 @@
+package org.servicemix.wsn.jbi;
+
+import javax.jbi.component.ComponentContext;
+
+import org.servicemix.wsn.jms.JmsNotificationBroker;
+import org.servicemix.wsn.jms.JmsSubscription;
+
+public class JbiNotificationBroker extends JmsNotificationBroker {
+
+	private ComponentContext context;
+	
+	public JbiNotificationBroker(String name) {
+		super(name);
+	}
+	
+	@Override
+	protected JmsSubscription createJmsSubscription(String name) {
+		JbiSubscription subscription = new JbiSubscription(name);
+		subscription.setContext(context);
+		return subscription;
+	}
+
+	public ComponentContext getContext() {
+		return context;
+	}
+
+	public void setContext(ComponentContext context) {
+		this.context = context;
+	}
+
+}

Added: incubator/servicemix/trunk/servicemix-wsn2005/src/main/java/org/servicemix/wsn/jbi/JbiSubscription.java
URL: http://svn.apache.org/viewcvs/incubator/servicemix/trunk/servicemix-wsn2005/src/main/java/org/servicemix/wsn/jbi/JbiSubscription.java?rev=357814&view=auto
==============================================================================
--- incubator/servicemix/trunk/servicemix-wsn2005/src/main/java/org/servicemix/wsn/jbi/JbiSubscription.java (added)
+++ incubator/servicemix/trunk/servicemix-wsn2005/src/main/java/org/servicemix/wsn/jbi/JbiSubscription.java Mon Dec 19 14:08:30 2005
@@ -0,0 +1,91 @@
+package org.servicemix.wsn.jbi;
+
+import javax.jbi.JBIException;
+import javax.jbi.component.ComponentContext;
+import javax.jbi.messaging.DeliveryChannel;
+import javax.jbi.messaging.InOnly;
+import javax.jbi.messaging.MessageExchangeFactory;
+import javax.jbi.messaging.NormalizedMessage;
+import javax.jbi.servicedesc.ServiceEndpoint;
+import javax.xml.namespace.QName;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.oasis_open.docs.wsn.b_1.Subscribe;
+import org.oasis_open.docs.wsn.b_1.SubscribeCreationFailedFaultType;
+import org.servicemix.jbi.jaxp.StringSource;
+import org.servicemix.wsn.jaxws.InvalidFilterFault;
+import org.servicemix.wsn.jaxws.InvalidMessageContentExpressionFault;
+import org.servicemix.wsn.jaxws.InvalidProducerPropertiesExpressionFault;
+import org.servicemix.wsn.jaxws.InvalidTopicExpressionFault;
+import org.servicemix.wsn.jaxws.InvalidUseRawValueFault;
+import org.servicemix.wsn.jaxws.SubscribeCreationFailedFault;
+import org.servicemix.wsn.jaxws.TopicExpressionDialectUnknownFault;
+import org.servicemix.wsn.jaxws.TopicNotSupportedFault;
+import org.servicemix.wsn.jaxws.UnacceptableInitialTerminationTimeFault;
+import org.servicemix.wsn.jms.JmsSubscription;
+
+public class JbiSubscription extends JmsSubscription {
+
+	private static Log log = LogFactory.getLog(JbiSubscription.class);
+	
+	private ComponentContext context;
+	private ServiceEndpoint endpoint;
+	
+	public JbiSubscription(String name) {
+		super(name);
+	}
+
+	@Override
+	protected void validateSubscription(Subscribe subscribeRequest) throws InvalidFilterFault, InvalidMessageContentExpressionFault, InvalidProducerPropertiesExpressionFault, InvalidTopicExpressionFault, InvalidUseRawValueFault, SubscribeCreationFailedFault, TopicExpressionDialectUnknownFault, TopicNotSupportedFault, UnacceptableInitialTerminationTimeFault {
+		super.validateSubscription(subscribeRequest);
+		String[] parts = split(consumerReference.getAddress().getValue());
+		endpoint = context.getEndpoint(new QName(parts[0], parts[1]), parts[2]);
+		if (endpoint == null) {
+			SubscribeCreationFailedFaultType fault = new SubscribeCreationFailedFaultType();
+			throw new SubscribeCreationFailedFault("Unable to resolve consumer reference endpoint", fault);
+		}
+	}
+
+    protected String[] split(String uri) {
+		char sep;
+		if (uri.indexOf('/') > 0) {
+			sep = '/';
+		} else {
+			sep = ':';
+		}
+		int idx1 = uri.lastIndexOf(sep);
+		int idx2 = uri.lastIndexOf(sep, idx1 - 1);
+		String epName = uri.substring(idx1 + 1);
+		String svcName = uri.substring(idx2 + 1, idx1);
+		String nsUri   = uri.substring(0, idx2);
+    	return new String[] { nsUri, svcName, epName };
+    }
+	
+	@Override
+	protected void doNotify(String notify) {
+		try {
+			DeliveryChannel channel = context.getDeliveryChannel();
+			MessageExchangeFactory factory = channel.createExchangeFactory(endpoint);
+			InOnly inonly = factory.createInOnlyExchange();
+			NormalizedMessage msg = inonly.createMessage();
+			inonly.setInMessage(msg);
+			msg.setContent(new StringSource(notify));
+			if (!channel.sendSync(inonly)) {
+				log.warn("Notification was aborted");
+			}
+		} catch (JBIException e) {
+			log.warn("Could not deliver notification", e);
+		}
+	}
+
+	public ComponentContext getContext() {
+		return context;
+	}
+
+	public void setContext(ComponentContext context) {
+		this.context = context;
+	}
+
+
+}

Added: incubator/servicemix/trunk/servicemix-wsn2005/src/main/java/org/servicemix/wsn/jms/JmsNotificationBroker.java
URL: http://svn.apache.org/viewcvs/incubator/servicemix/trunk/servicemix-wsn2005/src/main/java/org/servicemix/wsn/jms/JmsNotificationBroker.java?rev=357814&view=auto
==============================================================================
--- incubator/servicemix/trunk/servicemix-wsn2005/src/main/java/org/servicemix/wsn/jms/JmsNotificationBroker.java (added)
+++ incubator/servicemix/trunk/servicemix-wsn2005/src/main/java/org/servicemix/wsn/jms/JmsNotificationBroker.java Mon Dec 19 14:08:30 2005
@@ -0,0 +1,65 @@
+package org.servicemix.wsn.jms;
+
+import javax.jms.Connection;
+import javax.jms.ConnectionFactory;
+
+import org.oasis_open.docs.wsn.b_1.CreatePullPoint;
+import org.oasis_open.docs.wsn.b_1.Subscribe;
+import org.oasis_open.docs.wsn.br_1.RegisterPublisher;
+import org.servicemix.wsn.AbstractNotificationBroker;
+import org.servicemix.wsn.AbstractPublisher;
+import org.servicemix.wsn.AbstractPullPoint;
+import org.servicemix.wsn.AbstractSubscription;
+
+public abstract class JmsNotificationBroker extends AbstractNotificationBroker {
+
+	private ConnectionFactory connectionFactory;
+	private Connection connection;
+	
+	public JmsNotificationBroker(String name) {
+		super(name);
+	}
+
+    public void init() throws Exception {
+    	if (connection == null) {
+    		connection = connectionFactory.createConnection();
+			connection.start();
+    	}
+    	super.init();
+    }
+	
+	@Override
+	protected AbstractPublisher createPublisher(String name, RegisterPublisher registerPublisherRequest) {
+		JmsPublisher publisher = new JmsPublisher(name);
+		publisher.setManager(getManager());
+		publisher.setConnection(connection);
+		return publisher;
+	}
+
+	@Override
+	protected AbstractPullPoint createPullPoint(String name, CreatePullPoint createPullPointRequest) {
+		JmsPullPoint pullPoint = new JmsPullPoint(name);
+		pullPoint.setManager(getManager());
+		pullPoint.setConnection(connection);
+		return pullPoint;
+	}
+
+	@Override
+	protected AbstractSubscription createSubcription(String name, Subscribe subscribeRequest) {
+		JmsSubscription subscription = createJmsSubscription(name);
+		subscription.setManager(getManager());
+		subscription.setConnection(connection);
+		return subscription;
+	}
+	
+	protected abstract JmsSubscription createJmsSubscription(String name);
+
+	public ConnectionFactory getConnectionFactory() {
+		return connectionFactory;
+	}
+
+	public void setConnectionFactory(ConnectionFactory connectionFactory) {
+		this.connectionFactory = connectionFactory;
+	}
+
+}



Mime
View raw message