[jboss-cvs] JBossAS SVN: r87934 - branches/Branch_5_x/webservices/src/main/org/jboss/wsf/container/jboss50/deployer.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Tue Apr 28 06:00:40 EDT 2009


Author: alessio.soldano at jboss.com
Date: 2009-04-28 06:00:40 -0400 (Tue, 28 Apr 2009)
New Revision: 87934

Added:
   branches/Branch_5_x/webservices/src/main/org/jboss/wsf/container/jboss50/deployer/WSVirtualFileFilter.java
Modified:
   branches/Branch_5_x/webservices/src/main/org/jboss/wsf/container/jboss50/deployer/AbstractDeployerHook.java
Log:
[JBWS-2619] Getting additional metadata files


Modified: branches/Branch_5_x/webservices/src/main/org/jboss/wsf/container/jboss50/deployer/AbstractDeployerHook.java
===================================================================
--- branches/Branch_5_x/webservices/src/main/org/jboss/wsf/container/jboss50/deployer/AbstractDeployerHook.java	2009-04-28 09:03:08 UTC (rev 87933)
+++ branches/Branch_5_x/webservices/src/main/org/jboss/wsf/container/jboss50/deployer/AbstractDeployerHook.java	2009-04-28 10:00:40 UTC (rev 87934)
@@ -21,8 +21,14 @@
  */
 package org.jboss.wsf.container.jboss50.deployer;
 
+import java.util.LinkedList;
+import java.util.List;
+
 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.virtual.VirtualFile;
 import org.jboss.wsf.spi.SPIProvider;
 import org.jboss.wsf.spi.SPIProviderResolver;
 import org.jboss.wsf.spi.deployment.*;
@@ -39,6 +45,8 @@
 {
    // provide logging
    protected final Logger log = Logger.getLogger(getClass());
+   
+   private static final WSVirtualFileFilter WS_FILEFILTER = new WSVirtualFileFilter();
 
    private DeploymentAspectManager deploymentAspectManager;
    private DeploymentModelFactory deploymentModelFactory;
@@ -79,6 +87,18 @@
       {
          DeploymentModelFactory factory = getDeploymentModelFactory();
          ArchiveDeployment dep = (ArchiveDeployment)factory.newDeployment(unit.getSimpleName(), unit.getClassLoader());
+         if (unit instanceof VFSDeploymentUnit)
+         {
+            VFSDeploymentUnit vfsUnit = (VFSDeploymentUnit)unit;
+            List<VirtualFile> virtualFiles = vfsUnit.getMetaDataFiles(WS_FILEFILTER); //get all wsdl and xsd files
+            List<UnifiedVirtualFile> uVirtualFiles = new LinkedList<UnifiedVirtualFile>();
+            for (VirtualFile vf : virtualFiles)
+            {
+               uVirtualFiles.add(new VirtualFileAdaptor(vf));
+            }
+            dep.setMetadataFiles(uVirtualFiles);
+         }
+
          if (unit.getParent() != null)
          {
             DeploymentUnit parentUnit = unit.getParent();

Added: branches/Branch_5_x/webservices/src/main/org/jboss/wsf/container/jboss50/deployer/WSVirtualFileFilter.java
===================================================================
--- branches/Branch_5_x/webservices/src/main/org/jboss/wsf/container/jboss50/deployer/WSVirtualFileFilter.java	                        (rev 0)
+++ branches/Branch_5_x/webservices/src/main/org/jboss/wsf/container/jboss50/deployer/WSVirtualFileFilter.java	2009-04-28 10:00:40 UTC (rev 87934)
@@ -0,0 +1,81 @@
+/*
+ * JBoss, Home of Professional Open Source Copyright 2009, Red Hat Middleware
+ * LLC, and individual contributors 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.deployer;
+
+import org.jboss.virtual.VirtualFile;
+import org.jboss.virtual.VirtualFileFilterWithAttributes;
+import org.jboss.virtual.VisitorAttributes;
+
+/**
+ * VirtualFileFilter that can be used to search/filter files with the 
+ * suffix ".wsdl" and ".xsd".
+ * <p/>
+ * 
+ * @author <a href="mailto:dbevenius at jboss.com">Daniel Bevenius</a>
+ *
+ */
+public class WSVirtualFileFilter implements VirtualFileFilterWithAttributes
+{
+   /** The attributes */
+   private VisitorAttributes attributes;
+
+   /**
+    * No-args constructor. 
+    * 
+    * Will create a recursive filter by setting {@link VisitorAttributes#RECURSE_LEAVES_ONLY}.
+    */
+   public WSVirtualFileFilter()
+   {
+      this(VisitorAttributes.RECURSE_LEAVES_ONLY);
+   }
+
+   /**
+    * 
+    * @param attributes The {@link VisitorAttributes} value which determines the recursive behaviour of this filter.
+    */
+   public WSVirtualFileFilter(final VisitorAttributes attributes)
+   {
+      this.attributes = attributes;
+   }
+
+   /**
+    * Retrieves the VisitorAttribute for this instance.
+    */
+   public VisitorAttributes getAttributes()
+   {
+      return attributes;
+   }
+
+   /**
+    * Accepts files that end with .wsdl and .xsd.
+    * 
+    * @return {@code true} If the file name ends with either .wsdl or .xsd. Otherwise returns false.
+    */
+   public boolean accepts(final VirtualFile file)
+   {
+      if (file == null)
+         return false;
+
+      final String fileName = file.getName();
+      return fileName.endsWith(".wsdl") || fileName.endsWith(".xsd");
+   }
+
+}


Property changes on: branches/Branch_5_x/webservices/src/main/org/jboss/wsf/container/jboss50/deployer/WSVirtualFileFilter.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF




More information about the jboss-cvs-commits mailing list