Author: thomas.diesler(a)jboss.com
Date: 2006-10-31 12:39:12 -0500 (Tue, 31 Oct 2006)
New Revision: 1335
Added:
trunk/src/main/java/org/jboss/ws/deployment/AbstractServiceEndpointPublisher.java
trunk/src/main/java/org/jboss/ws/integration/jboss50/AbstractWebServiceDeployer.java
trunk/src/main/java/org/jboss/ws/integration/jboss50/ApplicationMetaDataAdaptor.java
trunk/src/main/java/org/jboss/ws/integration/jboss50/JBossServiceEndpointServlet.java
trunk/src/main/java/org/jboss/ws/integration/jboss50/ServiceEndpointGeneratorEJB.java
trunk/src/main/java/org/jboss/ws/integration/jboss50/ServiceEndpointGeneratorEJB3.java
trunk/src/main/java/org/jboss/ws/integration/jboss50/ServiceEndpointPublisher.java
trunk/src/main/java/org/jboss/ws/integration/jboss50/WebServiceDeployerEJB.java
trunk/src/main/java/org/jboss/ws/integration/jbossall/ServiceEndpointInvokerEJB3.java
trunk/src/main/java/org/jboss/ws/integration/jbossall/ServiceEndpointServlet.java
trunk/src/main/java/org/jboss/ws/server/AbstractServiceEndpointServlet.java
Removed:
trunk/src/main/java/org/jboss/ws/deployment/ServiceEndpointPublisher.java
trunk/src/main/java/org/jboss/ws/integration/jboss/
trunk/src/main/java/org/jboss/ws/integration/jboss40/ServiceEndpointInvokerEJB3.java
trunk/src/main/java/org/jboss/ws/server/StandardEndpointServlet.java
trunk/src/test/resources/jaxws/jbws944/
Modified:
trunk/.classpath
trunk/build.xml
trunk/src/ant/build-thirdparty.xml
trunk/src/main/java/org/jboss/ws/deployment/JAXWSProviderMetaDataBuilderJSE.java
trunk/src/main/java/org/jboss/ws/deployment/JSR109ServerMetaDataBuilder.java
trunk/src/main/java/org/jboss/ws/deployment/JSR181MetaDataBuilderEJB21.java
trunk/src/main/java/org/jboss/ws/deployment/JSR181MetaDataBuilderEJB3.java
trunk/src/main/java/org/jboss/ws/deployment/JSR181MetaDataBuilderJSE.java
trunk/src/main/java/org/jboss/ws/deployment/MetaDataBuilder.java
trunk/src/main/java/org/jboss/ws/deployment/UnifiedDeploymentInfo.java
trunk/src/main/java/org/jboss/ws/integration/jboss50/DeploymentInfoAdaptor.java
trunk/src/main/java/org/jboss/ws/integration/jboss50/WebServiceDeployerEJB3.java
trunk/src/main/java/org/jboss/ws/integration/tomcat/DeploymentInfoAdaptor.java
trunk/src/main/java/org/jboss/ws/integration/tomcat/TomcatServiceEndpointPublisher.java
trunk/src/main/java/org/jboss/ws/integration/tomcat/TomcatServiceEndpointServlet.java
trunk/src/main/java/org/jboss/ws/jaxrpc/ServiceReferenceable.java
trunk/src/main/java/org/jboss/ws/metadata/EndpointMetaData.java
trunk/src/main/java/org/jboss/ws/metadata/UnifiedMetaData.java
trunk/src/main/resources/jbossws.beans/META-INF/jboss-beans.xml
trunk/src/main/resources/jbossws.deployer/META-INF/jbossws-deployer-beans.xml
trunk/src/test/ant/build-jars-jaxws.xml
trunk/src/test/java/org/jboss/test/ws/jaxws/jbws944/EJB3Bean01.java
trunk/src/test/java/org/jboss/test/ws/jaxws/jbws944/EndpointInterface.java
trunk/src/test/java/org/jboss/test/ws/jaxws/jbws944/JBWS944TestCase.java
Log:
EJB3 deployer, more to come
Modified: trunk/.classpath
===================================================================
--- trunk/.classpath 2006-10-31 05:34:33 UTC (rev 1334)
+++ trunk/.classpath 2006-10-31 17:39:12 UTC (rev 1335)
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
- <classpathentry kind="src" path="src/main/java"/>
+ <classpathentry excluding="org/jboss/ws/integration/jboss40/"
kind="src" path="src/main/java"/>
<classpathentry excluding="org/jboss/test/ws/interop/" kind="src"
path="src/test/java"/>
<classpathentry kind="lib" path="thirdparty/activation.jar"/>
<classpathentry kind="lib" path="thirdparty/mailapi.jar"/>
@@ -23,12 +23,12 @@
<classpathentry kind="lib"
path="thirdparty/wstx-lgpl-2.0.6.jar"/>
<classpathentry kind="lib" path="thirdparty/jaxb-api.jar"/>
<classpathentry kind="lib" path="thirdparty/ant.jar"/>
- <classpathentry kind="lib"
path="thirdparty/jboss-container.jar"/>
+ <classpathentry
sourcepath="/home/tdiesler/svn/jbossmc/trunk/container/src/main"
kind="lib" path="thirdparty/jboss-container.jar"/>
<classpathentry kind="lib"
path="thirdparty/jboss-microcontainer.jar"/>
<classpathentry kind="lib"
path="thirdparty/jboss-remoting.jar"/>
<classpathentry kind="lib" path="thirdparty/jaxb-xjc.jar"/>
<classpathentry kind="lib" path="thirdparty/jaxb-impl.jar"/>
<classpathentry
sourcepath="/home/tdiesler/svn/jboss/common/common-core/trunk/src/main/java"
kind="lib" path="thirdparty/jboss-common.jar"/>
- <classpathentry
sourcepath="/home/tdiesler/svn/jboss/jbossmc/trunk/deployers/src/main"
kind="lib" path="thirdparty/jboss-deployers.jar"/>
+ <classpathentry
sourcepath="/home/tdiesler/svn/jbossmc/trunk/deployers/src/main"
kind="lib" path="thirdparty/jboss-deployers.jar"/>
<classpathentry kind="output" path="output-eclipse"/>
</classpath>
Modified: trunk/build.xml
===================================================================
--- trunk/build.xml 2006-10-31 05:34:33 UTC (rev 1334)
+++ trunk/build.xml 2006-10-31 17:39:12 UTC (rev 1335)
@@ -262,10 +262,15 @@
<mkdir dir="${build.lib.dir}/jbossws.beans/META-INF"/>
<copy todir="${build.lib.dir}/jbossws.beans/META-INF"
file="${build.resources.dir}/jbossws.beans/META-INF/jboss-beans.xml"/>
- <!-- Build jbossws.beans -->
+ <!-- Build jbossws.deployer -->
<mkdir dir="${build.lib.dir}/jbossws.deployer/META-INF"/>
<copy todir="${build.lib.dir}/jbossws.deployer/META-INF"
file="${build.resources.dir}/jbossws.deployer/META-INF/jbossws-deployer-beans.xml"/>
- <copy todir="${build.lib.dir}/jbossws.deployer"
file="${build.lib.dir}/jbossws-jboss-integration.jar"/>
+ <copy todir="${build.lib.dir}/jbossws.deployer">
+ <fileset dir="${build.lib.dir}">
+ <include name="jbossws-jboss-integration.jar"/>
+ <include name="jbossws-core.jar"/>
+ </fileset>
+ </copy>
<!-- Build jbossws-client.jar -->
<jar jarfile="${build.lib.dir}/jbossws-client.jar"
manifest="${build.etc.dir}/default.mf">
Modified: trunk/src/ant/build-thirdparty.xml
===================================================================
--- trunk/src/ant/build-thirdparty.xml 2006-10-31 05:34:33 UTC (rev 1334)
+++ trunk/src/ant/build-thirdparty.xml 2006-10-31 17:39:12 UTC (rev 1335)
@@ -109,8 +109,8 @@
<pathelement location="${jboss.lib}/jboss-system.jar"/>
<pathelement location="${jboss.server.lib}/jboss.jar"/>
<pathelement location="${jboss.client}/jbosssx-client.jar"/>
- <pathelement
location="${jboss.server.deployers}/jboss-aop-jdk50.deployer/jboss-aop-jdk50.jar"/>
- <pathelement
location="${jboss.server.deployers}/jboss-aop-jdk50.deployer/jboss-aspect-library-jdk50.jar"/>
+ <pathelement
location="${jboss.server.deployers}/jboss-aop-jboss5.deployer/jboss-aop-jdk50.jar"/>
+ <pathelement
location="${jboss.server.deployers}/jboss-aop-jboss5.deployer/jboss-aspect-library-jdk50.jar"/>
</path>
</target>
Added: trunk/src/main/java/org/jboss/ws/deployment/AbstractServiceEndpointPublisher.java
===================================================================
---
trunk/src/main/java/org/jboss/ws/deployment/AbstractServiceEndpointPublisher.java 2006-10-31
05:34:33 UTC (rev 1334)
+++
trunk/src/main/java/org/jboss/ws/deployment/AbstractServiceEndpointPublisher.java 2006-10-31
17:39:12 UTC (rev 1335)
@@ -0,0 +1,230 @@
+/*
+ * 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.deployment;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+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 org.jboss.logging.Logger;
+import org.jboss.ws.utils.DOMUtils;
+import org.jboss.ws.utils.DOMWriter;
+import org.jboss.ws.WSException;
+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
+{
+ // default bean name
+ public static final String BEAN_NAME = "ServiceEndpointPublisher";
+
+ // The servlet init param in web.xml that is the service endpoint class
+ public static final String INIT_PARAM_SERVICE_ENDPOINT_IMPL =
"ServiceEndpointImpl";
+
+ // logging support
+ private static Logger log = Logger.getLogger(AbstractServiceEndpointPublisher.class);
+
+ // The configured service endpoint servlet
+ protected String servletName;
+
+ public String getServiceEndpointServlet()
+ {
+ return servletName;
+ }
+
+ public void setServiceEndpointServlet(String servletName)
+ {
+ this.servletName = servletName;
+ }
+
+ public abstract String publishServiceEndpoint(URL warURL) throws Exception;
+
+ public abstract String destroyServiceEndpoint(URL warURL) throws Exception;
+
+ public abstract String publishServiceEndpoint(UnifiedDeploymentInfo udi) throws
Exception;
+
+ public abstract String destroyServiceEndpoint(UnifiedDeploymentInfo udi) throws
Exception;
+
+ public Map<String, String> rewriteWebXML(URL warURL)
+ {
+ 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
+ {
+ Element root = DOMUtils.parse(new FileInputStream(webXML));
+
+ String warName = warFile.getName();
+ Map<String, String> sepTargetMap = modifyServletConfig(root, warName);
+
+ // 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);
+
+ FileOutputStream fos = new FileOutputStream(webXML);
+ new DOMWriter(fos).setPrettyprint(true).print(root);
+ fos.close();
+
+ return sepTargetMap;
+ }
+ catch (RuntimeException rte)
+ {
+ throw rte;
+ }
+ catch (Exception e)
+ {
+ throw new WSException(e);
+ }
+ }
+
+ private Map<String, String> modifyServletConfig(Element root, String warName)
+ {
+ Map<String, String> sepTargetMap = new HashMap<String, String>();
+
+ 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");
+ if (classElement == null)
+ throw new WSException("Cannot find <servlet-class> for
servlet-name: " + linkName);
+
+ // Get the servlet class
+ String servletClassName = DOMUtils.getTextContent(classElement);
+
+ String targetBeanName = null;
+
+ // Nothing to do if we have an <init-param>
+ if (isAlreadyModified(servletElement) == false)
+ {
+ // Check if it is a real servlet that we can ignore
+ if (servletClassName.endsWith("Servlet"))
+ {
+ log.info("Ignore <servlet-class> that ends with
'Servlet': " + servletClassName);
+ 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(servletName));
+ classElement =
(Element)servletElement.getOwnerDocument().importNode(classElement, true);
+ servletElement.appendChild(classElement);
+
+ // add additional init params
+ if (servletClassName.equals(servletName) == false)
+ {
+ Element paramElement = DOMUtils.createElement("init-param");
+
paramElement.appendChild(DOMUtils.createElement("param-name")).appendChild(DOMUtils.createTextNode(INIT_PARAM_SERVICE_ENDPOINT_IMPL));
+
paramElement.appendChild(DOMUtils.createElement("param-value")).appendChild(DOMUtils.createTextNode(servletClassName));
+ paramElement =
(Element)servletElement.getOwnerDocument().importNode(paramElement, true);
+ servletElement.appendChild(paramElement);
+ targetBeanName = servletClassName;
+ }
+
+ // reattach the elements
+ itDetached = detachedElements.iterator();
+ while (itDetached.hasNext())
+ {
+ Element el = (Element)itDetached.next();
+ servletElement.appendChild(el);
+ }
+ }
+ else
+ {
+ 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
(INIT_PARAM_SERVICE_ENDPOINT_IMPL.equals(DOMUtils.getTextContent(elParamName)))
+ {
+ targetBeanName = DOMUtils.getTextContent(elParamValue);
+ }
+ }
+ }
+
+ if (targetBeanName == null)
+ throw new IllegalStateException("Cannot obtain service endpoint bean
for: " + linkName);
+
+ sepTargetMap.put(linkName, targetBeanName.trim());
+ }
+
+ return sepTargetMap;
+ }
+
+ // 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
(INIT_PARAM_SERVICE_ENDPOINT_IMPL.equals(DOMUtils.getTextContent(elParamName)))
+ return true;
+ }
+ return false;
+ }
+}
\ No newline at end of file
Property changes on:
trunk/src/main/java/org/jboss/ws/deployment/AbstractServiceEndpointPublisher.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified:
trunk/src/main/java/org/jboss/ws/deployment/JAXWSProviderMetaDataBuilderJSE.java
===================================================================
---
trunk/src/main/java/org/jboss/ws/deployment/JAXWSProviderMetaDataBuilderJSE.java 2006-10-31
05:34:33 UTC (rev 1334)
+++
trunk/src/main/java/org/jboss/ws/deployment/JAXWSProviderMetaDataBuilderJSE.java 2006-10-31
17:39:12 UTC (rev 1335)
@@ -70,6 +70,7 @@
try
{
UnifiedMetaData wsMetaData = new UnifiedMetaData();
+ wsMetaData.setDeploymentName(udi.getCanonicalName());
wsMetaData.setResourceLoader(resourceLoader);
wsMetaData.setClassLoader(classLoader);
Modified: trunk/src/main/java/org/jboss/ws/deployment/JSR109ServerMetaDataBuilder.java
===================================================================
---
trunk/src/main/java/org/jboss/ws/deployment/JSR109ServerMetaDataBuilder.java 2006-10-31
05:34:33 UTC (rev 1334)
+++
trunk/src/main/java/org/jboss/ws/deployment/JSR109ServerMetaDataBuilder.java 2006-10-31
17:39:12 UTC (rev 1335)
@@ -77,6 +77,7 @@
{
// For every webservice-description build the ServiceMetaData
UnifiedMetaData wsMetaData = new UnifiedMetaData();
+ wsMetaData.setDeploymentName(udi.getCanonicalName());
wsMetaData.setResourceLoader(resourceLoader);
wsMetaData.setClassLoader(classLoader);
@@ -273,11 +274,11 @@
*/
protected void initTransportGuaranteeJSE(UnifiedDeploymentInfo udi, EndpointMetaData
epMetaData, String servletLink) throws IOException
{
- File warFile = new File(udi.localUrl.getFile());
+ File warFile = new File(udi.url.getFile());
if (warFile.isDirectory() == false)
- throw new WSException("Expected a war directory: " + udi.localUrl);
+ throw new WSException("Expected a war directory: " + udi.url);
- File webXML = new File(udi.localUrl.getFile() + "/WEB-INF/web.xml");
+ File webXML = new File(udi.url.getFile() + "/WEB-INF/web.xml");
if (webXML.isFile() == false)
throw new WSException("Cannot find web.xml: " + webXML);
Modified: trunk/src/main/java/org/jboss/ws/deployment/JSR181MetaDataBuilderEJB21.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/deployment/JSR181MetaDataBuilderEJB21.java 2006-10-31
05:34:33 UTC (rev 1334)
+++ trunk/src/main/java/org/jboss/ws/deployment/JSR181MetaDataBuilderEJB21.java 2006-10-31
17:39:12 UTC (rev 1335)
@@ -53,6 +53,7 @@
try
{
UnifiedMetaData wsMetaData = new UnifiedMetaData();
+ wsMetaData.setDeploymentName(udi.getCanonicalName());
wsMetaData.setResourceLoader(resourceLoader);
wsMetaData.setClassLoader(classLoader);
Modified: trunk/src/main/java/org/jboss/ws/deployment/JSR181MetaDataBuilderEJB3.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/deployment/JSR181MetaDataBuilderEJB3.java 2006-10-31
05:34:33 UTC (rev 1334)
+++ trunk/src/main/java/org/jboss/ws/deployment/JSR181MetaDataBuilderEJB3.java 2006-10-31
17:39:12 UTC (rev 1335)
@@ -55,6 +55,7 @@
try
{
UnifiedMetaData wsMetaData = new UnifiedMetaData();
+ wsMetaData.setDeploymentName(udi.getCanonicalName());
wsMetaData.setResourceLoader(resourceLoader);
wsMetaData.setClassLoader(classLoader);
Modified: trunk/src/main/java/org/jboss/ws/deployment/JSR181MetaDataBuilderJSE.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/deployment/JSR181MetaDataBuilderJSE.java 2006-10-31
05:34:33 UTC (rev 1334)
+++ trunk/src/main/java/org/jboss/ws/deployment/JSR181MetaDataBuilderJSE.java 2006-10-31
17:39:12 UTC (rev 1335)
@@ -52,6 +52,7 @@
try
{
UnifiedMetaData wsMetaData = new UnifiedMetaData();
+ wsMetaData.setDeploymentName(udi.getCanonicalName());
wsMetaData.setResourceLoader(resourceLoader);
wsMetaData.setClassLoader(classLoader);
Modified: trunk/src/main/java/org/jboss/ws/deployment/MetaDataBuilder.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/deployment/MetaDataBuilder.java 2006-10-31 05:34:33
UTC (rev 1334)
+++ trunk/src/main/java/org/jboss/ws/deployment/MetaDataBuilder.java 2006-10-31 17:39:12
UTC (rev 1335)
@@ -96,14 +96,14 @@
private final static Logger log = Logger.getLogger(MetaDataBuilder.class);
protected ClassLoader classLoader;
- protected URLClassLoader resourceLoader;
+ protected ClassLoader resourceLoader;
public void setClassLoader(ClassLoader classLoader)
{
this.classLoader = classLoader;
}
- public void setResourceLoader(URLClassLoader resourceLoader)
+ public void setResourceLoader(ClassLoader resourceLoader)
{
this.resourceLoader = resourceLoader;
}
Deleted: trunk/src/main/java/org/jboss/ws/deployment/ServiceEndpointPublisher.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/deployment/ServiceEndpointPublisher.java 2006-10-31
05:34:33 UTC (rev 1334)
+++ trunk/src/main/java/org/jboss/ws/deployment/ServiceEndpointPublisher.java 2006-10-31
17:39:12 UTC (rev 1335)
@@ -1,242 +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.deployment;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-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 org.jboss.logging.Logger;
-import org.jboss.ws.utils.DOMUtils;
-import org.jboss.ws.utils.DOMWriter;
-import org.jboss.ws.WSException;
-import org.w3c.dom.Element;
-
-/**
- * The publisher for web service endpoints
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 12-May-2006
- */
-public abstract class ServiceEndpointPublisher
-{
- // default bean name
- public static final String BEAN_NAME = "ServiceEndpointPublisher";
-
- // The servlet init param in web.xml that is the service endpoint class
- public static final String INIT_PARAM_SERVICE_ENDPOINT_IMPL =
"ServiceEndpointImpl";
-
- // logging support
- private static Logger log = Logger.getLogger(ServiceEndpointPublisher.class);
-
- // The service endpoint deployer
- protected ServiceEndpointDeployer serviceEndpointDeployer;
- // The configured service endpoint servlet
- protected String servletName;
-
- public ServiceEndpointDeployer getServiceEndpointDeployer()
- {
- return serviceEndpointDeployer;
- }
-
- public void setServiceEndpointDeployer(ServiceEndpointDeployer
serviceEndpointDeployer)
- {
- this.serviceEndpointDeployer = serviceEndpointDeployer;
- }
-
- public String getServiceEndpointServlet()
- {
- return servletName;
- }
-
- public void setServiceEndpointServlet(String servletName)
- {
- this.servletName = servletName;
- }
-
- public abstract String publishServiceEndpoint(URL warURL) throws Exception;
-
- public abstract String destroyServiceEndpoint(URL warURL) throws Exception;
-
- public abstract String publishServiceEndpoint(UnifiedDeploymentInfo udi) throws
Exception;
-
- public abstract String destroyServiceEndpoint(UnifiedDeploymentInfo udi) throws
Exception;
-
- public Map<String, String> rewriteWebXML(URL warURL)
- {
- 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
- {
- Element root = DOMUtils.parse(new FileInputStream(webXML));
-
- String warName = warFile.getName();
- Map<String, String> sepTargetMap = modifyServletConfig(root, warName);
-
- // 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);
-
- FileOutputStream fos = new FileOutputStream(webXML);
- new DOMWriter(fos).setPrettyprint(true).print(root);
- fos.close();
-
- return sepTargetMap;
- }
- catch (RuntimeException rte)
- {
- throw rte;
- }
- catch (Exception e)
- {
- throw new WSException(e);
- }
- }
-
- private Map<String, String> modifyServletConfig(Element root, String warName)
- {
- Map<String, String> sepTargetMap = new HashMap<String, String>();
-
- 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");
- if (classElement == null)
- throw new WSException("Cannot find <servlet-class> for
servlet-name: " + linkName);
-
- // Get the servlet class
- String servletClassName = DOMUtils.getTextContent(classElement);
-
- String targetBeanName = null;
-
- // Nothing to do if we have an <init-param>
- if (isAlreadyModified(servletElement) == false)
- {
- // Check if it is a real servlet that we can ignore
- if (servletClassName.endsWith("Servlet"))
- {
- log.info("Ignore <servlet-class> that ends with
'Servlet': " + servletClassName);
- 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(servletName));
- classElement =
(Element)servletElement.getOwnerDocument().importNode(classElement, true);
- servletElement.appendChild(classElement);
-
- // add additional init params
- if (servletClassName.equals(servletName) == false)
- {
- Element paramElement = DOMUtils.createElement("init-param");
-
paramElement.appendChild(DOMUtils.createElement("param-name")).appendChild(DOMUtils.createTextNode(INIT_PARAM_SERVICE_ENDPOINT_IMPL));
-
paramElement.appendChild(DOMUtils.createElement("param-value")).appendChild(DOMUtils.createTextNode(servletClassName));
- paramElement =
(Element)servletElement.getOwnerDocument().importNode(paramElement, true);
- servletElement.appendChild(paramElement);
- targetBeanName = servletClassName;
- }
-
- // reattach the elements
- itDetached = detachedElements.iterator();
- while (itDetached.hasNext())
- {
- Element el = (Element)itDetached.next();
- servletElement.appendChild(el);
- }
- }
- else
- {
- 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
(INIT_PARAM_SERVICE_ENDPOINT_IMPL.equals(DOMUtils.getTextContent(elParamName)))
- {
- targetBeanName = DOMUtils.getTextContent(elParamValue);
- }
- }
- }
-
- if (targetBeanName == null)
- throw new IllegalStateException("Cannot obtain service endpoint bean
for: " + linkName);
-
- sepTargetMap.put(linkName, targetBeanName.trim());
- }
-
- return sepTargetMap;
- }
-
- // 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
(INIT_PARAM_SERVICE_ENDPOINT_IMPL.equals(DOMUtils.getTextContent(elParamName)))
- return true;
- }
- return false;
- }
-}
\ No newline at end of file
Modified: trunk/src/main/java/org/jboss/ws/deployment/UnifiedDeploymentInfo.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/deployment/UnifiedDeploymentInfo.java 2006-10-31
05:34:33 UTC (rev 1334)
+++ trunk/src/main/java/org/jboss/ws/deployment/UnifiedDeploymentInfo.java 2006-10-31
17:39:12 UTC (rev 1335)
@@ -57,12 +57,9 @@
/** The suffix of the deployment url */
public String shortName;
- /** The URL identifing this SDI **/
+ /** The URL identifing this deployment **/
public URL url;
- /** An optional URL to a local copy of the deployment */
- public URL localUrl;
-
/** We can hold "typed" metadata */
public Object metaData;
@@ -70,16 +67,11 @@
public ClassLoader annotationsCl;
/** Local Cl is a CL that is used for metadata loading */
- public URLClassLoader localCl;
+ public ClassLoader localCl;
/** Unified CL is a global scope class loader **/
public ClassLoader ucl;
- /** The variable deployedObject can contain the MBean that
- * is created through the deployment
- */
- public ObjectName deployedObject;
-
/** An arbitrary map of state associated with the deployment */
public Map<String, Object> context = new HashMap<String, Object>();
@@ -91,4 +83,15 @@
name = parent.getCanonicalName() + "/" + name;
return name;
}
+
+ public String toString()
+ {
+ StringBuilder builder = new StringBuilder();
+ builder.append("[");
+ builder.append("type=" + type);
+ builder.append(",shortName=" + shortName);
+ builder.append(",url=" + url);
+ builder.append("]");
+ return builder.toString();
+ }
}
Deleted:
trunk/src/main/java/org/jboss/ws/integration/jboss40/ServiceEndpointInvokerEJB3.java
===================================================================
---
trunk/src/main/java/org/jboss/ws/integration/jboss40/ServiceEndpointInvokerEJB3.java 2006-10-31
05:34:33 UTC (rev 1334)
+++
trunk/src/main/java/org/jboss/ws/integration/jboss40/ServiceEndpointInvokerEJB3.java 2006-10-31
17:39:12 UTC (rev 1335)
@@ -1,145 +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.jboss40;
-
-// $Id$
-
-import java.lang.reflect.Method;
-
-import javax.management.MBeanServer;
-import javax.management.ObjectName;
-import javax.xml.rpc.soap.SOAPFaultException;
-
-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.binding.EndpointInvocation;
-import org.jboss.ws.deployment.UnifiedDeploymentInfo;
-import org.jboss.ws.server.ServiceEndpointInfo;
-import org.jboss.ws.server.ServiceEndpointInvoker;
-import org.jboss.ws.server.AbstractServiceEndpointInvoker;
-import org.jboss.ws.utils.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 initServiceEndpoint(ServiceEndpointInfo seInfo)
- {
- super.initServiceEndpoint(seInfo);
-
- String ejbName = seInfo.getServerEndpointMetaData().getLinkName();
- UnifiedDeploymentInfo udi = seInfo.getUnifiedDeploymentInfo();
- String nameStr = "jboss.j2ee:name=" + ejbName +
",service=EJB3,jar=" + udi.shortName;
- if (udi.parent != null)
- {
- nameStr += ",ear=" + udi.parent.shortName;
- }
-
- objectName = ObjectNameFactory.create(nameStr.toString());
- }
-
- /** Load the SEI implementation bean if necessary
- */
- public Class loadServiceEndpoint(ServiceEndpointInfo seInfo)
- {
- 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 createServiceEndpoint(ServiceEndpointInfo seInfo, Object
endpointContext, Class seiImplClass)
- {
- return null;
- }
-
- /** Invoke an instance of the SEI implementation bean */
- public void invokeServiceEndpoint(ServiceEndpointInfo seInfo, Object seiImpl,
EndpointInvocation epInv) throws SOAPFaultException
- {
- log.debug("invokeServiceEndpoint: " + epInv.getJavaMethod().getName());
-
- /* [FIXME] how to do this for EJB3
-
- // these are provided by the ServerLoginHandler
- Principal principal = SecurityAssociation.getPrincipal();
- Object credential = SecurityAssociation.getCredential();
-
- CommonMessageContext msgContext = MessageContextAssociation.getMessageContext();
-
- Invocation inv = new Invocation(null, method, args, null, principal, credential);
- inv.setValue(InvocationKey.SOAP_MESSAGE_CONTEXT, msgContext);
- inv.setValue(InvocationKey.SOAP_MESSAGE, msgContext.getMessage());
- inv.setType(InvocationType.SERVICE_ENDPOINT);
- */
-
- // invoke on the container
- 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 implClass = container.getBeanClass();
- Method implMethod = getImplMethod(implClass, 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 destroyServiceEndpoint(ServiceEndpointInfo seInfo, Object seiImpl)
- {
- // do nothing
- }
-}
Added:
trunk/src/main/java/org/jboss/ws/integration/jboss50/AbstractWebServiceDeployer.java
===================================================================
---
trunk/src/main/java/org/jboss/ws/integration/jboss50/AbstractWebServiceDeployer.java 2006-10-31
05:34:33 UTC (rev 1334)
+++
trunk/src/main/java/org/jboss/ws/integration/jboss50/AbstractWebServiceDeployer.java 2006-10-31
17:39:12 UTC (rev 1335)
@@ -0,0 +1,129 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.ws.integration.jboss50;
+
+//$Id$
+
+import org.jboss.deployers.plugins.deployer.AbstractSimpleDeployer;
+import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.deployers.spi.deployer.DeploymentUnit;
+import org.jboss.kernel.spi.registry.KernelRegistry;
+import org.jboss.kernel.spi.registry.KernelRegistryEntry;
+import org.jboss.ws.deployment.ServiceEndpointDeployer;
+import org.jboss.ws.deployment.UnifiedDeploymentInfo;
+import org.jboss.ws.server.KernelLocator;
+
+/**
+ * A deployer service that manages Web Services deployments
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 31-Oct-2006
+ */
+public abstract class AbstractWebServiceDeployer extends AbstractSimpleDeployer
+{
+ @Override
+ public void deploy(DeploymentUnit unit) throws DeploymentException
+ {
+ if (isWebserviceDeployment(unit))
+ {
+ UnifiedDeploymentInfo udi = createUnifiedDeploymentInfo(unit);
+ unit.addAttachment(UnifiedDeploymentInfo.class, udi);
+
+ try
+ {
+ createServiceEndpoint(udi, unit);
+
+ startServiceEndpoint(udi, unit);
+ }
+ catch (Exception ex)
+ {
+ log.error("Cannot deploy web service: " + unit.getName(), ex);
+ throw new DeploymentException (ex);
+ }
+ }
+ }
+
+ @Override
+ public void undeploy(DeploymentUnit unit)
+ {
+ UnifiedDeploymentInfo udi = getUnifiedDeploymentInfo(unit);
+ if (udi != null)
+ {
+ try
+ {
+ stopServiceEndpoint(udi, unit);
+
+ destroyServiceEndpoint(udi, unit);
+ }
+ catch (RuntimeException rte)
+ {
+ log.error("Cannot undeploy web service: " + udi.getCanonicalName(),
rte);
+ throw rte;
+ }
+ catch (Exception ex)
+ {
+ log.error("Cannot undeploy web service: " + udi.getCanonicalName(),
ex);
+ throw new RuntimeException (ex);
+ }
+ }
+ }
+
+ protected void createServiceEndpoint(UnifiedDeploymentInfo udi, DeploymentUnit unit)
throws Exception
+ {
+ log.debug("createServiceEndpoint: " + udi.getCanonicalName());
+ getServiceEndpointDeployer().create(udi);
+ }
+
+ protected void startServiceEndpoint(UnifiedDeploymentInfo udi, DeploymentUnit unit)
throws Exception
+ {
+ log.debug("startServiceEndpoint: " + udi.getCanonicalName());
+ getServiceEndpointDeployer().start(udi);
+ }
+
+ protected void stopServiceEndpoint(UnifiedDeploymentInfo udi, DeploymentUnit unit)
throws Exception
+ {
+ log.debug("stopServiceEndpoint: " + udi.getCanonicalName());
+ getServiceEndpointDeployer().stop(udi);
+ }
+
+ protected void destroyServiceEndpoint(UnifiedDeploymentInfo udi, DeploymentUnit unit)
throws Exception
+ {
+ log.debug("destroyServiceEndpoint: " + udi.getCanonicalName());
+ getServiceEndpointDeployer().destroy(udi);
+ }
+
+ protected ServiceEndpointDeployer getServiceEndpointDeployer()
+ {
+ KernelRegistry registry = KernelLocator.getKernel().getRegistry();
+ KernelRegistryEntry entry = registry.getEntry(ServiceEndpointDeployer.BEAN_NAME);
+ return (ServiceEndpointDeployer)entry.getTarget();
+ }
+
+ protected abstract boolean isWebserviceDeployment(DeploymentUnit unit);
+
+ protected abstract UnifiedDeploymentInfo createUnifiedDeploymentInfo(DeploymentUnit
unit);
+
+ protected UnifiedDeploymentInfo getUnifiedDeploymentInfo(DeploymentUnit unit)
+ {
+ return (UnifiedDeploymentInfo)unit.getAttachment(UnifiedDeploymentInfo.class);
+ }
+}
Property changes on:
trunk/src/main/java/org/jboss/ws/integration/jboss50/AbstractWebServiceDeployer.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
trunk/src/main/java/org/jboss/ws/integration/jboss50/ApplicationMetaDataAdaptor.java
===================================================================
---
trunk/src/main/java/org/jboss/ws/integration/jboss50/ApplicationMetaDataAdaptor.java 2006-10-31
05:34:33 UTC (rev 1334)
+++
trunk/src/main/java/org/jboss/ws/integration/jboss50/ApplicationMetaDataAdaptor.java 2006-10-31
17:39:12 UTC (rev 1335)
@@ -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.jboss50;
+
+// $Id$
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.jboss.deployers.spi.deployer.DeploymentUnit;
+import org.jboss.ejb3.Container;
+import org.jboss.ejb3.EJBContainer;
+import org.jboss.ejb3.Ejb3Deployment;
+import org.jboss.ejb3.SessionContainer;
+import org.jboss.ejb3.mdb.MessagingContainer;
+import org.jboss.logging.Logger;
+import org.jboss.ws.metadata.j2ee.UnifiedApplicationMetaData;
+import org.jboss.ws.metadata.j2ee.UnifiedBeanMetaData;
+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 ApplicationMetaDataAdaptor
+{
+ // logging support
+ private static Logger log = Logger.getLogger(ApplicationMetaDataAdaptor.class);
+
+ public static UnifiedApplicationMetaData
buildUnifiedApplicationMetaData(DeploymentUnit unit)
+ {
+ UnifiedApplicationMetaData umd = new UnifiedApplicationMetaData();
+ buildUnifiedBeanMetaData(umd, unit);
+ //umd.setConfigName(apmd.getConfigName());
+ //umd.setConfigFile(apmd.getConfigFile());
+ //umd.setWebServiceContextRoot(apmd.getWebServiceContextRoot());
+ //umd.setSecurityDomain(apmd.getSecurityDomain());
+ //umd.setWsdlPublishLocationMap(apmd.getWsdlPublishLocationMap());
+ return umd;
+ }
+
+ private static void buildUnifiedBeanMetaData(UnifiedApplicationMetaData umd,
DeploymentUnit unit)
+ {
+ List<UnifiedBeanMetaData> beans = new
ArrayList<UnifiedBeanMetaData>();
+ Ejb3Deployment ejb3Deployment = unit.getAttachment(Ejb3Deployment.class);
+ Iterator<Container> it =
ejb3Deployment.getEjbContainers().values().iterator();
+ while (it.hasNext())
+ {
+ EJBContainer container = (EJBContainer)it.next();
+ UnifiedBeanMetaData ubmd = buildUnifiedBeanMetaData(container);
+ if (ubmd != null)
+ {
+ beans.add(ubmd);
+ }
+ }
+ umd.setEnterpriseBeans(beans);
+ }
+
+ private static UnifiedBeanMetaData buildUnifiedBeanMetaData(EJBContainer container)
+ {
+ UnifiedBeanMetaData ubmd = null;
+ if (container instanceof SessionContainer)
+ {
+ ubmd = new UnifiedSessionMetaData();
+ }
+ else if (container instanceof MessagingContainer)
+ {
+ ubmd = new UnifiedMessageDrivenMetaData();
+ log.warn ("No implemented: initialize MDB destination");
+
//((UnifiedMessageDrivenMetaData)ubmd).setDestinationJndiName(((MessagingContainer)container).getDestination());
+ }
+
+ if (ubmd != null)
+ {
+ ubmd.setEjbName(container.getEjbName());
+ ubmd.setEjbClass(container.getBeanClassName());
+// ubmd.setServiceEndpoint(container.getServiceEndpoint());
+// ubmd.setHome(container.getHome());
+// ubmd.setLocalHome(container.getLocalHome());
+// ubmd.setJndiName(container.getJndiName());
+// ubmd.setLocalJndiName(container.getLocalJndiName());
+
+// EjbPortComponentMetaData pcmd = container.getPortComponent();
+// if (pcmd != null)
+// {
+// UnifiedEjbPortComponentMetaData upcmd = new
UnifiedEjbPortComponentMetaData();
+// upcmd.setPortComponentName(pcmd.getPortComponentName());
+// upcmd.setPortComponentURI(pcmd.getPortComponentURI());
+// upcmd.setAuthMethod(pcmd.getAuthMethod());
+// upcmd.setTransportGuarantee(pcmd.getTransportGuarantee());
+// ubmd.setPortComponent(upcmd);
+// }
+ }
+ return ubmd;
+ }
+}
Property changes on:
trunk/src/main/java/org/jboss/ws/integration/jboss50/ApplicationMetaDataAdaptor.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: trunk/src/main/java/org/jboss/ws/integration/jboss50/DeploymentInfoAdaptor.java
===================================================================
---
trunk/src/main/java/org/jboss/ws/integration/jboss50/DeploymentInfoAdaptor.java 2006-10-31
05:34:33 UTC (rev 1334)
+++
trunk/src/main/java/org/jboss/ws/integration/jboss50/DeploymentInfoAdaptor.java 2006-10-31
17:39:12 UTC (rev 1335)
@@ -21,7 +21,11 @@
*/
package org.jboss.ws.integration.jboss50;
+import java.net.URL;
+
import org.jboss.deployers.spi.deployer.DeploymentUnit;
+import org.jboss.ejb3.Ejb3Deployment;
+import org.jboss.logging.Logger;
import org.jboss.ws.deployment.UnifiedDeploymentInfo;
// $Id$
@@ -35,41 +39,65 @@
*/
public class DeploymentInfoAdaptor
{
+ // logging support
+ private static Logger log = Logger.getLogger(DeploymentInfoAdaptor.class);
+
public static UnifiedDeploymentInfo buildDeploymentInfo(UnifiedDeploymentInfo udi,
DeploymentUnit unit)
{
- /*
- if (unit.parent != null)
+ if (unit.getDeploymentContext().getParent() != null)
{
- udi.parent = new UnifiedDeploymentInfo(null);
- buildDeploymentInfo(udi.parent, unit.parent);
+ log.warn("parent deployment not yet supported");
+ //udi.parent = new UnifiedDeploymentInfo(null);
+ //buildDeploymentInfo(udi.parent,
unit.getDeploymentContext().getParent().getDeploymentUnit());
}
- udi.shortName = unit.shortName;
- udi.url = unit.url;
- udi.localUrl = unit.localUrl;
- udi.metaData = buildMetaData(unit.metaData);
- udi.annotationsCl = unit.annotationsCl;
- udi.localCl = unit.localCl;
- udi.ucl = unit.ucl;
- udi.deployedObject = unit.deployedObject;
- */
+ udi.shortName = getShortName(unit);
+ udi.url = getDeploymentURL(unit);
+ udi.metaData = buildMetaData(unit);
+ udi.annotationsCl = unit.getClassLoader();
+ udi.localCl = unit.getClassLoader();
+ udi.ucl = unit.getClassLoader();
+ log.debug("UnifiedDeploymentInfo:\n" + udi);
+
return udi;
}
- private static Object buildMetaData(Object metaData)
+ private static String getShortName(DeploymentUnit unit)
{
- Object retMetaData = null;
+ String shortName = unit.getName();
+ if (shortName.endsWith("!/"))
+ shortName = shortName.substring(0, shortName.lastIndexOf("!"));
+ shortName = shortName.substring(shortName.lastIndexOf("/") + 1);
+ return shortName;
+ }
+
+ private static URL getDeploymentURL(DeploymentUnit unit)
+ {
+ try
+ {
+ URL url = new URL(unit.getName());
+ return url;
+ }
+ catch (Exception ex)
+ {
+ throw new IllegalStateException("Cannot get deployment url", ex);
+ }
+ }
+
+ private static Object buildMetaData(DeploymentUnit unit)
+ {
+ Object metaData = null;
+ if (unit.getAttachment(Ejb3Deployment.class) != null)
+ {
+ metaData = ApplicationMetaDataAdaptor.buildUnifiedApplicationMetaData(unit);
+ }
/*
if (metaData instanceof WebMetaData)
{
retMetaData =
WebMetaDataAdaptor.buildUnifiedWebMetaData((WebMetaData)metaData);
}
- else if (metaData instanceof ApplicationMetaData)
- {
- retMetaData =
ApplicationMetaDataAdaptor.buildUnifiedApplicationMetaData((ApplicationMetaData)metaData);
- }
*/
- return retMetaData;
+ return metaData;
}
}
Added:
trunk/src/main/java/org/jboss/ws/integration/jboss50/JBossServiceEndpointServlet.java
===================================================================
---
trunk/src/main/java/org/jboss/ws/integration/jboss50/JBossServiceEndpointServlet.java 2006-10-31
05:34:33 UTC (rev 1334)
+++
trunk/src/main/java/org/jboss/ws/integration/jboss50/JBossServiceEndpointServlet.java 2006-10-31
17:39:12 UTC (rev 1335)
@@ -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.jboss50;
+
+// $Id$
+
+import java.util.List;
+
+import javax.servlet.ServletContext;
+
+import org.jboss.logging.Logger;
+import org.jboss.ws.WSException;
+import org.jboss.ws.metadata.HandlerMetaData;
+import org.jboss.ws.metadata.ServerEndpointMetaData;
+import org.jboss.ws.metadata.HandlerMetaData.HandlerType;
+import org.jboss.ws.metadata.config.WSCommonConfig;
+import org.jboss.ws.server.ServiceEndpoint;
+import org.jboss.ws.server.AbstractServiceEndpointServlet;
+
+/**
+ * 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);
+ sepMetaData.setConfigFile(configFile);
+
+ List<HandlerMetaData> sepHandlers =
sepMetaData.getHandlers(HandlerType.ENDPOINT);
+ sepMetaData.clearHandlers();
+
+ // Add pre handlers
+ WSCommonConfig sepConfig = sepMetaData.getEndpointConfig();
+ sepMetaData.addHandlers(sepConfig.getHandlers(sepMetaData, HandlerType.PRE));
+
+ // Restore the endpoint handlers
+ sepMetaData.addHandlers(sepHandlers);
+
+ // Add post handlers
+ sepMetaData.addHandlers(sepConfig.getHandlers(sepMetaData, HandlerType.POST));
+
+ log.debug("Updated server meta data" + sepMetaData);
+ }
+ }
+}
Property changes on:
trunk/src/main/java/org/jboss/ws/integration/jboss50/JBossServiceEndpointServlet.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
trunk/src/main/java/org/jboss/ws/integration/jboss50/ServiceEndpointGeneratorEJB.java
===================================================================
---
trunk/src/main/java/org/jboss/ws/integration/jboss50/ServiceEndpointGeneratorEJB.java 2006-10-31
05:34:33 UTC (rev 1334)
+++
trunk/src/main/java/org/jboss/ws/integration/jboss50/ServiceEndpointGeneratorEJB.java 2006-10-31
17:39:12 UTC (rev 1335)
@@ -0,0 +1,275 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.ws.integration.jboss50;
+
+//$Id$
+
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.jboss.deployers.spi.deployer.DeploymentUnit;
+import org.jboss.logging.Logger;
+import org.jboss.ws.server.ServerConfig;
+import org.jboss.ws.server.ServerConfigFactory;
+import org.jboss.ws.utils.DOMUtils;
+import org.jboss.ws.utils.DOMWriter;
+import org.jboss.ws.WSException;
+import org.jboss.ws.metadata.EndpointMetaData;
+import org.jboss.ws.metadata.ServerEndpointMetaData;
+import org.jboss.ws.metadata.ServiceMetaData;
+import org.jboss.ws.metadata.UnifiedMetaData;
+import org.w3c.dom.Element;
+
+/**
+ * Generate a web deployment for EJB endpoints
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 12-May-2006
+ */
+public abstract class ServiceEndpointGeneratorEJB
+{
+ // logging support
+ protected Logger log = Logger.getLogger(ServiceEndpointGeneratorEJB.class);
+
+ public URL generatWebDeployment(UnifiedMetaData wsMetaData, DeploymentUnit unit)
+ {
+ // Collect the list of PortComponentMetaData
+ List<EndpointMetaData> epMetaDataList = new
ArrayList<EndpointMetaData>();
+ for (ServiceMetaData serviceMetaData : wsMetaData.getServices())
+ {
+ for (EndpointMetaData epMetaData : serviceMetaData.getEndpoints())
+ {
+ epMetaDataList.add(epMetaData);
+ }
+ }
+
+ Element webDoc = createWebAppDescriptor(epMetaDataList, unit);
+ Element jbossDoc = createJBossWebAppDescriptor(epMetaDataList, unit);
+
+ File tmpWar = null;
+ try
+ {
+ ServerConfigFactory factory = ServerConfigFactory.getInstance();
+ ServerConfig config = factory.getServerConfig();
+ File tmpdir = new File(config.getServerTempDir().getCanonicalPath() +
"/deploy");
+
+ String deploymentName = wsMetaData.getDeploymentName().replace('/',
'-') + "-ws";
+ 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();
+
+ return tmpWar.toURL();
+ }
+ catch (IOException e)
+ {
+ throw new WSException("Failed to create webservice.war", e);
+ }
+ }
+
+ private Element createWebAppDescriptor(List<EndpointMetaData> epMetaDataList,
DeploymentUnit unit)
+ {
+ Element webApp = DOMUtils.createElement("web-app");
+
+ /*
+ <servlet>
+ <servlet-name>
+ <servlet-class>
+ </servlet>
+ */
+ for (EndpointMetaData epMetaData : epMetaDataList)
+ {
+ ServerEndpointMetaData sepMetaData = (ServerEndpointMetaData)epMetaData;
+ String ejbName = sepMetaData.getLinkName();
+ Element servlet =
(Element)webApp.appendChild(DOMUtils.createElement("servlet"));
+ Element servletName =
(Element)servlet.appendChild(DOMUtils.createElement("servlet-name"));
+ servletName.appendChild(DOMUtils.createTextNode(ejbName));
+ Element servletClass =
(Element)servlet.appendChild(DOMUtils.createElement("servlet-class"));
+ String targetBean = sepMetaData.getServiceEndpointImplName();
+ String seiName = sepMetaData.getServiceEndpointInterfaceName();
+ String servletClassName = (targetBean != null ? targetBean : seiName);
+ servletClass.appendChild(DOMUtils.createTextNode(servletClassName));
+ }
+
+ /*
+ <servlet-mapping>
+ <servlet-name>
+ <url-pattern>
+ </servlet-mapping>
+ */
+ ArrayList urlPatters = new ArrayList();
+ for (EndpointMetaData epMetaData : epMetaDataList)
+ {
+ ServerEndpointMetaData sepMetaData = (ServerEndpointMetaData)epMetaData;
+ String ejbName = sepMetaData.getLinkName();
+ Element servletMapping =
(Element)webApp.appendChild(DOMUtils.createElement("servlet-mapping"));
+ Element servletName =
(Element)servletMapping.appendChild(DOMUtils.createElement("servlet-name"));
+ servletName.appendChild(DOMUtils.createTextNode(ejbName));
+ Element urlPatternElement =
(Element)servletMapping.appendChild(DOMUtils.createElement("url-pattern"));
+
+ String urlPattern = "/*";
+ if (sepMetaData.getURLPattern() != null)
+ {
+ urlPattern = sepMetaData.getURLPattern();
+ }
+
+ if (urlPatters.contains(urlPattern))
+ throw new IllegalArgumentException("Cannot use the same url-pattern with
different endpoints, " + "check your <port-component-uri> in
jboss.xml");
+
+ urlPatternElement.appendChild(DOMUtils.createTextNode(urlPattern));
+ urlPatters.add(urlPattern);
+ }
+
+ String authMethod = null;
+
+ // Add web-app/security-constraint for each port component
+ for (EndpointMetaData epMetaData : epMetaDataList)
+ {
+ ServerEndpointMetaData sepMetaData = (ServerEndpointMetaData)epMetaData;
+ String ejbName = sepMetaData.getLinkName();
+ if (sepMetaData.getAuthMethod() != null || sepMetaData.getTransportGuarantee()
!= null)
+ {
+ /*
+ <security-constraint>
+ <web-resource-collection>
+ <web-resource-name>TestUnAuthPort</web-resource-name>
+ <url-pattern>/HSTestRoot/TestUnAuth/*</url-pattern>
+ </web-resource-collection>
+ <auth-constraint>
+ <role-name>*</role-name>
+ </auth-constraint>
+ <user-data-constraint>
+ <transport-guarantee>NONE</transport-guarantee>
+ </user-data-constraint>
+ </security-constraint>
+ */
+ Element securityConstraint =
(Element)webApp.appendChild(DOMUtils.createElement("security-constraint"));
+ Element wrc =
(Element)securityConstraint.appendChild(DOMUtils.createElement("web-resource-collection"));
+ Element wrName =
(Element)wrc.appendChild(DOMUtils.createElement("web-resource-name"));
+ wrName.appendChild(DOMUtils.createTextNode(ejbName));
+ Element pattern =
(Element)wrc.appendChild(DOMUtils.createElement("url-pattern"));
+ String uri = sepMetaData.getURLPattern();
+ pattern.appendChild(DOMUtils.createTextNode(uri));
+ Element method =
(Element)wrc.appendChild(DOMUtils.createElement("http-method"));
+ method.appendChild(DOMUtils.createTextNode("GET"));
+ method =
(Element)wrc.appendChild(DOMUtils.createElement("http-method"));
+ method.appendChild(DOMUtils.createTextNode("POST"));
+
+ // Optional auth-constraint
+ if (sepMetaData.getAuthMethod() != null)
+ {
+ // Only the first auth-method gives the war login-config/auth-method
+ if (authMethod == null)
+ authMethod = sepMetaData.getAuthMethod();
+
+ Element authConstraint =
(Element)securityConstraint.appendChild(DOMUtils.createElement("auth-constraint"));
+ Element roleName =
(Element)authConstraint.appendChild(DOMUtils.createElement("role-name"));
+ roleName.appendChild(DOMUtils.createTextNode("*"));
+ }
+ // Optional user-data-constraint
+ if (sepMetaData.getTransportGuarantee() != null)
+ {
+ Element userData =
(Element)securityConstraint.appendChild(DOMUtils.createElement("user-data-constraint"));
+ Element transport =
(Element)userData.appendChild(DOMUtils.createElement("transport-guarantee"));
+
transport.appendChild(DOMUtils.createTextNode(sepMetaData.getTransportGuarantee()));
+ }
+ }
+ }
+
+ // Optional login-config/auth-method
+ if (authMethod != null)
+ {
+ Element loginConfig =
(Element)webApp.appendChild(DOMUtils.createElement("login-config"));
+ Element method =
(Element)loginConfig.appendChild(DOMUtils.createElement("auth-method"));
+ method.appendChild(DOMUtils.createTextNode(authMethod));
+ Element realm =
(Element)loginConfig.appendChild(DOMUtils.createElement("realm-name"));
+ realm.appendChild(DOMUtils.createTextNode("EJBServiceEndpointServlet
Realm"));
+
+ addEJBSecurityRoles(webApp, unit);
+ }
+
+ return webApp;
+ }
+
+ private Element createJBossWebAppDescriptor(List<EndpointMetaData>
epMetaDataList, DeploymentUnit unit)
+ {
+ /* 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");
+
+ UnifiedMetaData wsMetaData =
epMetaDataList.get(0).getServiceMetaData().getUnifiedMetaData();
+ String securityDomain = wsMetaData.getSecurityDomain();
+ if (securityDomain != null)
+ {
+ Element secDomain =
(Element)jbossWeb.appendChild(DOMUtils.createElement("security-domain"));
+ secDomain.appendChild(DOMUtils.createTextNode("java:/jaas/" +
securityDomain));
+ }
+
+ // Get the context root for this deployment
+ String contextRoot = null;
+ for (EndpointMetaData epMetaData : epMetaDataList)
+ {
+ ServerEndpointMetaData sepMetaData = (ServerEndpointMetaData)epMetaData;
+ String next = sepMetaData.getContextRoot();
+ if (next != null)
+ {
+ if (contextRoot == null)
+ {
+ contextRoot = next;
+ }
+ else if (contextRoot.equals(next) == false)
+ {
+ throw new WSException("Multiple context root not supported");
+ }
+ }
+ }
+ if (contextRoot == null)
+ throw new WSException("Cannot obtain context root");
+
+ Element root =
(Element)jbossWeb.appendChild(DOMUtils.createElement("context-root"));
+ root.appendChild(DOMUtils.createTextNode(contextRoot));
+
+ return jbossWeb;
+ }
+
+ /** Add the roles from ejb-jar.xml to the security roles
+ */
+ protected abstract void addEJBSecurityRoles(Element webApp, DeploymentUnit unit);
+}
Property changes on:
trunk/src/main/java/org/jboss/ws/integration/jboss50/ServiceEndpointGeneratorEJB.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
trunk/src/main/java/org/jboss/ws/integration/jboss50/ServiceEndpointGeneratorEJB3.java
===================================================================
---
trunk/src/main/java/org/jboss/ws/integration/jboss50/ServiceEndpointGeneratorEJB3.java 2006-10-31
05:34:33 UTC (rev 1334)
+++
trunk/src/main/java/org/jboss/ws/integration/jboss50/ServiceEndpointGeneratorEJB3.java 2006-10-31
17:39:12 UTC (rev 1335)
@@ -0,0 +1,98 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.ws.integration.jboss50;
+
+//$Id$
+
+import java.util.Iterator;
+
+import javax.annotation.security.RolesAllowed;
+import javax.management.MBeanServer;
+import javax.management.ObjectName;
+
+import org.jboss.deployers.spi.deployer.DeploymentUnit;
+import org.jboss.ejb3.EJBContainer;
+import org.jboss.ejb3.Ejb3Deployment;
+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.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, DeploymentUnit unit)
+ {
+ Ejb3Deployment ejb3Deployment = unit.getAttachment(Ejb3Deployment.class);
+ if (ejb3Deployment != null)
+ {
+ Iterator it = ejb3Deployment.getEjbContainers().values().iterator();
+ while (it.hasNext())
+ {
+ EJBContainer container = (EJBContainer)it.next();
+ 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");
+ }
+ }
+}
Property changes on:
trunk/src/main/java/org/jboss/ws/integration/jboss50/ServiceEndpointGeneratorEJB3.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: trunk/src/main/java/org/jboss/ws/integration/jboss50/ServiceEndpointPublisher.java
===================================================================
---
trunk/src/main/java/org/jboss/ws/integration/jboss50/ServiceEndpointPublisher.java 2006-10-31
05:34:33 UTC (rev 1334)
+++
trunk/src/main/java/org/jboss/ws/integration/jboss50/ServiceEndpointPublisher.java 2006-10-31
17:39:12 UTC (rev 1335)
@@ -0,0 +1,111 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.ws.integration.jboss50;
+
+// $Id$
+
+import java.net.URL;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.jboss.deployers.plugins.structure.AbstractDeploymentContext;
+import org.jboss.deployers.spi.deployment.MainDeployer;
+import org.jboss.deployers.spi.structure.DeploymentContext;
+import org.jboss.deployers.spi.structure.DeploymentState;
+import org.jboss.logging.Logger;
+import org.jboss.virtual.VFS;
+import org.jboss.virtual.VirtualFile;
+import org.jboss.ws.deployment.AbstractServiceEndpointPublisher;
+import org.jboss.ws.deployment.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);
+
+ private MainDeployer mainDeployer;
+ private Map<String, DeploymentContext> contextMap = new HashMap<String,
DeploymentContext>();
+
+ public MainDeployer getMainDeployer()
+ {
+ return mainDeployer;
+ }
+
+ public void setMainDeployer(MainDeployer mainDeployer)
+ {
+ this.mainDeployer = mainDeployer;
+ }
+
+ public String publishServiceEndpoint(URL warURL) throws Exception
+ {
+ log.debug("publishServiceEndpoint: " + warURL);
+
+ rewriteWebXML(warURL);
+ DeploymentContext context = createDeploymentContext(warURL);
+
+ mainDeployer.addDeploymentContext(context);
+ mainDeployer.process();
+
+ contextMap.put(warURL.toExternalForm(), context);
+ return "OK";
+ }
+
+ public String destroyServiceEndpoint(URL warURL) throws Exception
+ {
+ log.debug("destroyServiceEndpoint: " + warURL);
+
+ DeploymentContext context = contextMap.get(warURL.toExternalForm());
+ if (context != null)
+ {
+ context.setState(DeploymentState.UNDEPLOYING);
+ mainDeployer.process();
+ mainDeployer.removeDeploymentContext(context.getName());
+
+ contextMap.remove(warURL.toExternalForm());
+ }
+ return "OK";
+ }
+
+ public String publishServiceEndpoint(UnifiedDeploymentInfo udi) throws Exception
+ {
+ URL warURL = (URL)udi.context.get(WebServiceDeployerEJB.ENDPOINT_WAR_URL);
+ return publishServiceEndpoint(warURL);
+ }
+
+ public String destroyServiceEndpoint(UnifiedDeploymentInfo udi) throws Exception
+ {
+ URL warURL = (URL)udi.context.get(WebServiceDeployerEJB.ENDPOINT_WAR_URL);
+ return destroyServiceEndpoint(warURL);
+ }
+
+ private DeploymentContext createDeploymentContext(URL warURL) throws Exception
+ {
+ VirtualFile file = VFS.getRoot(warURL);
+ return new AbstractDeploymentContext(file);
+ }
+}
Property changes on:
trunk/src/main/java/org/jboss/ws/integration/jboss50/ServiceEndpointPublisher.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: trunk/src/main/java/org/jboss/ws/integration/jboss50/WebServiceDeployerEJB.java
===================================================================
---
trunk/src/main/java/org/jboss/ws/integration/jboss50/WebServiceDeployerEJB.java 2006-10-31
05:34:33 UTC (rev 1334)
+++
trunk/src/main/java/org/jboss/ws/integration/jboss50/WebServiceDeployerEJB.java 2006-10-31
17:39:12 UTC (rev 1335)
@@ -0,0 +1,71 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.ws.integration.jboss50;
+
+//$Id$
+
+import java.net.URL;
+
+import org.jboss.deployers.spi.deployer.DeploymentUnit;
+import org.jboss.kernel.spi.registry.KernelRegistry;
+import org.jboss.kernel.spi.registry.KernelRegistryEntry;
+import org.jboss.ws.deployment.AbstractServiceEndpointPublisher;
+import org.jboss.ws.deployment.UnifiedDeploymentInfo;
+import org.jboss.ws.metadata.UnifiedMetaData;
+import org.jboss.ws.server.KernelLocator;
+
+/**
+ * A deployer service that manages web service EJB Endpoints
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 31-Oct-2006
+ */
+public abstract class WebServiceDeployerEJB extends AbstractWebServiceDeployer
+{
+ public static final String ENDPOINT_WAR_URL = "EJB_ENDPOINT_WAR_URL";
+
+ @Override
+ protected void createServiceEndpoint(UnifiedDeploymentInfo udi, DeploymentUnit unit)
throws Exception
+ {
+ super.createServiceEndpoint(udi, unit);
+ UnifiedMetaData wsMetaData = getServiceEndpointDeployer().getUnifiedMetaData(udi);
+ URL warURL = generateWebDeployment(wsMetaData, unit);
+ udi.context.put(ENDPOINT_WAR_URL, warURL);
+ getServiceEndpointPublisher().publishServiceEndpoint(udi);
+ }
+
+ @Override
+ protected void destroyServiceEndpoint(UnifiedDeploymentInfo udi, DeploymentUnit unit)
throws Exception
+ {
+ getServiceEndpointPublisher().destroyServiceEndpoint(udi);
+ super.destroyServiceEndpoint(udi, unit);
+ }
+
+ protected ServiceEndpointPublisher getServiceEndpointPublisher()
+ {
+ KernelRegistry registry = KernelLocator.getKernel().getRegistry();
+ KernelRegistryEntry entry =
registry.getEntry(AbstractServiceEndpointPublisher.BEAN_NAME);
+ return (ServiceEndpointPublisher)entry.getTarget();
+ }
+
+ protected abstract URL generateWebDeployment(UnifiedMetaData wsMetaData,
DeploymentUnit unit);
+}
Property changes on:
trunk/src/main/java/org/jboss/ws/integration/jboss50/WebServiceDeployerEJB.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified:
trunk/src/main/java/org/jboss/ws/integration/jboss50/WebServiceDeployerEJB3.java
===================================================================
---
trunk/src/main/java/org/jboss/ws/integration/jboss50/WebServiceDeployerEJB3.java 2006-10-31
05:34:33 UTC (rev 1334)
+++
trunk/src/main/java/org/jboss/ws/integration/jboss50/WebServiceDeployerEJB3.java 2006-10-31
17:39:12 UTC (rev 1335)
@@ -23,143 +23,48 @@
//$Id$
-import java.util.ArrayList;
+import java.net.URL;
+import java.util.Iterator;
-import javax.management.MBeanServer;
-import javax.management.ObjectName;
+import javax.jws.WebService;
-import org.jboss.deployers.plugins.deployer.AbstractSimpleDeployer;
-import org.jboss.deployers.spi.DeploymentException;
import org.jboss.deployers.spi.deployer.DeploymentUnit;
+import org.jboss.ejb3.EJBContainer;
import org.jboss.ejb3.Ejb3Deployment;
-import org.jboss.ejb3.Ejb3ModuleMBean;
-import org.jboss.kernel.Kernel;
-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.ejb3.stateless.StatelessContainer;
import org.jboss.ws.deployment.JSR181Deployment;
import org.jboss.ws.deployment.UnifiedDeploymentInfo;
-import org.jboss.ws.metadata.j2ee.UnifiedApplicationMetaData;
-import org.jboss.ws.metadata.j2ee.UnifiedBeanMetaData;
+import org.jboss.ws.metadata.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 WebServiceDeployerEJB3 extends AbstractSimpleDeployer
+public class WebServiceDeployerEJB3 extends WebServiceDeployerEJB
{
- // logging support
- private static Logger log = Logger.getLogger(WebServiceDeployerEJB3.class);
-
- private MBeanServer mbeanServer;
- private Kernel kernel;
-
- public Kernel getKernel()
- {
- return kernel;
- }
-
- public void setKernel(Kernel kernel)
- {
- this.kernel = kernel;
- }
-
- public MBeanServer getMbeanServer()
- {
- return mbeanServer;
- }
-
- public void setMbeanServer(MBeanServer mbeanServer)
- {
- this.mbeanServer = mbeanServer;
- }
-
@Override
- public void deploy(DeploymentUnit unit) throws DeploymentException
+ protected UnifiedDeploymentInfo createUnifiedDeploymentInfo(DeploymentUnit unit)
{
- Ejb3Deployment ejb3Deployment = unit.getAttachment(Ejb3Deployment.class);
- if (ejb3Deployment != null)
- {
- log.info("deploy: " + unit);
- try
- {
- UnifiedDeploymentInfo udi = createUnifiedDeploymentInfo(unit);
-
- }
- catch (Exception ex)
- {
-
- }
-
- }
- }
-
- protected UnifiedDeploymentInfo createUnifiedDeploymentInfo(DeploymentUnit unit)
throws Exception
- {
UnifiedDeploymentInfo udi = new
JSR181Deployment(UnifiedDeploymentInfo.DeploymentType.JSR181_EJB3);
DeploymentInfoAdaptor.buildDeploymentInfo(udi, unit);
-
- 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 ubmd = new UnifiedBeanMetaData();
- ubmd.setEjbName(slc.getEjbName());
- ubmd.setEjbClass(slc.getBeanClassName());
- beans.add(ubmd);
- }
- }
- */
-
- UnifiedApplicationMetaData appMetaData = new UnifiedApplicationMetaData();
- appMetaData.setEnterpriseBeans(beans);
- udi.metaData = appMetaData;
-
return udi;
}
- private Ejb3ModuleMBean getEJB3Module(ObjectName objectName)
+ @Override
+ protected boolean isWebserviceDeployment(DeploymentUnit unit)
{
- 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");
- }
- }
-
- /** 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())
+ Ejb3Deployment ejb3Deployment = unit.getAttachment(Ejb3Deployment.class);
+ if (ejb3Deployment != null)
{
- if (manager instanceof StatelessContainer)
+ Iterator it = ejb3Deployment.getEjbContainers().values().iterator();
+ while (it.hasNext())
{
- StatelessContainer container = (StatelessContainer)manager;
- if (container.resolveAnnotation(WebService.class) != null)
+ EJBContainer container = (EJBContainer)it.next();
+ if (container instanceof StatelessContainer &&
container.resolveAnnotation(WebService.class) != null)
{
isWebserviceDeployment = true;
break;
@@ -170,10 +75,8 @@
return isWebserviceDeployment;
}
-
- protected URL generateWebDeployment(DeploymentInfo di, UnifiedMetaData wsMetaData)
throws IOException
+ protected URL generateWebDeployment(UnifiedMetaData wsMetaData, DeploymentUnit unit)
{
- return new ServiceEndpointGeneratorEJB3().generatWebDeployment(di, wsMetaData);
+ return new ServiceEndpointGeneratorEJB3().generatWebDeployment(wsMetaData, unit);
}
- */
}
Added:
trunk/src/main/java/org/jboss/ws/integration/jbossall/ServiceEndpointInvokerEJB3.java
===================================================================
---
trunk/src/main/java/org/jboss/ws/integration/jbossall/ServiceEndpointInvokerEJB3.java 2006-10-31
05:34:33 UTC (rev 1334)
+++
trunk/src/main/java/org/jboss/ws/integration/jbossall/ServiceEndpointInvokerEJB3.java 2006-10-31
17:39:12 UTC (rev 1335)
@@ -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.jbossall;
+
+// $Id$
+
+import java.lang.reflect.Method;
+
+import javax.management.MBeanServer;
+import javax.management.ObjectName;
+import javax.xml.rpc.soap.SOAPFaultException;
+
+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.binding.EndpointInvocation;
+import org.jboss.ws.deployment.UnifiedDeploymentInfo;
+import org.jboss.ws.server.ServiceEndpointInfo;
+import org.jboss.ws.server.ServiceEndpointInvoker;
+import org.jboss.ws.server.AbstractServiceEndpointInvoker;
+import org.jboss.ws.utils.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 initServiceEndpoint(ServiceEndpointInfo seInfo)
+ {
+ super.initServiceEndpoint(seInfo);
+
+ String ejbName = seInfo.getServerEndpointMetaData().getLinkName();
+ UnifiedDeploymentInfo udi = seInfo.getUnifiedDeploymentInfo();
+ String nameStr = "jboss.j2ee:name=" + ejbName +
",service=EJB3,jar=" + udi.shortName;
+ if (udi.parent != null)
+ {
+ nameStr += ",ear=" + udi.parent.shortName;
+ }
+
+ objectName = ObjectNameFactory.create(nameStr.toString());
+ }
+
+ /** Load the SEI implementation bean if necessary
+ */
+ public Class loadServiceEndpoint(ServiceEndpointInfo seInfo)
+ {
+ 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 createServiceEndpoint(ServiceEndpointInfo seInfo, Object
endpointContext, Class seiImplClass)
+ {
+ return null;
+ }
+
+ /** Invoke an instance of the SEI implementation bean */
+ public void invokeServiceEndpoint(ServiceEndpointInfo seInfo, Object seiImpl,
EndpointInvocation epInv) throws SOAPFaultException
+ {
+ log.debug("invokeServiceEndpoint: " + epInv.getJavaMethod().getName());
+
+ /* [FIXME] how to do this for EJB3
+
+ // these are provided by the ServerLoginHandler
+ Principal principal = SecurityAssociation.getPrincipal();
+ Object credential = SecurityAssociation.getCredential();
+
+ CommonMessageContext msgContext = MessageContextAssociation.getMessageContext();
+
+ Invocation inv = new Invocation(null, method, args, null, principal, credential);
+ inv.setValue(InvocationKey.SOAP_MESSAGE_CONTEXT, msgContext);
+ inv.setValue(InvocationKey.SOAP_MESSAGE, msgContext.getMessage());
+ inv.setType(InvocationType.SERVICE_ENDPOINT);
+ */
+
+ // invoke on the container
+ 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 implClass = container.getBeanClass();
+ Method implMethod = getImplMethod(implClass, 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 destroyServiceEndpoint(ServiceEndpointInfo seInfo, Object seiImpl)
+ {
+ // do nothing
+ }
+}
Property changes on:
trunk/src/main/java/org/jboss/ws/integration/jbossall/ServiceEndpointInvokerEJB3.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: trunk/src/main/java/org/jboss/ws/integration/jbossall/ServiceEndpointServlet.java
===================================================================
---
trunk/src/main/java/org/jboss/ws/integration/jbossall/ServiceEndpointServlet.java 2006-10-31
05:34:33 UTC (rev 1334)
+++
trunk/src/main/java/org/jboss/ws/integration/jbossall/ServiceEndpointServlet.java 2006-10-31
17:39:12 UTC (rev 1335)
@@ -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.jbossall;
+
+// $Id$
+
+import java.util.List;
+
+import javax.servlet.ServletContext;
+
+import org.jboss.logging.Logger;
+import org.jboss.ws.WSException;
+import org.jboss.ws.metadata.HandlerMetaData;
+import org.jboss.ws.metadata.ServerEndpointMetaData;
+import org.jboss.ws.metadata.HandlerMetaData.HandlerType;
+import org.jboss.ws.metadata.config.WSCommonConfig;
+import org.jboss.ws.server.ServiceEndpoint;
+import org.jboss.ws.server.AbstractServiceEndpointServlet;
+
+/**
+ * A servlet that is installed for every web service endpoint.
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 16-May-2006
+ */
+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);
+
+ 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);
+ sepMetaData.setConfigFile(configFile);
+
+ List<HandlerMetaData> sepHandlers =
sepMetaData.getHandlers(HandlerType.ENDPOINT);
+ sepMetaData.clearHandlers();
+
+ // Add pre handlers
+ WSCommonConfig sepConfig = sepMetaData.getEndpointConfig();
+ sepMetaData.addHandlers(sepConfig.getHandlers(sepMetaData, HandlerType.PRE));
+
+ // Restore the endpoint handlers
+ sepMetaData.addHandlers(sepHandlers);
+
+ // Add post handlers
+ sepMetaData.addHandlers(sepConfig.getHandlers(sepMetaData, HandlerType.POST));
+
+ log.debug("Updated server meta data" + sepMetaData);
+ }
+ }
+}
Property changes on:
trunk/src/main/java/org/jboss/ws/integration/jbossall/ServiceEndpointServlet.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: trunk/src/main/java/org/jboss/ws/integration/tomcat/DeploymentInfoAdaptor.java
===================================================================
---
trunk/src/main/java/org/jboss/ws/integration/tomcat/DeploymentInfoAdaptor.java 2006-10-31
05:34:33 UTC (rev 1334)
+++
trunk/src/main/java/org/jboss/ws/integration/tomcat/DeploymentInfoAdaptor.java 2006-10-31
17:39:12 UTC (rev 1335)
@@ -37,7 +37,7 @@
import org.jboss.ws.utils.DOMUtils;
import org.jboss.ws.WSException;
import org.jboss.ws.deployment.UnifiedDeploymentInfo;
-import org.jboss.ws.deployment.ServiceEndpointPublisher;
+import org.jboss.ws.deployment.AbstractServiceEndpointPublisher;
import org.jboss.ws.metadata.j2ee.UnifiedWebMetaData;
import org.w3c.dom.Element;
@@ -65,13 +65,11 @@
shortName = shortName.substring(1) + ".war";
udi.shortName = shortName;
- udi.localUrl = warURL;
udi.url = warURL;
udi.metaData = buildWebMetaData(udi, ctx);
udi.annotationsCl = loader.getParent();
udi.localCl = loader;
udi.ucl = loader.getParent();
- udi.deployedObject = null;
return udi;
}
@@ -138,7 +136,7 @@
Element ipel = (Element)itParams.next();
String paramName =
DOMUtils.getTextContent(DOMUtils.getFirstChildElement(ipel, "param-name"));
String paramValue =
DOMUtils.getTextContent(DOMUtils.getFirstChildElement(ipel, "param-value"));
- if
(ServiceEndpointPublisher.INIT_PARAM_SERVICE_ENDPOINT_IMPL.equals(paramName))
+ if
(AbstractServiceEndpointPublisher.INIT_PARAM_SERVICE_ENDPOINT_IMPL.equals(paramName))
{
servletClassMap.put(servletName, paramValue);
}
Modified:
trunk/src/main/java/org/jboss/ws/integration/tomcat/TomcatServiceEndpointPublisher.java
===================================================================
---
trunk/src/main/java/org/jboss/ws/integration/tomcat/TomcatServiceEndpointPublisher.java 2006-10-31
05:34:33 UTC (rev 1334)
+++
trunk/src/main/java/org/jboss/ws/integration/tomcat/TomcatServiceEndpointPublisher.java 2006-10-31
17:39:12 UTC (rev 1335)
@@ -32,7 +32,7 @@
import org.jboss.logging.Logger;
import org.jboss.util.NotImplementedException;
-import org.jboss.ws.deployment.ServiceEndpointPublisher;
+import org.jboss.ws.deployment.AbstractServiceEndpointPublisher;
import org.jboss.ws.deployment.UnifiedDeploymentInfo;
/**
@@ -41,7 +41,7 @@
* @author Thomas.Diesler(a)jboss.org
* @since 12-May-2006
*/
-public class TomcatServiceEndpointPublisher extends ServiceEndpointPublisher
+public class TomcatServiceEndpointPublisher extends AbstractServiceEndpointPublisher
{
// logging support
private static Logger log = Logger.getLogger(TomcatServiceEndpointPublisher.class);
@@ -90,12 +90,12 @@
return "NOT FOUND";
}
- public String publishServiceEndpoint(UnifiedDeploymentInfo udi) throws Exception
+ public String publishServiceEndpoint(UnifiedDeploymentInfo udi)
{
throw new NotImplementedException();
}
- public String destroyServiceEndpoint(UnifiedDeploymentInfo udi) throws Exception
+ public String destroyServiceEndpoint(UnifiedDeploymentInfo udi)
{
throw new NotImplementedException();
}
Modified:
trunk/src/main/java/org/jboss/ws/integration/tomcat/TomcatServiceEndpointServlet.java
===================================================================
---
trunk/src/main/java/org/jboss/ws/integration/tomcat/TomcatServiceEndpointServlet.java 2006-10-31
05:34:33 UTC (rev 1334)
+++
trunk/src/main/java/org/jboss/ws/integration/tomcat/TomcatServiceEndpointServlet.java 2006-10-31
17:39:12 UTC (rev 1335)
@@ -42,7 +42,7 @@
import org.jboss.ws.deployment.ServiceEndpointDeployer;
import org.jboss.ws.deployment.UnifiedDeploymentInfo;
import org.jboss.ws.server.KernelLocator;
-import org.jboss.ws.server.StandardEndpointServlet;
+import org.jboss.ws.server.AbstractServiceEndpointServlet;
/**
* A servlet that is installed for every web service endpoint.
@@ -50,7 +50,7 @@
* @author Thomas.Diesler(a)jboss.org
* @since 16-May-2006
*/
-public class TomcatServiceEndpointServlet extends StandardEndpointServlet
+public class TomcatServiceEndpointServlet extends AbstractServiceEndpointServlet
{
// provide logging
private static final Logger log =
Logger.getLogger(TomcatServiceEndpointServlet.class);
Modified: trunk/src/main/java/org/jboss/ws/jaxrpc/ServiceReferenceable.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/jaxrpc/ServiceReferenceable.java 2006-10-31 05:34:33
UTC (rev 1334)
+++ trunk/src/main/java/org/jboss/ws/jaxrpc/ServiceReferenceable.java 2006-10-31 17:39:12
UTC (rev 1335)
@@ -89,7 +89,7 @@
// The deployment URL of the web service client deployment
// Add a reference to the client deployment URL
- URL deploymentURL = (udi.localUrl != null ? udi.localUrl : udi.url);
+ URL deploymentURL = udi.url;
myRef.add(new StringRefAddr(DEPLOYMENT_URL, deploymentURL.toExternalForm()));
// Add a reference to the ServiceRefMetaData and WSDLDefinitions
Modified: trunk/src/main/java/org/jboss/ws/metadata/EndpointMetaData.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/metadata/EndpointMetaData.java 2006-10-31 05:34:33
UTC (rev 1334)
+++ trunk/src/main/java/org/jboss/ws/metadata/EndpointMetaData.java 2006-10-31 17:39:12
UTC (rev 1335)
@@ -201,9 +201,9 @@
}
/** Get the class loader associated with the endpoint meta data */
- public URLClassLoader getResourceLoader()
+ public ClassLoader getResourceLoader()
{
- URLClassLoader classLoader =
getServiceMetaData().getUnifiedMetaData().getResourceLoader();
+ ClassLoader classLoader =
getServiceMetaData().getUnifiedMetaData().getResourceLoader();
return classLoader;
}
Modified: trunk/src/main/java/org/jboss/ws/metadata/UnifiedMetaData.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/metadata/UnifiedMetaData.java 2006-10-31 05:34:33 UTC
(rev 1334)
+++ trunk/src/main/java/org/jboss/ws/metadata/UnifiedMetaData.java 2006-10-31 17:39:12 UTC
(rev 1335)
@@ -50,8 +50,10 @@
*/
public class UnifiedMetaData
{
+ // The canonical deployment name
+ private String deploymentName;
// The modules resource class loader
- private URLClassLoader resourceLoader;
+ private ClassLoader resourceLoader;
// The modules class loader
private ClassLoader classLoader;
// The optional security domain
@@ -72,17 +74,27 @@
// Used by eager initialization
private boolean initialized = false;
+ public String getDeploymentName()
+ {
+ return deploymentName;
+ }
+
+ public void setDeploymentName(String deploymentName)
+ {
+ this.deploymentName = deploymentName;
+ }
+
public UnifiedMetaData()
{
this.classLoader = Thread.currentThread().getContextClassLoader();
}
- public URLClassLoader getResourceLoader()
+ public ClassLoader getResourceLoader()
{
return resourceLoader;
}
- public void setResourceLoader(URLClassLoader resourceLoader)
+ public void setResourceLoader(ClassLoader resourceLoader)
{
this.resourceLoader = resourceLoader;
}
@@ -177,6 +189,7 @@
{
StringBuilder buffer = new StringBuilder("\nUnifiedMetaData: ");
buffer.append("\n implementation: " + getImplementationVersion());
+ buffer.append("\n deploymentName: " + getDeploymentName());
buffer.append("\n securityDomain: " + getSecurityDomain());
//buffer.append("\n resourceLoader: " + resourceLoader);
//buffer.append("\n classLoader: " + classLoader);
Copied: trunk/src/main/java/org/jboss/ws/server/AbstractServiceEndpointServlet.java (from
rev 1334, trunk/src/main/java/org/jboss/ws/server/StandardEndpointServlet.java)
===================================================================
--- trunk/src/main/java/org/jboss/ws/server/StandardEndpointServlet.java 2006-10-31
05:34:33 UTC (rev 1334)
+++ trunk/src/main/java/org/jboss/ws/server/AbstractServiceEndpointServlet.java 2006-10-31
17:39:12 UTC (rev 1335)
@@ -0,0 +1,166 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.ws.server;
+
+// $Id: AbstractServiceEndpointServlet.java 396 2006-05-23 09:48:45Z
thomas.diesler(a)jboss.com $
+
+import java.io.IOException;
+import java.io.Writer;
+import java.net.URL;
+
+import javax.management.ObjectName;
+import javax.servlet.ServletConfig;
+import javax.servlet.ServletException;
+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.util.NotImplementedException;
+import org.jboss.ws.WSException;
+import org.jboss.ws.jaxrpc.ServletEndpointContextImpl;
+import org.jboss.ws.metadata.ServerEndpointMetaData;
+import org.jboss.ws.utils.ObjectNameFactory;
+
+/**
+ * A servlet that is installed for every web service endpoint.
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 15-Jan-2005
+ */
+public abstract class AbstractServiceEndpointServlet extends HttpServlet
+{
+ // provide logging
+ private static final Logger log =
Logger.getLogger(AbstractServiceEndpointServlet.class);
+
+ protected ObjectName sepId;
+ protected ServiceEndpointManager epManager;
+
+ public void init(ServletConfig config) throws ServletException
+ {
+ super.init(config);
+ initServiceEndpointManager();
+ }
+
+ public void destroy()
+ {
+ super.destroy();
+ }
+
+ public void service(HttpServletRequest req, HttpServletResponse res) throws
ServletException, IOException
+ {
+ if (sepId == 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
+ {
+ // For the base document the resourcePath should be null
+ String resourcePath = (String)req.getParameter("resource");
+ URL requestURL = new URL(req.getRequestURL().toString());
+ epManager.processWSDLRequest(sepId, res.getOutputStream(), requestURL,
resourcePath);
+ }
+ 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());
+
+ try
+ {
+ EndpointContext context = new EndpointContext(getServletContext(), req, res);
+ epManager.processSOAPRequest(sepId, req.getInputStream(), res.getOutputStream(),
context);
+ }
+ catch (Exception ex)
+ {
+ handleException(ex);
+ }
+ }
+
+ 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);
+ }
+
+ protected void initServiceEndpointManager()
+ {
+ ServiceEndpointManagerFactory factory =
ServiceEndpointManagerFactory.getInstance();
+ epManager = factory.getServiceEndpointManager();
+ }
+
+ /** Initialize the service endpoint
+ */
+ protected void initServiceEndpoint(String contextPath)
+ {
+ String servletName = getServletName();
+ if (contextPath.startsWith("/"))
+ contextPath = contextPath.substring(1);
+
+ for (ObjectName sepId : epManager.getServiceEndpoints())
+ {
+ String context =
sepId.getKeyProperty(ServerEndpointMetaData.SEPID_PROPERTY_CONTEXT);
+ String endpoint =
sepId.getKeyProperty(ServerEndpointMetaData.SEPID_PROPERTY_ENDPOINT);
+ if (servletName.equals(endpoint) && contextPath.equals(context))
+ {
+ this.sepId = sepId;
+ break;
+ }
+ }
+
+ if (sepId == null)
+ {
+ ObjectName oname = ObjectNameFactory.create(ServerEndpointMetaData.SEPID_DOMAIN
+ ":" + ServerEndpointMetaData.SEPID_PROPERTY_CONTEXT + "=" +
contextPath
+ + "," + ServerEndpointMetaData.SEPID_PROPERTY_ENDPOINT +
"=" + servletName);
+ throw new WSException("Cannot obtain endpoint for: " + oname);
+ }
+ }
+}
Deleted: trunk/src/main/java/org/jboss/ws/server/StandardEndpointServlet.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/server/StandardEndpointServlet.java 2006-10-31
05:34:33 UTC (rev 1334)
+++ trunk/src/main/java/org/jboss/ws/server/StandardEndpointServlet.java 2006-10-31
17:39:12 UTC (rev 1335)
@@ -1,166 +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.server;
-
-// $Id: AbstractServiceEndpointServlet.java 396 2006-05-23 09:48:45Z
thomas.diesler(a)jboss.com $
-
-import java.io.IOException;
-import java.io.Writer;
-import java.net.URL;
-
-import javax.management.ObjectName;
-import javax.servlet.ServletConfig;
-import javax.servlet.ServletException;
-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.util.NotImplementedException;
-import org.jboss.ws.WSException;
-import org.jboss.ws.jaxrpc.ServletEndpointContextImpl;
-import org.jboss.ws.metadata.ServerEndpointMetaData;
-import org.jboss.ws.utils.ObjectNameFactory;
-
-/**
- * A servlet that is installed for every web service endpoint.
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 15-Jan-2005
- */
-public class StandardEndpointServlet extends HttpServlet
-{
- // provide logging
- private static final Logger log = Logger.getLogger(StandardEndpointServlet.class);
-
- protected ObjectName sepId;
- protected ServiceEndpointManager epManager;
-
- public void init(ServletConfig config) throws ServletException
- {
- super.init(config);
- initServiceEndpointManager();
- }
-
- public void destroy()
- {
- super.destroy();
- }
-
- public void service(HttpServletRequest req, HttpServletResponse res) throws
ServletException, IOException
- {
- if (sepId == 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
- {
- // For the base document the resourcePath should be null
- String resourcePath = (String)req.getParameter("resource");
- URL requestURL = new URL(req.getRequestURL().toString());
- epManager.processWSDLRequest(sepId, res.getOutputStream(), requestURL,
resourcePath);
- }
- 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());
-
- try
- {
- EndpointContext context = new EndpointContext(getServletContext(), req, res);
- epManager.processSOAPRequest(sepId, req.getInputStream(), res.getOutputStream(),
context);
- }
- catch (Exception ex)
- {
- handleException(ex);
- }
- }
-
- 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);
- }
-
- protected void initServiceEndpointManager()
- {
- ServiceEndpointManagerFactory factory =
ServiceEndpointManagerFactory.getInstance();
- epManager = factory.getServiceEndpointManager();
- }
-
- /** Initialize the service endpoint
- */
- protected void initServiceEndpoint(String contextPath)
- {
- String servletName = getServletName();
- if (contextPath.startsWith("/"))
- contextPath = contextPath.substring(1);
-
- for (ObjectName sepId : epManager.getServiceEndpoints())
- {
- String context =
sepId.getKeyProperty(ServerEndpointMetaData.SEPID_PROPERTY_CONTEXT);
- String endpoint =
sepId.getKeyProperty(ServerEndpointMetaData.SEPID_PROPERTY_ENDPOINT);
- if (servletName.equals(endpoint) && contextPath.equals(context))
- {
- this.sepId = sepId;
- break;
- }
- }
-
- if (sepId == null)
- {
- ObjectName oname = ObjectNameFactory.create(ServerEndpointMetaData.SEPID_DOMAIN
+ ":" + ServerEndpointMetaData.SEPID_PROPERTY_CONTEXT + "=" +
contextPath
- + "," + ServerEndpointMetaData.SEPID_PROPERTY_ENDPOINT +
"=" + servletName);
- throw new WSException("Cannot obtain endpoint for: " + oname);
- }
- }
-}
Modified: trunk/src/main/resources/jbossws.beans/META-INF/jboss-beans.xml
===================================================================
--- trunk/src/main/resources/jbossws.beans/META-INF/jboss-beans.xml 2006-10-31 05:34:33
UTC (rev 1334)
+++ trunk/src/main/resources/jbossws.beans/META-INF/jboss-beans.xml 2006-10-31 17:39:12
UTC (rev 1335)
@@ -19,9 +19,9 @@
<property name="alwaysModifySOAPAddress">true</property>
<property
name="serviceEndpointInvokerJSE">org.jboss.ws.server.ServiceEndpointInvokerJSE</property>
- <property
name="serviceEndpointInvokerEJB21">org.jboss.ws.integration.jboss.ServiceEndpointInvokerEJB21</property>
- <property
name="serviceEndpointInvokerEJB3">org.jboss.ws.integration.jboss.ServiceEndpointInvokerEJB3</property>
- <property
name="serviceEndpointInvokerMDB">org.jboss.ws.integration.jboss.ServiceEndpointInvokerMDB</property>
+ <property
name="serviceEndpointInvokerEJB21">org.jboss.ws.integration.jbossall.ServiceEndpointInvokerEJB21</property>
+ <property
name="serviceEndpointInvokerEJB3">org.jboss.ws.integration.jbossall.ServiceEndpointInvokerEJB3</property>
+ <property
name="serviceEndpointInvokerMDB">org.jboss.ws.integration.jbossall.ServiceEndpointInvokerMDB</property>
</bean>
<bean name="ServiceEndpointDeployer"
class="org.jboss.ws.deployment.ServiceEndpointDeployer">
@@ -30,18 +30,20 @@
</property>
</bean>
- <!--
- <bean name="ServiceEndpointPublisher"
class="org.jboss.ws.integration.jboss.JBossServiceEndpointPublisher">
- <property name="serviceEndpointDeployer"><inject
bean="ServiceEndpointDeployer"/></property>
- <property
name="serviceEndpointServlet">org.jboss.ws.integration.jboss.JBossServiceEndpointServlet</property>
+ <bean name="ServiceEndpointPublisher"
class="org.jboss.ws.integration.jboss50.ServiceEndpointPublisher">
+ <property name="mainDeployer"><inject
bean="MainDeployer"/></property>
+ <property
name="serviceEndpointServlet">org.jboss.ws.integration.jbossall.ServiceEndpointServlet</property>
</bean>
- -->
<!-- A subscription manager for WS-Eventing -->
<bean name="SubscriptionManager"
class="org.jboss.ws.eventing.mgmt.SubscriptionManager"/>
<bean name="ServerConfig"
class="org.jboss.ws.integration.jbossall.ServerConfigImpl"/>
- <bean name="KernelLocator"
class="org.jboss.ws.server.KernelLocator"/>
+ <bean name="KernelLocator"
class="org.jboss.ws.server.KernelLocator">
+ <!--property name="kernel">
+ <inject bean="jboss.kernel:service=Kernel"/>
+ </property-->
+ </bean>
</deployment>
\ No newline at end of file
Modified: trunk/src/main/resources/jbossws.deployer/META-INF/jbossws-deployer-beans.xml
===================================================================
---
trunk/src/main/resources/jbossws.deployer/META-INF/jbossws-deployer-beans.xml 2006-10-31
05:34:33 UTC (rev 1334)
+++
trunk/src/main/resources/jbossws.deployer/META-INF/jbossws-deployer-beans.xml 2006-10-31
17:39:12 UTC (rev 1335)
@@ -13,13 +13,8 @@
<this/>
</parameter>
</uninstall>
- <property name="kernel">
- <inject bean="jboss.kernel:service=Kernel"/>
- </property>
- <property name="mbeanServer">
- <inject bean="JMXKernel" property="mbeanServer"/>
- </property>
- <depends>AspectDeployer</depends>
+ <depends>EJBRegistrationDeployer</depends>
+ <depends>WarDeployer</depends>
</bean>
</deployment>
\ No newline at end of file
Modified: trunk/src/test/ant/build-jars-jaxws.xml
===================================================================
--- trunk/src/test/ant/build-jars-jaxws.xml 2006-10-31 05:34:33 UTC (rev 1334)
+++ trunk/src/test/ant/build-jars-jaxws.xml 2006-10-31 17:39:12 UTC (rev 1335)
@@ -104,17 +104,6 @@
<include
name="org/jboss/test/ws/jaxws/jbws944/EJB3RemoteInterface.class"/>
</fileset>
</jar>
- <jar jarfile="${build.test.dir}/libs/jaxws-jbws944-client.jar">
- <fileset dir="${build.test.dir}/classes">
- <include
name="org/jboss/test/ws/jaxws/jbws944/EndpointInterface.class"/>
- </fileset>
- <metainf dir="${build.test.dir}/resources/jaxws/jbws944/META-INF">
- <include name="application-client.xml"/>
- <include name="jboss-client.xml"/>
- <include name="jaxrpc-mapping.xml"/>
- <include name="wsdl/**"/>
- </metainf>
- </jar>
<!-- jaxws-jsr181-complex -->
<war warfile="${build.test.dir}/libs/jaxws-jsr181-complex.war"
webxml="${build.test.dir}/resources/jaxws/jsr181/complex/WEB-INF/web.xml">
Modified: trunk/src/test/java/org/jboss/test/ws/jaxws/jbws944/EJB3Bean01.java
===================================================================
--- trunk/src/test/java/org/jboss/test/ws/jaxws/jbws944/EJB3Bean01.java 2006-10-31
05:34:33 UTC (rev 1334)
+++ trunk/src/test/java/org/jboss/test/ws/jaxws/jbws944/EJB3Bean01.java 2006-10-31
17:39:12 UTC (rev 1335)
@@ -24,20 +24,12 @@
import javax.ejb.Remote;
import javax.ejb.Stateless;
import javax.jws.WebMethod;
-import javax.jws.WebParam;
-import javax.jws.WebResult;
import javax.jws.WebService;
import javax.jws.soap.SOAPBinding;
import org.jboss.annotation.ejb.RemoteBinding;
-/**
- * Test the JSR-181 annotation: javax.jws.WebService
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 29-Apr-2005
- */
-@WebService(name = "EndpointInterface", targetNamespace =
"http://org.jboss.ws/jbws944", serviceName = "TestService")
+@WebService(name = "EJB3Bean", targetNamespace =
"http://org.jboss.ws/jbws944")
@SOAPBinding(style = SOAPBinding.Style.RPC)
@Remote(EJB3RemoteInterface.class)
@RemoteBinding(jndiBinding = "/ejb3/EJB3EndpointInterface")
@@ -45,8 +37,7 @@
public class EJB3Bean01 implements EJB3RemoteInterface
{
@WebMethod
- @WebResult(name="result")
- public String echo(@WebParam(name="String_1") String input)
+ public String echo(String input)
{
return input;
}
Modified: trunk/src/test/java/org/jboss/test/ws/jaxws/jbws944/EndpointInterface.java
===================================================================
--- trunk/src/test/java/org/jboss/test/ws/jaxws/jbws944/EndpointInterface.java 2006-10-31
05:34:33 UTC (rev 1334)
+++ trunk/src/test/java/org/jboss/test/ws/jaxws/jbws944/EndpointInterface.java 2006-10-31
17:39:12 UTC (rev 1335)
@@ -21,17 +21,14 @@
*/
package org.jboss.test.ws.jaxws.jbws944;
-import java.rmi.Remote;
-import java.rmi.RemoteException;
+import javax.jws.WebMethod;
+import javax.jws.WebService;
+import javax.jws.soap.SOAPBinding;
-/**
- * Test the JSR-181 annotation: javax.jws.WebService
- * This interface is only used in the client deployment.
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 29-Apr-2005
- */
-public interface EndpointInterface extends Remote
+@WebService
+@SOAPBinding(style = SOAPBinding.Style.RPC)
+public interface EndpointInterface
{
- String echo(String input) throws RemoteException;
+ @WebMethod
+ String echo(String input);
}
Modified: trunk/src/test/java/org/jboss/test/ws/jaxws/jbws944/JBWS944TestCase.java
===================================================================
--- trunk/src/test/java/org/jboss/test/ws/jaxws/jbws944/JBWS944TestCase.java 2006-10-31
05:34:33 UTC (rev 1334)
+++ trunk/src/test/java/org/jboss/test/ws/jaxws/jbws944/JBWS944TestCase.java 2006-10-31
17:39:12 UTC (rev 1335)
@@ -25,7 +25,8 @@
import java.net.URL;
import javax.naming.InitialContext;
-import javax.xml.rpc.Service;
+import javax.xml.namespace.QName;
+import javax.xml.ws.Service;
import junit.framework.Test;
@@ -45,24 +46,11 @@
{
public final String TARGET_ENDPOINT_ADDRESS = "http://" + getServerHost() +
":8080/jaxws-jbws944/FooBean01";
- private static EndpointInterface port;
-
public static Test suite()
{
- return JBossWSTestSetup.newTestSetup(JBWS944TestCase.class,
"jaxws-jbws944.jar, jaxws-jbws944-client.jar");
+ return JBossWSTestSetup.newTestSetup(JBWS944TestCase.class,
"jaxws-jbws944.jar");
}
- protected void setUp() throws Exception
- {
- super.setUp();
- if (port == null)
- {
- InitialContext iniCtx = getInitialContext();
- Service service =
(Service)iniCtx.lookup("java:comp/env/service/TestService");
- port = (EndpointInterface)service.getPort(EndpointInterface.class);
- }
- }
-
public void testRemoteAccess() throws Exception
{
InitialContext iniCtx = getInitialContext();
@@ -78,7 +66,11 @@
assertWSDLAccess();
String helloWorld = "Hello world!";
- Object retObj = port.echo(helloWorld);
+ QName serviceName = new QName("http://org.jboss.ws/jbws944",
"EJB3BeanService");
+ URL wsdlURL = new URL(TARGET_ENDPOINT_ADDRESS + "?wsdl");
+ Service service = Service.create(wsdlURL, serviceName);
+ EndpointInterface port =
(EndpointInterface)service.getPort(EndpointInterface.class);
+ String retObj = port.echo(helloWorld);
assertEquals(helloWorld, retObj);
}