[jboss-svn-commits] JBL Code SVN: r29911 - in labs/jbossesb/trunk/product: samples/quickstarts/webservice_proxy_basic and 3 other directories.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Tue Nov 3 11:29:39 EST 2009


Author: tfennelly
Date: 2009-11-03 11:29:38 -0500 (Tue, 03 Nov 2009)
New Revision: 29911

Added:
   labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/dependencies/WSDeploymentBarrierController.java
   labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/dependencies/WSDeploymentBarrierControllerMBean.java
   labs/jbossesb/trunk/product/samples/quickstarts/webservice_proxy_basic/wsbarrier-service.xml
   labs/jbossesb/trunk/product/samples/quickstarts/webservice_proxy_routed/wsbarrier-service.xml
   labs/jbossesb/trunk/product/samples/quickstarts/webservice_proxy_security/wsbarrier-service.xml
   labs/jbossesb/trunk/product/samples/quickstarts/webservice_proxy_versioning/wsbarrier-service.xml
Modified:
   labs/jbossesb/trunk/product/samples/quickstarts/webservice_proxy_basic/build.xml
   labs/jbossesb/trunk/product/samples/quickstarts/webservice_proxy_basic/deployment.xml
   labs/jbossesb/trunk/product/samples/quickstarts/webservice_proxy_routed/build.xml
   labs/jbossesb/trunk/product/samples/quickstarts/webservice_proxy_routed/deployment.xml
   labs/jbossesb/trunk/product/samples/quickstarts/webservice_proxy_security/build.xml
   labs/jbossesb/trunk/product/samples/quickstarts/webservice_proxy_security/deployment.xml
   labs/jbossesb/trunk/product/samples/quickstarts/webservice_proxy_versioning/build.xml
   labs/jbossesb/trunk/product/samples/quickstarts/webservice_proxy_versioning/deployment.xml
Log:
https://jira.jboss.org/jira/browse/JBESB-2870
war/esb archive deployment dependencies/ordering not guaranteed

Added: labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/dependencies/WSDeploymentBarrierController.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/dependencies/WSDeploymentBarrierController.java	                        (rev 0)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/dependencies/WSDeploymentBarrierController.java	2009-11-03 16:29:38 UTC (rev 29911)
@@ -0,0 +1,154 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * (C) 2005-2006, JBoss Inc.
+ */
+package org.jboss.internal.soa.esb.dependencies;
+
+import org.jboss.system.ListenerServiceMBeanSupport;
+import org.jboss.system.ServiceMBean;
+import org.jboss.system.ServiceMBeanSupport;
+import org.jboss.logging.Logger;
+import org.jboss.mx.server.ServerObjectInstance;
+
+import javax.management.*;
+import java.util.*;
+
+/**
+ * Webservice Deployment Barrier Controller Service MBean.
+ *
+ * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
+ */
+public class WSDeploymentBarrierController extends ListenerServiceMBeanSupport implements WSDeploymentBarrierControllerMBean {
+
+    private final static Logger logger = Logger.getLogger(WSDeploymentBarrierController.class);
+
+    private ObjectName wsObjectName;
+    private WSDeploymentBarrier wsDeploymentBarrier;
+
+    public void setWsObjectName(ObjectName wsObjectName) {
+        this.wsObjectName = wsObjectName;
+    }
+
+    protected void createService() throws Exception {
+        List<SubscriptionInfo> subscriptions = new ArrayList<SubscriptionInfo>();
+        ObjectName wsObjectName = new ObjectName("jboss.web:service=WebServer");
+
+        subscriptions.add(new SubscriptionInfo(wsObjectName, "WebServer", null));
+        subscribe(subscriptions, true, getServiceName());
+
+        // The WS may already be deployed.  If it is, need to add barrier bean for it...
+        registerExistingDeployment();
+    }
+
+    protected void destroyService() throws Exception {
+        unsubscribe();
+        if(wsDeploymentBarrier != null) {
+            unregisterBarrierMBean(toBarrierObjectName(wsObjectName));
+        }
+    }
+
+    private void handle(Notification notification) {
+        if(notification instanceof MBeanServerNotification) {
+            MBeanServerNotification mbServerNotification = (MBeanServerNotification) notification;
+
+            if(mbServerNotification.getMBeanName().equals(wsObjectName)) {
+                ObjectName barrierObjectName;
+
+                try {
+                    barrierObjectName = toBarrierObjectName(wsObjectName);
+                } catch (MalformedObjectNameException e) {
+                    logger.warn("Failed to create WS Deployment Barrier MBean ObjectName for WS deployment '" + wsObjectName + "'.", e);
+                    return;
+                }
+
+                if(notification.getType().equals(MBeanServerNotification.REGISTRATION_NOTIFICATION)) {
+                    registerBarrierMBean(barrierObjectName);
+                } else if(notification.getType().equals(MBeanServerNotification.UNREGISTRATION_NOTIFICATION)) {
+                    unregisterBarrierMBean(barrierObjectName);
+                }
+            }
+        }
+    }
+
+    private void registerBarrierMBean(ObjectName barrierObjectName) {
+        if(wsDeploymentBarrier != null) {
+            // Already registered.
+            return;
+        }
+
+        wsDeploymentBarrier = new WSDeploymentBarrier();
+        try {
+            getServer().registerMBean(wsDeploymentBarrier, barrierObjectName);
+            wsDeploymentBarrier.create();
+            wsDeploymentBarrier.start();
+            logger.debug("Registered WS Barrier: " + barrierObjectName);
+        } catch (Exception e) {
+            logger.warn("Failed to register WS Deployment Barrier MBean.", e);
+        }
+    }
+
+    private void unregisterBarrierMBean(ObjectName barrierObjectName) {
+        if(wsDeploymentBarrier == null) {
+            // Already unregistered.
+            return;
+        }
+
+        try {
+            wsDeploymentBarrier.stop();
+            wsDeploymentBarrier.destroy();
+            getServer().unregisterMBean(barrierObjectName);
+            logger.debug("Unregistered WS Barrier: " + barrierObjectName);
+        } catch (Exception e) {
+            logger.warn("Failed to unregister WS Deployment Barrier MBean.", e);
+        } finally {
+            wsDeploymentBarrier = null;
+        }
+    }
+
+    private void registerExistingDeployment() {
+        try {
+            Set<ServerObjectInstance> existingDeployments = getServer().queryMBeans(wsObjectName, null);
+
+            if(existingDeployments != null && !existingDeployments.isEmpty()) {
+                // It's already deployed.  Add the Barrier...
+                registerBarrierMBean(toBarrierObjectName(wsObjectName));
+            }
+        } catch (MalformedObjectNameException e) {
+            logger.warn("Failed to query existance of WS Barrier Object.", e);
+        }
+    }
+
+    private static ObjectName toBarrierObjectName(ObjectName wsName) throws MalformedObjectNameException {
+        return new ObjectName(wsName.getCanonicalName() + ".Barrier");
+    }
+
+    public void handleNotification(Notification notification, Object handback) {
+        handle(notification);
+        super.handleNotification(notification, handback);
+    }
+
+    public void handleNotification2(Notification notification, Object handback) {
+        handle(notification);
+        super.handleNotification2(notification, handback);
+    }
+
+    public static interface WSDeploymentBarrierMBean extends ServiceMBean {
+    }
+    public static class WSDeploymentBarrier extends ServiceMBeanSupport implements WSDeploymentBarrierMBean {
+    }
+}
\ No newline at end of file

Added: labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/dependencies/WSDeploymentBarrierControllerMBean.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/dependencies/WSDeploymentBarrierControllerMBean.java	                        (rev 0)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/dependencies/WSDeploymentBarrierControllerMBean.java	2009-11-03 16:29:38 UTC (rev 29911)
@@ -0,0 +1,34 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * (C) 2005-2006, JBoss Inc.
+ */
+package org.jboss.internal.soa.esb.dependencies;
+
+import org.jboss.system.ListenerServiceMBean;
+
+import javax.management.ObjectName;
+
+/**
+ * WS Deployment Barrier Controller Service MBean interface.
+ *
+ * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
+ */
+public interface WSDeploymentBarrierControllerMBean extends ListenerServiceMBean {
+
+    void setWsObjectName(ObjectName wsObjectName);
+}
\ No newline at end of file

Modified: labs/jbossesb/trunk/product/samples/quickstarts/webservice_proxy_basic/build.xml
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/webservice_proxy_basic/build.xml	2009-11-03 15:49:32 UTC (rev 29910)
+++ labs/jbossesb/trunk/product/samples/quickstarts/webservice_proxy_basic/build.xml	2009-11-03 16:29:38 UTC (rev 29911)
@@ -4,8 +4,10 @@
 		${ant.project.name}
 		${line.separator}
 	</description>
+    
+    <property name="additional.deploys" value="wsbarrier-service.xml" />
 
-	<!-- Import the base Ant build script... -->
+    <!-- Import the base Ant build script... -->
     <import file="../conf/base-build.xml"/>
 
     <property name="war.build.dir" location="${build.dir}/war/classes"/>
@@ -17,7 +19,6 @@
     <target name="quickstart-specific-predeploys">
 		<copy todir="${org.jboss.esb.server.deploy.dir}"
 			file="build/predeploy/${ant.project.name}_ws.war"/>
-		<sleep seconds="3"/>
 	</target>
 
     <target name="quickstart-specific-undeploys">

Modified: labs/jbossesb/trunk/product/samples/quickstarts/webservice_proxy_basic/deployment.xml
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/webservice_proxy_basic/deployment.xml	2009-11-03 15:49:32 UTC (rev 29910)
+++ labs/jbossesb/trunk/product/samples/quickstarts/webservice_proxy_basic/deployment.xml	2009-11-03 16:29:38 UTC (rev 29911)
@@ -1,4 +1,5 @@
 <jbossesb-deployment>
 	<depends>jboss.esb:deployment=soap.esb</depends>
+    <depends>jboss.ws:context=Quickstart_webservice_proxy_basic_ws,endpoint=HelloWorldWS.Barrier</depends>
 </jbossesb-deployment>
 

Added: labs/jbossesb/trunk/product/samples/quickstarts/webservice_proxy_basic/wsbarrier-service.xml
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/webservice_proxy_basic/wsbarrier-service.xml	                        (rev 0)
+++ labs/jbossesb/trunk/product/samples/quickstarts/webservice_proxy_basic/wsbarrier-service.xml	2009-11-03 16:29:38 UTC (rev 29911)
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<server>
+    <mbean code="org.jboss.internal.soa.esb.dependencies.WSDeploymentBarrierController" name="jboss.esb:service=HelloWorldWSBarrierController">
+        <attribute name="WsObjectName">jboss.ws:context=Quickstart_webservice_proxy_basic_ws,endpoint=HelloWorldWS</attribute>        
+    </mbean>
+</server>

Modified: labs/jbossesb/trunk/product/samples/quickstarts/webservice_proxy_routed/build.xml
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/webservice_proxy_routed/build.xml	2009-11-03 15:49:32 UTC (rev 29910)
+++ labs/jbossesb/trunk/product/samples/quickstarts/webservice_proxy_routed/build.xml	2009-11-03 16:29:38 UTC (rev 29911)
@@ -5,7 +5,7 @@
 		${line.separator}
 	</description>
 
-	<property name="additional.deploys" value="Proxy_Routed_Rules.drl"/>
+	<property name="additional.deploys" value="Proxy_Routed_Rules.drl wsbarrier-service.xml"/>
 
 	<!-- Import the base Ant build script... -->
     <import file="../conf/base-build.xml"/>

Modified: labs/jbossesb/trunk/product/samples/quickstarts/webservice_proxy_routed/deployment.xml
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/webservice_proxy_routed/deployment.xml	2009-11-03 15:49:32 UTC (rev 29910)
+++ labs/jbossesb/trunk/product/samples/quickstarts/webservice_proxy_routed/deployment.xml	2009-11-03 16:29:38 UTC (rev 29911)
@@ -7,5 +7,7 @@
 	<depends>jboss.esb.quickstart.destination:service=Queue,name=quickstart_webservice_proxy_routed_hello_esb_reply</depends>
 	<depends>jboss.esb.quickstart.destination:service=Queue,name=quickstart_webservice_proxy_routed_goodbye_esb</depends>
 	<depends>jboss.esb.quickstart.destination:service=Queue,name=quickstart_webservice_proxy_routed_goodbye_esb_reply</depends>
+    <depends>jboss.ws:context=Quickstart_webservice_proxy_routed-ws,endpoint=HelloWS.Barrier</depends>
+    <depends>jboss.ws:context=Quickstart_webservice_proxy_routed-ws,endpoint=GoodbyeWS.Barrier</depends>
 </jbossesb-deployment>
 

Added: labs/jbossesb/trunk/product/samples/quickstarts/webservice_proxy_routed/wsbarrier-service.xml
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/webservice_proxy_routed/wsbarrier-service.xml	                        (rev 0)
+++ labs/jbossesb/trunk/product/samples/quickstarts/webservice_proxy_routed/wsbarrier-service.xml	2009-11-03 16:29:38 UTC (rev 29911)
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<server>
+    <mbean code="org.jboss.internal.soa.esb.dependencies.WSDeploymentBarrierController" name="jboss.esb:service=HelloWSBarrierController">
+        <attribute name="WsObjectName">jboss.ws:context=Quickstart_webservice_proxy_routed-ws,endpoint=HelloWS</attribute>
+    </mbean>
+    <mbean code="org.jboss.internal.soa.esb.dependencies.WSDeploymentBarrierController" name="jboss.esb:service=GoodbyeWSBarrierController">
+        <attribute name="WsObjectName">jboss.ws:context=Quickstart_webservice_proxy_routed-ws,endpoint=GoodbyeWS</attribute>
+    </mbean>
+</server>

Modified: labs/jbossesb/trunk/product/samples/quickstarts/webservice_proxy_security/build.xml
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/webservice_proxy_security/build.xml	2009-11-03 15:49:32 UTC (rev 29910)
+++ labs/jbossesb/trunk/product/samples/quickstarts/webservice_proxy_security/build.xml	2009-11-03 16:29:38 UTC (rev 29911)
@@ -5,6 +5,8 @@
 		${line.separator}
 	</description>
 
+    <property name="additional.deploys" value="wsbarrier-service.xml"/>
+
 	<!-- Import the base Ant build script... -->
     <import file="../conf/base-build.xml"/>
 

Modified: labs/jbossesb/trunk/product/samples/quickstarts/webservice_proxy_security/deployment.xml
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/webservice_proxy_security/deployment.xml	2009-11-03 15:49:32 UTC (rev 29910)
+++ labs/jbossesb/trunk/product/samples/quickstarts/webservice_proxy_security/deployment.xml	2009-11-03 16:29:38 UTC (rev 29911)
@@ -1,4 +1,5 @@
 <jbossesb-deployment>
 	<depends>jboss.esb:deployment=soap.esb</depends>
+    <depends>jboss.ws:context=webservice_proxy_security,endpoint=HelloWorldWS.Barrier</depends>
 </jbossesb-deployment>
 

Added: labs/jbossesb/trunk/product/samples/quickstarts/webservice_proxy_security/wsbarrier-service.xml
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/webservice_proxy_security/wsbarrier-service.xml	                        (rev 0)
+++ labs/jbossesb/trunk/product/samples/quickstarts/webservice_proxy_security/wsbarrier-service.xml	2009-11-03 16:29:38 UTC (rev 29911)
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<server>
+    <mbean code="org.jboss.internal.soa.esb.dependencies.WSDeploymentBarrierController" name="jboss.esb:service=HelloWorldWSBarrierController">
+        <attribute name="WsObjectName">jboss.ws:context=webservice_proxy_security,endpoint=HelloWorldWS</attribute>        
+    </mbean>
+</server>

Modified: labs/jbossesb/trunk/product/samples/quickstarts/webservice_proxy_versioning/build.xml
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/webservice_proxy_versioning/build.xml	2009-11-03 15:49:32 UTC (rev 29910)
+++ labs/jbossesb/trunk/product/samples/quickstarts/webservice_proxy_versioning/build.xml	2009-11-03 16:29:38 UTC (rev 29911)
@@ -5,7 +5,7 @@
 		${line.separator}
 	</description>
 
-	<property name="additional.deploys" value="Proxy_Versioning_WsdlTransform.xml Proxy_Versioning_RequestTransform.xsl"/>
+	<property name="additional.deploys" value="Proxy_Versioning_WsdlTransform.xml Proxy_Versioning_RequestTransform.xsl wsbarrier-service.xml" />
 
 	<!-- Import the base Ant build script... -->
     <import file="../conf/base-build.xml"/>

Modified: labs/jbossesb/trunk/product/samples/quickstarts/webservice_proxy_versioning/deployment.xml
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/webservice_proxy_versioning/deployment.xml	2009-11-03 15:49:32 UTC (rev 29910)
+++ labs/jbossesb/trunk/product/samples/quickstarts/webservice_proxy_versioning/deployment.xml	2009-11-03 16:29:38 UTC (rev 29911)
@@ -1,4 +1,5 @@
 <jbossesb-deployment>
 	<depends>jboss.esb:deployment=soap.esb</depends>
+    <depends>jboss.ws:context=Quickstart_webservice_proxy_versioning-ws,endpoint=InvoicingWS.Barrier</depends>
 </jbossesb-deployment>
 

Added: labs/jbossesb/trunk/product/samples/quickstarts/webservice_proxy_versioning/wsbarrier-service.xml
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/webservice_proxy_versioning/wsbarrier-service.xml	                        (rev 0)
+++ labs/jbossesb/trunk/product/samples/quickstarts/webservice_proxy_versioning/wsbarrier-service.xml	2009-11-03 16:29:38 UTC (rev 29911)
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<server>
+    <mbean code="org.jboss.internal.soa.esb.dependencies.WSDeploymentBarrierController" name="jboss.esb:service=InvoicingWSBarrierController">
+        <attribute name="WsObjectName">jboss.ws:context=Quickstart_webservice_proxy_versioning-ws,endpoint=InvoicingWS</attribute>        
+    </mbean>
+</server>



More information about the jboss-svn-commits mailing list