servicemix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kkoeh...@apache.org
Subject svn commit: r604222 - in /servicemix/smx3/trunk/platforms/geronimo: servicemix-service/ servicemix-service/src/main/java/org/apache/servicemix/geronimo/ servicemix-service/src/main/java/org/apache/servicemix/geronimo/flow/ servicemix/ servicemix/src/plan/
Date Fri, 14 Dec 2007 16:43:33 GMT
Author: kkoehler
Date: Fri Dec 14 08:43:32 2007
New Revision: 604222

URL: http://svn.apache.org/viewvc?rev=604222&view=rev
Log:
SM-1150: Additional Flow configuration for Geronimo ServiceMix Service

This commit adds the feature to configure servicemix flows with a geronimo plan. the jms flow
is currently configured as default flow.

Added:
    servicemix/smx3/trunk/platforms/geronimo/servicemix-service/src/main/java/org/apache/servicemix/geronimo/flow/
    servicemix/smx3/trunk/platforms/geronimo/servicemix-service/src/main/java/org/apache/servicemix/geronimo/flow/JCAFlowGBean.java
    servicemix/smx3/trunk/platforms/geronimo/servicemix-service/src/main/java/org/apache/servicemix/geronimo/flow/JMSFlowGBean.java
    servicemix/smx3/trunk/platforms/geronimo/servicemix-service/src/main/java/org/apache/servicemix/geronimo/flow/StFlowGBean.java
Modified:
    servicemix/smx3/trunk/platforms/geronimo/servicemix-service/pom.xml
    servicemix/smx3/trunk/platforms/geronimo/servicemix-service/src/main/java/org/apache/servicemix/geronimo/ServiceMixGBean.java
    servicemix/smx3/trunk/platforms/geronimo/servicemix/pom.xml
    servicemix/smx3/trunk/platforms/geronimo/servicemix/src/plan/geronimo-service.xml

Modified: servicemix/smx3/trunk/platforms/geronimo/servicemix-service/pom.xml
URL: http://svn.apache.org/viewvc/servicemix/smx3/trunk/platforms/geronimo/servicemix-service/pom.xml?rev=604222&r1=604221&r2=604222&view=diff
==============================================================================
--- servicemix/smx3/trunk/platforms/geronimo/servicemix-service/pom.xml (original)
+++ servicemix/smx3/trunk/platforms/geronimo/servicemix-service/pom.xml Fri Dec 14 08:43:32
2007
@@ -30,6 +30,10 @@
     <artifactId>servicemix-service</artifactId>
     <name>ServiceMix :: Geronimo :: ServiceMix service</name>
 
+    <properties>
+        <activemq-version>4.1.1</activemq-version>
+    </properties>
+
     <dependencies>
         <dependency>
             <groupId>org.apache.servicemix</groupId>
@@ -40,13 +44,30 @@
             <groupId>org.apache.geronimo.modules</groupId>
             <artifactId>geronimo-kernel</artifactId>
             <version>${geronimo-version}</version>
-			<scope>provided</scope>
+            <scope>provided</scope>
         </dependency>
         <dependency>
             <groupId>org.apache.geronimo.modules</groupId>
             <artifactId>geronimo-naming</artifactId>
             <version>${geronimo-version}</version>
         </dependency>
+        <dependency>
+            <groupId>org.apache.geronimo.modules</groupId>
+            <artifactId>geronimo-connector</artifactId>
+            <version>${geronimo-version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.geronimo.modules</groupId>
+            <artifactId>geronimo-management</artifactId>
+            <version>${geronimo-version}</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.activemq</groupId>
+            <artifactId>activemq-ra</artifactId>
+            <version>${activemq-version}</version>
+        </dependency>
+
     </dependencies>
 
 </project>

Modified: servicemix/smx3/trunk/platforms/geronimo/servicemix-service/src/main/java/org/apache/servicemix/geronimo/ServiceMixGBean.java
URL: http://svn.apache.org/viewvc/servicemix/smx3/trunk/platforms/geronimo/servicemix-service/src/main/java/org/apache/servicemix/geronimo/ServiceMixGBean.java?rev=604222&r1=604221&r2=604222&view=diff
==============================================================================
--- servicemix/smx3/trunk/platforms/geronimo/servicemix-service/src/main/java/org/apache/servicemix/geronimo/ServiceMixGBean.java
(original)
+++ servicemix/smx3/trunk/platforms/geronimo/servicemix-service/src/main/java/org/apache/servicemix/geronimo/ServiceMixGBean.java
Fri Dec 14 08:43:32 2007
@@ -17,6 +17,7 @@
 package org.apache.servicemix.geronimo;
 
 import java.io.File;
+import java.util.HashSet;
 import java.util.Set;
 
 import javax.jbi.JBIException;
@@ -39,27 +40,32 @@
 import org.apache.servicemix.jbi.framework.ComponentMBeanImpl;
 import org.apache.servicemix.jbi.framework.ComponentNameSpace;
 import org.apache.servicemix.jbi.framework.ServiceAssemblyLifeCycle;
+import org.apache.servicemix.jbi.nmr.flow.Flow;
 
 public class ServiceMixGBean implements GBeanLifecycle, Container {
 
     private Log log = LogFactory.getLog(getClass().getName());
     
     private JBIContainer container;
+    private boolean persistent = false;
     private String name;
     private String directory;
     private final AbstractNameQuery transactionManagerName;
+    private final AbstractNameQuery flows;
     private Kernel kernel;
 
     public static final GBeanInfo GBEAN_INFO;
 
     static {
-        GBeanInfoBuilder infoFactory = new GBeanInfoBuilder("ServiceMix JBI Container", ServiceMixGBean.class,
"JBIContainer");
+        GBeanInfoBuilder infoFactory = new GBeanInfoBuilder("ServiceMixJBIContainer", ServiceMixGBean.class,
"JBIContainer");
         infoFactory.addInterface(Container.class);
         infoFactory.addAttribute("name", String.class, true);
+        infoFactory.addAttribute("persistent", boolean.class, true);
         infoFactory.addAttribute("directory", String.class, true);
         infoFactory.addAttribute("transactionManager", AbstractNameQuery.class, true, true);
+        infoFactory.addAttribute("flows", AbstractNameQuery.class, true, true);
         infoFactory.addAttribute("kernel", Kernel.class, false);
-        infoFactory.setConstructor(new String[]{"name", "directory", "transactionManager",
"kernel"});
+        infoFactory.setConstructor(new String[]{"name", "directory", "transactionManager",
"flows", "kernel"});
         GBEAN_INFO = infoFactory.getBeanInfo();
     }
 
@@ -69,11 +75,13 @@
 
     public ServiceMixGBean(String name, 
                            String directory, 
-                           AbstractNameQuery transactionManagerName, 
+                           AbstractNameQuery transactionManagerName,
+                           AbstractNameQuery flows,
                            Kernel kernel) {
         this.name = name;
         this.directory = directory;
         this.transactionManagerName = transactionManagerName;
+        this.flows = flows;
         this.kernel = kernel;
         if (log.isDebugEnabled()) {
             log.debug("ServiceMixGBean created");
@@ -81,11 +89,20 @@
     }
     
     /**
+     * Sets the persistent flag
+     * 
+     * @param persistent flag for the JBIContainer
+     */
+    public void setPersistent(boolean persistent) {
+        this.persistent = persistent;
+    }
+    
+    /**
      * Starts the GBean.  This informs the GBean that it is about to transition to the running
state.
      *
      * @throws Exception if the target failed to start; this will cause a transition to the
failed state
      */
-    public void doStart() throws Exception {
+    public void doStart() throws Exception {        
         if (log.isDebugEnabled()) {
             log.debug("ServiceMixGBean doStart");
         }
@@ -101,6 +118,7 @@
         } finally {
             Thread.currentThread().setContextClassLoader(old);
         }
+
     }
 
     /**
@@ -144,6 +162,7 @@
 
     private JBIContainer createContainer() throws GBeanNotFoundException {
         JBIContainer container = new JBIContainer();
+        
         container.setUseShutdownHook(false);
         container.setName(name);
         container.setRootDir(directory);
@@ -152,6 +171,13 @@
         container.setTransactionManager(tm);
         container.setMonitorInstallationDirectory(false);
         container.setMonitorDeploymentDirectory(false);
+        
+        container.setPersistent(persistent);
+        
+        if (flows != null) {
+            container.setFlows(getFlows());
+        }
+
         return container;
     }
     
@@ -169,6 +195,29 @@
     }
 
     /**
+     * Determines the configured Flows and starts them if necessary
+     * 
+     * @return Flow Array
+     * @throws GBeanNotFoundException
+     */
+    @SuppressWarnings("unchecked")
+    private Flow[] getFlows() throws GBeanNotFoundException {
+        
+        Set<Flow> flowSet = new HashSet<Flow>();
+        
+        Set<AbstractName> listGBeans = kernel.listGBeans(flows);
+        for (AbstractName name: listGBeans) {
+            if (!kernel.isRunning(name)) {
+                kernel.startGBean(name);
+            }
+            Flow flow = (Flow) kernel.getGBean(name);
+            flowSet.add(flow);
+        }
+        
+        return flowSet.toArray(new Flow[0]);
+    }
+    
+    /**
      * Returns the JBIContainer
      * 
      * @return JBIContainer
@@ -224,8 +273,11 @@
     public void unregister(ServiceAssembly assembly) throws Exception {
         ServiceAssemblyLifeCycle salc = container.getRegistry().getServiceAssembly(assembly.getName());
         salc.shutDown(false);
+
         assembly.undeploySus();
+
         container.getRegistry().unregisterServiceAssembly(assembly.getName());
+
     }
 
 }

Added: servicemix/smx3/trunk/platforms/geronimo/servicemix-service/src/main/java/org/apache/servicemix/geronimo/flow/JCAFlowGBean.java
URL: http://svn.apache.org/viewvc/servicemix/smx3/trunk/platforms/geronimo/servicemix-service/src/main/java/org/apache/servicemix/geronimo/flow/JCAFlowGBean.java?rev=604222&view=auto
==============================================================================
--- servicemix/smx3/trunk/platforms/geronimo/servicemix-service/src/main/java/org/apache/servicemix/geronimo/flow/JCAFlowGBean.java
(added)
+++ servicemix/smx3/trunk/platforms/geronimo/servicemix-service/src/main/java/org/apache/servicemix/geronimo/flow/JCAFlowGBean.java
Fri Dec 14 08:43:32 2007
@@ -0,0 +1,51 @@
+/*
+ * 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.geronimo.flow;
+
+import org.apache.geronimo.gbean.GBeanInfo;
+import org.apache.geronimo.gbean.GBeanInfoBuilder;
+import org.apache.geronimo.kernel.Kernel;
+import org.apache.servicemix.jbi.nmr.flow.jca.JCAFlow;
+
+/**
+ * Wrapper GBean for ServiceMix JCAFlow Bean
+ */
+public class JCAFlowGBean extends JCAFlow {
+
+    private final Kernel kernel;
+
+    public JCAFlowGBean(Kernel kernel) {
+        this.kernel = kernel;
+    }
+    
+    public static final GBeanInfo GBEAN_INFO;
+    
+    static {
+        GBeanInfoBuilder infoFactory = new GBeanInfoBuilder("JCAFlow",
+                JCAFlowGBean.class, "ServiceMixFlow");
+        
+        infoFactory.addAttribute("jmsURL", String.class, true);
+        infoFactory.addAttribute("broadcastDestinationName", String.class, true);
+        infoFactory.setConstructor(new String[] { "kernel" });
+        GBEAN_INFO = infoFactory.getBeanInfo();
+    }
+
+    public static GBeanInfo getGBeanInfo() {
+        return GBEAN_INFO;
+    }
+
+}

Added: servicemix/smx3/trunk/platforms/geronimo/servicemix-service/src/main/java/org/apache/servicemix/geronimo/flow/JMSFlowGBean.java
URL: http://svn.apache.org/viewvc/servicemix/smx3/trunk/platforms/geronimo/servicemix-service/src/main/java/org/apache/servicemix/geronimo/flow/JMSFlowGBean.java?rev=604222&view=auto
==============================================================================
--- servicemix/smx3/trunk/platforms/geronimo/servicemix-service/src/main/java/org/apache/servicemix/geronimo/flow/JMSFlowGBean.java
(added)
+++ servicemix/smx3/trunk/platforms/geronimo/servicemix-service/src/main/java/org/apache/servicemix/geronimo/flow/JMSFlowGBean.java
Fri Dec 14 08:43:32 2007
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.servicemix.geronimo.flow;
+
+import org.apache.geronimo.gbean.GBeanInfo;
+import org.apache.geronimo.gbean.GBeanInfoBuilder;
+import org.apache.geronimo.kernel.Kernel;
+import org.apache.servicemix.jbi.nmr.flow.jms.JMSFlow;
+
+/**
+ * Wrapper GBean for ServiceMix JMSFlow Bean
+ */
+public class JMSFlowGBean extends JMSFlow {
+
+    private final Kernel kernel;
+    
+    public JMSFlowGBean(Kernel kernel) {
+        this.kernel = kernel;
+    }
+
+    public static final GBeanInfo GBEAN_INFO;
+        
+    static {
+        GBeanInfoBuilder infoFactory = new GBeanInfoBuilder("JMSFlow",
+                JMSFlowGBean.class, "ServiceMixFlow");
+        
+        infoFactory.addAttribute("jmsURL", String.class, true);
+        infoFactory.addAttribute("broadcastDestinationName", String.class, true);
+        infoFactory.setConstructor(new String[] { "kernel" });
+        GBEAN_INFO = infoFactory.getBeanInfo();
+    }
+
+    public static GBeanInfo getGBeanInfo() {
+        return GBEAN_INFO;
+    }
+}

Added: servicemix/smx3/trunk/platforms/geronimo/servicemix-service/src/main/java/org/apache/servicemix/geronimo/flow/StFlowGBean.java
URL: http://svn.apache.org/viewvc/servicemix/smx3/trunk/platforms/geronimo/servicemix-service/src/main/java/org/apache/servicemix/geronimo/flow/StFlowGBean.java?rev=604222&view=auto
==============================================================================
--- servicemix/smx3/trunk/platforms/geronimo/servicemix-service/src/main/java/org/apache/servicemix/geronimo/flow/StFlowGBean.java
(added)
+++ servicemix/smx3/trunk/platforms/geronimo/servicemix-service/src/main/java/org/apache/servicemix/geronimo/flow/StFlowGBean.java
Fri Dec 14 08:43:32 2007
@@ -0,0 +1,40 @@
+/*
+ * 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.geronimo.flow;
+
+import org.apache.geronimo.gbean.GBeanInfo;
+import org.apache.geronimo.gbean.GBeanInfoBuilder;
+import org.apache.servicemix.jbi.nmr.flow.st.STFlow;
+
+/**
+ * Wrapper GBean for ServiceMix StFlow Bean
+ */
+public class StFlowGBean extends STFlow {
+
+    public static final GBeanInfo GBEAN_INFO;
+    
+    static {
+        GBeanInfoBuilder infoFactory = new GBeanInfoBuilder("StFlow", StFlowGBean.class,
"ServiceMixFlow");
+        infoFactory.setConstructor(new String[] {});
+        GBEAN_INFO = infoFactory.getBeanInfo();
+    }
+
+    public static GBeanInfo getGBeanInfo() {
+        return GBEAN_INFO;
+    }
+    
+}

Modified: servicemix/smx3/trunk/platforms/geronimo/servicemix/pom.xml
URL: http://svn.apache.org/viewvc/servicemix/smx3/trunk/platforms/geronimo/servicemix/pom.xml?rev=604222&r1=604221&r2=604222&view=diff
==============================================================================
--- servicemix/smx3/trunk/platforms/geronimo/servicemix/pom.xml (original)
+++ servicemix/smx3/trunk/platforms/geronimo/servicemix/pom.xml Fri Dec 14 08:43:32 2007
@@ -32,6 +32,13 @@
     <packaging>car</packaging>
 
     <dependencies>
+
+        <dependency>
+            <groupId>org.apache.geronimo.specs</groupId>
+            <artifactId>geronimo-jta_1.1_spec</artifactId>
+            <version>1.1</version>
+        </dependency>
+
         <!-- Needed to download Geronimo dependencies -->
         <dependency>
             <groupId>org.apache.servicemix.geronimo</groupId>
@@ -63,7 +70,7 @@
 
         <dependency>
             <groupId>org.apache.servicemix</groupId>
-			<artifactId>servicemix-components</artifactId>
+            <artifactId>servicemix-components</artifactId>
             <version>${version}</version>
         </dependency>
 
@@ -73,6 +80,11 @@
         </dependency>
         <dependency>
             <groupId>org.apache.activemq</groupId>
+            <artifactId>activemq-ra</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.activemq</groupId>
             <artifactId>activeio-core</artifactId>
         </dependency>
         <dependency>
@@ -88,6 +100,14 @@
             <artifactId>commons-beanutils-core</artifactId>
         </dependency>
         <dependency>
+            <groupId>commons-pool</groupId>
+            <artifactId>commons-pool</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>commons-collections</groupId>
+            <artifactId>commons-collections</artifactId>
+        </dependency>
+        <dependency>
             <groupId>backport-util-concurrent</groupId>
             <artifactId>backport-util-concurrent</artifactId>
         </dependency>
@@ -171,7 +191,7 @@
             <artifactId>geronimo-gbean-deployer</artifactId>
             <version>${geronimo-version}</version>
             <type>car</type>
-			<scope>provided</scope>
+            <scope>provided</scope>
         </dependency>
     </dependencies>
 

Modified: servicemix/smx3/trunk/platforms/geronimo/servicemix/src/plan/geronimo-service.xml
URL: http://svn.apache.org/viewvc/servicemix/smx3/trunk/platforms/geronimo/servicemix/src/plan/geronimo-service.xml?rev=604222&r1=604221&r2=604222&view=diff
==============================================================================
--- servicemix/smx3/trunk/platforms/geronimo/servicemix/src/plan/geronimo-service.xml (original)
+++ servicemix/smx3/trunk/platforms/geronimo/servicemix/src/plan/geronimo-service.xml Fri
Dec 14 08:43:32 2007
@@ -22,9 +22,19 @@
 -->
 <module xmlns="http://geronimo.apache.org/xml/ns/deployment-${geronimoSchemaVersion}">
 
+    <gbean name="JMSFlow" class="org.apache.servicemix.geronimo.flow.JMSFlowGBean">
+        <attribute name="jmsURL">tcp://localhost:61616</attribute>
+        <attribute name="broadcastDestinationName">org.apache.servicemix.JMSFlow</attribute>
+    </gbean>
+
+    <gbean name="StFlow" class="org.apache.servicemix.geronimo.flow.StFlowGBean">
+    </gbean>
+
     <gbean name="ServiceMixJBIContainer" class="org.apache.servicemix.geronimo.ServiceMixGBean">
         <attribute name="name">servicemix</attribute>
+        <attribute name="persistent">true</attribute>
         <attribute name="transactionManager">?name=TransactionManager</attribute>
+        <attribute name="flows">?j2eeType=ServiceMixFlow</attribute>
         <!-- relative to bin directory -->
         <attribute name="directory">../var/servicemix</attribute>
     </gbean>



Mime
View raw message