Author: jim.ma
Date: 2010-04-28 23:26:44 -0400 (Wed, 28 Apr 2010)
New Revision: 12122
Added:
container/jboss50/branches/jbossws-jboss510-jms-integration/src/main/java/org/jboss/webservices/integration/deployers/WSEndpointsRealDeployer.java
Modified:
container/jboss50/branches/jbossws-jboss510-jms-integration/src/main/resources/jbossws-jboss.deployer/META-INF/stack-agnostic-jboss-beans.xml
Log:
[JBWS-2791]:Added the demand to BeanMetaData in As5 WSEndpointsRealDeployer to deploy jms
queue/topic first
Added:
container/jboss50/branches/jbossws-jboss510-jms-integration/src/main/java/org/jboss/webservices/integration/deployers/WSEndpointsRealDeployer.java
===================================================================
---
container/jboss50/branches/jbossws-jboss510-jms-integration/src/main/java/org/jboss/webservices/integration/deployers/WSEndpointsRealDeployer.java
(rev 0)
+++
container/jboss50/branches/jbossws-jboss510-jms-integration/src/main/java/org/jboss/webservices/integration/deployers/WSEndpointsRealDeployer.java 2010-04-29
03:26:44 UTC (rev 12122)
@@ -0,0 +1,106 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY 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 along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.webservices.integration.deployers;
+
+import java.util.Map;
+
+import org.jboss.beans.metadata.plugins.builder.BeanMetaDataBuilderFactory;
+import org.jboss.beans.metadata.spi.BeanMetaData;
+import org.jboss.beans.metadata.spi.builder.BeanMetaDataBuilder;
+import org.jboss.dependency.spi.ControllerState;
+import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.deployers.spi.deployer.helpers.AbstractRealDeployer;
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.system.metadata.ServiceDependencyMetaData;
+import org.jboss.system.metadata.ServiceDeployment;
+import org.jboss.system.metadata.ServiceMetaData;
+import org.jboss.util.id.GUID;
+import org.jboss.webservices.integration.util.ASHelper;
+import org.jboss.wsf.common.integration.WSHelper;
+import org.jboss.wsf.spi.deployment.Deployment;
+import org.jboss.wsf.spi.metadata.endpoints.AbstractEndpointsDeployment;
+
+public class WSEndpointsRealDeployer extends AbstractRealDeployer
+{
+ /**
+ * Constructor.
+ */
+ public WSEndpointsRealDeployer()
+ {
+ super();
+
+ // inputs
+ this.addInput("jbossws.metadata");
+
+ // outputs
+ this.addOutput(BeanMetaData.class);
+ }
+
+ /**
+ * Create BeanMetaData for endpoints deployment
+ *
+ * @param unit deployment unit
+ * @throws DeploymentException if any error occurs
+ */
+ @Override
+ protected void internalDeploy(final DeploymentUnit unit) throws DeploymentException
+ {
+
+ if (ASHelper.getOptionalAttachment(unit, Deployment.class) != null) {
+ Deployment dep = unit.getAttachment(Deployment.class);
+ if (WSHelper.getOptionalAttachment(dep, AbstractEndpointsDeployment.class) !=
null)
+ {
+ log.debug("Creating BeanMetaData for endpoints deployment");
+ AbstractEndpointsDeployment endpointsDep =
dep.getAttachment(AbstractEndpointsDeployment.class);
+ BeanMetaData beanMetaData = createBeanMetadata(unit, endpointsDep);
+ //it will be deployed by KernelDeploymentDeployer
+ unit.addAttachment(unit.getSimpleName() + "EndpointsBeanMetaData",
beanMetaData);
+ }
+ }
+ }
+
+ private BeanMetaData createBeanMetadata(DeploymentUnit unit,
AbstractEndpointsDeployment deploymentEndpoint)
+ {
+ String name = GUID.asString() + "EndpointsDeploymentBean";
+ BeanMetaDataBuilder builder = BeanMetaDataBuilderFactory.createBuilder(name,
deploymentEndpoint.getClass().getName());
+ builder.addPropertyMetaData("URL", deploymentEndpoint.getURL());
+ builder.addPropertyMetaData("endpointsMetaData",
deploymentEndpoint.getEndpointsMetaData());
+ builder.addPropertyMetaData("deployment",
deploymentEndpoint.getDeployment());
+
+ for (Map.Entry<String, Object> entry : unit.getAttachments().entrySet())
+ {
+ if (entry.getValue() instanceof ServiceDeployment)
+ {
+ ServiceDeployment serviceDeployment = (ServiceDeployment)entry.getValue();
+ for (ServiceMetaData serviceMetaData : serviceDeployment.getServices())
+ {
+ //add the demand to deploy the service first: eg. jms queue/topic
+ builder.addDemand(serviceMetaData.getObjectName().toString(),
ControllerState.PRE_INSTALL, ControllerState.INSTALLED, null);
+ }
+ }
+
+ }
+
+ return builder.getBeanMetaData();
+
+ }
+}
Modified:
container/jboss50/branches/jbossws-jboss510-jms-integration/src/main/resources/jbossws-jboss.deployer/META-INF/stack-agnostic-jboss-beans.xml
===================================================================
---
container/jboss50/branches/jbossws-jboss510-jms-integration/src/main/resources/jbossws-jboss.deployer/META-INF/stack-agnostic-jboss-beans.xml 2010-04-28
14:13:26 UTC (rev 12121)
+++
container/jboss50/branches/jbossws-jboss510-jms-integration/src/main/resources/jbossws-jboss.deployer/META-INF/stack-agnostic-jboss-beans.xml 2010-04-29
03:26:44 UTC (rev 12122)
@@ -60,6 +60,10 @@
<property name="name">jbossws-endpoints.xml</property>
<property name="useSchemaValidation">true</property>
</bean>
+
+
+ <bean name="WSEndpointsRealDeployer"
class="org.jboss.webservices.integration.deployers.WSEndpointsRealDeployer"/>
+
<bean name="WSEJBAdapterDeployer"
class="org.jboss.webservices.integration.deployers.WSEJBAdapterDeployer"/>
@@ -141,7 +145,6 @@
<property name="requires">EndpointName</property>
<property name="provides">RegisteredEndpoint</property>
<property name="relativeOrder">35</property> <!--
[JBDEPLOY-201] workaround -->
- <property name="processEndpointDeployment">true</property>
</bean>
<bean name="WSURLPatternDeploymentAspect"
class="org.jboss.wsf.framework.deployment.URLPatternDeploymentAspect">