mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-14 17:58:59 +00:00
ALF-12866: remove repository's dependency on remote-api.
* A dependency of the repository project on the remote-api project had crept in. * The dependency was stopping junit tests from being run in the Eclipse, since it does not define a dependency on remote-api by repository. git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@34213 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -33,7 +33,7 @@ import java.util.concurrent.locks.ReentrantReadWriteLock;
|
||||
* @author Ivan Rybnikov
|
||||
*
|
||||
*/
|
||||
public final class LockInfo implements Serializable
|
||||
public final class LockInfoImpl implements Serializable, LockInfo
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@@ -61,7 +61,7 @@ public final class LockInfo implements Serializable
|
||||
* Default constructor
|
||||
*
|
||||
*/
|
||||
public LockInfo()
|
||||
public LockInfoImpl()
|
||||
{
|
||||
}
|
||||
|
||||
@@ -72,7 +72,7 @@ public final class LockInfo implements Serializable
|
||||
* @param scope Lock scope (shared/exclusive)
|
||||
* @param depth Lock depth (0/infinity)
|
||||
*/
|
||||
public LockInfo(String token, String scope, String depth)
|
||||
public LockInfoImpl(String token, String scope, String depth)
|
||||
{
|
||||
this.exclusiveLockToken = token;
|
||||
this.scope = scope;
|
||||
@@ -88,6 +88,7 @@ public final class LockInfo implements Serializable
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public ReentrantReadWriteLock getRWLock()
|
||||
{
|
||||
return rwLock;
|
||||
@@ -98,6 +99,7 @@ public final class LockInfo implements Serializable
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
@Override
|
||||
public boolean isLocked()
|
||||
{
|
||||
return (isExclusive() || isShared());
|
||||
@@ -108,6 +110,7 @@ public final class LockInfo implements Serializable
|
||||
*
|
||||
* @param token Lock token
|
||||
*/
|
||||
@Override
|
||||
public void setExclusiveLockToken(String token)
|
||||
{
|
||||
this.exclusiveLockToken = token;
|
||||
@@ -118,6 +121,7 @@ public final class LockInfo implements Serializable
|
||||
*
|
||||
* @return String
|
||||
*/
|
||||
@Override
|
||||
public String getExclusiveLockToken()
|
||||
{
|
||||
checkLockState();
|
||||
@@ -129,6 +133,7 @@ public final class LockInfo implements Serializable
|
||||
*
|
||||
* @param scope
|
||||
*/
|
||||
@Override
|
||||
public void setScope(String scope)
|
||||
{
|
||||
this.scope = scope;
|
||||
@@ -139,6 +144,7 @@ public final class LockInfo implements Serializable
|
||||
*
|
||||
* @return lock scope
|
||||
*/
|
||||
@Override
|
||||
public String getScope()
|
||||
{
|
||||
return scope == null ? WebDAV.XML_EXCLUSIVE : scope;
|
||||
@@ -149,6 +155,7 @@ public final class LockInfo implements Serializable
|
||||
*
|
||||
* @param depth lock depth
|
||||
*/
|
||||
@Override
|
||||
public void setDepth(String depth)
|
||||
{
|
||||
this.depth = depth;
|
||||
@@ -159,6 +166,7 @@ public final class LockInfo implements Serializable
|
||||
*
|
||||
* @return lock depth
|
||||
*/
|
||||
@Override
|
||||
public String getDepth()
|
||||
{
|
||||
return depth;
|
||||
@@ -169,6 +177,7 @@ public final class LockInfo implements Serializable
|
||||
*
|
||||
* @return LinkedList<String>
|
||||
*/
|
||||
@Override
|
||||
public Set<String> getSharedLockTokens()
|
||||
{
|
||||
checkLockState();
|
||||
@@ -180,6 +189,7 @@ public final class LockInfo implements Serializable
|
||||
*
|
||||
* @param sharedLockTokens
|
||||
*/
|
||||
@Override
|
||||
public void setSharedLockTokens(Set<String> sharedLockTokens)
|
||||
{
|
||||
this.sharedLockTokens.clear();
|
||||
@@ -191,6 +201,7 @@ public final class LockInfo implements Serializable
|
||||
*
|
||||
* @param token The token to add.
|
||||
*/
|
||||
@Override
|
||||
public void addSharedLockToken(String token)
|
||||
{
|
||||
sharedLockTokens.add(token);
|
||||
@@ -201,6 +212,7 @@ public final class LockInfo implements Serializable
|
||||
*
|
||||
* @return true if shared.
|
||||
*/
|
||||
@Override
|
||||
public boolean isShared()
|
||||
{
|
||||
return (!sharedLockTokens.isEmpty());
|
||||
@@ -212,6 +224,7 @@ public final class LockInfo implements Serializable
|
||||
*
|
||||
* @return String
|
||||
*/
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
StringBuilder str = new StringBuilder();
|
||||
@@ -242,6 +255,7 @@ public final class LockInfo implements Serializable
|
||||
*
|
||||
* @return true if expired.
|
||||
*/
|
||||
@Override
|
||||
public boolean isExpired()
|
||||
{
|
||||
if (expires == null)
|
||||
@@ -257,6 +271,7 @@ public final class LockInfo implements Serializable
|
||||
*
|
||||
* @return true if exclusive.
|
||||
*/
|
||||
@Override
|
||||
public boolean isExclusive()
|
||||
{
|
||||
return (exclusiveLockToken != null && exclusiveLockToken.length() > 0);
|
||||
@@ -267,6 +282,7 @@ public final class LockInfo implements Serializable
|
||||
*
|
||||
* @return the owner
|
||||
*/
|
||||
@Override
|
||||
public String getOwner()
|
||||
{
|
||||
return owner;
|
||||
@@ -277,6 +293,7 @@ public final class LockInfo implements Serializable
|
||||
*
|
||||
* @param owner Owner's username
|
||||
*/
|
||||
@Override
|
||||
public void setOwner(String owner)
|
||||
{
|
||||
this.owner = owner;
|
||||
@@ -287,6 +304,7 @@ public final class LockInfo implements Serializable
|
||||
*
|
||||
* @param expires the expires to set
|
||||
*/
|
||||
@Override
|
||||
public void setExpires(Date expires)
|
||||
{
|
||||
this.expires = expires;
|
||||
@@ -297,6 +315,7 @@ public final class LockInfo implements Serializable
|
||||
*
|
||||
* @return the expires
|
||||
*/
|
||||
@Override
|
||||
public Date getExpires()
|
||||
{
|
||||
return expires;
|
||||
@@ -319,6 +338,7 @@ public final class LockInfo implements Serializable
|
||||
*
|
||||
* @param lockTimeout
|
||||
*/
|
||||
@Override
|
||||
public void setTimeoutSeconds(int lockTimeout)
|
||||
{
|
||||
if (lockTimeout == WebDAV.TIMEOUT_INFINITY)
|
@@ -56,7 +56,7 @@ public class LockMethod extends WebDAVMethod
|
||||
|
||||
protected int m_timeoutDuration = WebDAV.TIMEOUT_INFINITY;
|
||||
|
||||
protected LockInfo lockInfo = new LockInfo();
|
||||
protected LockInfo lockInfo = new LockInfoImpl();
|
||||
|
||||
protected boolean createExclusive;
|
||||
|
||||
|
@@ -1,64 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2012 Alfresco Software Limited.
|
||||
*
|
||||
* This file is part of Alfresco
|
||||
*
|
||||
* Alfresco 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 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Alfresco 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 Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.alfresco.repo.webdav;
|
||||
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
|
||||
/**
|
||||
* Provides storage for WebDAV {@link LockInfo lock information}.
|
||||
* <p>
|
||||
* Note: the existence of LockInfo does NOT mean that a node is necessarily locked. It may have timed-out,
|
||||
* been unlocked, or be left in an invalid state for some reason. The LockInfo is a record of a requested lock -
|
||||
* the actual values should be examined as necessary.
|
||||
* <p>
|
||||
* Implementations of this interface should be fast, ideally an in-memory map. Implementations should also be thread-
|
||||
* and cluster-safe.
|
||||
*
|
||||
* @author Matt Ward
|
||||
*/
|
||||
public interface LockStore
|
||||
{
|
||||
/**
|
||||
* Provide LockInfo about a specific node to the LockStore.
|
||||
*
|
||||
* @param nodeToLock
|
||||
* @param lockInfo
|
||||
*/
|
||||
void put(NodeRef nodeToLock, LockInfo lockInfo);
|
||||
|
||||
/**
|
||||
* Retrieves LockInfo for as given nodeRef. The LockInfo may specify that a node is
|
||||
* <strong>NOT</strong> locked, so the LockInfo should always be checked for validity.
|
||||
* <p>
|
||||
* The presence of LockInfo does not imply that a node is locked.
|
||||
*
|
||||
* @param nodeRef
|
||||
* @return
|
||||
*/
|
||||
LockInfo get(NodeRef nodeRef);
|
||||
|
||||
|
||||
/**
|
||||
* Remove LockInfo for the specified NodeRef. The LockInfo cannot be considered locked
|
||||
* once removed from the LockStore.
|
||||
*
|
||||
* @param nodeRef
|
||||
*/
|
||||
void remove(NodeRef nodeRef);
|
||||
}
|
@@ -1,30 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2012 Alfresco Software Limited.
|
||||
*
|
||||
* This file is part of Alfresco
|
||||
*
|
||||
* Alfresco 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 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Alfresco 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 Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.alfresco.repo.webdav;
|
||||
|
||||
|
||||
/**
|
||||
* Factory to create {@link LockStore} instances.
|
||||
*
|
||||
* @author Matt Ward
|
||||
*/
|
||||
public interface LockStoreFactory
|
||||
{
|
||||
LockStore getLockStore();
|
||||
}
|
@@ -1,54 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2012 Alfresco Software Limited.
|
||||
*
|
||||
* This file is part of Alfresco
|
||||
*
|
||||
* Alfresco 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 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Alfresco 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 Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.alfresco.repo.webdav;
|
||||
|
||||
import java.util.concurrent.ConcurrentMap;
|
||||
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
|
||||
import com.hazelcast.core.HazelcastInstance;
|
||||
|
||||
|
||||
/**
|
||||
* Default implementation of the {@link LockStoreFactory} interface. Creates {@link LockStore}s
|
||||
* backed by a Hazelcast distributed {@link java.util.Map Map}.
|
||||
*
|
||||
* @see LockStoreFactory
|
||||
* @see LockStoreImpl
|
||||
* @author Matt Ward
|
||||
*/
|
||||
public class LockStoreFactoryImpl implements LockStoreFactory
|
||||
{
|
||||
private HazelcastInstance hazelcast;
|
||||
|
||||
@Override
|
||||
public LockStore getLockStore()
|
||||
{
|
||||
ConcurrentMap<NodeRef, LockInfo> map = hazelcast.getMap("webdav-locks");
|
||||
return new LockStoreImpl(map);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param hazelcast the hazelcast to set
|
||||
*/
|
||||
public void setHazelcast(HazelcastInstance hazelcast)
|
||||
{
|
||||
this.hazelcast = hazelcast;
|
||||
}
|
||||
}
|
@@ -1,59 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2012 Alfresco Software Limited.
|
||||
*
|
||||
* This file is part of Alfresco
|
||||
*
|
||||
* Alfresco 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 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Alfresco 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 Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.alfresco.repo.webdav;
|
||||
|
||||
import java.util.concurrent.ConcurrentMap;
|
||||
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
|
||||
|
||||
/**
|
||||
* The default {@link LockStore} implementation. This is based upon a ConcurrentMap intended to be supplied by
|
||||
* Hazelcast (or a similar, distributed data structure library).
|
||||
*
|
||||
* @see LockStore
|
||||
* @author Matt Ward
|
||||
*/
|
||||
public class LockStoreImpl implements LockStore
|
||||
{
|
||||
private final ConcurrentMap<NodeRef, LockInfo> lockInfoMap;
|
||||
|
||||
public LockStoreImpl(ConcurrentMap<NodeRef, LockInfo> lockInfoMap)
|
||||
{
|
||||
this.lockInfoMap = lockInfoMap;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void put(NodeRef nodeToLock, LockInfo lockInfo)
|
||||
{
|
||||
lockInfoMap.put(nodeToLock, lockInfo);
|
||||
}
|
||||
|
||||
@Override
|
||||
public LockInfo get(NodeRef nodeRef)
|
||||
{
|
||||
return lockInfoMap.get(nodeRef);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void remove(NodeRef nodeRef)
|
||||
{
|
||||
lockInfoMap.remove(nodeRef);
|
||||
}
|
||||
}
|
@@ -1161,7 +1161,7 @@ public abstract class WebDAVMethod
|
||||
if (parent == null)
|
||||
{
|
||||
// Node has no lock and Lock token
|
||||
return new LockInfo();
|
||||
return new LockInfoImpl();
|
||||
}
|
||||
|
||||
lockInfo = m_parentLockInfo.get(parent);
|
||||
@@ -1196,7 +1196,7 @@ public abstract class WebDAVMethod
|
||||
{
|
||||
if (lockInfo == null)
|
||||
{
|
||||
lockInfo = new LockInfo();
|
||||
lockInfo = new LockInfoImpl();
|
||||
}
|
||||
// temporarily cache - for this request
|
||||
m_parentLockInfo.put(parent, lockInfo);
|
||||
|
Reference in New Issue
Block a user