[exo-jcr-commits] exo-jcr SVN: r1413 - in jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core: lock and 1 other directories.

do-not-reply at jboss.org do-not-reply at jboss.org
Fri Jan 15 09:36:43 EST 2010


Author: areshetnyak
Date: 2010-01-15 09:36:43 -0500 (Fri, 15 Jan 2010)
New Revision: 1413

Added:
   jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/AbstractLockManager.java
Modified:
   jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionImpl.java
   jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/LockManagerImpl.java
   jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/jbosscache/CacheableLockManager.java
Log:
EXOJCR-332 : The CacheLockImpl was changed.

Modified: jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionImpl.java
===================================================================
--- jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionImpl.java	2010-01-15 14:32:01 UTC (rev 1412)
+++ jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionImpl.java	2010-01-15 14:36:43 UTC (rev 1413)
@@ -31,7 +31,7 @@
 import org.exoplatform.services.jcr.datamodel.NodeData;
 import org.exoplatform.services.jcr.datamodel.QPathEntry;
 import org.exoplatform.services.jcr.impl.Constants;
-import org.exoplatform.services.jcr.impl.core.lock.LockManagerImpl;
+import org.exoplatform.services.jcr.impl.core.lock.AbstractLockManager;
 import org.exoplatform.services.jcr.impl.core.nodetype.NodeTypeImpl;
 import org.exoplatform.services.jcr.impl.core.observation.ObservationManagerImpl;
 import org.exoplatform.services.jcr.impl.core.observation.ObservationManagerRegistry;
@@ -120,7 +120,7 @@
 
    private final LocationFactory systemLocationFactory;
 
-   private final LockManagerImpl lockManager;
+   private final AbstractLockManager lockManager;
 
    protected final String workspaceName;
 
@@ -156,7 +156,7 @@
       this.systemLocationFactory = (LocationFactory)container.getComponentInstanceOfType(LocationFactory.class);
 
       this.accessManager = (AccessManager)container.getComponentInstanceOfType(AccessManager.class);
-      this.lockManager = (LockManagerImpl)container.getComponentInstanceOfType(LockManagerImpl.class);
+      this.lockManager = (AbstractLockManager)container.getComponentInstanceOfType(AbstractLockManager.class);
       WorkspaceEntry wsConfig = (WorkspaceEntry)container.getComponentInstanceOfType(WorkspaceEntry.class);
 
       this.lazyReadThreshold =
@@ -551,7 +551,7 @@
       return locationFactory;
    }
 
-   public LockManagerImpl getLockManager()
+   public AbstractLockManager getLockManager()
    {
       return lockManager;
    }

Added: jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/AbstractLockManager.java
===================================================================
--- jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/AbstractLockManager.java	                        (rev 0)
+++ jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/AbstractLockManager.java	2010-01-15 14:36:43 UTC (rev 1413)
@@ -0,0 +1,90 @@
+/*
+ * Copyright (C) 2003-2010 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.core.lock;
+
+import javax.jcr.RepositoryException;
+import javax.jcr.lock.Lock;
+import javax.jcr.lock.LockException;
+
+import org.exoplatform.services.jcr.core.ExtendedSession;
+import org.exoplatform.services.jcr.core.SessionLifecycleListener;
+import org.exoplatform.services.jcr.datamodel.NodeData;
+import org.exoplatform.services.jcr.impl.core.NodeImpl;
+
+/**
+ * Created by The eXo Platform SAS.
+ * 
+ * <br/>Date: 2010
+ *
+ * @author <a href="mailto:alex.reshetnyak at exoplatform.com.ua">Alex Reshetnyak</a> 
+ * @version $Id$
+ */
+public abstract class AbstractLockManager implements SessionLifecycleListener, LockManager
+{
+
+   /**
+    * {@inheritDoc}
+    */
+   public abstract void onCloseSession(ExtendedSession session);
+
+   /**
+    * {@inheritDoc}
+    */
+   public abstract void addLockToken(String sessionId, String lt);
+
+   /**
+    * {@inheritDoc}
+    */
+   public abstract Lock addPendingLock(NodeImpl node, boolean isDeep, boolean isSessionScoped, long timeOut)
+            throws LockException, RepositoryException;
+
+   /**
+    * {@inheritDoc}
+    */
+   public abstract LockImpl getLock(NodeImpl node) throws LockException, RepositoryException;
+
+   /**
+    * {@inheritDoc}
+    */
+   public abstract String[] getLockTokens(String sessionID);
+
+   /**
+    * {@inheritDoc}
+    */
+   public abstract boolean holdsLock(NodeData node) throws RepositoryException;
+
+   /**
+    * {@inheritDoc}
+    */
+   public abstract boolean isLockHolder(NodeImpl node) throws RepositoryException;
+
+   /**
+    * {@inheritDoc}
+    */
+   public abstract boolean isLocked(NodeData node);
+
+   /**
+    * {@inheritDoc}
+    */
+   public abstract void removeExpired();
+
+   /**
+    * {@inheritDoc}
+    */
+   public abstract void removeLockToken(String sessionId, String lt);
+
+}


Property changes on: jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/AbstractLockManager.java
___________________________________________________________________
Name: svn:keywords
   + Id
Name: svn:eol-style
   + native

Modified: jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/LockManagerImpl.java
===================================================================
--- jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/LockManagerImpl.java	2010-01-15 14:32:01 UTC (rev 1412)
+++ jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/LockManagerImpl.java	2010-01-15 14:36:43 UTC (rev 1413)
@@ -18,6 +18,21 @@
  */
 package org.exoplatform.services.jcr.impl.core.lock;
 
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import javax.jcr.AccessDeniedException;
+import javax.jcr.RepositoryException;
+import javax.jcr.UnsupportedRepositoryOperationException;
+import javax.jcr.lock.Lock;
+import javax.jcr.lock.LockException;
+
 import org.exoplatform.management.annotations.Managed;
 import org.exoplatform.management.annotations.ManagedDescription;
 import org.exoplatform.management.jmx.annotations.NameTemplate;
@@ -25,7 +40,6 @@
 import org.exoplatform.services.jcr.access.SystemIdentity;
 import org.exoplatform.services.jcr.config.WorkspaceEntry;
 import org.exoplatform.services.jcr.core.ExtendedSession;
-import org.exoplatform.services.jcr.core.SessionLifecycleListener;
 import org.exoplatform.services.jcr.dataflow.ChangesLogIterator;
 import org.exoplatform.services.jcr.dataflow.CompositeChangesLog;
 import org.exoplatform.services.jcr.dataflow.DataManager;
@@ -52,21 +66,6 @@
 import org.exoplatform.services.log.Log;
 import org.picocontainer.Startable;
 
-import java.io.IOException;
-import java.io.UnsupportedEncodingException;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-import javax.jcr.AccessDeniedException;
-import javax.jcr.RepositoryException;
-import javax.jcr.UnsupportedRepositoryOperationException;
-import javax.jcr.lock.Lock;
-import javax.jcr.lock.LockException;
-
 /**
  * Created by The eXo Platform SAS.
  * 
@@ -75,7 +74,7 @@
  */
 @Managed
 @NameTemplate(@Property(key = "service", value = "lockmanager"))
-public class LockManagerImpl implements ItemsPersistenceListener, SessionLifecycleListener, LockManager, Startable
+public class LockManagerImpl extends AbstractLockManager implements ItemsPersistenceListener, Startable
 {
    /**
     * Default lock time out. 30min

Modified: jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/jbosscache/CacheableLockManager.java
===================================================================
--- jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/jbosscache/CacheableLockManager.java	2010-01-15 14:32:01 UTC (rev 1412)
+++ jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/jbosscache/CacheableLockManager.java	2010-01-15 14:36:43 UTC (rev 1413)
@@ -16,6 +16,23 @@
  */
 package org.exoplatform.services.jcr.impl.core.lock.jbosscache;
 
+import java.io.Serializable;
+import java.math.BigInteger;
+import java.security.MessageDigest;
+import java.security.NoSuchAlgorithmException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import javax.jcr.AccessDeniedException;
+import javax.jcr.RepositoryException;
+import javax.jcr.UnsupportedRepositoryOperationException;
+import javax.jcr.lock.Lock;
+import javax.jcr.lock.LockException;
+
 import org.exoplatform.management.annotations.Managed;
 import org.exoplatform.management.annotations.ManagedDescription;
 import org.exoplatform.management.jmx.annotations.NameTemplate;
@@ -32,6 +49,7 @@
 import org.exoplatform.services.jcr.dataflow.PlainChangesLog;
 import org.exoplatform.services.jcr.dataflow.PlainChangesLogImpl;
 import org.exoplatform.services.jcr.dataflow.TransactionChangesLog;
+import org.exoplatform.services.jcr.dataflow.persistent.ItemsPersistenceListener;
 import org.exoplatform.services.jcr.datamodel.ItemData;
 import org.exoplatform.services.jcr.datamodel.NodeData;
 import org.exoplatform.services.jcr.datamodel.PropertyData;
@@ -39,8 +57,8 @@
 import org.exoplatform.services.jcr.impl.Constants;
 import org.exoplatform.services.jcr.impl.core.NodeImpl;
 import org.exoplatform.services.jcr.impl.core.SessionImpl;
+import org.exoplatform.services.jcr.impl.core.lock.AbstractLockManager;
 import org.exoplatform.services.jcr.impl.core.lock.LockImpl;
-import org.exoplatform.services.jcr.impl.core.lock.LockManagerImpl;
 import org.exoplatform.services.jcr.impl.core.lock.LockPersister;
 import org.exoplatform.services.jcr.impl.core.lock.LockRemover;
 import org.exoplatform.services.jcr.impl.dataflow.TransientItemData;
@@ -55,24 +73,8 @@
 import org.jboss.cache.DefaultCacheFactory;
 import org.jboss.cache.Fqn;
 import org.jboss.cache.Node;
+import org.picocontainer.Startable;
 
-import java.io.Serializable;
-import java.math.BigInteger;
-import java.security.MessageDigest;
-import java.security.NoSuchAlgorithmException;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import javax.jcr.AccessDeniedException;
-import javax.jcr.RepositoryException;
-import javax.jcr.UnsupportedRepositoryOperationException;
-import javax.jcr.lock.Lock;
-import javax.jcr.lock.LockException;
-
 /**
  * Created by The eXo Platform SAS.
  * 
@@ -83,7 +85,7 @@
  */
 @Managed
 @NameTemplate(@Property(key = "service", value = "lockmanager"))
-public class CacheableLockManager extends LockManagerImpl
+public class CacheableLockManager extends AbstractLockManager implements ItemsPersistenceListener, Startable
 {
    /**
     * Default lock time out. 30min
@@ -164,7 +166,6 @@
    public CacheableLockManager(WorkspacePersistentDataManager dataManager, WorkspaceEntry config,
       LockPersister persister) throws RepositoryConfigurationException
    {
-      super(dataManager, config, null);
       this.dataManager = dataManager;
       if (config.getLockManager() != null)
       {
@@ -177,7 +178,7 @@
       lockTokenHolders = new HashMap<String, Set<String>>();
       pendingLocks = new HashMap<String, LockData>();
 
-      // dataManager.addItemPersistenceListener(this);
+      dataManager.addItemPersistenceListener(this);
 
       // make cache
       if (config.getLockManager() != null && config.getLockManager().getCacheConfig() != null)



More information about the exo-jcr-commits mailing list