Author: thomas.diesler(a)jboss.com
Date: 2007-07-30 03:23:40 -0400 (Mon, 30 Jul 2007)
New Revision: 4024
Added:
trunk/integration/spi/src/main/java/org/jboss/wsf/framework/http/DefaultHttpServerFactory.java
trunk/integration/spi/src/main/java/org/jboss/wsf/framework/http/WebAppDeployingHttpServer.java
Removed:
trunk/integration/jboss50/src/main/java/org/jboss/wsf/container/jboss50/JBossHttpServer.java
Modified:
trunk/integration/jboss50/src/main/java/org/jboss/wsf/container/jboss50/WebAppDeploymentAspect.java
trunk/integration/native/src/test/resources/test-excludes-jboss40.txt
trunk/integration/native/src/test/resources/test-excludes-jboss42.txt
trunk/integration/spi/src/main/java/org/jboss/wsf/framework/DefaultSPIProviderResolver.java
trunk/integration/spi/src/main/java/org/jboss/wsf/framework/http/DefaultHttpContextFactory.java
trunk/jbossws-core/src/main/java/org/jboss/ws/core/jaxws/spi/EndpointImpl.java
Log:
More work on Endpoint API
Deleted:
trunk/integration/jboss50/src/main/java/org/jboss/wsf/container/jboss50/JBossHttpServer.java
===================================================================
---
trunk/integration/jboss50/src/main/java/org/jboss/wsf/container/jboss50/JBossHttpServer.java 2007-07-28
07:14:06 UTC (rev 4023)
+++
trunk/integration/jboss50/src/main/java/org/jboss/wsf/container/jboss50/JBossHttpServer.java 2007-07-30
07:23:40 UTC (rev 4024)
@@ -1,234 +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.wsf.container.jboss50;
-
-//$Id: JBossHttpServer.java 1786 2007-01-04 14:30:04Z thomas.diesler(a)jboss.com $
-
-import java.io.File;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.net.URL;
-import java.util.Map;
-
-import javax.management.MBeanServerConnection;
-import javax.management.ObjectName;
-import javax.naming.InitialContext;
-import javax.naming.NamingException;
-import javax.xml.ws.Endpoint;
-import javax.xml.ws.WebServiceException;
-
-import org.jboss.wsf.common.DOMUtils;
-import org.jboss.wsf.common.DOMWriter;
-import org.jboss.wsf.framework.DefaultExtensible;
-import org.jboss.wsf.spi.SPIProvider;
-import org.jboss.wsf.spi.SPIProviderResolver;
-import org.jboss.wsf.spi.http.HttpContext;
-import org.jboss.wsf.spi.http.HttpContextFactory;
-import org.jboss.wsf.spi.http.HttpServer;
-import org.jboss.wsf.spi.management.ServerConfig;
-import org.jboss.wsf.spi.management.ServerConfigFactory;
-import org.w3c.dom.Element;
-
-/**
- * A Tomcat HTTP Server
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 07-Jul-2006
- */
-public class JBossHttpServer extends DefaultExtensible implements HttpServer
-{
- private static final String MAIN_DEPLOYER =
"jboss.system:service=MainDeployer";
-
- /** Start an instance of this HTTP server */
- public void start()
- {
- // verify required properties
- }
-
- /** Create an HTTP context */
- public HttpContext createContext(String contextRoot)
- {
- SPIProvider spiProvider = SPIProviderResolver.getInstance().getProvider();
- HttpContext httpContext =
spiProvider.getSPI(HttpContextFactory.class).newHttpContext(this, contextRoot);
- return httpContext;
- }
-
- /** Publish an JAXWS endpoint to the HTTP server */
- public void publish(HttpContext context, Endpoint endpoint)
- {
- Class implClass = getImplementorClass(endpoint);
- String implName = implClass.getName();
-
- try
- {
- Element webDoc = createWebAppDescriptor(context, endpoint);
- Element jbossDoc = createJBossWebAppDescriptor(context, endpoint);
-
- File tmpWar = null;
- try
- {
- SPIProvider spiProvider = SPIProviderResolver.getInstance().getProvider();
- ServerConfig serverConfig =
spiProvider.getSPI(ServerConfigFactory.class).getServerConfig();
- File tmpDir = new File(serverConfig.getServerTempDir().getCanonicalPath() +
"/jbossws");
-
- String deploymentName =
implName.substring(implName.lastIndexOf(".") + 1);
- tmpWar = File.createTempFile(deploymentName, ".war", tmpDir);
- tmpWar.delete();
- File webInf = new File(tmpWar, "WEB-INF");
- webInf.mkdirs();
-
- File webXml = new File(webInf, "web.xml");
- FileWriter fw = new FileWriter(webXml);
- new DOMWriter(fw).setPrettyprint(true).print(webDoc);
- fw.close();
-
- File jbossWebXml = new File(webInf, "jboss-web.xml");
- fw = new FileWriter(jbossWebXml);
- new DOMWriter(fw).setPrettyprint(true).print(jbossDoc);
- fw.close();
- }
- catch (IOException e)
- {
- throw new WebServiceException("Failed to create webservice war",
e);
- }
-
- Map<String, Object> epProps = endpoint.getProperties();
- epProps.put("jbossws-endpoint-war-url", tmpWar);
-
- URL tmpURL = tmpWar.toURL();
- MBeanServerConnection server = getServer();
- server.invoke(new ObjectName(MAIN_DEPLOYER), "deploy", new Object[] {
tmpURL }, new String[] { "java.net.URL" });
- }
- catch (RuntimeException rte)
- {
- throw rte;
- }
- catch (Exception ex)
- {
- throw new WebServiceException(ex);
- }
- }
-
- /** Destroys an JAXWS endpoint on the HTTP server */
- public void destroy(HttpContext context, Endpoint endpoint)
- {
- Map<String, Object> epProps = endpoint.getProperties();
- File tmpWar = (File)epProps.get("jbossws-endpoint-war-url");
- if (tmpWar == null)
- throw new IllegalStateException("Cannot find endpoint war property");
-
- try
- {
- URL tmpURL = tmpWar.toURL();
- MBeanServerConnection server = getServer();
- server.invoke(new ObjectName(MAIN_DEPLOYER), "undeploy", new Object[]
{ tmpURL }, new String[] { "java.net.URL" });
-
- tmpWar.delete();
- }
- catch (RuntimeException rte)
- {
- throw rte;
- }
- catch (Exception ex)
- {
- throw new WebServiceException(ex);
- }
- }
-
- private Class getImplementorClass(Endpoint endpoint)
- {
- Object implementor = endpoint.getImplementor();
- Class implClass = (implementor instanceof Class ? (Class)implementor :
implementor.getClass());
- return implClass;
- }
-
- private MBeanServerConnection getServer() throws NamingException
- {
- InitialContext iniCtx = new InitialContext();
- MBeanServerConnection server =
(MBeanServerConnection)iniCtx.lookup("jmx/invoker/RMIAdaptor");
- return server;
- }
-
- private Element createWebAppDescriptor(HttpContext context, Endpoint endpoint)
- {
- Class implClass = getImplementorClass(endpoint);
- String implName = implClass.getName();
-
- Element webApp = DOMUtils.createElement("web-app");
-
- /*
- <servlet>
- <servlet-name>
- <servlet-class>
- </servlet>
- */
- Element servlet =
(Element)webApp.appendChild(DOMUtils.createElement("servlet"));
- Element servletName =
(Element)servlet.appendChild(DOMUtils.createElement("servlet-name"));
- servletName.appendChild(DOMUtils.createTextNode("JAXWSEndpoint"));
- Element servletClass =
(Element)servlet.appendChild(DOMUtils.createElement("servlet-class"));
- servletClass.appendChild(DOMUtils.createTextNode(implName));
-
- /*
- <servlet-mapping>
- <servlet-name>
- <url-pattern>
- </servlet-mapping>
- */
- Element servletMapping =
(Element)webApp.appendChild(DOMUtils.createElement("servlet-mapping"));
- servletName =
(Element)servletMapping.appendChild(DOMUtils.createElement("servlet-name"));
- servletName.appendChild(DOMUtils.createTextNode("JAXWSEndpoint"));
- Element urlPatternElement =
(Element)servletMapping.appendChild(DOMUtils.createElement("url-pattern"));
-
- String urlPattern = "/*";
- urlPatternElement.appendChild(DOMUtils.createTextNode(urlPattern));
-
- // Add security-constraint in generated web.xml for Endpoint API
- // FIXME: JBWS-1069
-
- return webApp;
- }
-
- private Element createJBossWebAppDescriptor(HttpContext context, Endpoint endpoint)
- {
- /* Create a jboss-web
- <jboss-web>
- <security-domain>java:/jaas/cts</security-domain>
- <context-root>/ws/ejbN/</context-root>
- </jboss-web>
- */
- Element jbossWeb = DOMUtils.createElement("jboss-web");
-
- // Get the context root for this deployment
- String contextRoot = context.getContextRoot();
- if (contextRoot == null)
- throw new WebServiceException("Cannot obtain context root");
-
- Element root =
(Element)jbossWeb.appendChild(DOMUtils.createElement("context-root"));
- root.appendChild(DOMUtils.createTextNode(contextRoot));
-
- // Add security-constraint in generated web.xml for Endpoint API
- // FIXME: JBWS-1069
-
- return jbossWeb;
- }
-}
-
Modified:
trunk/integration/jboss50/src/main/java/org/jboss/wsf/container/jboss50/WebAppDeploymentAspect.java
===================================================================
---
trunk/integration/jboss50/src/main/java/org/jboss/wsf/container/jboss50/WebAppDeploymentAspect.java 2007-07-28
07:14:06 UTC (rev 4023)
+++
trunk/integration/jboss50/src/main/java/org/jboss/wsf/container/jboss50/WebAppDeploymentAspect.java 2007-07-30
07:23:40 UTC (rev 4024)
@@ -23,6 +23,10 @@
// $Id: WebAppDeployerDeployer.java 3772 2007-07-01 19:29:13Z thomas.diesler(a)jboss.com $
+import java.net.URL;
+import java.util.HashMap;
+import java.util.Map;
+
import org.jboss.deployers.client.spi.DeployerClient;
import org.jboss.deployers.vfs.spi.client.VFSDeploymentFactory;
import org.jboss.logging.Logger;
@@ -32,10 +36,6 @@
import org.jboss.wsf.spi.deployment.DeploymentAspect;
import org.jboss.wsf.spi.deployment.WSFDeploymentException;
-import java.net.URL;
-import java.util.Map;
-import java.util.HashMap;
-
/**
* Publish the HTTP service endpoint to Tomcat
*
@@ -63,25 +63,24 @@
public void create(Deployment dep)
{
- if (dep.getType().toString().endsWith("EJB21") ||
dep.getType().toString().endsWith("EJB3"))
+ URL warURL = (URL)dep.getProperty("org.jboss.ws.webapp.url");
+ if (warURL == null)
+ throw new IllegalStateException("Cannot obtain generated webapp
URL");
+
+ log.debug("publishServiceEndpoint: " + warURL);
+ try
{
- URL warURL = (URL)dep.getProperty("org.jboss.ws.webapp.url");
+ webXMLRewriter.rewriteWebXml(dep);
+ org.jboss.deployers.client.spi.Deployment deployment =
createDeploymentContext(warURL);
- log.debug("publishServiceEndpoint: " + warURL);
- try
- {
- webXMLRewriter.rewriteWebXml(dep);
- org.jboss.deployers.client.spi.Deployment deployment =
createDeploymentContext(warURL);
+ mainDeployer.deploy(deployment);
- mainDeployer.deploy(deployment);
-
- deploymentMap.put(warURL.toExternalForm(), deployment);
- }
- catch (Exception ex)
- {
- WSFDeploymentException.rethrow(ex);
- }
+ deploymentMap.put(warURL.toExternalForm(), deployment);
}
+ catch (Exception ex)
+ {
+ WSFDeploymentException.rethrow(ex);
+ }
}
public void destroy(Deployment dep)
@@ -89,7 +88,7 @@
URL warURL = (URL)dep.getProperty("org.jboss.ws.webapp.url");
if (warURL == null)
{
- log.error("Cannot obtain warURL");
+ log.error("Cannot obtain generated webapp URL");
return;
}
Modified: trunk/integration/native/src/test/resources/test-excludes-jboss40.txt
===================================================================
--- trunk/integration/native/src/test/resources/test-excludes-jboss40.txt 2007-07-28
07:14:06 UTC (rev 4023)
+++ trunk/integration/native/src/test/resources/test-excludes-jboss40.txt 2007-07-30
07:23:40 UTC (rev 4024)
@@ -5,7 +5,6 @@
org/jboss/test/ws/benchmark/**
# EJB3/Injection excludes
-org/jboss/test/ws/jaxws/endpoint/**
org/jboss/test/ws/jaxws/jbws1581/**
org/jboss/test/ws/jaxws/samples/context/WebServiceContextEJBTestCase*
org/jboss/test/ws/jaxws/samples/handlerchain/HandlerChainClientTestCase*
Modified: trunk/integration/native/src/test/resources/test-excludes-jboss42.txt
===================================================================
--- trunk/integration/native/src/test/resources/test-excludes-jboss42.txt 2007-07-28
07:14:06 UTC (rev 4023)
+++ trunk/integration/native/src/test/resources/test-excludes-jboss42.txt 2007-07-30
07:23:40 UTC (rev 4024)
@@ -2,7 +2,6 @@
org/jboss/test/ws/benchmark/**
# EJB3/Injection excludes
-org/jboss/test/ws/jaxws/endpoint/**
org/jboss/test/ws/jaxws/jbws1581/**
org/jboss/test/ws/jaxws/samples/handlerchain/HandlerChainClientTestCase*
org/jboss/test/ws/jaxws/samples/retail/**
Modified:
trunk/integration/spi/src/main/java/org/jboss/wsf/framework/DefaultSPIProviderResolver.java
===================================================================
---
trunk/integration/spi/src/main/java/org/jboss/wsf/framework/DefaultSPIProviderResolver.java 2007-07-28
07:14:06 UTC (rev 4023)
+++
trunk/integration/spi/src/main/java/org/jboss/wsf/framework/DefaultSPIProviderResolver.java 2007-07-30
07:23:40 UTC (rev 4024)
@@ -25,8 +25,8 @@
import org.jboss.wsf.common.ServiceLoader;
import org.jboss.wsf.framework.deployment.DefaultDeploymentModelFactory;
import org.jboss.wsf.framework.deployment.DefaultLifecycleHandlerFactory;
-import org.jboss.wsf.framework.http.DefaultHttpContext;
import org.jboss.wsf.framework.http.DefaultHttpContextFactory;
+import org.jboss.wsf.framework.http.DefaultHttpServerFactory;
import org.jboss.wsf.framework.invocation.DefaultResourceInjectorFactory;
import org.jboss.wsf.spi.SPIProvider;
import org.jboss.wsf.spi.SPIProviderResolver;
@@ -81,6 +81,10 @@
{
returnType = (T)loadService(spiType,
DefaultHttpContextFactory.class.getName());
}
+ else if (HttpServerFactory.class.equals(spiType))
+ {
+ returnType = (T)loadService(spiType,
DefaultHttpServerFactory.class.getName());
+ }
else if (LifecycleHandlerFactory.class.equals(spiType))
{
returnType = (T)loadService(spiType,
DefaultLifecycleHandlerFactory.class.getName());
@@ -100,10 +104,6 @@
{
returnType = (T)loadService(spiType, null);
}
- else if (HttpServerFactory.class.equals(spiType))
- {
- returnType = (T)loadService(spiType, null);
- }
else if (InvocationHandlerFactory.class.equals(spiType))
{
returnType = (T)loadService(spiType, null);
Modified:
trunk/integration/spi/src/main/java/org/jboss/wsf/framework/http/DefaultHttpContextFactory.java
===================================================================
---
trunk/integration/spi/src/main/java/org/jboss/wsf/framework/http/DefaultHttpContextFactory.java 2007-07-28
07:14:06 UTC (rev 4023)
+++
trunk/integration/spi/src/main/java/org/jboss/wsf/framework/http/DefaultHttpContextFactory.java 2007-07-30
07:23:40 UTC (rev 4024)
@@ -23,8 +23,8 @@
//$Id: HttpContext.java 1757 2006-12-22 15:40:24Z thomas.diesler(a)jboss.com $
-import org.jboss.wsf.spi.SPIView;
import org.jboss.wsf.spi.http.HttpContext;
+import org.jboss.wsf.spi.http.HttpContextFactory;
import org.jboss.wsf.spi.http.HttpServer;
/**
@@ -33,7 +33,7 @@
* @author Thomas.Diesler(a)jboss.org
* @since 07-Jul-2006
*/
-public class DefaultHttpContextFactory implements SPIView
+public class DefaultHttpContextFactory extends HttpContextFactory
{
public HttpContext newHttpContext(HttpServer server, String contextRoot)
{
Added:
trunk/integration/spi/src/main/java/org/jboss/wsf/framework/http/DefaultHttpServerFactory.java
===================================================================
---
trunk/integration/spi/src/main/java/org/jboss/wsf/framework/http/DefaultHttpServerFactory.java
(rev 0)
+++
trunk/integration/spi/src/main/java/org/jboss/wsf/framework/http/DefaultHttpServerFactory.java 2007-07-30
07:23:40 UTC (rev 4024)
@@ -0,0 +1,41 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.wsf.framework.http;
+
+//$Id: HttpContext.java 1757 2006-12-22 15:40:24Z thomas.diesler(a)jboss.com $
+
+import org.jboss.wsf.spi.http.HttpServer;
+import org.jboss.wsf.spi.http.HttpServerFactory;
+
+/**
+ * A factory for an HTTP Server
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 07-Jul-2006
+ */
+public class DefaultHttpServerFactory extends HttpServerFactory
+{
+ public HttpServer newHttpServer()
+ {
+ return new WebAppDeployingHttpServer();
+ }
+}
Added:
trunk/integration/spi/src/main/java/org/jboss/wsf/framework/http/WebAppDeployingHttpServer.java
===================================================================
---
trunk/integration/spi/src/main/java/org/jboss/wsf/framework/http/WebAppDeployingHttpServer.java
(rev 0)
+++
trunk/integration/spi/src/main/java/org/jboss/wsf/framework/http/WebAppDeployingHttpServer.java 2007-07-30
07:23:40 UTC (rev 4024)
@@ -0,0 +1,234 @@
+/*
+ * 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.wsf.framework.http;
+
+//$Id: JBossHttpServer.java 1786 2007-01-04 14:30:04Z thomas.diesler(a)jboss.com $
+
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.net.URL;
+import java.util.Map;
+
+import javax.management.MBeanServerConnection;
+import javax.management.ObjectName;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+import javax.xml.ws.Endpoint;
+import javax.xml.ws.WebServiceException;
+
+import org.jboss.wsf.common.DOMUtils;
+import org.jboss.wsf.common.DOMWriter;
+import org.jboss.wsf.framework.DefaultExtensible;
+import org.jboss.wsf.spi.SPIProvider;
+import org.jboss.wsf.spi.SPIProviderResolver;
+import org.jboss.wsf.spi.http.HttpContext;
+import org.jboss.wsf.spi.http.HttpContextFactory;
+import org.jboss.wsf.spi.http.HttpServer;
+import org.jboss.wsf.spi.management.ServerConfig;
+import org.jboss.wsf.spi.management.ServerConfigFactory;
+import org.w3c.dom.Element;
+
+/**
+ * A Tomcat HTTP Server
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 07-Jul-2006
+ */
+public class WebAppDeployingHttpServer extends DefaultExtensible implements HttpServer
+{
+ private static final String MAIN_DEPLOYER =
"jboss.system:service=MainDeployer";
+
+ /** Start an instance of this HTTP server */
+ public void start()
+ {
+ // verify required properties
+ }
+
+ /** Create an HTTP context */
+ public HttpContext createContext(String contextRoot)
+ {
+ SPIProvider spiProvider = SPIProviderResolver.getInstance().getProvider();
+ HttpContext httpContext =
spiProvider.getSPI(HttpContextFactory.class).newHttpContext(this, contextRoot);
+ return httpContext;
+ }
+
+ /** Publish an JAXWS endpoint to the HTTP server */
+ public void publish(HttpContext context, Endpoint endpoint)
+ {
+ Class implClass = getImplementorClass(endpoint);
+ String implName = implClass.getName();
+
+ try
+ {
+ Element webDoc = createWebAppDescriptor(context, endpoint);
+ Element jbossDoc = createJBossWebAppDescriptor(context, endpoint);
+
+ File tmpWar = null;
+ try
+ {
+ SPIProvider spiProvider = SPIProviderResolver.getInstance().getProvider();
+ ServerConfig serverConfig =
spiProvider.getSPI(ServerConfigFactory.class).getServerConfig();
+ File tmpDir = new File(serverConfig.getServerTempDir().getCanonicalPath() +
"/jbossws");
+
+ String deploymentName =
implName.substring(implName.lastIndexOf(".") + 1);
+ tmpWar = File.createTempFile(deploymentName, ".war", tmpDir);
+ tmpWar.delete();
+ File webInf = new File(tmpWar, "WEB-INF");
+ webInf.mkdirs();
+
+ File webXml = new File(webInf, "web.xml");
+ FileWriter fw = new FileWriter(webXml);
+ new DOMWriter(fw).setPrettyprint(true).print(webDoc);
+ fw.close();
+
+ File jbossWebXml = new File(webInf, "jboss-web.xml");
+ fw = new FileWriter(jbossWebXml);
+ new DOMWriter(fw).setPrettyprint(true).print(jbossDoc);
+ fw.close();
+ }
+ catch (IOException e)
+ {
+ throw new WebServiceException("Failed to create webservice war",
e);
+ }
+
+ Map<String, Object> epProps = endpoint.getProperties();
+ epProps.put("jbossws-endpoint-war-url", tmpWar);
+
+ URL tmpURL = tmpWar.toURL();
+ MBeanServerConnection server = getServer();
+ server.invoke(new ObjectName(MAIN_DEPLOYER), "deploy", new Object[] {
tmpURL }, new String[] { "java.net.URL" });
+ }
+ catch (RuntimeException rte)
+ {
+ throw rte;
+ }
+ catch (Exception ex)
+ {
+ throw new WebServiceException(ex);
+ }
+ }
+
+ /** Destroys an JAXWS endpoint on the HTTP server */
+ public void destroy(HttpContext context, Endpoint endpoint)
+ {
+ Map<String, Object> epProps = endpoint.getProperties();
+ File tmpWar = (File)epProps.get("jbossws-endpoint-war-url");
+ if (tmpWar == null)
+ throw new IllegalStateException("Cannot find endpoint war property");
+
+ try
+ {
+ URL tmpURL = tmpWar.toURL();
+ MBeanServerConnection server = getServer();
+ server.invoke(new ObjectName(MAIN_DEPLOYER), "undeploy", new Object[]
{ tmpURL }, new String[] { "java.net.URL" });
+
+ tmpWar.delete();
+ }
+ catch (RuntimeException rte)
+ {
+ throw rte;
+ }
+ catch (Exception ex)
+ {
+ throw new WebServiceException(ex);
+ }
+ }
+
+ private Class getImplementorClass(Endpoint endpoint)
+ {
+ Object implementor = endpoint.getImplementor();
+ Class implClass = (implementor instanceof Class ? (Class)implementor :
implementor.getClass());
+ return implClass;
+ }
+
+ private MBeanServerConnection getServer() throws NamingException
+ {
+ InitialContext iniCtx = new InitialContext();
+ MBeanServerConnection server =
(MBeanServerConnection)iniCtx.lookup("jmx/invoker/RMIAdaptor");
+ return server;
+ }
+
+ private Element createWebAppDescriptor(HttpContext context, Endpoint endpoint)
+ {
+ Class implClass = getImplementorClass(endpoint);
+ String implName = implClass.getName();
+
+ Element webApp = DOMUtils.createElement("web-app");
+
+ /*
+ <servlet>
+ <servlet-name>
+ <servlet-class>
+ </servlet>
+ */
+ Element servlet =
(Element)webApp.appendChild(DOMUtils.createElement("servlet"));
+ Element servletName =
(Element)servlet.appendChild(DOMUtils.createElement("servlet-name"));
+ servletName.appendChild(DOMUtils.createTextNode("JAXWSEndpoint"));
+ Element servletClass =
(Element)servlet.appendChild(DOMUtils.createElement("servlet-class"));
+ servletClass.appendChild(DOMUtils.createTextNode(implName));
+
+ /*
+ <servlet-mapping>
+ <servlet-name>
+ <url-pattern>
+ </servlet-mapping>
+ */
+ Element servletMapping =
(Element)webApp.appendChild(DOMUtils.createElement("servlet-mapping"));
+ servletName =
(Element)servletMapping.appendChild(DOMUtils.createElement("servlet-name"));
+ servletName.appendChild(DOMUtils.createTextNode("JAXWSEndpoint"));
+ Element urlPatternElement =
(Element)servletMapping.appendChild(DOMUtils.createElement("url-pattern"));
+
+ String urlPattern = "/*";
+ urlPatternElement.appendChild(DOMUtils.createTextNode(urlPattern));
+
+ // Add security-constraint in generated web.xml for Endpoint API
+ // FIXME: JBWS-1069
+
+ return webApp;
+ }
+
+ private Element createJBossWebAppDescriptor(HttpContext context, Endpoint endpoint)
+ {
+ /* Create a jboss-web
+ <jboss-web>
+ <security-domain>java:/jaas/cts</security-domain>
+ <context-root>/ws/ejbN/</context-root>
+ </jboss-web>
+ */
+ Element jbossWeb = DOMUtils.createElement("jboss-web");
+
+ // Get the context root for this deployment
+ String contextRoot = context.getContextRoot();
+ if (contextRoot == null)
+ throw new WebServiceException("Cannot obtain context root");
+
+ Element root =
(Element)jbossWeb.appendChild(DOMUtils.createElement("context-root"));
+ root.appendChild(DOMUtils.createTextNode(contextRoot));
+
+ // Add security-constraint in generated web.xml for Endpoint API
+ // FIXME: JBWS-1069
+
+ return jbossWeb;
+ }
+}
+
Modified: trunk/jbossws-core/src/main/java/org/jboss/ws/core/jaxws/spi/EndpointImpl.java
===================================================================
---
trunk/jbossws-core/src/main/java/org/jboss/ws/core/jaxws/spi/EndpointImpl.java 2007-07-28
07:14:06 UTC (rev 4023)
+++
trunk/jbossws-core/src/main/java/org/jboss/ws/core/jaxws/spi/EndpointImpl.java 2007-07-30
07:23:40 UTC (rev 4024)
@@ -152,7 +152,7 @@
// Check with the security manger
checkPublishEndpointPermission();
- // Check if we are standalone
+ /* Check if we are standalone
boolean isStandalone;
try
{
@@ -162,12 +162,13 @@
}
catch (Exception ex)
{
- // ignore, there should be no ServiceEndpointManager in VM
+ // ignore, there should be no ServerConfigFactory in VM
isStandalone = true;
}
if (isStandalone == false)
throw new IllegalStateException("Cannot publish endpoint from within
server");
+ */
if (context instanceof HttpContext)
{