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

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Tue Oct 21 12:57:09 EDT 2008


Author: scott.stark at jboss.org
Date: 2008-10-21 12:57:09 -0400 (Tue, 21 Oct 2008)
New Revision: 79855

Added:
   trunk/spring-int/src/main/org/jboss/spring/cluster/
   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
Removed:
   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
Modified:
   trunk/spring-int/.classpath
   trunk/spring-int/build.xml
   trunk/spring-int/pom.xml
Log:
[JBAS-6088]; add simple Spring bean cache / cluster scope.
[JBAS-6008]; add test for simple Spring cluster integration.

Modified: trunk/spring-int/.classpath
===================================================================
--- trunk/spring-int/.classpath	2008-10-21 16:39:23 UTC (rev 79854)
+++ trunk/spring-int/.classpath	2008-10-21 16:57:09 UTC (rev 79855)
@@ -13,5 +13,7 @@
 	<classpathentry kind="lib" path="/thirdparty/junit/lib/junit.jar"/>
 	<classpathentry kind="lib" path="/thirdparty/jboss/test/lib/jboss-test.jar"/>
 	<classpathentry kind="lib" path="/thirdparty/jboss/aop/lib/jboss-aop.jar"/>
+   <classpathentry exported="true" kind="lib" path="/thirdparty/jboss/cache/jbosscache-core/lib/jbosscache-core.jar" sourcepath="/jbosscache-core/src/main/java"/>
+	<classpathentry exported="true" kind="lib" path="/thirdparty/jboss/cache/jbosscache-pojo/lib/jbosscache-pojo.jar" sourcepath="/thirdparty/jboss/cache/jbosscache-pojo/lib/jbosscache-pojo-sources.jar"/>
 	<classpathentry kind="output" path="output/eclipse-classes"/>
 </classpath>

Modified: trunk/spring-int/build.xml
===================================================================
--- trunk/spring-int/build.xml	2008-10-21 16:39:23 UTC (rev 79854)
+++ trunk/spring-int/build.xml	2008-10-21 16:57:09 UTC (rev 79855)
@@ -102,6 +102,8 @@
       <path refid="jboss.microcontainer.classpath"/>
       <path refid="jboss.jboss.vfs.classpath"/>
       <path refid="jboss.jboss.javaee.classpath"/>
+      <path refid="jboss.cache.jbosscache.core.classpath"/>
+      <path refid="jboss.cache.jbosscache.pojo.classpath"/>
     </path>
 
     <!-- Where source files live -->
@@ -173,6 +175,7 @@
          <include name="org/jboss/spring/interceptor/**"/>
          <include name="org/jboss/spring/support/**"/>
          <include name="org/jboss/spring/io/**"/>
+         <include name="org/jboss/spring/cluster/**"/>
       </fileset>
     </jar>
 
@@ -240,6 +243,7 @@
        <include name="org/jboss/spring/factory/**"/>
        <include name="org/jboss/spring/support/**"/>
        <include name="org/jboss/spring/io/**"/>
+       <include name="org/jboss/spring/cluster/**"/>
     </javac>
   </target>
 
@@ -394,6 +398,7 @@
             <exclude name="org/jboss/spring/factory/**"/>
             <exclude name="org/jboss/spring/interceptor/**"/>
             <exclude name="org/jboss/spring/io/**"/>
+            <exclude name="org/jboss/spring/cluster/**"/>
         </javac>
         <copy todir="${module.output}/example/classes">
             <fileset dir="${source.resources}/test/dd">

Modified: trunk/spring-int/pom.xml
===================================================================
--- trunk/spring-int/pom.xml	2008-10-21 16:39:23 UTC (rev 79854)
+++ trunk/spring-int/pom.xml	2008-10-21 16:57:09 UTC (rev 79855)
@@ -99,6 +99,20 @@
       <groupId>org.springframework</groupId>
       <artifactId>spring-core</artifactId>
     </dependency>
+    <dependency>
+      <groupId>org.jboss.cache</groupId>
+      <artifactId>jbosscache-pojo</artifactId>
+      <exclusions>
+        <exclusion>
+          <groupId>jboss</groupId>
+          <artifactId>jboss-j2ee</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>org.jboss.aop</groupId>
+          <artifactId>jboss-aop</artifactId>
+        </exclusion>
+      </exclusions>
+    </dependency>
   </dependencies>
   
 </project>
\ No newline at end of file

Copied: trunk/spring-int/src/main/org/jboss/spring/cluster (from rev 79746, trunk/spring-int/src/main/org/jboss/spring/cluster)

Deleted: trunk/spring-int/src/main/org/jboss/spring/cluster/CacheLookup.java
===================================================================
--- trunk/spring-int/src/main/org/jboss/spring/cluster/CacheLookup.java	2008-10-20 12:57:06 UTC (rev 79746)
+++ trunk/spring-int/src/main/org/jboss/spring/cluster/CacheLookup.java	2008-10-21 16:57:09 UTC (rev 79855)
@@ -1,108 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2006, 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.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;
-   }
-}

Copied: trunk/spring-int/src/main/org/jboss/spring/cluster/CacheLookup.java (from rev 79746, trunk/spring-int/src/main/org/jboss/spring/cluster/CacheLookup.java)
===================================================================
--- trunk/spring-int/src/main/org/jboss/spring/cluster/CacheLookup.java	                        (rev 0)
+++ trunk/spring-int/src/main/org/jboss/spring/cluster/CacheLookup.java	2008-10-21 16:57:09 UTC (rev 79855)
@@ -0,0 +1,108 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, 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.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;
+   }
+}

Deleted: trunk/spring-int/src/main/org/jboss/spring/cluster/CachePostProcessor.java
===================================================================
--- trunk/spring-int/src/main/org/jboss/spring/cluster/CachePostProcessor.java	2008-10-20 12:57:06 UTC (rev 79746)
+++ trunk/spring-int/src/main/org/jboss/spring/cluster/CachePostProcessor.java	2008-10-21 16:57:09 UTC (rev 79855)
@@ -1,94 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2006, 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.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;
-   }
-}

Copied: trunk/spring-int/src/main/org/jboss/spring/cluster/CachePostProcessor.java (from rev 79746, trunk/spring-int/src/main/org/jboss/spring/cluster/CachePostProcessor.java)
===================================================================
--- trunk/spring-int/src/main/org/jboss/spring/cluster/CachePostProcessor.java	                        (rev 0)
+++ trunk/spring-int/src/main/org/jboss/spring/cluster/CachePostProcessor.java	2008-10-21 16:57:09 UTC (rev 79855)
@@ -0,0 +1,94 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, 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.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;
+   }
+}

Deleted: trunk/spring-int/src/main/org/jboss/spring/cluster/CacheScope.java
===================================================================
--- trunk/spring-int/src/main/org/jboss/spring/cluster/CacheScope.java	2008-10-20 12:57:06 UTC (rev 79746)
+++ trunk/spring-int/src/main/org/jboss/spring/cluster/CacheScope.java	2008-10-21 16:57:09 UTC (rev 79855)
@@ -1,57 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2006, 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.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)
-   {
-   }
-}

Copied: trunk/spring-int/src/main/org/jboss/spring/cluster/CacheScope.java (from rev 79746, trunk/spring-int/src/main/org/jboss/spring/cluster/CacheScope.java)
===================================================================
--- trunk/spring-int/src/main/org/jboss/spring/cluster/CacheScope.java	                        (rev 0)
+++ trunk/spring-int/src/main/org/jboss/spring/cluster/CacheScope.java	2008-10-21 16:57:09 UTC (rev 79855)
@@ -0,0 +1,57 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, 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.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)
+   {
+   }
+}




More information about the jboss-cvs-commits mailing list