[exo-jcr-commits] exo-jcr SVN: r476 - jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache.

do-not-reply at jboss.org do-not-reply at jboss.org
Fri Nov 6 04:36:42 EST 2009


Author: areshetnyak
Date: 2009-11-06 04:36:42 -0500 (Fri, 06 Nov 2009)
New Revision: 476

Added:
   jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/AbstractWriteOnlyCacheLoader.java
   jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/WriteOnlyCacheLoaderException.java
Log:
EXOJCR-201 : AbstractWriteOnlyCasheLoader was added.

Added: jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/AbstractWriteOnlyCacheLoader.java
===================================================================
--- jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/AbstractWriteOnlyCacheLoader.java	                        (rev 0)
+++ jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/AbstractWriteOnlyCacheLoader.java	2009-11-06 09:36:42 UTC (rev 476)
@@ -0,0 +1,130 @@
+/*
+ * Copyright (C) 2003-2009 eXo Platform SAS.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Affero General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see<http://www.gnu.org/licenses/>.
+ */
+package org.exoplatform.services.jcr.impl.storage.jbosscache;
+
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.jboss.cache.Fqn;
+import org.jboss.cache.Modification;
+import org.jboss.cache.config.CacheLoaderConfig.IndividualCacheLoaderConfig;
+import org.jboss.cache.loader.AbstractCacheLoader;
+
+/**
+ * Created by The eXo Platform SAS.
+ * 
+ * <br/>
+ * Date: 06.11.2009
+ * 
+ * @author <a href="mailto:alex.reshetnyak at exoplatform.com.ua">Alex Reshetnyak</a>
+ * @version $Id$
+ */
+public abstract class AbstractWriteOnlyCacheLoader
+   extends AbstractCacheLoader
+{
+   private IndividualCacheLoaderConfig config;
+
+   /**
+    * {@inheritDoc}
+    */
+   public boolean exists(Fqn arg0) throws Exception
+   {
+      return false;
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   public Map<Object, Object> get(Fqn arg0) throws Exception
+   {
+      throw new WriteOnlyCacheLoaderException("The method 'Map<Object, Object> get(Fqn arg0)' should not be called.");
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   public Set<Object> getChildrenNames(Fqn arg0) throws Exception
+   {
+      return new HashSet<Object>();
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   public IndividualCacheLoaderConfig getConfig()
+   {
+      return config;
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   public void put(Fqn arg0, Map<Object, Object> arg1) throws Exception
+   {
+      throw new WriteOnlyCacheLoaderException("The method 'put(Fqn arg0, Map<Object, Object> arg1))' should not be called.");
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   public Object put(Fqn arg0, Object arg1, Object arg2) throws Exception
+   {
+      throw new WriteOnlyCacheLoaderException("The method 'put(Fqn arg0, Object arg1, Object arg2)' should not be called.");
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   public void remove(Fqn arg0) throws Exception
+   {
+      throw new WriteOnlyCacheLoaderException("The method 'remove(Fqn arg0)' should not be called.");
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   public Object remove(Fqn arg0, Object arg1) throws Exception
+   {
+      throw new WriteOnlyCacheLoaderException("The method 'remove(Fqn arg0, Object arg1)' should not be called.");
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   public void removeData(Fqn arg0) throws Exception
+   {
+      throw new WriteOnlyCacheLoaderException("The method 'removeData(Fqn arg0)' should not be called.");
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   public void setConfig(IndividualCacheLoaderConfig config)
+   {
+     this.config = config;
+   }
+   
+   /**
+    * That method should be override in other loaders (indexer, lock, observation).  
+    */
+   public abstract void put(List<Modification> modifications) throws Exception ;
+
+}


Property changes on: jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/AbstractWriteOnlyCacheLoader.java
___________________________________________________________________
Name: svn:keywords
   + Id
Name: svn:eol-style
   + native

Added: jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/WriteOnlyCacheLoaderException.java
===================================================================
--- jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/WriteOnlyCacheLoaderException.java	                        (rev 0)
+++ jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/WriteOnlyCacheLoaderException.java	2009-11-06 09:36:42 UTC (rev 476)
@@ -0,0 +1,48 @@
+package org.exoplatform.services.jcr.impl.storage.jbosscache;
+
+public class WriteOnlyCacheLoaderException
+   extends Exception
+{
+   /**
+    * Constructs an Exception without a message.
+    */
+   public WriteOnlyCacheLoaderException()
+   {
+      super();
+   }
+
+   /**
+    * Constructs an Exception with a detailed message.
+    * 
+    * @param Message
+    *          The message associated with the exception.
+    */
+   public WriteOnlyCacheLoaderException(String message)
+   {
+      super(message);
+   }
+
+   /**
+   * Constructs an Exception with a detailed message and base exception.
+   * 
+   * @param Message
+   *          The message associated with the exception.
+   * @param cause
+   *          Throwable, the base exception.
+   */
+   public WriteOnlyCacheLoaderException(String message, Throwable cause)
+   {
+      super(message, cause);
+   }
+
+   /**
+    * WriteOnlyCacheLoaderException constructor.
+    *
+    * @param cause
+    *         Throwable, the base exception.
+    */
+   public WriteOnlyCacheLoaderException(Throwable cause)
+   {
+      super(cause);
+   }
+}


Property changes on: jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/WriteOnlyCacheLoaderException.java
___________________________________________________________________
Name: svn:keywords
   + Id
Name: svn:eol-style
   + native



More information about the exo-jcr-commits mailing list