Author: thomas.diesler(a)jboss.com
Date: 2007-01-06 09:58:51 -0500 (Sat, 06 Jan 2007)
New Revision: 1848
Modified:
trunk/build/ant-import/build-thirdparty.xml
trunk/integration-jboss42/.classpath
trunk/integration-jboss42/src/main/java/org/jboss/ws/integration/jboss42/DeploymentInfoAdaptor.java
trunk/integration-jboss42/src/main/java/org/jboss/ws/integration/jboss42/WebServiceClientDeployer.java
trunk/integration-jboss50/src/main/java/org/jboss/ws/integration/jboss50/DeploymentInfoAdaptor.java
trunk/jbossws-core/.classpath
trunk/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/ServiceReferenceable.java
trunk/jbossws-core/src/main/java/org/jboss/ws/core/server/UnifiedDeploymentInfo.java
trunk/jbossws-core/src/main/java/org/jboss/ws/core/server/WSDLFilePublisher.java
trunk/jbossws-core/src/main/java/org/jboss/ws/core/utils/IOUtils.java
trunk/jbossws-core/src/main/java/org/jboss/ws/metadata/builder/jaxrpc/JAXRPCClientMetaDataBuilder.java
trunk/jbossws-core/src/main/java/org/jboss/ws/metadata/jaxrpcmapping/JavaWsdlMappingFactory.java
trunk/jbossws-core/src/main/java/org/jboss/ws/metadata/wsse/WSSecurityOMFactory.java
trunk/jbossws-tests/src/main/java/org/jboss/test/ws/JBossWSTestHelper.java
Log:
Abstract jboss-vfs to integration layer
Modified: trunk/build/ant-import/build-thirdparty.xml
===================================================================
--- trunk/build/ant-import/build-thirdparty.xml 2007-01-06 12:59:38 UTC (rev 1847)
+++ trunk/build/ant-import/build-thirdparty.xml 2007-01-06 14:58:51 UTC (rev 1848)
@@ -100,7 +100,6 @@
<pathelement location="${thirdparty.dir}/jaxb-xjc.jar"/>
<pathelement location="${thirdparty.dir}/jboss-dependency.jar"/>
<pathelement
location="${thirdparty.dir}/jboss-microcontainer.jar"/>
- <pathelement location="${thirdparty.dir}/jboss-vfs.jar"/>
<pathelement location="${thirdparty.dir}/servlet-api.jar"/>
<pathelement location="${thirdparty.dir}/stax-api-1.0.jar"/>
<pathelement location="${thirdparty.dir}/wstx-lgpl-2.0.6.jar"/>
@@ -111,6 +110,7 @@
<path refid="core.classpath"/>
<pathelement
location="${thirdparty.dir}/ejb3.deployer/jboss-ejb3.jar"/>
<pathelement location="${thirdparty.dir}/jboss-deployers.jar"/>
+ <pathelement location="${thirdparty.dir}/jboss-vfs.jar"/>
<pathelement location="${jboss50.lib}/jboss-j2se.jar"/>
<pathelement location="${jboss50.server.lib}/jboss.jar"/>
<pathelement
location="${jboss50.server.deployers}/jboss-aop-jboss5.deployer/jboss-aop-jdk50.jar"/>
Modified: trunk/integration-jboss42/.classpath
===================================================================
--- trunk/integration-jboss42/.classpath 2007-01-06 12:59:38 UTC (rev 1847)
+++ trunk/integration-jboss42/.classpath 2007-01-06 14:58:51 UTC (rev 1848)
@@ -33,6 +33,5 @@
<classpathentry kind="lib"
path="/build/thirdparty/xalan.jar"/>
<classpathentry kind="lib"
path="/build/thirdparty/xercesImpl.jar"/>
<classpathentry kind="lib"
path="/build/thirdparty/ejb3.deployer/jboss-ejb3.jar"/>
- <classpathentry kind="lib"
path="/build/thirdparty/jboss-vfs.jar"/>
<classpathentry kind="output" path="output-eclipse"/>
</classpath>
Modified:
trunk/integration-jboss42/src/main/java/org/jboss/ws/integration/jboss42/DeploymentInfoAdaptor.java
===================================================================
---
trunk/integration-jboss42/src/main/java/org/jboss/ws/integration/jboss42/DeploymentInfoAdaptor.java 2007-01-06
12:59:38 UTC (rev 1847)
+++
trunk/integration-jboss42/src/main/java/org/jboss/ws/integration/jboss42/DeploymentInfoAdaptor.java 2007-01-06
14:58:51 UTC (rev 1848)
@@ -30,7 +30,6 @@
import org.jboss.deployment.DeploymentInfo;
import org.jboss.metadata.ApplicationMetaData;
import org.jboss.metadata.WebMetaData;
-import org.jboss.virtual.VFS;
import org.jboss.ws.core.server.UnifiedDeploymentInfo;
/**
@@ -52,7 +51,7 @@
udi.name = di.getCanonicalName();
udi.simpleName = di.shortName;
udi.url = getDeploymentURL(di);
- udi.vfRoot = VFS.getRoot(udi.url);
+ udi.vfRoot = null;
udi.classLoader = di.annotationsCl;
udi.deployedObject = di.deployedObject;
Modified:
trunk/integration-jboss42/src/main/java/org/jboss/ws/integration/jboss42/WebServiceClientDeployer.java
===================================================================
---
trunk/integration-jboss42/src/main/java/org/jboss/ws/integration/jboss42/WebServiceClientDeployer.java 2007-01-06
12:59:38 UTC (rev 1847)
+++
trunk/integration-jboss42/src/main/java/org/jboss/ws/integration/jboss42/WebServiceClientDeployer.java 2007-01-06
14:58:51 UTC (rev 1848)
@@ -35,7 +35,6 @@
import org.jboss.deployment.DeploymentInfo;
import org.jboss.naming.Util;
import org.jboss.system.ServiceMBeanSupport;
-import org.jboss.virtual.VirtualFile;
import org.jboss.webservice.metadata.serviceref.ServiceRefMetaData;
import org.jboss.ws.WSException;
import org.jboss.ws.core.jaxrpc.ServiceReferenceable;
Modified:
trunk/integration-jboss50/src/main/java/org/jboss/ws/integration/jboss50/DeploymentInfoAdaptor.java
===================================================================
---
trunk/integration-jboss50/src/main/java/org/jboss/ws/integration/jboss50/DeploymentInfoAdaptor.java 2007-01-06
12:59:38 UTC (rev 1847)
+++
trunk/integration-jboss50/src/main/java/org/jboss/ws/integration/jboss50/DeploymentInfoAdaptor.java 2007-01-06
14:58:51 UTC (rev 1848)
@@ -21,6 +21,7 @@
*/
package org.jboss.ws.integration.jboss50;
+import java.io.IOException;
import java.net.URL;
import java.net.URLClassLoader;
@@ -29,7 +30,9 @@
import org.jboss.ejb3.Ejb3Deployment;
import org.jboss.logging.Logger;
import org.jboss.metadata.WebMetaData;
+import org.jboss.virtual.VirtualFile;
import org.jboss.ws.core.server.UnifiedDeploymentInfo;
+import org.jboss.ws.core.server.UnifiedDeploymentInfo.UnifiedVirtualFile;
// $Id$
@@ -54,10 +57,11 @@
udi.parent = new UnifiedDeploymentInfo(null);
buildDeploymentInfo(udi.parent,
unit.getDeploymentContext().getParent().getDeploymentUnit());
}
+
+ udi.vfRoot = new VirtualFileAdaptor(unit.getDeploymentContext().getRoot());
udi.name = unit.getName();
udi.simpleName = unit.getSimpleName();
- udi.vfRoot = unit.getDeploymentContext().getRoot();
udi.url = udi.vfRoot.toURL();
buildMetaData(udi, unit);
@@ -77,7 +81,6 @@
private static void buildMetaData(UnifiedDeploymentInfo udi, DeploymentUnit unit)
throws Exception
{
- Object metaData = null;
if (unit.getAttachment(Ejb3Deployment.class) != null)
{
udi.metaData =
ApplicationMetaDataAdaptor.buildUnifiedApplicationMetaData(unit);
@@ -87,8 +90,36 @@
if (unit.getAllMetaData(WebMetaData.class).size() > 0)
{
udi.metaData = WebMetaDataAdaptor.buildUnifiedWebMetaData(unit);
- udi.webappURL = unit.getDeploymentContext().getRoot().toURL();
+ udi.webappURL = udi.vfRoot.toURL();
}
}
}
+
+ public static class VirtualFileAdaptor implements UnifiedVirtualFile
+ {
+ private VirtualFile root;
+
+ public VirtualFileAdaptor(VirtualFile root)
+ {
+ this.root = root;
+ }
+
+ public UnifiedVirtualFile findChild(String child) throws IOException
+ {
+ VirtualFile vf = root.findChild(child);
+ return new VirtualFileAdaptor(vf);
+ }
+
+ public URL toURL()
+ {
+ try
+ {
+ return root.toURL();
+ }
+ catch (Exception e)
+ {
+ return null;
+ }
+ }
+ }
}
Modified: trunk/jbossws-core/.classpath
===================================================================
--- trunk/jbossws-core/.classpath 2007-01-06 12:59:38 UTC (rev 1847)
+++ trunk/jbossws-core/.classpath 2007-01-06 14:58:51 UTC (rev 1848)
@@ -30,6 +30,5 @@
<classpathentry kind="lib"
path="/build/thirdparty/wstx-lgpl-2.0.6.jar"/>
<classpathentry kind="lib"
path="/build/thirdparty/xalan.jar"/>
<classpathentry kind="lib"
path="/build/thirdparty/xercesImpl.jar"/>
- <classpathentry kind="lib"
path="/build/thirdparty/jboss-vfs.jar"/>
<classpathentry kind="output" path="output-eclipse"/>
</classpath>
Modified:
trunk/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/ServiceReferenceable.java
===================================================================
---
trunk/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/ServiceReferenceable.java 2007-01-06
12:59:38 UTC (rev 1847)
+++
trunk/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/ServiceReferenceable.java 2007-01-06
14:58:51 UTC (rev 1848)
@@ -28,6 +28,7 @@
import java.io.IOException;
import java.io.InputStream;
import java.io.ObjectOutputStream;
+import java.net.URL;
import javax.naming.BinaryRefAddr;
import javax.naming.NamingException;
@@ -36,7 +37,6 @@
import javax.naming.StringRefAddr;
import org.jboss.logging.Logger;
-import org.jboss.virtual.VirtualFile;
import org.jboss.ws.core.server.ServiceEndpointManager;
import org.jboss.ws.core.server.ServiceEndpointManagerFactory;
import org.jboss.ws.core.server.UnifiedDeploymentInfo;
@@ -161,7 +161,7 @@
try
{
ObjectOutputStream oos = new ObjectOutputStream(baos);
- VirtualFile vfConfig = getSecurityConfig();
+ URL vfConfig = getSecurityConfig();
WSSecurityConfiguration securityConfig =
WSSecurityOMFactory.newInstance().parse(vfConfig);
oos.writeObject(securityConfig);
oos.close();
@@ -173,13 +173,13 @@
return baos.toByteArray();
}
- private VirtualFile getSecurityConfig()
+ private URL getSecurityConfig()
{
String descriptorPath = udi.metaData instanceof UnifiedWebMetaData ?
"WEB-INF" : "META-INF";
descriptorPath = descriptorPath + "/" +
WSSecurityOMFactory.CLIENT_RESOURCE_NAME;
try
{
- VirtualFile vfConfig = udi.getMetaDataFile(descriptorPath);
+ URL vfConfig = udi.getMetaDataFileURL(descriptorPath);
InputStream inputStream = vfConfig.openStream();
inputStream.close();
return vfConfig;
Modified:
trunk/jbossws-core/src/main/java/org/jboss/ws/core/server/UnifiedDeploymentInfo.java
===================================================================
---
trunk/jbossws-core/src/main/java/org/jboss/ws/core/server/UnifiedDeploymentInfo.java 2007-01-06
12:59:38 UTC (rev 1847)
+++
trunk/jbossws-core/src/main/java/org/jboss/ws/core/server/UnifiedDeploymentInfo.java 2007-01-06
14:58:51 UTC (rev 1848)
@@ -25,15 +25,12 @@
import java.io.IOException;
import java.net.MalformedURLException;
-import java.net.URISyntaxException;
import java.net.URL;
import java.util.HashMap;
import java.util.Map;
import javax.management.ObjectName;
-import org.jboss.virtual.VirtualFile;
-
/**
* The container independent deployment info.
*
@@ -61,7 +58,7 @@
/** The URL for this deployment */
public URL url;
/** The virtual file for the deployment root */
- public VirtualFile vfRoot;
+ public UnifiedVirtualFile vfRoot;
/** The string identifing this deployment **/
public String name;
/** The URL to the expanded webapp **/
@@ -102,26 +99,16 @@
// ignore
}
- if (resourceURL == null)
+ if (resourceURL == null && vfRoot != null)
{
- try
- {
- VirtualFile vfResource = vfRoot.findChild(resourcePath);
- resourceURL = vfResource.toURL();
- }
- catch (URISyntaxException e)
- {
- // ignore
- }
+ UnifiedVirtualFile vfResource = vfRoot.findChild(resourcePath);
+ resourceURL = vfResource.toURL();
}
if (resourceURL == null)
{
String deploymentPath = url.toExternalForm();
- if (deploymentPath.startsWith("vfsfile:") &&
deploymentPath.endsWith("!/") == false)
- deploymentPath += "!/";
-
if (deploymentPath.startsWith("jar:") &&
deploymentPath.endsWith("!/") == false)
deploymentPath += "!/";
@@ -135,17 +122,14 @@
return resourceURL;
}
- public VirtualFile getMetaDataFile(String resourcePath) throws IOException
+ /**
+ * An adaptor a VirtualFile from jboss-vfs.jar
+ * jboss-vfs cannot be used in jboss-4.x because of its dependeny on
jboss-common-core.jar
+ */
+ public interface UnifiedVirtualFile
{
- VirtualFile vfResource = null;
- if (resourcePath != null && resourcePath.length() > 0)
- {
- if (resourcePath.startsWith("/"))
- resourcePath = resourcePath.substring(1);
-
- vfResource = vfRoot.findChild(resourcePath);
- }
- return vfResource;
+ UnifiedVirtualFile findChild(String child) throws IOException;
+ URL toURL();
}
public String toString()
Modified:
trunk/jbossws-core/src/main/java/org/jboss/ws/core/server/WSDLFilePublisher.java
===================================================================
---
trunk/jbossws-core/src/main/java/org/jboss/ws/core/server/WSDLFilePublisher.java 2007-01-06
12:59:38 UTC (rev 1847)
+++
trunk/jbossws-core/src/main/java/org/jboss/ws/core/server/WSDLFilePublisher.java 2007-01-06
14:58:51 UTC (rev 1848)
@@ -40,7 +40,6 @@
import org.jboss.logging.Logger;
import org.jboss.util.NotImplementedException;
-import org.jboss.virtual.VirtualFile;
import org.jboss.ws.Constants;
import org.jboss.ws.WSException;
import org.jboss.ws.core.utils.DOMUtils;
@@ -216,8 +215,8 @@
resourcePath = resourcePath + "/";
resourcePath = expLocation + resourcePath + schemaLocation;
- VirtualFile vfResource = udi.getMetaDataFile(resourcePath);
- InputStream is = vfResource.openStream();
+ URL resourceURL = udi.getMetaDataFileURL(resourcePath);
+ InputStream is = new ResourceURL(resourceURL).openStream();
if (is == null)
throw new IllegalArgumentException("Cannot find schema import
in deployment: " + resourcePath);
Modified: trunk/jbossws-core/src/main/java/org/jboss/ws/core/utils/IOUtils.java
===================================================================
--- trunk/jbossws-core/src/main/java/org/jboss/ws/core/utils/IOUtils.java 2007-01-06
12:59:38 UTC (rev 1847)
+++ trunk/jbossws-core/src/main/java/org/jboss/ws/core/utils/IOUtils.java 2007-01-06
14:58:51 UTC (rev 1848)
@@ -40,7 +40,6 @@
import javax.activation.DataHandler;
import org.jboss.logging.Logger;
-import org.jboss.virtual.VirtualFile;
import org.jboss.ws.WSException;
import org.jboss.ws.core.server.ServerConfig;
import org.jboss.ws.core.server.ServerConfigFactory;
@@ -118,20 +117,4 @@
tmpdir.mkdirs();
return tmpdir;
}
-
- public static URL toURL(VirtualFile file)
- {
- try
- {
- return file.toURL();
- }
- catch (MalformedURLException e)
- {
- return null;
- }
- catch (URISyntaxException e)
- {
- return null;
- }
- }
}
Modified:
trunk/jbossws-core/src/main/java/org/jboss/ws/metadata/builder/jaxrpc/JAXRPCClientMetaDataBuilder.java
===================================================================
---
trunk/jbossws-core/src/main/java/org/jboss/ws/metadata/builder/jaxrpc/JAXRPCClientMetaDataBuilder.java 2007-01-06
12:59:38 UTC (rev 1847)
+++
trunk/jbossws-core/src/main/java/org/jboss/ws/metadata/builder/jaxrpc/JAXRPCClientMetaDataBuilder.java 2007-01-06
14:58:51 UTC (rev 1848)
@@ -30,7 +30,6 @@
import javax.xml.namespace.QName;
import org.jboss.logging.Logger;
-import org.jboss.virtual.VirtualFile;
import org.jboss.ws.Constants;
import org.jboss.ws.WSException;
import org.jboss.ws.metadata.config.JBossWSConfigFactory;
Modified:
trunk/jbossws-core/src/main/java/org/jboss/ws/metadata/jaxrpcmapping/JavaWsdlMappingFactory.java
===================================================================
---
trunk/jbossws-core/src/main/java/org/jboss/ws/metadata/jaxrpcmapping/JavaWsdlMappingFactory.java 2007-01-06
12:59:38 UTC (rev 1847)
+++
trunk/jbossws-core/src/main/java/org/jboss/ws/metadata/jaxrpcmapping/JavaWsdlMappingFactory.java 2007-01-06
14:58:51 UTC (rev 1848)
@@ -30,7 +30,6 @@
import javax.xml.namespace.QName;
import org.jboss.logging.Logger;
-import org.jboss.virtual.VirtualFile;
import org.jboss.ws.core.utils.IOUtils;
import org.jboss.ws.core.utils.ResourceURL;
import org.jboss.xb.binding.JBossXBException;
@@ -76,22 +75,6 @@
// setup the XML binding Unmarshaller
InputStream is = new ResourceURL(mappingURL).openStream();
- return parse(is, mappingURL);
- }
-
- public JavaWsdlMapping parse(VirtualFile vfMapping) throws IOException
- {
- if (vfMapping == null)
- throw new IllegalArgumentException("JAXRPC mapping file cannot be
null");
-
- // setup the XML binding Unmarshaller
- InputStream is = vfMapping.openStream();
- URL mappingURL = IOUtils.toURL(vfMapping);
- return parse(is, mappingURL);
- }
-
- private JavaWsdlMapping parse(InputStream is, URL mappingURL) throws IOException
- {
try
{
Unmarshaller unmarshaller =
UnmarshallerFactory.newInstance().newUnmarshaller();
Modified:
trunk/jbossws-core/src/main/java/org/jboss/ws/metadata/wsse/WSSecurityOMFactory.java
===================================================================
---
trunk/jbossws-core/src/main/java/org/jboss/ws/metadata/wsse/WSSecurityOMFactory.java 2007-01-06
12:59:38 UTC (rev 1847)
+++
trunk/jbossws-core/src/main/java/org/jboss/ws/metadata/wsse/WSSecurityOMFactory.java 2007-01-06
14:58:51 UTC (rev 1848)
@@ -27,8 +27,6 @@
import java.util.HashMap;
import org.jboss.logging.Logger;
-import org.jboss.virtual.VirtualFile;
-import org.jboss.ws.core.utils.IOUtils;
import org.jboss.ws.core.utils.ResourceURL;
import org.jboss.xb.binding.JBossXBException;
import org.jboss.xb.binding.ObjectModelFactory;
@@ -86,21 +84,6 @@
throw new IllegalArgumentException("Security config URL cannot be
null");
InputStream is = new ResourceURL(configURL).openStream();
- return parse(is, configURL);
- }
-
- public WSSecurityConfiguration parse(VirtualFile vfConfig) throws IOException
- {
- if (vfConfig == null)
- throw new IllegalArgumentException("Security config file cannot be
null");
-
- InputStream is = vfConfig.openStream();
- URL configURL = IOUtils.toURL(vfConfig);
- return parse(is, configURL);
- }
-
- private WSSecurityConfiguration parse(InputStream is, URL configURL) throws
IOException
- {
try
{
Unmarshaller unmarshaller =
UnmarshallerFactory.newInstance().newUnmarshaller();
Modified: trunk/jbossws-tests/src/main/java/org/jboss/test/ws/JBossWSTestHelper.java
===================================================================
--- trunk/jbossws-tests/src/main/java/org/jboss/test/ws/JBossWSTestHelper.java 2007-01-06
12:59:38 UTC (rev 1847)
+++ trunk/jbossws-tests/src/main/java/org/jboss/test/ws/JBossWSTestHelper.java 2007-01-06
14:58:51 UTC (rev 1848)
@@ -26,9 +26,13 @@
import java.net.URL;
import javax.management.MBeanServerConnection;
+import javax.management.ObjectName;
import javax.naming.InitialContext;
import javax.naming.NamingException;
+import org.jboss.logging.Logger;
+import org.jboss.ws.core.utils.ObjectNameFactory;
+
/**
* A JBossWS test helper that deals with test deployment/undeployment, etc.
*
@@ -37,7 +41,11 @@
*/
public class JBossWSTestHelper
{
+ // provide logging
+ private static Logger log = Logger.getLogger(JBossWSTestHelper.class);
+
private static MBeanServerConnection server;
+ private static String integrationTarget;
/** Deploy the given archive
*/
@@ -127,8 +135,42 @@
private static String getIntegrationTarget()
{
- String target = System.getProperty("jbossws.integration.target",
"jboss50");
- return target;
+ if (integrationTarget == null)
+ {
+ integrationTarget = System.getProperty("jbossws.integration.target");
+
+ // Read the JBoss SpecificationVersion
+ try
+ {
+ ObjectName oname =
ObjectNameFactory.create("jboss.system:type=ServerConfig");
+ String jbossVersion = (String)getServer().getAttribute(oname,
"SpecificationVersion");
+ if (jbossVersion.startsWith("5.0"))
+ jbossVersion = "jboss50";
+ else if (jbossVersion.startsWith("4.2"))
+ jbossVersion = "jboss42";
+ else if (jbossVersion.startsWith("4.0"))
+ jbossVersion = "jboss40";
+ else
+ throw new RuntimeException("Unsupported jboss version: " +
jbossVersion);
+
+ if (jbossVersion.equals(integrationTarget) == false)
+ {
+ log.warn("Integration target mismatch, using: " +
jbossVersion);
+ integrationTarget = jbossVersion;
+ }
+ }
+ catch (Exception ex)
+ {
+ // ignore, we are not running on jboss-4.2 or greater
+ }
+
+ if (integrationTarget == null)
+ {
+ log.warn("Cannot obtain jbossws.integration.target, using default:
tomcat");
+ integrationTarget = "tomcat";
+ }
+ }
+ return integrationTarget;
}
/** Try to discover the URL for the deployment archive */