[jboss-cvs] JBossAS SVN: r108703 - in projects/ejb3/branches/infinispan-int: ext-api/src/test/java/org/jboss/ejb3/extapi/testcompilation and 1 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Thu Oct 21 12:34:42 EDT 2010


Author: pferraro
Date: 2010-10-21 12:34:42 -0400 (Thu, 21 Oct 2010)
New Revision: 108703

Added:
   projects/ejb3/branches/infinispan-int/ext-api-impl/src/main/java/org/jboss/ejb3/annotation/impl/CachePropertyImpl.java
   projects/ejb3/branches/infinispan-int/ext-api/src/main/java/org/jboss/ejb3/annotation/CacheProperty.java
Modified:
   projects/ejb3/branches/infinispan-int/ext-api-impl/src/main/java/org/jboss/ejb3/annotation/impl/CacheConfigImpl.java
   projects/ejb3/branches/infinispan-int/ext-api/src/main/java/org/jboss/ejb3/annotation/CacheConfig.java
   projects/ejb3/branches/infinispan-int/ext-api/src/test/java/org/jboss/ejb3/extapi/testcompilation/TestCompilationBean.java
Log:
Refactor backups and mode into generic provider properties.

Modified: projects/ejb3/branches/infinispan-int/ext-api/src/main/java/org/jboss/ejb3/annotation/CacheConfig.java
===================================================================
--- projects/ejb3/branches/infinispan-int/ext-api/src/main/java/org/jboss/ejb3/annotation/CacheConfig.java	2010-10-21 16:32:54 UTC (rev 108702)
+++ projects/ejb3/branches/infinispan-int/ext-api/src/main/java/org/jboss/ejb3/annotation/CacheConfig.java	2010-10-21 16:34:42 UTC (rev 108703)
@@ -51,12 +51,6 @@
 
    public static final boolean DEFAULT_REPL_IS_PASV = true;
 
-   public static final int DEFAULT_BACKUPS = Integer.MAX_VALUE;
-   public static final int TOTAL_REPLICATION = -1;
-   public static final int NO_BACKUPS = 0;
-   
-   enum Mode { DEFAULT, SYNCHRONOUS, ASYNCHRONOUS };
-
    // Instance Members
 
    String name() default "";
@@ -69,7 +63,5 @@
 
    long removalTimeoutSeconds() default CacheConfig.DEFAULT_REMOVAL_TIMEOUT_SECONDS;
    
-   int backups() default DEFAULT_BACKUPS;
-   
-   Mode mode() default Mode.DEFAULT;
+   CacheProperty[] properties() default {};
 }

Added: projects/ejb3/branches/infinispan-int/ext-api/src/main/java/org/jboss/ejb3/annotation/CacheProperty.java
===================================================================
--- projects/ejb3/branches/infinispan-int/ext-api/src/main/java/org/jboss/ejb3/annotation/CacheProperty.java	                        (rev 0)
+++ projects/ejb3/branches/infinispan-int/ext-api/src/main/java/org/jboss/ejb3/annotation/CacheProperty.java	2010-10-21 16:34:42 UTC (rev 108703)
@@ -0,0 +1,15 @@
+package org.jboss.ejb3.annotation;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+/**
+ * Annotation to define the provider specific caching configuration for a SFSB
+ * 
+ * @author Paul Ferraro
+ */
+ at Retention(RetentionPolicy.RUNTIME)
+public @interface CacheProperty {
+   String name();
+   String value();
+}

Modified: projects/ejb3/branches/infinispan-int/ext-api/src/test/java/org/jboss/ejb3/extapi/testcompilation/TestCompilationBean.java
===================================================================
--- projects/ejb3/branches/infinispan-int/ext-api/src/test/java/org/jboss/ejb3/extapi/testcompilation/TestCompilationBean.java	2010-10-21 16:32:54 UTC (rev 108702)
+++ projects/ejb3/branches/infinispan-int/ext-api/src/test/java/org/jboss/ejb3/extapi/testcompilation/TestCompilationBean.java	2010-10-21 16:34:42 UTC (rev 108703)
@@ -5,6 +5,7 @@
 import org.jboss.ejb3.annotation.AspectDomain;
 import org.jboss.ejb3.annotation.Cache;
 import org.jboss.ejb3.annotation.CacheConfig;
+import org.jboss.ejb3.annotation.CacheProperty;
 import org.jboss.ejb3.annotation.Clustered;
 import org.jboss.ejb3.annotation.Consumer;
 import org.jboss.ejb3.annotation.CurrentMessage;
@@ -52,7 +53,7 @@
  */
 @AspectDomain("test")
 @Cache("CacheImpl")
- at CacheConfig(name = "CacheConfigName", maxSize = CacheConfig.DEFAULT_NONCLUSTERED_MAX_SIZE, idleTimeoutSeconds = CacheConfig.DEFAULT_IDLE_TIMEOUT_SECONDS, replicationIsPassivation = CacheConfig.DEFAULT_REPL_IS_PASV, removalTimeoutSeconds = CacheConfig.DEFAULT_REMOVAL_TIMEOUT_SECONDS)
+ at CacheConfig(name = "CacheConfigName", maxSize = CacheConfig.DEFAULT_NONCLUSTERED_MAX_SIZE, idleTimeoutSeconds = CacheConfig.DEFAULT_IDLE_TIMEOUT_SECONDS, replicationIsPassivation = CacheConfig.DEFAULT_REPL_IS_PASV, removalTimeoutSeconds = CacheConfig.DEFAULT_REMOVAL_TIMEOUT_SECONDS, properties = { @CacheProperty(name = "test", value ="value") })
 @Clustered(loadBalancePolicy = ClusteredDefaults.LOAD_BALANCE_POLICY_DEFAULT, partition = ClusteredDefaults.PARTITION_NAME_DEFAULT)
 @Consumer(name = "ConsumerName", activationConfig =
 {@ActivationConfigProperty(propertyName = "propertyName", propertyValue = "propertyValue")})

Modified: projects/ejb3/branches/infinispan-int/ext-api-impl/src/main/java/org/jboss/ejb3/annotation/impl/CacheConfigImpl.java
===================================================================
--- projects/ejb3/branches/infinispan-int/ext-api-impl/src/main/java/org/jboss/ejb3/annotation/impl/CacheConfigImpl.java	2010-10-21 16:32:54 UTC (rev 108702)
+++ projects/ejb3/branches/infinispan-int/ext-api-impl/src/main/java/org/jboss/ejb3/annotation/impl/CacheConfigImpl.java	2010-10-21 16:34:42 UTC (rev 108703)
@@ -24,6 +24,7 @@
 import java.lang.annotation.Annotation;
 
 import org.jboss.ejb3.annotation.CacheConfig;
+import org.jboss.ejb3.annotation.CacheProperty;
 
 /**
  * Implementation of CacheConfig Annotation
@@ -46,10 +47,8 @@
 
    private boolean replicationIsPassivation = CacheConfig.DEFAULT_REPL_IS_PASV;
 
-   private Mode mode = CacheConfig.Mode.DEFAULT;
+   private CacheProperty[] properties = {};
    
-   private int backups = CacheConfig.DEFAULT_BACKUPS;
-   
    // Constructor
 
    public CacheConfigImpl()
@@ -108,26 +107,16 @@
       this.replicationIsPassivation = replicationIsPassivation;
    }
 
-   public int backups()
+   public CacheProperty[] properties()
    {
-      return this.backups;
+      return this.properties;
    }
 
-   public void setBackups(int backups)
+   public void setProperties(CacheProperty[] properties)
    {
-      this.backups = backups;
+      this.properties = properties;
    }
    
-   public Mode mode()
-   {
-      return this.mode;
-   }
-
-   public void setMode(Mode mode)
-   {
-      this.mode = mode;
-   }
-   
    public void merge(CacheConfig annotation)
    {
       if (maxSize == CacheConfig.DEFAULT_NONCLUSTERED_MAX_SIZE)
@@ -150,15 +139,10 @@
          replicationIsPassivation = annotation.replicationIsPassivation();
       }
 
-      if (mode == CacheConfig.Mode.DEFAULT)
+      if ((properties == null) || (properties.length == 0))
       {
-         mode = annotation.mode();
+         properties = annotation.properties();
       }
-      
-      if (backups == CacheConfig.DEFAULT_BACKUPS)
-      {
-         backups = annotation.backups();
-      }
    }
 
    public Class<? extends Annotation> annotationType()

Added: projects/ejb3/branches/infinispan-int/ext-api-impl/src/main/java/org/jboss/ejb3/annotation/impl/CachePropertyImpl.java
===================================================================
--- projects/ejb3/branches/infinispan-int/ext-api-impl/src/main/java/org/jboss/ejb3/annotation/impl/CachePropertyImpl.java	                        (rev 0)
+++ projects/ejb3/branches/infinispan-int/ext-api-impl/src/main/java/org/jboss/ejb3/annotation/impl/CachePropertyImpl.java	2010-10-21 16:34:42 UTC (rev 108703)
@@ -0,0 +1,70 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, 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.ejb3.annotation.impl;
+
+import java.lang.annotation.Annotation;
+
+import org.jboss.ejb3.annotation.CacheConfig;
+import org.jboss.ejb3.annotation.CacheProperty;
+
+/**
+ * Implementation of CacheConfig Annotation
+ * 
+ * @author <a href="mailto:andrew.rubinger at redhat.com">ALR</a>
+ * @version $Revision: $
+ */
+public class CachePropertyImpl implements CacheProperty
+{
+
+   // Instance Members
+
+   private String name;
+
+   private String value;
+   
+   // Accessors / Mutators
+
+   public String name()
+   {
+      return name;
+   }
+
+   public void setName(String name)
+   {
+      this.name = name;
+   }
+
+   public String value()
+   {
+      return value;
+   }
+
+   public void setValue(String value)
+   {
+      this.value = value;
+   }
+
+   public Class<? extends Annotation> annotationType()
+   {
+      return CacheConfig.class;
+   }
+}



More information about the jboss-cvs-commits mailing list