[jboss-cvs] JBossAS SVN: r81069 - in trunk/spring-int/src: main/org/jboss/spring/deployers and 2 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Fri Nov 14 10:15:40 EST 2008


Author: dimitris at jboss.org
Date: 2008-11-14 10:15:40 -0500 (Fri, 14 Nov 2008)
New Revision: 81069

Modified:
   trunk/spring-int/src/main/org/jboss/spring/cluster/CacheLookup.java
   trunk/spring-int/src/main/org/jboss/spring/cluster/CachePostProcessor.java
   trunk/spring-int/src/main/org/jboss/spring/cluster/CacheScope.java
   trunk/spring-int/src/main/org/jboss/spring/deployers/AbstractSpringMetaDataDeployer.java
   trunk/spring-int/src/main/org/jboss/spring/deployers/ApplicationContextDeployer.java
   trunk/spring-int/src/main/org/jboss/spring/deployers/BeanFactoryDeployer.java
   trunk/spring-int/src/main/org/jboss/spring/deployers/SpringMetaData.java
   trunk/spring-int/src/main/org/jboss/spring/deployers/SpringParserDeployer.java
   trunk/spring-int/src/main/org/jboss/spring/io/VFSResource.java
   trunk/spring-int/src/main/org/jboss/spring/io/VFSResourceLoader.java
   trunk/spring-int/src/main/org/jboss/spring/io/VFSResourcePatternResolver.java
   trunk/spring-int/src/resources/spring-deployers-jboss-beans.xml
Log:
fix svn properties

Modified: trunk/spring-int/src/main/org/jboss/spring/cluster/CacheLookup.java
===================================================================
--- trunk/spring-int/src/main/org/jboss/spring/cluster/CacheLookup.java	2008-11-14 15:14:35 UTC (rev 81068)
+++ trunk/spring-int/src/main/org/jboss/spring/cluster/CacheLookup.java	2008-11-14 15:15:40 UTC (rev 81069)
@@ -1,108 +1,108 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, 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.
- *
- * 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.spring.cluster;
-
-import org.jboss.cache.CacheException;
-import org.jboss.cache.pojo.PojoCache;
-
-/**
- * Cache lookup helper class.
- *
- * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
- */
-public abstract class CacheLookup
-{
-   private String rootName = "/pojos/";
-   protected PojoCache pojoCache;
-
-   protected CacheLookup(PojoCache pojoCache)
-   {
-      this.pojoCache = pojoCache;
-   }
-
-   /**
-    * Get the object out of pojo cache.
-    *
-    * @param name the name to look for
-    * @return cached object or null for some cache exception
-    */
-   protected Object get(String name)
-   {
-      try
-      {
-         return pojoCache.find(rootName + name);
-      }
-      catch (CacheException e)
-      {
-         System.err.println("Exception getting object from PojoCache:" + e);
-      }
-      return null;
-   }
-
-   /**
-    * Put the object into cache.
-    *
-    * @param name the name to put it under
-    * @param object the object to put
-    * @return result of cache put
-    */
-   protected Object put(String name, Object object)
-   {
-      try
-      {
-         return pojoCache.attach(rootName + name, object);
-      }
-      catch (CacheException e)
-      {
-         throw new IllegalArgumentException("Unable to put object to PojoCache: " + e);
-      }
-   }
-
-   /**
-    * Remove object with name param from cache.
-    *
-    * @param name the object's name
-    * @return removed object or null for any cache error
-    */
-   public Object remove(String name)
-   {
-      try
-      {
-         return pojoCache.detach(rootName + name);
-      }
-      catch (CacheException e)
-      {
-         System.err.println("Exception removing object from PojoCache:" + e);
-         return null;
-      }
-   }
-
-   /**
-    * Set the cache root name.
-    *
-    * @param rootName the root name
-    */
-   public void setRootName(String rootName)
-   {
-      this.rootName = rootName;
-   }
-}
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, 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.
+ *
+ * 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.spring.cluster;
+
+import org.jboss.cache.CacheException;
+import org.jboss.cache.pojo.PojoCache;
+
+/**
+ * Cache lookup helper class.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public abstract class CacheLookup
+{
+   private String rootName = "/pojos/";
+   protected PojoCache pojoCache;
+
+   protected CacheLookup(PojoCache pojoCache)
+   {
+      this.pojoCache = pojoCache;
+   }
+
+   /**
+    * Get the object out of pojo cache.
+    *
+    * @param name the name to look for
+    * @return cached object or null for some cache exception
+    */
+   protected Object get(String name)
+   {
+      try
+      {
+         return pojoCache.find(rootName + name);
+      }
+      catch (CacheException e)
+      {
+         System.err.println("Exception getting object from PojoCache:" + e);
+      }
+      return null;
+   }
+
+   /**
+    * Put the object into cache.
+    *
+    * @param name the name to put it under
+    * @param object the object to put
+    * @return result of cache put
+    */
+   protected Object put(String name, Object object)
+   {
+      try
+      {
+         return pojoCache.attach(rootName + name, object);
+      }
+      catch (CacheException e)
+      {
+         throw new IllegalArgumentException("Unable to put object to PojoCache: " + e);
+      }
+   }
+
+   /**
+    * Remove object with name param from cache.
+    *
+    * @param name the object's name
+    * @return removed object or null for any cache error
+    */
+   public Object remove(String name)
+   {
+      try
+      {
+         return pojoCache.detach(rootName + name);
+      }
+      catch (CacheException e)
+      {
+         System.err.println("Exception removing object from PojoCache:" + e);
+         return null;
+      }
+   }
+
+   /**
+    * Set the cache root name.
+    *
+    * @param rootName the root name
+    */
+   public void setRootName(String rootName)
+   {
+      this.rootName = rootName;
+   }
+}


Property changes on: trunk/spring-int/src/main/org/jboss/spring/cluster/CacheLookup.java
___________________________________________________________________
Name: svn:eol-style
   + native

Modified: trunk/spring-int/src/main/org/jboss/spring/cluster/CachePostProcessor.java
===================================================================
--- trunk/spring-int/src/main/org/jboss/spring/cluster/CachePostProcessor.java	2008-11-14 15:14:35 UTC (rev 81068)
+++ trunk/spring-int/src/main/org/jboss/spring/cluster/CachePostProcessor.java	2008-11-14 15:15:40 UTC (rev 81069)
@@ -1,94 +1,94 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, 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.
- *
- * 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.spring.cluster;
-
-import java.lang.annotation.Annotation;
-
-import org.jboss.cache.pojo.PojoCache;
-import org.jboss.cache.pojo.annotation.Replicable;
-import org.springframework.beans.BeansException;
-import org.springframework.beans.factory.config.BeanFactoryPostProcessor;
-import org.springframework.beans.factory.config.BeanPostProcessor;
-import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
-
-/**
- * Pojo cache / cluster post processor.
- *
- * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
- */
-public class CachePostProcessor extends CacheLookup implements BeanFactoryPostProcessor, BeanPostProcessor
-{
-   private String scopeName = "cache";
-
-   public CachePostProcessor(PojoCache pojoCache)
-   {
-      super(pojoCache);
-   }
-
-   public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException
-   {
-      beanFactory.registerScope(scopeName, new CacheScope(pojoCache));
-   }
-
-   public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException
-   {
-      Class<?> beanClass = bean.getClass();
-      if (beanClass.isAnnotationPresent(getMarkerAnnotation()))
-      {
-         Object result = get(beanName);
-         if (result != null)
-         {
-            return result;
-         }
-         else
-         {
-            return put(beanName, bean);
-         }
-      }
-      return bean;
-   }
-
-   public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException
-   {
-      return bean;
-   }
-
-   /**
-    * Get the bean cache / cluster marker annotation.
-    *
-    * @return the cache / cluster marker annotation
-    */
-   public Class<? extends Annotation> getMarkerAnnotation()
-   {
-      return Replicable.class;
-   }
-
-   /**
-    * Set scope name.
-    *
-    * @param scopeName the scope name
-    */
-   public void setScopeName(String scopeName)
-   {
-      this.scopeName = scopeName;
-   }
-}
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, 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.
+ *
+ * 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.spring.cluster;
+
+import java.lang.annotation.Annotation;
+
+import org.jboss.cache.pojo.PojoCache;
+import org.jboss.cache.pojo.annotation.Replicable;
+import org.springframework.beans.BeansException;
+import org.springframework.beans.factory.config.BeanFactoryPostProcessor;
+import org.springframework.beans.factory.config.BeanPostProcessor;
+import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
+
+/**
+ * Pojo cache / cluster post processor.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public class CachePostProcessor extends CacheLookup implements BeanFactoryPostProcessor, BeanPostProcessor
+{
+   private String scopeName = "cache";
+
+   public CachePostProcessor(PojoCache pojoCache)
+   {
+      super(pojoCache);
+   }
+
+   public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException
+   {
+      beanFactory.registerScope(scopeName, new CacheScope(pojoCache));
+   }
+
+   public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException
+   {
+      Class<?> beanClass = bean.getClass();
+      if (beanClass.isAnnotationPresent(getMarkerAnnotation()))
+      {
+         Object result = get(beanName);
+         if (result != null)
+         {
+            return result;
+         }
+         else
+         {
+            return put(beanName, bean);
+         }
+      }
+      return bean;
+   }
+
+   public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException
+   {
+      return bean;
+   }
+
+   /**
+    * Get the bean cache / cluster marker annotation.
+    *
+    * @return the cache / cluster marker annotation
+    */
+   public Class<? extends Annotation> getMarkerAnnotation()
+   {
+      return Replicable.class;
+   }
+
+   /**
+    * Set scope name.
+    *
+    * @param scopeName the scope name
+    */
+   public void setScopeName(String scopeName)
+   {
+      this.scopeName = scopeName;
+   }
+}


Property changes on: trunk/spring-int/src/main/org/jboss/spring/cluster/CachePostProcessor.java
___________________________________________________________________
Name: svn:eol-style
   + native

Modified: trunk/spring-int/src/main/org/jboss/spring/cluster/CacheScope.java
===================================================================
--- trunk/spring-int/src/main/org/jboss/spring/cluster/CacheScope.java	2008-11-14 15:14:35 UTC (rev 81068)
+++ trunk/spring-int/src/main/org/jboss/spring/cluster/CacheScope.java	2008-11-14 15:15:40 UTC (rev 81069)
@@ -1,57 +1,57 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, 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.
- *
- * 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.spring.cluster;
-
-import org.jboss.cache.pojo.PojoCache;
-import org.springframework.beans.factory.ObjectFactory;
-import org.springframework.beans.factory.config.Scope;
-
-/**
- * Pojo cache scope.
- *
- * It enables plain spring beans to be clustered
- * via JBoss Pojo cache.
- *
- * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
- */
-public class CacheScope extends CacheLookup implements Scope
-{
-   public CacheScope(PojoCache pojoCache)
-   {
-      super(pojoCache);
-   }
-
-   public String getConversationId()
-   {
-      return null;
-   }
-
-   public Object get(String name, ObjectFactory objectFactory)
-   {
-      Object result = get(name);
-      return (result != null) ?  result : put(name,  objectFactory.getObject());
-   }
-
-   public void registerDestructionCallback(String string, Runnable runnable)
-   {
-   }
-}
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, 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.
+ *
+ * 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.spring.cluster;
+
+import org.jboss.cache.pojo.PojoCache;
+import org.springframework.beans.factory.ObjectFactory;
+import org.springframework.beans.factory.config.Scope;
+
+/**
+ * Pojo cache scope.
+ *
+ * It enables plain spring beans to be clustered
+ * via JBoss Pojo cache.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public class CacheScope extends CacheLookup implements Scope
+{
+   public CacheScope(PojoCache pojoCache)
+   {
+      super(pojoCache);
+   }
+
+   public String getConversationId()
+   {
+      return null;
+   }
+
+   public Object get(String name, ObjectFactory objectFactory)
+   {
+      Object result = get(name);
+      return (result != null) ?  result : put(name,  objectFactory.getObject());
+   }
+
+   public void registerDestructionCallback(String string, Runnable runnable)
+   {
+   }
+}


Property changes on: trunk/spring-int/src/main/org/jboss/spring/cluster/CacheScope.java
___________________________________________________________________
Name: svn:eol-style
   + native

Modified: trunk/spring-int/src/main/org/jboss/spring/deployers/AbstractSpringMetaDataDeployer.java
===================================================================
--- trunk/spring-int/src/main/org/jboss/spring/deployers/AbstractSpringMetaDataDeployer.java	2008-11-14 15:14:35 UTC (rev 81068)
+++ trunk/spring-int/src/main/org/jboss/spring/deployers/AbstractSpringMetaDataDeployer.java	2008-11-14 15:15:40 UTC (rev 81069)
@@ -1,211 +1,211 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, 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.
- *
- * 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.spring.deployers;
-
-import javax.naming.InitialContext;
-import javax.naming.NamingException;
-
-import org.jboss.deployers.spi.DeploymentException;
-import org.jboss.deployers.spi.deployer.helpers.AbstractRealDeployerWithInput;
-import org.jboss.deployers.spi.deployer.helpers.DeploymentVisitor;
-import org.jboss.deployers.structure.spi.DeploymentUnit;
-import org.jboss.spring.factory.Nameable;
-import org.jboss.util.naming.NonSerializableFactory;
-import org.jboss.util.naming.Util;
-import org.springframework.beans.factory.BeanFactory;
-
-/**
- * Deploys SpringMetaData.
- * @see ApplicationContextDeployer
- * @see BeanFactoryDeployer
- *
- * @param <T> exact bean factory type
- * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
- */
-public abstract class AbstractSpringMetaDataDeployer<T extends BeanFactory> extends AbstractRealDeployerWithInput<SpringMetaData>
-{
-   protected AbstractSpringMetaDataDeployer()
-   {
-      setDeploymentVisitor(createDeploymentVisitor());
-   }
-
-   /**
-    * Create deployment visitor.
-    *
-    * @return the deployment visitor
-    */
-   protected abstract DeploymentVisitor<SpringMetaData> createDeploymentVisitor();
-
-   protected abstract class SpringDeploymentVisitor implements DeploymentVisitor<SpringMetaData>
-   {
-      public Class<SpringMetaData> getVisitorType()
-      {
-         return SpringMetaData.class;
-      }
-
-      public void deploy(DeploymentUnit unit, SpringMetaData springMetaData) throws DeploymentException
-      {
-         ClassLoader classLoader = unit.getClassLoader();
-         ClassLoader old = Thread.currentThread().getContextClassLoader();
-         try
-         {
-            Thread.currentThread().setContextClassLoader(classLoader);
-            T beanFactory = doCreate(springMetaData);
-            String name = ((Nameable) beanFactory).getName();
-            springMetaData.setName(name);
-            bind(beanFactory, name);
-            if (log.isTraceEnabled())
-               log.trace("Bean factory [" + name + "] binded to local JNDI.");
-         }
-         finally
-         {
-            Thread.currentThread().setContextClassLoader(old);
-         }
-      }
-
-      /**
-       * Do create BeanFactory instance.
-       *
-       * @param metaData the spring meta data
-       * @return new bean factory instance
-       */
-      protected abstract T doCreate(SpringMetaData metaData);
-
-      public void undeploy(DeploymentUnit unit, SpringMetaData springMetaData)
-      {
-         String name = springMetaData.getName();
-         try
-         {
-            T beanFactory = lookup(name);
-            if (beanFactory != null)
-            {
-               doClose(beanFactory);
-               unbind(name);
-               if (log.isTraceEnabled())
-                  log.trace("Bean factory [" + name + "] unbinded from local JNDI.");
-            }
-         }
-         catch (Exception e)
-         {
-            if (log.isTraceEnabled())
-               log.trace("Exception finding BeanFactory instance named " + name, e);
-         }
-      }
-
-      /**
-       * Do close bean factory.
-       *
-       * @param beanFactory the bean factory to close
-       */
-      protected abstract void doClose(T beanFactory);
-   }
-
-   /**
-    * Bind factory to non-serializable JNDI context.
-    *
-    * @param beanFactory the bean factory
-    * @param name the jndi name
-    * @throws DeploymentException for any error
-    */
-   protected void bind(T beanFactory, String name) throws DeploymentException
-   {
-      InitialContext ctx = null;
-      try
-      {
-         ctx = new InitialContext();
-         NonSerializableFactory.rebind(ctx, name, beanFactory);
-      }
-      catch (NamingException e)
-      {
-         throw new DeploymentException("Unable to bind BeanFactory into JNDI", e);
-      }
-      finally
-      {
-         if (ctx != null)
-         {
-            try
-            {
-               ctx.close();
-            }
-            catch (Throwable ignored)
-            {
-            }
-         }
-      }
-   }
-
-   /**
-    * Unind factory from non-serializable JNDI context.
-    *
-    * @param name the jndi name
-    */
-   protected void unbind(String name)
-   {
-      InitialContext ctx = null;
-      try
-      {
-         ctx = new InitialContext();
-         ctx.unbind(name);
-         NonSerializableFactory.unbind(name);
-      }
-      catch (NamingException e)
-      {
-         log.warn("Unable to unbind BeanFactory from JNDI", e);
-      }
-      finally
-      {
-         if (ctx != null)
-         {
-            try
-            {
-               ctx.close();
-            }
-            catch (Throwable ignored)
-            {
-            }
-         }
-      }
-   }
-
-   /**
-    * Do a jndi lookup for bean factory.
-    *
-    * @param name the jndi name
-    * @return bean factory instance
-    * @throws Exception for any exception
-    */
-   protected T lookup(String name) throws Exception
-   {
-      Class<T> beanFactoryClass = getExactBeanFactoryClass();
-      T beanFactory = beanFactoryClass.cast(Util.lookup(name, beanFactoryClass));
-      if (log.isTraceEnabled())
-         log.trace("Found Spring bean factory [" + name + "]: " + beanFactory);
-      return beanFactory;
-   }
-
-   /**
-    * Exact bean factory class.
-    *
-    * @return the bean factory class
-    */
-   protected abstract Class<T> getExactBeanFactoryClass();
-}
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, 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.
+ *
+ * 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.spring.deployers;
+
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+
+import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.deployers.spi.deployer.helpers.AbstractRealDeployerWithInput;
+import org.jboss.deployers.spi.deployer.helpers.DeploymentVisitor;
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.spring.factory.Nameable;
+import org.jboss.util.naming.NonSerializableFactory;
+import org.jboss.util.naming.Util;
+import org.springframework.beans.factory.BeanFactory;
+
+/**
+ * Deploys SpringMetaData.
+ * @see ApplicationContextDeployer
+ * @see BeanFactoryDeployer
+ *
+ * @param <T> exact bean factory type
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public abstract class AbstractSpringMetaDataDeployer<T extends BeanFactory> extends AbstractRealDeployerWithInput<SpringMetaData>
+{
+   protected AbstractSpringMetaDataDeployer()
+   {
+      setDeploymentVisitor(createDeploymentVisitor());
+   }
+
+   /**
+    * Create deployment visitor.
+    *
+    * @return the deployment visitor
+    */
+   protected abstract DeploymentVisitor<SpringMetaData> createDeploymentVisitor();
+
+   protected abstract class SpringDeploymentVisitor implements DeploymentVisitor<SpringMetaData>
+   {
+      public Class<SpringMetaData> getVisitorType()
+      {
+         return SpringMetaData.class;
+      }
+
+      public void deploy(DeploymentUnit unit, SpringMetaData springMetaData) throws DeploymentException
+      {
+         ClassLoader classLoader = unit.getClassLoader();
+         ClassLoader old = Thread.currentThread().getContextClassLoader();
+         try
+         {
+            Thread.currentThread().setContextClassLoader(classLoader);
+            T beanFactory = doCreate(springMetaData);
+            String name = ((Nameable) beanFactory).getName();
+            springMetaData.setName(name);
+            bind(beanFactory, name);
+            if (log.isTraceEnabled())
+               log.trace("Bean factory [" + name + "] binded to local JNDI.");
+         }
+         finally
+         {
+            Thread.currentThread().setContextClassLoader(old);
+         }
+      }
+
+      /**
+       * Do create BeanFactory instance.
+       *
+       * @param metaData the spring meta data
+       * @return new bean factory instance
+       */
+      protected abstract T doCreate(SpringMetaData metaData);
+
+      public void undeploy(DeploymentUnit unit, SpringMetaData springMetaData)
+      {
+         String name = springMetaData.getName();
+         try
+         {
+            T beanFactory = lookup(name);
+            if (beanFactory != null)
+            {
+               doClose(beanFactory);
+               unbind(name);
+               if (log.isTraceEnabled())
+                  log.trace("Bean factory [" + name + "] unbinded from local JNDI.");
+            }
+         }
+         catch (Exception e)
+         {
+            if (log.isTraceEnabled())
+               log.trace("Exception finding BeanFactory instance named " + name, e);
+         }
+      }
+
+      /**
+       * Do close bean factory.
+       *
+       * @param beanFactory the bean factory to close
+       */
+      protected abstract void doClose(T beanFactory);
+   }
+
+   /**
+    * Bind factory to non-serializable JNDI context.
+    *
+    * @param beanFactory the bean factory
+    * @param name the jndi name
+    * @throws DeploymentException for any error
+    */
+   protected void bind(T beanFactory, String name) throws DeploymentException
+   {
+      InitialContext ctx = null;
+      try
+      {
+         ctx = new InitialContext();
+         NonSerializableFactory.rebind(ctx, name, beanFactory);
+      }
+      catch (NamingException e)
+      {
+         throw new DeploymentException("Unable to bind BeanFactory into JNDI", e);
+      }
+      finally
+      {
+         if (ctx != null)
+         {
+            try
+            {
+               ctx.close();
+            }
+            catch (Throwable ignored)
+            {
+            }
+         }
+      }
+   }
+
+   /**
+    * Unind factory from non-serializable JNDI context.
+    *
+    * @param name the jndi name
+    */
+   protected void unbind(String name)
+   {
+      InitialContext ctx = null;
+      try
+      {
+         ctx = new InitialContext();
+         ctx.unbind(name);
+         NonSerializableFactory.unbind(name);
+      }
+      catch (NamingException e)
+      {
+         log.warn("Unable to unbind BeanFactory from JNDI", e);
+      }
+      finally
+      {
+         if (ctx != null)
+         {
+            try
+            {
+               ctx.close();
+            }
+            catch (Throwable ignored)
+            {
+            }
+         }
+      }
+   }
+
+   /**
+    * Do a jndi lookup for bean factory.
+    *
+    * @param name the jndi name
+    * @return bean factory instance
+    * @throws Exception for any exception
+    */
+   protected T lookup(String name) throws Exception
+   {
+      Class<T> beanFactoryClass = getExactBeanFactoryClass();
+      T beanFactory = beanFactoryClass.cast(Util.lookup(name, beanFactoryClass));
+      if (log.isTraceEnabled())
+         log.trace("Found Spring bean factory [" + name + "]: " + beanFactory);
+      return beanFactory;
+   }
+
+   /**
+    * Exact bean factory class.
+    *
+    * @return the bean factory class
+    */
+   protected abstract Class<T> getExactBeanFactoryClass();
+}


Property changes on: trunk/spring-int/src/main/org/jboss/spring/deployers/AbstractSpringMetaDataDeployer.java
___________________________________________________________________
Name: svn:eol-style
   + native

Modified: trunk/spring-int/src/main/org/jboss/spring/deployers/ApplicationContextDeployer.java
===================================================================
--- trunk/spring-int/src/main/org/jboss/spring/deployers/ApplicationContextDeployer.java	2008-11-14 15:14:35 UTC (rev 81068)
+++ trunk/spring-int/src/main/org/jboss/spring/deployers/ApplicationContextDeployer.java	2008-11-14 15:15:40 UTC (rev 81069)
@@ -1,55 +1,55 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, 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.
- *
- * 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.spring.deployers;
-
-import org.jboss.deployers.spi.deployer.helpers.DeploymentVisitor;
-import org.jboss.spring.factory.NamedXmlApplicationContext;
-import org.springframework.context.ConfigurableApplicationContext;
-
-/**
- * Spring application context deployer.
- *
- * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
- */
-public class ApplicationContextDeployer extends AbstractSpringMetaDataDeployer<ConfigurableApplicationContext>
-{
-   protected DeploymentVisitor<SpringMetaData> createDeploymentVisitor()
-   {
-      return new SpringDeploymentVisitor()
-      {
-         protected ConfigurableApplicationContext doCreate(SpringMetaData metaData)
-         {
-            return new NamedXmlApplicationContext(metaData.getDefaultName(), metaData.getResource());
-         }
-
-         protected void doClose(ConfigurableApplicationContext beanFactory)
-         {
-            beanFactory.close();
-         }
-      };
-   }
-
-   protected Class<ConfigurableApplicationContext> getExactBeanFactoryClass()
-   {
-      return ConfigurableApplicationContext.class;
-   }
-}
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, 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.
+ *
+ * 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.spring.deployers;
+
+import org.jboss.deployers.spi.deployer.helpers.DeploymentVisitor;
+import org.jboss.spring.factory.NamedXmlApplicationContext;
+import org.springframework.context.ConfigurableApplicationContext;
+
+/**
+ * Spring application context deployer.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public class ApplicationContextDeployer extends AbstractSpringMetaDataDeployer<ConfigurableApplicationContext>
+{
+   protected DeploymentVisitor<SpringMetaData> createDeploymentVisitor()
+   {
+      return new SpringDeploymentVisitor()
+      {
+         protected ConfigurableApplicationContext doCreate(SpringMetaData metaData)
+         {
+            return new NamedXmlApplicationContext(metaData.getDefaultName(), metaData.getResource());
+         }
+
+         protected void doClose(ConfigurableApplicationContext beanFactory)
+         {
+            beanFactory.close();
+         }
+      };
+   }
+
+   protected Class<ConfigurableApplicationContext> getExactBeanFactoryClass()
+   {
+      return ConfigurableApplicationContext.class;
+   }
+}


Property changes on: trunk/spring-int/src/main/org/jboss/spring/deployers/ApplicationContextDeployer.java
___________________________________________________________________
Name: svn:eol-style
   + native

Modified: trunk/spring-int/src/main/org/jboss/spring/deployers/BeanFactoryDeployer.java
===================================================================
--- trunk/spring-int/src/main/org/jboss/spring/deployers/BeanFactoryDeployer.java	2008-11-14 15:14:35 UTC (rev 81068)
+++ trunk/spring-int/src/main/org/jboss/spring/deployers/BeanFactoryDeployer.java	2008-11-14 15:15:40 UTC (rev 81069)
@@ -1,55 +1,55 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, 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.
- *
- * 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.spring.deployers;
-
-import org.jboss.deployers.spi.deployer.helpers.DeploymentVisitor;
-import org.jboss.spring.factory.NamedXmlBeanFactory;
-import org.springframework.beans.factory.config.ConfigurableBeanFactory;
-
-/**
- * Spring bean factory deployer.
- *
- * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
- */
-public class BeanFactoryDeployer extends AbstractSpringMetaDataDeployer<ConfigurableBeanFactory>
-{
-   protected DeploymentVisitor<SpringMetaData> createDeploymentVisitor()
-   {
-      return new SpringDeploymentVisitor()
-      {
-         protected ConfigurableBeanFactory doCreate(SpringMetaData metaData)
-         {
-            return new NamedXmlBeanFactory(metaData.getDefaultName(), metaData.getResource());
-         }
-
-         protected void doClose(ConfigurableBeanFactory beanFactory)
-         {
-            beanFactory.destroySingletons();
-         }
-      };
-   }
-
-   protected Class<ConfigurableBeanFactory> getExactBeanFactoryClass()
-   {
-      return ConfigurableBeanFactory.class;
-   }
-}
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, 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.
+ *
+ * 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.spring.deployers;
+
+import org.jboss.deployers.spi.deployer.helpers.DeploymentVisitor;
+import org.jboss.spring.factory.NamedXmlBeanFactory;
+import org.springframework.beans.factory.config.ConfigurableBeanFactory;
+
+/**
+ * Spring bean factory deployer.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public class BeanFactoryDeployer extends AbstractSpringMetaDataDeployer<ConfigurableBeanFactory>
+{
+   protected DeploymentVisitor<SpringMetaData> createDeploymentVisitor()
+   {
+      return new SpringDeploymentVisitor()
+      {
+         protected ConfigurableBeanFactory doCreate(SpringMetaData metaData)
+         {
+            return new NamedXmlBeanFactory(metaData.getDefaultName(), metaData.getResource());
+         }
+
+         protected void doClose(ConfigurableBeanFactory beanFactory)
+         {
+            beanFactory.destroySingletons();
+         }
+      };
+   }
+
+   protected Class<ConfigurableBeanFactory> getExactBeanFactoryClass()
+   {
+      return ConfigurableBeanFactory.class;
+   }
+}


Property changes on: trunk/spring-int/src/main/org/jboss/spring/deployers/BeanFactoryDeployer.java
___________________________________________________________________
Name: svn:eol-style
   + native

Modified: trunk/spring-int/src/main/org/jboss/spring/deployers/SpringMetaData.java
===================================================================
--- trunk/spring-int/src/main/org/jboss/spring/deployers/SpringMetaData.java	2008-11-14 15:14:35 UTC (rev 81068)
+++ trunk/spring-int/src/main/org/jboss/spring/deployers/SpringMetaData.java	2008-11-14 15:15:40 UTC (rev 81069)
@@ -1,93 +1,93 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, 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.
- *
- * 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.spring.deployers;
-
-import java.io.Serializable;
-import java.net.URL;
-
-import org.springframework.core.io.Resource;
-import org.springframework.core.io.UrlResource;
-
-/**
- * Spring meta data.
- * 
- * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
- */
-public class SpringMetaData implements Serializable
-{
-   private static final long serialVersionUID = 8989753488155849440L;
-
-   private URL fileURL;
-   private String defaultName;
-   private String name;
-   private transient Resource resource;
-
-   public SpringMetaData()
-   {
-   }
-
-   public SpringMetaData(URL fileURL, String defaultName)
-   {
-      this.fileURL = fileURL;
-      this.defaultName = defaultName;
-   }
-
-   public URL getFileURL()
-   {
-      return fileURL;
-   }
-
-   public void setFileURL(URL fileURL)
-   {
-      this.fileURL = fileURL;
-   }
-
-   public String getDefaultName()
-   {
-      return defaultName;
-   }
-
-   public String getName()
-   {
-      return name != null ? name : defaultName;
-   }
-
-   public void setName(String name)
-   {
-      this.name = name;
-   }
-
-   public Resource getResource()
-   {
-      if (resource == null)
-         resource = new UrlResource(fileURL);
-      return resource;
-   }
-
-   public String toString()
-   {
-      StringBuilder builder = new StringBuilder();
-      builder.append("fileURL=").append(fileURL);
-      builder.append(", defaultName=").append(defaultName);
-      return builder.toString();
-   }
-}
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, 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.
+ *
+ * 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.spring.deployers;
+
+import java.io.Serializable;
+import java.net.URL;
+
+import org.springframework.core.io.Resource;
+import org.springframework.core.io.UrlResource;
+
+/**
+ * Spring meta data.
+ * 
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public class SpringMetaData implements Serializable
+{
+   private static final long serialVersionUID = 8989753488155849440L;
+
+   private URL fileURL;
+   private String defaultName;
+   private String name;
+   private transient Resource resource;
+
+   public SpringMetaData()
+   {
+   }
+
+   public SpringMetaData(URL fileURL, String defaultName)
+   {
+      this.fileURL = fileURL;
+      this.defaultName = defaultName;
+   }
+
+   public URL getFileURL()
+   {
+      return fileURL;
+   }
+
+   public void setFileURL(URL fileURL)
+   {
+      this.fileURL = fileURL;
+   }
+
+   public String getDefaultName()
+   {
+      return defaultName;
+   }
+
+   public String getName()
+   {
+      return name != null ? name : defaultName;
+   }
+
+   public void setName(String name)
+   {
+      this.name = name;
+   }
+
+   public Resource getResource()
+   {
+      if (resource == null)
+         resource = new UrlResource(fileURL);
+      return resource;
+   }
+
+   public String toString()
+   {
+      StringBuilder builder = new StringBuilder();
+      builder.append("fileURL=").append(fileURL);
+      builder.append(", defaultName=").append(defaultName);
+      return builder.toString();
+   }
+}


Property changes on: trunk/spring-int/src/main/org/jboss/spring/deployers/SpringMetaData.java
___________________________________________________________________
Name: svn:eol-style
   + native

Modified: trunk/spring-int/src/main/org/jboss/spring/deployers/SpringParserDeployer.java
===================================================================
--- trunk/spring-int/src/main/org/jboss/spring/deployers/SpringParserDeployer.java	2008-11-14 15:14:35 UTC (rev 81068)
+++ trunk/spring-int/src/main/org/jboss/spring/deployers/SpringParserDeployer.java	2008-11-14 15:15:40 UTC (rev 81069)
@@ -1,108 +1,108 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, 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.
- *
- * 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.spring.deployers;
-
-import org.jboss.deployers.vfs.spi.deployer.AbstractVFSParsingDeployer;
-import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
-import org.jboss.virtual.VirtualFile;
-
-/**
- * Spring deployer.
- * Picks up -spring.xml file.
- *
- * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
- */
-public class SpringParserDeployer extends AbstractVFSParsingDeployer<SpringMetaData>
-{
-   private boolean useLegacyDefaultName;
-
-   public SpringParserDeployer()
-   {
-      super(SpringMetaData.class);
-      setSuffix("-spring.xml");
-      setJarExtension(".spring");
-      setUseLegacyDefaultName(false);
-   }
-
-   /**
-    * Get the use name flag.
-    *
-    * @return true if the default name should be determined from deployment unit
-    */
-   protected boolean isUseLegacyDefaultName()
-   {
-      return useLegacyDefaultName;
-   }
-
-   /**
-    * Should we use deployment unit's name as default.
-    * e.g. using string before .jar|spring|... as the name
-    *
-    * Previous versions used string before .spring as the name,
-    * setting this to true results in this legacy behaviour.
-    *
-    * Current default is string before -spring.xml.
-    *
-    * @param useLegacyDefaultName the flag
-    */
-   public void setUseLegacyDefaultName(boolean useLegacyDefaultName)
-   {
-      this.useLegacyDefaultName = useLegacyDefaultName;
-   }
-
-   /**
-    * Get default name from meta file.
-    *
-    * @param file the virtual file
-    * @return default name
-    */
-   protected String getDefaultName(VirtualFile file)
-   {
-      String shortName = file.getName();
-      int p = shortName.indexOf("-spring.xml");
-      return shortName.substring(0, p);
-   }
-
-   /**
-    * Get default name from unit.
-    *
-    * @param unit the deployment unit
-    * @return default name
-    */
-   protected String getDefaultName(VFSDeploymentUnit unit)
-   {
-      String shortName = unit.getSimpleName();
-      int p = shortName.lastIndexOf(".");
-      return shortName.substring(0, p);
-   }
-
-   protected SpringMetaData parse(VFSDeploymentUnit unit, VirtualFile file, SpringMetaData metaData) throws Exception
-   {
-      String defaultName;
-      if (isUseLegacyDefaultName())
-         defaultName = getDefaultName(unit);
-      else
-         defaultName = getDefaultName(file);
-
-      return new SpringMetaData(file.toURL(), defaultName);
-   }
-}
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, 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.
+ *
+ * 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.spring.deployers;
+
+import org.jboss.deployers.vfs.spi.deployer.AbstractVFSParsingDeployer;
+import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
+import org.jboss.virtual.VirtualFile;
+
+/**
+ * Spring deployer.
+ * Picks up -spring.xml file.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public class SpringParserDeployer extends AbstractVFSParsingDeployer<SpringMetaData>
+{
+   private boolean useLegacyDefaultName;
+
+   public SpringParserDeployer()
+   {
+      super(SpringMetaData.class);
+      setSuffix("-spring.xml");
+      setJarExtension(".spring");
+      setUseLegacyDefaultName(false);
+   }
+
+   /**
+    * Get the use name flag.
+    *
+    * @return true if the default name should be determined from deployment unit
+    */
+   protected boolean isUseLegacyDefaultName()
+   {
+      return useLegacyDefaultName;
+   }
+
+   /**
+    * Should we use deployment unit's name as default.
+    * e.g. using string before .jar|spring|... as the name
+    *
+    * Previous versions used string before .spring as the name,
+    * setting this to true results in this legacy behaviour.
+    *
+    * Current default is string before -spring.xml.
+    *
+    * @param useLegacyDefaultName the flag
+    */
+   public void setUseLegacyDefaultName(boolean useLegacyDefaultName)
+   {
+      this.useLegacyDefaultName = useLegacyDefaultName;
+   }
+
+   /**
+    * Get default name from meta file.
+    *
+    * @param file the virtual file
+    * @return default name
+    */
+   protected String getDefaultName(VirtualFile file)
+   {
+      String shortName = file.getName();
+      int p = shortName.indexOf("-spring.xml");
+      return shortName.substring(0, p);
+   }
+
+   /**
+    * Get default name from unit.
+    *
+    * @param unit the deployment unit
+    * @return default name
+    */
+   protected String getDefaultName(VFSDeploymentUnit unit)
+   {
+      String shortName = unit.getSimpleName();
+      int p = shortName.lastIndexOf(".");
+      return shortName.substring(0, p);
+   }
+
+   protected SpringMetaData parse(VFSDeploymentUnit unit, VirtualFile file, SpringMetaData metaData) throws Exception
+   {
+      String defaultName;
+      if (isUseLegacyDefaultName())
+         defaultName = getDefaultName(unit);
+      else
+         defaultName = getDefaultName(file);
+
+      return new SpringMetaData(file.toURL(), defaultName);
+   }
+}


Property changes on: trunk/spring-int/src/main/org/jboss/spring/deployers/SpringParserDeployer.java
___________________________________________________________________
Name: svn:eol-style
   + native

Modified: trunk/spring-int/src/main/org/jboss/spring/io/VFSResource.java
===================================================================
--- trunk/spring-int/src/main/org/jboss/spring/io/VFSResource.java	2008-11-14 15:14:35 UTC (rev 81068)
+++ trunk/spring-int/src/main/org/jboss/spring/io/VFSResource.java	2008-11-14 15:15:40 UTC (rev 81069)
@@ -1,163 +1,163 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, 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.
- *
- * 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.spring.io;
-
-import java.net.URL;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.io.IOException;
-import java.io.File;
-import java.io.InputStream;
-
-import org.jboss.virtual.VirtualFile;
-import org.jboss.virtual.VFSUtils;
-import org.springframework.core.io.Resource;
-
-/**
- * VFS based Resource.
- *
- * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
- */
-public class VFSResource implements Resource
-{
-   private VirtualFile file;
-
-   public VFSResource(VirtualFile file)
-   {
-      if (file == null)
-         throw new IllegalArgumentException("Null file");
-      this.file = file;
-   }
-
-   public boolean exists()
-   {
-      try
-      {
-         return file.exists();
-      }
-      catch (IOException e)
-      {
-         throw new RuntimeException(e);
-      }
-   }
-
-   public boolean isOpen()
-   {
-      return false;
-   }
-
-   public boolean isReadable()
-   {
-      try
-      {
-         return file.getSize() > 0;
-      }
-      catch (IOException e)
-      {
-         throw new RuntimeException(e);
-      }
-   }
-
-   public long lastModified()
-   {
-      try
-      {
-         return file.getLastModified();
-      }
-      catch (IOException e)
-      {
-         throw new RuntimeException(e);
-      }
-   }
-
-   public URL getURL() throws IOException
-   {
-      try
-      {
-         return file.toURL();
-      }
-      catch (URISyntaxException e)
-      {
-         IOException ioe = new IOException(e.getMessage());
-         ioe.initCause(e);
-         throw ioe;
-      }
-   }
-
-   public URI getURI() throws IOException
-   {
-      try
-      {
-         return file.toURI();
-      }
-      catch (URISyntaxException e)
-      {
-         IOException ioe = new IOException(e.getMessage());
-         ioe.initCause(e);
-         throw ioe;
-      }
-   }
-
-   public File getFile() throws IOException
-   {
-      try
-      {
-         return new File(VFSUtils.getCompatibleURI(file));
-      }
-      catch (IOException e)
-      {
-         throw e;
-      }
-      catch (Exception e)
-      {
-         IOException ioe = new IOException(e.getMessage());
-         ioe.initCause(e);
-         throw ioe;
-      }
-   }
-
-   @SuppressWarnings("deprecation")
-   public Resource createRelative(String relativePath) throws IOException
-   {
-      return new VFSResource(file.findChild(relativePath));
-   }
-
-   public String getFilename()
-   {
-      return file.getName();
-   }
-
-   public String getDescription()
-   {
-      return file.toString();
-   }
-
-   public InputStream getInputStream() throws IOException
-   {
-      return file.openStream();
-   }
-
-   public String toString()
-   {
-      return getDescription();
-   }
-}
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, 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.
+ *
+ * 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.spring.io;
+
+import java.net.URL;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.io.IOException;
+import java.io.File;
+import java.io.InputStream;
+
+import org.jboss.virtual.VirtualFile;
+import org.jboss.virtual.VFSUtils;
+import org.springframework.core.io.Resource;
+
+/**
+ * VFS based Resource.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public class VFSResource implements Resource
+{
+   private VirtualFile file;
+
+   public VFSResource(VirtualFile file)
+   {
+      if (file == null)
+         throw new IllegalArgumentException("Null file");
+      this.file = file;
+   }
+
+   public boolean exists()
+   {
+      try
+      {
+         return file.exists();
+      }
+      catch (IOException e)
+      {
+         throw new RuntimeException(e);
+      }
+   }
+
+   public boolean isOpen()
+   {
+      return false;
+   }
+
+   public boolean isReadable()
+   {
+      try
+      {
+         return file.getSize() > 0;
+      }
+      catch (IOException e)
+      {
+         throw new RuntimeException(e);
+      }
+   }
+
+   public long lastModified()
+   {
+      try
+      {
+         return file.getLastModified();
+      }
+      catch (IOException e)
+      {
+         throw new RuntimeException(e);
+      }
+   }
+
+   public URL getURL() throws IOException
+   {
+      try
+      {
+         return file.toURL();
+      }
+      catch (URISyntaxException e)
+      {
+         IOException ioe = new IOException(e.getMessage());
+         ioe.initCause(e);
+         throw ioe;
+      }
+   }
+
+   public URI getURI() throws IOException
+   {
+      try
+      {
+         return file.toURI();
+      }
+      catch (URISyntaxException e)
+      {
+         IOException ioe = new IOException(e.getMessage());
+         ioe.initCause(e);
+         throw ioe;
+      }
+   }
+
+   public File getFile() throws IOException
+   {
+      try
+      {
+         return new File(VFSUtils.getCompatibleURI(file));
+      }
+      catch (IOException e)
+      {
+         throw e;
+      }
+      catch (Exception e)
+      {
+         IOException ioe = new IOException(e.getMessage());
+         ioe.initCause(e);
+         throw ioe;
+      }
+   }
+
+   @SuppressWarnings("deprecation")
+   public Resource createRelative(String relativePath) throws IOException
+   {
+      return new VFSResource(file.findChild(relativePath));
+   }
+
+   public String getFilename()
+   {
+      return file.getName();
+   }
+
+   public String getDescription()
+   {
+      return file.toString();
+   }
+
+   public InputStream getInputStream() throws IOException
+   {
+      return file.openStream();
+   }
+
+   public String toString()
+   {
+      return getDescription();
+   }
+}


Property changes on: trunk/spring-int/src/main/org/jboss/spring/io/VFSResource.java
___________________________________________________________________
Name: svn:eol-style
   + native

Modified: trunk/spring-int/src/main/org/jboss/spring/io/VFSResourceLoader.java
===================================================================
--- trunk/spring-int/src/main/org/jboss/spring/io/VFSResourceLoader.java	2008-11-14 15:14:35 UTC (rev 81068)
+++ trunk/spring-int/src/main/org/jboss/spring/io/VFSResourceLoader.java	2008-11-14 15:15:40 UTC (rev 81069)
@@ -1,72 +1,72 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, 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.
- *
- * 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.spring.io;
-
-import java.net.URL;
-
-import org.jboss.virtual.VFS;
-import org.jboss.virtual.VirtualFile;
-import org.springframework.core.io.ClassPathResource;
-import org.springframework.core.io.DefaultResourceLoader;
-import org.springframework.core.io.Resource;
-import org.springframework.util.Assert;
-
-/**
- * VFS based ResourceLoader.
- *
- * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
- */
-public class VFSResourceLoader extends DefaultResourceLoader
-{
-   public VFSResourceLoader()
-   {
-   }
-
-   public VFSResourceLoader(ClassLoader classLoader)
-   {
-      super(classLoader);
-   }
-
-   public Resource getResource(String location)
-   {
-      Assert.notNull(location, "Location must not be null");
-      if (location.startsWith(CLASSPATH_URL_PREFIX))
-      {
-         return new ClassPathResource(location.substring(CLASSPATH_URL_PREFIX.length()), getClassLoader());
-      }
-      else
-      {
-         try
-         {
-            // Try to parse the location as a URL...
-            URL url = new URL(location);
-            VirtualFile file = VFS.getCachedFile(url);
-            return new VFSResource(file);
-         }
-         catch (Exception ex)
-         {
-            // No URL -> resolve as resource path.
-            return getResourceByPath(location);
-         }
-      }
-   }
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, 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.
+ *
+ * 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.spring.io;
+
+import java.net.URL;
+
+import org.jboss.virtual.VFS;
+import org.jboss.virtual.VirtualFile;
+import org.springframework.core.io.ClassPathResource;
+import org.springframework.core.io.DefaultResourceLoader;
+import org.springframework.core.io.Resource;
+import org.springframework.util.Assert;
+
+/**
+ * VFS based ResourceLoader.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public class VFSResourceLoader extends DefaultResourceLoader
+{
+   public VFSResourceLoader()
+   {
+   }
+
+   public VFSResourceLoader(ClassLoader classLoader)
+   {
+      super(classLoader);
+   }
+
+   public Resource getResource(String location)
+   {
+      Assert.notNull(location, "Location must not be null");
+      if (location.startsWith(CLASSPATH_URL_PREFIX))
+      {
+         return new ClassPathResource(location.substring(CLASSPATH_URL_PREFIX.length()), getClassLoader());
+      }
+      else
+      {
+         try
+         {
+            // Try to parse the location as a URL...
+            URL url = new URL(location);
+            VirtualFile file = VFS.getCachedFile(url);
+            return new VFSResource(file);
+         }
+         catch (Exception ex)
+         {
+            // No URL -> resolve as resource path.
+            return getResourceByPath(location);
+         }
+      }
+   }
 }
\ No newline at end of file


Property changes on: trunk/spring-int/src/main/org/jboss/spring/io/VFSResourceLoader.java
___________________________________________________________________
Name: svn:eol-style
   + native

Modified: trunk/spring-int/src/main/org/jboss/spring/io/VFSResourcePatternResolver.java
===================================================================
--- trunk/spring-int/src/main/org/jboss/spring/io/VFSResourcePatternResolver.java	2008-11-14 15:14:35 UTC (rev 81068)
+++ trunk/spring-int/src/main/org/jboss/spring/io/VFSResourcePatternResolver.java	2008-11-14 15:15:40 UTC (rev 81069)
@@ -1,156 +1,156 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, 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.
- *
- * 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.spring.io;
-
-import java.io.IOException;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Enumeration;
-
-import org.jboss.logging.Logger;
-import org.jboss.virtual.VFS;
-import org.jboss.virtual.VirtualFile;
-import org.jboss.virtual.VirtualFileVisitor;
-import org.jboss.virtual.VisitorAttributes;
-import org.springframework.core.io.Resource;
-import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
-
-/**
- * VFS based ResourcePatternResolver.
- *
- * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
- */
-public class VFSResourcePatternResolver extends PathMatchingResourcePatternResolver
-{
-   private Logger log = Logger.getLogger(VFSResourcePatternResolver.class);
-
-   public VFSResourcePatternResolver()
-   {
-      super(new VFSResourceLoader());
-   }
-
-   public VFSResourcePatternResolver(ClassLoader classLoader)
-   {
-      super(new VFSResourceLoader(classLoader));
-   }
-
-   protected Resource[] findPathMatchingResources(String locationPattern) throws IOException
-   {
-      if (locationPattern.startsWith(CLASSPATH_ALL_URL_PREFIX))
-         locationPattern = locationPattern.substring(CLASSPATH_ALL_URL_PREFIX.length());
-      String rootDirPath = determineRootDir(locationPattern);
-      String subPattern = locationPattern.substring(rootDirPath.length());
-      if (rootDirPath.startsWith("/"))
-         rootDirPath = rootDirPath.substring(1);
-
-      List<Resource> resources = new ArrayList<Resource>();
-      Enumeration<URL> urls = getClassLoader().getResources(rootDirPath);
-      while(urls.hasMoreElements())
-         resources.addAll(getVFSResources(urls.nextElement(), subPattern));
-
-      return resources.toArray(new Resource[resources.size()]);
-   }
-
-   /**
-    * Get VFS resources.
-    *
-    * @param rootURL the root URL
-    * @param subPattern the sub pattern
-    * @return vfs resources list
-    * @throws IOException for any error
-    */
-   protected List<Resource> getVFSResources(URL rootURL, String subPattern) throws IOException
-   {
-      log.debug("Scanning url: " + rootURL + ", sub-pattern: " + subPattern);
-      VirtualFile root = VFS.getCachedFile(rootURL);
-      PatternVirtualFileVisitor visitor = new PatternVirtualFileVisitor(subPattern);
-      root.visit(visitor);
-      if (log.isTraceEnabled())
-         log.trace("Found resources: " + visitor);
-      return visitor.getResources();
-   }
-
-   protected Resource convertClassLoaderURL(URL url)
-   {
-      try
-      {
-         VirtualFile file = VFS.getCachedFile(url);
-         return new VFSResource(file);
-      }
-      catch (IOException e)
-      {
-         throw new RuntimeException(e);
-      }
-   }
-
-   /**
-    * Get visitor attributes.
-    * Allows for override, if necessary.
-    * 
-    * @return  visitor attributes
-    */
-   protected VisitorAttributes getVisitorAttributes()
-   {
-      return VisitorAttributes.RECURSE_LEAVES_ONLY;
-   }
-
-   private class PatternVirtualFileVisitor implements VirtualFileVisitor
-   {
-      private String subPattern;
-      private List<Resource> resources = new ArrayList<Resource>();
-
-      private PatternVirtualFileVisitor(String subPattern)
-      {
-         this.subPattern = subPattern;
-      }
-
-      public VisitorAttributes getAttributes()
-      {
-         return getVisitorAttributes();
-      }
-
-      public void visit(VirtualFile vf)
-      {
-         if (getPathMatcher().match(subPattern, vf.getPathName()))
-            resources.add(new VFSResource(vf));
-      }
-
-      public List<Resource> getResources()
-      {
-         return resources;
-      }
-
-      public int size()
-      {
-         return resources.size();
-      }
-
-      public String toString()
-      {
-         StringBuffer buffer = new StringBuffer();
-         buffer.append("sub-pattern: ").append(subPattern);
-         buffer.append(", resources: ").append(resources);
-         return buffer.toString();
-      }
-   }
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, 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.
+ *
+ * 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.spring.io;
+
+import java.io.IOException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Enumeration;
+
+import org.jboss.logging.Logger;
+import org.jboss.virtual.VFS;
+import org.jboss.virtual.VirtualFile;
+import org.jboss.virtual.VirtualFileVisitor;
+import org.jboss.virtual.VisitorAttributes;
+import org.springframework.core.io.Resource;
+import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
+
+/**
+ * VFS based ResourcePatternResolver.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public class VFSResourcePatternResolver extends PathMatchingResourcePatternResolver
+{
+   private Logger log = Logger.getLogger(VFSResourcePatternResolver.class);
+
+   public VFSResourcePatternResolver()
+   {
+      super(new VFSResourceLoader());
+   }
+
+   public VFSResourcePatternResolver(ClassLoader classLoader)
+   {
+      super(new VFSResourceLoader(classLoader));
+   }
+
+   protected Resource[] findPathMatchingResources(String locationPattern) throws IOException
+   {
+      if (locationPattern.startsWith(CLASSPATH_ALL_URL_PREFIX))
+         locationPattern = locationPattern.substring(CLASSPATH_ALL_URL_PREFIX.length());
+      String rootDirPath = determineRootDir(locationPattern);
+      String subPattern = locationPattern.substring(rootDirPath.length());
+      if (rootDirPath.startsWith("/"))
+         rootDirPath = rootDirPath.substring(1);
+
+      List<Resource> resources = new ArrayList<Resource>();
+      Enumeration<URL> urls = getClassLoader().getResources(rootDirPath);
+      while(urls.hasMoreElements())
+         resources.addAll(getVFSResources(urls.nextElement(), subPattern));
+
+      return resources.toArray(new Resource[resources.size()]);
+   }
+
+   /**
+    * Get VFS resources.
+    *
+    * @param rootURL the root URL
+    * @param subPattern the sub pattern
+    * @return vfs resources list
+    * @throws IOException for any error
+    */
+   protected List<Resource> getVFSResources(URL rootURL, String subPattern) throws IOException
+   {
+      log.debug("Scanning url: " + rootURL + ", sub-pattern: " + subPattern);
+      VirtualFile root = VFS.getCachedFile(rootURL);
+      PatternVirtualFileVisitor visitor = new PatternVirtualFileVisitor(subPattern);
+      root.visit(visitor);
+      if (log.isTraceEnabled())
+         log.trace("Found resources: " + visitor);
+      return visitor.getResources();
+   }
+
+   protected Resource convertClassLoaderURL(URL url)
+   {
+      try
+      {
+         VirtualFile file = VFS.getCachedFile(url);
+         return new VFSResource(file);
+      }
+      catch (IOException e)
+      {
+         throw new RuntimeException(e);
+      }
+   }
+
+   /**
+    * Get visitor attributes.
+    * Allows for override, if necessary.
+    * 
+    * @return  visitor attributes
+    */
+   protected VisitorAttributes getVisitorAttributes()
+   {
+      return VisitorAttributes.RECURSE_LEAVES_ONLY;
+   }
+
+   private class PatternVirtualFileVisitor implements VirtualFileVisitor
+   {
+      private String subPattern;
+      private List<Resource> resources = new ArrayList<Resource>();
+
+      private PatternVirtualFileVisitor(String subPattern)
+      {
+         this.subPattern = subPattern;
+      }
+
+      public VisitorAttributes getAttributes()
+      {
+         return getVisitorAttributes();
+      }
+
+      public void visit(VirtualFile vf)
+      {
+         if (getPathMatcher().match(subPattern, vf.getPathName()))
+            resources.add(new VFSResource(vf));
+      }
+
+      public List<Resource> getResources()
+      {
+         return resources;
+      }
+
+      public int size()
+      {
+         return resources.size();
+      }
+
+      public String toString()
+      {
+         StringBuffer buffer = new StringBuffer();
+         buffer.append("sub-pattern: ").append(subPattern);
+         buffer.append(", resources: ").append(resources);
+         return buffer.toString();
+      }
+   }
 }
\ No newline at end of file


Property changes on: trunk/spring-int/src/main/org/jboss/spring/io/VFSResourcePatternResolver.java
___________________________________________________________________
Name: svn:eol-style
   + native

Modified: trunk/spring-int/src/resources/spring-deployers-jboss-beans.xml
===================================================================
--- trunk/spring-int/src/resources/spring-deployers-jboss-beans.xml	2008-11-14 15:14:35 UTC (rev 81068)
+++ trunk/spring-int/src/resources/spring-deployers-jboss-beans.xml	2008-11-14 15:15:40 UTC (rev 81069)
@@ -1,20 +1,20 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--
-   Spring deployer beans.
--->
-<deployment xmlns="urn:jboss:bean-deployer:2.0">
-
-   <bean name="SpringParserDeployer" class="org.jboss.spring.deployers.SpringParserDeployer"/>
-
-   <bean name="ApplicationContextDeployer" class="org.jboss.spring.deployers.ApplicationContextDeployer"/>
-
-   <!--
-      Uncomment this if you want to use only BeanFactory not the full ApplicationContext.
-       And comment the ApplicationContextDeployer, else both will pick-up the SpringMetaData. 
-   -->
-   <!--
-   <bean name="BeanFactoryDeployer" class="org.jboss.spring.deployers.BeanFactoryDeployer"/>
-   -->
-
-</deployment>
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+   Spring deployer beans.
+-->
+<deployment xmlns="urn:jboss:bean-deployer:2.0">
+
+   <bean name="SpringParserDeployer" class="org.jboss.spring.deployers.SpringParserDeployer"/>
+
+   <bean name="ApplicationContextDeployer" class="org.jboss.spring.deployers.ApplicationContextDeployer"/>
+
+   <!--
+      Uncomment this if you want to use only BeanFactory not the full ApplicationContext.
+       And comment the ApplicationContextDeployer, else both will pick-up the SpringMetaData. 
+   -->
+   <!--
+   <bean name="BeanFactoryDeployer" class="org.jboss.spring.deployers.BeanFactoryDeployer"/>
+   -->
+
+</deployment>


Property changes on: trunk/spring-int/src/resources/spring-deployers-jboss-beans.xml
___________________________________________________________________
Name: svn:eol-style
   + native




More information about the jboss-cvs-commits mailing list