Author: thomas.diesler(a)jboss.com
Date: 2007-05-17 07:53:42 -0400 (Thu, 17 May 2007)
New Revision: 3120
Added:
branches/tdiesler/trunk/integration/jboss42/src/main/java/org/jboss/ws/integration/jboss42/AbstractApplicationMetaDataAdapter.java
branches/tdiesler/trunk/integration/jboss42/src/main/java/org/jboss/ws/integration/jboss42/AbstractDeployerHook.java
branches/tdiesler/trunk/integration/jboss42/src/main/java/org/jboss/ws/integration/jboss42/AbstractDeployerHookEJB.java
branches/tdiesler/trunk/integration/jboss42/src/main/java/org/jboss/ws/integration/jboss42/AbstractDeployerHookJSE.java
branches/tdiesler/trunk/integration/jboss42/src/main/java/org/jboss/ws/integration/jboss42/ApplicationMetaDataAdapter.java
branches/tdiesler/trunk/integration/jboss42/src/main/java/org/jboss/ws/integration/jboss42/ArchiveDeployerHook.java
branches/tdiesler/trunk/integration/jboss42/src/main/java/org/jboss/ws/integration/jboss42/ClassLoaderInjectionDeployer.java
branches/tdiesler/trunk/integration/jboss42/src/main/java/org/jboss/ws/integration/jboss42/DeploymentInfoAdapter.java
branches/tdiesler/trunk/integration/jboss42/src/main/java/org/jboss/ws/integration/jboss42/DeploymentInfoAdapterFactory.java
branches/tdiesler/trunk/integration/jboss42/src/main/java/org/jboss/ws/integration/jboss42/InvocationHandlerEJB21.java
branches/tdiesler/trunk/integration/jboss42/src/main/java/org/jboss/ws/integration/jboss42/InvocationHandlerEJB3.java
branches/tdiesler/trunk/integration/jboss42/src/main/java/org/jboss/ws/integration/jboss42/JAXRPCDeployerHookEJB21.java
branches/tdiesler/trunk/integration/jboss42/src/main/java/org/jboss/ws/integration/jboss42/JAXRPCDeployerHookJSE.java
branches/tdiesler/trunk/integration/jboss42/src/main/java/org/jboss/ws/integration/jboss42/JAXWSDeployerHookEJB3.java
branches/tdiesler/trunk/integration/jboss42/src/main/java/org/jboss/ws/integration/jboss42/JAXWSDeployerHookJSE.java
branches/tdiesler/trunk/integration/jboss42/src/main/java/org/jboss/ws/integration/jboss42/MainDeployerHook.java
branches/tdiesler/trunk/integration/jboss42/src/main/java/org/jboss/ws/integration/jboss42/ModifyWebMetaDataDeployer.java
branches/tdiesler/trunk/integration/jboss42/src/main/java/org/jboss/ws/integration/jboss42/SecurityRolesHandlerEJB21.java
branches/tdiesler/trunk/integration/jboss42/src/main/java/org/jboss/ws/integration/jboss42/SecurityRolesHandlerEJB3.java
branches/tdiesler/trunk/integration/jboss42/src/main/java/org/jboss/ws/integration/jboss42/ServiceEndpointInterceptor.java
branches/tdiesler/trunk/integration/jboss42/src/main/java/org/jboss/ws/integration/jboss42/UnifiedDeploymentInfoDeployer.java
branches/tdiesler/trunk/integration/jboss42/src/main/java/org/jboss/ws/integration/jboss42/WebAppDeployerDeployer.java
branches/tdiesler/trunk/integration/jboss42/src/main/java/org/jboss/ws/integration/jboss42/WebMetaDataAdapter.java
branches/tdiesler/trunk/integration/spi/src/main/java/org/jboss/ws/integration/invocation/AbstractInvocationHandler.java
branches/tdiesler/trunk/integration/spi/src/main/java/org/jboss/ws/integration/invocation/InvocationHandlerJSE.java
Removed:
branches/tdiesler/trunk/integration/jboss50/src/main/java/org/jboss/ws/integration/jboss50/AbstractInvocationHandler.java
branches/tdiesler/trunk/integration/jboss50/src/main/java/org/jboss/ws/integration/jboss50/InvocationHandlerJSE.java
branches/tdiesler/trunk/integration/jbws-jboss42/src/main/java/org/jboss/ws/integration/jboss42/jbossws/AbstractApplicationMetaDataAdapter.java
branches/tdiesler/trunk/integration/jbws-jboss42/src/main/java/org/jboss/ws/integration/jboss42/jbossws/AbstractDeployerHook.java
branches/tdiesler/trunk/integration/jbws-jboss42/src/main/java/org/jboss/ws/integration/jboss42/jbossws/AbstractDeployerHookEJB.java
branches/tdiesler/trunk/integration/jbws-jboss42/src/main/java/org/jboss/ws/integration/jboss42/jbossws/AbstractDeployerHookJSE.java
branches/tdiesler/trunk/integration/jbws-jboss42/src/main/java/org/jboss/ws/integration/jboss42/jbossws/ApplicationMetaDataAdapter.java
branches/tdiesler/trunk/integration/jbws-jboss42/src/main/java/org/jboss/ws/integration/jboss42/jbossws/ArchiveDeployerHook.java
branches/tdiesler/trunk/integration/jbws-jboss42/src/main/java/org/jboss/ws/integration/jboss42/jbossws/ClassLoaderInjectionDeployer.java
branches/tdiesler/trunk/integration/jbws-jboss42/src/main/java/org/jboss/ws/integration/jboss42/jbossws/DeploymentInfoAdapter.java
branches/tdiesler/trunk/integration/jbws-jboss42/src/main/java/org/jboss/ws/integration/jboss42/jbossws/DeploymentInfoAdapterFactory.java
branches/tdiesler/trunk/integration/jbws-jboss42/src/main/java/org/jboss/ws/integration/jboss42/jbossws/JAXRPCDeployerHookEJB21.java
branches/tdiesler/trunk/integration/jbws-jboss42/src/main/java/org/jboss/ws/integration/jboss42/jbossws/JAXRPCDeployerHookJSE.java
branches/tdiesler/trunk/integration/jbws-jboss42/src/main/java/org/jboss/ws/integration/jboss42/jbossws/JAXWSDeployerHookEJB3.java
branches/tdiesler/trunk/integration/jbws-jboss42/src/main/java/org/jboss/ws/integration/jboss42/jbossws/JAXWSDeployerHookJSE.java
branches/tdiesler/trunk/integration/jbws-jboss42/src/main/java/org/jboss/ws/integration/jboss42/jbossws/MainDeployerHook.java
branches/tdiesler/trunk/integration/jbws-jboss42/src/main/java/org/jboss/ws/integration/jboss42/jbossws/ModifyWebMetaDataDeployer.java
branches/tdiesler/trunk/integration/jbws-jboss42/src/main/java/org/jboss/ws/integration/jboss42/jbossws/SecurityRolesHandlerEJB21.java
branches/tdiesler/trunk/integration/jbws-jboss42/src/main/java/org/jboss/ws/integration/jboss42/jbossws/SecurityRolesHandlerEJB3.java
branches/tdiesler/trunk/integration/jbws-jboss42/src/main/java/org/jboss/ws/integration/jboss42/jbossws/UnifiedDeploymentInfoDeployer.java
branches/tdiesler/trunk/integration/jbws-jboss42/src/main/java/org/jboss/ws/integration/jboss42/jbossws/WebAppDeployerDeployer.java
branches/tdiesler/trunk/integration/jbws-jboss42/src/main/java/org/jboss/ws/integration/jboss42/jbossws/WebMetaDataAdapter.java
branches/tdiesler/trunk/testsuite/build.xml
Modified:
branches/tdiesler/trunk/build/ant-import/build-setup.xml
branches/tdiesler/trunk/build/build.xml
branches/tdiesler/trunk/integration/jboss42/.classpath
branches/tdiesler/trunk/integration/jboss42/ant-import/build-thirdparty.xml
branches/tdiesler/trunk/integration/jboss50/ant-import/build-thirdparty.xml
branches/tdiesler/trunk/integration/jboss50/src/main/java/org/jboss/ws/integration/jboss50/InvocationHandlerEJB21.java
branches/tdiesler/trunk/integration/jboss50/src/main/java/org/jboss/ws/integration/jboss50/InvocationHandlerEJB3.java
branches/tdiesler/trunk/integration/jboss50/src/main/java/org/jboss/ws/integration/jboss50/WebAppDeployerDeployer.java
branches/tdiesler/trunk/integration/jbws-jboss42/ant-import/build-thirdparty.xml
branches/tdiesler/trunk/integration/jbws-jboss42/src/main/resources/jbossws.beans/META-INF/jboss-beans.xml
branches/tdiesler/trunk/integration/jbws-jboss50/ant-import/build-thirdparty.xml
branches/tdiesler/trunk/integration/jbws-jboss50/src/main/resources/jbossws.sar/META-INF/jbossws-beans.xml
branches/tdiesler/trunk/integration/spi/src/main/java/org/jboss/ws/integration/deployment/ServiceEndpointPublisher.java
branches/tdiesler/trunk/jbossws/build.xml
branches/tdiesler/trunk/testsuite/ant-import/build-testsuite.xml
Log:
Modified: branches/tdiesler/trunk/build/ant-import/build-setup.xml
===================================================================
--- branches/tdiesler/trunk/build/ant-import/build-setup.xml 2007-05-17 11:03:51 UTC (rev
3119)
+++ branches/tdiesler/trunk/build/ant-import/build-setup.xml 2007-05-17 11:53:42 UTC (rev
3120)
@@ -54,26 +54,14 @@
<available property="jbossws.portal.content.available"
file="${jbossws.portal.content}" type="dir"/>
- <!-- Define jboss.home -->
- <condition property="jboss.home" value="${jboss50.home}">
- <equals arg1="${jbossws.integration.target}"
arg2="jboss50"/>
- </condition>
- <condition property="jboss.home" value="${jboss42.home}">
- <equals arg1="${jbossws.integration.target}"
arg2="jboss42"/>
- </condition>
-
<!-- ================================================================== -->
<!-- Initialization -->
<!-- ================================================================== -->
<target name="prepare">
-
- <echo message="jboss.home = ${jboss.home}"/>
-
<tstamp>
<format property="build.id" pattern="yyyyMMddHHmm"/>
</tstamp>
-
</target>
</project>
\ No newline at end of file
Modified: branches/tdiesler/trunk/build/build.xml
===================================================================
--- branches/tdiesler/trunk/build/build.xml 2007-05-17 11:03:51 UTC (rev 3119)
+++ branches/tdiesler/trunk/build/build.xml 2007-05-17 11:53:42 UTC (rev 3120)
@@ -39,7 +39,6 @@
<target name="clean" depends="prepare" description="Cleans
up most generated files.">
<ant antfile="${spi.dir}/build.xml" target="clean"
inheritall="false"/>
<ant antfile="${core.dir}/build.xml" target="clean"
inheritall="false"/>
- <ant antfile="${testsuite.dir}/build.xml" target="clean"
inheritall="false"/>
<ant antfile="${int.jboss50.dir}/build.xml" target="clean"
inheritall="false"/>
<ant antfile="${int.jboss42.dir}/build.xml" target="clean"
inheritall="false"/>
<ant antfile="${int.sunri50.dir}/build.xml" target="clean"
inheritall="false"/>
@@ -48,7 +47,6 @@
<target name="clobber" depends="prepare"
description="Cleans up all generated files.">
<ant antfile="${spi.dir}/build.xml" target="clobber"
inheritall="false"/>
<ant antfile="${core.dir}/build.xml" target="clobber"
inheritall="false"/>
- <ant antfile="${testsuite.dir}/build.xml" target="clobber"
inheritall="false"/>
<ant antfile="${int.jboss50.dir}/build.xml" target="clobber"
inheritall="false"/>
<ant antfile="${int.jboss42.dir}/build.xml" target="clobber"
inheritall="false"/>
<ant antfile="${int.sunri50.dir}/build.xml" target="clobber"
inheritall="false"/>
@@ -64,7 +62,6 @@
<target name="most" description="Builds almost everything."
depends="prepare">
<ant antfile="${spi.dir}/build.xml" target="most"
inheritall="false"/>
<ant antfile="${core.dir}/build.xml" target="most"
inheritall="false"/>
- <ant antfile="${testsuite.dir}/build.xml" target="most"
inheritall="false"/>
<ant antfile="${int.jboss50.dir}/build.xml" target="most"
inheritall="false"/>
<ant antfile="${int.jboss42.dir}/build.xml" target="most"
inheritall="false"/>
<ant antfile="${int.sunri50.dir}/build.xml" target="most"
inheritall="false"/>
Modified: branches/tdiesler/trunk/integration/jboss42/.classpath
===================================================================
--- branches/tdiesler/trunk/integration/jboss42/.classpath 2007-05-17 11:03:51 UTC (rev
3119)
+++ branches/tdiesler/trunk/integration/jboss42/.classpath 2007-05-17 11:53:42 UTC (rev
3120)
@@ -4,5 +4,9 @@
<classpathentry kind="con"
path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="con"
path="org.eclipse.jdt.USER_LIBRARY/jboss-4.2.x"/>
<classpathentry combineaccessrules="false" kind="src"
path="/spi"/>
+ <classpathentry kind="lib"
path="/spi/thirdparty/jaxrpc-api.jar"/>
+ <classpathentry kind="lib"
path="/spi/thirdparty/jaxws-api.jar"/>
+ <classpathentry kind="lib"
path="/spi/thirdparty/jsr181-api.jar"/>
+ <classpathentry kind="lib"
path="/spi/thirdparty/saaj-api.jar"/>
<classpathentry kind="output" path="output-eclipse"/>
</classpath>
Modified: branches/tdiesler/trunk/integration/jboss42/ant-import/build-thirdparty.xml
===================================================================
--- branches/tdiesler/trunk/integration/jboss42/ant-import/build-thirdparty.xml 2007-05-17
11:03:51 UTC (rev 3119)
+++ branches/tdiesler/trunk/integration/jboss42/ant-import/build-thirdparty.xml 2007-05-17
11:53:42 UTC (rev 3120)
@@ -28,19 +28,27 @@
<target name="thirdparty-get" depends="thirdparty-init"
description="Gets the thirdparty libraries"/>
- <target name="thirdparty-classpath"
depends="thirdparty-init">
+ <target name="thirdparty-classpath"
depends="thirdparty-get">
<!-- The compile classpath for jboss42 integration -->
<path id="jbws42.integration.classpath">
<pathelement location="${spi.dir}/output/lib/jbossws-spi.jar"/>
+ <pathelement location="${spi.dir}/thirdparty/jaxws-api.jar"/>
+ <pathelement location="${spi.dir}/thirdparty/jaxrpc-api.jar"/>
+ <pathelement location="${spi.dir}/thirdparty/jsr181-api.jar"/>
+ <pathelement location="${spi.dir}/thirdparty/saaj-api.jar"/>
<pathelement location="${jboss42.lib}/jboss-common.jar"/>
<pathelement location="${jboss42.lib}/jboss-jmx.jar"/>
<pathelement location="${jboss42.lib}/jboss-system.jar"/>
+ <pathelement location="${jboss42.lib}/jboss-xml-binding.jar"/>
<pathelement location="${jboss42.server.lib}/jboss.jar"/>
<pathelement location="${jboss42.server.lib}/jboss-j2ee.jar"/>
<pathelement location="${jboss42.server.lib}/jboss-ejb3x.jar"/>
<pathelement location="${jboss42.server.lib}/jbosssx.jar"/>
+ <pathelement location="${jboss42.server.lib}/servlet-api.jar"/>
<pathelement
location="${jboss42.server.deploy}/jboss-aop-jdk50.deployer/jboss-aop-jdk50.jar"/>
+ <pathelement
location="${jboss42.server.deploy}/jboss-bean.deployer/jboss-dependency.jar"/>
+ <pathelement
location="${jboss42.server.deploy}/jboss-bean.deployer/jboss-microcontainer.jar"/>
<pathelement
location="${jboss42.server.deploy}/ejb3.deployer/jboss-annotations-ejb3.jar"/>
<pathelement
location="${jboss42.server.deploy}/ejb3.deployer/jboss-ejb3.jar"/>
</path>
Copied:
branches/tdiesler/trunk/integration/jboss42/src/main/java/org/jboss/ws/integration/jboss42/AbstractApplicationMetaDataAdapter.java
(from rev 3110,
branches/tdiesler/trunk/integration/jbws-jboss42/src/main/java/org/jboss/ws/integration/jboss42/jbossws/AbstractApplicationMetaDataAdapter.java)
===================================================================
---
branches/tdiesler/trunk/integration/jboss42/src/main/java/org/jboss/ws/integration/jboss42/AbstractApplicationMetaDataAdapter.java
(rev 0)
+++
branches/tdiesler/trunk/integration/jboss42/src/main/java/org/jboss/ws/integration/jboss42/AbstractApplicationMetaDataAdapter.java 2007-05-17
11:53:42 UTC (rev 3120)
@@ -0,0 +1,87 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.ws.integration.jboss42;
+
+// $Id$
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.jboss.metadata.ApplicationMetaData;
+import org.jboss.metadata.BeanMetaData;
+import org.jboss.ws.integration.deployment.UnifiedDeploymentInfo;
+import org.jboss.ws.metadata.j2ee.UnifiedApplicationMetaData;
+import org.jboss.ws.metadata.j2ee.UnifiedBeanMetaData;
+import org.jboss.ws.metadata.j2ee.UnifiedApplicationMetaData.PublishLocationAdapter;
+
+/**
+ * Build container independent application meta data
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 05-May-2006
+ */
+public abstract class AbstractApplicationMetaDataAdapter
+{
+ public UnifiedApplicationMetaData
buildUnifiedApplicationMetaData(UnifiedDeploymentInfo udi, ApplicationMetaData apmd)
+ {
+ udi.addAttachment(ApplicationMetaData.class, apmd);
+
+ UnifiedApplicationMetaData umd = new UnifiedApplicationMetaData();
+ buildUnifiedBeanMetaData(umd, apmd);
+ umd.setConfigName(apmd.getConfigName());
+ umd.setConfigFile(apmd.getConfigFile());
+ umd.setWebServiceContextRoot(apmd.getWebServiceContextRoot());
+ umd.setSecurityDomain(apmd.getSecurityDomain());
+ umd.setPublishLocationAdapter(getPublishLocationAdpater(apmd));
+ return umd;
+ }
+
+ protected PublishLocationAdapter getPublishLocationAdpater(final ApplicationMetaData
apmd)
+ {
+ return new PublishLocationAdapter ()
+ {
+ public String getWsdlPublishLocationByName(String name)
+ {
+ return apmd.getWsdlPublishLocationByName(name);
+ }
+ };
+ }
+
+ protected void buildUnifiedBeanMetaData(UnifiedApplicationMetaData umd,
ApplicationMetaData metaData)
+ {
+ List<UnifiedBeanMetaData> beans = new
ArrayList<UnifiedBeanMetaData>();
+ Iterator it = metaData.getEnterpriseBeans();
+ while (it.hasNext())
+ {
+ BeanMetaData bmd = (BeanMetaData)it.next();
+ UnifiedBeanMetaData ubmd = buildUnifiedBeanMetaData(bmd);
+ if (ubmd != null)
+ {
+ beans.add(ubmd);
+ }
+ }
+ umd.setEnterpriseBeans(beans);
+ }
+
+ protected abstract UnifiedBeanMetaData buildUnifiedBeanMetaData(BeanMetaData bmd);
+}
Copied:
branches/tdiesler/trunk/integration/jboss42/src/main/java/org/jboss/ws/integration/jboss42/AbstractDeployerHook.java
(from rev 3110,
branches/tdiesler/trunk/integration/jbws-jboss42/src/main/java/org/jboss/ws/integration/jboss42/jbossws/AbstractDeployerHook.java)
===================================================================
---
branches/tdiesler/trunk/integration/jboss42/src/main/java/org/jboss/ws/integration/jboss42/AbstractDeployerHook.java
(rev 0)
+++
branches/tdiesler/trunk/integration/jboss42/src/main/java/org/jboss/ws/integration/jboss42/AbstractDeployerHook.java 2007-05-17
11:53:42 UTC (rev 3120)
@@ -0,0 +1,202 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.ws.integration.jboss42;
+
+//$Id$
+
+import java.util.List;
+
+import javax.management.MBeanServer;
+import javax.management.ObjectName;
+
+import org.jboss.deployment.DeploymentInfo;
+import org.jboss.logging.Logger;
+import org.jboss.mx.util.MBeanProxy;
+import org.jboss.mx.util.MBeanProxyCreationException;
+import org.jboss.mx.util.MBeanServerLocator;
+import org.jboss.ws.integration.Endpoint;
+import org.jboss.ws.integration.Service;
+import org.jboss.ws.integration.deployment.DeployerManager;
+import org.jboss.ws.integration.deployment.Deployment;
+import org.jboss.ws.integration.deployment.WSDeploymentException;
+import org.jboss.ws.integration.jboss42.DeployerHook;
+import org.jboss.ws.integration.jboss42.DeployerInterceptorMBean;
+
+/**
+ * An abstract web service deployer.
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 25-Apr-2007
+ */
+public abstract class AbstractDeployerHook implements DeployerHook
+{
+ // provide logging
+ protected final Logger log = Logger.getLogger(getClass());
+
+ protected DeployerManager deployerManager;
+ private List<ObjectName> phaseOneInterceptors;
+ private List<ObjectName> phaseTwoInterceptors;
+ private String deploymentClass;
+ private String serviceClass;
+ private String endpointClass;
+
+ public void setDeployerManager(DeployerManager deploymentManager)
+ {
+ this.deployerManager = deploymentManager;
+ }
+
+ public void setDeploymentClass(String deploymentClass)
+ {
+ this.deploymentClass = deploymentClass;
+ }
+
+ public void setEndpointClass(String endpointClass)
+ {
+ this.endpointClass = endpointClass;
+ }
+
+ public void setServiceClass(String serviceClass)
+ {
+ this.serviceClass = serviceClass;
+ }
+
+ public Deployment createDeployment()
+ {
+ try
+ {
+ ClassLoader loader = Thread.currentThread().getContextClassLoader();
+ Class<?> clazz = loader.loadClass(deploymentClass);
+ return (Deployment)clazz.newInstance();
+ }
+ catch (Exception ex)
+ {
+ throw new WSDeploymentException("Cannot load: " + deploymentClass);
+ }
+ }
+
+ public Service createService()
+ {
+ try
+ {
+ ClassLoader loader = Thread.currentThread().getContextClassLoader();
+ Class<?> clazz = loader.loadClass(serviceClass);
+ return (Service)clazz.newInstance();
+ }
+ catch (Exception ex)
+ {
+ throw new WSDeploymentException("Cannot load: " + serviceClass);
+ }
+ }
+
+ public Endpoint createEndpoint()
+ {
+ try
+ {
+ ClassLoader loader = Thread.currentThread().getContextClassLoader();
+ Class<?> clazz = loader.loadClass(endpointClass);
+ return (Endpoint)clazz.newInstance();
+ }
+ catch (Exception ex)
+ {
+ throw new WSDeploymentException("Cannot load: " + endpointClass);
+ }
+ }
+
+ public void setPhaseOneInterceptors(List<ObjectName> phaseOneInterceptors)
+ {
+ this.phaseOneInterceptors = phaseOneInterceptors;
+ }
+
+ public void setPhaseTwoInterceptors(List<ObjectName> phaseTwoInterceptors)
+ {
+ this.phaseTwoInterceptors = phaseTwoInterceptors;
+ }
+
+ /** Return true if this deployment should be ignored
+ */
+ public boolean ignoreDeployment(DeploymentInfo unit)
+ {
+ return false;
+ }
+
+ /** Add the hooks to the interceptors
+ */
+ public void start()
+ {
+ MBeanServer server = MBeanServerLocator.locateJBoss();
+ try
+ {
+ if (phaseOneInterceptors != null)
+ {
+ for (ObjectName oname : phaseOneInterceptors)
+ {
+ DeployerInterceptorMBean interceptor =
(DeployerInterceptorMBean)MBeanProxy.get(DeployerInterceptorMBean.class, oname, server);
+ interceptor.addPhaseOneHook(this);
+ }
+ }
+
+ if (phaseTwoInterceptors != null)
+ {
+ for (ObjectName oname : phaseTwoInterceptors)
+ {
+ DeployerInterceptorMBean interceptor =
(DeployerInterceptorMBean)MBeanProxy.get(DeployerInterceptorMBean.class, oname, server);
+ interceptor.addPhaseTwoHook(this);
+ }
+ }
+ }
+ catch (MBeanProxyCreationException e)
+ {
+ throw new WSDeploymentException(e);
+ }
+ }
+
+ /** Add the hooks to the interceptors
+ */
+ public void stop()
+ {
+ MBeanServer server = MBeanServerLocator.locateJBoss();
+ try
+ {
+ if (phaseOneInterceptors != null)
+ {
+ for (ObjectName oname : phaseOneInterceptors)
+ {
+ DeployerInterceptorMBean interceptor =
(DeployerInterceptorMBean)MBeanProxy.get(DeployerInterceptorMBean.class, oname, server);
+ interceptor.removePhaseOneHook(this);
+ }
+ }
+
+ if (phaseTwoInterceptors != null)
+ {
+ for (ObjectName oname : phaseTwoInterceptors)
+ {
+ DeployerInterceptorMBean interceptor =
(DeployerInterceptorMBean)MBeanProxy.get(DeployerInterceptorMBean.class, oname, server);
+ interceptor.removePhaseTwoHook(this);
+ }
+ }
+ }
+ catch (MBeanProxyCreationException e)
+ {
+ throw new WSDeploymentException(e);
+ }
+ }
+}
Copied:
branches/tdiesler/trunk/integration/jboss42/src/main/java/org/jboss/ws/integration/jboss42/AbstractDeployerHookEJB.java
(from rev 3110,
branches/tdiesler/trunk/integration/jbws-jboss42/src/main/java/org/jboss/ws/integration/jboss42/jbossws/AbstractDeployerHookEJB.java)
===================================================================
---
branches/tdiesler/trunk/integration/jboss42/src/main/java/org/jboss/ws/integration/jboss42/AbstractDeployerHookEJB.java
(rev 0)
+++
branches/tdiesler/trunk/integration/jboss42/src/main/java/org/jboss/ws/integration/jboss42/AbstractDeployerHookEJB.java 2007-05-17
11:53:42 UTC (rev 3120)
@@ -0,0 +1,34 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.ws.integration.jboss42;
+
+//$Id$
+
+/**
+ * An abstract deployer for EJB Endpoints
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 25-Apr-2007
+ */
+public abstract class AbstractDeployerHookEJB extends ArchiveDeployerHook
+{
+}
Copied:
branches/tdiesler/trunk/integration/jboss42/src/main/java/org/jboss/ws/integration/jboss42/AbstractDeployerHookJSE.java
(from rev 3110,
branches/tdiesler/trunk/integration/jbws-jboss42/src/main/java/org/jboss/ws/integration/jboss42/jbossws/AbstractDeployerHookJSE.java)
===================================================================
---
branches/tdiesler/trunk/integration/jboss42/src/main/java/org/jboss/ws/integration/jboss42/AbstractDeployerHookJSE.java
(rev 0)
+++
branches/tdiesler/trunk/integration/jboss42/src/main/java/org/jboss/ws/integration/jboss42/AbstractDeployerHookJSE.java 2007-05-17
11:53:42 UTC (rev 3120)
@@ -0,0 +1,63 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.ws.integration.jboss42;
+
+import org.jboss.deployment.DeploymentInfo;
+import org.jboss.metadata.WebMetaData;
+
+//$Id$
+
+/**
+ * An abstract deployer for JSE Endpoints
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 25-Apr-2007
+ */
+public abstract class AbstractDeployerHookJSE extends ArchiveDeployerHook
+{
+ public boolean isWebServiceDeployment(DeploymentInfo unit)
+ {
+ if ((unit.metaData instanceof WebMetaData) == false)
+ return false;
+
+ return true;
+ }
+
+ static class Servlet
+ {
+ String servletName;
+ String servletClass;
+ public Servlet(String servletName, String servletClass)
+ {
+ this.servletName = servletName;
+ this.servletClass = servletClass;
+ }
+ public String getServletClass()
+ {
+ return servletClass;
+ }
+ public String getServletName()
+ {
+ return servletName;
+ }
+ }
+}
Copied:
branches/tdiesler/trunk/integration/jboss42/src/main/java/org/jboss/ws/integration/jboss42/ApplicationMetaDataAdapter.java
(from rev 3110,
branches/tdiesler/trunk/integration/jbws-jboss42/src/main/java/org/jboss/ws/integration/jboss42/jbossws/ApplicationMetaDataAdapter.java)
===================================================================
---
branches/tdiesler/trunk/integration/jboss42/src/main/java/org/jboss/ws/integration/jboss42/ApplicationMetaDataAdapter.java
(rev 0)
+++
branches/tdiesler/trunk/integration/jboss42/src/main/java/org/jboss/ws/integration/jboss42/ApplicationMetaDataAdapter.java 2007-05-17
11:53:42 UTC (rev 3120)
@@ -0,0 +1,80 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.ws.integration.jboss42;
+
+// $Id$
+
+import org.jboss.metadata.BeanMetaData;
+import org.jboss.metadata.EjbPortComponentMetaData;
+import org.jboss.metadata.MessageDrivenMetaData;
+import org.jboss.metadata.SessionMetaData;
+import org.jboss.ws.metadata.j2ee.UnifiedBeanMetaData;
+import org.jboss.ws.metadata.j2ee.UnifiedEjbPortComponentMetaData;
+import org.jboss.ws.metadata.j2ee.UnifiedMessageDrivenMetaData;
+import org.jboss.ws.metadata.j2ee.UnifiedSessionMetaData;
+
+/**
+ * Build container independent application meta data
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 05-May-2006
+ */
+public class ApplicationMetaDataAdapter extends AbstractApplicationMetaDataAdapter
+{
+ protected UnifiedBeanMetaData buildUnifiedBeanMetaData(BeanMetaData bmd)
+ {
+ UnifiedBeanMetaData ubmd = null;
+ if (bmd instanceof SessionMetaData)
+ {
+ ubmd = new UnifiedSessionMetaData();
+ }
+ else if (bmd instanceof MessageDrivenMetaData)
+ {
+ ubmd = new UnifiedMessageDrivenMetaData();
+
((UnifiedMessageDrivenMetaData)ubmd).setDestinationJndiName(((MessageDrivenMetaData)bmd).getDestinationJndiName());
+ }
+
+ if (ubmd != null)
+ {
+ ubmd.setEjbName(bmd.getEjbName());
+ ubmd.setEjbClass(bmd.getEjbClass());
+ ubmd.setServiceEndpointInterface(bmd.getServiceEndpoint());
+ ubmd.setHome(bmd.getHome());
+ ubmd.setLocalHome(bmd.getLocalHome());
+ ubmd.setJndiName(bmd.getJndiName());
+ ubmd.setLocalJndiName(bmd.getLocalJndiName());
+
+ EjbPortComponentMetaData pcmd = bmd.getPortComponent();
+ if (pcmd != null)
+ {
+ UnifiedEjbPortComponentMetaData upcmd = new
UnifiedEjbPortComponentMetaData();
+ upcmd.setPortComponentName(pcmd.getPortComponentName());
+ upcmd.setPortComponentURI(pcmd.getPortComponentURI());
+ upcmd.setAuthMethod(pcmd.getAuthMethod());
+ upcmd.setTransportGuarantee(pcmd.getTransportGuarantee());
+ upcmd.setSecureWSDLAccess(pcmd.getSecureWSDLAccess());
+ ubmd.setPortComponent(upcmd);
+ }
+ }
+ return ubmd;
+ }
+}
Copied:
branches/tdiesler/trunk/integration/jboss42/src/main/java/org/jboss/ws/integration/jboss42/ArchiveDeployerHook.java
(from rev 3110,
branches/tdiesler/trunk/integration/jbws-jboss42/src/main/java/org/jboss/ws/integration/jboss42/jbossws/ArchiveDeployerHook.java)
===================================================================
---
branches/tdiesler/trunk/integration/jboss42/src/main/java/org/jboss/ws/integration/jboss42/ArchiveDeployerHook.java
(rev 0)
+++
branches/tdiesler/trunk/integration/jboss42/src/main/java/org/jboss/ws/integration/jboss42/ArchiveDeployerHook.java 2007-05-17
11:53:42 UTC (rev 3120)
@@ -0,0 +1,157 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.ws.integration.jboss42;
+
+//$Id$
+
+import java.io.IOException;
+import java.net.URL;
+
+import org.jboss.deployment.DeploymentException;
+import org.jboss.deployment.DeploymentInfo;
+import org.jboss.ws.integration.ResourceLoaderAdapter;
+import org.jboss.ws.integration.UnifiedVirtualFile;
+import org.jboss.ws.integration.deployment.Deployment;
+import org.jboss.ws.integration.deployment.WSDeploymentException;
+import org.jboss.ws.integration.deployment.Deployment.DeploymentType;
+import org.jboss.ws.metadata.webservices.WebservicesFactory;
+import org.jboss.ws.metadata.webservices.WebservicesMetaData;
+import org.jboss.ws.utils.DOMUtils;
+import org.jboss.xb.binding.ObjectModelFactory;
+import org.jboss.xb.binding.Unmarshaller;
+import org.jboss.xb.binding.UnmarshallerFactory;
+import org.w3c.dom.Element;
+
+/**
+ * An abstract web service deployer.
+ *
+ * deploy(unit)
+ * if(isWebServiceDeployment)
+ * dep = createDeployment(unit)
+ * deploy(dep)
+ *
+ * undeploy(unit)
+ * dep = getDeployment(unit)
+ * undeploy(dep)
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 25-Apr-2007
+ */
+public abstract class ArchiveDeployerHook extends AbstractDeployerHook
+{
+ /** Get the deployemnt type this deployer can handle
+ */
+ public abstract DeploymentType getDeploymentType();
+
+ /** Depending on the type of deployment, this method should return true
+ * if the deployment contains web service endpoints.
+ */
+ public abstract boolean isWebServiceDeployment(DeploymentInfo unit);
+
+ /** Create the Deployment for a given DeploymentInfo
+ */
+ public abstract Deployment createDeployment(DeploymentInfo unit);
+
+ /** Get the Deployment for a given DeploymentInfo
+ */
+ public Deployment getDeployment(DeploymentInfo unit)
+ {
+ Deployment dep = (Deployment)unit.context.get(Deployment.class);
+ return (dep != null && dep.getType() == getDeploymentType() ? dep : null);
+ }
+
+ public void deploy(DeploymentInfo unit) throws DeploymentException
+ {
+ if (ignoreDeployment(unit))
+ return;
+
+ if (isWebServiceDeployment(unit))
+ {
+ log.debug("deploy: " + unit.shortName);
+ Deployment dep = getDeployment(unit);
+ if (dep == null)
+ {
+ dep = createDeployment(unit);
+ dep.getContext().addAttachment(DeploymentInfo.class, unit);
+ }
+
+ deployerManager.deploy(dep);
+ unit.context.put(Deployment.class, dep);
+ }
+ }
+
+ public void undeploy(DeploymentInfo unit)
+ {
+ if (ignoreDeployment(unit))
+ return;
+
+ Deployment dep = getDeployment(unit);
+ if (dep != null)
+ {
+ log.debug("undeploy: " + unit.shortName);
+ deployerManager.undeploy(dep);
+ unit.context.remove(Deployment.class);
+ }
+ }
+
+ /** Unmrashall the webservices.xml if there is one
+ */
+ protected WebservicesMetaData getWebservicesMetaData(DeploymentInfo unit, String
wsFile)
+ {
+ WebservicesMetaData wsMetaData =
(WebservicesMetaData)unit.context.get(WebservicesMetaData.class);
+ UnifiedVirtualFile vfWebservices = getWebservicesFile(unit, wsFile);
+ if (wsMetaData == null && vfWebservices != null)
+ {
+ try
+ {
+ URL wsURL = vfWebservices.toURL();
+ Element root = DOMUtils.parse(wsURL.openStream());
+ String namespaceURI = root.getNamespaceURI();
+ if (
namespaceURI.equals("http://java.sun.com/xml/ns/j2ee"))
+ {
+ Unmarshaller unmarshaller =
UnmarshallerFactory.newInstance().newUnmarshaller();
+ ObjectModelFactory factory = new WebservicesFactory(wsURL);
+ wsMetaData =
(WebservicesMetaData)unmarshaller.unmarshal(wsURL.openStream(), factory, null);
+ unit.context.put(WebservicesMetaData.class, wsMetaData);
+ }
+ }
+ catch (Exception ex)
+ {
+ throw new WSDeploymentException(ex);
+ }
+ }
+ return wsMetaData;
+ }
+
+ private UnifiedVirtualFile getWebservicesFile(DeploymentInfo unit, String wsFile)
+ {
+ try
+ {
+ UnifiedVirtualFile vfsRoot = new ResourceLoaderAdapter(unit.localCl);
+ return (wsFile != null ? vfsRoot.findChild(wsFile) : null);
+ }
+ catch (IOException e)
+ {
+ return null;
+ }
+ }
+}
Copied:
branches/tdiesler/trunk/integration/jboss42/src/main/java/org/jboss/ws/integration/jboss42/ClassLoaderInjectionDeployer.java
(from rev 3110,
branches/tdiesler/trunk/integration/jbws-jboss42/src/main/java/org/jboss/ws/integration/jboss42/jbossws/ClassLoaderInjectionDeployer.java)
===================================================================
---
branches/tdiesler/trunk/integration/jboss42/src/main/java/org/jboss/ws/integration/jboss42/ClassLoaderInjectionDeployer.java
(rev 0)
+++
branches/tdiesler/trunk/integration/jboss42/src/main/java/org/jboss/ws/integration/jboss42/ClassLoaderInjectionDeployer.java 2007-05-17
11:53:42 UTC (rev 3120)
@@ -0,0 +1,81 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.ws.integration.jboss42;
+
+//$Id$
+
+import org.jboss.deployment.DeploymentInfo;
+import org.jboss.metadata.WebMetaData;
+import org.jboss.ws.integration.Endpoint;
+import org.jboss.ws.integration.deployment.AbstractDeployer;
+import org.jboss.ws.integration.deployment.Deployment;
+import org.jboss.ws.integration.deployment.WSDeploymentException;
+
+/**
+ * A deployer that injects the correct classloader into the UMDM
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 25-Apr-2007
+ */
+public class ClassLoaderInjectionDeployer extends AbstractDeployer
+{
+ @Override
+ public void create(Deployment dep)
+ {
+ DeploymentInfo unit = dep.getContext().getAttachment(DeploymentInfo.class);
+ if (unit == null)
+ throw new IllegalStateException("Cannot obtain deployement unit");
+
+ ClassLoader classLoader = unit.ucl;
+
+ // Get the webapp context classloader and use it as the deploymet class loader
+ WebMetaData webMetaData = dep.getContext().getAttachment(WebMetaData.class);
+ if (webMetaData != null)
+ {
+ classLoader = webMetaData.getContextLoader();
+ }
+
+ dep.setClassLoader(classLoader);
+
+ // Reload target beans with the updated class loader
+ for (Endpoint ep : dep.getService().getEndpoints())
+ {
+ Class targetBean = ep.getTargetBean();
+ if (targetBean != null)
+ {
+ String beanName = targetBean.getName();
+ if (targetBean.getClassLoader() != classLoader)
+ {
+ try
+ {
+ targetBean = classLoader.loadClass(beanName);
+ ep.setTargetBean(targetBean);
+ }
+ catch (ClassNotFoundException e)
+ {
+ throw new WSDeploymentException("Cannot reload target bean: "
+ beanName);
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
Copied:
branches/tdiesler/trunk/integration/jboss42/src/main/java/org/jboss/ws/integration/jboss42/DeploymentInfoAdapter.java
(from rev 3110,
branches/tdiesler/trunk/integration/jbws-jboss42/src/main/java/org/jboss/ws/integration/jboss42/jbossws/DeploymentInfoAdapter.java)
===================================================================
---
branches/tdiesler/trunk/integration/jboss42/src/main/java/org/jboss/ws/integration/jboss42/DeploymentInfoAdapter.java
(rev 0)
+++
branches/tdiesler/trunk/integration/jboss42/src/main/java/org/jboss/ws/integration/jboss42/DeploymentInfoAdapter.java 2007-05-17
11:53:42 UTC (rev 3120)
@@ -0,0 +1,168 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.ws.integration.jboss42;
+
+// $Id$
+
+import java.io.File;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.ArrayList;
+
+import javax.management.MBeanServer;
+import javax.management.ObjectName;
+
+import org.jboss.deployment.DeploymentInfo;
+import org.jboss.ejb3.Ejb3ModuleMBean;
+import org.jboss.ejb3.stateless.StatelessContainer;
+import org.jboss.logging.Logger;
+import org.jboss.metadata.ApplicationMetaData;
+import org.jboss.metadata.WebMetaData;
+import org.jboss.mx.util.MBeanProxy;
+import org.jboss.mx.util.MBeanProxyCreationException;
+import org.jboss.mx.util.MBeanServerLocator;
+import org.jboss.ws.integration.ResourceLoaderAdapter;
+import org.jboss.ws.integration.deployment.UnifiedDeploymentInfo;
+import org.jboss.ws.integration.deployment.WSDeploymentException;
+import org.jboss.ws.metadata.j2ee.UnifiedApplicationMetaData;
+import org.jboss.ws.metadata.j2ee.UnifiedBeanMetaData;
+
+/**
+ * Build container independent deployment info.
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 05-May-2006
+ */
+public class DeploymentInfoAdapter
+{
+ // logging support
+ private static Logger log = Logger.getLogger(DeploymentInfoAdapter.class);
+
+ private WebMetaDataAdapter webMetaDataAdapter;
+ private AbstractApplicationMetaDataAdapter appMetaDataAdapter;
+
+ public void setAppMetaDataAdapter(AbstractApplicationMetaDataAdapter
applicationMetaDataAdapter)
+ {
+ this.appMetaDataAdapter = applicationMetaDataAdapter;
+ }
+
+ public void setWebMetaDataAdapter(WebMetaDataAdapter webMetaDataAdapter)
+ {
+ this.webMetaDataAdapter = webMetaDataAdapter;
+ }
+
+ public UnifiedDeploymentInfo buildDeploymentInfo(UnifiedDeploymentInfo udi,
DeploymentInfo di)
+ {
+ udi.addAttachment(DeploymentInfo.class, di);
+
+ if (di.parent != null)
+ {
+ udi.parent = new UnifiedDeploymentInfo(null);
+ buildDeploymentInfo(udi.parent, di.parent);
+ }
+
+ udi.vfRoot = new ResourceLoaderAdapter(di.localCl);
+ udi.name = di.getCanonicalName();
+ udi.simpleName = di.shortName;
+ udi.url = getDeploymentURL(di);
+ udi.classLoader = di.annotationsCl;
+ udi.deployedObject = di.deployedObject;
+
+ buildMetaData(udi, di.metaData);
+
+ log.debug("UnifiedDeploymentInfo:\n" + udi);
+ return udi;
+ }
+
+ private URL getDeploymentURL(DeploymentInfo di)
+ {
+ URL deploymentURL = (di.localUrl != null ? di.localUrl : di.url);
+ if ("file".equals(deploymentURL.getProtocol()))
+ {
+ String path = deploymentURL.getPath();
+ if (new File(path).isFile())
+ {
+ try
+ {
+ deploymentURL = new URL("jar:file:" + path + "!/");
+ }
+ catch (MalformedURLException e)
+ {
+ // ignore
+ }
+ }
+ }
+ return deploymentURL;
+ }
+
+ private void buildMetaData(UnifiedDeploymentInfo udi, Object metaData)
+ {
+ if (metaData instanceof WebMetaData)
+ {
+ udi.metaData = webMetaDataAdapter.buildUnifiedWebMetaData(udi,
(WebMetaData)metaData);
+ udi.webappURL = udi.url;
+ }
+ else if (metaData instanceof ApplicationMetaData)
+ {
+ udi.metaData = appMetaDataAdapter.buildUnifiedApplicationMetaData(udi,
(ApplicationMetaData)metaData);
+ }
+ else if (udi.deployedObject != null)
+ {
+ Ejb3ModuleMBean ejb3Module = getEJB3Module(udi.deployedObject);
+
+ ArrayList<UnifiedBeanMetaData> beans = new
ArrayList<UnifiedBeanMetaData>();
+ for (Object container : ejb3Module.getContainers().values())
+ {
+ if (container instanceof StatelessContainer)
+ {
+ StatelessContainer slc = (StatelessContainer)container;
+ UnifiedBeanMetaData uslc = new UnifiedBeanMetaData();
+ uslc.setEjbName(slc.getEjbName());
+ uslc.setEjbClass(slc.getBeanClassName());
+ beans.add(uslc);
+ }
+ }
+
+ UnifiedApplicationMetaData appMetaData = new UnifiedApplicationMetaData();
+ appMetaData.setEnterpriseBeans(beans);
+ udi.metaData = appMetaData;
+ }
+ }
+
+ public static Ejb3ModuleMBean getEJB3Module(ObjectName objectName)
+ {
+ Ejb3ModuleMBean ejb3Module;
+ try
+ {
+ MBeanServer server = MBeanServerLocator.locateJBoss();
+ ejb3Module = (Ejb3ModuleMBean)MBeanProxy.get(Ejb3ModuleMBean.class, objectName,
server);
+ if (ejb3Module == null)
+ throw new WSDeploymentException("Cannot obtain EJB3 module: " +
objectName);
+
+ return ejb3Module;
+ }
+ catch (MBeanProxyCreationException ex)
+ {
+ throw new WSDeploymentException("Cannot obtain proxy to EJB3
module");
+ }
+ }
+}
Copied:
branches/tdiesler/trunk/integration/jboss42/src/main/java/org/jboss/ws/integration/jboss42/DeploymentInfoAdapterFactory.java
(from rev 3110,
branches/tdiesler/trunk/integration/jbws-jboss42/src/main/java/org/jboss/ws/integration/jboss42/jbossws/DeploymentInfoAdapterFactory.java)
===================================================================
---
branches/tdiesler/trunk/integration/jboss42/src/main/java/org/jboss/ws/integration/jboss42/DeploymentInfoAdapterFactory.java
(rev 0)
+++
branches/tdiesler/trunk/integration/jboss42/src/main/java/org/jboss/ws/integration/jboss42/DeploymentInfoAdapterFactory.java 2007-05-17
11:53:42 UTC (rev 3120)
@@ -0,0 +1,47 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.ws.integration.jboss42;
+
+// $Id$
+
+import org.jboss.kernel.spi.registry.KernelRegistry;
+import org.jboss.kernel.spi.registry.KernelRegistryEntry;
+import org.jboss.ws.integration.KernelLocator;
+
+/**
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 10-Mar-2007
+ */
+public class DeploymentInfoAdapterFactory
+{
+ // Hide ctor
+ private DeploymentInfoAdapterFactory()
+ {
+ }
+
+ public static DeploymentInfoAdapter newInstance()
+ {
+ KernelRegistry registry = KernelLocator.getKernel().getRegistry();
+ KernelRegistryEntry entry =
registry.getEntry("WSDeploymentInfoAdapter");
+ return (DeploymentInfoAdapter)entry.getTarget();
+ }
+}
Added:
branches/tdiesler/trunk/integration/jboss42/src/main/java/org/jboss/ws/integration/jboss42/InvocationHandlerEJB21.java
===================================================================
---
branches/tdiesler/trunk/integration/jboss42/src/main/java/org/jboss/ws/integration/jboss42/InvocationHandlerEJB21.java
(rev 0)
+++
branches/tdiesler/trunk/integration/jboss42/src/main/java/org/jboss/ws/integration/jboss42/InvocationHandlerEJB21.java 2007-05-17
11:53:42 UTC (rev 3120)
@@ -0,0 +1,166 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.ws.integration.jboss42;
+
+// $Id$
+
+import java.lang.reflect.Method;
+import java.security.Principal;
+
+import javax.management.MBeanServer;
+import javax.management.ObjectName;
+import javax.xml.rpc.handler.MessageContext;
+import javax.xml.rpc.handler.soap.SOAPMessageContext;
+import javax.xml.ws.WebServiceException;
+
+import org.jboss.ejb.EjbModule;
+import org.jboss.ejb.Interceptor;
+import org.jboss.ejb.StatelessSessionContainer;
+import org.jboss.invocation.Invocation;
+import org.jboss.invocation.InvocationKey;
+import org.jboss.invocation.InvocationType;
+import org.jboss.invocation.PayloadKey;
+import org.jboss.logging.Logger;
+import org.jboss.mx.util.MBeanServerLocator;
+import org.jboss.security.SecurityAssociation;
+import org.jboss.ws.integration.Endpoint;
+import org.jboss.ws.integration.deployment.UnifiedDeploymentInfo;
+import org.jboss.ws.integration.invocation.AbstractInvocationHandler;
+import org.jboss.ws.integration.invocation.HandlerCallback;
+import org.jboss.ws.integration.invocation.EndpointInvocation;
+import org.jboss.ws.metadata.j2ee.UnifiedApplicationMetaData;
+import org.jboss.ws.metadata.j2ee.UnifiedBeanMetaData;
+import org.jboss.ws.utils.ObjectNameFactory;
+
+/**
+ * Handles invocations on EJB3 endpoints.
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 25-Apr-2007
+ */
+public class InvocationHandlerEJB21 extends AbstractInvocationHandler
+{
+ // provide logging
+ private static final Logger log = Logger.getLogger(InvocationHandlerEJB21.class);
+
+ private String jndiName;
+ private MBeanServer server;
+ private ObjectName objectName;
+
+ public void create(Endpoint ep)
+ {
+ super.create(ep);
+
+ ObjectName epName = ep.getName();
+ String ejbName = epName.getKeyProperty(Endpoint.SEPID_PROPERTY_ENDPOINT);
+ if (ejbName == null)
+ throw new WebServiceException("Cannot obtain ejb-link from port
component");
+
+ UnifiedDeploymentInfo udi =
ep.getService().getDeployment().getContext().getAttachment(UnifiedDeploymentInfo.class);
+ UnifiedApplicationMetaData applMetaData =
(UnifiedApplicationMetaData)udi.metaData;
+ UnifiedBeanMetaData beanMetaData =
(UnifiedBeanMetaData)applMetaData.getBeanByEjbName(ejbName);
+ if (beanMetaData == null)
+ throw new WebServiceException("Cannot obtain ejb meta data for: " +
ejbName);
+
+ // get the bean's JNDI name
+ jndiName = beanMetaData.getContainerObjectNameJndiName();
+ if (jndiName == null)
+ throw new WebServiceException("Cannot obtain JNDI name for: " +
ejbName);
+
+ server = MBeanServerLocator.locateJBoss();
+ objectName = ObjectNameFactory.create("jboss.j2ee:jndiName=" + jndiName +
",service=EJB");
+ if (server.isRegistered(objectName) == false)
+ throw new WebServiceException("Cannot find service endpoint target: "
+ objectName);
+
+ // Dynamically add the service endpoint interceptor
+ //
http://jira.jboss.org/jira/browse/JBWS-758
+ try
+ {
+ EjbModule ejbModule = (EjbModule)server.getAttribute(objectName,
"EjbModule");
+ StatelessSessionContainer container =
(StatelessSessionContainer)ejbModule.getContainer(ejbName);
+
+ boolean injectionPointFound = false;
+ Interceptor prev = container.getInterceptor();
+ while (prev != null && prev.getNext() != null)
+ {
+ Interceptor next = prev.getNext();
+ if (next.getNext() == null)
+ {
+ log.debug("Inject service endpoint interceptor after: " +
prev.getClass().getName());
+ ServiceEndpointInterceptor sepInterceptor = new
ServiceEndpointInterceptor();
+ prev.setNext(sepInterceptor);
+ sepInterceptor.setNext(next);
+ injectionPointFound = true;
+ }
+ prev = next;
+ }
+ if (injectionPointFound == false)
+ log.warn("Cannot service endpoint interceptor injection point");
+ }
+ catch (Exception ex)
+ {
+ log.warn("Cannot add service endpoint interceptor", ex);
+ }
+
+ }
+
+ public void invoke(Endpoint ep, EndpointInvocation epInv) throws Exception
+ {
+ log.debug("Invoke: " + epInv.getJavaMethod().getName());
+
+ // these are provided by the ServerLoginHandler
+ Principal principal = SecurityAssociation.getPrincipal();
+ Object credential = SecurityAssociation.getCredential();
+
+ // invoke on the container
+ try
+ {
+ // setup the invocation
+ Method method = epInv.getJavaMethod();
+ Object[] args = epInv.getArgs();
+ Invocation inv = new Invocation(null, method, args, null, principal,
credential);
+
+ // EJB2.1 endpoints will only get an JAXRPC context
+ MessageContext msgContext =
epInv.getInvocationContext().getAttachment(MessageContext.class);
+ if (msgContext == null)
+ throw new IllegalStateException("Cannot obtain MessageContext");
+
+ HandlerCallback callback =
epInv.getInvocationContext().getAttachment(HandlerCallback.class);
+ if (callback == null)
+ throw new IllegalStateException("Cannot obtain HandlerCallback");
+
+ inv.setValue(InvocationKey.SOAP_MESSAGE_CONTEXT, msgContext);
+ inv.setValue(InvocationKey.SOAP_MESSAGE,
((SOAPMessageContext)msgContext).getMessage());
+ inv.setType(InvocationType.SERVICE_ENDPOINT);
+ inv.setValue(HandlerCallback.class.getName(), callback, PayloadKey.TRANSIENT);
+ inv.setValue(EndpointInvocation.class.getName(), epInv, PayloadKey.TRANSIENT);
+
+ String[] sig = { org.jboss.invocation.Invocation.class.getName() };
+ Object retObj = server.invoke(objectName, "invoke", new Object[] { inv
}, sig);
+ epInv.setReturnValue(retObj);
+ }
+ catch (Exception e)
+ {
+ handleInvocationException(e);
+ }
+ }
+}
Property changes on:
branches/tdiesler/trunk/integration/jboss42/src/main/java/org/jboss/ws/integration/jboss42/InvocationHandlerEJB21.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
branches/tdiesler/trunk/integration/jboss42/src/main/java/org/jboss/ws/integration/jboss42/InvocationHandlerEJB3.java
===================================================================
---
branches/tdiesler/trunk/integration/jboss42/src/main/java/org/jboss/ws/integration/jboss42/InvocationHandlerEJB3.java
(rev 0)
+++
branches/tdiesler/trunk/integration/jboss42/src/main/java/org/jboss/ws/integration/jboss42/InvocationHandlerEJB3.java 2007-05-17
11:53:42 UTC (rev 3120)
@@ -0,0 +1,145 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.ws.integration.jboss42;
+
+// $Id$
+
+import java.lang.reflect.Method;
+
+import javax.ejb.EJBContext;
+import javax.management.ObjectName;
+import javax.xml.ws.WebServiceException;
+
+import org.jboss.aop.Dispatcher;
+import org.jboss.aop.MethodInfo;
+import org.jboss.ejb3.BeanContext;
+import org.jboss.ejb3.BeanContextLifecycleCallback;
+import org.jboss.ejb3.EJBContainerInvocation;
+import org.jboss.ejb3.stateless.StatelessBeanContext;
+import org.jboss.ejb3.stateless.StatelessContainer;
+import org.jboss.injection.lang.reflect.BeanProperty;
+import org.jboss.ws.integration.Endpoint;
+import org.jboss.ws.integration.deployment.UnifiedDeploymentInfo;
+import org.jboss.ws.integration.invocation.AbstractInvocationHandler;
+import org.jboss.ws.integration.invocation.EndpointInvocation;
+import org.jboss.ws.integration.invocation.WebServiceContextEJB;
+import org.jboss.ws.utils.ObjectNameFactory;
+
+/**
+ * Handles invocations on EJB3 endpoints.
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 25-Apr-2007
+ */
+public class InvocationHandlerEJB3 extends AbstractInvocationHandler
+{
+ private ObjectName objectName;
+
+ public void create(Endpoint ep)
+ {
+ super.create(ep);
+
+ String ejbName = ep.getName().getKeyProperty(Endpoint.SEPID_PROPERTY_ENDPOINT);
+ if (ejbName == null)
+ throw new WebServiceException("Cannot obtain ejb-link");
+
+ UnifiedDeploymentInfo udi =
ep.getService().getDeployment().getContext().getAttachment(UnifiedDeploymentInfo.class);
+ String nameStr = "jboss.j2ee:name=" + ejbName +
",service=EJB3,jar=" + udi.simpleName;
+ if (udi.parent != null)
+ {
+ nameStr += ",ear=" + udi.parent.simpleName;
+ }
+
+ objectName = ObjectNameFactory.create(nameStr.toString());
+ }
+
+ public void start(Endpoint ep)
+ {
+ super.start(ep);
+
+ Dispatcher dispatcher = Dispatcher.singleton;
+ if (dispatcher.getRegistered(objectName.getCanonicalName()) == null)
+ throw new WebServiceException("Cannot find service endpoint target: "
+ objectName);
+ }
+
+ public void invoke(Endpoint ep, EndpointInvocation epInv) throws Exception
+ {
+ try
+ {
+ Dispatcher dispatcher = Dispatcher.singleton;
+ StatelessContainer container =
(StatelessContainer)dispatcher.getRegistered(objectName.getCanonicalName());
+ Class beanClass = container.getBeanClass();
+
+ Method method = getImplMethod(beanClass, epInv.getJavaMethod());
+ Object[] args = epInv.getArgs();
+
+ MethodInfo info = container.getMethodInfo(method);
+ EJBContainerInvocation<StatelessContainer, StatelessBeanContext> ejb3Inv =
new EJBContainerInvocation<StatelessContainer, StatelessBeanContext>(info);
+ ejb3Inv.setAdvisor(container);
+ ejb3Inv.setArguments(args);
+ ejb3Inv.setContextCallback(new CallbackImpl(epInv));
+
+ Object retObj = ejb3Inv.invokeNext();
+
+ epInv.setReturnValue(retObj);
+ }
+ catch (Throwable th)
+ {
+ handleInvocationException(th);
+ }
+ }
+
+ static class CallbackImpl implements BeanContextLifecycleCallback
+ {
+ private javax.xml.ws.handler.MessageContext jaxwsMessageContext;
+ private javax.xml.rpc.handler.MessageContext jaxrpcMessageContext;
+
+ public CallbackImpl(EndpointInvocation epInv)
+ {
+ jaxrpcMessageContext =
epInv.getInvocationContext().getAttachment(javax.xml.rpc.handler.MessageContext.class);
+ jaxwsMessageContext =
epInv.getInvocationContext().getAttachment(javax.xml.ws.handler.MessageContext.class);
+ }
+
+ public void attached(BeanContext beanCtx)
+ {
+ StatelessBeanContext sbc = (StatelessBeanContext)beanCtx;
+ sbc.setMessageContextJAXRPC(jaxrpcMessageContext);
+
+ BeanProperty beanProp = sbc.getWebServiceContextProperty();
+ if (beanProp != null)
+ {
+ EJBContext ejbCtx = beanCtx.getEJBContext();
+ beanProp.set(beanCtx.getInstance(), new
WebServiceContextEJB(jaxwsMessageContext, ejbCtx));
+ }
+ }
+
+ public void released(BeanContext beanCtx)
+ {
+ StatelessBeanContext sbc = (StatelessBeanContext)beanCtx;
+ sbc.setMessageContextJAXRPC(null);
+
+ BeanProperty beanProp = sbc.getWebServiceContextProperty();
+ if (beanProp != null)
+ beanProp.set(beanCtx.getInstance(), null);
+ }
+ }
+}
\ No newline at end of file
Property changes on:
branches/tdiesler/trunk/integration/jboss42/src/main/java/org/jboss/ws/integration/jboss42/InvocationHandlerEJB3.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Copied:
branches/tdiesler/trunk/integration/jboss42/src/main/java/org/jboss/ws/integration/jboss42/JAXRPCDeployerHookEJB21.java
(from rev 3110,
branches/tdiesler/trunk/integration/jbws-jboss42/src/main/java/org/jboss/ws/integration/jboss42/jbossws/JAXRPCDeployerHookEJB21.java)
===================================================================
---
branches/tdiesler/trunk/integration/jboss42/src/main/java/org/jboss/ws/integration/jboss42/JAXRPCDeployerHookEJB21.java
(rev 0)
+++
branches/tdiesler/trunk/integration/jboss42/src/main/java/org/jboss/ws/integration/jboss42/JAXRPCDeployerHookEJB21.java 2007-05-17
11:53:42 UTC (rev 3120)
@@ -0,0 +1,120 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.ws.integration.jboss42;
+
+//$Id$
+
+import org.jboss.deployment.DeploymentInfo;
+import org.jboss.metadata.ApplicationMetaData;
+import org.jboss.metadata.BeanMetaData;
+import org.jboss.ws.integration.Endpoint;
+import org.jboss.ws.integration.Service;
+import org.jboss.ws.integration.deployment.Deployment;
+import org.jboss.ws.integration.deployment.Deployment.DeploymentType;
+import org.jboss.ws.metadata.webservices.PortComponentMetaData;
+import org.jboss.ws.metadata.webservices.WebserviceDescriptionMetaData;
+import org.jboss.ws.metadata.webservices.WebservicesMetaData;
+import org.jboss.ws.utils.ObjectNameFactory;
+
+/**
+ * A deployer JAXRPC EJB21 Endpoints
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 25-Apr-2007
+ */
+public class JAXRPCDeployerHookEJB21 extends AbstractDeployerHookEJB
+{
+ /** Get the deployemnt type this deployer can handle
+ */
+ public DeploymentType getDeploymentType()
+ {
+ return DeploymentType.JAXRPC_EJB21;
+ }
+
+ @Override
+ public Deployment createDeployment(DeploymentInfo unit)
+ {
+ Deployment dep = createDeployment();
+ dep.setType(getDeploymentType());
+ dep.setClassLoader(unit.ucl);
+
+ Service service = dep.getService();
+
+ ApplicationMetaData appmd = (ApplicationMetaData)unit.metaData;
+ if (appmd == null)
+ throw new IllegalStateException("Deployment unit does not contain
application meta data");
+
+ WebservicesMetaData wsMetaData = getWebservicesMetaData(unit, null);
+ if (wsMetaData == null)
+ throw new IllegalStateException("Deployment unit does not contain
webservices meta data");
+
+ // Copy the attachments
+ dep.getContext().addAttachment(WebservicesMetaData.class, wsMetaData);
+ dep.getContext().addAttachment(ApplicationMetaData.class, appmd);
+
+ for (WebserviceDescriptionMetaData wsd : wsMetaData.getWebserviceDescriptions())
+ {
+ for (PortComponentMetaData pcmd : wsd.getPortComponents())
+ {
+ String ejbLink = pcmd.getEjbLink();
+ if (ejbLink == null)
+ throw new IllegalStateException("ejb-link cannot be null");
+
+ BeanMetaData beanMetaData = appmd.getBeanByEjbName(ejbLink);
+ if (beanMetaData == null)
+ throw new IllegalStateException("Cannot obtain bean meta data for:
" + ejbLink);
+
+ String ejbClass = beanMetaData.getEjbClass();
+ try
+ {
+ ClassLoader loader = unit.ucl;
+ Class<?> epBean = loader.loadClass(ejbClass.trim());
+
+ // Create the endpoint
+ Endpoint ep = createEndpoint();
+ ep.setService(service);
+ ep.setTargetBean(epBean);
+
+ String nameStr = Endpoint.SEPID_DOMAIN + ":" +
Endpoint.SEPID_PROPERTY_ENDPOINT + "=" + ejbLink;
+ ep.setName(ObjectNameFactory.create(nameStr));
+
+ service.addEndpoint(ep);
+ }
+ catch (ClassNotFoundException ex)
+ {
+ log.warn("Cannot load servlet class: " + ejbClass);
+ }
+ }
+ }
+ return dep;
+ }
+
+ @Override
+ public boolean isWebServiceDeployment(DeploymentInfo unit)
+ {
+ if ((unit.metaData instanceof ApplicationMetaData) == false)
+ return false;
+
+ WebservicesMetaData wsMetaData = getWebservicesMetaData(unit,
"META-INF/webservices.xml");
+ return wsMetaData != null;
+ }
+}
\ No newline at end of file
Copied:
branches/tdiesler/trunk/integration/jboss42/src/main/java/org/jboss/ws/integration/jboss42/JAXRPCDeployerHookJSE.java
(from rev 3110,
branches/tdiesler/trunk/integration/jbws-jboss42/src/main/java/org/jboss/ws/integration/jboss42/jbossws/JAXRPCDeployerHookJSE.java)
===================================================================
---
branches/tdiesler/trunk/integration/jboss42/src/main/java/org/jboss/ws/integration/jboss42/JAXRPCDeployerHookJSE.java
(rev 0)
+++
branches/tdiesler/trunk/integration/jboss42/src/main/java/org/jboss/ws/integration/jboss42/JAXRPCDeployerHookJSE.java 2007-05-17
11:53:42 UTC (rev 3120)
@@ -0,0 +1,147 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.ws.integration.jboss42;
+
+//$Id$
+
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Map.Entry;
+
+import org.jboss.deployment.DeploymentInfo;
+import org.jboss.metadata.WebMetaData;
+import org.jboss.ws.integration.Endpoint;
+import org.jboss.ws.integration.Service;
+import org.jboss.ws.integration.deployment.Deployment;
+import org.jboss.ws.integration.deployment.Deployment.DeploymentType;
+import org.jboss.ws.metadata.webservices.PortComponentMetaData;
+import org.jboss.ws.metadata.webservices.WebserviceDescriptionMetaData;
+import org.jboss.ws.metadata.webservices.WebservicesMetaData;
+import org.jboss.ws.utils.ObjectNameFactory;
+
+/**
+ * A deployer JAXRPC JSE Endpoints
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 25-Apr-2007
+ */
+public class JAXRPCDeployerHookJSE extends AbstractDeployerHookJSE
+{
+ /** Get the deployemnt type this deployer can handle
+ */
+ public DeploymentType getDeploymentType()
+ {
+ return DeploymentType.JAXRPC_JSE;
+ }
+
+ /**
+ * Create an endpoint for every servlet-link in webservices.xml
+ */
+ @Override
+ public Deployment createDeployment(DeploymentInfo unit)
+ {
+ Deployment dep = createDeployment();
+ dep.setType(getDeploymentType());
+ dep.setClassLoader(unit.annotationsCl);
+
+ Service service = dep.getService();
+
+ WebMetaData webMetaData = (WebMetaData)unit.metaData;
+ if (webMetaData == null)
+ throw new IllegalStateException("Deployment unit does not contain web meta
data");
+
+ WebservicesMetaData wsMetaData = getWebservicesMetaData(unit,
"WEB-INF/webservices.xml");
+ if (wsMetaData == null)
+ throw new IllegalStateException("Deployment unit does not contain
webservices meta data");
+
+ // Copy the attachments
+ dep.getContext().addAttachment(WebservicesMetaData.class, wsMetaData);
+ dep.getContext().addAttachment(WebMetaData.class, webMetaData);
+
+ for (WebserviceDescriptionMetaData wsd : wsMetaData.getWebserviceDescriptions())
+ {
+ for (PortComponentMetaData pcmd : wsd.getPortComponents())
+ {
+ String servletLink = pcmd.getServletLink();
+ if (servletLink == null)
+ throw new IllegalStateException("servlet-link cannot be null");
+
+ Servlet servlet = getServletForName(webMetaData, servletLink);
+ String servletClass = servlet.getServletClass();
+
+ try
+ {
+ ClassLoader loader = dep.getClassLoader();
+ Class<?> epBean = loader.loadClass(servletClass.trim());
+
+ // If this is a servlet we defer the the bean creation
+ if (javax.servlet.Servlet.class.isAssignableFrom(epBean))
+ {
+ epBean = null;
+ }
+
+ // Create the endpoint
+ Endpoint ep = createEndpoint();
+ ep.setService(service);
+ ep.setTargetBean(epBean);
+
+ String nameStr = Endpoint.SEPID_DOMAIN + ":" +
Endpoint.SEPID_PROPERTY_ENDPOINT + "=" + servletLink;
+ ep.setName(ObjectNameFactory.create(nameStr));
+
+ service.addEndpoint(ep);
+ }
+ catch (ClassNotFoundException ex)
+ {
+ log.warn("Cannot load servlet class: " + servletClass);
+ }
+ }
+ }
+
+ return dep;
+ }
+
+ private Servlet getServletForName(WebMetaData wmd, String servletLink)
+ {
+ Iterator it = wmd.getServletClassMap().entrySet().iterator();
+ while (it.hasNext())
+ {
+ Map.Entry entry = (Entry)it.next();
+ String servletName = (String)entry.getKey();
+ String servletClass = (String)entry.getValue();
+ if (servletLink.equals(servletName))
+ {
+ return new Servlet(servletName, servletClass);
+ }
+ }
+ throw new IllegalStateException("Cannot find servlet for link: " +
servletLink);
+ }
+
+ @Override
+ public boolean isWebServiceDeployment(DeploymentInfo unit)
+ {
+ if (super.isWebServiceDeployment(unit) == false)
+ return false;
+
+ WebservicesMetaData wsMetaData = getWebservicesMetaData(unit,
"WEB-INF/webservices.xml");
+ return wsMetaData != null;
+ }
+}
Copied:
branches/tdiesler/trunk/integration/jboss42/src/main/java/org/jboss/ws/integration/jboss42/JAXWSDeployerHookEJB3.java
(from rev 3110,
branches/tdiesler/trunk/integration/jbws-jboss42/src/main/java/org/jboss/ws/integration/jboss42/jbossws/JAXWSDeployerHookEJB3.java)
===================================================================
---
branches/tdiesler/trunk/integration/jboss42/src/main/java/org/jboss/ws/integration/jboss42/JAXWSDeployerHookEJB3.java
(rev 0)
+++
branches/tdiesler/trunk/integration/jboss42/src/main/java/org/jboss/ws/integration/jboss42/JAXWSDeployerHookEJB3.java 2007-05-17
11:53:42 UTC (rev 3120)
@@ -0,0 +1,124 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.ws.integration.jboss42;
+
+//$Id$
+
+import javax.jws.WebService;
+import javax.xml.ws.WebServiceProvider;
+
+import org.jboss.deployment.DeploymentInfo;
+import org.jboss.ejb3.EJBContainer;
+import org.jboss.ejb3.Ejb3ModuleMBean;
+import org.jboss.ejb3.stateless.StatelessContainer;
+import org.jboss.ws.integration.Endpoint;
+import org.jboss.ws.integration.Service;
+import org.jboss.ws.integration.deployment.Deployment;
+import org.jboss.ws.integration.deployment.Deployment.DeploymentType;
+import org.jboss.ws.utils.ObjectNameFactory;
+
+/**
+ * A deployer JAXWS EJB3 Endpoints
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 25-Apr-2007
+ */
+public class JAXWSDeployerHookEJB3 extends AbstractDeployerHookEJB
+{
+ /** Get the deployemnt type this deployer can handle
+ */
+ public DeploymentType getDeploymentType()
+ {
+ return DeploymentType.JAXWS_EJB3;
+ }
+
+ @Override
+ public Deployment createDeployment(DeploymentInfo unit)
+ {
+ Deployment dep = createDeployment();
+ dep.setType(getDeploymentType());
+ dep.setClassLoader(unit.ucl);
+
+ Service service = dep.getService();
+
+ Ejb3ModuleMBean ejb3Module =
DeploymentInfoAdapter.getEJB3Module(unit.deployedObject);
+ for (Object manager : ejb3Module.getContainers().values())
+ {
+ if (manager instanceof EJBContainer)
+ {
+ EJBContainer container = (EJBContainer)manager;
+ if (isWebServiceBean(container))
+ {
+ String ejbName = container.getEjbName();
+ Class epBean = container.getBeanClass();
+
+ // Create the endpoint
+ Endpoint ep = createEndpoint();
+ ep.setService(service);
+ ep.setTargetBean(epBean);
+
+ String nameStr = Endpoint.SEPID_DOMAIN + ":" +
Endpoint.SEPID_PROPERTY_ENDPOINT + "=" + ejbName;
+ ep.setName(ObjectNameFactory.create(nameStr));
+
+ service.addEndpoint(ep);
+ }
+ }
+ }
+
+ return dep;
+ }
+
+ @Override
+ public boolean isWebServiceDeployment(DeploymentInfo unit)
+ {
+ boolean isWebserviceDeployment = false;
+
+ // Check if the ejb3 contains annotated endpoints
+ Ejb3ModuleMBean ejb3Module =
DeploymentInfoAdapter.getEJB3Module(unit.deployedObject);
+ for (Object manager : ejb3Module.getContainers().values())
+ {
+ if (manager instanceof EJBContainer)
+ {
+ EJBContainer container = (EJBContainer)manager;
+ if (isWebServiceBean(container))
+ {
+ isWebserviceDeployment = true;
+ break;
+ }
+ }
+ }
+
+ return isWebserviceDeployment;
+ }
+
+ private boolean isWebServiceBean(EJBContainer container)
+ {
+ boolean isWebServiceBean = false;
+ if (container instanceof StatelessContainer)
+ {
+ boolean isWebService = container.resolveAnnotation(WebService.class) != null;
+ boolean isWebServiceProvider =
container.resolveAnnotation(WebServiceProvider.class) != null;
+ isWebServiceBean = isWebService || isWebServiceProvider;
+ }
+ return isWebServiceBean;
+ }
+}
\ No newline at end of file
Copied:
branches/tdiesler/trunk/integration/jboss42/src/main/java/org/jboss/ws/integration/jboss42/JAXWSDeployerHookJSE.java
(from rev 3110,
branches/tdiesler/trunk/integration/jbws-jboss42/src/main/java/org/jboss/ws/integration/jboss42/jbossws/JAXWSDeployerHookJSE.java)
===================================================================
---
branches/tdiesler/trunk/integration/jboss42/src/main/java/org/jboss/ws/integration/jboss42/JAXWSDeployerHookJSE.java
(rev 0)
+++
branches/tdiesler/trunk/integration/jboss42/src/main/java/org/jboss/ws/integration/jboss42/JAXWSDeployerHookJSE.java 2007-05-17
11:53:42 UTC (rev 3120)
@@ -0,0 +1,156 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.ws.integration.jboss42;
+
+//$Id$
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+
+import javax.jws.WebService;
+import javax.xml.ws.WebServiceProvider;
+
+import org.jboss.deployment.DeploymentInfo;
+import org.jboss.metadata.WebMetaData;
+import org.jboss.ws.integration.Endpoint;
+import org.jboss.ws.integration.Service;
+import org.jboss.ws.integration.deployment.Deployment;
+import org.jboss.ws.integration.deployment.Deployment.DeploymentType;
+import org.jboss.ws.utils.ObjectNameFactory;
+
+/**
+ * A deployer JAXWS JSE Endpoints
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 25-Apr-2007
+ */
+public class JAXWSDeployerHookJSE extends AbstractDeployerHookJSE
+{
+ /** Get the deployemnt type this deployer can handle
+ */
+ public DeploymentType getDeploymentType()
+ {
+ return DeploymentType.JAXWS_JSE;
+ }
+
+ @Override
+ public Deployment createDeployment(DeploymentInfo unit)
+ {
+ Deployment dep = createDeployment();
+ dep.setType(getDeploymentType());
+ dep.setClassLoader(unit.annotationsCl);
+
+ Service service = dep.getService();
+
+ WebMetaData webMetaData = (WebMetaData)unit.metaData;
+ if (webMetaData == null)
+ throw new IllegalStateException("Deployment unit does not contain web meta
data");
+
+ // Copy the attachments
+ dep.getContext().addAttachment(WebMetaData.class, webMetaData);
+
+ List<Servlet> servlets = getRelevantServlets(webMetaData,
unit.annotationsCl);
+ for (Servlet servlet : servlets)
+ {
+ String servletName = servlet.getServletName();
+ String servletClass = servlet.getServletClass();
+
+ try
+ {
+ ClassLoader loader = unit.annotationsCl;
+ Class<?> epBean = loader.loadClass(servletClass.trim());
+
+ // Create the endpoint
+ Endpoint ep = createEndpoint();
+ ep.setService(service);
+ ep.setTargetBean(epBean);
+
+ String nameStr = Endpoint.SEPID_DOMAIN + ":" +
Endpoint.SEPID_PROPERTY_ENDPOINT + "=" + servletName;
+ ep.setName(ObjectNameFactory.create(nameStr));
+
+ service.addEndpoint(ep);
+ }
+ catch (ClassNotFoundException ex)
+ {
+ log.warn("Cannot load servlet class: " + servletClass);
+ continue;
+ }
+ }
+
+ return dep;
+ }
+
+ @Override
+ public boolean isWebServiceDeployment(DeploymentInfo unit)
+ {
+ if (super.isWebServiceDeployment(unit) == false)
+ return false;
+
+ boolean isWebServiceDeployment = false;
+ try
+ {
+ WebMetaData webMetaData = (WebMetaData)unit.metaData;
+ List<Servlet> servlets = getRelevantServlets(webMetaData,
unit.annotationsCl);
+ isWebServiceDeployment = servlets.size() > 0;
+ }
+ catch (Exception ex)
+ {
+ log.error("Cannot process web deployment", ex);
+ }
+
+ return isWebServiceDeployment;
+ }
+
+ private List<Servlet> getRelevantServlets(WebMetaData webMetaData, ClassLoader
loader)
+ {
+ List<Servlet> servlets = new ArrayList<Servlet>();
+ Iterator it = webMetaData.getServletClassMap().entrySet().iterator();
+ while (it.hasNext())
+ {
+ Map.Entry entry = (Entry)it.next();
+ String servletName = (String)entry.getKey();
+ String servletClassName = (String)entry.getValue();
+
+ // Skip JSPs
+ if (servletClassName == null || servletClassName.length() == 0)
+ continue;
+
+ try
+ {
+ Class<?> servletClass = loader.loadClass(servletClassName.trim());
+ boolean isWebService = servletClass.isAnnotationPresent(WebService.class);
+ boolean isWebServiceProvider =
servletClass.isAnnotationPresent(WebServiceProvider.class);
+ if (isWebService || isWebServiceProvider)
+ servlets.add(new Servlet(servletName, servletClassName));
+ }
+ catch (ClassNotFoundException ex)
+ {
+ log.warn("Cannot load servlet class: " + servletClassName);
+ continue;
+ }
+ }
+ return servlets;
+ }
+}
\ No newline at end of file
Copied:
branches/tdiesler/trunk/integration/jboss42/src/main/java/org/jboss/ws/integration/jboss42/MainDeployerHook.java
(from rev 3110,
branches/tdiesler/trunk/integration/jbws-jboss42/src/main/java/org/jboss/ws/integration/jboss42/jbossws/MainDeployerHook.java)
===================================================================
---
branches/tdiesler/trunk/integration/jboss42/src/main/java/org/jboss/ws/integration/jboss42/MainDeployerHook.java
(rev 0)
+++
branches/tdiesler/trunk/integration/jboss42/src/main/java/org/jboss/ws/integration/jboss42/MainDeployerHook.java 2007-05-17
11:53:42 UTC (rev 3120)
@@ -0,0 +1,61 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.ws.integration.jboss42;
+
+//$Id$
+
+import org.jboss.deployment.DeploymentException;
+import org.jboss.deployment.DeploymentInfo;
+import org.jboss.ws.integration.deployment.Deployment;
+
+/**
+ * A basic hook that delegates a deployment manger.
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 25-Apr-2007
+ */
+public class MainDeployerHook extends AbstractDeployerHook
+{
+ public void deploy(DeploymentInfo unit) throws DeploymentException
+ {
+ if (ignoreDeployment(unit))
+ return;
+
+ Deployment dep = (Deployment)unit.context.get(Deployment.class);
+ if (dep != null)
+ {
+ deployerManager.deploy(dep);
+ }
+ }
+
+ public void undeploy(DeploymentInfo unit)
+ {
+ if (ignoreDeployment(unit))
+ return;
+
+ Deployment dep = (Deployment)unit.context.get(Deployment.class);
+ if (dep != null)
+ {
+ deployerManager.undeploy(dep);
+ }
+ }
+}
Copied:
branches/tdiesler/trunk/integration/jboss42/src/main/java/org/jboss/ws/integration/jboss42/ModifyWebMetaDataDeployer.java
(from rev 3110,
branches/tdiesler/trunk/integration/jbws-jboss42/src/main/java/org/jboss/ws/integration/jboss42/jbossws/ModifyWebMetaDataDeployer.java)
===================================================================
---
branches/tdiesler/trunk/integration/jboss42/src/main/java/org/jboss/ws/integration/jboss42/ModifyWebMetaDataDeployer.java
(rev 0)
+++
branches/tdiesler/trunk/integration/jboss42/src/main/java/org/jboss/ws/integration/jboss42/ModifyWebMetaDataDeployer.java 2007-05-17
11:53:42 UTC (rev 3120)
@@ -0,0 +1,80 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.ws.integration.jboss42;
+
+//$Id$
+
+import org.jboss.ws.integration.Endpoint;
+import org.jboss.ws.integration.deployment.AbstractDeployer;
+import org.jboss.ws.integration.deployment.Deployment;
+import org.jboss.ws.integration.deployment.ServiceEndpointPublisher;
+import org.jboss.ws.integration.deployment.UnifiedDeploymentInfo;
+import org.jboss.ws.integration.deployment.ServiceEndpointPublisher.RewriteResults;
+
+/**
+ * A deployer that modifies the web.xml meta data
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 25-Apr-2007
+ */
+public class ModifyWebMetaDataDeployer extends AbstractDeployer
+{
+ private ServiceEndpointPublisher serviceEndpointPublisher;
+
+ public void setServiceEndpointPublisher(ServiceEndpointPublisher
serviceEndpointPublisher)
+ {
+ this.serviceEndpointPublisher = serviceEndpointPublisher;
+ }
+
+ public void create(Deployment dep)
+ {
+ UnifiedDeploymentInfo udi =
dep.getContext().getAttachment(UnifiedDeploymentInfo.class);
+ if (udi == null)
+ throw new IllegalStateException("Cannot obtain unified deployement
info");
+
+ RewriteResults results = serviceEndpointPublisher.rewriteWebXml(udi);
+
+ // The endpoint may not have a target bean when
+ // <servlet-class> originally contained a javax.servlet.Servlet
+ for (Endpoint ep : dep.getService().getEndpoints())
+ {
+ if (ep.getTargetBean() == null)
+ {
+ String servletName =
ep.getName().getKeyProperty(Endpoint.SEPID_PROPERTY_ENDPOINT);
+ String beanName = results.sepTargetMap.get(servletName);
+ if (beanName == null)
+ throw new IllegalStateException("Cannot obtain target bean for:
" + servletName);
+
+ try
+ {
+ ClassLoader loader = dep.getClassLoader();
+ Class<?> epBean = loader.loadClass(beanName);
+ ep.setTargetBean(epBean);
+ }
+ catch (ClassNotFoundException ex)
+ {
+ log.warn("Cannot load target bean: " + beanName);
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
Copied:
branches/tdiesler/trunk/integration/jboss42/src/main/java/org/jboss/ws/integration/jboss42/SecurityRolesHandlerEJB21.java
(from rev 3110,
branches/tdiesler/trunk/integration/jbws-jboss42/src/main/java/org/jboss/ws/integration/jboss42/jbossws/SecurityRolesHandlerEJB21.java)
===================================================================
---
branches/tdiesler/trunk/integration/jboss42/src/main/java/org/jboss/ws/integration/jboss42/SecurityRolesHandlerEJB21.java
(rev 0)
+++
branches/tdiesler/trunk/integration/jboss42/src/main/java/org/jboss/ws/integration/jboss42/SecurityRolesHandlerEJB21.java 2007-05-17
11:53:42 UTC (rev 3120)
@@ -0,0 +1,70 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.ws.integration.jboss42;
+
+//$Id$
+
+import java.util.Iterator;
+import java.util.Map;
+
+import org.jboss.logging.Logger;
+import org.jboss.metadata.ApplicationMetaData;
+import org.jboss.metadata.AssemblyDescriptorMetaData;
+import org.jboss.ws.integration.deployment.SecurityRolesHandler;
+import org.jboss.ws.integration.deployment.UnifiedDeploymentInfo;
+import org.jboss.ws.utils.DOMUtils;
+import org.w3c.dom.Element;
+
+/**
+ * Generate a service endpoint deployment for EJB endpoints
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 12-May-2006
+ */
+public class SecurityRolesHandlerEJB21 implements SecurityRolesHandler
+{
+ // logging support
+ protected Logger log = Logger.getLogger(SecurityRolesHandlerEJB21.class);
+
+ /** Add the roles from ejb-jar.xml to the security roles
+ */
+ public void addSecurityRoles(Element webApp, UnifiedDeploymentInfo udi)
+ {
+ // Fix:
http://jira.jboss.org/jira/browse/JBWS-309
+ ApplicationMetaData applMetaData =
(ApplicationMetaData)udi.getAttachment(ApplicationMetaData.class);
+ AssemblyDescriptorMetaData assemblyDescriptor =
applMetaData.getAssemblyDescriptor();
+ if (assemblyDescriptor != null)
+ {
+ Map securityRoles = assemblyDescriptor.getSecurityRoles();
+ if (securityRoles != null)
+ {
+ Iterator it = securityRoles.keySet().iterator();
+ while (it.hasNext())
+ {
+ Element securityRole =
(Element)webApp.appendChild(DOMUtils.createElement("security-role"));
+ Element roleName =
(Element)securityRole.appendChild(DOMUtils.createElement("role-name"));
+ roleName.appendChild(DOMUtils.createTextNode((String)it.next()));
+ }
+ }
+ }
+ }
+}
Copied:
branches/tdiesler/trunk/integration/jboss42/src/main/java/org/jboss/ws/integration/jboss42/SecurityRolesHandlerEJB3.java
(from rev 3110,
branches/tdiesler/trunk/integration/jbws-jboss42/src/main/java/org/jboss/ws/integration/jboss42/jbossws/SecurityRolesHandlerEJB3.java)
===================================================================
---
branches/tdiesler/trunk/integration/jboss42/src/main/java/org/jboss/ws/integration/jboss42/SecurityRolesHandlerEJB3.java
(rev 0)
+++
branches/tdiesler/trunk/integration/jboss42/src/main/java/org/jboss/ws/integration/jboss42/SecurityRolesHandlerEJB3.java 2007-05-17
11:53:42 UTC (rev 3120)
@@ -0,0 +1,96 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.ws.integration.jboss42;
+
+//$Id$
+
+import javax.annotation.security.RolesAllowed;
+import javax.management.MBeanServer;
+import javax.management.ObjectName;
+
+import org.jboss.ejb3.Ejb3ModuleMBean;
+import org.jboss.ejb3.stateless.StatelessContainer;
+import org.jboss.logging.Logger;
+import org.jboss.mx.util.MBeanProxy;
+import org.jboss.mx.util.MBeanProxyCreationException;
+import org.jboss.mx.util.MBeanServerLocator;
+import org.jboss.ws.integration.deployment.SecurityRolesHandler;
+import org.jboss.ws.integration.deployment.UnifiedDeploymentInfo;
+import org.jboss.ws.integration.deployment.WSDeploymentException;
+import org.jboss.ws.utils.DOMUtils;
+import org.w3c.dom.Element;
+
+/**
+ * Generate a service endpoint deployment for EJB endpoints
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 12-May-2006
+ */
+public class SecurityRolesHandlerEJB3 implements SecurityRolesHandler
+{
+ // logging support
+ protected Logger log = Logger.getLogger(SecurityRolesHandlerEJB3.class);
+
+ /** Add the roles from ejb-jar.xml to the security roles
+ */
+ public void addSecurityRoles(Element webApp, UnifiedDeploymentInfo udi)
+ {
+ // The container objects below provide access to all of the ejb metadata
+ Ejb3ModuleMBean ejb3Module = getEJB3Module(udi.deployedObject);
+ for (Object manager : ejb3Module.getContainers().values())
+ {
+ if (manager instanceof StatelessContainer)
+ {
+ StatelessContainer container = (StatelessContainer)manager;
+
+ RolesAllowed anRolesAllowed =
(RolesAllowed)container.resolveAnnotation(RolesAllowed.class);
+ if (anRolesAllowed != null)
+ {
+ for (String role : anRolesAllowed.value())
+ {
+ Element securityRole =
(Element)webApp.appendChild(DOMUtils.createElement("security-role"));
+ Element roleName =
(Element)securityRole.appendChild(DOMUtils.createElement("role-name"));
+ roleName.appendChild(DOMUtils.createTextNode(role));
+ }
+ }
+ }
+ }
+ }
+
+ private Ejb3ModuleMBean getEJB3Module(ObjectName objectName)
+ {
+ Ejb3ModuleMBean ejb3Module;
+ try
+ {
+ MBeanServer server = MBeanServerLocator.locateJBoss();
+ ejb3Module = (Ejb3ModuleMBean)MBeanProxy.get(Ejb3ModuleMBean.class, objectName,
server);
+ if (ejb3Module == null)
+ throw new WSDeploymentException("Cannot obtain EJB3 module: " +
objectName);
+
+ return ejb3Module;
+ }
+ catch (MBeanProxyCreationException ex)
+ {
+ throw new WSDeploymentException("Cannot obtain proxy to EJB3
module");
+ }
+ }
+}
Added:
branches/tdiesler/trunk/integration/jboss42/src/main/java/org/jboss/ws/integration/jboss42/ServiceEndpointInterceptor.java
===================================================================
---
branches/tdiesler/trunk/integration/jboss42/src/main/java/org/jboss/ws/integration/jboss42/ServiceEndpointInterceptor.java
(rev 0)
+++
branches/tdiesler/trunk/integration/jboss42/src/main/java/org/jboss/ws/integration/jboss42/ServiceEndpointInterceptor.java 2007-05-17
11:53:42 UTC (rev 3120)
@@ -0,0 +1,127 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.ws.integration.jboss42;
+
+// $Id$
+
+import javax.xml.rpc.handler.soap.SOAPMessageContext;
+
+import org.jboss.ejb.plugins.AbstractInterceptor;
+import org.jboss.invocation.Invocation;
+import org.jboss.invocation.InvocationKey;
+import org.jboss.logging.Logger;
+import org.jboss.ws.integration.invocation.HandlerCallback;
+import org.jboss.ws.metadata.j2ee.serviceref.UnifiedHandlerMetaData.HandlerType;
+
+/**
+ * This Interceptor does the ws4ee handler processing.
+ *
+ * According to the ws4ee spec the handler logic must be invoked after the container
+ * applied method level security to the invocation.
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 21-Sep-2005
+ */
+public class ServiceEndpointInterceptor extends AbstractInterceptor
+{
+ // provide logging
+ private static Logger log = Logger.getLogger(ServiceEndpointInterceptor.class);
+
+ // Interceptor implementation --------------------------------------
+
+ /** Before and after we call the service endpoint bean, we process the handler
chains.
+ */
+ public Object invoke(final Invocation mi) throws Exception
+ {
+ // If no msgContext, it's not for us
+ SOAPMessageContext msgContext =
(SOAPMessageContext)mi.getPayloadValue(InvocationKey.SOAP_MESSAGE_CONTEXT);
+ if (msgContext == null)
+ {
+ return getNext().invoke(mi);
+ }
+
+ // Get the endpoint invocation
+ org.jboss.ws.integration.invocation.EndpointInvocation epInv =
(org.jboss.ws.integration.invocation.EndpointInvocation)mi
+
.getValue(org.jboss.ws.integration.invocation.EndpointInvocation.class.getName());
+
+ // Get the handler callback
+ HandlerCallback callback =
(HandlerCallback)mi.getValue(HandlerCallback.class.getName());
+
+ // Handlers need to be Tx. Therefore we must invoke the handler chain after the
TransactionInterceptor.
+ if (callback != null && epInv != null)
+ {
+ try
+ {
+ // call the request handlers
+ boolean handlersPass =
callback.callRequestHandlerChain(HandlerType.ENDPOINT);
+ handlersPass = handlersPass &&
callback.callRequestHandlerChain(HandlerType.POST);
+
+ // Call the next interceptor in the chain
+ if (handlersPass)
+ {
+ // The SOAPContentElements stored in the EndpointInvocation might have
changed after
+ // handler processing. Get the updated request payload. This should be a
noop if request
+ // handlers did not modify the incomming SOAP message.
+ Object[] reqParams = epInv.getArgs();
+ mi.setArguments(reqParams);
+ Object resObj = getNext().invoke(mi);
+
+ // Setting the message to null should trigger binding of the response
message
+ msgContext.setMessage(null);
+ epInv.setReturnValue(resObj);
+ }
+
+ // call the response handlers
+ handlersPass = callback.callResponseHandlerChain(HandlerType.POST);
+ handlersPass = handlersPass &&
callback.callResponseHandlerChain(HandlerType.ENDPOINT);
+
+ // update the return value after response handler processing
+ Object resObj = epInv.getReturnValue();
+
+ return resObj;
+ }
+ catch (Exception ex)
+ {
+ try
+ {
+ // call the fault handlers
+ boolean handlersPass = callback.callFaultHandlerChain(HandlerType.POST,
ex);
+ handlersPass = handlersPass &&
callback.callFaultHandlerChain(HandlerType.ENDPOINT, ex);
+ }
+ catch (Exception subEx)
+ {
+ log.warn("Cannot process handlerChain.handleFault, ignoring: ",
subEx);
+ }
+ throw ex;
+ }
+ finally
+ {
+ // do nothing
+ }
+ }
+ else
+ {
+ log.warn("Handler callback not available");
+ return getNext().invoke(mi);
+ }
+ }
+}
Property changes on:
branches/tdiesler/trunk/integration/jboss42/src/main/java/org/jboss/ws/integration/jboss42/ServiceEndpointInterceptor.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Copied:
branches/tdiesler/trunk/integration/jboss42/src/main/java/org/jboss/ws/integration/jboss42/UnifiedDeploymentInfoDeployer.java
(from rev 3110,
branches/tdiesler/trunk/integration/jbws-jboss42/src/main/java/org/jboss/ws/integration/jboss42/jbossws/UnifiedDeploymentInfoDeployer.java)
===================================================================
---
branches/tdiesler/trunk/integration/jboss42/src/main/java/org/jboss/ws/integration/jboss42/UnifiedDeploymentInfoDeployer.java
(rev 0)
+++
branches/tdiesler/trunk/integration/jboss42/src/main/java/org/jboss/ws/integration/jboss42/UnifiedDeploymentInfoDeployer.java 2007-05-17
11:53:42 UTC (rev 3120)
@@ -0,0 +1,76 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.ws.integration.jboss42;
+
+//$Id$
+
+import org.jboss.deployment.DeploymentInfo;
+import org.jboss.ws.integration.deployment.AbstractDeployer;
+import org.jboss.ws.integration.deployment.Deployment;
+import org.jboss.ws.integration.deployment.JAXRPCDeployment;
+import org.jboss.ws.integration.deployment.JAXWSDeployment;
+import org.jboss.ws.integration.deployment.UnifiedDeploymentInfo;
+import org.jboss.ws.integration.deployment.Deployment.DeploymentType;
+import org.jboss.ws.metadata.webservices.WebservicesMetaData;
+
+/**
+ * A deployer that builds the UnifiedDeploymentInfo
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 25-Apr-2007
+ */
+public class UnifiedDeploymentInfoDeployer extends AbstractDeployer
+{
+ private DeploymentInfoAdapter deploymentInfoAdapter;
+
+ public void setDeploymentInfoAdapter(DeploymentInfoAdapter deploymentInfoAdapter)
+ {
+ this.deploymentInfoAdapter = deploymentInfoAdapter;
+ }
+
+ @Override
+ public void create(Deployment dep)
+ {
+ UnifiedDeploymentInfo udi =
dep.getContext().getAttachment(UnifiedDeploymentInfo.class);
+ if (udi == null)
+ {
+ DeploymentInfo unit = dep.getContext().getAttachment(DeploymentInfo.class);
+ if (unit == null)
+ throw new IllegalStateException("Cannot obtain deployment unit");
+
+ DeploymentType type = dep.getType();
+ if (type.toString().startsWith("JAXWS"))
+ {
+ udi = new JAXWSDeployment(type);
+ deploymentInfoAdapter.buildDeploymentInfo(udi, unit);
+ }
+ else
+ {
+ WebservicesMetaData wsMetaData =
dep.getContext().getAttachment(WebservicesMetaData.class);
+ udi = new JAXRPCDeployment(type, wsMetaData);
+ deploymentInfoAdapter.buildDeploymentInfo(udi, unit);
+ }
+
+ dep.getContext().addAttachment(UnifiedDeploymentInfo.class, udi);
+ }
+ }
+}
\ No newline at end of file
Copied:
branches/tdiesler/trunk/integration/jboss42/src/main/java/org/jboss/ws/integration/jboss42/WebAppDeployerDeployer.java
(from rev 3110,
branches/tdiesler/trunk/integration/jbws-jboss42/src/main/java/org/jboss/ws/integration/jboss42/jbossws/WebAppDeployerDeployer.java)
===================================================================
---
branches/tdiesler/trunk/integration/jboss42/src/main/java/org/jboss/ws/integration/jboss42/WebAppDeployerDeployer.java
(rev 0)
+++
branches/tdiesler/trunk/integration/jboss42/src/main/java/org/jboss/ws/integration/jboss42/WebAppDeployerDeployer.java 2007-05-17
11:53:42 UTC (rev 3120)
@@ -0,0 +1,118 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.ws.integration.jboss42;
+
+// $Id$
+
+import java.net.URL;
+
+import javax.management.MBeanServer;
+
+import org.jboss.deployment.DeploymentInfo;
+import org.jboss.deployment.MainDeployerMBean;
+import org.jboss.logging.Logger;
+import org.jboss.mx.util.MBeanProxy;
+import org.jboss.mx.util.MBeanProxyCreationException;
+import org.jboss.mx.util.MBeanServerLocator;
+import org.jboss.ws.integration.deployment.AbstractDeployer;
+import org.jboss.ws.integration.deployment.Deployment;
+import org.jboss.ws.integration.deployment.ServiceEndpointPublisher;
+import org.jboss.ws.integration.deployment.UnifiedDeploymentInfo;
+import org.jboss.ws.integration.deployment.WSDeploymentException;
+
+/**
+ * Publish the HTTP service endpoint to Tomcat
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 12-May-2006
+ */
+public class WebAppDeployerDeployer extends AbstractDeployer
+{
+ // provide logging
+ private static Logger log = Logger.getLogger(WebAppDeployerDeployer.class);
+
+ private ServiceEndpointPublisher serviceEndpointPublisher;
+
+ public void setServiceEndpointPublisher(ServiceEndpointPublisher
serviceEndpointPublisher)
+ {
+ this.serviceEndpointPublisher = serviceEndpointPublisher;
+ }
+
+ public void create(Deployment dep)
+ {
+ UnifiedDeploymentInfo udi =
dep.getContext().getAttachment(UnifiedDeploymentInfo.class);
+ if (udi == null)
+ throw new IllegalStateException("Cannot obtain unified deployement
info");
+
+ URL warURL = udi.webappURL;
+
+ log.debug("publishServiceEndpoint: " + warURL);
+ try
+ {
+ DeploymentInfo di = udi.getAttachment(DeploymentInfo.class);
+ if (di == null)
+ throw new IllegalStateException("Cannot obtain DeploymentInfo from
context");
+
+ serviceEndpointPublisher.rewriteWebXml(udi);
+
+ // Preserve the repository config
+ DeploymentInfo auxdi = new DeploymentInfo(warURL, null,
MBeanServerLocator.locateJBoss());
+ auxdi.repositoryConfig = di.getTopRepositoryConfig();
+ getMainDeployer().deploy(auxdi);
+ }
+ catch (Exception ex)
+ {
+ WSDeploymentException.rethrow(ex);
+ }
+ }
+
+ public void destroy(Deployment dep)
+ {
+ UnifiedDeploymentInfo udi =
dep.getContext().getAttachment(UnifiedDeploymentInfo.class);
+ if (udi == null)
+ throw new IllegalStateException("Cannot obtain unified deployement
info");
+
+ URL warURL = udi.webappURL;
+ if (warURL == null)
+ {
+ log.error("Cannot obtain warURL for: " + udi.name);
+ return;
+ }
+
+ log.debug("destroyServiceEndpoint: " + warURL);
+ try
+ {
+ getMainDeployer().undeploy(warURL);
+ }
+ catch (Exception ex)
+ {
+ WSDeploymentException.rethrow(ex);
+ }
+ }
+
+ private MainDeployerMBean getMainDeployer() throws MBeanProxyCreationException
+ {
+ MBeanServer server = MBeanServerLocator.locateJBoss();
+ MainDeployerMBean mainDeployer =
(MainDeployerMBean)MBeanProxy.get(MainDeployerMBean.class, MainDeployerMBean.OBJECT_NAME,
server);
+ return mainDeployer;
+ }
+}
Copied:
branches/tdiesler/trunk/integration/jboss42/src/main/java/org/jboss/ws/integration/jboss42/WebMetaDataAdapter.java
(from rev 3110,
branches/tdiesler/trunk/integration/jbws-jboss42/src/main/java/org/jboss/ws/integration/jboss42/jbossws/WebMetaDataAdapter.java)
===================================================================
---
branches/tdiesler/trunk/integration/jboss42/src/main/java/org/jboss/ws/integration/jboss42/WebMetaDataAdapter.java
(rev 0)
+++
branches/tdiesler/trunk/integration/jboss42/src/main/java/org/jboss/ws/integration/jboss42/WebMetaDataAdapter.java 2007-05-17
11:53:42 UTC (rev 3120)
@@ -0,0 +1,122 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.ws.integration.jboss42;
+
+// $Id$
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+
+import org.jboss.metadata.WebMetaData;
+import org.jboss.metadata.WebSecurityMetaData;
+import org.jboss.metadata.WebSecurityMetaData.WebResourceCollection;
+import org.jboss.ws.integration.deployment.UnifiedDeploymentInfo;
+import org.jboss.ws.metadata.j2ee.UnifiedWebMetaData;
+import org.jboss.ws.metadata.j2ee.UnifiedWebSecurityMetaData;
+import org.jboss.ws.metadata.j2ee.UnifiedWebMetaData.PublishLocationAdapter;
+import
org.jboss.ws.metadata.j2ee.UnifiedWebSecurityMetaData.UnifiedWebResourceCollection;
+
+/**
+ * Build container independent web meta data
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 05-May-2006
+ */
+public class WebMetaDataAdapter
+{
+ public UnifiedWebMetaData buildUnifiedWebMetaData(UnifiedDeploymentInfo udi,
WebMetaData webMetaData)
+ {
+ udi.addAttachment(WebMetaData.class, webMetaData);
+
+ UnifiedWebMetaData umd = new UnifiedWebMetaData();
+ umd.setContextRoot(webMetaData.getContextRoot());
+ umd.setServletMappings(webMetaData.getServletMappings());
+ umd.setServletClassNames(getServletClassMap(webMetaData));
+ umd.setConfigName(webMetaData.getConfigName());
+ umd.setConfigFile(webMetaData.getConfigFile());
+ umd.setSecurityDomain(webMetaData.getSecurityDomain());
+ umd.setPublishLocationAdapter(getPublishLocationAdpater(webMetaData));
+ umd.setSecurityMetaData(getSecurityMetaData(webMetaData.getSecurityContraints()));
+
+ return umd;
+ }
+
+ private PublishLocationAdapter getPublishLocationAdpater(final WebMetaData wmd)
+ {
+ return new PublishLocationAdapter()
+ {
+ public String getWsdlPublishLocationByName(String name)
+ {
+ return wmd.getWsdlPublishLocationByName(name);
+ }
+ };
+ }
+
+ private List<UnifiedWebSecurityMetaData> getSecurityMetaData(final Iterator
securityConstraints)
+ {
+ ArrayList<UnifiedWebSecurityMetaData> unifiedsecurityMetaData = new
ArrayList<UnifiedWebSecurityMetaData>();
+
+ while (securityConstraints.hasNext())
+ {
+ WebSecurityMetaData securityMetaData =
(WebSecurityMetaData)securityConstraints.next();
+
+ UnifiedWebSecurityMetaData current = new UnifiedWebSecurityMetaData();
+ unifiedsecurityMetaData.add(current);
+
+ current.setTransportGuarantee(securityMetaData.getTransportGuarantee());
+
+ HashMap resources = securityMetaData.getWebResources();
+ for (Object webResourceObj : resources.values())
+ {
+ WebResourceCollection webResource = (WebResourceCollection)webResourceObj;
+ UnifiedWebResourceCollection currentResource =
current.addWebResource(webResource.getName());
+ for (String currentPattern : webResource.getUrlPatterns())
+ {
+ currentResource.addPattern(currentPattern);
+ }
+ }
+
+ }
+
+ return unifiedsecurityMetaData;
+ }
+
+ private Map<String, String> getServletClassMap(WebMetaData wmd)
+ {
+ Map<String, String> mappings = new HashMap<String, String>();
+ Iterator it = wmd.getServletClassMap().entrySet().iterator();
+ while (it.hasNext())
+ {
+ Map.Entry entry = (Entry)it.next();
+ String servletName = (String)entry.getKey();
+ String servletClass = (String)entry.getValue();
+ // Skip JSPs
+ if (servletClass != null)
+ mappings.put(servletName, servletClass);
+ }
+ return mappings;
+ }
+}
Modified: branches/tdiesler/trunk/integration/jboss50/ant-import/build-thirdparty.xml
===================================================================
--- branches/tdiesler/trunk/integration/jboss50/ant-import/build-thirdparty.xml 2007-05-17
11:03:51 UTC (rev 3119)
+++ branches/tdiesler/trunk/integration/jboss50/ant-import/build-thirdparty.xml 2007-05-17
11:53:42 UTC (rev 3120)
@@ -28,7 +28,7 @@
<target name="thirdparty-get" depends="thirdparty-init"
description="Gets the thirdparty libraries"/>
- <target name="thirdparty-classpath"
depends="thirdparty-init">
+ <target name="thirdparty-classpath"
depends="thirdparty-get">
<!-- The compile classpath for jboss50 integration -->
<path id="jbws50.integration.classpath">
Deleted:
branches/tdiesler/trunk/integration/jboss50/src/main/java/org/jboss/ws/integration/jboss50/AbstractInvocationHandler.java
===================================================================
---
branches/tdiesler/trunk/integration/jboss50/src/main/java/org/jboss/ws/integration/jboss50/AbstractInvocationHandler.java 2007-05-17
11:03:51 UTC (rev 3119)
+++
branches/tdiesler/trunk/integration/jboss50/src/main/java/org/jboss/ws/integration/jboss50/AbstractInvocationHandler.java 2007-05-17
11:53:42 UTC (rev 3120)
@@ -1,119 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt 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.ws.integration.jboss50;
-
-// $Id$
-
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.lang.reflect.UndeclaredThrowableException;
-
-import javax.management.MBeanException;
-
-import org.jboss.logging.Logger;
-import org.jboss.ws.core.utils.JavaUtils;
-import org.jboss.ws.integration.Endpoint;
-import org.jboss.ws.integration.invocation.InvocationHandler;
-
-/**
- * Handles invocations on endpoints.
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 25-Apr-2007
- */
-public abstract class AbstractInvocationHandler implements InvocationHandler
-{
- // provide logging
- private static final Logger log = Logger.getLogger(AbstractInvocationHandler.class);
-
- protected Method getImplMethod(Class implClass, Method seiMethod) throws
ClassNotFoundException, NoSuchMethodException
- {
- String methodName = seiMethod.getName();
- Class[] paramTypes = seiMethod.getParameterTypes();
- for (int i = 0; i < paramTypes.length; i++)
- {
- Class paramType = paramTypes[i];
- if (JavaUtils.isPrimitive(paramType) == false)
- {
- String paramTypeName = paramType.getName();
- paramType = JavaUtils.loadJavaType(paramTypeName);
- paramTypes[i] = paramType;
- }
- }
-
- Method implMethod = implClass.getMethod(methodName, paramTypes);
- return implMethod;
- }
-
- protected void handleInvocationException(Throwable th) throws Exception
- {
- if (th instanceof InvocationTargetException)
- {
- // unwrap the throwable raised by the service endpoint implementation
- Throwable targetEx = ((InvocationTargetException)th).getTargetException();
- handleInvocationThrowable(targetEx);
- }
-
- if (th instanceof MBeanException)
- {
- throw ((MBeanException)th).getTargetException();
- }
-
- handleInvocationThrowable(th);
- }
-
- private void handleInvocationThrowable(Throwable th) throws Exception
- {
- if (th instanceof Exception)
- {
- throw (Exception)th;
- }
- else if (th instanceof Error)
- {
- throw (Error)th;
- }
- else
- {
- throw new UndeclaredThrowableException(th);
- }
- }
-
- public void create(Endpoint ep)
- {
- log.debug("Create: " + ep.getName());
- }
-
- public void start(Endpoint ep)
- {
- log.debug("Start: " + ep.getName());
- }
-
- public void stop(Endpoint ep)
- {
- log.debug("Stop: " + ep.getName());
- }
-
- public void destroy(Endpoint ep)
- {
- log.debug("Destroy: " + ep.getName());
- }
-}
Modified:
branches/tdiesler/trunk/integration/jboss50/src/main/java/org/jboss/ws/integration/jboss50/InvocationHandlerEJB21.java
===================================================================
---
branches/tdiesler/trunk/integration/jboss50/src/main/java/org/jboss/ws/integration/jboss50/InvocationHandlerEJB21.java 2007-05-17
11:03:51 UTC (rev 3119)
+++
branches/tdiesler/trunk/integration/jboss50/src/main/java/org/jboss/ws/integration/jboss50/InvocationHandlerEJB21.java 2007-05-17
11:53:42 UTC (rev 3120)
@@ -44,8 +44,9 @@
import org.jboss.security.SecurityAssociation;
import org.jboss.ws.integration.Endpoint;
import org.jboss.ws.integration.deployment.UnifiedDeploymentInfo;
+import org.jboss.ws.integration.invocation.AbstractInvocationHandler;
+import org.jboss.ws.integration.invocation.EndpointInvocation;
import org.jboss.ws.integration.invocation.HandlerCallback;
-import org.jboss.ws.integration.invocation.EndpointInvocation;
import org.jboss.ws.metadata.j2ee.UnifiedApplicationMetaData;
import org.jboss.ws.metadata.j2ee.UnifiedBeanMetaData;
import org.jboss.ws.utils.ObjectNameFactory;
Modified:
branches/tdiesler/trunk/integration/jboss50/src/main/java/org/jboss/ws/integration/jboss50/InvocationHandlerEJB3.java
===================================================================
---
branches/tdiesler/trunk/integration/jboss50/src/main/java/org/jboss/ws/integration/jboss50/InvocationHandlerEJB3.java 2007-05-17
11:03:51 UTC (rev 3119)
+++
branches/tdiesler/trunk/integration/jboss50/src/main/java/org/jboss/ws/integration/jboss50/InvocationHandlerEJB3.java 2007-05-17
11:53:42 UTC (rev 3120)
@@ -39,6 +39,7 @@
import org.jboss.injection.lang.reflect.BeanProperty;
import org.jboss.ws.integration.Endpoint;
import org.jboss.ws.integration.deployment.UnifiedDeploymentInfo;
+import org.jboss.ws.integration.invocation.AbstractInvocationHandler;
import org.jboss.ws.integration.invocation.EndpointInvocation;
import org.jboss.ws.integration.invocation.WebServiceContextEJB;
import org.jboss.ws.utils.ObjectNameFactory;
Deleted:
branches/tdiesler/trunk/integration/jboss50/src/main/java/org/jboss/ws/integration/jboss50/InvocationHandlerJSE.java
===================================================================
---
branches/tdiesler/trunk/integration/jboss50/src/main/java/org/jboss/ws/integration/jboss50/InvocationHandlerJSE.java 2007-05-17
11:03:51 UTC (rev 3119)
+++
branches/tdiesler/trunk/integration/jboss50/src/main/java/org/jboss/ws/integration/jboss50/InvocationHandlerJSE.java 2007-05-17
11:53:42 UTC (rev 3120)
@@ -1,100 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt 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.ws.integration.jboss50;
-
-// $Id$
-
-import java.lang.reflect.Method;
-
-import javax.xml.rpc.server.ServiceLifecycle;
-import javax.xml.rpc.server.ServletEndpointContext;
-import javax.xml.ws.WebServiceContext;
-import javax.xml.ws.WebServiceException;
-
-import org.jboss.ws.integration.Endpoint;
-import org.jboss.ws.integration.invocation.EndpointInvocation;
-import org.jboss.ws.integration.invocation.InvocationContext;
-import org.jboss.ws.integration.invocation.WebServiceContextInjector;
-
-/**
- * Handles invocations on JSE endpoints.
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 25-Apr-2007
- */
-public class InvocationHandlerJSE extends AbstractInvocationHandler
-{
- private Object targetBean;
-
- public void create(Endpoint ep)
- {
- try
- {
- Class epImpl = ep.getTargetBean();
- targetBean = epImpl.newInstance();
- }
- catch (Exception ex)
- {
- throw new WebServiceException("Cannot load target bean");
- }
- }
-
- public void invoke(Endpoint ep, EndpointInvocation epInv) throws Exception
- {
- try
- {
- InvocationContext invContext = epInv.getInvocationContext();
- WebServiceContext wsContext =
invContext.getAttachment(WebServiceContext.class);
- if (wsContext != null)
- {
- new WebServiceContextInjector().injectContext(targetBean,
(WebServiceContext)wsContext);
- }
-
- if (targetBean instanceof ServiceLifecycle)
- {
- ServletEndpointContext sepContext =
invContext.getAttachment(ServletEndpointContext.class);
- if (sepContext == null)
- throw new IllegalStateException("Cannot obtain
ServletEndpointContext");
-
- ((ServiceLifecycle)targetBean).init(sepContext);
- }
-
- try
- {
- Method method = getImplMethod(ep.getTargetBean(), epInv.getJavaMethod());
- Object retObj = method.invoke(targetBean, epInv.getArgs());
- epInv.setReturnValue(retObj);
- }
- finally
- {
- if (targetBean instanceof ServiceLifecycle)
- {
- ((ServiceLifecycle)targetBean).destroy();
- }
- }
- }
- catch (Exception e)
- {
- handleInvocationException(e);
- }
- }
-}
Modified:
branches/tdiesler/trunk/integration/jboss50/src/main/java/org/jboss/ws/integration/jboss50/WebAppDeployerDeployer.java
===================================================================
---
branches/tdiesler/trunk/integration/jboss50/src/main/java/org/jboss/ws/integration/jboss50/WebAppDeployerDeployer.java 2007-05-17
11:03:51 UTC (rev 3119)
+++
branches/tdiesler/trunk/integration/jboss50/src/main/java/org/jboss/ws/integration/jboss50/WebAppDeployerDeployer.java 2007-05-17
11:53:42 UTC (rev 3120)
@@ -34,7 +34,7 @@
import org.jboss.logging.Logger;
import org.jboss.virtual.VFS;
import org.jboss.virtual.VirtualFile;
-import org.jboss.ws.integration.deployment.Deployer;
+import org.jboss.ws.integration.deployment.AbstractDeployer;
import org.jboss.ws.integration.deployment.Deployment;
import org.jboss.ws.integration.deployment.ServiceEndpointPublisher;
import org.jboss.ws.integration.deployment.UnifiedDeploymentInfo;
@@ -46,7 +46,7 @@
* @author Thomas.Diesler(a)jboss.org
* @since 12-May-2006
*/
-public class WebAppDeployerDeployer implements Deployer
+public class WebAppDeployerDeployer extends AbstractDeployer
{
// provide logging
private static Logger log = Logger.getLogger(WebAppDeployerDeployer.class);
@@ -127,12 +127,4 @@
VirtualFile file = VFS.getRoot(warURL);
return new AbstractDeploymentContext(file);
}
-
- public void start(Deployment dep)
- {
- }
-
- public void stop(Deployment dep)
- {
- }
}
Modified:
branches/tdiesler/trunk/integration/jbws-jboss42/ant-import/build-thirdparty.xml
===================================================================
---
branches/tdiesler/trunk/integration/jbws-jboss42/ant-import/build-thirdparty.xml 2007-05-17
11:03:51 UTC (rev 3119)
+++
branches/tdiesler/trunk/integration/jbws-jboss42/ant-import/build-thirdparty.xml 2007-05-17
11:53:42 UTC (rev 3120)
@@ -28,33 +28,7 @@
<target name="thirdparty-get" depends="thirdparty-init"
description="Gets the thirdparty libraries"/>
- <target name="thirdparty-classpath"
depends="thirdparty-init">
-
- <!-- The compile classpath for jboss42 integration -->
- <path id="jbws42.integration.classpath">
- <pathelement location="${spi.dir}/output/lib/jbossws-spi.jar"/>
- <pathelement location="${core.dir}/output/lib/jboss-jaxrpc.jar"/>
- <pathelement location="${core.dir}/output/lib/jboss-jaxws.jar"/>
- <pathelement location="${core.dir}/output/lib/jboss-saaj.jar"/>
- <pathelement location="${core.dir}/output/lib/jbossws-core.jar"/>
- <pathelement
location="${int.jboss42.dir}/output/lib/jbossws-jboss42.jar"/>
-
- <pathelement location="${jboss42.lib}/jboss-common.jar"/>
- <pathelement location="${jboss42.lib}/jboss-jmx.jar"/>
- <pathelement location="${jboss42.lib}/jboss-system.jar"/>
- <pathelement location="${jboss42.lib}/jboss-xml-binding.jar"/>
- <pathelement location="${jboss42.server.lib}/jboss.jar"/>
- <pathelement location="${jboss42.server.lib}/jboss-j2ee.jar"/>
- <pathelement location="${jboss42.server.lib}/jboss-ejb3x.jar"/>
- <pathelement location="${jboss42.server.lib}/jbosssx.jar"/>
- <pathelement location="${jboss42.server.lib}/servlet-api.jar"/>
- <pathelement
location="${jboss42.server.deploy}/jboss-aop-jdk50.deployer/jboss-aop-jdk50.jar"/>
- <pathelement
location="${jboss42.server.deploy}/jboss-bean.deployer/jboss-dependency.jar"/>
- <pathelement
location="${jboss42.server.deploy}/jboss-bean.deployer/jboss-microcontainer.jar"/>
- <pathelement
location="${jboss42.server.deploy}/ejb3.deployer/jboss-annotations-ejb3.jar"/>
- <pathelement
location="${jboss42.server.deploy}/ejb3.deployer/jboss-ejb3.jar"/>
- </path>
-
+ <target name="thirdparty-classpath"
depends="thirdparty-get">
</target>
</project>
Deleted:
branches/tdiesler/trunk/integration/jbws-jboss42/src/main/java/org/jboss/ws/integration/jboss42/jbossws/AbstractApplicationMetaDataAdapter.java
===================================================================
---
branches/tdiesler/trunk/integration/jbws-jboss42/src/main/java/org/jboss/ws/integration/jboss42/jbossws/AbstractApplicationMetaDataAdapter.java 2007-05-17
11:03:51 UTC (rev 3119)
+++
branches/tdiesler/trunk/integration/jbws-jboss42/src/main/java/org/jboss/ws/integration/jboss42/jbossws/AbstractApplicationMetaDataAdapter.java 2007-05-17
11:53:42 UTC (rev 3120)
@@ -1,87 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt 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.ws.integration.jboss42.jbossws;
-
-// $Id$
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.jboss.metadata.ApplicationMetaData;
-import org.jboss.metadata.BeanMetaData;
-import org.jboss.ws.integration.deployment.UnifiedDeploymentInfo;
-import org.jboss.ws.metadata.j2ee.UnifiedApplicationMetaData;
-import org.jboss.ws.metadata.j2ee.UnifiedBeanMetaData;
-import org.jboss.ws.metadata.j2ee.UnifiedApplicationMetaData.PublishLocationAdapter;
-
-/**
- * Build container independent application meta data
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 05-May-2006
- */
-public abstract class AbstractApplicationMetaDataAdapter
-{
- public UnifiedApplicationMetaData
buildUnifiedApplicationMetaData(UnifiedDeploymentInfo udi, ApplicationMetaData apmd)
- {
- udi.addAttachment(ApplicationMetaData.class, apmd);
-
- UnifiedApplicationMetaData umd = new UnifiedApplicationMetaData();
- buildUnifiedBeanMetaData(umd, apmd);
- umd.setConfigName(apmd.getConfigName());
- umd.setConfigFile(apmd.getConfigFile());
- umd.setWebServiceContextRoot(apmd.getWebServiceContextRoot());
- umd.setSecurityDomain(apmd.getSecurityDomain());
- umd.setPublishLocationAdapter(getPublishLocationAdpater(apmd));
- return umd;
- }
-
- protected PublishLocationAdapter getPublishLocationAdpater(final ApplicationMetaData
apmd)
- {
- return new PublishLocationAdapter ()
- {
- public String getWsdlPublishLocationByName(String name)
- {
- return apmd.getWsdlPublishLocationByName(name);
- }
- };
- }
-
- protected void buildUnifiedBeanMetaData(UnifiedApplicationMetaData umd,
ApplicationMetaData metaData)
- {
- List<UnifiedBeanMetaData> beans = new
ArrayList<UnifiedBeanMetaData>();
- Iterator it = metaData.getEnterpriseBeans();
- while (it.hasNext())
- {
- BeanMetaData bmd = (BeanMetaData)it.next();
- UnifiedBeanMetaData ubmd = buildUnifiedBeanMetaData(bmd);
- if (ubmd != null)
- {
- beans.add(ubmd);
- }
- }
- umd.setEnterpriseBeans(beans);
- }
-
- protected abstract UnifiedBeanMetaData buildUnifiedBeanMetaData(BeanMetaData bmd);
-}
Deleted:
branches/tdiesler/trunk/integration/jbws-jboss42/src/main/java/org/jboss/ws/integration/jboss42/jbossws/AbstractDeployerHook.java
===================================================================
---
branches/tdiesler/trunk/integration/jbws-jboss42/src/main/java/org/jboss/ws/integration/jboss42/jbossws/AbstractDeployerHook.java 2007-05-17
11:03:51 UTC (rev 3119)
+++
branches/tdiesler/trunk/integration/jbws-jboss42/src/main/java/org/jboss/ws/integration/jboss42/jbossws/AbstractDeployerHook.java 2007-05-17
11:53:42 UTC (rev 3120)
@@ -1,202 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt 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.ws.integration.jboss42.jbossws;
-
-//$Id$
-
-import java.util.List;
-
-import javax.management.MBeanServer;
-import javax.management.ObjectName;
-
-import org.jboss.deployment.DeploymentInfo;
-import org.jboss.logging.Logger;
-import org.jboss.mx.util.MBeanProxy;
-import org.jboss.mx.util.MBeanProxyCreationException;
-import org.jboss.mx.util.MBeanServerLocator;
-import org.jboss.ws.integration.Endpoint;
-import org.jboss.ws.integration.Service;
-import org.jboss.ws.integration.deployment.DeployerManager;
-import org.jboss.ws.integration.deployment.Deployment;
-import org.jboss.ws.integration.deployment.WSDeploymentException;
-import org.jboss.ws.integration.jboss42.DeployerHook;
-import org.jboss.ws.integration.jboss42.DeployerInterceptorMBean;
-
-/**
- * An abstract web service deployer.
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 25-Apr-2007
- */
-public abstract class AbstractDeployerHook implements DeployerHook
-{
- // provide logging
- protected final Logger log = Logger.getLogger(getClass());
-
- protected DeployerManager deployerManager;
- private List<ObjectName> phaseOneInterceptors;
- private List<ObjectName> phaseTwoInterceptors;
- private String deploymentClass;
- private String serviceClass;
- private String endpointClass;
-
- public void setDeployerManager(DeployerManager deploymentManager)
- {
- this.deployerManager = deploymentManager;
- }
-
- public void setDeploymentClass(String deploymentClass)
- {
- this.deploymentClass = deploymentClass;
- }
-
- public void setEndpointClass(String endpointClass)
- {
- this.endpointClass = endpointClass;
- }
-
- public void setServiceClass(String serviceClass)
- {
- this.serviceClass = serviceClass;
- }
-
- public Deployment createDeployment()
- {
- try
- {
- ClassLoader loader = Thread.currentThread().getContextClassLoader();
- Class<?> clazz = loader.loadClass(deploymentClass);
- return (Deployment)clazz.newInstance();
- }
- catch (Exception ex)
- {
- throw new WSDeploymentException("Cannot load: " + deploymentClass);
- }
- }
-
- public Service createService()
- {
- try
- {
- ClassLoader loader = Thread.currentThread().getContextClassLoader();
- Class<?> clazz = loader.loadClass(serviceClass);
- return (Service)clazz.newInstance();
- }
- catch (Exception ex)
- {
- throw new WSDeploymentException("Cannot load: " + serviceClass);
- }
- }
-
- public Endpoint createEndpoint()
- {
- try
- {
- ClassLoader loader = Thread.currentThread().getContextClassLoader();
- Class<?> clazz = loader.loadClass(endpointClass);
- return (Endpoint)clazz.newInstance();
- }
- catch (Exception ex)
- {
- throw new WSDeploymentException("Cannot load: " + endpointClass);
- }
- }
-
- public void setPhaseOneInterceptors(List<ObjectName> phaseOneInterceptors)
- {
- this.phaseOneInterceptors = phaseOneInterceptors;
- }
-
- public void setPhaseTwoInterceptors(List<ObjectName> phaseTwoInterceptors)
- {
- this.phaseTwoInterceptors = phaseTwoInterceptors;
- }
-
- /** Return true if this deployment should be ignored
- */
- public boolean ignoreDeployment(DeploymentInfo unit)
- {
- return false;
- }
-
- /** Add the hooks to the interceptors
- */
- public void start()
- {
- MBeanServer server = MBeanServerLocator.locateJBoss();
- try
- {
- if (phaseOneInterceptors != null)
- {
- for (ObjectName oname : phaseOneInterceptors)
- {
- DeployerInterceptorMBean interceptor =
(DeployerInterceptorMBean)MBeanProxy.get(DeployerInterceptorMBean.class, oname, server);
- interceptor.addPhaseOneHook(this);
- }
- }
-
- if (phaseTwoInterceptors != null)
- {
- for (ObjectName oname : phaseTwoInterceptors)
- {
- DeployerInterceptorMBean interceptor =
(DeployerInterceptorMBean)MBeanProxy.get(DeployerInterceptorMBean.class, oname, server);
- interceptor.addPhaseTwoHook(this);
- }
- }
- }
- catch (MBeanProxyCreationException e)
- {
- throw new WSDeploymentException(e);
- }
- }
-
- /** Add the hooks to the interceptors
- */
- public void stop()
- {
- MBeanServer server = MBeanServerLocator.locateJBoss();
- try
- {
- if (phaseOneInterceptors != null)
- {
- for (ObjectName oname : phaseOneInterceptors)
- {
- DeployerInterceptorMBean interceptor =
(DeployerInterceptorMBean)MBeanProxy.get(DeployerInterceptorMBean.class, oname, server);
- interceptor.removePhaseOneHook(this);
- }
- }
-
- if (phaseTwoInterceptors != null)
- {
- for (ObjectName oname : phaseTwoInterceptors)
- {
- DeployerInterceptorMBean interceptor =
(DeployerInterceptorMBean)MBeanProxy.get(DeployerInterceptorMBean.class, oname, server);
- interceptor.removePhaseTwoHook(this);
- }
- }
- }
- catch (MBeanProxyCreationException e)
- {
- throw new WSDeploymentException(e);
- }
- }
-}
Deleted:
branches/tdiesler/trunk/integration/jbws-jboss42/src/main/java/org/jboss/ws/integration/jboss42/jbossws/AbstractDeployerHookEJB.java
===================================================================
---
branches/tdiesler/trunk/integration/jbws-jboss42/src/main/java/org/jboss/ws/integration/jboss42/jbossws/AbstractDeployerHookEJB.java 2007-05-17
11:03:51 UTC (rev 3119)
+++
branches/tdiesler/trunk/integration/jbws-jboss42/src/main/java/org/jboss/ws/integration/jboss42/jbossws/AbstractDeployerHookEJB.java 2007-05-17
11:53:42 UTC (rev 3120)
@@ -1,34 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt 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.ws.integration.jboss42.jbossws;
-
-//$Id$
-
-/**
- * An abstract deployer for EJB Endpoints
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 25-Apr-2007
- */
-public abstract class AbstractDeployerHookEJB extends ArchiveDeployerHook
-{
-}
Deleted:
branches/tdiesler/trunk/integration/jbws-jboss42/src/main/java/org/jboss/ws/integration/jboss42/jbossws/AbstractDeployerHookJSE.java
===================================================================
---
branches/tdiesler/trunk/integration/jbws-jboss42/src/main/java/org/jboss/ws/integration/jboss42/jbossws/AbstractDeployerHookJSE.java 2007-05-17
11:03:51 UTC (rev 3119)
+++
branches/tdiesler/trunk/integration/jbws-jboss42/src/main/java/org/jboss/ws/integration/jboss42/jbossws/AbstractDeployerHookJSE.java 2007-05-17
11:53:42 UTC (rev 3120)
@@ -1,63 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt 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.ws.integration.jboss42.jbossws;
-
-import org.jboss.deployment.DeploymentInfo;
-import org.jboss.metadata.WebMetaData;
-
-//$Id$
-
-/**
- * An abstract deployer for JSE Endpoints
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 25-Apr-2007
- */
-public abstract class AbstractDeployerHookJSE extends ArchiveDeployerHook
-{
- public boolean isWebServiceDeployment(DeploymentInfo unit)
- {
- if ((unit.metaData instanceof WebMetaData) == false)
- return false;
-
- return true;
- }
-
- static class Servlet
- {
- String servletName;
- String servletClass;
- public Servlet(String servletName, String servletClass)
- {
- this.servletName = servletName;
- this.servletClass = servletClass;
- }
- public String getServletClass()
- {
- return servletClass;
- }
- public String getServletName()
- {
- return servletName;
- }
- }
-}
Deleted:
branches/tdiesler/trunk/integration/jbws-jboss42/src/main/java/org/jboss/ws/integration/jboss42/jbossws/ApplicationMetaDataAdapter.java
===================================================================
---
branches/tdiesler/trunk/integration/jbws-jboss42/src/main/java/org/jboss/ws/integration/jboss42/jbossws/ApplicationMetaDataAdapter.java 2007-05-17
11:03:51 UTC (rev 3119)
+++
branches/tdiesler/trunk/integration/jbws-jboss42/src/main/java/org/jboss/ws/integration/jboss42/jbossws/ApplicationMetaDataAdapter.java 2007-05-17
11:53:42 UTC (rev 3120)
@@ -1,80 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt 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.ws.integration.jboss42.jbossws;
-
-// $Id$
-
-import org.jboss.metadata.BeanMetaData;
-import org.jboss.metadata.EjbPortComponentMetaData;
-import org.jboss.metadata.MessageDrivenMetaData;
-import org.jboss.metadata.SessionMetaData;
-import org.jboss.ws.metadata.j2ee.UnifiedBeanMetaData;
-import org.jboss.ws.metadata.j2ee.UnifiedEjbPortComponentMetaData;
-import org.jboss.ws.metadata.j2ee.UnifiedMessageDrivenMetaData;
-import org.jboss.ws.metadata.j2ee.UnifiedSessionMetaData;
-
-/**
- * Build container independent application meta data
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 05-May-2006
- */
-public class ApplicationMetaDataAdapter extends AbstractApplicationMetaDataAdapter
-{
- protected UnifiedBeanMetaData buildUnifiedBeanMetaData(BeanMetaData bmd)
- {
- UnifiedBeanMetaData ubmd = null;
- if (bmd instanceof SessionMetaData)
- {
- ubmd = new UnifiedSessionMetaData();
- }
- else if (bmd instanceof MessageDrivenMetaData)
- {
- ubmd = new UnifiedMessageDrivenMetaData();
-
((UnifiedMessageDrivenMetaData)ubmd).setDestinationJndiName(((MessageDrivenMetaData)bmd).getDestinationJndiName());
- }
-
- if (ubmd != null)
- {
- ubmd.setEjbName(bmd.getEjbName());
- ubmd.setEjbClass(bmd.getEjbClass());
- ubmd.setServiceEndpointInterface(bmd.getServiceEndpoint());
- ubmd.setHome(bmd.getHome());
- ubmd.setLocalHome(bmd.getLocalHome());
- ubmd.setJndiName(bmd.getJndiName());
- ubmd.setLocalJndiName(bmd.getLocalJndiName());
-
- EjbPortComponentMetaData pcmd = bmd.getPortComponent();
- if (pcmd != null)
- {
- UnifiedEjbPortComponentMetaData upcmd = new
UnifiedEjbPortComponentMetaData();
- upcmd.setPortComponentName(pcmd.getPortComponentName());
- upcmd.setPortComponentURI(pcmd.getPortComponentURI());
- upcmd.setAuthMethod(pcmd.getAuthMethod());
- upcmd.setTransportGuarantee(pcmd.getTransportGuarantee());
- upcmd.setSecureWSDLAccess(pcmd.getSecureWSDLAccess());
- ubmd.setPortComponent(upcmd);
- }
- }
- return ubmd;
- }
-}
Deleted:
branches/tdiesler/trunk/integration/jbws-jboss42/src/main/java/org/jboss/ws/integration/jboss42/jbossws/ArchiveDeployerHook.java
===================================================================
---
branches/tdiesler/trunk/integration/jbws-jboss42/src/main/java/org/jboss/ws/integration/jboss42/jbossws/ArchiveDeployerHook.java 2007-05-17
11:03:51 UTC (rev 3119)
+++
branches/tdiesler/trunk/integration/jbws-jboss42/src/main/java/org/jboss/ws/integration/jboss42/jbossws/ArchiveDeployerHook.java 2007-05-17
11:53:42 UTC (rev 3120)
@@ -1,157 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt 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.ws.integration.jboss42.jbossws;
-
-//$Id$
-
-import java.io.IOException;
-import java.net.URL;
-
-import org.jboss.deployment.DeploymentException;
-import org.jboss.deployment.DeploymentInfo;
-import org.jboss.ws.integration.ResourceLoaderAdapter;
-import org.jboss.ws.integration.UnifiedVirtualFile;
-import org.jboss.ws.integration.deployment.Deployment;
-import org.jboss.ws.integration.deployment.WSDeploymentException;
-import org.jboss.ws.integration.deployment.Deployment.DeploymentType;
-import org.jboss.ws.metadata.webservices.WebservicesFactory;
-import org.jboss.ws.metadata.webservices.WebservicesMetaData;
-import org.jboss.ws.utils.DOMUtils;
-import org.jboss.xb.binding.ObjectModelFactory;
-import org.jboss.xb.binding.Unmarshaller;
-import org.jboss.xb.binding.UnmarshallerFactory;
-import org.w3c.dom.Element;
-
-/**
- * An abstract web service deployer.
- *
- * deploy(unit)
- * if(isWebServiceDeployment)
- * dep = createDeployment(unit)
- * deploy(dep)
- *
- * undeploy(unit)
- * dep = getDeployment(unit)
- * undeploy(dep)
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 25-Apr-2007
- */
-public abstract class ArchiveDeployerHook extends AbstractDeployerHook
-{
- /** Get the deployemnt type this deployer can handle
- */
- public abstract DeploymentType getDeploymentType();
-
- /** Depending on the type of deployment, this method should return true
- * if the deployment contains web service endpoints.
- */
- public abstract boolean isWebServiceDeployment(DeploymentInfo unit);
-
- /** Create the Deployment for a given DeploymentInfo
- */
- public abstract Deployment createDeployment(DeploymentInfo unit);
-
- /** Get the Deployment for a given DeploymentInfo
- */
- public Deployment getDeployment(DeploymentInfo unit)
- {
- Deployment dep = (Deployment)unit.context.get(Deployment.class);
- return (dep != null && dep.getType() == getDeploymentType() ? dep : null);
- }
-
- public void deploy(DeploymentInfo unit) throws DeploymentException
- {
- if (ignoreDeployment(unit))
- return;
-
- if (isWebServiceDeployment(unit))
- {
- log.debug("deploy: " + unit.shortName);
- Deployment dep = getDeployment(unit);
- if (dep == null)
- {
- dep = createDeployment(unit);
- dep.getContext().addAttachment(DeploymentInfo.class, unit);
- }
-
- deployerManager.deploy(dep);
- unit.context.put(Deployment.class, dep);
- }
- }
-
- public void undeploy(DeploymentInfo unit)
- {
- if (ignoreDeployment(unit))
- return;
-
- Deployment dep = getDeployment(unit);
- if (dep != null)
- {
- log.debug("undeploy: " + unit.shortName);
- deployerManager.undeploy(dep);
- unit.context.remove(Deployment.class);
- }
- }
-
- /** Unmrashall the webservices.xml if there is one
- */
- protected WebservicesMetaData getWebservicesMetaData(DeploymentInfo unit, String
wsFile)
- {
- WebservicesMetaData wsMetaData =
(WebservicesMetaData)unit.context.get(WebservicesMetaData.class);
- UnifiedVirtualFile vfWebservices = getWebservicesFile(unit, wsFile);
- if (wsMetaData == null && vfWebservices != null)
- {
- try
- {
- URL wsURL = vfWebservices.toURL();
- Element root = DOMUtils.parse(wsURL.openStream());
- String namespaceURI = root.getNamespaceURI();
- if (
namespaceURI.equals("http://java.sun.com/xml/ns/j2ee"))
- {
- Unmarshaller unmarshaller =
UnmarshallerFactory.newInstance().newUnmarshaller();
- ObjectModelFactory factory = new WebservicesFactory(wsURL);
- wsMetaData =
(WebservicesMetaData)unmarshaller.unmarshal(wsURL.openStream(), factory, null);
- unit.context.put(WebservicesMetaData.class, wsMetaData);
- }
- }
- catch (Exception ex)
- {
- throw new WSDeploymentException(ex);
- }
- }
- return wsMetaData;
- }
-
- private UnifiedVirtualFile getWebservicesFile(DeploymentInfo unit, String wsFile)
- {
- try
- {
- UnifiedVirtualFile vfsRoot = new ResourceLoaderAdapter(unit.localCl);
- return (wsFile != null ? vfsRoot.findChild(wsFile) : null);
- }
- catch (IOException e)
- {
- return null;
- }
- }
-}
Deleted:
branches/tdiesler/trunk/integration/jbws-jboss42/src/main/java/org/jboss/ws/integration/jboss42/jbossws/ClassLoaderInjectionDeployer.java
===================================================================
---
branches/tdiesler/trunk/integration/jbws-jboss42/src/main/java/org/jboss/ws/integration/jboss42/jbossws/ClassLoaderInjectionDeployer.java 2007-05-17
11:03:51 UTC (rev 3119)
+++
branches/tdiesler/trunk/integration/jbws-jboss42/src/main/java/org/jboss/ws/integration/jboss42/jbossws/ClassLoaderInjectionDeployer.java 2007-05-17
11:53:42 UTC (rev 3120)
@@ -1,86 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt 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.ws.integration.jboss42.jbossws;
-
-//$Id$
-
-import org.jboss.deployment.DeploymentInfo;
-import org.jboss.metadata.WebMetaData;
-import org.jboss.ws.integration.Endpoint;
-import org.jboss.ws.integration.deployment.AbstractDeployer;
-import org.jboss.ws.integration.deployment.Deployment;
-import org.jboss.ws.integration.deployment.WSDeploymentException;
-import org.jboss.ws.metadata.umdm.UnifiedMetaData;
-
-/**
- * A deployer that injects the correct classloader into the UMDM
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 25-Apr-2007
- */
-public class ClassLoaderInjectionDeployer extends AbstractDeployer
-{
- @Override
- public void create(Deployment dep)
- {
- DeploymentInfo unit = dep.getContext().getAttachment(DeploymentInfo.class);
- if (unit == null)
- throw new IllegalStateException("Cannot obtain deployement unit");
-
- UnifiedMetaData umd = dep.getContext().getAttachment(UnifiedMetaData.class);
- if (umd == null)
- throw new IllegalStateException("Cannot obtain unified meta data");
-
- ClassLoader classLoader = unit.ucl;
-
- // Get the webapp context classloader and use it as the deploymet class loader
- WebMetaData webMetaData = dep.getContext().getAttachment(WebMetaData.class);
- if (webMetaData != null)
- {
- classLoader = webMetaData.getContextLoader();
- }
-
- dep.setClassLoader(classLoader);
-
- // Reload target beans with the updated class loader
- for (Endpoint ep : dep.getService().getEndpoints())
- {
- Class targetBean = ep.getTargetBean();
- if (targetBean != null)
- {
- String beanName = targetBean.getName();
- if (targetBean.getClassLoader() != classLoader)
- {
- try
- {
- targetBean = classLoader.loadClass(beanName);
- ep.setTargetBean(targetBean);
- }
- catch (ClassNotFoundException e)
- {
- throw new WSDeploymentException("Cannot reload target bean: "
+ beanName);
- }
- }
- }
- }
- }
-}
\ No newline at end of file
Deleted:
branches/tdiesler/trunk/integration/jbws-jboss42/src/main/java/org/jboss/ws/integration/jboss42/jbossws/DeploymentInfoAdapter.java
===================================================================
---
branches/tdiesler/trunk/integration/jbws-jboss42/src/main/java/org/jboss/ws/integration/jboss42/jbossws/DeploymentInfoAdapter.java 2007-05-17
11:03:51 UTC (rev 3119)
+++
branches/tdiesler/trunk/integration/jbws-jboss42/src/main/java/org/jboss/ws/integration/jboss42/jbossws/DeploymentInfoAdapter.java 2007-05-17
11:53:42 UTC (rev 3120)
@@ -1,168 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt 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.ws.integration.jboss42.jbossws;
-
-// $Id$
-
-import java.io.File;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.ArrayList;
-
-import javax.management.MBeanServer;
-import javax.management.ObjectName;
-
-import org.jboss.deployment.DeploymentInfo;
-import org.jboss.ejb3.Ejb3ModuleMBean;
-import org.jboss.ejb3.stateless.StatelessContainer;
-import org.jboss.logging.Logger;
-import org.jboss.metadata.ApplicationMetaData;
-import org.jboss.metadata.WebMetaData;
-import org.jboss.mx.util.MBeanProxy;
-import org.jboss.mx.util.MBeanProxyCreationException;
-import org.jboss.mx.util.MBeanServerLocator;
-import org.jboss.ws.WSException;
-import org.jboss.ws.integration.ResourceLoaderAdapter;
-import org.jboss.ws.integration.deployment.UnifiedDeploymentInfo;
-import org.jboss.ws.metadata.j2ee.UnifiedApplicationMetaData;
-import org.jboss.ws.metadata.j2ee.UnifiedBeanMetaData;
-
-/**
- * Build container independent deployment info.
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 05-May-2006
- */
-public class DeploymentInfoAdapter
-{
- // logging support
- private static Logger log = Logger.getLogger(DeploymentInfoAdapter.class);
-
- private WebMetaDataAdapter webMetaDataAdapter;
- private AbstractApplicationMetaDataAdapter appMetaDataAdapter;
-
- public void setAppMetaDataAdapter(AbstractApplicationMetaDataAdapter
applicationMetaDataAdapter)
- {
- this.appMetaDataAdapter = applicationMetaDataAdapter;
- }
-
- public void setWebMetaDataAdapter(WebMetaDataAdapter webMetaDataAdapter)
- {
- this.webMetaDataAdapter = webMetaDataAdapter;
- }
-
- public UnifiedDeploymentInfo buildDeploymentInfo(UnifiedDeploymentInfo udi,
DeploymentInfo di)
- {
- udi.addAttachment(DeploymentInfo.class, di);
-
- if (di.parent != null)
- {
- udi.parent = new UnifiedDeploymentInfo(null);
- buildDeploymentInfo(udi.parent, di.parent);
- }
-
- udi.vfRoot = new ResourceLoaderAdapter(di.localCl);
- udi.name = di.getCanonicalName();
- udi.simpleName = di.shortName;
- udi.url = getDeploymentURL(di);
- udi.classLoader = di.annotationsCl;
- udi.deployedObject = di.deployedObject;
-
- buildMetaData(udi, di.metaData);
-
- log.debug("UnifiedDeploymentInfo:\n" + udi);
- return udi;
- }
-
- private URL getDeploymentURL(DeploymentInfo di)
- {
- URL deploymentURL = (di.localUrl != null ? di.localUrl : di.url);
- if ("file".equals(deploymentURL.getProtocol()))
- {
- String path = deploymentURL.getPath();
- if (new File(path).isFile())
- {
- try
- {
- deploymentURL = new URL("jar:file:" + path + "!/");
- }
- catch (MalformedURLException e)
- {
- // ignore
- }
- }
- }
- return deploymentURL;
- }
-
- private void buildMetaData(UnifiedDeploymentInfo udi, Object metaData)
- {
- if (metaData instanceof WebMetaData)
- {
- udi.metaData = webMetaDataAdapter.buildUnifiedWebMetaData(udi,
(WebMetaData)metaData);
- udi.webappURL = udi.url;
- }
- else if (metaData instanceof ApplicationMetaData)
- {
- udi.metaData = appMetaDataAdapter.buildUnifiedApplicationMetaData(udi,
(ApplicationMetaData)metaData);
- }
- else if (udi.deployedObject != null)
- {
- Ejb3ModuleMBean ejb3Module = getEJB3Module(udi.deployedObject);
-
- ArrayList<UnifiedBeanMetaData> beans = new
ArrayList<UnifiedBeanMetaData>();
- for (Object container : ejb3Module.getContainers().values())
- {
- if (container instanceof StatelessContainer)
- {
- StatelessContainer slc = (StatelessContainer)container;
- UnifiedBeanMetaData uslc = new UnifiedBeanMetaData();
- uslc.setEjbName(slc.getEjbName());
- uslc.setEjbClass(slc.getBeanClassName());
- beans.add(uslc);
- }
- }
-
- UnifiedApplicationMetaData appMetaData = new UnifiedApplicationMetaData();
- appMetaData.setEnterpriseBeans(beans);
- udi.metaData = appMetaData;
- }
- }
-
- public static Ejb3ModuleMBean getEJB3Module(ObjectName objectName)
- {
- Ejb3ModuleMBean ejb3Module;
- try
- {
- MBeanServer server = MBeanServerLocator.locateJBoss();
- ejb3Module = (Ejb3ModuleMBean)MBeanProxy.get(Ejb3ModuleMBean.class, objectName,
server);
- if (ejb3Module == null)
- throw new WSException("Cannot obtain EJB3 module: " + objectName);
-
- return ejb3Module;
- }
- catch (MBeanProxyCreationException ex)
- {
- throw new WSException("Cannot obtain proxy to EJB3 module");
- }
- }
-}
Deleted:
branches/tdiesler/trunk/integration/jbws-jboss42/src/main/java/org/jboss/ws/integration/jboss42/jbossws/DeploymentInfoAdapterFactory.java
===================================================================
---
branches/tdiesler/trunk/integration/jbws-jboss42/src/main/java/org/jboss/ws/integration/jboss42/jbossws/DeploymentInfoAdapterFactory.java 2007-05-17
11:03:51 UTC (rev 3119)
+++
branches/tdiesler/trunk/integration/jbws-jboss42/src/main/java/org/jboss/ws/integration/jboss42/jbossws/DeploymentInfoAdapterFactory.java 2007-05-17
11:53:42 UTC (rev 3120)
@@ -1,47 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt 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.ws.integration.jboss42.jbossws;
-
-// $Id$
-
-import org.jboss.kernel.spi.registry.KernelRegistry;
-import org.jboss.kernel.spi.registry.KernelRegistryEntry;
-import org.jboss.ws.integration.KernelLocator;
-
-/**
- * @author Thomas.Diesler(a)jboss.org
- * @since 10-Mar-2007
- */
-public class DeploymentInfoAdapterFactory
-{
- // Hide ctor
- private DeploymentInfoAdapterFactory()
- {
- }
-
- public static DeploymentInfoAdapter newInstance()
- {
- KernelRegistry registry = KernelLocator.getKernel().getRegistry();
- KernelRegistryEntry entry =
registry.getEntry("WSDeploymentInfoAdapter");
- return (DeploymentInfoAdapter)entry.getTarget();
- }
-}
Deleted:
branches/tdiesler/trunk/integration/jbws-jboss42/src/main/java/org/jboss/ws/integration/jboss42/jbossws/JAXRPCDeployerHookEJB21.java
===================================================================
---
branches/tdiesler/trunk/integration/jbws-jboss42/src/main/java/org/jboss/ws/integration/jboss42/jbossws/JAXRPCDeployerHookEJB21.java 2007-05-17
11:03:51 UTC (rev 3119)
+++
branches/tdiesler/trunk/integration/jbws-jboss42/src/main/java/org/jboss/ws/integration/jboss42/jbossws/JAXRPCDeployerHookEJB21.java 2007-05-17
11:53:42 UTC (rev 3120)
@@ -1,120 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt 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.ws.integration.jboss42.jbossws;
-
-//$Id$
-
-import org.jboss.deployment.DeploymentInfo;
-import org.jboss.metadata.ApplicationMetaData;
-import org.jboss.metadata.BeanMetaData;
-import org.jboss.ws.integration.Endpoint;
-import org.jboss.ws.integration.Service;
-import org.jboss.ws.integration.deployment.Deployment;
-import org.jboss.ws.integration.deployment.Deployment.DeploymentType;
-import org.jboss.ws.metadata.webservices.PortComponentMetaData;
-import org.jboss.ws.metadata.webservices.WebserviceDescriptionMetaData;
-import org.jboss.ws.metadata.webservices.WebservicesMetaData;
-import org.jboss.ws.utils.ObjectNameFactory;
-
-/**
- * A deployer JAXRPC EJB21 Endpoints
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 25-Apr-2007
- */
-public class JAXRPCDeployerHookEJB21 extends AbstractDeployerHookEJB
-{
- /** Get the deployemnt type this deployer can handle
- */
- public DeploymentType getDeploymentType()
- {
- return DeploymentType.JAXRPC_EJB21;
- }
-
- @Override
- public Deployment createDeployment(DeploymentInfo unit)
- {
- Deployment dep = createDeployment();
- dep.setType(getDeploymentType());
- dep.setClassLoader(unit.ucl);
-
- Service service = dep.getService();
-
- ApplicationMetaData appmd = (ApplicationMetaData)unit.metaData;
- if (appmd == null)
- throw new IllegalStateException("Deployment unit does not contain
application meta data");
-
- WebservicesMetaData wsMetaData = getWebservicesMetaData(unit, null);
- if (wsMetaData == null)
- throw new IllegalStateException("Deployment unit does not contain
webservices meta data");
-
- // Copy the attachments
- dep.getContext().addAttachment(WebservicesMetaData.class, wsMetaData);
- dep.getContext().addAttachment(ApplicationMetaData.class, appmd);
-
- for (WebserviceDescriptionMetaData wsd : wsMetaData.getWebserviceDescriptions())
- {
- for (PortComponentMetaData pcmd : wsd.getPortComponents())
- {
- String ejbLink = pcmd.getEjbLink();
- if (ejbLink == null)
- throw new IllegalStateException("ejb-link cannot be null");
-
- BeanMetaData beanMetaData = appmd.getBeanByEjbName(ejbLink);
- if (beanMetaData == null)
- throw new IllegalStateException("Cannot obtain bean meta data for:
" + ejbLink);
-
- String ejbClass = beanMetaData.getEjbClass();
- try
- {
- ClassLoader loader = unit.ucl;
- Class<?> epBean = loader.loadClass(ejbClass.trim());
-
- // Create the endpoint
- Endpoint ep = createEndpoint();
- ep.setService(service);
- ep.setTargetBean(epBean);
-
- String nameStr = Endpoint.SEPID_DOMAIN + ":" +
Endpoint.SEPID_PROPERTY_ENDPOINT + "=" + ejbLink;
- ep.setName(ObjectNameFactory.create(nameStr));
-
- service.addEndpoint(ep);
- }
- catch (ClassNotFoundException ex)
- {
- log.warn("Cannot load servlet class: " + ejbClass);
- }
- }
- }
- return dep;
- }
-
- @Override
- public boolean isWebServiceDeployment(DeploymentInfo unit)
- {
- if ((unit.metaData instanceof ApplicationMetaData) == false)
- return false;
-
- WebservicesMetaData wsMetaData = getWebservicesMetaData(unit,
"META-INF/webservices.xml");
- return wsMetaData != null;
- }
-}
\ No newline at end of file
Deleted:
branches/tdiesler/trunk/integration/jbws-jboss42/src/main/java/org/jboss/ws/integration/jboss42/jbossws/JAXRPCDeployerHookJSE.java
===================================================================
---
branches/tdiesler/trunk/integration/jbws-jboss42/src/main/java/org/jboss/ws/integration/jboss42/jbossws/JAXRPCDeployerHookJSE.java 2007-05-17
11:03:51 UTC (rev 3119)
+++
branches/tdiesler/trunk/integration/jbws-jboss42/src/main/java/org/jboss/ws/integration/jboss42/jbossws/JAXRPCDeployerHookJSE.java 2007-05-17
11:53:42 UTC (rev 3120)
@@ -1,147 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt 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.ws.integration.jboss42.jbossws;
-
-//$Id$
-
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Map.Entry;
-
-import org.jboss.deployment.DeploymentInfo;
-import org.jboss.metadata.WebMetaData;
-import org.jboss.ws.integration.Endpoint;
-import org.jboss.ws.integration.Service;
-import org.jboss.ws.integration.deployment.Deployment;
-import org.jboss.ws.integration.deployment.Deployment.DeploymentType;
-import org.jboss.ws.metadata.webservices.PortComponentMetaData;
-import org.jboss.ws.metadata.webservices.WebserviceDescriptionMetaData;
-import org.jboss.ws.metadata.webservices.WebservicesMetaData;
-import org.jboss.ws.utils.ObjectNameFactory;
-
-/**
- * A deployer JAXRPC JSE Endpoints
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 25-Apr-2007
- */
-public class JAXRPCDeployerHookJSE extends AbstractDeployerHookJSE
-{
- /** Get the deployemnt type this deployer can handle
- */
- public DeploymentType getDeploymentType()
- {
- return DeploymentType.JAXRPC_JSE;
- }
-
- /**
- * Create an endpoint for every servlet-link in webservices.xml
- */
- @Override
- public Deployment createDeployment(DeploymentInfo unit)
- {
- Deployment dep = createDeployment();
- dep.setType(getDeploymentType());
- dep.setClassLoader(unit.annotationsCl);
-
- Service service = dep.getService();
-
- WebMetaData webMetaData = (WebMetaData)unit.metaData;
- if (webMetaData == null)
- throw new IllegalStateException("Deployment unit does not contain web meta
data");
-
- WebservicesMetaData wsMetaData = getWebservicesMetaData(unit,
"WEB-INF/webservices.xml");
- if (wsMetaData == null)
- throw new IllegalStateException("Deployment unit does not contain
webservices meta data");
-
- // Copy the attachments
- dep.getContext().addAttachment(WebservicesMetaData.class, wsMetaData);
- dep.getContext().addAttachment(WebMetaData.class, webMetaData);
-
- for (WebserviceDescriptionMetaData wsd : wsMetaData.getWebserviceDescriptions())
- {
- for (PortComponentMetaData pcmd : wsd.getPortComponents())
- {
- String servletLink = pcmd.getServletLink();
- if (servletLink == null)
- throw new IllegalStateException("servlet-link cannot be null");
-
- Servlet servlet = getServletForName(webMetaData, servletLink);
- String servletClass = servlet.getServletClass();
-
- try
- {
- ClassLoader loader = dep.getClassLoader();
- Class<?> epBean = loader.loadClass(servletClass.trim());
-
- // If this is a servlet we defer the the bean creation
- if (javax.servlet.Servlet.class.isAssignableFrom(epBean))
- {
- epBean = null;
- }
-
- // Create the endpoint
- Endpoint ep = createEndpoint();
- ep.setService(service);
- ep.setTargetBean(epBean);
-
- String nameStr = Endpoint.SEPID_DOMAIN + ":" +
Endpoint.SEPID_PROPERTY_ENDPOINT + "=" + servletLink;
- ep.setName(ObjectNameFactory.create(nameStr));
-
- service.addEndpoint(ep);
- }
- catch (ClassNotFoundException ex)
- {
- log.warn("Cannot load servlet class: " + servletClass);
- }
- }
- }
-
- return dep;
- }
-
- private Servlet getServletForName(WebMetaData wmd, String servletLink)
- {
- Iterator it = wmd.getServletClassMap().entrySet().iterator();
- while (it.hasNext())
- {
- Map.Entry entry = (Entry)it.next();
- String servletName = (String)entry.getKey();
- String servletClass = (String)entry.getValue();
- if (servletLink.equals(servletName))
- {
- return new Servlet(servletName, servletClass);
- }
- }
- throw new IllegalStateException("Cannot find servlet for link: " +
servletLink);
- }
-
- @Override
- public boolean isWebServiceDeployment(DeploymentInfo unit)
- {
- if (super.isWebServiceDeployment(unit) == false)
- return false;
-
- WebservicesMetaData wsMetaData = getWebservicesMetaData(unit,
"WEB-INF/webservices.xml");
- return wsMetaData != null;
- }
-}
Deleted:
branches/tdiesler/trunk/integration/jbws-jboss42/src/main/java/org/jboss/ws/integration/jboss42/jbossws/JAXWSDeployerHookEJB3.java
===================================================================
---
branches/tdiesler/trunk/integration/jbws-jboss42/src/main/java/org/jboss/ws/integration/jboss42/jbossws/JAXWSDeployerHookEJB3.java 2007-05-17
11:03:51 UTC (rev 3119)
+++
branches/tdiesler/trunk/integration/jbws-jboss42/src/main/java/org/jboss/ws/integration/jboss42/jbossws/JAXWSDeployerHookEJB3.java 2007-05-17
11:53:42 UTC (rev 3120)
@@ -1,124 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt 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.ws.integration.jboss42.jbossws;
-
-//$Id$
-
-import javax.jws.WebService;
-import javax.xml.ws.WebServiceProvider;
-
-import org.jboss.deployment.DeploymentInfo;
-import org.jboss.ejb3.EJBContainer;
-import org.jboss.ejb3.Ejb3ModuleMBean;
-import org.jboss.ejb3.stateless.StatelessContainer;
-import org.jboss.ws.integration.Endpoint;
-import org.jboss.ws.integration.Service;
-import org.jboss.ws.integration.deployment.Deployment;
-import org.jboss.ws.integration.deployment.Deployment.DeploymentType;
-import org.jboss.ws.utils.ObjectNameFactory;
-
-/**
- * A deployer JAXWS EJB3 Endpoints
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 25-Apr-2007
- */
-public class JAXWSDeployerHookEJB3 extends AbstractDeployerHookEJB
-{
- /** Get the deployemnt type this deployer can handle
- */
- public DeploymentType getDeploymentType()
- {
- return DeploymentType.JAXWS_EJB3;
- }
-
- @Override
- public Deployment createDeployment(DeploymentInfo unit)
- {
- Deployment dep = createDeployment();
- dep.setType(getDeploymentType());
- dep.setClassLoader(unit.ucl);
-
- Service service = dep.getService();
-
- Ejb3ModuleMBean ejb3Module =
DeploymentInfoAdapter.getEJB3Module(unit.deployedObject);
- for (Object manager : ejb3Module.getContainers().values())
- {
- if (manager instanceof EJBContainer)
- {
- EJBContainer container = (EJBContainer)manager;
- if (isWebServiceBean(container))
- {
- String ejbName = container.getEjbName();
- Class epBean = container.getBeanClass();
-
- // Create the endpoint
- Endpoint ep = createEndpoint();
- ep.setService(service);
- ep.setTargetBean(epBean);
-
- String nameStr = Endpoint.SEPID_DOMAIN + ":" +
Endpoint.SEPID_PROPERTY_ENDPOINT + "=" + ejbName;
- ep.setName(ObjectNameFactory.create(nameStr));
-
- service.addEndpoint(ep);
- }
- }
- }
-
- return dep;
- }
-
- @Override
- public boolean isWebServiceDeployment(DeploymentInfo unit)
- {
- boolean isWebserviceDeployment = false;
-
- // Check if the ejb3 contains annotated endpoints
- Ejb3ModuleMBean ejb3Module =
DeploymentInfoAdapter.getEJB3Module(unit.deployedObject);
- for (Object manager : ejb3Module.getContainers().values())
- {
- if (manager instanceof EJBContainer)
- {
- EJBContainer container = (EJBContainer)manager;
- if (isWebServiceBean(container))
- {
- isWebserviceDeployment = true;
- break;
- }
- }
- }
-
- return isWebserviceDeployment;
- }
-
- private boolean isWebServiceBean(EJBContainer container)
- {
- boolean isWebServiceBean = false;
- if (container instanceof StatelessContainer)
- {
- boolean isWebService = container.resolveAnnotation(WebService.class) != null;
- boolean isWebServiceProvider =
container.resolveAnnotation(WebServiceProvider.class) != null;
- isWebServiceBean = isWebService || isWebServiceProvider;
- }
- return isWebServiceBean;
- }
-}
\ No newline at end of file
Deleted:
branches/tdiesler/trunk/integration/jbws-jboss42/src/main/java/org/jboss/ws/integration/jboss42/jbossws/JAXWSDeployerHookJSE.java
===================================================================
---
branches/tdiesler/trunk/integration/jbws-jboss42/src/main/java/org/jboss/ws/integration/jboss42/jbossws/JAXWSDeployerHookJSE.java 2007-05-17
11:03:51 UTC (rev 3119)
+++
branches/tdiesler/trunk/integration/jbws-jboss42/src/main/java/org/jboss/ws/integration/jboss42/jbossws/JAXWSDeployerHookJSE.java 2007-05-17
11:53:42 UTC (rev 3120)
@@ -1,156 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt 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.ws.integration.jboss42.jbossws;
-
-//$Id$
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-
-import javax.jws.WebService;
-import javax.xml.ws.WebServiceProvider;
-
-import org.jboss.deployment.DeploymentInfo;
-import org.jboss.metadata.WebMetaData;
-import org.jboss.ws.integration.Endpoint;
-import org.jboss.ws.integration.Service;
-import org.jboss.ws.integration.deployment.Deployment;
-import org.jboss.ws.integration.deployment.Deployment.DeploymentType;
-import org.jboss.ws.utils.ObjectNameFactory;
-
-/**
- * A deployer JAXWS JSE Endpoints
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 25-Apr-2007
- */
-public class JAXWSDeployerHookJSE extends AbstractDeployerHookJSE
-{
- /** Get the deployemnt type this deployer can handle
- */
- public DeploymentType getDeploymentType()
- {
- return DeploymentType.JAXWS_JSE;
- }
-
- @Override
- public Deployment createDeployment(DeploymentInfo unit)
- {
- Deployment dep = createDeployment();
- dep.setType(getDeploymentType());
- dep.setClassLoader(unit.annotationsCl);
-
- Service service = dep.getService();
-
- WebMetaData webMetaData = (WebMetaData)unit.metaData;
- if (webMetaData == null)
- throw new IllegalStateException("Deployment unit does not contain web meta
data");
-
- // Copy the attachments
- dep.getContext().addAttachment(WebMetaData.class, webMetaData);
-
- List<Servlet> servlets = getRelevantServlets(webMetaData,
unit.annotationsCl);
- for (Servlet servlet : servlets)
- {
- String servletName = servlet.getServletName();
- String servletClass = servlet.getServletClass();
-
- try
- {
- ClassLoader loader = unit.annotationsCl;
- Class<?> epBean = loader.loadClass(servletClass.trim());
-
- // Create the endpoint
- Endpoint ep = createEndpoint();
- ep.setService(service);
- ep.setTargetBean(epBean);
-
- String nameStr = Endpoint.SEPID_DOMAIN + ":" +
Endpoint.SEPID_PROPERTY_ENDPOINT + "=" + servletName;
- ep.setName(ObjectNameFactory.create(nameStr));
-
- service.addEndpoint(ep);
- }
- catch (ClassNotFoundException ex)
- {
- log.warn("Cannot load servlet class: " + servletClass);
- continue;
- }
- }
-
- return dep;
- }
-
- @Override
- public boolean isWebServiceDeployment(DeploymentInfo unit)
- {
- if (super.isWebServiceDeployment(unit) == false)
- return false;
-
- boolean isWebServiceDeployment = false;
- try
- {
- WebMetaData webMetaData = (WebMetaData)unit.metaData;
- List<Servlet> servlets = getRelevantServlets(webMetaData,
unit.annotationsCl);
- isWebServiceDeployment = servlets.size() > 0;
- }
- catch (Exception ex)
- {
- log.error("Cannot process web deployment", ex);
- }
-
- return isWebServiceDeployment;
- }
-
- private List<Servlet> getRelevantServlets(WebMetaData webMetaData, ClassLoader
loader)
- {
- List<Servlet> servlets = new ArrayList<Servlet>();
- Iterator it = webMetaData.getServletClassMap().entrySet().iterator();
- while (it.hasNext())
- {
- Map.Entry entry = (Entry)it.next();
- String servletName = (String)entry.getKey();
- String servletClassName = (String)entry.getValue();
-
- // Skip JSPs
- if (servletClassName == null || servletClassName.length() == 0)
- continue;
-
- try
- {
- Class<?> servletClass = loader.loadClass(servletClassName.trim());
- boolean isWebService = servletClass.isAnnotationPresent(WebService.class);
- boolean isWebServiceProvider =
servletClass.isAnnotationPresent(WebServiceProvider.class);
- if (isWebService || isWebServiceProvider)
- servlets.add(new Servlet(servletName, servletClassName));
- }
- catch (ClassNotFoundException ex)
- {
- log.warn("Cannot load servlet class: " + servletClassName);
- continue;
- }
- }
- return servlets;
- }
-}
\ No newline at end of file
Deleted:
branches/tdiesler/trunk/integration/jbws-jboss42/src/main/java/org/jboss/ws/integration/jboss42/jbossws/MainDeployerHook.java
===================================================================
---
branches/tdiesler/trunk/integration/jbws-jboss42/src/main/java/org/jboss/ws/integration/jboss42/jbossws/MainDeployerHook.java 2007-05-17
11:03:51 UTC (rev 3119)
+++
branches/tdiesler/trunk/integration/jbws-jboss42/src/main/java/org/jboss/ws/integration/jboss42/jbossws/MainDeployerHook.java 2007-05-17
11:53:42 UTC (rev 3120)
@@ -1,61 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt 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.ws.integration.jboss42.jbossws;
-
-//$Id$
-
-import org.jboss.deployment.DeploymentException;
-import org.jboss.deployment.DeploymentInfo;
-import org.jboss.ws.integration.deployment.Deployment;
-
-/**
- * A basic hook that delegates a deployment manger.
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 25-Apr-2007
- */
-public class MainDeployerHook extends AbstractDeployerHook
-{
- public void deploy(DeploymentInfo unit) throws DeploymentException
- {
- if (ignoreDeployment(unit))
- return;
-
- Deployment dep = (Deployment)unit.context.get(Deployment.class);
- if (dep != null)
- {
- deployerManager.deploy(dep);
- }
- }
-
- public void undeploy(DeploymentInfo unit)
- {
- if (ignoreDeployment(unit))
- return;
-
- Deployment dep = (Deployment)unit.context.get(Deployment.class);
- if (dep != null)
- {
- deployerManager.undeploy(dep);
- }
- }
-}
Deleted:
branches/tdiesler/trunk/integration/jbws-jboss42/src/main/java/org/jboss/ws/integration/jboss42/jbossws/ModifyWebMetaDataDeployer.java
===================================================================
---
branches/tdiesler/trunk/integration/jbws-jboss42/src/main/java/org/jboss/ws/integration/jboss42/jbossws/ModifyWebMetaDataDeployer.java 2007-05-17
11:03:51 UTC (rev 3119)
+++
branches/tdiesler/trunk/integration/jbws-jboss42/src/main/java/org/jboss/ws/integration/jboss42/jbossws/ModifyWebMetaDataDeployer.java 2007-05-17
11:53:42 UTC (rev 3120)
@@ -1,85 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt 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.ws.integration.jboss42.jbossws;
-
-//$Id$
-
-import org.jboss.ws.integration.Endpoint;
-import org.jboss.ws.integration.deployment.AbstractDeployer;
-import org.jboss.ws.integration.deployment.Deployment;
-import org.jboss.ws.integration.deployment.ServiceEndpointPublisher;
-import org.jboss.ws.integration.deployment.UnifiedDeploymentInfo;
-import org.jboss.ws.integration.deployment.ServiceEndpointPublisher.RewriteResults;
-import org.jboss.ws.metadata.umdm.ServerEndpointMetaData;
-
-/**
- * A deployer that modifies the web.xml meta data
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 25-Apr-2007
- */
-public class ModifyWebMetaDataDeployer extends AbstractDeployer
-{
- private ServiceEndpointPublisher serviceEndpointPublisher;
-
- public void setServiceEndpointPublisher(ServiceEndpointPublisher
serviceEndpointPublisher)
- {
- this.serviceEndpointPublisher = serviceEndpointPublisher;
- }
-
- public void create(Deployment dep)
- {
- UnifiedDeploymentInfo udi =
dep.getContext().getAttachment(UnifiedDeploymentInfo.class);
- if (udi == null)
- throw new IllegalStateException("Cannot obtain unified deployement
info");
-
- RewriteResults results = serviceEndpointPublisher.rewriteWebXml(udi);
-
- // The endpoint may not have a target bean when
- // <servlet-class> originally contained a javax.servlet.Servlet
- for (Endpoint ep : dep.getService().getEndpoints())
- {
- if (ep.getTargetBean() == null)
- {
- String servletName =
ep.getName().getKeyProperty(Endpoint.SEPID_PROPERTY_ENDPOINT);
- String beanName = results.sepTargetMap.get(servletName);
- if (beanName == null)
- throw new IllegalStateException("Cannot obtain target bean for:
" + servletName);
-
- try
- {
- ClassLoader loader = dep.getClassLoader();
- Class<?> epBean = loader.loadClass(beanName);
- ep.setTargetBean(epBean);
-
- ServerEndpointMetaData sepMetaData =
ep.getAttachment(ServerEndpointMetaData.class);
- sepMetaData.setServiceEndpointImplName(beanName);
- }
- catch (ClassNotFoundException ex)
- {
- log.warn("Cannot load target bean: " + beanName);
- }
-
- }
- }
- }
-}
\ No newline at end of file
Deleted:
branches/tdiesler/trunk/integration/jbws-jboss42/src/main/java/org/jboss/ws/integration/jboss42/jbossws/SecurityRolesHandlerEJB21.java
===================================================================
---
branches/tdiesler/trunk/integration/jbws-jboss42/src/main/java/org/jboss/ws/integration/jboss42/jbossws/SecurityRolesHandlerEJB21.java 2007-05-17
11:03:51 UTC (rev 3119)
+++
branches/tdiesler/trunk/integration/jbws-jboss42/src/main/java/org/jboss/ws/integration/jboss42/jbossws/SecurityRolesHandlerEJB21.java 2007-05-17
11:53:42 UTC (rev 3120)
@@ -1,70 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt 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.ws.integration.jboss42.jbossws;
-
-//$Id$
-
-import java.util.Iterator;
-import java.util.Map;
-
-import org.jboss.logging.Logger;
-import org.jboss.metadata.ApplicationMetaData;
-import org.jboss.metadata.AssemblyDescriptorMetaData;
-import org.jboss.ws.integration.deployment.SecurityRolesHandler;
-import org.jboss.ws.integration.deployment.UnifiedDeploymentInfo;
-import org.jboss.ws.utils.DOMUtils;
-import org.w3c.dom.Element;
-
-/**
- * Generate a service endpoint deployment for EJB endpoints
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 12-May-2006
- */
-public class SecurityRolesHandlerEJB21 implements SecurityRolesHandler
-{
- // logging support
- protected Logger log = Logger.getLogger(SecurityRolesHandlerEJB21.class);
-
- /** Add the roles from ejb-jar.xml to the security roles
- */
- public void addSecurityRoles(Element webApp, UnifiedDeploymentInfo udi)
- {
- // Fix:
http://jira.jboss.org/jira/browse/JBWS-309
- ApplicationMetaData applMetaData =
(ApplicationMetaData)udi.getAttachment(ApplicationMetaData.class);
- AssemblyDescriptorMetaData assemblyDescriptor =
applMetaData.getAssemblyDescriptor();
- if (assemblyDescriptor != null)
- {
- Map securityRoles = assemblyDescriptor.getSecurityRoles();
- if (securityRoles != null)
- {
- Iterator it = securityRoles.keySet().iterator();
- while (it.hasNext())
- {
- Element securityRole =
(Element)webApp.appendChild(DOMUtils.createElement("security-role"));
- Element roleName =
(Element)securityRole.appendChild(DOMUtils.createElement("role-name"));
- roleName.appendChild(DOMUtils.createTextNode((String)it.next()));
- }
- }
- }
- }
-}
Deleted:
branches/tdiesler/trunk/integration/jbws-jboss42/src/main/java/org/jboss/ws/integration/jboss42/jbossws/SecurityRolesHandlerEJB3.java
===================================================================
---
branches/tdiesler/trunk/integration/jbws-jboss42/src/main/java/org/jboss/ws/integration/jboss42/jbossws/SecurityRolesHandlerEJB3.java 2007-05-17
11:03:51 UTC (rev 3119)
+++
branches/tdiesler/trunk/integration/jbws-jboss42/src/main/java/org/jboss/ws/integration/jboss42/jbossws/SecurityRolesHandlerEJB3.java 2007-05-17
11:53:42 UTC (rev 3120)
@@ -1,96 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt 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.ws.integration.jboss42.jbossws;
-
-//$Id$
-
-import javax.annotation.security.RolesAllowed;
-import javax.management.MBeanServer;
-import javax.management.ObjectName;
-
-import org.jboss.ejb3.Ejb3ModuleMBean;
-import org.jboss.ejb3.stateless.StatelessContainer;
-import org.jboss.logging.Logger;
-import org.jboss.mx.util.MBeanProxy;
-import org.jboss.mx.util.MBeanProxyCreationException;
-import org.jboss.mx.util.MBeanServerLocator;
-import org.jboss.ws.WSException;
-import org.jboss.ws.integration.deployment.SecurityRolesHandler;
-import org.jboss.ws.integration.deployment.UnifiedDeploymentInfo;
-import org.jboss.ws.utils.DOMUtils;
-import org.w3c.dom.Element;
-
-/**
- * Generate a service endpoint deployment for EJB endpoints
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 12-May-2006
- */
-public class SecurityRolesHandlerEJB3 implements SecurityRolesHandler
-{
- // logging support
- protected Logger log = Logger.getLogger(SecurityRolesHandlerEJB3.class);
-
- /** Add the roles from ejb-jar.xml to the security roles
- */
- public void addSecurityRoles(Element webApp, UnifiedDeploymentInfo udi)
- {
- // The container objects below provide access to all of the ejb metadata
- Ejb3ModuleMBean ejb3Module = getEJB3Module(udi.deployedObject);
- for (Object manager : ejb3Module.getContainers().values())
- {
- if (manager instanceof StatelessContainer)
- {
- StatelessContainer container = (StatelessContainer)manager;
-
- RolesAllowed anRolesAllowed =
(RolesAllowed)container.resolveAnnotation(RolesAllowed.class);
- if (anRolesAllowed != null)
- {
- for (String role : anRolesAllowed.value())
- {
- Element securityRole =
(Element)webApp.appendChild(DOMUtils.createElement("security-role"));
- Element roleName =
(Element)securityRole.appendChild(DOMUtils.createElement("role-name"));
- roleName.appendChild(DOMUtils.createTextNode(role));
- }
- }
- }
- }
- }
-
- private Ejb3ModuleMBean getEJB3Module(ObjectName objectName)
- {
- Ejb3ModuleMBean ejb3Module;
- try
- {
- MBeanServer server = MBeanServerLocator.locateJBoss();
- ejb3Module = (Ejb3ModuleMBean)MBeanProxy.get(Ejb3ModuleMBean.class, objectName,
server);
- if (ejb3Module == null)
- throw new WSException("Cannot obtain EJB3 module: " + objectName);
-
- return ejb3Module;
- }
- catch (MBeanProxyCreationException ex)
- {
- throw new WSException("Cannot obtain proxy to EJB3 module");
- }
- }
-}
Deleted:
branches/tdiesler/trunk/integration/jbws-jboss42/src/main/java/org/jboss/ws/integration/jboss42/jbossws/UnifiedDeploymentInfoDeployer.java
===================================================================
---
branches/tdiesler/trunk/integration/jbws-jboss42/src/main/java/org/jboss/ws/integration/jboss42/jbossws/UnifiedDeploymentInfoDeployer.java 2007-05-17
11:03:51 UTC (rev 3119)
+++
branches/tdiesler/trunk/integration/jbws-jboss42/src/main/java/org/jboss/ws/integration/jboss42/jbossws/UnifiedDeploymentInfoDeployer.java 2007-05-17
11:53:42 UTC (rev 3120)
@@ -1,76 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt 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.ws.integration.jboss42.jbossws;
-
-//$Id$
-
-import org.jboss.deployment.DeploymentInfo;
-import org.jboss.ws.integration.deployment.AbstractDeployer;
-import org.jboss.ws.integration.deployment.Deployment;
-import org.jboss.ws.integration.deployment.JAXRPCDeployment;
-import org.jboss.ws.integration.deployment.JAXWSDeployment;
-import org.jboss.ws.integration.deployment.UnifiedDeploymentInfo;
-import org.jboss.ws.integration.deployment.Deployment.DeploymentType;
-import org.jboss.ws.metadata.webservices.WebservicesMetaData;
-
-/**
- * A deployer that builds the UnifiedDeploymentInfo
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 25-Apr-2007
- */
-public class UnifiedDeploymentInfoDeployer extends AbstractDeployer
-{
- private DeploymentInfoAdapter deploymentInfoAdapter;
-
- public void setDeploymentInfoAdapter(DeploymentInfoAdapter deploymentInfoAdapter)
- {
- this.deploymentInfoAdapter = deploymentInfoAdapter;
- }
-
- @Override
- public void create(Deployment dep)
- {
- UnifiedDeploymentInfo udi =
dep.getContext().getAttachment(UnifiedDeploymentInfo.class);
- if (udi == null)
- {
- DeploymentInfo unit = dep.getContext().getAttachment(DeploymentInfo.class);
- if (unit == null)
- throw new IllegalStateException("Cannot obtain deployment unit");
-
- DeploymentType type = dep.getType();
- if (type.toString().startsWith("JAXWS"))
- {
- udi = new JAXWSDeployment(type);
- deploymentInfoAdapter.buildDeploymentInfo(udi, unit);
- }
- else
- {
- WebservicesMetaData wsMetaData =
dep.getContext().getAttachment(WebservicesMetaData.class);
- udi = new JAXRPCDeployment(type, wsMetaData);
- deploymentInfoAdapter.buildDeploymentInfo(udi, unit);
- }
-
- dep.getContext().addAttachment(UnifiedDeploymentInfo.class, udi);
- }
- }
-}
\ No newline at end of file
Deleted:
branches/tdiesler/trunk/integration/jbws-jboss42/src/main/java/org/jboss/ws/integration/jboss42/jbossws/WebAppDeployerDeployer.java
===================================================================
---
branches/tdiesler/trunk/integration/jbws-jboss42/src/main/java/org/jboss/ws/integration/jboss42/jbossws/WebAppDeployerDeployer.java 2007-05-17
11:03:51 UTC (rev 3119)
+++
branches/tdiesler/trunk/integration/jbws-jboss42/src/main/java/org/jboss/ws/integration/jboss42/jbossws/WebAppDeployerDeployer.java 2007-05-17
11:53:42 UTC (rev 3120)
@@ -1,126 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt 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.ws.integration.jboss42.jbossws;
-
-// $Id$
-
-import java.net.URL;
-
-import javax.management.MBeanServer;
-
-import org.jboss.deployment.DeploymentInfo;
-import org.jboss.deployment.MainDeployerMBean;
-import org.jboss.logging.Logger;
-import org.jboss.mx.util.MBeanProxy;
-import org.jboss.mx.util.MBeanProxyCreationException;
-import org.jboss.mx.util.MBeanServerLocator;
-import org.jboss.ws.integration.deployment.Deployer;
-import org.jboss.ws.integration.deployment.Deployment;
-import org.jboss.ws.integration.deployment.ServiceEndpointPublisher;
-import org.jboss.ws.integration.deployment.UnifiedDeploymentInfo;
-import org.jboss.ws.integration.deployment.WSDeploymentException;
-
-/**
- * Publish the HTTP service endpoint to Tomcat
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 12-May-2006
- */
-public class WebAppDeployerDeployer implements Deployer
-{
- // provide logging
- private static Logger log = Logger.getLogger(WebAppDeployerDeployer.class);
-
- private ServiceEndpointPublisher serviceEndpointPublisher;
-
- public void setServiceEndpointPublisher(ServiceEndpointPublisher
serviceEndpointPublisher)
- {
- this.serviceEndpointPublisher = serviceEndpointPublisher;
- }
-
- public void create(Deployment dep)
- {
- UnifiedDeploymentInfo udi =
dep.getContext().getAttachment(UnifiedDeploymentInfo.class);
- if (udi == null)
- throw new IllegalStateException("Cannot obtain unified deployement
info");
-
- URL warURL = udi.webappURL;
-
- log.debug("publishServiceEndpoint: " + warURL);
- try
- {
- DeploymentInfo di = udi.getAttachment(DeploymentInfo.class);
- if (di == null)
- throw new IllegalStateException("Cannot obtain DeploymentInfo from
context");
-
- serviceEndpointPublisher.rewriteWebXml(udi);
-
- // Preserve the repository config
- DeploymentInfo auxdi = new DeploymentInfo(warURL, null,
MBeanServerLocator.locateJBoss());
- auxdi.repositoryConfig = di.getTopRepositoryConfig();
- getMainDeployer().deploy(auxdi);
- }
- catch (Exception ex)
- {
- WSDeploymentException.rethrow(ex);
- }
- }
-
- public void destroy(Deployment dep)
- {
- UnifiedDeploymentInfo udi =
dep.getContext().getAttachment(UnifiedDeploymentInfo.class);
- if (udi == null)
- throw new IllegalStateException("Cannot obtain unified deployement
info");
-
- URL warURL = udi.webappURL;
- if (warURL == null)
- {
- log.error("Cannot obtain warURL for: " + udi.name);
- return;
- }
-
- log.debug("destroyServiceEndpoint: " + warURL);
- try
- {
- getMainDeployer().undeploy(warURL);
- }
- catch (Exception ex)
- {
- WSDeploymentException.rethrow(ex);
- }
- }
-
- public void start(Deployment dep)
- {
- }
-
- public void stop(Deployment dep)
- {
- }
-
- private MainDeployerMBean getMainDeployer() throws MBeanProxyCreationException
- {
- MBeanServer server = MBeanServerLocator.locateJBoss();
- MainDeployerMBean mainDeployer =
(MainDeployerMBean)MBeanProxy.get(MainDeployerMBean.class, MainDeployerMBean.OBJECT_NAME,
server);
- return mainDeployer;
- }
-}
Deleted:
branches/tdiesler/trunk/integration/jbws-jboss42/src/main/java/org/jboss/ws/integration/jboss42/jbossws/WebMetaDataAdapter.java
===================================================================
---
branches/tdiesler/trunk/integration/jbws-jboss42/src/main/java/org/jboss/ws/integration/jboss42/jbossws/WebMetaDataAdapter.java 2007-05-17
11:03:51 UTC (rev 3119)
+++
branches/tdiesler/trunk/integration/jbws-jboss42/src/main/java/org/jboss/ws/integration/jboss42/jbossws/WebMetaDataAdapter.java 2007-05-17
11:53:42 UTC (rev 3120)
@@ -1,122 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt 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.ws.integration.jboss42.jbossws;
-
-// $Id$
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-
-import org.jboss.metadata.WebMetaData;
-import org.jboss.metadata.WebSecurityMetaData;
-import org.jboss.metadata.WebSecurityMetaData.WebResourceCollection;
-import org.jboss.ws.integration.deployment.UnifiedDeploymentInfo;
-import org.jboss.ws.metadata.j2ee.UnifiedWebMetaData;
-import org.jboss.ws.metadata.j2ee.UnifiedWebSecurityMetaData;
-import org.jboss.ws.metadata.j2ee.UnifiedWebMetaData.PublishLocationAdapter;
-import
org.jboss.ws.metadata.j2ee.UnifiedWebSecurityMetaData.UnifiedWebResourceCollection;
-
-/**
- * Build container independent web meta data
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 05-May-2006
- */
-public class WebMetaDataAdapter
-{
- public UnifiedWebMetaData buildUnifiedWebMetaData(UnifiedDeploymentInfo udi,
WebMetaData webMetaData)
- {
- udi.addAttachment(WebMetaData.class, webMetaData);
-
- UnifiedWebMetaData umd = new UnifiedWebMetaData();
- umd.setContextRoot(webMetaData.getContextRoot());
- umd.setServletMappings(webMetaData.getServletMappings());
- umd.setServletClassNames(getServletClassMap(webMetaData));
- umd.setConfigName(webMetaData.getConfigName());
- umd.setConfigFile(webMetaData.getConfigFile());
- umd.setSecurityDomain(webMetaData.getSecurityDomain());
- umd.setPublishLocationAdapter(getPublishLocationAdpater(webMetaData));
- umd.setSecurityMetaData(getSecurityMetaData(webMetaData.getSecurityContraints()));
-
- return umd;
- }
-
- private PublishLocationAdapter getPublishLocationAdpater(final WebMetaData wmd)
- {
- return new PublishLocationAdapter()
- {
- public String getWsdlPublishLocationByName(String name)
- {
- return wmd.getWsdlPublishLocationByName(name);
- }
- };
- }
-
- private List<UnifiedWebSecurityMetaData> getSecurityMetaData(final Iterator
securityConstraints)
- {
- ArrayList<UnifiedWebSecurityMetaData> unifiedsecurityMetaData = new
ArrayList<UnifiedWebSecurityMetaData>();
-
- while (securityConstraints.hasNext())
- {
- WebSecurityMetaData securityMetaData =
(WebSecurityMetaData)securityConstraints.next();
-
- UnifiedWebSecurityMetaData current = new UnifiedWebSecurityMetaData();
- unifiedsecurityMetaData.add(current);
-
- current.setTransportGuarantee(securityMetaData.getTransportGuarantee());
-
- HashMap resources = securityMetaData.getWebResources();
- for (Object webResourceObj : resources.values())
- {
- WebResourceCollection webResource = (WebResourceCollection)webResourceObj;
- UnifiedWebResourceCollection currentResource =
current.addWebResource(webResource.getName());
- for (String currentPattern : webResource.getUrlPatterns())
- {
- currentResource.addPattern(currentPattern);
- }
- }
-
- }
-
- return unifiedsecurityMetaData;
- }
-
- private Map<String, String> getServletClassMap(WebMetaData wmd)
- {
- Map<String, String> mappings = new HashMap<String, String>();
- Iterator it = wmd.getServletClassMap().entrySet().iterator();
- while (it.hasNext())
- {
- Map.Entry entry = (Entry)it.next();
- String servletName = (String)entry.getKey();
- String servletClass = (String)entry.getValue();
- // Skip JSPs
- if (servletClass != null)
- mappings.put(servletName, servletClass);
- }
- return mappings;
- }
-}
Modified:
branches/tdiesler/trunk/integration/jbws-jboss42/src/main/resources/jbossws.beans/META-INF/jboss-beans.xml
===================================================================
---
branches/tdiesler/trunk/integration/jbws-jboss42/src/main/resources/jbossws.beans/META-INF/jboss-beans.xml 2007-05-17
11:03:51 UTC (rev 3119)
+++
branches/tdiesler/trunk/integration/jbws-jboss42/src/main/resources/jbossws.beans/META-INF/jboss-beans.xml 2007-05-17
11:53:42 UTC (rev 3120)
@@ -104,6 +104,7 @@
<inject bean="WSEndpointHandlerDeployer"/>
<inject bean="WSPublishContractDeployer"/>
<inject bean="WSClassLoaderInjectionDeployer"/>
+ <inject bean="WSServiceEndpointInvokerDeployer"/>
<inject bean="WSEagerInitializeDeployer"/>
<inject bean="WSEventingDeployer"/>
<inject bean="WSEndpointRegistryDeployer"/>
@@ -116,17 +117,17 @@
The Deployers
Each handles a single aspect of web service deployment
-->
- <bean name="WSClassLoaderInjectionDeployer"
class="org.jboss.ws.integration.jboss42.jbossws.ClassLoaderInjectionDeployer"/>
+ <bean name="WSClassLoaderInjectionDeployer"
class="org.jboss.ws.integration.jboss42.ClassLoaderInjectionDeployer"/>
<bean name="WSEagerInitializeDeployer"
class="org.jboss.ws.core.deployment.EagerInitializeDeployer"/>
<bean name="WSEndpointHandlerDeployer"
class="org.jboss.ws.integration.deployment.EndpointHandlerDeployer">
<property
name="requestHandler">org.jboss.ws.core.server.RequestHandlerImpl</property>
<property
name="lifecycleHandler">org.jboss.ws.core.server.LifecycleHandlerImpl</property>
<property name="invocationHandler">
<map keyClass="java.lang.String"
valueClass="java.lang.String">
-
<entry><key>JAXRPC_JSE</key><value>org.jboss.ws.core.server.InvocationHandlerJSE</value></entry>
-
<entry><key>JAXRPC_EJB21</key><value>org.jboss.ws.integration.jboss42.jbossws.InvocationHandlerEJB21</value></entry>
-
<entry><key>JAXWS_JSE</key><value>org.jboss.ws.core.server.InvocationHandlerJSE</value></entry>
-
<entry><key>JAXWS_EJB3</key><value>org.jboss.ws.integration.jboss42.jbossws.InvocationHandlerEJB3</value></entry>
+
<entry><key>JAXRPC_JSE</key><value>org.jboss.ws.integration.invocation.InvocationHandlerJSE</value></entry>
+
<entry><key>JAXRPC_EJB21</key><value>org.jboss.ws.integration.jboss42.InvocationHandlerEJB21</value></entry>
+
<entry><key>JAXWS_JSE</key><value>org.jboss.ws.integration.invocation.InvocationHandlerJSE</value></entry>
+
<entry><key>JAXWS_EJB3</key><value>org.jboss.ws.integration.jboss42.InvocationHandlerEJB3</value></entry>
</map>
</property>
</bean>
@@ -134,35 +135,36 @@
<bean name="WSEndpointNameDeployer"
class="org.jboss.ws.core.deployment.EndpointNameDeployer"/>
<bean name="WSEndpointRegistryDeployer"
class="org.jboss.ws.integration.deployment.EndpointRegistryDeployer"/>
<bean name="WSEventingDeployer"
class="org.jboss.ws.core.deployment.EventingDeployer"/>
- <bean name="WSModifyWebMetaDataDeployer"
class="org.jboss.ws.integration.jboss42.jbossws.ModifyWebMetaDataDeployer">
+ <bean name="WSModifyWebMetaDataDeployer"
class="org.jboss.ws.integration.jboss42.ModifyWebMetaDataDeployer">
<property name="serviceEndpointPublisher"><inject
bean="WSServiceEndpointPublisher"/></property>
</bean>
<bean name="WSPublishContractDeployer"
class="org.jboss.ws.core.deployment.PublishContractDeployer"/>
- <bean name="WSUnifiedDeploymentInfoDeployer"
class="org.jboss.ws.integration.jboss42.jbossws.UnifiedDeploymentInfoDeployer">
+ <bean name="WSServiceEndpointInvokerDeployer"
class="org.jboss.ws.core.deployment.ServiceEndpointInvokerDeployer"/>
+ <bean name="WSUnifiedDeploymentInfoDeployer"
class="org.jboss.ws.integration.jboss42.UnifiedDeploymentInfoDeployer">
<property name="deploymentInfoAdapter"><inject
bean="WSDeploymentInfoAdapter"/></property>
</bean>
<bean name="WSUnifiedMetaDataAssociationDeployer"
class="org.jboss.ws.core.deployment.UnifiedMetaDataAssociationDeployer"/>
<bean name="WSUnifiedMetaDataDeployer"
class="org.jboss.ws.core.deployment.UnifiedMetaDataDeployer"/>
- <bean name="WSWebAppGeneratorDeployer"
class="org.jboss.ws.integration.jboss42.jbossws.WebAppGeneratorDeployer"/>
- <bean name="WSWebAppDeployerDeployer"
class="org.jboss.ws.integration.jboss42.jbossws.WebAppDeployerDeployer">
+ <bean name="WSWebAppGeneratorDeployer"
class="org.jboss.ws.core.deployment.WebAppGeneratorDeployer"/>
+ <bean name="WSWebAppDeployerDeployer"
class="org.jboss.ws.integration.jboss42.WebAppDeployerDeployer">
<property name="serviceEndpointPublisher"><inject
bean="WSServiceEndpointPublisher"/></property>
</bean>
<!-- Deployer helper beans -->
- <bean name="WSServiceEndpointPublisher"
class="org.jboss.ws.core.deployment.ServiceEndpointPublisher">
+ <bean name="WSServiceEndpointPublisher"
class="org.jboss.ws.integration.deployment.ServiceEndpointPublisher">
<property
name="servletClass">org.jboss.ws.core.server.ServiceEndpointServlet</property>
</bean>
- <bean name="WSDeploymentInfoAdapter"
class="org.jboss.ws.integration.jboss42.jbossws.DeploymentInfoAdapter">
+ <bean name="WSDeploymentInfoAdapter"
class="org.jboss.ws.integration.jboss42.DeploymentInfoAdapter">
<property name="appMetaDataAdapter"><inject
bean="WSAppMetaDataAdapter"/></property>
<property name="webMetaDataAdapter"><inject
bean="WSWebMetaDataAdapter"/></property>
</bean>
- <bean name="WSAppMetaDataAdapter"
class="org.jboss.ws.integration.jboss42.jbossws.ApplicationMetaDataAdapter"/>
- <bean name="WSWebMetaDataAdapter"
class="org.jboss.ws.integration.jboss42.jbossws.WebMetaDataAdapter"/>
+ <bean name="WSAppMetaDataAdapter"
class="org.jboss.ws.integration.jboss42.ApplicationMetaDataAdapter"/>
+ <bean name="WSWebMetaDataAdapter"
class="org.jboss.ws.integration.jboss42.WebMetaDataAdapter"/>
<!--
Register DeployerHooks with JBoss deployers
-->
- <bean name="WSDeployerHook_JAXRPC_JSE"
class="org.jboss.ws.integration.jboss42.jbossws.JAXRPCDeployerHookJSE">
+ <bean name="WSDeployerHook_JAXRPC_JSE"
class="org.jboss.ws.integration.jboss42.JAXRPCDeployerHookJSE">
<property
name="deploymentClass">org.jboss.ws.core.deployment.UnifiedMetaDataDeployment</property>
<property
name="endpointClass">org.jboss.ws.integration.BasicEndpoint</property>
<property name="deployerManager"><inject
bean="WSDeployerManagerJSE"/></property>
@@ -172,7 +174,7 @@
</list>
</property>
</bean>
- <bean name="WSDeployerHook_JAXRPC_EJB21"
class="org.jboss.ws.integration.jboss42.jbossws.JAXRPCDeployerHookEJB21">
+ <bean name="WSDeployerHook_JAXRPC_EJB21"
class="org.jboss.ws.integration.jboss42.JAXRPCDeployerHookEJB21">
<property
name="deploymentClass">org.jboss.ws.core.deployment.UnifiedMetaDataDeployment</property>
<property
name="endpointClass">org.jboss.ws.integration.BasicEndpoint</property>
<property name="deployerManager"><inject
bean="WSDeployerManagerEJB"/></property>
@@ -182,7 +184,7 @@
</list>
</property>
</bean>
- <bean name="WSDeployerHook_JAXWS_JSE"
class="org.jboss.ws.integration.jboss42.jbossws.JAXWSDeployerHookJSE">
+ <bean name="WSDeployerHook_JAXWS_JSE"
class="org.jboss.ws.integration.jboss42.JAXWSDeployerHookJSE">
<property
name="deploymentClass">org.jboss.ws.core.deployment.UnifiedMetaDataDeployment</property>
<property
name="endpointClass">org.jboss.ws.integration.BasicEndpoint</property>
<property name="deployerManager"><inject
bean="WSDeployerManagerJSE"/></property>
@@ -192,7 +194,7 @@
</list>
</property>
</bean>
- <bean name="WSDeployerHook_JAXWS_EJB3"
class="org.jboss.ws.integration.jboss42.jbossws.JAXWSDeployerHookEJB3">
+ <bean name="WSDeployerHook_JAXWS_EJB3"
class="org.jboss.ws.integration.jboss42.JAXWSDeployerHookEJB3">
<property
name="deploymentClass">org.jboss.ws.core.deployment.UnifiedMetaDataDeployment</property>
<property
name="endpointClass">org.jboss.ws.integration.BasicEndpoint</property>
<property name="deployerManager"><inject
bean="WSDeployerManagerEJB"/></property>
@@ -202,7 +204,7 @@
</list>
</property>
</bean>
- <bean name="WSMainDeployerHook"
class="org.jboss.ws.integration.jboss42.jbossws.MainDeployerHook">
+ <bean name="WSMainDeployerHook"
class="org.jboss.ws.integration.jboss42.MainDeployerHook">
<property name="deployerManager"><inject
bean="WSMainDeployerManager"/></property>
<property name="phaseTwoInterceptors">
<list class="java.util.LinkedList"
elementClass="javax.management.ObjectName">
Modified:
branches/tdiesler/trunk/integration/jbws-jboss50/ant-import/build-thirdparty.xml
===================================================================
---
branches/tdiesler/trunk/integration/jbws-jboss50/ant-import/build-thirdparty.xml 2007-05-17
11:03:51 UTC (rev 3119)
+++
branches/tdiesler/trunk/integration/jbws-jboss50/ant-import/build-thirdparty.xml 2007-05-17
11:53:42 UTC (rev 3120)
@@ -32,30 +32,6 @@
<!-- The compile classpath for jboss50 integration -->
<path id="jbws50.integration.classpath">
- <pathelement location="${spi.dir}/output/lib/jbossws-spi.jar"/>
- <pathelement location="${core.dir}/output/lib/jboss-jaxrpc.jar"/>
- <pathelement location="${core.dir}/output/lib/jboss-jaxws.jar"/>
- <pathelement location="${core.dir}/output/lib/jboss-saaj.jar"/>
- <pathelement location="${core.dir}/output/lib/jbossws-core.jar"/>
- <pathelement
location="${int.jboss50.dir}/output/lib/jbossws-jboss50.jar"/>
-
- <pathelement location="${jboss50.lib}/jboss-aop-jdk50.jar"/>
- <pathelement location="${jboss50.lib}/jboss-common-core.jar"/>
- <pathelement location="${jboss50.lib}/jboss-logging-spi.jar"/>
- <pathelement location="${jboss50.lib}/jboss-deployers.jar"/>
- <pathelement location="${jboss50.lib}/jboss-j2se.jar"/>
- <pathelement location="${jboss50.lib}/jboss-system.jar"/>
- <pathelement location="${jboss50.lib}/jboss-system-jmx.jar"/>
- <pathelement location="${jboss50.lib}/jboss-vfs.jar"/>
- <pathelement location="${jboss50.lib}/jboss-xml-binding.jar"/>
- <pathelement location="${jboss50.server.lib}/jboss.jar"/>
- <pathelement location="${jboss50.server.lib}/jboss-javaee.jar"/>
- <pathelement location="${jboss50.server.lib}/jbosssx.jar"/>
- <pathelement location="${jboss50.server.lib}/jnpserver.jar"/>
- <pathelement
location="${jboss50.server.deployers}/jboss-aop-jboss5.deployer/jboss-aspect-library-jdk50.jar"/>
- <pathelement
location="${jboss50.server.deployers}/ejb3.deployer/jboss-annotations-ejb3.jar"/>
- <pathelement
location="${jboss50.server.deployers}/ejb3.deployer/jboss-ejb3.jar"/>
- <pathelement
location="${jboss50.server.deployers}/ejb3.deployer/jboss-ejb3x.jar"/>
</path>
</target>
Modified:
branches/tdiesler/trunk/integration/jbws-jboss50/src/main/resources/jbossws.sar/META-INF/jbossws-beans.xml
===================================================================
---
branches/tdiesler/trunk/integration/jbws-jboss50/src/main/resources/jbossws.sar/META-INF/jbossws-beans.xml 2007-05-17
11:03:51 UTC (rev 3119)
+++
branches/tdiesler/trunk/integration/jbws-jboss50/src/main/resources/jbossws.sar/META-INF/jbossws-beans.xml 2007-05-17
11:53:42 UTC (rev 3120)
@@ -136,9 +136,9 @@
<property
name="lifecycleHandler">org.jboss.ws.core.server.LifecycleHandlerImpl</property>
<property name="invocationHandler">
<map keyClass="java.lang.String"
valueClass="java.lang.String">
-
<entry><key>JAXRPC_JSE</key><value>org.jboss.ws.integration.jboss50.InvocationHandlerJSE</value></entry>
+
<entry><key>JAXRPC_JSE</key><value>org.jboss.ws.integration.invocation.InvocationHandlerJSE</value></entry>
<entry><key>JAXRPC_EJB21</key><value>org.jboss.ws.integration.jboss50.InvocationHandlerEJB21</value></entry>
-
<entry><key>JAXWS_JSE</key><value>org.jboss.ws.integration.jboss50.InvocationHandlerJSE</value></entry>
+
<entry><key>JAXWS_JSE</key><value>org.jboss.ws.integration.invocation.InvocationHandlerJSE</value></entry>
<entry><key>JAXWS_EJB3</key><value>org.jboss.ws.integration.jboss50.InvocationHandlerEJB3</value></entry>
</map>
</property>
Modified:
branches/tdiesler/trunk/integration/spi/src/main/java/org/jboss/ws/integration/deployment/ServiceEndpointPublisher.java
===================================================================
---
branches/tdiesler/trunk/integration/spi/src/main/java/org/jboss/ws/integration/deployment/ServiceEndpointPublisher.java 2007-05-17
11:03:51 UTC (rev 3119)
+++
branches/tdiesler/trunk/integration/spi/src/main/java/org/jboss/ws/integration/deployment/ServiceEndpointPublisher.java 2007-05-17
11:53:42 UTC (rev 3120)
@@ -108,7 +108,7 @@
}
}
- public RewriteResults rewriteWebXml(InputStream source, File dest, ClassLoader loader)
throws Exception
+ private RewriteResults rewriteWebXml(InputStream source, File dest, ClassLoader
loader) throws Exception
{
if (dest == null)
{
Added:
branches/tdiesler/trunk/integration/spi/src/main/java/org/jboss/ws/integration/invocation/AbstractInvocationHandler.java
===================================================================
---
branches/tdiesler/trunk/integration/spi/src/main/java/org/jboss/ws/integration/invocation/AbstractInvocationHandler.java
(rev 0)
+++
branches/tdiesler/trunk/integration/spi/src/main/java/org/jboss/ws/integration/invocation/AbstractInvocationHandler.java 2007-05-17
11:53:42 UTC (rev 3120)
@@ -0,0 +1,118 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.ws.integration.invocation;
+
+// $Id$
+
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.lang.reflect.UndeclaredThrowableException;
+
+import javax.management.MBeanException;
+
+import org.jboss.logging.Logger;
+import org.jboss.ws.core.utils.JavaUtils;
+import org.jboss.ws.integration.Endpoint;
+
+/**
+ * Handles invocations on endpoints.
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 25-Apr-2007
+ */
+public abstract class AbstractInvocationHandler implements InvocationHandler
+{
+ // provide logging
+ private static final Logger log = Logger.getLogger(AbstractInvocationHandler.class);
+
+ protected Method getImplMethod(Class implClass, Method seiMethod) throws
ClassNotFoundException, NoSuchMethodException
+ {
+ String methodName = seiMethod.getName();
+ Class[] paramTypes = seiMethod.getParameterTypes();
+ for (int i = 0; i < paramTypes.length; i++)
+ {
+ Class paramType = paramTypes[i];
+ if (JavaUtils.isPrimitive(paramType) == false)
+ {
+ String paramTypeName = paramType.getName();
+ paramType = JavaUtils.loadJavaType(paramTypeName);
+ paramTypes[i] = paramType;
+ }
+ }
+
+ Method implMethod = implClass.getMethod(methodName, paramTypes);
+ return implMethod;
+ }
+
+ protected void handleInvocationException(Throwable th) throws Exception
+ {
+ if (th instanceof InvocationTargetException)
+ {
+ // unwrap the throwable raised by the service endpoint implementation
+ Throwable targetEx = ((InvocationTargetException)th).getTargetException();
+ handleInvocationThrowable(targetEx);
+ }
+
+ if (th instanceof MBeanException)
+ {
+ throw ((MBeanException)th).getTargetException();
+ }
+
+ handleInvocationThrowable(th);
+ }
+
+ private void handleInvocationThrowable(Throwable th) throws Exception
+ {
+ if (th instanceof Exception)
+ {
+ throw (Exception)th;
+ }
+ else if (th instanceof Error)
+ {
+ throw (Error)th;
+ }
+ else
+ {
+ throw new UndeclaredThrowableException(th);
+ }
+ }
+
+ public void create(Endpoint ep)
+ {
+ log.debug("Create: " + ep.getName());
+ }
+
+ public void start(Endpoint ep)
+ {
+ log.debug("Start: " + ep.getName());
+ }
+
+ public void stop(Endpoint ep)
+ {
+ log.debug("Stop: " + ep.getName());
+ }
+
+ public void destroy(Endpoint ep)
+ {
+ log.debug("Destroy: " + ep.getName());
+ }
+}
Property changes on:
branches/tdiesler/trunk/integration/spi/src/main/java/org/jboss/ws/integration/invocation/AbstractInvocationHandler.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
branches/tdiesler/trunk/integration/spi/src/main/java/org/jboss/ws/integration/invocation/InvocationHandlerJSE.java
===================================================================
---
branches/tdiesler/trunk/integration/spi/src/main/java/org/jboss/ws/integration/invocation/InvocationHandlerJSE.java
(rev 0)
+++
branches/tdiesler/trunk/integration/spi/src/main/java/org/jboss/ws/integration/invocation/InvocationHandlerJSE.java 2007-05-17
11:53:42 UTC (rev 3120)
@@ -0,0 +1,90 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.ws.integration.invocation;
+
+// $Id$
+
+import java.lang.reflect.Method;
+
+import javax.xml.rpc.server.ServiceLifecycle;
+import javax.xml.rpc.server.ServletEndpointContext;
+import javax.xml.ws.WebServiceContext;
+
+import org.jboss.ws.integration.Endpoint;
+
+/**
+ * Handles invocations on JSE endpoints.
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 25-Apr-2007
+ */
+public class InvocationHandlerJSE extends AbstractInvocationHandler
+{
+ protected Object getTargetBean(Endpoint ep) throws InstantiationException,
IllegalAccessException
+ {
+ Class epImpl = ep.getTargetBean();
+ Object targetBean = epImpl.newInstance();
+ return targetBean;
+ }
+
+ public void invoke(Endpoint ep, EndpointInvocation epInv) throws Exception
+ {
+ try
+ {
+ Object targetBean = getTargetBean(ep);
+
+ InvocationContext invContext = epInv.getInvocationContext();
+ WebServiceContext wsContext =
invContext.getAttachment(WebServiceContext.class);
+ if (wsContext != null)
+ {
+ new WebServiceContextInjector().injectContext(targetBean,
(WebServiceContext)wsContext);
+ }
+
+ if (targetBean instanceof ServiceLifecycle)
+ {
+ ServletEndpointContext sepContext =
invContext.getAttachment(ServletEndpointContext.class);
+ if (sepContext == null)
+ throw new IllegalStateException("Cannot obtain
ServletEndpointContext");
+
+ ((ServiceLifecycle)targetBean).init(sepContext);
+ }
+
+ try
+ {
+ Method method = getImplMethod(ep.getTargetBean(), epInv.getJavaMethod());
+ Object retObj = method.invoke(targetBean, epInv.getArgs());
+ epInv.setReturnValue(retObj);
+ }
+ finally
+ {
+ if (targetBean instanceof ServiceLifecycle)
+ {
+ ((ServiceLifecycle)targetBean).destroy();
+ }
+ }
+ }
+ catch (Exception e)
+ {
+ handleInvocationException(e);
+ }
+ }
+}
Property changes on:
branches/tdiesler/trunk/integration/spi/src/main/java/org/jboss/ws/integration/invocation/InvocationHandlerJSE.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: branches/tdiesler/trunk/jbossws/build.xml
===================================================================
--- branches/tdiesler/trunk/jbossws/build.xml 2007-05-17 11:03:51 UTC (rev 3119)
+++ branches/tdiesler/trunk/jbossws/build.xml 2007-05-17 11:53:42 UTC (rev 3120)
@@ -31,6 +31,14 @@
<property name="core.output.classes14.dir"
value="${core.output.dir}/classes14"/>
<property name="core.output.lib.dir"
value="${core.output.dir}/lib"/>
+ <!-- Define jboss.home -->
+ <condition property="jboss.home" value="${jboss50.home}">
+ <equals arg1="${jbossws.integration.target}"
arg2="jboss50"/>
+ </condition>
+ <condition property="jboss.home" value="${jboss42.home}">
+ <equals arg1="${jbossws.integration.target}"
arg2="jboss42"/>
+ </condition>
+
<target name="init" depends="prepare,thirdparty-get">
<ant antfile="${spi.dir}/build.xml" target="main"
inheritall="false"/>
</target>
Modified: branches/tdiesler/trunk/testsuite/ant-import/build-testsuite.xml
===================================================================
--- branches/tdiesler/trunk/testsuite/ant-import/build-testsuite.xml 2007-05-17 11:03:51
UTC (rev 3119)
+++ branches/tdiesler/trunk/testsuite/ant-import/build-testsuite.xml 2007-05-17 11:53:42
UTC (rev 3120)
@@ -12,6 +12,14 @@
-->
<target name="tests-init" depends="tests-prepare">
+ <!-- Define jboss.home -->
+ <condition property="jboss.home" value="${jboss50.home}">
+ <equals arg1="${jbossws.integration.target}"
arg2="jboss50"/>
+ </condition>
+ <condition property="jboss.home" value="${jboss42.home}">
+ <equals arg1="${jbossws.integration.target}"
arg2="jboss42"/>
+ </condition>
+
<!-- The combined compile classpath -->
<path id="javac.classpath">
<pathelement location="${spi.dir}/output/classes"/>
Deleted: branches/tdiesler/trunk/testsuite/build.xml
===================================================================
--- branches/tdiesler/trunk/testsuite/build.xml 2007-05-17 11:03:51 UTC (rev 3119)
+++ branches/tdiesler/trunk/testsuite/build.xml 2007-05-17 11:53:42 UTC (rev 3120)
@@ -1,32 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!-- ============================================================ -->
-<!-- JBoss, the OpenSource J2EE webOS -->
-<!-- Distributable under LGPL license. -->
-<!-- See terms of license at
http://www.gnu.org. -->
-<!-- ============================================================ -->
-
-<!-- $Id$ -->
-
-<project default="main" basedir=".."
name="JBossWS-Tests">
-
- <import file="${basedir}/build/ant-import/build-setup.xml"/>
-
- <import file="${testsuite.dir}/ant-import/build-testsuite.xml"/>
-
- <!-- ================================================================== -->
- <!-- Cleaning -->
- <!-- ================================================================== -->
-
- <target name="clean" description="Delete all generated test
files.">
- <delete dir="${testsuite.dir}/output-tests"/>
- </target>
-
- <target name="clobber" depends="clean" description="Cleans
up all generated files.">
- </target>
-
- <target name="main" description="Builds almost everything."
depends="tests-main"/>
-
- <target name="most" description="Builds almost everything."
depends="main"/>
-
-</project>