Author: jim.ma
Date: 2010-04-27 01:44:25 -0400 (Tue, 27 Apr 2010)
New Revision: 12120
Added:
container/jboss60/branches/jbossws-jboss600M2-jms-integration/src/main/java/org/jboss/webservices/integration/deployers/WSEndpointsDescriptorParserDeployer.java
container/jboss60/branches/jbossws-jboss600M2-jms-integration/src/main/java/org/jboss/webservices/integration/deployers/WSEndpointsRealDeployer.java
Modified:
container/jboss60/branches/jbossws-jboss600M2-jms-integration/src/main/java/org/jboss/webservices/integration/deployers/deployment/WSDeploymentBuilder.java
container/jboss60/branches/jbossws-jboss600M2-jms-integration/src/main/java/org/jboss/webservices/integration/util/ASHelper.java
container/jboss60/branches/jbossws-jboss600M2-jms-integration/src/main/resources/jbossws-jboss.deployer/META-INF/stack-agnostic-jboss-beans.xml
Log:
[JBWS-2791]:Added the deployers to parse and deploy jbossws-endpoints.xml
Added:
container/jboss60/branches/jbossws-jboss600M2-jms-integration/src/main/java/org/jboss/webservices/integration/deployers/WSEndpointsDescriptorParserDeployer.java
===================================================================
---
container/jboss60/branches/jbossws-jboss600M2-jms-integration/src/main/java/org/jboss/webservices/integration/deployers/WSEndpointsDescriptorParserDeployer.java
(rev 0)
+++
container/jboss60/branches/jbossws-jboss600M2-jms-integration/src/main/java/org/jboss/webservices/integration/deployers/WSEndpointsDescriptorParserDeployer.java 2010-04-27
05:44:25 UTC (rev 12120)
@@ -0,0 +1,58 @@
+/*
+ * 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 org.jboss.deployers.vfs.spi.deployer.ObjectModelFactoryDeployer;
+import org.jboss.wsf.spi.metadata.endpoints.EndpointsFactory;
+import org.jboss.wsf.spi.metadata.endpoints.EndpointsMetaData;
+import org.jboss.xb.binding.ObjectModelFactory;
+
+/**
+ * jbsssws-endpoints.xml Parser
+ *
+ * @author <a href="ema(a)redhat.com">Jim Ma</a>
+ */
+public class WSEndpointsDescriptorParserDeployer extends
ObjectModelFactoryDeployer<EndpointsMetaData>
+{
+
+ /**
+ * Constructor.
+ */
+ public WSEndpointsDescriptorParserDeployer()
+ {
+ super(EndpointsMetaData.class);
+ }
+
+ /**
+ * Model factory generator.
+ *
+ * @param root object tree root
+ * @return object model factory
+ */
+ @Override
+ protected ObjectModelFactory getObjectModelFactory(final EndpointsMetaData root)
+ {
+ this.log.debug("Creating endpoints descrptor factory");
+ return new EndpointsFactory(null);
+ }
+
+}
Added:
container/jboss60/branches/jbossws-jboss600M2-jms-integration/src/main/java/org/jboss/webservices/integration/deployers/WSEndpointsRealDeployer.java
===================================================================
---
container/jboss60/branches/jbossws-jboss600M2-jms-integration/src/main/java/org/jboss/webservices/integration/deployers/WSEndpointsRealDeployer.java
(rev 0)
+++
container/jboss60/branches/jbossws-jboss600M2-jms-integration/src/main/java/org/jboss/webservices/integration/deployers/WSEndpointsRealDeployer.java 2010-04-27
05:44:25 UTC (rev 12120)
@@ -0,0 +1,102 @@
+/*
+ * 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.deployers.spi.DeploymentException;
+import org.jboss.deployers.spi.deployer.helpers.AbstractRealDeployer;
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+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
+{
+ private final String JMS_DEPLOYMENT_PACKAGE_NAME =
"org.jboss.as.integration.hornetq.deployers.pojo.";
+ /**
+ * 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 BeanMetaData)
+ {
+ BeanMetaData beanMetaData = (BeanMetaData)entry.getValue();
+ if (beanMetaData.getBean().startsWith(JMS_DEPLOYMENT_PACKAGE_NAME))
+ {
+ //deploy jms first
+ builder.addDependency(entry.getKey());
+ }
+ }
+ }
+
+ return builder.getBeanMetaData();
+
+ }
+}
Modified:
container/jboss60/branches/jbossws-jboss600M2-jms-integration/src/main/java/org/jboss/webservices/integration/deployers/deployment/WSDeploymentBuilder.java
===================================================================
---
container/jboss60/branches/jbossws-jboss600M2-jms-integration/src/main/java/org/jboss/webservices/integration/deployers/deployment/WSDeploymentBuilder.java 2010-04-27
03:15:38 UTC (rev 12119)
+++
container/jboss60/branches/jbossws-jboss600M2-jms-integration/src/main/java/org/jboss/webservices/integration/deployers/deployment/WSDeploymentBuilder.java 2010-04-27
05:44:25 UTC (rev 12120)
@@ -26,7 +26,12 @@
import org.jboss.deployers.structure.spi.DeploymentUnit;
import org.jboss.webservices.integration.util.ASHelper;
+import org.jboss.wsf.spi.SPIProvider;
+import org.jboss.wsf.spi.SPIProviderResolver;
+import org.jboss.wsf.spi.deployment.Deployment;
+import org.jboss.wsf.spi.deployment.DeploymentModelFactory;
import org.jboss.wsf.spi.deployment.Deployment.DeploymentType;
+import org.jboss.wsf.spi.metadata.endpoints.EndpointsMetaData;
/**
* JBossWS deployment model builder.
@@ -81,6 +86,28 @@
{
WSDeploymentBuilder.builders.get(deploymentType).newDeploymentModel(unit);
}
+ //if the DeploymentUnit contains jbossws-endpoints.xml (jms endpoints)
+ if (ASHelper.hasAttachment(unit, EndpointsMetaData.class))
+ {
+ Deployment dep = ASHelper.getOptionalAttachment(unit, Deployment.class);
+ if (dep == null)
+ {
+ dep = buildDeploymentFromEndpointsMetaData(unit);
+ }
+
+ EndpointsMetaData endpointsMetaData = ASHelper.getRequiredAttachment(unit,
EndpointsMetaData.class);
+ dep.addAttachment(EndpointsMetaData.class, endpointsMetaData);
+ dep.setRuntimeClassLoader(unit.getClassLoader());
+ unit.addAttachment(Deployment.class, dep);
+ }
}
-
+
+ private Deployment buildDeploymentFromEndpointsMetaData(DeploymentUnit unit)
+ {
+ SPIProvider spiProvider = SPIProviderResolver.getInstance().getProvider();
+ DeploymentModelFactory deploymentModelFactory =
spiProvider.getSPI(DeploymentModelFactory.class);
+ Deployment dep = deploymentModelFactory.newDeployment(unit.getSimpleName(),
unit.getClassLoader());
+ //There is no SPI Endpoint created and also there is no DeploymentType
+ return dep;
+ }
}
Modified:
container/jboss60/branches/jbossws-jboss600M2-jms-integration/src/main/java/org/jboss/webservices/integration/util/ASHelper.java
===================================================================
---
container/jboss60/branches/jbossws-jboss600M2-jms-integration/src/main/java/org/jboss/webservices/integration/util/ASHelper.java 2010-04-27
03:15:38 UTC (rev 12119)
+++
container/jboss60/branches/jbossws-jboss600M2-jms-integration/src/main/java/org/jboss/webservices/integration/util/ASHelper.java 2010-04-27
05:44:25 UTC (rev 12120)
@@ -36,6 +36,7 @@
import org.jboss.metadata.web.jboss.JBossServletMetaData;
import org.jboss.metadata.web.jboss.JBossWebMetaData;
import org.jboss.metadata.web.spec.ServletMetaData;
+import org.jboss.wsf.spi.deployment.Deployment;
import org.jboss.wsf.spi.deployment.Deployment.DeploymentType;
import org.jboss.wsf.spi.deployment.integration.WebServiceDeclaration;
import org.jboss.wsf.spi.deployment.integration.WebServiceDeployment;
@@ -72,7 +73,7 @@
*/
public static boolean isWebServiceDeployment(final DeploymentUnit unit)
{
- return ASHelper.getOptionalAttachment(unit, DeploymentType.class) != null;
+ return ASHelper.getOptionalAttachment(unit, Deployment.class) != null;
}
/**
Modified:
container/jboss60/branches/jbossws-jboss600M2-jms-integration/src/main/resources/jbossws-jboss.deployer/META-INF/stack-agnostic-jboss-beans.xml
===================================================================
---
container/jboss60/branches/jbossws-jboss600M2-jms-integration/src/main/resources/jbossws-jboss.deployer/META-INF/stack-agnostic-jboss-beans.xml 2010-04-27
03:15:38 UTC (rev 12119)
+++
container/jboss60/branches/jbossws-jboss600M2-jms-integration/src/main/resources/jbossws-jboss.deployer/META-INF/stack-agnostic-jboss-beans.xml 2010-04-27
05:44:25 UTC (rev 12120)
@@ -55,6 +55,15 @@
<property name="name">webservices.xml</property>
<property name="useSchemaValidation">true</property>
</bean>
+
+ <bean name="WSEndpointsDescriptorParserDeployer"
class="org.jboss.webservices.integration.deployers.WSEndpointsDescriptorParserDeployer">
+ <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"/>