Author: thomas.diesler(a)jboss.com
Date: 2006-12-21 07:35:57 -0500 (Thu, 21 Dec 2006)
New Revision: 1682
Added:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/server/ServiceEndpointPublisher.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/integration/jboss42/JBoss42ServiceEndpointPublisher.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/integration/jboss50/JBoss50ServiceEndpointPublisher.java
Removed:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/server/AbstractServiceEndpointPublisher.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/integration/jboss42/ServiceEndpointPublisher.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/integration/jboss50/ServiceEndpointPublisher.java
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/integration/jboss42/DeployerInterceptor.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/integration/jboss42/DeployerInterceptorJSE.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/integration/jboss42/JBossServiceEndpointPublisher.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/integration/jboss50/AbstractDeployer.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/integration/jboss50/AbstractEJBDeployer.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/integration/jboss50/AbstractJSEDeployer.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/integration/tomcat/DeploymentInfoAdaptor.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/integration/tomcat/TomcatServiceEndpointPublisher.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/integration/tomcat/wspublish.java
Log:
partial commit
Deleted:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/server/AbstractServiceEndpointPublisher.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/server/AbstractServiceEndpointPublisher.java 2006-12-21
10:11:41 UTC (rev 1681)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/server/AbstractServiceEndpointPublisher.java 2006-12-21
12:35:57 UTC (rev 1682)
@@ -1,262 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.ws.core.server;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.InputStream;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-import javax.servlet.Servlet;
-
-import org.jboss.logging.Logger;
-import org.jboss.ws.WSException;
-import org.jboss.ws.core.utils.DOMUtils;
-import org.jboss.ws.core.utils.DOMWriter;
-import org.jboss.ws.core.utils.IOUtils;
-import org.jboss.ws.core.utils.JavaUtils;
-import org.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(UnifiedDeploymentInfo udi) throws
Exception;
-
- public abstract String destroyServiceEndpoint(UnifiedDeploymentInfo udi) throws
Exception;
-
- public URL rewriteWarWebXml(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
- {
- // After redeployment there might be a stale copy of the original
web.xml.org,
we delete it
- File orgWebXML = new File(webXML.getCanonicalPath() + ".org");
- orgWebXML.delete();
-
- // Rename the web.xml
- if (webXML.renameTo(orgWebXML) == false)
- throw new WSException("Cannot rename web.xml: " + orgWebXML);
-
- FileInputStream stream = new FileInputStream(orgWebXML);
- return rewriteWebXml(stream, webXML, null).toURL();
- }
- catch (RuntimeException rte)
- {
- throw rte;
- }
- catch (Exception e)
- {
- throw new WSException(e);
- }
- }
-
- public File rewriteWebXml(InputStream source, File dest, ClassLoader loader) throws
Exception
- {
- if (dest == null)
- {
- dest = File.createTempFile("jbossws-alt-web", "xml",
IOUtils.createTempDirectory());
- dest.deleteOnExit();
- }
-
- Element root = DOMUtils.parse(source);
- modifyServletConfig(root, loader);
-
- FileOutputStream fos = new FileOutputStream(dest);
- new DOMWriter(fos).setPrettyprint(true).print(root);
- fos.flush();
- fos.close();
-
- return dest;
- }
-
- private Map<String, String> modifyServletConfig(Element root, ClassLoader
loader) throws ClassNotFoundException
- {
- 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");
-
- // JSP
- if (classElement == null)
- continue;
-
- String servletClassName = DOMUtils.getTextContent(classElement).trim();
-
- // Get the servlet class
- Class servletClass = null;
- if (loader != null)
- {
- try
- {
- servletClass = loader.loadClass(servletClassName);
- }
- catch (ClassNotFoundException ex)
- {
- log.warn("Cannot load servlet class: " + servletClassName);
- }
- }
-
- 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 (servletClass != null && JavaUtils.isAssignableFrom(Servlet.class,
servletClass))
- {
- log.info("Ignore servlet: " + servletClassName);
- continue;
- }
- else 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
Copied:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/server/ServiceEndpointPublisher.java
(from rev 1675,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/server/AbstractServiceEndpointPublisher.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/server/AbstractServiceEndpointPublisher.java 2006-12-21
09:45:07 UTC (rev 1675)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/core/server/ServiceEndpointPublisher.java 2006-12-21
12:35:57 UTC (rev 1682)
@@ -0,0 +1,260 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.ws.core.server;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.InputStream;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import javax.servlet.Servlet;
+
+import org.jboss.logging.Logger;
+import org.jboss.ws.WSException;
+import org.jboss.ws.core.utils.DOMUtils;
+import org.jboss.ws.core.utils.DOMWriter;
+import org.jboss.ws.core.utils.IOUtils;
+import org.jboss.ws.core.utils.JavaUtils;
+import org.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 configured service endpoint servlet
+ protected String servletName;
+
+ public String getServiceEndpointServlet()
+ {
+ return servletName;
+ }
+
+ public void setServiceEndpointServlet(String servletName)
+ {
+ this.servletName = servletName;
+ }
+
+ public abstract String publishServiceEndpoint(UnifiedDeploymentInfo udi) throws
Exception;
+
+ public abstract String destroyServiceEndpoint(UnifiedDeploymentInfo udi) throws
Exception;
+
+ public URL rewriteWebXml(UnifiedDeploymentInfo udi)
+ {
+ URL warURL = udi.expandedWebApp;
+ return rewriteWebXml(warURL);
+ }
+
+ public URL 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
+ {
+ // After redeployment there might be a stale copy of the original
web.xml.org,
we delete it
+ File orgWebXML = new File(webXML.getCanonicalPath() + ".org");
+ orgWebXML.delete();
+
+ // Rename the web.xml
+ if (webXML.renameTo(orgWebXML) == false)
+ throw new WSException("Cannot rename web.xml: " + orgWebXML);
+
+ FileInputStream stream = new FileInputStream(orgWebXML);
+ return rewriteWebXml(stream, webXML, null);
+ }
+ catch (RuntimeException rte)
+ {
+ throw rte;
+ }
+ catch (Exception e)
+ {
+ throw new WSException(e);
+ }
+ }
+
+ public URL rewriteWebXml(InputStream source, File dest, ClassLoader loader) throws
Exception
+ {
+ if (dest == null)
+ {
+ dest = File.createTempFile("jbossws-alt-web", "xml",
IOUtils.createTempDirectory());
+ dest.deleteOnExit();
+ }
+
+ Element root = DOMUtils.parse(source);
+ modifyServletConfig(root, loader);
+
+ FileOutputStream fos = new FileOutputStream(dest);
+ new DOMWriter(fos).setPrettyprint(true).print(root);
+ fos.flush();
+ fos.close();
+
+ return dest.toURL();
+ }
+
+ private void modifyServletConfig(Element root, ClassLoader loader) throws
ClassNotFoundException
+ {
+ Iterator itServlets = DOMUtils.getChildElements(root, "servlet");
+ while (itServlets.hasNext())
+ {
+ Element servletElement = (Element)itServlets.next();
+ String linkName =
DOMUtils.getTextContent(DOMUtils.getFirstChildElement(servletElement,
"servlet-name"));
+
+ // find the servlet-class
+ Element classElement = DOMUtils.getFirstChildElement(servletElement,
"servlet-class");
+
+ // JSP
+ if (classElement == null)
+ continue;
+
+ String servletClassName = DOMUtils.getTextContent(classElement).trim();
+
+ // Get the servlet class
+ Class servletClass = null;
+ if (loader != null)
+ {
+ try
+ {
+ servletClass = loader.loadClass(servletClassName);
+ }
+ catch (ClassNotFoundException ex)
+ {
+ log.warn("Cannot load servlet class: " + servletClassName);
+ }
+ }
+
+ 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 (servletClass != null && JavaUtils.isAssignableFrom(Servlet.class,
servletClass))
+ {
+ log.info("Ignore servlet: " + servletClassName);
+ continue;
+ }
+ else 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);
+ }
+ }
+
+ // 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:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/integration/jboss42/DeployerInterceptor.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/integration/jboss42/DeployerInterceptor.java 2006-12-21
10:11:41 UTC (rev 1681)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/integration/jboss42/DeployerInterceptor.java 2006-12-21
12:35:57 UTC (rev 1682)
@@ -33,6 +33,7 @@
import org.jboss.mx.util.MBeanProxy;
import org.jboss.ws.core.server.KernelLocator;
import org.jboss.ws.core.server.ServiceEndpointDeployer;
+import org.jboss.ws.core.server.ServiceEndpointPublisher;
import org.jboss.ws.core.server.UnifiedDeploymentInfo;
/**
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/integration/jboss42/DeployerInterceptorJSE.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/integration/jboss42/DeployerInterceptorJSE.java 2006-12-21
10:11:41 UTC (rev 1681)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/integration/jboss42/DeployerInterceptorJSE.java 2006-12-21
12:35:57 UTC (rev 1682)
@@ -32,6 +32,7 @@
import org.jboss.mx.server.Invocation;
import org.jboss.ws.WSException;
import org.jboss.ws.core.server.JAXWSDeployment;
+import org.jboss.ws.core.server.ServiceEndpointPublisher;
import org.jboss.ws.core.server.UnifiedDeploymentInfo;
import org.jboss.ws.core.server.UnifiedDeploymentInfo.DeploymentType;
import org.jboss.ws.metadata.builder.jaxrpc.JAXRPCDeployment;
@@ -85,27 +86,11 @@
if (udi != null)
{
ServiceEndpointPublisher endpointPublisher = getServiceEndpointPublisher();
- Map<String, String> sepTargetMap = endpointPublisher.rewriteWebXml(udi);
- updateServiceEndpointTargetBeans(udi, sepTargetMap);
+ endpointPublisher.rewriteWebXml(udi);
}
return retn;
}
- private void updateServiceEndpointTargetBeans(UnifiedDeploymentInfo udi,
Map<String, String> sepTargetMap)
- {
- UnifiedMetaData wsMetaData = getServiceEndpointDeployer().getUnifiedMetaData(udi);
-
- for (ServiceMetaData serviceMetaData : wsMetaData.getServices())
- {
- for (EndpointMetaData epMetaData : serviceMetaData.getEndpoints())
- {
- ServerEndpointMetaData sepMetaData = (ServerEndpointMetaData)epMetaData;
- String targetBean = sepTargetMap.get(sepMetaData.getLinkName());
- sepMetaData.setServiceEndpointImplName(targetBean);
- }
- }
- }
-
/** Return true if the deployment is a web service endpoint
*/
protected boolean isWebserviceDeployment(DeploymentInfo di)
Copied:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/integration/jboss42/JBoss42ServiceEndpointPublisher.java
(from rev 1675,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/integration/jboss42/ServiceEndpointPublisher.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/integration/jboss42/ServiceEndpointPublisher.java 2006-12-21
09:45:07 UTC (rev 1675)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/integration/jboss42/JBoss42ServiceEndpointPublisher.java 2006-12-21
12:35:57 UTC (rev 1682)
@@ -0,0 +1,103 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.ws.integration.jboss42;
+
+// $Id$
+
+import java.net.URL;
+import java.util.HashSet;
+import java.util.Set;
+
+import javax.management.MBeanServer;
+
+import org.jboss.deployment.DeploymentInfo;
+import org.jboss.deployment.MainDeployerMBean;
+import org.jboss.logging.Logger;
+import org.jboss.mx.util.MBeanProxy;
+import org.jboss.mx.util.MBeanProxyCreationException;
+import org.jboss.mx.util.MBeanServerLocator;
+import org.jboss.ws.core.server.ServiceEndpointPublisher;
+import org.jboss.ws.core.server.UnifiedDeploymentInfo;
+import org.jboss.ws.metadata.umdm.EndpointMetaData;
+import org.jboss.ws.metadata.umdm.ServerEndpointMetaData;
+import org.jboss.ws.metadata.umdm.ServiceMetaData;
+import org.jboss.ws.metadata.umdm.UnifiedMetaData;
+
+/**
+ * Publish the HTTP service endpoint to Tomcat
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 12-May-2006
+ */
+public class JBoss42ServiceEndpointPublisher extends ServiceEndpointPublisher
+{
+ // provide logging
+ private static Logger log = Logger.getLogger(JBoss42ServiceEndpointPublisher.class);
+
+ public String publishServiceEndpoint(UnifiedDeploymentInfo udi) throws Exception
+ {
+ URL warURL = udi.localUrl;
+ DeploymentInfo di =
(DeploymentInfo)udi.context.get(DeploymentInfo.class.getName());
+ if (di == null)
+ throw new IllegalStateException("Cannot obtain DeploymentInfo from
context");
+
+ rewriteWebXml(udi);
+
+ // Preserve the repository config
+ DeploymentInfo auxdi = new DeploymentInfo(warURL, null,
MBeanServerLocator.locateJBoss());
+ auxdi.repositoryConfig = di.getTopRepositoryConfig();
+ getMainDeployer().deploy(auxdi);
+ return "OK";
+ }
+
+ public String destroyServiceEndpoint(UnifiedDeploymentInfo udi) throws Exception
+ {
+ getMainDeployer().undeploy(udi.localUrl);
+ return "OK";
+ }
+
+ public Set<String> getWebServiceServletLinks(UnifiedDeploymentInfo udi)
+ {
+ Set<String> links = new HashSet<String>();
+
+ UnifiedMetaData wsMetaData = getServiceEndpointDeployer().getUnifiedMetaData(udi);
+
+ for (ServiceMetaData serviceMetaData : wsMetaData.getServices())
+ {
+ for (EndpointMetaData epMetaData : serviceMetaData.getEndpoints())
+ {
+ ServerEndpointMetaData sepMetaData = (ServerEndpointMetaData)epMetaData;
+ links.add(sepMetaData.getLinkName());
+
+ }
+ }
+
+ return links;
+ }
+
+ private MainDeployerMBean getMainDeployer() throws MBeanProxyCreationException
+ {
+ MBeanServer server = MBeanServerLocator.locateJBoss();
+ MainDeployerMBean mainDeployer =
(MainDeployerMBean)MBeanProxy.get(MainDeployerMBean.class, MainDeployerMBean.OBJECT_NAME,
server);
+ return mainDeployer;
+ }
+}
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/integration/jboss42/JBossServiceEndpointPublisher.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/integration/jboss42/JBossServiceEndpointPublisher.java 2006-12-21
10:11:41 UTC (rev 1681)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/integration/jboss42/JBossServiceEndpointPublisher.java 2006-12-21
12:35:57 UTC (rev 1682)
@@ -56,7 +56,7 @@
if (di == null)
throw new IllegalStateException("Cannot obtain DeploymentInfo from
context");
- rewriteWebXML(udi);
+ rewriteWebXml(udi);
// Preserve the repository config
DeploymentInfo auxdi = new DeploymentInfo(warURL, null,
MBeanServerLocator.locateJBoss());
Deleted:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/integration/jboss42/ServiceEndpointPublisher.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/integration/jboss42/ServiceEndpointPublisher.java 2006-12-21
10:11:41 UTC (rev 1681)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/integration/jboss42/ServiceEndpointPublisher.java 2006-12-21
12:35:57 UTC (rev 1682)
@@ -1,103 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.ws.integration.jboss42;
-
-// $Id$
-
-import java.net.URL;
-import java.util.HashSet;
-import java.util.Set;
-
-import javax.management.MBeanServer;
-
-import org.jboss.deployment.DeploymentInfo;
-import org.jboss.deployment.MainDeployerMBean;
-import org.jboss.logging.Logger;
-import org.jboss.mx.util.MBeanProxy;
-import org.jboss.mx.util.MBeanProxyCreationException;
-import org.jboss.mx.util.MBeanServerLocator;
-import org.jboss.ws.core.server.AbstractServiceEndpointPublisher;
-import org.jboss.ws.core.server.UnifiedDeploymentInfo;
-import org.jboss.ws.metadata.umdm.EndpointMetaData;
-import org.jboss.ws.metadata.umdm.ServerEndpointMetaData;
-import org.jboss.ws.metadata.umdm.ServiceMetaData;
-import org.jboss.ws.metadata.umdm.UnifiedMetaData;
-
-/**
- * Publish the HTTP service endpoint to Tomcat
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 12-May-2006
- */
-public class ServiceEndpointPublisher extends AbstractServiceEndpointPublisher
-{
- // provide logging
- private static Logger log = Logger.getLogger(ServiceEndpointPublisher.class);
-
- public String publishServiceEndpoint(UnifiedDeploymentInfo udi) throws Exception
- {
- URL warURL = udi.localUrl;
- DeploymentInfo di =
(DeploymentInfo)udi.context.get(DeploymentInfo.class.getName());
- if (di == null)
- throw new IllegalStateException("Cannot obtain DeploymentInfo from
context");
-
- rewriteWarWebXml(warURL);
-
- // Preserve the repository config
- DeploymentInfo auxdi = new DeploymentInfo(warURL, null,
MBeanServerLocator.locateJBoss());
- auxdi.repositoryConfig = di.getTopRepositoryConfig();
- getMainDeployer().deploy(auxdi);
- return "OK";
- }
-
- public String destroyServiceEndpoint(UnifiedDeploymentInfo udi) throws Exception
- {
- getMainDeployer().undeploy(udi.localUrl);
- return "OK";
- }
-
- public Set<String> getWebServiceServletLinks(UnifiedDeploymentInfo udi)
- {
- Set<String> links = new HashSet<String>();
-
- UnifiedMetaData wsMetaData = getServiceEndpointDeployer().getUnifiedMetaData(udi);
-
- for (ServiceMetaData serviceMetaData : wsMetaData.getServices())
- {
- for (EndpointMetaData epMetaData : serviceMetaData.getEndpoints())
- {
- ServerEndpointMetaData sepMetaData = (ServerEndpointMetaData)epMetaData;
- links.add(sepMetaData.getLinkName());
-
- }
- }
-
- return links;
- }
-
- private MainDeployerMBean getMainDeployer() throws MBeanProxyCreationException
- {
- MBeanServer server = MBeanServerLocator.locateJBoss();
- MainDeployerMBean mainDeployer =
(MainDeployerMBean)MBeanProxy.get(MainDeployerMBean.class, MainDeployerMBean.OBJECT_NAME,
server);
- return mainDeployer;
- }
-}
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/integration/jboss50/AbstractDeployer.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/integration/jboss50/AbstractDeployer.java 2006-12-21
10:11:41 UTC (rev 1681)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/integration/jboss50/AbstractDeployer.java 2006-12-21
12:35:57 UTC (rev 1682)
@@ -28,15 +28,25 @@
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.core.server.AbstractServiceEndpointPublisher;
+import org.jboss.ws.core.server.ServiceEndpointPublisher;
import org.jboss.ws.core.server.KernelLocator;
import org.jboss.ws.core.server.ServiceEndpointDeployer;
import org.jboss.ws.core.server.UnifiedDeploymentInfo;
import org.jboss.ws.core.server.UnifiedDeploymentInfo.DeploymentType;
/**
- * An abstract web service deployer
+ * An abstract web service deployer.
+ *
+ * deploy(unit)
+ * if(isWebServiceDeployment)
+ * deployServiceEndoint
+ * udi = createUnifiedDeploymentInfo()
+ * ServiceEndpointDeployer.create(udi)
*
+ * undeploy(unit)
+ * undeployServiceEndoint
+ * ServiceEndpointDeployer.destroy(udi)
+ *
* @author Thomas.Diesler(a)jboss.org
* @since 31-Oct-2006
*/
@@ -57,7 +67,11 @@
deployInternal(unit);
}
- private void deployInternal(DeploymentUnit unit) throws DeploymentException
+ /**
+ * Called when the deployment contains web service endpoints.
+ * Is private and handles recovery of failed deployments
+ */
+ private final void deployInternal(DeploymentUnit unit) throws DeploymentException
{
try
{
@@ -91,12 +105,12 @@
/** Create the unified deployment info from the deployment unit
*/
- protected abstract UnifiedDeploymentInfo createUnifiedDeploymentInfo(DeploymentUnit
unit) throws DeploymentException;
+ protected abstract UnifiedDeploymentInfo createUnifiedDeploymentInfo(DeploymentUnit
unit) throws Exception;
/** Create the unified deployment info and create the service endpoints
* through the ServiceEndpointDeployer
*/
- protected void deployServiceEndpoint(DeploymentUnit unit) throws DeploymentException
+ protected void deployServiceEndpoint(DeploymentUnit unit) throws Exception
{
UnifiedDeploymentInfo udi = createUnifiedDeploymentInfo(unit);
unit.addAttachment(UnifiedDeploymentInfo.class, udi);
@@ -110,7 +124,7 @@
destroyServiceEndpoint(udi, unit);
}
- protected void createServiceEndpoint(UnifiedDeploymentInfo udi, DeploymentUnit unit)
throws DeploymentException
+ protected void createServiceEndpoint(UnifiedDeploymentInfo udi, DeploymentUnit unit)
throws Exception
{
log.debug("Create ServiceEndpoint: " + udi.getCanonicalName());
getServiceEndpointDeployer().create(udi);
@@ -130,7 +144,6 @@
{
UnifiedDeploymentInfo udi = unit.getAttachment(UnifiedDeploymentInfo.class);
return (udi != null && udi.type == getDeploymentType() ? udi : null);
-
}
protected ServiceEndpointDeployer getServiceEndpointDeployer()
@@ -140,10 +153,10 @@
return (ServiceEndpointDeployer)entry.getTarget();
}
- protected ServiceEndpointPublisher getServiceEndpointPublisher()
+ protected JBoss50ServiceEndpointPublisher getServiceEndpointPublisher()
{
KernelRegistry registry = KernelLocator.getKernel().getRegistry();
- KernelRegistryEntry entry =
registry.getEntry(AbstractServiceEndpointPublisher.BEAN_NAME);
- return (ServiceEndpointPublisher)entry.getTarget();
+ KernelRegistryEntry entry = registry.getEntry(ServiceEndpointPublisher.BEAN_NAME);
+ return (JBoss50ServiceEndpointPublisher)entry.getTarget();
}
}
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/integration/jboss50/AbstractEJBDeployer.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/integration/jboss50/AbstractEJBDeployer.java 2006-12-21
10:11:41 UTC (rev 1681)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/integration/jboss50/AbstractEJBDeployer.java 2006-12-21
12:35:57 UTC (rev 1682)
@@ -39,18 +39,18 @@
public abstract class AbstractEJBDeployer extends AbstractDeployer
{
@Override
- protected void createServiceEndpoint(UnifiedDeploymentInfo udi, DeploymentUnit unit)
throws DeploymentException
+ protected void createServiceEndpoint(UnifiedDeploymentInfo udi, DeploymentUnit unit)
throws Exception
{
// Create the service endpoint
super.createServiceEndpoint(udi, unit);
- // Generate the webapp and publish to tomcat
+ // Generate the webapp and publish through th publisher
try
{
UnifiedMetaData wsMetaData =
getServiceEndpointDeployer().getUnifiedMetaData(udi);
URL warURL = new ServiceEndpointGeneratorEJB3().generatWebDeployment(wsMetaData,
unit);
unit.addAttachment(ServiceEndpointWebApp.class, new
ServiceEndpointWebApp(warURL));
- getServiceEndpointPublisher().publishServiceEndpoint(warURL);
+ getServiceEndpointPublisher().publishServiceEndpoint(udi);
}
catch (Exception ex)
{
@@ -65,7 +65,7 @@
URL warURL = unit.getAttachment(ServiceEndpointWebApp.class).getWarURL();
try
{
- getServiceEndpointPublisher().destroyServiceEndpoint(warURL);
+ getServiceEndpointPublisher().destroyServiceEndpoint(udi);
}
catch (Exception ex)
{
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/integration/jboss50/AbstractJSEDeployer.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/integration/jboss50/AbstractJSEDeployer.java 2006-12-21
10:11:41 UTC (rev 1681)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/integration/jboss50/AbstractJSEDeployer.java 2006-12-21
12:35:57 UTC (rev 1682)
@@ -24,6 +24,7 @@
//$Id$
import java.io.InputStream;
+import java.net.URL;
import java.util.Iterator;
import java.util.Set;
@@ -32,8 +33,7 @@
import org.jboss.metadata.NameValuePair;
import org.jboss.metadata.WebMetaData;
import org.jboss.metadata.web.Servlet;
-import org.jboss.ws.WSException;
-import org.jboss.ws.core.server.UnifiedDeploymentInfo;
+import org.jboss.ws.core.server.ServiceEndpointPublisher;
/**
* An abstract deployer for JSE Endpoints
@@ -43,61 +43,33 @@
*/
public abstract class AbstractJSEDeployer extends AbstractDeployer
{
- // The servlet init param in web.xml that is the service endpoint class
- public static final String INIT_PARAM_SERVICE_ENDPOINT_IMPL =
"ServiceEndpointImpl";
-
public AbstractJSEDeployer()
{
super();
super.setRelativeOrder(CLASSLOADER_DEPLOYER + 1);
}
- /** Create the unified deployment info and create and start th eservice endpoints
- * through the ServiceEndpointDeployer
+ /**
+ * After the service endpoint has successfully been deployed to the
ServiceEndpointManager,
+ *
*/
@Override
- protected void deployServiceEndpoint(DeploymentUnit unit) throws DeploymentException
+ protected void deployServiceEndpoint(DeploymentUnit unit) throws Exception
{
// Call the super implementation
super.deployServiceEndpoint(unit);
// FIXME: JBAS-3812 - TomcatDeployment should use modified WebMetaData
- String altDD = generateAltDD(unit);
+ InputStream stream =
unit.getDeploymentContext().getRoot().findChild("WEB-INF/web.xml").openStream();
+ URL webXml = getServiceEndpointPublisher().rewriteWebXml(stream, null,
unit.getClassLoader());
- // modify the WebMetaData
- modifyWebMetaData(unit, altDD);
+ modifyWebMetaData(unit, webXml);
}
- private String generateAltDD(DeploymentUnit unit)
+ private void modifyWebMetaData(DeploymentUnit unit, URL altDD) throws
DeploymentException
{
try
{
- InputStream stream =
unit.getDeploymentContext().getRoot().findChild("WEB-INF/web.xml").openStream();
- ClassLoader loader = unit.getClassLoader();
- return getServiceEndpointPublisher().rewriteWebXml(stream, null,
loader).toString();
- }
- catch (RuntimeException rte)
- {
- throw rte;
- }
- catch (Exception e)
- {
- WSException.rethrow("Could not generate alternate deployment
descriptor", e);
- return null;
- }
- }
-
- @Override
- protected void undeployServiceEndpoint(DeploymentUnit unit, UnifiedDeploymentInfo
udi)
- {
- // Call the super implementation
- super.undeployServiceEndpoint(unit, udi);
- }
-
- private void modifyWebMetaData(DeploymentUnit unit, String altDD) throws
DeploymentException
- {
- try
- {
Set<? extends WebMetaData> allMetaData =
unit.getAllMetaData(WebMetaData.class);
if (allMetaData.size() > 0)
{
@@ -118,13 +90,13 @@
if (isAlreadyModified(servlet) == false)
{
servlet.setServletClass(serviceEndpointServlet);
- NameValuePair initParam = new
NameValuePair(INIT_PARAM_SERVICE_ENDPOINT_IMPL, servletClassName);
+ NameValuePair initParam = new
NameValuePair(ServiceEndpointPublisher.INIT_PARAM_SERVICE_ENDPOINT_IMPL,
servletClassName);
servlet.addInitParam(initParam);
}
-
- // FIXME: JBAS-3812 - TomcatDeployment should use modified WebMetaData
- webMetaData.setAltDDPath(altDD);
}
+
+ // FIXME: JBAS-3812 - TomcatDeployment should use modified WebMetaData
+ webMetaData.setAltDDPath(altDD.toExternalForm());
}
}
catch (Exception ex)
@@ -139,7 +111,7 @@
while (itParams.hasNext())
{
NameValuePair pair = (NameValuePair)itParams.next();
- if (INIT_PARAM_SERVICE_ENDPOINT_IMPL.equals(pair.getName()))
+ if
(ServiceEndpointPublisher.INIT_PARAM_SERVICE_ENDPOINT_IMPL.equals(pair.getName()))
return true;
}
return false;
Copied:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/integration/jboss50/JBoss50ServiceEndpointPublisher.java
(from rev 1675,
branches/tdiesler/trunk/src/main/java/org/jboss/ws/integration/jboss50/ServiceEndpointPublisher.java)
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/integration/jboss50/ServiceEndpointPublisher.java 2006-12-21
09:45:07 UTC (rev 1675)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/integration/jboss50/JBoss50ServiceEndpointPublisher.java 2006-12-21
12:35:57 UTC (rev 1682)
@@ -0,0 +1,101 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.ws.integration.jboss50;
+
+// $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.core.server.ServiceEndpointPublisher;
+import org.jboss.ws.core.server.UnifiedDeploymentInfo;
+
+/**
+ * Publish the HTTP service endpoint to Tomcat
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 12-May-2006
+ */
+public class JBoss50ServiceEndpointPublisher extends ServiceEndpointPublisher
+{
+ // provide logging
+ private static Logger log = Logger.getLogger(JBoss50ServiceEndpointPublisher.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(UnifiedDeploymentInfo udi) throws Exception
+ {
+ URL warURL = udi.expandedWebApp;
+ 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(UnifiedDeploymentInfo udi) throws Exception
+ {
+ URL warURL = udi.expandedWebApp;
+ 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";
+ }
+
+ private DeploymentContext createDeploymentContext(URL warURL) throws Exception
+ {
+ VirtualFile file = VFS.getRoot(warURL);
+ return new AbstractDeploymentContext(file);
+ }
+}
Deleted:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/integration/jboss50/ServiceEndpointPublisher.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/integration/jboss50/ServiceEndpointPublisher.java 2006-12-21
10:11:41 UTC (rev 1681)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/integration/jboss50/ServiceEndpointPublisher.java 2006-12-21
12:35:57 UTC (rev 1682)
@@ -1,98 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.ws.integration.jboss50;
-
-// $Id$
-
-import java.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.core.server.AbstractServiceEndpointPublisher;
-
-/**
- * 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);
-
- rewriteWarWebXml(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";
- }
-
- private DeploymentContext createDeploymentContext(URL warURL) throws Exception
- {
- VirtualFile file = VFS.getRoot(warURL);
- return new AbstractDeploymentContext(file);
- }
-}
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/integration/tomcat/DeploymentInfoAdaptor.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/integration/tomcat/DeploymentInfoAdaptor.java 2006-12-21
10:11:41 UTC (rev 1681)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/integration/tomcat/DeploymentInfoAdaptor.java 2006-12-21
12:35:57 UTC (rev 1682)
@@ -37,7 +37,7 @@
import javax.servlet.ServletContext;
import org.jboss.ws.WSException;
-import org.jboss.ws.core.server.AbstractServiceEndpointPublisher;
+import org.jboss.ws.core.server.ServiceEndpointPublisher;
import org.jboss.ws.core.server.UnifiedDeploymentInfo;
import org.jboss.ws.core.utils.DOMUtils;
import org.jboss.ws.metadata.j2ee.UnifiedWebMetaData;
@@ -138,7 +138,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
(AbstractServiceEndpointPublisher.INIT_PARAM_SERVICE_ENDPOINT_IMPL.equals(paramName))
+ if
(ServiceEndpointPublisher.INIT_PARAM_SERVICE_ENDPOINT_IMPL.equals(paramName))
{
servletClassMap.put(servletName, paramValue);
}
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/integration/tomcat/TomcatServiceEndpointPublisher.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/integration/tomcat/TomcatServiceEndpointPublisher.java 2006-12-21
10:11:41 UTC (rev 1681)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/integration/tomcat/TomcatServiceEndpointPublisher.java 2006-12-21
12:35:57 UTC (rev 1682)
@@ -32,7 +32,7 @@
import org.jboss.logging.Logger;
import org.jboss.util.NotImplementedException;
-import org.jboss.ws.core.server.AbstractServiceEndpointPublisher;
+import org.jboss.ws.core.server.ServiceEndpointPublisher;
import org.jboss.ws.core.server.UnifiedDeploymentInfo;
/**
@@ -41,7 +41,7 @@
* @author Thomas.Diesler(a)jboss.org
* @since 12-May-2006
*/
-public class TomcatServiceEndpointPublisher extends AbstractServiceEndpointPublisher
+public class TomcatServiceEndpointPublisher extends ServiceEndpointPublisher
{
// logging support
private static Logger log = Logger.getLogger(TomcatServiceEndpointPublisher.class);
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/integration/tomcat/wspublish.java
===================================================================
---
branches/tdiesler/trunk/src/main/java/org/jboss/ws/integration/tomcat/wspublish.java 2006-12-21
10:11:41 UTC (rev 1681)
+++
branches/tdiesler/trunk/src/main/java/org/jboss/ws/integration/tomcat/wspublish.java 2006-12-21
12:35:57 UTC (rev 1682)
@@ -69,7 +69,7 @@
TomcatServiceEndpointPublisher publisher = new TomcatServiceEndpointPublisher();
publisher.setServiceEndpointServlet(servletName);
- publisher.rewriteWarWebXml(tmpDir.toURL());
+ publisher.rewriteWebXml(tmpDir.toURL());
File outFile = new File(destDir.getCanonicalPath() + "/" + warName);
outFile.getParentFile().mkdirs();