JBossWS SVN: r2964 - branches/jbossws-2.0/integration-jboss42.
by jbossws-commits@lists.jboss.org
Author: darran.lofthouse(a)jboss.com
Date: 2007-05-04 14:42:55 -0400 (Fri, 04 May 2007)
New Revision: 2964
Modified:
branches/jbossws-2.0/integration-jboss42/.classpath
Log:
Fix classpath error.
Modified: branches/jbossws-2.0/integration-jboss42/.classpath
===================================================================
--- branches/jbossws-2.0/integration-jboss42/.classpath 2007-05-04 18:37:42 UTC (rev 2963)
+++ branches/jbossws-2.0/integration-jboss42/.classpath 2007-05-04 18:42:55 UTC (rev 2964)
@@ -2,7 +2,7 @@
<classpath>
<classpathentry kind="src" path="src/java"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
- <classpathentry kind="con" path="org.eclipse.jdt.USER_LIBRARY/jboss-4-2-x"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.USER_LIBRARY/jboss-4.2.x"/>
<classpathentry combineaccessrules="false" kind="src" path="/jbossws-core"/>
<classpathentry kind="lib" path="/build/thirdparty/ant.jar"/>
<classpathentry kind="lib" path="/build/thirdparty/activation.jar"/>
17 years, 8 months
JBossWS SVN: r2963 - in branches/jbossws-2.0: integration-jboss50/src/java/org/jboss/ws/integration/jboss50 and 2 other directories.
by jbossws-commits@lists.jboss.org
Author: darran.lofthouse(a)jboss.com
Date: 2007-05-04 14:37:42 -0400 (Fri, 04 May 2007)
New Revision: 2963
Modified:
branches/jbossws-2.0/integration-jboss42/.classpath
branches/jbossws-2.0/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/AbstractDeployerJSE.java
branches/jbossws-2.0/integration-tomcat/src/java/org/jboss/ws/integration/tomcat/wspublish.java
branches/jbossws-2.0/jbossws-tests/src/java/org/jboss/test/ws/jaxrpc/jbws1093/JBWS1093TestCase.java
Log:
JBWS-1093 - Test if servlet class is a servlet or map it as an endpoint.
Modified: branches/jbossws-2.0/integration-jboss42/.classpath
===================================================================
--- branches/jbossws-2.0/integration-jboss42/.classpath 2007-05-04 15:08:18 UTC (rev 2962)
+++ branches/jbossws-2.0/integration-jboss42/.classpath 2007-05-04 18:37:42 UTC (rev 2963)
@@ -2,7 +2,7 @@
<classpath>
<classpathentry kind="src" path="src/java"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
- <classpathentry kind="con" path="org.eclipse.jdt.USER_LIBRARY/jboss-4.2.x"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.USER_LIBRARY/jboss-4-2-x"/>
<classpathentry combineaccessrules="false" kind="src" path="/jbossws-core"/>
<classpathentry kind="lib" path="/build/thirdparty/ant.jar"/>
<classpathentry kind="lib" path="/build/thirdparty/activation.jar"/>
Modified: branches/jbossws-2.0/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/AbstractDeployerJSE.java
===================================================================
--- branches/jbossws-2.0/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/AbstractDeployerJSE.java 2007-05-04 15:08:18 UTC (rev 2962)
+++ branches/jbossws-2.0/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/AbstractDeployerJSE.java 2007-05-04 18:37:42 UTC (rev 2963)
@@ -35,6 +35,7 @@
import org.jboss.metadata.web.Servlet;
import org.jboss.ws.core.server.AbstractServiceEndpointPublisher;
import org.jboss.ws.core.server.AbstractServiceEndpointPublisher.RewriteResults;
+import org.jboss.ws.core.utils.JavaUtils;
/**
* An abstract deployer for JSE Endpoints
@@ -60,15 +61,10 @@
// Call the super implementation
super.deployServiceEndpoint(unit);
- // FIXME: JBAS-3812 - TomcatDeployment should use modified WebMetaData
- InputStream stream = unit.getDeploymentContext().getRoot().findChild("WEB-INF/web.xml").openStream();
- RewriteResults results = getServiceEndpointPublisher().rewriteWebXml(stream, null, unit.getClassLoader());
-
- URL webXML = results.webXML;
- modifyWebMetaData(unit, webXML);
+ modifyWebMetaData(unit);
}
- private void modifyWebMetaData(DeploymentUnit unit, URL webXML) throws Exception
+ private void modifyWebMetaData(DeploymentUnit unit) throws Exception
{
Set<? extends WebMetaData> allMetaData = unit.getAllMetaData(WebMetaData.class);
if (allMetaData.size() < 1)
@@ -88,19 +84,44 @@
continue;
// Nothing to do if we have an <init-param>
- if (isAlreadyModified(servlet) == false)
+ if (isAlreadyModified(servlet) == false && isAServlet(servletClassName, unit.getClassLoader()) == false)
{
servlet.setServletClass(serviceEndpointServlet);
NameValuePair initParam = new NameValuePair(AbstractServiceEndpointPublisher.INIT_PARAM_SERVICE_ENDPOINT_IMPL, servletClassName);
servlet.addInitParam(initParam);
}
+
}
- // FIXME: JBAS-3812 - TomcatDeployment should use modified WebMetaData
- String webXmlPath = webXML.getPath();
- webMetaData.setAltDDPath(webXmlPath);
}
+ private boolean isAServlet(String servletClassName, ClassLoader cl)
+ {
+ boolean isAServlet = false;
+
+ if (cl != null)
+ {
+ try
+ {
+ Class servletClass = cl.loadClass(servletClassName);
+
+ isAServlet = JavaUtils.isAssignableFrom(javax.servlet.Servlet.class, servletClass);
+
+ if (isAServlet == true)
+ {
+ log.info("Ignore servlet: " + servletClassName);
+ }
+ }
+ catch (ClassNotFoundException e)
+ {
+ log.warn("Cannot load servlet class: " + servletClassName);
+ }
+
+ }
+
+ return isAServlet;
+ }
+
private boolean isAlreadyModified(Servlet servlet)
{
Iterator itParams = servlet.getInitParams().iterator();
Modified: branches/jbossws-2.0/integration-tomcat/src/java/org/jboss/ws/integration/tomcat/wspublish.java
===================================================================
--- branches/jbossws-2.0/integration-tomcat/src/java/org/jboss/ws/integration/tomcat/wspublish.java 2007-05-04 15:08:18 UTC (rev 2962)
+++ branches/jbossws-2.0/integration-tomcat/src/java/org/jboss/ws/integration/tomcat/wspublish.java 2007-05-04 18:37:42 UTC (rev 2963)
@@ -70,6 +70,7 @@
UnifiedDeploymentInfo udi = new UnifiedDeploymentInfo(null);
udi.webappURL = tmpDir.toURL();
+ udi.classLoader = DeploymentLoader.newInstance(udi.webappURL);
TomcatServiceEndpointPublisher publisher = new TomcatServiceEndpointPublisher();
publisher.setServiceEndpointServlet(servletName);
Modified: branches/jbossws-2.0/jbossws-tests/src/java/org/jboss/test/ws/jaxrpc/jbws1093/JBWS1093TestCase.java
===================================================================
--- branches/jbossws-2.0/jbossws-tests/src/java/org/jboss/test/ws/jaxrpc/jbws1093/JBWS1093TestCase.java 2007-05-04 15:08:18 UTC (rev 2962)
+++ branches/jbossws-2.0/jbossws-tests/src/java/org/jboss/test/ws/jaxrpc/jbws1093/JBWS1093TestCase.java 2007-05-04 18:37:42 UTC (rev 2963)
@@ -85,12 +85,6 @@
public void testAccessServlet() throws Exception
{
- if (true)
- {
- System.out.println("FIXME: [JBAS-4210] HTTP request dispatched to the wrong servlet");
- return;
- }
-
URL servletURL = new URL("http://" + getServerHost() + ":8080" + "/jaxrpc-jbws1093/ServletTest");
InputStream is = servletURL.openStream();
17 years, 8 months
JBossWS SVN: r2962 - in branches/dlofthouse/JBWS-1625/jbossws-tests/src: java/org/jboss/test/ws/tools/jbws1597 and 4 other directories.
by jbossws-commits@lists.jboss.org
Author: darran.lofthouse(a)jboss.com
Date: 2007-05-04 11:08:18 -0400 (Fri, 04 May 2007)
New Revision: 2962
Added:
branches/dlofthouse/JBWS-1625/jbossws-tests/src/java/org/jboss/test/ws/tools/jbws1597/
branches/dlofthouse/JBWS-1625/jbossws-tests/src/java/org/jboss/test/ws/tools/jbws1597/JBWS1597TestCase.java
branches/dlofthouse/JBWS-1625/jbossws-tests/src/resources/tools/jbws1597/
branches/dlofthouse/JBWS-1625/jbossws-tests/src/resources/tools/jbws1597/doclit_in/
branches/dlofthouse/JBWS-1625/jbossws-tests/src/resources/tools/jbws1597/doclit_in/PhoneBook.wsdl
branches/dlofthouse/JBWS-1625/jbossws-tests/src/resources/tools/jbws1597/doclit_in/wstools-config.xml
Modified:
branches/dlofthouse/JBWS-1625/jbossws-tests/src/java/org/jboss/test/ws/tools/jbws429/JBWS429TestCase.java
Log:
Initial Test Case.
Added: branches/dlofthouse/JBWS-1625/jbossws-tests/src/java/org/jboss/test/ws/tools/jbws1597/JBWS1597TestCase.java
===================================================================
--- branches/dlofthouse/JBWS-1625/jbossws-tests/src/java/org/jboss/test/ws/tools/jbws1597/JBWS1597TestCase.java (rev 0)
+++ branches/dlofthouse/JBWS-1625/jbossws-tests/src/java/org/jboss/test/ws/tools/jbws1597/JBWS1597TestCase.java 2007-05-04 15:08:18 UTC (rev 2962)
@@ -0,0 +1,101 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2007, 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.test.ws.tools.jbws1597;
+
+import java.io.File;
+import java.io.FilenameFilter;
+
+import org.jboss.test.ws.JBossWSTest;
+import org.jboss.test.ws.tools.fixture.JBossSourceComparator;
+import org.jboss.test.ws.tools.validation.JaxrpcMappingValidator;
+import org.jboss.ws.tools.WSTools;
+
+/**
+ *
+ * @author darran.lofthouse(a)jboss.com
+ * @since 27 Apr 2007
+ */
+public class JBWS1597TestCase extends JBossWSTest
+{
+
+ public void testGenerateDocLitIn() throws Exception
+ {
+ generateScenario("doclit_in");
+ }
+
+ protected void generateScenario(final String scenario) throws Exception
+ {
+ String resourceDir = "resources/tools/jbws1597/" + scenario;
+ String toolsDir = "tools/jbws1597/" + scenario;
+ String[] args = new String[] { "-dest", toolsDir, "-config", resourceDir + "/wstools-config.xml" };
+ new WSTools().generate(args);
+ File resourceDirFile = new File(resourceDir);
+ String[] expectedFiles = resourceDirFile.list(new FilenameFilter() {
+ public boolean accept(File dir, String name)
+ {
+ return name.endsWith(".java");
+ }
+ });
+
+ for (int i = 0; i < expectedFiles.length; i++)
+ {
+ String currentFile = expectedFiles[i];
+
+ try
+ {
+ compareSource(resourceDir + "/" + currentFile, toolsDir + "/org/jboss/test/ws/jbws1597/" + currentFile);
+ }
+ catch (Exception e)
+ {
+ throw new Exception("Validation of '" + currentFile + "' failed.", e);
+ }
+ }
+
+ File packageDir = new File(toolsDir + "/org/jboss/test/ws/jbws1597");
+ String[] generatedFiles = packageDir.list();
+ for (int i = 0; i < generatedFiles.length; i++)
+ {
+ String currentFile = generatedFiles[i];
+
+ boolean matched = "PhoneBookService.java".equals(currentFile);
+
+ for (int j = 0; j < expectedFiles.length && (matched == false); j++)
+ matched = currentFile.equals(expectedFiles[j]);
+
+ assertTrue("File '" + currentFile + "' was not expected to be generated", matched);
+ }
+
+ JaxrpcMappingValidator mappingValidator = new JaxrpcMappingValidator();
+ mappingValidator.validate(resourceDir + "/jaxrpc-mapping.xml", toolsDir + "/jaxrpc-mapping.xml");
+ }
+
+ private static void compareSource(final String expectedName, final String generatedName) throws Exception
+ {
+ File expected = new File(expectedName);
+ File generated = new File(generatedName);
+
+ JBossSourceComparator sc = new JBossSourceComparator(expected, generated);
+ sc.validate();
+ sc.validateImports();
+ }
+
+}
Property changes on: branches/dlofthouse/JBWS-1625/jbossws-tests/src/java/org/jboss/test/ws/tools/jbws1597/JBWS1597TestCase.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: branches/dlofthouse/JBWS-1625/jbossws-tests/src/java/org/jboss/test/ws/tools/jbws429/JBWS429TestCase.java
===================================================================
--- branches/dlofthouse/JBWS-1625/jbossws-tests/src/java/org/jboss/test/ws/tools/jbws429/JBWS429TestCase.java 2007-05-04 15:06:01 UTC (rev 2961)
+++ branches/dlofthouse/JBWS-1625/jbossws-tests/src/java/org/jboss/test/ws/tools/jbws429/JBWS429TestCase.java 2007-05-04 15:08:18 UTC (rev 2962)
@@ -24,7 +24,7 @@
import java.io.File;
import java.io.FilenameFilter;
-import org.jboss.test.ws.tools.WSToolsTest;
+import org.jboss.test.ws.JBossWSTest;
import org.jboss.test.ws.tools.fixture.JBossSourceComparator;
import org.jboss.test.ws.tools.validation.JaxrpcMappingValidator;
import org.jboss.ws.tools.WSTools;
@@ -37,7 +37,7 @@
* @author darran.lofthouse(a)jboss.com
* @since 11 Apr 2007
*/
-public class JBWS429TestCase extends WSToolsTest
+public class JBWS429TestCase extends JBossWSTest
{
/**
Added: branches/dlofthouse/JBWS-1625/jbossws-tests/src/resources/tools/jbws1597/doclit_in/PhoneBook.wsdl
===================================================================
--- branches/dlofthouse/JBWS-1625/jbossws-tests/src/resources/tools/jbws1597/doclit_in/PhoneBook.wsdl (rev 0)
+++ branches/dlofthouse/JBWS-1625/jbossws-tests/src/resources/tools/jbws1597/doclit_in/PhoneBook.wsdl 2007-05-04 15:08:18 UTC (rev 2962)
@@ -0,0 +1,77 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<definitions name='PhoneBook'
+ targetNamespace='http://test.jboss.org/ws/jbws1597'
+ xmlns='http://schemas.xmlsoap.org/wsdl/'
+ xmlns:ns1='http://test.jboss.org/ws/jbws1597/types'
+ xmlns:soap='http://schemas.xmlsoap.org/wsdl/soap/'
+ xmlns:tns='http://test.jboss.org/ws/jbws1597'
+ xmlns:xsd='http://www.w3.org/2001/XMLSchema'>
+ <types>
+ <schema targetNamespace='http://test.jboss.org/ws/jbws1597/types'
+ xmlns='http://www.w3.org/2001/XMLSchema'
+ xmlns:soap11-enc='http://schemas.xmlsoap.org/soap/encoding/'
+ xmlns:tns='http://test.jboss.org/ws/jbws1597/types'
+ xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>
+
+ <complexType name='Person'>
+ <sequence>
+ <element name='firstName' nillable='true' type='string'/>
+ <element name='surname' nillable='true' type='string'/>
+ </sequence>
+ </complexType>
+
+ <complexType name='TelephoneNumber'>
+ <sequence>
+ <element name='areaCode' nillable='true' type='string'/>
+ <element name='number' nillable='true' type='string'/>
+ </sequence>
+ </complexType>
+
+ <complexType name='BillingAccount'>
+ <sequence>
+ <element name='sortCode' nillable='true' type='string'/>
+ <element name='accountNumber' nillable='true' type='string'/>
+ </sequence>
+ </complexType>
+
+ <element name='lookup' type='tns:Person'/>
+ <element name='lookupResponse' type='tns:TelephoneNumber'/>
+ <element name='billingAccount' type='tns:BillingAccount'/>
+ </schema>
+ </types>
+
+ <message name='PhoneBook_lookup'>
+ <part element='ns1:lookup' name='parameters'/>
+ <part element='ns1:billingAccount' name='header'/>
+ </message>
+
+ <message name='PhoneBook_lookupResponse'>
+ <part element='ns1:lookupResponse' name='result'/>
+ </message>
+
+ <portType name='PhoneBook'>
+ <operation name='lookup'>
+ <input message='tns:PhoneBook_lookup'/>
+ <output message='tns:PhoneBook_lookupResponse'/>
+ </operation>
+ </portType>
+
+ <binding name='PhoneBookBinding' type='tns:PhoneBook'>
+ <soap:binding style='document' transport='http://schemas.xmlsoap.org/soap/http'/>
+ <operation name='lookup'>
+ <soap:operation soapAction=''/>
+ <input>
+ <soap:body use='literal' parts='parameters'/>
+ <soap:header use='literal' message='tns:PhoneBook_lookup' part='header' />
+ </input>
+ <output>
+ <soap:body use='literal'/>
+ </output>
+ </operation>
+ </binding>
+ <service name='PhoneBook'>
+ <port binding='tns:PhoneBookBinding' name='PhoneBookPort'>
+ <soap:address location='REPLACE_WITH_ACTUAL_URL'/>
+ </port>
+ </service>
+</definitions>
\ No newline at end of file
Property changes on: branches/dlofthouse/JBWS-1625/jbossws-tests/src/resources/tools/jbws1597/doclit_in/PhoneBook.wsdl
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: branches/dlofthouse/JBWS-1625/jbossws-tests/src/resources/tools/jbws1597/doclit_in/wstools-config.xml
===================================================================
--- branches/dlofthouse/JBWS-1625/jbossws-tests/src/resources/tools/jbws1597/doclit_in/wstools-config.xml (rev 0)
+++ branches/dlofthouse/JBWS-1625/jbossws-tests/src/resources/tools/jbws1597/doclit_in/wstools-config.xml 2007-05-04 15:08:18 UTC (rev 2962)
@@ -0,0 +1,6 @@
+<configuration>
+ <wsdl-java location="resources/tools/jbws1597/doclit_in/PhoneBook.wsdl"
+ parameter-style="bare">
+ <mapping file="jaxrpc-mapping.xml"/>
+ </wsdl-java>
+</configuration>
Property changes on: branches/dlofthouse/JBWS-1625/jbossws-tests/src/resources/tools/jbws1597/doclit_in/wstools-config.xml
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
17 years, 8 months
JBossWS SVN: r2961 - branches/dlofthouse/JBWS-1597.
by jbossws-commits@lists.jboss.org
Author: darran.lofthouse(a)jboss.com
Date: 2007-05-04 11:06:01 -0400 (Fri, 04 May 2007)
New Revision: 2961
Added:
branches/dlofthouse/JBWS-1597/JBWS-1625/
Log:
Branch for JBWS-1597
Copied: branches/dlofthouse/JBWS-1597/JBWS-1625 (from rev 2960, branches/dlofthouse/JBWS-1625)
17 years, 8 months
JBossWS SVN: r2960 - in trunk: integration-jboss40/src/resources/jbossws.sar/META-INF and 4 other directories.
by jbossws-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2007-05-04 09:48:53 -0400 (Fri, 04 May 2007)
New Revision: 2960
Added:
trunk/jbossws-core/src/java/org/jboss/ws/core/server/ServiceEndpointRegistry.java
trunk/jbossws-core/src/java/org/jboss/ws/core/server/ServiceEndpointRegistryMBean.java
Removed:
trunk/integration-jboss40/src/resources/jbossws.sar/META-INF/jboss-service-no-ejb3.xml
Modified:
trunk/build/eclipse/jbossws.userlibraries
trunk/integration-jboss40/src/resources/jbossws.sar/META-INF/jboss-service.xml
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/DeploymentInfoAdapter.java
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/JAXWSDeployerHookEJB3.java
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/JAXWSDeployerHookJSE.java
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/UnifiedDeploymentInfoDeployer.java
trunk/integration-jboss42/src/resources/jbossws.beans/META-INF/jboss-beans.xml
trunk/integration-jboss50/src/resources/jbossws.sar/META-INF/jbossws-beans.xml
trunk/jbossws-core/src/java/org/jboss/ws/core/server/AbstractServiceEndpointServlet.java
trunk/jbossws-core/src/java/org/jboss/ws/core/server/RequestHandlerImpl.java
Log:
Fix JAXWS_EJB3 for AS42
Modified: trunk/build/eclipse/jbossws.userlibraries
===================================================================
--- trunk/build/eclipse/jbossws.userlibraries 2007-05-04 12:20:09 UTC (rev 2959)
+++ trunk/build/eclipse/jbossws.userlibraries 2007-05-04 13:48:53 UTC (rev 2960)
@@ -22,16 +22,14 @@
<archive path="/home/tdiesler/svn/jbossas/trunk/build/output/jboss-5.0.0.Beta3/lib/jboss-aop-jdk50.jar"/>
<archive path="/home/tdiesler/svn/jbossas/trunk/build/output/jboss-5.0.0.Beta3/lib/jboss-deployers.jar"/>
<archive path="/home/tdiesler/svn/jbossas/trunk/build/output/jboss-5.0.0.Beta3/lib/jboss-j2se.jar"/>
-<archive path="/home/tdiesler/svn/jbossas/trunk/build/output/jboss-5.0.0.Beta3/lib/jboss-security-spi.jar"/>
+<archive path="/home/tdiesler/svn/jbossas/trunk/build/output/jboss-5.0.0.Beta3/server/default/lib/jboss-javaee.jar"/>
<archive path="/home/tdiesler/svn/jbossas/trunk/build/output/jboss-5.0.0.Beta3/lib/jboss-system.jar"/>
<archive path="/home/tdiesler/svn/jbossas/trunk/build/output/jboss-5.0.0.Beta3/lib/jboss-system-jmx.jar"/>
<archive path="/home/tdiesler/svn/jbossas/trunk/build/output/jboss-5.0.0.Beta3/lib/jboss-vfs.jar"/>
-<archive path="/home/tdiesler/svn/jbossas/trunk/build/output/jboss-5.0.0.Beta3/lib/jbosssx.jar"/>
<archive path="/home/tdiesler/svn/jbossas/trunk/build/output/jboss-5.0.0.Beta3/server/default/lib/jboss.jar" source="/home/tdiesler/svn/jbossas/trunk/server/src/main"/>
<archive path="/home/tdiesler/svn/jbossas/trunk/build/output/jboss-5.0.0.Beta3/server/default/lib/jnpserver.jar"/>
<archive path="/home/tdiesler/svn/jbossas/trunk/build/output/jboss-5.0.0.Beta3/server/default/deployers/jboss-aop-jboss5.deployer/jboss-aspect-library-jdk50.jar"/>
<archive path="/home/tdiesler/svn/jbossas/trunk/build/output/jboss-5.0.0.Beta3/server/default/deployers/ejb3.deployer/jboss-annotations-ejb3.jar"/>
<archive path="/home/tdiesler/svn/jbossas/trunk/build/output/jboss-5.0.0.Beta3/server/default/deployers/ejb3.deployer/jboss-ejb3.jar" source="/home/tdiesler/svn/jbossas/branches/Branch_4_2/ejb3/src/main"/>
-<archive path="/home/tdiesler/svn/jbossas/trunk/build/output/jboss-5.0.0.Beta3/server/default/deployers/ejb3.deployer/jboss-ejb3x.jar"/>
</library>
</eclipse-userlibraries>
Deleted: trunk/integration-jboss40/src/resources/jbossws.sar/META-INF/jboss-service-no-ejb3.xml
===================================================================
--- trunk/integration-jboss40/src/resources/jbossws.sar/META-INF/jboss-service-no-ejb3.xml 2007-05-04 12:20:09 UTC (rev 2959)
+++ trunk/integration-jboss40/src/resources/jbossws.sar/META-INF/jboss-service-no-ejb3.xml 2007-05-04 13:48:53 UTC (rev 2960)
@@ -1,49 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!-- $Id$ -->
-
-<server>
-
- <!--
- Bind JAXRPC ServiceRefs
- -->
- <mbean name="jboss.ws:service=WebServiceClientDeployer" code="org.jboss.ws.integration.jboss40.WebServiceClientDeployer">
- <depends>jboss:service=Naming</depends>
- </mbean>
-
- <!--
- A deployer service for JSE endpoints.
- -->
- <mbean name="jboss.ws:service=WebServiceDeployerJSE" code="org.jboss.ws.integration.jboss42.DeployerInterceptorJSE">
- <depends-list optional-attribute-name="Interceptables">
- <depends-list-element>jboss.web:service=WebServer</depends-list-element>
- </depends-list>
- </mbean>
-
- <!--
- A deployer service for EJB2.1 endpoints.
- -->
- <mbean name="jboss.ws:service=DeployerInterceptorEJB21" code="org.jboss.ws.integration.jboss42.DeployerInterceptorEJB21">
- <depends-list optional-attribute-name="Interceptables">
- <depends-list-element>jboss.ejb:service=EJBDeployer</depends-list-element>
- </depends-list>
- </mbean>
-
- <!--
- A deployer service for EJB3 endpoints.
- <mbean name="jboss.ws:service=DeployerInterceptorEJB3" code="org.jboss.ws.integration.jboss42.DeployerInterceptorEJB3">
- <depends-list optional-attribute-name="Interceptables">
- <depends-list-element>jboss.ejb3:service=EJB3Deployer</depends-list-element>
- </depends-list>
- </mbean>
- -->
-
- <!--
- A deployer service for JSE endpoints that are nested in service archives (sar).
- -->
- <mbean name="jboss.ws:service=DeployerInterceptorNestedJSE" code="org.jboss.ws.integration.jboss42.DeployerInterceptorNestedJSE">
- <depends optional-attribute-name="MainDeployer" proxy-type="attribute">jboss.system:service=MainDeployer</depends>
- <depends>jboss.ws:service=WebServiceDeployerJSE</depends>
- </mbean>
-
-</server>
Modified: trunk/integration-jboss40/src/resources/jbossws.sar/META-INF/jboss-service.xml
===================================================================
--- trunk/integration-jboss40/src/resources/jbossws.sar/META-INF/jboss-service.xml 2007-05-04 12:20:09 UTC (rev 2959)
+++ trunk/integration-jboss40/src/resources/jbossws.sar/META-INF/jboss-service.xml 2007-05-04 13:48:53 UTC (rev 2960)
@@ -14,7 +14,7 @@
<!--
A deployer service for JSE endpoints.
-->
- <mbean name="jboss.ws:service=WebServiceDeployerJSE" code="org.jboss.ws.integration.jboss42.DeployerInterceptorJSE">
+ <mbean name="jboss.ws:service=DeployerInterceptorJSE" code="org.jboss.ws.integration.jboss42.DeployerInterceptorJSE">
<depends-list optional-attribute-name="Interceptables">
<depends-list-element>jboss.web:service=WebServer</depends-list-element>
</depends-list>
@@ -38,12 +38,4 @@
</depends-list>
</mbean>
- <!--
- A deployer service for JSE endpoints that are nested in service archives (sar).
- -->
- <mbean name="jboss.ws:service=DeployerInterceptorNestedJSE" code="org.jboss.ws.integration.jboss42.DeployerInterceptorNestedJSE">
- <depends optional-attribute-name="MainDeployer" proxy-type="attribute">jboss.system:service=MainDeployer</depends>
- <depends>jboss.ws:service=WebServiceDeployerJSE</depends>
- </mbean>
-
</server>
Modified: trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/DeploymentInfoAdapter.java
===================================================================
--- trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/DeploymentInfoAdapter.java 2007-05-04 12:20:09 UTC (rev 2959)
+++ trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/DeploymentInfoAdapter.java 2007-05-04 13:48:53 UTC (rev 2960)
@@ -26,13 +26,25 @@
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.core.deployment.UnifiedDeploymentInfo;
import org.jboss.ws.integration.ResourceLoaderAdapter;
+import org.jboss.ws.metadata.j2ee.UnifiedApplicationMetaData;
+import org.jboss.ws.metadata.j2ee.UnifiedBeanMetaData;
/**
* Build container independent deployment info.
@@ -61,7 +73,7 @@
public UnifiedDeploymentInfo buildDeploymentInfo(UnifiedDeploymentInfo udi, DeploymentInfo di)
{
udi.addAttachment(DeploymentInfo.class, di);
-
+
if (di.parent != null)
{
udi.parent = new UnifiedDeploymentInfo(null);
@@ -113,5 +125,44 @@
{
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");
+ }
+ }
}
Modified: trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/JAXWSDeployerHookEJB3.java
===================================================================
--- trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/JAXWSDeployerHookEJB3.java 2007-05-04 12:20:09 UTC (rev 2959)
+++ trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/JAXWSDeployerHookEJB3.java 2007-05-04 13:48:53 UTC (rev 2960)
@@ -23,23 +23,17 @@
//$Id$
-import java.io.IOException;
-import java.util.Iterator;
-
import javax.jws.WebService;
import javax.xml.ws.WebServiceProvider;
import org.jboss.deployment.DeploymentInfo;
import org.jboss.ejb3.EJBContainer;
-import org.jboss.ejb3.Ejb3Deployment;
+import org.jboss.ejb3.Ejb3ModuleMBean;
import org.jboss.ejb3.stateless.StatelessContainer;
-import org.jboss.util.NotImplementedException;
import org.jboss.ws.integration.Endpoint;
import org.jboss.ws.integration.EndpointImpl;
import org.jboss.ws.integration.ObjectNameFactory;
-import org.jboss.ws.integration.ResourceLoaderAdapter;
import org.jboss.ws.integration.Service;
-import org.jboss.ws.integration.UnifiedVirtualFile;
import org.jboss.ws.integration.deployment.Deployment;
import org.jboss.ws.integration.deployment.DeploymentImpl;
import org.jboss.ws.integration.deployment.Deployment.DeploymentType;
@@ -68,28 +62,24 @@
Service service = dep.getService();
- Ejb3Deployment ejb3Deployment = (Ejb3Deployment)unit.context.get(Ejb3Deployment.class);
- if (ejb3Deployment == null)
- throw new IllegalStateException("Deployment unit does not contain ejb3 deployment");
-
- // Copy the attachments
- dep.getContext().addAttachment(Ejb3Deployment.class, ejb3Deployment);
-
- Iterator it = ejb3Deployment.getEjbContainers().values().iterator();
- while (it.hasNext())
+ Ejb3ModuleMBean ejb3Module = DeploymentInfoAdapter.getEJB3Module(unit.deployedObject);
+ for (Object manager : ejb3Module.getContainers().values())
{
- EJBContainer container = (EJBContainer)it.next();
- if (isWebServiceBean(container))
+ if (manager instanceof EJBContainer)
{
- String ejbName = container.getEjbName();
- Class epBean = container.getBeanClass();
+ EJBContainer container = (EJBContainer)manager;
+ if (isWebServiceBean(container))
+ {
+ String ejbName = container.getEjbName();
+ Class epBean = container.getBeanClass();
- // Create the endpoint
- Endpoint endpoint = new EndpointImpl(service, epBean);
- String nameStr = Endpoint.SEPID_DOMAIN + ":" + Endpoint.SEPID_PROPERTY_ENDPOINT + "=" + ejbName;
- endpoint.setName(ObjectNameFactory.create(nameStr));
+ // Create the endpoint
+ Endpoint endpoint = new EndpointImpl(service, epBean);
+ String nameStr = Endpoint.SEPID_DOMAIN + ":" + Endpoint.SEPID_PROPERTY_ENDPOINT + "=" + ejbName;
+ endpoint.setName(ObjectNameFactory.create(nameStr));
- service.addEndpoint(endpoint);
+ service.addEndpoint(endpoint);
+ }
}
}
@@ -99,24 +89,24 @@
@Override
public boolean isWebServiceDeployment(DeploymentInfo unit)
{
- Ejb3Deployment ejb3Deployment = (Ejb3Deployment)unit.context.get(Ejb3Deployment.class);
- if (ejb3Deployment == null)
- return false;
+ boolean isWebserviceDeployment = false;
- boolean isWebServiceDeployment = false;
-
- Iterator it = ejb3Deployment.getEjbContainers().values().iterator();
- while (it.hasNext())
+ // Check if the ejb3 contains annotated endpoints
+ Ejb3ModuleMBean ejb3Module = DeploymentInfoAdapter.getEJB3Module(unit.deployedObject);
+ for (Object manager : ejb3Module.getContainers().values())
{
- EJBContainer container = (EJBContainer)it.next();
- if (isWebServiceBean(container))
+ if (manager instanceof EJBContainer)
{
- isWebServiceDeployment = true;
- break;
+ EJBContainer container = (EJBContainer)manager;
+ if (isWebServiceBean(container))
+ {
+ isWebserviceDeployment = true;
+ break;
+ }
}
}
- return isWebServiceDeployment;
+ return isWebserviceDeployment;
}
private boolean isWebServiceBean(EJBContainer container)
Modified: trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/JAXWSDeployerHookJSE.java
===================================================================
--- trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/JAXWSDeployerHookJSE.java 2007-05-04 12:20:09 UTC (rev 2959)
+++ trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/JAXWSDeployerHookJSE.java 2007-05-04 13:48:53 UTC (rev 2960)
@@ -69,14 +69,14 @@
Service service = dep.getService();
- WebMetaData webMetaData = (WebMetaData)unit.context.get(WebMetaData.class);
+ 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.ucl);
+ List<Servlet> servlets = getRelevantServlets(webMetaData, unit.annotationsCl);
for (Servlet servlet : servlets)
{
String servletName = servlet.getServletName();
@@ -114,7 +114,7 @@
try
{
WebMetaData webMetaData = (WebMetaData)unit.metaData;
- List<Servlet> servlets = getRelevantServlets(webMetaData, unit.ucl);
+ List<Servlet> servlets = getRelevantServlets(webMetaData, unit.annotationsCl);
isWebServiceDeployment = servlets.size() > 0;
}
catch (Exception ex)
Modified: trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/UnifiedDeploymentInfoDeployer.java
===================================================================
--- trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/UnifiedDeploymentInfoDeployer.java 2007-05-04 12:20:09 UTC (rev 2959)
+++ trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/UnifiedDeploymentInfoDeployer.java 2007-05-04 13:48:53 UTC (rev 2960)
@@ -23,13 +23,26 @@
//$Id$
+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.mx.util.MBeanProxy;
+import org.jboss.mx.util.MBeanProxyCreationException;
+import org.jboss.mx.util.MBeanServerLocator;
+import org.jboss.ws.WSException;
import org.jboss.ws.core.deployment.JAXRPCDeployment;
import org.jboss.ws.core.deployment.JAXWSDeployment;
import org.jboss.ws.core.deployment.UnifiedDeploymentInfo;
import org.jboss.ws.integration.deployment.AbstractDeployer;
import org.jboss.ws.integration.deployment.Deployment;
import org.jboss.ws.integration.deployment.Deployment.DeploymentType;
+import org.jboss.ws.metadata.j2ee.UnifiedApplicationMetaData;
+import org.jboss.ws.metadata.j2ee.UnifiedBeanMetaData;
import org.jboss.ws.metadata.webservices.WebservicesMetaData;
/**
Modified: trunk/integration-jboss42/src/resources/jbossws.beans/META-INF/jboss-beans.xml
===================================================================
--- trunk/integration-jboss42/src/resources/jbossws.beans/META-INF/jboss-beans.xml 2007-05-04 12:20:09 UTC (rev 2959)
+++ trunk/integration-jboss42/src/resources/jbossws.beans/META-INF/jboss-beans.xml 2007-05-04 13:48:53 UTC (rev 2960)
@@ -26,7 +26,7 @@
</bean>
<!-- The registry for web service endpoints -->
- <bean name="WSEndpointRegistry" class="org.jboss.ws.integration.management.EndpointRegistryImpl"/>
+ <bean name="WSEndpointRegistry" class="org.jboss.ws.core.server.ServiceEndpointRegistry"/>
<!-- A subscription manager for WS-Eventing -->
<bean name="WSSubscriptionManager" class="org.jboss.ws.extensions.eventing.mgmt.SubscriptionManager"/>
Modified: trunk/integration-jboss50/src/resources/jbossws.sar/META-INF/jbossws-beans.xml
===================================================================
--- trunk/integration-jboss50/src/resources/jbossws.sar/META-INF/jbossws-beans.xml 2007-05-04 12:20:09 UTC (rev 2959)
+++ trunk/integration-jboss50/src/resources/jbossws.sar/META-INF/jbossws-beans.xml 2007-05-04 13:48:53 UTC (rev 2960)
@@ -26,7 +26,7 @@
</bean>
<!-- The registry for web service endpoints -->
- <bean name="WSEndpointRegistry" class="org.jboss.ws.integration.management.EndpointRegistryImpl"/>
+ <bean name="WSEndpointRegistry" class="org.jboss.ws.core.server.ServiceEndpointRegistry"/>
<!-- A subscription manager for WS-Eventing -->
<bean name="WSSubscriptionManager" class="org.jboss.ws.extensions.eventing.mgmt.SubscriptionManager"/>
Modified: trunk/jbossws-core/src/java/org/jboss/ws/core/server/AbstractServiceEndpointServlet.java
===================================================================
--- trunk/jbossws-core/src/java/org/jboss/ws/core/server/AbstractServiceEndpointServlet.java 2007-05-04 12:20:09 UTC (rev 2959)
+++ trunk/jbossws-core/src/java/org/jboss/ws/core/server/AbstractServiceEndpointServlet.java 2007-05-04 13:48:53 UTC (rev 2960)
@@ -85,16 +85,28 @@
if (req.getParameter("wsdl") != null || req.getParameter("WSDL") != null)
{
res.setContentType("text/xml");
+ ServletOutputStream out = res.getOutputStream();
try
{
RequestHandler requestHandler = endpoint.getRequestHandler();
ServletRequestContext context = new ServletRequestContext(getServletContext(), req, res);
- requestHandler.handleWSDLRequest(endpoint, res.getOutputStream(), context);
+ requestHandler.handleWSDLRequest(endpoint, out, context);
}
catch (Exception ex)
{
handleException(ex);
}
+ finally
+ {
+ try
+ {
+ out.close();
+ }
+ catch (IOException ioex)
+ {
+ log.error("Cannot close output stream");
+ }
+ }
}
else
{
@@ -102,7 +114,6 @@
res.setContentType("text/plain");
Writer out = res.getWriter();
out.write("HTTP GET not supported");
- out.flush();
out.close();
}
}
@@ -111,13 +122,13 @@
{
log.debug("doPost: " + req.getRequestURI());
- ServletInputStream inputStream = req.getInputStream();
- ServletOutputStream outputStream = res.getOutputStream();
+ ServletInputStream in = req.getInputStream();
+ ServletOutputStream out = res.getOutputStream();
try
{
RequestHandler requestHandler = endpoint.getRequestHandler();
ServletRequestContext context = new ServletRequestContext(getServletContext(), req, res);
- requestHandler.handleRequest(endpoint, inputStream, outputStream, context);
+ requestHandler.handleRequest(endpoint, in, out, context);
}
catch (Exception ex)
{
@@ -127,14 +138,12 @@
{
try
{
- outputStream.flush();
- outputStream.close();
+ out.close();
}
catch (IOException ioex)
{
- log.error("Cannot flush output stream");
+ log.error("Cannot close output stream");
}
-
}
}
Modified: trunk/jbossws-core/src/java/org/jboss/ws/core/server/RequestHandlerImpl.java
===================================================================
--- trunk/jbossws-core/src/java/org/jboss/ws/core/server/RequestHandlerImpl.java 2007-05-04 12:20:09 UTC (rev 2959)
+++ trunk/jbossws-core/src/java/org/jboss/ws/core/server/RequestHandlerImpl.java 2007-05-04 13:48:53 UTC (rev 2960)
@@ -396,8 +396,6 @@
OutputStreamWriter writer = new OutputStreamWriter(outputStream);
new DOMWriter(writer).setPrettyprint(true).print(document.getDocumentElement());
- outputStream.flush();
- outputStream.close();
}
catch (RuntimeException rte)
{
Added: trunk/jbossws-core/src/java/org/jboss/ws/core/server/ServiceEndpointRegistry.java
===================================================================
--- trunk/jbossws-core/src/java/org/jboss/ws/core/server/ServiceEndpointRegistry.java (rev 0)
+++ trunk/jbossws-core/src/java/org/jboss/ws/core/server/ServiceEndpointRegistry.java 2007-05-04 13:48:53 UTC (rev 2960)
@@ -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.core.server;
+
+// $Id$
+
+import java.util.ArrayList;
+
+import javax.management.MBeanServer;
+import javax.management.MBeanServerFactory;
+
+import org.jboss.logging.Logger;
+import org.jboss.ws.integration.management.EndpointRegistryImpl;
+import org.jboss.ws.metadata.umdm.UnifiedMetaData;
+
+/**
+ * A Service Endpoint Registry
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 04-May-2007
+ */
+public class ServiceEndpointRegistry extends EndpointRegistryImpl implements ServiceEndpointRegistryMBean
+{
+ // provide logging
+ private static final Logger log = Logger.getLogger(ServiceEndpointRegistry.class);
+
+ public String getImplementationVersion()
+ {
+ return UnifiedMetaData.getImplementationVersion();
+ }
+
+ public void create() throws Exception
+ {
+ log.info(UnifiedMetaData.getImplementationVersion());
+ MBeanServer server = getMBeanServer();
+ if (server != null)
+ {
+ server.registerMBean(this, OBJECT_NAME);
+ }
+ }
+
+ public void destroy() throws Exception
+ {
+ log.debug("Destroy service endpoint manager");
+ MBeanServer server = getMBeanServer();
+ if (server != null)
+ {
+ server.unregisterMBean(OBJECT_NAME);
+ }
+ }
+
+ private MBeanServer getMBeanServer()
+ {
+ MBeanServer server = null;
+ ArrayList servers = MBeanServerFactory.findMBeanServer(null);
+ if (servers.size() > 0)
+ {
+ server = (MBeanServer)servers.get(0);
+ }
+ return server;
+ }
+}
Property changes on: trunk/jbossws-core/src/java/org/jboss/ws/core/server/ServiceEndpointRegistry.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: trunk/jbossws-core/src/java/org/jboss/ws/core/server/ServiceEndpointRegistryMBean.java
===================================================================
--- trunk/jbossws-core/src/java/org/jboss/ws/core/server/ServiceEndpointRegistryMBean.java (rev 0)
+++ trunk/jbossws-core/src/java/org/jboss/ws/core/server/ServiceEndpointRegistryMBean.java 2007-05-04 13:48:53 UTC (rev 2960)
@@ -0,0 +1,38 @@
+/*
+ * 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.core.server;
+
+import javax.management.ObjectName;
+
+import org.jboss.ws.integration.ObjectNameFactory;
+
+/**
+ * MBean interface.
+ * @since 15-April-2004
+ */
+public interface ServiceEndpointRegistryMBean
+{
+ // default object name
+ static final ObjectName OBJECT_NAME = ObjectNameFactory.create("jboss.ws:service=ServiceEndpointRegistry");
+
+ String getImplementationVersion();
+}
Property changes on: trunk/jbossws-core/src/java/org/jboss/ws/core/server/ServiceEndpointRegistryMBean.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
17 years, 8 months
JBossWS SVN: r2959 - in trunk: integration-jboss40/src/java/org/jboss/ws/integration/jboss40 and 14 other directories.
by jbossws-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2007-05-04 08:20:09 -0400 (Fri, 04 May 2007)
New Revision: 2959
Added:
trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/InvocationHandlerEJB21.java
trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/WebAppGeneratorDeployer.java
trunk/integration-tomcat/src/java/org/jboss/ws/integration/tomcat/ServiceEndpointDeployer.java
trunk/jbossws-core/src/java/org/jboss/ws/core/deployment/
trunk/jbossws-core/src/java/org/jboss/ws/core/deployment/EagerInitializeDeployer.java
trunk/jbossws-core/src/java/org/jboss/ws/core/deployment/EndpointHandlerDeployer.java
trunk/jbossws-core/src/java/org/jboss/ws/core/deployment/EndpointLifecycleDeployer.java
trunk/jbossws-core/src/java/org/jboss/ws/core/deployment/EndpointNameDeployer.java
trunk/jbossws-core/src/java/org/jboss/ws/core/deployment/JAXRPCClientDeployment.java
trunk/jbossws-core/src/java/org/jboss/ws/core/deployment/JAXRPCDeployment.java
trunk/jbossws-core/src/java/org/jboss/ws/core/deployment/JAXWSDeployment.java
trunk/jbossws-core/src/java/org/jboss/ws/core/deployment/PublishContractDeployer.java
trunk/jbossws-core/src/java/org/jboss/ws/core/deployment/ServiceEndpointPublisher.java
trunk/jbossws-core/src/java/org/jboss/ws/core/deployment/UnifiedDeploymentInfo.java
trunk/jbossws-core/src/java/org/jboss/ws/core/deployment/UnifiedMetaDataAssociationDeployer.java
trunk/jbossws-core/src/java/org/jboss/ws/core/deployment/UnifiedMetaDataDeployer.java
trunk/jbossws-core/src/java/org/jboss/ws/core/deployment/WSDLFilePublisher.java
trunk/jbossws-core/src/java/org/jboss/ws/core/server/AbstractInvocationHandler.java
trunk/jbossws-core/src/java/org/jboss/ws/core/server/AbstractServiceEndpointServlet.java
trunk/jbossws-core/src/java/org/jboss/ws/core/server/InvocationHandlerJSE.java
trunk/jbossws-core/src/java/org/jboss/ws/core/server/LifecycleHandlerImpl.java
trunk/jbossws-core/src/java/org/jboss/ws/core/server/RequestHandlerImpl.java
trunk/jbossws-core/src/java/org/jboss/ws/core/server/ServiceEndpointServlet.java
trunk/jbossws-core/src/java/org/jboss/ws/core/server/legacy/JBossContextServlet.java
trunk/jbossws-core/src/java/org/jboss/ws/core/server/legacy/PortComponentLinkServlet.java
Removed:
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/AbstractInvocationHandler.java
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/AbstractServiceEndpointServlet.java
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/EagerInitializeDeployer.java
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/EndpointHandlerDeployer.java
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/EndpointLifecycleDeployer.java
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/EndpointNameDeployer.java
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/InvocationHandlerJSE.java
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/LifecycleHandlerImpl.java
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/PublishContractDeployer.java
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/RequestHandlerImpl.java
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/ServiceEndpointServlet.java
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/UnifiedMetaDataAssociationDeployer.java
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/UnifiedMetaDataDeployer.java
trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/AbstractInvocationHandler.java
trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/AbstractServiceEndpointServlet.java
trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/EagerInitializeDeployer.java
trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/EndpointHandlerDeployer.java
trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/EndpointLifecycleDeployer.java
trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/EndpointNameDeployer.java
trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/InvocationHandlerEJB21.java
trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/InvocationHandlerJSE.java
trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/JBossContextServlet.java
trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/LifecycleHandlerImpl.java
trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/PortComponentLinkServlet.java
trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/PublishContractDeployer.java
trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/RequestHandlerImpl.java
trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/ServiceEndpointServlet.java
trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/UnifiedMetaDataAssociationDeployer.java
trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/UnifiedMetaDataDeployer.java
trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/WebAppGeneratorDeployer.java
trunk/jbossws-core/src/java/org/jboss/ws/core/server/JAXWSDeployment.java
trunk/jbossws-core/src/java/org/jboss/ws/core/server/ServiceEndpointPublisher.java
trunk/jbossws-core/src/java/org/jboss/ws/core/server/UnifiedDeploymentInfo.java
trunk/jbossws-core/src/java/org/jboss/ws/core/server/WSDLFilePublisher.java
trunk/jbossws-core/src/java/org/jboss/ws/core/server/legacy/ServiceEndpointDeployer.java
trunk/jbossws-core/src/java/org/jboss/ws/core/server/legacy/ServiceEndpointInvokerJSE.java
trunk/jbossws-core/src/java/org/jboss/ws/metadata/builder/jaxrpc/JAXRPCClientDeployment.java
trunk/jbossws-core/src/java/org/jboss/ws/metadata/builder/jaxrpc/JAXRPCDeployment.java
Modified:
trunk/build/eclipse/jbossws.userlibraries
trunk/integration-jboss40/src/java/org/jboss/ws/integration/jboss40/ServiceRefMetaDataAdapter.java
trunk/integration-jboss40/src/java/org/jboss/ws/integration/jboss40/WebServiceClientDeployer.java
trunk/integration-jboss40/src/resources/jbossws.beans/META-INF/jboss-beans.xml
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/AbstractApplicationMetaDataAdapter.java
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/DeploymentInfoAdapter.java
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/InvocationHandlerEJB21.java
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/InvocationHandlerEJB3.java
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/ModifyWebMetaDataDeployer.java
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/ServiceEndpointGeneratorEJB21.java
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/ServiceEndpointGeneratorEJB3.java
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/UnifiedDeploymentInfoDeployer.java
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/WebAppDeployerDeployer.java
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/WebAppGeneratorDeployer.java
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/WebMetaDataAdapter.java
trunk/integration-jboss42/src/resources/jbossws.beans/META-INF/jboss-beans.xml
trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/ApplicationMetaDataAdaptor.java
trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/ApplicationMetaDataAdaptorEJB3.java
trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/DeploymentInfoAdapter.java
trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/InvocationHandlerEJB3.java
trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/ModifyWebMetaDataDeployer.java
trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/ServiceEndpointGeneratorEJB21.java
trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/ServiceEndpointGeneratorEJB3.java
trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/UnifiedDeploymentInfoDeployer.java
trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/WebAppDeployerDeployer.java
trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/WebMetaDataAdaptor.java
trunk/integration-jboss50/src/resources/jbossws.sar/META-INF/jbossws-beans.xml
trunk/integration-tomcat/src/java/org/jboss/ws/integration/tomcat/DeploymentInfoAdaptor.java
trunk/integration-tomcat/src/java/org/jboss/ws/integration/tomcat/TomcatServiceEndpointPublisher.java
trunk/integration-tomcat/src/java/org/jboss/ws/integration/tomcat/TomcatServiceEndpointServlet.java
trunk/integration-tomcat/src/java/org/jboss/ws/integration/tomcat/wspublish.java
trunk/jbossws-core/src/java/org/jboss/ws/core/server/ServiceEndpointGeneratorEJB.java
trunk/jbossws-core/src/java/org/jboss/ws/core/server/legacy/ServiceEndpointInfo.java
trunk/jbossws-core/src/java/org/jboss/ws/metadata/builder/MetaDataBuilder.java
trunk/jbossws-core/src/java/org/jboss/ws/metadata/builder/jaxrpc/JAXRPCServerMetaDataBuilder.java
trunk/jbossws-core/src/java/org/jboss/ws/metadata/builder/jaxws/JAXWSMetaDataBuilderEJB3.java
trunk/jbossws-core/src/java/org/jboss/ws/metadata/builder/jaxws/JAXWSMetaDataBuilderJSE.java
trunk/jbossws-core/src/java/org/jboss/ws/metadata/builder/jaxws/JAXWSProviderMetaDataBuilder.java
trunk/jbossws-core/src/java/org/jboss/ws/metadata/builder/jaxws/JAXWSServerMetaDataBuilder.java
trunk/jbossws-core/src/java/org/jboss/ws/metadata/builder/jaxws/JAXWSWebServiceMetaDataBuilder.java
trunk/jbossws-core/src/java/org/jboss/ws/tools/jaxws/impl/WSContractProviderImpl.java
Log:
Consolidate AS42, AS50 deployment
Modified: trunk/build/eclipse/jbossws.userlibraries
===================================================================
--- trunk/build/eclipse/jbossws.userlibraries 2007-05-04 10:28:42 UTC (rev 2958)
+++ trunk/build/eclipse/jbossws.userlibraries 2007-05-04 12:20:09 UTC (rev 2959)
@@ -19,19 +19,19 @@
<archive path="/home/tdiesler/svn/jbossas/branches/Branch_4_2/build/output/jboss-4.2.0.GA/server/default/deploy/jboss-aop-jdk50.deployer/jboss-aop-jdk50.jar"/>
</library>
<library name="jboss-5.0.x" systemlibrary="false">
-<archive path="/home/tdiesler/svn/jbossas/trunk/build/output/jboss-5.0.0.Beta2/lib/jboss-aop-jdk50.jar"/>
-<archive path="/home/tdiesler/svn/jbossas/trunk/build/output/jboss-5.0.0.Beta2/lib/jboss-deployers.jar"/>
-<archive path="/home/tdiesler/svn/jbossas/trunk/build/output/jboss-5.0.0.Beta2/lib/jboss-j2se.jar"/>
-<archive path="/home/tdiesler/svn/jbossas/trunk/build/output/jboss-5.0.0.Beta2/lib/jboss-security-spi.jar"/>
-<archive path="/home/tdiesler/svn/jbossas/trunk/build/output/jboss-5.0.0.Beta2/lib/jboss-system.jar"/>
-<archive path="/home/tdiesler/svn/jbossas/trunk/build/output/jboss-5.0.0.Beta2/lib/jboss-system-jmx.jar"/>
-<archive path="/home/tdiesler/svn/jbossas/trunk/build/output/jboss-5.0.0.Beta2/lib/jboss-vfs.jar"/>
-<archive path="/home/tdiesler/svn/jbossas/trunk/build/output/jboss-5.0.0.Beta2/lib/jbosssx.jar"/>
-<archive path="/home/tdiesler/svn/jbossas/trunk/build/output/jboss-5.0.0.Beta2/server/default/lib/jboss.jar" source="/home/tdiesler/svn/jbossas/trunk/server/src/main"/>
-<archive path="/home/tdiesler/svn/jbossas/trunk/build/output/jboss-5.0.0.Beta2/server/default/lib/jnpserver.jar"/>
-<archive path="/home/tdiesler/svn/jbossas/trunk/build/output/jboss-5.0.0.Beta2/server/default/deployers/jboss-aop-jboss5.deployer/jboss-aspect-library-jdk50.jar"/>
-<archive path="/home/tdiesler/svn/jbossas/trunk/build/output/jboss-5.0.0.Beta2/server/default/deployers/ejb3.deployer/jboss-annotations-ejb3.jar"/>
-<archive path="/home/tdiesler/svn/jbossas/trunk/build/output/jboss-5.0.0.Beta2/server/default/deployers/ejb3.deployer/jboss-ejb3.jar" source="/home/tdiesler/svn/jbossas/branches/Branch_4_2/ejb3/src/main"/>
-<archive path="/home/tdiesler/svn/jbossas/trunk/build/output/jboss-5.0.0.Beta2/server/default/deployers/ejb3.deployer/jboss-ejb3x.jar"/>
+<archive path="/home/tdiesler/svn/jbossas/trunk/build/output/jboss-5.0.0.Beta3/lib/jboss-aop-jdk50.jar"/>
+<archive path="/home/tdiesler/svn/jbossas/trunk/build/output/jboss-5.0.0.Beta3/lib/jboss-deployers.jar"/>
+<archive path="/home/tdiesler/svn/jbossas/trunk/build/output/jboss-5.0.0.Beta3/lib/jboss-j2se.jar"/>
+<archive path="/home/tdiesler/svn/jbossas/trunk/build/output/jboss-5.0.0.Beta3/lib/jboss-security-spi.jar"/>
+<archive path="/home/tdiesler/svn/jbossas/trunk/build/output/jboss-5.0.0.Beta3/lib/jboss-system.jar"/>
+<archive path="/home/tdiesler/svn/jbossas/trunk/build/output/jboss-5.0.0.Beta3/lib/jboss-system-jmx.jar"/>
+<archive path="/home/tdiesler/svn/jbossas/trunk/build/output/jboss-5.0.0.Beta3/lib/jboss-vfs.jar"/>
+<archive path="/home/tdiesler/svn/jbossas/trunk/build/output/jboss-5.0.0.Beta3/lib/jbosssx.jar"/>
+<archive path="/home/tdiesler/svn/jbossas/trunk/build/output/jboss-5.0.0.Beta3/server/default/lib/jboss.jar" source="/home/tdiesler/svn/jbossas/trunk/server/src/main"/>
+<archive path="/home/tdiesler/svn/jbossas/trunk/build/output/jboss-5.0.0.Beta3/server/default/lib/jnpserver.jar"/>
+<archive path="/home/tdiesler/svn/jbossas/trunk/build/output/jboss-5.0.0.Beta3/server/default/deployers/jboss-aop-jboss5.deployer/jboss-aspect-library-jdk50.jar"/>
+<archive path="/home/tdiesler/svn/jbossas/trunk/build/output/jboss-5.0.0.Beta3/server/default/deployers/ejb3.deployer/jboss-annotations-ejb3.jar"/>
+<archive path="/home/tdiesler/svn/jbossas/trunk/build/output/jboss-5.0.0.Beta3/server/default/deployers/ejb3.deployer/jboss-ejb3.jar" source="/home/tdiesler/svn/jbossas/branches/Branch_4_2/ejb3/src/main"/>
+<archive path="/home/tdiesler/svn/jbossas/trunk/build/output/jboss-5.0.0.Beta3/server/default/deployers/ejb3.deployer/jboss-ejb3x.jar"/>
</library>
</eclipse-userlibraries>
Modified: trunk/integration-jboss40/src/java/org/jboss/ws/integration/jboss40/ServiceRefMetaDataAdapter.java
===================================================================
--- trunk/integration-jboss40/src/java/org/jboss/ws/integration/jboss40/ServiceRefMetaDataAdapter.java 2007-05-04 10:28:42 UTC (rev 2958)
+++ trunk/integration-jboss40/src/java/org/jboss/ws/integration/jboss40/ServiceRefMetaDataAdapter.java 2007-05-04 12:20:09 UTC (rev 2959)
@@ -35,7 +35,7 @@
import org.jboss.webservice.metadata.serviceref.InitParamMetaData;
import org.jboss.webservice.metadata.serviceref.PortComponentRefMetaData;
import org.jboss.webservice.metadata.serviceref.ServiceRefMetaData;
-import org.jboss.ws.core.server.UnifiedDeploymentInfo;
+import org.jboss.ws.core.deployment.UnifiedDeploymentInfo;
import org.jboss.ws.metadata.j2ee.serviceref.UnifiedCallPropertyMetaData;
import org.jboss.ws.metadata.j2ee.serviceref.UnifiedHandlerMetaData;
import org.jboss.ws.metadata.j2ee.serviceref.UnifiedInitParamMetaData;
Modified: trunk/integration-jboss40/src/java/org/jboss/ws/integration/jboss40/WebServiceClientDeployer.java
===================================================================
--- trunk/integration-jboss40/src/java/org/jboss/ws/integration/jboss40/WebServiceClientDeployer.java 2007-05-04 10:28:42 UTC (rev 2958)
+++ trunk/integration-jboss40/src/java/org/jboss/ws/integration/jboss40/WebServiceClientDeployer.java 2007-05-04 12:20:09 UTC (rev 2959)
@@ -32,12 +32,12 @@
import org.jboss.system.ServiceMBeanSupport;
import org.jboss.util.naming.Util;
import org.jboss.webservice.metadata.serviceref.ServiceRefMetaData;
+import org.jboss.ws.core.deployment.JAXRPCClientDeployment;
+import org.jboss.ws.core.deployment.UnifiedDeploymentInfo;
import org.jboss.ws.core.jaxrpc.client.ServiceReferenceable;
-import org.jboss.ws.core.server.UnifiedDeploymentInfo;
import org.jboss.ws.integration.URLLoaderAdapter;
import org.jboss.ws.integration.deployment.Deployment.DeploymentType;
import org.jboss.ws.integration.jboss42.jbossws.DeploymentInfoAdapterFactory;
-import org.jboss.ws.metadata.builder.jaxrpc.JAXRPCClientDeployment;
import org.jboss.ws.metadata.j2ee.serviceref.UnifiedServiceRefMetaData;
/**
Modified: trunk/integration-jboss40/src/resources/jbossws.beans/META-INF/jboss-beans.xml
===================================================================
--- trunk/integration-jboss40/src/resources/jbossws.beans/META-INF/jboss-beans.xml 2007-05-04 10:28:42 UTC (rev 2958)
+++ trunk/integration-jboss40/src/resources/jbossws.beans/META-INF/jboss-beans.xml 2007-05-04 12:20:09 UTC (rev 2959)
@@ -1,26 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
-<deployment xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="urn:jboss:bean-deployer bean-deployer_1_0.xsd"
- xmlns="urn:jboss:bean-deployer">
+<?xml version="1.0" encoding="UTF-8"?>
+
+<deployment xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:jboss:bean-deployer bean-deployer_1_0.xsd" xmlns="urn:jboss:bean-deployer">
- <bean name="KernelLocator" class="org.jboss.ws.integration.KernelLocator">
- <property name="kernel"><inject bean="jboss.kernel:service=Kernel"/></property>
- </bean>
-
- <bean name="ServiceEndpointManager" class="org.jboss.ws.core.server.ServiceEndpointManager">
-
+ <!-- An abstraction of server configuration aspects. -->
+ <bean name="WSServerConfig" class="org.jboss.ws.integration.management.ServerConfigImpl">
<!--
- The WSDL, that is a required deployment artifact for an endpoint, has a <soap:address>
- element which points to the location of the endpoint. JBoss supports rewriting of that SOAP address.
-
- If the content of <soap:address> is a valid URL, JBossWS will not rewrite it unless 'alwaysModifySOAPAddress' is true.
- If the content of <soap:address> is not a valid URL, JBossWS will rewrite it using the attribute values given below.
+ The WSDL, that is a required deployment artifact for an endpoint, has a <soap:address>
+ element which points to the location of the endpoint. JBoss supports rewriting of that SOAP address.
- If next line (webServiceHost) is commented, JBossWS uses requesters protocolo, host and port when rewriting the <soap:address>.
+ If the content of <soap:address> is a valid URL, JBossWS will not rewrite it unless 'modifySOAPAddress' is true.
+ If the content of <soap:address> is not a valid URL, JBossWS will rewrite it using the attribute values given below.
+
+ If 'webServiceHost' is not set, JBossWS uses requesters protocol host and port when rewriting the <soap:address>.
-->
<property name="webServiceHost">${jboss.bind.address}</property>
- <property name="alwaysModifySOAPAddress">true</property>
+ <property name="modifySOAPAddress">true</property>
<!--
Set these properties to explicitly define the ports that will be used for rewriting the SOAP address.
@@ -29,38 +25,186 @@
<property name="webServiceSecurePort">8443</property>
<property name="webServicePort">8080</property>
-->
-
- <property name="serviceEndpointInvokerJSE">org.jboss.ws.core.server.ServiceEndpointInvokerJSE</property>
- <property name="serviceEndpointInvokerEJB3">org.jboss.ws.integration.jboss42.ServiceEndpointInvokerEJB3</property>
- <property name="serviceEndpointInvokerEJB21">org.jboss.ws.integration.jboss42.ServiceEndpointInvokerEJB21</property>
- <property name="serviceEndpointInvokerMDB">org.jboss.ws.integration.jboss42.ServiceEndpointInvokerMDB</property>
</bean>
+
+ <!-- The registry for web service endpoints -->
+ <bean name="WSEndpointRegistry" class="org.jboss.ws.integration.management.EndpointRegistryImpl"/>
- <bean name="ServiceEndpointDeployer" class="org.jboss.ws.core.server.ServiceEndpointDeployer">
- <property name="serviceEndpointManager">
- <inject bean="ServiceEndpointManager"/>
- </property>
- </bean>
+ <!-- A subscription manager for WS-Eventing -->
+ <bean name="WSSubscriptionManager" class="org.jboss.ws.extensions.eventing.mgmt.SubscriptionManager"/>
- <bean name="ServiceEndpointPublisher" class="org.jboss.ws.integration.jboss42.ServiceEndpointPublisher">
- <property name="serviceEndpointServlet">org.jboss.ws.integration.jboss42.JBossServiceEndpointServlet</property>
+ <!-- Bind Service objects in client environment context -->
+ <!-- The bean name is compiled into the server. Changeit with the next release. -->
+ <bean name="ServiceRefHandler" class="org.jboss.ws.core.client.ServiceRefHandlerImpl"/>
+
+ <!-- Locate the single instance of the kernel -->
+ <bean name="WSKernelLocator" class="org.jboss.ws.integration.KernelLocator">
+ <property name="kernel"><inject bean="jboss.kernel:service=Kernel"/></property>
</bean>
- <!-- A subscription manager for WS-Eventing -->
- <bean name="SubscriptionManager" class="org.jboss.ws.extensions.eventing.mgmt.SubscriptionManager"/>
+ <!--
+ *********************************************************************************************************************
+ Web Service deployment
+
+ There are three deployer interceptors registered with the JBoss Deployers.
+
+ 1) DeployerInterceptorJSE
+ 2) DeployerInterceptorEJB21
+ 3) DeployerInterceptorEJB3
+
+ Each interceptor has a number of DeployerHooks registerd with it
+
+ Conceptually, each of these hooks implements the following pattern:
+
+ DployerHook.deploy(unit)
+ if(isWebServiceDeployment)
+ Deployment dep = createDeployment(unit)
+ DeployerManager.deploy(dep)
+
+ DeployerHook.undeploy(unit)
+ Deployment dep = getDeployment(unit)
+ DeployerManager.undeploy(dep)
+
+ Each deployer hook has a web service DeployerManager injected into it.
+ A web service DeployerManager maintains a list of Deployers, each of which
+ handles a single aspect of web service deployment.
+
+ Finally, each Endpoint is registered with the EndpointRegistry.
+
+ *********************************************************************************************************************
+ -->
- <bean name="ServerConfig" class="org.jboss.ws.integration.jboss42.ServerConfigImpl"/>
+ <!--
+ Each DeploymentManger maintains a list of Deployers
+ Each Deployer handles a single aspect of web service deployment.
+ -->
+ <bean name="WSDeployerManagerJSE" class="org.jboss.ws.integration.deployment.DeployerManagerImpl">
+ <property name="deployers">
+ <list class="java.util.LinkedList" elementClass="org.jboss.ws.integration.deployment.Deployer">
+ <inject bean="WSUnifiedDeploymentInfoDeployer"/>
+ <inject bean="WSUnifiedMetaDataDeployer"/>
+ <inject bean="WSUnifiedMetaDataAssociationDeployer"/>
+ <inject bean="WSModifyWebMetaDataDeployer"/>
+ </list>
+ </property>
+ </bean>
+ <bean name="WSDeployerManagerEJB" class="org.jboss.ws.integration.deployment.DeployerManagerImpl">
+ <property name="deployers">
+ <list class="java.util.LinkedList" elementClass="org.jboss.ws.integration.deployment.Deployer">
+ <inject bean="WSUnifiedDeploymentInfoDeployer"/>
+ <inject bean="WSUnifiedMetaDataDeployer"/>
+ <inject bean="WSUnifiedMetaDataAssociationDeployer"/>
+ <inject bean="WSWebAppGeneratorDeployer"/>
+ <inject bean="WSWebAppDeployerDeployer"/>
+ </list>
+ </property>
+ </bean>
+ <bean name="WSMainDeployerManager" class="org.jboss.ws.integration.deployment.DeployerManagerImpl">
+ <property name="deployers">
+ <list class="java.util.LinkedList" elementClass="org.jboss.ws.integration.deployment.Deployer">
+ <inject bean="WSEndpointNameDeployer"/>
+ <inject bean="WSEndpointHandlerDeployer"/>
+ <inject bean="WSPublishContractDeployer"/>
+ <inject bean="WSClassLoaderInjectionDeployer"/>
+ <inject bean="WSEagerInitializeDeployer"/>
+ <inject bean="WSEndpointRegistryDeployer"/>
+ <inject bean="WSEndpointLifecycleDeployer"/>
+ </list>
+ </property>
+ </bean>
- <bean name="DeploymentInfoAdapter" class="org.jboss.ws.integration.jboss42.DeploymentInfoAdapter">
- <property name="applicationMetaDataAdapter">
- <inject bean="ApplicationMetaDataAdapter"/>
+ <!--
+ The Deployers
+ Each handles a single aspect of web service deployment
+ -->
+ <bean name="WSClassLoaderInjectionDeployer" class="org.jboss.ws.integration.jboss42.jbossws.ClassLoaderInjectionDeployer"/>
+ <bean name="WSEagerInitializeDeployer" class="org.jboss.ws.core.deployment.EagerInitializeDeployer"/>
+ <bean name="WSEndpointHandlerDeployer" class="org.jboss.ws.core.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>
+ </map>
</property>
- <property name="webMetaDataAdapter">
- <inject bean="WebMetaDataAdapter"/>
+ </bean>
+ <bean name="WSEndpointLifecycleDeployer" class="org.jboss.ws.core.deployment.EndpointLifecycleDeployer"/>
+ <bean name="WSEndpointNameDeployer" class="org.jboss.ws.core.deployment.EndpointNameDeployer"/>
+ <bean name="WSEndpointRegistryDeployer" class="org.jboss.ws.integration.deployment.EndpointRegistryDeployer"/>
+ <bean name="WSEndpointValidationDeployer" class="org.jboss.ws.integration.deployment.EndpointValidationDeployer"/>
+ <bean name="WSModifyWebMetaDataDeployer" class="org.jboss.ws.integration.jboss42.jbossws.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">
+ <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">
+ <property name="serviceEndpointPublisher"><inject bean="WSServiceEndpointPublisher"/></property>
+ </bean>
+
+ <!-- Deployer helper beans -->
+ <bean name="WSServiceEndpointPublisher" class="org.jboss.ws.core.deployment.ServiceEndpointPublisher">
+ <property name="servletClass">org.jboss.ws.core.server.ServiceEndpointServlet</property>
+ </bean>
+ <bean name="WSDeploymentInfoAdapter" class="org.jboss.ws.integration.jboss42.jbossws.DeploymentInfoAdapter">
+ <property name="appMetaDataAdapter"><inject bean="WSAppMetaDataAdapter"/></property>
+ <property name="webMetaDataAdapter"><inject bean="WSWebMetaDataAdapter"/></property>
+ </bean>
+ <bean name="WSAppMetaDataAdapter" class="org.jboss.ws.integration.jboss40.jbossws.ApplicationMetaDataAdapter"/>
+ <bean name="WSServiceRefMetaDataAdapter" class="org.jboss.ws.integration.jboss40.ServiceRefMetaDataAdapter"/>
+ <bean name="WSWebMetaDataAdapter" class="org.jboss.ws.integration.jboss40.jbossws.WebMetaDataAdapter"/>
+
+ <!--
+ Register DeployerHooks with JBoss deployers
+ -->
+ <bean name="WSDeployerHook_JAXRPC_JSE" class="org.jboss.ws.integration.jboss42.jbossws.JAXRPCDeployerHookJSE">
+ <property name="deployerManager"><inject bean="WSDeployerManagerJSE"/></property>
+ <property name="phaseOneInterceptors">
+ <list class="java.util.LinkedList" elementClass="javax.management.ObjectName">
+ <value>jboss.ws:service=DeployerInterceptorJSE</value>
+ </list>
</property>
</bean>
- <bean name="ServiceRefMetaDataAdapter" class="org.jboss.ws.integration.jboss40.ServiceRefMetaDataAdapter"/>
- <bean name="ApplicationMetaDataAdapter" class="org.jboss.ws.integration.jboss40.ApplicationMetaDataAdapter"/>
- <bean name="WebMetaDataAdapter" class="org.jboss.ws.integration.jboss42.WebMetaDataAdapter"/>
+ <bean name="WSDeployerHook_JAXRPC_EJB21" class="org.jboss.ws.integration.jboss42.jbossws.JAXRPCDeployerHookEJB21">
+ <property name="deployerManager"><inject bean="WSDeployerManagerEJB"/></property>
+ <property name="phaseOneInterceptors">
+ <list class="java.util.LinkedList" elementClass="javax.management.ObjectName">
+ <value>jboss.ws:service=DeployerInterceptorEJB21</value>
+ </list>
+ </property>
+ </bean>
+ <bean name="WSDeployerHook_JAXWS_JSE" class="org.jboss.ws.integration.jboss42.jbossws.JAXWSDeployerHookJSE">
+ <property name="deployerManager"><inject bean="WSDeployerManagerJSE"/></property>
+ <property name="phaseOneInterceptors">
+ <list class="java.util.LinkedList" elementClass="javax.management.ObjectName">
+ <value>jboss.ws:service=DeployerInterceptorJSE</value>
+ </list>
+ </property>
+ </bean>
+ <bean name="WSDeployerHook_JAXWS_EJB3" class="org.jboss.ws.integration.jboss42.jbossws.JAXWSDeployerHookEJB3">
+ <property name="deployerManager"><inject bean="WSDeployerManagerEJB"/></property>
+ <property name="phaseOneInterceptors">
+ <list class="java.util.LinkedList" elementClass="javax.management.ObjectName">
+ <value>jboss.ws:service=DeployerInterceptorEJB3</value>
+ </list>
+ </property>
+ </bean>
+ <bean name="WSMainDeployerHook" class="org.jboss.ws.integration.jboss42.jbossws.MainDeployerHook">
+ <property name="deployerManager"><inject bean="WSMainDeployerManager"/></property>
+ <property name="phaseTwoInterceptors">
+ <list class="java.util.LinkedList" elementClass="javax.management.ObjectName">
+ <value>jboss.ws:service=DeployerInterceptorJSE</value>
+ <value>jboss.ws:service=DeployerInterceptorEJB21</value>
+ <value>jboss.ws:service=DeployerInterceptorEJB3</value>
+ </list>
+ </property>
+ </bean>
-</deployment>
+</deployment>
\ No newline at end of file
Modified: trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/AbstractApplicationMetaDataAdapter.java
===================================================================
--- trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/AbstractApplicationMetaDataAdapter.java 2007-05-04 10:28:42 UTC (rev 2958)
+++ trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/AbstractApplicationMetaDataAdapter.java 2007-05-04 12:20:09 UTC (rev 2959)
@@ -29,7 +29,7 @@
import org.jboss.metadata.ApplicationMetaData;
import org.jboss.metadata.BeanMetaData;
-import org.jboss.ws.core.server.UnifiedDeploymentInfo;
+import org.jboss.ws.core.deployment.UnifiedDeploymentInfo;
import org.jboss.ws.metadata.j2ee.UnifiedApplicationMetaData;
import org.jboss.ws.metadata.j2ee.UnifiedBeanMetaData;
import org.jboss.ws.metadata.j2ee.UnifiedApplicationMetaData.PublishLocationAdapter;
Deleted: trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/AbstractInvocationHandler.java
===================================================================
--- trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/AbstractInvocationHandler.java 2007-05-04 10:28:42 UTC (rev 2958)
+++ trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/AbstractInvocationHandler.java 2007-05-04 12:20:09 UTC (rev 2959)
@@ -1,431 +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.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.lang.reflect.UndeclaredThrowableException;
-import java.util.HashMap;
-
-import javax.activation.DataHandler;
-import javax.management.MBeanException;
-import javax.xml.namespace.QName;
-import javax.xml.rpc.soap.SOAPFaultException;
-import javax.xml.soap.Name;
-import javax.xml.soap.SOAPBody;
-import javax.xml.soap.SOAPBodyElement;
-import javax.xml.soap.SOAPException;
-import javax.xml.soap.SOAPHeader;
-import javax.xml.ws.http.HTTPBinding;
-
-import org.jboss.logging.Logger;
-import org.jboss.ws.Constants;
-import org.jboss.ws.core.CommonBinding;
-import org.jboss.ws.core.CommonBindingProvider;
-import org.jboss.ws.core.CommonMessageContext;
-import org.jboss.ws.core.CommonSOAPBinding;
-import org.jboss.ws.core.DirectionHolder;
-import org.jboss.ws.core.EndpointInvocation;
-import org.jboss.ws.core.MessageAbstraction;
-import org.jboss.ws.core.DirectionHolder.Direction;
-import org.jboss.ws.core.jaxrpc.handler.HandlerDelegateJAXRPC;
-import org.jboss.ws.core.jaxrpc.handler.MessageContextJAXRPC;
-import org.jboss.ws.core.jaxws.binding.BindingProviderImpl;
-import org.jboss.ws.core.jaxws.handler.HandlerDelegateJAXWS;
-import org.jboss.ws.core.jaxws.handler.MessageContextJAXWS;
-import org.jboss.ws.core.server.ServerHandlerDelegate;
-import org.jboss.ws.core.soap.MessageContextAssociation;
-import org.jboss.ws.core.soap.SOAPMessageImpl;
-import org.jboss.ws.core.utils.JavaUtils;
-import org.jboss.ws.extensions.xop.XOPContext;
-import org.jboss.ws.integration.Endpoint;
-import org.jboss.ws.integration.invocation.InvocationContext;
-import org.jboss.ws.integration.invocation.InvocationHandler;
-import org.jboss.ws.metadata.umdm.EndpointMetaData;
-import org.jboss.ws.metadata.umdm.OperationMetaData;
-import org.jboss.ws.metadata.umdm.ServerEndpointMetaData;
-import org.jboss.ws.metadata.umdm.HandlerMetaData.HandlerType;
-
-/** An implementation handles invocations on the endpoint
- *
- * @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 Endpoint endpoint;
- protected CommonBindingProvider bindingProvider;
- protected ServerHandlerDelegate delegate;
-
- /** Initialize the service endpoint */
- public void init(Endpoint endpoint)
- {
- this.endpoint = endpoint;
-
- ServerEndpointMetaData sepMetaData = endpoint.getMetaData(ServerEndpointMetaData.class);
- if (sepMetaData == null)
- throw new IllegalStateException("Cannot obtain endpoint meta data");
-
- if (sepMetaData.getType() == EndpointMetaData.Type.JAXRPC)
- {
- bindingProvider = new CommonBindingProvider(sepMetaData);
- delegate = new HandlerDelegateJAXRPC(sepMetaData);
- }
- else
- {
- bindingProvider = new BindingProviderImpl(sepMetaData);
- delegate = new HandlerDelegateJAXWS(sepMetaData);
- }
- }
-
- /** Load the SEI implementation bean if necessary */
- protected abstract Class loadServiceEndpoint() throws ClassNotFoundException;
-
- /** Create the instance of the SEI implementation bean if necessary */
- protected abstract Object createServiceEndpointInstance(Class seiImplClass, InvocationContext context) throws Exception;
-
- /** Invoke the instance of the SEI implementation bean */
- protected abstract void invokeServiceEndpointInstance(Object seiImpl, EndpointInvocation epInv) throws Exception;
-
- /** Destroy the instance of the SEI implementation bean if necessary */
- protected abstract void destroyServiceEndpointInstance(Object seiImpl);
-
- public boolean callRequestHandlerChain(ServerEndpointMetaData sepMetaData, HandlerType type)
- {
- return delegate.callRequestHandlerChain(sepMetaData, type);
- }
-
- public boolean callResponseHandlerChain(ServerEndpointMetaData sepMetaData, HandlerType type)
- {
- return delegate.callResponseHandlerChain(sepMetaData, type);
- }
-
- public void closeHandlerChain(ServerEndpointMetaData sepMetaData, HandlerType type)
- {
- delegate.closeHandlerChain(sepMetaData, type);
- }
-
- public boolean callFaultHandlerChain(ServerEndpointMetaData sepMetaData, HandlerType type, Exception ex)
- {
- return delegate.callFaultHandlerChain(sepMetaData, type, ex);
- }
-
- /** Invoke the the service endpoint */
- public void invoke(InvocationContext reqContext) throws Exception
- {
- CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
- ServerEndpointMetaData sepMetaData = (ServerEndpointMetaData)msgContext.getEndpointMetaData();
- MessageAbstraction reqMessage = msgContext.getMessageAbstraction();
-
- // Load the endpoint implementation bean
- Class seImpl = loadServiceEndpoint();
-
- // Create an instance of the endpoint implementation bean
- Object seInstance = createServiceEndpointInstance(seImpl, reqContext);
-
- // The direction of the message
- DirectionHolder direction = new DirectionHolder(Direction.InBound);
-
- // Get the order of pre/post handlerchains
- HandlerType[] handlerType = delegate.getHandlerTypeOrder();
- HandlerType[] faultType = delegate.getHandlerTypeOrder();
-
- // Set the required inbound context properties
- setInboundContextProperties();
-
- try
- {
- boolean oneway = false;
- EndpointInvocation epInv = null;
- OperationMetaData opMetaData = null;
- CommonBinding binding = bindingProvider.getCommonBinding();
- binding.setHeaderSource(delegate);
-
- // call the request handler chain
- boolean handlersPass = callRequestHandlerChain(sepMetaData, handlerType[0]);
-
- // Unbind the request message
- if (handlersPass)
- {
- // Get the operation meta data from the SOAP message
- opMetaData = getDispatchDestination(sepMetaData, reqMessage);
- msgContext.setOperationMetaData(opMetaData);
- oneway = opMetaData.isOneWay();
-
- /*
- * From JAX-WS 10.2.1 - "7. If the node does not understand how to process
- * the message, then neither handlers nor the endpoint
- * are invoked and instead the binding generates a SOAP must
- * understand exception"
- *
- * Therefore, this must precede the ENDPOINT chain; however, The PRE
- * chain still must happen first since the message may be encrypted, in which
- * case the operation is still not known. Without knowing the operation, it
- * is not possible to determine what headers are understood by the endpoint.
- */
- if (binding instanceof CommonSOAPBinding)
- ((CommonSOAPBinding)binding).checkMustUnderstand(opMetaData);
-
- // Unbind the request message
- epInv = binding.unbindRequestMessage(opMetaData, reqMessage);
- }
-
- handlersPass = handlersPass && callRequestHandlerChain(sepMetaData, handlerType[1]);
- handlersPass = handlersPass && callRequestHandlerChain(sepMetaData, handlerType[2]);
-
- if (handlersPass)
- {
- msgContext.put(CommonMessageContext.ALLOW_EXPAND_TO_DOM, Boolean.TRUE);
- try
- {
- // Check if protocol handlers modified the payload
- if (msgContext.isModified())
- {
- log.debug("Handler modified payload, unbind message again");
- reqMessage = msgContext.getMessageAbstraction();
- epInv = binding.unbindRequestMessage(opMetaData, reqMessage);
- }
-
- // Invoke the service endpoint
- invokeServiceEndpointInstance(seInstance, epInv);
- }
- finally
- {
- msgContext.remove(CommonMessageContext.ALLOW_EXPAND_TO_DOM);
- }
-
- // Reverse the message direction
- msgContext = processPivotInternal(msgContext, direction);
-
- // Set the required outbound context properties
- setOutboundContextProperties();
-
- if (binding instanceof CommonSOAPBinding)
- XOPContext.setMTOMEnabled(((CommonSOAPBinding)binding).isMTOMEnabled());
-
- // Bind the response message
- MessageAbstraction resMessage = binding.bindResponseMessage(opMetaData, epInv);
- msgContext.setMessageAbstraction(resMessage);
- }
- else
- {
- // Reverse the message direction without calling the endpoint
- MessageAbstraction resMessage = msgContext.getMessageAbstraction();
- msgContext = processPivotInternal(msgContext, direction);
- msgContext.setMessageAbstraction(resMessage);
- }
-
- if (oneway == false)
- {
- // call the response handler chain, removing the fault type entry will not call handleFault for that chain
- handlersPass = callResponseHandlerChain(sepMetaData, handlerType[2]);
- faultType[2] = null;
- handlersPass = handlersPass && callResponseHandlerChain(sepMetaData, handlerType[1]);
- faultType[1] = null;
- handlersPass = handlersPass && callResponseHandlerChain(sepMetaData, handlerType[0]);
- faultType[0] = null;
- }
- }
- catch (RuntimeException ex)
- {
- // Reverse the message direction
- processPivotInternal(msgContext, direction);
-
- try
- {
- CommonBinding binding = bindingProvider.getCommonBinding();
- binding.bindFaultMessage(ex);
-
- // call the fault handler chain
- boolean handlersPass = true;
- if (faultType[2] != null)
- handlersPass = handlersPass && callFaultHandlerChain(sepMetaData, faultType[2], ex);
- if (faultType[1] != null)
- handlersPass = handlersPass && callFaultHandlerChain(sepMetaData, faultType[1], ex);
- if (faultType[0] != null)
- handlersPass = handlersPass && callFaultHandlerChain(sepMetaData, faultType[0], ex);
- }
- catch (RuntimeException subEx)
- {
- log.warn("Exception while processing handleFault: ", ex);
- ex = subEx;
- }
- throw ex;
- }
- finally
- {
- closeHandlerChain(sepMetaData, handlerType[2]);
- closeHandlerChain(sepMetaData, handlerType[1]);
- closeHandlerChain(sepMetaData, handlerType[0]);
-
- destroyServiceEndpointInstance(seInstance);
- }
- }
-
- protected void setInboundContextProperties()
- {
- CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
- if (msgContext instanceof MessageContextJAXWS)
- {
- // Map of attachments to a message for the outbound message, key is the MIME Content-ID, value is a DataHandler
- msgContext.put(MessageContextJAXWS.INBOUND_MESSAGE_ATTACHMENTS, new HashMap<String, DataHandler>());
- }
- }
-
- protected void setOutboundContextProperties()
- {
- CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
- if (msgContext instanceof MessageContextJAXWS)
- {
- // Map of attachments to a message for the outbound message, key is the MIME Content-ID, value is a DataHandler
- msgContext.put(MessageContextJAXWS.OUTBOUND_MESSAGE_ATTACHMENTS, new HashMap<String, DataHandler>());
- }
- }
-
- private CommonMessageContext processPivotInternal(CommonMessageContext msgContext, DirectionHolder direction)
- {
- if (direction.getDirection() == Direction.InBound)
- {
- EndpointMetaData epMetaData = msgContext.getEndpointMetaData();
- if (epMetaData.getType() == EndpointMetaData.Type.JAXRPC)
- {
- msgContext = MessageContextJAXRPC.processPivot(msgContext);
- }
- else
- {
- msgContext = MessageContextJAXWS.processPivot(msgContext);
- }
- direction.setDirection(Direction.OutBound);
- }
- return msgContext;
- }
-
- private OperationMetaData getDispatchDestination(EndpointMetaData epMetaData, MessageAbstraction reqMessage) throws SOAPException
- {
- OperationMetaData opMetaData;
-
- String bindingID = epMetaData.getBindingId();
- if (HTTPBinding.HTTP_BINDING.equals(bindingID))
- {
- if (epMetaData.getOperations().size() != 1)
- throw new IllegalStateException("Multiple operations not supported for HTTP binding");
-
- opMetaData = epMetaData.getOperations().get(0);
- }
- else
- {
- SOAPMessageImpl soapMessage = (SOAPMessageImpl)reqMessage;
-
- opMetaData = soapMessage.getOperationMetaData(epMetaData);
- SOAPHeader soapHeader = soapMessage.getSOAPHeader();
-
- // Report a MustUnderstand fault
- if (opMetaData == null)
- {
- String faultString;
- SOAPBody soapBody = soapMessage.getSOAPBody();
- if (soapBody.getChildElements().hasNext())
- {
- SOAPBodyElement soapBodyElement = (SOAPBodyElement)soapBody.getChildElements().next();
- Name soapName = soapBodyElement.getElementName();
- faultString = "Endpoint " + epMetaData.getPortName() + " does not contain operation meta data for: " + soapName;
- }
- else
- {
- faultString = "Endpoint " + epMetaData.getPortName() + " does not contain operation meta data for empty soap body";
- }
-
- // R2724 If an INSTANCE receives a message that is inconsistent with its WSDL description, it SHOULD generate a soap:Fault
- // with a faultcode of "Client", unless a "MustUnderstand" or "VersionMismatch" fault is generated.
- if (soapHeader != null && soapHeader.examineMustUnderstandHeaderElements(Constants.URI_SOAP11_NEXT_ACTOR).hasNext())
- {
- QName faultCode = Constants.SOAP11_FAULT_CODE_MUST_UNDERSTAND;
- throw new SOAPFaultException(faultCode, faultString, null, null);
- }
- else
- {
- QName faultCode = Constants.SOAP11_FAULT_CODE_CLIENT;
- throw new SOAPFaultException(faultCode, faultString, null, null);
- }
- }
- }
- return opMetaData;
- }
-
- 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;
- }
-
- /** handle invocation exceptions */
- public 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);
- }
- }
-}
Deleted: trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/AbstractServiceEndpointServlet.java
===================================================================
--- trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/AbstractServiceEndpointServlet.java 2007-05-04 10:28:42 UTC (rev 2958)
+++ trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/AbstractServiceEndpointServlet.java 2007-05-04 12:20:09 UTC (rev 2959)
@@ -1,178 +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.io.Writer;
-
-import javax.management.ObjectName;
-import javax.servlet.ServletConfig;
-import javax.servlet.ServletException;
-import javax.servlet.ServletInputStream;
-import javax.servlet.ServletOutputStream;
-import javax.servlet.http.HttpServlet;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import javax.xml.rpc.JAXRPCException;
-
-import org.jboss.logging.Logger;
-import org.jboss.ws.WSException;
-import org.jboss.ws.core.server.ServletRequestContext;
-import org.jboss.ws.integration.Endpoint;
-import org.jboss.ws.integration.ObjectNameFactory;
-import org.jboss.ws.integration.RequestHandler;
-import org.jboss.ws.integration.management.EndpointRegistry;
-import org.jboss.ws.integration.management.EndpointRegistryFactory;
-
-/**
- * A servlet that is installed for every web service endpoint.
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 25-Apr-2007
- */
-public abstract class AbstractServiceEndpointServlet extends HttpServlet
-{
- // provide logging
- private static final Logger log = Logger.getLogger(AbstractServiceEndpointServlet.class);
-
- protected Endpoint endpoint;
- protected EndpointRegistry epRegistry;
-
- public void init(ServletConfig config) throws ServletException
- {
- super.init(config);
- epRegistry = EndpointRegistryFactory.getEndpointRegistry();
- }
-
- public void destroy()
- {
- super.destroy();
- }
-
- public void service(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException
- {
- if (endpoint == null)
- {
- String contextPath = req.getContextPath();
- initServiceEndpoint(contextPath);
- }
- super.service(req, res);
- }
-
- public void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException
- {
- // Process a WSDL request
- if (req.getParameter("wsdl") != null || req.getParameter("WSDL") != null)
- {
- res.setContentType("text/xml");
- try
- {
- RequestHandler requestHandler = endpoint.getRequestHandler();
- ServletRequestContext context = new ServletRequestContext(getServletContext(), req, res);
- requestHandler.handleWSDLRequest(endpoint, res.getOutputStream(), context);
- }
- catch (Exception ex)
- {
- handleException(ex);
- }
- }
- else
- {
- res.setStatus(405);
- res.setContentType("text/plain");
- Writer out = res.getWriter();
- out.write("HTTP GET not supported");
- out.flush();
- out.close();
- }
- }
-
- public void doPost(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException
- {
- log.debug("doPost: " + req.getRequestURI());
-
- ServletInputStream inputStream = req.getInputStream();
- ServletOutputStream outputStream = res.getOutputStream();
- try
- {
- RequestHandler requestHandler = endpoint.getRequestHandler();
- ServletRequestContext context = new ServletRequestContext(getServletContext(), req, res);
- requestHandler.handleRequest(endpoint, inputStream, outputStream, context);
- }
- catch (Exception ex)
- {
- handleException(ex);
- }
- finally
- {
- try
- {
- outputStream.flush();
- outputStream.close();
- }
- catch (IOException ioex)
- {
- log.error("Cannot flush output stream");
- }
-
- }
- }
-
- private void handleException(Exception ex) throws ServletException
- {
- log.error("Error processing web service request", ex);
-
- if (ex instanceof JAXRPCException)
- throw (JAXRPCException)ex;
-
- throw new ServletException(ex);
- }
-
- /** Initialize the service endpoint
- */
- protected void initServiceEndpoint(String contextPath)
- {
- String servletName = getServletName();
- if (contextPath.startsWith("/"))
- contextPath = contextPath.substring(1);
-
- for (ObjectName sepId : epRegistry.getEndpoints())
- {
- String propContext = sepId.getKeyProperty(Endpoint.SEPID_PROPERTY_CONTEXT);
- String propEndpoint = sepId.getKeyProperty(Endpoint.SEPID_PROPERTY_ENDPOINT);
- if (servletName.equals(propEndpoint) && contextPath.equals(propContext))
- {
- endpoint = epRegistry.getEndpoint(sepId);
- break;
- }
- }
-
- if (endpoint == null)
- {
- ObjectName oname = ObjectNameFactory.create(Endpoint.SEPID_DOMAIN + ":" + Endpoint.SEPID_PROPERTY_CONTEXT + "=" + contextPath + ","
- + Endpoint.SEPID_PROPERTY_ENDPOINT + "=" + servletName);
- throw new WSException("Cannot obtain endpoint for: " + oname);
- }
- }
-}
Modified: trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/DeploymentInfoAdapter.java
===================================================================
--- trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/DeploymentInfoAdapter.java 2007-05-04 10:28:42 UTC (rev 2958)
+++ trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/DeploymentInfoAdapter.java 2007-05-04 12:20:09 UTC (rev 2959)
@@ -31,7 +31,7 @@
import org.jboss.logging.Logger;
import org.jboss.metadata.ApplicationMetaData;
import org.jboss.metadata.WebMetaData;
-import org.jboss.ws.core.server.UnifiedDeploymentInfo;
+import org.jboss.ws.core.deployment.UnifiedDeploymentInfo;
import org.jboss.ws.integration.ResourceLoaderAdapter;
/**
Deleted: trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/EagerInitializeDeployer.java
===================================================================
--- trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/EagerInitializeDeployer.java 2007-05-04 10:28:42 UTC (rev 2958)
+++ trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/EagerInitializeDeployer.java 2007-05-04 12:20:09 UTC (rev 2959)
@@ -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.ws.integration.deployment.AbstractDeployer;
-import org.jboss.ws.integration.deployment.Deployment;
-import org.jboss.ws.metadata.umdm.UnifiedMetaData;
-
-/**
- * A deployer that initializes the UMDM
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 25-Apr-2007
- */
-public class EagerInitializeDeployer extends AbstractDeployer
-{
- @Override
- public void create(Deployment dep)
- {
- UnifiedMetaData umd = dep.getContext().getAttachment(UnifiedMetaData.class);
- if (umd == null)
- throw new IllegalStateException("Cannot obtain unified meta data");
-
- umd.eagerInitialize();
- }
-}
\ No newline at end of file
Deleted: trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/EndpointHandlerDeployer.java
===================================================================
--- trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/EndpointHandlerDeployer.java 2007-05-04 10:28:42 UTC (rev 2958)
+++ trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/EndpointHandlerDeployer.java 2007-05-04 12:20:09 UTC (rev 2959)
@@ -1,115 +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.Map;
-
-import org.jboss.ws.integration.Endpoint;
-import org.jboss.ws.integration.LifecycleHandler;
-import org.jboss.ws.integration.RequestHandler;
-import org.jboss.ws.integration.deployment.AbstractDeployer;
-import org.jboss.ws.integration.deployment.Deployment;
-import org.jboss.ws.integration.invocation.InvocationHandler;
-
-/**
- * A deployer that assigns the handlers to the Endpoint
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 25-Apr-2007
- */
-public class EndpointHandlerDeployer extends AbstractDeployer
-{
- private String requestHandler;
- private String lifecycleHandler;
- private Map<String,String> invocationHandler;
-
- public void setLifecycleHandler(String handler)
- {
- this.lifecycleHandler = handler;
- }
-
- public void setRequestHandler(String handler)
- {
- this.requestHandler = handler;
- }
-
- public void setInvocationHandler(Map<String,String> handlers)
- {
- this.invocationHandler = handlers;
- }
-
- @Override
- public void create(Deployment dep)
- {
- for (Endpoint ep : dep.getService().getEndpoints())
- {
- ep.setRequestHandler(getRequestHandler(dep));
- ep.setLifecycleHandler(getLifecycleHandler(dep));
- ep.setInvocationHandler(getInvocationHandler(dep));
- }
- }
-
- private RequestHandler getRequestHandler(Deployment dep)
- {
- try
- {
- Class<?> handlerClass = dep.getClassLoader().loadClass(requestHandler);
- return (RequestHandler)handlerClass.newInstance();
- }
- catch (Exception e)
- {
- throw new IllegalStateException("Cannot load request handler: " + requestHandler);
- }
- }
-
- private LifecycleHandler getLifecycleHandler(Deployment dep)
- {
- try
- {
- Class<?> handlerClass = dep.getClassLoader().loadClass(lifecycleHandler);
- return (LifecycleHandler)handlerClass.newInstance();
- }
- catch (Exception e)
- {
- throw new IllegalStateException("Cannot load lifecycle handler: " + lifecycleHandler);
- }
- }
-
- private InvocationHandler getInvocationHandler(Deployment dep)
- {
- String className = invocationHandler.get(dep.getType().toString());
- if (className == null)
- throw new IllegalStateException("Cannot obtain invocation handler for: " + dep.getType());
-
- try
- {
- Class<?> handlerClass = dep.getClassLoader().loadClass(className);
- return (InvocationHandler)handlerClass.newInstance();
- }
- catch (Exception e)
- {
- throw new IllegalStateException("Cannot load invocation handler: " + className);
- }
- }
-}
\ No newline at end of file
Deleted: trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/EndpointLifecycleDeployer.java
===================================================================
--- trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/EndpointLifecycleDeployer.java 2007-05-04 10:28:42 UTC (rev 2958)
+++ trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/EndpointLifecycleDeployer.java 2007-05-04 12:20:09 UTC (rev 2959)
@@ -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.ws.integration.Endpoint;
-import org.jboss.ws.integration.Service;
-import org.jboss.ws.integration.deployment.AbstractDeployer;
-import org.jboss.ws.integration.deployment.Deployment;
-
-/**
- * A deployer that that calls the endpoint lifecycle handler
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 25-Apr-2007
- */
-public class EndpointLifecycleDeployer extends AbstractDeployer
-{
- @Override
- public void create(Deployment dep)
- {
- for (Endpoint ep : dep.getService().getEndpoints())
- ep.getLifecycleHandler().create(ep);
- }
-
- @Override
- public void start(Deployment dep)
- {
- for (Endpoint ep : dep.getService().getEndpoints())
- {
- ep.getLifecycleHandler().start(ep);
- }
- }
-
- @Override
- public void stop(Deployment dep)
- {
- Service service = dep.getService();
- if (service != null)
- {
- for (Endpoint ep : service.getEndpoints())
- {
- ep.getLifecycleHandler().stop(ep);
- }
- }
- }
-
- @Override
- public void destroy(Deployment dep)
- {
- Service service = dep.getService();
- if (service != null)
- {
- for (Endpoint ep : service.getEndpoints())
- {
- ep.getLifecycleHandler().destroy(ep);
- }
- }
- }
-}
Deleted: trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/EndpointNameDeployer.java
===================================================================
--- trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/EndpointNameDeployer.java 2007-05-04 10:28:42 UTC (rev 2958)
+++ trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/EndpointNameDeployer.java 2007-05-04 12:20:09 UTC (rev 2959)
@@ -1,54 +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.management.ObjectName;
-
-import org.jboss.ws.integration.Endpoint;
-import org.jboss.ws.integration.deployment.AbstractDeployer;
-import org.jboss.ws.integration.deployment.Deployment;
-import org.jboss.ws.metadata.umdm.ServerEndpointMetaData;
-
-/**
- * A deployer that assigns the complete name to the Endpoint
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 25-Apr-2007
- */
-public class EndpointNameDeployer extends AbstractDeployer
-{
- @Override
- public void create(Deployment dep)
- {
- for (Endpoint ep : dep.getService().getEndpoints())
- {
- ServerEndpointMetaData sepMetaData = ep.getMetaData(ServerEndpointMetaData.class);
- if (sepMetaData == null)
- throw new IllegalStateException("Cannot obtain endpoint meta data");
-
- ObjectName sepID = sepMetaData.getServiceEndpointID();
- ep.setName(sepID);
- }
- }
-}
\ No newline at end of file
Modified: trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/InvocationHandlerEJB21.java
===================================================================
--- trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/InvocationHandlerEJB21.java 2007-05-04 10:28:42 UTC (rev 2958)
+++ trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/InvocationHandlerEJB21.java 2007-05-04 12:20:09 UTC (rev 2959)
@@ -42,9 +42,10 @@
import org.jboss.ws.WSException;
import org.jboss.ws.core.CommonMessageContext;
import org.jboss.ws.core.EndpointInvocation;
+import org.jboss.ws.core.deployment.UnifiedDeploymentInfo;
import org.jboss.ws.core.jaxrpc.handler.HandlerCallback;
import org.jboss.ws.core.jaxrpc.handler.SOAPMessageContextJAXRPC;
-import org.jboss.ws.core.server.UnifiedDeploymentInfo;
+import org.jboss.ws.core.server.AbstractInvocationHandler;
import org.jboss.ws.core.soap.MessageContextAssociation;
import org.jboss.ws.integration.Endpoint;
import org.jboss.ws.integration.ObjectNameFactory;
Modified: trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/InvocationHandlerEJB3.java
===================================================================
--- trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/InvocationHandlerEJB3.java 2007-05-04 10:28:42 UTC (rev 2958)
+++ trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/InvocationHandlerEJB3.java 2007-05-04 12:20:09 UTC (rev 2959)
@@ -40,10 +40,11 @@
import org.jboss.ws.WSException;
import org.jboss.ws.core.CommonMessageContext;
import org.jboss.ws.core.EndpointInvocation;
+import org.jboss.ws.core.deployment.UnifiedDeploymentInfo;
import org.jboss.ws.core.jaxrpc.handler.SOAPMessageContextJAXRPC;
import org.jboss.ws.core.jaxws.WebServiceContextEJB;
import org.jboss.ws.core.jaxws.handler.SOAPMessageContextJAXWS;
-import org.jboss.ws.core.server.UnifiedDeploymentInfo;
+import org.jboss.ws.core.server.AbstractInvocationHandler;
import org.jboss.ws.core.soap.MessageContextAssociation;
import org.jboss.ws.integration.Endpoint;
import org.jboss.ws.integration.ObjectNameFactory;
Deleted: trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/InvocationHandlerJSE.java
===================================================================
--- trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/InvocationHandlerJSE.java 2007-05-04 10:28:42 UTC (rev 2958)
+++ trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/InvocationHandlerJSE.java 2007-05-04 12:20:09 UTC (rev 2959)
@@ -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.lang.reflect.Method;
-
-import javax.xml.rpc.ServiceException;
-import javax.xml.rpc.server.ServiceLifecycle;
-import javax.xml.rpc.server.ServletEndpointContext;
-import javax.xml.rpc.soap.SOAPFaultException;
-import javax.xml.ws.WebServiceContext;
-
-import org.jboss.logging.Logger;
-import org.jboss.ws.WSException;
-import org.jboss.ws.core.CommonMessageContext;
-import org.jboss.ws.core.EndpointInvocation;
-import org.jboss.ws.core.jaxrpc.ServletEndpointContextImpl;
-import org.jboss.ws.core.jaxws.WebServiceContextInjector;
-import org.jboss.ws.core.jaxws.WebServiceContextJSE;
-import org.jboss.ws.core.jaxws.handler.SOAPMessageContextJAXWS;
-import org.jboss.ws.core.server.ServletRequestContext;
-import org.jboss.ws.core.soap.MessageContextAssociation;
-import org.jboss.ws.integration.invocation.InvocationContext;
-import org.jboss.ws.metadata.umdm.ServerEndpointMetaData;
-
-/**
- * Handles invocations on JSE endpoints.
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 25-Apr-2007
- */
-public class InvocationHandlerJSE extends AbstractInvocationHandler
-{
- // provide logging
- private static final Logger log = Logger.getLogger(InvocationHandlerJSE.class);
-
- /** Load the SEI implementation bean if necessary */
- public Class loadServiceEndpoint() throws ClassNotFoundException
- {
- ServerEndpointMetaData sepMetaData = endpoint.getMetaData(ServerEndpointMetaData.class);
- if (sepMetaData == null)
- throw new IllegalStateException("Cannot obtain endpoint meta data");
-
- ClassLoader cl = sepMetaData.getClassLoader();
- String seiImplName = sepMetaData.getServiceEndpointImplName();
- Class seiImplClass = cl.loadClass(seiImplName);
- return seiImplClass;
- }
-
- /** Create an instance of the SEI implementation bean if necessary */
- public Object createServiceEndpointInstance(Class seiImplClass, InvocationContext context) throws IllegalAccessException, InstantiationException
- {
- Object seiImpl = seiImplClass.newInstance();
- if (seiImpl instanceof ServiceLifecycle && context != null)
- {
- try
- {
- ServiceLifecycle serviceLifecycle = ((ServiceLifecycle)seiImpl);
- ServletEndpointContext servletEndpointContext = new ServletEndpointContextImpl((ServletRequestContext)context);
- serviceLifecycle.init(servletEndpointContext);
- }
- catch (ServiceException ex)
- {
- throw new WSException(ex);
- }
- }
- return seiImpl;
- }
-
- /** Invoke an instance of the SEI implementation bean */
- public void invokeServiceEndpointInstance(Object seiImpl, EndpointInvocation epInv) throws SOAPFaultException, Exception
- {
- log.debug("invokeServiceEndpoint: " + epInv.getJavaMethod().getName());
- try
- {
- CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
- if (msgContext instanceof SOAPMessageContextJAXWS)
- {
- WebServiceContext wsContext = new WebServiceContextJSE((SOAPMessageContextJAXWS)msgContext);
- new WebServiceContextInjector().injectContext(seiImpl, wsContext);
- }
-
- Class implClass = seiImpl.getClass();
- Method seiMethod = epInv.getJavaMethod();
- Method implMethod = getImplMethod(implClass, seiMethod);
-
- Object[] args = epInv.getRequestPayload();
- Object retObj = implMethod.invoke(seiImpl, args);
- epInv.setReturnValue(retObj);
- }
- catch (Exception e)
- {
- handleInvocationException(e);
- }
- }
-
- /** Destroy an instance of the SEI implementation bean if necessary */
- public void destroyServiceEndpointInstance(Object seiImpl)
- {
- if (seiImpl instanceof ServiceLifecycle)
- {
- ((ServiceLifecycle)seiImpl).destroy();
- }
- }
-}
Deleted: trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/LifecycleHandlerImpl.java
===================================================================
--- trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/LifecycleHandlerImpl.java 2007-05-04 10:28:42 UTC (rev 2958)
+++ trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/LifecycleHandlerImpl.java 2007-05-04 12:20:09 UTC (rev 2959)
@@ -1,57 +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.metadata.umdm.ServerEndpointMetaData;
-
-/**
- * A lifecycle handler
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 25-Apr-2007
- */
-public class LifecycleHandlerImpl extends org.jboss.ws.integration.LifecycleHandlerImpl
-{
- public void start(Endpoint endpoint)
- {
- super.start(endpoint);
- log.info("WebService started: " + getEndpointAddress(endpoint));
- }
-
- public void stop(Endpoint endpoint)
- {
- super.stop(endpoint);
- log.info("WebService stoped: " + getEndpointAddress(endpoint));
- }
-
- private String getEndpointAddress(Endpoint ep)
- {
- ServerEndpointMetaData sepMetaData = ep.getMetaData(ServerEndpointMetaData.class);
- if (sepMetaData == null)
- throw new IllegalStateException("Cannot obtain endpoint meta data");
-
- return sepMetaData.getEndpointAddress();
- }
-}
Modified: trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/ModifyWebMetaDataDeployer.java
===================================================================
--- trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/ModifyWebMetaDataDeployer.java 2007-05-04 10:28:42 UTC (rev 2958)
+++ trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/ModifyWebMetaDataDeployer.java 2007-05-04 12:20:09 UTC (rev 2959)
@@ -23,8 +23,8 @@
//$Id$
-import org.jboss.ws.core.server.ServiceEndpointPublisher;
-import org.jboss.ws.core.server.UnifiedDeploymentInfo;
+import org.jboss.ws.core.deployment.ServiceEndpointPublisher;
+import org.jboss.ws.core.deployment.UnifiedDeploymentInfo;
import org.jboss.ws.integration.deployment.AbstractDeployer;
import org.jboss.ws.integration.deployment.Deployment;
Deleted: trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/PublishContractDeployer.java
===================================================================
--- trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/PublishContractDeployer.java 2007-05-04 10:28:42 UTC (rev 2958)
+++ trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/PublishContractDeployer.java 2007-05-04 12:20:09 UTC (rev 2959)
@@ -1,64 +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 org.jboss.ws.core.server.UnifiedDeploymentInfo;
-import org.jboss.ws.core.server.WSDLFilePublisher;
-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 publishes the wsdl
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 25-Apr-2007
- */
-public class PublishContractDeployer extends AbstractDeployer
-{
- @Override
- public void create(Deployment dep)
- {
- UnifiedDeploymentInfo udi = dep.getContext().getAttachment(UnifiedDeploymentInfo.class);
- if (udi == null)
- throw new IllegalStateException("Cannot obtain unified deployement info");
-
- UnifiedMetaData umd = dep.getContext().getAttachment(UnifiedMetaData.class);
- if (umd == null)
- throw new IllegalStateException("Cannot obtain unified meta data");
-
- try
- {
- WSDLFilePublisher publisher = new WSDLFilePublisher(udi);
- publisher.publishWsdlFiles(umd);
- }
- catch (IOException ex)
- {
- throw new WSDeploymentException(ex);
- }
- }
-}
\ No newline at end of file
Deleted: trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/RequestHandlerImpl.java
===================================================================
--- trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/RequestHandlerImpl.java 2007-05-04 10:28:42 UTC (rev 2958)
+++ trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/RequestHandlerImpl.java 2007-05-04 12:20:09 UTC (rev 2959)
@@ -1,415 +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.io.InputStream;
-import java.io.OutputStream;
-import java.io.OutputStreamWriter;
-import java.net.URL;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import javax.activation.DataHandler;
-import javax.servlet.ServletContext;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import javax.xml.namespace.QName;
-import javax.xml.rpc.soap.SOAPFaultException;
-import javax.xml.soap.MimeHeaders;
-import javax.xml.soap.SOAPEnvelope;
-import javax.xml.soap.SOAPException;
-import javax.xml.soap.SOAPMessage;
-import javax.xml.soap.SOAPPart;
-import javax.xml.ws.addressing.AddressingProperties;
-import javax.xml.ws.addressing.JAXWSAConstants;
-import javax.xml.ws.http.HTTPBinding;
-
-import org.jboss.logging.Logger;
-import org.jboss.ws.Constants;
-import org.jboss.ws.WSException;
-import org.jboss.ws.core.CommonBinding;
-import org.jboss.ws.core.CommonBindingProvider;
-import org.jboss.ws.core.CommonMessageContext;
-import org.jboss.ws.core.HTTPMessageImpl;
-import org.jboss.ws.core.MessageAbstraction;
-import org.jboss.ws.core.MessageTrace;
-import org.jboss.ws.core.jaxrpc.binding.BindingException;
-import org.jboss.ws.core.jaxrpc.handler.MessageContextJAXRPC;
-import org.jboss.ws.core.jaxrpc.handler.SOAPMessageContextJAXRPC;
-import org.jboss.ws.core.jaxws.handler.MessageContextJAXWS;
-import org.jboss.ws.core.jaxws.handler.SOAPMessageContextJAXWS;
-import org.jboss.ws.core.server.MimeHeaderSource;
-import org.jboss.ws.core.server.ServletHeaderSource;
-import org.jboss.ws.core.server.ServletRequestContext;
-import org.jboss.ws.core.server.WSDLRequestHandler;
-import org.jboss.ws.core.soap.MessageContextAssociation;
-import org.jboss.ws.core.soap.MessageFactoryImpl;
-import org.jboss.ws.core.soap.SOAPConnectionImpl;
-import org.jboss.ws.core.soap.SOAPMessageImpl;
-import org.jboss.ws.core.utils.DOMWriter;
-import org.jboss.ws.core.utils.ThreadLocalAssociation;
-import org.jboss.ws.extensions.addressing.AddressingConstantsImpl;
-import org.jboss.ws.extensions.xop.XOPContext;
-import org.jboss.ws.integration.Endpoint;
-import org.jboss.ws.integration.RequestHandler;
-import org.jboss.ws.integration.Endpoint.EndpointState;
-import org.jboss.ws.integration.invocation.InvocationContext;
-import org.jboss.ws.integration.invocation.InvocationHandler;
-import org.jboss.ws.integration.management.ServerConfig;
-import org.jboss.ws.integration.management.ServerConfigFactory;
-import org.jboss.ws.metadata.umdm.EndpointMetaData;
-import org.jboss.ws.metadata.umdm.ServerEndpointMetaData;
-import org.jboss.ws.metadata.umdm.EndpointMetaData.Type;
-import org.w3c.dom.Document;
-
-/**
- * A request handler
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 25-Apr-2007
- */
-public class RequestHandlerImpl implements RequestHandler
-{
- // provide logging
- private static final Logger log = Logger.getLogger(RequestHandlerImpl.class);
-
- public void handleRequest(Endpoint endpoint, InputStream inputStream, OutputStream outputStream, InvocationContext context)
- {
- log.debug("handleRequest: " + endpoint.getName());
-
- ServerEndpointMetaData sepMetaData = endpoint.getMetaData(ServerEndpointMetaData.class);
- if (sepMetaData == null)
- throw new IllegalStateException("Cannot obtain endpoint meta data");
-
- ServletRequestContext reqContext = (ServletRequestContext)context;
-
- Type type = sepMetaData.getType();
-
- ServletContext servletContext = reqContext.getServletContext();
- HttpServletRequest httpRequest = reqContext.getHttpServletRequest();
- HttpServletResponse httpResponse = reqContext.getHttpServletResponse();
- ServletHeaderSource headerSource = new ServletHeaderSource(httpRequest, httpResponse);
-
- // Build the message context
- CommonMessageContext msgContext;
- if (type == EndpointMetaData.Type.JAXRPC)
- {
- msgContext = new SOAPMessageContextJAXRPC();
- msgContext.put(MessageContextJAXRPC.SERVLET_CONTEXT, servletContext);
- msgContext.put(MessageContextJAXRPC.SERVLET_REQUEST, httpRequest);
- msgContext.put(MessageContextJAXRPC.SERVLET_RESPONSE, httpResponse);
- }
- else
- {
- msgContext = new SOAPMessageContextJAXWS();
- msgContext.put(MessageContextJAXWS.MESSAGE_OUTBOUND_PROPERTY, new Boolean(false));
- msgContext.put(MessageContextJAXWS.INBOUND_MESSAGE_ATTACHMENTS, new HashMap<String, DataHandler>());
- msgContext.put(MessageContextJAXWS.HTTP_REQUEST_HEADERS, headerSource.getHeaderMap());
- msgContext.put(MessageContextJAXWS.HTTP_REQUEST_METHOD, httpRequest.getMethod());
- msgContext.put(MessageContextJAXWS.QUERY_STRING, httpRequest.getQueryString());
- msgContext.put(MessageContextJAXWS.PATH_INFO, httpRequest.getPathInfo());
- msgContext.put(MessageContextJAXWS.SERVLET_CONTEXT, servletContext);
- msgContext.put(MessageContextJAXWS.SERVLET_REQUEST, httpRequest);
- msgContext.put(MessageContextJAXWS.SERVLET_RESPONSE, httpResponse);
-
- }
- msgContext.setEndpointMetaData(sepMetaData);
-
- // Associate a message context with the current thread
- MessageContextAssociation.pushMessageContext(msgContext);
-
- try
- {
- MessageAbstraction resMessage = processRequest(endpoint, headerSource, reqContext, inputStream);
-
- // Replace the message context with the response context
- msgContext = MessageContextAssociation.peekMessageContext();
-
- Map<String, List<String>> headers = (Map<String, List<String>>)msgContext.get(MessageContextJAXWS.HTTP_RESPONSE_HEADERS);
- if (headers != null)
- headerSource.setHeaderMap(headers);
-
- Integer code = (Integer)msgContext.get(MessageContextJAXWS.HTTP_RESPONSE_CODE);
- if (code != null)
- httpResponse.setStatus(code.intValue());
-
- boolean isFault = false;
- if (resMessage instanceof SOAPMessage)
- {
- SOAPPart part = ((SOAPMessage)resMessage).getSOAPPart();
- if (part == null)
- throw new SOAPException("Cannot obtain SOAPPart from response message");
-
- // R1126 An INSTANCE MUST return a "500 Internal Server Error" HTTP status code
- // if the response envelope is a Fault.
- //
- // Also, a one-way operation must show up as empty content, and can be detected
- // by a null envelope.
- SOAPEnvelope soapEnv = part.getEnvelope();
- isFault = soapEnv != null && soapEnv.getBody().hasFault();
- if (isFault && httpResponse != null)
- {
- httpResponse.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
- }
- }
-
- sendResponse(outputStream, msgContext, isFault);
- }
- catch (Exception ex)
- {
- WSException.rethrow(ex);
- }
- finally
- {
- // Reset the message context association
- MessageContextAssociation.popMessageContext();
-
- // clear thread local storage
- ThreadLocalAssociation.clear();
- }
- }
-
- private void sendResponse(OutputStream outputStream, CommonMessageContext msgContext, boolean isFault) throws SOAPException, IOException
- {
- MessageAbstraction resMessage = msgContext.getMessageAbstraction();
- String wsaTo = null;
-
- // Get the destination from the AddressingProperties
- AddressingProperties outProps = (AddressingProperties)msgContext.get(JAXWSAConstants.SERVER_ADDRESSING_PROPERTIES_OUTBOUND);
- if (outProps != null && outProps.getTo() != null)
- {
- AddressingConstantsImpl ADDR = new AddressingConstantsImpl();
- wsaTo = outProps.getTo().getURI().toString();
- if (wsaTo.equals(ADDR.getAnonymousURI()))
- wsaTo = null;
- }
- if (wsaTo != null)
- {
- log.debug("Sending response to addressing destination: " + wsaTo);
- new SOAPConnectionImpl().callOneWay((SOAPMessage)resMessage, wsaTo);
- }
- else
- {
- resMessage.writeTo(outputStream);
- }
- }
-
- /**
- * Handle a request to this web service endpoint
- */
- private MessageAbstraction processRequest(Endpoint endpoint, MimeHeaderSource headerSource, ServletRequestContext reqContext, InputStream inputStream)
- throws BindingException
- {
- CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
-
- ServerEndpointMetaData sepMetaData = endpoint.getMetaData(ServerEndpointMetaData.class);
- if (sepMetaData == null)
- throw new IllegalStateException("Cannot obtain endpoint meta data");
-
- long beginProcessing = 0;
- ClassLoader ctxClassLoader = Thread.currentThread().getContextClassLoader();
- try
- {
- EndpointState state = endpoint.getState();
- if (state != EndpointState.STARTED)
- {
- QName faultCode = Constants.SOAP11_FAULT_CODE_SERVER;
- String faultString = "Endpoint cannot handle requests in state: " + state;
- throw new SOAPFaultException(faultCode, faultString, null, null);
- }
-
- log.debug("BEGIN handleRequest: " + endpoint.getName());
- beginProcessing = initRequestMetrics(endpoint);
-
- MimeHeaders headers = (headerSource != null ? headerSource.getMimeHeaders() : null);
-
- MessageAbstraction reqMessage;
-
- String bindingID = sepMetaData.getBindingId();
- if (HTTPBinding.HTTP_BINDING.equals(bindingID))
- {
- reqMessage = new HTTPMessageImpl(headers, inputStream);
- }
- else
- {
- MessageFactoryImpl msgFactory = new MessageFactoryImpl();
- msgFactory.setServiceMode(sepMetaData.getServiceMode());
- msgFactory.setStyle(sepMetaData.getStyle());
-
- reqMessage = (SOAPMessageImpl)msgFactory.createMessage(headers, inputStream);
- }
-
- // Associate current message with message context
- msgContext.setMessageAbstraction(reqMessage);
-
- // debug the incomming message
- MessageTrace.traceMessage("Incoming Request Message", reqMessage);
-
- // Set the thread context class loader
- ClassLoader classLoader = sepMetaData.getClassLoader();
- Thread.currentThread().setContextClassLoader(classLoader);
-
- // Invoke the service endpoint
- InvocationHandler invoker = endpoint.getInvocationHandler();
- invoker.invoke(reqContext);
-
- // Get the response message context
- msgContext = MessageContextAssociation.peekMessageContext();
-
- // Get the response message
- MessageAbstraction resMessage = msgContext.getMessageAbstraction();
- if (resMessage != null)
- postProcessResponse(headerSource, resMessage);
-
- return resMessage;
- }
- catch (Exception ex)
- {
- MessageAbstraction resMessage = msgContext.getMessageAbstraction();
-
- // In case we have an exception before the invoker is called
- // we create the fault message here.
- if (resMessage == null || resMessage.isFaultMessage() == false)
- {
- CommonBindingProvider bindingProvider = new CommonBindingProvider(sepMetaData);
- CommonBinding binding = bindingProvider.getCommonBinding();
- resMessage = binding.bindFaultMessage(ex);
- }
-
- if (resMessage != null)
- postProcessResponse(headerSource, resMessage);
-
- return resMessage;
- }
- finally
- {
- try
- {
- MessageAbstraction resMessage = msgContext.getMessageAbstraction();
- if (resMessage != null)
- {
- if (resMessage.isFaultMessage())
- {
- processFaultMetrics(endpoint, beginProcessing);
- }
- else
- {
- processResponseMetrics(endpoint, beginProcessing);
- }
- }
- }
- catch (Exception ex)
- {
- log.error("Cannot process metrics", ex);
- }
-
- // Reset the thread context class loader
- Thread.currentThread().setContextClassLoader(ctxClassLoader);
- log.debug("END handleRequest: " + endpoint.getName());
- }
- }
-
- private long initRequestMetrics(Endpoint endpoint)
- {
- return 0;
- }
-
- private void processResponseMetrics(Endpoint endpoint, long beginProcessing)
- {
- }
-
- private void processFaultMetrics(Endpoint endpoint, long beginProcessing)
- {
- }
-
- /** Set response mime headers
- */
- private void postProcessResponse(MimeHeaderSource headerSource, MessageAbstraction resMessage)
- {
- try
- {
- // Set the outbound headers
- if (headerSource != null && resMessage instanceof SOAPMessage)
- {
- XOPContext.eagerlyCreateAttachments();
- ((SOAPMessage)resMessage).saveChanges();
- headerSource.setMimeHeaders(resMessage.getMimeHeaders());
- }
-
- // debug the outgoing message
- MessageTrace.traceMessage("Outgoing Response Message", resMessage);
- }
- catch (Exception ex)
- {
- WSException.rethrow("Faild to post process response message", ex);
- }
- }
-
- public void handleWSDLRequest(Endpoint endpoint, OutputStream outputStream, InvocationContext context)
- {
- log.debug("handleWSDLRequest: " + endpoint.getName());
-
- ServerEndpointMetaData epMetaData = endpoint.getMetaData(ServerEndpointMetaData.class);
- if (epMetaData == null)
- throw new IllegalStateException("Cannot obtain endpoint meta data");
-
- ServletRequestContext reqContext = (ServletRequestContext)context;
- HttpServletRequest req = reqContext.getHttpServletRequest();
-
- try
- {
- // For the base document the resourcePath should be null
- String resPath = (String)req.getParameter("resource");
- URL reqURL = new URL(req.getRequestURL().toString());
-
- String wsdlHost = reqURL.getProtocol() + "://" + reqURL.getHost() + ":" + reqURL.getPort();
-
- ServerConfigFactory factory = ServerConfigFactory.getInstance();
- ServerConfig config = factory.getServerConfig();
- if (config.getWebServiceHost().equals(ServerConfig.UNDEFINED_HOSTNAME) == false)
- {
- wsdlHost = config.getWebServiceHost();
- }
- log.debug("WSDL request, using host: " + wsdlHost);
-
- WSDLRequestHandler wsdlRequestHandler = new WSDLRequestHandler(epMetaData);
- Document document = wsdlRequestHandler.getDocumentForPath(reqURL, wsdlHost, resPath);
-
- OutputStreamWriter writer = new OutputStreamWriter(outputStream);
- new DOMWriter(writer).setPrettyprint(true).print(document.getDocumentElement());
- outputStream.flush();
- outputStream.close();
- }
- catch (RuntimeException rte)
- {
- throw rte;
- }
- catch (IOException ex)
- {
- throw new WSException(ex);
- }
- }
-}
Modified: trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/ServiceEndpointGeneratorEJB21.java
===================================================================
--- trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/ServiceEndpointGeneratorEJB21.java 2007-05-04 10:28:42 UTC (rev 2958)
+++ trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/ServiceEndpointGeneratorEJB21.java 2007-05-04 12:20:09 UTC (rev 2959)
@@ -29,8 +29,8 @@
import org.jboss.logging.Logger;
import org.jboss.metadata.ApplicationMetaData;
import org.jboss.metadata.AssemblyDescriptorMetaData;
+import org.jboss.ws.core.deployment.UnifiedDeploymentInfo;
import org.jboss.ws.core.server.ServiceEndpointGeneratorEJB;
-import org.jboss.ws.core.server.UnifiedDeploymentInfo;
import org.jboss.ws.core.utils.DOMUtils;
import org.w3c.dom.Element;
Modified: trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/ServiceEndpointGeneratorEJB3.java
===================================================================
--- trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/ServiceEndpointGeneratorEJB3.java 2007-05-04 10:28:42 UTC (rev 2958)
+++ trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/ServiceEndpointGeneratorEJB3.java 2007-05-04 12:20:09 UTC (rev 2959)
@@ -34,8 +34,8 @@
import org.jboss.mx.util.MBeanProxyCreationException;
import org.jboss.mx.util.MBeanServerLocator;
import org.jboss.ws.WSException;
+import org.jboss.ws.core.deployment.UnifiedDeploymentInfo;
import org.jboss.ws.core.server.ServiceEndpointGeneratorEJB;
-import org.jboss.ws.core.server.UnifiedDeploymentInfo;
import org.jboss.ws.core.utils.DOMUtils;
import org.w3c.dom.Element;
Deleted: trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/ServiceEndpointServlet.java
===================================================================
--- trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/ServiceEndpointServlet.java 2007-05-04 10:28:42 UTC (rev 2958)
+++ trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/ServiceEndpointServlet.java 2007-05-04 12:20:09 UTC (rev 2959)
@@ -1,62 +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.servlet.ServletContext;
-
-import org.jboss.logging.Logger;
-import org.jboss.ws.metadata.umdm.ServerEndpointMetaData;
-
-/**
- * A servlet that is installed for every web service endpoint.
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 25-Apr-2007
- */
-public class ServiceEndpointServlet extends AbstractServiceEndpointServlet
-{
- // provide logging
- private static final Logger log = Logger.getLogger(ServiceEndpointServlet.class);
-
- /** Initialize the service endpoint
- */
- protected void initServiceEndpoint(String contextPath)
- {
- super.initServiceEndpoint(contextPath);
-
- // read the config name/file from web.xml
- ServletContext ctx = getServletContext();
- String configName = ctx.getInitParameter("jbossws-config-name");
- String configFile = ctx.getInitParameter("jbossws-config-file");
- if (configName != null || configFile != null)
- {
- ServerEndpointMetaData epMetaData = endpoint.getMetaData(ServerEndpointMetaData.class);
- if (epMetaData == null)
- throw new IllegalStateException("Cannot obtain endpoint meta data");
-
- log.debug("Updating service endpoint config\n config-name: " + configName + "\n config-file: " + configFile);
- epMetaData.setConfigName(configName, configFile);
- }
- }
-}
Modified: trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/UnifiedDeploymentInfoDeployer.java
===================================================================
--- trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/UnifiedDeploymentInfoDeployer.java 2007-05-04 10:28:42 UTC (rev 2958)
+++ trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/UnifiedDeploymentInfoDeployer.java 2007-05-04 12:20:09 UTC (rev 2959)
@@ -24,12 +24,12 @@
//$Id$
import org.jboss.deployment.DeploymentInfo;
-import org.jboss.ws.core.server.JAXWSDeployment;
-import org.jboss.ws.core.server.UnifiedDeploymentInfo;
+import org.jboss.ws.core.deployment.JAXRPCDeployment;
+import org.jboss.ws.core.deployment.JAXWSDeployment;
+import org.jboss.ws.core.deployment.UnifiedDeploymentInfo;
import org.jboss.ws.integration.deployment.AbstractDeployer;
import org.jboss.ws.integration.deployment.Deployment;
import org.jboss.ws.integration.deployment.Deployment.DeploymentType;
-import org.jboss.ws.metadata.builder.jaxrpc.JAXRPCDeployment;
import org.jboss.ws.metadata.webservices.WebservicesMetaData;
/**
Deleted: trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/UnifiedMetaDataAssociationDeployer.java
===================================================================
--- trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/UnifiedMetaDataAssociationDeployer.java 2007-05-04 10:28:42 UTC (rev 2958)
+++ trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/UnifiedMetaDataAssociationDeployer.java 2007-05-04 12:20:09 UTC (rev 2959)
@@ -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 javax.management.ObjectName;
-
-import org.jboss.ws.integration.Endpoint;
-import org.jboss.ws.integration.deployment.AbstractDeployer;
-import org.jboss.ws.integration.deployment.Deployment;
-import org.jboss.ws.metadata.umdm.EndpointMetaData;
-import org.jboss.ws.metadata.umdm.ServerEndpointMetaData;
-import org.jboss.ws.metadata.umdm.ServiceMetaData;
-import org.jboss.ws.metadata.umdm.UnifiedMetaData;
-
-/**
- * A deployer that assigns the EndpointMetaData to the Endpoint
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 25-Apr-2007
- */
-public class UnifiedMetaDataAssociationDeployer extends AbstractDeployer
-{
- @Override
- public void create(Deployment dep)
- {
- UnifiedMetaData umd = dep.getContext().getAttachment(UnifiedMetaData.class);
- if (umd == null)
- throw new IllegalStateException("Cannot obtain unified meta data");
-
- for (Endpoint ep : dep.getService().getEndpoints())
- {
- ServerEndpointMetaData sepMetaData = ep.getMetaData(ServerEndpointMetaData.class);
- if (sepMetaData == null)
- {
- sepMetaData = getEndpointMetaData(umd, ep.getName());
- sepMetaData.setServiceEndpointImplName(ep.getEndpointImpl().getName());
- ep.addMetaData(ServerEndpointMetaData.class, sepMetaData);
- }
- }
- }
-
- private ServerEndpointMetaData getEndpointMetaData(UnifiedMetaData umd, ObjectName epName)
- {
- String propEndpoint = epName.getKeyProperty(Endpoint.SEPID_PROPERTY_ENDPOINT);
-
- ServerEndpointMetaData epMetaData = null;
- for (ServiceMetaData serviceMetaData : umd.getServices())
- {
- for (EndpointMetaData aux : serviceMetaData.getEndpoints())
- {
- String linkName = ((ServerEndpointMetaData)aux).getLinkName();
- if (propEndpoint.equals(linkName))
- {
- epMetaData = (ServerEndpointMetaData)aux;
- break;
- }
- }
- }
-
- if (epMetaData == null)
- throw new IllegalStateException("Cannot find endpoint meta data for: " + epName);
-
- return epMetaData;
- }
-}
\ No newline at end of file
Deleted: trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/UnifiedMetaDataDeployer.java
===================================================================
--- trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/UnifiedMetaDataDeployer.java 2007-05-04 10:28:42 UTC (rev 2958)
+++ trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/UnifiedMetaDataDeployer.java 2007-05-04 12:20:09 UTC (rev 2959)
@@ -1,82 +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.core.server.UnifiedDeploymentInfo;
-import org.jboss.ws.integration.deployment.AbstractDeployer;
-import org.jboss.ws.integration.deployment.Deployment;
-import org.jboss.ws.integration.deployment.Deployment.DeploymentType;
-import org.jboss.ws.metadata.builder.jaxrpc.JAXRPCDeployment;
-import org.jboss.ws.metadata.builder.jaxrpc.JAXRPCServerMetaDataBuilder;
-import org.jboss.ws.metadata.builder.jaxws.JAXWSMetaDataBuilderEJB3;
-import org.jboss.ws.metadata.builder.jaxws.JAXWSMetaDataBuilderJSE;
-import org.jboss.ws.metadata.umdm.UnifiedMetaData;
-
-/**
- * A deployer that builds the UnifiedDeploymentInfo
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 25-Apr-2007
- */
-public class UnifiedMetaDataDeployer extends AbstractDeployer
-{
- @Override
- public void create(Deployment dep)
- {
- UnifiedMetaData umd = dep.getContext().getAttachment(UnifiedMetaData.class);
- if (umd == null)
- {
- UnifiedDeploymentInfo udi = dep.getContext().getAttachment(UnifiedDeploymentInfo.class);
- if (udi == null)
- throw new IllegalStateException("Cannot obtain unified deployement info");
-
- if (udi.type == DeploymentType.JAXRPC_JSE)
- {
- JAXRPCServerMetaDataBuilder builder = new JAXRPCServerMetaDataBuilder();
- umd = builder.buildMetaData((JAXRPCDeployment)udi);
- }
- else if (udi.type == DeploymentType.JAXRPC_EJB21)
- {
- JAXRPCServerMetaDataBuilder builder = new JAXRPCServerMetaDataBuilder();
- umd = builder.buildMetaData((JAXRPCDeployment)udi);
- }
- else if (udi.type == DeploymentType.JAXWS_JSE)
- {
- JAXWSMetaDataBuilderJSE builder = new JAXWSMetaDataBuilderJSE();
- umd = builder.buildMetaData(udi);
- }
- else if (udi.type == DeploymentType.JAXWS_EJB3)
- {
- JAXWSMetaDataBuilderEJB3 builder = new JAXWSMetaDataBuilderEJB3();
- umd = builder.buildMetaData(udi);
- }
- else
- {
- throw new IllegalStateException("Invalid type: " + udi.type);
- }
-
- dep.getContext().addAttachment(UnifiedMetaData.class, umd);
- }
- }
-}
\ No newline at end of file
Modified: trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/WebAppDeployerDeployer.java
===================================================================
--- trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/WebAppDeployerDeployer.java 2007-05-04 10:28:42 UTC (rev 2958)
+++ trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/WebAppDeployerDeployer.java 2007-05-04 12:20:09 UTC (rev 2959)
@@ -33,8 +33,8 @@
import org.jboss.mx.util.MBeanProxy;
import org.jboss.mx.util.MBeanProxyCreationException;
import org.jboss.mx.util.MBeanServerLocator;
-import org.jboss.ws.core.server.ServiceEndpointPublisher;
-import org.jboss.ws.core.server.UnifiedDeploymentInfo;
+import org.jboss.ws.core.deployment.ServiceEndpointPublisher;
+import org.jboss.ws.core.deployment.UnifiedDeploymentInfo;
import org.jboss.ws.integration.deployment.Deployer;
import org.jboss.ws.integration.deployment.Deployment;
import org.jboss.ws.integration.deployment.WSDeploymentException;
Modified: trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/WebAppGeneratorDeployer.java
===================================================================
--- trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/WebAppGeneratorDeployer.java 2007-05-04 10:28:42 UTC (rev 2958)
+++ trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/WebAppGeneratorDeployer.java 2007-05-04 12:20:09 UTC (rev 2959)
@@ -23,7 +23,7 @@
//$Id$
-import org.jboss.ws.core.server.UnifiedDeploymentInfo;
+import org.jboss.ws.core.deployment.UnifiedDeploymentInfo;
import org.jboss.ws.integration.deployment.AbstractDeployer;
import org.jboss.ws.integration.deployment.Deployment;
import org.jboss.ws.metadata.umdm.UnifiedMetaData;
Modified: trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/WebMetaDataAdapter.java
===================================================================
--- trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/WebMetaDataAdapter.java 2007-05-04 10:28:42 UTC (rev 2958)
+++ trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/WebMetaDataAdapter.java 2007-05-04 12:20:09 UTC (rev 2959)
@@ -33,7 +33,7 @@
import org.jboss.metadata.WebMetaData;
import org.jboss.metadata.WebSecurityMetaData;
import org.jboss.metadata.WebSecurityMetaData.WebResourceCollection;
-import org.jboss.ws.core.server.UnifiedDeploymentInfo;
+import org.jboss.ws.core.deployment.UnifiedDeploymentInfo;
import org.jboss.ws.metadata.j2ee.UnifiedWebMetaData;
import org.jboss.ws.metadata.j2ee.UnifiedWebSecurityMetaData;
import org.jboss.ws.metadata.j2ee.UnifiedWebMetaData.PublishLocationAdapter;
Modified: trunk/integration-jboss42/src/resources/jbossws.beans/META-INF/jboss-beans.xml
===================================================================
--- trunk/integration-jboss42/src/resources/jbossws.beans/META-INF/jboss-beans.xml 2007-05-04 10:28:42 UTC (rev 2958)
+++ trunk/integration-jboss42/src/resources/jbossws.beans/META-INF/jboss-beans.xml 2007-05-04 12:20:09 UTC (rev 2959)
@@ -44,26 +44,14 @@
*********************************************************************************************************************
Web Service deployment
- There are three deployers registered with the JBoss Main Deployer.
- The order of which is important
+ There are three deployer interceptors registered with the JBoss Deployers.
- 1) EJBDeployer < WebServiceDeployerEJB
- 2) WebServiceDeployerJSE < WarDeployer
- 3) WebServiceMainDeployer
+ 1) DeployerInterceptorJSE
+ 2) DeployerInterceptorEJB21
+ 3) DeployerInterceptorEJB3
- Each WebServiceDeployer has a number of DeployerHooks registerd with it
+ Each interceptor has a number of DeployerHooks registerd with it
- - WebServiceDeployerEJB
- - WSDeployerHook_JAXRPC_EJB21
- - WSDeployerHook_JAXWS_EJB3
-
- - WebServiceDeployerJSE
- - WSDeployerHook_JAXRPC_JSE
- - WSDeployerHook_JAXWS_JSE
-
- - WebServiceMainDeployer
- - WSMainDeployerHook
-
Conceptually, each of these hooks implements the following pattern:
DployerHook.deploy(unit)
@@ -128,40 +116,40 @@
Each handles a single aspect of web service deployment
-->
<bean name="WSClassLoaderInjectionDeployer" class="org.jboss.ws.integration.jboss42.jbossws.ClassLoaderInjectionDeployer"/>
- <bean name="WSEagerInitializeDeployer" class="org.jboss.ws.integration.jboss42.jbossws.EagerInitializeDeployer"/>
- <bean name="WSEndpointHandlerDeployer" class="org.jboss.ws.integration.jboss42.jbossws.EndpointHandlerDeployer">
- <property name="requestHandler">org.jboss.ws.integration.jboss42.jbossws.RequestHandlerImpl</property>
- <property name="lifecycleHandler">org.jboss.ws.integration.jboss42.jbossws.LifecycleHandlerImpl</property>
+ <bean name="WSEagerInitializeDeployer" class="org.jboss.ws.core.deployment.EagerInitializeDeployer"/>
+ <bean name="WSEndpointHandlerDeployer" class="org.jboss.ws.core.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.integration.jboss42.jbossws.InvocationHandlerJSE</value></entry>
+ <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.integration.jboss42.jbossws.InvocationHandlerJSE</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>
</map>
</property>
</bean>
- <bean name="WSEndpointLifecycleDeployer" class="org.jboss.ws.integration.jboss42.jbossws.EndpointLifecycleDeployer"/>
- <bean name="WSEndpointNameDeployer" class="org.jboss.ws.integration.jboss42.jbossws.EndpointNameDeployer"/>
+ <bean name="WSEndpointLifecycleDeployer" class="org.jboss.ws.core.deployment.EndpointLifecycleDeployer"/>
+ <bean name="WSEndpointNameDeployer" class="org.jboss.ws.core.deployment.EndpointNameDeployer"/>
<bean name="WSEndpointRegistryDeployer" class="org.jboss.ws.integration.deployment.EndpointRegistryDeployer"/>
<bean name="WSEndpointValidationDeployer" class="org.jboss.ws.integration.deployment.EndpointValidationDeployer"/>
<bean name="WSModifyWebMetaDataDeployer" class="org.jboss.ws.integration.jboss42.jbossws.ModifyWebMetaDataDeployer">
<property name="serviceEndpointPublisher"><inject bean="WSServiceEndpointPublisher"/></property>
</bean>
- <bean name="WSPublishContractDeployer" class="org.jboss.ws.integration.jboss42.jbossws.PublishContractDeployer"/>
+ <bean name="WSPublishContractDeployer" class="org.jboss.ws.core.deployment.PublishContractDeployer"/>
<bean name="WSUnifiedDeploymentInfoDeployer" class="org.jboss.ws.integration.jboss42.jbossws.UnifiedDeploymentInfoDeployer">
<property name="deploymentInfoAdapter"><inject bean="WSDeploymentInfoAdapter"/></property>
</bean>
- <bean name="WSUnifiedMetaDataAssociationDeployer" class="org.jboss.ws.integration.jboss42.jbossws.UnifiedMetaDataAssociationDeployer"/>
- <bean name="WSUnifiedMetaDataDeployer" class="org.jboss.ws.integration.jboss42.jbossws.UnifiedMetaDataDeployer"/>
+ <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">
<property name="serviceEndpointPublisher"><inject bean="WSServiceEndpointPublisher"/></property>
</bean>
<!-- Deployer helper beans -->
- <bean name="WSServiceEndpointPublisher" class="org.jboss.ws.core.server.ServiceEndpointPublisher">
- <property name="servletClass">org.jboss.ws.integration.jboss42.jbossws.ServiceEndpointServlet</property>
+ <bean name="WSServiceEndpointPublisher" class="org.jboss.ws.core.deployment.ServiceEndpointPublisher">
+ <property name="servletClass">org.jboss.ws.core.server.ServiceEndpointServlet</property>
</bean>
<bean name="WSDeploymentInfoAdapter" class="org.jboss.ws.integration.jboss42.jbossws.DeploymentInfoAdapter">
<property name="appMetaDataAdapter"><inject bean="WSAppMetaDataAdapter"/></property>
Deleted: trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/AbstractInvocationHandler.java
===================================================================
--- trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/AbstractInvocationHandler.java 2007-05-04 10:28:42 UTC (rev 2958)
+++ trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/AbstractInvocationHandler.java 2007-05-04 12:20:09 UTC (rev 2959)
@@ -1,431 +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.jbossws;
-
-// $Id$
-
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.lang.reflect.UndeclaredThrowableException;
-import java.util.HashMap;
-
-import javax.activation.DataHandler;
-import javax.management.MBeanException;
-import javax.xml.namespace.QName;
-import javax.xml.rpc.soap.SOAPFaultException;
-import javax.xml.soap.Name;
-import javax.xml.soap.SOAPBody;
-import javax.xml.soap.SOAPBodyElement;
-import javax.xml.soap.SOAPException;
-import javax.xml.soap.SOAPHeader;
-import javax.xml.ws.http.HTTPBinding;
-
-import org.jboss.logging.Logger;
-import org.jboss.ws.Constants;
-import org.jboss.ws.core.CommonBinding;
-import org.jboss.ws.core.CommonBindingProvider;
-import org.jboss.ws.core.CommonMessageContext;
-import org.jboss.ws.core.CommonSOAPBinding;
-import org.jboss.ws.core.DirectionHolder;
-import org.jboss.ws.core.EndpointInvocation;
-import org.jboss.ws.core.MessageAbstraction;
-import org.jboss.ws.core.DirectionHolder.Direction;
-import org.jboss.ws.core.jaxrpc.handler.HandlerDelegateJAXRPC;
-import org.jboss.ws.core.jaxrpc.handler.MessageContextJAXRPC;
-import org.jboss.ws.core.jaxws.binding.BindingProviderImpl;
-import org.jboss.ws.core.jaxws.handler.HandlerDelegateJAXWS;
-import org.jboss.ws.core.jaxws.handler.MessageContextJAXWS;
-import org.jboss.ws.core.server.ServerHandlerDelegate;
-import org.jboss.ws.core.soap.MessageContextAssociation;
-import org.jboss.ws.core.soap.SOAPMessageImpl;
-import org.jboss.ws.core.utils.JavaUtils;
-import org.jboss.ws.extensions.xop.XOPContext;
-import org.jboss.ws.integration.Endpoint;
-import org.jboss.ws.integration.invocation.InvocationContext;
-import org.jboss.ws.integration.invocation.InvocationHandler;
-import org.jboss.ws.metadata.umdm.EndpointMetaData;
-import org.jboss.ws.metadata.umdm.OperationMetaData;
-import org.jboss.ws.metadata.umdm.ServerEndpointMetaData;
-import org.jboss.ws.metadata.umdm.HandlerMetaData.HandlerType;
-
-/** An implementation handles invocations on the endpoint
- *
- * @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 Endpoint endpoint;
- protected CommonBindingProvider bindingProvider;
- protected ServerHandlerDelegate delegate;
-
- /** Initialize the service endpoint */
- public void init(Endpoint endpoint)
- {
- this.endpoint = endpoint;
-
- ServerEndpointMetaData sepMetaData = endpoint.getMetaData(ServerEndpointMetaData.class);
- if (sepMetaData == null)
- throw new IllegalStateException("Cannot obtain endpoint meta data");
-
- if (sepMetaData.getType() == EndpointMetaData.Type.JAXRPC)
- {
- bindingProvider = new CommonBindingProvider(sepMetaData);
- delegate = new HandlerDelegateJAXRPC(sepMetaData);
- }
- else
- {
- bindingProvider = new BindingProviderImpl(sepMetaData);
- delegate = new HandlerDelegateJAXWS(sepMetaData);
- }
- }
-
- /** Load the SEI implementation bean if necessary */
- protected abstract Class loadServiceEndpoint() throws ClassNotFoundException;
-
- /** Create the instance of the SEI implementation bean if necessary */
- protected abstract Object createServiceEndpointInstance(Class seiImplClass, InvocationContext context) throws Exception;
-
- /** Invoke the instance of the SEI implementation bean */
- protected abstract void invokeServiceEndpointInstance(Object seiImpl, EndpointInvocation epInv) throws Exception;
-
- /** Destroy the instance of the SEI implementation bean if necessary */
- protected abstract void destroyServiceEndpointInstance(Object seiImpl);
-
- public boolean callRequestHandlerChain(ServerEndpointMetaData sepMetaData, HandlerType type)
- {
- return delegate.callRequestHandlerChain(sepMetaData, type);
- }
-
- public boolean callResponseHandlerChain(ServerEndpointMetaData sepMetaData, HandlerType type)
- {
- return delegate.callResponseHandlerChain(sepMetaData, type);
- }
-
- public void closeHandlerChain(ServerEndpointMetaData sepMetaData, HandlerType type)
- {
- delegate.closeHandlerChain(sepMetaData, type);
- }
-
- public boolean callFaultHandlerChain(ServerEndpointMetaData sepMetaData, HandlerType type, Exception ex)
- {
- return delegate.callFaultHandlerChain(sepMetaData, type, ex);
- }
-
- /** Invoke the the service endpoint */
- public void invoke(InvocationContext reqContext) throws Exception
- {
- CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
- ServerEndpointMetaData sepMetaData = (ServerEndpointMetaData)msgContext.getEndpointMetaData();
- MessageAbstraction reqMessage = msgContext.getMessageAbstraction();
-
- // Load the endpoint implementation bean
- Class seImpl = loadServiceEndpoint();
-
- // Create an instance of the endpoint implementation bean
- Object seInstance = createServiceEndpointInstance(seImpl, reqContext);
-
- // The direction of the message
- DirectionHolder direction = new DirectionHolder(Direction.InBound);
-
- // Get the order of pre/post handlerchains
- HandlerType[] handlerType = delegate.getHandlerTypeOrder();
- HandlerType[] faultType = delegate.getHandlerTypeOrder();
-
- // Set the required inbound context properties
- setInboundContextProperties();
-
- try
- {
- boolean oneway = false;
- EndpointInvocation epInv = null;
- OperationMetaData opMetaData = null;
- CommonBinding binding = bindingProvider.getCommonBinding();
- binding.setHeaderSource(delegate);
-
- // call the request handler chain
- boolean handlersPass = callRequestHandlerChain(sepMetaData, handlerType[0]);
-
- // Unbind the request message
- if (handlersPass)
- {
- // Get the operation meta data from the SOAP message
- opMetaData = getDispatchDestination(sepMetaData, reqMessage);
- msgContext.setOperationMetaData(opMetaData);
- oneway = opMetaData.isOneWay();
-
- /*
- * From JAX-WS 10.2.1 - "7. If the node does not understand how to process
- * the message, then neither handlers nor the endpoint
- * are invoked and instead the binding generates a SOAP must
- * understand exception"
- *
- * Therefore, this must precede the ENDPOINT chain; however, The PRE
- * chain still must happen first since the message may be encrypted, in which
- * case the operation is still not known. Without knowing the operation, it
- * is not possible to determine what headers are understood by the endpoint.
- */
- if (binding instanceof CommonSOAPBinding)
- ((CommonSOAPBinding)binding).checkMustUnderstand(opMetaData);
-
- // Unbind the request message
- epInv = binding.unbindRequestMessage(opMetaData, reqMessage);
- }
-
- handlersPass = handlersPass && callRequestHandlerChain(sepMetaData, handlerType[1]);
- handlersPass = handlersPass && callRequestHandlerChain(sepMetaData, handlerType[2]);
-
- if (handlersPass)
- {
- msgContext.put(CommonMessageContext.ALLOW_EXPAND_TO_DOM, Boolean.TRUE);
- try
- {
- // Check if protocol handlers modified the payload
- if (msgContext.isModified())
- {
- log.debug("Handler modified payload, unbind message again");
- reqMessage = msgContext.getMessageAbstraction();
- epInv = binding.unbindRequestMessage(opMetaData, reqMessage);
- }
-
- // Invoke the service endpoint
- invokeServiceEndpointInstance(seInstance, epInv);
- }
- finally
- {
- msgContext.remove(CommonMessageContext.ALLOW_EXPAND_TO_DOM);
- }
-
- // Reverse the message direction
- msgContext = processPivotInternal(msgContext, direction);
-
- // Set the required outbound context properties
- setOutboundContextProperties();
-
- if (binding instanceof CommonSOAPBinding)
- XOPContext.setMTOMEnabled(((CommonSOAPBinding)binding).isMTOMEnabled());
-
- // Bind the response message
- MessageAbstraction resMessage = binding.bindResponseMessage(opMetaData, epInv);
- msgContext.setMessageAbstraction(resMessage);
- }
- else
- {
- // Reverse the message direction without calling the endpoint
- MessageAbstraction resMessage = msgContext.getMessageAbstraction();
- msgContext = processPivotInternal(msgContext, direction);
- msgContext.setMessageAbstraction(resMessage);
- }
-
- if (oneway == false)
- {
- // call the response handler chain, removing the fault type entry will not call handleFault for that chain
- handlersPass = callResponseHandlerChain(sepMetaData, handlerType[2]);
- faultType[2] = null;
- handlersPass = handlersPass && callResponseHandlerChain(sepMetaData, handlerType[1]);
- faultType[1] = null;
- handlersPass = handlersPass && callResponseHandlerChain(sepMetaData, handlerType[0]);
- faultType[0] = null;
- }
- }
- catch (RuntimeException ex)
- {
- // Reverse the message direction
- processPivotInternal(msgContext, direction);
-
- try
- {
- CommonBinding binding = bindingProvider.getCommonBinding();
- binding.bindFaultMessage(ex);
-
- // call the fault handler chain
- boolean handlersPass = true;
- if (faultType[2] != null)
- handlersPass = handlersPass && callFaultHandlerChain(sepMetaData, faultType[2], ex);
- if (faultType[1] != null)
- handlersPass = handlersPass && callFaultHandlerChain(sepMetaData, faultType[1], ex);
- if (faultType[0] != null)
- handlersPass = handlersPass && callFaultHandlerChain(sepMetaData, faultType[0], ex);
- }
- catch (RuntimeException subEx)
- {
- log.warn("Exception while processing handleFault: ", ex);
- ex = subEx;
- }
- throw ex;
- }
- finally
- {
- closeHandlerChain(sepMetaData, handlerType[2]);
- closeHandlerChain(sepMetaData, handlerType[1]);
- closeHandlerChain(sepMetaData, handlerType[0]);
-
- destroyServiceEndpointInstance(seInstance);
- }
- }
-
- protected void setInboundContextProperties()
- {
- CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
- if (msgContext instanceof MessageContextJAXWS)
- {
- // Map of attachments to a message for the outbound message, key is the MIME Content-ID, value is a DataHandler
- msgContext.put(MessageContextJAXWS.INBOUND_MESSAGE_ATTACHMENTS, new HashMap<String, DataHandler>());
- }
- }
-
- protected void setOutboundContextProperties()
- {
- CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
- if (msgContext instanceof MessageContextJAXWS)
- {
- // Map of attachments to a message for the outbound message, key is the MIME Content-ID, value is a DataHandler
- msgContext.put(MessageContextJAXWS.OUTBOUND_MESSAGE_ATTACHMENTS, new HashMap<String, DataHandler>());
- }
- }
-
- private CommonMessageContext processPivotInternal(CommonMessageContext msgContext, DirectionHolder direction)
- {
- if (direction.getDirection() == Direction.InBound)
- {
- EndpointMetaData epMetaData = msgContext.getEndpointMetaData();
- if (epMetaData.getType() == EndpointMetaData.Type.JAXRPC)
- {
- msgContext = MessageContextJAXRPC.processPivot(msgContext);
- }
- else
- {
- msgContext = MessageContextJAXWS.processPivot(msgContext);
- }
- direction.setDirection(Direction.OutBound);
- }
- return msgContext;
- }
-
- private OperationMetaData getDispatchDestination(EndpointMetaData epMetaData, MessageAbstraction reqMessage) throws SOAPException
- {
- OperationMetaData opMetaData;
-
- String bindingID = epMetaData.getBindingId();
- if (HTTPBinding.HTTP_BINDING.equals(bindingID))
- {
- if (epMetaData.getOperations().size() != 1)
- throw new IllegalStateException("Multiple operations not supported for HTTP binding");
-
- opMetaData = epMetaData.getOperations().get(0);
- }
- else
- {
- SOAPMessageImpl soapMessage = (SOAPMessageImpl)reqMessage;
-
- opMetaData = soapMessage.getOperationMetaData(epMetaData);
- SOAPHeader soapHeader = soapMessage.getSOAPHeader();
-
- // Report a MustUnderstand fault
- if (opMetaData == null)
- {
- String faultString;
- SOAPBody soapBody = soapMessage.getSOAPBody();
- if (soapBody.getChildElements().hasNext())
- {
- SOAPBodyElement soapBodyElement = (SOAPBodyElement)soapBody.getChildElements().next();
- Name soapName = soapBodyElement.getElementName();
- faultString = "Endpoint " + epMetaData.getPortName() + " does not contain operation meta data for: " + soapName;
- }
- else
- {
- faultString = "Endpoint " + epMetaData.getPortName() + " does not contain operation meta data for empty soap body";
- }
-
- // R2724 If an INSTANCE receives a message that is inconsistent with its WSDL description, it SHOULD generate a soap:Fault
- // with a faultcode of "Client", unless a "MustUnderstand" or "VersionMismatch" fault is generated.
- if (soapHeader != null && soapHeader.examineMustUnderstandHeaderElements(Constants.URI_SOAP11_NEXT_ACTOR).hasNext())
- {
- QName faultCode = Constants.SOAP11_FAULT_CODE_MUST_UNDERSTAND;
- throw new SOAPFaultException(faultCode, faultString, null, null);
- }
- else
- {
- QName faultCode = Constants.SOAP11_FAULT_CODE_CLIENT;
- throw new SOAPFaultException(faultCode, faultString, null, null);
- }
- }
- }
- return opMetaData;
- }
-
- 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;
- }
-
- /** handle invocation exceptions */
- public 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);
- }
- }
-}
Deleted: trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/AbstractServiceEndpointServlet.java
===================================================================
--- trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/AbstractServiceEndpointServlet.java 2007-05-04 10:28:42 UTC (rev 2958)
+++ trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/AbstractServiceEndpointServlet.java 2007-05-04 12:20:09 UTC (rev 2959)
@@ -1,178 +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.jbossws;
-
-// $Id$
-
-import java.io.IOException;
-import java.io.Writer;
-
-import javax.management.ObjectName;
-import javax.servlet.ServletConfig;
-import javax.servlet.ServletException;
-import javax.servlet.ServletInputStream;
-import javax.servlet.ServletOutputStream;
-import javax.servlet.http.HttpServlet;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import javax.xml.rpc.JAXRPCException;
-
-import org.jboss.logging.Logger;
-import org.jboss.ws.WSException;
-import org.jboss.ws.core.server.ServletRequestContext;
-import org.jboss.ws.integration.Endpoint;
-import org.jboss.ws.integration.ObjectNameFactory;
-import org.jboss.ws.integration.RequestHandler;
-import org.jboss.ws.integration.management.EndpointRegistry;
-import org.jboss.ws.integration.management.EndpointRegistryFactory;
-
-/**
- * A servlet that is installed for every web service endpoint.
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 25-Apr-2007
- */
-public abstract class AbstractServiceEndpointServlet extends HttpServlet
-{
- // provide logging
- private static final Logger log = Logger.getLogger(AbstractServiceEndpointServlet.class);
-
- protected Endpoint endpoint;
- protected EndpointRegistry epRegistry;
-
- public void init(ServletConfig config) throws ServletException
- {
- super.init(config);
- epRegistry = EndpointRegistryFactory.getEndpointRegistry();
- }
-
- public void destroy()
- {
- super.destroy();
- }
-
- public void service(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException
- {
- if (endpoint == null)
- {
- String contextPath = req.getContextPath();
- initServiceEndpoint(contextPath);
- }
- super.service(req, res);
- }
-
- public void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException
- {
- // Process a WSDL request
- if (req.getParameter("wsdl") != null || req.getParameter("WSDL") != null)
- {
- res.setContentType("text/xml");
- try
- {
- RequestHandler requestHandler = endpoint.getRequestHandler();
- ServletRequestContext context = new ServletRequestContext(getServletContext(), req, res);
- requestHandler.handleWSDLRequest(endpoint, res.getOutputStream(), context);
- }
- catch (Exception ex)
- {
- handleException(ex);
- }
- }
- else
- {
- res.setStatus(405);
- res.setContentType("text/plain");
- Writer out = res.getWriter();
- out.write("HTTP GET not supported");
- out.flush();
- out.close();
- }
- }
-
- public void doPost(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException
- {
- log.debug("doPost: " + req.getRequestURI());
-
- ServletInputStream inputStream = req.getInputStream();
- ServletOutputStream outputStream = res.getOutputStream();
- try
- {
- RequestHandler requestHandler = endpoint.getRequestHandler();
- ServletRequestContext context = new ServletRequestContext(getServletContext(), req, res);
- requestHandler.handleRequest(endpoint, inputStream, outputStream, context);
- }
- catch (Exception ex)
- {
- handleException(ex);
- }
- finally
- {
- try
- {
- outputStream.flush();
- outputStream.close();
- }
- catch (IOException ioex)
- {
- log.error("Cannot flush output stream");
- }
-
- }
- }
-
- private void handleException(Exception ex) throws ServletException
- {
- log.error("Error processing web service request", ex);
-
- if (ex instanceof JAXRPCException)
- throw (JAXRPCException)ex;
-
- throw new ServletException(ex);
- }
-
- /** Initialize the service endpoint
- */
- protected void initServiceEndpoint(String contextPath)
- {
- String servletName = getServletName();
- if (contextPath.startsWith("/"))
- contextPath = contextPath.substring(1);
-
- for (ObjectName sepId : epRegistry.getEndpoints())
- {
- String propContext = sepId.getKeyProperty(Endpoint.SEPID_PROPERTY_CONTEXT);
- String propEndpoint = sepId.getKeyProperty(Endpoint.SEPID_PROPERTY_ENDPOINT);
- if (servletName.equals(propEndpoint) && contextPath.equals(propContext))
- {
- endpoint = epRegistry.getEndpoint(sepId);
- break;
- }
- }
-
- if (endpoint == null)
- {
- ObjectName oname = ObjectNameFactory.create(Endpoint.SEPID_DOMAIN + ":" + Endpoint.SEPID_PROPERTY_CONTEXT + "=" + contextPath + ","
- + Endpoint.SEPID_PROPERTY_ENDPOINT + "=" + servletName);
- throw new WSException("Cannot obtain endpoint for: " + oname);
- }
- }
-}
Modified: trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/ApplicationMetaDataAdaptor.java
===================================================================
--- trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/ApplicationMetaDataAdaptor.java 2007-05-04 10:28:42 UTC (rev 2958)
+++ trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/ApplicationMetaDataAdaptor.java 2007-05-04 12:20:09 UTC (rev 2959)
@@ -36,7 +36,7 @@
import org.jboss.metadata.SessionMetaData;
import org.jboss.metadata.ApplicationMetaData.WebserviceDescription;
import org.jboss.metadata.ApplicationMetaData.Webservices;
-import org.jboss.ws.core.server.UnifiedDeploymentInfo;
+import org.jboss.ws.core.deployment.UnifiedDeploymentInfo;
import org.jboss.ws.metadata.j2ee.UnifiedApplicationMetaData;
import org.jboss.ws.metadata.j2ee.UnifiedBeanMetaData;
import org.jboss.ws.metadata.j2ee.UnifiedEjbPortComponentMetaData;
Modified: trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/ApplicationMetaDataAdaptorEJB3.java
===================================================================
--- trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/ApplicationMetaDataAdaptorEJB3.java 2007-05-04 10:28:42 UTC (rev 2958)
+++ trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/ApplicationMetaDataAdaptorEJB3.java 2007-05-04 12:20:09 UTC (rev 2959)
@@ -39,7 +39,7 @@
import org.jboss.ejb3.metamodel.WebserviceDescription;
import org.jboss.ejb3.metamodel.Webservices;
import org.jboss.logging.Logger;
-import org.jboss.ws.core.server.UnifiedDeploymentInfo;
+import org.jboss.ws.core.deployment.UnifiedDeploymentInfo;
import org.jboss.ws.metadata.j2ee.UnifiedApplicationMetaData;
import org.jboss.ws.metadata.j2ee.UnifiedBeanMetaData;
import org.jboss.ws.metadata.j2ee.UnifiedEjbPortComponentMetaData;
Modified: trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/DeploymentInfoAdapter.java
===================================================================
--- trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/DeploymentInfoAdapter.java 2007-05-04 10:28:42 UTC (rev 2958)
+++ trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/DeploymentInfoAdapter.java 2007-05-04 12:20:09 UTC (rev 2959)
@@ -30,7 +30,7 @@
import org.jboss.metadata.ApplicationMetaData;
import org.jboss.metadata.WebMetaData;
import org.jboss.ws.WSException;
-import org.jboss.ws.core.server.UnifiedDeploymentInfo;
+import org.jboss.ws.core.deployment.UnifiedDeploymentInfo;
// $Id$
Deleted: trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/EagerInitializeDeployer.java
===================================================================
--- trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/EagerInitializeDeployer.java 2007-05-04 10:28:42 UTC (rev 2958)
+++ trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/EagerInitializeDeployer.java 2007-05-04 12:20:09 UTC (rev 2959)
@@ -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.jboss50.jbossws;
-
-//$Id$
-
-import org.jboss.ws.integration.deployment.AbstractDeployer;
-import org.jboss.ws.integration.deployment.Deployment;
-import org.jboss.ws.metadata.umdm.UnifiedMetaData;
-
-/**
- * A deployer that initializes the UMDM
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 25-Apr-2007
- */
-public class EagerInitializeDeployer extends AbstractDeployer
-{
- @Override
- public void create(Deployment dep)
- {
- UnifiedMetaData umd = dep.getContext().getAttachment(UnifiedMetaData.class);
- if (umd == null)
- throw new IllegalStateException("Cannot obtain unified meta data");
-
- umd.eagerInitialize();
- }
-}
\ No newline at end of file
Deleted: trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/EndpointHandlerDeployer.java
===================================================================
--- trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/EndpointHandlerDeployer.java 2007-05-04 10:28:42 UTC (rev 2958)
+++ trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/EndpointHandlerDeployer.java 2007-05-04 12:20:09 UTC (rev 2959)
@@ -1,115 +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.jbossws;
-
-//$Id$
-
-import java.util.Map;
-
-import org.jboss.ws.integration.Endpoint;
-import org.jboss.ws.integration.LifecycleHandler;
-import org.jboss.ws.integration.RequestHandler;
-import org.jboss.ws.integration.deployment.AbstractDeployer;
-import org.jboss.ws.integration.deployment.Deployment;
-import org.jboss.ws.integration.invocation.InvocationHandler;
-
-/**
- * A deployer that assigns the handlers to the Endpoint
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 25-Apr-2007
- */
-public class EndpointHandlerDeployer extends AbstractDeployer
-{
- private String requestHandler;
- private String lifecycleHandler;
- private Map<String,String> invocationHandler;
-
- public void setLifecycleHandler(String handler)
- {
- this.lifecycleHandler = handler;
- }
-
- public void setRequestHandler(String handler)
- {
- this.requestHandler = handler;
- }
-
- public void setInvocationHandler(Map<String,String> handlers)
- {
- this.invocationHandler = handlers;
- }
-
- @Override
- public void create(Deployment dep)
- {
- for (Endpoint ep : dep.getService().getEndpoints())
- {
- ep.setRequestHandler(getRequestHandler(dep));
- ep.setLifecycleHandler(getLifecycleHandler(dep));
- ep.setInvocationHandler(getInvocationHandler(dep));
- }
- }
-
- private RequestHandler getRequestHandler(Deployment dep)
- {
- try
- {
- Class<?> handlerClass = dep.getClassLoader().loadClass(requestHandler);
- return (RequestHandler)handlerClass.newInstance();
- }
- catch (Exception e)
- {
- throw new IllegalStateException("Cannot load request handler: " + requestHandler);
- }
- }
-
- private LifecycleHandler getLifecycleHandler(Deployment dep)
- {
- try
- {
- Class<?> handlerClass = dep.getClassLoader().loadClass(lifecycleHandler);
- return (LifecycleHandler)handlerClass.newInstance();
- }
- catch (Exception e)
- {
- throw new IllegalStateException("Cannot load lifecycle handler: " + lifecycleHandler);
- }
- }
-
- private InvocationHandler getInvocationHandler(Deployment dep)
- {
- String className = invocationHandler.get(dep.getType().toString());
- if (className == null)
- throw new IllegalStateException("Cannot obtain invocation handler for: " + dep.getType());
-
- try
- {
- Class<?> handlerClass = dep.getClassLoader().loadClass(className);
- return (InvocationHandler)handlerClass.newInstance();
- }
- catch (Exception e)
- {
- throw new IllegalStateException("Cannot load invocation handler: " + className);
- }
- }
-}
\ No newline at end of file
Deleted: trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/EndpointLifecycleDeployer.java
===================================================================
--- trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/EndpointLifecycleDeployer.java 2007-05-04 10:28:42 UTC (rev 2958)
+++ trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/EndpointLifecycleDeployer.java 2007-05-04 12:20:09 UTC (rev 2959)
@@ -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.jboss50.jbossws;
-
-//$Id$
-
-import org.jboss.ws.integration.Endpoint;
-import org.jboss.ws.integration.Service;
-import org.jboss.ws.integration.deployment.AbstractDeployer;
-import org.jboss.ws.integration.deployment.Deployment;
-
-/**
- * A deployer that that calls the endpoint lifecycle handler
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 25-Apr-2007
- */
-public class EndpointLifecycleDeployer extends AbstractDeployer
-{
- @Override
- public void create(Deployment dep)
- {
- for (Endpoint ep : dep.getService().getEndpoints())
- ep.getLifecycleHandler().create(ep);
- }
-
- @Override
- public void start(Deployment dep)
- {
- for (Endpoint ep : dep.getService().getEndpoints())
- {
- ep.getLifecycleHandler().start(ep);
- }
- }
-
- @Override
- public void stop(Deployment dep)
- {
- Service service = dep.getService();
- if (service != null)
- {
- for (Endpoint ep : service.getEndpoints())
- {
- ep.getLifecycleHandler().stop(ep);
- }
- }
- }
-
- @Override
- public void destroy(Deployment dep)
- {
- Service service = dep.getService();
- if (service != null)
- {
- for (Endpoint ep : service.getEndpoints())
- {
- ep.getLifecycleHandler().destroy(ep);
- }
- }
- }
-}
Deleted: trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/EndpointNameDeployer.java
===================================================================
--- trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/EndpointNameDeployer.java 2007-05-04 10:28:42 UTC (rev 2958)
+++ trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/EndpointNameDeployer.java 2007-05-04 12:20:09 UTC (rev 2959)
@@ -1,54 +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.jbossws;
-
-//$Id$
-
-import javax.management.ObjectName;
-
-import org.jboss.ws.integration.Endpoint;
-import org.jboss.ws.integration.deployment.AbstractDeployer;
-import org.jboss.ws.integration.deployment.Deployment;
-import org.jboss.ws.metadata.umdm.ServerEndpointMetaData;
-
-/**
- * A deployer that assigns the complete name to the Endpoint
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 25-Apr-2007
- */
-public class EndpointNameDeployer extends AbstractDeployer
-{
- @Override
- public void create(Deployment dep)
- {
- for (Endpoint ep : dep.getService().getEndpoints())
- {
- ServerEndpointMetaData sepMetaData = ep.getMetaData(ServerEndpointMetaData.class);
- if (sepMetaData == null)
- throw new IllegalStateException("Cannot obtain endpoint meta data");
-
- ObjectName sepID = sepMetaData.getServiceEndpointID();
- ep.setName(sepID);
- }
- }
-}
\ No newline at end of file
Deleted: trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/InvocationHandlerEJB21.java
===================================================================
--- trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/InvocationHandlerEJB21.java 2007-05-04 10:28:42 UTC (rev 2958)
+++ trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/InvocationHandlerEJB21.java 2007-05-04 12:20:09 UTC (rev 2959)
@@ -1,282 +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.jbossws;
-
-// $Id$
-
-import java.lang.reflect.Method;
-import java.security.Principal;
-
-import javax.management.MBeanServer;
-import javax.management.ObjectName;
-
-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.security.SecurityContext;
-import org.jboss.security.plugins.SecurityContextAssociation;
-import org.jboss.security.plugins.SecurityContextFactory;
-import org.jboss.ws.WSException;
-import org.jboss.ws.core.CommonMessageContext;
-import org.jboss.ws.core.EndpointInvocation;
-import org.jboss.ws.core.jaxrpc.handler.HandlerCallback;
-import org.jboss.ws.core.jaxrpc.handler.SOAPMessageContextJAXRPC;
-import org.jboss.ws.core.server.UnifiedDeploymentInfo;
-import org.jboss.ws.core.soap.MessageContextAssociation;
-import org.jboss.ws.integration.Endpoint;
-import org.jboss.ws.integration.ObjectNameFactory;
-import org.jboss.ws.integration.invocation.InvocationContext;
-import org.jboss.ws.integration.jboss50.AbstractWebServiceDeployer;
-import org.jboss.ws.metadata.j2ee.UnifiedApplicationMetaData;
-import org.jboss.ws.metadata.j2ee.UnifiedBeanMetaData;
-import org.jboss.ws.metadata.umdm.ServerEndpointMetaData;
-import org.jboss.ws.metadata.umdm.EndpointMetaData.Type;
-import org.jboss.ws.metadata.umdm.HandlerMetaData.HandlerType;
-
-/**
- * Handles invocations on EJB21 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;
-
- /** Initialize the service endpoint */
- @Override
- public void init(Endpoint endpoint)
- {
- super.init(endpoint);
-
- server = MBeanServerLocator.locateJBoss();
-
- ServerEndpointMetaData sepMetaData = endpoint.getMetaData(ServerEndpointMetaData.class);
- if (sepMetaData == null)
- throw new IllegalStateException("Cannot obtain endpoint meta data");
-
- String ejbName = sepMetaData.getLinkName();
- if (ejbName == null)
- throw new WSException("Cannot obtain ejb-link from port component");
-
- UnifiedDeploymentInfo udi = endpoint.getService().getDeployment().getContext().getAttachment(UnifiedDeploymentInfo.class);
- UnifiedApplicationMetaData applMetaData = (UnifiedApplicationMetaData)udi.metaData;
- UnifiedBeanMetaData beanMetaData = (UnifiedBeanMetaData)applMetaData.getBeanByEjbName(ejbName);
- if (beanMetaData == null)
- throw new WSException("Cannot obtain ejb meta data for: " + ejbName);
-
- // verify the service endpoint
- String seiName = sepMetaData.getServiceEndpointInterfaceName();
- if (sepMetaData.getType() == Type.JAXRPC && seiName != null)
- {
- String bmdSEI = beanMetaData.getServiceEndpointInterface();
- if (seiName.equals(bmdSEI) == false)
- throw new WSException("Endpoint meta data defines SEI '" + seiName + "', <service-endpoint> in ejb-jar.xml defines '" + bmdSEI + "'");
- }
-
- // get the bean's JNDI name
- jndiName = beanMetaData.getContainerObjectNameJndiName();
- if (jndiName == null)
- throw new WSException("Cannot obtain JNDI name for: " + ejbName);
-
- objectName = ObjectNameFactory.create("jboss.j2ee:jndiName=" + jndiName + ",service=EJB");
-
- // 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);
- }
- }
-
- /** Load the SEI implementation bean if necessary
- */
- public Class loadServiceEndpoint()
- {
- if (server.isRegistered(objectName) == false)
- throw new WSException("Cannot find service endpoint target: " + objectName);
-
- return null;
- }
-
- /** Create an instance of the SEI implementation bean if necessary */
- @Override
- protected Object createServiceEndpointInstance(Class seiImplClass, InvocationContext context) throws Exception
- {
- return null;
- }
-
- /** Invoke an instance of the SEI implementation bean */
- public void invokeServiceEndpointInstance(Object seiImpl, EndpointInvocation epInv) throws Exception
- {
- log.debug("invokeServiceEndpoint: " + epInv.getJavaMethod().getName());
-
- // these are provided by the ServerLoginHandler
- Principal principal = SecurityAssociation.getPrincipal();
- Object credential = SecurityAssociation.getCredential();
-
- CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
-
- // invoke on the container
- try
- {
- // setup the invocation
- Method method = epInv.getJavaMethod();
- Object[] args = epInv.getRequestPayload();
- Invocation inv = new Invocation(null, method, args, null, principal, credential);
-
- // Copy the SecurityContext
- if (principal != null)
- {
- SecurityContext sc = SecurityContextAssociation.getSecurityContext();
- if (sc == null)
- {
- log.error("Cannot obtain SecurityContext from container that hosts the endpoint");
- sc = SecurityContextFactory.createSecurityContext(principal, credential, null, null);
- }
- inv.setSecurityContext(sc);
- }
-
- // EJB2.1 endpoints will only get an JAXRPC context
- if ((msgContext instanceof javax.xml.rpc.handler.MessageContext) == false)
- msgContext = new SOAPMessageContextJAXRPC(msgContext);
-
- inv.setValue(InvocationKey.SOAP_MESSAGE_CONTEXT, msgContext);
- inv.setValue(InvocationKey.SOAP_MESSAGE, msgContext.getSOAPMessage());
- inv.setType(InvocationType.SERVICE_ENDPOINT);
-
- // Set the handler callback and endpoint invocation
- ServerEndpointMetaData sepMetaData = endpoint.getMetaData(ServerEndpointMetaData.class);
- inv.setValue(HandlerCallback.class.getName(), new HandlerCallbackImpl(sepMetaData), PayloadKey.TRANSIENT);
- inv.setValue(EndpointInvocation.class.getName(), epInv, PayloadKey.TRANSIENT);
-
- String[] sig = { Invocation.class.getName() };
- Object retObj = server.invoke(objectName, "invoke", new Object[] { inv }, sig);
- epInv.setReturnValue(retObj);
- }
- catch (Exception e)
- {
- handleInvocationException(e);
- }
- }
-
- /** Create an instance of the SEI implementation bean if necessary */
- public void destroyServiceEndpointInstance(Object seiImpl)
- {
- // do nothing
- }
-
- /** Handlers are beeing called through the HandlerCallback from the EJB interceptor */
- @Override
- public boolean callRequestHandlerChain(ServerEndpointMetaData sepMetaData, HandlerType type)
- {
- if (type == HandlerType.PRE)
- return delegate.callRequestHandlerChain(sepMetaData, type);
- else return true;
- }
-
- /** Handlers are beeing called through the HandlerCallback from the EJB interceptor */
- public boolean callResponseHandlerChain(ServerEndpointMetaData sepMetaData, HandlerType type)
- {
- if (type == HandlerType.PRE)
- return delegate.callResponseHandlerChain(sepMetaData, type);
- else return true;
- }
-
- /** Handlers are beeing called through the HandlerCallback from the EJB interceptor */
- public boolean callFaultHandlerChain(ServerEndpointMetaData sepMetaData, HandlerType type, Exception ex)
- {
- if (type == HandlerType.PRE)
- return delegate.callFaultHandlerChain(sepMetaData, type, ex);
- else return true;
- }
-
- // The ServiceEndpointInterceptor calls the methods in this callback
- public class HandlerCallbackImpl implements HandlerCallback
- {
- private ServerEndpointMetaData sepMetaData;
-
- public HandlerCallbackImpl(ServerEndpointMetaData sepMetaData)
- {
- this.sepMetaData = sepMetaData;
- }
-
- /** Handlers are beeing called through the HandlerCallback from the EJB interceptor */
- public boolean callRequestHandlerChain(HandlerType type)
- {
- if (type == HandlerType.PRE)
- return true;
- else return delegate.callRequestHandlerChain(sepMetaData, type);
- }
-
- /** Handlers are beeing called through the HandlerCallback from the EJB interceptor */
- public boolean callResponseHandlerChain(HandlerType type)
- {
- if (type == HandlerType.PRE)
- return true;
- else return delegate.callResponseHandlerChain(sepMetaData, type);
- }
-
- /** Handlers are beeing called through the HandlerCallback from the EJB interceptor */
- public boolean callFaultHandlerChain(HandlerType type, Exception ex)
- {
- if (type == HandlerType.PRE)
- return true;
- else return delegate.callFaultHandlerChain(sepMetaData, type, ex);
- }
- }
-}
Added: trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/InvocationHandlerEJB21.java
===================================================================
--- trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/InvocationHandlerEJB21.java (rev 0)
+++ trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/InvocationHandlerEJB21.java 2007-05-04 12:20:09 UTC (rev 2959)
@@ -0,0 +1,267 @@
+/*
+ * 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.jbossws;
+
+// $Id$
+
+import java.lang.reflect.Method;
+import java.security.Principal;
+
+import javax.management.MBeanServer;
+import javax.management.ObjectName;
+
+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.WSException;
+import org.jboss.ws.core.CommonMessageContext;
+import org.jboss.ws.core.EndpointInvocation;
+import org.jboss.ws.core.deployment.UnifiedDeploymentInfo;
+import org.jboss.ws.core.jaxrpc.handler.HandlerCallback;
+import org.jboss.ws.core.jaxrpc.handler.SOAPMessageContextJAXRPC;
+import org.jboss.ws.core.server.AbstractInvocationHandler;
+import org.jboss.ws.core.soap.MessageContextAssociation;
+import org.jboss.ws.integration.Endpoint;
+import org.jboss.ws.integration.ObjectNameFactory;
+import org.jboss.ws.integration.invocation.InvocationContext;
+import org.jboss.ws.metadata.j2ee.UnifiedApplicationMetaData;
+import org.jboss.ws.metadata.j2ee.UnifiedBeanMetaData;
+import org.jboss.ws.metadata.umdm.ServerEndpointMetaData;
+import org.jboss.ws.metadata.umdm.EndpointMetaData.Type;
+import org.jboss.ws.metadata.umdm.HandlerMetaData.HandlerType;
+
+/**
+ * Handles invocations on EJB21 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;
+
+ /** Initialize the service endpoint */
+ @Override
+ public void init(Endpoint endpoint)
+ {
+ super.init(endpoint);
+
+ server = MBeanServerLocator.locateJBoss();
+
+ ServerEndpointMetaData sepMetaData = endpoint.getMetaData(ServerEndpointMetaData.class);
+ if (sepMetaData == null)
+ throw new IllegalStateException("Cannot obtain endpoint meta data");
+
+ String ejbName = sepMetaData.getLinkName();
+ if (ejbName == null)
+ throw new WSException("Cannot obtain ejb-link from port component");
+
+ UnifiedDeploymentInfo udi = endpoint.getService().getDeployment().getContext().getAttachment(UnifiedDeploymentInfo.class);
+ UnifiedApplicationMetaData applMetaData = (UnifiedApplicationMetaData)udi.metaData;
+ UnifiedBeanMetaData beanMetaData = (UnifiedBeanMetaData)applMetaData.getBeanByEjbName(ejbName);
+ if (beanMetaData == null)
+ throw new WSException("Cannot obtain ejb meta data for: " + ejbName);
+
+ // verify the service endpoint
+ String seiName = sepMetaData.getServiceEndpointInterfaceName();
+ if (sepMetaData.getType() == Type.JAXRPC && seiName != null)
+ {
+ String bmdSEI = beanMetaData.getServiceEndpointInterface();
+ if (seiName.equals(bmdSEI) == false)
+ throw new WSException("Endpoint meta data defines SEI '" + seiName + "', <service-endpoint> in ejb-jar.xml defines '" + bmdSEI + "'");
+ }
+
+ // get the bean's JNDI name
+ jndiName = beanMetaData.getContainerObjectNameJndiName();
+ if (jndiName == null)
+ throw new WSException("Cannot obtain JNDI name for: " + ejbName);
+
+ objectName = ObjectNameFactory.create("jboss.j2ee:jndiName=" + jndiName + ",service=EJB");
+
+ // 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);
+ }
+ }
+
+ /** Load the SEI implementation bean if necessary
+ */
+ public Class loadServiceEndpoint()
+ {
+ if (server.isRegistered(objectName) == false)
+ throw new WSException("Cannot find service endpoint target: " + objectName);
+
+ return null;
+ }
+
+ /** Create an instance of the SEI implementation bean if necessary */
+ @Override
+ protected Object createServiceEndpointInstance(Class seiImplClass, InvocationContext context) throws Exception
+ {
+ return null;
+ }
+
+ /** Invoke an instance of the SEI implementation bean */
+ public void invokeServiceEndpointInstance(Object seiImpl, EndpointInvocation epInv) throws Exception
+ {
+ log.debug("invokeServiceEndpoint: " + epInv.getJavaMethod().getName());
+
+ // these are provided by the ServerLoginHandler
+ Principal principal = SecurityAssociation.getPrincipal();
+ Object credential = SecurityAssociation.getCredential();
+
+ CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
+
+ // invoke on the container
+ try
+ {
+ // setup the invocation
+ Method method = epInv.getJavaMethod();
+ Object[] args = epInv.getRequestPayload();
+ Invocation inv = new Invocation(null, method, args, null, principal, credential);
+
+ // EJB2.1 endpoints will only get an JAXRPC context
+ if ((msgContext instanceof javax.xml.rpc.handler.MessageContext) == false)
+ msgContext = new SOAPMessageContextJAXRPC(msgContext);
+
+ inv.setValue(InvocationKey.SOAP_MESSAGE_CONTEXT, msgContext);
+ inv.setValue(InvocationKey.SOAP_MESSAGE, msgContext.getSOAPMessage());
+ inv.setType(InvocationType.SERVICE_ENDPOINT);
+
+ // Set the handler callback and endpoint invocation
+ ServerEndpointMetaData sepMetaData = endpoint.getMetaData(ServerEndpointMetaData.class);
+ inv.setValue(HandlerCallback.class.getName(), new HandlerCallbackImpl(sepMetaData), PayloadKey.TRANSIENT);
+ inv.setValue(EndpointInvocation.class.getName(), epInv, PayloadKey.TRANSIENT);
+
+ String[] sig = { Invocation.class.getName() };
+ Object retObj = server.invoke(objectName, "invoke", new Object[] { inv }, sig);
+ epInv.setReturnValue(retObj);
+ }
+ catch (Exception e)
+ {
+ handleInvocationException(e);
+ }
+ }
+
+ /** Create an instance of the SEI implementation bean if necessary */
+ public void destroyServiceEndpointInstance(Object seiImpl)
+ {
+ // do nothing
+ }
+
+ /** Handlers are beeing called through the HandlerCallback from the EJB interceptor */
+ @Override
+ public boolean callRequestHandlerChain(ServerEndpointMetaData sepMetaData, HandlerType type)
+ {
+ if (type == HandlerType.PRE)
+ return delegate.callRequestHandlerChain(sepMetaData, type);
+ else return true;
+ }
+
+ /** Handlers are beeing called through the HandlerCallback from the EJB interceptor */
+ public boolean callResponseHandlerChain(ServerEndpointMetaData sepMetaData, HandlerType type)
+ {
+ if (type == HandlerType.PRE)
+ return delegate.callResponseHandlerChain(sepMetaData, type);
+ else return true;
+ }
+
+ /** Handlers are beeing called through the HandlerCallback from the EJB interceptor */
+ public boolean callFaultHandlerChain(ServerEndpointMetaData sepMetaData, HandlerType type, Exception ex)
+ {
+ if (type == HandlerType.PRE)
+ return delegate.callFaultHandlerChain(sepMetaData, type, ex);
+ else return true;
+ }
+
+ // The ServiceEndpointInterceptor calls the methods in this callback
+ public class HandlerCallbackImpl implements HandlerCallback
+ {
+ private ServerEndpointMetaData sepMetaData;
+
+ public HandlerCallbackImpl(ServerEndpointMetaData sepMetaData)
+ {
+ this.sepMetaData = sepMetaData;
+ }
+
+ /** Handlers are beeing called through the HandlerCallback from the EJB interceptor */
+ public boolean callRequestHandlerChain(HandlerType type)
+ {
+ if (type == HandlerType.PRE)
+ return true;
+ else return delegate.callRequestHandlerChain(sepMetaData, type);
+ }
+
+ /** Handlers are beeing called through the HandlerCallback from the EJB interceptor */
+ public boolean callResponseHandlerChain(HandlerType type)
+ {
+ if (type == HandlerType.PRE)
+ return true;
+ else return delegate.callResponseHandlerChain(sepMetaData, type);
+ }
+
+ /** Handlers are beeing called through the HandlerCallback from the EJB interceptor */
+ public boolean callFaultHandlerChain(HandlerType type, Exception ex)
+ {
+ if (type == HandlerType.PRE)
+ return true;
+ else return delegate.callFaultHandlerChain(sepMetaData, type, ex);
+ }
+ }
+}
Modified: trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/InvocationHandlerEJB3.java
===================================================================
--- trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/InvocationHandlerEJB3.java 2007-05-04 10:28:42 UTC (rev 2958)
+++ trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/InvocationHandlerEJB3.java 2007-05-04 12:20:09 UTC (rev 2959)
@@ -40,10 +40,11 @@
import org.jboss.ws.WSException;
import org.jboss.ws.core.CommonMessageContext;
import org.jboss.ws.core.EndpointInvocation;
+import org.jboss.ws.core.deployment.UnifiedDeploymentInfo;
import org.jboss.ws.core.jaxrpc.handler.SOAPMessageContextJAXRPC;
import org.jboss.ws.core.jaxws.WebServiceContextEJB;
import org.jboss.ws.core.jaxws.handler.SOAPMessageContextJAXWS;
-import org.jboss.ws.core.server.UnifiedDeploymentInfo;
+import org.jboss.ws.core.server.AbstractInvocationHandler;
import org.jboss.ws.core.soap.MessageContextAssociation;
import org.jboss.ws.integration.Endpoint;
import org.jboss.ws.integration.ObjectNameFactory;
Deleted: trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/InvocationHandlerJSE.java
===================================================================
--- trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/InvocationHandlerJSE.java 2007-05-04 10:28:42 UTC (rev 2958)
+++ trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/InvocationHandlerJSE.java 2007-05-04 12:20:09 UTC (rev 2959)
@@ -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.jboss50.jbossws;
-
-// $Id$
-
-import java.lang.reflect.Method;
-
-import javax.xml.rpc.ServiceException;
-import javax.xml.rpc.server.ServiceLifecycle;
-import javax.xml.rpc.server.ServletEndpointContext;
-import javax.xml.rpc.soap.SOAPFaultException;
-import javax.xml.ws.WebServiceContext;
-
-import org.jboss.logging.Logger;
-import org.jboss.ws.WSException;
-import org.jboss.ws.core.CommonMessageContext;
-import org.jboss.ws.core.EndpointInvocation;
-import org.jboss.ws.core.jaxrpc.ServletEndpointContextImpl;
-import org.jboss.ws.core.jaxws.WebServiceContextInjector;
-import org.jboss.ws.core.jaxws.WebServiceContextJSE;
-import org.jboss.ws.core.jaxws.handler.SOAPMessageContextJAXWS;
-import org.jboss.ws.core.server.ServletRequestContext;
-import org.jboss.ws.core.soap.MessageContextAssociation;
-import org.jboss.ws.integration.invocation.InvocationContext;
-import org.jboss.ws.metadata.umdm.ServerEndpointMetaData;
-
-/**
- * Handles invocations on JSE endpoints.
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 25-Apr-2007
- */
-public class InvocationHandlerJSE extends AbstractInvocationHandler
-{
- // provide logging
- private static final Logger log = Logger.getLogger(InvocationHandlerJSE.class);
-
- /** Load the SEI implementation bean if necessary */
- public Class loadServiceEndpoint() throws ClassNotFoundException
- {
- ServerEndpointMetaData sepMetaData = endpoint.getMetaData(ServerEndpointMetaData.class);
- if (sepMetaData == null)
- throw new IllegalStateException("Cannot obtain endpoint meta data");
-
- ClassLoader cl = sepMetaData.getClassLoader();
- String seiImplName = sepMetaData.getServiceEndpointImplName();
- Class seiImplClass = cl.loadClass(seiImplName);
- return seiImplClass;
- }
-
- /** Create an instance of the SEI implementation bean if necessary */
- public Object createServiceEndpointInstance(Class seiImplClass, InvocationContext context) throws IllegalAccessException, InstantiationException
- {
- Object seiImpl = seiImplClass.newInstance();
- if (seiImpl instanceof ServiceLifecycle && context != null)
- {
- try
- {
- ServiceLifecycle serviceLifecycle = ((ServiceLifecycle)seiImpl);
- ServletEndpointContext servletEndpointContext = new ServletEndpointContextImpl((ServletRequestContext)context);
- serviceLifecycle.init(servletEndpointContext);
- }
- catch (ServiceException ex)
- {
- throw new WSException(ex);
- }
- }
- return seiImpl;
- }
-
- /** Invoke an instance of the SEI implementation bean */
- public void invokeServiceEndpointInstance(Object seiImpl, EndpointInvocation epInv) throws SOAPFaultException, Exception
- {
- log.debug("invokeServiceEndpoint: " + epInv.getJavaMethod().getName());
- try
- {
- CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
- if (msgContext instanceof SOAPMessageContextJAXWS)
- {
- WebServiceContext wsContext = new WebServiceContextJSE((SOAPMessageContextJAXWS)msgContext);
- new WebServiceContextInjector().injectContext(seiImpl, wsContext);
- }
-
- Class implClass = seiImpl.getClass();
- Method seiMethod = epInv.getJavaMethod();
- Method implMethod = getImplMethod(implClass, seiMethod);
-
- Object[] args = epInv.getRequestPayload();
- Object retObj = implMethod.invoke(seiImpl, args);
- epInv.setReturnValue(retObj);
- }
- catch (Exception e)
- {
- handleInvocationException(e);
- }
- }
-
- /** Destroy an instance of the SEI implementation bean if necessary */
- public void destroyServiceEndpointInstance(Object seiImpl)
- {
- if (seiImpl instanceof ServiceLifecycle)
- {
- ((ServiceLifecycle)seiImpl).destroy();
- }
- }
-}
Deleted: trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/JBossContextServlet.java
===================================================================
--- trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/JBossContextServlet.java 2007-05-04 10:28:42 UTC (rev 2958)
+++ trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/JBossContextServlet.java 2007-05-04 12:20:09 UTC (rev 2959)
@@ -1,46 +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.jbossws;
-
-// $Id$
-
-import org.jboss.logging.Logger;
-import org.jboss.ws.core.server.legacy.CommonContextServlet;
-import org.jboss.ws.core.server.legacy.ServiceEndpointManagerFactory;
-
-/**
- * The servlet that that is associated with context /jbossws
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 21-Mar-2005
- */
-public class JBossContextServlet extends CommonContextServlet
-{
- // provide logging
- protected final Logger log = Logger.getLogger(JBossContextServlet.class);
-
- protected void initServiceEndpointManager()
- {
- ServiceEndpointManagerFactory factory = ServiceEndpointManagerFactory.getInstance();
- epManager = factory.getServiceEndpointManager();
- }
-}
Deleted: trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/LifecycleHandlerImpl.java
===================================================================
--- trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/LifecycleHandlerImpl.java 2007-05-04 10:28:42 UTC (rev 2958)
+++ trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/LifecycleHandlerImpl.java 2007-05-04 12:20:09 UTC (rev 2959)
@@ -1,57 +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.jbossws;
-
-//$Id$
-
-import org.jboss.ws.integration.Endpoint;
-import org.jboss.ws.metadata.umdm.ServerEndpointMetaData;
-
-/**
- * A lifecycle handler
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 25-Apr-2007
- */
-public class LifecycleHandlerImpl extends org.jboss.ws.integration.LifecycleHandlerImpl
-{
- public void start(Endpoint endpoint)
- {
- super.start(endpoint);
- log.info("WebService started: " + getEndpointAddress(endpoint));
- }
-
- public void stop(Endpoint endpoint)
- {
- super.stop(endpoint);
- log.info("WebService stoped: " + getEndpointAddress(endpoint));
- }
-
- private String getEndpointAddress(Endpoint ep)
- {
- ServerEndpointMetaData sepMetaData = ep.getMetaData(ServerEndpointMetaData.class);
- if (sepMetaData == null)
- throw new IllegalStateException("Cannot obtain endpoint meta data");
-
- return sepMetaData.getEndpointAddress();
- }
-}
Modified: trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/ModifyWebMetaDataDeployer.java
===================================================================
--- trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/ModifyWebMetaDataDeployer.java 2007-05-04 10:28:42 UTC (rev 2958)
+++ trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/ModifyWebMetaDataDeployer.java 2007-05-04 12:20:09 UTC (rev 2959)
@@ -28,7 +28,7 @@
import org.jboss.metadata.NameValuePair;
import org.jboss.metadata.WebMetaData;
import org.jboss.metadata.web.Servlet;
-import org.jboss.ws.core.server.ServiceEndpointPublisher;
+import org.jboss.ws.core.deployment.ServiceEndpointPublisher;
import org.jboss.ws.core.utils.JavaUtils;
import org.jboss.ws.integration.Endpoint;
import org.jboss.ws.integration.deployment.AbstractDeployer;
Deleted: trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/PortComponentLinkServlet.java
===================================================================
--- trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/PortComponentLinkServlet.java 2007-05-04 10:28:42 UTC (rev 2958)
+++ trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/PortComponentLinkServlet.java 2007-05-04 12:20:09 UTC (rev 2959)
@@ -1,93 +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.jbossws;
-
-// $Id$
-
-import java.io.IOException;
-import java.io.PrintWriter;
-
-import javax.servlet.ServletConfig;
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServlet;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import org.jboss.logging.Logger;
-import org.jboss.ws.WSException;
-import org.jboss.ws.core.server.legacy.ServiceEndpoint;
-import org.jboss.ws.core.server.legacy.ServiceEndpointManager;
-import org.jboss.ws.core.server.legacy.ServiceEndpointManagerFactory;
-
-/**
- * A servlet that reports the serviceURL for a given service ID.
- * <p/>
- * When the web service client ENC is setup, it may contain port-component-link
- * entries that point to service endpoints in the same top level deployment.
- * The final serviceURL of those endpoints will become available after the
- * reference to the javax.xml.rpc.Service is bound to JNDI.
- * <p/>
- * When the client does a lookup of the javax.xml.rpc.Service from JNDI the ObjectFactory
- * will contact this servlet for the final serviceURL. It is acceptable that the client
- * wsdl does not contain the correct serviceURL if the client is using the port-component-link element.
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 29-May-2004
- */
-public class PortComponentLinkServlet extends HttpServlet
-{
- // provide logging
- private static final Logger log = Logger.getLogger(PortComponentLinkServlet.class);
-
- protected ServiceEndpointManager epManager;
-
- public void init(ServletConfig config) throws ServletException
- {
- super.init(config);
- ServiceEndpointManagerFactory factory = ServiceEndpointManagerFactory.getInstance();
- epManager = factory.getServiceEndpointManager();
- }
-
- /**
- * Get the serviceURL as string for a given serviceID.
- */
- public void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException
- {
- String pcLink = req.getParameter("pcLink");
- if (pcLink == null)
- throw new IllegalArgumentException("Cannot obtain request parameter 'pcLink'");
-
- ServiceEndpoint serviceEndpoint = epManager.resolvePortComponentLink(pcLink);
- ;
- if (serviceEndpoint == null)
- throw new WSException("Cannot resolve port-component-link: " + pcLink);
-
- res.setContentType("text/plain");
- PrintWriter out = res.getWriter();
-
- String endpointAddress = serviceEndpoint.getServiceEndpointInfo().getServerEndpointMetaData().getEndpointAddress();
- out.println(endpointAddress);
-
- log.debug("Resolved " + pcLink + " to: " + endpointAddress);
- out.close();
- }
-}
Deleted: trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/PublishContractDeployer.java
===================================================================
--- trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/PublishContractDeployer.java 2007-05-04 10:28:42 UTC (rev 2958)
+++ trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/PublishContractDeployer.java 2007-05-04 12:20:09 UTC (rev 2959)
@@ -1,64 +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.jbossws;
-
-//$Id$
-
-import java.io.IOException;
-
-import org.jboss.ws.core.server.UnifiedDeploymentInfo;
-import org.jboss.ws.core.server.WSDLFilePublisher;
-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 publishes the wsdl
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 25-Apr-2007
- */
-public class PublishContractDeployer extends AbstractDeployer
-{
- @Override
- public void create(Deployment dep)
- {
- UnifiedDeploymentInfo udi = dep.getContext().getAttachment(UnifiedDeploymentInfo.class);
- if (udi == null)
- throw new IllegalStateException("Cannot obtain unified deployement info");
-
- UnifiedMetaData umd = dep.getContext().getAttachment(UnifiedMetaData.class);
- if (umd == null)
- throw new IllegalStateException("Cannot obtain unified meta data");
-
- try
- {
- WSDLFilePublisher publisher = new WSDLFilePublisher(udi);
- publisher.publishWsdlFiles(umd);
- }
- catch (IOException ex)
- {
- throw new WSDeploymentException(ex);
- }
- }
-}
\ No newline at end of file
Deleted: trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/RequestHandlerImpl.java
===================================================================
--- trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/RequestHandlerImpl.java 2007-05-04 10:28:42 UTC (rev 2958)
+++ trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/RequestHandlerImpl.java 2007-05-04 12:20:09 UTC (rev 2959)
@@ -1,415 +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.jbossws;
-
-//$Id$
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.io.OutputStreamWriter;
-import java.net.URL;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import javax.activation.DataHandler;
-import javax.servlet.ServletContext;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import javax.xml.namespace.QName;
-import javax.xml.rpc.soap.SOAPFaultException;
-import javax.xml.soap.MimeHeaders;
-import javax.xml.soap.SOAPEnvelope;
-import javax.xml.soap.SOAPException;
-import javax.xml.soap.SOAPMessage;
-import javax.xml.soap.SOAPPart;
-import javax.xml.ws.addressing.AddressingProperties;
-import javax.xml.ws.addressing.JAXWSAConstants;
-import javax.xml.ws.http.HTTPBinding;
-
-import org.jboss.logging.Logger;
-import org.jboss.ws.Constants;
-import org.jboss.ws.WSException;
-import org.jboss.ws.core.CommonBinding;
-import org.jboss.ws.core.CommonBindingProvider;
-import org.jboss.ws.core.CommonMessageContext;
-import org.jboss.ws.core.HTTPMessageImpl;
-import org.jboss.ws.core.MessageAbstraction;
-import org.jboss.ws.core.MessageTrace;
-import org.jboss.ws.core.jaxrpc.binding.BindingException;
-import org.jboss.ws.core.jaxrpc.handler.MessageContextJAXRPC;
-import org.jboss.ws.core.jaxrpc.handler.SOAPMessageContextJAXRPC;
-import org.jboss.ws.core.jaxws.handler.MessageContextJAXWS;
-import org.jboss.ws.core.jaxws.handler.SOAPMessageContextJAXWS;
-import org.jboss.ws.core.server.MimeHeaderSource;
-import org.jboss.ws.core.server.ServletHeaderSource;
-import org.jboss.ws.core.server.ServletRequestContext;
-import org.jboss.ws.core.server.WSDLRequestHandler;
-import org.jboss.ws.core.soap.MessageContextAssociation;
-import org.jboss.ws.core.soap.MessageFactoryImpl;
-import org.jboss.ws.core.soap.SOAPConnectionImpl;
-import org.jboss.ws.core.soap.SOAPMessageImpl;
-import org.jboss.ws.core.utils.DOMWriter;
-import org.jboss.ws.core.utils.ThreadLocalAssociation;
-import org.jboss.ws.extensions.addressing.AddressingConstantsImpl;
-import org.jboss.ws.extensions.xop.XOPContext;
-import org.jboss.ws.integration.Endpoint;
-import org.jboss.ws.integration.RequestHandler;
-import org.jboss.ws.integration.Endpoint.EndpointState;
-import org.jboss.ws.integration.invocation.InvocationContext;
-import org.jboss.ws.integration.invocation.InvocationHandler;
-import org.jboss.ws.integration.management.ServerConfig;
-import org.jboss.ws.integration.management.ServerConfigFactory;
-import org.jboss.ws.metadata.umdm.EndpointMetaData;
-import org.jboss.ws.metadata.umdm.ServerEndpointMetaData;
-import org.jboss.ws.metadata.umdm.EndpointMetaData.Type;
-import org.w3c.dom.Document;
-
-/**
- * A request handler
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 25-Apr-2007
- */
-public class RequestHandlerImpl implements RequestHandler
-{
- // provide logging
- private static final Logger log = Logger.getLogger(RequestHandlerImpl.class);
-
- public void handleRequest(Endpoint endpoint, InputStream inputStream, OutputStream outputStream, InvocationContext context)
- {
- log.debug("handleRequest: " + endpoint.getName());
-
- ServerEndpointMetaData sepMetaData = endpoint.getMetaData(ServerEndpointMetaData.class);
- if (sepMetaData == null)
- throw new IllegalStateException("Cannot obtain endpoint meta data");
-
- ServletRequestContext reqContext = (ServletRequestContext)context;
-
- Type type = sepMetaData.getType();
-
- ServletContext servletContext = reqContext.getServletContext();
- HttpServletRequest httpRequest = reqContext.getHttpServletRequest();
- HttpServletResponse httpResponse = reqContext.getHttpServletResponse();
- ServletHeaderSource headerSource = new ServletHeaderSource(httpRequest, httpResponse);
-
- // Build the message context
- CommonMessageContext msgContext;
- if (type == EndpointMetaData.Type.JAXRPC)
- {
- msgContext = new SOAPMessageContextJAXRPC();
- msgContext.put(MessageContextJAXRPC.SERVLET_CONTEXT, servletContext);
- msgContext.put(MessageContextJAXRPC.SERVLET_REQUEST, httpRequest);
- msgContext.put(MessageContextJAXRPC.SERVLET_RESPONSE, httpResponse);
- }
- else
- {
- msgContext = new SOAPMessageContextJAXWS();
- msgContext.put(MessageContextJAXWS.MESSAGE_OUTBOUND_PROPERTY, new Boolean(false));
- msgContext.put(MessageContextJAXWS.INBOUND_MESSAGE_ATTACHMENTS, new HashMap<String, DataHandler>());
- msgContext.put(MessageContextJAXWS.HTTP_REQUEST_HEADERS, headerSource.getHeaderMap());
- msgContext.put(MessageContextJAXWS.HTTP_REQUEST_METHOD, httpRequest.getMethod());
- msgContext.put(MessageContextJAXWS.QUERY_STRING, httpRequest.getQueryString());
- msgContext.put(MessageContextJAXWS.PATH_INFO, httpRequest.getPathInfo());
- msgContext.put(MessageContextJAXWS.SERVLET_CONTEXT, servletContext);
- msgContext.put(MessageContextJAXWS.SERVLET_REQUEST, httpRequest);
- msgContext.put(MessageContextJAXWS.SERVLET_RESPONSE, httpResponse);
-
- }
- msgContext.setEndpointMetaData(sepMetaData);
-
- // Associate a message context with the current thread
- MessageContextAssociation.pushMessageContext(msgContext);
-
- try
- {
- MessageAbstraction resMessage = processRequest(endpoint, headerSource, reqContext, inputStream);
-
- // Replace the message context with the response context
- msgContext = MessageContextAssociation.peekMessageContext();
-
- Map<String, List<String>> headers = (Map<String, List<String>>)msgContext.get(MessageContextJAXWS.HTTP_RESPONSE_HEADERS);
- if (headers != null)
- headerSource.setHeaderMap(headers);
-
- Integer code = (Integer)msgContext.get(MessageContextJAXWS.HTTP_RESPONSE_CODE);
- if (code != null)
- httpResponse.setStatus(code.intValue());
-
- boolean isFault = false;
- if (resMessage instanceof SOAPMessage)
- {
- SOAPPart part = ((SOAPMessage)resMessage).getSOAPPart();
- if (part == null)
- throw new SOAPException("Cannot obtain SOAPPart from response message");
-
- // R1126 An INSTANCE MUST return a "500 Internal Server Error" HTTP status code
- // if the response envelope is a Fault.
- //
- // Also, a one-way operation must show up as empty content, and can be detected
- // by a null envelope.
- SOAPEnvelope soapEnv = part.getEnvelope();
- isFault = soapEnv != null && soapEnv.getBody().hasFault();
- if (isFault && httpResponse != null)
- {
- httpResponse.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
- }
- }
-
- sendResponse(outputStream, msgContext, isFault);
- }
- catch (Exception ex)
- {
- WSException.rethrow(ex);
- }
- finally
- {
- // Reset the message context association
- MessageContextAssociation.popMessageContext();
-
- // clear thread local storage
- ThreadLocalAssociation.clear();
- }
- }
-
- private void sendResponse(OutputStream outputStream, CommonMessageContext msgContext, boolean isFault) throws SOAPException, IOException
- {
- MessageAbstraction resMessage = msgContext.getMessageAbstraction();
- String wsaTo = null;
-
- // Get the destination from the AddressingProperties
- AddressingProperties outProps = (AddressingProperties)msgContext.get(JAXWSAConstants.SERVER_ADDRESSING_PROPERTIES_OUTBOUND);
- if (outProps != null && outProps.getTo() != null)
- {
- AddressingConstantsImpl ADDR = new AddressingConstantsImpl();
- wsaTo = outProps.getTo().getURI().toString();
- if (wsaTo.equals(ADDR.getAnonymousURI()))
- wsaTo = null;
- }
- if (wsaTo != null)
- {
- log.debug("Sending response to addressing destination: " + wsaTo);
- new SOAPConnectionImpl().callOneWay((SOAPMessage)resMessage, wsaTo);
- }
- else
- {
- resMessage.writeTo(outputStream);
- }
- }
-
- /**
- * Handle a request to this web service endpoint
- */
- private MessageAbstraction processRequest(Endpoint endpoint, MimeHeaderSource headerSource, ServletRequestContext reqContext, InputStream inputStream)
- throws BindingException
- {
- CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
-
- ServerEndpointMetaData sepMetaData = endpoint.getMetaData(ServerEndpointMetaData.class);
- if (sepMetaData == null)
- throw new IllegalStateException("Cannot obtain endpoint meta data");
-
- long beginProcessing = 0;
- ClassLoader ctxClassLoader = Thread.currentThread().getContextClassLoader();
- try
- {
- EndpointState state = endpoint.getState();
- if (state != EndpointState.STARTED)
- {
- QName faultCode = Constants.SOAP11_FAULT_CODE_SERVER;
- String faultString = "Endpoint cannot handle requests in state: " + state;
- throw new SOAPFaultException(faultCode, faultString, null, null);
- }
-
- log.debug("BEGIN handleRequest: " + endpoint.getName());
- beginProcessing = initRequestMetrics(endpoint);
-
- MimeHeaders headers = (headerSource != null ? headerSource.getMimeHeaders() : null);
-
- MessageAbstraction reqMessage;
-
- String bindingID = sepMetaData.getBindingId();
- if (HTTPBinding.HTTP_BINDING.equals(bindingID))
- {
- reqMessage = new HTTPMessageImpl(headers, inputStream);
- }
- else
- {
- MessageFactoryImpl msgFactory = new MessageFactoryImpl();
- msgFactory.setServiceMode(sepMetaData.getServiceMode());
- msgFactory.setStyle(sepMetaData.getStyle());
-
- reqMessage = (SOAPMessageImpl)msgFactory.createMessage(headers, inputStream);
- }
-
- // Associate current message with message context
- msgContext.setMessageAbstraction(reqMessage);
-
- // debug the incomming message
- MessageTrace.traceMessage("Incoming Request Message", reqMessage);
-
- // Set the thread context class loader
- ClassLoader classLoader = sepMetaData.getClassLoader();
- Thread.currentThread().setContextClassLoader(classLoader);
-
- // Invoke the service endpoint
- InvocationHandler invoker = endpoint.getInvocationHandler();
- invoker.invoke(reqContext);
-
- // Get the response message context
- msgContext = MessageContextAssociation.peekMessageContext();
-
- // Get the response message
- MessageAbstraction resMessage = msgContext.getMessageAbstraction();
- if (resMessage != null)
- postProcessResponse(headerSource, resMessage);
-
- return resMessage;
- }
- catch (Exception ex)
- {
- MessageAbstraction resMessage = msgContext.getMessageAbstraction();
-
- // In case we have an exception before the invoker is called
- // we create the fault message here.
- if (resMessage == null || resMessage.isFaultMessage() == false)
- {
- CommonBindingProvider bindingProvider = new CommonBindingProvider(sepMetaData);
- CommonBinding binding = bindingProvider.getCommonBinding();
- resMessage = binding.bindFaultMessage(ex);
- }
-
- if (resMessage != null)
- postProcessResponse(headerSource, resMessage);
-
- return resMessage;
- }
- finally
- {
- try
- {
- MessageAbstraction resMessage = msgContext.getMessageAbstraction();
- if (resMessage != null)
- {
- if (resMessage.isFaultMessage())
- {
- processFaultMetrics(endpoint, beginProcessing);
- }
- else
- {
- processResponseMetrics(endpoint, beginProcessing);
- }
- }
- }
- catch (Exception ex)
- {
- log.error("Cannot process metrics", ex);
- }
-
- // Reset the thread context class loader
- Thread.currentThread().setContextClassLoader(ctxClassLoader);
- log.debug("END handleRequest: " + endpoint.getName());
- }
- }
-
- private long initRequestMetrics(Endpoint endpoint)
- {
- return 0;
- }
-
- private void processResponseMetrics(Endpoint endpoint, long beginProcessing)
- {
- }
-
- private void processFaultMetrics(Endpoint endpoint, long beginProcessing)
- {
- }
-
- /** Set response mime headers
- */
- private void postProcessResponse(MimeHeaderSource headerSource, MessageAbstraction resMessage)
- {
- try
- {
- // Set the outbound headers
- if (headerSource != null && resMessage instanceof SOAPMessage)
- {
- XOPContext.eagerlyCreateAttachments();
- ((SOAPMessage)resMessage).saveChanges();
- headerSource.setMimeHeaders(resMessage.getMimeHeaders());
- }
-
- // debug the outgoing message
- MessageTrace.traceMessage("Outgoing Response Message", resMessage);
- }
- catch (Exception ex)
- {
- WSException.rethrow("Faild to post process response message", ex);
- }
- }
-
- public void handleWSDLRequest(Endpoint endpoint, OutputStream outputStream, InvocationContext context)
- {
- log.debug("handleWSDLRequest: " + endpoint.getName());
-
- ServerEndpointMetaData epMetaData = endpoint.getMetaData(ServerEndpointMetaData.class);
- if (epMetaData == null)
- throw new IllegalStateException("Cannot obtain endpoint meta data");
-
- ServletRequestContext reqContext = (ServletRequestContext)context;
- HttpServletRequest req = reqContext.getHttpServletRequest();
-
- try
- {
- // For the base document the resourcePath should be null
- String resPath = (String)req.getParameter("resource");
- URL reqURL = new URL(req.getRequestURL().toString());
-
- String wsdlHost = reqURL.getProtocol() + "://" + reqURL.getHost() + ":" + reqURL.getPort();
-
- ServerConfigFactory factory = ServerConfigFactory.getInstance();
- ServerConfig config = factory.getServerConfig();
- if (config.getWebServiceHost().equals(ServerConfig.UNDEFINED_HOSTNAME) == false)
- {
- wsdlHost = config.getWebServiceHost();
- }
- log.debug("WSDL request, using host: " + wsdlHost);
-
- WSDLRequestHandler wsdlRequestHandler = new WSDLRequestHandler(epMetaData);
- Document document = wsdlRequestHandler.getDocumentForPath(reqURL, wsdlHost, resPath);
-
- OutputStreamWriter writer = new OutputStreamWriter(outputStream);
- new DOMWriter(writer).setPrettyprint(true).print(document.getDocumentElement());
- outputStream.flush();
- outputStream.close();
- }
- catch (RuntimeException rte)
- {
- throw rte;
- }
- catch (IOException ex)
- {
- throw new WSException(ex);
- }
- }
-}
Modified: trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/ServiceEndpointGeneratorEJB21.java
===================================================================
--- trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/ServiceEndpointGeneratorEJB21.java 2007-05-04 10:28:42 UTC (rev 2958)
+++ trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/ServiceEndpointGeneratorEJB21.java 2007-05-04 12:20:09 UTC (rev 2959)
@@ -29,8 +29,8 @@
import org.jboss.logging.Logger;
import org.jboss.metadata.ApplicationMetaData;
import org.jboss.metadata.AssemblyDescriptorMetaData;
+import org.jboss.ws.core.deployment.UnifiedDeploymentInfo;
import org.jboss.ws.core.server.ServiceEndpointGeneratorEJB;
-import org.jboss.ws.core.server.UnifiedDeploymentInfo;
import org.jboss.ws.core.utils.DOMUtils;
import org.w3c.dom.Element;
Modified: trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/ServiceEndpointGeneratorEJB3.java
===================================================================
--- trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/ServiceEndpointGeneratorEJB3.java 2007-05-04 10:28:42 UTC (rev 2958)
+++ trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/ServiceEndpointGeneratorEJB3.java 2007-05-04 12:20:09 UTC (rev 2959)
@@ -30,8 +30,8 @@
import org.jboss.ejb3.EJBContainer;
import org.jboss.ejb3.Ejb3Deployment;
import org.jboss.logging.Logger;
+import org.jboss.ws.core.deployment.UnifiedDeploymentInfo;
import org.jboss.ws.core.server.ServiceEndpointGeneratorEJB;
-import org.jboss.ws.core.server.UnifiedDeploymentInfo;
import org.jboss.ws.core.utils.DOMUtils;
import org.w3c.dom.Element;
Deleted: trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/ServiceEndpointServlet.java
===================================================================
--- trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/ServiceEndpointServlet.java 2007-05-04 10:28:42 UTC (rev 2958)
+++ trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/ServiceEndpointServlet.java 2007-05-04 12:20:09 UTC (rev 2959)
@@ -1,62 +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.jbossws;
-
-// $Id$
-
-import javax.servlet.ServletContext;
-
-import org.jboss.logging.Logger;
-import org.jboss.ws.metadata.umdm.ServerEndpointMetaData;
-
-/**
- * A servlet that is installed for every web service endpoint.
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 25-Apr-2007
- */
-public class ServiceEndpointServlet extends AbstractServiceEndpointServlet
-{
- // provide logging
- private static final Logger log = Logger.getLogger(ServiceEndpointServlet.class);
-
- /** Initialize the service endpoint
- */
- protected void initServiceEndpoint(String contextPath)
- {
- super.initServiceEndpoint(contextPath);
-
- // read the config name/file from web.xml
- ServletContext ctx = getServletContext();
- String configName = ctx.getInitParameter("jbossws-config-name");
- String configFile = ctx.getInitParameter("jbossws-config-file");
- if (configName != null || configFile != null)
- {
- ServerEndpointMetaData epMetaData = endpoint.getMetaData(ServerEndpointMetaData.class);
- if (epMetaData == null)
- throw new IllegalStateException("Cannot obtain endpoint meta data");
-
- log.debug("Updating service endpoint config\n config-name: " + configName + "\n config-file: " + configFile);
- epMetaData.setConfigName(configName, configFile);
- }
- }
-}
Modified: trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/UnifiedDeploymentInfoDeployer.java
===================================================================
--- trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/UnifiedDeploymentInfoDeployer.java 2007-05-04 10:28:42 UTC (rev 2958)
+++ trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/UnifiedDeploymentInfoDeployer.java 2007-05-04 12:20:09 UTC (rev 2959)
@@ -24,12 +24,12 @@
//$Id$
import org.jboss.deployers.spi.deployer.DeploymentUnit;
-import org.jboss.ws.core.server.JAXWSDeployment;
-import org.jboss.ws.core.server.UnifiedDeploymentInfo;
+import org.jboss.ws.core.deployment.JAXRPCDeployment;
+import org.jboss.ws.core.deployment.JAXWSDeployment;
+import org.jboss.ws.core.deployment.UnifiedDeploymentInfo;
import org.jboss.ws.integration.deployment.AbstractDeployer;
import org.jboss.ws.integration.deployment.Deployment;
import org.jboss.ws.integration.deployment.Deployment.DeploymentType;
-import org.jboss.ws.metadata.builder.jaxrpc.JAXRPCDeployment;
import org.jboss.ws.metadata.webservices.WebservicesMetaData;
/**
Deleted: trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/UnifiedMetaDataAssociationDeployer.java
===================================================================
--- trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/UnifiedMetaDataAssociationDeployer.java 2007-05-04 10:28:42 UTC (rev 2958)
+++ trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/UnifiedMetaDataAssociationDeployer.java 2007-05-04 12:20:09 UTC (rev 2959)
@@ -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.jboss50.jbossws;
-
-//$Id$
-
-import javax.management.ObjectName;
-
-import org.jboss.ws.integration.Endpoint;
-import org.jboss.ws.integration.deployment.AbstractDeployer;
-import org.jboss.ws.integration.deployment.Deployment;
-import org.jboss.ws.metadata.umdm.EndpointMetaData;
-import org.jboss.ws.metadata.umdm.ServerEndpointMetaData;
-import org.jboss.ws.metadata.umdm.ServiceMetaData;
-import org.jboss.ws.metadata.umdm.UnifiedMetaData;
-
-/**
- * A deployer that assigns the EndpointMetaData to the Endpoint
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 25-Apr-2007
- */
-public class UnifiedMetaDataAssociationDeployer extends AbstractDeployer
-{
- @Override
- public void create(Deployment dep)
- {
- UnifiedMetaData umd = dep.getContext().getAttachment(UnifiedMetaData.class);
- if (umd == null)
- throw new IllegalStateException("Cannot obtain unified meta data");
-
- for (Endpoint ep : dep.getService().getEndpoints())
- {
- ServerEndpointMetaData sepMetaData = ep.getMetaData(ServerEndpointMetaData.class);
- if (sepMetaData == null)
- {
- sepMetaData = getEndpointMetaData(umd, ep.getName());
- sepMetaData.setServiceEndpointImplName(ep.getEndpointImpl().getName());
- ep.addMetaData(ServerEndpointMetaData.class, sepMetaData);
- }
- }
- }
-
- private ServerEndpointMetaData getEndpointMetaData(UnifiedMetaData umd, ObjectName epName)
- {
- String propEndpoint = epName.getKeyProperty(Endpoint.SEPID_PROPERTY_ENDPOINT);
-
- ServerEndpointMetaData epMetaData = null;
- for (ServiceMetaData serviceMetaData : umd.getServices())
- {
- for (EndpointMetaData aux : serviceMetaData.getEndpoints())
- {
- String linkName = ((ServerEndpointMetaData)aux).getLinkName();
- if (propEndpoint.equals(linkName))
- {
- epMetaData = (ServerEndpointMetaData)aux;
- break;
- }
- }
- }
-
- if (epMetaData == null)
- throw new IllegalStateException("Cannot find endpoint meta data for: " + epName);
-
- return epMetaData;
- }
-}
\ No newline at end of file
Deleted: trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/UnifiedMetaDataDeployer.java
===================================================================
--- trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/UnifiedMetaDataDeployer.java 2007-05-04 10:28:42 UTC (rev 2958)
+++ trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/UnifiedMetaDataDeployer.java 2007-05-04 12:20:09 UTC (rev 2959)
@@ -1,82 +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.jbossws;
-
-//$Id$
-
-import org.jboss.ws.core.server.UnifiedDeploymentInfo;
-import org.jboss.ws.integration.deployment.AbstractDeployer;
-import org.jboss.ws.integration.deployment.Deployment;
-import org.jboss.ws.integration.deployment.Deployment.DeploymentType;
-import org.jboss.ws.metadata.builder.jaxrpc.JAXRPCDeployment;
-import org.jboss.ws.metadata.builder.jaxrpc.JAXRPCServerMetaDataBuilder;
-import org.jboss.ws.metadata.builder.jaxws.JAXWSMetaDataBuilderEJB3;
-import org.jboss.ws.metadata.builder.jaxws.JAXWSMetaDataBuilderJSE;
-import org.jboss.ws.metadata.umdm.UnifiedMetaData;
-
-/**
- * A deployer that builds the UnifiedDeploymentInfo
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 25-Apr-2007
- */
-public class UnifiedMetaDataDeployer extends AbstractDeployer
-{
- @Override
- public void create(Deployment dep)
- {
- UnifiedMetaData umd = dep.getContext().getAttachment(UnifiedMetaData.class);
- if (umd == null)
- {
- UnifiedDeploymentInfo udi = dep.getContext().getAttachment(UnifiedDeploymentInfo.class);
- if (udi == null)
- throw new IllegalStateException("Cannot obtain unified deployement info");
-
- if (udi.type == DeploymentType.JAXRPC_JSE)
- {
- JAXRPCServerMetaDataBuilder builder = new JAXRPCServerMetaDataBuilder();
- umd = builder.buildMetaData((JAXRPCDeployment)udi);
- }
- else if (udi.type == DeploymentType.JAXRPC_EJB21)
- {
- JAXRPCServerMetaDataBuilder builder = new JAXRPCServerMetaDataBuilder();
- umd = builder.buildMetaData((JAXRPCDeployment)udi);
- }
- else if (udi.type == DeploymentType.JAXWS_JSE)
- {
- JAXWSMetaDataBuilderJSE builder = new JAXWSMetaDataBuilderJSE();
- umd = builder.buildMetaData(udi);
- }
- else if (udi.type == DeploymentType.JAXWS_EJB3)
- {
- JAXWSMetaDataBuilderEJB3 builder = new JAXWSMetaDataBuilderEJB3();
- umd = builder.buildMetaData(udi);
- }
- else
- {
- throw new IllegalStateException("Invalid type: " + udi.type);
- }
-
- dep.getContext().addAttachment(UnifiedMetaData.class, umd);
- }
- }
-}
\ No newline at end of file
Modified: trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/WebAppDeployerDeployer.java
===================================================================
--- trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/WebAppDeployerDeployer.java 2007-05-04 10:28:42 UTC (rev 2958)
+++ trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/WebAppDeployerDeployer.java 2007-05-04 12:20:09 UTC (rev 2959)
@@ -34,8 +34,8 @@
import org.jboss.logging.Logger;
import org.jboss.virtual.VFS;
import org.jboss.virtual.VirtualFile;
-import org.jboss.ws.core.server.ServiceEndpointPublisher;
-import org.jboss.ws.core.server.UnifiedDeploymentInfo;
+import org.jboss.ws.core.deployment.ServiceEndpointPublisher;
+import org.jboss.ws.core.deployment.UnifiedDeploymentInfo;
import org.jboss.ws.integration.deployment.Deployer;
import org.jboss.ws.integration.deployment.Deployment;
import org.jboss.ws.integration.deployment.WSDeploymentException;
Deleted: trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/WebAppGeneratorDeployer.java
===================================================================
--- trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/WebAppGeneratorDeployer.java 2007-05-04 10:28:42 UTC (rev 2958)
+++ trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/WebAppGeneratorDeployer.java 2007-05-04 12:20:09 UTC (rev 2959)
@@ -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.jboss50.jbossws;
-
-//$Id$
-
-import org.jboss.ws.core.server.UnifiedDeploymentInfo;
-import org.jboss.ws.integration.deployment.AbstractDeployer;
-import org.jboss.ws.integration.deployment.Deployment;
-import org.jboss.ws.metadata.umdm.UnifiedMetaData;
-
-/**
- * A deployer that generates a webapp for an EJB endpoint
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 25-Apr-2007
- */
-public class WebAppGeneratorDeployer extends AbstractDeployer
-{
- @Override
- public void create(Deployment dep)
- {
- UnifiedDeploymentInfo udi = dep.getContext().getAttachment(UnifiedDeploymentInfo.class);
- if (udi == null)
- throw new IllegalStateException("Cannot obtain unified deployement info");
-
- UnifiedMetaData umd = dep.getContext().getAttachment(UnifiedMetaData.class);
- if (umd == null)
- throw new IllegalStateException("Cannot obtain unified meta data");
-
- if (dep.getType().toString().endsWith("EJB21"))
- {
- ServiceEndpointGeneratorEJB21 generator = new ServiceEndpointGeneratorEJB21();
- udi.webappURL = generator.generatWebDeployment(umd, udi);
- }
- else if (dep.getType().toString().endsWith("EJB3"))
- {
- ServiceEndpointGeneratorEJB3 generator = new ServiceEndpointGeneratorEJB3();
- udi.webappURL = generator.generatWebDeployment(umd, udi);
- }
- }
-}
\ No newline at end of file
Added: trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/WebAppGeneratorDeployer.java
===================================================================
--- trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/WebAppGeneratorDeployer.java (rev 0)
+++ trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/WebAppGeneratorDeployer.java 2007-05-04 12:20:09 UTC (rev 2959)
@@ -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.jboss50.jbossws;
+
+//$Id$
+
+import org.jboss.ws.core.deployment.UnifiedDeploymentInfo;
+import org.jboss.ws.integration.deployment.AbstractDeployer;
+import org.jboss.ws.integration.deployment.Deployment;
+import org.jboss.ws.metadata.umdm.UnifiedMetaData;
+
+/**
+ * A deployer that generates a webapp for an EJB endpoint
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 25-Apr-2007
+ */
+public class WebAppGeneratorDeployer extends AbstractDeployer
+{
+ @Override
+ public void create(Deployment dep)
+ {
+ UnifiedDeploymentInfo udi = dep.getContext().getAttachment(UnifiedDeploymentInfo.class);
+ if (udi == null)
+ throw new IllegalStateException("Cannot obtain unified deployement info");
+
+ UnifiedMetaData umd = dep.getContext().getAttachment(UnifiedMetaData.class);
+ if (umd == null)
+ throw new IllegalStateException("Cannot obtain unified meta data");
+
+ if (dep.getType().toString().endsWith("EJB21"))
+ {
+ ServiceEndpointGeneratorEJB21 generator = new ServiceEndpointGeneratorEJB21();
+ udi.webappURL = generator.generatWebDeployment(umd, udi);
+ }
+ else if (dep.getType().toString().endsWith("EJB3"))
+ {
+ ServiceEndpointGeneratorEJB3 generator = new ServiceEndpointGeneratorEJB3();
+ udi.webappURL = generator.generatWebDeployment(umd, udi);
+ }
+ }
+}
\ No newline at end of file
Modified: trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/WebMetaDataAdaptor.java
===================================================================
--- trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/WebMetaDataAdaptor.java 2007-05-04 10:28:42 UTC (rev 2958)
+++ trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/WebMetaDataAdaptor.java 2007-05-04 12:20:09 UTC (rev 2959)
@@ -35,7 +35,7 @@
import org.jboss.metadata.WebSecurityMetaData.WebResourceCollection;
import org.jboss.metadata.web.Servlet;
import org.jboss.metadata.web.ServletMapping;
-import org.jboss.ws.core.server.UnifiedDeploymentInfo;
+import org.jboss.ws.core.deployment.UnifiedDeploymentInfo;
import org.jboss.ws.metadata.j2ee.UnifiedWebMetaData;
import org.jboss.ws.metadata.j2ee.UnifiedWebSecurityMetaData;
import org.jboss.ws.metadata.j2ee.UnifiedWebMetaData.PublishLocationAdapter;
Modified: trunk/integration-jboss50/src/resources/jbossws.sar/META-INF/jbossws-beans.xml
===================================================================
--- trunk/integration-jboss50/src/resources/jbossws.sar/META-INF/jbossws-beans.xml 2007-05-04 10:28:42 UTC (rev 2958)
+++ trunk/integration-jboss50/src/resources/jbossws.sar/META-INF/jbossws-beans.xml 2007-05-04 12:20:09 UTC (rev 2959)
@@ -128,30 +128,30 @@
Each handles a single aspect of web service deployment
-->
<bean name="WSClassLoaderInjectionDeployer" class="org.jboss.ws.integration.jboss50.jbossws.ClassLoaderInjectionDeployer"/>
- <bean name="WSEagerInitializeDeployer" class="org.jboss.ws.integration.jboss50.jbossws.EagerInitializeDeployer"/>
- <bean name="WSEndpointHandlerDeployer" class="org.jboss.ws.integration.jboss50.jbossws.EndpointHandlerDeployer">
- <property name="requestHandler">org.jboss.ws.integration.jboss50.jbossws.RequestHandlerImpl</property>
- <property name="lifecycleHandler">org.jboss.ws.integration.jboss50.jbossws.LifecycleHandlerImpl</property>
+ <bean name="WSEagerInitializeDeployer" class="org.jboss.ws.core.deployment.EagerInitializeDeployer"/>
+ <bean name="WSEndpointHandlerDeployer" class="org.jboss.ws.core.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.integration.jboss50.jbossws.InvocationHandlerJSE</value></entry>
+ <entry><key>JAXRPC_JSE</key><value>org.jboss.ws.core.server.InvocationHandlerJSE</value></entry>
<entry><key>JAXRPC_EJB21</key><value>org.jboss.ws.integration.jboss50.jbossws.InvocationHandlerEJB21</value></entry>
- <entry><key>JAXWS_JSE</key><value>org.jboss.ws.integration.jboss50.jbossws.InvocationHandlerJSE</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.jboss50.jbossws.InvocationHandlerEJB3</value></entry>
</map>
</property>
</bean>
- <bean name="WSEndpointLifecycleDeployer" class="org.jboss.ws.integration.jboss50.jbossws.EndpointLifecycleDeployer"/>
- <bean name="WSEndpointNameDeployer" class="org.jboss.ws.integration.jboss50.jbossws.EndpointNameDeployer"/>
+ <bean name="WSEndpointLifecycleDeployer" class="org.jboss.ws.core.deployment.EndpointLifecycleDeployer"/>
+ <bean name="WSEndpointNameDeployer" class="org.jboss.ws.core.deployment.EndpointNameDeployer"/>
<bean name="WSEndpointRegistryDeployer" class="org.jboss.ws.integration.deployment.EndpointRegistryDeployer"/>
<bean name="WSEndpointValidationDeployer" class="org.jboss.ws.integration.deployment.EndpointValidationDeployer"/>
<bean name="WSModifyWebMetaDataDeployer" class="org.jboss.ws.integration.jboss50.jbossws.ModifyWebMetaDataDeployer">
<property name="serviceEndpointPublisher"><inject bean="WSServiceEndpointPublisher"/></property>
</bean>
- <bean name="WSPublishContractDeployer" class="org.jboss.ws.integration.jboss50.jbossws.PublishContractDeployer"/>
+ <bean name="WSPublishContractDeployer" class="org.jboss.ws.core.deployment.PublishContractDeployer"/>
<bean name="WSUnifiedDeploymentInfoDeployer" class="org.jboss.ws.integration.jboss50.jbossws.UnifiedDeploymentInfoDeployer"/>
- <bean name="WSUnifiedMetaDataAssociationDeployer" class="org.jboss.ws.integration.jboss50.jbossws.UnifiedMetaDataAssociationDeployer"/>
- <bean name="WSUnifiedMetaDataDeployer" class="org.jboss.ws.integration.jboss50.jbossws.UnifiedMetaDataDeployer"/>
+ <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.jboss50.jbossws.WebAppGeneratorDeployer"/>
<bean name="WSWebAppDeployerDeployer" class="org.jboss.ws.integration.jboss50.jbossws.WebAppDeployerDeployer">
<property name="serviceEndpointPublisher"><inject bean="WSServiceEndpointPublisher"/></property>
@@ -159,8 +159,8 @@
</bean>
<!-- Deployer helper beans -->
- <bean name="WSServiceEndpointPublisher" class="org.jboss.ws.core.server.ServiceEndpointPublisher">
- <property name="servletClass">org.jboss.ws.integration.jboss50.jbossws.ServiceEndpointServlet</property>
+ <bean name="WSServiceEndpointPublisher" class="org.jboss.ws.core.deployment.ServiceEndpointPublisher">
+ <property name="servletClass">org.jboss.ws.core.server.ServiceEndpointServlet</property>
</bean>
<!--
Modified: trunk/integration-tomcat/src/java/org/jboss/ws/integration/tomcat/DeploymentInfoAdaptor.java
===================================================================
--- trunk/integration-tomcat/src/java/org/jboss/ws/integration/tomcat/DeploymentInfoAdaptor.java 2007-05-04 10:28:42 UTC (rev 2958)
+++ trunk/integration-tomcat/src/java/org/jboss/ws/integration/tomcat/DeploymentInfoAdaptor.java 2007-05-04 12:20:09 UTC (rev 2959)
@@ -37,8 +37,8 @@
import javax.servlet.ServletContext;
import org.jboss.ws.WSException;
-import org.jboss.ws.core.server.ServiceEndpointPublisher;
-import org.jboss.ws.core.server.UnifiedDeploymentInfo;
+import org.jboss.ws.core.deployment.ServiceEndpointPublisher;
+import org.jboss.ws.core.deployment.UnifiedDeploymentInfo;
import org.jboss.ws.core.utils.DOMUtils;
import org.jboss.ws.integration.Endpoint;
import org.jboss.ws.integration.ResourceLoaderAdapter;
Copied: trunk/integration-tomcat/src/java/org/jboss/ws/integration/tomcat/ServiceEndpointDeployer.java (from rev 2953, trunk/jbossws-core/src/java/org/jboss/ws/core/server/legacy/ServiceEndpointDeployer.java)
===================================================================
--- trunk/integration-tomcat/src/java/org/jboss/ws/integration/tomcat/ServiceEndpointDeployer.java (rev 0)
+++ trunk/integration-tomcat/src/java/org/jboss/ws/integration/tomcat/ServiceEndpointDeployer.java 2007-05-04 12:20:09 UTC (rev 2959)
@@ -0,0 +1,233 @@
+/*
+ * 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.tomcat;
+
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+import javax.management.ObjectName;
+
+import org.jboss.logging.Logger;
+import org.jboss.ws.WSException;
+import org.jboss.ws.core.deployment.JAXRPCDeployment;
+import org.jboss.ws.core.deployment.UnifiedDeploymentInfo;
+import org.jboss.ws.core.deployment.WSDLFilePublisher;
+import org.jboss.ws.core.server.legacy.ServiceEndpointInfo;
+import org.jboss.ws.core.server.legacy.ServiceEndpointManager;
+import org.jboss.ws.integration.deployment.Deployment.DeploymentType;
+import org.jboss.ws.metadata.builder.jaxrpc.JAXRPCServerMetaDataBuilder;
+import org.jboss.ws.metadata.builder.jaxws.JAXWSMetaDataBuilderEJB3;
+import org.jboss.ws.metadata.builder.jaxws.JAXWSMetaDataBuilderJSE;
+import org.jboss.ws.metadata.umdm.EndpointMetaData;
+import org.jboss.ws.metadata.umdm.ServerEndpointMetaData;
+import org.jboss.ws.metadata.umdm.ServiceMetaData;
+import org.jboss.ws.metadata.umdm.UnifiedMetaData;
+
+/**
+ * The POJO deployer for web service endpoints. This Deployer is already decoupled from the target
+ * container (i.e. JBoss, Tomcat). The containers deployer architecture should be used to populate
+ * the UnifiedDeploymentInfo object.
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 12-May-2006
+ */
+public class ServiceEndpointDeployer
+{
+ // logging support
+ private static Logger log = Logger.getLogger(ServiceEndpointDeployer.class);
+
+ // default bean name
+ public static final String BEAN_NAME = "ServiceEndpointDeployer";
+
+ // The ServiceEndpointManger injected by the kernel
+ private ServiceEndpointManager epManager;
+
+ // Maps the deployment url to UMDM
+ private Map<String, UnifiedMetaData> metaDataMap = new ConcurrentHashMap<String, UnifiedMetaData>();
+
+ // Injected by the Microkernel
+ public void setServiceEndpointManager(ServiceEndpointManager epManager)
+ {
+ this.epManager = epManager;
+ }
+
+ public void create(UnifiedDeploymentInfo udi)
+ {
+ if(log.isDebugEnabled()) log.debug("create: " + udi.name);
+ try
+ {
+ UnifiedMetaData wsMetaData;
+ if (udi.type == DeploymentType.JAXRPC_JSE)
+ {
+ JAXRPCServerMetaDataBuilder builder = new JAXRPCServerMetaDataBuilder();
+ wsMetaData = builder.buildMetaData((JAXRPCDeployment)udi);
+ }
+ else if (udi.type == DeploymentType.JAXRPC_EJB21)
+ {
+ JAXRPCServerMetaDataBuilder builder = new JAXRPCServerMetaDataBuilder();
+ wsMetaData = builder.buildMetaData((JAXRPCDeployment)udi);
+ }
+ else if (udi.type == DeploymentType.JAXWS_JSE)
+ {
+ JAXWSMetaDataBuilderJSE builder = new JAXWSMetaDataBuilderJSE();
+ wsMetaData = builder.buildMetaData(udi);
+ }
+ else if (udi.type == DeploymentType.JAXWS_EJB3)
+ {
+ JAXWSMetaDataBuilderEJB3 builder = new JAXWSMetaDataBuilderEJB3();
+ wsMetaData = builder.buildMetaData(udi);
+ }
+ else
+ {
+ throw new IllegalStateException("Invalid type: " + udi.type);
+ }
+
+ metaDataMap.put(udi.name, wsMetaData);
+
+ for (ServiceMetaData serviceMetaData : wsMetaData.getServices())
+ {
+ for (EndpointMetaData epMetaData : serviceMetaData.getEndpoints())
+ {
+ ServiceEndpointInfo seInfo = new ServiceEndpointInfo(udi, (ServerEndpointMetaData)epMetaData);
+ epManager.createServiceEndpoint(seInfo);
+ }
+ }
+ }
+ catch (Exception ex)
+ {
+ log.error("Cannot create service endpoint", ex);
+ if (ex instanceof RuntimeException)
+ throw (RuntimeException)ex;
+
+ throw new WSException(ex);
+ }
+ }
+
+ public void start(UnifiedDeploymentInfo udi)
+ {
+ if(log.isDebugEnabled()) log.debug("start: " + udi.name);
+ try
+ {
+ UnifiedMetaData wsMetaData = getUnifiedMetaData(udi);
+ if (wsMetaData != null)
+ {
+ // late initialization of the web context loader
+ if (wsMetaData.getClassLoader() != udi.classLoader)
+ wsMetaData.setClassLoader(udi.classLoader);
+
+ // Publish the WSDL file
+ WSDLFilePublisher wsdlfp = new WSDLFilePublisher(udi);
+ wsdlfp.publishWsdlFiles(wsMetaData);
+ for (ServiceMetaData serviceMetaData : wsMetaData.getServices())
+ {
+ for (EndpointMetaData epMetaData : serviceMetaData.getEndpoints())
+ {
+ ObjectName sepID = ((ServerEndpointMetaData)epMetaData).getServiceEndpointID();
+ epManager.startServiceEndpoint(sepID);
+ }
+ }
+ }
+ }
+ catch (Exception ex)
+ {
+ log.error("Cannot start service endpoint", ex);
+ if (ex instanceof RuntimeException)
+ throw (RuntimeException)ex;
+
+ throw new WSException(ex);
+ }
+ }
+
+ public void stop(UnifiedDeploymentInfo udi)
+ {
+ if(log.isDebugEnabled()) log.debug("stop: " + udi.name);
+ try
+ {
+ UnifiedMetaData wsMetaData = getUnifiedMetaData(udi);
+ if (wsMetaData != null)
+ {
+ // Stop the service endpoints
+ for (ServiceMetaData serviceMetaData : wsMetaData.getServices())
+ {
+ for (EndpointMetaData epMetaData : serviceMetaData.getEndpoints())
+ {
+ ObjectName sepID = ((ServerEndpointMetaData)epMetaData).getServiceEndpointID();
+ epManager.stopServiceEndpoint(sepID);
+ }
+ }
+
+ // Unpublish the WSDL file
+ WSDLFilePublisher wsdlfp = new WSDLFilePublisher(udi);
+ wsdlfp.unpublishWsdlFiles();
+ }
+ }
+ catch (Exception ex)
+ {
+ log.error("Cannot stop service endpoint", ex);
+ if (ex instanceof RuntimeException)
+ throw (RuntimeException)ex;
+
+ throw new WSException(ex);
+ }
+ }
+
+ public void destroy(UnifiedDeploymentInfo udi)
+ {
+ if(log.isDebugEnabled()) log.debug("destroy: " + udi.name);
+ try
+ {
+ UnifiedMetaData wsMetaData = getUnifiedMetaData(udi);
+ if (wsMetaData != null)
+ {
+ // Destroy the service endpoints
+ for (ServiceMetaData serviceMetaData : wsMetaData.getServices())
+ {
+ for (EndpointMetaData epMetaData : serviceMetaData.getEndpoints())
+ {
+ ObjectName sepID = ((ServerEndpointMetaData)epMetaData).getServiceEndpointID();
+ epManager.destroyServiceEndpoint(sepID);
+ }
+ }
+ removeUnifiedMetaData(udi);
+ }
+ }
+ catch (Exception ex)
+ {
+ log.error("Cannot destroy service endpoint", ex);
+ if (ex instanceof RuntimeException)
+ throw (RuntimeException)ex;
+
+ throw new WSException(ex);
+ }
+ }
+
+ public UnifiedMetaData getUnifiedMetaData(UnifiedDeploymentInfo udi)
+ {
+ UnifiedMetaData wsMetaData = metaDataMap.get(udi.name);
+ return wsMetaData;
+ }
+
+ public void removeUnifiedMetaData(UnifiedDeploymentInfo udi)
+ {
+ metaDataMap.remove(udi.name);
+ }
+}
\ No newline at end of file
Modified: trunk/integration-tomcat/src/java/org/jboss/ws/integration/tomcat/TomcatServiceEndpointPublisher.java
===================================================================
--- trunk/integration-tomcat/src/java/org/jboss/ws/integration/tomcat/TomcatServiceEndpointPublisher.java 2007-05-04 10:28:42 UTC (rev 2958)
+++ trunk/integration-tomcat/src/java/org/jboss/ws/integration/tomcat/TomcatServiceEndpointPublisher.java 2007-05-04 12:20:09 UTC (rev 2959)
@@ -31,7 +31,7 @@
import java.util.Set;
import org.jboss.logging.Logger;
-import org.jboss.ws.core.server.ServiceEndpointPublisher;
+import org.jboss.ws.core.deployment.ServiceEndpointPublisher;
/**
* Publish the HTTP service endpoint to Tomcat
Modified: trunk/integration-tomcat/src/java/org/jboss/ws/integration/tomcat/TomcatServiceEndpointServlet.java
===================================================================
--- trunk/integration-tomcat/src/java/org/jboss/ws/integration/tomcat/TomcatServiceEndpointServlet.java 2007-05-04 10:28:42 UTC (rev 2958)
+++ trunk/integration-tomcat/src/java/org/jboss/ws/integration/tomcat/TomcatServiceEndpointServlet.java 2007-05-04 12:20:09 UTC (rev 2959)
@@ -37,15 +37,14 @@
import org.jboss.kernel.spi.registry.KernelRegistryEntry;
import org.jboss.logging.Logger;
import org.jboss.ws.WSException;
-import org.jboss.ws.core.server.JAXWSDeployment;
-import org.jboss.ws.core.server.UnifiedDeploymentInfo;
+import org.jboss.ws.core.deployment.JAXRPCDeployment;
+import org.jboss.ws.core.deployment.JAXWSDeployment;
+import org.jboss.ws.core.deployment.UnifiedDeploymentInfo;
import org.jboss.ws.core.server.legacy.AbstractServiceEndpointServlet;
-import org.jboss.ws.core.server.legacy.ServiceEndpointDeployer;
import org.jboss.ws.integration.KernelLocator;
import org.jboss.ws.integration.ResourceLoaderAdapter;
import org.jboss.ws.integration.UnifiedVirtualFile;
import org.jboss.ws.integration.deployment.Deployment.DeploymentType;
-import org.jboss.ws.metadata.builder.jaxrpc.JAXRPCDeployment;
/**
* A servlet that is installed for every web service endpoint.
Modified: trunk/integration-tomcat/src/java/org/jboss/ws/integration/tomcat/wspublish.java
===================================================================
--- trunk/integration-tomcat/src/java/org/jboss/ws/integration/tomcat/wspublish.java 2007-05-04 10:28:42 UTC (rev 2958)
+++ trunk/integration-tomcat/src/java/org/jboss/ws/integration/tomcat/wspublish.java 2007-05-04 12:20:09 UTC (rev 2959)
@@ -32,7 +32,7 @@
import org.jboss.logging.Logger;
import org.jboss.util.file.JarUtils;
-import org.jboss.ws.core.server.UnifiedDeploymentInfo;
+import org.jboss.ws.core.deployment.UnifiedDeploymentInfo;
/**
* Publish a standard portable J2EE web service endpoint
Added: trunk/jbossws-core/src/java/org/jboss/ws/core/deployment/EagerInitializeDeployer.java
===================================================================
--- trunk/jbossws-core/src/java/org/jboss/ws/core/deployment/EagerInitializeDeployer.java (rev 0)
+++ trunk/jbossws-core/src/java/org/jboss/ws/core/deployment/EagerInitializeDeployer.java 2007-05-04 12:20:09 UTC (rev 2959)
@@ -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.core.deployment;
+
+//$Id$
+
+import org.jboss.ws.integration.deployment.AbstractDeployer;
+import org.jboss.ws.integration.deployment.Deployment;
+import org.jboss.ws.metadata.umdm.UnifiedMetaData;
+
+/**
+ * A deployer that initializes the UMDM
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 25-Apr-2007
+ */
+public class EagerInitializeDeployer extends AbstractDeployer
+{
+ @Override
+ public void create(Deployment dep)
+ {
+ UnifiedMetaData umd = dep.getContext().getAttachment(UnifiedMetaData.class);
+ if (umd == null)
+ throw new IllegalStateException("Cannot obtain unified meta data");
+
+ umd.eagerInitialize();
+ }
+}
\ No newline at end of file
Property changes on: trunk/jbossws-core/src/java/org/jboss/ws/core/deployment/EagerInitializeDeployer.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: trunk/jbossws-core/src/java/org/jboss/ws/core/deployment/EndpointHandlerDeployer.java
===================================================================
--- trunk/jbossws-core/src/java/org/jboss/ws/core/deployment/EndpointHandlerDeployer.java (rev 0)
+++ trunk/jbossws-core/src/java/org/jboss/ws/core/deployment/EndpointHandlerDeployer.java 2007-05-04 12:20:09 UTC (rev 2959)
@@ -0,0 +1,115 @@
+/*
+ * 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.core.deployment;
+
+//$Id$
+
+import java.util.Map;
+
+import org.jboss.ws.integration.Endpoint;
+import org.jboss.ws.integration.LifecycleHandler;
+import org.jboss.ws.integration.RequestHandler;
+import org.jboss.ws.integration.deployment.AbstractDeployer;
+import org.jboss.ws.integration.deployment.Deployment;
+import org.jboss.ws.integration.invocation.InvocationHandler;
+
+/**
+ * A deployer that assigns the handlers to the Endpoint
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 25-Apr-2007
+ */
+public class EndpointHandlerDeployer extends AbstractDeployer
+{
+ private String requestHandler;
+ private String lifecycleHandler;
+ private Map<String,String> invocationHandler;
+
+ public void setLifecycleHandler(String handler)
+ {
+ this.lifecycleHandler = handler;
+ }
+
+ public void setRequestHandler(String handler)
+ {
+ this.requestHandler = handler;
+ }
+
+ public void setInvocationHandler(Map<String,String> handlers)
+ {
+ this.invocationHandler = handlers;
+ }
+
+ @Override
+ public void create(Deployment dep)
+ {
+ for (Endpoint ep : dep.getService().getEndpoints())
+ {
+ ep.setRequestHandler(getRequestHandler(dep));
+ ep.setLifecycleHandler(getLifecycleHandler(dep));
+ ep.setInvocationHandler(getInvocationHandler(dep));
+ }
+ }
+
+ private RequestHandler getRequestHandler(Deployment dep)
+ {
+ try
+ {
+ Class<?> handlerClass = dep.getClassLoader().loadClass(requestHandler);
+ return (RequestHandler)handlerClass.newInstance();
+ }
+ catch (Exception e)
+ {
+ throw new IllegalStateException("Cannot load request handler: " + requestHandler);
+ }
+ }
+
+ private LifecycleHandler getLifecycleHandler(Deployment dep)
+ {
+ try
+ {
+ Class<?> handlerClass = dep.getClassLoader().loadClass(lifecycleHandler);
+ return (LifecycleHandler)handlerClass.newInstance();
+ }
+ catch (Exception e)
+ {
+ throw new IllegalStateException("Cannot load lifecycle handler: " + lifecycleHandler);
+ }
+ }
+
+ private InvocationHandler getInvocationHandler(Deployment dep)
+ {
+ String className = invocationHandler.get(dep.getType().toString());
+ if (className == null)
+ throw new IllegalStateException("Cannot obtain invocation handler for: " + dep.getType());
+
+ try
+ {
+ Class<?> handlerClass = dep.getClassLoader().loadClass(className);
+ return (InvocationHandler)handlerClass.newInstance();
+ }
+ catch (Exception e)
+ {
+ throw new IllegalStateException("Cannot load invocation handler: " + className);
+ }
+ }
+}
\ No newline at end of file
Property changes on: trunk/jbossws-core/src/java/org/jboss/ws/core/deployment/EndpointHandlerDeployer.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: trunk/jbossws-core/src/java/org/jboss/ws/core/deployment/EndpointLifecycleDeployer.java
===================================================================
--- trunk/jbossws-core/src/java/org/jboss/ws/core/deployment/EndpointLifecycleDeployer.java (rev 0)
+++ trunk/jbossws-core/src/java/org/jboss/ws/core/deployment/EndpointLifecycleDeployer.java 2007-05-04 12:20:09 UTC (rev 2959)
@@ -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.core.deployment;
+
+//$Id$
+
+import org.jboss.ws.integration.Endpoint;
+import org.jboss.ws.integration.Service;
+import org.jboss.ws.integration.deployment.AbstractDeployer;
+import org.jboss.ws.integration.deployment.Deployment;
+
+/**
+ * A deployer that that calls the endpoint lifecycle handler
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 25-Apr-2007
+ */
+public class EndpointLifecycleDeployer extends AbstractDeployer
+{
+ @Override
+ public void create(Deployment dep)
+ {
+ for (Endpoint ep : dep.getService().getEndpoints())
+ ep.getLifecycleHandler().create(ep);
+ }
+
+ @Override
+ public void start(Deployment dep)
+ {
+ for (Endpoint ep : dep.getService().getEndpoints())
+ {
+ ep.getLifecycleHandler().start(ep);
+ }
+ }
+
+ @Override
+ public void stop(Deployment dep)
+ {
+ Service service = dep.getService();
+ if (service != null)
+ {
+ for (Endpoint ep : service.getEndpoints())
+ {
+ ep.getLifecycleHandler().stop(ep);
+ }
+ }
+ }
+
+ @Override
+ public void destroy(Deployment dep)
+ {
+ Service service = dep.getService();
+ if (service != null)
+ {
+ for (Endpoint ep : service.getEndpoints())
+ {
+ ep.getLifecycleHandler().destroy(ep);
+ }
+ }
+ }
+}
Property changes on: trunk/jbossws-core/src/java/org/jboss/ws/core/deployment/EndpointLifecycleDeployer.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: trunk/jbossws-core/src/java/org/jboss/ws/core/deployment/EndpointNameDeployer.java
===================================================================
--- trunk/jbossws-core/src/java/org/jboss/ws/core/deployment/EndpointNameDeployer.java (rev 0)
+++ trunk/jbossws-core/src/java/org/jboss/ws/core/deployment/EndpointNameDeployer.java 2007-05-04 12:20:09 UTC (rev 2959)
@@ -0,0 +1,54 @@
+/*
+ * 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.core.deployment;
+
+//$Id$
+
+import javax.management.ObjectName;
+
+import org.jboss.ws.integration.Endpoint;
+import org.jboss.ws.integration.deployment.AbstractDeployer;
+import org.jboss.ws.integration.deployment.Deployment;
+import org.jboss.ws.metadata.umdm.ServerEndpointMetaData;
+
+/**
+ * A deployer that assigns the complete name to the Endpoint
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 25-Apr-2007
+ */
+public class EndpointNameDeployer extends AbstractDeployer
+{
+ @Override
+ public void create(Deployment dep)
+ {
+ for (Endpoint ep : dep.getService().getEndpoints())
+ {
+ ServerEndpointMetaData sepMetaData = ep.getMetaData(ServerEndpointMetaData.class);
+ if (sepMetaData == null)
+ throw new IllegalStateException("Cannot obtain endpoint meta data");
+
+ ObjectName sepID = sepMetaData.getServiceEndpointID();
+ ep.setName(sepID);
+ }
+ }
+}
\ No newline at end of file
Property changes on: trunk/jbossws-core/src/java/org/jboss/ws/core/deployment/EndpointNameDeployer.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Copied: trunk/jbossws-core/src/java/org/jboss/ws/core/deployment/JAXRPCClientDeployment.java (from rev 2953, trunk/jbossws-core/src/java/org/jboss/ws/metadata/builder/jaxrpc/JAXRPCClientDeployment.java)
===================================================================
--- trunk/jbossws-core/src/java/org/jboss/ws/core/deployment/JAXRPCClientDeployment.java (rev 0)
+++ trunk/jbossws-core/src/java/org/jboss/ws/core/deployment/JAXRPCClientDeployment.java 2007-05-04 12:20:09 UTC (rev 2959)
@@ -0,0 +1,41 @@
+/*
+ * 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.core.deployment;
+
+//$Id$
+
+import org.jboss.ws.integration.deployment.Deployment.DeploymentType;
+
+/**
+ * The container independent deployment info.
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 05-May-2006
+ */
+public class JAXRPCClientDeployment extends UnifiedDeploymentInfo
+{
+
+ public JAXRPCClientDeployment(DeploymentType type)
+ {
+ super(type);
+ }
+}
Copied: trunk/jbossws-core/src/java/org/jboss/ws/core/deployment/JAXRPCDeployment.java (from rev 2953, trunk/jbossws-core/src/java/org/jboss/ws/metadata/builder/jaxrpc/JAXRPCDeployment.java)
===================================================================
--- trunk/jbossws-core/src/java/org/jboss/ws/core/deployment/JAXRPCDeployment.java (rev 0)
+++ trunk/jbossws-core/src/java/org/jboss/ws/core/deployment/JAXRPCDeployment.java 2007-05-04 12:20:09 UTC (rev 2959)
@@ -0,0 +1,84 @@
+/*
+ * 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.core.deployment;
+
+import java.io.InputStream;
+import java.net.URL;
+
+import org.jboss.ws.WSException;
+import org.jboss.ws.integration.UnifiedVirtualFile;
+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.xb.binding.ObjectModelFactory;
+import org.jboss.xb.binding.Unmarshaller;
+import org.jboss.xb.binding.UnmarshallerFactory;
+
+// $Id$
+
+/**
+ * The container independent deployment info.
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 05-May-2006
+ */
+public class JAXRPCDeployment extends UnifiedDeploymentInfo
+{
+ private WebservicesMetaData wsMetaData;
+
+ public JAXRPCDeployment(DeploymentType type, WebservicesMetaData wsMetaData)
+ {
+ super(type);
+ this.wsMetaData = wsMetaData;
+ }
+
+ public JAXRPCDeployment(DeploymentType type, UnifiedVirtualFile vfWebservices)
+ {
+ super(type);
+
+ try
+ {
+ // Unmarshall webservices.xml
+ URL webservicesURL = vfWebservices.toURL();
+ InputStream is = webservicesURL.openStream();
+ try
+ {
+ Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller();
+ ObjectModelFactory factory = new WebservicesFactory(webservicesURL);
+ wsMetaData = (WebservicesMetaData)unmarshaller.unmarshal(is, factory, null);
+ }
+ finally
+ {
+ is.close();
+ }
+ }
+ catch (Exception ex)
+ {
+ WSException.rethrow(ex);
+ }
+ }
+
+ public WebservicesMetaData getWebservicesMetaData()
+ {
+ return wsMetaData;
+ }
+}
Copied: trunk/jbossws-core/src/java/org/jboss/ws/core/deployment/JAXWSDeployment.java (from rev 2953, trunk/jbossws-core/src/java/org/jboss/ws/core/server/JAXWSDeployment.java)
===================================================================
--- trunk/jbossws-core/src/java/org/jboss/ws/core/deployment/JAXWSDeployment.java (rev 0)
+++ trunk/jbossws-core/src/java/org/jboss/ws/core/deployment/JAXWSDeployment.java 2007-05-04 12:20:09 UTC (rev 2959)
@@ -0,0 +1,40 @@
+/*
+ * 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.core.deployment;
+
+//$Id$
+
+import org.jboss.ws.integration.deployment.Deployment.DeploymentType;
+
+/**
+ * The container independent deployment info.
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 29-Jun-2006
+ */
+public class JAXWSDeployment extends UnifiedDeploymentInfo
+{
+ public JAXWSDeployment(DeploymentType type)
+ {
+ super(type);
+ }
+}
Added: trunk/jbossws-core/src/java/org/jboss/ws/core/deployment/PublishContractDeployer.java
===================================================================
--- trunk/jbossws-core/src/java/org/jboss/ws/core/deployment/PublishContractDeployer.java (rev 0)
+++ trunk/jbossws-core/src/java/org/jboss/ws/core/deployment/PublishContractDeployer.java 2007-05-04 12:20:09 UTC (rev 2959)
@@ -0,0 +1,62 @@
+/*
+ * 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.core.deployment;
+
+//$Id$
+
+import java.io.IOException;
+
+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 publishes the wsdl
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 25-Apr-2007
+ */
+public class PublishContractDeployer extends AbstractDeployer
+{
+ @Override
+ public void create(Deployment dep)
+ {
+ UnifiedDeploymentInfo udi = dep.getContext().getAttachment(UnifiedDeploymentInfo.class);
+ if (udi == null)
+ throw new IllegalStateException("Cannot obtain unified deployement info");
+
+ UnifiedMetaData umd = dep.getContext().getAttachment(UnifiedMetaData.class);
+ if (umd == null)
+ throw new IllegalStateException("Cannot obtain unified meta data");
+
+ try
+ {
+ WSDLFilePublisher publisher = new WSDLFilePublisher(udi);
+ publisher.publishWsdlFiles(umd);
+ }
+ catch (IOException ex)
+ {
+ throw new WSDeploymentException(ex);
+ }
+ }
+}
\ No newline at end of file
Property changes on: trunk/jbossws-core/src/java/org/jboss/ws/core/deployment/PublishContractDeployer.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Copied: trunk/jbossws-core/src/java/org/jboss/ws/core/deployment/ServiceEndpointPublisher.java (from rev 2955, trunk/jbossws-core/src/java/org/jboss/ws/core/server/ServiceEndpointPublisher.java)
===================================================================
--- trunk/jbossws-core/src/java/org/jboss/ws/core/deployment/ServiceEndpointPublisher.java (rev 0)
+++ trunk/jbossws-core/src/java/org/jboss/ws/core/deployment/ServiceEndpointPublisher.java 2007-05-04 12:20:09 UTC (rev 2959)
@@ -0,0 +1,264 @@
+/*
+ * 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.core.deployment;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.InputStream;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import javax.servlet.Servlet;
+
+import org.jboss.logging.Logger;
+import org.jboss.ws.WSException;
+import org.jboss.ws.core.utils.DOMUtils;
+import org.jboss.ws.core.utils.DOMWriter;
+import org.jboss.ws.core.utils.IOUtils;
+import org.jboss.ws.core.utils.JavaUtils;
+import org.jboss.ws.integration.Endpoint;
+import org.w3c.dom.Element;
+
+/**
+ * The publisher for web service endpoints
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 12-May-2006
+ */
+public class ServiceEndpointPublisher
+{
+ // logging support
+ private static Logger log = Logger.getLogger(ServiceEndpointPublisher.class);
+
+ // The configured service endpoint servlet
+ private String servletClass;
+
+ // The results of the URL rewriting
+ public class RewriteResults
+ {
+ // The URL to the rewrittn web.xml
+ public URL webXML;
+ // Map<servlet-name, servlet-class> the servlet-class enties are the implementation beans
+ public Map<String, String> sepTargetMap = new HashMap<String, String>();
+ }
+
+ public String getServletClass()
+ {
+ return servletClass;
+ }
+
+ public void setServletClass(String servletClass)
+ {
+ this.servletClass = servletClass;
+ }
+
+ public RewriteResults rewriteWebXml(UnifiedDeploymentInfo udi)
+ {
+ URL warURL = udi.webappURL;
+ File warFile = new File(warURL.getFile());
+ if (warFile.isDirectory() == false)
+ throw new WSException("Expected a war directory: " + warURL);
+
+ File webXML = new File(warURL.getFile() + "/WEB-INF/web.xml");
+ if (webXML.isFile() == false)
+ throw new WSException("Cannot find web.xml: " + webXML);
+
+ try
+ {
+ // After redeployment there might be a stale copy of the original web.xml.org, we delete it
+ File orgWebXML = new File(webXML.getCanonicalPath() + ".org");
+ orgWebXML.delete();
+
+ // Rename the web.xml
+ if (webXML.renameTo(orgWebXML) == false)
+ throw new WSException("Cannot rename web.xml: " + orgWebXML);
+
+ FileInputStream stream = new FileInputStream(orgWebXML);
+ return rewriteWebXml(stream, webXML, udi.classLoader);
+ }
+ catch (RuntimeException rte)
+ {
+ throw rte;
+ }
+ catch (Exception e)
+ {
+ throw new WSException(e);
+ }
+ }
+
+ public RewriteResults rewriteWebXml(InputStream source, File dest, ClassLoader loader) throws Exception
+ {
+ if (dest == null)
+ {
+ dest = File.createTempFile("jbossws-alt-web", "xml", IOUtils.createTempDirectory());
+ dest.deleteOnExit();
+ }
+
+ Element root = DOMUtils.parse(source);
+ RewriteResults results = modifyServletConfig(root, loader);
+ results.webXML = dest.toURL();
+
+ FileOutputStream fos = new FileOutputStream(dest);
+ new DOMWriter(fos).setPrettyprint(true).print(root);
+ fos.flush();
+ fos.close();
+
+ return results;
+ }
+
+ private RewriteResults modifyServletConfig(Element root, ClassLoader loader) throws ClassNotFoundException
+ {
+ RewriteResults results = new RewriteResults();
+ Iterator itServlets = DOMUtils.getChildElements(root, "servlet");
+ while (itServlets.hasNext())
+ {
+ Element servletElement = (Element)itServlets.next();
+ String linkName = DOMUtils.getTextContent(DOMUtils.getFirstChildElement(servletElement, "servlet-name"));
+
+ // find the servlet-class
+ Element classElement = DOMUtils.getFirstChildElement(servletElement, "servlet-class");
+
+ // JSP
+ if (classElement == null)
+ continue;
+
+ String orgServletClassName = DOMUtils.getTextContent(classElement).trim();
+
+ // Get the servlet class
+ Class orgServletClass = null;
+ if (loader != null)
+ {
+ try
+ {
+ orgServletClass = loader.loadClass(orgServletClassName);
+ }
+ catch (ClassNotFoundException ex)
+ {
+ log.warn("Cannot load servlet class: " + orgServletClassName);
+ }
+ }
+
+ String targetBeanName = null;
+
+ // Nothing to do if we have an <init-param>
+ if (isAlreadyModified(servletElement))
+ {
+ Iterator itParams = DOMUtils.getChildElements(servletElement, "init-param");
+ while (itParams.hasNext())
+ {
+ Element elParam = (Element)itParams.next();
+ Element elParamName = DOMUtils.getFirstChildElement(elParam, "param-name");
+ Element elParamValue = DOMUtils.getFirstChildElement(elParam, "param-value");
+ if (Endpoint.SEPID_DOMAIN_ENDPOINT.equals(DOMUtils.getTextContent(elParamName)))
+ {
+ targetBeanName = DOMUtils.getTextContent(elParamValue);
+ }
+ }
+ }
+ else
+ {
+ // Check if it is a real servlet that we can ignore
+ if (orgServletClass != null && JavaUtils.isAssignableFrom(Servlet.class, orgServletClass))
+ {
+ log.info("Ignore servlet: " + orgServletClassName);
+ continue;
+ }
+ else if (orgServletClassName.endsWith("Servlet"))
+ {
+ log.info("Ignore <servlet-class> that ends with 'Servlet': " + orgServletClassName);
+ continue;
+ }
+
+ // build a list of detached elements that come after <servlet-class>
+ boolean startDetach = false;
+ List<Element> detachedElements = new ArrayList<Element>();
+ Iterator itDetached = DOMUtils.getChildElements(servletElement);
+ while (itDetached.hasNext())
+ {
+ Element el = (Element)itDetached.next();
+ if (startDetach == true)
+ {
+ detachedElements.add(el);
+ servletElement.removeChild(el);
+ }
+ if (el.equals(classElement))
+ {
+ servletElement.removeChild(el);
+ startDetach = true;
+ }
+ }
+
+ // replace the class name
+ classElement = (Element)DOMUtils.createElement("servlet-class");
+ classElement.appendChild(DOMUtils.createTextNode(servletClass));
+ classElement = (Element)servletElement.getOwnerDocument().importNode(classElement, true);
+ servletElement.appendChild(classElement);
+
+ // add additional init params
+ if (orgServletClassName.equals(servletClass) == false)
+ {
+ Element paramElement = DOMUtils.createElement("init-param");
+ paramElement.appendChild(DOMUtils.createElement("param-name")).appendChild(DOMUtils.createTextNode(Endpoint.SEPID_DOMAIN_ENDPOINT));
+ paramElement.appendChild(DOMUtils.createElement("param-value")).appendChild(DOMUtils.createTextNode(orgServletClassName));
+ paramElement = (Element)servletElement.getOwnerDocument().importNode(paramElement, true);
+ servletElement.appendChild(paramElement);
+ targetBeanName = orgServletClassName;
+ }
+
+ // reattach the elements
+ itDetached = detachedElements.iterator();
+ while (itDetached.hasNext())
+ {
+ Element el = (Element)itDetached.next();
+ servletElement.appendChild(el);
+ }
+ }
+
+ if (targetBeanName == null)
+ throw new IllegalStateException("Cannot obtain service endpoint bean for: " + linkName);
+
+ // remember the target bean name
+ results.sepTargetMap.put(linkName, targetBeanName.trim());
+ }
+
+ return results;
+ }
+
+ // Return true if the web.xml is already modified
+ private boolean isAlreadyModified(Element servletElement)
+ {
+ Iterator itParams = DOMUtils.getChildElements(servletElement, "init-param");
+ while (itParams.hasNext())
+ {
+ Element elParam = (Element)itParams.next();
+ Element elParamName = DOMUtils.getFirstChildElement(elParam, "param-name");
+ if (Endpoint.SEPID_DOMAIN_ENDPOINT.equals(DOMUtils.getTextContent(elParamName)))
+ return true;
+ }
+ return false;
+ }
+}
\ No newline at end of file
Copied: trunk/jbossws-core/src/java/org/jboss/ws/core/deployment/UnifiedDeploymentInfo.java (from rev 2953, trunk/jbossws-core/src/java/org/jboss/ws/core/server/UnifiedDeploymentInfo.java)
===================================================================
--- trunk/jbossws-core/src/java/org/jboss/ws/core/deployment/UnifiedDeploymentInfo.java (rev 0)
+++ trunk/jbossws-core/src/java/org/jboss/ws/core/deployment/UnifiedDeploymentInfo.java 2007-05-04 12:20:09 UTC (rev 2959)
@@ -0,0 +1,144 @@
+/*
+ * 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.core.deployment;
+
+// $Id: UnifiedDeploymentInfo.java 2923 2007-04-25 14:23:29Z thomas.diesler(a)jboss.com $
+
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.management.ObjectName;
+
+import org.jboss.ws.integration.UnifiedVirtualFile;
+import org.jboss.ws.integration.deployment.Deployment.DeploymentType;
+
+/**
+ * The container independent deployment info.
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 05-May-2006
+ */
+public class UnifiedDeploymentInfo
+{
+ public UnifiedDeploymentInfo(DeploymentType type)
+ {
+ this.type = type;
+ }
+
+ /** The type of this deployment */
+ public DeploymentType type;
+ /** Sub deployments have a parent */
+ public UnifiedDeploymentInfo parent;
+ /** The suffix of the deployment url */
+ public String simpleName;
+ /** The URL for this deployment */
+ public URL url;
+ /** The virtual file for the deployment root */
+ public UnifiedVirtualFile vfRoot;
+ /** The string identifing this deployment **/
+ public String name;
+ /** The URL to the expanded webapp **/
+ public URL webappURL;
+ /** We can hold "typed" metadata */
+ public Object metaData;
+ /** The deployment classloader **/
+ public ClassLoader classLoader;
+ /** An optional ObjectName of the deployed object */
+ public ObjectName deployedObject;
+
+ /** An arbitrary map of state associated with the deployment */
+ private Map<Class, Object> attachments = new HashMap<Class, Object>();
+
+ public <T> T getAttachment(Class<T> key)
+ {
+ return (T)attachments.get(key);
+ }
+
+ public <T> T addAttachment(Class<T> key, T value)
+ {
+ return (T)attachments.put(key, value);
+ }
+
+ /** The sortName concatenated with the canonical names of all parents. */
+ public String getCanonicalName()
+ {
+ String name = simpleName;
+ if (parent != null)
+ name = parent.getCanonicalName() + "/" + name;
+ return name;
+ }
+
+ public URL getMetaDataFileURL(String resourcePath) throws IOException
+ {
+ URL resourceURL = null;
+ if (resourcePath != null && resourcePath.length() > 0)
+ {
+ if (resourcePath.startsWith("/"))
+ resourcePath = resourcePath.substring(1);
+
+ try
+ {
+ // assign an absolute URL
+ resourceURL = new URL(resourcePath);
+ }
+ catch (MalformedURLException ex)
+ {
+ // ignore
+ }
+
+ if (resourceURL == null && vfRoot != null)
+ {
+ UnifiedVirtualFile vfResource = vfRoot.findChild(resourcePath);
+ resourceURL = vfResource.toURL();
+ }
+
+ if (resourceURL == null)
+ {
+ String deploymentPath = url.toExternalForm();
+
+ if (deploymentPath.startsWith("jar:") && deploymentPath.endsWith("!/") == false)
+ deploymentPath += "!/";
+
+ if (deploymentPath.endsWith("/") == false)
+ deploymentPath += "/";
+
+ // assign a relative URL
+ resourceURL = new URL(deploymentPath + resourcePath);
+ }
+ }
+ return resourceURL;
+ }
+
+ public String toString()
+ {
+ StringBuilder builder = new StringBuilder();
+ builder.append("[");
+ builder.append("type=" + type);
+ builder.append(",simpleName=" + simpleName);
+ builder.append(",url=" + url);
+ builder.append("]");
+ return builder.toString();
+ }
+}
Added: trunk/jbossws-core/src/java/org/jboss/ws/core/deployment/UnifiedMetaDataAssociationDeployer.java
===================================================================
--- trunk/jbossws-core/src/java/org/jboss/ws/core/deployment/UnifiedMetaDataAssociationDeployer.java (rev 0)
+++ trunk/jbossws-core/src/java/org/jboss/ws/core/deployment/UnifiedMetaDataAssociationDeployer.java 2007-05-04 12:20:09 UTC (rev 2959)
@@ -0,0 +1,86 @@
+/*
+ * 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.core.deployment;
+
+//$Id$
+
+import javax.management.ObjectName;
+
+import org.jboss.ws.integration.Endpoint;
+import org.jboss.ws.integration.deployment.AbstractDeployer;
+import org.jboss.ws.integration.deployment.Deployment;
+import org.jboss.ws.metadata.umdm.EndpointMetaData;
+import org.jboss.ws.metadata.umdm.ServerEndpointMetaData;
+import org.jboss.ws.metadata.umdm.ServiceMetaData;
+import org.jboss.ws.metadata.umdm.UnifiedMetaData;
+
+/**
+ * A deployer that assigns the EndpointMetaData to the Endpoint
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 25-Apr-2007
+ */
+public class UnifiedMetaDataAssociationDeployer extends AbstractDeployer
+{
+ @Override
+ public void create(Deployment dep)
+ {
+ UnifiedMetaData umd = dep.getContext().getAttachment(UnifiedMetaData.class);
+ if (umd == null)
+ throw new IllegalStateException("Cannot obtain unified meta data");
+
+ for (Endpoint ep : dep.getService().getEndpoints())
+ {
+ ServerEndpointMetaData sepMetaData = ep.getMetaData(ServerEndpointMetaData.class);
+ if (sepMetaData == null)
+ {
+ sepMetaData = getEndpointMetaData(umd, ep.getName());
+ sepMetaData.setServiceEndpointImplName(ep.getEndpointImpl().getName());
+ ep.addMetaData(ServerEndpointMetaData.class, sepMetaData);
+ }
+ }
+ }
+
+ private ServerEndpointMetaData getEndpointMetaData(UnifiedMetaData umd, ObjectName epName)
+ {
+ String propEndpoint = epName.getKeyProperty(Endpoint.SEPID_PROPERTY_ENDPOINT);
+
+ ServerEndpointMetaData epMetaData = null;
+ for (ServiceMetaData serviceMetaData : umd.getServices())
+ {
+ for (EndpointMetaData aux : serviceMetaData.getEndpoints())
+ {
+ String linkName = ((ServerEndpointMetaData)aux).getLinkName();
+ if (propEndpoint.equals(linkName))
+ {
+ epMetaData = (ServerEndpointMetaData)aux;
+ break;
+ }
+ }
+ }
+
+ if (epMetaData == null)
+ throw new IllegalStateException("Cannot find endpoint meta data for: " + epName);
+
+ return epMetaData;
+ }
+}
\ No newline at end of file
Property changes on: trunk/jbossws-core/src/java/org/jboss/ws/core/deployment/UnifiedMetaDataAssociationDeployer.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: trunk/jbossws-core/src/java/org/jboss/ws/core/deployment/UnifiedMetaDataDeployer.java
===================================================================
--- trunk/jbossws-core/src/java/org/jboss/ws/core/deployment/UnifiedMetaDataDeployer.java (rev 0)
+++ trunk/jbossws-core/src/java/org/jboss/ws/core/deployment/UnifiedMetaDataDeployer.java 2007-05-04 12:20:09 UTC (rev 2959)
@@ -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.core.deployment;
+
+//$Id$
+
+import org.jboss.ws.integration.deployment.AbstractDeployer;
+import org.jboss.ws.integration.deployment.Deployment;
+import org.jboss.ws.integration.deployment.Deployment.DeploymentType;
+import org.jboss.ws.metadata.builder.jaxrpc.JAXRPCServerMetaDataBuilder;
+import org.jboss.ws.metadata.builder.jaxws.JAXWSMetaDataBuilderEJB3;
+import org.jboss.ws.metadata.builder.jaxws.JAXWSMetaDataBuilderJSE;
+import org.jboss.ws.metadata.umdm.UnifiedMetaData;
+
+/**
+ * A deployer that builds the UnifiedDeploymentInfo
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 25-Apr-2007
+ */
+public class UnifiedMetaDataDeployer extends AbstractDeployer
+{
+ @Override
+ public void create(Deployment dep)
+ {
+ UnifiedMetaData umd = dep.getContext().getAttachment(UnifiedMetaData.class);
+ if (umd == null)
+ {
+ UnifiedDeploymentInfo udi = dep.getContext().getAttachment(UnifiedDeploymentInfo.class);
+ if (udi == null)
+ throw new IllegalStateException("Cannot obtain unified deployement info");
+
+ if (udi.type == DeploymentType.JAXRPC_JSE)
+ {
+ JAXRPCServerMetaDataBuilder builder = new JAXRPCServerMetaDataBuilder();
+ umd = builder.buildMetaData((JAXRPCDeployment)udi);
+ }
+ else if (udi.type == DeploymentType.JAXRPC_EJB21)
+ {
+ JAXRPCServerMetaDataBuilder builder = new JAXRPCServerMetaDataBuilder();
+ umd = builder.buildMetaData((JAXRPCDeployment)udi);
+ }
+ else if (udi.type == DeploymentType.JAXWS_JSE)
+ {
+ JAXWSMetaDataBuilderJSE builder = new JAXWSMetaDataBuilderJSE();
+ umd = builder.buildMetaData(udi);
+ }
+ else if (udi.type == DeploymentType.JAXWS_EJB3)
+ {
+ JAXWSMetaDataBuilderEJB3 builder = new JAXWSMetaDataBuilderEJB3();
+ umd = builder.buildMetaData(udi);
+ }
+ else
+ {
+ throw new IllegalStateException("Invalid type: " + udi.type);
+ }
+
+ dep.getContext().addAttachment(UnifiedMetaData.class, umd);
+ }
+ }
+}
\ No newline at end of file
Property changes on: trunk/jbossws-core/src/java/org/jboss/ws/core/deployment/UnifiedMetaDataDeployer.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Copied: trunk/jbossws-core/src/java/org/jboss/ws/core/deployment/WSDLFilePublisher.java (from rev 2953, trunk/jbossws-core/src/java/org/jboss/ws/core/server/WSDLFilePublisher.java)
===================================================================
--- trunk/jbossws-core/src/java/org/jboss/ws/core/deployment/WSDLFilePublisher.java (rev 0)
+++ trunk/jbossws-core/src/java/org/jboss/ws/core/deployment/WSDLFilePublisher.java 2007-05-04 12:20:09 UTC (rev 2959)
@@ -0,0 +1,328 @@
+/*
+ * 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.core.deployment;
+
+// $Id$
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.Writer;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.Iterator;
+import java.util.List;
+
+import javax.wsdl.Definition;
+import javax.wsdl.Import;
+import javax.wsdl.factory.WSDLFactory;
+
+import org.jboss.logging.Logger;
+import org.jboss.util.NotImplementedException;
+import org.jboss.ws.Constants;
+import org.jboss.ws.WSException;
+import org.jboss.ws.core.utils.DOMUtils;
+import org.jboss.ws.core.utils.IOUtils;
+import org.jboss.ws.core.utils.ResourceURL;
+import org.jboss.ws.integration.management.ServerConfig;
+import org.jboss.ws.integration.management.ServerConfigFactory;
+import org.jboss.ws.metadata.umdm.ServiceMetaData;
+import org.jboss.ws.metadata.umdm.UnifiedMetaData;
+import org.jboss.ws.metadata.wsdl.WSDLDefinitions;
+import org.jboss.ws.tools.wsdl.WSDLWriter;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
+/** A helper class that publishes the wsdl files and their imports to the server/data/wsdl directory.
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 02-June-2004
+ */
+public class WSDLFilePublisher
+{
+ // provide logging
+ private static final Logger log = Logger.getLogger(WSDLFilePublisher.class);
+
+ // The deployment info for the web service archive
+ private UnifiedDeploymentInfo udi;
+ // The expected wsdl location in the deployment
+ private String expLocation;
+
+ public WSDLFilePublisher(UnifiedDeploymentInfo udi)
+ {
+ this.udi = udi;
+
+ if (udi.type.toString().endsWith("JSE"))
+ {
+ expLocation = "WEB-INF/wsdl/";
+ }
+ else
+ {
+ expLocation = "META-INF/wsdl/";
+ }
+ }
+
+ /** Publish the deployed wsdl file to the data directory
+ */
+ public void publishWsdlFiles(UnifiedMetaData wsMetaData) throws IOException
+ {
+ String deploymentName = udi.getCanonicalName();
+
+ // For each service
+ for (ServiceMetaData serviceMetaData : wsMetaData.getServices())
+ {
+ File wsdlFile = getPublishLocation(deploymentName, serviceMetaData);
+ wsdlFile.getParentFile().mkdirs();
+
+ // Get the wsdl definition and write it to the wsdl publish location
+ try
+ {
+ Writer fWriter = IOUtils.getCharsetFileWriter(wsdlFile, Constants.DEFAULT_XML_CHARSET);
+ WSDLDefinitions wsdlDefinitions = serviceMetaData.getWsdlDefinitions();
+ new WSDLWriter(wsdlDefinitions).write(fWriter, Constants.DEFAULT_XML_CHARSET);
+
+ URL wsdlPublishURL = wsdlFile.toURL();
+ log.info("WSDL published to: " + wsdlPublishURL);
+
+ // udpate the wsdl file location
+ serviceMetaData.setWsdlLocation(wsdlFile.toURL());
+
+ // Process the wsdl imports
+ Definition wsdl11Definition = wsdlDefinitions.getWsdlOneOneDefinition();
+ if (wsdl11Definition != null)
+ {
+ publishWsdlImports(wsdlFile.toURL(), wsdl11Definition);
+
+ // Publish XMLSchema imports
+ Document document = wsdlDefinitions.getWsdlDocument();
+ publishSchemaImports(wsdlFile.toURL(), document.getDocumentElement());
+ }
+ else
+ {
+ throw new NotImplementedException("WSDL-2.0 imports");
+ }
+ }
+ catch (RuntimeException rte)
+ {
+ throw rte;
+ }
+ catch (Exception e)
+ {
+ throw new WSException("Cannot publish wsdl to: " + wsdlFile, e);
+ }
+ }
+ }
+
+ /** Publish the wsdl imports for a given wsdl definition
+ */
+ private void publishWsdlImports(URL parentURL, Definition parentDefinition) throws Exception
+ {
+ String baseURI = parentURL.toExternalForm();
+
+ Iterator it = parentDefinition.getImports().values().iterator();
+ while (it.hasNext())
+ {
+ for (Import wsdlImport : (List<Import>)it.next())
+ {
+ String locationURI = wsdlImport.getLocationURI();
+ Definition subdef = wsdlImport.getDefinition();
+
+ // its an external import, don't publish locally
+ if (locationURI.startsWith("http://") == false)
+ {
+ URL targetURL = new URL(baseURI.substring(0, baseURI.lastIndexOf("/") + 1) + locationURI);
+ File targetFile = new File(targetURL.getPath());
+ targetFile.getParentFile().mkdirs();
+
+ WSDLFactory wsdlFactory = WSDLFactory.newInstance();
+ javax.wsdl.xml.WSDLWriter wsdlWriter = wsdlFactory.newWSDLWriter();
+ FileWriter fw = new FileWriter(targetFile);
+ wsdlWriter.writeWSDL(subdef, fw);
+ fw.close();
+
+ if (log.isDebugEnabled())
+ log.debug("WSDL import published to: " + targetURL);
+
+ // recursivly publish imports
+ publishWsdlImports(targetURL, subdef);
+
+ // Publish XMLSchema imports
+ Element subdoc = DOMUtils.parse(targetURL.openStream());
+ publishSchemaImports(targetURL, subdoc);
+ }
+ }
+ }
+ }
+
+ /** Publish the schema imports for a given wsdl definition
+ */
+ private void publishSchemaImports(URL parentURL, Element element) throws Exception
+ {
+ String baseURI = parentURL.toExternalForm();
+
+ Iterator it = DOMUtils.getChildElements(element);
+ while (it.hasNext())
+ {
+ Element childElement = (Element)it.next();
+ if ("import".equals(childElement.getLocalName()) || "include".equals(childElement.getLocalName()))
+ {
+ String schemaLocation = childElement.getAttribute("schemaLocation");
+ if (schemaLocation.length() > 0)
+ {
+ if (schemaLocation.startsWith("http://") == false)
+ {
+ URL xsdURL = new URL(baseURI.substring(0, baseURI.lastIndexOf("/") + 1) + schemaLocation);
+ File targetFile = new File(xsdURL.getPath());
+ targetFile.getParentFile().mkdirs();
+
+ String deploymentName = udi.getCanonicalName();
+
+ // get the resource path
+ int index = baseURI.indexOf(deploymentName);
+ String resourcePath = baseURI.substring(index + deploymentName.length());
+ resourcePath = resourcePath.substring(0, resourcePath.lastIndexOf("/"));
+ if (resourcePath.length() > 0)
+ resourcePath = resourcePath + "/";
+
+ resourcePath = expLocation + resourcePath + schemaLocation;
+ URL resourceURL = udi.getMetaDataFileURL(resourcePath);
+ InputStream is = new ResourceURL(resourceURL).openStream();
+ if (is == null)
+ throw new IllegalArgumentException("Cannot find schema import in deployment: " + resourcePath);
+
+ FileOutputStream fos = new FileOutputStream(targetFile);
+ IOUtils.copyStream(fos, is);
+ fos.close();
+ is.close();
+
+ if (log.isDebugEnabled())
+ log.debug("XMLSchema import published to: " + xsdURL);
+
+ // recursivly publish imports
+ Element subdoc = DOMUtils.parse(xsdURL.openStream());
+ publishSchemaImports(xsdURL, subdoc);
+ }
+ }
+ }
+ else
+ {
+ publishSchemaImports(parentURL, childElement);
+ }
+ }
+ }
+
+ /**
+ * Delete the published wsdl
+ */
+ public void unpublishWsdlFiles() throws IOException
+ {
+ String deploymentDir = (udi.parent != null ? udi.parent.simpleName : udi.simpleName);
+ ServerConfig config = ServerConfigFactory.getInstance().getServerConfig();
+ File serviceDir = new File(config.getServerDataDir().getCanonicalPath() + "/wsdl/" + deploymentDir);
+ deleteWsdlPublishDirectory(serviceDir);
+ }
+
+ /**
+ * Delete the published wsdl document, traversing down the dir structure
+ */
+ private void deleteWsdlPublishDirectory(File dir) throws IOException
+ {
+ String[] files = dir.list();
+ for (int i = 0; files != null && i < files.length; i++)
+ {
+ String fileName = files[i];
+ File file = new File(dir + "/" + fileName);
+ if (file.isDirectory())
+ {
+ deleteWsdlPublishDirectory(file);
+ }
+ else
+ {
+ if (file.delete() == false)
+ log.warn("Cannot delete published wsdl document: " + file.toURL());
+ }
+ }
+
+ // delete the directory as well
+ dir.delete();
+ }
+
+ /**
+ * Get the file publish location
+ */
+ private File getPublishLocation(String archiveName, ServiceMetaData serviceMetaData) throws IOException
+ {
+ String wsdlLocation = null;
+ if (serviceMetaData.getWsdlLocation() != null)
+ wsdlLocation = serviceMetaData.getWsdlLocation().toExternalForm();
+ else if (serviceMetaData.getWsdlFile() != null)
+ wsdlLocation = serviceMetaData.getWsdlFile();
+
+ if (wsdlLocation == null)
+ throw new IllegalStateException("Cannot obtain wsdl location for: " + serviceMetaData.getServiceName());
+
+ if (log.isDebugEnabled())
+ log.debug("Publish WSDL file: " + wsdlLocation);
+
+ // Only file URLs are supported in <wsdl-publish-location>
+ String publishLocation = serviceMetaData.getWsdlPublishLocation();
+ boolean predefinedLocation = publishLocation != null && publishLocation.startsWith("file:");
+
+ File locationFile = null;
+ if (predefinedLocation == false)
+ {
+ ServerConfig config = ServerConfigFactory.getInstance().getServerConfig();
+ locationFile = new File(config.getServerDataDir().getCanonicalPath() + "/wsdl/" + archiveName);
+ }
+ else
+ {
+ try
+ {
+ locationFile = new File(new URL(publishLocation).getPath());
+ }
+ catch (MalformedURLException e)
+ {
+ throw new IllegalArgumentException("Invalid publish location: " + e.getMessage());
+ }
+ }
+
+ File wsdlFile;
+ if (wsdlLocation.indexOf(expLocation) >= 0)
+ {
+ wsdlLocation = wsdlLocation.substring(wsdlLocation.indexOf(expLocation) + expLocation.length());
+ wsdlFile = new File(locationFile + "/" + wsdlLocation);
+ }
+ else if (wsdlLocation.startsWith("vfsfile:") || wsdlLocation.startsWith("file:") || wsdlLocation.startsWith("jar:"))
+ {
+ wsdlLocation = wsdlLocation.substring(wsdlLocation.lastIndexOf("/") + 1);
+ wsdlFile = new File(locationFile + "/" + wsdlLocation);
+ }
+ else
+ {
+ throw new WSException("Invalid wsdlFile '" + wsdlLocation + "', expected in: " + expLocation);
+ }
+
+ return wsdlFile;
+ }
+}
Copied: trunk/jbossws-core/src/java/org/jboss/ws/core/server/AbstractInvocationHandler.java (from rev 2953, trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/AbstractInvocationHandler.java)
===================================================================
--- trunk/jbossws-core/src/java/org/jboss/ws/core/server/AbstractInvocationHandler.java (rev 0)
+++ trunk/jbossws-core/src/java/org/jboss/ws/core/server/AbstractInvocationHandler.java 2007-05-04 12:20:09 UTC (rev 2959)
@@ -0,0 +1,430 @@
+/*
+ * 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.core.server;
+
+// $Id$
+
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.lang.reflect.UndeclaredThrowableException;
+import java.util.HashMap;
+
+import javax.activation.DataHandler;
+import javax.management.MBeanException;
+import javax.xml.namespace.QName;
+import javax.xml.rpc.soap.SOAPFaultException;
+import javax.xml.soap.Name;
+import javax.xml.soap.SOAPBody;
+import javax.xml.soap.SOAPBodyElement;
+import javax.xml.soap.SOAPException;
+import javax.xml.soap.SOAPHeader;
+import javax.xml.ws.http.HTTPBinding;
+
+import org.jboss.logging.Logger;
+import org.jboss.ws.Constants;
+import org.jboss.ws.core.CommonBinding;
+import org.jboss.ws.core.CommonBindingProvider;
+import org.jboss.ws.core.CommonMessageContext;
+import org.jboss.ws.core.CommonSOAPBinding;
+import org.jboss.ws.core.DirectionHolder;
+import org.jboss.ws.core.EndpointInvocation;
+import org.jboss.ws.core.MessageAbstraction;
+import org.jboss.ws.core.DirectionHolder.Direction;
+import org.jboss.ws.core.jaxrpc.handler.HandlerDelegateJAXRPC;
+import org.jboss.ws.core.jaxrpc.handler.MessageContextJAXRPC;
+import org.jboss.ws.core.jaxws.binding.BindingProviderImpl;
+import org.jboss.ws.core.jaxws.handler.HandlerDelegateJAXWS;
+import org.jboss.ws.core.jaxws.handler.MessageContextJAXWS;
+import org.jboss.ws.core.soap.MessageContextAssociation;
+import org.jboss.ws.core.soap.SOAPMessageImpl;
+import org.jboss.ws.core.utils.JavaUtils;
+import org.jboss.ws.extensions.xop.XOPContext;
+import org.jboss.ws.integration.Endpoint;
+import org.jboss.ws.integration.invocation.InvocationContext;
+import org.jboss.ws.integration.invocation.InvocationHandler;
+import org.jboss.ws.metadata.umdm.EndpointMetaData;
+import org.jboss.ws.metadata.umdm.OperationMetaData;
+import org.jboss.ws.metadata.umdm.ServerEndpointMetaData;
+import org.jboss.ws.metadata.umdm.HandlerMetaData.HandlerType;
+
+/** An implementation handles invocations on the endpoint
+ *
+ * @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 Endpoint endpoint;
+ protected CommonBindingProvider bindingProvider;
+ protected ServerHandlerDelegate delegate;
+
+ /** Initialize the service endpoint */
+ public void init(Endpoint endpoint)
+ {
+ this.endpoint = endpoint;
+
+ ServerEndpointMetaData sepMetaData = endpoint.getMetaData(ServerEndpointMetaData.class);
+ if (sepMetaData == null)
+ throw new IllegalStateException("Cannot obtain endpoint meta data");
+
+ if (sepMetaData.getType() == EndpointMetaData.Type.JAXRPC)
+ {
+ bindingProvider = new CommonBindingProvider(sepMetaData);
+ delegate = new HandlerDelegateJAXRPC(sepMetaData);
+ }
+ else
+ {
+ bindingProvider = new BindingProviderImpl(sepMetaData);
+ delegate = new HandlerDelegateJAXWS(sepMetaData);
+ }
+ }
+
+ /** Load the SEI implementation bean if necessary */
+ protected abstract Class loadServiceEndpoint() throws ClassNotFoundException;
+
+ /** Create the instance of the SEI implementation bean if necessary */
+ protected abstract Object createServiceEndpointInstance(Class seiImplClass, InvocationContext context) throws Exception;
+
+ /** Invoke the instance of the SEI implementation bean */
+ protected abstract void invokeServiceEndpointInstance(Object seiImpl, EndpointInvocation epInv) throws Exception;
+
+ /** Destroy the instance of the SEI implementation bean if necessary */
+ protected abstract void destroyServiceEndpointInstance(Object seiImpl);
+
+ public boolean callRequestHandlerChain(ServerEndpointMetaData sepMetaData, HandlerType type)
+ {
+ return delegate.callRequestHandlerChain(sepMetaData, type);
+ }
+
+ public boolean callResponseHandlerChain(ServerEndpointMetaData sepMetaData, HandlerType type)
+ {
+ return delegate.callResponseHandlerChain(sepMetaData, type);
+ }
+
+ public void closeHandlerChain(ServerEndpointMetaData sepMetaData, HandlerType type)
+ {
+ delegate.closeHandlerChain(sepMetaData, type);
+ }
+
+ public boolean callFaultHandlerChain(ServerEndpointMetaData sepMetaData, HandlerType type, Exception ex)
+ {
+ return delegate.callFaultHandlerChain(sepMetaData, type, ex);
+ }
+
+ /** Invoke the the service endpoint */
+ public void invoke(InvocationContext reqContext) throws Exception
+ {
+ CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
+ ServerEndpointMetaData sepMetaData = (ServerEndpointMetaData)msgContext.getEndpointMetaData();
+ MessageAbstraction reqMessage = msgContext.getMessageAbstraction();
+
+ // Load the endpoint implementation bean
+ Class seImpl = loadServiceEndpoint();
+
+ // Create an instance of the endpoint implementation bean
+ Object seInstance = createServiceEndpointInstance(seImpl, reqContext);
+
+ // The direction of the message
+ DirectionHolder direction = new DirectionHolder(Direction.InBound);
+
+ // Get the order of pre/post handlerchains
+ HandlerType[] handlerType = delegate.getHandlerTypeOrder();
+ HandlerType[] faultType = delegate.getHandlerTypeOrder();
+
+ // Set the required inbound context properties
+ setInboundContextProperties();
+
+ try
+ {
+ boolean oneway = false;
+ EndpointInvocation epInv = null;
+ OperationMetaData opMetaData = null;
+ CommonBinding binding = bindingProvider.getCommonBinding();
+ binding.setHeaderSource(delegate);
+
+ // call the request handler chain
+ boolean handlersPass = callRequestHandlerChain(sepMetaData, handlerType[0]);
+
+ // Unbind the request message
+ if (handlersPass)
+ {
+ // Get the operation meta data from the SOAP message
+ opMetaData = getDispatchDestination(sepMetaData, reqMessage);
+ msgContext.setOperationMetaData(opMetaData);
+ oneway = opMetaData.isOneWay();
+
+ /*
+ * From JAX-WS 10.2.1 - "7. If the node does not understand how to process
+ * the message, then neither handlers nor the endpoint
+ * are invoked and instead the binding generates a SOAP must
+ * understand exception"
+ *
+ * Therefore, this must precede the ENDPOINT chain; however, The PRE
+ * chain still must happen first since the message may be encrypted, in which
+ * case the operation is still not known. Without knowing the operation, it
+ * is not possible to determine what headers are understood by the endpoint.
+ */
+ if (binding instanceof CommonSOAPBinding)
+ ((CommonSOAPBinding)binding).checkMustUnderstand(opMetaData);
+
+ // Unbind the request message
+ epInv = binding.unbindRequestMessage(opMetaData, reqMessage);
+ }
+
+ handlersPass = handlersPass && callRequestHandlerChain(sepMetaData, handlerType[1]);
+ handlersPass = handlersPass && callRequestHandlerChain(sepMetaData, handlerType[2]);
+
+ if (handlersPass)
+ {
+ msgContext.put(CommonMessageContext.ALLOW_EXPAND_TO_DOM, Boolean.TRUE);
+ try
+ {
+ // Check if protocol handlers modified the payload
+ if (msgContext.isModified())
+ {
+ log.debug("Handler modified payload, unbind message again");
+ reqMessage = msgContext.getMessageAbstraction();
+ epInv = binding.unbindRequestMessage(opMetaData, reqMessage);
+ }
+
+ // Invoke the service endpoint
+ invokeServiceEndpointInstance(seInstance, epInv);
+ }
+ finally
+ {
+ msgContext.remove(CommonMessageContext.ALLOW_EXPAND_TO_DOM);
+ }
+
+ // Reverse the message direction
+ msgContext = processPivotInternal(msgContext, direction);
+
+ // Set the required outbound context properties
+ setOutboundContextProperties();
+
+ if (binding instanceof CommonSOAPBinding)
+ XOPContext.setMTOMEnabled(((CommonSOAPBinding)binding).isMTOMEnabled());
+
+ // Bind the response message
+ MessageAbstraction resMessage = binding.bindResponseMessage(opMetaData, epInv);
+ msgContext.setMessageAbstraction(resMessage);
+ }
+ else
+ {
+ // Reverse the message direction without calling the endpoint
+ MessageAbstraction resMessage = msgContext.getMessageAbstraction();
+ msgContext = processPivotInternal(msgContext, direction);
+ msgContext.setMessageAbstraction(resMessage);
+ }
+
+ if (oneway == false)
+ {
+ // call the response handler chain, removing the fault type entry will not call handleFault for that chain
+ handlersPass = callResponseHandlerChain(sepMetaData, handlerType[2]);
+ faultType[2] = null;
+ handlersPass = handlersPass && callResponseHandlerChain(sepMetaData, handlerType[1]);
+ faultType[1] = null;
+ handlersPass = handlersPass && callResponseHandlerChain(sepMetaData, handlerType[0]);
+ faultType[0] = null;
+ }
+ }
+ catch (RuntimeException ex)
+ {
+ // Reverse the message direction
+ processPivotInternal(msgContext, direction);
+
+ try
+ {
+ CommonBinding binding = bindingProvider.getCommonBinding();
+ binding.bindFaultMessage(ex);
+
+ // call the fault handler chain
+ boolean handlersPass = true;
+ if (faultType[2] != null)
+ handlersPass = handlersPass && callFaultHandlerChain(sepMetaData, faultType[2], ex);
+ if (faultType[1] != null)
+ handlersPass = handlersPass && callFaultHandlerChain(sepMetaData, faultType[1], ex);
+ if (faultType[0] != null)
+ handlersPass = handlersPass && callFaultHandlerChain(sepMetaData, faultType[0], ex);
+ }
+ catch (RuntimeException subEx)
+ {
+ log.warn("Exception while processing handleFault: ", ex);
+ ex = subEx;
+ }
+ throw ex;
+ }
+ finally
+ {
+ closeHandlerChain(sepMetaData, handlerType[2]);
+ closeHandlerChain(sepMetaData, handlerType[1]);
+ closeHandlerChain(sepMetaData, handlerType[0]);
+
+ destroyServiceEndpointInstance(seInstance);
+ }
+ }
+
+ protected void setInboundContextProperties()
+ {
+ CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
+ if (msgContext instanceof MessageContextJAXWS)
+ {
+ // Map of attachments to a message for the outbound message, key is the MIME Content-ID, value is a DataHandler
+ msgContext.put(MessageContextJAXWS.INBOUND_MESSAGE_ATTACHMENTS, new HashMap<String, DataHandler>());
+ }
+ }
+
+ protected void setOutboundContextProperties()
+ {
+ CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
+ if (msgContext instanceof MessageContextJAXWS)
+ {
+ // Map of attachments to a message for the outbound message, key is the MIME Content-ID, value is a DataHandler
+ msgContext.put(MessageContextJAXWS.OUTBOUND_MESSAGE_ATTACHMENTS, new HashMap<String, DataHandler>());
+ }
+ }
+
+ private CommonMessageContext processPivotInternal(CommonMessageContext msgContext, DirectionHolder direction)
+ {
+ if (direction.getDirection() == Direction.InBound)
+ {
+ EndpointMetaData epMetaData = msgContext.getEndpointMetaData();
+ if (epMetaData.getType() == EndpointMetaData.Type.JAXRPC)
+ {
+ msgContext = MessageContextJAXRPC.processPivot(msgContext);
+ }
+ else
+ {
+ msgContext = MessageContextJAXWS.processPivot(msgContext);
+ }
+ direction.setDirection(Direction.OutBound);
+ }
+ return msgContext;
+ }
+
+ private OperationMetaData getDispatchDestination(EndpointMetaData epMetaData, MessageAbstraction reqMessage) throws SOAPException
+ {
+ OperationMetaData opMetaData;
+
+ String bindingID = epMetaData.getBindingId();
+ if (HTTPBinding.HTTP_BINDING.equals(bindingID))
+ {
+ if (epMetaData.getOperations().size() != 1)
+ throw new IllegalStateException("Multiple operations not supported for HTTP binding");
+
+ opMetaData = epMetaData.getOperations().get(0);
+ }
+ else
+ {
+ SOAPMessageImpl soapMessage = (SOAPMessageImpl)reqMessage;
+
+ opMetaData = soapMessage.getOperationMetaData(epMetaData);
+ SOAPHeader soapHeader = soapMessage.getSOAPHeader();
+
+ // Report a MustUnderstand fault
+ if (opMetaData == null)
+ {
+ String faultString;
+ SOAPBody soapBody = soapMessage.getSOAPBody();
+ if (soapBody.getChildElements().hasNext())
+ {
+ SOAPBodyElement soapBodyElement = (SOAPBodyElement)soapBody.getChildElements().next();
+ Name soapName = soapBodyElement.getElementName();
+ faultString = "Endpoint " + epMetaData.getPortName() + " does not contain operation meta data for: " + soapName;
+ }
+ else
+ {
+ faultString = "Endpoint " + epMetaData.getPortName() + " does not contain operation meta data for empty soap body";
+ }
+
+ // R2724 If an INSTANCE receives a message that is inconsistent with its WSDL description, it SHOULD generate a soap:Fault
+ // with a faultcode of "Client", unless a "MustUnderstand" or "VersionMismatch" fault is generated.
+ if (soapHeader != null && soapHeader.examineMustUnderstandHeaderElements(Constants.URI_SOAP11_NEXT_ACTOR).hasNext())
+ {
+ QName faultCode = Constants.SOAP11_FAULT_CODE_MUST_UNDERSTAND;
+ throw new SOAPFaultException(faultCode, faultString, null, null);
+ }
+ else
+ {
+ QName faultCode = Constants.SOAP11_FAULT_CODE_CLIENT;
+ throw new SOAPFaultException(faultCode, faultString, null, null);
+ }
+ }
+ }
+ return opMetaData;
+ }
+
+ 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;
+ }
+
+ /** handle invocation exceptions */
+ public 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);
+ }
+ }
+}
Copied: trunk/jbossws-core/src/java/org/jboss/ws/core/server/AbstractServiceEndpointServlet.java (from rev 2953, trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/AbstractServiceEndpointServlet.java)
===================================================================
--- trunk/jbossws-core/src/java/org/jboss/ws/core/server/AbstractServiceEndpointServlet.java (rev 0)
+++ trunk/jbossws-core/src/java/org/jboss/ws/core/server/AbstractServiceEndpointServlet.java 2007-05-04 12:20:09 UTC (rev 2959)
@@ -0,0 +1,177 @@
+/*
+ * 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.core.server;
+
+// $Id$
+
+import java.io.IOException;
+import java.io.Writer;
+
+import javax.management.ObjectName;
+import javax.servlet.ServletConfig;
+import javax.servlet.ServletException;
+import javax.servlet.ServletInputStream;
+import javax.servlet.ServletOutputStream;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.xml.rpc.JAXRPCException;
+
+import org.jboss.logging.Logger;
+import org.jboss.ws.WSException;
+import org.jboss.ws.integration.Endpoint;
+import org.jboss.ws.integration.ObjectNameFactory;
+import org.jboss.ws.integration.RequestHandler;
+import org.jboss.ws.integration.management.EndpointRegistry;
+import org.jboss.ws.integration.management.EndpointRegistryFactory;
+
+/**
+ * A servlet that is installed for every web service endpoint.
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 25-Apr-2007
+ */
+public abstract class AbstractServiceEndpointServlet extends HttpServlet
+{
+ // provide logging
+ private static final Logger log = Logger.getLogger(AbstractServiceEndpointServlet.class);
+
+ protected Endpoint endpoint;
+ protected EndpointRegistry epRegistry;
+
+ public void init(ServletConfig config) throws ServletException
+ {
+ super.init(config);
+ epRegistry = EndpointRegistryFactory.getEndpointRegistry();
+ }
+
+ public void destroy()
+ {
+ super.destroy();
+ }
+
+ public void service(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException
+ {
+ if (endpoint == null)
+ {
+ String contextPath = req.getContextPath();
+ initServiceEndpoint(contextPath);
+ }
+ super.service(req, res);
+ }
+
+ public void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException
+ {
+ // Process a WSDL request
+ if (req.getParameter("wsdl") != null || req.getParameter("WSDL") != null)
+ {
+ res.setContentType("text/xml");
+ try
+ {
+ RequestHandler requestHandler = endpoint.getRequestHandler();
+ ServletRequestContext context = new ServletRequestContext(getServletContext(), req, res);
+ requestHandler.handleWSDLRequest(endpoint, res.getOutputStream(), context);
+ }
+ catch (Exception ex)
+ {
+ handleException(ex);
+ }
+ }
+ else
+ {
+ res.setStatus(405);
+ res.setContentType("text/plain");
+ Writer out = res.getWriter();
+ out.write("HTTP GET not supported");
+ out.flush();
+ out.close();
+ }
+ }
+
+ public void doPost(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException
+ {
+ log.debug("doPost: " + req.getRequestURI());
+
+ ServletInputStream inputStream = req.getInputStream();
+ ServletOutputStream outputStream = res.getOutputStream();
+ try
+ {
+ RequestHandler requestHandler = endpoint.getRequestHandler();
+ ServletRequestContext context = new ServletRequestContext(getServletContext(), req, res);
+ requestHandler.handleRequest(endpoint, inputStream, outputStream, context);
+ }
+ catch (Exception ex)
+ {
+ handleException(ex);
+ }
+ finally
+ {
+ try
+ {
+ outputStream.flush();
+ outputStream.close();
+ }
+ catch (IOException ioex)
+ {
+ log.error("Cannot flush output stream");
+ }
+
+ }
+ }
+
+ private void handleException(Exception ex) throws ServletException
+ {
+ log.error("Error processing web service request", ex);
+
+ if (ex instanceof JAXRPCException)
+ throw (JAXRPCException)ex;
+
+ throw new ServletException(ex);
+ }
+
+ /** Initialize the service endpoint
+ */
+ protected void initServiceEndpoint(String contextPath)
+ {
+ String servletName = getServletName();
+ if (contextPath.startsWith("/"))
+ contextPath = contextPath.substring(1);
+
+ for (ObjectName sepId : epRegistry.getEndpoints())
+ {
+ String propContext = sepId.getKeyProperty(Endpoint.SEPID_PROPERTY_CONTEXT);
+ String propEndpoint = sepId.getKeyProperty(Endpoint.SEPID_PROPERTY_ENDPOINT);
+ if (servletName.equals(propEndpoint) && contextPath.equals(propContext))
+ {
+ endpoint = epRegistry.getEndpoint(sepId);
+ break;
+ }
+ }
+
+ if (endpoint == null)
+ {
+ ObjectName oname = ObjectNameFactory.create(Endpoint.SEPID_DOMAIN + ":" + Endpoint.SEPID_PROPERTY_CONTEXT + "=" + contextPath + ","
+ + Endpoint.SEPID_PROPERTY_ENDPOINT + "=" + servletName);
+ throw new WSException("Cannot obtain endpoint for: " + oname);
+ }
+ }
+}
Copied: trunk/jbossws-core/src/java/org/jboss/ws/core/server/InvocationHandlerJSE.java (from rev 2953, trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/InvocationHandlerJSE.java)
===================================================================
--- trunk/jbossws-core/src/java/org/jboss/ws/core/server/InvocationHandlerJSE.java (rev 0)
+++ trunk/jbossws-core/src/java/org/jboss/ws/core/server/InvocationHandlerJSE.java 2007-05-04 12:20:09 UTC (rev 2959)
@@ -0,0 +1,125 @@
+/*
+ * 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.core.server;
+
+// $Id$
+
+import java.lang.reflect.Method;
+
+import javax.xml.rpc.ServiceException;
+import javax.xml.rpc.server.ServiceLifecycle;
+import javax.xml.rpc.server.ServletEndpointContext;
+import javax.xml.rpc.soap.SOAPFaultException;
+import javax.xml.ws.WebServiceContext;
+
+import org.jboss.logging.Logger;
+import org.jboss.ws.WSException;
+import org.jboss.ws.core.CommonMessageContext;
+import org.jboss.ws.core.EndpointInvocation;
+import org.jboss.ws.core.jaxrpc.ServletEndpointContextImpl;
+import org.jboss.ws.core.jaxws.WebServiceContextInjector;
+import org.jboss.ws.core.jaxws.WebServiceContextJSE;
+import org.jboss.ws.core.jaxws.handler.SOAPMessageContextJAXWS;
+import org.jboss.ws.core.soap.MessageContextAssociation;
+import org.jboss.ws.integration.invocation.InvocationContext;
+import org.jboss.ws.metadata.umdm.ServerEndpointMetaData;
+
+/**
+ * Handles invocations on JSE endpoints.
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 25-Apr-2007
+ */
+public class InvocationHandlerJSE extends AbstractInvocationHandler
+{
+ // provide logging
+ private static final Logger log = Logger.getLogger(InvocationHandlerJSE.class);
+
+ /** Load the SEI implementation bean if necessary */
+ public Class loadServiceEndpoint() throws ClassNotFoundException
+ {
+ ServerEndpointMetaData sepMetaData = endpoint.getMetaData(ServerEndpointMetaData.class);
+ if (sepMetaData == null)
+ throw new IllegalStateException("Cannot obtain endpoint meta data");
+
+ ClassLoader cl = sepMetaData.getClassLoader();
+ String seiImplName = sepMetaData.getServiceEndpointImplName();
+ Class seiImplClass = cl.loadClass(seiImplName);
+ return seiImplClass;
+ }
+
+ /** Create an instance of the SEI implementation bean if necessary */
+ public Object createServiceEndpointInstance(Class seiImplClass, InvocationContext context) throws IllegalAccessException, InstantiationException
+ {
+ Object seiImpl = seiImplClass.newInstance();
+ if (seiImpl instanceof ServiceLifecycle && context != null)
+ {
+ try
+ {
+ ServiceLifecycle serviceLifecycle = ((ServiceLifecycle)seiImpl);
+ ServletEndpointContext servletEndpointContext = new ServletEndpointContextImpl((ServletRequestContext)context);
+ serviceLifecycle.init(servletEndpointContext);
+ }
+ catch (ServiceException ex)
+ {
+ throw new WSException(ex);
+ }
+ }
+ return seiImpl;
+ }
+
+ /** Invoke an instance of the SEI implementation bean */
+ public void invokeServiceEndpointInstance(Object seiImpl, EndpointInvocation epInv) throws SOAPFaultException, Exception
+ {
+ log.debug("invokeServiceEndpoint: " + epInv.getJavaMethod().getName());
+ try
+ {
+ CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
+ if (msgContext instanceof SOAPMessageContextJAXWS)
+ {
+ WebServiceContext wsContext = new WebServiceContextJSE((SOAPMessageContextJAXWS)msgContext);
+ new WebServiceContextInjector().injectContext(seiImpl, wsContext);
+ }
+
+ Class implClass = seiImpl.getClass();
+ Method seiMethod = epInv.getJavaMethod();
+ Method implMethod = getImplMethod(implClass, seiMethod);
+
+ Object[] args = epInv.getRequestPayload();
+ Object retObj = implMethod.invoke(seiImpl, args);
+ epInv.setReturnValue(retObj);
+ }
+ catch (Exception e)
+ {
+ handleInvocationException(e);
+ }
+ }
+
+ /** Destroy an instance of the SEI implementation bean if necessary */
+ public void destroyServiceEndpointInstance(Object seiImpl)
+ {
+ if (seiImpl instanceof ServiceLifecycle)
+ {
+ ((ServiceLifecycle)seiImpl).destroy();
+ }
+ }
+}
Deleted: trunk/jbossws-core/src/java/org/jboss/ws/core/server/JAXWSDeployment.java
===================================================================
--- trunk/jbossws-core/src/java/org/jboss/ws/core/server/JAXWSDeployment.java 2007-05-04 10:28:42 UTC (rev 2958)
+++ trunk/jbossws-core/src/java/org/jboss/ws/core/server/JAXWSDeployment.java 2007-05-04 12:20:09 UTC (rev 2959)
@@ -1,40 +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.core.server;
-
-//$Id$
-
-import org.jboss.ws.integration.deployment.Deployment.DeploymentType;
-
-/**
- * The container independent deployment info.
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 29-Jun-2006
- */
-public class JAXWSDeployment extends UnifiedDeploymentInfo
-{
- public JAXWSDeployment(DeploymentType type)
- {
- super(type);
- }
-}
Copied: trunk/jbossws-core/src/java/org/jboss/ws/core/server/LifecycleHandlerImpl.java (from rev 2953, trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/LifecycleHandlerImpl.java)
===================================================================
--- trunk/jbossws-core/src/java/org/jboss/ws/core/server/LifecycleHandlerImpl.java (rev 0)
+++ trunk/jbossws-core/src/java/org/jboss/ws/core/server/LifecycleHandlerImpl.java 2007-05-04 12:20:09 UTC (rev 2959)
@@ -0,0 +1,57 @@
+/*
+ * 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.core.server;
+
+//$Id: LifecycleHandlerImpl.java 2923 2007-04-25 14:23:29Z thomas.diesler(a)jboss.com $
+
+import org.jboss.ws.integration.Endpoint;
+import org.jboss.ws.metadata.umdm.ServerEndpointMetaData;
+
+/**
+ * A lifecycle handler
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 25-Apr-2007
+ */
+public class LifecycleHandlerImpl extends org.jboss.ws.integration.LifecycleHandlerImpl
+{
+ public void start(Endpoint endpoint)
+ {
+ super.start(endpoint);
+ log.info("WebService started: " + getEndpointAddress(endpoint));
+ }
+
+ public void stop(Endpoint endpoint)
+ {
+ super.stop(endpoint);
+ log.info("WebService stoped: " + getEndpointAddress(endpoint));
+ }
+
+ private String getEndpointAddress(Endpoint ep)
+ {
+ ServerEndpointMetaData sepMetaData = ep.getMetaData(ServerEndpointMetaData.class);
+ if (sepMetaData == null)
+ throw new IllegalStateException("Cannot obtain endpoint meta data");
+
+ return sepMetaData.getEndpointAddress();
+ }
+}
Copied: trunk/jbossws-core/src/java/org/jboss/ws/core/server/RequestHandlerImpl.java (from rev 2953, trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/RequestHandlerImpl.java)
===================================================================
--- trunk/jbossws-core/src/java/org/jboss/ws/core/server/RequestHandlerImpl.java (rev 0)
+++ trunk/jbossws-core/src/java/org/jboss/ws/core/server/RequestHandlerImpl.java 2007-05-04 12:20:09 UTC (rev 2959)
@@ -0,0 +1,411 @@
+/*
+ * 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.core.server;
+
+//$Id$
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.io.OutputStreamWriter;
+import java.net.URL;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.activation.DataHandler;
+import javax.servlet.ServletContext;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.xml.namespace.QName;
+import javax.xml.rpc.soap.SOAPFaultException;
+import javax.xml.soap.MimeHeaders;
+import javax.xml.soap.SOAPEnvelope;
+import javax.xml.soap.SOAPException;
+import javax.xml.soap.SOAPMessage;
+import javax.xml.soap.SOAPPart;
+import javax.xml.ws.addressing.AddressingProperties;
+import javax.xml.ws.addressing.JAXWSAConstants;
+import javax.xml.ws.http.HTTPBinding;
+
+import org.jboss.logging.Logger;
+import org.jboss.ws.Constants;
+import org.jboss.ws.WSException;
+import org.jboss.ws.core.CommonBinding;
+import org.jboss.ws.core.CommonBindingProvider;
+import org.jboss.ws.core.CommonMessageContext;
+import org.jboss.ws.core.HTTPMessageImpl;
+import org.jboss.ws.core.MessageAbstraction;
+import org.jboss.ws.core.MessageTrace;
+import org.jboss.ws.core.jaxrpc.binding.BindingException;
+import org.jboss.ws.core.jaxrpc.handler.MessageContextJAXRPC;
+import org.jboss.ws.core.jaxrpc.handler.SOAPMessageContextJAXRPC;
+import org.jboss.ws.core.jaxws.handler.MessageContextJAXWS;
+import org.jboss.ws.core.jaxws.handler.SOAPMessageContextJAXWS;
+import org.jboss.ws.core.soap.MessageContextAssociation;
+import org.jboss.ws.core.soap.MessageFactoryImpl;
+import org.jboss.ws.core.soap.SOAPConnectionImpl;
+import org.jboss.ws.core.soap.SOAPMessageImpl;
+import org.jboss.ws.core.utils.DOMWriter;
+import org.jboss.ws.core.utils.ThreadLocalAssociation;
+import org.jboss.ws.extensions.addressing.AddressingConstantsImpl;
+import org.jboss.ws.extensions.xop.XOPContext;
+import org.jboss.ws.integration.Endpoint;
+import org.jboss.ws.integration.RequestHandler;
+import org.jboss.ws.integration.Endpoint.EndpointState;
+import org.jboss.ws.integration.invocation.InvocationContext;
+import org.jboss.ws.integration.invocation.InvocationHandler;
+import org.jboss.ws.integration.management.ServerConfig;
+import org.jboss.ws.integration.management.ServerConfigFactory;
+import org.jboss.ws.metadata.umdm.EndpointMetaData;
+import org.jboss.ws.metadata.umdm.ServerEndpointMetaData;
+import org.jboss.ws.metadata.umdm.EndpointMetaData.Type;
+import org.w3c.dom.Document;
+
+/**
+ * A request handler
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 25-Apr-2007
+ */
+public class RequestHandlerImpl implements RequestHandler
+{
+ // provide logging
+ private static final Logger log = Logger.getLogger(RequestHandlerImpl.class);
+
+ public void handleRequest(Endpoint endpoint, InputStream inputStream, OutputStream outputStream, InvocationContext context)
+ {
+ log.debug("handleRequest: " + endpoint.getName());
+
+ ServerEndpointMetaData sepMetaData = endpoint.getMetaData(ServerEndpointMetaData.class);
+ if (sepMetaData == null)
+ throw new IllegalStateException("Cannot obtain endpoint meta data");
+
+ ServletRequestContext reqContext = (ServletRequestContext)context;
+
+ Type type = sepMetaData.getType();
+
+ ServletContext servletContext = reqContext.getServletContext();
+ HttpServletRequest httpRequest = reqContext.getHttpServletRequest();
+ HttpServletResponse httpResponse = reqContext.getHttpServletResponse();
+ ServletHeaderSource headerSource = new ServletHeaderSource(httpRequest, httpResponse);
+
+ // Build the message context
+ CommonMessageContext msgContext;
+ if (type == EndpointMetaData.Type.JAXRPC)
+ {
+ msgContext = new SOAPMessageContextJAXRPC();
+ msgContext.put(MessageContextJAXRPC.SERVLET_CONTEXT, servletContext);
+ msgContext.put(MessageContextJAXRPC.SERVLET_REQUEST, httpRequest);
+ msgContext.put(MessageContextJAXRPC.SERVLET_RESPONSE, httpResponse);
+ }
+ else
+ {
+ msgContext = new SOAPMessageContextJAXWS();
+ msgContext.put(MessageContextJAXWS.MESSAGE_OUTBOUND_PROPERTY, new Boolean(false));
+ msgContext.put(MessageContextJAXWS.INBOUND_MESSAGE_ATTACHMENTS, new HashMap<String, DataHandler>());
+ msgContext.put(MessageContextJAXWS.HTTP_REQUEST_HEADERS, headerSource.getHeaderMap());
+ msgContext.put(MessageContextJAXWS.HTTP_REQUEST_METHOD, httpRequest.getMethod());
+ msgContext.put(MessageContextJAXWS.QUERY_STRING, httpRequest.getQueryString());
+ msgContext.put(MessageContextJAXWS.PATH_INFO, httpRequest.getPathInfo());
+ msgContext.put(MessageContextJAXWS.SERVLET_CONTEXT, servletContext);
+ msgContext.put(MessageContextJAXWS.SERVLET_REQUEST, httpRequest);
+ msgContext.put(MessageContextJAXWS.SERVLET_RESPONSE, httpResponse);
+
+ }
+ msgContext.setEndpointMetaData(sepMetaData);
+
+ // Associate a message context with the current thread
+ MessageContextAssociation.pushMessageContext(msgContext);
+
+ try
+ {
+ MessageAbstraction resMessage = processRequest(endpoint, headerSource, reqContext, inputStream);
+
+ // Replace the message context with the response context
+ msgContext = MessageContextAssociation.peekMessageContext();
+
+ Map<String, List<String>> headers = (Map<String, List<String>>)msgContext.get(MessageContextJAXWS.HTTP_RESPONSE_HEADERS);
+ if (headers != null)
+ headerSource.setHeaderMap(headers);
+
+ Integer code = (Integer)msgContext.get(MessageContextJAXWS.HTTP_RESPONSE_CODE);
+ if (code != null)
+ httpResponse.setStatus(code.intValue());
+
+ boolean isFault = false;
+ if (resMessage instanceof SOAPMessage)
+ {
+ SOAPPart part = ((SOAPMessage)resMessage).getSOAPPart();
+ if (part == null)
+ throw new SOAPException("Cannot obtain SOAPPart from response message");
+
+ // R1126 An INSTANCE MUST return a "500 Internal Server Error" HTTP status code
+ // if the response envelope is a Fault.
+ //
+ // Also, a one-way operation must show up as empty content, and can be detected
+ // by a null envelope.
+ SOAPEnvelope soapEnv = part.getEnvelope();
+ isFault = soapEnv != null && soapEnv.getBody().hasFault();
+ if (isFault && httpResponse != null)
+ {
+ httpResponse.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
+ }
+ }
+
+ sendResponse(outputStream, msgContext, isFault);
+ }
+ catch (Exception ex)
+ {
+ WSException.rethrow(ex);
+ }
+ finally
+ {
+ // Reset the message context association
+ MessageContextAssociation.popMessageContext();
+
+ // clear thread local storage
+ ThreadLocalAssociation.clear();
+ }
+ }
+
+ private void sendResponse(OutputStream outputStream, CommonMessageContext msgContext, boolean isFault) throws SOAPException, IOException
+ {
+ MessageAbstraction resMessage = msgContext.getMessageAbstraction();
+ String wsaTo = null;
+
+ // Get the destination from the AddressingProperties
+ AddressingProperties outProps = (AddressingProperties)msgContext.get(JAXWSAConstants.SERVER_ADDRESSING_PROPERTIES_OUTBOUND);
+ if (outProps != null && outProps.getTo() != null)
+ {
+ AddressingConstantsImpl ADDR = new AddressingConstantsImpl();
+ wsaTo = outProps.getTo().getURI().toString();
+ if (wsaTo.equals(ADDR.getAnonymousURI()))
+ wsaTo = null;
+ }
+ if (wsaTo != null)
+ {
+ log.debug("Sending response to addressing destination: " + wsaTo);
+ new SOAPConnectionImpl().callOneWay((SOAPMessage)resMessage, wsaTo);
+ }
+ else
+ {
+ resMessage.writeTo(outputStream);
+ }
+ }
+
+ /**
+ * Handle a request to this web service endpoint
+ */
+ private MessageAbstraction processRequest(Endpoint endpoint, MimeHeaderSource headerSource, ServletRequestContext reqContext, InputStream inputStream)
+ throws BindingException
+ {
+ CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
+
+ ServerEndpointMetaData sepMetaData = endpoint.getMetaData(ServerEndpointMetaData.class);
+ if (sepMetaData == null)
+ throw new IllegalStateException("Cannot obtain endpoint meta data");
+
+ long beginProcessing = 0;
+ ClassLoader ctxClassLoader = Thread.currentThread().getContextClassLoader();
+ try
+ {
+ EndpointState state = endpoint.getState();
+ if (state != EndpointState.STARTED)
+ {
+ QName faultCode = Constants.SOAP11_FAULT_CODE_SERVER;
+ String faultString = "Endpoint cannot handle requests in state: " + state;
+ throw new SOAPFaultException(faultCode, faultString, null, null);
+ }
+
+ log.debug("BEGIN handleRequest: " + endpoint.getName());
+ beginProcessing = initRequestMetrics(endpoint);
+
+ MimeHeaders headers = (headerSource != null ? headerSource.getMimeHeaders() : null);
+
+ MessageAbstraction reqMessage;
+
+ String bindingID = sepMetaData.getBindingId();
+ if (HTTPBinding.HTTP_BINDING.equals(bindingID))
+ {
+ reqMessage = new HTTPMessageImpl(headers, inputStream);
+ }
+ else
+ {
+ MessageFactoryImpl msgFactory = new MessageFactoryImpl();
+ msgFactory.setServiceMode(sepMetaData.getServiceMode());
+ msgFactory.setStyle(sepMetaData.getStyle());
+
+ reqMessage = (SOAPMessageImpl)msgFactory.createMessage(headers, inputStream);
+ }
+
+ // Associate current message with message context
+ msgContext.setMessageAbstraction(reqMessage);
+
+ // debug the incomming message
+ MessageTrace.traceMessage("Incoming Request Message", reqMessage);
+
+ // Set the thread context class loader
+ ClassLoader classLoader = sepMetaData.getClassLoader();
+ Thread.currentThread().setContextClassLoader(classLoader);
+
+ // Invoke the service endpoint
+ InvocationHandler invoker = endpoint.getInvocationHandler();
+ invoker.invoke(reqContext);
+
+ // Get the response message context
+ msgContext = MessageContextAssociation.peekMessageContext();
+
+ // Get the response message
+ MessageAbstraction resMessage = msgContext.getMessageAbstraction();
+ if (resMessage != null)
+ postProcessResponse(headerSource, resMessage);
+
+ return resMessage;
+ }
+ catch (Exception ex)
+ {
+ MessageAbstraction resMessage = msgContext.getMessageAbstraction();
+
+ // In case we have an exception before the invoker is called
+ // we create the fault message here.
+ if (resMessage == null || resMessage.isFaultMessage() == false)
+ {
+ CommonBindingProvider bindingProvider = new CommonBindingProvider(sepMetaData);
+ CommonBinding binding = bindingProvider.getCommonBinding();
+ resMessage = binding.bindFaultMessage(ex);
+ }
+
+ if (resMessage != null)
+ postProcessResponse(headerSource, resMessage);
+
+ return resMessage;
+ }
+ finally
+ {
+ try
+ {
+ MessageAbstraction resMessage = msgContext.getMessageAbstraction();
+ if (resMessage != null)
+ {
+ if (resMessage.isFaultMessage())
+ {
+ processFaultMetrics(endpoint, beginProcessing);
+ }
+ else
+ {
+ processResponseMetrics(endpoint, beginProcessing);
+ }
+ }
+ }
+ catch (Exception ex)
+ {
+ log.error("Cannot process metrics", ex);
+ }
+
+ // Reset the thread context class loader
+ Thread.currentThread().setContextClassLoader(ctxClassLoader);
+ log.debug("END handleRequest: " + endpoint.getName());
+ }
+ }
+
+ private long initRequestMetrics(Endpoint endpoint)
+ {
+ return 0;
+ }
+
+ private void processResponseMetrics(Endpoint endpoint, long beginProcessing)
+ {
+ }
+
+ private void processFaultMetrics(Endpoint endpoint, long beginProcessing)
+ {
+ }
+
+ /** Set response mime headers
+ */
+ private void postProcessResponse(MimeHeaderSource headerSource, MessageAbstraction resMessage)
+ {
+ try
+ {
+ // Set the outbound headers
+ if (headerSource != null && resMessage instanceof SOAPMessage)
+ {
+ XOPContext.eagerlyCreateAttachments();
+ ((SOAPMessage)resMessage).saveChanges();
+ headerSource.setMimeHeaders(resMessage.getMimeHeaders());
+ }
+
+ // debug the outgoing message
+ MessageTrace.traceMessage("Outgoing Response Message", resMessage);
+ }
+ catch (Exception ex)
+ {
+ WSException.rethrow("Faild to post process response message", ex);
+ }
+ }
+
+ public void handleWSDLRequest(Endpoint endpoint, OutputStream outputStream, InvocationContext context)
+ {
+ log.debug("handleWSDLRequest: " + endpoint.getName());
+
+ ServerEndpointMetaData epMetaData = endpoint.getMetaData(ServerEndpointMetaData.class);
+ if (epMetaData == null)
+ throw new IllegalStateException("Cannot obtain endpoint meta data");
+
+ ServletRequestContext reqContext = (ServletRequestContext)context;
+ HttpServletRequest req = reqContext.getHttpServletRequest();
+
+ try
+ {
+ // For the base document the resourcePath should be null
+ String resPath = (String)req.getParameter("resource");
+ URL reqURL = new URL(req.getRequestURL().toString());
+
+ String wsdlHost = reqURL.getProtocol() + "://" + reqURL.getHost() + ":" + reqURL.getPort();
+
+ ServerConfigFactory factory = ServerConfigFactory.getInstance();
+ ServerConfig config = factory.getServerConfig();
+ if (config.getWebServiceHost().equals(ServerConfig.UNDEFINED_HOSTNAME) == false)
+ {
+ wsdlHost = config.getWebServiceHost();
+ }
+ log.debug("WSDL request, using host: " + wsdlHost);
+
+ WSDLRequestHandler wsdlRequestHandler = new WSDLRequestHandler(epMetaData);
+ Document document = wsdlRequestHandler.getDocumentForPath(reqURL, wsdlHost, resPath);
+
+ OutputStreamWriter writer = new OutputStreamWriter(outputStream);
+ new DOMWriter(writer).setPrettyprint(true).print(document.getDocumentElement());
+ outputStream.flush();
+ outputStream.close();
+ }
+ catch (RuntimeException rte)
+ {
+ throw rte;
+ }
+ catch (IOException ex)
+ {
+ throw new WSException(ex);
+ }
+ }
+}
Modified: trunk/jbossws-core/src/java/org/jboss/ws/core/server/ServiceEndpointGeneratorEJB.java
===================================================================
--- trunk/jbossws-core/src/java/org/jboss/ws/core/server/ServiceEndpointGeneratorEJB.java 2007-05-04 10:28:42 UTC (rev 2958)
+++ trunk/jbossws-core/src/java/org/jboss/ws/core/server/ServiceEndpointGeneratorEJB.java 2007-05-04 12:20:09 UTC (rev 2959)
@@ -33,7 +33,7 @@
import org.jboss.logging.Logger;
import org.jboss.ws.WSException;
-import org.jboss.ws.core.server.UnifiedDeploymentInfo;
+import org.jboss.ws.core.deployment.UnifiedDeploymentInfo;
import org.jboss.ws.core.utils.DOMUtils;
import org.jboss.ws.core.utils.DOMWriter;
import org.jboss.ws.integration.management.ServerConfig;
Deleted: trunk/jbossws-core/src/java/org/jboss/ws/core/server/ServiceEndpointPublisher.java
===================================================================
--- trunk/jbossws-core/src/java/org/jboss/ws/core/server/ServiceEndpointPublisher.java 2007-05-04 10:28:42 UTC (rev 2958)
+++ trunk/jbossws-core/src/java/org/jboss/ws/core/server/ServiceEndpointPublisher.java 2007-05-04 12:20:09 UTC (rev 2959)
@@ -1,267 +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.core.server;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.InputStream;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-import javax.servlet.Servlet;
-
-import org.jboss.logging.Logger;
-import org.jboss.ws.WSException;
-import org.jboss.ws.core.utils.DOMUtils;
-import org.jboss.ws.core.utils.DOMWriter;
-import org.jboss.ws.core.utils.IOUtils;
-import org.jboss.ws.core.utils.JavaUtils;
-import org.jboss.ws.integration.Endpoint;
-import org.w3c.dom.Element;
-
-/**
- * The publisher for web service endpoints
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 12-May-2006
- */
-public class ServiceEndpointPublisher
-{
- // logging support
- private static Logger log = Logger.getLogger(ServiceEndpointPublisher.class);
-
- // The default bean name
- public static final String BEAN_NAME = "ServiceEndpointPublisher";
-
- // The configured service endpoint servlet
- private String servletClass;
-
- // The results of the URL rewriting
- public class RewriteResults
- {
- // The URL to the rewrittn web.xml
- public URL webXML;
- // Map<servlet-name, servlet-class> the servlet-class enties are the implementation beans
- public Map<String, String> sepTargetMap = new HashMap<String, String>();
- }
-
- public String getServletClass()
- {
- return servletClass;
- }
-
- public void setServletClass(String servletClass)
- {
- this.servletClass = servletClass;
- }
-
- public RewriteResults rewriteWebXml(UnifiedDeploymentInfo udi)
- {
- URL warURL = udi.webappURL;
- File warFile = new File(warURL.getFile());
- if (warFile.isDirectory() == false)
- throw new WSException("Expected a war directory: " + warURL);
-
- File webXML = new File(warURL.getFile() + "/WEB-INF/web.xml");
- if (webXML.isFile() == false)
- throw new WSException("Cannot find web.xml: " + webXML);
-
- try
- {
- // After redeployment there might be a stale copy of the original web.xml.org, we delete it
- File orgWebXML = new File(webXML.getCanonicalPath() + ".org");
- orgWebXML.delete();
-
- // Rename the web.xml
- if (webXML.renameTo(orgWebXML) == false)
- throw new WSException("Cannot rename web.xml: " + orgWebXML);
-
- FileInputStream stream = new FileInputStream(orgWebXML);
- return rewriteWebXml(stream, webXML, udi.classLoader);
- }
- catch (RuntimeException rte)
- {
- throw rte;
- }
- catch (Exception e)
- {
- throw new WSException(e);
- }
- }
-
- public RewriteResults rewriteWebXml(InputStream source, File dest, ClassLoader loader) throws Exception
- {
- if (dest == null)
- {
- dest = File.createTempFile("jbossws-alt-web", "xml", IOUtils.createTempDirectory());
- dest.deleteOnExit();
- }
-
- Element root = DOMUtils.parse(source);
- RewriteResults results = modifyServletConfig(root, loader);
- results.webXML = dest.toURL();
-
- FileOutputStream fos = new FileOutputStream(dest);
- new DOMWriter(fos).setPrettyprint(true).print(root);
- fos.flush();
- fos.close();
-
- return results;
- }
-
- private RewriteResults modifyServletConfig(Element root, ClassLoader loader) throws ClassNotFoundException
- {
- RewriteResults results = new RewriteResults();
- Iterator itServlets = DOMUtils.getChildElements(root, "servlet");
- while (itServlets.hasNext())
- {
- Element servletElement = (Element)itServlets.next();
- String linkName = DOMUtils.getTextContent(DOMUtils.getFirstChildElement(servletElement, "servlet-name"));
-
- // find the servlet-class
- Element classElement = DOMUtils.getFirstChildElement(servletElement, "servlet-class");
-
- // JSP
- if (classElement == null)
- continue;
-
- String orgServletClassName = DOMUtils.getTextContent(classElement).trim();
-
- // Get the servlet class
- Class orgServletClass = null;
- if (loader != null)
- {
- try
- {
- orgServletClass = loader.loadClass(orgServletClassName);
- }
- catch (ClassNotFoundException ex)
- {
- log.warn("Cannot load servlet class: " + orgServletClassName);
- }
- }
-
- String targetBeanName = null;
-
- // Nothing to do if we have an <init-param>
- if (isAlreadyModified(servletElement))
- {
- Iterator itParams = DOMUtils.getChildElements(servletElement, "init-param");
- while (itParams.hasNext())
- {
- Element elParam = (Element)itParams.next();
- Element elParamName = DOMUtils.getFirstChildElement(elParam, "param-name");
- Element elParamValue = DOMUtils.getFirstChildElement(elParam, "param-value");
- if (Endpoint.SEPID_DOMAIN_ENDPOINT.equals(DOMUtils.getTextContent(elParamName)))
- {
- targetBeanName = DOMUtils.getTextContent(elParamValue);
- }
- }
- }
- else
- {
- // Check if it is a real servlet that we can ignore
- if (orgServletClass != null && JavaUtils.isAssignableFrom(Servlet.class, orgServletClass))
- {
- log.info("Ignore servlet: " + orgServletClassName);
- continue;
- }
- else if (orgServletClassName.endsWith("Servlet"))
- {
- log.info("Ignore <servlet-class> that ends with 'Servlet': " + orgServletClassName);
- continue;
- }
-
- // build a list of detached elements that come after <servlet-class>
- boolean startDetach = false;
- List<Element> detachedElements = new ArrayList<Element>();
- Iterator itDetached = DOMUtils.getChildElements(servletElement);
- while (itDetached.hasNext())
- {
- Element el = (Element)itDetached.next();
- if (startDetach == true)
- {
- detachedElements.add(el);
- servletElement.removeChild(el);
- }
- if (el.equals(classElement))
- {
- servletElement.removeChild(el);
- startDetach = true;
- }
- }
-
- // replace the class name
- classElement = (Element)DOMUtils.createElement("servlet-class");
- classElement.appendChild(DOMUtils.createTextNode(servletClass));
- classElement = (Element)servletElement.getOwnerDocument().importNode(classElement, true);
- servletElement.appendChild(classElement);
-
- // add additional init params
- if (orgServletClassName.equals(servletClass) == false)
- {
- Element paramElement = DOMUtils.createElement("init-param");
- paramElement.appendChild(DOMUtils.createElement("param-name")).appendChild(DOMUtils.createTextNode(Endpoint.SEPID_DOMAIN_ENDPOINT));
- paramElement.appendChild(DOMUtils.createElement("param-value")).appendChild(DOMUtils.createTextNode(orgServletClassName));
- paramElement = (Element)servletElement.getOwnerDocument().importNode(paramElement, true);
- servletElement.appendChild(paramElement);
- targetBeanName = orgServletClassName;
- }
-
- // reattach the elements
- itDetached = detachedElements.iterator();
- while (itDetached.hasNext())
- {
- Element el = (Element)itDetached.next();
- servletElement.appendChild(el);
- }
- }
-
- if (targetBeanName == null)
- throw new IllegalStateException("Cannot obtain service endpoint bean for: " + linkName);
-
- // remember the target bean name
- results.sepTargetMap.put(linkName, targetBeanName.trim());
- }
-
- return results;
- }
-
- // Return true if the web.xml is already modified
- private boolean isAlreadyModified(Element servletElement)
- {
- Iterator itParams = DOMUtils.getChildElements(servletElement, "init-param");
- while (itParams.hasNext())
- {
- Element elParam = (Element)itParams.next();
- Element elParamName = DOMUtils.getFirstChildElement(elParam, "param-name");
- if (Endpoint.SEPID_DOMAIN_ENDPOINT.equals(DOMUtils.getTextContent(elParamName)))
- return true;
- }
- return false;
- }
-}
\ No newline at end of file
Copied: trunk/jbossws-core/src/java/org/jboss/ws/core/server/ServiceEndpointServlet.java (from rev 2953, trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/ServiceEndpointServlet.java)
===================================================================
--- trunk/jbossws-core/src/java/org/jboss/ws/core/server/ServiceEndpointServlet.java (rev 0)
+++ trunk/jbossws-core/src/java/org/jboss/ws/core/server/ServiceEndpointServlet.java 2007-05-04 12:20:09 UTC (rev 2959)
@@ -0,0 +1,62 @@
+/*
+ * 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.core.server;
+
+// $Id$
+
+import javax.servlet.ServletContext;
+
+import org.jboss.logging.Logger;
+import org.jboss.ws.metadata.umdm.ServerEndpointMetaData;
+
+/**
+ * A servlet that is installed for every web service endpoint.
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 25-Apr-2007
+ */
+public class ServiceEndpointServlet extends AbstractServiceEndpointServlet
+{
+ // provide logging
+ private static final Logger log = Logger.getLogger(ServiceEndpointServlet.class);
+
+ /** Initialize the service endpoint
+ */
+ protected void initServiceEndpoint(String contextPath)
+ {
+ super.initServiceEndpoint(contextPath);
+
+ // read the config name/file from web.xml
+ ServletContext ctx = getServletContext();
+ String configName = ctx.getInitParameter("jbossws-config-name");
+ String configFile = ctx.getInitParameter("jbossws-config-file");
+ if (configName != null || configFile != null)
+ {
+ ServerEndpointMetaData epMetaData = endpoint.getMetaData(ServerEndpointMetaData.class);
+ if (epMetaData == null)
+ throw new IllegalStateException("Cannot obtain endpoint meta data");
+
+ log.debug("Updating service endpoint config\n config-name: " + configName + "\n config-file: " + configFile);
+ epMetaData.setConfigName(configName, configFile);
+ }
+ }
+}
Deleted: trunk/jbossws-core/src/java/org/jboss/ws/core/server/UnifiedDeploymentInfo.java
===================================================================
--- trunk/jbossws-core/src/java/org/jboss/ws/core/server/UnifiedDeploymentInfo.java 2007-05-04 10:28:42 UTC (rev 2958)
+++ trunk/jbossws-core/src/java/org/jboss/ws/core/server/UnifiedDeploymentInfo.java 2007-05-04 12:20:09 UTC (rev 2959)
@@ -1,144 +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.core.server;
-
-// $Id$
-
-import java.io.IOException;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.HashMap;
-import java.util.Map;
-
-import javax.management.ObjectName;
-
-import org.jboss.ws.integration.UnifiedVirtualFile;
-import org.jboss.ws.integration.deployment.Deployment.DeploymentType;
-
-/**
- * The container independent deployment info.
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 05-May-2006
- */
-public class UnifiedDeploymentInfo
-{
- public UnifiedDeploymentInfo(DeploymentType type)
- {
- this.type = type;
- }
-
- /** The type of this deployment */
- public DeploymentType type;
- /** Sub deployments have a parent */
- public UnifiedDeploymentInfo parent;
- /** The suffix of the deployment url */
- public String simpleName;
- /** The URL for this deployment */
- public URL url;
- /** The virtual file for the deployment root */
- public UnifiedVirtualFile vfRoot;
- /** The string identifing this deployment **/
- public String name;
- /** The URL to the expanded webapp **/
- public URL webappURL;
- /** We can hold "typed" metadata */
- public Object metaData;
- /** The deployment classloader **/
- public ClassLoader classLoader;
- /** An optional ObjectName of the deployed object */
- public ObjectName deployedObject;
-
- /** An arbitrary map of state associated with the deployment */
- private Map<Class, Object> attachments = new HashMap<Class, Object>();
-
- public <T> T getAttachment(Class<T> key)
- {
- return (T)attachments.get(key);
- }
-
- public <T> T addAttachment(Class<T> key, T value)
- {
- return (T)attachments.put(key, value);
- }
-
- /** The sortName concatenated with the canonical names of all parents. */
- public String getCanonicalName()
- {
- String name = simpleName;
- if (parent != null)
- name = parent.getCanonicalName() + "/" + name;
- return name;
- }
-
- public URL getMetaDataFileURL(String resourcePath) throws IOException
- {
- URL resourceURL = null;
- if (resourcePath != null && resourcePath.length() > 0)
- {
- if (resourcePath.startsWith("/"))
- resourcePath = resourcePath.substring(1);
-
- try
- {
- // assign an absolute URL
- resourceURL = new URL(resourcePath);
- }
- catch (MalformedURLException ex)
- {
- // ignore
- }
-
- if (resourceURL == null && vfRoot != null)
- {
- UnifiedVirtualFile vfResource = vfRoot.findChild(resourcePath);
- resourceURL = vfResource.toURL();
- }
-
- if (resourceURL == null)
- {
- String deploymentPath = url.toExternalForm();
-
- if (deploymentPath.startsWith("jar:") && deploymentPath.endsWith("!/") == false)
- deploymentPath += "!/";
-
- if (deploymentPath.endsWith("/") == false)
- deploymentPath += "/";
-
- // assign a relative URL
- resourceURL = new URL(deploymentPath + resourcePath);
- }
- }
- return resourceURL;
- }
-
- public String toString()
- {
- StringBuilder builder = new StringBuilder();
- builder.append("[");
- builder.append("type=" + type);
- builder.append(",simpleName=" + simpleName);
- builder.append(",url=" + url);
- builder.append("]");
- return builder.toString();
- }
-}
Deleted: trunk/jbossws-core/src/java/org/jboss/ws/core/server/WSDLFilePublisher.java
===================================================================
--- trunk/jbossws-core/src/java/org/jboss/ws/core/server/WSDLFilePublisher.java 2007-05-04 10:28:42 UTC (rev 2958)
+++ trunk/jbossws-core/src/java/org/jboss/ws/core/server/WSDLFilePublisher.java 2007-05-04 12:20:09 UTC (rev 2959)
@@ -1,328 +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.core.server;
-
-// $Id$
-
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.Writer;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.Iterator;
-import java.util.List;
-
-import javax.wsdl.Definition;
-import javax.wsdl.Import;
-import javax.wsdl.factory.WSDLFactory;
-
-import org.jboss.logging.Logger;
-import org.jboss.util.NotImplementedException;
-import org.jboss.ws.Constants;
-import org.jboss.ws.WSException;
-import org.jboss.ws.core.utils.DOMUtils;
-import org.jboss.ws.core.utils.IOUtils;
-import org.jboss.ws.core.utils.ResourceURL;
-import org.jboss.ws.integration.management.ServerConfig;
-import org.jboss.ws.integration.management.ServerConfigFactory;
-import org.jboss.ws.metadata.umdm.ServiceMetaData;
-import org.jboss.ws.metadata.umdm.UnifiedMetaData;
-import org.jboss.ws.metadata.wsdl.WSDLDefinitions;
-import org.jboss.ws.tools.wsdl.WSDLWriter;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-
-/** A helper class that publishes the wsdl files and their imports to the server/data/wsdl directory.
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 02-June-2004
- */
-public class WSDLFilePublisher
-{
- // provide logging
- private static final Logger log = Logger.getLogger(WSDLFilePublisher.class);
-
- // The deployment info for the web service archive
- private UnifiedDeploymentInfo udi;
- // The expected wsdl location in the deployment
- private String expLocation;
-
- public WSDLFilePublisher(UnifiedDeploymentInfo udi)
- {
- this.udi = udi;
-
- if (udi.type.toString().endsWith("_JSE"))
- {
- expLocation = "WEB-INF/wsdl/";
- }
- else
- {
- expLocation = "META-INF/wsdl/";
- }
- }
-
- /** Publish the deployed wsdl file to the data directory
- */
- public void publishWsdlFiles(UnifiedMetaData wsMetaData) throws IOException
- {
- String deploymentName = udi.getCanonicalName();
-
- // For each service
- for (ServiceMetaData serviceMetaData : wsMetaData.getServices())
- {
- File wsdlFile = getPublishLocation(deploymentName, serviceMetaData);
- wsdlFile.getParentFile().mkdirs();
-
- // Get the wsdl definition and write it to the wsdl publish location
- try
- {
- Writer fWriter = IOUtils.getCharsetFileWriter(wsdlFile, Constants.DEFAULT_XML_CHARSET);
- WSDLDefinitions wsdlDefinitions = serviceMetaData.getWsdlDefinitions();
- new WSDLWriter(wsdlDefinitions).write(fWriter, Constants.DEFAULT_XML_CHARSET);
-
- URL wsdlPublishURL = wsdlFile.toURL();
- log.info("WSDL published to: " + wsdlPublishURL);
-
- // udpate the wsdl file location
- serviceMetaData.setWsdlLocation(wsdlFile.toURL());
-
- // Process the wsdl imports
- Definition wsdl11Definition = wsdlDefinitions.getWsdlOneOneDefinition();
- if (wsdl11Definition != null)
- {
- publishWsdlImports(wsdlFile.toURL(), wsdl11Definition);
-
- // Publish XMLSchema imports
- Document document = wsdlDefinitions.getWsdlDocument();
- publishSchemaImports(wsdlFile.toURL(), document.getDocumentElement());
- }
- else
- {
- throw new NotImplementedException("WSDL-2.0 imports");
- }
- }
- catch (RuntimeException rte)
- {
- throw rte;
- }
- catch (Exception e)
- {
- throw new WSException("Cannot publish wsdl to: " + wsdlFile, e);
- }
- }
- }
-
- /** Publish the wsdl imports for a given wsdl definition
- */
- private void publishWsdlImports(URL parentURL, Definition parentDefinition) throws Exception
- {
- String baseURI = parentURL.toExternalForm();
-
- Iterator it = parentDefinition.getImports().values().iterator();
- while (it.hasNext())
- {
- for (Import wsdlImport : (List<Import>)it.next())
- {
- String locationURI = wsdlImport.getLocationURI();
- Definition subdef = wsdlImport.getDefinition();
-
- // its an external import, don't publish locally
- if (locationURI.startsWith("http://") == false)
- {
- URL targetURL = new URL(baseURI.substring(0, baseURI.lastIndexOf("/") + 1) + locationURI);
- File targetFile = new File(targetURL.getPath());
- targetFile.getParentFile().mkdirs();
-
- WSDLFactory wsdlFactory = WSDLFactory.newInstance();
- javax.wsdl.xml.WSDLWriter wsdlWriter = wsdlFactory.newWSDLWriter();
- FileWriter fw = new FileWriter(targetFile);
- wsdlWriter.writeWSDL(subdef, fw);
- fw.close();
-
- if (log.isDebugEnabled())
- log.debug("WSDL import published to: " + targetURL);
-
- // recursivly publish imports
- publishWsdlImports(targetURL, subdef);
-
- // Publish XMLSchema imports
- Element subdoc = DOMUtils.parse(targetURL.openStream());
- publishSchemaImports(targetURL, subdoc);
- }
- }
- }
- }
-
- /** Publish the schema imports for a given wsdl definition
- */
- private void publishSchemaImports(URL parentURL, Element element) throws Exception
- {
- String baseURI = parentURL.toExternalForm();
-
- Iterator it = DOMUtils.getChildElements(element);
- while (it.hasNext())
- {
- Element childElement = (Element)it.next();
- if ("import".equals(childElement.getLocalName()) || "include".equals(childElement.getLocalName()))
- {
- String schemaLocation = childElement.getAttribute("schemaLocation");
- if (schemaLocation.length() > 0)
- {
- if (schemaLocation.startsWith("http://") == false)
- {
- URL xsdURL = new URL(baseURI.substring(0, baseURI.lastIndexOf("/") + 1) + schemaLocation);
- File targetFile = new File(xsdURL.getPath());
- targetFile.getParentFile().mkdirs();
-
- String deploymentName = udi.getCanonicalName();
-
- // get the resource path
- int index = baseURI.indexOf(deploymentName);
- String resourcePath = baseURI.substring(index + deploymentName.length());
- resourcePath = resourcePath.substring(0, resourcePath.lastIndexOf("/"));
- if (resourcePath.length() > 0)
- resourcePath = resourcePath + "/";
-
- resourcePath = expLocation + resourcePath + schemaLocation;
- URL resourceURL = udi.getMetaDataFileURL(resourcePath);
- InputStream is = new ResourceURL(resourceURL).openStream();
- if (is == null)
- throw new IllegalArgumentException("Cannot find schema import in deployment: " + resourcePath);
-
- FileOutputStream fos = new FileOutputStream(targetFile);
- IOUtils.copyStream(fos, is);
- fos.close();
- is.close();
-
- if (log.isDebugEnabled())
- log.debug("XMLSchema import published to: " + xsdURL);
-
- // recursivly publish imports
- Element subdoc = DOMUtils.parse(xsdURL.openStream());
- publishSchemaImports(xsdURL, subdoc);
- }
- }
- }
- else
- {
- publishSchemaImports(parentURL, childElement);
- }
- }
- }
-
- /**
- * Delete the published wsdl
- */
- public void unpublishWsdlFiles() throws IOException
- {
- String deploymentDir = (udi.parent != null ? udi.parent.simpleName : udi.simpleName);
- ServerConfig config = ServerConfigFactory.getInstance().getServerConfig();
- File serviceDir = new File(config.getServerDataDir().getCanonicalPath() + "/wsdl/" + deploymentDir);
- deleteWsdlPublishDirectory(serviceDir);
- }
-
- /**
- * Delete the published wsdl document, traversing down the dir structure
- */
- private void deleteWsdlPublishDirectory(File dir) throws IOException
- {
- String[] files = dir.list();
- for (int i = 0; files != null && i < files.length; i++)
- {
- String fileName = files[i];
- File file = new File(dir + "/" + fileName);
- if (file.isDirectory())
- {
- deleteWsdlPublishDirectory(file);
- }
- else
- {
- if (file.delete() == false)
- log.warn("Cannot delete published wsdl document: " + file.toURL());
- }
- }
-
- // delete the directory as well
- dir.delete();
- }
-
- /**
- * Get the file publish location
- */
- private File getPublishLocation(String archiveName, ServiceMetaData serviceMetaData) throws IOException
- {
- String wsdlLocation = null;
- if (serviceMetaData.getWsdlLocation() != null)
- wsdlLocation = serviceMetaData.getWsdlLocation().toExternalForm();
- else if (serviceMetaData.getWsdlFile() != null)
- wsdlLocation = serviceMetaData.getWsdlFile();
-
- if (wsdlLocation == null)
- throw new IllegalStateException("Cannot obtain wsdl location for: " + serviceMetaData.getServiceName());
-
- if (log.isDebugEnabled())
- log.debug("Publish WSDL file: " + wsdlLocation);
-
- // Only file URLs are supported in <wsdl-publish-location>
- String publishLocation = serviceMetaData.getWsdlPublishLocation();
- boolean predefinedLocation = publishLocation != null && publishLocation.startsWith("file:");
-
- File locationFile = null;
- if (predefinedLocation == false)
- {
- ServerConfig config = ServerConfigFactory.getInstance().getServerConfig();
- locationFile = new File(config.getServerDataDir().getCanonicalPath() + "/wsdl/" + archiveName);
- }
- else
- {
- try
- {
- locationFile = new File(new URL(publishLocation).getPath());
- }
- catch (MalformedURLException e)
- {
- throw new IllegalArgumentException("Invalid publish location: " + e.getMessage());
- }
- }
-
- File wsdlFile;
- if (wsdlLocation.indexOf(expLocation) >= 0)
- {
- wsdlLocation = wsdlLocation.substring(wsdlLocation.indexOf(expLocation) + expLocation.length());
- wsdlFile = new File(locationFile + "/" + wsdlLocation);
- }
- else if (wsdlLocation.startsWith("vfsfile:") || wsdlLocation.startsWith("file:") || wsdlLocation.startsWith("jar:"))
- {
- wsdlLocation = wsdlLocation.substring(wsdlLocation.lastIndexOf("/") + 1);
- wsdlFile = new File(locationFile + "/" + wsdlLocation);
- }
- else
- {
- throw new WSException("Invalid wsdlFile '" + wsdlLocation + "', expected in: " + expLocation);
- }
-
- return wsdlFile;
- }
-}
Copied: trunk/jbossws-core/src/java/org/jboss/ws/core/server/legacy/JBossContextServlet.java (from rev 2953, trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/JBossContextServlet.java)
===================================================================
--- trunk/jbossws-core/src/java/org/jboss/ws/core/server/legacy/JBossContextServlet.java (rev 0)
+++ trunk/jbossws-core/src/java/org/jboss/ws/core/server/legacy/JBossContextServlet.java 2007-05-04 12:20:09 UTC (rev 2959)
@@ -0,0 +1,44 @@
+/*
+ * 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.core.server.legacy;
+
+// $Id$
+
+import org.jboss.logging.Logger;
+
+/**
+ * The servlet that that is associated with context /jbossws
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 21-Mar-2005
+ */
+public class JBossContextServlet extends CommonContextServlet
+{
+ // provide logging
+ protected final Logger log = Logger.getLogger(JBossContextServlet.class);
+
+ protected void initServiceEndpointManager()
+ {
+ ServiceEndpointManagerFactory factory = ServiceEndpointManagerFactory.getInstance();
+ epManager = factory.getServiceEndpointManager();
+ }
+}
Copied: trunk/jbossws-core/src/java/org/jboss/ws/core/server/legacy/PortComponentLinkServlet.java (from rev 2953, trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/PortComponentLinkServlet.java)
===================================================================
--- trunk/jbossws-core/src/java/org/jboss/ws/core/server/legacy/PortComponentLinkServlet.java (rev 0)
+++ trunk/jbossws-core/src/java/org/jboss/ws/core/server/legacy/PortComponentLinkServlet.java 2007-05-04 12:20:09 UTC (rev 2959)
@@ -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.core.server.legacy;
+
+// $Id$
+
+import java.io.IOException;
+import java.io.PrintWriter;
+
+import javax.servlet.ServletConfig;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.jboss.logging.Logger;
+import org.jboss.ws.WSException;
+
+/**
+ * A servlet that reports the serviceURL for a given service ID.
+ * <p/>
+ * When the web service client ENC is setup, it may contain port-component-link
+ * entries that point to service endpoints in the same top level deployment.
+ * The final serviceURL of those endpoints will become available after the
+ * reference to the javax.xml.rpc.Service is bound to JNDI.
+ * <p/>
+ * When the client does a lookup of the javax.xml.rpc.Service from JNDI the ObjectFactory
+ * will contact this servlet for the final serviceURL. It is acceptable that the client
+ * wsdl does not contain the correct serviceURL if the client is using the port-component-link element.
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 29-May-2004
+ */
+public class PortComponentLinkServlet extends HttpServlet
+{
+ // provide logging
+ private static final Logger log = Logger.getLogger(PortComponentLinkServlet.class);
+
+ protected ServiceEndpointManager epManager;
+
+ public void init(ServletConfig config) throws ServletException
+ {
+ super.init(config);
+ ServiceEndpointManagerFactory factory = ServiceEndpointManagerFactory.getInstance();
+ epManager = factory.getServiceEndpointManager();
+ }
+
+ /**
+ * Get the serviceURL as string for a given serviceID.
+ */
+ public void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException
+ {
+ String pcLink = req.getParameter("pcLink");
+ if (pcLink == null)
+ throw new IllegalArgumentException("Cannot obtain request parameter 'pcLink'");
+
+ ServiceEndpoint serviceEndpoint = epManager.resolvePortComponentLink(pcLink);
+ ;
+ if (serviceEndpoint == null)
+ throw new WSException("Cannot resolve port-component-link: " + pcLink);
+
+ res.setContentType("text/plain");
+ PrintWriter out = res.getWriter();
+
+ String endpointAddress = serviceEndpoint.getServiceEndpointInfo().getServerEndpointMetaData().getEndpointAddress();
+ out.println(endpointAddress);
+
+ log.debug("Resolved " + pcLink + " to: " + endpointAddress);
+ out.close();
+ }
+}
Deleted: trunk/jbossws-core/src/java/org/jboss/ws/core/server/legacy/ServiceEndpointDeployer.java
===================================================================
--- trunk/jbossws-core/src/java/org/jboss/ws/core/server/legacy/ServiceEndpointDeployer.java 2007-05-04 10:28:42 UTC (rev 2958)
+++ trunk/jbossws-core/src/java/org/jboss/ws/core/server/legacy/ServiceEndpointDeployer.java 2007-05-04 12:20:09 UTC (rev 2959)
@@ -1,231 +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.core.server.legacy;
-
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-
-import javax.management.ObjectName;
-
-import org.jboss.logging.Logger;
-import org.jboss.ws.WSException;
-import org.jboss.ws.core.server.UnifiedDeploymentInfo;
-import org.jboss.ws.core.server.WSDLFilePublisher;
-import org.jboss.ws.integration.deployment.Deployment.DeploymentType;
-import org.jboss.ws.metadata.builder.jaxrpc.JAXRPCDeployment;
-import org.jboss.ws.metadata.builder.jaxrpc.JAXRPCServerMetaDataBuilder;
-import org.jboss.ws.metadata.builder.jaxws.JAXWSMetaDataBuilderEJB3;
-import org.jboss.ws.metadata.builder.jaxws.JAXWSMetaDataBuilderJSE;
-import org.jboss.ws.metadata.umdm.EndpointMetaData;
-import org.jboss.ws.metadata.umdm.ServerEndpointMetaData;
-import org.jboss.ws.metadata.umdm.ServiceMetaData;
-import org.jboss.ws.metadata.umdm.UnifiedMetaData;
-
-/**
- * The POJO deployer for web service endpoints. This Deployer is already decoupled from the target
- * container (i.e. JBoss, Tomcat). The containers deployer architecture should be used to populate
- * the UnifiedDeploymentInfo object.
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 12-May-2006
- */
-public class ServiceEndpointDeployer
-{
- // logging support
- private static Logger log = Logger.getLogger(ServiceEndpointDeployer.class);
-
- // default bean name
- public static final String BEAN_NAME = "ServiceEndpointDeployer";
-
- // The ServiceEndpointManger injected by the kernel
- private ServiceEndpointManager epManager;
-
- // Maps the deployment url to UMDM
- private Map<String, UnifiedMetaData> metaDataMap = new ConcurrentHashMap<String, UnifiedMetaData>();
-
- // Injected by the Microkernel
- public void setServiceEndpointManager(ServiceEndpointManager epManager)
- {
- this.epManager = epManager;
- }
-
- public void create(UnifiedDeploymentInfo udi)
- {
- if(log.isDebugEnabled()) log.debug("create: " + udi.name);
- try
- {
- UnifiedMetaData wsMetaData;
- if (udi.type == DeploymentType.JAXRPC_JSE)
- {
- JAXRPCServerMetaDataBuilder builder = new JAXRPCServerMetaDataBuilder();
- wsMetaData = builder.buildMetaData((JAXRPCDeployment)udi);
- }
- else if (udi.type == DeploymentType.JAXRPC_EJB21)
- {
- JAXRPCServerMetaDataBuilder builder = new JAXRPCServerMetaDataBuilder();
- wsMetaData = builder.buildMetaData((JAXRPCDeployment)udi);
- }
- else if (udi.type == DeploymentType.JAXWS_JSE)
- {
- JAXWSMetaDataBuilderJSE builder = new JAXWSMetaDataBuilderJSE();
- wsMetaData = builder.buildMetaData(udi);
- }
- else if (udi.type == DeploymentType.JAXWS_EJB3)
- {
- JAXWSMetaDataBuilderEJB3 builder = new JAXWSMetaDataBuilderEJB3();
- wsMetaData = builder.buildMetaData(udi);
- }
- else
- {
- throw new IllegalStateException("Invalid type: " + udi.type);
- }
-
- metaDataMap.put(udi.name, wsMetaData);
-
- for (ServiceMetaData serviceMetaData : wsMetaData.getServices())
- {
- for (EndpointMetaData epMetaData : serviceMetaData.getEndpoints())
- {
- ServiceEndpointInfo seInfo = new ServiceEndpointInfo(udi, (ServerEndpointMetaData)epMetaData);
- epManager.createServiceEndpoint(seInfo);
- }
- }
- }
- catch (Exception ex)
- {
- log.error("Cannot create service endpoint", ex);
- if (ex instanceof RuntimeException)
- throw (RuntimeException)ex;
-
- throw new WSException(ex);
- }
- }
-
- public void start(UnifiedDeploymentInfo udi)
- {
- if(log.isDebugEnabled()) log.debug("start: " + udi.name);
- try
- {
- UnifiedMetaData wsMetaData = getUnifiedMetaData(udi);
- if (wsMetaData != null)
- {
- // late initialization of the web context loader
- if (wsMetaData.getClassLoader() != udi.classLoader)
- wsMetaData.setClassLoader(udi.classLoader);
-
- // Publish the WSDL file
- WSDLFilePublisher wsdlfp = new WSDLFilePublisher(udi);
- wsdlfp.publishWsdlFiles(wsMetaData);
- for (ServiceMetaData serviceMetaData : wsMetaData.getServices())
- {
- for (EndpointMetaData epMetaData : serviceMetaData.getEndpoints())
- {
- ObjectName sepID = ((ServerEndpointMetaData)epMetaData).getServiceEndpointID();
- epManager.startServiceEndpoint(sepID);
- }
- }
- }
- }
- catch (Exception ex)
- {
- log.error("Cannot start service endpoint", ex);
- if (ex instanceof RuntimeException)
- throw (RuntimeException)ex;
-
- throw new WSException(ex);
- }
- }
-
- public void stop(UnifiedDeploymentInfo udi)
- {
- if(log.isDebugEnabled()) log.debug("stop: " + udi.name);
- try
- {
- UnifiedMetaData wsMetaData = getUnifiedMetaData(udi);
- if (wsMetaData != null)
- {
- // Stop the service endpoints
- for (ServiceMetaData serviceMetaData : wsMetaData.getServices())
- {
- for (EndpointMetaData epMetaData : serviceMetaData.getEndpoints())
- {
- ObjectName sepID = ((ServerEndpointMetaData)epMetaData).getServiceEndpointID();
- epManager.stopServiceEndpoint(sepID);
- }
- }
-
- // Unpublish the WSDL file
- WSDLFilePublisher wsdlfp = new WSDLFilePublisher(udi);
- wsdlfp.unpublishWsdlFiles();
- }
- }
- catch (Exception ex)
- {
- log.error("Cannot stop service endpoint", ex);
- if (ex instanceof RuntimeException)
- throw (RuntimeException)ex;
-
- throw new WSException(ex);
- }
- }
-
- public void destroy(UnifiedDeploymentInfo udi)
- {
- if(log.isDebugEnabled()) log.debug("destroy: " + udi.name);
- try
- {
- UnifiedMetaData wsMetaData = getUnifiedMetaData(udi);
- if (wsMetaData != null)
- {
- // Destroy the service endpoints
- for (ServiceMetaData serviceMetaData : wsMetaData.getServices())
- {
- for (EndpointMetaData epMetaData : serviceMetaData.getEndpoints())
- {
- ObjectName sepID = ((ServerEndpointMetaData)epMetaData).getServiceEndpointID();
- epManager.destroyServiceEndpoint(sepID);
- }
- }
- removeUnifiedMetaData(udi);
- }
- }
- catch (Exception ex)
- {
- log.error("Cannot destroy service endpoint", ex);
- if (ex instanceof RuntimeException)
- throw (RuntimeException)ex;
-
- throw new WSException(ex);
- }
- }
-
- public UnifiedMetaData getUnifiedMetaData(UnifiedDeploymentInfo udi)
- {
- UnifiedMetaData wsMetaData = metaDataMap.get(udi.name);
- return wsMetaData;
- }
-
- public void removeUnifiedMetaData(UnifiedDeploymentInfo udi)
- {
- metaDataMap.remove(udi.name);
- }
-}
\ No newline at end of file
Modified: trunk/jbossws-core/src/java/org/jboss/ws/core/server/legacy/ServiceEndpointInfo.java
===================================================================
--- trunk/jbossws-core/src/java/org/jboss/ws/core/server/legacy/ServiceEndpointInfo.java 2007-05-04 10:28:42 UTC (rev 2958)
+++ trunk/jbossws-core/src/java/org/jboss/ws/core/server/legacy/ServiceEndpointInfo.java 2007-05-04 12:20:09 UTC (rev 2959)
@@ -26,7 +26,7 @@
import javax.management.ObjectName;
import org.jboss.ws.WSException;
-import org.jboss.ws.core.server.UnifiedDeploymentInfo;
+import org.jboss.ws.core.deployment.UnifiedDeploymentInfo;
import org.jboss.ws.integration.deployment.Deployment.DeploymentType;
import org.jboss.ws.metadata.j2ee.UnifiedApplicationMetaData;
import org.jboss.ws.metadata.j2ee.UnifiedBeanMetaData;
Deleted: trunk/jbossws-core/src/java/org/jboss/ws/core/server/legacy/ServiceEndpointInvokerJSE.java
===================================================================
--- trunk/jbossws-core/src/java/org/jboss/ws/core/server/legacy/ServiceEndpointInvokerJSE.java 2007-05-04 10:28:42 UTC (rev 2958)
+++ trunk/jbossws-core/src/java/org/jboss/ws/core/server/legacy/ServiceEndpointInvokerJSE.java 2007-05-04 12:20:09 UTC (rev 2959)
@@ -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.core.server.legacy;
-
-// $Id: $
-
-import java.lang.reflect.Method;
-
-import javax.xml.rpc.ServiceException;
-import javax.xml.rpc.server.ServiceLifecycle;
-import javax.xml.rpc.server.ServletEndpointContext;
-import javax.xml.rpc.soap.SOAPFaultException;
-import javax.xml.ws.WebServiceContext;
-
-import org.jboss.logging.Logger;
-import org.jboss.ws.WSException;
-import org.jboss.ws.core.CommonMessageContext;
-import org.jboss.ws.core.EndpointInvocation;
-import org.jboss.ws.core.jaxrpc.ServletEndpointContextImpl;
-import org.jboss.ws.core.jaxws.WebServiceContextInjector;
-import org.jboss.ws.core.jaxws.WebServiceContextJSE;
-import org.jboss.ws.core.jaxws.handler.SOAPMessageContextJAXWS;
-import org.jboss.ws.core.server.ServletRequestContext;
-import org.jboss.ws.core.soap.MessageContextAssociation;
-import org.jboss.ws.metadata.umdm.ServerEndpointMetaData;
-
-/**
- * Handles invocations on JSE endpoints.
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 19-Jan-2005
- */
-public class ServiceEndpointInvokerJSE extends AbstractServiceEndpointInvoker implements ServiceEndpointInvoker
-{
- // provide logging
- private Logger log = Logger.getLogger(ServiceEndpointInvokerJSE.class);
-
- /** Load the SEI implementation bean if necessary */
- public Class loadServiceEndpoint() throws ClassNotFoundException
- {
- ServerEndpointMetaData epMetaData = seInfo.getServerEndpointMetaData();
- ClassLoader cl = epMetaData.getClassLoader();
- String seiImplName = epMetaData.getServiceEndpointImplName();
- Class seiImplClass = cl.loadClass(seiImplName);
- return seiImplClass;
- }
-
- /** Create an instance of the SEI implementation bean if necessary */
- public Object createServiceEndpointInstance(Object context, Class seiImplClass) throws IllegalAccessException, InstantiationException
- {
- Object seiImpl = seiImplClass.newInstance();
- if (seiImpl instanceof ServiceLifecycle && context != null)
- {
- try
- {
- ServiceLifecycle serviceLifecycle = ((ServiceLifecycle)seiImpl);
- ServletEndpointContext servletEndpointContext = new ServletEndpointContextImpl((ServletRequestContext)context);
- serviceLifecycle.init(servletEndpointContext);
- }
- catch (ServiceException ex)
- {
- throw new WSException(ex);
- }
- }
- return seiImpl;
- }
-
- /** Invoke an instance of the SEI implementation bean */
- public void invokeServiceEndpointInstance(Object seiImpl, EndpointInvocation epInv) throws SOAPFaultException, Exception
- {
- log.debug("invokeServiceEndpoint: " + epInv.getJavaMethod().getName());
- try
- {
- CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
- if (msgContext instanceof SOAPMessageContextJAXWS)
- {
- WebServiceContext wsContext = new WebServiceContextJSE((SOAPMessageContextJAXWS)msgContext);
- new WebServiceContextInjector().injectContext(seiImpl, wsContext);
- }
-
- Class implClass = seiImpl.getClass();
- Method seiMethod = epInv.getJavaMethod();
- Method implMethod = getImplMethod(implClass, seiMethod);
-
- Object[] args = epInv.getRequestPayload();
- Object retObj = implMethod.invoke(seiImpl, args);
- epInv.setReturnValue(retObj);
- }
- catch (Exception e)
- {
- handleInvocationException(e);
- }
- }
-
- /** Destroy an instance of the SEI implementation bean if necessary */
- public void destroyServiceEndpointInstance(Object seiImpl)
- {
- if (seiImpl instanceof ServiceLifecycle)
- {
- ((ServiceLifecycle)seiImpl).destroy();
- }
- }
-}
Modified: trunk/jbossws-core/src/java/org/jboss/ws/metadata/builder/MetaDataBuilder.java
===================================================================
--- trunk/jbossws-core/src/java/org/jboss/ws/metadata/builder/MetaDataBuilder.java 2007-05-04 10:28:42 UTC (rev 2958)
+++ trunk/jbossws-core/src/java/org/jboss/ws/metadata/builder/MetaDataBuilder.java 2007-05-04 12:20:09 UTC (rev 2959)
@@ -46,8 +46,8 @@
import org.jboss.logging.Logger;
import org.jboss.ws.Constants;
import org.jboss.ws.WSException;
+import org.jboss.ws.core.deployment.UnifiedDeploymentInfo;
import org.jboss.ws.core.jaxrpc.Use;
-import org.jboss.ws.core.server.UnifiedDeploymentInfo;
import org.jboss.ws.core.server.legacy.ServiceEndpointManager;
import org.jboss.ws.core.server.legacy.ServiceEndpointManagerFactory;
import org.jboss.ws.integration.ObjectNameFactory;
Deleted: trunk/jbossws-core/src/java/org/jboss/ws/metadata/builder/jaxrpc/JAXRPCClientDeployment.java
===================================================================
--- trunk/jbossws-core/src/java/org/jboss/ws/metadata/builder/jaxrpc/JAXRPCClientDeployment.java 2007-05-04 10:28:42 UTC (rev 2958)
+++ trunk/jbossws-core/src/java/org/jboss/ws/metadata/builder/jaxrpc/JAXRPCClientDeployment.java 2007-05-04 12:20:09 UTC (rev 2959)
@@ -1,42 +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.metadata.builder.jaxrpc;
-
-//$Id$
-
-import org.jboss.ws.core.server.UnifiedDeploymentInfo;
-import org.jboss.ws.integration.deployment.Deployment.DeploymentType;
-
-/**
- * The container independent deployment info.
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 05-May-2006
- */
-public class JAXRPCClientDeployment extends UnifiedDeploymentInfo
-{
-
- public JAXRPCClientDeployment(DeploymentType type)
- {
- super(type);
- }
-}
Deleted: trunk/jbossws-core/src/java/org/jboss/ws/metadata/builder/jaxrpc/JAXRPCDeployment.java
===================================================================
--- trunk/jbossws-core/src/java/org/jboss/ws/metadata/builder/jaxrpc/JAXRPCDeployment.java 2007-05-04 10:28:42 UTC (rev 2958)
+++ trunk/jbossws-core/src/java/org/jboss/ws/metadata/builder/jaxrpc/JAXRPCDeployment.java 2007-05-04 12:20:09 UTC (rev 2959)
@@ -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.metadata.builder.jaxrpc;
-
-import java.io.InputStream;
-import java.net.URL;
-
-import org.jboss.ws.WSException;
-import org.jboss.ws.core.server.UnifiedDeploymentInfo;
-import org.jboss.ws.integration.UnifiedVirtualFile;
-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.xb.binding.ObjectModelFactory;
-import org.jboss.xb.binding.Unmarshaller;
-import org.jboss.xb.binding.UnmarshallerFactory;
-
-// $Id$
-
-/**
- * The container independent deployment info.
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 05-May-2006
- */
-public class JAXRPCDeployment extends UnifiedDeploymentInfo
-{
- private WebservicesMetaData wsMetaData;
-
- public JAXRPCDeployment(DeploymentType type, WebservicesMetaData wsMetaData)
- {
- super(type);
- this.wsMetaData = wsMetaData;
- }
-
- public JAXRPCDeployment(DeploymentType type, UnifiedVirtualFile vfWebservices)
- {
- super(type);
-
- try
- {
- // Unmarshall webservices.xml
- URL webservicesURL = vfWebservices.toURL();
- InputStream is = webservicesURL.openStream();
- try
- {
- Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller();
- ObjectModelFactory factory = new WebservicesFactory(webservicesURL);
- wsMetaData = (WebservicesMetaData)unmarshaller.unmarshal(is, factory, null);
- }
- finally
- {
- is.close();
- }
- }
- catch (Exception ex)
- {
- WSException.rethrow(ex);
- }
- }
-
- public WebservicesMetaData getWebservicesMetaData()
- {
- return wsMetaData;
- }
-}
Modified: trunk/jbossws-core/src/java/org/jboss/ws/metadata/builder/jaxrpc/JAXRPCServerMetaDataBuilder.java
===================================================================
--- trunk/jbossws-core/src/java/org/jboss/ws/metadata/builder/jaxrpc/JAXRPCServerMetaDataBuilder.java 2007-05-04 10:28:42 UTC (rev 2958)
+++ trunk/jbossws-core/src/java/org/jboss/ws/metadata/builder/jaxrpc/JAXRPCServerMetaDataBuilder.java 2007-05-04 12:20:09 UTC (rev 2959)
@@ -29,6 +29,7 @@
import org.jboss.logging.Logger;
import org.jboss.ws.WSException;
+import org.jboss.ws.core.deployment.JAXRPCDeployment;
import org.jboss.ws.metadata.j2ee.UnifiedApplicationMetaData;
import org.jboss.ws.metadata.j2ee.UnifiedBeanMetaData;
import org.jboss.ws.metadata.j2ee.UnifiedEjbPortComponentMetaData;
Modified: trunk/jbossws-core/src/java/org/jboss/ws/metadata/builder/jaxws/JAXWSMetaDataBuilderEJB3.java
===================================================================
--- trunk/jbossws-core/src/java/org/jboss/ws/metadata/builder/jaxws/JAXWSMetaDataBuilderEJB3.java 2007-05-04 10:28:42 UTC (rev 2958)
+++ trunk/jbossws-core/src/java/org/jboss/ws/metadata/builder/jaxws/JAXWSMetaDataBuilderEJB3.java 2007-05-04 12:20:09 UTC (rev 2959)
@@ -30,7 +30,7 @@
import org.jboss.annotation.security.SecurityDomain;
import org.jboss.logging.Logger;
import org.jboss.ws.WSException;
-import org.jboss.ws.core.server.UnifiedDeploymentInfo;
+import org.jboss.ws.core.deployment.UnifiedDeploymentInfo;
import org.jboss.ws.metadata.j2ee.UnifiedApplicationMetaData;
import org.jboss.ws.metadata.j2ee.UnifiedBeanMetaData;
import org.jboss.ws.metadata.umdm.UnifiedMetaData;
Modified: trunk/jbossws-core/src/java/org/jboss/ws/metadata/builder/jaxws/JAXWSMetaDataBuilderJSE.java
===================================================================
--- trunk/jbossws-core/src/java/org/jboss/ws/metadata/builder/jaxws/JAXWSMetaDataBuilderJSE.java 2007-05-04 10:28:42 UTC (rev 2958)
+++ trunk/jbossws-core/src/java/org/jboss/ws/metadata/builder/jaxws/JAXWSMetaDataBuilderJSE.java 2007-05-04 12:20:09 UTC (rev 2959)
@@ -26,7 +26,7 @@
import org.jboss.logging.Logger;
import org.jboss.ws.WSException;
-import org.jboss.ws.core.server.UnifiedDeploymentInfo;
+import org.jboss.ws.core.deployment.UnifiedDeploymentInfo;
import org.jboss.ws.metadata.j2ee.UnifiedWebMetaData;
import org.jboss.ws.metadata.umdm.UnifiedMetaData;
Modified: trunk/jbossws-core/src/java/org/jboss/ws/metadata/builder/jaxws/JAXWSProviderMetaDataBuilder.java
===================================================================
--- trunk/jbossws-core/src/java/org/jboss/ws/metadata/builder/jaxws/JAXWSProviderMetaDataBuilder.java 2007-05-04 10:28:42 UTC (rev 2958)
+++ trunk/jbossws-core/src/java/org/jboss/ws/metadata/builder/jaxws/JAXWSProviderMetaDataBuilder.java 2007-05-04 12:20:09 UTC (rev 2959)
@@ -37,8 +37,8 @@
import javax.xml.ws.Service.Mode;
import org.jboss.ws.Constants;
+import org.jboss.ws.core.deployment.UnifiedDeploymentInfo;
import org.jboss.ws.core.jaxrpc.Style;
-import org.jboss.ws.core.server.UnifiedDeploymentInfo;
import org.jboss.ws.core.soap.SOAPContentElement;
import org.jboss.ws.core.utils.JavaUtils;
import org.jboss.ws.metadata.builder.MetaDataBuilder;
Modified: trunk/jbossws-core/src/java/org/jboss/ws/metadata/builder/jaxws/JAXWSServerMetaDataBuilder.java
===================================================================
--- trunk/jbossws-core/src/java/org/jboss/ws/metadata/builder/jaxws/JAXWSServerMetaDataBuilder.java 2007-05-04 10:28:42 UTC (rev 2958)
+++ trunk/jbossws-core/src/java/org/jboss/ws/metadata/builder/jaxws/JAXWSServerMetaDataBuilder.java 2007-05-04 12:20:09 UTC (rev 2959)
@@ -28,7 +28,7 @@
import org.jboss.ws.annotation.EndpointConfig;
import org.jboss.ws.annotation.WebContext;
-import org.jboss.ws.core.server.UnifiedDeploymentInfo;
+import org.jboss.ws.core.deployment.UnifiedDeploymentInfo;
import org.jboss.ws.integration.deployment.Deployment.DeploymentType;
import org.jboss.ws.metadata.umdm.ServerEndpointMetaData;
import org.jboss.ws.metadata.umdm.UnifiedMetaData;
Modified: trunk/jbossws-core/src/java/org/jboss/ws/metadata/builder/jaxws/JAXWSWebServiceMetaDataBuilder.java
===================================================================
--- trunk/jbossws-core/src/java/org/jboss/ws/metadata/builder/jaxws/JAXWSWebServiceMetaDataBuilder.java 2007-05-04 10:28:42 UTC (rev 2958)
+++ trunk/jbossws-core/src/java/org/jboss/ws/metadata/builder/jaxws/JAXWSWebServiceMetaDataBuilder.java 2007-05-04 12:20:09 UTC (rev 2959)
@@ -34,7 +34,7 @@
import org.jboss.ws.Constants;
import org.jboss.ws.WSException;
-import org.jboss.ws.core.server.UnifiedDeploymentInfo;
+import org.jboss.ws.core.deployment.UnifiedDeploymentInfo;
import org.jboss.ws.core.utils.IOUtils;
import org.jboss.ws.metadata.builder.MetaDataBuilder;
import org.jboss.ws.metadata.umdm.*;
Modified: trunk/jbossws-core/src/java/org/jboss/ws/tools/jaxws/impl/WSContractProviderImpl.java
===================================================================
--- trunk/jbossws-core/src/java/org/jboss/ws/tools/jaxws/impl/WSContractProviderImpl.java 2007-05-04 10:28:42 UTC (rev 2958)
+++ trunk/jbossws-core/src/java/org/jboss/ws/tools/jaxws/impl/WSContractProviderImpl.java 2007-05-04 12:20:09 UTC (rev 2959)
@@ -30,7 +30,7 @@
import javax.ejb.Stateless;
import org.jboss.ws.WSException;
-import org.jboss.ws.core.server.UnifiedDeploymentInfo;
+import org.jboss.ws.core.deployment.UnifiedDeploymentInfo;
import org.jboss.ws.integration.ResourceLoaderAdapter;
import org.jboss.ws.integration.deployment.Deployment.DeploymentType;
import org.jboss.ws.metadata.builder.jaxws.JAXWSWebServiceMetaDataBuilder;
17 years, 8 months
JBossWS SVN: r2958 - in branches/jbossws-2.0/build/hudson/hudson-home/jobs: AS-4.0-jdk14 and 4 other directories.
by jbossws-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2007-05-04 06:28:42 -0400 (Fri, 04 May 2007)
New Revision: 2958
Modified:
branches/jbossws-2.0/build/hudson/hudson-home/jobs/AS-4.0-jdk14/config.xml
branches/jbossws-2.0/build/hudson/hudson-home/jobs/AS-4.0.5-jdk14/config.xml
branches/jbossws-2.0/build/hudson/hudson-home/jobs/AS-4.0.5/config.xml
branches/jbossws-2.0/build/hudson/hudson-home/jobs/AS-4.0/config.xml
branches/jbossws-2.0/build/hudson/hudson-home/jobs/AS-4.2/config.xml
branches/jbossws-2.0/build/hudson/hudson-home/jobs/AS-5.0/config.xml
Log:
Remove all thirdparty subdirs.
Don't build testsuite.
Modified: branches/jbossws-2.0/build/hudson/hudson-home/jobs/AS-4.0/config.xml
===================================================================
--- branches/jbossws-2.0/build/hudson/hudson-home/jobs/AS-4.0/config.xml 2007-05-04 08:39:46 UTC (rev 2957)
+++ branches/jbossws-2.0/build/hudson/hudson-home/jobs/AS-4.0/config.xml 2007-05-04 10:28:42 UTC (rev 2958)
@@ -22,7 +22,7 @@
# build jboss
#
cd $SVNBASE
-rm -f thirdparty/libraries.ent
+rm -rf thirdparty/*
./build/build.sh clean main
#
@@ -32,12 +32,6 @@
echo "Cannot find expected build: @hudson.jboss40.build@-ejb3"
exit 1
fi
-
-#
-# build the testsuite
-#
-cd testsuite
-./build.sh clean main
</command>
</hudson.tasks.Shell>
</builders>
Modified: branches/jbossws-2.0/build/hudson/hudson-home/jobs/AS-4.0-jdk14/config.xml
===================================================================
--- branches/jbossws-2.0/build/hudson/hudson-home/jobs/AS-4.0-jdk14/config.xml 2007-05-04 08:39:46 UTC (rev 2957)
+++ branches/jbossws-2.0/build/hudson/hudson-home/jobs/AS-4.0-jdk14/config.xml 2007-05-04 10:28:42 UTC (rev 2958)
@@ -24,7 +24,7 @@
# build jboss
#
cd $SVNBASE
-rm -f thirdparty/libraries.ent
+rm -rf thirdparty/*
./build/build.sh clean main
#
@@ -34,12 +34,6 @@
echo "Cannot find expected build: @hudson.jboss40.build@"
exit 1
fi
-
-#
-# build the testsuite
-#
-cd testsuite
-./build.sh clean main
</command>
</hudson.tasks.Shell>
</builders>
Modified: branches/jbossws-2.0/build/hudson/hudson-home/jobs/AS-4.0.5/config.xml
===================================================================
--- branches/jbossws-2.0/build/hudson/hudson-home/jobs/AS-4.0.5/config.xml 2007-05-04 08:39:46 UTC (rev 2957)
+++ branches/jbossws-2.0/build/hudson/hudson-home/jobs/AS-4.0.5/config.xml 2007-05-04 10:28:42 UTC (rev 2958)
@@ -13,14 +13,8 @@
# build jboss
#
cd $SVNBASE
-rm -f thirdparty/libraries.ent
+rm -rf thirdparty/*
./build/build.sh clean main
-
-#
-# build the testsuite
-#
-cd testsuite
-./build.sh clean main
</command>
</hudson.tasks.Shell>
</builders>
Modified: branches/jbossws-2.0/build/hudson/hudson-home/jobs/AS-4.0.5-jdk14/config.xml
===================================================================
--- branches/jbossws-2.0/build/hudson/hudson-home/jobs/AS-4.0.5-jdk14/config.xml 2007-05-04 08:39:46 UTC (rev 2957)
+++ branches/jbossws-2.0/build/hudson/hudson-home/jobs/AS-4.0.5-jdk14/config.xml 2007-05-04 10:28:42 UTC (rev 2958)
@@ -15,14 +15,9 @@
# build jboss
#
cd $SVNBASE
-rm -f thirdparty/libraries.ent
+rm -rf thirdparty/*
./build/build.sh clean main
-#
-# build the testsuite
-#
-cd testsuite
-./build.sh clean main
</command>
</hudson.tasks.Shell>
</builders>
Modified: branches/jbossws-2.0/build/hudson/hudson-home/jobs/AS-4.2/config.xml
===================================================================
--- branches/jbossws-2.0/build/hudson/hudson-home/jobs/AS-4.2/config.xml 2007-05-04 08:39:46 UTC (rev 2957)
+++ branches/jbossws-2.0/build/hudson/hudson-home/jobs/AS-4.2/config.xml 2007-05-04 10:28:42 UTC (rev 2958)
@@ -22,7 +22,7 @@
# build jboss
#
cd $SVNBASE
-rm -f thirdparty/libraries.ent
+rm -rf thirdparty/*
./build/build.sh clean main
#
@@ -32,12 +32,6 @@
echo "Cannot find expected build: @hudson.jboss42.build@"
exit 1
fi
-
-#
-# build the testsuite
-#
-cd testsuite
-./build.sh clean main
</command>
</hudson.tasks.Shell>
</builders>
Modified: branches/jbossws-2.0/build/hudson/hudson-home/jobs/AS-5.0/config.xml
===================================================================
--- branches/jbossws-2.0/build/hudson/hudson-home/jobs/AS-5.0/config.xml 2007-05-04 08:39:46 UTC (rev 2957)
+++ branches/jbossws-2.0/build/hudson/hudson-home/jobs/AS-5.0/config.xml 2007-05-04 10:28:42 UTC (rev 2958)
@@ -22,7 +22,7 @@
# build jboss
#
cd $SVNBASE
-rm -f thirdparty/libraries.ent
+rm -rf thirdparty/*
./build/build.sh clean main
#
@@ -32,12 +32,6 @@
echo "Cannot find expected build: @hudson.jboss50.build@"
exit 1
fi
-
-#
-# build the testsuite
-#
-cd testsuite
-./build.sh clean main
</command>
</hudson.tasks.Shell>
</builders>
17 years, 8 months
JBossWS SVN: r2957 - in branches/JBWS-856/jbossws-core/src/java/org/jboss/ws: extensions/policy/metadata and 1 other directories.
by jbossws-commits@lists.jboss.org
Author: palin
Date: 2007-05-04 04:39:46 -0400 (Fri, 04 May 2007)
New Revision: 2957
Added:
branches/JBWS-856/jbossws-core/src/java/org/jboss/ws/extensions/policy/PolicyScopeLevel.java
Modified:
branches/JBWS-856/jbossws-core/src/java/org/jboss/ws/extensions/policy/metadata/PolicyMetaExtension.java
branches/JBWS-856/jbossws-core/src/java/org/jboss/ws/metadata/builder/MetaDataBuilder.java
Log:
Partial commit: some changes to MetaDataBuilder to deal with policy references using the apache library and to save policy scope in the umdm
Added: branches/JBWS-856/jbossws-core/src/java/org/jboss/ws/extensions/policy/PolicyScopeLevel.java
===================================================================
--- branches/JBWS-856/jbossws-core/src/java/org/jboss/ws/extensions/policy/PolicyScopeLevel.java (rev 0)
+++ branches/JBWS-856/jbossws-core/src/java/org/jboss/ws/extensions/policy/PolicyScopeLevel.java 2007-05-04 08:39:46 UTC (rev 2957)
@@ -0,0 +1,43 @@
+/*
+ * 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.extensions.policy;
+
+
+/**
+ * When attaching a Policy to a WSDL element, a Policy Scope is implied for that attachment.
+ * PolicyScopeLevel enumerates all kind of element a Policy can be attached to in wsdl 1.1.
+ *
+ * @author Alessio Soldano, <alessio.soldano(a)javalinux.it>
+ * @since 3-May-2007
+ */
+public enum PolicyScopeLevel
+{
+ WSDL_SERVICE, //wsdl:service
+ WSDL_PORT, //wsdl:port
+ WSDL_PORT_TYPE, //wsdl:portType
+ WSDL_BINDING, //wsdl:binding
+ BINDING_OPERATION, //wsdl:binding/wsdl:operation
+ PORT_TYPE_OPERATION, //wsdl:portType/wsdl:operation
+ BINDING_OPERATION_INPUT, //wsdl:binding/wsdl:operation/wsdl:input
+ PORT_TYPE_OPERATION_INPUT, //wsdl:portType/wsdl:operation/wsdl:input
+ MESSAGE //wsdl:message
+}
Modified: branches/JBWS-856/jbossws-core/src/java/org/jboss/ws/extensions/policy/metadata/PolicyMetaExtension.java
===================================================================
--- branches/JBWS-856/jbossws-core/src/java/org/jboss/ws/extensions/policy/metadata/PolicyMetaExtension.java 2007-05-03 22:43:23 UTC (rev 2956)
+++ branches/JBWS-856/jbossws-core/src/java/org/jboss/ws/extensions/policy/metadata/PolicyMetaExtension.java 2007-05-04 08:39:46 UTC (rev 2957)
@@ -2,12 +2,14 @@
import org.apache.ws.policy.Policy;
+import org.jboss.ws.extensions.policy.PolicyScopeLevel;
import org.jboss.ws.metadata.umdm.MetaDataExtension;
public class PolicyMetaExtension extends MetaDataExtension
{
- Policy policy;
+ private Policy policy;
+ private PolicyScopeLevel scope;
public PolicyMetaExtension(String extensionNameSpace)
@@ -25,7 +27,17 @@
{
this.policy = policy;
}
-
-
+
+ public PolicyScopeLevel getScope()
+ {
+ return scope;
+ }
+
+
+ public void setScope(PolicyScopeLevel scope)
+ {
+ this.scope = scope;
+ }
+
}
Modified: branches/JBWS-856/jbossws-core/src/java/org/jboss/ws/metadata/builder/MetaDataBuilder.java
===================================================================
--- branches/JBWS-856/jbossws-core/src/java/org/jboss/ws/metadata/builder/MetaDataBuilder.java 2007-05-03 22:43:23 UTC (rev 2956)
+++ branches/JBWS-856/jbossws-core/src/java/org/jboss/ws/metadata/builder/MetaDataBuilder.java 2007-05-04 08:39:46 UTC (rev 2957)
@@ -45,8 +45,10 @@
import javax.xml.ws.addressing.AddressingProperties;
import org.apache.ws.policy.Policy;
+import org.apache.ws.policy.PolicyReference;
import org.apache.ws.policy.util.DOMPolicyReader;
import org.apache.ws.policy.util.PolicyFactory;
+import org.apache.ws.policy.util.PolicyRegistry;
import org.jboss.logging.Logger;
import org.jboss.ws.Constants;
import org.jboss.ws.WSException;
@@ -61,6 +63,7 @@
import org.jboss.ws.extensions.eventing.EventingUtils;
import org.jboss.ws.extensions.eventing.deployment.EventingEndpoint;
import org.jboss.ws.extensions.eventing.metadata.EventingEpMetaExt;
+import org.jboss.ws.extensions.policy.PolicyScopeLevel;
import org.jboss.ws.extensions.policy.deployer.PolicyDeployer;
import org.jboss.ws.extensions.policy.deployer.exceptions.UnsupportedPolicy;
import org.jboss.ws.extensions.policy.metadata.PolicyMetaExtension;
@@ -470,12 +473,12 @@
protected void processPolicyMetaDataExtension(EndpointMetaData epMetaData, WSDLDefinitions wsdlDefinitions)
{
//Collect all policies defined in our wsdl definitions
- DOMPolicyReader reader = (DOMPolicyReader) PolicyFactory.getPolicyReader(PolicyFactory.DOM_POLICY_READER);
- Map<String,Policy> localPolicyElementsMap = new HashMap<String,Policy>();
+ DOMPolicyReader reader = (DOMPolicyReader) PolicyFactory.getPolicyReader(PolicyFactory.DOM_POLICY_READER);
+ PolicyRegistry localPolicyRegistry = new PolicyRegistry();
for (WSDLExtensibilityElement policyElement : wsdlDefinitions.getExtensibilityElements(Constants.WSDL_ELEMENT_POLICY))
{
Policy policy = reader.readPolicy(policyElement.getElement());
- localPolicyElementsMap.put(policy.getId(), policy);
+ localPolicyRegistry.register(policy.getPolicyURI(), policy);
}
WSDLService wsdlService = wsdlDefinitions.getService(epMetaData.getServiceMetaData().getServiceName().getLocalPart());
@@ -485,51 +488,50 @@
//Port scope
List<WSDLExtensibilityElement> portPolicyRefList = wsdlEndpoint.getExtensibilityElements(Constants.WSDL_ELEMENT_POLICYREFERENCE);
- deployPolicies(portPolicyRefList, localPolicyElementsMap, epMetaData);
+ deployPolicies(portPolicyRefList, PolicyScopeLevel.WSDL_PORT, localPolicyRegistry, epMetaData);
//Binding scope
List<WSDLExtensibilityElement> bindingPolicyRefList = wsdlBinding.getExtensibilityElements(Constants.WSDL_ELEMENT_POLICYREFERENCE);
- deployPolicies(bindingPolicyRefList, localPolicyElementsMap, epMetaData);
+ deployPolicies(bindingPolicyRefList, PolicyScopeLevel.WSDL_BINDING, localPolicyRegistry, epMetaData);
//PortType scope
List<WSDLExtensibilityElement> portTypePolicyRefList = wsdlInterface.getExtensibilityElements(Constants.WSDL_PROPERTY_POLICYURIS);
- deployPolicies(portTypePolicyRefList, localPolicyElementsMap, epMetaData);
+ deployPolicies(portTypePolicyRefList, PolicyScopeLevel.WSDL_PORT_TYPE, localPolicyRegistry, epMetaData);
}
- private void deployPolicies(List<WSDLExtensibilityElement> policyReferences, Map<String,Policy> localPolicies, ExtensibleMetaData extMetaData)
+ private void deployPolicies(List<WSDLExtensibilityElement> policyReferences, PolicyScopeLevel scope, PolicyRegistry localPolicies, ExtensibleMetaData extMetaData)
{
if (policyReferences != null && policyReferences.size() != 0 && extMetaData instanceof ServerEndpointMetaData)
{
DOMPolicyReader reader = (DOMPolicyReader) PolicyFactory.getPolicyReader(PolicyFactory.DOM_POLICY_READER);
for (WSDLExtensibilityElement element : policyReferences)
{
-// boolean local = true;
-// String uri = element.getElement().getAttribute("URI");
-// //TODO!!!
-// //process uri
-// if (local)
-// {
-// Policy policy = localPolicies.get(uri.substring(1)); //get rid of '#'
-// //clone the policy before asking for deployment
- deployPolicy((Policy) reader.readPolicyReference(element.getElement()).normalize(),extMetaData);
-// }
-// else
-// {
-// //TODO!!! get the policy definition, create the policy and deploy it
-// }
+ PolicyReference policyRef = reader.readPolicyReference(element.getElement());
+ Policy normPolicy;
+ try
+ {
+ normPolicy = (Policy)policyRef.normalize(localPolicies);
+ }
+ catch (RuntimeException e)
+ {
+ //TODO!!! not a local policy: get the policy definition and create the policy
+ normPolicy = null;
+ }
+ deployPolicy(normPolicy, scope, extMetaData);
}
}
}
- private void deployPolicy(Policy policy, ExtensibleMetaData extMetaData)
+ private void deployPolicy(Policy policy, PolicyScopeLevel scope, ExtensibleMetaData extMetaData)
{
PolicyMetaExtension ext = new PolicyMetaExtension(Constants.URI_WS_POLICY);
try
{
Policy deployedPolicy = PolicyDeployer.getInstance().deployServerside(policy, extMetaData);
ext.setPolicy(deployedPolicy);
+ ext.setScope(scope);
extMetaData.addExtension(ext);
}
catch (UnsupportedPolicy e)
17 years, 8 months
JBossWS SVN: r2956 - in branches/JBWS-856/jbossws-core/src/java/org/jboss/ws: extensions/policy/deployer/util and 2 other directories.
by jbossws-commits@lists.jboss.org
Author: maeste
Date: 2007-05-03 18:43:23 -0400 (Thu, 03 May 2007)
New Revision: 2956
Added:
branches/JBWS-856/jbossws-core/src/java/org/jboss/ws/extensions/policy/deployer/util/
branches/JBWS-856/jbossws-core/src/java/org/jboss/ws/extensions/policy/deployer/util/PrimitiveAssertionWriter.java
Modified:
branches/JBWS-856/jbossws-core/src/java/org/jboss/ws/extensions/policy/deployer/AssertionDeployer.java
branches/JBWS-856/jbossws-core/src/java/org/jboss/ws/extensions/policy/deployer/PolicyDeployer.java
branches/JBWS-856/jbossws-core/src/java/org/jboss/ws/extensions/policy/deployer/WSSecurityAssertionDeployer.java
branches/JBWS-856/jbossws-core/src/java/org/jboss/ws/extensions/policy/metadata/PolicyMetaExtension.java
branches/JBWS-856/jbossws-core/src/java/org/jboss/ws/metadata/builder/MetaDataBuilder.java
Log:
Use of apche policy lib to represent policy in Unified metadata
Modified: branches/JBWS-856/jbossws-core/src/java/org/jboss/ws/extensions/policy/deployer/AssertionDeployer.java
===================================================================
--- branches/JBWS-856/jbossws-core/src/java/org/jboss/ws/extensions/policy/deployer/AssertionDeployer.java 2007-05-03 19:18:24 UTC (rev 2955)
+++ branches/JBWS-856/jbossws-core/src/java/org/jboss/ws/extensions/policy/deployer/AssertionDeployer.java 2007-05-03 22:43:23 UTC (rev 2956)
@@ -1,10 +1,10 @@
package org.jboss.ws.extensions.policy.deployer;
-import org.jboss.ws.extensions.policy.PolicyAssertion;
+import org.apache.ws.policy.PrimitiveAssertion;
import org.jboss.ws.extensions.policy.deployer.exceptions.UnsupportedAssertion;
import org.jboss.ws.metadata.umdm.ExtensibleMetaData;
public interface AssertionDeployer
{
- public void deploy(PolicyAssertion assertion, ExtensibleMetaData extMetaData) throws UnsupportedAssertion;
+ public void deploy(PrimitiveAssertion assertion, ExtensibleMetaData extMetaData) throws UnsupportedAssertion;
}
Modified: branches/JBWS-856/jbossws-core/src/java/org/jboss/ws/extensions/policy/deployer/PolicyDeployer.java
===================================================================
--- branches/JBWS-856/jbossws-core/src/java/org/jboss/ws/extensions/policy/deployer/PolicyDeployer.java 2007-05-03 19:18:24 UTC (rev 2955)
+++ branches/JBWS-856/jbossws-core/src/java/org/jboss/ws/extensions/policy/deployer/PolicyDeployer.java 2007-05-03 22:43:23 UTC (rev 2956)
@@ -22,12 +22,14 @@
package org.jboss.ws.extensions.policy.deployer;
import java.util.HashMap;
+import java.util.List;
import java.util.Map;
-import org.jboss.ws.extensions.policy.Policy;
-import org.jboss.ws.extensions.policy.PolicyAlternative;
-import org.jboss.ws.extensions.policy.PolicyAssertion;
-import org.jboss.ws.extensions.policy.PolicyFactory;
+import org.apache.ws.policy.AndCompositeAssertion;
+import org.apache.ws.policy.Assertion;
+import org.apache.ws.policy.Policy;
+import org.apache.ws.policy.PrimitiveAssertion;
+import org.apache.ws.policy.XorCompositeAssertion;
import org.jboss.ws.extensions.policy.deployer.exceptions.UnsupportedAlternative;
import org.jboss.ws.extensions.policy.deployer.exceptions.UnsupportedAssertion;
import org.jboss.ws.extensions.policy.deployer.exceptions.UnsupportedPolicy;
@@ -74,14 +76,17 @@
public Policy deployServerside(Policy policy, ExtensibleMetaData extMetaData) throws UnsupportedPolicy
{
- Policy returnedPolicy = PolicyFactory.newInstance().createPolicy(policy.toElement());
- returnedPolicy.clearPolicyAlternatives();
- for (PolicyAlternative alternative : policy.getPolicyAlternatives())
+ Policy returnedPolicy = (Policy) policy.normalize();
+ ((XorCompositeAssertion) returnedPolicy.getTerms().get(0)).getTerms().clear();
+ Policy originalPolicy = (Policy) policy.normalize();
+// in normal form we have just one wsp:ExactlyOne elemnet containg unbounded wsp:All (alternative)
+ XorCompositeAssertion exactlyOne = (XorCompositeAssertion) originalPolicy.getTerms().get(0);
+ for (AndCompositeAssertion alternative: (List<AndCompositeAssertion>) exactlyOne.getTerms() )
{
try
{
deployAlternativeServerSide(alternative,extMetaData);
- returnedPolicy.addPolicyAlternative(alternative);
+ ((XorCompositeAssertion) returnedPolicy.getTerms().get(0)).addTerm(alternative);
}
catch (UnsupportedAlternative e)
{
@@ -89,7 +94,7 @@
}
}
- if (returnedPolicy.getPolicyAlternatives().size() == 0)
+ if (((XorCompositeAssertion) returnedPolicy.getTerms().get(0)).getTerms().size() == 0)
{
throw new UnsupportedPolicy();
}
@@ -101,25 +106,43 @@
}
- private void deployAlternativeServerSide(PolicyAlternative alternative, ExtensibleMetaData extMetaData) throws UnsupportedAlternative
+ private void deployAlternativeServerSide(AndCompositeAssertion alternative, ExtensibleMetaData extMetaData) throws UnsupportedAlternative
{
- for (PolicyAssertion assertion : alternative.getPolicyAssertions())
+ for (Assertion assertion : (List<Assertion>) alternative.getTerms())
{
+
try
{
- deployAssertionServerSide(assertion,extMetaData);
+ if (assertion instanceof PrimitiveAssertion)
+ {
+ deployAssertionServerSide((PrimitiveAssertion) assertion,extMetaData);
+ }
+ else if (assertion instanceof Policy) //inner policy to be verified
+ {
+ deployServerside((Policy) assertion, extMetaData);
+ }
+ else
+ {
+ throw new UnsupportedAlternative();
+ }
+
}
catch (UnsupportedAssertion e)
{
//If there is al least one unsupported assertion the alternative isn't supported
throw new UnsupportedAlternative();
}
+ catch (UnsupportedPolicy ep)
+ {
+ //If there is al least one unsupported assertion the alternative isn't supported
+ throw new UnsupportedAlternative();
+ }
}
}
- private void deployAssertionServerSide(PolicyAssertion assertion, ExtensibleMetaData extMetaData) throws UnsupportedAssertion
+ private void deployAssertionServerSide(PrimitiveAssertion assertion, ExtensibleMetaData extMetaData) throws UnsupportedAssertion
{
- AssertionDeployer deployer = getDomainDeployerInstance(assertion.getNameSpace());
+ AssertionDeployer deployer = getDomainDeployerInstance(assertion.getName().getNamespaceURI());
deployer.deploy(assertion,extMetaData);
}
Modified: branches/JBWS-856/jbossws-core/src/java/org/jboss/ws/extensions/policy/deployer/WSSecurityAssertionDeployer.java
===================================================================
--- branches/JBWS-856/jbossws-core/src/java/org/jboss/ws/extensions/policy/deployer/WSSecurityAssertionDeployer.java 2007-05-03 19:18:24 UTC (rev 2955)
+++ branches/JBWS-856/jbossws-core/src/java/org/jboss/ws/extensions/policy/deployer/WSSecurityAssertionDeployer.java 2007-05-03 22:43:23 UTC (rev 2956)
@@ -1,7 +1,14 @@
package org.jboss.ws.extensions.policy.deployer;
+import java.io.StringWriter;
+
+import javax.xml.stream.XMLOutputFactory;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.apache.ws.policy.PrimitiveAssertion;
import org.jboss.ws.extensions.policy.PolicyAssertion;
import org.jboss.ws.extensions.policy.deployer.exceptions.UnsupportedAssertion;
+import org.jboss.ws.extensions.policy.deployer.util.PrimitiveAssertionWriter;
import org.jboss.ws.metadata.umdm.EndpointMetaData;
import org.jboss.ws.metadata.umdm.ExtensibleMetaData;
import org.jboss.ws.metadata.wsse.WSSecurityConfigFactory;
@@ -12,8 +19,9 @@
public class WSSecurityAssertionDeployer implements AssertionDeployer
{
- public void deploy(PolicyAssertion assertion, ExtensibleMetaData extMetaData) throws UnsupportedAssertion
+ public void deploy(PrimitiveAssertion assertion, ExtensibleMetaData extMetaData) throws UnsupportedAssertion
{
+ StringWriter writer = new StringWriter();
if (extMetaData instanceof EndpointMetaData)
{
EndpointMetaData ep = (EndpointMetaData) extMetaData;
@@ -21,15 +29,18 @@
WSSecurityConfiguration securityConfiguration;
try
{
+ //GET XML of security assertion
+ PrimitiveAssertionWriter.newInstance().writePrimitiveAssertion(assertion, writer);
+
//Set security configuration
- securityConfiguration = WSSecurityOMFactory.newInstance().parse(assertion.toXMLString(true));
+ securityConfiguration = WSSecurityOMFactory.newInstance().parse(writer.toString());
WSSecurityConfigFactory.newInstance().initKeystorePath(ep.getRootFile(), securityConfiguration);
ep.getServiceMetaData().setSecurityConfiguration(securityConfiguration);
//set up handler chain as defined in standard file
ep.setConfigName("Standard WSSecurity Endpoint");
ep.initEndpointConfig();
}
- catch (JBossXBException e)
+ catch (Exception e)
{
throw new UnsupportedAssertion();
}
Added: branches/JBWS-856/jbossws-core/src/java/org/jboss/ws/extensions/policy/deployer/util/PrimitiveAssertionWriter.java
===================================================================
--- branches/JBWS-856/jbossws-core/src/java/org/jboss/ws/extensions/policy/deployer/util/PrimitiveAssertionWriter.java (rev 0)
+++ branches/JBWS-856/jbossws-core/src/java/org/jboss/ws/extensions/policy/deployer/util/PrimitiveAssertionWriter.java 2007-05-03 22:43:23 UTC (rev 2956)
@@ -0,0 +1,88 @@
+
+package org.jboss.ws.extensions.policy.deployer.util;
+
+import java.io.StringWriter;
+import java.util.Hashtable;
+import java.util.Iterator;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLOutputFactory;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.apache.ws.policy.PrimitiveAssertion;
+
+
+public class PrimitiveAssertionWriter {
+
+ private int num = 1;
+
+ PrimitiveAssertionWriter() {
+ }
+
+ public static PrimitiveAssertionWriter newInstance()
+ {
+ return new PrimitiveAssertionWriter();
+ }
+
+ public void writePrimitiveAssertion(PrimitiveAssertion assertion,
+ StringWriter stringWriter) throws XMLStreamException {
+
+ XMLStreamWriter writer = XMLOutputFactory.newInstance().createXMLStreamWriter(stringWriter);
+
+ QName qname = assertion.getName();
+
+ String writerPrefix = writer.getPrefix(qname.getNamespaceURI());
+ if (writerPrefix != null) {
+ writer.writeStartElement(qname.getNamespaceURI(), qname
+ .getLocalPart());
+ } else {
+ String prefix = (qname.getPrefix() != null) ? qname.getPrefix()
+ : generateNamespace();
+ writer.writeStartElement(prefix, qname.getLocalPart(), qname
+ .getNamespaceURI());
+ writer.writeNamespace(prefix, qname.getNamespaceURI());
+ writer.setPrefix(prefix, qname.getNamespaceURI());
+
+ }
+
+ Hashtable attributes = assertion.getAttributes();
+ writeAttributes(attributes, writer);
+
+ String text = (String) assertion.getStrValue();
+ if (text != null) {
+ writer.writeCharacters(text);
+ }
+
+ //A Primitive assertion can't have terms----to be verified
+// List terms = assertion.getTerms();
+// writeTerms(terms, writer);
+
+ writer.writeEndElement();
+ }
+
+
+
+ private void writeAttributes(Hashtable attributes, XMLStreamWriter writer)
+ throws XMLStreamException {
+
+ Iterator iterator = attributes.keySet().iterator();
+ while (iterator.hasNext()) {
+ QName qname = (QName) iterator.next();
+ String value = (String) attributes.get(qname);
+
+ String prefix = qname.getPrefix();
+ if (prefix != null) {
+ writer.writeAttribute(prefix, qname.getNamespaceURI(), qname
+ .getLocalPart(), value);
+ } else {
+ writer.writeAttribute(qname.getNamespaceURI(), qname
+ .getLocalPart(), value);
+ }
+ }
+ }
+
+ private String generateNamespace() {
+ return "ns" + num++;
+ }
+}
\ No newline at end of file
Modified: branches/JBWS-856/jbossws-core/src/java/org/jboss/ws/extensions/policy/metadata/PolicyMetaExtension.java
===================================================================
--- branches/JBWS-856/jbossws-core/src/java/org/jboss/ws/extensions/policy/metadata/PolicyMetaExtension.java 2007-05-03 19:18:24 UTC (rev 2955)
+++ branches/JBWS-856/jbossws-core/src/java/org/jboss/ws/extensions/policy/metadata/PolicyMetaExtension.java 2007-05-03 22:43:23 UTC (rev 2956)
@@ -1,7 +1,7 @@
package org.jboss.ws.extensions.policy.metadata;
-import org.jboss.ws.extensions.policy.Policy;
+import org.apache.ws.policy.Policy;
import org.jboss.ws.metadata.umdm.MetaDataExtension;
public class PolicyMetaExtension extends MetaDataExtension
Modified: branches/JBWS-856/jbossws-core/src/java/org/jboss/ws/metadata/builder/MetaDataBuilder.java
===================================================================
--- branches/JBWS-856/jbossws-core/src/java/org/jboss/ws/metadata/builder/MetaDataBuilder.java 2007-05-03 19:18:24 UTC (rev 2955)
+++ branches/JBWS-856/jbossws-core/src/java/org/jboss/ws/metadata/builder/MetaDataBuilder.java 2007-05-03 22:43:23 UTC (rev 2956)
@@ -44,6 +44,9 @@
import javax.xml.namespace.QName;
import javax.xml.ws.addressing.AddressingProperties;
+import org.apache.ws.policy.Policy;
+import org.apache.ws.policy.util.DOMPolicyReader;
+import org.apache.ws.policy.util.PolicyFactory;
import org.jboss.logging.Logger;
import org.jboss.ws.Constants;
import org.jboss.ws.WSException;
@@ -58,8 +61,6 @@
import org.jboss.ws.extensions.eventing.EventingUtils;
import org.jboss.ws.extensions.eventing.deployment.EventingEndpoint;
import org.jboss.ws.extensions.eventing.metadata.EventingEpMetaExt;
-import org.jboss.ws.extensions.policy.Policy;
-import org.jboss.ws.extensions.policy.PolicyFactory;
import org.jboss.ws.extensions.policy.deployer.PolicyDeployer;
import org.jboss.ws.extensions.policy.deployer.exceptions.UnsupportedPolicy;
import org.jboss.ws.extensions.policy.metadata.PolicyMetaExtension;
@@ -469,12 +470,12 @@
protected void processPolicyMetaDataExtension(EndpointMetaData epMetaData, WSDLDefinitions wsdlDefinitions)
{
//Collect all policies defined in our wsdl definitions
- PolicyFactory factory = PolicyFactory.newInstance();
+ DOMPolicyReader reader = (DOMPolicyReader) PolicyFactory.getPolicyReader(PolicyFactory.DOM_POLICY_READER);
Map<String,Policy> localPolicyElementsMap = new HashMap<String,Policy>();
for (WSDLExtensibilityElement policyElement : wsdlDefinitions.getExtensibilityElements(Constants.WSDL_ELEMENT_POLICY))
{
- Policy policy = factory.createPolicy(policyElement.getElement());
- localPolicyElementsMap.put(policy.getID(), policy);
+ Policy policy = reader.readPolicy(policyElement.getElement());
+ localPolicyElementsMap.put(policy.getId(), policy);
}
WSDLService wsdlService = wsdlDefinitions.getService(epMetaData.getServiceMetaData().getServiceName().getLocalPart());
@@ -501,23 +502,23 @@
{
if (policyReferences != null && policyReferences.size() != 0 && extMetaData instanceof ServerEndpointMetaData)
{
- PolicyFactory factory = PolicyFactory.newInstance();
+ DOMPolicyReader reader = (DOMPolicyReader) PolicyFactory.getPolicyReader(PolicyFactory.DOM_POLICY_READER);
for (WSDLExtensibilityElement element : policyReferences)
{
- boolean local = true;
- String uri = element.getElement().getAttribute("URI");
- //TODO!!!
- //process uri
- if (local)
- {
- Policy policy = localPolicies.get(uri.substring(1)); //get rid of '#'
- //clone the policy before asking for deployment
- deployPolicy(factory.createPolicy(policy.toElement()),extMetaData);
- }
- else
- {
- //TODO!!! get the policy definition, create the policy and deploy it
- }
+// boolean local = true;
+// String uri = element.getElement().getAttribute("URI");
+// //TODO!!!
+// //process uri
+// if (local)
+// {
+// Policy policy = localPolicies.get(uri.substring(1)); //get rid of '#'
+// //clone the policy before asking for deployment
+ deployPolicy((Policy) reader.readPolicyReference(element.getElement()).normalize(),extMetaData);
+// }
+// else
+// {
+// //TODO!!! get the policy definition, create the policy and deploy it
+// }
}
}
}
@@ -535,7 +536,7 @@
{
if (log.isDebugEnabled())
{
- log.debug("Policy Not supported:" + policy.toXMLString(true));
+ log.debug("Policy Not supported:" + policy.getPolicyURI());
}
}
}
17 years, 8 months
JBossWS SVN: r2955 - in trunk: integration-jboss42/src/java/org/jboss/ws/integration/jboss42 and 9 other directories.
by jbossws-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2007-05-03 15:18:24 -0400 (Thu, 03 May 2007)
New Revision: 2955
Added:
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/DeployerHook.java
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/DeployerInterceptorMBean.java
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/AbstractApplicationMetaDataAdapter.java
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/AbstractDeployerHook.java
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/AbstractDeployerHookEJB.java
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/AbstractDeployerHookJSE.java
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/AbstractInvocationHandler.java
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/AbstractServiceEndpointServlet.java
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/ApplicationMetaDataAdapter.java
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/ArchiveDeployerHook.java
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/ClassLoaderInjectionDeployer.java
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/DeploymentInfoAdapter.java
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/DeploymentInfoAdapterFactory.java
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/EagerInitializeDeployer.java
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/EndpointHandlerDeployer.java
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/EndpointLifecycleDeployer.java
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/EndpointNameDeployer.java
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/InvocationHandlerEJB21.java
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/InvocationHandlerEJB3.java
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/InvocationHandlerJSE.java
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/JAXRPCDeployerHookEJB21.java
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/JAXRPCDeployerHookJSE.java
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/JAXWSDeployerHookEJB3.java
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/JAXWSDeployerHookJSE.java
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/LifecycleHandlerImpl.java
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/MainDeployerHook.java
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/ModifyWebMetaDataDeployer.java
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/PortComponentLinkServlet.java
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/PublishContractDeployer.java
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/RequestHandlerImpl.java
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/SecurityAssociationAdaptorFactoryImpl.java
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/ServiceEndpointGeneratorEJB21.java
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/ServiceEndpointGeneratorEJB3.java
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/ServiceEndpointInterceptor.java
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/ServiceEndpointServlet.java
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/UnifiedDeploymentInfoDeployer.java
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/UnifiedMetaDataAssociationDeployer.java
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/UnifiedMetaDataDeployer.java
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/WebAppDeployerDeployer.java
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/WebAppGeneratorDeployer.java
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/WebMetaDataAdapter.java
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jms/ServiceEndpointInvokerMDB.java
trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/DeploymentInfoAdapter.java
trunk/jbossws-core/src/java/org/jboss/ws/core/server/ServiceEndpointPublisher.java
Removed:
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/AbstractApplicationMetaDataAdapter.java
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/ApplicationMetaDataAdapter.java
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/DeployerInterceptorEJB.java
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/DeployerInterceptorNestedJSE.java
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/DeployerInterceptorNestedJSEMBean.java
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/DeploymentInfoAdapter.java
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/DeploymentInfoAdapterFactory.java
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/JBossContextServlet.java
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/JBossHttpServer.java
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/JBossServiceEndpointServlet.java
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/PortComponentLinkServlet.java
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/SecurityAssociationAdaptorFactoryImpl.java
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/ServiceEndpointGeneratorEJB21.java
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/ServiceEndpointGeneratorEJB3.java
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/ServiceEndpointInterceptor.java
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/ServiceEndpointInvokerEJB21.java
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/ServiceEndpointInvokerEJB3.java
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/ServiceEndpointInvokerMDB.java
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/ServiceEndpointPublisher.java
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/WebMetaDataAdapter.java
trunk/integration-jboss42/src/resources/jbossws.sar/META-INF/jboss-service-no-ejb3.xml
trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/DeploymentInfoAdaptor.java
trunk/jbossws-core/src/java/org/jboss/ws/core/server/AbstractServiceEndpointPublisher.java
Modified:
trunk/integration-jboss40/src/java/org/jboss/ws/integration/jboss40/ApplicationMetaDataAdapter.java
trunk/integration-jboss40/src/java/org/jboss/ws/integration/jboss40/WebServiceClientDeployer.java
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/DeployerInterceptor.java
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/DeployerInterceptorEJB21.java
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/DeployerInterceptorEJB21MBean.java
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/DeployerInterceptorEJB3.java
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/DeployerInterceptorEJB3MBean.java
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/DeployerInterceptorJSE.java
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/DeployerInterceptorJSEMBean.java
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jms/JMSMessageDispatcher.java
trunk/integration-jboss42/src/resources/jbossws.beans/META-INF/jboss-beans.xml
trunk/integration-jboss42/src/resources/jbossws.sar/META-INF/jboss-service.xml
trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/DeployerHook.java
trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/ArchiveDeployerHook.java
trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/EndpointLifecycleDeployer.java
trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/JAXRPCDeployerHookEJB21.java
trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/JAXRPCDeployerHookJSE.java
trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/JAXWSDeployerHookEJB3.java
trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/JAXWSDeployerHookJSE.java
trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/ModifyWebMetaDataDeployer.java
trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/UnifiedDeploymentInfoDeployer.java
trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/WebAppDeployerDeployer.java
trunk/integration-jboss50/src/resources/jbossws.sar/META-INF/jbossws-beans.xml
trunk/integration-tomcat/src/java/org/jboss/ws/integration/tomcat/DeploymentInfoAdaptor.java
trunk/integration-tomcat/src/java/org/jboss/ws/integration/tomcat/TomcatServiceEndpointPublisher.java
trunk/integration-tomcat/src/java/org/jboss/ws/integration/tomcat/wspublish.java
Log:
Use new deployer architectur with AS42
Modified: trunk/integration-jboss40/src/java/org/jboss/ws/integration/jboss40/ApplicationMetaDataAdapter.java
===================================================================
--- trunk/integration-jboss40/src/java/org/jboss/ws/integration/jboss40/ApplicationMetaDataAdapter.java 2007-05-03 15:43:45 UTC (rev 2954)
+++ trunk/integration-jboss40/src/java/org/jboss/ws/integration/jboss40/ApplicationMetaDataAdapter.java 2007-05-03 19:18:24 UTC (rev 2955)
@@ -27,7 +27,7 @@
import org.jboss.metadata.EjbPortComponentMetaData;
import org.jboss.metadata.MessageDrivenMetaData;
import org.jboss.metadata.SessionMetaData;
-import org.jboss.ws.integration.jboss42.AbstractApplicationMetaDataAdapter;
+import org.jboss.ws.integration.jboss42.jbossws.AbstractApplicationMetaDataAdapter;
import org.jboss.ws.metadata.j2ee.UnifiedBeanMetaData;
import org.jboss.ws.metadata.j2ee.UnifiedEjbPortComponentMetaData;
import org.jboss.ws.metadata.j2ee.UnifiedMessageDrivenMetaData;
Modified: trunk/integration-jboss40/src/java/org/jboss/ws/integration/jboss40/WebServiceClientDeployer.java
===================================================================
--- trunk/integration-jboss40/src/java/org/jboss/ws/integration/jboss40/WebServiceClientDeployer.java 2007-05-03 15:43:45 UTC (rev 2954)
+++ trunk/integration-jboss40/src/java/org/jboss/ws/integration/jboss40/WebServiceClientDeployer.java 2007-05-03 19:18:24 UTC (rev 2955)
@@ -36,7 +36,7 @@
import org.jboss.ws.core.server.UnifiedDeploymentInfo;
import org.jboss.ws.integration.URLLoaderAdapter;
import org.jboss.ws.integration.deployment.Deployment.DeploymentType;
-import org.jboss.ws.integration.jboss42.DeploymentInfoAdapterFactory;
+import org.jboss.ws.integration.jboss42.jbossws.DeploymentInfoAdapterFactory;
import org.jboss.ws.metadata.builder.jaxrpc.JAXRPCClientDeployment;
import org.jboss.ws.metadata.j2ee.serviceref.UnifiedServiceRefMetaData;
Deleted: trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/AbstractApplicationMetaDataAdapter.java
===================================================================
--- trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/AbstractApplicationMetaDataAdapter.java 2007-05-03 15:43:45 UTC (rev 2954)
+++ trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/AbstractApplicationMetaDataAdapter.java 2007-05-03 19:18:24 UTC (rev 2955)
@@ -1,84 +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;
-
-// $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.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(ApplicationMetaData 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: trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/ApplicationMetaDataAdapter.java
===================================================================
--- trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/ApplicationMetaDataAdapter.java 2007-05-03 15:43:45 UTC (rev 2954)
+++ trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/ApplicationMetaDataAdapter.java 2007-05-03 19:18:24 UTC (rev 2955)
@@ -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;
-
-// $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;
- }
-}
Added: trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/DeployerHook.java
===================================================================
--- trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/DeployerHook.java (rev 0)
+++ trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/DeployerHook.java 2007-05-03 19:18:24 UTC (rev 2955)
@@ -0,0 +1,41 @@
+/*
+ * 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.DeploymentException;
+import org.jboss.deployment.DeploymentInfo;
+
+//$Id$
+
+
+/**
+ * An interface for all web service deployer hooks
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 24-Apr-2007
+ */
+public interface DeployerHook
+{
+ void deploy(DeploymentInfo unit) throws DeploymentException;
+
+ void undeploy(DeploymentInfo unit);
+}
Property changes on: trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/DeployerHook.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/DeployerInterceptor.java
===================================================================
--- trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/DeployerInterceptor.java 2007-05-03 15:43:45 UTC (rev 2954)
+++ trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/DeployerInterceptor.java 2007-05-03 19:18:24 UTC (rev 2955)
@@ -23,176 +23,115 @@
//$Id$
-import org.jboss.deployment.DeploymentException;
+import java.util.LinkedList;
+import java.util.List;
+
import org.jboss.deployment.DeploymentInfo;
import org.jboss.deployment.MainDeployerMBean;
import org.jboss.deployment.SubDeployerInterceptorSupport;
-import org.jboss.kernel.spi.registry.KernelRegistry;
-import org.jboss.kernel.spi.registry.KernelRegistryEntry;
-import org.jboss.metadata.WebMetaData;
import org.jboss.mx.server.Invocation;
import org.jboss.mx.util.MBeanProxy;
-import org.jboss.ws.core.server.AbstractServiceEndpointPublisher;
-import org.jboss.ws.core.server.UnifiedDeploymentInfo;
-import org.jboss.ws.core.server.legacy.ServiceEndpointDeployer;
-import org.jboss.ws.integration.KernelLocator;
-import org.jboss.ws.integration.deployment.WSDeploymentException;
/**
* A deployer service that manages WS4EE compliant Web Services
*
- * This service is called from the {@see org.jboss.ws.metadata.WebServiceInterceptor}
- *
* @author Thomas.Diesler(a)jboss.org
- * @author Dimitris.Andreadis(a)jboss.org
- * @since 15-Jan-2005
+ * @since 03-May-2007
*/
-public abstract class DeployerInterceptor extends SubDeployerInterceptorSupport
+public abstract class DeployerInterceptor extends SubDeployerInterceptorSupport implements DeployerInterceptorMBean
{
// The main deployer
private MainDeployerMBean mainDeployer;
- /** Create the deployer service
- */
- protected void createService() throws Exception
- {
- mainDeployer = (MainDeployerMBean)MBeanProxy.get(MainDeployerMBean.class, MainDeployerMBean.OBJECT_NAME, server);
- super.attach();
- }
+ private List<DeployerHook> phaseOneHooks = new LinkedList<DeployerHook>();
+ private List<DeployerHook> phaseTwoHooks = new LinkedList<DeployerHook>();
- /** Destroy the deployer service
- */
- protected void destroyService()
+ public void addPhaseOneHook(DeployerHook hook)
{
- super.detach();
+ log.debug("Add phase-one deployer hook: " + hook);
+ phaseOneHooks.add(hook);
}
- /** Overwrite to create the webservice
- */
- protected final Object create(Invocation invocation, DeploymentInfo di) throws Throwable
+ public void removePhaseOneHook(DeployerHook hook)
{
- Object retn = invokeNext(invocation);
- if (isWebserviceDeployment(di))
- {
- try
- {
- createServiceEndpoint(di);
- }
- catch (Exception ex)
- {
- destroyServiceEndpoint(di);
- DeploymentException.rethrowAsDeploymentException("Cannot create service endpoint", ex);
- }
- }
- return retn;
+ log.debug("Remove phase-one deployer hook: " + hook);
+ phaseOneHooks.remove(hook);
}
- /** Overwrite to start the webservice
- */
- protected final Object start(Invocation invocation, DeploymentInfo di) throws Throwable
+ public void addPhaseTwoHook(DeployerHook hook)
{
- Object retn = invokeNext(invocation);
- try
- {
- startServiceEndpoint(di);
- }
- catch (Exception ex)
- {
- destroyServiceEndpoint(di);
- DeploymentException.rethrowAsDeploymentException("Cannot start service endpoint", ex);
- }
- return retn;
+ log.debug("Add phase-two deployer hook: " + hook);
+ phaseTwoHooks.add(hook);
}
- /** Overwrite to stop the webservice
- */
- protected final Object stop(Invocation invocation, DeploymentInfo di) throws Throwable
+ public void removePhaseTwoHook(DeployerHook hook)
{
- stopServiceEndpoint(di);
- return invokeNext(invocation);
+ log.debug("Remove phase-two deployer hook: " + hook);
+ phaseTwoHooks.remove(hook);
}
- /** Overwrite to destroy the webservice
- */
- protected final Object destroy(Invocation invocation, DeploymentInfo di) throws Throwable
+ @Override
+ protected final Object create(Invocation invocation, DeploymentInfo unit) throws Throwable
{
- destroyServiceEndpoint(di);
- return invokeNext(invocation);
- }
+ Object retn = invokeNext(invocation);
- protected void createServiceEndpoint(DeploymentInfo di) throws Exception
- {
- log.debug("create: " + di.url);
- UnifiedDeploymentInfo udi = createUnifiedDeploymentInfo(di);
- di.context.put(UnifiedDeploymentInfo.class.getName(), udi);
- getServiceEndpointDeployer().create(udi);
+ for (DeployerHook deployer : phaseOneHooks)
+ deployer.deploy(unit);
+
+ return retn;
}
- protected void startServiceEndpoint(DeploymentInfo di) throws Exception
+ @Override
+ protected final Object start(Invocation invocation, DeploymentInfo unit) throws Throwable
{
- UnifiedDeploymentInfo udi = getUnifiedDeploymentInfo(di);
- if (udi != null)
- {
- log.debug("start: " + di.url);
-
- // late initialization of the web context loader
- if (di.metaData instanceof WebMetaData)
- {
- ClassLoader classLoader = ((WebMetaData)di.metaData).getContextLoader();
- udi.classLoader = classLoader;
- }
+ Object retn = invokeNext(invocation);
- getServiceEndpointDeployer().start(udi);
- }
- }
+ for (DeployerHook deployer : phaseTwoHooks)
+ deployer.deploy(unit);
- protected void stopServiceEndpoint(DeploymentInfo di) throws Exception
- {
- UnifiedDeploymentInfo udi = getUnifiedDeploymentInfo(di);
- if (udi != null)
- {
- log.debug("stop: " + di.url);
- getServiceEndpointDeployer().stop(udi);
- }
+ return retn;
}
- protected void destroyServiceEndpoint(DeploymentInfo di) throws Exception
+ @Override
+ protected final Object stop(Invocation invocation, DeploymentInfo unit) throws Throwable
{
- UnifiedDeploymentInfo udi = getUnifiedDeploymentInfo(di);
- if (udi != null)
- {
- log.debug("destroy: " + di.url);
- getServiceEndpointDeployer().destroy(udi);
- }
+ Object retn = invokeNext(invocation);
+
+ for (DeployerHook deployer : phaseTwoHooks)
+ deployer.undeploy(unit);
+
+ return retn;
}
- protected ServiceEndpointDeployer getServiceEndpointDeployer()
+ @Override
+ protected final Object destroy(Invocation invocation, DeploymentInfo unit) throws Throwable
{
- KernelRegistry registry = KernelLocator.getKernel().getRegistry();
- KernelRegistryEntry entry = registry.getEntry(ServiceEndpointDeployer.BEAN_NAME);
- return (ServiceEndpointDeployer)entry.getTarget();
+ Object retn = invokeNext(invocation);
+
+ for (DeployerHook deployer : phaseOneHooks)
+ deployer.undeploy(unit);
+
+ return retn;
}
- protected AbstractServiceEndpointPublisher getServiceEndpointPublisher()
+ /** Create the deployer service
+ */
+ protected void createService() throws Exception
{
- KernelRegistry registry = KernelLocator.getKernel().getRegistry();
- KernelRegistryEntry entry = registry.getEntry(AbstractServiceEndpointPublisher.BEAN_NAME);
- return (AbstractServiceEndpointPublisher)entry.getTarget();
+ mainDeployer = (MainDeployerMBean)MBeanProxy.get(MainDeployerMBean.class, MainDeployerMBean.OBJECT_NAME, server);
+ super.attach();
}
- /** Return true if the deployment contains a web service endpoint
+ /** Destroy the deployer service
*/
- protected abstract boolean isWebserviceDeployment(DeploymentInfo di);
-
- protected abstract UnifiedDeploymentInfo createUnifiedDeploymentInfo(DeploymentInfo di) throws Exception;
-
- protected UnifiedDeploymentInfo getUnifiedDeploymentInfo(DeploymentInfo di)
+ protected void destroyService()
{
- return (UnifiedDeploymentInfo)di.context.get(UnifiedDeploymentInfo.class.getName());
+ super.detach();
}
- /** Handle all webservice deployment exceptions.
- * You can either simply logs the problem and keep the EJB/WAR module
+ /**
+ * Handle all webservice deployment exceptions.
+ * You can either simply log the problem and keep the EJB/WAR module
* alive or undeploy properly.
*/
protected void handleStartupException(DeploymentInfo di, Throwable th)
@@ -201,7 +140,8 @@
mainDeployer.undeploy(di);
}
- /** Handle all webservice deployment exceptions.
+ /**
+ * Handle all webservice deployment exceptions.
*
* You can either simply logs the problem and keep the EJB/WAR module
* alive or undeploy properly.
Deleted: trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/DeployerInterceptorEJB.java
===================================================================
--- trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/DeployerInterceptorEJB.java 2007-05-03 15:43:45 UTC (rev 2954)
+++ trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/DeployerInterceptorEJB.java 2007-05-03 19:18:24 UTC (rev 2955)
@@ -1,67 +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;
-
-//$Id$
-
-import java.io.IOException;
-import java.net.URL;
-
-import org.jboss.deployment.DeploymentInfo;
-import org.jboss.ws.core.server.UnifiedDeploymentInfo;
-import org.jboss.ws.metadata.umdm.UnifiedMetaData;
-
-/**
- * A deployer service that manages WS4EE compliant Web-Services for EJB Endpoints
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 15-Jan-2005
- */
-public abstract class DeployerInterceptorEJB extends DeployerInterceptor
-{
- protected void createServiceEndpoint(DeploymentInfo di) throws Exception
- {
- super.createServiceEndpoint(di);
-
- UnifiedDeploymentInfo udi = getUnifiedDeploymentInfo(di);
- if (udi != null)
- {
- UnifiedMetaData wsMetaData = getServiceEndpointDeployer().getUnifiedMetaData(udi);
- udi.webappURL = generateWebDeployment(udi, wsMetaData);
- udi.addAttachment(DeploymentInfo.class, di);
- getServiceEndpointPublisher().publishServiceEndpoint(udi);
- }
- }
-
- protected abstract URL generateWebDeployment(UnifiedDeploymentInfo udi, UnifiedMetaData wsMetaData) throws IOException;
-
- protected void destroyServiceEndpoint(DeploymentInfo di) throws Exception
- {
- super.destroyServiceEndpoint(di);
-
- UnifiedDeploymentInfo udi = getUnifiedDeploymentInfo(di);
- if (udi != null)
- {
- getServiceEndpointPublisher().destroyServiceEndpoint(udi);
- }
- }
-}
Modified: trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/DeployerInterceptorEJB21.java
===================================================================
--- trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/DeployerInterceptorEJB21.java 2007-05-03 15:43:45 UTC (rev 2954)
+++ trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/DeployerInterceptorEJB21.java 2007-05-03 19:18:24 UTC (rev 2955)
@@ -23,97 +23,13 @@
//$Id$
-import java.io.IOException;
-import java.net.URL;
-import java.util.Iterator;
-
-import org.jboss.deployment.DeploymentInfo;
-import org.jboss.metadata.ApplicationMetaData;
-import org.jboss.metadata.BeanMetaData;
-import org.jboss.ws.WSException;
-import org.jboss.ws.core.server.UnifiedDeploymentInfo;
-import org.jboss.ws.integration.ResourceLoaderAdapter;
-import org.jboss.ws.integration.UnifiedVirtualFile;
-import org.jboss.ws.integration.deployment.Deployment.DeploymentType;
-import org.jboss.ws.metadata.builder.jaxrpc.JAXRPCDeployment;
-import org.jboss.ws.metadata.umdm.UnifiedMetaData;
-
/**
* A deployer service that manages WS4EE compliant Web-Services for EJB-2.1 Endpoints
*
* @author Thomas.Diesler(a)jboss.org
* @since 15-Jan-2005
*/
-public class DeployerInterceptorEJB21 extends DeployerInterceptorEJB implements DeployerInterceptorEJB21MBean
+public class DeployerInterceptorEJB21 extends DeployerInterceptor implements DeployerInterceptorEJB21MBean
{
- protected UnifiedDeploymentInfo createUnifiedDeploymentInfo(DeploymentInfo di) throws Exception
- {
- UnifiedVirtualFile vfsWebservices = getWebservicesFile(di);
- UnifiedDeploymentInfo udi = new JAXRPCDeployment(DeploymentType.JAXRPC_EJB21, vfsWebservices);
- DeploymentInfoAdapterFactory.newInstance().buildDeploymentInfo(udi, di);
- return udi;
- }
- /** Return true if the deployment is a web service endpoint
- */
- protected boolean isWebserviceDeployment(DeploymentInfo di)
- {
- ApplicationMetaData applMetaData = (ApplicationMetaData)di.metaData;
- boolean isWebserviceDeployment = applMetaData.isWebServiceDeployment();
-
- // Check if we have a webservices.xml descriptor
- if (isWebserviceDeployment == false)
- {
- isWebserviceDeployment = getWebservicesFile(di) != null;
- }
-
- // Check if the ejb-jar contains annotated endpoints
- if (isWebserviceDeployment == false)
- {
- try
- {
- Iterator itBeans = applMetaData.getEnterpriseBeans();
- while (itBeans.hasNext() && isWebserviceDeployment == false)
- {
- BeanMetaData beanMetaData = (BeanMetaData)itBeans.next();
- String ejbClassName = beanMetaData.getEjbClass();
- Class ejbClass = di.annotationsCl.loadClass(ejbClassName);
- if (ejbClass.isAnnotationPresent(javax.jws.WebService.class))
- throw new UnsupportedOperationException("JAXWS not supported on EJB2.1 endpoints");
- }
- }
- catch (RuntimeException e)
- {
- throw e;
- }
- catch (Exception e)
- {
- throw new WSException(e);
- }
- }
-
- applMetaData.setWebServiceDeployment(isWebserviceDeployment);
- return isWebserviceDeployment;
- }
-
- private UnifiedVirtualFile getWebservicesFile(DeploymentInfo di)
- {
- UnifiedVirtualFile vfsRoot = new ResourceLoaderAdapter(di.localCl);
- try
- {
- return vfsRoot.findChild("META-INF/webservices.xml");
- }
- catch (IOException e)
- {
- return null;
- }
- }
-
- @Override
- protected URL generateWebDeployment(UnifiedDeploymentInfo udi, UnifiedMetaData wsMetaData) throws IOException
- {
- ServiceEndpointGeneratorEJB21 generator = new ServiceEndpointGeneratorEJB21();
- return generator.generatWebDeployment(wsMetaData, udi);
- }
-
}
Modified: trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/DeployerInterceptorEJB21MBean.java
===================================================================
--- trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/DeployerInterceptorEJB21MBean.java 2007-05-03 15:43:45 UTC (rev 2954)
+++ trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/DeployerInterceptorEJB21MBean.java 2007-05-03 19:18:24 UTC (rev 2955)
@@ -1,36 +1,35 @@
/*
-* 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.
-*/
+ * 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 javax.management.ObjectName;
-import org.jboss.deployment.SubDeployerInterceptorMBean;
import org.jboss.ws.integration.ObjectNameFactory;
/**
* MBean interface.
* @since 19-Jan-2005
*/
-public interface DeployerInterceptorEJB21MBean extends SubDeployerInterceptorMBean
+public interface DeployerInterceptorEJB21MBean extends DeployerInterceptorMBean
{
//default object name
public static final ObjectName OBJECT_NAME = ObjectNameFactory.create("jboss.ws:service=WebServiceDeployerEJB21");
Modified: trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/DeployerInterceptorEJB3.java
===================================================================
--- trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/DeployerInterceptorEJB3.java 2007-05-03 15:43:45 UTC (rev 2954)
+++ trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/DeployerInterceptorEJB3.java 2007-05-03 19:18:24 UTC (rev 2955)
@@ -23,109 +23,12 @@
// $Id$
-import java.io.IOException;
-import java.net.URL;
-import java.util.ArrayList;
-
-import javax.jws.WebService;
-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.mx.util.MBeanProxy;
-import org.jboss.mx.util.MBeanProxyCreationException;
-import org.jboss.mx.util.MBeanServerLocator;
-import org.jboss.ws.WSException;
-import org.jboss.ws.core.server.JAXWSDeployment;
-import org.jboss.ws.core.server.UnifiedDeploymentInfo;
-import org.jboss.ws.integration.deployment.Deployment.DeploymentType;
-import org.jboss.ws.metadata.j2ee.UnifiedApplicationMetaData;
-import org.jboss.ws.metadata.j2ee.UnifiedBeanMetaData;
-import org.jboss.ws.metadata.umdm.UnifiedMetaData;
-
/**
* A deployer service that manages WS4EE compliant Web-Services for EJB3 Endpoints
*
* @author Thomas.Diesler(a)jboss.org
* @since 10-May-2005
*/
-public class DeployerInterceptorEJB3 extends DeployerInterceptorEJB implements DeployerInterceptorEJB3MBean
+public class DeployerInterceptorEJB3 extends DeployerInterceptor implements DeployerInterceptorEJB3MBean
{
- protected UnifiedDeploymentInfo createUnifiedDeploymentInfo(DeploymentInfo di) throws Exception
- {
- UnifiedDeploymentInfo udi = new JAXWSDeployment(DeploymentType.JAXWS_EJB3);
- DeploymentInfoAdapterFactory.newInstance().buildDeploymentInfo(udi, di);
-
- Ejb3ModuleMBean ejb3Module = getEJB3Module(udi.deployedObject);
-
- // The container objects below provide access to all of the ejb metadata
- 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;
-
- return udi;
- }
-
- /** Return true if the deployment is a web service endpoint
- */
- protected boolean isWebserviceDeployment(DeploymentInfo di)
- {
- boolean isWebserviceDeployment = false;
-
- // Check if the ejb3 contains annotated endpoints
- Ejb3ModuleMBean ejb3Module = getEJB3Module(di.deployedObject);
- for (Object manager : ejb3Module.getContainers().values())
- {
- if (manager instanceof StatelessContainer)
- {
- StatelessContainer container = (StatelessContainer)manager;
- if (container.resolveAnnotation(WebService.class) != null)
- {
- isWebserviceDeployment = true;
- break;
- }
- }
- }
-
- return isWebserviceDeployment;
- }
-
- 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");
- }
- }
-
- @Override
- protected URL generateWebDeployment(UnifiedDeploymentInfo udi, UnifiedMetaData wsMetaData) throws IOException
- {
- return new ServiceEndpointGeneratorEJB3().generatWebDeployment(wsMetaData, udi);
- }
}
Modified: trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/DeployerInterceptorEJB3MBean.java
===================================================================
--- trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/DeployerInterceptorEJB3MBean.java 2007-05-03 15:43:45 UTC (rev 2954)
+++ trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/DeployerInterceptorEJB3MBean.java 2007-05-03 19:18:24 UTC (rev 2955)
@@ -1,36 +1,35 @@
/*
-* 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.
-*/
+ * 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 javax.management.ObjectName;
-import org.jboss.deployment.SubDeployerInterceptorMBean;
import org.jboss.ws.integration.ObjectNameFactory;
/**
* MBean interface.
* @since 19-Jan-2005
*/
-public interface DeployerInterceptorEJB3MBean extends SubDeployerInterceptorMBean
+public interface DeployerInterceptorEJB3MBean extends DeployerInterceptorMBean
{
//default object name
public static final ObjectName OBJECT_NAME = ObjectNameFactory.create("jboss.ws:service=WebServiceDeployerEJB3");
Modified: trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/DeployerInterceptorJSE.java
===================================================================
--- trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/DeployerInterceptorJSE.java 2007-05-03 15:43:45 UTC (rev 2954)
+++ trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/DeployerInterceptorJSE.java 2007-05-03 19:18:24 UTC (rev 2955)
@@ -23,29 +23,6 @@
// $Id$
-import java.io.IOException;
-import java.util.Iterator;
-import java.util.Map;
-
-import javax.jws.WebService;
-import javax.xml.ws.WebServiceProvider;
-
-import org.jboss.deployment.DeploymentInfo;
-import org.jboss.metadata.WebMetaData;
-import org.jboss.ws.WSException;
-import org.jboss.ws.core.server.AbstractServiceEndpointPublisher;
-import org.jboss.ws.core.server.JAXWSDeployment;
-import org.jboss.ws.core.server.UnifiedDeploymentInfo;
-import org.jboss.ws.core.server.AbstractServiceEndpointPublisher.RewriteResults;
-import org.jboss.ws.integration.ResourceLoaderAdapter;
-import org.jboss.ws.integration.UnifiedVirtualFile;
-import org.jboss.ws.integration.deployment.Deployment.DeploymentType;
-import org.jboss.ws.metadata.builder.jaxrpc.JAXRPCDeployment;
-import org.jboss.ws.metadata.umdm.EndpointMetaData;
-import org.jboss.ws.metadata.umdm.ServerEndpointMetaData;
-import org.jboss.ws.metadata.umdm.ServiceMetaData;
-import org.jboss.ws.metadata.umdm.UnifiedMetaData;
-
/**
* A deployer service that manages WS4EE compliant Web Services for WAR
*
@@ -54,117 +31,4 @@
*/
public class DeployerInterceptorJSE extends DeployerInterceptor implements DeployerInterceptorJSEMBean
{
- /** Return true if the deployment is a web service endpoint
- */
- protected boolean isWebserviceDeployment(DeploymentInfo di)
- {
- WebMetaData webMetaData = (WebMetaData)di.metaData;
- boolean isWebserviceDeployment = webMetaData.isWebServiceDeployment();
-
- // Check if we have a webservices.xml descriptor
- if (isWebserviceDeployment == false)
- {
- if (getWebservicesFile(di) != null)
- {
- di.context.put("UnifiedDeploymentInfo.Type", DeploymentType.JAXRPC_JSE);
- isWebserviceDeployment = true;
- }
- }
-
- // Check if the web.xml contains annotated endpoint impl
- if (isWebserviceDeployment == false)
- {
- Map servletClassMap = webMetaData.getServletClassMap();
- Iterator<String> it = servletClassMap.values().iterator();
- while (it.hasNext() && isWebserviceDeployment == false)
- {
- String servletClassName = it.next();
- try
- {
- Class servletClass = di.annotationsCl.loadClass(servletClassName);
- if (servletClass.isAnnotationPresent(WebService.class) || servletClass.isAnnotationPresent(WebServiceProvider.class))
- {
- di.context.put("UnifiedDeploymentInfo.Type", DeploymentType.JAXWS_JSE);
- isWebserviceDeployment = true;
- }
- }
- catch (ClassNotFoundException ex)
- {
- log.warn("Cannot load servlet class: " + servletClassName);
- }
- }
- }
-
- webMetaData.setWebServiceDeployment(isWebserviceDeployment);
- return isWebserviceDeployment;
- }
-
- protected UnifiedDeploymentInfo createUnifiedDeploymentInfo(DeploymentInfo di) throws Exception
- {
- UnifiedDeploymentInfo udi;
-
- DeploymentType type = (DeploymentType)di.context.get("UnifiedDeploymentInfo.Type");
- if (type == DeploymentType.JAXRPC_JSE)
- {
- UnifiedVirtualFile vfsWebservices = getWebservicesFile(di);
- udi = new JAXRPCDeployment(DeploymentType.JAXRPC_JSE, vfsWebservices);
- DeploymentInfoAdapterFactory.newInstance().buildDeploymentInfo(udi, di);
- }
- else if (type == DeploymentType.JAXWS_JSE)
- {
- udi = new JAXWSDeployment(DeploymentType.JAXWS_JSE);
- DeploymentInfoAdapterFactory.newInstance().buildDeploymentInfo(udi, di);
- }
- else
- {
- throw new WSException("Unexpected type: " + type);
- }
-
- return udi;
- }
-
- /** Overwrite to create the webservice
- *
- * This implemantation modifies the servlet entries in web.xml
- */
- protected void createServiceEndpoint(DeploymentInfo di) throws Exception
- {
- super.createServiceEndpoint(di);
- UnifiedDeploymentInfo udi = getUnifiedDeploymentInfo(di);
- if (udi != null)
- {
- AbstractServiceEndpointPublisher endpointPublisher = getServiceEndpointPublisher();
- RewriteResults results = endpointPublisher.rewriteWebXml(udi);
- updateServiceEndpointTargetBeans(udi, results);
- }
- }
-
- private void updateServiceEndpointTargetBeans(UnifiedDeploymentInfo udi, RewriteResults results)
- {
- UnifiedMetaData wsMetaData = getServiceEndpointDeployer().getUnifiedMetaData(udi);
- Map<String, String> sepTargetMap = results.sepTargetMap;
-
- for (ServiceMetaData serviceMetaData : wsMetaData.getServices())
- {
- for (EndpointMetaData epMetaData : serviceMetaData.getEndpoints())
- {
- ServerEndpointMetaData sepMetaData = (ServerEndpointMetaData)epMetaData;
- String targetBean = sepTargetMap.get(sepMetaData.getLinkName());
- sepMetaData.setServiceEndpointImplName(targetBean);
- }
- }
- }
-
- private UnifiedVirtualFile getWebservicesFile(DeploymentInfo di)
- {
- UnifiedVirtualFile vfsRoot = new ResourceLoaderAdapter(di.localCl);
- try
- {
- return vfsRoot.findChild("WEB-INF/webservices.xml");
- }
- catch (IOException e)
- {
- return null;
- }
- }
}
Modified: trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/DeployerInterceptorJSEMBean.java
===================================================================
--- trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/DeployerInterceptorJSEMBean.java 2007-05-03 15:43:45 UTC (rev 2954)
+++ trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/DeployerInterceptorJSEMBean.java 2007-05-03 19:18:24 UTC (rev 2955)
@@ -30,7 +30,7 @@
* MBean interface.
* @since 19-Jan-2005
*/
-public interface DeployerInterceptorJSEMBean extends SubDeployerInterceptorMBean
+public interface DeployerInterceptorJSEMBean extends DeployerInterceptorMBean
{
//default object name
public static final ObjectName OBJECT_NAME = ObjectNameFactory.create("jboss.ws:service=WebServiceDeployerJSE");
Added: trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/DeployerInterceptorMBean.java
===================================================================
--- trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/DeployerInterceptorMBean.java (rev 0)
+++ trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/DeployerInterceptorMBean.java 2007-05-03 19:18:24 UTC (rev 2955)
@@ -0,0 +1,39 @@
+/*
+ * 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.SubDeployerInterceptorMBean;
+
+/**
+ * MBean interface.
+ * @since 19-Jan-2005
+ */
+public interface DeployerInterceptorMBean extends SubDeployerInterceptorMBean
+{
+ void addPhaseOneHook(DeployerHook deployer);
+
+ void removePhaseOneHook(DeployerHook deployer);
+
+ void addPhaseTwoHook(DeployerHook deployer);
+
+ void removePhaseTwoHook(DeployerHook deployer);
+}
Property changes on: trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/DeployerInterceptorMBean.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Deleted: trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/DeployerInterceptorNestedJSE.java
===================================================================
--- trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/DeployerInterceptorNestedJSE.java 2007-05-03 15:43:45 UTC (rev 2954)
+++ trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/DeployerInterceptorNestedJSE.java 2007-05-03 19:18:24 UTC (rev 2955)
@@ -1,133 +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;
-
-// $Id$
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.IOException;
-
-import org.jboss.deployment.DeploymentException;
-import org.jboss.deployment.DeploymentInfo;
-import org.jboss.deployment.MainDeployerMBean;
-import org.jboss.deployment.SubDeployerSupport;
-import org.jboss.system.server.ServerConfig;
-import org.jboss.system.server.ServerConfigLocator;
-import org.jboss.ws.core.utils.IOUtils;
-import org.jboss.ws.integration.deployment.WSDeploymentException;
-
-/**
- * A deployer service that manages WS4EE compliant Web Services for
- * nested POJO endpoints.
- *
- * The WebServiceDeployerJSE attaches itself as an deployment interceptor to
- * the jboss.web:service=WebServer deployer. As a consequence, all *.war deployments
- * that are picked up before the interceptor is installed are not treated as potential
- * web service endpoint deployments.
- *
- * Nested POJO endpoints can be packaged in *.jse deployments that are then picked up by this
- * deployer.
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 03-Mar-2005
- */
-public class DeployerInterceptorNestedJSE extends SubDeployerSupport implements DeployerInterceptorNestedJSEMBean
-{
- private static final String NESTED_JSE_WAR_FILE = "org.jboss.ws.server.nested.jse";
-
- // The MainDeployer
- protected MainDeployerMBean mainDeployer;
-
- public void setMainDeployer(MainDeployerMBean mainDeployer)
- {
- this.mainDeployer = mainDeployer;
- }
-
- public boolean accepts(DeploymentInfo sdi)
- {
- setSuffixes(new String[] { ".jse" });
- return super.accepts(sdi);
- }
-
- /** Copy the *.jse to a *.war and deploy through the main deployer
- */
- public void create(DeploymentInfo di) throws DeploymentException
- {
- log.debug("create: " + di.url);
-
- try
- {
- File jseFile = new File(di.localUrl.getFile());
- if (jseFile.isFile() == false)
- throw new DeploymentException("Expected a file: " + di.localUrl);
-
- ServerConfig config = ServerConfigLocator.locate();
- String warFileName = config.getServerTempDir().getCanonicalPath() + "/deploy/" + di.shortName;
- warFileName = warFileName.substring(0, warFileName.length() - 4) + ".war";
- File warFile = new File(warFileName);
-
- FileOutputStream fos = new FileOutputStream(warFile);
- FileInputStream fis = new FileInputStream(jseFile);
- try
- {
- IOUtils.copyStream(fos, fis);
- }
- finally
- {
- fos.close();
- fis.close();
- }
-
- mainDeployer.deploy(warFile.toURL());
-
- // remember the war url that we deployed
- di.context.put(NESTED_JSE_WAR_FILE, warFile);
-
- super.create(di);
- }
- catch (IOException ex)
- {
- throw new DeploymentException("Failed to create: " + di.url, ex);
- }
- }
-
- /** Undeploy the *.war through the main deployer
- */
- public void destroy(DeploymentInfo di) throws DeploymentException
- {
- log.debug("destroy: " + di.url);
- try
- {
- File warFile = (File)di.context.get(NESTED_JSE_WAR_FILE);
- mainDeployer.undeploy(warFile.toURL());
- warFile.delete();
-
- super.destroy(di);
- }
- catch (IOException ex)
- {
- throw new WSDeploymentException("Failed to destroy: " + di.url, ex);
- }
- }
-}
Deleted: trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/DeployerInterceptorNestedJSEMBean.java
===================================================================
--- trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/DeployerInterceptorNestedJSEMBean.java 2007-05-03 15:43:45 UTC (rev 2954)
+++ trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/DeployerInterceptorNestedJSEMBean.java 2007-05-03 19:18:24 UTC (rev 2955)
@@ -1,42 +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;
-
-// $Id$
-
-import javax.management.ObjectName;
-
-import org.jboss.deployment.MainDeployerMBean;
-import org.jboss.deployment.SubDeployerMBean;
-import org.jboss.ws.integration.ObjectNameFactory;
-
-/**
- * @author Thomas.Diesler(a)jboss.org
- * @since 03-Mar-2005
- */
-public interface DeployerInterceptorNestedJSEMBean extends SubDeployerMBean
-{
- //default object name
- public static final ObjectName OBJECT_NAME = ObjectNameFactory.create("jboss.ws:service=WebServiceDeployerNestedJSE");
-
- void setMainDeployer(MainDeployerMBean mainDeployer);
-}
Deleted: trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/DeploymentInfoAdapter.java
===================================================================
--- trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/DeploymentInfoAdapter.java 2007-05-03 15:43:45 UTC (rev 2954)
+++ trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/DeploymentInfoAdapter.java 2007-05-03 19:18:24 UTC (rev 2955)
@@ -1,103 +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;
-
-// $Id$
-
-import java.io.File;
-import java.net.MalformedURLException;
-import java.net.URL;
-
-import org.jboss.deployment.DeploymentInfo;
-import org.jboss.metadata.ApplicationMetaData;
-import org.jboss.metadata.WebMetaData;
-import org.jboss.ws.core.server.UnifiedDeploymentInfo;
-import org.jboss.ws.integration.ResourceLoaderAdapter;
-
-/**
- * Build container independent deployment info.
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 05-May-2006
- */
-public class DeploymentInfoAdapter
-{
- private WebMetaDataAdapter webMetaDataAdapter;
- private AbstractApplicationMetaDataAdapter applicationMetaDataAdapter;
-
- public void setApplicationMetaDataAdapter(AbstractApplicationMetaDataAdapter applicationMetaDataAdapter)
- {
- this.applicationMetaDataAdapter = applicationMetaDataAdapter;
- }
-
- public void setWebMetaDataAdapter(WebMetaDataAdapter webMetaDataAdapter)
- {
- this.webMetaDataAdapter = webMetaDataAdapter;
- }
-
- public UnifiedDeploymentInfo buildDeploymentInfo(UnifiedDeploymentInfo udi, DeploymentInfo di) throws Exception
- {
- 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);
-
- return udi;
- }
-
- private URL getDeploymentURL(DeploymentInfo di) throws MalformedURLException
- {
- URL deploymentURL = (di.localUrl != null ? di.localUrl : di.url);
- if ("file".equals(deploymentURL.getProtocol()))
- {
- String path = deploymentURL.getPath();
- if (new File(path).isFile())
- {
- deploymentURL = new URL("jar:file:" + path + "!/");
- }
- }
- return deploymentURL;
- }
-
- private void buildMetaData(UnifiedDeploymentInfo udi, Object metaData)
- {
- if (metaData instanceof WebMetaData)
- {
- udi.metaData = webMetaDataAdapter.buildUnifiedWebMetaData((WebMetaData)metaData);
- udi.webappURL = udi.url;
- }
- else if (metaData instanceof ApplicationMetaData)
- {
- udi.metaData = applicationMetaDataAdapter.buildUnifiedApplicationMetaData((ApplicationMetaData)metaData);
- }
- }
-}
Deleted: trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/DeploymentInfoAdapterFactory.java
===================================================================
--- trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/DeploymentInfoAdapterFactory.java 2007-05-03 15:43:45 UTC (rev 2954)
+++ trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/DeploymentInfoAdapterFactory.java 2007-05-03 19:18:24 UTC (rev 2955)
@@ -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;
-
-// $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("DeploymentInfoAdapter");
- return (DeploymentInfoAdapter)entry.getTarget();
- }
-}
Deleted: trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/JBossContextServlet.java
===================================================================
--- trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/JBossContextServlet.java 2007-05-03 15:43:45 UTC (rev 2954)
+++ trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/JBossContextServlet.java 2007-05-03 19:18:24 UTC (rev 2955)
@@ -1,46 +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;
-
-// $Id$
-
-import org.jboss.logging.Logger;
-import org.jboss.ws.core.server.legacy.CommonContextServlet;
-import org.jboss.ws.core.server.legacy.ServiceEndpointManagerFactory;
-
-/**
- * The servlet that that is associated with context /jbossws
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 21-Mar-2005
- */
-public class JBossContextServlet extends CommonContextServlet
-{
- // provide logging
- protected final Logger log = Logger.getLogger(JBossContextServlet.class);
-
- protected void initServiceEndpointManager()
- {
- ServiceEndpointManagerFactory factory = ServiceEndpointManagerFactory.getInstance();
- epManager = factory.getServiceEndpointManager();
- }
-}
Deleted: trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/JBossHttpServer.java
===================================================================
--- trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/JBossHttpServer.java 2007-05-03 15:43:45 UTC (rev 2954)
+++ trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/JBossHttpServer.java 2007-05-03 19:18:24 UTC (rev 2955)
@@ -1,231 +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;
-
-//$Id$
-
-import java.io.File;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.net.URL;
-import java.util.Map;
-
-import javax.management.MBeanServerConnection;
-import javax.management.ObjectName;
-import javax.naming.InitialContext;
-import javax.naming.NamingException;
-import javax.xml.ws.Endpoint;
-
-import org.jboss.ws.WSException;
-import org.jboss.ws.core.server.HttpContext;
-import org.jboss.ws.core.server.HttpServer;
-import org.jboss.ws.core.utils.DOMUtils;
-import org.jboss.ws.core.utils.DOMWriter;
-import org.jboss.ws.integration.management.ServerConfig;
-import org.jboss.ws.integration.management.ServerConfigFactory;
-import org.w3c.dom.Element;
-
-/**
- * A Tomcat HTTP Server
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 07-Jul-2006
- */
-public class JBossHttpServer extends HttpServer
-{
- private static final String MAIN_DEPLOYER = "jboss.system:service=MainDeployer";
-
- /** Start an instance of this HTTP server */
- @Override
- public void start()
- {
- // verify required properties
- }
-
- /** Create an HTTP context */
- public HttpContext createContext(String contextRoot)
- {
- return new HttpContext(this, contextRoot);
- }
-
- /** Publish an JAXWS endpoint to the HTTP server */
- @Override
- public void publish(HttpContext context, Endpoint endpoint)
- {
- Class implClass = getImplementorClass(endpoint);
- String implName = implClass.getName();
-
- try
- {
- Element webDoc = createWebAppDescriptor(context, endpoint);
- Element jbossDoc = createJBossWebAppDescriptor(context, endpoint);
-
- File tmpWar = null;
- try
- {
- ServerConfigFactory factory = ServerConfigFactory.getInstance();
- ServerConfig serverConfig = factory.getServerConfig();
- File tmpDir = new File(serverConfig.getServerTempDir().getCanonicalPath() + "/jbossws");
-
- String deploymentName = implName.substring(implName.lastIndexOf(".") + 1);
- tmpWar = File.createTempFile(deploymentName, ".war", tmpDir);
- tmpWar.delete();
- File webInf = new File(tmpWar, "WEB-INF");
- webInf.mkdirs();
-
- File webXml = new File(webInf, "web.xml");
- FileWriter fw = new FileWriter(webXml);
- new DOMWriter(fw).setPrettyprint(true).print(webDoc);
- fw.close();
-
- File jbossWebXml = new File(webInf, "jboss-web.xml");
- fw = new FileWriter(jbossWebXml);
- new DOMWriter(fw).setPrettyprint(true).print(jbossDoc);
- fw.close();
- }
- catch (IOException e)
- {
- throw new WSException("Failed to create webservice war", e);
- }
-
- Map<String, Object> epProps = endpoint.getProperties();
- epProps.put("jbossws-endpoint-war-url", tmpWar);
-
- URL tmpURL = tmpWar.toURL();
- MBeanServerConnection server = getServer();
- server.invoke(new ObjectName(MAIN_DEPLOYER), "deploy", new Object[] { tmpURL }, new String[] { "java.net.URL" });
- }
- catch (RuntimeException rte)
- {
- throw rte;
- }
- catch (Exception ex)
- {
- throw new WSException(ex);
- }
- }
-
- /** Destroys an JAXWS endpoint on the HTTP server */
- @Override
- public void destroy(HttpContext context, Endpoint endpoint)
- {
- Map<String, Object> epProps = endpoint.getProperties();
- File tmpWar = (File)epProps.get("jbossws-endpoint-war-url");
- if (tmpWar == null)
- throw new IllegalStateException("Cannot find endpoint war property");
-
- try
- {
- URL tmpURL = tmpWar.toURL();
- MBeanServerConnection server = getServer();
- server.invoke(new ObjectName(MAIN_DEPLOYER), "undeploy", new Object[] { tmpURL }, new String[] { "java.net.URL" });
-
- tmpWar.delete();
- }
- catch (RuntimeException rte)
- {
- throw rte;
- }
- catch (Exception ex)
- {
- throw new WSException(ex);
- }
- }
-
- private Class getImplementorClass(Endpoint endpoint)
- {
- Object implementor = endpoint.getImplementor();
- Class implClass = (implementor instanceof Class ? (Class)implementor : implementor.getClass());
- return implClass;
- }
-
- private MBeanServerConnection getServer() throws NamingException
- {
- InitialContext iniCtx = new InitialContext();
- MBeanServerConnection server = (MBeanServerConnection)iniCtx.lookup("jmx/invoker/RMIAdaptor");
- return server;
- }
-
- private Element createWebAppDescriptor(HttpContext context, Endpoint endpoint)
- {
- Class implClass = getImplementorClass(endpoint);
- String implName = implClass.getName();
-
- Element webApp = DOMUtils.createElement("web-app");
-
- /*
- <servlet>
- <servlet-name>
- <servlet-class>
- </servlet>
- */
- Element servlet = (Element)webApp.appendChild(DOMUtils.createElement("servlet"));
- Element servletName = (Element)servlet.appendChild(DOMUtils.createElement("servlet-name"));
- servletName.appendChild(DOMUtils.createTextNode("JAXWSEndpoint"));
- Element servletClass = (Element)servlet.appendChild(DOMUtils.createElement("servlet-class"));
- servletClass.appendChild(DOMUtils.createTextNode(implName));
-
- /*
- <servlet-mapping>
- <servlet-name>
- <url-pattern>
- </servlet-mapping>
- */
- Element servletMapping = (Element)webApp.appendChild(DOMUtils.createElement("servlet-mapping"));
- servletName = (Element)servletMapping.appendChild(DOMUtils.createElement("servlet-name"));
- servletName.appendChild(DOMUtils.createTextNode("JAXWSEndpoint"));
- Element urlPatternElement = (Element)servletMapping.appendChild(DOMUtils.createElement("url-pattern"));
-
- String urlPattern = "/*";
- urlPatternElement.appendChild(DOMUtils.createTextNode(urlPattern));
-
- // Add security-constraint in generated web.xml for Endpoint API
- // FIXME: JBWS-1069
-
- return webApp;
- }
-
- private Element createJBossWebAppDescriptor(HttpContext context, Endpoint endpoint)
- {
- /* Create a jboss-web
- <jboss-web>
- <security-domain>java:/jaas/cts</security-domain>
- <context-root>/ws/ejbN/</context-root>
- </jboss-web>
- */
- Element jbossWeb = DOMUtils.createElement("jboss-web");
-
- // Get the context root for this deployment
- String contextRoot = context.getContextRoot();
- if (contextRoot == null)
- throw new WSException("Cannot obtain context root");
-
- Element root = (Element)jbossWeb.appendChild(DOMUtils.createElement("context-root"));
- root.appendChild(DOMUtils.createTextNode(contextRoot));
-
- // Add security-constraint in generated web.xml for Endpoint API
- // FIXME: JBWS-1069
-
- return jbossWeb;
- }
-}
-
Deleted: trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/JBossServiceEndpointServlet.java
===================================================================
--- trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/JBossServiceEndpointServlet.java 2007-05-03 15:43:45 UTC (rev 2954)
+++ trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/JBossServiceEndpointServlet.java 2007-05-03 19:18:24 UTC (rev 2955)
@@ -1,68 +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;
-
-// $Id$
-
-import javax.servlet.ServletContext;
-
-import org.jboss.logging.Logger;
-import org.jboss.ws.WSException;
-import org.jboss.ws.core.server.legacy.AbstractServiceEndpointServlet;
-import org.jboss.ws.core.server.legacy.ServiceEndpoint;
-import org.jboss.ws.metadata.umdm.ServerEndpointMetaData;
-
-/**
- * A servlet that is installed for every web service endpoint.
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 16-May-2006
- */
-public class JBossServiceEndpointServlet extends AbstractServiceEndpointServlet
-{
- // provide logging
- private static final Logger log = Logger.getLogger(JBossServiceEndpointServlet.class);
-
- /** Initialize the service endpoint
- */
- protected void initServiceEndpoint(String contextPath)
- {
- super.initServiceEndpoint(contextPath);
-
- ServiceEndpoint wsEndpoint = epManager.getServiceEndpointByID(sepId);
- if (wsEndpoint == null)
- throw new WSException("Cannot obtain endpoint for: " + sepId);
-
- // read the config name/file from web.xml
- ServletContext ctx = getServletContext();
- String configName = ctx.getInitParameter("jbossws-config-name");
- String configFile = ctx.getInitParameter("jbossws-config-file");
- if (configName != null || configFile != null)
- {
- log.debug("Updating service endpoint config\n config-name: " + configName + "\n config-file: " + configFile);
- ServerEndpointMetaData sepMetaData = wsEndpoint.getServiceEndpointInfo().getServerEndpointMetaData();
- sepMetaData.setConfigName(configName, configFile);
-
- log.debug("Updated server meta data" + sepMetaData);
- }
- }
-}
Deleted: trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/PortComponentLinkServlet.java
===================================================================
--- trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/PortComponentLinkServlet.java 2007-05-03 15:43:45 UTC (rev 2954)
+++ trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/PortComponentLinkServlet.java 2007-05-03 19:18:24 UTC (rev 2955)
@@ -1,93 +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;
-
-// $Id$
-
-import java.io.IOException;
-import java.io.PrintWriter;
-
-import javax.servlet.ServletConfig;
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServlet;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import org.jboss.logging.Logger;
-import org.jboss.ws.WSException;
-import org.jboss.ws.core.server.legacy.ServiceEndpoint;
-import org.jboss.ws.core.server.legacy.ServiceEndpointManager;
-import org.jboss.ws.core.server.legacy.ServiceEndpointManagerFactory;
-
-/**
- * A servlet that reports the serviceURL for a given service ID.
- * <p/>
- * When the web service client ENC is setup, it may contain port-component-link
- * entries that point to service endpoints in the same top level deployment.
- * The final serviceURL of those endpoints will become available after the
- * reference to the javax.xml.rpc.Service is bound to JNDI.
- * <p/>
- * When the client does a lookup of the javax.xml.rpc.Service from JNDI the ObjectFactory
- * will contact this servlet for the final serviceURL. It is acceptable that the client
- * wsdl does not contain the correct serviceURL if the client is using the port-component-link element.
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 29-May-2004
- */
-public class PortComponentLinkServlet extends HttpServlet
-{
- // provide logging
- private static final Logger log = Logger.getLogger(PortComponentLinkServlet.class);
-
- protected ServiceEndpointManager epManager;
-
- public void init(ServletConfig config) throws ServletException
- {
- super.init(config);
- ServiceEndpointManagerFactory factory = ServiceEndpointManagerFactory.getInstance();
- epManager = factory.getServiceEndpointManager();
- }
-
- /**
- * Get the serviceURL as string for a given serviceID.
- */
- public void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException
- {
- String pcLink = req.getParameter("pcLink");
- if (pcLink == null)
- throw new IllegalArgumentException("Cannot obtain request parameter 'pcLink'");
-
- ServiceEndpoint serviceEndpoint = epManager.resolvePortComponentLink(pcLink);
- ;
- if (serviceEndpoint == null)
- throw new WSException("Cannot resolve port-component-link: " + pcLink);
-
- res.setContentType("text/plain");
- PrintWriter out = res.getWriter();
-
- String endpointAddress = serviceEndpoint.getServiceEndpointInfo().getServerEndpointMetaData().getEndpointAddress();
- out.println(endpointAddress);
-
- log.debug("Resolved " + pcLink + " to: " + endpointAddress);
- out.close();
- }
-}
Deleted: trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/SecurityAssociationAdaptorFactoryImpl.java
===================================================================
--- trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/SecurityAssociationAdaptorFactoryImpl.java 2007-05-03 15:43:45 UTC (rev 2954)
+++ trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/SecurityAssociationAdaptorFactoryImpl.java 2007-05-03 19:18:24 UTC (rev 2955)
@@ -1,57 +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;
-
-// $Id$
-
-import java.security.Principal;
-
-import org.jboss.security.SecurityAssociation;
-import org.jboss.ws.extensions.security.SecurityAssociationAdaptor;
-import org.jboss.ws.extensions.security.SecurityAssociationAdaptorFactory;
-
-/**
- * A JBoss specific SecurityAdaptorFactory
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 05-May-2006
- */
-public class SecurityAssociationAdaptorFactoryImpl implements SecurityAssociationAdaptorFactory
-{
- public SecurityAssociationAdaptor getSecurityAssociationAdaptor()
- {
- return new SecurityAccociationAdaptorImpl();
- }
-
- public class SecurityAccociationAdaptorImpl implements SecurityAssociationAdaptor
- {
- public void setPrincipal(Principal pricipal)
- {
- SecurityAssociation.setPrincipal(pricipal);
- }
-
- public void setCredential(Object credential)
- {
- SecurityAssociation.setCredential(credential);
- }
- }
-}
Deleted: trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/ServiceEndpointGeneratorEJB21.java
===================================================================
--- trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/ServiceEndpointGeneratorEJB21.java 2007-05-03 15:43:45 UTC (rev 2954)
+++ trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/ServiceEndpointGeneratorEJB21.java 2007-05-03 19:18:24 UTC (rev 2955)
@@ -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;
-
-//$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.core.server.ServiceEndpointGeneratorEJB;
-import org.jboss.ws.core.server.UnifiedDeploymentInfo;
-import org.jboss.ws.core.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 ServiceEndpointGeneratorEJB21 extends ServiceEndpointGeneratorEJB
-{
- // logging support
- protected Logger log = Logger.getLogger(ServiceEndpointGeneratorEJB21.class);
-
- /** Add the roles from ejb-jar.xml to the security roles
- */
- protected void addEJBSecurityRoles(Element webApp, UnifiedDeploymentInfo udi)
- {
- // Fix: http://jira.jboss.org/jira/browse/JBWS-309
- ApplicationMetaData applMetaData = (ApplicationMetaData)udi.metaData;
- 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: trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/ServiceEndpointGeneratorEJB3.java
===================================================================
--- trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/ServiceEndpointGeneratorEJB3.java 2007-05-03 15:43:45 UTC (rev 2954)
+++ trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/ServiceEndpointGeneratorEJB3.java 2007-05-03 19:18:24 UTC (rev 2955)
@@ -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;
-
-//$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.core.server.ServiceEndpointGeneratorEJB;
-import org.jboss.ws.core.server.UnifiedDeploymentInfo;
-import org.jboss.ws.core.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 ServiceEndpointGeneratorEJB3 extends ServiceEndpointGeneratorEJB
-{
- // logging support
- protected Logger log = Logger.getLogger(ServiceEndpointGeneratorEJB3.class);
-
- /** Add the roles from ejb-jar.xml to the security roles
- */
- protected void addEJBSecurityRoles(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: trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/ServiceEndpointInterceptor.java
===================================================================
--- trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/ServiceEndpointInterceptor.java 2007-05-03 15:43:45 UTC (rev 2954)
+++ trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/ServiceEndpointInterceptor.java 2007-05-03 19:18:24 UTC (rev 2955)
@@ -1,141 +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;
-
-// $Id$
-
-import javax.xml.soap.SOAPMessage;
-
-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.core.CommonBinding;
-import org.jboss.ws.core.CommonBindingProvider;
-import org.jboss.ws.core.CommonMessageContext;
-import org.jboss.ws.core.EndpointInvocation;
-import org.jboss.ws.core.MessageAbstraction;
-import org.jboss.ws.core.jaxrpc.SOAPFaultHelperJAXRPC;
-import org.jboss.ws.core.soap.SOAPMessageImpl;
-import org.jboss.ws.metadata.umdm.OperationMetaData;
-import org.jboss.ws.metadata.umdm.HandlerMetaData.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
- CommonMessageContext msgContext = (CommonMessageContext)mi.getPayloadValue(InvocationKey.SOAP_MESSAGE_CONTEXT);
- if (msgContext == null)
- {
- return getNext().invoke(mi);
- }
-
- // Get the endpoint invocation
- EndpointInvocation epInv = (EndpointInvocation)mi.getValue(EndpointInvocation.class.getName());
- OperationMetaData opMetaData = epInv.getOperationMetaData();
-
- // Get the handler callback
- String key = ServiceEndpointInvokerEJB21.HandlerCallback.class.getName();
- ServiceEndpointInvokerEJB21.HandlerCallback callback = (ServiceEndpointInvokerEJB21.HandlerCallback)mi.getValue(key);
-
- // 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.getRequestPayload();
- mi.setArguments(reqParams);
- Object resObj = getNext().invoke(mi);
- epInv.setReturnValue(resObj);
-
- // Bind the response message
- CommonBindingProvider bindingProvider = new CommonBindingProvider(opMetaData.getEndpointMetaData());
- CommonBinding binding = (CommonBinding)bindingProvider.getCommonBinding();
- SOAPMessage resMessage = (SOAPMessage)binding.bindResponseMessage(opMetaData, epInv);
- msgContext.setSOAPMessage(resMessage);
- }
-
- // 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
- {
- SOAPMessage faultMessage = SOAPFaultHelperJAXRPC.exceptionToFaultMessage(ex);
- msgContext.setSOAPMessage(faultMessage);
-
- // 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);
- }
- }
-}
Deleted: trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/ServiceEndpointInvokerEJB21.java
===================================================================
--- trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/ServiceEndpointInvokerEJB21.java 2007-05-03 15:43:45 UTC (rev 2954)
+++ trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/ServiceEndpointInvokerEJB21.java 2007-05-03 19:18:24 UTC (rev 2955)
@@ -1,269 +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;
-
-// $Id$
-
-import java.lang.reflect.Method;
-import java.security.Principal;
-
-import javax.management.MBeanServer;
-import javax.management.ObjectName;
-
-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.WSException;
-import org.jboss.ws.core.CommonMessageContext;
-import org.jboss.ws.core.EndpointInvocation;
-import org.jboss.ws.core.jaxrpc.handler.SOAPMessageContextJAXRPC;
-import org.jboss.ws.core.server.legacy.AbstractServiceEndpointInvoker;
-import org.jboss.ws.core.server.legacy.ServiceEndpointInfo;
-import org.jboss.ws.core.server.legacy.ServiceEndpointInvoker;
-import org.jboss.ws.core.soap.MessageContextAssociation;
-import org.jboss.ws.integration.ObjectNameFactory;
-import org.jboss.ws.metadata.j2ee.UnifiedApplicationMetaData;
-import org.jboss.ws.metadata.j2ee.UnifiedBeanMetaData;
-import org.jboss.ws.metadata.umdm.ServerEndpointMetaData;
-import org.jboss.ws.metadata.umdm.EndpointMetaData.Type;
-import org.jboss.ws.metadata.umdm.HandlerMetaData.HandlerType;
-
-/**
- * Handles invocations on EJB2.1 endpoints.
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 19-Jan-2005
- */
-public class ServiceEndpointInvokerEJB21 extends AbstractServiceEndpointInvoker implements ServiceEndpointInvoker
-{
- // provide logging
- private Logger log = Logger.getLogger(ServiceEndpointInvokerEJB21.class);
-
- private String jndiName;
- private MBeanServer server;
- private ObjectName objectName;
-
- public ServiceEndpointInvokerEJB21()
- {
- server = MBeanServerLocator.locateJBoss();
- }
-
- /** Initialize the service endpoint */
- @Override
- public void init(ServiceEndpointInfo seInfo)
- {
- super.init(seInfo);
-
- ServerEndpointMetaData epMetaData = seInfo.getServerEndpointMetaData();
- String ejbName = epMetaData.getLinkName();
- if (ejbName == null)
- throw new WSException("Cannot obtain ejb-link from port component");
-
- UnifiedApplicationMetaData applMetaData = (UnifiedApplicationMetaData)seInfo.getUnifiedDeploymentInfo().metaData;
- UnifiedBeanMetaData beanMetaData = (UnifiedBeanMetaData)applMetaData.getBeanByEjbName(ejbName);
- if (beanMetaData == null)
- throw new WSException("Cannot obtain ejb meta data for: " + ejbName);
-
- // verify the service endpoint
- String seiName = epMetaData.getServiceEndpointInterfaceName();
- if (epMetaData.getType() == Type.JAXRPC && seiName != null)
- {
- String bmdSEI = beanMetaData.getServiceEndpointInterface();
- if (seiName.equals(bmdSEI) == false)
- throw new WSException("Endpoint meta data defines SEI '" + seiName + "', <service-endpoint> in ejb-jar.xml defines '" + bmdSEI + "'");
- }
-
- // get the bean's JNDI name
- jndiName = beanMetaData.getContainerObjectNameJndiName();
- if (jndiName == null)
- throw new WSException("Cannot obtain JNDI name for: " + ejbName);
-
- objectName = ObjectNameFactory.create("jboss.j2ee:jndiName=" + jndiName + ",service=EJB");
-
- // 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);
- }
- }
-
- /** Load the SEI implementation bean if necessary
- */
- public Class loadServiceEndpoint()
- {
- if (server.isRegistered(objectName) == false)
- throw new WSException("Cannot find service endpoint target: " + objectName);
-
- return null;
- }
-
- /** Create an instance of the SEI implementation bean if necessary */
- public Object createServiceEndpointInstance(Object endpointContext, Class seiImplClass)
- {
- return null;
- }
-
- /** Invoke an instance of the SEI implementation bean */
- public void invokeServiceEndpointInstance(Object seiImpl, EndpointInvocation epInv) throws Exception
- {
- log.debug("invokeServiceEndpoint: " + epInv.getJavaMethod().getName());
-
- // these are provided by the ServerLoginHandler
- Principal principal = SecurityAssociation.getPrincipal();
- Object credential = SecurityAssociation.getCredential();
-
- CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
-
- // invoke on the container
- try
- {
- // setup the invocation
- Method method = epInv.getJavaMethod();
- Object[] args = epInv.getRequestPayload();
- Invocation inv = new Invocation(null, method, args, null, principal, credential);
-
- // EJB2.1 endpoints will only get an JAXRPC context
- if ((msgContext instanceof javax.xml.rpc.handler.MessageContext) == false)
- msgContext = new SOAPMessageContextJAXRPC(msgContext);
-
- inv.setValue(InvocationKey.SOAP_MESSAGE_CONTEXT, msgContext);
- inv.setValue(InvocationKey.SOAP_MESSAGE, msgContext.getSOAPMessage());
- inv.setType(InvocationType.SERVICE_ENDPOINT);
-
- // Set the handler callback and endpoint invocation
- ServerEndpointMetaData sepMetaData = seInfo.getServerEndpointMetaData();
- inv.setValue(HandlerCallback.class.getName(), new HandlerCallback(sepMetaData), PayloadKey.TRANSIENT);
- inv.setValue(EndpointInvocation.class.getName(), epInv, PayloadKey.TRANSIENT);
-
- String[] sig = { Invocation.class.getName() };
- Object retObj = server.invoke(objectName, "invoke", new Object[] { inv }, sig);
- epInv.setReturnValue(retObj);
- }
- catch (Exception e)
- {
- handleInvocationException(e);
- }
- }
-
- /** Create an instance of the SEI implementation bean if necessary */
- public void destroyServiceEndpointInstance(Object seiImpl)
- {
- // do nothing
- }
-
- /** Handlers are beeing called through the HandlerCallback from the EJB interceptor */
- @Override
- public boolean callRequestHandlerChain(ServerEndpointMetaData sepMetaData, HandlerType type)
- {
- if (type == HandlerType.PRE)
- return delegate.callRequestHandlerChain(sepMetaData, type);
- else
- return true;
- }
-
- /** Handlers are beeing called through the HandlerCallback from the EJB interceptor */
- public boolean callResponseHandlerChain(ServerEndpointMetaData sepMetaData, HandlerType type)
- {
- if (type == HandlerType.PRE)
- return delegate.callResponseHandlerChain(sepMetaData, type);
- else
- return true;
- }
-
- /** Handlers are beeing called through the HandlerCallback from the EJB interceptor */
- public boolean callFaultHandlerChain(ServerEndpointMetaData sepMetaData, HandlerType type, Exception ex)
- {
- if (type == HandlerType.PRE)
- return delegate.callFaultHandlerChain(sepMetaData, type, ex);
- else
- return true;
- }
-
- // The ServiceEndpointInterceptor calls the methods in this callback
- public class HandlerCallback
- {
- private ServerEndpointMetaData sepMetaData;
-
- public HandlerCallback(ServerEndpointMetaData sepMetaData)
- {
- this.sepMetaData = sepMetaData;
- }
-
- /** Handlers are beeing called through the HandlerCallback from the EJB interceptor */
- public boolean callRequestHandlerChain(HandlerType type)
- {
- if (type == HandlerType.PRE)
- return true;
- else
- return delegate.callRequestHandlerChain(sepMetaData, type);
- }
-
- /** Handlers are beeing called through the HandlerCallback from the EJB interceptor */
- public boolean callResponseHandlerChain(HandlerType type)
- {
- if (type == HandlerType.PRE)
- return true;
- else
- return delegate.callResponseHandlerChain(sepMetaData, type);
- }
-
- /** Handlers are beeing called through the HandlerCallback from the EJB interceptor */
- public boolean callFaultHandlerChain(HandlerType type, Exception ex)
- {
- if (type == HandlerType.PRE)
- return true;
- else
- return delegate.callFaultHandlerChain(sepMetaData, type, ex);
- }
- }
-}
Deleted: trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/ServiceEndpointInvokerEJB3.java
===================================================================
--- trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/ServiceEndpointInvokerEJB3.java 2007-05-03 15:43:45 UTC (rev 2954)
+++ trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/ServiceEndpointInvokerEJB3.java 2007-05-03 19:18:24 UTC (rev 2955)
@@ -1,130 +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;
-
-// $Id$
-
-import java.lang.reflect.Method;
-
-import javax.management.MBeanServer;
-import javax.management.ObjectName;
-
-import org.jboss.aop.Dispatcher;
-import org.jboss.ejb3.stateless.StatelessContainer;
-import org.jboss.logging.Logger;
-import org.jboss.mx.util.MBeanServerLocator;
-import org.jboss.ws.WSException;
-import org.jboss.ws.core.EndpointInvocation;
-import org.jboss.ws.core.server.UnifiedDeploymentInfo;
-import org.jboss.ws.core.server.legacy.AbstractServiceEndpointInvoker;
-import org.jboss.ws.core.server.legacy.ServiceEndpointInfo;
-import org.jboss.ws.core.server.legacy.ServiceEndpointInvoker;
-import org.jboss.ws.integration.ObjectNameFactory;
-
-/**
- * Handles invocations on EJB3 endpoints.
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 23-Jul-2005
- */
-public class ServiceEndpointInvokerEJB3 extends AbstractServiceEndpointInvoker implements ServiceEndpointInvoker
-{
- // provide logging
- private Logger log = Logger.getLogger(ServiceEndpointInvokerEJB3.class);
-
- private MBeanServer server;
- private ObjectName objectName;
-
- public ServiceEndpointInvokerEJB3()
- {
- server = MBeanServerLocator.locateJBoss();
- }
-
- /** Initialize the service endpoint */
- @Override
- public void init(ServiceEndpointInfo seInfo)
- {
- super.init(seInfo);
-
- String ejbName = seInfo.getServerEndpointMetaData().getLinkName();
- UnifiedDeploymentInfo udi = seInfo.getUnifiedDeploymentInfo();
- 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());
- }
-
- /** Load the SEI implementation bean if necessary
- */
- public Class loadServiceEndpoint()
- {
- if (server.isRegistered(objectName) == false)
- throw new WSException("Cannot find service endpoint target: " + objectName);
-
- return null;
- }
-
- /** Create an instance of the SEI implementation bean if necessary */
- public Object createServiceEndpointInstance(Object endpointContext, Class seiImplClass)
- {
- return null;
- }
-
- /** Invoke an instance of the SEI implementation bean */
- public void invokeServiceEndpointInstance(Object seiImpl, EndpointInvocation epInv) throws Exception
- {
- log.debug("invokeServiceEndpoint: " + epInv.getJavaMethod().getName());
- try
- {
- // setup the invocation
- Method seiMethod = epInv.getJavaMethod();
- Object[] args = epInv.getRequestPayload();
-
- Dispatcher dispatcher = Dispatcher.singleton;
- String canonicalName = objectName.getCanonicalName();
- StatelessContainer container = (StatelessContainer)dispatcher.getRegistered(canonicalName);
- if (container == null)
- throw new WSException("Cannot obtain container from Dispatcher: " + canonicalName);
-
- Class beanClass = container.getBeanClass();
-
- Method implMethod = getImplMethod(beanClass, seiMethod);
- Object retObj = container.localInvoke(implMethod, args);
-
- epInv.setReturnValue(retObj);
- }
- catch (Throwable e)
- {
- handleInvocationException(e);
- }
- }
-
- /** Create an instance of the SEI implementation bean if necessary */
- public void destroyServiceEndpointInstance(Object seiImpl)
- {
- // do nothing
- }
-
-}
Deleted: trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/ServiceEndpointInvokerMDB.java
===================================================================
--- trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/ServiceEndpointInvokerMDB.java 2007-05-03 15:43:45 UTC (rev 2954)
+++ trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/ServiceEndpointInvokerMDB.java 2007-05-03 19:18:24 UTC (rev 2955)
@@ -1,94 +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;
-
-// $Id$
-
-import java.lang.reflect.Method;
-
-import org.jboss.logging.Logger;
-import org.jboss.ws.core.EndpointInvocation;
-import org.jboss.ws.core.server.legacy.AbstractServiceEndpointInvoker;
-import org.jboss.ws.core.server.legacy.ServiceEndpointInvoker;
-import org.jboss.ws.core.utils.ThreadLocalAssociation;
-
-/**
- * Handles invocations on MDB endpoints.
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 21-Mar-2006
- */
-public class ServiceEndpointInvokerMDB extends AbstractServiceEndpointInvoker implements ServiceEndpointInvoker
-{
- // provide logging
- private Logger log = Logger.getLogger(ServiceEndpointInvokerMDB.class);
-
- /** Load the SEI implementation bean if necessary
- */
- public Class loadServiceEndpoint() throws ClassNotFoundException
- {
- return null;
- }
-
- // The dispatcher sets the target bean object
- public void setTargetBeanObject(Object targetMDB)
- {
- ThreadLocalAssociation.localInvokerMDBAssoc().set(targetMDB);
- }
-
- /** Create an instance of the SEI implementation bean if necessary
- */
- public Object createServiceEndpointInstance(Object endpointContext, Class seiImplClass) throws InstantiationException, IllegalAccessException
- {
- return ThreadLocalAssociation.localInvokerMDBAssoc().get();
- }
-
- /** Invoke an instance of the SEI implementation bean */
- public void invokeServiceEndpointInstance(Object seiImpl, EndpointInvocation epInv) throws Exception
- {
- log.debug("invokeServiceEndpoint: " + epInv.getJavaMethod().getName());
- try
- {
- Class implClass = seiImpl.getClass();
- Method seiMethod = epInv.getJavaMethod();
- Method implMethod = getImplMethod(implClass, seiMethod);
-
- Object[] args = epInv.getRequestPayload();
- Object retObj = implMethod.invoke(seiImpl, args);
- epInv.setReturnValue(retObj);
- }
- catch (Exception e)
- {
- handleInvocationException(e);
- }
- finally
- {
- // cleanup thread local
- setTargetBeanObject(null);
- }
- }
-
- /** Destroy an instance of the SEI implementation bean if necessary */
- public void destroyServiceEndpointInstance(Object seiImpl)
- {
- }
-}
Deleted: trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/ServiceEndpointPublisher.java
===================================================================
--- trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/ServiceEndpointPublisher.java 2007-05-03 15:43:45 UTC (rev 2954)
+++ trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/ServiceEndpointPublisher.java 2007-05-03 19:18:24 UTC (rev 2955)
@@ -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;
-
-// $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.core.server.AbstractServiceEndpointPublisher;
-import org.jboss.ws.core.server.UnifiedDeploymentInfo;
-
-/**
- * Publish the HTTP service endpoint to Tomcat
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 12-May-2006
- */
-public class ServiceEndpointPublisher extends AbstractServiceEndpointPublisher
-{
- // provide logging
- private static Logger log = Logger.getLogger(ServiceEndpointPublisher.class);
-
- public String publishServiceEndpoint(UnifiedDeploymentInfo udi) throws Exception
- {
- DeploymentInfo di = udi.getAttachment(DeploymentInfo.class);
- if (di == null)
- throw new IllegalStateException("Cannot obtain DeploymentInfo from context");
-
- rewriteWebXml(udi);
-
- // Preserve the repository config
- URL warURL = udi.webappURL;
- DeploymentInfo auxdi = new DeploymentInfo(warURL, null, MBeanServerLocator.locateJBoss());
- auxdi.repositoryConfig = di.getTopRepositoryConfig();
- getMainDeployer().deploy(auxdi);
- return "OK";
- }
-
- public String destroyServiceEndpoint(UnifiedDeploymentInfo udi) throws Exception
- {
- URL warURL = udi.webappURL;
- if (warURL == null)
- {
- log.error("Cannot obtain waURL for: " + udi.name);
- return "FAIL";
- }
-
- log.debug("destroyServiceEndpoint: " + warURL);
-
- getMainDeployer().undeploy(warURL);
- return "OK";
- }
-
- private MainDeployerMBean getMainDeployer() throws MBeanProxyCreationException
- {
- MBeanServer server = MBeanServerLocator.locateJBoss();
- MainDeployerMBean mainDeployer = (MainDeployerMBean)MBeanProxy.get(MainDeployerMBean.class, MainDeployerMBean.OBJECT_NAME, server);
- return mainDeployer;
- }
-}
Deleted: trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/WebMetaDataAdapter.java
===================================================================
--- trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/WebMetaDataAdapter.java 2007-05-03 15:43:45 UTC (rev 2954)
+++ trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/WebMetaDataAdapter.java 2007-05-03 19:18:24 UTC (rev 2955)
@@ -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.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.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(WebMetaData wmd)
- {
- UnifiedWebMetaData umd = new UnifiedWebMetaData();
- umd.setContextRoot(wmd.getContextRoot());
- umd.setServletMappings(wmd.getServletMappings());
- umd.setServletClassNames(getServletClassMap(wmd));
- umd.setConfigName(wmd.getConfigName());
- umd.setConfigFile(wmd.getConfigFile());
- umd.setSecurityDomain(wmd.getSecurityDomain());
- umd.setPublishLocationAdapter(getPublishLocationAdpater(wmd));
- umd.setSecurityMetaData(getSecurityMetaData(wmd.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;
- }
-}
Copied: trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/AbstractApplicationMetaDataAdapter.java (from rev 2953, trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/AbstractApplicationMetaDataAdapter.java)
===================================================================
--- trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/AbstractApplicationMetaDataAdapter.java (rev 0)
+++ trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/AbstractApplicationMetaDataAdapter.java 2007-05-03 19:18:24 UTC (rev 2955)
@@ -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.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.core.server.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);
+}
Added: trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/AbstractDeployerHook.java
===================================================================
--- trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/AbstractDeployerHook.java (rev 0)
+++ trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/AbstractDeployerHook.java 2007-05-03 19:18:24 UTC (rev 2955)
@@ -0,0 +1,139 @@
+/*
+ * 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.deployment.DeployerManager;
+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;
+
+ public void setDeployerManager(DeployerManager deploymentManager)
+ {
+ this.deployerManager = deploymentManager;
+ }
+
+ 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);
+ }
+ }
+}
Property changes on: trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/AbstractDeployerHook.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/AbstractDeployerHookEJB.java
===================================================================
--- trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/AbstractDeployerHookEJB.java (rev 0)
+++ trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/AbstractDeployerHookEJB.java 2007-05-03 19:18:24 UTC (rev 2955)
@@ -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.jbossws;
+
+//$Id$
+
+/**
+ * An abstract deployer for EJB Endpoints
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 25-Apr-2007
+ */
+public abstract class AbstractDeployerHookEJB extends ArchiveDeployerHook
+{
+}
Property changes on: trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/AbstractDeployerHookEJB.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/AbstractDeployerHookJSE.java
===================================================================
--- trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/AbstractDeployerHookJSE.java (rev 0)
+++ trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/AbstractDeployerHookJSE.java 2007-05-03 19:18:24 UTC (rev 2955)
@@ -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.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;
+ }
+ }
+}
Property changes on: trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/AbstractDeployerHookJSE.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/AbstractInvocationHandler.java
===================================================================
--- trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/AbstractInvocationHandler.java (rev 0)
+++ trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/AbstractInvocationHandler.java 2007-05-03 19:18:24 UTC (rev 2955)
@@ -0,0 +1,431 @@
+/*
+ * 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.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.lang.reflect.UndeclaredThrowableException;
+import java.util.HashMap;
+
+import javax.activation.DataHandler;
+import javax.management.MBeanException;
+import javax.xml.namespace.QName;
+import javax.xml.rpc.soap.SOAPFaultException;
+import javax.xml.soap.Name;
+import javax.xml.soap.SOAPBody;
+import javax.xml.soap.SOAPBodyElement;
+import javax.xml.soap.SOAPException;
+import javax.xml.soap.SOAPHeader;
+import javax.xml.ws.http.HTTPBinding;
+
+import org.jboss.logging.Logger;
+import org.jboss.ws.Constants;
+import org.jboss.ws.core.CommonBinding;
+import org.jboss.ws.core.CommonBindingProvider;
+import org.jboss.ws.core.CommonMessageContext;
+import org.jboss.ws.core.CommonSOAPBinding;
+import org.jboss.ws.core.DirectionHolder;
+import org.jboss.ws.core.EndpointInvocation;
+import org.jboss.ws.core.MessageAbstraction;
+import org.jboss.ws.core.DirectionHolder.Direction;
+import org.jboss.ws.core.jaxrpc.handler.HandlerDelegateJAXRPC;
+import org.jboss.ws.core.jaxrpc.handler.MessageContextJAXRPC;
+import org.jboss.ws.core.jaxws.binding.BindingProviderImpl;
+import org.jboss.ws.core.jaxws.handler.HandlerDelegateJAXWS;
+import org.jboss.ws.core.jaxws.handler.MessageContextJAXWS;
+import org.jboss.ws.core.server.ServerHandlerDelegate;
+import org.jboss.ws.core.soap.MessageContextAssociation;
+import org.jboss.ws.core.soap.SOAPMessageImpl;
+import org.jboss.ws.core.utils.JavaUtils;
+import org.jboss.ws.extensions.xop.XOPContext;
+import org.jboss.ws.integration.Endpoint;
+import org.jboss.ws.integration.invocation.InvocationContext;
+import org.jboss.ws.integration.invocation.InvocationHandler;
+import org.jboss.ws.metadata.umdm.EndpointMetaData;
+import org.jboss.ws.metadata.umdm.OperationMetaData;
+import org.jboss.ws.metadata.umdm.ServerEndpointMetaData;
+import org.jboss.ws.metadata.umdm.HandlerMetaData.HandlerType;
+
+/** An implementation handles invocations on the endpoint
+ *
+ * @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 Endpoint endpoint;
+ protected CommonBindingProvider bindingProvider;
+ protected ServerHandlerDelegate delegate;
+
+ /** Initialize the service endpoint */
+ public void init(Endpoint endpoint)
+ {
+ this.endpoint = endpoint;
+
+ ServerEndpointMetaData sepMetaData = endpoint.getMetaData(ServerEndpointMetaData.class);
+ if (sepMetaData == null)
+ throw new IllegalStateException("Cannot obtain endpoint meta data");
+
+ if (sepMetaData.getType() == EndpointMetaData.Type.JAXRPC)
+ {
+ bindingProvider = new CommonBindingProvider(sepMetaData);
+ delegate = new HandlerDelegateJAXRPC(sepMetaData);
+ }
+ else
+ {
+ bindingProvider = new BindingProviderImpl(sepMetaData);
+ delegate = new HandlerDelegateJAXWS(sepMetaData);
+ }
+ }
+
+ /** Load the SEI implementation bean if necessary */
+ protected abstract Class loadServiceEndpoint() throws ClassNotFoundException;
+
+ /** Create the instance of the SEI implementation bean if necessary */
+ protected abstract Object createServiceEndpointInstance(Class seiImplClass, InvocationContext context) throws Exception;
+
+ /** Invoke the instance of the SEI implementation bean */
+ protected abstract void invokeServiceEndpointInstance(Object seiImpl, EndpointInvocation epInv) throws Exception;
+
+ /** Destroy the instance of the SEI implementation bean if necessary */
+ protected abstract void destroyServiceEndpointInstance(Object seiImpl);
+
+ public boolean callRequestHandlerChain(ServerEndpointMetaData sepMetaData, HandlerType type)
+ {
+ return delegate.callRequestHandlerChain(sepMetaData, type);
+ }
+
+ public boolean callResponseHandlerChain(ServerEndpointMetaData sepMetaData, HandlerType type)
+ {
+ return delegate.callResponseHandlerChain(sepMetaData, type);
+ }
+
+ public void closeHandlerChain(ServerEndpointMetaData sepMetaData, HandlerType type)
+ {
+ delegate.closeHandlerChain(sepMetaData, type);
+ }
+
+ public boolean callFaultHandlerChain(ServerEndpointMetaData sepMetaData, HandlerType type, Exception ex)
+ {
+ return delegate.callFaultHandlerChain(sepMetaData, type, ex);
+ }
+
+ /** Invoke the the service endpoint */
+ public void invoke(InvocationContext reqContext) throws Exception
+ {
+ CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
+ ServerEndpointMetaData sepMetaData = (ServerEndpointMetaData)msgContext.getEndpointMetaData();
+ MessageAbstraction reqMessage = msgContext.getMessageAbstraction();
+
+ // Load the endpoint implementation bean
+ Class seImpl = loadServiceEndpoint();
+
+ // Create an instance of the endpoint implementation bean
+ Object seInstance = createServiceEndpointInstance(seImpl, reqContext);
+
+ // The direction of the message
+ DirectionHolder direction = new DirectionHolder(Direction.InBound);
+
+ // Get the order of pre/post handlerchains
+ HandlerType[] handlerType = delegate.getHandlerTypeOrder();
+ HandlerType[] faultType = delegate.getHandlerTypeOrder();
+
+ // Set the required inbound context properties
+ setInboundContextProperties();
+
+ try
+ {
+ boolean oneway = false;
+ EndpointInvocation epInv = null;
+ OperationMetaData opMetaData = null;
+ CommonBinding binding = bindingProvider.getCommonBinding();
+ binding.setHeaderSource(delegate);
+
+ // call the request handler chain
+ boolean handlersPass = callRequestHandlerChain(sepMetaData, handlerType[0]);
+
+ // Unbind the request message
+ if (handlersPass)
+ {
+ // Get the operation meta data from the SOAP message
+ opMetaData = getDispatchDestination(sepMetaData, reqMessage);
+ msgContext.setOperationMetaData(opMetaData);
+ oneway = opMetaData.isOneWay();
+
+ /*
+ * From JAX-WS 10.2.1 - "7. If the node does not understand how to process
+ * the message, then neither handlers nor the endpoint
+ * are invoked and instead the binding generates a SOAP must
+ * understand exception"
+ *
+ * Therefore, this must precede the ENDPOINT chain; however, The PRE
+ * chain still must happen first since the message may be encrypted, in which
+ * case the operation is still not known. Without knowing the operation, it
+ * is not possible to determine what headers are understood by the endpoint.
+ */
+ if (binding instanceof CommonSOAPBinding)
+ ((CommonSOAPBinding)binding).checkMustUnderstand(opMetaData);
+
+ // Unbind the request message
+ epInv = binding.unbindRequestMessage(opMetaData, reqMessage);
+ }
+
+ handlersPass = handlersPass && callRequestHandlerChain(sepMetaData, handlerType[1]);
+ handlersPass = handlersPass && callRequestHandlerChain(sepMetaData, handlerType[2]);
+
+ if (handlersPass)
+ {
+ msgContext.put(CommonMessageContext.ALLOW_EXPAND_TO_DOM, Boolean.TRUE);
+ try
+ {
+ // Check if protocol handlers modified the payload
+ if (msgContext.isModified())
+ {
+ log.debug("Handler modified payload, unbind message again");
+ reqMessage = msgContext.getMessageAbstraction();
+ epInv = binding.unbindRequestMessage(opMetaData, reqMessage);
+ }
+
+ // Invoke the service endpoint
+ invokeServiceEndpointInstance(seInstance, epInv);
+ }
+ finally
+ {
+ msgContext.remove(CommonMessageContext.ALLOW_EXPAND_TO_DOM);
+ }
+
+ // Reverse the message direction
+ msgContext = processPivotInternal(msgContext, direction);
+
+ // Set the required outbound context properties
+ setOutboundContextProperties();
+
+ if (binding instanceof CommonSOAPBinding)
+ XOPContext.setMTOMEnabled(((CommonSOAPBinding)binding).isMTOMEnabled());
+
+ // Bind the response message
+ MessageAbstraction resMessage = binding.bindResponseMessage(opMetaData, epInv);
+ msgContext.setMessageAbstraction(resMessage);
+ }
+ else
+ {
+ // Reverse the message direction without calling the endpoint
+ MessageAbstraction resMessage = msgContext.getMessageAbstraction();
+ msgContext = processPivotInternal(msgContext, direction);
+ msgContext.setMessageAbstraction(resMessage);
+ }
+
+ if (oneway == false)
+ {
+ // call the response handler chain, removing the fault type entry will not call handleFault for that chain
+ handlersPass = callResponseHandlerChain(sepMetaData, handlerType[2]);
+ faultType[2] = null;
+ handlersPass = handlersPass && callResponseHandlerChain(sepMetaData, handlerType[1]);
+ faultType[1] = null;
+ handlersPass = handlersPass && callResponseHandlerChain(sepMetaData, handlerType[0]);
+ faultType[0] = null;
+ }
+ }
+ catch (RuntimeException ex)
+ {
+ // Reverse the message direction
+ processPivotInternal(msgContext, direction);
+
+ try
+ {
+ CommonBinding binding = bindingProvider.getCommonBinding();
+ binding.bindFaultMessage(ex);
+
+ // call the fault handler chain
+ boolean handlersPass = true;
+ if (faultType[2] != null)
+ handlersPass = handlersPass && callFaultHandlerChain(sepMetaData, faultType[2], ex);
+ if (faultType[1] != null)
+ handlersPass = handlersPass && callFaultHandlerChain(sepMetaData, faultType[1], ex);
+ if (faultType[0] != null)
+ handlersPass = handlersPass && callFaultHandlerChain(sepMetaData, faultType[0], ex);
+ }
+ catch (RuntimeException subEx)
+ {
+ log.warn("Exception while processing handleFault: ", ex);
+ ex = subEx;
+ }
+ throw ex;
+ }
+ finally
+ {
+ closeHandlerChain(sepMetaData, handlerType[2]);
+ closeHandlerChain(sepMetaData, handlerType[1]);
+ closeHandlerChain(sepMetaData, handlerType[0]);
+
+ destroyServiceEndpointInstance(seInstance);
+ }
+ }
+
+ protected void setInboundContextProperties()
+ {
+ CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
+ if (msgContext instanceof MessageContextJAXWS)
+ {
+ // Map of attachments to a message for the outbound message, key is the MIME Content-ID, value is a DataHandler
+ msgContext.put(MessageContextJAXWS.INBOUND_MESSAGE_ATTACHMENTS, new HashMap<String, DataHandler>());
+ }
+ }
+
+ protected void setOutboundContextProperties()
+ {
+ CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
+ if (msgContext instanceof MessageContextJAXWS)
+ {
+ // Map of attachments to a message for the outbound message, key is the MIME Content-ID, value is a DataHandler
+ msgContext.put(MessageContextJAXWS.OUTBOUND_MESSAGE_ATTACHMENTS, new HashMap<String, DataHandler>());
+ }
+ }
+
+ private CommonMessageContext processPivotInternal(CommonMessageContext msgContext, DirectionHolder direction)
+ {
+ if (direction.getDirection() == Direction.InBound)
+ {
+ EndpointMetaData epMetaData = msgContext.getEndpointMetaData();
+ if (epMetaData.getType() == EndpointMetaData.Type.JAXRPC)
+ {
+ msgContext = MessageContextJAXRPC.processPivot(msgContext);
+ }
+ else
+ {
+ msgContext = MessageContextJAXWS.processPivot(msgContext);
+ }
+ direction.setDirection(Direction.OutBound);
+ }
+ return msgContext;
+ }
+
+ private OperationMetaData getDispatchDestination(EndpointMetaData epMetaData, MessageAbstraction reqMessage) throws SOAPException
+ {
+ OperationMetaData opMetaData;
+
+ String bindingID = epMetaData.getBindingId();
+ if (HTTPBinding.HTTP_BINDING.equals(bindingID))
+ {
+ if (epMetaData.getOperations().size() != 1)
+ throw new IllegalStateException("Multiple operations not supported for HTTP binding");
+
+ opMetaData = epMetaData.getOperations().get(0);
+ }
+ else
+ {
+ SOAPMessageImpl soapMessage = (SOAPMessageImpl)reqMessage;
+
+ opMetaData = soapMessage.getOperationMetaData(epMetaData);
+ SOAPHeader soapHeader = soapMessage.getSOAPHeader();
+
+ // Report a MustUnderstand fault
+ if (opMetaData == null)
+ {
+ String faultString;
+ SOAPBody soapBody = soapMessage.getSOAPBody();
+ if (soapBody.getChildElements().hasNext())
+ {
+ SOAPBodyElement soapBodyElement = (SOAPBodyElement)soapBody.getChildElements().next();
+ Name soapName = soapBodyElement.getElementName();
+ faultString = "Endpoint " + epMetaData.getPortName() + " does not contain operation meta data for: " + soapName;
+ }
+ else
+ {
+ faultString = "Endpoint " + epMetaData.getPortName() + " does not contain operation meta data for empty soap body";
+ }
+
+ // R2724 If an INSTANCE receives a message that is inconsistent with its WSDL description, it SHOULD generate a soap:Fault
+ // with a faultcode of "Client", unless a "MustUnderstand" or "VersionMismatch" fault is generated.
+ if (soapHeader != null && soapHeader.examineMustUnderstandHeaderElements(Constants.URI_SOAP11_NEXT_ACTOR).hasNext())
+ {
+ QName faultCode = Constants.SOAP11_FAULT_CODE_MUST_UNDERSTAND;
+ throw new SOAPFaultException(faultCode, faultString, null, null);
+ }
+ else
+ {
+ QName faultCode = Constants.SOAP11_FAULT_CODE_CLIENT;
+ throw new SOAPFaultException(faultCode, faultString, null, null);
+ }
+ }
+ }
+ return opMetaData;
+ }
+
+ 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;
+ }
+
+ /** handle invocation exceptions */
+ public 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);
+ }
+ }
+}
Property changes on: trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/AbstractInvocationHandler.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/AbstractServiceEndpointServlet.java
===================================================================
--- trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/AbstractServiceEndpointServlet.java (rev 0)
+++ trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/AbstractServiceEndpointServlet.java 2007-05-03 19:18:24 UTC (rev 2955)
@@ -0,0 +1,178 @@
+/*
+ * 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.io.Writer;
+
+import javax.management.ObjectName;
+import javax.servlet.ServletConfig;
+import javax.servlet.ServletException;
+import javax.servlet.ServletInputStream;
+import javax.servlet.ServletOutputStream;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.xml.rpc.JAXRPCException;
+
+import org.jboss.logging.Logger;
+import org.jboss.ws.WSException;
+import org.jboss.ws.core.server.ServletRequestContext;
+import org.jboss.ws.integration.Endpoint;
+import org.jboss.ws.integration.ObjectNameFactory;
+import org.jboss.ws.integration.RequestHandler;
+import org.jboss.ws.integration.management.EndpointRegistry;
+import org.jboss.ws.integration.management.EndpointRegistryFactory;
+
+/**
+ * A servlet that is installed for every web service endpoint.
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 25-Apr-2007
+ */
+public abstract class AbstractServiceEndpointServlet extends HttpServlet
+{
+ // provide logging
+ private static final Logger log = Logger.getLogger(AbstractServiceEndpointServlet.class);
+
+ protected Endpoint endpoint;
+ protected EndpointRegistry epRegistry;
+
+ public void init(ServletConfig config) throws ServletException
+ {
+ super.init(config);
+ epRegistry = EndpointRegistryFactory.getEndpointRegistry();
+ }
+
+ public void destroy()
+ {
+ super.destroy();
+ }
+
+ public void service(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException
+ {
+ if (endpoint == null)
+ {
+ String contextPath = req.getContextPath();
+ initServiceEndpoint(contextPath);
+ }
+ super.service(req, res);
+ }
+
+ public void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException
+ {
+ // Process a WSDL request
+ if (req.getParameter("wsdl") != null || req.getParameter("WSDL") != null)
+ {
+ res.setContentType("text/xml");
+ try
+ {
+ RequestHandler requestHandler = endpoint.getRequestHandler();
+ ServletRequestContext context = new ServletRequestContext(getServletContext(), req, res);
+ requestHandler.handleWSDLRequest(endpoint, res.getOutputStream(), context);
+ }
+ catch (Exception ex)
+ {
+ handleException(ex);
+ }
+ }
+ else
+ {
+ res.setStatus(405);
+ res.setContentType("text/plain");
+ Writer out = res.getWriter();
+ out.write("HTTP GET not supported");
+ out.flush();
+ out.close();
+ }
+ }
+
+ public void doPost(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException
+ {
+ log.debug("doPost: " + req.getRequestURI());
+
+ ServletInputStream inputStream = req.getInputStream();
+ ServletOutputStream outputStream = res.getOutputStream();
+ try
+ {
+ RequestHandler requestHandler = endpoint.getRequestHandler();
+ ServletRequestContext context = new ServletRequestContext(getServletContext(), req, res);
+ requestHandler.handleRequest(endpoint, inputStream, outputStream, context);
+ }
+ catch (Exception ex)
+ {
+ handleException(ex);
+ }
+ finally
+ {
+ try
+ {
+ outputStream.flush();
+ outputStream.close();
+ }
+ catch (IOException ioex)
+ {
+ log.error("Cannot flush output stream");
+ }
+
+ }
+ }
+
+ private void handleException(Exception ex) throws ServletException
+ {
+ log.error("Error processing web service request", ex);
+
+ if (ex instanceof JAXRPCException)
+ throw (JAXRPCException)ex;
+
+ throw new ServletException(ex);
+ }
+
+ /** Initialize the service endpoint
+ */
+ protected void initServiceEndpoint(String contextPath)
+ {
+ String servletName = getServletName();
+ if (contextPath.startsWith("/"))
+ contextPath = contextPath.substring(1);
+
+ for (ObjectName sepId : epRegistry.getEndpoints())
+ {
+ String propContext = sepId.getKeyProperty(Endpoint.SEPID_PROPERTY_CONTEXT);
+ String propEndpoint = sepId.getKeyProperty(Endpoint.SEPID_PROPERTY_ENDPOINT);
+ if (servletName.equals(propEndpoint) && contextPath.equals(propContext))
+ {
+ endpoint = epRegistry.getEndpoint(sepId);
+ break;
+ }
+ }
+
+ if (endpoint == null)
+ {
+ ObjectName oname = ObjectNameFactory.create(Endpoint.SEPID_DOMAIN + ":" + Endpoint.SEPID_PROPERTY_CONTEXT + "=" + contextPath + ","
+ + Endpoint.SEPID_PROPERTY_ENDPOINT + "=" + servletName);
+ throw new WSException("Cannot obtain endpoint for: " + oname);
+ }
+ }
+}
Property changes on: trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/AbstractServiceEndpointServlet.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Copied: trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/ApplicationMetaDataAdapter.java (from rev 2953, trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/ApplicationMetaDataAdapter.java)
===================================================================
--- trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/ApplicationMetaDataAdapter.java (rev 0)
+++ trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/ApplicationMetaDataAdapter.java 2007-05-03 19:18:24 UTC (rev 2955)
@@ -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.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;
+ }
+}
Added: trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/ArchiveDeployerHook.java
===================================================================
--- trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/ArchiveDeployerHook.java (rev 0)
+++ trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/ArchiveDeployerHook.java 2007-05-03 19:18:24 UTC (rev 2955)
@@ -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.jbossws;
+
+//$Id$
+
+import java.io.IOException;
+import java.net.URL;
+
+import org.jboss.deployment.DeploymentException;
+import org.jboss.deployment.DeploymentInfo;
+import org.jboss.ws.core.utils.DOMUtils;
+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.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;
+ }
+ }
+}
Property changes on: trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/ArchiveDeployerHook.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/ClassLoaderInjectionDeployer.java
===================================================================
--- trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/ClassLoaderInjectionDeployer.java (rev 0)
+++ trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/ClassLoaderInjectionDeployer.java 2007-05-03 19:18:24 UTC (rev 2955)
@@ -0,0 +1,62 @@
+/*
+ * 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.deployment.AbstractDeployer;
+import org.jboss.ws.integration.deployment.Deployment;
+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();
+ }
+
+ umd.setClassLoader(classLoader);
+ }
+}
\ No newline at end of file
Property changes on: trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/ClassLoaderInjectionDeployer.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Copied: trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/DeploymentInfoAdapter.java (from rev 2953, trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/DeploymentInfoAdapter.java)
===================================================================
--- trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/DeploymentInfoAdapter.java (rev 0)
+++ trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/DeploymentInfoAdapter.java 2007-05-03 19:18:24 UTC (rev 2955)
@@ -0,0 +1,117 @@
+/*
+ * 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 org.jboss.deployment.DeploymentInfo;
+import org.jboss.logging.Logger;
+import org.jboss.metadata.ApplicationMetaData;
+import org.jboss.metadata.WebMetaData;
+import org.jboss.ws.core.server.UnifiedDeploymentInfo;
+import org.jboss.ws.integration.ResourceLoaderAdapter;
+
+/**
+ * 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);
+ }
+ }
+}
Copied: trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/DeploymentInfoAdapterFactory.java (from rev 2953, trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/DeploymentInfoAdapterFactory.java)
===================================================================
--- trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/DeploymentInfoAdapterFactory.java (rev 0)
+++ trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/DeploymentInfoAdapterFactory.java 2007-05-03 19:18:24 UTC (rev 2955)
@@ -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.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("DeploymentInfoAdapter");
+ return (DeploymentInfoAdapter)entry.getTarget();
+ }
+}
Added: trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/EagerInitializeDeployer.java
===================================================================
--- trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/EagerInitializeDeployer.java (rev 0)
+++ trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/EagerInitializeDeployer.java 2007-05-03 19:18:24 UTC (rev 2955)
@@ -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.jbossws;
+
+//$Id$
+
+import org.jboss.ws.integration.deployment.AbstractDeployer;
+import org.jboss.ws.integration.deployment.Deployment;
+import org.jboss.ws.metadata.umdm.UnifiedMetaData;
+
+/**
+ * A deployer that initializes the UMDM
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 25-Apr-2007
+ */
+public class EagerInitializeDeployer extends AbstractDeployer
+{
+ @Override
+ public void create(Deployment dep)
+ {
+ UnifiedMetaData umd = dep.getContext().getAttachment(UnifiedMetaData.class);
+ if (umd == null)
+ throw new IllegalStateException("Cannot obtain unified meta data");
+
+ umd.eagerInitialize();
+ }
+}
\ No newline at end of file
Property changes on: trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/EagerInitializeDeployer.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/EndpointHandlerDeployer.java
===================================================================
--- trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/EndpointHandlerDeployer.java (rev 0)
+++ trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/EndpointHandlerDeployer.java 2007-05-03 19:18:24 UTC (rev 2955)
@@ -0,0 +1,115 @@
+/*
+ * 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.Map;
+
+import org.jboss.ws.integration.Endpoint;
+import org.jboss.ws.integration.LifecycleHandler;
+import org.jboss.ws.integration.RequestHandler;
+import org.jboss.ws.integration.deployment.AbstractDeployer;
+import org.jboss.ws.integration.deployment.Deployment;
+import org.jboss.ws.integration.invocation.InvocationHandler;
+
+/**
+ * A deployer that assigns the handlers to the Endpoint
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 25-Apr-2007
+ */
+public class EndpointHandlerDeployer extends AbstractDeployer
+{
+ private String requestHandler;
+ private String lifecycleHandler;
+ private Map<String,String> invocationHandler;
+
+ public void setLifecycleHandler(String handler)
+ {
+ this.lifecycleHandler = handler;
+ }
+
+ public void setRequestHandler(String handler)
+ {
+ this.requestHandler = handler;
+ }
+
+ public void setInvocationHandler(Map<String,String> handlers)
+ {
+ this.invocationHandler = handlers;
+ }
+
+ @Override
+ public void create(Deployment dep)
+ {
+ for (Endpoint ep : dep.getService().getEndpoints())
+ {
+ ep.setRequestHandler(getRequestHandler(dep));
+ ep.setLifecycleHandler(getLifecycleHandler(dep));
+ ep.setInvocationHandler(getInvocationHandler(dep));
+ }
+ }
+
+ private RequestHandler getRequestHandler(Deployment dep)
+ {
+ try
+ {
+ Class<?> handlerClass = dep.getClassLoader().loadClass(requestHandler);
+ return (RequestHandler)handlerClass.newInstance();
+ }
+ catch (Exception e)
+ {
+ throw new IllegalStateException("Cannot load request handler: " + requestHandler);
+ }
+ }
+
+ private LifecycleHandler getLifecycleHandler(Deployment dep)
+ {
+ try
+ {
+ Class<?> handlerClass = dep.getClassLoader().loadClass(lifecycleHandler);
+ return (LifecycleHandler)handlerClass.newInstance();
+ }
+ catch (Exception e)
+ {
+ throw new IllegalStateException("Cannot load lifecycle handler: " + lifecycleHandler);
+ }
+ }
+
+ private InvocationHandler getInvocationHandler(Deployment dep)
+ {
+ String className = invocationHandler.get(dep.getType().toString());
+ if (className == null)
+ throw new IllegalStateException("Cannot obtain invocation handler for: " + dep.getType());
+
+ try
+ {
+ Class<?> handlerClass = dep.getClassLoader().loadClass(className);
+ return (InvocationHandler)handlerClass.newInstance();
+ }
+ catch (Exception e)
+ {
+ throw new IllegalStateException("Cannot load invocation handler: " + className);
+ }
+ }
+}
\ No newline at end of file
Property changes on: trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/EndpointHandlerDeployer.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/EndpointLifecycleDeployer.java
===================================================================
--- trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/EndpointLifecycleDeployer.java (rev 0)
+++ trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/EndpointLifecycleDeployer.java 2007-05-03 19:18:24 UTC (rev 2955)
@@ -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.jbossws;
+
+//$Id$
+
+import org.jboss.ws.integration.Endpoint;
+import org.jboss.ws.integration.Service;
+import org.jboss.ws.integration.deployment.AbstractDeployer;
+import org.jboss.ws.integration.deployment.Deployment;
+
+/**
+ * A deployer that that calls the endpoint lifecycle handler
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 25-Apr-2007
+ */
+public class EndpointLifecycleDeployer extends AbstractDeployer
+{
+ @Override
+ public void create(Deployment dep)
+ {
+ for (Endpoint ep : dep.getService().getEndpoints())
+ ep.getLifecycleHandler().create(ep);
+ }
+
+ @Override
+ public void start(Deployment dep)
+ {
+ for (Endpoint ep : dep.getService().getEndpoints())
+ {
+ ep.getLifecycleHandler().start(ep);
+ }
+ }
+
+ @Override
+ public void stop(Deployment dep)
+ {
+ Service service = dep.getService();
+ if (service != null)
+ {
+ for (Endpoint ep : service.getEndpoints())
+ {
+ ep.getLifecycleHandler().stop(ep);
+ }
+ }
+ }
+
+ @Override
+ public void destroy(Deployment dep)
+ {
+ Service service = dep.getService();
+ if (service != null)
+ {
+ for (Endpoint ep : service.getEndpoints())
+ {
+ ep.getLifecycleHandler().destroy(ep);
+ }
+ }
+ }
+}
Property changes on: trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/EndpointLifecycleDeployer.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/EndpointNameDeployer.java
===================================================================
--- trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/EndpointNameDeployer.java (rev 0)
+++ trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/EndpointNameDeployer.java 2007-05-03 19:18:24 UTC (rev 2955)
@@ -0,0 +1,54 @@
+/*
+ * 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.management.ObjectName;
+
+import org.jboss.ws.integration.Endpoint;
+import org.jboss.ws.integration.deployment.AbstractDeployer;
+import org.jboss.ws.integration.deployment.Deployment;
+import org.jboss.ws.metadata.umdm.ServerEndpointMetaData;
+
+/**
+ * A deployer that assigns the complete name to the Endpoint
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 25-Apr-2007
+ */
+public class EndpointNameDeployer extends AbstractDeployer
+{
+ @Override
+ public void create(Deployment dep)
+ {
+ for (Endpoint ep : dep.getService().getEndpoints())
+ {
+ ServerEndpointMetaData sepMetaData = ep.getMetaData(ServerEndpointMetaData.class);
+ if (sepMetaData == null)
+ throw new IllegalStateException("Cannot obtain endpoint meta data");
+
+ ObjectName sepID = sepMetaData.getServiceEndpointID();
+ ep.setName(sepID);
+ }
+ }
+}
\ No newline at end of file
Property changes on: trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/EndpointNameDeployer.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/InvocationHandlerEJB21.java
===================================================================
--- trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/InvocationHandlerEJB21.java (rev 0)
+++ trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/InvocationHandlerEJB21.java 2007-05-03 19:18:24 UTC (rev 2955)
@@ -0,0 +1,266 @@
+/*
+ * 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.lang.reflect.Method;
+import java.security.Principal;
+
+import javax.management.MBeanServer;
+import javax.management.ObjectName;
+
+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.WSException;
+import org.jboss.ws.core.CommonMessageContext;
+import org.jboss.ws.core.EndpointInvocation;
+import org.jboss.ws.core.jaxrpc.handler.HandlerCallback;
+import org.jboss.ws.core.jaxrpc.handler.SOAPMessageContextJAXRPC;
+import org.jboss.ws.core.server.UnifiedDeploymentInfo;
+import org.jboss.ws.core.soap.MessageContextAssociation;
+import org.jboss.ws.integration.Endpoint;
+import org.jboss.ws.integration.ObjectNameFactory;
+import org.jboss.ws.integration.invocation.InvocationContext;
+import org.jboss.ws.metadata.j2ee.UnifiedApplicationMetaData;
+import org.jboss.ws.metadata.j2ee.UnifiedBeanMetaData;
+import org.jboss.ws.metadata.umdm.ServerEndpointMetaData;
+import org.jboss.ws.metadata.umdm.EndpointMetaData.Type;
+import org.jboss.ws.metadata.umdm.HandlerMetaData.HandlerType;
+
+/**
+ * Handles invocations on EJB21 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;
+
+ /** Initialize the service endpoint */
+ @Override
+ public void init(Endpoint endpoint)
+ {
+ super.init(endpoint);
+
+ server = MBeanServerLocator.locateJBoss();
+
+ ServerEndpointMetaData sepMetaData = endpoint.getMetaData(ServerEndpointMetaData.class);
+ if (sepMetaData == null)
+ throw new IllegalStateException("Cannot obtain endpoint meta data");
+
+ String ejbName = sepMetaData.getLinkName();
+ if (ejbName == null)
+ throw new WSException("Cannot obtain ejb-link from port component");
+
+ UnifiedDeploymentInfo udi = endpoint.getService().getDeployment().getContext().getAttachment(UnifiedDeploymentInfo.class);
+ UnifiedApplicationMetaData applMetaData = (UnifiedApplicationMetaData)udi.metaData;
+ UnifiedBeanMetaData beanMetaData = (UnifiedBeanMetaData)applMetaData.getBeanByEjbName(ejbName);
+ if (beanMetaData == null)
+ throw new WSException("Cannot obtain ejb meta data for: " + ejbName);
+
+ // verify the service endpoint
+ String seiName = sepMetaData.getServiceEndpointInterfaceName();
+ if (sepMetaData.getType() == Type.JAXRPC && seiName != null)
+ {
+ String bmdSEI = beanMetaData.getServiceEndpointInterface();
+ if (seiName.equals(bmdSEI) == false)
+ throw new WSException("Endpoint meta data defines SEI '" + seiName + "', <service-endpoint> in ejb-jar.xml defines '" + bmdSEI + "'");
+ }
+
+ // get the bean's JNDI name
+ jndiName = beanMetaData.getContainerObjectNameJndiName();
+ if (jndiName == null)
+ throw new WSException("Cannot obtain JNDI name for: " + ejbName);
+
+ objectName = ObjectNameFactory.create("jboss.j2ee:jndiName=" + jndiName + ",service=EJB");
+
+ // 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);
+ }
+ }
+
+ /** Load the SEI implementation bean if necessary
+ */
+ public Class loadServiceEndpoint()
+ {
+ if (server.isRegistered(objectName) == false)
+ throw new WSException("Cannot find service endpoint target: " + objectName);
+
+ return null;
+ }
+
+ /** Create an instance of the SEI implementation bean if necessary */
+ @Override
+ protected Object createServiceEndpointInstance(Class seiImplClass, InvocationContext context) throws Exception
+ {
+ return null;
+ }
+
+ /** Invoke an instance of the SEI implementation bean */
+ public void invokeServiceEndpointInstance(Object seiImpl, EndpointInvocation epInv) throws Exception
+ {
+ log.debug("invokeServiceEndpoint: " + epInv.getJavaMethod().getName());
+
+ // these are provided by the ServerLoginHandler
+ Principal principal = SecurityAssociation.getPrincipal();
+ Object credential = SecurityAssociation.getCredential();
+
+ CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
+
+ // invoke on the container
+ try
+ {
+ // setup the invocation
+ Method method = epInv.getJavaMethod();
+ Object[] args = epInv.getRequestPayload();
+ Invocation inv = new Invocation(null, method, args, null, principal, credential);
+
+ // EJB2.1 endpoints will only get an JAXRPC context
+ if ((msgContext instanceof javax.xml.rpc.handler.MessageContext) == false)
+ msgContext = new SOAPMessageContextJAXRPC(msgContext);
+
+ inv.setValue(InvocationKey.SOAP_MESSAGE_CONTEXT, msgContext);
+ inv.setValue(InvocationKey.SOAP_MESSAGE, msgContext.getSOAPMessage());
+ inv.setType(InvocationType.SERVICE_ENDPOINT);
+
+ // Set the handler callback and endpoint invocation
+ ServerEndpointMetaData sepMetaData = endpoint.getMetaData(ServerEndpointMetaData.class);
+ inv.setValue(HandlerCallback.class.getName(), new HandlerCallbackImpl(sepMetaData), PayloadKey.TRANSIENT);
+ inv.setValue(EndpointInvocation.class.getName(), epInv, PayloadKey.TRANSIENT);
+
+ String[] sig = { Invocation.class.getName() };
+ Object retObj = server.invoke(objectName, "invoke", new Object[] { inv }, sig);
+ epInv.setReturnValue(retObj);
+ }
+ catch (Exception e)
+ {
+ handleInvocationException(e);
+ }
+ }
+
+ /** Create an instance of the SEI implementation bean if necessary */
+ public void destroyServiceEndpointInstance(Object seiImpl)
+ {
+ // do nothing
+ }
+
+ /** Handlers are beeing called through the HandlerCallback from the EJB interceptor */
+ @Override
+ public boolean callRequestHandlerChain(ServerEndpointMetaData sepMetaData, HandlerType type)
+ {
+ if (type == HandlerType.PRE)
+ return delegate.callRequestHandlerChain(sepMetaData, type);
+ else return true;
+ }
+
+ /** Handlers are beeing called through the HandlerCallback from the EJB interceptor */
+ public boolean callResponseHandlerChain(ServerEndpointMetaData sepMetaData, HandlerType type)
+ {
+ if (type == HandlerType.PRE)
+ return delegate.callResponseHandlerChain(sepMetaData, type);
+ else return true;
+ }
+
+ /** Handlers are beeing called through the HandlerCallback from the EJB interceptor */
+ public boolean callFaultHandlerChain(ServerEndpointMetaData sepMetaData, HandlerType type, Exception ex)
+ {
+ if (type == HandlerType.PRE)
+ return delegate.callFaultHandlerChain(sepMetaData, type, ex);
+ else return true;
+ }
+
+ // The ServiceEndpointInterceptor calls the methods in this callback
+ public class HandlerCallbackImpl implements HandlerCallback
+ {
+ private ServerEndpointMetaData sepMetaData;
+
+ public HandlerCallbackImpl(ServerEndpointMetaData sepMetaData)
+ {
+ this.sepMetaData = sepMetaData;
+ }
+
+ /** Handlers are beeing called through the HandlerCallback from the EJB interceptor */
+ public boolean callRequestHandlerChain(HandlerType type)
+ {
+ if (type == HandlerType.PRE)
+ return true;
+ else return delegate.callRequestHandlerChain(sepMetaData, type);
+ }
+
+ /** Handlers are beeing called through the HandlerCallback from the EJB interceptor */
+ public boolean callResponseHandlerChain(HandlerType type)
+ {
+ if (type == HandlerType.PRE)
+ return true;
+ else return delegate.callResponseHandlerChain(sepMetaData, type);
+ }
+
+ /** Handlers are beeing called through the HandlerCallback from the EJB interceptor */
+ public boolean callFaultHandlerChain(HandlerType type, Exception ex)
+ {
+ if (type == HandlerType.PRE)
+ return true;
+ else return delegate.callFaultHandlerChain(sepMetaData, type, ex);
+ }
+ }
+}
Property changes on: trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/InvocationHandlerEJB21.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/InvocationHandlerEJB3.java
===================================================================
--- trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/InvocationHandlerEJB3.java (rev 0)
+++ trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/InvocationHandlerEJB3.java 2007-05-03 19:18:24 UTC (rev 2955)
@@ -0,0 +1,191 @@
+/*
+ * 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.lang.reflect.Method;
+
+import javax.ejb.EJBContext;
+import javax.management.ObjectName;
+
+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.logging.Logger;
+import org.jboss.ws.WSException;
+import org.jboss.ws.core.CommonMessageContext;
+import org.jboss.ws.core.EndpointInvocation;
+import org.jboss.ws.core.jaxrpc.handler.SOAPMessageContextJAXRPC;
+import org.jboss.ws.core.jaxws.WebServiceContextEJB;
+import org.jboss.ws.core.jaxws.handler.SOAPMessageContextJAXWS;
+import org.jboss.ws.core.server.UnifiedDeploymentInfo;
+import org.jboss.ws.core.soap.MessageContextAssociation;
+import org.jboss.ws.integration.Endpoint;
+import org.jboss.ws.integration.ObjectNameFactory;
+import org.jboss.ws.integration.invocation.InvocationContext;
+import org.jboss.ws.metadata.umdm.ServerEndpointMetaData;
+
+/**
+ * Handles invocations on EJB3 endpoints.
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 25-Apr-2007
+ */
+public class InvocationHandlerEJB3 extends AbstractInvocationHandler
+{
+ // provide logging
+ private static final Logger log = Logger.getLogger(InvocationHandlerEJB3.class);
+
+ private ObjectName objectName;
+
+ /** Initialize the service endpoint */
+ @Override
+ public void init(Endpoint endpoint)
+ {
+ super.init(endpoint);
+
+ ServerEndpointMetaData sepMetaData = endpoint.getMetaData(ServerEndpointMetaData.class);
+ if (sepMetaData == null)
+ throw new IllegalStateException("Cannot obtain endpoint meta data");
+
+ String ejbName = sepMetaData.getLinkName();
+ if (ejbName == null)
+ throw new WSException("Cannot obtain ejb-link from port component");
+
+ UnifiedDeploymentInfo udi = endpoint.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());
+ }
+
+ /** Load the SEI implementation bean if necessary
+ */
+ public Class loadServiceEndpoint()
+ {
+ Dispatcher dispatcher = Dispatcher.singleton;
+ if (dispatcher.getRegistered(objectName.getCanonicalName()) == null)
+ throw new WSException("Cannot find service endpoint target: " + objectName);
+
+ return null;
+ }
+
+ /** Create an instance of the SEI implementation bean if necessary */
+ @Override
+ protected Object createServiceEndpointInstance(Class seiImplClass, InvocationContext context) throws Exception
+ {
+ return null;
+ }
+
+ /** Invoke an instance of the SEI implementation bean */
+ public void invokeServiceEndpointInstance(Object seiImpl, EndpointInvocation epInv) throws Exception
+ {
+ log.debug("invokeServiceEndpoint: " + epInv.getJavaMethod().getName());
+
+ // invoke on the container
+ try
+ {
+ // setup the invocation
+ Method seiMethod = epInv.getJavaMethod();
+ Object[] args = epInv.getRequestPayload();
+
+ Dispatcher dispatcher = Dispatcher.singleton;
+ StatelessContainer container = (StatelessContainer)dispatcher.getRegistered(objectName.getCanonicalName());
+ Class beanClass = container.getBeanClass();
+
+ Method implMethod = getImplMethod(beanClass, seiMethod);
+ MethodInfo info = container.getMethodInfo(implMethod);
+
+ EJBContainerInvocation<StatelessContainer, StatelessBeanContext> ejb3Inv = new EJBContainerInvocation<StatelessContainer, StatelessBeanContext>(info);
+ ejb3Inv.setAdvisor(container);
+ ejb3Inv.setArguments(args);
+ ejb3Inv.setContextCallback(new ContextCallback());
+
+ Object retObj = ejb3Inv.invokeNext();
+
+ epInv.setReturnValue(retObj);
+ }
+ catch (Throwable th)
+ {
+ handleInvocationException(th);
+ }
+ }
+
+ /** Create an instance of the SEI implementation bean if necessary */
+ public void destroyServiceEndpointInstance(Object seiImpl)
+ {
+ // do nothing
+ }
+
+ class ContextCallback implements BeanContextLifecycleCallback
+ {
+ private SOAPMessageContextJAXWS jaxwsMessageContext;
+ private SOAPMessageContextJAXRPC jaxrpcMessageContext;
+
+ public ContextCallback()
+ {
+ CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
+ if (msgContext instanceof SOAPMessageContextJAXRPC)
+ {
+ jaxrpcMessageContext = (SOAPMessageContextJAXRPC)msgContext;
+ jaxwsMessageContext = new SOAPMessageContextJAXWS(msgContext);
+ }
+ else if (msgContext instanceof SOAPMessageContextJAXWS)
+ {
+ jaxwsMessageContext = (SOAPMessageContextJAXWS)msgContext;
+ jaxrpcMessageContext = new SOAPMessageContextJAXRPC(msgContext);
+ }
+ }
+
+ 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);
+ }
+ }
+}
Property changes on: trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/InvocationHandlerEJB3.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/InvocationHandlerJSE.java
===================================================================
--- trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/InvocationHandlerJSE.java (rev 0)
+++ trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/InvocationHandlerJSE.java 2007-05-03 19:18:24 UTC (rev 2955)
@@ -0,0 +1,126 @@
+/*
+ * 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.lang.reflect.Method;
+
+import javax.xml.rpc.ServiceException;
+import javax.xml.rpc.server.ServiceLifecycle;
+import javax.xml.rpc.server.ServletEndpointContext;
+import javax.xml.rpc.soap.SOAPFaultException;
+import javax.xml.ws.WebServiceContext;
+
+import org.jboss.logging.Logger;
+import org.jboss.ws.WSException;
+import org.jboss.ws.core.CommonMessageContext;
+import org.jboss.ws.core.EndpointInvocation;
+import org.jboss.ws.core.jaxrpc.ServletEndpointContextImpl;
+import org.jboss.ws.core.jaxws.WebServiceContextInjector;
+import org.jboss.ws.core.jaxws.WebServiceContextJSE;
+import org.jboss.ws.core.jaxws.handler.SOAPMessageContextJAXWS;
+import org.jboss.ws.core.server.ServletRequestContext;
+import org.jboss.ws.core.soap.MessageContextAssociation;
+import org.jboss.ws.integration.invocation.InvocationContext;
+import org.jboss.ws.metadata.umdm.ServerEndpointMetaData;
+
+/**
+ * Handles invocations on JSE endpoints.
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 25-Apr-2007
+ */
+public class InvocationHandlerJSE extends AbstractInvocationHandler
+{
+ // provide logging
+ private static final Logger log = Logger.getLogger(InvocationHandlerJSE.class);
+
+ /** Load the SEI implementation bean if necessary */
+ public Class loadServiceEndpoint() throws ClassNotFoundException
+ {
+ ServerEndpointMetaData sepMetaData = endpoint.getMetaData(ServerEndpointMetaData.class);
+ if (sepMetaData == null)
+ throw new IllegalStateException("Cannot obtain endpoint meta data");
+
+ ClassLoader cl = sepMetaData.getClassLoader();
+ String seiImplName = sepMetaData.getServiceEndpointImplName();
+ Class seiImplClass = cl.loadClass(seiImplName);
+ return seiImplClass;
+ }
+
+ /** Create an instance of the SEI implementation bean if necessary */
+ public Object createServiceEndpointInstance(Class seiImplClass, InvocationContext context) throws IllegalAccessException, InstantiationException
+ {
+ Object seiImpl = seiImplClass.newInstance();
+ if (seiImpl instanceof ServiceLifecycle && context != null)
+ {
+ try
+ {
+ ServiceLifecycle serviceLifecycle = ((ServiceLifecycle)seiImpl);
+ ServletEndpointContext servletEndpointContext = new ServletEndpointContextImpl((ServletRequestContext)context);
+ serviceLifecycle.init(servletEndpointContext);
+ }
+ catch (ServiceException ex)
+ {
+ throw new WSException(ex);
+ }
+ }
+ return seiImpl;
+ }
+
+ /** Invoke an instance of the SEI implementation bean */
+ public void invokeServiceEndpointInstance(Object seiImpl, EndpointInvocation epInv) throws SOAPFaultException, Exception
+ {
+ log.debug("invokeServiceEndpoint: " + epInv.getJavaMethod().getName());
+ try
+ {
+ CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
+ if (msgContext instanceof SOAPMessageContextJAXWS)
+ {
+ WebServiceContext wsContext = new WebServiceContextJSE((SOAPMessageContextJAXWS)msgContext);
+ new WebServiceContextInjector().injectContext(seiImpl, wsContext);
+ }
+
+ Class implClass = seiImpl.getClass();
+ Method seiMethod = epInv.getJavaMethod();
+ Method implMethod = getImplMethod(implClass, seiMethod);
+
+ Object[] args = epInv.getRequestPayload();
+ Object retObj = implMethod.invoke(seiImpl, args);
+ epInv.setReturnValue(retObj);
+ }
+ catch (Exception e)
+ {
+ handleInvocationException(e);
+ }
+ }
+
+ /** Destroy an instance of the SEI implementation bean if necessary */
+ public void destroyServiceEndpointInstance(Object seiImpl)
+ {
+ if (seiImpl instanceof ServiceLifecycle)
+ {
+ ((ServiceLifecycle)seiImpl).destroy();
+ }
+ }
+}
Property changes on: trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/InvocationHandlerJSE.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/JAXRPCDeployerHookEJB21.java
===================================================================
--- trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/JAXRPCDeployerHookEJB21.java (rev 0)
+++ trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/JAXRPCDeployerHookEJB21.java 2007-05-03 19:18:24 UTC (rev 2955)
@@ -0,0 +1,119 @@
+/*
+ * 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.EndpointImpl;
+import org.jboss.ws.integration.ObjectNameFactory;
+import org.jboss.ws.integration.Service;
+import org.jboss.ws.integration.deployment.Deployment;
+import org.jboss.ws.integration.deployment.DeploymentImpl;
+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;
+
+/**
+ * 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 = new DeploymentImpl();
+ 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 endpoint = new EndpointImpl(service, epBean);
+ String nameStr = Endpoint.SEPID_DOMAIN + ":" + Endpoint.SEPID_PROPERTY_ENDPOINT + "=" + ejbLink;
+ endpoint.setName(ObjectNameFactory.create(nameStr));
+
+ service.addEndpoint(endpoint);
+ }
+ 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
Property changes on: trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/JAXRPCDeployerHookEJB21.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/JAXRPCDeployerHookJSE.java
===================================================================
--- trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/JAXRPCDeployerHookJSE.java (rev 0)
+++ trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/JAXRPCDeployerHookJSE.java 2007-05-03 19:18:24 UTC (rev 2955)
@@ -0,0 +1,140 @@
+/*
+ * 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.EndpointImpl;
+import org.jboss.ws.integration.ObjectNameFactory;
+import org.jboss.ws.integration.Service;
+import org.jboss.ws.integration.deployment.Deployment;
+import org.jboss.ws.integration.deployment.DeploymentImpl;
+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;
+
+/**
+ * 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 = new DeploymentImpl();
+ 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 = unit.annotationsCl;
+ Class<?> epBean = loader.loadClass(servletClass.trim());
+
+ // Create the endpoint
+ Endpoint endpoint = new EndpointImpl(service, epBean);
+ String nameStr = Endpoint.SEPID_DOMAIN + ":" + Endpoint.SEPID_PROPERTY_ENDPOINT + "=" + servletLink;
+ endpoint.setName(ObjectNameFactory.create(nameStr));
+
+ service.addEndpoint(endpoint);
+ }
+ 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;
+ }
+}
Property changes on: trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/JAXRPCDeployerHookJSE.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/JAXWSDeployerHookEJB3.java
===================================================================
--- trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/JAXWSDeployerHookEJB3.java (rev 0)
+++ trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/JAXWSDeployerHookEJB3.java 2007-05-03 19:18:24 UTC (rev 2955)
@@ -0,0 +1,133 @@
+/*
+ * 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.util.Iterator;
+
+import javax.jws.WebService;
+import javax.xml.ws.WebServiceProvider;
+
+import org.jboss.deployment.DeploymentInfo;
+import org.jboss.ejb3.EJBContainer;
+import org.jboss.ejb3.Ejb3Deployment;
+import org.jboss.ejb3.stateless.StatelessContainer;
+import org.jboss.util.NotImplementedException;
+import org.jboss.ws.integration.Endpoint;
+import org.jboss.ws.integration.EndpointImpl;
+import org.jboss.ws.integration.ObjectNameFactory;
+import org.jboss.ws.integration.ResourceLoaderAdapter;
+import org.jboss.ws.integration.Service;
+import org.jboss.ws.integration.UnifiedVirtualFile;
+import org.jboss.ws.integration.deployment.Deployment;
+import org.jboss.ws.integration.deployment.DeploymentImpl;
+import org.jboss.ws.integration.deployment.Deployment.DeploymentType;
+
+/**
+ * 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 = new DeploymentImpl();
+ dep.setType(getDeploymentType());
+ dep.setClassLoader(unit.ucl);
+
+ Service service = dep.getService();
+
+ Ejb3Deployment ejb3Deployment = (Ejb3Deployment)unit.context.get(Ejb3Deployment.class);
+ if (ejb3Deployment == null)
+ throw new IllegalStateException("Deployment unit does not contain ejb3 deployment");
+
+ // Copy the attachments
+ dep.getContext().addAttachment(Ejb3Deployment.class, ejb3Deployment);
+
+ Iterator it = ejb3Deployment.getEjbContainers().values().iterator();
+ while (it.hasNext())
+ {
+ EJBContainer container = (EJBContainer)it.next();
+ if (isWebServiceBean(container))
+ {
+ String ejbName = container.getEjbName();
+ Class epBean = container.getBeanClass();
+
+ // Create the endpoint
+ Endpoint endpoint = new EndpointImpl(service, epBean);
+ String nameStr = Endpoint.SEPID_DOMAIN + ":" + Endpoint.SEPID_PROPERTY_ENDPOINT + "=" + ejbName;
+ endpoint.setName(ObjectNameFactory.create(nameStr));
+
+ service.addEndpoint(endpoint);
+ }
+ }
+
+ return dep;
+ }
+
+ @Override
+ public boolean isWebServiceDeployment(DeploymentInfo unit)
+ {
+ Ejb3Deployment ejb3Deployment = (Ejb3Deployment)unit.context.get(Ejb3Deployment.class);
+ if (ejb3Deployment == null)
+ return false;
+
+ boolean isWebServiceDeployment = false;
+
+ Iterator it = ejb3Deployment.getEjbContainers().values().iterator();
+ while (it.hasNext())
+ {
+ EJBContainer container = (EJBContainer)it.next();
+ 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
Property changes on: trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/JAXWSDeployerHookEJB3.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/JAXWSDeployerHookJSE.java
===================================================================
--- trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/JAXWSDeployerHookJSE.java (rev 0)
+++ trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/JAXWSDeployerHookJSE.java 2007-05-03 19:18:24 UTC (rev 2955)
@@ -0,0 +1,158 @@
+/*
+ * 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.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.EndpointImpl;
+import org.jboss.ws.integration.ObjectNameFactory;
+import org.jboss.ws.integration.ResourceLoaderAdapter;
+import org.jboss.ws.integration.Service;
+import org.jboss.ws.integration.UnifiedVirtualFile;
+import org.jboss.ws.integration.deployment.Deployment;
+import org.jboss.ws.integration.deployment.DeploymentImpl;
+import org.jboss.ws.integration.deployment.Deployment.DeploymentType;
+
+/**
+ * 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 = new DeploymentImpl();
+ dep.setType(getDeploymentType());
+ dep.setClassLoader(unit.annotationsCl);
+
+ Service service = dep.getService();
+
+ WebMetaData webMetaData = (WebMetaData)unit.context.get(WebMetaData.class);
+ 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.ucl);
+ 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 endpoint = new EndpointImpl(service, epBean);
+ String nameStr = Endpoint.SEPID_DOMAIN + ":" + Endpoint.SEPID_PROPERTY_ENDPOINT + "=" + servletName;
+ endpoint.setName(ObjectNameFactory.create(nameStr));
+
+ service.addEndpoint(endpoint);
+ }
+ 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.ucl);
+ 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
Property changes on: trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/JAXWSDeployerHookJSE.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/LifecycleHandlerImpl.java
===================================================================
--- trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/LifecycleHandlerImpl.java (rev 0)
+++ trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/LifecycleHandlerImpl.java 2007-05-03 19:18:24 UTC (rev 2955)
@@ -0,0 +1,57 @@
+/*
+ * 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.metadata.umdm.ServerEndpointMetaData;
+
+/**
+ * A lifecycle handler
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 25-Apr-2007
+ */
+public class LifecycleHandlerImpl extends org.jboss.ws.integration.LifecycleHandlerImpl
+{
+ public void start(Endpoint endpoint)
+ {
+ super.start(endpoint);
+ log.info("WebService started: " + getEndpointAddress(endpoint));
+ }
+
+ public void stop(Endpoint endpoint)
+ {
+ super.stop(endpoint);
+ log.info("WebService stoped: " + getEndpointAddress(endpoint));
+ }
+
+ private String getEndpointAddress(Endpoint ep)
+ {
+ ServerEndpointMetaData sepMetaData = ep.getMetaData(ServerEndpointMetaData.class);
+ if (sepMetaData == null)
+ throw new IllegalStateException("Cannot obtain endpoint meta data");
+
+ return sepMetaData.getEndpointAddress();
+ }
+}
Property changes on: trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/LifecycleHandlerImpl.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/MainDeployerHook.java
===================================================================
--- trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/MainDeployerHook.java (rev 0)
+++ trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/MainDeployerHook.java 2007-05-03 19:18:24 UTC (rev 2955)
@@ -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.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);
+ }
+ }
+}
Property changes on: trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/MainDeployerHook.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/ModifyWebMetaDataDeployer.java
===================================================================
--- trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/ModifyWebMetaDataDeployer.java (rev 0)
+++ trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/ModifyWebMetaDataDeployer.java 2007-05-03 19:18:24 UTC (rev 2955)
@@ -0,0 +1,54 @@
+/*
+ * 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.core.server.ServiceEndpointPublisher;
+import org.jboss.ws.core.server.UnifiedDeploymentInfo;
+import org.jboss.ws.integration.deployment.AbstractDeployer;
+import org.jboss.ws.integration.deployment.Deployment;
+
+/**
+ * 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");
+
+ serviceEndpointPublisher.rewriteWebXml(udi);
+ }
+}
\ No newline at end of file
Property changes on: trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/ModifyWebMetaDataDeployer.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Copied: trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/PortComponentLinkServlet.java (from rev 2953, trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/PortComponentLinkServlet.java)
===================================================================
--- trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/PortComponentLinkServlet.java (rev 0)
+++ trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/PortComponentLinkServlet.java 2007-05-03 19:18:24 UTC (rev 2955)
@@ -0,0 +1,93 @@
+/*
+ * 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.io.PrintWriter;
+
+import javax.servlet.ServletConfig;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.jboss.logging.Logger;
+import org.jboss.ws.WSException;
+import org.jboss.ws.core.server.legacy.ServiceEndpoint;
+import org.jboss.ws.core.server.legacy.ServiceEndpointManager;
+import org.jboss.ws.core.server.legacy.ServiceEndpointManagerFactory;
+
+/**
+ * A servlet that reports the serviceURL for a given service ID.
+ * <p/>
+ * When the web service client ENC is setup, it may contain port-component-link
+ * entries that point to service endpoints in the same top level deployment.
+ * The final serviceURL of those endpoints will become available after the
+ * reference to the javax.xml.rpc.Service is bound to JNDI.
+ * <p/>
+ * When the client does a lookup of the javax.xml.rpc.Service from JNDI the ObjectFactory
+ * will contact this servlet for the final serviceURL. It is acceptable that the client
+ * wsdl does not contain the correct serviceURL if the client is using the port-component-link element.
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 29-May-2004
+ */
+public class PortComponentLinkServlet extends HttpServlet
+{
+ // provide logging
+ private static final Logger log = Logger.getLogger(PortComponentLinkServlet.class);
+
+ protected ServiceEndpointManager epManager;
+
+ public void init(ServletConfig config) throws ServletException
+ {
+ super.init(config);
+ ServiceEndpointManagerFactory factory = ServiceEndpointManagerFactory.getInstance();
+ epManager = factory.getServiceEndpointManager();
+ }
+
+ /**
+ * Get the serviceURL as string for a given serviceID.
+ */
+ public void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException
+ {
+ String pcLink = req.getParameter("pcLink");
+ if (pcLink == null)
+ throw new IllegalArgumentException("Cannot obtain request parameter 'pcLink'");
+
+ ServiceEndpoint serviceEndpoint = epManager.resolvePortComponentLink(pcLink);
+ ;
+ if (serviceEndpoint == null)
+ throw new WSException("Cannot resolve port-component-link: " + pcLink);
+
+ res.setContentType("text/plain");
+ PrintWriter out = res.getWriter();
+
+ String endpointAddress = serviceEndpoint.getServiceEndpointInfo().getServerEndpointMetaData().getEndpointAddress();
+ out.println(endpointAddress);
+
+ log.debug("Resolved " + pcLink + " to: " + endpointAddress);
+ out.close();
+ }
+}
Added: trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/PublishContractDeployer.java
===================================================================
--- trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/PublishContractDeployer.java (rev 0)
+++ trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/PublishContractDeployer.java 2007-05-03 19:18:24 UTC (rev 2955)
@@ -0,0 +1,64 @@
+/*
+ * 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 org.jboss.ws.core.server.UnifiedDeploymentInfo;
+import org.jboss.ws.core.server.WSDLFilePublisher;
+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 publishes the wsdl
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 25-Apr-2007
+ */
+public class PublishContractDeployer extends AbstractDeployer
+{
+ @Override
+ public void create(Deployment dep)
+ {
+ UnifiedDeploymentInfo udi = dep.getContext().getAttachment(UnifiedDeploymentInfo.class);
+ if (udi == null)
+ throw new IllegalStateException("Cannot obtain unified deployement info");
+
+ UnifiedMetaData umd = dep.getContext().getAttachment(UnifiedMetaData.class);
+ if (umd == null)
+ throw new IllegalStateException("Cannot obtain unified meta data");
+
+ try
+ {
+ WSDLFilePublisher publisher = new WSDLFilePublisher(udi);
+ publisher.publishWsdlFiles(umd);
+ }
+ catch (IOException ex)
+ {
+ throw new WSDeploymentException(ex);
+ }
+ }
+}
\ No newline at end of file
Property changes on: trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/PublishContractDeployer.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/RequestHandlerImpl.java
===================================================================
--- trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/RequestHandlerImpl.java (rev 0)
+++ trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/RequestHandlerImpl.java 2007-05-03 19:18:24 UTC (rev 2955)
@@ -0,0 +1,415 @@
+/*
+ * 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.io.InputStream;
+import java.io.OutputStream;
+import java.io.OutputStreamWriter;
+import java.net.URL;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.activation.DataHandler;
+import javax.servlet.ServletContext;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.xml.namespace.QName;
+import javax.xml.rpc.soap.SOAPFaultException;
+import javax.xml.soap.MimeHeaders;
+import javax.xml.soap.SOAPEnvelope;
+import javax.xml.soap.SOAPException;
+import javax.xml.soap.SOAPMessage;
+import javax.xml.soap.SOAPPart;
+import javax.xml.ws.addressing.AddressingProperties;
+import javax.xml.ws.addressing.JAXWSAConstants;
+import javax.xml.ws.http.HTTPBinding;
+
+import org.jboss.logging.Logger;
+import org.jboss.ws.Constants;
+import org.jboss.ws.WSException;
+import org.jboss.ws.core.CommonBinding;
+import org.jboss.ws.core.CommonBindingProvider;
+import org.jboss.ws.core.CommonMessageContext;
+import org.jboss.ws.core.HTTPMessageImpl;
+import org.jboss.ws.core.MessageAbstraction;
+import org.jboss.ws.core.MessageTrace;
+import org.jboss.ws.core.jaxrpc.binding.BindingException;
+import org.jboss.ws.core.jaxrpc.handler.MessageContextJAXRPC;
+import org.jboss.ws.core.jaxrpc.handler.SOAPMessageContextJAXRPC;
+import org.jboss.ws.core.jaxws.handler.MessageContextJAXWS;
+import org.jboss.ws.core.jaxws.handler.SOAPMessageContextJAXWS;
+import org.jboss.ws.core.server.MimeHeaderSource;
+import org.jboss.ws.core.server.ServletHeaderSource;
+import org.jboss.ws.core.server.ServletRequestContext;
+import org.jboss.ws.core.server.WSDLRequestHandler;
+import org.jboss.ws.core.soap.MessageContextAssociation;
+import org.jboss.ws.core.soap.MessageFactoryImpl;
+import org.jboss.ws.core.soap.SOAPConnectionImpl;
+import org.jboss.ws.core.soap.SOAPMessageImpl;
+import org.jboss.ws.core.utils.DOMWriter;
+import org.jboss.ws.core.utils.ThreadLocalAssociation;
+import org.jboss.ws.extensions.addressing.AddressingConstantsImpl;
+import org.jboss.ws.extensions.xop.XOPContext;
+import org.jboss.ws.integration.Endpoint;
+import org.jboss.ws.integration.RequestHandler;
+import org.jboss.ws.integration.Endpoint.EndpointState;
+import org.jboss.ws.integration.invocation.InvocationContext;
+import org.jboss.ws.integration.invocation.InvocationHandler;
+import org.jboss.ws.integration.management.ServerConfig;
+import org.jboss.ws.integration.management.ServerConfigFactory;
+import org.jboss.ws.metadata.umdm.EndpointMetaData;
+import org.jboss.ws.metadata.umdm.ServerEndpointMetaData;
+import org.jboss.ws.metadata.umdm.EndpointMetaData.Type;
+import org.w3c.dom.Document;
+
+/**
+ * A request handler
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 25-Apr-2007
+ */
+public class RequestHandlerImpl implements RequestHandler
+{
+ // provide logging
+ private static final Logger log = Logger.getLogger(RequestHandlerImpl.class);
+
+ public void handleRequest(Endpoint endpoint, InputStream inputStream, OutputStream outputStream, InvocationContext context)
+ {
+ log.debug("handleRequest: " + endpoint.getName());
+
+ ServerEndpointMetaData sepMetaData = endpoint.getMetaData(ServerEndpointMetaData.class);
+ if (sepMetaData == null)
+ throw new IllegalStateException("Cannot obtain endpoint meta data");
+
+ ServletRequestContext reqContext = (ServletRequestContext)context;
+
+ Type type = sepMetaData.getType();
+
+ ServletContext servletContext = reqContext.getServletContext();
+ HttpServletRequest httpRequest = reqContext.getHttpServletRequest();
+ HttpServletResponse httpResponse = reqContext.getHttpServletResponse();
+ ServletHeaderSource headerSource = new ServletHeaderSource(httpRequest, httpResponse);
+
+ // Build the message context
+ CommonMessageContext msgContext;
+ if (type == EndpointMetaData.Type.JAXRPC)
+ {
+ msgContext = new SOAPMessageContextJAXRPC();
+ msgContext.put(MessageContextJAXRPC.SERVLET_CONTEXT, servletContext);
+ msgContext.put(MessageContextJAXRPC.SERVLET_REQUEST, httpRequest);
+ msgContext.put(MessageContextJAXRPC.SERVLET_RESPONSE, httpResponse);
+ }
+ else
+ {
+ msgContext = new SOAPMessageContextJAXWS();
+ msgContext.put(MessageContextJAXWS.MESSAGE_OUTBOUND_PROPERTY, new Boolean(false));
+ msgContext.put(MessageContextJAXWS.INBOUND_MESSAGE_ATTACHMENTS, new HashMap<String, DataHandler>());
+ msgContext.put(MessageContextJAXWS.HTTP_REQUEST_HEADERS, headerSource.getHeaderMap());
+ msgContext.put(MessageContextJAXWS.HTTP_REQUEST_METHOD, httpRequest.getMethod());
+ msgContext.put(MessageContextJAXWS.QUERY_STRING, httpRequest.getQueryString());
+ msgContext.put(MessageContextJAXWS.PATH_INFO, httpRequest.getPathInfo());
+ msgContext.put(MessageContextJAXWS.SERVLET_CONTEXT, servletContext);
+ msgContext.put(MessageContextJAXWS.SERVLET_REQUEST, httpRequest);
+ msgContext.put(MessageContextJAXWS.SERVLET_RESPONSE, httpResponse);
+
+ }
+ msgContext.setEndpointMetaData(sepMetaData);
+
+ // Associate a message context with the current thread
+ MessageContextAssociation.pushMessageContext(msgContext);
+
+ try
+ {
+ MessageAbstraction resMessage = processRequest(endpoint, headerSource, reqContext, inputStream);
+
+ // Replace the message context with the response context
+ msgContext = MessageContextAssociation.peekMessageContext();
+
+ Map<String, List<String>> headers = (Map<String, List<String>>)msgContext.get(MessageContextJAXWS.HTTP_RESPONSE_HEADERS);
+ if (headers != null)
+ headerSource.setHeaderMap(headers);
+
+ Integer code = (Integer)msgContext.get(MessageContextJAXWS.HTTP_RESPONSE_CODE);
+ if (code != null)
+ httpResponse.setStatus(code.intValue());
+
+ boolean isFault = false;
+ if (resMessage instanceof SOAPMessage)
+ {
+ SOAPPart part = ((SOAPMessage)resMessage).getSOAPPart();
+ if (part == null)
+ throw new SOAPException("Cannot obtain SOAPPart from response message");
+
+ // R1126 An INSTANCE MUST return a "500 Internal Server Error" HTTP status code
+ // if the response envelope is a Fault.
+ //
+ // Also, a one-way operation must show up as empty content, and can be detected
+ // by a null envelope.
+ SOAPEnvelope soapEnv = part.getEnvelope();
+ isFault = soapEnv != null && soapEnv.getBody().hasFault();
+ if (isFault && httpResponse != null)
+ {
+ httpResponse.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
+ }
+ }
+
+ sendResponse(outputStream, msgContext, isFault);
+ }
+ catch (Exception ex)
+ {
+ WSException.rethrow(ex);
+ }
+ finally
+ {
+ // Reset the message context association
+ MessageContextAssociation.popMessageContext();
+
+ // clear thread local storage
+ ThreadLocalAssociation.clear();
+ }
+ }
+
+ private void sendResponse(OutputStream outputStream, CommonMessageContext msgContext, boolean isFault) throws SOAPException, IOException
+ {
+ MessageAbstraction resMessage = msgContext.getMessageAbstraction();
+ String wsaTo = null;
+
+ // Get the destination from the AddressingProperties
+ AddressingProperties outProps = (AddressingProperties)msgContext.get(JAXWSAConstants.SERVER_ADDRESSING_PROPERTIES_OUTBOUND);
+ if (outProps != null && outProps.getTo() != null)
+ {
+ AddressingConstantsImpl ADDR = new AddressingConstantsImpl();
+ wsaTo = outProps.getTo().getURI().toString();
+ if (wsaTo.equals(ADDR.getAnonymousURI()))
+ wsaTo = null;
+ }
+ if (wsaTo != null)
+ {
+ log.debug("Sending response to addressing destination: " + wsaTo);
+ new SOAPConnectionImpl().callOneWay((SOAPMessage)resMessage, wsaTo);
+ }
+ else
+ {
+ resMessage.writeTo(outputStream);
+ }
+ }
+
+ /**
+ * Handle a request to this web service endpoint
+ */
+ private MessageAbstraction processRequest(Endpoint endpoint, MimeHeaderSource headerSource, ServletRequestContext reqContext, InputStream inputStream)
+ throws BindingException
+ {
+ CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
+
+ ServerEndpointMetaData sepMetaData = endpoint.getMetaData(ServerEndpointMetaData.class);
+ if (sepMetaData == null)
+ throw new IllegalStateException("Cannot obtain endpoint meta data");
+
+ long beginProcessing = 0;
+ ClassLoader ctxClassLoader = Thread.currentThread().getContextClassLoader();
+ try
+ {
+ EndpointState state = endpoint.getState();
+ if (state != EndpointState.STARTED)
+ {
+ QName faultCode = Constants.SOAP11_FAULT_CODE_SERVER;
+ String faultString = "Endpoint cannot handle requests in state: " + state;
+ throw new SOAPFaultException(faultCode, faultString, null, null);
+ }
+
+ log.debug("BEGIN handleRequest: " + endpoint.getName());
+ beginProcessing = initRequestMetrics(endpoint);
+
+ MimeHeaders headers = (headerSource != null ? headerSource.getMimeHeaders() : null);
+
+ MessageAbstraction reqMessage;
+
+ String bindingID = sepMetaData.getBindingId();
+ if (HTTPBinding.HTTP_BINDING.equals(bindingID))
+ {
+ reqMessage = new HTTPMessageImpl(headers, inputStream);
+ }
+ else
+ {
+ MessageFactoryImpl msgFactory = new MessageFactoryImpl();
+ msgFactory.setServiceMode(sepMetaData.getServiceMode());
+ msgFactory.setStyle(sepMetaData.getStyle());
+
+ reqMessage = (SOAPMessageImpl)msgFactory.createMessage(headers, inputStream);
+ }
+
+ // Associate current message with message context
+ msgContext.setMessageAbstraction(reqMessage);
+
+ // debug the incomming message
+ MessageTrace.traceMessage("Incoming Request Message", reqMessage);
+
+ // Set the thread context class loader
+ ClassLoader classLoader = sepMetaData.getClassLoader();
+ Thread.currentThread().setContextClassLoader(classLoader);
+
+ // Invoke the service endpoint
+ InvocationHandler invoker = endpoint.getInvocationHandler();
+ invoker.invoke(reqContext);
+
+ // Get the response message context
+ msgContext = MessageContextAssociation.peekMessageContext();
+
+ // Get the response message
+ MessageAbstraction resMessage = msgContext.getMessageAbstraction();
+ if (resMessage != null)
+ postProcessResponse(headerSource, resMessage);
+
+ return resMessage;
+ }
+ catch (Exception ex)
+ {
+ MessageAbstraction resMessage = msgContext.getMessageAbstraction();
+
+ // In case we have an exception before the invoker is called
+ // we create the fault message here.
+ if (resMessage == null || resMessage.isFaultMessage() == false)
+ {
+ CommonBindingProvider bindingProvider = new CommonBindingProvider(sepMetaData);
+ CommonBinding binding = bindingProvider.getCommonBinding();
+ resMessage = binding.bindFaultMessage(ex);
+ }
+
+ if (resMessage != null)
+ postProcessResponse(headerSource, resMessage);
+
+ return resMessage;
+ }
+ finally
+ {
+ try
+ {
+ MessageAbstraction resMessage = msgContext.getMessageAbstraction();
+ if (resMessage != null)
+ {
+ if (resMessage.isFaultMessage())
+ {
+ processFaultMetrics(endpoint, beginProcessing);
+ }
+ else
+ {
+ processResponseMetrics(endpoint, beginProcessing);
+ }
+ }
+ }
+ catch (Exception ex)
+ {
+ log.error("Cannot process metrics", ex);
+ }
+
+ // Reset the thread context class loader
+ Thread.currentThread().setContextClassLoader(ctxClassLoader);
+ log.debug("END handleRequest: " + endpoint.getName());
+ }
+ }
+
+ private long initRequestMetrics(Endpoint endpoint)
+ {
+ return 0;
+ }
+
+ private void processResponseMetrics(Endpoint endpoint, long beginProcessing)
+ {
+ }
+
+ private void processFaultMetrics(Endpoint endpoint, long beginProcessing)
+ {
+ }
+
+ /** Set response mime headers
+ */
+ private void postProcessResponse(MimeHeaderSource headerSource, MessageAbstraction resMessage)
+ {
+ try
+ {
+ // Set the outbound headers
+ if (headerSource != null && resMessage instanceof SOAPMessage)
+ {
+ XOPContext.eagerlyCreateAttachments();
+ ((SOAPMessage)resMessage).saveChanges();
+ headerSource.setMimeHeaders(resMessage.getMimeHeaders());
+ }
+
+ // debug the outgoing message
+ MessageTrace.traceMessage("Outgoing Response Message", resMessage);
+ }
+ catch (Exception ex)
+ {
+ WSException.rethrow("Faild to post process response message", ex);
+ }
+ }
+
+ public void handleWSDLRequest(Endpoint endpoint, OutputStream outputStream, InvocationContext context)
+ {
+ log.debug("handleWSDLRequest: " + endpoint.getName());
+
+ ServerEndpointMetaData epMetaData = endpoint.getMetaData(ServerEndpointMetaData.class);
+ if (epMetaData == null)
+ throw new IllegalStateException("Cannot obtain endpoint meta data");
+
+ ServletRequestContext reqContext = (ServletRequestContext)context;
+ HttpServletRequest req = reqContext.getHttpServletRequest();
+
+ try
+ {
+ // For the base document the resourcePath should be null
+ String resPath = (String)req.getParameter("resource");
+ URL reqURL = new URL(req.getRequestURL().toString());
+
+ String wsdlHost = reqURL.getProtocol() + "://" + reqURL.getHost() + ":" + reqURL.getPort();
+
+ ServerConfigFactory factory = ServerConfigFactory.getInstance();
+ ServerConfig config = factory.getServerConfig();
+ if (config.getWebServiceHost().equals(ServerConfig.UNDEFINED_HOSTNAME) == false)
+ {
+ wsdlHost = config.getWebServiceHost();
+ }
+ log.debug("WSDL request, using host: " + wsdlHost);
+
+ WSDLRequestHandler wsdlRequestHandler = new WSDLRequestHandler(epMetaData);
+ Document document = wsdlRequestHandler.getDocumentForPath(reqURL, wsdlHost, resPath);
+
+ OutputStreamWriter writer = new OutputStreamWriter(outputStream);
+ new DOMWriter(writer).setPrettyprint(true).print(document.getDocumentElement());
+ outputStream.flush();
+ outputStream.close();
+ }
+ catch (RuntimeException rte)
+ {
+ throw rte;
+ }
+ catch (IOException ex)
+ {
+ throw new WSException(ex);
+ }
+ }
+}
Property changes on: trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/RequestHandlerImpl.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Copied: trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/SecurityAssociationAdaptorFactoryImpl.java (from rev 2953, trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/SecurityAssociationAdaptorFactoryImpl.java)
===================================================================
--- trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/SecurityAssociationAdaptorFactoryImpl.java (rev 0)
+++ trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/SecurityAssociationAdaptorFactoryImpl.java 2007-05-03 19:18:24 UTC (rev 2955)
@@ -0,0 +1,57 @@
+/*
+ * 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.security.Principal;
+
+import org.jboss.security.SecurityAssociation;
+import org.jboss.ws.extensions.security.SecurityAssociationAdaptor;
+import org.jboss.ws.extensions.security.SecurityAssociationAdaptorFactory;
+
+/**
+ * A JBoss specific SecurityAdaptorFactory
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 05-May-2006
+ */
+public class SecurityAssociationAdaptorFactoryImpl implements SecurityAssociationAdaptorFactory
+{
+ public SecurityAssociationAdaptor getSecurityAssociationAdaptor()
+ {
+ return new SecurityAccociationAdaptorImpl();
+ }
+
+ public class SecurityAccociationAdaptorImpl implements SecurityAssociationAdaptor
+ {
+ public void setPrincipal(Principal pricipal)
+ {
+ SecurityAssociation.setPrincipal(pricipal);
+ }
+
+ public void setCredential(Object credential)
+ {
+ SecurityAssociation.setCredential(credential);
+ }
+ }
+}
Copied: trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/ServiceEndpointGeneratorEJB21.java (from rev 2953, trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/ServiceEndpointGeneratorEJB21.java)
===================================================================
--- trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/ServiceEndpointGeneratorEJB21.java (rev 0)
+++ trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/ServiceEndpointGeneratorEJB21.java 2007-05-03 19:18:24 UTC (rev 2955)
@@ -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.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.core.server.ServiceEndpointGeneratorEJB;
+import org.jboss.ws.core.server.UnifiedDeploymentInfo;
+import org.jboss.ws.core.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 ServiceEndpointGeneratorEJB21 extends ServiceEndpointGeneratorEJB
+{
+ // logging support
+ protected Logger log = Logger.getLogger(ServiceEndpointGeneratorEJB21.class);
+
+ /** Add the roles from ejb-jar.xml to the security roles
+ */
+ protected void addEJBSecurityRoles(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: trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/ServiceEndpointGeneratorEJB3.java (from rev 2953, trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/ServiceEndpointGeneratorEJB3.java)
===================================================================
--- trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/ServiceEndpointGeneratorEJB3.java (rev 0)
+++ trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/ServiceEndpointGeneratorEJB3.java 2007-05-03 19:18:24 UTC (rev 2955)
@@ -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.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.core.server.ServiceEndpointGeneratorEJB;
+import org.jboss.ws.core.server.UnifiedDeploymentInfo;
+import org.jboss.ws.core.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 ServiceEndpointGeneratorEJB3 extends ServiceEndpointGeneratorEJB
+{
+ // logging support
+ protected Logger log = Logger.getLogger(ServiceEndpointGeneratorEJB3.class);
+
+ /** Add the roles from ejb-jar.xml to the security roles
+ */
+ protected void addEJBSecurityRoles(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");
+ }
+ }
+}
Added: trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/ServiceEndpointInterceptor.java
===================================================================
--- trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/ServiceEndpointInterceptor.java (rev 0)
+++ trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/ServiceEndpointInterceptor.java 2007-05-03 19:18:24 UTC (rev 2955)
@@ -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.jbossws;
+
+// $Id$
+
+import javax.xml.soap.SOAPMessage;
+
+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.core.CommonBinding;
+import org.jboss.ws.core.CommonBindingProvider;
+import org.jboss.ws.core.CommonMessageContext;
+import org.jboss.ws.core.EndpointInvocation;
+import org.jboss.ws.core.jaxrpc.SOAPFaultHelperJAXRPC;
+import org.jboss.ws.core.jaxrpc.handler.HandlerCallback;
+import org.jboss.ws.core.soap.MessageContextAssociation;
+import org.jboss.ws.metadata.umdm.OperationMetaData;
+import org.jboss.ws.metadata.umdm.HandlerMetaData.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
+ CommonMessageContext msgContext = (CommonMessageContext)mi.getPayloadValue(InvocationKey.SOAP_MESSAGE_CONTEXT);
+ if (msgContext == null)
+ {
+ return getNext().invoke(mi);
+ }
+
+ // Get the endpoint invocation
+ EndpointInvocation epInv = (EndpointInvocation)mi.getValue(EndpointInvocation.class.getName());
+ OperationMetaData opMetaData = epInv.getOperationMetaData();
+
+ // 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)
+ {
+ CommonBindingProvider bindingProvider = new CommonBindingProvider(opMetaData.getEndpointMetaData());
+ CommonBinding binding = bindingProvider.getCommonBinding();
+
+ // Verify that the the message has not been mofified
+ CommonMessageContext messageContext = MessageContextAssociation.peekMessageContext();
+ if (messageContext.isModified())
+ {
+ log.debug("Handler modified payload, unbind message and update invocation args");
+ epInv = bindingProvider.getCommonBinding().unbindRequestMessage(opMetaData, messageContext.getMessageAbstraction());
+ }
+
+ // 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.getRequestPayload();
+ mi.setArguments(reqParams);
+ Object resObj = getNext().invoke(mi);
+ epInv.setReturnValue(resObj);
+
+ // Bind the response message
+ SOAPMessage resMessage = (SOAPMessage)binding.bindResponseMessage(opMetaData, epInv);
+ msgContext.setSOAPMessage(resMessage);
+ }
+
+ // 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
+ {
+ SOAPMessage faultMessage = SOAPFaultHelperJAXRPC.exceptionToFaultMessage(ex);
+ msgContext.setSOAPMessage(faultMessage);
+
+ // 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;
+ }
+ }
+ else
+ {
+ log.warn("Handler callback not available");
+ return getNext().invoke(mi);
+ }
+ }
+}
Property changes on: trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/ServiceEndpointInterceptor.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/ServiceEndpointServlet.java
===================================================================
--- trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/ServiceEndpointServlet.java (rev 0)
+++ trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/ServiceEndpointServlet.java 2007-05-03 19:18:24 UTC (rev 2955)
@@ -0,0 +1,62 @@
+/*
+ * 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.servlet.ServletContext;
+
+import org.jboss.logging.Logger;
+import org.jboss.ws.metadata.umdm.ServerEndpointMetaData;
+
+/**
+ * A servlet that is installed for every web service endpoint.
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 25-Apr-2007
+ */
+public class ServiceEndpointServlet extends AbstractServiceEndpointServlet
+{
+ // provide logging
+ private static final Logger log = Logger.getLogger(ServiceEndpointServlet.class);
+
+ /** Initialize the service endpoint
+ */
+ protected void initServiceEndpoint(String contextPath)
+ {
+ super.initServiceEndpoint(contextPath);
+
+ // read the config name/file from web.xml
+ ServletContext ctx = getServletContext();
+ String configName = ctx.getInitParameter("jbossws-config-name");
+ String configFile = ctx.getInitParameter("jbossws-config-file");
+ if (configName != null || configFile != null)
+ {
+ ServerEndpointMetaData epMetaData = endpoint.getMetaData(ServerEndpointMetaData.class);
+ if (epMetaData == null)
+ throw new IllegalStateException("Cannot obtain endpoint meta data");
+
+ log.debug("Updating service endpoint config\n config-name: " + configName + "\n config-file: " + configFile);
+ epMetaData.setConfigName(configName, configFile);
+ }
+ }
+}
Property changes on: trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/ServiceEndpointServlet.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/UnifiedDeploymentInfoDeployer.java
===================================================================
--- trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/UnifiedDeploymentInfoDeployer.java (rev 0)
+++ trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/UnifiedDeploymentInfoDeployer.java 2007-05-03 19:18:24 UTC (rev 2955)
@@ -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.jbossws;
+
+//$Id$
+
+import org.jboss.deployment.DeploymentInfo;
+import org.jboss.ws.core.server.JAXWSDeployment;
+import org.jboss.ws.core.server.UnifiedDeploymentInfo;
+import org.jboss.ws.integration.deployment.AbstractDeployer;
+import org.jboss.ws.integration.deployment.Deployment;
+import org.jboss.ws.integration.deployment.Deployment.DeploymentType;
+import org.jboss.ws.metadata.builder.jaxrpc.JAXRPCDeployment;
+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
Property changes on: trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/UnifiedDeploymentInfoDeployer.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/UnifiedMetaDataAssociationDeployer.java
===================================================================
--- trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/UnifiedMetaDataAssociationDeployer.java (rev 0)
+++ trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/UnifiedMetaDataAssociationDeployer.java 2007-05-03 19:18:24 UTC (rev 2955)
@@ -0,0 +1,86 @@
+/*
+ * 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.management.ObjectName;
+
+import org.jboss.ws.integration.Endpoint;
+import org.jboss.ws.integration.deployment.AbstractDeployer;
+import org.jboss.ws.integration.deployment.Deployment;
+import org.jboss.ws.metadata.umdm.EndpointMetaData;
+import org.jboss.ws.metadata.umdm.ServerEndpointMetaData;
+import org.jboss.ws.metadata.umdm.ServiceMetaData;
+import org.jboss.ws.metadata.umdm.UnifiedMetaData;
+
+/**
+ * A deployer that assigns the EndpointMetaData to the Endpoint
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 25-Apr-2007
+ */
+public class UnifiedMetaDataAssociationDeployer extends AbstractDeployer
+{
+ @Override
+ public void create(Deployment dep)
+ {
+ UnifiedMetaData umd = dep.getContext().getAttachment(UnifiedMetaData.class);
+ if (umd == null)
+ throw new IllegalStateException("Cannot obtain unified meta data");
+
+ for (Endpoint ep : dep.getService().getEndpoints())
+ {
+ ServerEndpointMetaData sepMetaData = ep.getMetaData(ServerEndpointMetaData.class);
+ if (sepMetaData == null)
+ {
+ sepMetaData = getEndpointMetaData(umd, ep.getName());
+ sepMetaData.setServiceEndpointImplName(ep.getEndpointImpl().getName());
+ ep.addMetaData(ServerEndpointMetaData.class, sepMetaData);
+ }
+ }
+ }
+
+ private ServerEndpointMetaData getEndpointMetaData(UnifiedMetaData umd, ObjectName epName)
+ {
+ String propEndpoint = epName.getKeyProperty(Endpoint.SEPID_PROPERTY_ENDPOINT);
+
+ ServerEndpointMetaData epMetaData = null;
+ for (ServiceMetaData serviceMetaData : umd.getServices())
+ {
+ for (EndpointMetaData aux : serviceMetaData.getEndpoints())
+ {
+ String linkName = ((ServerEndpointMetaData)aux).getLinkName();
+ if (propEndpoint.equals(linkName))
+ {
+ epMetaData = (ServerEndpointMetaData)aux;
+ break;
+ }
+ }
+ }
+
+ if (epMetaData == null)
+ throw new IllegalStateException("Cannot find endpoint meta data for: " + epName);
+
+ return epMetaData;
+ }
+}
\ No newline at end of file
Property changes on: trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/UnifiedMetaDataAssociationDeployer.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/UnifiedMetaDataDeployer.java
===================================================================
--- trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/UnifiedMetaDataDeployer.java (rev 0)
+++ trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/UnifiedMetaDataDeployer.java 2007-05-03 19:18:24 UTC (rev 2955)
@@ -0,0 +1,82 @@
+/*
+ * 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.core.server.UnifiedDeploymentInfo;
+import org.jboss.ws.integration.deployment.AbstractDeployer;
+import org.jboss.ws.integration.deployment.Deployment;
+import org.jboss.ws.integration.deployment.Deployment.DeploymentType;
+import org.jboss.ws.metadata.builder.jaxrpc.JAXRPCDeployment;
+import org.jboss.ws.metadata.builder.jaxrpc.JAXRPCServerMetaDataBuilder;
+import org.jboss.ws.metadata.builder.jaxws.JAXWSMetaDataBuilderEJB3;
+import org.jboss.ws.metadata.builder.jaxws.JAXWSMetaDataBuilderJSE;
+import org.jboss.ws.metadata.umdm.UnifiedMetaData;
+
+/**
+ * A deployer that builds the UnifiedDeploymentInfo
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 25-Apr-2007
+ */
+public class UnifiedMetaDataDeployer extends AbstractDeployer
+{
+ @Override
+ public void create(Deployment dep)
+ {
+ UnifiedMetaData umd = dep.getContext().getAttachment(UnifiedMetaData.class);
+ if (umd == null)
+ {
+ UnifiedDeploymentInfo udi = dep.getContext().getAttachment(UnifiedDeploymentInfo.class);
+ if (udi == null)
+ throw new IllegalStateException("Cannot obtain unified deployement info");
+
+ if (udi.type == DeploymentType.JAXRPC_JSE)
+ {
+ JAXRPCServerMetaDataBuilder builder = new JAXRPCServerMetaDataBuilder();
+ umd = builder.buildMetaData((JAXRPCDeployment)udi);
+ }
+ else if (udi.type == DeploymentType.JAXRPC_EJB21)
+ {
+ JAXRPCServerMetaDataBuilder builder = new JAXRPCServerMetaDataBuilder();
+ umd = builder.buildMetaData((JAXRPCDeployment)udi);
+ }
+ else if (udi.type == DeploymentType.JAXWS_JSE)
+ {
+ JAXWSMetaDataBuilderJSE builder = new JAXWSMetaDataBuilderJSE();
+ umd = builder.buildMetaData(udi);
+ }
+ else if (udi.type == DeploymentType.JAXWS_EJB3)
+ {
+ JAXWSMetaDataBuilderEJB3 builder = new JAXWSMetaDataBuilderEJB3();
+ umd = builder.buildMetaData(udi);
+ }
+ else
+ {
+ throw new IllegalStateException("Invalid type: " + udi.type);
+ }
+
+ dep.getContext().addAttachment(UnifiedMetaData.class, umd);
+ }
+ }
+}
\ No newline at end of file
Property changes on: trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/UnifiedMetaDataDeployer.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/WebAppDeployerDeployer.java
===================================================================
--- trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/WebAppDeployerDeployer.java (rev 0)
+++ trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/WebAppDeployerDeployer.java 2007-05-03 19:18:24 UTC (rev 2955)
@@ -0,0 +1,126 @@
+/*
+ * 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.core.server.ServiceEndpointPublisher;
+import org.jboss.ws.core.server.UnifiedDeploymentInfo;
+import org.jboss.ws.integration.deployment.Deployer;
+import org.jboss.ws.integration.deployment.Deployment;
+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;
+ }
+}
Property changes on: trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/WebAppDeployerDeployer.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/WebAppGeneratorDeployer.java
===================================================================
--- trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/WebAppGeneratorDeployer.java (rev 0)
+++ trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/WebAppGeneratorDeployer.java 2007-05-03 19:18:24 UTC (rev 2955)
@@ -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.jbossws;
+
+//$Id$
+
+import org.jboss.ws.core.server.UnifiedDeploymentInfo;
+import org.jboss.ws.integration.deployment.AbstractDeployer;
+import org.jboss.ws.integration.deployment.Deployment;
+import org.jboss.ws.metadata.umdm.UnifiedMetaData;
+
+/**
+ * A deployer that generates a webapp for an EJB endpoint
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 25-Apr-2007
+ */
+public class WebAppGeneratorDeployer extends AbstractDeployer
+{
+ @Override
+ public void create(Deployment dep)
+ {
+ UnifiedDeploymentInfo udi = dep.getContext().getAttachment(UnifiedDeploymentInfo.class);
+ if (udi == null)
+ throw new IllegalStateException("Cannot obtain unified deployement info");
+
+ UnifiedMetaData umd = dep.getContext().getAttachment(UnifiedMetaData.class);
+ if (umd == null)
+ throw new IllegalStateException("Cannot obtain unified meta data");
+
+ if (dep.getType().toString().endsWith("EJB21"))
+ {
+ ServiceEndpointGeneratorEJB21 generator = new ServiceEndpointGeneratorEJB21();
+ udi.webappURL = generator.generatWebDeployment(umd, udi);
+ }
+ else if (dep.getType().toString().endsWith("EJB3"))
+ {
+ ServiceEndpointGeneratorEJB3 generator = new ServiceEndpointGeneratorEJB3();
+ udi.webappURL = generator.generatWebDeployment(umd, udi);
+ }
+ }
+}
\ No newline at end of file
Property changes on: trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/WebAppGeneratorDeployer.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Copied: trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/WebMetaDataAdapter.java (from rev 2953, trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/WebMetaDataAdapter.java)
===================================================================
--- trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/WebMetaDataAdapter.java (rev 0)
+++ trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jbossws/WebMetaDataAdapter.java 2007-05-03 19:18:24 UTC (rev 2955)
@@ -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.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.core.server.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: trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jms/JMSMessageDispatcher.java
===================================================================
--- trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jms/JMSMessageDispatcher.java 2007-05-03 15:43:45 UTC (rev 2954)
+++ trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jms/JMSMessageDispatcher.java 2007-05-03 19:18:24 UTC (rev 2955)
@@ -43,7 +43,6 @@
import org.jboss.ws.core.server.legacy.ServiceEndpointManager;
import org.jboss.ws.core.server.legacy.ServiceEndpointManagerFactory;
import org.jboss.ws.core.soap.MessageContextAssociation;
-import org.jboss.ws.integration.jboss42.ServiceEndpointInvokerMDB;
import org.jboss.ws.metadata.umdm.ServerEndpointMetaData;
/**
Copied: trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jms/ServiceEndpointInvokerMDB.java (from rev 2953, trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/ServiceEndpointInvokerMDB.java)
===================================================================
--- trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jms/ServiceEndpointInvokerMDB.java (rev 0)
+++ trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jms/ServiceEndpointInvokerMDB.java 2007-05-03 19:18:24 UTC (rev 2955)
@@ -0,0 +1,94 @@
+/*
+ * 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.jms;
+
+// $Id$
+
+import java.lang.reflect.Method;
+
+import org.jboss.logging.Logger;
+import org.jboss.ws.core.EndpointInvocation;
+import org.jboss.ws.core.server.legacy.AbstractServiceEndpointInvoker;
+import org.jboss.ws.core.server.legacy.ServiceEndpointInvoker;
+import org.jboss.ws.core.utils.ThreadLocalAssociation;
+
+/**
+ * Handles invocations on MDB endpoints.
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 21-Mar-2006
+ */
+public class ServiceEndpointInvokerMDB extends AbstractServiceEndpointInvoker implements ServiceEndpointInvoker
+{
+ // provide logging
+ private Logger log = Logger.getLogger(ServiceEndpointInvokerMDB.class);
+
+ /** Load the SEI implementation bean if necessary
+ */
+ public Class loadServiceEndpoint() throws ClassNotFoundException
+ {
+ return null;
+ }
+
+ // The dispatcher sets the target bean object
+ public void setTargetBeanObject(Object targetMDB)
+ {
+ ThreadLocalAssociation.localInvokerMDBAssoc().set(targetMDB);
+ }
+
+ /** Create an instance of the SEI implementation bean if necessary
+ */
+ public Object createServiceEndpointInstance(Object endpointContext, Class seiImplClass) throws InstantiationException, IllegalAccessException
+ {
+ return ThreadLocalAssociation.localInvokerMDBAssoc().get();
+ }
+
+ /** Invoke an instance of the SEI implementation bean */
+ public void invokeServiceEndpointInstance(Object seiImpl, EndpointInvocation epInv) throws Exception
+ {
+ log.debug("invokeServiceEndpoint: " + epInv.getJavaMethod().getName());
+ try
+ {
+ Class implClass = seiImpl.getClass();
+ Method seiMethod = epInv.getJavaMethod();
+ Method implMethod = getImplMethod(implClass, seiMethod);
+
+ Object[] args = epInv.getRequestPayload();
+ Object retObj = implMethod.invoke(seiImpl, args);
+ epInv.setReturnValue(retObj);
+ }
+ catch (Exception e)
+ {
+ handleInvocationException(e);
+ }
+ finally
+ {
+ // cleanup thread local
+ setTargetBeanObject(null);
+ }
+ }
+
+ /** Destroy an instance of the SEI implementation bean if necessary */
+ public void destroyServiceEndpointInstance(Object seiImpl)
+ {
+ }
+}
Modified: trunk/integration-jboss42/src/resources/jbossws.beans/META-INF/jboss-beans.xml
===================================================================
--- trunk/integration-jboss42/src/resources/jbossws.beans/META-INF/jboss-beans.xml 2007-05-03 15:43:45 UTC (rev 2954)
+++ trunk/integration-jboss42/src/resources/jbossws.beans/META-INF/jboss-beans.xml 2007-05-03 19:18:24 UTC (rev 2955)
@@ -1,26 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
-<deployment xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="urn:jboss:bean-deployer bean-deployer_1_0.xsd"
- xmlns="urn:jboss:bean-deployer">
+<deployment xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:jboss:bean-deployer bean-deployer_1_0.xsd" xmlns="urn:jboss:bean-deployer">
- <bean name="KernelLocator" class="org.jboss.ws.integration.KernelLocator">
- <property name="kernel"><inject bean="jboss.kernel:service=Kernel"/></property>
- </bean>
-
- <bean name="ServiceEndpointManager" class="org.jboss.ws.core.server.ServiceEndpointManager">
-
+ <!-- An abstraction of server configuration aspects. -->
+ <bean name="WSServerConfig" class="org.jboss.ws.integration.management.ServerConfigImpl">
<!--
The WSDL, that is a required deployment artifact for an endpoint, has a <soap:address>
element which points to the location of the endpoint. JBoss supports rewriting of that SOAP address.
- If the content of <soap:address> is a valid URL, JBossWS will not rewrite it unless 'alwaysModifySOAPAddress' is true.
+ If the content of <soap:address> is a valid URL, JBossWS will not rewrite it unless 'modifySOAPAddress' is true.
If the content of <soap:address> is not a valid URL, JBossWS will rewrite it using the attribute values given below.
- If next line (webServiceHost) is commented, JBossWS uses requesters protocolo, host and port when rewriting the <soap:address>.
+ If 'webServiceHost' is not set, JBossWS uses requesters protocol host and port when rewriting the <soap:address>.
-->
<property name="webServiceHost">${jboss.bind.address}</property>
- <property name="alwaysModifySOAPAddress">true</property>
+ <property name="modifySOAPAddress">true</property>
<!--
Set these properties to explicitly define the ports that will be used for rewriting the SOAP address.
@@ -29,40 +23,197 @@
<property name="webServiceSecurePort">8443</property>
<property name="webServicePort">8080</property>
-->
-
- <property name="serviceEndpointInvokerJSE">org.jboss.ws.core.server.ServiceEndpointInvokerJSE</property>
- <property name="serviceEndpointInvokerEJB3">org.jboss.ws.integration.jboss42.ServiceEndpointInvokerEJB3</property>
- <property name="serviceEndpointInvokerEJB21">org.jboss.ws.integration.jboss42.ServiceEndpointInvokerEJB21</property>
- <property name="serviceEndpointInvokerMDB">org.jboss.ws.integration.jboss42.ServiceEndpointInvokerMDB</property>
</bean>
+
+ <!-- The registry for web service endpoints -->
+ <bean name="WSEndpointRegistry" class="org.jboss.ws.integration.management.EndpointRegistryImpl"/>
- <bean name="ServiceEndpointDeployer" class="org.jboss.ws.core.server.ServiceEndpointDeployer">
- <property name="serviceEndpointManager">
- <inject bean="ServiceEndpointManager"/>
- </property>
- </bean>
+ <!-- A subscription manager for WS-Eventing -->
+ <bean name="WSSubscriptionManager" class="org.jboss.ws.extensions.eventing.mgmt.SubscriptionManager"/>
- <bean name="ServiceEndpointPublisher" class="org.jboss.ws.integration.jboss42.ServiceEndpointPublisher">
- <property name="serviceEndpointServlet">org.jboss.ws.integration.jboss42.JBossServiceEndpointServlet</property>
- </bean>
-
<!-- Bind Service objects in client environment context -->
+ <!-- The bean name is compiled into the server. Changeit with the next release. -->
<bean name="ServiceRefHandler" class="org.jboss.ws.core.client.ServiceRefHandlerImpl"/>
- <!-- A subscription manager for WS-Eventing -->
- <bean name="SubscriptionManager" class="org.jboss.ws.extensions.eventing.mgmt.SubscriptionManager"/>
+ <!-- Locate the single instance of the kernel -->
+ <bean name="WSKernelLocator" class="org.jboss.ws.integration.KernelLocator">
+ <property name="kernel"><inject bean="jboss.kernel:service=Kernel"/></property>
+ </bean>
- <bean name="ServerConfig" class="org.jboss.ws.integration.jboss42.ServerConfigImpl"/>
+ <!--
+ *********************************************************************************************************************
+ Web Service deployment
+
+ There are three deployers registered with the JBoss Main Deployer.
+ The order of which is important
+
+ 1) EJBDeployer < WebServiceDeployerEJB
+ 2) WebServiceDeployerJSE < WarDeployer
+ 3) WebServiceMainDeployer
+
+ Each WebServiceDeployer has a number of DeployerHooks registerd with it
+
+ - WebServiceDeployerEJB
+ - WSDeployerHook_JAXRPC_EJB21
+ - WSDeployerHook_JAXWS_EJB3
+
+ - WebServiceDeployerJSE
+ - WSDeployerHook_JAXRPC_JSE
+ - WSDeployerHook_JAXWS_JSE
+
+ - WebServiceMainDeployer
+ - WSMainDeployerHook
+
+ Conceptually, each of these hooks implements the following pattern:
+
+ DployerHook.deploy(unit)
+ if(isWebServiceDeployment)
+ Deployment dep = createDeployment(unit)
+ DeployerManager.deploy(dep)
+
+ DeployerHook.undeploy(unit)
+ Deployment dep = getDeployment(unit)
+ DeployerManager.undeploy(dep)
+
+ Each deployer hook has a web service DeployerManager injected into it.
+ A web service DeployerManager maintains a list of Deployers, each of which
+ handles a single aspect of web service deployment.
+
+ Finally, each Endpoint is registered with the EndpointRegistry.
+
+ *********************************************************************************************************************
+ -->
+
+ <!--
+ Each DeploymentManger maintains a list of Deployers
+ Each Deployer handles a single aspect of web service deployment.
+ -->
+ <bean name="WSDeployerManagerJSE" class="org.jboss.ws.integration.deployment.DeployerManagerImpl">
+ <property name="deployers">
+ <list class="java.util.LinkedList" elementClass="org.jboss.ws.integration.deployment.Deployer">
+ <inject bean="WSUnifiedDeploymentInfoDeployer"/>
+ <inject bean="WSUnifiedMetaDataDeployer"/>
+ <inject bean="WSUnifiedMetaDataAssociationDeployer"/>
+ <inject bean="WSModifyWebMetaDataDeployer"/>
+ </list>
+ </property>
+ </bean>
+ <bean name="WSDeployerManagerEJB" class="org.jboss.ws.integration.deployment.DeployerManagerImpl">
+ <property name="deployers">
+ <list class="java.util.LinkedList" elementClass="org.jboss.ws.integration.deployment.Deployer">
+ <inject bean="WSUnifiedDeploymentInfoDeployer"/>
+ <inject bean="WSUnifiedMetaDataDeployer"/>
+ <inject bean="WSUnifiedMetaDataAssociationDeployer"/>
+ <inject bean="WSWebAppGeneratorDeployer"/>
+ <inject bean="WSWebAppDeployerDeployer"/>
+ </list>
+ </property>
+ </bean>
+ <bean name="WSMainDeployerManager" class="org.jboss.ws.integration.deployment.DeployerManagerImpl">
+ <property name="deployers">
+ <list class="java.util.LinkedList" elementClass="org.jboss.ws.integration.deployment.Deployer">
+ <inject bean="WSEndpointNameDeployer"/>
+ <inject bean="WSEndpointHandlerDeployer"/>
+ <inject bean="WSPublishContractDeployer"/>
+ <inject bean="WSClassLoaderInjectionDeployer"/>
+ <inject bean="WSEagerInitializeDeployer"/>
+ <inject bean="WSEndpointRegistryDeployer"/>
+ <inject bean="WSEndpointLifecycleDeployer"/>
+ </list>
+ </property>
+ </bean>
+
+ <!--
+ The Deployers
+ Each handles a single aspect of web service deployment
+ -->
+ <bean name="WSClassLoaderInjectionDeployer" class="org.jboss.ws.integration.jboss42.jbossws.ClassLoaderInjectionDeployer"/>
+ <bean name="WSEagerInitializeDeployer" class="org.jboss.ws.integration.jboss42.jbossws.EagerInitializeDeployer"/>
+ <bean name="WSEndpointHandlerDeployer" class="org.jboss.ws.integration.jboss42.jbossws.EndpointHandlerDeployer">
+ <property name="requestHandler">org.jboss.ws.integration.jboss42.jbossws.RequestHandlerImpl</property>
+ <property name="lifecycleHandler">org.jboss.ws.integration.jboss42.jbossws.LifecycleHandlerImpl</property>
+ <property name="invocationHandler">
+ <map keyClass="java.lang.String" valueClass="java.lang.String">
+ <entry><key>JAXRPC_JSE</key><value>org.jboss.ws.integration.jboss42.jbossws.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.integration.jboss42.jbossws.InvocationHandlerJSE</value></entry>
+ <entry><key>JAXWS_EJB3</key><value>org.jboss.ws.integration.jboss42.jbossws.InvocationHandlerEJB3</value></entry>
+ </map>
+ </property>
+ </bean>
+ <bean name="WSEndpointLifecycleDeployer" class="org.jboss.ws.integration.jboss42.jbossws.EndpointLifecycleDeployer"/>
+ <bean name="WSEndpointNameDeployer" class="org.jboss.ws.integration.jboss42.jbossws.EndpointNameDeployer"/>
+ <bean name="WSEndpointRegistryDeployer" class="org.jboss.ws.integration.deployment.EndpointRegistryDeployer"/>
+ <bean name="WSEndpointValidationDeployer" class="org.jboss.ws.integration.deployment.EndpointValidationDeployer"/>
+ <bean name="WSModifyWebMetaDataDeployer" class="org.jboss.ws.integration.jboss42.jbossws.ModifyWebMetaDataDeployer">
+ <property name="serviceEndpointPublisher"><inject bean="WSServiceEndpointPublisher"/></property>
+ </bean>
+ <bean name="WSPublishContractDeployer" class="org.jboss.ws.integration.jboss42.jbossws.PublishContractDeployer"/>
+ <bean name="WSUnifiedDeploymentInfoDeployer" class="org.jboss.ws.integration.jboss42.jbossws.UnifiedDeploymentInfoDeployer">
+ <property name="deploymentInfoAdapter"><inject bean="WSDeploymentInfoAdapter"/></property>
+ </bean>
+ <bean name="WSUnifiedMetaDataAssociationDeployer" class="org.jboss.ws.integration.jboss42.jbossws.UnifiedMetaDataAssociationDeployer"/>
+ <bean name="WSUnifiedMetaDataDeployer" class="org.jboss.ws.integration.jboss42.jbossws.UnifiedMetaDataDeployer"/>
+ <bean name="WSWebAppGeneratorDeployer" class="org.jboss.ws.integration.jboss42.jbossws.WebAppGeneratorDeployer"/>
+ <bean name="WSWebAppDeployerDeployer" class="org.jboss.ws.integration.jboss42.jbossws.WebAppDeployerDeployer">
+ <property name="serviceEndpointPublisher"><inject bean="WSServiceEndpointPublisher"/></property>
+ </bean>
- <bean name="DeploymentInfoAdapter" class="org.jboss.ws.integration.jboss42.DeploymentInfoAdapter">
- <property name="applicationMetaDataAdapter">
- <inject bean="ApplicationMetaDataAdapter"/>
+ <!-- Deployer helper beans -->
+ <bean name="WSServiceEndpointPublisher" class="org.jboss.ws.core.server.ServiceEndpointPublisher">
+ <property name="servletClass">org.jboss.ws.integration.jboss42.jbossws.ServiceEndpointServlet</property>
+ </bean>
+ <bean name="WSDeploymentInfoAdapter" class="org.jboss.ws.integration.jboss42.jbossws.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"/>
+
+ <!--
+ Register DeployerHooks with JBoss deployers
+ -->
+ <bean name="WSDeployerHook_JAXRPC_JSE" class="org.jboss.ws.integration.jboss42.jbossws.JAXRPCDeployerHookJSE">
+ <property name="deployerManager"><inject bean="WSDeployerManagerJSE"/></property>
+ <property name="phaseOneInterceptors">
+ <list class="java.util.LinkedList" elementClass="javax.management.ObjectName">
+ <value>jboss.ws:service=DeployerInterceptorJSE</value>
+ </list>
</property>
- <property name="webMetaDataAdapter">
- <inject bean="WebMetaDataAdapter"/>
+ </bean>
+ <bean name="WSDeployerHook_JAXRPC_EJB21" class="org.jboss.ws.integration.jboss42.jbossws.JAXRPCDeployerHookEJB21">
+ <property name="deployerManager"><inject bean="WSDeployerManagerEJB"/></property>
+ <property name="phaseOneInterceptors">
+ <list class="java.util.LinkedList" elementClass="javax.management.ObjectName">
+ <value>jboss.ws:service=DeployerInterceptorEJB21</value>
+ </list>
</property>
</bean>
- <bean name="ApplicationMetaDataAdapter" class="org.jboss.ws.integration.jboss42.ApplicationMetaDataAdapter"/>
- <bean name="WebMetaDataAdapter" class="org.jboss.ws.integration.jboss42.WebMetaDataAdapter"/>
+ <bean name="WSDeployerHook_JAXWS_JSE" class="org.jboss.ws.integration.jboss42.jbossws.JAXWSDeployerHookJSE">
+ <property name="deployerManager"><inject bean="WSDeployerManagerJSE"/></property>
+ <property name="phaseOneInterceptors">
+ <list class="java.util.LinkedList" elementClass="javax.management.ObjectName">
+ <value>jboss.ws:service=DeployerInterceptorJSE</value>
+ </list>
+ </property>
+ </bean>
+ <bean name="WSDeployerHook_JAXWS_EJB3" class="org.jboss.ws.integration.jboss42.jbossws.JAXWSDeployerHookEJB3">
+ <property name="deployerManager"><inject bean="WSDeployerManagerEJB"/></property>
+ <property name="phaseOneInterceptors">
+ <list class="java.util.LinkedList" elementClass="javax.management.ObjectName">
+ <value>jboss.ws:service=DeployerInterceptorEJB3</value>
+ </list>
+ </property>
+ </bean>
+ <bean name="WSMainDeployerHook" class="org.jboss.ws.integration.jboss42.jbossws.MainDeployerHook">
+ <property name="deployerManager"><inject bean="WSMainDeployerManager"/></property>
+ <property name="phaseTwoInterceptors">
+ <list class="java.util.LinkedList" elementClass="javax.management.ObjectName">
+ <value>jboss.ws:service=DeployerInterceptorJSE</value>
+ <value>jboss.ws:service=DeployerInterceptorEJB21</value>
+ <value>jboss.ws:service=DeployerInterceptorEJB3</value>
+ </list>
+ </property>
+ </bean>
</deployment>
Deleted: trunk/integration-jboss42/src/resources/jbossws.sar/META-INF/jboss-service-no-ejb3.xml
===================================================================
--- trunk/integration-jboss42/src/resources/jbossws.sar/META-INF/jboss-service-no-ejb3.xml 2007-05-03 15:43:45 UTC (rev 2954)
+++ trunk/integration-jboss42/src/resources/jbossws.sar/META-INF/jboss-service-no-ejb3.xml 2007-05-03 19:18:24 UTC (rev 2955)
@@ -1,42 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!-- $Id$ -->
-
-<server>
-
- <!--
- A deployer service for JSE endpoints.
- -->
- <mbean name="jboss.ws:service=WebServiceDeployerJSE" code="org.jboss.ws.integration.jboss42.DeployerInterceptorJSE">
- <depends-list optional-attribute-name="Interceptables">
- <depends-list-element>jboss.web:service=WebServer</depends-list-element>
- </depends-list>
- </mbean>
-
- <!--
- A deployer service for EJB2.1 endpoints.
- -->
- <mbean name="jboss.ws:service=DeployerInterceptorEJB21" code="org.jboss.ws.integration.jboss42.DeployerInterceptorEJB21">
- <depends-list optional-attribute-name="Interceptables">
- <depends-list-element>jboss.ejb:service=EJBDeployer</depends-list-element>
- </depends-list>
- </mbean>
-
- <!--
- A deployer service for EJB3 endpoints.
- <mbean name="jboss.ws:service=DeployerInterceptorEJB3" code="org.jboss.ws.integration.jboss42.DeployerInterceptorEJB3">
- <depends-list optional-attribute-name="Interceptables">
- <depends-list-element>jboss.ejb3:service=EJB3Deployer</depends-list-element>
- </depends-list>
- </mbean>
- -->
-
- <!--
- A deployer service for JSE endpoints that are nested in service archives (sar).
- -->
- <mbean name="jboss.ws:service=DeployerInterceptorNestedJSE" code="org.jboss.ws.integration.jboss42.DeployerInterceptorNestedJSE">
- <depends optional-attribute-name="MainDeployer" proxy-type="attribute">jboss.system:service=MainDeployer</depends>
- <depends>jboss.ws:service=WebServiceDeployerJSE</depends>
- </mbean>
-
-</server>
Modified: trunk/integration-jboss42/src/resources/jbossws.sar/META-INF/jboss-service.xml
===================================================================
--- trunk/integration-jboss42/src/resources/jbossws.sar/META-INF/jboss-service.xml 2007-05-03 15:43:45 UTC (rev 2954)
+++ trunk/integration-jboss42/src/resources/jbossws.sar/META-INF/jboss-service.xml 2007-05-03 19:18:24 UTC (rev 2955)
@@ -7,7 +7,7 @@
<!--
A deployer service for JSE endpoints.
-->
- <mbean name="jboss.ws:service=WebServiceDeployerJSE" code="org.jboss.ws.integration.jboss42.DeployerInterceptorJSE">
+ <mbean name="jboss.ws:service=DeployerInterceptorJSE" code="org.jboss.ws.integration.jboss42.DeployerInterceptorJSE">
<depends-list optional-attribute-name="Interceptables">
<depends-list-element>jboss.web:service=WebServer</depends-list-element>
</depends-list>
@@ -31,12 +31,4 @@
</depends-list>
</mbean>
- <!--
- A deployer service for JSE endpoints that are nested in service archives (sar).
- -->
- <mbean name="jboss.ws:service=DeployerInterceptorNestedJSE" code="org.jboss.ws.integration.jboss42.DeployerInterceptorNestedJSE">
- <depends optional-attribute-name="MainDeployer" proxy-type="attribute">jboss.system:service=MainDeployer</depends>
- <depends>jboss.ws:service=WebServiceDeployerJSE</depends>
- </mbean>
-
</server>
Modified: trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/DeployerHook.java
===================================================================
--- trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/DeployerHook.java 2007-05-03 15:43:45 UTC (rev 2954)
+++ trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/DeployerHook.java 2007-05-03 19:18:24 UTC (rev 2955)
@@ -27,7 +27,7 @@
import org.jboss.deployers.spi.deployer.DeploymentUnit;
/**
- * An interface for all web service deployers
+ * An interface for all web service deployer hooks
*
* @author Thomas.Diesler(a)jboss.org
* @since 24-Apr-2007
@@ -36,5 +36,5 @@
{
void deploy(DeploymentUnit unit) throws DeploymentException;
- public void undeploy(DeploymentUnit unit);
+ void undeploy(DeploymentUnit unit);
}
Modified: trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/ArchiveDeployerHook.java
===================================================================
--- trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/ArchiveDeployerHook.java 2007-05-03 15:43:45 UTC (rev 2954)
+++ trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/ArchiveDeployerHook.java 2007-05-03 19:18:24 UTC (rev 2955)
@@ -23,14 +23,13 @@
//$Id$
-import java.io.InputStream;
import java.net.URL;
import org.jboss.deployers.spi.DeploymentException;
import org.jboss.deployers.spi.deployer.DeploymentUnit;
-import org.jboss.logging.Logger;
import org.jboss.virtual.VirtualFile;
import org.jboss.ws.core.utils.DOMUtils;
+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;
@@ -83,7 +82,7 @@
{
if (ignoreDeployment(unit))
return;
-
+
if (isWebServiceDeployment(unit))
{
log.debug("deploy: " + unit.getName());
@@ -103,7 +102,7 @@
{
if (ignoreDeployment(unit))
return;
-
+
Deployment dep = getDeployment(unit);
if (dep != null)
{
@@ -118,29 +117,21 @@
protected WebservicesMetaData getWebservicesMetaData(DeploymentUnit unit)
{
WebservicesMetaData wsMetaData = unit.getAttachment(WebservicesMetaData.class);
- VirtualFile vfWebservices = unit.getMetaDataFile("webservices.xml");
+ UnifiedVirtualFile vfWebservices = getWebservicesFile(unit);
if (wsMetaData == null && vfWebservices != null)
{
try
{
- URL webservicesURL = vfWebservices.toURL();
- InputStream is = webservicesURL.openStream();
- 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"))
{
- Element root = DOMUtils.parse(vfWebservices.openStream());
- String namespaceURI = root.getNamespaceURI();
- if (namespaceURI.equals("http://java.sun.com/xml/ns/j2ee"))
- {
- Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller();
- ObjectModelFactory factory = new WebservicesFactory(webservicesURL);
- wsMetaData = (WebservicesMetaData)unmarshaller.unmarshal(is, factory, null);
- unit.addAttachment(WebservicesMetaData.class, wsMetaData);
- }
+ Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller();
+ ObjectModelFactory factory = new WebservicesFactory(wsURL);
+ wsMetaData = (WebservicesMetaData)unmarshaller.unmarshal(wsURL.openStream(), factory, null);
+ unit.addAttachment(WebservicesMetaData.class, wsMetaData);
}
- finally
- {
- is.close();
- }
}
catch (Exception ex)
{
@@ -149,4 +140,10 @@
}
return wsMetaData;
}
+
+ private UnifiedVirtualFile getWebservicesFile(DeploymentUnit unit)
+ {
+ VirtualFile vf = unit.getMetaDataFile("webservices.xml");
+ return (vf != null ? new VirtualFileAdaptor(vf) : null);
+ }
}
Copied: trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/DeploymentInfoAdapter.java (from rev 2953, trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/DeploymentInfoAdaptor.java)
===================================================================
--- trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/DeploymentInfoAdapter.java (rev 0)
+++ trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/DeploymentInfoAdapter.java 2007-05-03 19:18:24 UTC (rev 2955)
@@ -0,0 +1,101 @@
+/*
+ * 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.jbossws;
+
+import java.net.URL;
+import java.net.URLClassLoader;
+
+import org.jboss.deployers.spi.deployer.DeploymentUnit;
+import org.jboss.ejb3.Ejb3Deployment;
+import org.jboss.logging.Logger;
+import org.jboss.metadata.ApplicationMetaData;
+import org.jboss.metadata.WebMetaData;
+import org.jboss.ws.WSException;
+import org.jboss.ws.core.server.UnifiedDeploymentInfo;
+
+// $Id$
+
+/**
+ * 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);
+
+ public static void buildDeploymentInfo(UnifiedDeploymentInfo udi, DeploymentUnit unit)
+ {
+ udi.addAttachment(DeploymentUnit.class, unit);
+
+ try
+ {
+ if (unit.getDeploymentContext().getParent() != null)
+ {
+ udi.parent = new UnifiedDeploymentInfo(null);
+ buildDeploymentInfo(udi.parent, unit.getDeploymentContext().getParent().getDeploymentUnit());
+ }
+
+ udi.vfRoot = new VirtualFileAdaptor(unit.getDeploymentContext().getRoot());
+
+ udi.name = unit.getName();
+ udi.simpleName = unit.getSimpleName();
+ udi.url = udi.vfRoot.toURL();
+
+ buildMetaData(udi, unit);
+
+ // Since we create temporary classes, we need to create a delegate loader
+ // This prevents CCE problems where the parent loader is available at deploy time,
+ // and a child loader is available at start time.
+ udi.classLoader = new URLClassLoader(new URL[] {}, unit.getClassLoader());
+
+ log.debug("UnifiedDeploymentInfo:\n" + udi);
+ }
+ catch (Exception ex)
+ {
+ WSException.rethrow(ex.getMessage(), ex);
+ }
+ }
+
+ private static void buildMetaData(UnifiedDeploymentInfo udi, DeploymentUnit unit) throws Exception
+ {
+ if (unit.getAttachment(Ejb3Deployment.class) != null)
+ {
+ udi.metaData = ApplicationMetaDataAdaptorEJB3.buildUnifiedApplicationMetaData(udi, unit);
+ }
+ else if (unit.getAttachment(ApplicationMetaData.class) != null)
+ {
+ udi.metaData = ApplicationMetaDataAdaptor.buildUnifiedApplicationMetaData(udi, unit);
+ }
+ else if (unit.getAttachment(WebMetaData.class) != null)
+ {
+ udi.metaData = WebMetaDataAdaptor.buildUnifiedWebMetaData(udi, unit);
+ udi.webappURL = udi.vfRoot.toURL();
+ }
+ else
+ {
+ throw new IllegalStateException("Cannot build meta data");
+ }
+ }
+}
Deleted: trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/DeploymentInfoAdaptor.java
===================================================================
--- trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/DeploymentInfoAdaptor.java 2007-05-03 15:43:45 UTC (rev 2954)
+++ trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/DeploymentInfoAdaptor.java 2007-05-03 19:18:24 UTC (rev 2955)
@@ -1,99 +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.jbossws;
-
-import java.net.URL;
-import java.net.URLClassLoader;
-
-import org.jboss.deployers.spi.deployer.DeploymentUnit;
-import org.jboss.ejb3.Ejb3Deployment;
-import org.jboss.logging.Logger;
-import org.jboss.metadata.ApplicationMetaData;
-import org.jboss.metadata.WebMetaData;
-import org.jboss.ws.WSException;
-import org.jboss.ws.core.server.UnifiedDeploymentInfo;
-
-// $Id$
-
-/**
- * Build container independent deployment info.
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 05-May-2006
- */
-public class DeploymentInfoAdaptor
-{
- // logging support
- private static Logger log = Logger.getLogger(DeploymentInfoAdaptor.class);
-
- public static void buildDeploymentInfo(UnifiedDeploymentInfo udi, DeploymentUnit unit)
- {
- try
- {
- if (unit.getDeploymentContext().getParent() != null)
- {
- udi.parent = new UnifiedDeploymentInfo(null);
- buildDeploymentInfo(udi.parent, unit.getDeploymentContext().getParent().getDeploymentUnit());
- }
-
- udi.vfRoot = new VirtualFileAdaptor(unit.getDeploymentContext().getRoot());
-
- udi.name = unit.getName();
- udi.simpleName = unit.getSimpleName();
- udi.url = udi.vfRoot.toURL();
-
- buildMetaData(udi, unit);
-
- // Since we create temporary classes, we need to create a delegate loader
- // This prevents CCE problems where the parent loader is available at deploy time,
- // and a child loader is available at start time.
- udi.classLoader = new URLClassLoader(new URL[] {}, unit.getClassLoader());
-
- log.debug("UnifiedDeploymentInfo:\n" + udi);
- }
- catch (Exception ex)
- {
- WSException.rethrow(ex.getMessage(), ex);
- }
- }
-
- private static void buildMetaData(UnifiedDeploymentInfo udi, DeploymentUnit unit) throws Exception
- {
- if (unit.getAttachment(Ejb3Deployment.class) != null)
- {
- udi.metaData = ApplicationMetaDataAdaptorEJB3.buildUnifiedApplicationMetaData(udi, unit);
- }
- else if (unit.getAttachment(ApplicationMetaData.class) != null)
- {
- udi.metaData = ApplicationMetaDataAdaptor.buildUnifiedApplicationMetaData(udi, unit);
- }
- else if (unit.getAttachment(WebMetaData.class) != null)
- {
- udi.metaData = WebMetaDataAdaptor.buildUnifiedWebMetaData(udi, unit);
- udi.webappURL = udi.vfRoot.toURL();
- }
- else
- {
- throw new IllegalStateException("Cannot build meta data");
- }
- }
-}
Modified: trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/EndpointLifecycleDeployer.java
===================================================================
--- trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/EndpointLifecycleDeployer.java 2007-05-03 15:43:45 UTC (rev 2954)
+++ trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/EndpointLifecycleDeployer.java 2007-05-03 19:18:24 UTC (rev 2955)
@@ -24,6 +24,7 @@
//$Id$
import org.jboss.ws.integration.Endpoint;
+import org.jboss.ws.integration.Service;
import org.jboss.ws.integration.deployment.AbstractDeployer;
import org.jboss.ws.integration.deployment.Deployment;
@@ -54,16 +55,26 @@
@Override
public void stop(Deployment dep)
{
- for (Endpoint ep : dep.getService().getEndpoints())
+ Service service = dep.getService();
+ if (service != null)
{
- ep.getLifecycleHandler().stop(ep);
+ for (Endpoint ep : service.getEndpoints())
+ {
+ ep.getLifecycleHandler().stop(ep);
+ }
}
}
@Override
public void destroy(Deployment dep)
{
- for (Endpoint ep : dep.getService().getEndpoints())
- ep.getLifecycleHandler().destroy(ep);
+ Service service = dep.getService();
+ if (service != null)
+ {
+ for (Endpoint ep : service.getEndpoints())
+ {
+ ep.getLifecycleHandler().destroy(ep);
+ }
+ }
}
}
Modified: trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/JAXRPCDeployerHookEJB21.java
===================================================================
--- trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/JAXRPCDeployerHookEJB21.java 2007-05-03 15:43:45 UTC (rev 2954)
+++ trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/JAXRPCDeployerHookEJB21.java 2007-05-03 19:18:24 UTC (rev 2955)
@@ -56,11 +56,11 @@
@Override
public Deployment createDeployment(DeploymentUnit unit)
{
- Deployment deployment = new DeploymentImpl();
- deployment.setType(getDeploymentType());
- deployment.setClassLoader(unit.getClassLoader());
+ Deployment dep = new DeploymentImpl();
+ dep.setType(getDeploymentType());
+ dep.setClassLoader(unit.getClassLoader());
- Service service = deployment.getService();
+ Service service = dep.getService();
ApplicationMetaData appmd = unit.getAttachment(ApplicationMetaData.class);
if (appmd == null)
@@ -71,8 +71,8 @@
throw new IllegalStateException("Deployment unit does not contain webservices meta data");
// Copy the attachments
- deployment.getContext().addAttachment(WebservicesMetaData.class, wsMetaData);
- deployment.getContext().addAttachment(ApplicationMetaData.class, appmd);
+ dep.getContext().addAttachment(WebservicesMetaData.class, wsMetaData);
+ dep.getContext().addAttachment(ApplicationMetaData.class, appmd);
for (WebserviceDescriptionMetaData wsd : wsMetaData.getWebserviceDescriptions())
{
@@ -105,7 +105,7 @@
}
}
}
- return deployment;
+ return dep;
}
@Override
Modified: trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/JAXRPCDeployerHookJSE.java
===================================================================
--- trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/JAXRPCDeployerHookJSE.java 2007-05-03 15:43:45 UTC (rev 2954)
+++ trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/JAXRPCDeployerHookJSE.java 2007-05-03 19:18:24 UTC (rev 2955)
@@ -58,11 +58,11 @@
@Override
public Deployment createDeployment(DeploymentUnit unit)
{
- Deployment deployment = new DeploymentImpl();
- deployment.setType(getDeploymentType());
- deployment.setClassLoader(unit.getClassLoader());
+ Deployment dep = new DeploymentImpl();
+ dep.setType(getDeploymentType());
+ dep.setClassLoader(unit.getClassLoader());
- Service service = deployment.getService();
+ Service service = dep.getService();
WebMetaData webMetaData = unit.getAttachment(WebMetaData.class);
if (webMetaData == null)
@@ -73,18 +73,9 @@
throw new IllegalStateException("Deployment unit does not contain webservices meta data");
// Copy the attachments
- deployment.getContext().addAttachment(WebservicesMetaData.class, wsMetaData);
- deployment.getContext().addAttachment(WebMetaData.class, webMetaData);
+ dep.getContext().addAttachment(WebservicesMetaData.class, wsMetaData);
+ dep.getContext().addAttachment(WebMetaData.class, webMetaData);
- // Get the context root
- String contextRoot = webMetaData.getContextRoot();
- if (contextRoot == null)
- {
- contextRoot = unit.getSimpleName();
- if (contextRoot.endsWith(".war"))
- contextRoot = contextRoot.substring(0, contextRoot.length() - 4);
- }
-
for (WebserviceDescriptionMetaData wsd : wsMetaData.getWebserviceDescriptions())
{
for (PortComponentMetaData pcmd : wsd.getPortComponents())
@@ -115,7 +106,7 @@
}
}
- return deployment;
+ return dep;
}
private Servlet getServletForName(WebMetaData wmd, String servletLink)
Modified: trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/JAXWSDeployerHookEJB3.java
===================================================================
--- trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/JAXWSDeployerHookEJB3.java 2007-05-03 15:43:45 UTC (rev 2954)
+++ trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/JAXWSDeployerHookEJB3.java 2007-05-03 19:18:24 UTC (rev 2955)
@@ -58,18 +58,18 @@
@Override
public Deployment createDeployment(DeploymentUnit unit)
{
- Deployment deployment = new DeploymentImpl();
- deployment.setType(getDeploymentType());
- deployment.setClassLoader(unit.getClassLoader());
+ Deployment dep = new DeploymentImpl();
+ dep.setType(getDeploymentType());
+ dep.setClassLoader(unit.getClassLoader());
- Service service = deployment.getService();
+ Service service = dep.getService();
Ejb3Deployment ejb3Deployment = unit.getAttachment(Ejb3Deployment.class);
if (ejb3Deployment == null)
throw new IllegalStateException("Deployment unit does not contain ejb3 deployment");
// Copy the attachments
- deployment.getContext().addAttachment(Ejb3Deployment.class, ejb3Deployment);
+ dep.getContext().addAttachment(Ejb3Deployment.class, ejb3Deployment);
Iterator it = ejb3Deployment.getEjbContainers().values().iterator();
while (it.hasNext())
@@ -89,7 +89,7 @@
}
}
- return deployment;
+ return dep;
}
@Override
Modified: trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/JAXWSDeployerHookJSE.java
===================================================================
--- trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/JAXWSDeployerHookJSE.java 2007-05-03 15:43:45 UTC (rev 2954)
+++ trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/JAXWSDeployerHookJSE.java 2007-05-03 19:18:24 UTC (rev 2955)
@@ -58,18 +58,18 @@
@Override
public Deployment createDeployment(DeploymentUnit unit)
{
- Deployment deployment = new DeploymentImpl();
- deployment.setType(getDeploymentType());
- deployment.setClassLoader(unit.getClassLoader());
+ Deployment dep = new DeploymentImpl();
+ dep.setType(getDeploymentType());
+ dep.setClassLoader(unit.getClassLoader());
- Service service = deployment.getService();
+ Service service = dep.getService();
WebMetaData webMetaData = unit.getAttachment(WebMetaData.class);
if (webMetaData == null)
throw new IllegalStateException("Deployment unit does not contain web meta data");
// Copy the attachments
- deployment.getContext().addAttachment(WebMetaData.class, webMetaData);
+ dep.getContext().addAttachment(WebMetaData.class, webMetaData);
List<Servlet> servlets = getRelevantServlets(webMetaData, unit.getClassLoader());
for (Servlet servlet : servlets)
@@ -96,7 +96,7 @@
}
}
- return deployment;
+ return dep;
}
@Override
Modified: trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/ModifyWebMetaDataDeployer.java
===================================================================
--- trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/ModifyWebMetaDataDeployer.java 2007-05-03 15:43:45 UTC (rev 2954)
+++ trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/ModifyWebMetaDataDeployer.java 2007-05-03 19:18:24 UTC (rev 2955)
@@ -28,6 +28,7 @@
import org.jboss.metadata.NameValuePair;
import org.jboss.metadata.WebMetaData;
import org.jboss.metadata.web.Servlet;
+import org.jboss.ws.core.server.ServiceEndpointPublisher;
import org.jboss.ws.core.utils.JavaUtils;
import org.jboss.ws.integration.Endpoint;
import org.jboss.ws.integration.deployment.AbstractDeployer;
@@ -41,19 +42,13 @@
*/
public class ModifyWebMetaDataDeployer extends AbstractDeployer
{
- // The service endpoint servlet that is specific for the deployed stack
- private String servletClass;
+ private ServiceEndpointPublisher serviceEndpointPublisher;
- public String getServletClass()
+ public void setServiceEndpointPublisher(ServiceEndpointPublisher serviceEndpointPublisher)
{
- return servletClass;
+ this.serviceEndpointPublisher = serviceEndpointPublisher;
}
- public void setServletClass(String servletName)
- {
- this.servletClass = servletName;
- }
-
@Override
public void create(Deployment dep)
{
@@ -74,7 +69,7 @@
// Nothing to do if we have an <init-param>
if (!isAlreadyModified(servlet) && !isJavaxServlet(orgServletClass, dep.getClassLoader()))
{
- servlet.setServletClass(getServletClass());
+ servlet.setServletClass(serviceEndpointPublisher.getServletClass());
NameValuePair initParam = new NameValuePair(Endpoint.SEPID_DOMAIN_ENDPOINT, orgServletClass);
servlet.addInitParam(initParam);
}
Modified: trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/UnifiedDeploymentInfoDeployer.java
===================================================================
--- trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/UnifiedDeploymentInfoDeployer.java 2007-05-03 15:43:45 UTC (rev 2954)
+++ trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/UnifiedDeploymentInfoDeployer.java 2007-05-03 19:18:24 UTC (rev 2955)
@@ -54,13 +54,13 @@
if (type.toString().startsWith("JAXWS"))
{
udi = new JAXWSDeployment(type);
- DeploymentInfoAdaptor.buildDeploymentInfo(udi, unit);
+ DeploymentInfoAdapter.buildDeploymentInfo(udi, unit);
}
else
{
WebservicesMetaData wsMetaData = dep.getContext().getAttachment(WebservicesMetaData.class);
udi = new JAXRPCDeployment(type, wsMetaData);
- DeploymentInfoAdaptor.buildDeploymentInfo(udi, unit);
+ DeploymentInfoAdapter.buildDeploymentInfo(udi, unit);
}
dep.getContext().addAttachment(UnifiedDeploymentInfo.class, udi);
Modified: trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/WebAppDeployerDeployer.java
===================================================================
--- trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/WebAppDeployerDeployer.java 2007-05-03 15:43:45 UTC (rev 2954)
+++ trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/jbossws/WebAppDeployerDeployer.java 2007-05-03 19:18:24 UTC (rev 2955)
@@ -34,7 +34,7 @@
import org.jboss.logging.Logger;
import org.jboss.virtual.VFS;
import org.jboss.virtual.VirtualFile;
-import org.jboss.ws.core.server.AbstractServiceEndpointPublisher;
+import org.jboss.ws.core.server.ServiceEndpointPublisher;
import org.jboss.ws.core.server.UnifiedDeploymentInfo;
import org.jboss.ws.integration.deployment.Deployer;
import org.jboss.ws.integration.deployment.Deployment;
@@ -46,22 +46,23 @@
* @author Thomas.Diesler(a)jboss.org
* @since 12-May-2006
*/
-public class WebAppDeployerDeployer extends AbstractServiceEndpointPublisher implements Deployer
+public class WebAppDeployerDeployer implements Deployer
{
// provide logging
private static Logger log = Logger.getLogger(WebAppDeployerDeployer.class);
private MainDeployer mainDeployer;
+ private ServiceEndpointPublisher serviceEndpointPublisher;
private Map<String, DeploymentContext> contextMap = new HashMap<String, DeploymentContext>();
- public MainDeployer getMainDeployer()
+ public void setMainDeployer(MainDeployer mainDeployer)
{
- return mainDeployer;
+ this.mainDeployer = mainDeployer;
}
- public void setMainDeployer(MainDeployer mainDeployer)
+ public void setServiceEndpointPublisher(ServiceEndpointPublisher serviceEndpointPublisher)
{
- this.mainDeployer = mainDeployer;
+ this.serviceEndpointPublisher = serviceEndpointPublisher;
}
public void create(Deployment dep)
@@ -75,7 +76,7 @@
log.debug("publishServiceEndpoint: " + warURL);
try
{
- rewriteWebXml(udi);
+ serviceEndpointPublisher.rewriteWebXml(udi);
DeploymentContext context = createDeploymentContext(warURL);
mainDeployer.addDeploymentContext(context);
Modified: trunk/integration-jboss50/src/resources/jbossws.sar/META-INF/jbossws-beans.xml
===================================================================
--- trunk/integration-jboss50/src/resources/jbossws.sar/META-INF/jbossws-beans.xml 2007-05-03 15:43:45 UTC (rev 2954)
+++ trunk/integration-jboss50/src/resources/jbossws.sar/META-INF/jbossws-beans.xml 2007-05-03 19:18:24 UTC (rev 2955)
@@ -146,7 +146,7 @@
<bean name="WSEndpointRegistryDeployer" class="org.jboss.ws.integration.deployment.EndpointRegistryDeployer"/>
<bean name="WSEndpointValidationDeployer" class="org.jboss.ws.integration.deployment.EndpointValidationDeployer"/>
<bean name="WSModifyWebMetaDataDeployer" class="org.jboss.ws.integration.jboss50.jbossws.ModifyWebMetaDataDeployer">
- <property name="servletClass">org.jboss.ws.integration.jboss50.jbossws.ServiceEndpointServlet</property>
+ <property name="serviceEndpointPublisher"><inject bean="WSServiceEndpointPublisher"/></property>
</bean>
<bean name="WSPublishContractDeployer" class="org.jboss.ws.integration.jboss50.jbossws.PublishContractDeployer"/>
<bean name="WSUnifiedDeploymentInfoDeployer" class="org.jboss.ws.integration.jboss50.jbossws.UnifiedDeploymentInfoDeployer"/>
@@ -154,10 +154,15 @@
<bean name="WSUnifiedMetaDataDeployer" class="org.jboss.ws.integration.jboss50.jbossws.UnifiedMetaDataDeployer"/>
<bean name="WSWebAppGeneratorDeployer" class="org.jboss.ws.integration.jboss50.jbossws.WebAppGeneratorDeployer"/>
<bean name="WSWebAppDeployerDeployer" class="org.jboss.ws.integration.jboss50.jbossws.WebAppDeployerDeployer">
- <property name="servletClass"><inject bean="WSModifyWebMetaDataDeployer" property="servletClass"/></property>
+ <property name="serviceEndpointPublisher"><inject bean="WSServiceEndpointPublisher"/></property>
<property name="mainDeployer"><inject bean="MainDeployer"/></property>
</bean>
+ <!-- Deployer helper beans -->
+ <bean name="WSServiceEndpointPublisher" class="org.jboss.ws.core.server.ServiceEndpointPublisher">
+ <property name="servletClass">org.jboss.ws.integration.jboss50.jbossws.ServiceEndpointServlet</property>
+ </bean>
+
<!--
Register DeployerHooks with JBoss deployers
-->
Modified: trunk/integration-tomcat/src/java/org/jboss/ws/integration/tomcat/DeploymentInfoAdaptor.java
===================================================================
--- trunk/integration-tomcat/src/java/org/jboss/ws/integration/tomcat/DeploymentInfoAdaptor.java 2007-05-03 15:43:45 UTC (rev 2954)
+++ trunk/integration-tomcat/src/java/org/jboss/ws/integration/tomcat/DeploymentInfoAdaptor.java 2007-05-03 19:18:24 UTC (rev 2955)
@@ -37,7 +37,7 @@
import javax.servlet.ServletContext;
import org.jboss.ws.WSException;
-import org.jboss.ws.core.server.AbstractServiceEndpointPublisher;
+import org.jboss.ws.core.server.ServiceEndpointPublisher;
import org.jboss.ws.core.server.UnifiedDeploymentInfo;
import org.jboss.ws.core.utils.DOMUtils;
import org.jboss.ws.integration.Endpoint;
Modified: trunk/integration-tomcat/src/java/org/jboss/ws/integration/tomcat/TomcatServiceEndpointPublisher.java
===================================================================
--- trunk/integration-tomcat/src/java/org/jboss/ws/integration/tomcat/TomcatServiceEndpointPublisher.java 2007-05-03 15:43:45 UTC (rev 2954)
+++ trunk/integration-tomcat/src/java/org/jboss/ws/integration/tomcat/TomcatServiceEndpointPublisher.java 2007-05-03 19:18:24 UTC (rev 2955)
@@ -31,9 +31,7 @@
import java.util.Set;
import org.jboss.logging.Logger;
-import org.jboss.util.NotImplementedException;
-import org.jboss.ws.core.server.AbstractServiceEndpointPublisher;
-import org.jboss.ws.core.server.UnifiedDeploymentInfo;
+import org.jboss.ws.core.server.ServiceEndpointPublisher;
/**
* Publish the HTTP service endpoint to Tomcat
@@ -41,11 +39,11 @@
* @author Thomas.Diesler(a)jboss.org
* @since 12-May-2006
*/
-public class TomcatServiceEndpointPublisher extends AbstractServiceEndpointPublisher
+public class TomcatServiceEndpointPublisher extends ServiceEndpointPublisher
{
// logging support
private static Logger log = Logger.getLogger(TomcatServiceEndpointPublisher.class);
-
+
private boolean isRunning;
private File targetDir;
private File deployDir;
@@ -67,7 +65,7 @@
{
this.targetDir = new File(dirName);
if (targetDir.isDirectory() == false)
- throw new IllegalArgumentException ("Target dir does not exist: " + targetDir);
+ throw new IllegalArgumentException("Target dir does not exist: " + targetDir);
}
public void setInterval(long interval)
@@ -86,24 +84,13 @@
File targetFile = new File(targetDir.getAbsolutePath() + "/" + new File(warURL.getFile()).getName());
if (targetFile.delete())
return "OK";
- else
- return "NOT FOUND";
+ else return "NOT FOUND";
}
- public String publishServiceEndpoint(UnifiedDeploymentInfo udi)
- {
- throw new NotImplementedException();
- }
-
- public String destroyServiceEndpoint(UnifiedDeploymentInfo udi)
- {
- throw new NotImplementedException();
- }
-
private void scanDeployDir()
{
List<File> fileList = Arrays.asList(deployDir.listFiles());
-
+
// deploy new files
for (File file : fileList)
{
@@ -113,7 +100,7 @@
deployedFiles.add(file);
}
}
-
+
// undeploy files
for (File file : deployedFiles)
{
@@ -133,7 +120,7 @@
{
System.out.println("Deploy file: " + file);
publishServiceEndpoint(file.toURL());
- }
+ }
else
{
System.out.println("Ignore file: " + file);
@@ -142,7 +129,7 @@
catch (Exception ex)
{
log.error("Cannot deploy file: " + file, ex);
- }
+ }
}
private void undeployFile(File file)
@@ -153,7 +140,7 @@
{
System.out.println("Undeploy file: " + file);
destroyServiceEndpoint(file.toURL());
- }
+ }
else
{
System.out.println("Ignore file: " + file);
@@ -162,7 +149,7 @@
catch (Exception ex)
{
log.error("Cannot undeploy file: " + file, ex);
- }
+ }
}
// bean lifecycle start
Modified: trunk/integration-tomcat/src/java/org/jboss/ws/integration/tomcat/wspublish.java
===================================================================
--- trunk/integration-tomcat/src/java/org/jboss/ws/integration/tomcat/wspublish.java 2007-05-03 15:43:45 UTC (rev 2954)
+++ trunk/integration-tomcat/src/java/org/jboss/ws/integration/tomcat/wspublish.java 2007-05-03 19:18:24 UTC (rev 2955)
@@ -46,7 +46,7 @@
// provide logging
protected final Logger log = Logger.getLogger(wspublish.class);
- public static final String DEFAULT_TOMCAT_SERVICE_ENDPOINT_SERVLET = "org.jboss.ws.integration.tomcat.TomcatServiceEndpointServlet";
+ public static final String DEFAULT_TOMCAT_SERVICE_ENDPOINT_SERVLET = TomcatServiceEndpointServlet.class.getName();
public URL process(URL warURL, File destDir, String servletClass) throws IOException
{
Deleted: trunk/jbossws-core/src/java/org/jboss/ws/core/server/AbstractServiceEndpointPublisher.java
===================================================================
--- trunk/jbossws-core/src/java/org/jboss/ws/core/server/AbstractServiceEndpointPublisher.java 2007-05-03 15:43:45 UTC (rev 2954)
+++ trunk/jbossws-core/src/java/org/jboss/ws/core/server/AbstractServiceEndpointPublisher.java 2007-05-03 19:18:24 UTC (rev 2955)
@@ -1,278 +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.core.server;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.InputStream;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-import javax.servlet.Servlet;
-
-import org.jboss.logging.Logger;
-import org.jboss.util.NotImplementedException;
-import org.jboss.ws.WSException;
-import org.jboss.ws.core.utils.DOMUtils;
-import org.jboss.ws.core.utils.DOMWriter;
-import org.jboss.ws.core.utils.IOUtils;
-import org.jboss.ws.core.utils.JavaUtils;
-import org.jboss.ws.integration.Endpoint;
-import org.w3c.dom.Element;
-
-/**
- * The publisher for web service endpoints
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 12-May-2006
- */
-public abstract class AbstractServiceEndpointPublisher
-{
- // logging support
- private static Logger log = Logger.getLogger(AbstractServiceEndpointPublisher.class);
-
- // The default bean name
- public static final String BEAN_NAME = "ServiceEndpointPublisher";
-
- // The configured service endpoint servlet
- private String servletClass;
-
- // The results of the URL rewriting
- public class RewriteResults
- {
- // The URL to the rewrittn web.xml
- public URL webXML;
- // Map<servlet-name, servlet-class> the servlet-class enties are the implementation beans
- public Map<String, String> sepTargetMap = new HashMap<String, String>();
- }
-
- public String getServletClass()
- {
- return servletClass;
- }
-
- public void setServletClass(String servletClass)
- {
- this.servletClass = servletClass;
- }
-
- public String publishServiceEndpoint(UnifiedDeploymentInfo udi) throws Exception
- {
- throw new NotImplementedException("Subclass should overwrite this method");
- }
-
- public String destroyServiceEndpoint(UnifiedDeploymentInfo udi) throws Exception
- {
- throw new NotImplementedException("Subclass should overwrite this method");
- }
-
- public RewriteResults rewriteWebXml(UnifiedDeploymentInfo udi)
- {
- URL warURL = udi.webappURL;
- File warFile = new File(warURL.getFile());
- if (warFile.isDirectory() == false)
- throw new WSException("Expected a war directory: " + warURL);
-
- File webXML = new File(warURL.getFile() + "/WEB-INF/web.xml");
- if (webXML.isFile() == false)
- throw new WSException("Cannot find web.xml: " + webXML);
-
- try
- {
- // After redeployment there might be a stale copy of the original web.xml.org, we delete it
- File orgWebXML = new File(webXML.getCanonicalPath() + ".org");
- orgWebXML.delete();
-
- // Rename the web.xml
- if (webXML.renameTo(orgWebXML) == false)
- throw new WSException("Cannot rename web.xml: " + orgWebXML);
-
- FileInputStream stream = new FileInputStream(orgWebXML);
- return rewriteWebXml(stream, webXML, udi.classLoader);
- }
- catch (RuntimeException rte)
- {
- throw rte;
- }
- catch (Exception e)
- {
- throw new WSException(e);
- }
- }
-
- public RewriteResults rewriteWebXml(InputStream source, File dest, ClassLoader loader) throws Exception
- {
- if (dest == null)
- {
- dest = File.createTempFile("jbossws-alt-web", "xml", IOUtils.createTempDirectory());
- dest.deleteOnExit();
- }
-
- Element root = DOMUtils.parse(source);
- RewriteResults results = modifyServletConfig(root, loader);
- results.webXML = dest.toURL();
-
- FileOutputStream fos = new FileOutputStream(dest);
- new DOMWriter(fos).setPrettyprint(true).print(root);
- fos.flush();
- fos.close();
-
- return results;
- }
-
- private RewriteResults modifyServletConfig(Element root, ClassLoader loader) throws ClassNotFoundException
- {
- RewriteResults results = new RewriteResults();
- Iterator itServlets = DOMUtils.getChildElements(root, "servlet");
- while (itServlets.hasNext())
- {
- Element servletElement = (Element)itServlets.next();
- String linkName = DOMUtils.getTextContent(DOMUtils.getFirstChildElement(servletElement, "servlet-name"));
-
- // find the servlet-class
- Element classElement = DOMUtils.getFirstChildElement(servletElement, "servlet-class");
-
- // JSP
- if (classElement == null)
- continue;
-
- String orgServletClassName = DOMUtils.getTextContent(classElement).trim();
-
- // Get the servlet class
- Class orgServletClass = null;
- if (loader != null)
- {
- try
- {
- orgServletClass = loader.loadClass(orgServletClassName);
- }
- catch (ClassNotFoundException ex)
- {
- log.warn("Cannot load servlet class: " + orgServletClassName);
- }
- }
-
- String targetBeanName = null;
-
- // Nothing to do if we have an <init-param>
- if (isAlreadyModified(servletElement))
- {
- Iterator itParams = DOMUtils.getChildElements(servletElement, "init-param");
- while (itParams.hasNext())
- {
- Element elParam = (Element)itParams.next();
- Element elParamName = DOMUtils.getFirstChildElement(elParam, "param-name");
- Element elParamValue = DOMUtils.getFirstChildElement(elParam, "param-value");
- if (Endpoint.SEPID_DOMAIN_ENDPOINT.equals(DOMUtils.getTextContent(elParamName)))
- {
- targetBeanName = DOMUtils.getTextContent(elParamValue);
- }
- }
- }
- else
- {
- // Check if it is a real servlet that we can ignore
- if (orgServletClass != null && JavaUtils.isAssignableFrom(Servlet.class, orgServletClass))
- {
- log.info("Ignore servlet: " + orgServletClassName);
- continue;
- }
- else if (orgServletClassName.endsWith("Servlet"))
- {
- log.info("Ignore <servlet-class> that ends with 'Servlet': " + orgServletClassName);
- continue;
- }
-
- // build a list of detached elements that come after <servlet-class>
- boolean startDetach = false;
- List<Element> detachedElements = new ArrayList<Element>();
- Iterator itDetached = DOMUtils.getChildElements(servletElement);
- while (itDetached.hasNext())
- {
- Element el = (Element)itDetached.next();
- if (startDetach == true)
- {
- detachedElements.add(el);
- servletElement.removeChild(el);
- }
- if (el.equals(classElement))
- {
- servletElement.removeChild(el);
- startDetach = true;
- }
- }
-
- // replace the class name
- classElement = (Element)DOMUtils.createElement("servlet-class");
- classElement.appendChild(DOMUtils.createTextNode(servletClass));
- classElement = (Element)servletElement.getOwnerDocument().importNode(classElement, true);
- servletElement.appendChild(classElement);
-
- // add additional init params
- if (orgServletClassName.equals(servletClass) == false)
- {
- Element paramElement = DOMUtils.createElement("init-param");
- paramElement.appendChild(DOMUtils.createElement("param-name")).appendChild(DOMUtils.createTextNode(Endpoint.SEPID_DOMAIN_ENDPOINT));
- paramElement.appendChild(DOMUtils.createElement("param-value")).appendChild(DOMUtils.createTextNode(orgServletClassName));
- paramElement = (Element)servletElement.getOwnerDocument().importNode(paramElement, true);
- servletElement.appendChild(paramElement);
- targetBeanName = orgServletClassName;
- }
-
- // reattach the elements
- itDetached = detachedElements.iterator();
- while (itDetached.hasNext())
- {
- Element el = (Element)itDetached.next();
- servletElement.appendChild(el);
- }
- }
-
- if (targetBeanName == null)
- throw new IllegalStateException("Cannot obtain service endpoint bean for: " + linkName);
-
- // remember the target bean name
- results.sepTargetMap.put(linkName, targetBeanName.trim());
- }
-
- return results;
- }
-
- // Return true if the web.xml is already modified
- private boolean isAlreadyModified(Element servletElement)
- {
- Iterator itParams = DOMUtils.getChildElements(servletElement, "init-param");
- while (itParams.hasNext())
- {
- Element elParam = (Element)itParams.next();
- Element elParamName = DOMUtils.getFirstChildElement(elParam, "param-name");
- if (Endpoint.SEPID_DOMAIN_ENDPOINT.equals(DOMUtils.getTextContent(elParamName)))
- return true;
- }
- return false;
- }
-}
\ No newline at end of file
Copied: trunk/jbossws-core/src/java/org/jboss/ws/core/server/ServiceEndpointPublisher.java (from rev 2953, trunk/jbossws-core/src/java/org/jboss/ws/core/server/AbstractServiceEndpointPublisher.java)
===================================================================
--- trunk/jbossws-core/src/java/org/jboss/ws/core/server/ServiceEndpointPublisher.java (rev 0)
+++ trunk/jbossws-core/src/java/org/jboss/ws/core/server/ServiceEndpointPublisher.java 2007-05-03 19:18:24 UTC (rev 2955)
@@ -0,0 +1,267 @@
+/*
+ * 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.core.server;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.InputStream;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import javax.servlet.Servlet;
+
+import org.jboss.logging.Logger;
+import org.jboss.ws.WSException;
+import org.jboss.ws.core.utils.DOMUtils;
+import org.jboss.ws.core.utils.DOMWriter;
+import org.jboss.ws.core.utils.IOUtils;
+import org.jboss.ws.core.utils.JavaUtils;
+import org.jboss.ws.integration.Endpoint;
+import org.w3c.dom.Element;
+
+/**
+ * The publisher for web service endpoints
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 12-May-2006
+ */
+public class ServiceEndpointPublisher
+{
+ // logging support
+ private static Logger log = Logger.getLogger(ServiceEndpointPublisher.class);
+
+ // The default bean name
+ public static final String BEAN_NAME = "ServiceEndpointPublisher";
+
+ // The configured service endpoint servlet
+ private String servletClass;
+
+ // The results of the URL rewriting
+ public class RewriteResults
+ {
+ // The URL to the rewrittn web.xml
+ public URL webXML;
+ // Map<servlet-name, servlet-class> the servlet-class enties are the implementation beans
+ public Map<String, String> sepTargetMap = new HashMap<String, String>();
+ }
+
+ public String getServletClass()
+ {
+ return servletClass;
+ }
+
+ public void setServletClass(String servletClass)
+ {
+ this.servletClass = servletClass;
+ }
+
+ public RewriteResults rewriteWebXml(UnifiedDeploymentInfo udi)
+ {
+ URL warURL = udi.webappURL;
+ File warFile = new File(warURL.getFile());
+ if (warFile.isDirectory() == false)
+ throw new WSException("Expected a war directory: " + warURL);
+
+ File webXML = new File(warURL.getFile() + "/WEB-INF/web.xml");
+ if (webXML.isFile() == false)
+ throw new WSException("Cannot find web.xml: " + webXML);
+
+ try
+ {
+ // After redeployment there might be a stale copy of the original web.xml.org, we delete it
+ File orgWebXML = new File(webXML.getCanonicalPath() + ".org");
+ orgWebXML.delete();
+
+ // Rename the web.xml
+ if (webXML.renameTo(orgWebXML) == false)
+ throw new WSException("Cannot rename web.xml: " + orgWebXML);
+
+ FileInputStream stream = new FileInputStream(orgWebXML);
+ return rewriteWebXml(stream, webXML, udi.classLoader);
+ }
+ catch (RuntimeException rte)
+ {
+ throw rte;
+ }
+ catch (Exception e)
+ {
+ throw new WSException(e);
+ }
+ }
+
+ public RewriteResults rewriteWebXml(InputStream source, File dest, ClassLoader loader) throws Exception
+ {
+ if (dest == null)
+ {
+ dest = File.createTempFile("jbossws-alt-web", "xml", IOUtils.createTempDirectory());
+ dest.deleteOnExit();
+ }
+
+ Element root = DOMUtils.parse(source);
+ RewriteResults results = modifyServletConfig(root, loader);
+ results.webXML = dest.toURL();
+
+ FileOutputStream fos = new FileOutputStream(dest);
+ new DOMWriter(fos).setPrettyprint(true).print(root);
+ fos.flush();
+ fos.close();
+
+ return results;
+ }
+
+ private RewriteResults modifyServletConfig(Element root, ClassLoader loader) throws ClassNotFoundException
+ {
+ RewriteResults results = new RewriteResults();
+ Iterator itServlets = DOMUtils.getChildElements(root, "servlet");
+ while (itServlets.hasNext())
+ {
+ Element servletElement = (Element)itServlets.next();
+ String linkName = DOMUtils.getTextContent(DOMUtils.getFirstChildElement(servletElement, "servlet-name"));
+
+ // find the servlet-class
+ Element classElement = DOMUtils.getFirstChildElement(servletElement, "servlet-class");
+
+ // JSP
+ if (classElement == null)
+ continue;
+
+ String orgServletClassName = DOMUtils.getTextContent(classElement).trim();
+
+ // Get the servlet class
+ Class orgServletClass = null;
+ if (loader != null)
+ {
+ try
+ {
+ orgServletClass = loader.loadClass(orgServletClassName);
+ }
+ catch (ClassNotFoundException ex)
+ {
+ log.warn("Cannot load servlet class: " + orgServletClassName);
+ }
+ }
+
+ String targetBeanName = null;
+
+ // Nothing to do if we have an <init-param>
+ if (isAlreadyModified(servletElement))
+ {
+ Iterator itParams = DOMUtils.getChildElements(servletElement, "init-param");
+ while (itParams.hasNext())
+ {
+ Element elParam = (Element)itParams.next();
+ Element elParamName = DOMUtils.getFirstChildElement(elParam, "param-name");
+ Element elParamValue = DOMUtils.getFirstChildElement(elParam, "param-value");
+ if (Endpoint.SEPID_DOMAIN_ENDPOINT.equals(DOMUtils.getTextContent(elParamName)))
+ {
+ targetBeanName = DOMUtils.getTextContent(elParamValue);
+ }
+ }
+ }
+ else
+ {
+ // Check if it is a real servlet that we can ignore
+ if (orgServletClass != null && JavaUtils.isAssignableFrom(Servlet.class, orgServletClass))
+ {
+ log.info("Ignore servlet: " + orgServletClassName);
+ continue;
+ }
+ else if (orgServletClassName.endsWith("Servlet"))
+ {
+ log.info("Ignore <servlet-class> that ends with 'Servlet': " + orgServletClassName);
+ continue;
+ }
+
+ // build a list of detached elements that come after <servlet-class>
+ boolean startDetach = false;
+ List<Element> detachedElements = new ArrayList<Element>();
+ Iterator itDetached = DOMUtils.getChildElements(servletElement);
+ while (itDetached.hasNext())
+ {
+ Element el = (Element)itDetached.next();
+ if (startDetach == true)
+ {
+ detachedElements.add(el);
+ servletElement.removeChild(el);
+ }
+ if (el.equals(classElement))
+ {
+ servletElement.removeChild(el);
+ startDetach = true;
+ }
+ }
+
+ // replace the class name
+ classElement = (Element)DOMUtils.createElement("servlet-class");
+ classElement.appendChild(DOMUtils.createTextNode(servletClass));
+ classElement = (Element)servletElement.getOwnerDocument().importNode(classElement, true);
+ servletElement.appendChild(classElement);
+
+ // add additional init params
+ if (orgServletClassName.equals(servletClass) == false)
+ {
+ Element paramElement = DOMUtils.createElement("init-param");
+ paramElement.appendChild(DOMUtils.createElement("param-name")).appendChild(DOMUtils.createTextNode(Endpoint.SEPID_DOMAIN_ENDPOINT));
+ paramElement.appendChild(DOMUtils.createElement("param-value")).appendChild(DOMUtils.createTextNode(orgServletClassName));
+ paramElement = (Element)servletElement.getOwnerDocument().importNode(paramElement, true);
+ servletElement.appendChild(paramElement);
+ targetBeanName = orgServletClassName;
+ }
+
+ // reattach the elements
+ itDetached = detachedElements.iterator();
+ while (itDetached.hasNext())
+ {
+ Element el = (Element)itDetached.next();
+ servletElement.appendChild(el);
+ }
+ }
+
+ if (targetBeanName == null)
+ throw new IllegalStateException("Cannot obtain service endpoint bean for: " + linkName);
+
+ // remember the target bean name
+ results.sepTargetMap.put(linkName, targetBeanName.trim());
+ }
+
+ return results;
+ }
+
+ // Return true if the web.xml is already modified
+ private boolean isAlreadyModified(Element servletElement)
+ {
+ Iterator itParams = DOMUtils.getChildElements(servletElement, "init-param");
+ while (itParams.hasNext())
+ {
+ Element elParam = (Element)itParams.next();
+ Element elParamName = DOMUtils.getFirstChildElement(elParam, "param-name");
+ if (Endpoint.SEPID_DOMAIN_ENDPOINT.equals(DOMUtils.getTextContent(elParamName)))
+ return true;
+ }
+ return false;
+ }
+}
\ No newline at end of file
17 years, 8 months