JBossWS SVN: r7081 - container/jboss50/branches/jbossws-jboss500/src/main/java/org/jboss/wsf/container/jboss50/deployment/tomcat.
by jbossws-commits@lists.jboss.org
Author: richard.opalka(a)jboss.com
Date: 2008-05-16 19:22:56 -0400 (Fri, 16 May 2008)
New Revision: 7081
Added:
container/jboss50/branches/jbossws-jboss500/src/main/java/org/jboss/wsf/container/jboss50/deployment/tomcat/WebAppDescriptorModifier.java
Removed:
container/jboss50/branches/jbossws-jboss500/src/main/java/org/jboss/wsf/container/jboss50/deployment/tomcat/WebAppDesciptorModifier.java
Modified:
container/jboss50/branches/jbossws-jboss500/src/main/java/org/jboss/wsf/container/jboss50/deployment/tomcat/DefaultWebAppDesciptorModifierImpl.java
container/jboss50/branches/jbossws-jboss500/src/main/java/org/jboss/wsf/container/jboss50/deployment/tomcat/WebXMLRewriterImpl.java
Log:
refactoring - fixed typo
Modified: container/jboss50/branches/jbossws-jboss500/src/main/java/org/jboss/wsf/container/jboss50/deployment/tomcat/DefaultWebAppDesciptorModifierImpl.java
===================================================================
--- container/jboss50/branches/jbossws-jboss500/src/main/java/org/jboss/wsf/container/jboss50/deployment/tomcat/DefaultWebAppDesciptorModifierImpl.java 2008-05-16 23:22:33 UTC (rev 7080)
+++ container/jboss50/branches/jbossws-jboss500/src/main/java/org/jboss/wsf/container/jboss50/deployment/tomcat/DefaultWebAppDesciptorModifierImpl.java 2008-05-16 23:22:56 UTC (rev 7081)
@@ -37,7 +37,7 @@
* @author Thomas.Diesler(a)jboss.org
* @since 19-May-2006
*/
-public class DefaultWebAppDesciptorModifierImpl implements WebAppDesciptorModifier
+public class DefaultWebAppDesciptorModifierImpl implements WebAppDescriptorModifier
{
// logging support
private static Logger log = Logger.getLogger(DefaultWebAppDesciptorModifierImpl.class);
Deleted: container/jboss50/branches/jbossws-jboss500/src/main/java/org/jboss/wsf/container/jboss50/deployment/tomcat/WebAppDesciptorModifier.java
===================================================================
--- container/jboss50/branches/jbossws-jboss500/src/main/java/org/jboss/wsf/container/jboss50/deployment/tomcat/WebAppDesciptorModifier.java 2008-05-16 23:22:33 UTC (rev 7080)
+++ container/jboss50/branches/jbossws-jboss500/src/main/java/org/jboss/wsf/container/jboss50/deployment/tomcat/WebAppDesciptorModifier.java 2008-05-16 23:22:56 UTC (rev 7081)
@@ -1,36 +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.deployment.tomcat;
-
-import org.jboss.wsf.spi.deployment.Deployment;
-import org.dom4j.Document;
-
-/**
- * Modifies the web app according to the stack requirements.
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 19-May-2007
- */
-public interface WebAppDesciptorModifier
-{
- RewriteResults modifyDescriptor(Deployment dep, Document webXml) throws ClassNotFoundException;
-}
Added: container/jboss50/branches/jbossws-jboss500/src/main/java/org/jboss/wsf/container/jboss50/deployment/tomcat/WebAppDescriptorModifier.java
===================================================================
--- container/jboss50/branches/jbossws-jboss500/src/main/java/org/jboss/wsf/container/jboss50/deployment/tomcat/WebAppDescriptorModifier.java (rev 0)
+++ container/jboss50/branches/jbossws-jboss500/src/main/java/org/jboss/wsf/container/jboss50/deployment/tomcat/WebAppDescriptorModifier.java 2008-05-16 23:22:56 UTC (rev 7081)
@@ -0,0 +1,36 @@
+/*
+ * 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.deployment.tomcat;
+
+import org.jboss.wsf.spi.deployment.Deployment;
+import org.dom4j.Document;
+
+/**
+ * Modifies the web app according to the stack requirements.
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 19-May-2007
+ */
+public interface WebAppDescriptorModifier
+{
+ RewriteResults modifyDescriptor(Deployment dep, Document webXml) throws ClassNotFoundException;
+}
Property changes on: container/jboss50/branches/jbossws-jboss500/src/main/java/org/jboss/wsf/container/jboss50/deployment/tomcat/WebAppDescriptorModifier.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: container/jboss50/branches/jbossws-jboss500/src/main/java/org/jboss/wsf/container/jboss50/deployment/tomcat/WebXMLRewriterImpl.java
===================================================================
--- container/jboss50/branches/jbossws-jboss500/src/main/java/org/jboss/wsf/container/jboss50/deployment/tomcat/WebXMLRewriterImpl.java 2008-05-16 23:22:33 UTC (rev 7080)
+++ container/jboss50/branches/jbossws-jboss500/src/main/java/org/jboss/wsf/container/jboss50/deployment/tomcat/WebXMLRewriterImpl.java 2008-05-16 23:22:56 UTC (rev 7081)
@@ -43,19 +43,19 @@
*/
public class WebXMLRewriterImpl
{
- private WebAppDesciptorModifier desciptorModifier;
+ private WebAppDescriptorModifier desciptorModifier;
public WebXMLRewriterImpl()
{
this.desciptorModifier = new DefaultWebAppDesciptorModifierImpl();
}
- public WebAppDesciptorModifier getDesciptorModifier()
+ public WebAppDescriptorModifier getDesciptorModifier()
{
return desciptorModifier;
}
- public void setDesciptorModifier(WebAppDesciptorModifier desciptorModifier)
+ public void setDesciptorModifier(WebAppDescriptorModifier desciptorModifier)
{
this.desciptorModifier = desciptorModifier;
}
16 years, 8 months
JBossWS SVN: r7080 - container/jboss50/branches/jbossws-jboss500/src/main/java/org/jboss/wsf/container/jboss50.
by jbossws-commits@lists.jboss.org
Author: richard.opalka(a)jboss.com
Date: 2008-05-16 19:22:33 -0400 (Fri, 16 May 2008)
New Revision: 7080
Removed:
container/jboss50/branches/jbossws-jboss500/src/main/java/org/jboss/wsf/container/jboss50/WebAppDeployingHttpServer.java
Log:
removing obsolete class
Deleted: container/jboss50/branches/jbossws-jboss500/src/main/java/org/jboss/wsf/container/jboss50/WebAppDeployingHttpServer.java
===================================================================
--- container/jboss50/branches/jbossws-jboss500/src/main/java/org/jboss/wsf/container/jboss50/WebAppDeployingHttpServer.java 2008-05-16 23:19:47 UTC (rev 7079)
+++ container/jboss50/branches/jbossws-jboss500/src/main/java/org/jboss/wsf/container/jboss50/WebAppDeployingHttpServer.java 2008-05-16 23:22:33 UTC (rev 7080)
@@ -1,247 +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$
-
-import java.io.File;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.net.URL;
-import java.util.HashMap;
-import java.util.Map;
-
-import javax.xml.ws.Endpoint;
-import javax.xml.ws.WebServiceException;
-
-import org.jboss.deployers.client.spi.DeployerClient;
-import org.jboss.deployers.client.spi.Deployment;
-import org.jboss.deployers.vfs.spi.client.VFSDeploymentFactory;
-import org.jboss.virtual.VFS;
-import org.jboss.virtual.VirtualFile;
-import org.jboss.wsf.common.DOMUtils;
-import org.jboss.wsf.common.DOMWriter;
-import org.jboss.wsf.spi.SPIProvider;
-import org.jboss.wsf.spi.SPIProviderResolver;
-import org.jboss.wsf.spi.deployment.AbstractExtensible;
-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 AbstractExtensible implements HttpServer
-{
- private DeployerClient mainDeployer;
- private Map<String, Deployment> deploymentMap = new HashMap<String, Deployment>();
-
- public void setMainDeployer(DeployerClient mainDeployer)
- {
- this.mainDeployer = 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");
- tmpDir.mkdirs();
-
- 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();
- Deployment deployment = createDeploymentContext(tmpURL);
-
- mainDeployer.deploy(deployment);
- deploymentMap.put(tmpURL.toExternalForm(), deployment);
- }
- 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();
- Deployment deployment = deploymentMap.get(tmpURL.toExternalForm());
- if (deployment != null)
- {
- mainDeployer.undeploy(deployment);
- deploymentMap.remove(tmpURL.toExternalForm());
- }
-
- 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 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;
- }
-
- private Deployment createDeploymentContext(URL warURL) throws Exception
- {
- VirtualFile file = VFS.getRoot(warURL);
- return VFSDeploymentFactory.getInstance().createVFSDeployment(file);
- }
-}
16 years, 8 months
JBossWS SVN: r7079 - container/jboss50/branches/jbossws-jboss500/src/main/java/org/jboss/wsf/container/jboss50/transport.
by jbossws-commits@lists.jboss.org
Author: richard.opalka(a)jboss.com
Date: 2008-05-16 19:19:47 -0400 (Fri, 16 May 2008)
New Revision: 7079
Added:
container/jboss50/branches/jbossws-jboss500/src/main/java/org/jboss/wsf/container/jboss50/transport/EJBHttpTransportManager.java
container/jboss50/branches/jbossws-jboss500/src/main/java/org/jboss/wsf/container/jboss50/transport/EndpointAPIHttpTransportManager.java
Log:
backported both endpoint and ejb transport managers
Added: container/jboss50/branches/jbossws-jboss500/src/main/java/org/jboss/wsf/container/jboss50/transport/EJBHttpTransportManager.java
===================================================================
--- container/jboss50/branches/jbossws-jboss500/src/main/java/org/jboss/wsf/container/jboss50/transport/EJBHttpTransportManager.java (rev 0)
+++ container/jboss50/branches/jbossws-jboss500/src/main/java/org/jboss/wsf/container/jboss50/transport/EJBHttpTransportManager.java 2008-05-16 23:19:47 UTC (rev 7079)
@@ -0,0 +1,110 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.transport;
+
+import org.jboss.wsf.framework.transport.HttpListenerRef;
+import org.jboss.wsf.spi.SPIProvider;
+import org.jboss.wsf.spi.SPIProviderResolver;
+import org.jboss.wsf.spi.deployment.Deployment;
+import org.jboss.wsf.spi.deployment.Endpoint;
+import org.jboss.wsf.spi.management.ServerConfig;
+import org.jboss.wsf.spi.management.ServerConfigFactory;
+import org.jboss.wsf.spi.transport.HttpSpec;
+import org.jboss.wsf.spi.transport.ListenerRef;
+import org.jboss.wsf.spi.transport.TransportManager;
+import org.jboss.wsf.spi.transport.TransportSpec;
+
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.net.URL;
+
+/**
+ * Creates a webapp dpeloyment and pushes it into the deployment framework
+ *
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public class EJBHttpTransportManager implements TransportManager
+{
+ private WebAppDeploymentFactory deploymentFactory;
+ private WebAppGenerator generator;
+
+ public ListenerRef createListener(Endpoint endpoint, TransportSpec transportSpec)
+ {
+
+ assert deploymentFactory!=null;
+ assert generator!=null;
+
+ // Resolve the endpoint address
+ if(! (transportSpec instanceof HttpSpec))
+ throw new IllegalArgumentException("Unknown TransportSpec " + transportSpec);
+ HttpSpec httpSpec = (HttpSpec)transportSpec;
+
+ // Create JBossWebMetaData and attach it to the DeploymentUnit
+ Deployment topLevelDeployment = endpoint.getService().getDeployment();
+
+ // TODO: Somehow the ServletClass and InitParameter need to go from TransportSpec into generator
+ topLevelDeployment.setProperty(HttpSpec.PROPERTY_WEBAPP_SERVLET_CLASS, httpSpec.getServletClass());
+ topLevelDeployment.setProperty(HttpSpec.PROPERTY_WEBAPP_CONTEXT_PARAMETERS, httpSpec.getContextParameter());
+ URL webAppURL = generator.create(topLevelDeployment);
+ deploymentFactory.create(topLevelDeployment, webAppURL);
+
+ SPIProvider provider = SPIProviderResolver.getInstance().getProvider();
+ ServerConfigFactory spi = provider.getSPI(ServerConfigFactory.class);
+ ServerConfig serverConfig = spi.getServerConfig();
+
+ String host = serverConfig.getWebServiceHost();
+ int port = serverConfig.getWebServicePort();
+ String hostAndPort = host + (port > 0 ? ":" + port : "");
+
+ try
+ {
+ String ctx = httpSpec.getWebContext();
+ String pattern = httpSpec.getUrlPattern();
+ ListenerRef ref = new HttpListenerRef(
+ ctx, pattern,
+ new URI("http://"+hostAndPort+ctx+pattern)
+ );
+
+ return ref;
+
+ } catch (URISyntaxException e)
+ {
+ throw new RuntimeException("Failed to create ListenerRef", e);
+ }
+
+ }
+
+ public void destroyListener(ListenerRef ref)
+ {
+ // noop
+ }
+
+ public void setDeploymentFactory(WebAppDeploymentFactory deploymentFactory)
+ {
+ this.deploymentFactory = deploymentFactory;
+ }
+
+ public void setGenerator(WebAppGenerator generator)
+ {
+ this.generator = generator;
+ }
+}
Property changes on: container/jboss50/branches/jbossws-jboss500/src/main/java/org/jboss/wsf/container/jboss50/transport/EJBHttpTransportManager.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: container/jboss50/branches/jbossws-jboss500/src/main/java/org/jboss/wsf/container/jboss50/transport/EndpointAPIHttpTransportManager.java
===================================================================
--- container/jboss50/branches/jbossws-jboss500/src/main/java/org/jboss/wsf/container/jboss50/transport/EndpointAPIHttpTransportManager.java (rev 0)
+++ container/jboss50/branches/jbossws-jboss500/src/main/java/org/jboss/wsf/container/jboss50/transport/EndpointAPIHttpTransportManager.java 2008-05-16 23:19:47 UTC (rev 7079)
@@ -0,0 +1,108 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.transport;
+
+import org.jboss.logging.Logger;
+import org.jboss.wsf.framework.transport.HttpListenerRef;
+import org.jboss.wsf.spi.SPIProvider;
+import org.jboss.wsf.spi.SPIProviderResolver;
+import org.jboss.wsf.spi.deployment.Deployment;
+import org.jboss.wsf.spi.deployment.Endpoint;
+import org.jboss.wsf.spi.management.ServerConfig;
+import org.jboss.wsf.spi.management.ServerConfigFactory;
+import org.jboss.wsf.spi.transport.HttpSpec;
+import org.jboss.wsf.spi.transport.ListenerRef;
+import org.jboss.wsf.spi.transport.TransportManager;
+import org.jboss.wsf.spi.transport.TransportSpec;
+
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.Map;
+import java.util.HashMap;
+
+/**
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public class EndpointAPIHttpTransportManager implements TransportManager
+{
+ private static Logger log = Logger.getLogger(EndpointAPIHttpTransportManager.class);
+
+ private WebAppGenerator generator;
+
+ private Map<String, Deployment> deploymentRegistry = new HashMap<String, Deployment>();
+
+ public ListenerRef createListener(Endpoint endpoint, TransportSpec transportSpec)
+ {
+ assert generator!=null;
+
+ // Resolve the endpoint address
+ if(! (transportSpec instanceof HttpSpec))
+ throw new IllegalArgumentException("Unknown TransportSpec " + transportSpec);
+ HttpSpec httpSpec = (HttpSpec)transportSpec;
+
+ // Create jboss web app data and attach it to the Deployment
+ Deployment topLevelDeployment = endpoint.getService().getDeployment();
+ generator.create(topLevelDeployment);
+
+ // Server config
+ SPIProvider provider = SPIProviderResolver.getInstance().getProvider();
+ ServerConfigFactory spi = provider.getSPI(ServerConfigFactory.class);
+ ServerConfig serverConfig = spi.getServerConfig();
+ String host = serverConfig.getWebServiceHost();
+ int port = serverConfig.getWebServicePort();
+ String hostAndPort = host + (port > 0 ? ":" + port : "");
+
+ ListenerRef listenerRef = null;
+ try
+ {
+ String ctx = httpSpec.getWebContext();
+ String pattern = httpSpec.getUrlPattern();
+ listenerRef = new HttpListenerRef( ctx, pattern, new URI("http://"+hostAndPort+ctx+pattern) );
+
+ }
+ catch (URISyntaxException e)
+ {
+ throw new RuntimeException("Failed to create ListenerRef", e);
+ }
+
+ // Map listenerRef for destroy phase
+ deploymentRegistry.put( listenerRef.getUUID(), topLevelDeployment );
+
+ return listenerRef;
+
+ }
+
+ public void destroyListener(ListenerRef ref)
+ {
+ Deployment dep = deploymentRegistry.get(ref.getUUID());
+ if(null==dep)
+ throw new IllegalArgumentException("Unknown ListenerRef " + ref);
+
+ deploymentRegistry.remove(ref.getUUID());
+ }
+
+ public void setGenerator(WebAppGenerator generator)
+ {
+ this.generator = generator;
+ }
+
+}
Property changes on: container/jboss50/branches/jbossws-jboss500/src/main/java/org/jboss/wsf/container/jboss50/transport/EndpointAPIHttpTransportManager.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
16 years, 8 months
JBossWS SVN: r7078 - container/jboss50/branches/jbossws-jboss500/src/main/java/org/jboss/wsf/container/jboss50/transport.
by jbossws-commits@lists.jboss.org
Author: richard.opalka(a)jboss.com
Date: 2008-05-16 19:02:49 -0400 (Fri, 16 May 2008)
New Revision: 7078
Modified:
container/jboss50/branches/jbossws-jboss500/src/main/java/org/jboss/wsf/container/jboss50/transport/WebAppDeploymentFactory.java
Log:
optimization
Modified: container/jboss50/branches/jbossws-jboss500/src/main/java/org/jboss/wsf/container/jboss50/transport/WebAppDeploymentFactory.java
===================================================================
--- container/jboss50/branches/jbossws-jboss500/src/main/java/org/jboss/wsf/container/jboss50/transport/WebAppDeploymentFactory.java 2008-05-16 22:51:22 UTC (rev 7077)
+++ container/jboss50/branches/jbossws-jboss500/src/main/java/org/jboss/wsf/container/jboss50/transport/WebAppDeploymentFactory.java 2008-05-16 23:02:49 UTC (rev 7078)
@@ -35,10 +35,8 @@
import org.jboss.virtual.VirtualFile;
import org.jboss.wsf.container.jboss50.deployment.tomcat.WebXMLRewriterImpl;
import org.jboss.wsf.spi.deployment.Deployment;
-import org.jboss.wsf.spi.deployment.DeploymentAspect;
import org.jboss.wsf.spi.deployment.WSFDeploymentException;
import org.jboss.wsf.spi.transport.HttpSpec;
-import org.jboss.wsf.spi.WSFRuntime;
/**
* Publish the HTTP service endpoint to Tomcat
@@ -60,9 +58,9 @@
this.mainDeployer = mainDeployer;
}
- public void setWebXMLRewriter(WebXMLRewriterImpl serviceEndpointPublisher)
+ public void setWebXMLRewriter(WebXMLRewriterImpl webXMLRewriter)
{
- this.webXMLRewriter = serviceEndpointPublisher;
+ this.webXMLRewriter = webXMLRewriter;
}
public void create(Deployment dep, URL webAppURL)
16 years, 8 months
JBossWS SVN: r7077 - in container/jboss50/branches/jbossws-jboss500/src/main/java/org/jboss/wsf/container/jboss50: deployment/tomcat and 1 other directory.
by jbossws-commits@lists.jboss.org
Author: richard.opalka(a)jboss.com
Date: 2008-05-16 18:51:22 -0400 (Fri, 16 May 2008)
New Revision: 7077
Added:
container/jboss50/branches/jbossws-jboss500/src/main/java/org/jboss/wsf/container/jboss50/deployment/tomcat/DefaultWebAppDesciptorModifierImpl.java
Removed:
container/jboss50/branches/jbossws-jboss500/src/main/java/org/jboss/wsf/container/jboss50/DefaultWebAppDesciptorModifierImpl.java
Modified:
container/jboss50/branches/jbossws-jboss500/src/main/java/org/jboss/wsf/container/jboss50/deployment/tomcat/WebXMLRewriterImpl.java
Log:
refactoring
Deleted: container/jboss50/branches/jbossws-jboss500/src/main/java/org/jboss/wsf/container/jboss50/DefaultWebAppDesciptorModifierImpl.java
===================================================================
--- container/jboss50/branches/jbossws-jboss500/src/main/java/org/jboss/wsf/container/jboss50/DefaultWebAppDesciptorModifierImpl.java 2008-05-16 22:33:17 UTC (rev 7076)
+++ container/jboss50/branches/jbossws-jboss500/src/main/java/org/jboss/wsf/container/jboss50/DefaultWebAppDesciptorModifierImpl.java 2008-05-16 22:51:22 UTC (rev 7077)
@@ -1,171 +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;
-
-import java.util.Iterator;
-import java.util.Map;
-
-import org.dom4j.Document;
-import org.dom4j.Element;
-import org.jboss.logging.Logger;
-import org.jboss.wsf.container.jboss50.deployment.tomcat.RewriteResults;
-import org.jboss.wsf.container.jboss50.deployment.tomcat.WebAppDesciptorModifier;
-import org.jboss.wsf.spi.deployment.Deployment;
-import org.jboss.wsf.spi.deployment.Endpoint;
-import org.jboss.wsf.spi.transport.HttpSpec;
-
-/**
- * Modifies web.xml for jbossws
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 19-May-2006
- */
-public class DefaultWebAppDesciptorModifierImpl implements WebAppDesciptorModifier
-{
- // logging support
- private static Logger log = Logger.getLogger(DefaultWebAppDesciptorModifierImpl.class);
-
- public RewriteResults modifyDescriptor(Deployment dep, Document webXml) throws ClassNotFoundException
- {
- RewriteResults results = new RewriteResults();
- Element root = webXml.getRootElement();
-
- String servletClass = (String)dep.getProperty(HttpSpec.PROPERTY_WEBAPP_SERVLET_CLASS);
- if (servletClass == null)
- throw new IllegalStateException("Cannot obtain context property: " + HttpSpec.PROPERTY_WEBAPP_SERVLET_CLASS);
-
- Map<String, String> contextParams = (Map<String, String>)dep.getProperty(HttpSpec.PROPERTY_WEBAPP_CONTEXT_PARAMETERS);
- if (contextParams != null)
- {
- for (Map.Entry<String, String> entry : contextParams.entrySet())
- {
- // Ugly way to insert at position 0
- Element contextParamTmp = root.addElement("context-param-tmp");
-
- Element contextParam = (Element)contextParamTmp.clone();
- contextParam.setName("context-param");
- contextParam.addElement("param-name").addText(entry.getKey());
- contextParam.addElement("param-value").addText(entry.getValue());
- root.content().add(0, contextParam);
-
- root.remove(contextParamTmp);
- }
- }
-
- String listenerClass = (String)dep.getProperty(HttpSpec.PROPERTY_WEBAPP_SERVLET_CONTEXT_LISTENER);
- if (listenerClass != null)
- {
- Element listener = root.addElement("listener");
- listener.addElement("listener-class").setText(listenerClass);
- }
-
- for (Iterator it = root.elementIterator("servlet"); it.hasNext();)
- {
- Element servlet = (Element)it.next();
- String linkName = servlet.element("servlet-name").getTextTrim();
-
- // find the servlet-class
- Element classElement = servlet.element("servlet-class");
-
- // JSP
- if (classElement == null)
- continue;
-
- String orgServletClassName = classElement.getTextTrim();
-
- // Get the servlet class
- Class orgServletClass = null;
- try
- {
- ClassLoader loader = dep.getInitialClassLoader();
- orgServletClass = loader.loadClass(orgServletClassName);
- }
- catch (ClassNotFoundException ex)
- {
- log.warn("Cannot load servlet class: " + orgServletClassName);
- }
-
- String targetBeanName = null;
-
- // Nothing to do if we have an <init-param>
- if (isAlreadyModified(servlet))
- {
- for (Iterator itParam = servlet.elementIterator("init-param"); itParam.hasNext();)
- {
- Element elParam = (Element)itParam.next();
- String paramName = elParam.element("param-name").getTextTrim();
- String paramValue = elParam.element("param-value").getTextTrim();
- if (Endpoint.SEPID_DOMAIN_ENDPOINT.equals(paramName))
- {
- targetBeanName = paramValue;
- }
- }
- }
- else
- {
- // Check if it is a real servlet that we can ignore
- if (orgServletClass != null && javax.servlet.Servlet.class.isAssignableFrom(orgServletClass))
- {
- log.info("Ignore servlet: " + orgServletClassName);
- continue;
- }
- else if (orgServletClassName.endsWith("Servlet"))
- {
- log.info("Ignore <servlet-class> that ends with 'Servlet': " + orgServletClassName);
- continue;
- }
-
- classElement.setText(servletClass);
-
- // add additional init params
- if (orgServletClassName.equals(servletClass) == false)
- {
- targetBeanName = orgServletClassName;
- Element paramElement = servlet.addElement("init-param");
- paramElement.addElement("param-name").addText(Endpoint.SEPID_DOMAIN_ENDPOINT);
- paramElement.addElement("param-value").addText(targetBeanName);
- }
- }
-
- if (targetBeanName == null)
- throw new IllegalStateException("Cannot obtain service endpoint bean for: " + linkName);
-
- // remember the target bean name
- results.sepTargetMap.put(linkName, targetBeanName);
- }
-
- return results;
- }
-
- // Return true if the web.xml is already modified
- private boolean isAlreadyModified(Element servlet)
- {
- for (Iterator it = servlet.elementIterator("init-param"); it.hasNext();)
- {
- Element elParam = (Element)it.next();
- String paramName = elParam.element("param-name").getTextTrim();
- if (Endpoint.SEPID_DOMAIN_ENDPOINT.equals(paramName))
- return true;
- }
- return false;
- }
-}
Added: container/jboss50/branches/jbossws-jboss500/src/main/java/org/jboss/wsf/container/jboss50/deployment/tomcat/DefaultWebAppDesciptorModifierImpl.java
===================================================================
--- container/jboss50/branches/jbossws-jboss500/src/main/java/org/jboss/wsf/container/jboss50/deployment/tomcat/DefaultWebAppDesciptorModifierImpl.java (rev 0)
+++ container/jboss50/branches/jbossws-jboss500/src/main/java/org/jboss/wsf/container/jboss50/deployment/tomcat/DefaultWebAppDesciptorModifierImpl.java 2008-05-16 22:51:22 UTC (rev 7077)
@@ -0,0 +1,169 @@
+/*
+ * 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.deployment.tomcat;
+
+import java.util.Iterator;
+import java.util.Map;
+
+import org.dom4j.Document;
+import org.dom4j.Element;
+import org.jboss.logging.Logger;
+import org.jboss.wsf.spi.deployment.Deployment;
+import org.jboss.wsf.spi.deployment.Endpoint;
+import org.jboss.wsf.spi.transport.HttpSpec;
+
+/**
+ * Modifies web.xml for jbossws
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 19-May-2006
+ */
+public class DefaultWebAppDesciptorModifierImpl implements WebAppDesciptorModifier
+{
+ // logging support
+ private static Logger log = Logger.getLogger(DefaultWebAppDesciptorModifierImpl.class);
+
+ public RewriteResults modifyDescriptor(Deployment dep, Document webXml) throws ClassNotFoundException
+ {
+ RewriteResults results = new RewriteResults();
+ Element root = webXml.getRootElement();
+
+ String servletClass = (String)dep.getProperty(HttpSpec.PROPERTY_WEBAPP_SERVLET_CLASS);
+ if (servletClass == null)
+ throw new IllegalStateException("Cannot obtain context property: " + HttpSpec.PROPERTY_WEBAPP_SERVLET_CLASS);
+
+ Map<String, String> contextParams = (Map<String, String>)dep.getProperty(HttpSpec.PROPERTY_WEBAPP_CONTEXT_PARAMETERS);
+ if (contextParams != null)
+ {
+ for (Map.Entry<String, String> entry : contextParams.entrySet())
+ {
+ // Ugly way to insert at position 0
+ Element contextParamTmp = root.addElement("context-param-tmp");
+
+ Element contextParam = (Element)contextParamTmp.clone();
+ contextParam.setName("context-param");
+ contextParam.addElement("param-name").addText(entry.getKey());
+ contextParam.addElement("param-value").addText(entry.getValue());
+ root.content().add(0, contextParam);
+
+ root.remove(contextParamTmp);
+ }
+ }
+
+ String listenerClass = (String)dep.getProperty(HttpSpec.PROPERTY_WEBAPP_SERVLET_CONTEXT_LISTENER);
+ if (listenerClass != null)
+ {
+ Element listener = root.addElement("listener");
+ listener.addElement("listener-class").setText(listenerClass);
+ }
+
+ for (Iterator it = root.elementIterator("servlet"); it.hasNext();)
+ {
+ Element servlet = (Element)it.next();
+ String linkName = servlet.element("servlet-name").getTextTrim();
+
+ // find the servlet-class
+ Element classElement = servlet.element("servlet-class");
+
+ // JSP
+ if (classElement == null)
+ continue;
+
+ String orgServletClassName = classElement.getTextTrim();
+
+ // Get the servlet class
+ Class orgServletClass = null;
+ try
+ {
+ ClassLoader loader = dep.getInitialClassLoader();
+ orgServletClass = loader.loadClass(orgServletClassName);
+ }
+ catch (ClassNotFoundException ex)
+ {
+ log.warn("Cannot load servlet class: " + orgServletClassName);
+ }
+
+ String targetBeanName = null;
+
+ // Nothing to do if we have an <init-param>
+ if (isAlreadyModified(servlet))
+ {
+ for (Iterator itParam = servlet.elementIterator("init-param"); itParam.hasNext();)
+ {
+ Element elParam = (Element)itParam.next();
+ String paramName = elParam.element("param-name").getTextTrim();
+ String paramValue = elParam.element("param-value").getTextTrim();
+ if (Endpoint.SEPID_DOMAIN_ENDPOINT.equals(paramName))
+ {
+ targetBeanName = paramValue;
+ }
+ }
+ }
+ else
+ {
+ // Check if it is a real servlet that we can ignore
+ if (orgServletClass != null && javax.servlet.Servlet.class.isAssignableFrom(orgServletClass))
+ {
+ log.info("Ignore servlet: " + orgServletClassName);
+ continue;
+ }
+ else if (orgServletClassName.endsWith("Servlet"))
+ {
+ log.info("Ignore <servlet-class> that ends with 'Servlet': " + orgServletClassName);
+ continue;
+ }
+
+ classElement.setText(servletClass);
+
+ // add additional init params
+ if (orgServletClassName.equals(servletClass) == false)
+ {
+ targetBeanName = orgServletClassName;
+ Element paramElement = servlet.addElement("init-param");
+ paramElement.addElement("param-name").addText(Endpoint.SEPID_DOMAIN_ENDPOINT);
+ paramElement.addElement("param-value").addText(targetBeanName);
+ }
+ }
+
+ if (targetBeanName == null)
+ throw new IllegalStateException("Cannot obtain service endpoint bean for: " + linkName);
+
+ // remember the target bean name
+ results.sepTargetMap.put(linkName, targetBeanName);
+ }
+
+ return results;
+ }
+
+ // Return true if the web.xml is already modified
+ private boolean isAlreadyModified(Element servlet)
+ {
+ for (Iterator it = servlet.elementIterator("init-param"); it.hasNext();)
+ {
+ Element elParam = (Element)it.next();
+ String paramName = elParam.element("param-name").getTextTrim();
+ if (Endpoint.SEPID_DOMAIN_ENDPOINT.equals(paramName))
+ return true;
+ }
+ return false;
+ }
+}
Property changes on: container/jboss50/branches/jbossws-jboss500/src/main/java/org/jboss/wsf/container/jboss50/deployment/tomcat/DefaultWebAppDesciptorModifierImpl.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: container/jboss50/branches/jbossws-jboss500/src/main/java/org/jboss/wsf/container/jboss50/deployment/tomcat/WebXMLRewriterImpl.java
===================================================================
--- container/jboss50/branches/jbossws-jboss500/src/main/java/org/jboss/wsf/container/jboss50/deployment/tomcat/WebXMLRewriterImpl.java 2008-05-16 22:33:17 UTC (rev 7076)
+++ container/jboss50/branches/jbossws-jboss500/src/main/java/org/jboss/wsf/container/jboss50/deployment/tomcat/WebXMLRewriterImpl.java 2008-05-16 22:51:22 UTC (rev 7077)
@@ -24,7 +24,6 @@
import org.jboss.wsf.spi.deployment.Deployment;
import org.jboss.wsf.spi.transport.HttpSpec;
import org.jboss.wsf.common.IOUtils;
-import org.jboss.wsf.container.jboss50.DefaultWebAppDesciptorModifierImpl;
import org.dom4j.io.SAXReader;
import org.dom4j.io.OutputFormat;
import org.dom4j.io.XMLWriter;
16 years, 8 months
JBossWS SVN: r7076 - in container/jboss50/branches/jbossws-jboss500/src/main/java/org/jboss/wsf/container/jboss50: transport and 1 other directory.
by jbossws-commits@lists.jboss.org
Author: richard.opalka(a)jboss.com
Date: 2008-05-16 18:33:17 -0400 (Fri, 16 May 2008)
New Revision: 7076
Added:
container/jboss50/branches/jbossws-jboss500/src/main/java/org/jboss/wsf/container/jboss50/transport/WebAppDeploymentFactory.java
Removed:
container/jboss50/branches/jbossws-jboss500/src/main/java/org/jboss/wsf/container/jboss50/WebAppDeploymentAspect.java
Log:
refactoring
Deleted: container/jboss50/branches/jbossws-jboss500/src/main/java/org/jboss/wsf/container/jboss50/WebAppDeploymentAspect.java
===================================================================
--- container/jboss50/branches/jbossws-jboss500/src/main/java/org/jboss/wsf/container/jboss50/WebAppDeploymentAspect.java 2008-05-16 21:56:10 UTC (rev 7075)
+++ container/jboss50/branches/jbossws-jboss500/src/main/java/org/jboss/wsf/container/jboss50/WebAppDeploymentAspect.java 2008-05-16 22:33:17 UTC (rev 7076)
@@ -1,124 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.wsf.container.jboss50;
-
-// $Id$
-
-import java.net.URL;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.jboss.deployers.client.spi.DeployerClient;
-import org.jboss.deployers.spi.attachments.MutableAttachments;
-import org.jboss.deployers.vfs.spi.client.VFSDeploymentFactory;
-import org.jboss.logging.Logger;
-import org.jboss.virtual.VFS;
-import org.jboss.virtual.VirtualFile;
-import org.jboss.wsf.container.jboss50.deployment.tomcat.WebXMLRewriterImpl;
-import org.jboss.wsf.spi.deployment.Deployment;
-import org.jboss.wsf.spi.deployment.DeploymentAspect;
-import org.jboss.wsf.spi.deployment.WSFDeploymentException;
-import org.jboss.wsf.spi.transport.HttpSpec;
-import org.jboss.wsf.spi.WSFRuntime;
-
-/**
- * Publish the HTTP service endpoint to Tomcat
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 12-May-2006
- */
-public class WebAppDeploymentAspect extends DeploymentAspect
-{
- // provide logging
- private static Logger log = Logger.getLogger(WebAppDeploymentAspect.class);
-
- private DeployerClient mainDeployer;
- private WebXMLRewriterImpl webXMLRewriter;
- private Map<String, org.jboss.deployers.client.spi.Deployment> deploymentMap = new HashMap<String, org.jboss.deployers.client.spi.Deployment>();
-
- public void setMainDeployer(DeployerClient mainDeployer)
- {
- this.mainDeployer = mainDeployer;
- }
-
- public void setWebXMLRewriter(WebXMLRewriterImpl serviceEndpointPublisher)
- {
- this.webXMLRewriter = serviceEndpointPublisher;
- }
-
- public void create(Deployment dep, WSFRuntime runtime)
- {
- URL warURL = (URL)dep.getProperty(HttpSpec.PROPERTY_WEBAPP_URL);
- if (warURL == null)
- throw new IllegalStateException("Cannot obtain generated webapp URL");
-
- log.debug("publishServiceEndpoint: " + warURL);
- try
- {
- webXMLRewriter.rewriteWebXml(dep);
- org.jboss.deployers.client.spi.Deployment deployment = createDeploymentContext(warURL);
-
- // Mark the deployment as generated web app so the JSE deployer hook can ignore it
- MutableAttachments attach = (MutableAttachments)deployment.getPredeterminedManagedObjects();
- attach.addAttachment(HttpSpec.PROPERTY_GENERATED_WEBAPP, Boolean.TRUE);
-
- mainDeployer.deploy(deployment);
-
- deploymentMap.put(warURL.toExternalForm(), deployment);
- }
- catch (Exception ex)
- {
- WSFDeploymentException.rethrow(ex);
- }
- }
-
- public void destroy(Deployment dep, WSFRuntime runtime)
- {
- URL warURL = (URL)dep.getProperty(HttpSpec.PROPERTY_WEBAPP_URL);
- if (warURL == null)
- {
- log.error("Cannot obtain generated webapp URL");
- return;
- }
-
- log.debug("destroyServiceEndpoint: " + warURL);
- try
- {
- org.jboss.deployers.client.spi.Deployment deployment = deploymentMap.get(warURL.toExternalForm());
- if (deployment != null)
- {
- mainDeployer.undeploy(deployment);
- deploymentMap.remove(warURL.toExternalForm());
- }
- }
- catch (Exception ex)
- {
- WSFDeploymentException.rethrow(ex);
- }
- }
-
- private org.jboss.deployers.client.spi.Deployment createDeploymentContext(URL warURL) throws Exception
- {
- VirtualFile file = VFS.getRoot(warURL);
- return VFSDeploymentFactory.getInstance().createVFSDeployment(file);
- }
-}
Added: container/jboss50/branches/jbossws-jboss500/src/main/java/org/jboss/wsf/container/jboss50/transport/WebAppDeploymentFactory.java
===================================================================
--- container/jboss50/branches/jbossws-jboss500/src/main/java/org/jboss/wsf/container/jboss50/transport/WebAppDeploymentFactory.java (rev 0)
+++ container/jboss50/branches/jbossws-jboss500/src/main/java/org/jboss/wsf/container/jboss50/transport/WebAppDeploymentFactory.java 2008-05-16 22:33:17 UTC (rev 7076)
@@ -0,0 +1,124 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.wsf.container.jboss50.transport;
+
+// $Id$
+
+import java.net.URL;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.jboss.deployers.client.spi.DeployerClient;
+import org.jboss.deployers.spi.attachments.MutableAttachments;
+import org.jboss.deployers.vfs.spi.client.VFSDeploymentFactory;
+import org.jboss.logging.Logger;
+import org.jboss.virtual.VFS;
+import org.jboss.virtual.VirtualFile;
+import org.jboss.wsf.container.jboss50.deployment.tomcat.WebXMLRewriterImpl;
+import org.jboss.wsf.spi.deployment.Deployment;
+import org.jboss.wsf.spi.deployment.DeploymentAspect;
+import org.jboss.wsf.spi.deployment.WSFDeploymentException;
+import org.jboss.wsf.spi.transport.HttpSpec;
+import org.jboss.wsf.spi.WSFRuntime;
+
+/**
+ * Publish the HTTP service endpoint to Tomcat
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 12-May-2006
+ */
+public class WebAppDeploymentFactory
+{
+ // provide logging
+ private static Logger log = Logger.getLogger(WebAppDeploymentFactory.class);
+
+ private DeployerClient mainDeployer;
+ private WebXMLRewriterImpl webXMLRewriter;
+ private Map<String, org.jboss.deployers.client.spi.Deployment> deploymentMap = new HashMap<String, org.jboss.deployers.client.spi.Deployment>();
+
+ public void setMainDeployer(DeployerClient mainDeployer)
+ {
+ this.mainDeployer = mainDeployer;
+ }
+
+ public void setWebXMLRewriter(WebXMLRewriterImpl serviceEndpointPublisher)
+ {
+ this.webXMLRewriter = serviceEndpointPublisher;
+ }
+
+ public void create(Deployment dep, URL webAppURL)
+ {
+ if (webAppURL == null)
+ throw new IllegalArgumentException("Web meta data URL cannot be null");
+
+ log.debug("publishServiceEndpoint: " + webAppURL);
+ try
+ {
+ webXMLRewriter.rewriteWebXml(dep);
+ dep.setProperty(HttpSpec.PROPERTY_WEBAPP_URL, webAppURL);
+ org.jboss.deployers.client.spi.Deployment deployment = createDeploymentContext(webAppURL);
+
+ // Mark the deployment as generated web app so the JSE deployer hook can ignore it
+ MutableAttachments attach = (MutableAttachments)deployment.getPredeterminedManagedObjects();
+ attach.addAttachment(HttpSpec.PROPERTY_GENERATED_WEBAPP, Boolean.TRUE);
+
+ mainDeployer.deploy(deployment);
+
+ deploymentMap.put(webAppURL.toExternalForm(), deployment);
+ }
+ catch (Exception ex)
+ {
+ WSFDeploymentException.rethrow(ex);
+ }
+ }
+
+ public void destroy(Deployment dep)
+ {
+ URL warURL = (URL)dep.getProperty(HttpSpec.PROPERTY_WEBAPP_URL);
+ if (warURL == null)
+ {
+ log.error("Cannot obtain generated webapp URL");
+ return;
+ }
+
+ log.debug("destroyServiceEndpoint: " + warURL);
+ try
+ {
+ org.jboss.deployers.client.spi.Deployment deployment = deploymentMap.get(warURL.toExternalForm());
+ if (deployment != null)
+ {
+ mainDeployer.undeploy(deployment);
+ deploymentMap.remove(warURL.toExternalForm());
+ }
+ }
+ catch (Exception ex)
+ {
+ WSFDeploymentException.rethrow(ex);
+ }
+ }
+
+ private org.jboss.deployers.client.spi.Deployment createDeploymentContext(URL warURL) throws Exception
+ {
+ VirtualFile file = VFS.getRoot(warURL);
+ return VFSDeploymentFactory.getInstance().createVFSDeployment(file);
+ }
+}
Property changes on: container/jboss50/branches/jbossws-jboss500/src/main/java/org/jboss/wsf/container/jboss50/transport/WebAppDeploymentFactory.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
16 years, 8 months
JBossWS SVN: r7075 - in container/jboss50/branches/jbossws-jboss500/src/main/java/org/jboss/wsf/container/jboss50: deployment/tomcat and 1 other directory.
by jbossws-commits@lists.jboss.org
Author: richard.opalka(a)jboss.com
Date: 2008-05-16 17:56:10 -0400 (Fri, 16 May 2008)
New Revision: 7075
Added:
container/jboss50/branches/jbossws-jboss500/src/main/java/org/jboss/wsf/container/jboss50/deployment/tomcat/WebAppDesciptorModifier.java
container/jboss50/branches/jbossws-jboss500/src/main/java/org/jboss/wsf/container/jboss50/deployment/tomcat/WebXMLRewriterImpl.java
Removed:
container/jboss50/branches/jbossws-jboss500/src/main/java/org/jboss/wsf/container/jboss50/WebAppDesciptorModifier.java
container/jboss50/branches/jbossws-jboss500/src/main/java/org/jboss/wsf/container/jboss50/WebXMLRewriterImpl.java
Modified:
container/jboss50/branches/jbossws-jboss500/src/main/java/org/jboss/wsf/container/jboss50/DefaultWebAppDesciptorModifierImpl.java
container/jboss50/branches/jbossws-jboss500/src/main/java/org/jboss/wsf/container/jboss50/WebAppDeploymentAspect.java
Log:
refactoring
Modified: container/jboss50/branches/jbossws-jboss500/src/main/java/org/jboss/wsf/container/jboss50/DefaultWebAppDesciptorModifierImpl.java
===================================================================
--- container/jboss50/branches/jbossws-jboss500/src/main/java/org/jboss/wsf/container/jboss50/DefaultWebAppDesciptorModifierImpl.java 2008-05-16 21:54:27 UTC (rev 7074)
+++ container/jboss50/branches/jbossws-jboss500/src/main/java/org/jboss/wsf/container/jboss50/DefaultWebAppDesciptorModifierImpl.java 2008-05-16 21:56:10 UTC (rev 7075)
@@ -28,6 +28,7 @@
import org.dom4j.Element;
import org.jboss.logging.Logger;
import org.jboss.wsf.container.jboss50.deployment.tomcat.RewriteResults;
+import org.jboss.wsf.container.jboss50.deployment.tomcat.WebAppDesciptorModifier;
import org.jboss.wsf.spi.deployment.Deployment;
import org.jboss.wsf.spi.deployment.Endpoint;
import org.jboss.wsf.spi.transport.HttpSpec;
Modified: container/jboss50/branches/jbossws-jboss500/src/main/java/org/jboss/wsf/container/jboss50/WebAppDeploymentAspect.java
===================================================================
--- container/jboss50/branches/jbossws-jboss500/src/main/java/org/jboss/wsf/container/jboss50/WebAppDeploymentAspect.java 2008-05-16 21:54:27 UTC (rev 7074)
+++ container/jboss50/branches/jbossws-jboss500/src/main/java/org/jboss/wsf/container/jboss50/WebAppDeploymentAspect.java 2008-05-16 21:56:10 UTC (rev 7075)
@@ -33,6 +33,7 @@
import org.jboss.logging.Logger;
import org.jboss.virtual.VFS;
import org.jboss.virtual.VirtualFile;
+import org.jboss.wsf.container.jboss50.deployment.tomcat.WebXMLRewriterImpl;
import org.jboss.wsf.spi.deployment.Deployment;
import org.jboss.wsf.spi.deployment.DeploymentAspect;
import org.jboss.wsf.spi.deployment.WSFDeploymentException;
Deleted: container/jboss50/branches/jbossws-jboss500/src/main/java/org/jboss/wsf/container/jboss50/WebAppDesciptorModifier.java
===================================================================
--- container/jboss50/branches/jbossws-jboss500/src/main/java/org/jboss/wsf/container/jboss50/WebAppDesciptorModifier.java 2008-05-16 21:54:27 UTC (rev 7074)
+++ container/jboss50/branches/jbossws-jboss500/src/main/java/org/jboss/wsf/container/jboss50/WebAppDesciptorModifier.java 2008-05-16 21:56:10 UTC (rev 7075)
@@ -1,37 +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;
-
-import org.jboss.wsf.container.jboss50.deployment.tomcat.RewriteResults;
-import org.jboss.wsf.spi.deployment.Deployment;
-import org.dom4j.Document;
-
-/**
- * Modifies the web app according to the stack requirements.
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 19-May-2007
- */
-public interface WebAppDesciptorModifier
-{
- RewriteResults modifyDescriptor(Deployment dep, Document webXml) throws ClassNotFoundException;
-}
Deleted: container/jboss50/branches/jbossws-jboss500/src/main/java/org/jboss/wsf/container/jboss50/WebXMLRewriterImpl.java
===================================================================
--- container/jboss50/branches/jbossws-jboss500/src/main/java/org/jboss/wsf/container/jboss50/WebXMLRewriterImpl.java 2008-05-16 21:54:27 UTC (rev 7074)
+++ container/jboss50/branches/jbossws-jboss500/src/main/java/org/jboss/wsf/container/jboss50/WebXMLRewriterImpl.java 2008-05-16 21:56:10 UTC (rev 7075)
@@ -1,134 +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;
-
-import org.jboss.wsf.spi.deployment.Deployment;
-import org.jboss.wsf.spi.transport.HttpSpec;
-import org.jboss.wsf.common.IOUtils;
-import org.jboss.wsf.container.jboss50.deployment.tomcat.RewriteResults;
-import org.dom4j.io.SAXReader;
-import org.dom4j.io.OutputFormat;
-import org.dom4j.io.XMLWriter;
-import org.dom4j.Document;
-
-import javax.xml.ws.WebServiceException;
-import java.net.URL;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-
-/**
- * The rewriter for web.xml
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 19-May-2007
- */
-public class WebXMLRewriterImpl
-{
- private WebAppDesciptorModifier desciptorModifier;
-
- public WebXMLRewriterImpl()
- {
- this.desciptorModifier = new DefaultWebAppDesciptorModifierImpl();
- }
-
- public WebAppDesciptorModifier getDesciptorModifier()
- {
- return desciptorModifier;
- }
-
- public void setDesciptorModifier(WebAppDesciptorModifier desciptorModifier)
- {
- this.desciptorModifier = desciptorModifier;
- }
-
- public RewriteResults rewriteWebXml(Deployment dep)
- {
- URL warURL = (URL)dep.getProperty(HttpSpec.PROPERTY_WEBAPP_URL);
- File warFile = new File(warURL.getFile());
- if (warFile.isDirectory() == false)
- throw new WebServiceException("Expected a war directory: " + warURL);
-
- File webXML = new File(warURL.getFile() + "/WEB-INF/web.xml");
- if (webXML.isFile() == false)
- throw new WebServiceException("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 WebServiceException("Cannot rename web.xml: " + orgWebXML);
-
- return rewriteWebXml(orgWebXML, webXML, dep);
- }
- catch (RuntimeException rte)
- {
- throw rte;
- }
- catch (Exception e)
- {
- throw new WebServiceException(e);
- }
- }
-
- private RewriteResults rewriteWebXml(File input, File destFile, Deployment dep) throws Exception
- {
- if (destFile == null)
- {
- destFile = File.createTempFile("jbossws-alt-web", "xml", IOUtils.createTempDirectory());
- destFile.deleteOnExit();
- }
-
- FileInputStream inputStream = null;
- FileOutputStream outputStream = null;
-
- try
- {
- inputStream = new FileInputStream(input);
- SAXReader reader = new SAXReader();
- Document document = reader.read(inputStream);
-
- RewriteResults results = desciptorModifier.modifyDescriptor(dep, document);
- results.webXML = destFile.toURL();
-
- outputStream = new FileOutputStream(destFile);
- OutputFormat format = OutputFormat.createPrettyPrint();
- XMLWriter writer = new XMLWriter(outputStream, format);
- writer.write(document);
- writer.close();
-
- return results;
- }
- finally
- {
- if(inputStream!=null)
- inputStream.close();
-
- if(outputStream!=null)
- outputStream.close();
- }
- }
-}
Added: container/jboss50/branches/jbossws-jboss500/src/main/java/org/jboss/wsf/container/jboss50/deployment/tomcat/WebAppDesciptorModifier.java
===================================================================
--- container/jboss50/branches/jbossws-jboss500/src/main/java/org/jboss/wsf/container/jboss50/deployment/tomcat/WebAppDesciptorModifier.java (rev 0)
+++ container/jboss50/branches/jbossws-jboss500/src/main/java/org/jboss/wsf/container/jboss50/deployment/tomcat/WebAppDesciptorModifier.java 2008-05-16 21:56:10 UTC (rev 7075)
@@ -0,0 +1,36 @@
+/*
+ * 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.deployment.tomcat;
+
+import org.jboss.wsf.spi.deployment.Deployment;
+import org.dom4j.Document;
+
+/**
+ * Modifies the web app according to the stack requirements.
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 19-May-2007
+ */
+public interface WebAppDesciptorModifier
+{
+ RewriteResults modifyDescriptor(Deployment dep, Document webXml) throws ClassNotFoundException;
+}
Property changes on: container/jboss50/branches/jbossws-jboss500/src/main/java/org/jboss/wsf/container/jboss50/deployment/tomcat/WebAppDesciptorModifier.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: container/jboss50/branches/jbossws-jboss500/src/main/java/org/jboss/wsf/container/jboss50/deployment/tomcat/WebXMLRewriterImpl.java
===================================================================
--- container/jboss50/branches/jbossws-jboss500/src/main/java/org/jboss/wsf/container/jboss50/deployment/tomcat/WebXMLRewriterImpl.java (rev 0)
+++ container/jboss50/branches/jbossws-jboss500/src/main/java/org/jboss/wsf/container/jboss50/deployment/tomcat/WebXMLRewriterImpl.java 2008-05-16 21:56:10 UTC (rev 7075)
@@ -0,0 +1,134 @@
+/*
+ * 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.deployment.tomcat;
+
+import org.jboss.wsf.spi.deployment.Deployment;
+import org.jboss.wsf.spi.transport.HttpSpec;
+import org.jboss.wsf.common.IOUtils;
+import org.jboss.wsf.container.jboss50.DefaultWebAppDesciptorModifierImpl;
+import org.dom4j.io.SAXReader;
+import org.dom4j.io.OutputFormat;
+import org.dom4j.io.XMLWriter;
+import org.dom4j.Document;
+
+import javax.xml.ws.WebServiceException;
+import java.net.URL;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+
+/**
+ * The rewriter for web.xml
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 19-May-2007
+ */
+public class WebXMLRewriterImpl
+{
+ private WebAppDesciptorModifier desciptorModifier;
+
+ public WebXMLRewriterImpl()
+ {
+ this.desciptorModifier = new DefaultWebAppDesciptorModifierImpl();
+ }
+
+ public WebAppDesciptorModifier getDesciptorModifier()
+ {
+ return desciptorModifier;
+ }
+
+ public void setDesciptorModifier(WebAppDesciptorModifier desciptorModifier)
+ {
+ this.desciptorModifier = desciptorModifier;
+ }
+
+ public RewriteResults rewriteWebXml(Deployment dep)
+ {
+ URL warURL = (URL)dep.getProperty(HttpSpec.PROPERTY_WEBAPP_URL);
+ File warFile = new File(warURL.getFile());
+ if (warFile.isDirectory() == false)
+ throw new WebServiceException("Expected a war directory: " + warURL);
+
+ File webXML = new File(warURL.getFile() + "/WEB-INF/web.xml");
+ if (webXML.isFile() == false)
+ throw new WebServiceException("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 WebServiceException("Cannot rename web.xml: " + orgWebXML);
+
+ return rewriteWebXml(orgWebXML, webXML, dep);
+ }
+ catch (RuntimeException rte)
+ {
+ throw rte;
+ }
+ catch (Exception e)
+ {
+ throw new WebServiceException(e);
+ }
+ }
+
+ private RewriteResults rewriteWebXml(File input, File destFile, Deployment dep) throws Exception
+ {
+ if (destFile == null)
+ {
+ destFile = File.createTempFile("jbossws-alt-web", "xml", IOUtils.createTempDirectory());
+ destFile.deleteOnExit();
+ }
+
+ FileInputStream inputStream = null;
+ FileOutputStream outputStream = null;
+
+ try
+ {
+ inputStream = new FileInputStream(input);
+ SAXReader reader = new SAXReader();
+ Document document = reader.read(inputStream);
+
+ RewriteResults results = desciptorModifier.modifyDescriptor(dep, document);
+ results.webXML = destFile.toURL();
+
+ outputStream = new FileOutputStream(destFile);
+ OutputFormat format = OutputFormat.createPrettyPrint();
+ XMLWriter writer = new XMLWriter(outputStream, format);
+ writer.write(document);
+ writer.close();
+
+ return results;
+ }
+ finally
+ {
+ if(inputStream!=null)
+ inputStream.close();
+
+ if(outputStream!=null)
+ outputStream.close();
+ }
+ }
+}
Property changes on: container/jboss50/branches/jbossws-jboss500/src/main/java/org/jboss/wsf/container/jboss50/deployment/tomcat/WebXMLRewriterImpl.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
16 years, 8 months
JBossWS SVN: r7074 - container/jboss50/branches/jbossws-jboss500/src/main/java/org/jboss/wsf/container/jboss50/deployment/tomcat.
by jbossws-commits@lists.jboss.org
Author: richard.opalka(a)jboss.com
Date: 2008-05-16 17:54:27 -0400 (Fri, 16 May 2008)
New Revision: 7074
Removed:
container/jboss50/branches/jbossws-jboss500/src/main/java/org/jboss/wsf/container/jboss50/deployment/tomcat/WebMetaDataModifier.java
Log:
remove useless interface
Deleted: container/jboss50/branches/jbossws-jboss500/src/main/java/org/jboss/wsf/container/jboss50/deployment/tomcat/WebMetaDataModifier.java
===================================================================
--- container/jboss50/branches/jbossws-jboss500/src/main/java/org/jboss/wsf/container/jboss50/deployment/tomcat/WebMetaDataModifier.java 2008-05-16 21:47:47 UTC (rev 7073)
+++ container/jboss50/branches/jbossws-jboss500/src/main/java/org/jboss/wsf/container/jboss50/deployment/tomcat/WebMetaDataModifier.java 2008-05-16 21:54:27 UTC (rev 7074)
@@ -1,35 +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.deployment.tomcat;
-
-import org.jboss.wsf.spi.deployment.Deployment;
-
-/**
- * Modifies the web app according to the stack requirements.
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 19-May-2007
- */
-public interface WebMetaDataModifier
-{
- RewriteResults modifyMetaData(Deployment dep) throws ClassNotFoundException;
-}
16 years, 8 months
JBossWS SVN: r7073 - in container/jboss50/branches/jbossws-jboss500/src/main/java/org/jboss/wsf/container/jboss50: deployment/tomcat and 1 other directory.
by jbossws-commits@lists.jboss.org
Author: richard.opalka(a)jboss.com
Date: 2008-05-16 17:47:47 -0400 (Fri, 16 May 2008)
New Revision: 7073
Modified:
container/jboss50/branches/jbossws-jboss500/src/main/java/org/jboss/wsf/container/jboss50/DefaultWebAppDesciptorModifierImpl.java
container/jboss50/branches/jbossws-jboss500/src/main/java/org/jboss/wsf/container/jboss50/WebAppDeploymentAspect.java
container/jboss50/branches/jbossws-jboss500/src/main/java/org/jboss/wsf/container/jboss50/WebAppDesciptorModifier.java
container/jboss50/branches/jbossws-jboss500/src/main/java/org/jboss/wsf/container/jboss50/WebXMLRewriterImpl.java
container/jboss50/branches/jbossws-jboss500/src/main/java/org/jboss/wsf/container/jboss50/deployment/tomcat/ModifyWebMetaDataDeploymentAspect.java
Log:
refactoring
Modified: container/jboss50/branches/jbossws-jboss500/src/main/java/org/jboss/wsf/container/jboss50/DefaultWebAppDesciptorModifierImpl.java
===================================================================
--- container/jboss50/branches/jbossws-jboss500/src/main/java/org/jboss/wsf/container/jboss50/DefaultWebAppDesciptorModifierImpl.java 2008-05-16 21:11:59 UTC (rev 7072)
+++ container/jboss50/branches/jbossws-jboss500/src/main/java/org/jboss/wsf/container/jboss50/DefaultWebAppDesciptorModifierImpl.java 2008-05-16 21:47:47 UTC (rev 7073)
@@ -30,6 +30,7 @@
import org.jboss.wsf.container.jboss50.deployment.tomcat.RewriteResults;
import org.jboss.wsf.spi.deployment.Deployment;
import org.jboss.wsf.spi.deployment.Endpoint;
+import org.jboss.wsf.spi.transport.HttpSpec;
/**
* Modifies web.xml for jbossws
@@ -47,11 +48,11 @@
RewriteResults results = new RewriteResults();
Element root = webXml.getRootElement();
- String servletClass = (String)dep.getProperty(PROPERTY_WEBAPP_SERVLET_CLASS);
+ String servletClass = (String)dep.getProperty(HttpSpec.PROPERTY_WEBAPP_SERVLET_CLASS);
if (servletClass == null)
- throw new IllegalStateException("Cannot obtain context property: " + PROPERTY_WEBAPP_SERVLET_CLASS);
+ throw new IllegalStateException("Cannot obtain context property: " + HttpSpec.PROPERTY_WEBAPP_SERVLET_CLASS);
- Map<String, String> contextParams = (Map<String, String>)dep.getProperty(PROPERTY_WEBAPP_CONTEXT_PARAMETERS);
+ Map<String, String> contextParams = (Map<String, String>)dep.getProperty(HttpSpec.PROPERTY_WEBAPP_CONTEXT_PARAMETERS);
if (contextParams != null)
{
for (Map.Entry<String, String> entry : contextParams.entrySet())
@@ -69,7 +70,7 @@
}
}
- String listenerClass = (String)dep.getProperty(PROPERTY_WEBAPP_SERVLET_CONTEXT_LISTENER);
+ String listenerClass = (String)dep.getProperty(HttpSpec.PROPERTY_WEBAPP_SERVLET_CONTEXT_LISTENER);
if (listenerClass != null)
{
Element listener = root.addElement("listener");
Modified: container/jboss50/branches/jbossws-jboss500/src/main/java/org/jboss/wsf/container/jboss50/WebAppDeploymentAspect.java
===================================================================
--- container/jboss50/branches/jbossws-jboss500/src/main/java/org/jboss/wsf/container/jboss50/WebAppDeploymentAspect.java 2008-05-16 21:11:59 UTC (rev 7072)
+++ container/jboss50/branches/jbossws-jboss500/src/main/java/org/jboss/wsf/container/jboss50/WebAppDeploymentAspect.java 2008-05-16 21:47:47 UTC (rev 7073)
@@ -36,6 +36,7 @@
import org.jboss.wsf.spi.deployment.Deployment;
import org.jboss.wsf.spi.deployment.DeploymentAspect;
import org.jboss.wsf.spi.deployment.WSFDeploymentException;
+import org.jboss.wsf.spi.transport.HttpSpec;
import org.jboss.wsf.spi.WSFRuntime;
/**
@@ -65,7 +66,7 @@
public void create(Deployment dep, WSFRuntime runtime)
{
- URL warURL = (URL)dep.getProperty(WebAppDesciptorModifier.PROPERTY_WEBAPP_URL);
+ URL warURL = (URL)dep.getProperty(HttpSpec.PROPERTY_WEBAPP_URL);
if (warURL == null)
throw new IllegalStateException("Cannot obtain generated webapp URL");
@@ -77,7 +78,7 @@
// Mark the deployment as generated web app so the JSE deployer hook can ignore it
MutableAttachments attach = (MutableAttachments)deployment.getPredeterminedManagedObjects();
- attach.addAttachment(WebAppDesciptorModifier.PROPERTY_GENERATED_WEBAPP, Boolean.TRUE);
+ attach.addAttachment(HttpSpec.PROPERTY_GENERATED_WEBAPP, Boolean.TRUE);
mainDeployer.deploy(deployment);
@@ -91,7 +92,7 @@
public void destroy(Deployment dep, WSFRuntime runtime)
{
- URL warURL = (URL)dep.getProperty(WebAppDesciptorModifier.PROPERTY_WEBAPP_URL);
+ URL warURL = (URL)dep.getProperty(HttpSpec.PROPERTY_WEBAPP_URL);
if (warURL == null)
{
log.error("Cannot obtain generated webapp URL");
Modified: container/jboss50/branches/jbossws-jboss500/src/main/java/org/jboss/wsf/container/jboss50/WebAppDesciptorModifier.java
===================================================================
--- container/jboss50/branches/jbossws-jboss500/src/main/java/org/jboss/wsf/container/jboss50/WebAppDesciptorModifier.java 2008-05-16 21:11:59 UTC (rev 7072)
+++ container/jboss50/branches/jbossws-jboss500/src/main/java/org/jboss/wsf/container/jboss50/WebAppDesciptorModifier.java 2008-05-16 21:47:47 UTC (rev 7073)
@@ -33,11 +33,5 @@
*/
public interface WebAppDesciptorModifier
{
- static final String PROPERTY_GENERATED_WEBAPP = "org.jboss.ws.generated.webapp";
- static final String PROPERTY_WEBAPP_CONTEXT_PARAMETERS = "org.jboss.ws.webapp.ContextParameterMap";
- static final String PROPERTY_WEBAPP_SERVLET_CLASS = "org.jboss.ws.webapp.ServletClass";
- static final String PROPERTY_WEBAPP_SERVLET_CONTEXT_LISTENER = "org.jboss.ws.webapp.ServletContextListener";
- static final String PROPERTY_WEBAPP_URL = "org.jboss.ws.webapp.url";
-
RewriteResults modifyDescriptor(Deployment dep, Document webXml) throws ClassNotFoundException;
}
Modified: container/jboss50/branches/jbossws-jboss500/src/main/java/org/jboss/wsf/container/jboss50/WebXMLRewriterImpl.java
===================================================================
--- container/jboss50/branches/jbossws-jboss500/src/main/java/org/jboss/wsf/container/jboss50/WebXMLRewriterImpl.java 2008-05-16 21:11:59 UTC (rev 7072)
+++ container/jboss50/branches/jbossws-jboss500/src/main/java/org/jboss/wsf/container/jboss50/WebXMLRewriterImpl.java 2008-05-16 21:47:47 UTC (rev 7073)
@@ -22,6 +22,7 @@
package org.jboss.wsf.container.jboss50;
import org.jboss.wsf.spi.deployment.Deployment;
+import org.jboss.wsf.spi.transport.HttpSpec;
import org.jboss.wsf.common.IOUtils;
import org.jboss.wsf.container.jboss50.deployment.tomcat.RewriteResults;
import org.dom4j.io.SAXReader;
@@ -33,7 +34,6 @@
import java.net.URL;
import java.io.File;
import java.io.FileInputStream;
-import java.io.InputStream;
import java.io.FileOutputStream;
/**
@@ -63,7 +63,7 @@
public RewriteResults rewriteWebXml(Deployment dep)
{
- URL warURL = (URL)dep.getProperty(WebAppDesciptorModifier.PROPERTY_WEBAPP_URL);
+ URL warURL = (URL)dep.getProperty(HttpSpec.PROPERTY_WEBAPP_URL);
File warFile = new File(warURL.getFile());
if (warFile.isDirectory() == false)
throw new WebServiceException("Expected a war directory: " + warURL);
Modified: container/jboss50/branches/jbossws-jboss500/src/main/java/org/jboss/wsf/container/jboss50/deployment/tomcat/ModifyWebMetaDataDeploymentAspect.java
===================================================================
--- container/jboss50/branches/jbossws-jboss500/src/main/java/org/jboss/wsf/container/jboss50/deployment/tomcat/ModifyWebMetaDataDeploymentAspect.java 2008-05-16 21:11:59 UTC (rev 7072)
+++ container/jboss50/branches/jbossws-jboss500/src/main/java/org/jboss/wsf/container/jboss50/deployment/tomcat/ModifyWebMetaDataDeploymentAspect.java 2008-05-16 21:47:47 UTC (rev 7073)
@@ -31,10 +31,10 @@
import org.jboss.metadata.web.jboss.JBossWebMetaData;
import org.jboss.metadata.web.spec.ListenerMetaData;
import org.jboss.metadata.web.spec.ServletMetaData;
-import org.jboss.wsf.container.jboss50.WebAppDesciptorModifier;
import org.jboss.wsf.spi.deployment.Deployment;
import org.jboss.wsf.spi.deployment.DeploymentAspect;
import org.jboss.wsf.spi.deployment.Endpoint;
+import org.jboss.wsf.spi.transport.HttpSpec;
import org.jboss.wsf.spi.WSFRuntime;
/**
@@ -48,17 +48,17 @@
@Override
public void create(Deployment dep, WSFRuntime runtime)
{
- String servletClass = (String)dep.getProperty(WebAppDesciptorModifier.PROPERTY_WEBAPP_SERVLET_CLASS);
+ String servletClass = (String)dep.getProperty(HttpSpec.PROPERTY_WEBAPP_SERVLET_CLASS);
if (servletClass == null)
- throw new IllegalStateException("Cannot obtain context property: " + WebAppDesciptorModifier.PROPERTY_WEBAPP_SERVLET_CLASS);
+ throw new IllegalStateException("Cannot obtain context property: " + HttpSpec.PROPERTY_WEBAPP_SERVLET_CLASS);
modifyServletClass(dep, servletClass);
- String listenerClass = (String)dep.getProperty(WebAppDesciptorModifier.PROPERTY_WEBAPP_SERVLET_CONTEXT_LISTENER);
+ String listenerClass = (String)dep.getProperty(HttpSpec.PROPERTY_WEBAPP_SERVLET_CONTEXT_LISTENER);
if (listenerClass != null)
modifyListener(dep, listenerClass);
- Map<String, String> contextParams = (Map<String, String>)dep.getProperty(WebAppDesciptorModifier.PROPERTY_WEBAPP_CONTEXT_PARAMETERS);
+ Map<String, String> contextParams = (Map<String, String>)dep.getProperty(HttpSpec.PROPERTY_WEBAPP_CONTEXT_PARAMETERS);
if (contextParams != null)
modifyContextParams(dep, contextParams);
}
16 years, 8 months
JBossWS SVN: r7072 - container/jboss50/branches/jbossws-jboss500/src/main/java/org/jboss/wsf/container/jboss50/transport.
by jbossws-commits@lists.jboss.org
Author: richard.opalka(a)jboss.com
Date: 2008-05-16 17:11:59 -0400 (Fri, 16 May 2008)
New Revision: 7072
Added:
container/jboss50/branches/jbossws-jboss500/src/main/java/org/jboss/wsf/container/jboss50/transport/NoopHttpTransportManager.java
Log:
adding another transport manager
Added: container/jboss50/branches/jbossws-jboss500/src/main/java/org/jboss/wsf/container/jboss50/transport/NoopHttpTransportManager.java
===================================================================
--- container/jboss50/branches/jbossws-jboss500/src/main/java/org/jboss/wsf/container/jboss50/transport/NoopHttpTransportManager.java (rev 0)
+++ container/jboss50/branches/jbossws-jboss500/src/main/java/org/jboss/wsf/container/jboss50/transport/NoopHttpTransportManager.java 2008-05-16 21:11:59 UTC (rev 7072)
@@ -0,0 +1,83 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.transport;
+
+import org.jboss.wsf.framework.transport.HttpListenerRef;
+import org.jboss.wsf.spi.SPIProvider;
+import org.jboss.wsf.spi.SPIProviderResolver;
+import org.jboss.wsf.spi.deployment.Endpoint;
+import org.jboss.wsf.spi.management.ServerConfig;
+import org.jboss.wsf.spi.management.ServerConfigFactory;
+import org.jboss.wsf.spi.transport.HttpSpec;
+import org.jboss.wsf.spi.transport.ListenerRef;
+import org.jboss.wsf.spi.transport.TransportManager;
+import org.jboss.wsf.spi.transport.TransportSpec;
+
+import java.net.URI;
+import java.net.URISyntaxException;
+
+/**
+ * TransportManager implementation that doesn't create physical
+ * endpoints (ports, etc) but simply constructs a service endpoint address for a given
+ * deployment;
+ *
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public class NoopHttpTransportManager implements TransportManager
+{
+ public ListenerRef createListener(Endpoint endpoint, TransportSpec transportSpec)
+ {
+ if(! (transportSpec instanceof HttpSpec))
+ throw new IllegalArgumentException("Unknown TransportSpec " + transportSpec);
+
+ HttpSpec httpSpec = (HttpSpec)transportSpec;
+
+ SPIProvider provider = SPIProviderResolver.getInstance().getProvider();
+ ServerConfigFactory spi = provider.getSPI(ServerConfigFactory.class);
+ ServerConfig serverConfig = spi.getServerConfig();
+
+ String host = serverConfig.getWebServiceHost();
+ int port = serverConfig.getWebServicePort();
+ String hostAndPort = host + (port > 0 ? ":" + port : "");
+
+ try
+ {
+ String ctx = httpSpec.getWebContext();
+ String pattern = httpSpec.getUrlPattern();
+ ListenerRef ref = new HttpListenerRef(
+ ctx, pattern,
+ new URI("http://"+hostAndPort+ctx+pattern)
+ );
+
+ return ref;
+
+ } catch (URISyntaxException e)
+ {
+ throw new RuntimeException("Failed to create ListenerRef", e);
+ }
+ }
+
+ public void destroyListener(ListenerRef ref)
+ {
+ // noop
+ }
+}
Property changes on: container/jboss50/branches/jbossws-jboss500/src/main/java/org/jboss/wsf/container/jboss50/transport/NoopHttpTransportManager.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
16 years, 8 months