[jboss-cvs] JBossAS SVN: r109532 - trunk/webservices/src/main/java/org/jboss/webservices/integration/injection.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Mon Nov 29 03:35:21 EST 2010


Author: richard.opalka at jboss.com
Date: 2010-11-29 03:35:17 -0500 (Mon, 29 Nov 2010)
New Revision: 109532

Added:
   trunk/webservices/src/main/java/org/jboss/webservices/integration/injection/VirtualFileAdaptor.java
Modified:
   trunk/webservices/src/main/java/org/jboss/webservices/integration/injection/ServiceRefResourceProvider.java
   trunk/webservices/src/main/java/org/jboss/webservices/integration/injection/WebServiceContextResourceProvider.java
Log:
[JBAS-8667][JBWS-3161] fixing classloader regression and distinguish between @Addressing(enabled=false) and no @Addressing annotation

Modified: trunk/webservices/src/main/java/org/jboss/webservices/integration/injection/ServiceRefResourceProvider.java
===================================================================
--- trunk/webservices/src/main/java/org/jboss/webservices/integration/injection/ServiceRefResourceProvider.java	2010-11-29 07:50:48 UTC (rev 109531)
+++ trunk/webservices/src/main/java/org/jboss/webservices/integration/injection/ServiceRefResourceProvider.java	2010-11-29 08:35:17 UTC (rev 109532)
@@ -21,27 +21,41 @@
  */
 package org.jboss.webservices.integration.injection;
 
+import java.lang.annotation.Annotation;
+import java.lang.reflect.AccessibleObject;
+import java.lang.reflect.AnnotatedElement;
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.net.MalformedURLException;
+import java.net.URISyntaxException;
+import java.net.URL;
+import java.util.ArrayList;
 import java.util.Collection;
 import java.util.List;
 import java.util.Map;
 
 import javax.naming.Referenceable;
 import javax.xml.namespace.QName;
+import javax.xml.ws.Service;
+import javax.xml.ws.WebServiceRef;
+import javax.xml.ws.WebServiceRefs;
+import javax.xml.ws.soap.MTOM;
 
+import org.jboss.classloader.spi.base.BaseClassLoader;
 import org.jboss.deployers.structure.spi.DeploymentUnit;
-import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
 import org.jboss.logging.Logger;
-import org.jboss.metadata.serviceref.VirtualFileAdaptor;
 import org.jboss.switchboard.javaee.environment.Addressing;
 import org.jboss.switchboard.javaee.environment.Handler;
 import org.jboss.switchboard.javaee.environment.HandlerChain;
+import org.jboss.switchboard.javaee.environment.InjectionTarget;
 import org.jboss.switchboard.javaee.environment.PortComponent;
 import org.jboss.switchboard.javaee.environment.ServiceRefType;
 import org.jboss.switchboard.javaee.jboss.environment.JBossPortComponent;
 import org.jboss.switchboard.javaee.jboss.environment.JBossServiceRefType;
 import org.jboss.switchboard.mc.spi.MCBasedResourceProvider;
 import org.jboss.switchboard.spi.Resource;
-import org.jboss.wsf.common.ResourceLoaderAdapter;
+import org.jboss.vfs.VFS;
+import org.jboss.vfs.VirtualFile;
 import org.jboss.wsf.spi.SPIProvider;
 import org.jboss.wsf.spi.SPIProviderResolver;
 import org.jboss.wsf.spi.deployment.UnifiedVirtualFile;
@@ -54,6 +68,7 @@
 import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedServiceRefMetaData;
 import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedStubPropertyMetaData;
 import org.jboss.wsf.spi.serviceref.ServiceRefHandler;
+import org.jboss.wsf.spi.serviceref.ServiceRefHandler.Type;
 import org.jboss.wsf.spi.serviceref.ServiceRefHandlerFactory;
 
 /**
@@ -73,7 +88,7 @@
 
    private static final Logger log = Logger.getLogger(ServiceRefResourceProvider.class);
 
-   private ServiceRefHandler delegate;
+   private final ServiceRefHandler delegate;
 
    /**
     * Constructor.
@@ -90,11 +105,23 @@
    @Override
    public Resource provide(final DeploymentUnit deploymentUnit, final ServiceRefType serviceRefSBMD)
    {
-      final UnifiedVirtualFile vfsRoot = this.getUnifiedVirtualFile(deploymentUnit);
-      final UnifiedServiceRefMetaData serviceRefUMDM = this.getUnifiedServiceRefMetaData(vfsRoot, serviceRefSBMD);
-      final Referenceable jndiReferenceable = this.delegate.createReferenceable(serviceRefUMDM);
+      final ClassLoader newLoader = deploymentUnit.getClassLoader();
+      final ClassLoader oldLoader = Thread.currentThread().getContextClassLoader();
 
-      return new ServiceRefResource(jndiReferenceable);
+      try
+      {
+         Thread.currentThread().setContextClassLoader(newLoader);
+         final UnifiedVirtualFile vfsRoot = this.getUnifiedVirtualFile(deploymentUnit);
+         final UnifiedServiceRefMetaData serviceRefUMDM = this.getUnifiedServiceRefMetaData(vfsRoot, serviceRefSBMD,
+               newLoader);
+         final Referenceable jndiReferenceable = this.delegate.createReferenceable(serviceRefUMDM);
+
+         return new ServiceRefResource(jndiReferenceable);
+      }
+      finally
+      {
+         Thread.currentThread().setContextClassLoader(oldLoader);
+      }
    }
 
    /**
@@ -116,14 +143,26 @@
     */
    private UnifiedVirtualFile getUnifiedVirtualFile(final DeploymentUnit deploymentUnit)
    {
-      if (deploymentUnit instanceof VFSDeploymentUnit)
+      final ClassLoader loader = deploymentUnit.getClassLoader();
+      VirtualFile virtualFile = null;
+      if (loader instanceof BaseClassLoader)
       {
-         return new VirtualFileAdaptor(((VFSDeploymentUnit) deploymentUnit).getRoot());
+         try
+         {
+            virtualFile = VFS.getChild(new URL(((BaseClassLoader) loader).getName()));
+         }
+         catch (URISyntaxException e)
+         {
+            throw new RuntimeException(e);
+         }
+         catch (MalformedURLException e)
+         {
+            throw new RuntimeException(e);
+         }
+         return new VirtualFileAdaptor(virtualFile);
       }
-      else
-      {
-         return new ResourceLoaderAdapter(deploymentUnit.getClassLoader());
-      }
+
+      throw new UnsupportedOperationException();
    }
 
    /**
@@ -134,7 +173,7 @@
     * @return unified jbossws service reference meta data
     */
    private UnifiedServiceRefMetaData getUnifiedServiceRefMetaData(final UnifiedVirtualFile vfsRoot,
-         final ServiceRefType serviceRefSBMD)
+         final ServiceRefType serviceRefSBMD, final ClassLoader loader)
    {
       final UnifiedServiceRefMetaData serviceRefUMDM = new UnifiedServiceRefMetaData(vfsRoot);
       serviceRefUMDM.setServiceRefName(serviceRefSBMD.getName());
@@ -146,17 +185,31 @@
       serviceRefUMDM.setHandlerChain(serviceRefSBMD.getHandlerChain());
 
       // propagate addressing properties
+      serviceRefUMDM.setAddressingAnnotationSpecified(serviceRefSBMD.isAddressingFeatureEnabled());
       serviceRefUMDM.setAddressingEnabled(serviceRefSBMD.isAddressingEnabled());
       serviceRefUMDM.setAddressingRequired(serviceRefSBMD.isAddressingRequired());
       serviceRefUMDM.setAddressingResponses(serviceRefSBMD.getAddressingResponses());
 
       // propagate MTOM properties
+      serviceRefUMDM.setMtomAnnotationSpecified(serviceRefSBMD.isMtomFeatureEnabled());
       serviceRefUMDM.setMtomEnabled(serviceRefSBMD.isMtomEnabled());
       serviceRefUMDM.setMtomThreshold(serviceRefSBMD.getMtomThreshold());
 
       // propagate respect binding properties
+      serviceRefUMDM.setRespectBindingAnnotationSpecified(serviceRefSBMD.isRespectBindingFeatureEnabled());
       serviceRefUMDM.setRespectBindingEnabled(serviceRefSBMD.isRespectBindingEnabled());
 
+      // process injection targets
+      if (serviceRefSBMD.getInjectionTargets() != null && serviceRefSBMD.getInjectionTargets().size() > 0)
+      {
+         if (serviceRefSBMD.getInjectionTargets().size() > 1)
+            throw new UnsupportedOperationException("What to do in such case?");
+         final InjectionTarget injectionTarget = serviceRefSBMD.getInjectionTargets().iterator().next();
+
+         AccessibleObject anAlement = this.findInjectionTarget(loader, injectionTarget);
+         this.processAnnotatedElement(anAlement, serviceRefUMDM);
+      }
+
       // propagate port compoments
       final Collection<? extends PortComponent> portComponentsSBMD = serviceRefSBMD.getPortComponents();
       if (portComponentsSBMD != null)
@@ -202,6 +255,9 @@
          this.processUnifiedJBossServiceRefMetaData(serviceRefUMDM, serviceRefSBMD);
       }
 
+      // detect JAXWS or JAXRPC type
+      this.processType(serviceRefUMDM);
+
       return serviceRefUMDM;
    }
 
@@ -422,4 +478,222 @@
          return this.target;
       }
    }
+
+   private void processAnnotatedElement(final AnnotatedElement anElement, final UnifiedServiceRefMetaData serviceRefUMDM)
+   {
+      this.processAddressingAnnotation(anElement, serviceRefUMDM);
+      this.processMTOMAnnotation(anElement, serviceRefUMDM);
+      this.processRespectBindingAnnotation(anElement, serviceRefUMDM);
+      this.processHandlerChainAnnotation(anElement, serviceRefUMDM);
+      this.processServiceRefType(anElement, serviceRefUMDM);
+   }
+
+   // TODO: use classloader to detect service ref type
+   private void processType(final UnifiedServiceRefMetaData serviceRefUMDM)
+   {
+      final boolean isJAXRPC = serviceRefUMDM.getMappingFile() != null // TODO: is mappingFile check required?
+            || "javax.xml.rpc.Service".equals(serviceRefUMDM.getServiceInterface());
+
+      serviceRefUMDM.setType(isJAXRPC ? Type.JAXRPC : Type.JAXWS);
+   }
+
+   private void processAddressingAnnotation(final AnnotatedElement anElement,
+         final UnifiedServiceRefMetaData serviceRefUMDM)
+   {
+      final javax.xml.ws.soap.Addressing addressingAnnotation = this.getAnnotation(anElement,
+            javax.xml.ws.soap.Addressing.class);
+
+      if (addressingAnnotation != null)
+      {
+         serviceRefUMDM.setAddressingAnnotationSpecified(true);
+         serviceRefUMDM.setAddressingEnabled(addressingAnnotation.enabled());
+         serviceRefUMDM.setAddressingRequired(addressingAnnotation.required());
+         serviceRefUMDM.setAddressingResponses(addressingAnnotation.responses().toString());
+      }
+   }
+
+   private void processMTOMAnnotation(final AnnotatedElement anElement, final UnifiedServiceRefMetaData serviceRefUMDM)
+   {
+      final MTOM mtomAnnotation = this.getAnnotation(anElement, MTOM.class);
+
+      if (mtomAnnotation != null)
+      {
+         serviceRefUMDM.setMtomAnnotationSpecified(true);
+         serviceRefUMDM.setMtomEnabled(mtomAnnotation.enabled());
+         serviceRefUMDM.setMtomThreshold(mtomAnnotation.threshold());
+      }
+   }
+
+   private void processRespectBindingAnnotation(final AnnotatedElement anElement,
+         final UnifiedServiceRefMetaData serviceRefUMDM)
+   {
+      final javax.xml.ws.RespectBinding respectBindingAnnotation = this.getAnnotation(anElement,
+            javax.xml.ws.RespectBinding.class);
+
+      if (respectBindingAnnotation != null)
+      {
+         serviceRefUMDM.setRespectBindingAnnotationSpecified(true);
+         serviceRefUMDM.setRespectBindingEnabled(respectBindingAnnotation.enabled());
+      }
+   }
+
+   private void processServiceRefType(final AnnotatedElement anElement, final UnifiedServiceRefMetaData serviceRefUMDM)
+   {
+      if (anElement instanceof Field)
+      {
+         final Class<?> targetClass = ((Field) anElement).getType();
+         serviceRefUMDM.setServiceRefType(targetClass.getName());
+
+         if (Service.class.isAssignableFrom(targetClass))
+            serviceRefUMDM.setServiceInterface(targetClass.getName());
+      }
+      else if (anElement instanceof Method)
+      {
+         final Class<?> targetClass = ((Method) anElement).getParameterTypes()[0];
+         serviceRefUMDM.setServiceRefType(targetClass.getName());
+
+         if (Service.class.isAssignableFrom(targetClass))
+            serviceRefUMDM.setServiceInterface(targetClass.getName());
+      }
+      else
+      {
+         final WebServiceRef serviceRefAnnotation = this.getWebServiceRefAnnotation(anElement, serviceRefUMDM);
+         Class<?> targetClass = null;
+         if (serviceRefAnnotation != null && (serviceRefAnnotation.type() != Object.class))
+         {
+            targetClass = serviceRefAnnotation.type();
+            serviceRefUMDM.setServiceRefType(targetClass.getName());
+
+            if (Service.class.isAssignableFrom(targetClass))
+               serviceRefUMDM.setServiceInterface(targetClass.getName());
+         }
+      }
+   }
+
+   private void processHandlerChainAnnotation(final AnnotatedElement anElement,
+         final UnifiedServiceRefMetaData serviceRefUMDM)
+   {
+      final javax.jws.HandlerChain handlerChainAnnotation = this.getAnnotation(anElement, javax.jws.HandlerChain.class);
+
+      if (handlerChainAnnotation != null)
+      {
+         // Set the handlerChain from @HandlerChain on the annotated element
+         String handlerChain = null;
+         if (handlerChainAnnotation.file().length() > 0)
+            handlerChain = handlerChainAnnotation.file();
+
+         // Resolve path to handler chain
+         if (handlerChain != null)
+         {
+            try
+            {
+               new URL(handlerChain);
+            }
+            catch (MalformedURLException ignored)
+            {
+               final Class<?> declaringClass = getDeclaringClass(anElement);
+
+               handlerChain = declaringClass.getPackage().getName().replace('.', '/') + "/" + handlerChain;
+            }
+
+            serviceRefUMDM.setHandlerChain(handlerChain);
+         }
+      }
+   }
+
+   private Class<?> getDeclaringClass(final AnnotatedElement annotatedElement)
+   {
+      Class<?> declaringClass = null;
+      if (annotatedElement instanceof Field)
+         declaringClass = ((Field) annotatedElement).getDeclaringClass();
+      else if (annotatedElement instanceof Method)
+         declaringClass = ((Method) annotatedElement).getDeclaringClass();
+      else if (annotatedElement instanceof Class)
+         declaringClass = (Class<?>) annotatedElement;
+
+      return declaringClass;
+   }
+
+   private <T extends Annotation> T getAnnotation(final AnnotatedElement anElement, final Class<T> annotationClass)
+   {
+      return anElement != null ? (T) anElement.getAnnotation(annotationClass) : null;
+   }
+
+   private WebServiceRef getWebServiceRefAnnotation(final AnnotatedElement anElement,
+         final UnifiedServiceRefMetaData serviceRefUMDM)
+   {
+      final WebServiceRef webServiceRefAnnotation = this.getAnnotation(anElement, WebServiceRef.class);
+      final WebServiceRefs webServiceRefsAnnotation = this.getAnnotation(anElement, WebServiceRefs.class);
+
+      if (webServiceRefAnnotation == null && webServiceRefsAnnotation == null)
+      {
+         return null;
+      }
+
+      // Build the list of @WebServiceRef relevant annotations
+      final List<WebServiceRef> wsrefList = new ArrayList<WebServiceRef>();
+
+      if (webServiceRefAnnotation != null)
+      {
+         wsrefList.add(webServiceRefAnnotation);
+      }
+
+      if (webServiceRefsAnnotation != null)
+      {
+         for (final WebServiceRef webServiceRefAnn : webServiceRefsAnnotation.value())
+         {
+            wsrefList.add(webServiceRefAnn);
+         }
+      }
+
+      // Return effective @WebServiceRef annotation
+      WebServiceRef returnValue = null;
+      if (wsrefList.size() == 1)
+      {
+         returnValue = wsrefList.get(0);
+      }
+      else
+      {
+         for (WebServiceRef webServiceRefAnn : wsrefList)
+         {
+            if (serviceRefUMDM.getServiceRefName().endsWith(webServiceRefAnn.name()))
+            {
+               returnValue = webServiceRefAnn;
+               break;
+            }
+         }
+      }
+
+      return returnValue;
+   }
+
+   private AccessibleObject findInjectionTarget(ClassLoader loader, InjectionTarget target)
+   {
+      Class<?> clazz = null;
+      try
+      {
+         clazz = loader.loadClass(target.getTargetClass());
+      }
+      catch (ClassNotFoundException e)
+      {
+         throw new RuntimeException("<injection-target> class: " + target.getTargetClass()
+               + " was not found in deployment");
+      }
+
+      for (Field field : clazz.getDeclaredFields())
+      {
+         if (target.getTargetName().equals(field.getName()))
+            return field;
+      }
+
+      for (Method method : clazz.getDeclaredMethods())
+      {
+         if (method.getName().equals(target.getTargetName()))
+            return method;
+      }
+
+      throw new RuntimeException("<injection-target> could not be found: " + target.getTargetClass() + "."
+            + target.getTargetName());
+
+   }
 }

Added: trunk/webservices/src/main/java/org/jboss/webservices/integration/injection/VirtualFileAdaptor.java
===================================================================
--- trunk/webservices/src/main/java/org/jboss/webservices/integration/injection/VirtualFileAdaptor.java	                        (rev 0)
+++ trunk/webservices/src/main/java/org/jboss/webservices/integration/injection/VirtualFileAdaptor.java	2010-11-29 08:35:17 UTC (rev 109532)
@@ -0,0 +1,244 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, 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.webservices.integration.injection;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.io.ObjectStreamField;
+import java.io.OutputStream;
+import java.net.URISyntaxException;
+import java.net.URL;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.jar.JarEntry;
+import java.util.jar.JarInputStream;
+import java.util.jar.JarOutputStream;
+
+import org.jboss.vfs.VFS;
+import org.jboss.vfs.VFSUtils;
+import org.jboss.vfs.VirtualFile;
+import org.jboss.wsf.spi.deployment.UnifiedVirtualFile;
+import org.jboss.wsf.spi.deployment.WritableUnifiedVirtualFile;
+
+/**
+ * A VirtualFile adaptor.
+ *
+ * @author Thomas.Diesler at jboss.org
+ * @author Ales.Justin at jboss.org
+ * @author alessio.soldano at jboss.com
+ */
+public final class VirtualFileAdaptor implements WritableUnifiedVirtualFile
+{
+   private static final long serialVersionUID = -4509594124653184348L;
+
+   private static final ObjectStreamField[] serialPersistentFields =
+   {
+      new ObjectStreamField("rootUrl", URL.class),
+      new ObjectStreamField("path", String.class),
+      new ObjectStreamField("requiresMount", boolean.class)
+   };
+
+   /** Minimal info to get full vfs file structure */
+   private URL rootUrl;
+   private String path;
+   private boolean requiresMount;
+   /** The virtual file */
+   private transient VirtualFile file;
+
+   public VirtualFileAdaptor(VirtualFile file)
+   {
+      this.file = file;
+   }
+
+   public VirtualFileAdaptor(URL rootUrl, String path)
+   {
+      this(rootUrl, path, false);
+   }
+
+   protected VirtualFileAdaptor(URL rootUrl, String path, boolean requiresMount)
+   {
+      if (rootUrl == null)
+         throw new IllegalArgumentException("Null root url");
+      if (path == null)
+         throw new IllegalArgumentException("Null path");
+
+      this.rootUrl = rootUrl;
+      this.path = path;
+      this.requiresMount = requiresMount;
+   }
+
+   /**
+    * Get the virtual file.
+    * Create file from root url and path if it doesn't exist yet.
+    *
+    * @return virtual file root
+    * @throws IOException for any error
+    */
+   protected VirtualFile getFile() throws IOException
+   {
+      if (file == null)
+      {
+         VirtualFile root;
+         try
+         {
+            root = VFS.getChild(rootUrl);
+         }
+         catch (URISyntaxException e)
+         {
+            throw new IOException("Unable to get Virtualfile from URL: " + rootUrl, e);
+         }
+         file = root.getChild(path);
+         
+         if (!file.exists())
+         {
+            throw new IOException("VirtualFile " + file + " does not exist");
+         }
+         else if (requiresMount && !isMounted(root, file))
+         {
+            throw new IOException("VirtualFile " + file + " is not mounted");
+         }
+      }
+      return file;
+   }
+   
+   private static boolean isMounted(VirtualFile root, VirtualFile child) throws IOException
+   {
+      return !(root.getPathName().equals(root.getPhysicalFile().getAbsolutePath()) && child.getPathName().equals(child.getPhysicalFile().getAbsolutePath()));
+   }
+   
+   public UnifiedVirtualFile findChild(String child) throws IOException
+   {
+      final VirtualFile virtualFile = getFile();   
+      final VirtualFile childFile = file.getChild(child);
+      if(!childFile.exists())
+         throw new IOException("Child '" + child + "' not found for VirtualFile " + virtualFile);
+      return new VirtualFileAdaptor(childFile);
+   }
+
+   public URL toURL()
+   {
+      try
+      {
+         return getFile().toURL();
+      }
+      catch (Exception e)
+      {
+         return null;
+      }
+   }
+   
+   public void writeContent(OutputStream bos) throws IOException
+   {
+      writeContent(bos, null);
+   }
+   
+   public void writeContent(OutputStream bos, NameFilter filter) throws IOException
+   {
+      InputStream is = null;
+      try
+      {
+         is = getFile().openStream();
+         if (is instanceof JarInputStream)
+         {
+            JarInputStream jis = (JarInputStream)is;
+            JarOutputStream os = new JarOutputStream(bos);
+            JarEntry je = null;
+            while ((je = jis.getNextJarEntry()) != null)
+            {
+               if (filter != null && filter.accept(je.getName()))
+               {
+                  os.putNextEntry(je);
+                  VFSUtils.copyStream(jis, os);
+               }
+            }
+            VFSUtils.safeClose(os);
+         }
+         else
+         {
+            VFSUtils.copyStream(is, bos);
+         }
+      }
+      finally
+      {
+         VFSUtils.safeClose(is);
+      }
+   }
+   
+   private void writeObject(ObjectOutputStream out) throws IOException, URISyntaxException
+   {
+      VirtualFile file = getFile();
+      URL url = rootUrl;
+      if (url == null)
+      {
+         VirtualFile parentFile = file.getParent();
+         url = parentFile != null ? parentFile.toURL() : null;
+      }
+      String pathName = path;
+      if (pathName == null)
+         pathName = file.getName();
+
+      ObjectOutputStream.PutField fields = out.putFields();
+      fields.put("rootUrl", url);
+      fields.put("path", pathName);
+      
+      VirtualFile newRoot = VFS.getChild(url);
+      VirtualFile newChild = newRoot.getChild(pathName);
+      fields.put("requiresMount", isMounted(newRoot, newChild));
+            
+      out.writeFields();
+   }
+
+   private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException
+   {
+      ObjectInputStream.GetField fields = in.readFields();
+      rootUrl = (URL) fields.get("rootUrl", null);
+      path = (String) fields.get("path", null);
+      requiresMount = fields.get("requiresMount", false);
+   }
+
+   public List<UnifiedVirtualFile> getChildren() throws IOException
+   {
+      List<VirtualFile> vfList = getFile().getChildren();
+      if (vfList == null)
+         return null;
+      List<UnifiedVirtualFile> uvfList = new LinkedList<UnifiedVirtualFile>();
+      for (VirtualFile vf : vfList)
+      {
+         uvfList.add(new VirtualFileAdaptor(vf));
+      }
+      return uvfList;
+   }
+
+   public String getName()
+   {
+      try
+      {
+         return getFile().getName();
+      }
+      catch (Exception e)
+      {
+         throw new RuntimeException(e);
+      }
+   }
+}

Modified: trunk/webservices/src/main/java/org/jboss/webservices/integration/injection/WebServiceContextResourceProvider.java
===================================================================
--- trunk/webservices/src/main/java/org/jboss/webservices/integration/injection/WebServiceContextResourceProvider.java	2010-11-29 07:50:48 UTC (rev 109531)
+++ trunk/webservices/src/main/java/org/jboss/webservices/integration/injection/WebServiceContextResourceProvider.java	2010-11-29 08:35:17 UTC (rev 109532)
@@ -1,8 +1,8 @@
 /*
- * JBoss, Home of Professional Open Source.
- * Copyright 2009, 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.
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, 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



More information about the jboss-cvs-commits mailing list