Author: thomas.diesler(a)jboss.com
Date: 2007-01-17 11:17:23 -0500 (Wed, 17 Jan 2007)
New Revision: 1990
Added:
trunk/integration-jboss50/src/main/java/org/jboss/ws/integration/jboss50/VirtualFileAdaptor.java
trunk/jbossws-core/src/main/java/org/jboss/ws/core/server/UnifiedVirtualFile.java
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/ServiceObjectFactory.java
trunk/integration-jboss50/src/main/java/org/jboss/ws/integration/jboss50/WebServiceRefHandler.java
trunk/integration-jboss50/src/main/java/org/jboss/ws/integration/jboss50/WebServiceRefHandlerMBean.java
trunk/jbossws-core/src/main/java/org/jboss/ws/core/jaxws/client/UnifiedServiceRef.java
trunk/jbossws-core/src/main/java/org/jboss/ws/core/server/UnifiedDeploymentInfo.java
Log:
Use deployment root VirtualFile in @WebServiceRef handling
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-17
15:29:14 UTC (rev 1989)
+++
trunk/integration-jboss50/src/main/java/org/jboss/ws/integration/jboss50/DeploymentInfoAdaptor.java 2007-01-17
16:17:23 UTC (rev 1990)
@@ -21,7 +21,6 @@
*/
package org.jboss.ws.integration.jboss50;
-import java.io.IOException;
import java.net.URL;
import java.net.URLClassLoader;
@@ -30,9 +29,7 @@
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$
@@ -94,32 +91,4 @@
}
}
}
-
- 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/integration-jboss50/src/main/java/org/jboss/ws/integration/jboss50/ServiceObjectFactory.java
===================================================================
---
trunk/integration-jboss50/src/main/java/org/jboss/ws/integration/jboss50/ServiceObjectFactory.java 2007-01-17
15:29:14 UTC (rev 1989)
+++
trunk/integration-jboss50/src/main/java/org/jboss/ws/integration/jboss50/ServiceObjectFactory.java 2007-01-17
16:17:23 UTC (rev 1990)
@@ -45,12 +45,11 @@
import javax.xml.ws.Service;
import org.jboss.logging.Logger;
-import org.jboss.virtual.VFS;
-import org.jboss.virtual.VirtualFile;
import org.jboss.ws.WSException;
import org.jboss.ws.core.StubExt;
import org.jboss.ws.core.jaxws.ServiceConfiguration;
import org.jboss.ws.core.jaxws.client.UnifiedServiceRef;
+import org.jboss.ws.core.server.UnifiedVirtualFile;
/**
* This ServiceObjectFactory reconstructs a javax.xml.ws.Service
@@ -103,8 +102,7 @@
Object target;
- URL rootURL = usRef.getRootURL();
- URL wsdlURL = getWsdlLocationURL(rootURL, serviceClass,
usRef.getWsdlLocation());
+ URL wsdlURL = getWsdlLocationURL(targetClass != null ? targetClass :
serviceClass, usRef);
// Generic javax.xml.ws.Service
if (serviceClass == Service.class)
@@ -207,8 +205,11 @@
return sref;
}
- private URL getWsdlLocationURL(URL rootURL, Class type, String wsdlLocation)
+ private URL getWsdlLocationURL(Class userClass, UnifiedServiceRef usRef)
{
+ UnifiedVirtualFile vfsRoot = usRef.getRootFile();
+ String wsdlLocation = usRef.getWsdlLocation();
+
URL wsdlURL = null;
if (wsdlLocation != null)
{
@@ -242,7 +243,6 @@
{
try
{
- VirtualFile vfsRoot = getVirtualFile(rootURL);
wsdlURL = vfsRoot.findChild(wsdlLocation).toURL();
}
catch (Exception ex)
@@ -254,11 +254,10 @@
// Try the filename relative to class
if (wsdlURL == null)
{
- String packagePath = type.getPackage().getName().replace('.',
'/');
+ String packagePath = userClass.getPackage().getName().replace('.',
'/');
String wsdlPath = packagePath + "/" + wsdlLocation;
try
{
- VirtualFile vfsRoot = getVirtualFile(rootURL);
wsdlURL = vfsRoot.findChild(wsdlPath).toURL();
}
catch (Exception ex)
@@ -272,18 +271,4 @@
}
return wsdlURL;
}
-
- /**
- * For some reason VFS.getRoot(rootURL) fails with
- * IOException("No context factory for " + rootURL);
- */
- private VirtualFile getVirtualFile(URL rootURL) throws IOException
- {
- URL fileURL = rootURL;
- if (rootURL.getProtocol().equals("vfsfile"))
- fileURL = new URL(rootURL.toExternalForm().substring(3));
-
- VirtualFile vfsRoot = VFS.getRoot(fileURL);
- return vfsRoot;
- }
}
Added:
trunk/integration-jboss50/src/main/java/org/jboss/ws/integration/jboss50/VirtualFileAdaptor.java
===================================================================
---
trunk/integration-jboss50/src/main/java/org/jboss/ws/integration/jboss50/VirtualFileAdaptor.java
(rev 0)
+++
trunk/integration-jboss50/src/main/java/org/jboss/ws/integration/jboss50/VirtualFileAdaptor.java 2007-01-17
16:17:23 UTC (rev 1990)
@@ -0,0 +1,66 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.ws.integration.jboss50;
+
+import java.io.IOException;
+import java.net.URL;
+
+import org.jboss.virtual.VirtualFile;
+import org.jboss.ws.core.server.UnifiedVirtualFile;
+
+// $Id$
+
+/**
+ * A JBoss50 VirtualFile adaptor
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 05-May-2006
+ */
+public class VirtualFileAdaptor implements UnifiedVirtualFile
+{
+ private static final long serialVersionUID = 6547394037548338042L;
+
+ 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;
+ }
+ }
+}
Property changes on:
trunk/integration-jboss50/src/main/java/org/jboss/ws/integration/jboss50/VirtualFileAdaptor.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified:
trunk/integration-jboss50/src/main/java/org/jboss/ws/integration/jboss50/WebServiceRefHandler.java
===================================================================
---
trunk/integration-jboss50/src/main/java/org/jboss/ws/integration/jboss50/WebServiceRefHandler.java 2007-01-17
15:29:14 UTC (rev 1989)
+++
trunk/integration-jboss50/src/main/java/org/jboss/ws/integration/jboss50/WebServiceRefHandler.java 2007-01-17
16:17:23 UTC (rev 1990)
@@ -38,6 +38,7 @@
import org.jboss.logging.Logger;
import org.jboss.mx.util.MBeanServerLocator;
import org.jboss.util.naming.Util;
+import org.jboss.virtual.VirtualFile;
import org.jboss.ws.WSException;
import org.jboss.ws.core.jaxws.client.UnifiedServiceRef;
import org.jboss.ws.core.utils.DOMUtils;
@@ -55,7 +56,7 @@
// logging support
private static Logger log = Logger.getLogger(WebServiceRefHandler.class);
- public void setupWebServiceRef(Context encCtx, String encName, Class targetClass,
WebServiceRef wsref, URL rootURL, Source metadata) throws NamingException
+ public void setupWebServiceRef(Context encCtx, String encName, Class targetClass,
WebServiceRef wsref, VirtualFile vfsRoot, Source metadata) throws NamingException
{
String externalName = encCtx.getNameInNamespace() + "/" + encName;
String refTypeName = (targetClass != null ? targetClass.getName() : null);
@@ -86,7 +87,7 @@
try
{
- UnifiedServiceRef usRef = getUnifiedServiceRef(rootURL, metadata);
+ UnifiedServiceRef usRef = getUnifiedServiceRef(vfsRoot, metadata);
// Set the wsdlLocation if there is no override already
if (usRef.getWsdlLocation() == null && wsref.wsdlLocation().length()
> 0)
@@ -104,12 +105,12 @@
}
}
- private UnifiedServiceRef getUnifiedServiceRef(URL rootURL, Source metadata) throws
TransformerException
+ private UnifiedServiceRef getUnifiedServiceRef(VirtualFile vfsRoot, Source metadata)
throws TransformerException
{
Element root = getElementFromSource(metadata);
String encName = DOMUtils.getTextContent(DOMUtils.getFirstChildElement(root,
"service-ref-name"));
- UnifiedServiceRef ref = new UnifiedServiceRef(rootURL, encName);
+ UnifiedServiceRef ref = new UnifiedServiceRef(new VirtualFileAdaptor(vfsRoot),
encName);
Element refEl = DOMUtils.getFirstChildElement(root, "config-name");
if (refEl != null)
Modified:
trunk/integration-jboss50/src/main/java/org/jboss/ws/integration/jboss50/WebServiceRefHandlerMBean.java
===================================================================
---
trunk/integration-jboss50/src/main/java/org/jboss/ws/integration/jboss50/WebServiceRefHandlerMBean.java 2007-01-17
15:29:14 UTC (rev 1989)
+++
trunk/integration-jboss50/src/main/java/org/jboss/ws/integration/jboss50/WebServiceRefHandlerMBean.java 2007-01-17
16:17:23 UTC (rev 1990)
@@ -21,7 +21,6 @@
*/
package org.jboss.ws.integration.jboss50;
-import java.net.URL;
import javax.management.ObjectName;
import javax.naming.Context;
@@ -29,6 +28,7 @@
import javax.xml.transform.Source;
import javax.xml.ws.WebServiceRef;
+import org.jboss.virtual.VirtualFile;
import org.jboss.ws.core.utils.ObjectNameFactory;
/**
@@ -41,5 +41,5 @@
/** Binds a JAXWS WebServiceRef into the callers ENC
*/
- void setupWebServiceRef(Context encCtx, String encName, Class refType, WebServiceRef
wsref, URL rootURL, Source metadata) throws NamingException;
+ void setupWebServiceRef(Context encCtx, String encName, Class refType, WebServiceRef
wsref, VirtualFile vfsRoot, Source metadata) throws NamingException;
}
Modified:
trunk/jbossws-core/src/main/java/org/jboss/ws/core/jaxws/client/UnifiedServiceRef.java
===================================================================
---
trunk/jbossws-core/src/main/java/org/jboss/ws/core/jaxws/client/UnifiedServiceRef.java 2007-01-17
15:29:14 UTC (rev 1989)
+++
trunk/jbossws-core/src/main/java/org/jboss/ws/core/jaxws/client/UnifiedServiceRef.java 2007-01-17
16:17:23 UTC (rev 1990)
@@ -24,8 +24,9 @@
//$Id$
import java.io.Serializable;
-import java.net.URL;
+import org.jboss.ws.core.server.UnifiedVirtualFile;
+
/**
* Represents a <service-ref> element of the jboss.xml, jboss-web.xml,
jboss-client.xml deployment descriptor
* for the 5.0 schema
@@ -34,23 +35,23 @@
*/
public class UnifiedServiceRef implements Serializable
{
- private static final long serialVersionUID = 7575421890971083734L;
+ private static final long serialVersionUID = -5518998734737147195L;
- private URL rootURL;
+ private UnifiedVirtualFile vfsRoot;
private String encName;
private String wsdlLocation;
private String configName;
private String configFile;
- public UnifiedServiceRef(URL rootURL, String name)
+ public UnifiedServiceRef(UnifiedVirtualFile vfsRoot, String name)
{
- this.rootURL = rootURL;
+ this.vfsRoot = vfsRoot;
this.encName = name;
}
- public URL getRootURL()
+ public UnifiedVirtualFile getRootFile()
{
- return rootURL;
+ return vfsRoot;
}
public String getEncName()
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-17
15:29:14 UTC (rev 1989)
+++
trunk/jbossws-core/src/main/java/org/jboss/ws/core/server/UnifiedDeploymentInfo.java 2007-01-17
16:17:23 UTC (rev 1990)
@@ -122,16 +122,6 @@
return resourceURL;
}
- /**
- * 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
- {
- UnifiedVirtualFile findChild(String child) throws IOException;
- URL toURL();
- }
-
public String toString()
{
StringBuilder builder = new StringBuilder();
Added: trunk/jbossws-core/src/main/java/org/jboss/ws/core/server/UnifiedVirtualFile.java
===================================================================
--- trunk/jbossws-core/src/main/java/org/jboss/ws/core/server/UnifiedVirtualFile.java
(rev 0)
+++
trunk/jbossws-core/src/main/java/org/jboss/ws/core/server/UnifiedVirtualFile.java 2007-01-17
16:17:23 UTC (rev 1990)
@@ -0,0 +1,42 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.ws.core.server;
+
+// $Id$
+
+import java.io.IOException;
+import java.io.Serializable;
+import java.net.URL;
+
+/**
+ * An adaptor to a VirtualFile from jboss-vfs.jar
+ * jboss-vfs cannot be used in jboss-4.x because of its dependeny on
jboss-common-core.jar
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 05-May-2006
+ */
+public interface UnifiedVirtualFile extends Serializable
+{
+ UnifiedVirtualFile findChild(String child) throws IOException;
+
+ URL toURL();
+}
Property changes on:
trunk/jbossws-core/src/main/java/org/jboss/ws/core/server/UnifiedVirtualFile.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF