You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicemix.apache.org by jg...@apache.org on 2009/03/18 16:45:04 UTC

svn commit: r755620 - in /servicemix/smx4/nmr/trunk: assembly/src/main/descriptors/ examples/interceptors/ examples/interceptors/endpoint/ examples/interceptors/endpoint/src/ examples/interceptors/endpoint/src/main/ examples/interceptors/endpoint/src/m...

Author: jgoodyear
Date: Wed Mar 18 15:45:03 2009
New Revision: 755620

URL: http://svn.apache.org/viewvc?rev=755620&view=rev
Log:
SMX4NMR-131: Adding Endpoint Listener Demo to NMR kit.

Added:
    servicemix/smx4/nmr/trunk/examples/interceptors/endpoint/
    servicemix/smx4/nmr/trunk/examples/interceptors/endpoint/README.txt
    servicemix/smx4/nmr/trunk/examples/interceptors/endpoint/pom.xml
    servicemix/smx4/nmr/trunk/examples/interceptors/endpoint/src/
    servicemix/smx4/nmr/trunk/examples/interceptors/endpoint/src/main/
    servicemix/smx4/nmr/trunk/examples/interceptors/endpoint/src/main/java/
    servicemix/smx4/nmr/trunk/examples/interceptors/endpoint/src/main/java/org/
    servicemix/smx4/nmr/trunk/examples/interceptors/endpoint/src/main/java/org/apache/
    servicemix/smx4/nmr/trunk/examples/interceptors/endpoint/src/main/java/org/apache/servicemix/
    servicemix/smx4/nmr/trunk/examples/interceptors/endpoint/src/main/java/org/apache/servicemix/nmr/
    servicemix/smx4/nmr/trunk/examples/interceptors/endpoint/src/main/java/org/apache/servicemix/nmr/examples/
    servicemix/smx4/nmr/trunk/examples/interceptors/endpoint/src/main/java/org/apache/servicemix/nmr/examples/interceptors/
    servicemix/smx4/nmr/trunk/examples/interceptors/endpoint/src/main/java/org/apache/servicemix/nmr/examples/interceptors/endpoint/
    servicemix/smx4/nmr/trunk/examples/interceptors/endpoint/src/main/java/org/apache/servicemix/nmr/examples/interceptors/endpoint/CustomEndpointListener.java   (with props)
    servicemix/smx4/nmr/trunk/examples/interceptors/endpoint/src/main/resources/
    servicemix/smx4/nmr/trunk/examples/interceptors/endpoint/src/main/resources/META-INF/
    servicemix/smx4/nmr/trunk/examples/interceptors/endpoint/src/main/resources/META-INF/spring/
    servicemix/smx4/nmr/trunk/examples/interceptors/endpoint/src/main/resources/META-INF/spring/beans.xml
Modified:
    servicemix/smx4/nmr/trunk/assembly/src/main/descriptors/unix-bin.xml
    servicemix/smx4/nmr/trunk/assembly/src/main/descriptors/windows-bin.xml
    servicemix/smx4/nmr/trunk/examples/interceptors/pom.xml

Modified: servicemix/smx4/nmr/trunk/assembly/src/main/descriptors/unix-bin.xml
URL: http://svn.apache.org/viewvc/servicemix/smx4/nmr/trunk/assembly/src/main/descriptors/unix-bin.xml?rev=755620&r1=755619&r2=755620&view=diff
==============================================================================
--- servicemix/smx4/nmr/trunk/assembly/src/main/descriptors/unix-bin.xml (original)
+++ servicemix/smx4/nmr/trunk/assembly/src/main/descriptors/unix-bin.xml Wed Mar 18 15:45:03 2009
@@ -129,6 +129,12 @@
             <filtered>true</filtered>
             <lineEnding>unix</lineEnding>
         </file>
+        <file>
+            <source>../examples/interceptors/endpoint/README.txt</source>
+            <outputDirectory>/examples/interceptors/endpoint</outputDirectory>
+            <filtered>true</filtered>
+            <lineEnding>unix</lineEnding>
+        </file>
     </files>
 
 </assembly>

Modified: servicemix/smx4/nmr/trunk/assembly/src/main/descriptors/windows-bin.xml
URL: http://svn.apache.org/viewvc/servicemix/smx4/nmr/trunk/assembly/src/main/descriptors/windows-bin.xml?rev=755620&r1=755619&r2=755620&view=diff
==============================================================================
--- servicemix/smx4/nmr/trunk/assembly/src/main/descriptors/windows-bin.xml (original)
+++ servicemix/smx4/nmr/trunk/assembly/src/main/descriptors/windows-bin.xml Wed Mar 18 15:45:03 2009
@@ -130,6 +130,12 @@
             <filtered>true</filtered>
             <lineEnding>dos</lineEnding>
         </file>
+        <file>
+            <source>../examples/interceptors/endpoint/README.txt</source>
+            <outputDirectory>/examples/interceptors/endpoint</outputDirectory>
+            <filtered>true</filtered>
+            <lineEnding>dos</lineEnding>
+        </file>
     </files>
 
 

Added: servicemix/smx4/nmr/trunk/examples/interceptors/endpoint/README.txt
URL: http://svn.apache.org/viewvc/servicemix/smx4/nmr/trunk/examples/interceptors/endpoint/README.txt?rev=755620&view=auto
==============================================================================
--- servicemix/smx4/nmr/trunk/examples/interceptors/endpoint/README.txt (added)
+++ servicemix/smx4/nmr/trunk/examples/interceptors/endpoint/README.txt Wed Mar 18 15:45:03 2009
@@ -0,0 +1,45 @@
+/*
+ * 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.
+ */
+
+Welcome to the ServiceMix Custom Endpoint Listener Example
+==========================================================
+
+Quick steps to install this example
+-------------------------------------
+
+Launch the ServiceMix Kernel by running
+  bin/servicemix
+in the root dir of this distribution.
+
+run:
+  mvn install
+
+Deploy the example on ServiceMix 4:
+
+- using the ServiceMix console:
+   osgi/install -s mvn:org.apache.servicemix.nmr.examples.interceptors/endpoint/${version}/jar 
+
+Once the bundle is installed it will capture and report to the servicemix 
+log the endpoint register and unregister events in the NMR.
+
+Starting and Stopping the Listener:
+
+- using the ServiceMix console:
+   osgi/start BundleID
+   osgi/stop BundleID
+
+Note: Upon installation the Listener will automatically be started.

Added: servicemix/smx4/nmr/trunk/examples/interceptors/endpoint/pom.xml
URL: http://svn.apache.org/viewvc/servicemix/smx4/nmr/trunk/examples/interceptors/endpoint/pom.xml?rev=755620&view=auto
==============================================================================
--- servicemix/smx4/nmr/trunk/examples/interceptors/endpoint/pom.xml (added)
+++ servicemix/smx4/nmr/trunk/examples/interceptors/endpoint/pom.xml Wed Mar 18 15:45:03 2009
@@ -0,0 +1,70 @@
+<?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.nmr.examples</groupId>
+        <artifactId>org.apache.servicemix.nmr.examples.interceptors</artifactId>
+        <version>1.0.0-SNAPSHOT</version>
+    </parent>
+
+    <groupId>org.apache.servicemix.nmr.examples.interceptors</groupId>
+    <artifactId>endpoint</artifactId>
+    <packaging>bundle</packaging>
+    <name>Apache ServiceMix NMR Example:: Endpoint Listener</name>
+
+    <dependencies>
+        <dependency>
+            <groupId>commons-logging</groupId>
+            <artifactId>commons-logging</artifactId>
+            <version>${commons.logging.version}</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.servicemix.nmr</groupId>
+            <artifactId>org.apache.servicemix.nmr.api</artifactId>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-bundle-plugin</artifactId>
+                <configuration>
+                    <instructions>
+                        <Bundle-SymbolicName>${pom.artifactId}</Bundle-SymbolicName>
+                        <Import-Package>
+                            org.apache.commons.logging,
+                            org.apache.servicemix.nmr.api,
+                            org.apache.servicemix.nmr.api.event,
+                            org.apache.servicemix.nmr.api.internal
+                        </Import-Package>
+                        <Private-Package>org.apache.servicemix.nmr.examples.interceptors.endpoint</Private-Package>
+                    </instructions>
+                </configuration>
+             </plugin>
+        </plugins>
+    </build>
+
+</project>

Added: servicemix/smx4/nmr/trunk/examples/interceptors/endpoint/src/main/java/org/apache/servicemix/nmr/examples/interceptors/endpoint/CustomEndpointListener.java
URL: http://svn.apache.org/viewvc/servicemix/smx4/nmr/trunk/examples/interceptors/endpoint/src/main/java/org/apache/servicemix/nmr/examples/interceptors/endpoint/CustomEndpointListener.java?rev=755620&view=auto
==============================================================================
--- servicemix/smx4/nmr/trunk/examples/interceptors/endpoint/src/main/java/org/apache/servicemix/nmr/examples/interceptors/endpoint/CustomEndpointListener.java (added)
+++ servicemix/smx4/nmr/trunk/examples/interceptors/endpoint/src/main/java/org/apache/servicemix/nmr/examples/interceptors/endpoint/CustomEndpointListener.java Wed Mar 18 15:45:03 2009
@@ -0,0 +1,55 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.servicemix.nmr.examples.interceptors.endpoint;
+
+import org.apache.servicemix.nmr.api.Endpoint;
+import org.apache.servicemix.nmr.api.event.EndpointListener;
+import org.apache.servicemix.nmr.api.internal.InternalEndpoint;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/**
+ * This listener will be called each time it receives events
+ * about new registered endpoints or endpoints being
+ * unregistered.
+ */
+public class CustomEndpointListener implements EndpointListener {
+
+    private static final transient Log LOG = LogFactory.getLog(CustomEndpointListener.class);
+
+    /**
+     * An endpoint has been registered
+     *
+     * @param endpoint the registered endpoint
+     */
+    public void endpointRegistered(InternalEndpoint endpoint) {
+        LOG.info("Endpoint Registered: ID: " + endpoint.getId() +
+                 " Meta-Data: " + endpoint.getMetaData().toString());
+    }
+
+    /**
+     * An endpoint has been unregistered
+     *
+     * @param endpoint the unregistered endpoint
+     */
+    public void endpointUnregistered(InternalEndpoint endpoint) {
+        LOG.info("Endpoint Unregistered: ID: " + endpoint.getId() +
+                 " Meta-Data: " + endpoint.getMetaData().toString());
+    }
+
+}

Propchange: servicemix/smx4/nmr/trunk/examples/interceptors/endpoint/src/main/java/org/apache/servicemix/nmr/examples/interceptors/endpoint/CustomEndpointListener.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: servicemix/smx4/nmr/trunk/examples/interceptors/endpoint/src/main/resources/META-INF/spring/beans.xml
URL: http://svn.apache.org/viewvc/servicemix/smx4/nmr/trunk/examples/interceptors/endpoint/src/main/resources/META-INF/spring/beans.xml?rev=755620&view=auto
==============================================================================
--- servicemix/smx4/nmr/trunk/examples/interceptors/endpoint/src/main/resources/META-INF/spring/beans.xml (added)
+++ servicemix/smx4/nmr/trunk/examples/interceptors/endpoint/src/main/resources/META-INF/spring/beans.xml Wed Mar 18 15:45:03 2009
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You under the Apache License, Version 2.0
+    (the "License"); you may not use this file except in compliance with
+    the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+-->
+
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xmlns:osgi="http://www.springframework.org/schema/osgi"
+       xmlns:util="http://www.springframework.org/schema/util"
+       xsi:schemaLocation="
+       http://www.springframework.org/schema/beans
+       http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
+       http://www.springframework.org/schema/util
+       http://www.springframework.org/schema/util/spring-util.xsd
+       http://www.springframework.org/schema/osgi
+       http://www.springframework.org/schema/osgi/spring-osgi.xsd
+       ">
+
+  <!-- Custom Endpoint Listener -->
+  <bean id="CustomEndpointListener" class="org.apache.servicemix.nmr.examples.interceptors.endpoint.CustomEndpointListener">
+  </bean>
+
+  <!-- Endpoint Listener -->
+  <osgi:service ref="CustomEndpointListener"> 
+      <osgi:interfaces>
+          <value>org.apache.servicemix.nmr.api.event.EndpointListener</value>
+          <value>org.apache.servicemix.nmr.api.event.Listener</value>
+      </osgi:interfaces>
+  </osgi:service>
+
+</beans>

Modified: servicemix/smx4/nmr/trunk/examples/interceptors/pom.xml
URL: http://svn.apache.org/viewvc/servicemix/smx4/nmr/trunk/examples/interceptors/pom.xml?rev=755620&r1=755619&r2=755620&view=diff
==============================================================================
--- servicemix/smx4/nmr/trunk/examples/interceptors/pom.xml (original)
+++ servicemix/smx4/nmr/trunk/examples/interceptors/pom.xml Wed Mar 18 15:45:03 2009
@@ -33,6 +33,7 @@
 
     <modules>
         <module>exchange</module>
+        <module>endpoint</module>
     </modules>
 
 </project>