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