exo-jcr SVN: r3477 - in jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr: impl/core and 2 other directories.
by do-not-reply@jboss.org
Author: tolusha
Date: 2010-11-18 04:35:51 -0500 (Thu, 18 Nov 2010)
New Revision: 3477
Modified:
jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/access/AccessControlList.java
jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/NodeImpl.java
jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionDataManager.java
jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/CacheableWorkspaceDataManager.java
jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/JBossCacheWorkspaceStorageCache.java
Log:
JCR-1505: Avoid iterating over a List thanks to its iterator when it is possible
Modified: jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/access/AccessControlList.java
===================================================================
--- jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/access/AccessControlList.java 2010-11-18 09:32:30 UTC (rev 3476)
+++ jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/access/AccessControlList.java 2010-11-18 09:35:51 UTC (rev 3477)
@@ -159,8 +159,9 @@
public List<AccessControlEntry> getPermissionEntries()
{
List<AccessControlEntry> list = new ArrayList<AccessControlEntry>();
- for (AccessControlEntry entry : accessList)
+ for (int i = 0, length = accessList.size(); i < length; i++)
{
+ AccessControlEntry entry = accessList.get(i);
list.add(new AccessControlEntry(entry.getIdentity(), entry.getPermission()));
}
return list;
@@ -169,8 +170,9 @@
public List<String> getPermissions(String identity)
{
List<String> permissions = new ArrayList<String>();
- for (AccessControlEntry entry : accessList)
+ for (int i = 0, length = accessList.size(); i < length; i++)
{
+ AccessControlEntry entry = accessList.get(i);
if (entry.getIdentity().equals(identity))
permissions.add(entry.getPermission());
}
Modified: jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/NodeImpl.java
===================================================================
--- jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/NodeImpl.java 2010-11-18 09:32:30 UTC (rev 3476)
+++ jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/NodeImpl.java 2010-11-18 09:35:51 UTC (rev 3477)
@@ -981,8 +981,9 @@
{
// full iterator
List<NodeImpl> nodes = new ArrayList<NodeImpl>();
- for (NodeData child : childs)
+ for (int i = 0, length = childs.size(); i < length; i++)
{
+ NodeData child = childs.get(i);
if (session.getAccessManager().hasPermission(child.getACL(), new String[]{PermissionType.READ},
session.getUserState().getIdentity()))
{
@@ -1032,8 +1033,9 @@
{
// full iterator
List<NodeImpl> nodes = new ArrayList<NodeImpl>();
- for (NodeData child : childs)
+ for (int i = 0, length = childs.size(); i < length; i++)
{
+ NodeData child = childs.get(i);
if (filter.accept(child)
&& session.getAccessManager().hasPermission(child.getACL(), new String[]{PermissionType.READ},
session.getUserState().getIdentity()))
@@ -1129,8 +1131,9 @@
{
// full iterator
List<PropertyImpl> props = new ArrayList<PropertyImpl>();
- for (PropertyData child : childs)
+ for (int i = 0, length = childs.size(); i < length; i++)
{
+ PropertyData child = childs.get(i);
PropertyImpl item = (PropertyImpl)dataManager.readItem(child, nodeData(), true, false);
session.getActionHandler().postRead(item);
props.add(item);
@@ -1185,8 +1188,9 @@
{
// full iterator
List<PropertyImpl> props = new ArrayList<PropertyImpl>();
- for (PropertyData child : childs)
+ for (int i = 0, length = childs.size(); i < length; i++)
{
+ PropertyData child = childs.get(i);
if (filter.accept(child))
{
PropertyImpl item = (PropertyImpl)dataManager.readItem(child, nodeData(), true, false);
Modified: jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionDataManager.java
===================================================================
--- jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionDataManager.java 2010-11-18 09:32:30 UTC (rev 3476)
+++ jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionDataManager.java 2010-11-18 09:35:51 UTC (rev 3477)
@@ -672,8 +672,9 @@
{
List<PropertyData> refDatas = transactionableManager.getReferencesData(identifier, true);
List<PropertyImpl> refs = new ArrayList<PropertyImpl>(refDatas.size());
- for (PropertyData data : refDatas)
+ for (int i = 0, length = refDatas.size(); i < length; i++)
{
+ PropertyData data = refDatas.get(i);
ItemState state = changesLog.getItemState(data.getIdentifier());
if (state != null)
{
@@ -1959,8 +1960,9 @@
if (action != MERGE_PROPS)
{
List<NodeData> childNodes = dataManager.getChildNodesData((NodeData)parent);
- for (NodeData childNode : childNodes)
+ for (int i = 0, length = childNodes.size(); i < length; i++)
{
+ NodeData childNode = childNodes.get(i);
ret.put(childNode.getIdentifier(), childNode);
}
}
@@ -1969,8 +1971,9 @@
List<PropertyData> childProps =
listOnly ? dataManager.listChildPropertiesData((NodeData)parent) : dataManager
.getChildPropertiesData((NodeData)parent);
- outer : for (PropertyData childProp : childProps)
+ outer : for (int i = 0, length = childProps.size(); i < length; i++)
{
+ PropertyData childProp = childProps.get(i);
for (ItemState transientState : transientDescendants)
{
if (!transientState.isNode() && !transientState.isDeleted()
Modified: jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/CacheableWorkspaceDataManager.java
===================================================================
--- jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/CacheableWorkspaceDataManager.java 2010-11-18 09:32:30 UTC (rev 3476)
+++ jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/CacheableWorkspaceDataManager.java 2010-11-18 09:35:51 UTC (rev 3477)
@@ -34,7 +34,6 @@
import org.exoplatform.services.transaction.TransactionService;
import java.util.ArrayList;
-import java.util.Iterator;
import java.util.List;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
@@ -491,11 +490,9 @@
if (skipVersionStorage)
{
List<PropertyData> result = new ArrayList<PropertyData>();
-
- Iterator<PropertyData> iterator = props.iterator();
- while (iterator.hasNext())
+ for (int i = 0, length = props.size(); i < length; i++)
{
- PropertyData prop = iterator.next();
+ PropertyData prop = props.get(i);
if (!prop.getQPath().isDescendantOf(Constants.JCR_VERSION_STORAGE_PATH))
{
result.add(prop);
Modified: jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/JBossCacheWorkspaceStorageCache.java
===================================================================
--- jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/JBossCacheWorkspaceStorageCache.java 2010-11-18 09:32:30 UTC (rev 3476)
+++ jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/JBossCacheWorkspaceStorageCache.java 2010-11-18 09:35:51 UTC (rev 3477)
@@ -511,9 +511,11 @@
return null;
}
- // add property as many times as has referenced values
- for (ValueData vdata : prop.getValues())
+ // add property as many times as has referenced values
+ List<ValueData> lData = prop.getValues();
+ for (int i = 0, length = lData.size(); i < length; i++)
{
+ ValueData vdata = lData.get(i);
try
{
if (new String(vdata.getAsByteArray(), Constants.DEFAULT_ENCODING).equals(identifier))
@@ -999,8 +1001,10 @@
// add referenced property
if (modifyListsOfChild != ModifyChildOption.NOT_MODIFY && prop.getType() == PropertyType.REFERENCE)
{
- for (ValueData vdata : prop.getValues())
+ List<ValueData> lData = prop.getValues();
+ for (int i = 0, length = lData.size(); i < length; i++)
{
+ ValueData vdata = lData.get(i);
String nodeIdentifier = null;
try
{
15 years, 6 months
exo-jcr SVN: r3476 - in jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr: impl/core and 1 other directories.
by do-not-reply@jboss.org
Author: tolusha
Date: 2010-11-18 04:32:30 -0500 (Thu, 18 Nov 2010)
New Revision: 3476
Modified:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/access/AccessControlList.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/NodeImpl.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionDataManager.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/CacheableWorkspaceDataManager.java
Log:
JCR-1505: Avoid iterating over a List thanks to its iterator when it is possible
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/access/AccessControlList.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/access/AccessControlList.java 2010-11-17 15:40:05 UTC (rev 3475)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/access/AccessControlList.java 2010-11-18 09:32:30 UTC (rev 3476)
@@ -159,8 +159,9 @@
public List<AccessControlEntry> getPermissionEntries()
{
List<AccessControlEntry> list = new ArrayList<AccessControlEntry>();
- for (AccessControlEntry entry : accessList)
+ for (int i = 0, length = accessList.size(); i < length; i++)
{
+ AccessControlEntry entry = accessList.get(i);
list.add(new AccessControlEntry(entry.getIdentity(), entry.getPermission()));
}
return list;
@@ -169,8 +170,9 @@
public List<String> getPermissions(String identity)
{
List<String> permissions = new ArrayList<String>();
- for (AccessControlEntry entry : accessList)
+ for (int i = 0, length = accessList.size(); i < length; i++)
{
+ AccessControlEntry entry = accessList.get(i);
if (entry.getIdentity().equals(identity))
permissions.add(entry.getPermission());
}
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/NodeImpl.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/NodeImpl.java 2010-11-17 15:40:05 UTC (rev 3475)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/NodeImpl.java 2010-11-18 09:32:30 UTC (rev 3476)
@@ -1046,8 +1046,9 @@
{
// full iterator
List<NodeImpl> nodes = new ArrayList<NodeImpl>();
- for (NodeData child : childs)
+ for (int i = 0, length = childs.size(); i < length; i++)
{
+ NodeData child = childs.get(i);
if (session.getAccessManager().hasPermission(child.getACL(), new String[]{PermissionType.READ},
session.getUserState().getIdentity()))
{
@@ -1097,8 +1098,9 @@
{
// full iterator
List<NodeImpl> nodes = new ArrayList<NodeImpl>();
- for (NodeData child : childs)
+ for (int i = 0, length = childs.size(); i < length; i++)
{
+ NodeData child = childs.get(i);
if (filter.accept(child)
&& session.getAccessManager().hasPermission(child.getACL(), new String[]{PermissionType.READ},
session.getUserState().getIdentity()))
@@ -1198,8 +1200,9 @@
{
// full iterator
List<PropertyImpl> props = new ArrayList<PropertyImpl>();
- for (PropertyData child : childs)
+ for (int i = 0, length = childs.size(); i < length; i++)
{
+ PropertyData child = childs.get(i);
PropertyImpl item = (PropertyImpl)dataManager.readItem(child, nodeData(), true, false);
session.getActionHandler().postRead(item);
props.add(item);
@@ -1254,8 +1257,9 @@
{
// full iterator
List<PropertyImpl> props = new ArrayList<PropertyImpl>();
- for (PropertyData child : childs)
+ for (int i = 0, length = childs.size(); i < length; i++)
{
+ PropertyData child = childs.get(i);
if (filter.accept(child))
{
PropertyImpl item = (PropertyImpl)dataManager.readItem(child, nodeData(), true, false);
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionDataManager.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionDataManager.java 2010-11-17 15:40:05 UTC (rev 3475)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionDataManager.java 2010-11-18 09:32:30 UTC (rev 3476)
@@ -792,8 +792,9 @@
{
List<PropertyData> refDatas = transactionableManager.getReferencesData(identifier, true);
List<PropertyImpl> refs = new ArrayList<PropertyImpl>(refDatas.size());
- for (PropertyData data : refDatas)
+ for (int i = 0, length = refDatas.size(); i < length; i++)
{
+ PropertyData data = refDatas.get(i);
ItemState state = changesLog.getItemState(data.getIdentifier());
if (state != null)
{
@@ -2082,8 +2083,9 @@
if (action != MERGE_PROPS)
{
List<NodeData> childNodes = dataManager.getChildNodesData((NodeData)parent);
- for (NodeData childNode : childNodes)
+ for (int i = 0, length = childNodes.size(); i < length; i++)
{
+ NodeData childNode = childNodes.get(i);
ret.put(childNode.getIdentifier(), childNode);
}
}
@@ -2092,8 +2094,9 @@
List<PropertyData> childProps =
listOnly ? dataManager.listChildPropertiesData((NodeData)parent) : dataManager
.getChildPropertiesData((NodeData)parent);
- outer : for (PropertyData childProp : childProps)
+ outer : for (int i = 0, length = childProps.size(); i < length; i++)
{
+ PropertyData childProp = childProps.get(i);
for (ItemState transientState : transientDescendants)
{
if (!transientState.isNode() && !transientState.isDeleted()
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/CacheableWorkspaceDataManager.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/CacheableWorkspaceDataManager.java 2010-11-17 15:40:05 UTC (rev 3475)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/CacheableWorkspaceDataManager.java 2010-11-18 09:32:30 UTC (rev 3476)
@@ -38,7 +38,6 @@
import org.exoplatform.services.transaction.TransactionService;
import java.util.ArrayList;
-import java.util.Iterator;
import java.util.List;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
@@ -537,11 +536,9 @@
if (skipVersionStorage)
{
List<PropertyData> result = new ArrayList<PropertyData>();
-
- Iterator<PropertyData> iterator = props.iterator();
- while (iterator.hasNext())
+ for (int i = 0, length = props.size(); i < length; i++)
{
- PropertyData prop = iterator.next();
+ PropertyData prop = props.get(i);
if (!prop.getQPath().isDescendantOf(Constants.JCR_VERSION_STORAGE_PATH))
{
result.add(prop);
15 years, 6 months
exo-jcr SVN: r3475 - in jcr/branches/1.12.x/exo.jcr.component.core/src: main/java/org/exoplatform/services/jcr/impl/core/version and 2 other directories.
by do-not-reply@jboss.org
Author: tolusha
Date: 2010-11-17 10:40:05 -0500 (Wed, 17 Nov 2010)
New Revision: 3475
Modified:
jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/ScratchWorkspaceInitializer.java
jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/version/FrozenNodeInitializer.java
jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/TransientNodeData.java
jcr/branches/1.12.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/access/TestPermissions.java
Log:
JCR-1509: fix issue with ACL inconsistence when node have been put to version storage
Modified: jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/ScratchWorkspaceInitializer.java
===================================================================
--- jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/ScratchWorkspaceInitializer.java 2010-11-17 15:29:19 UTC (rev 3474)
+++ jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/ScratchWorkspaceInitializer.java 2010-11-17 15:40:05 UTC (rev 3475)
@@ -21,6 +21,7 @@
import org.exoplatform.services.jcr.access.AccessControlEntry;
import org.exoplatform.services.jcr.access.AccessControlList;
import org.exoplatform.services.jcr.access.AccessControlPolicy;
+import org.exoplatform.services.jcr.access.PermissionType;
import org.exoplatform.services.jcr.access.SystemIdentity;
import org.exoplatform.services.jcr.config.RepositoryConfigurationException;
import org.exoplatform.services.jcr.config.RepositoryEntry;
@@ -326,16 +327,49 @@
}
// init version storage
+ AccessControlList acl = new AccessControlList();
+ acl.removePermissions(SystemIdentity.ANY);
+ acl.addPermissions(SystemIdentity.ANY, new String[]{PermissionType.READ});
+
+ for (AccessControlEntry entry : jcrSystem.getACL().getPermissionEntries())
+ {
+ String identity = entry.getIdentity();
+ String permission = entry.getPermission();
+
+ if (!identity.equals(SystemIdentity.ANY) || !permission.equals(PermissionType.READ))
+ {
+ acl.addPermissions(identity, new String[]{permission});
+ }
+ }
+
TransientNodeData versionStorageNodeData =
TransientNodeData.createNodeData(jcrSystem, Constants.JCR_VERSIONSTORAGE, Constants.EXO_VERSIONSTORAGE,
- Constants.VERSIONSTORAGE_UUID);
+ Constants.VERSIONSTORAGE_UUID, acl);
TransientPropertyData vsPrimaryType =
TransientPropertyData.createPropertyData(versionStorageNodeData, Constants.JCR_PRIMARYTYPE, PropertyType.NAME,
false, new TransientValueData(versionStorageNodeData.getPrimaryTypeName()));
- changesLog.add(ItemState.createAddedState(versionStorageNodeData)).add(ItemState.createAddedState(vsPrimaryType));
+ TransientPropertyData exoMixinTypes =
+ TransientPropertyData.createPropertyData(versionStorageNodeData, Constants.JCR_MIXINTYPES, PropertyType.NAME,
+ true, new TransientValueData(Constants.EXO_PRIVILEGEABLE));
+ List<ValueData> permsValues = new ArrayList<ValueData>();
+ for (int i = 0; i < acl.getPermissionEntries().size(); i++)
+ {
+ AccessControlEntry entry = acl.getPermissionEntries().get(i);
+ permsValues.add(new TransientValueData(entry));
+ }
+ TransientPropertyData exoPerms =
+ TransientPropertyData.createPropertyData(versionStorageNodeData, Constants.EXO_PERMISSIONS,
+ ExtendedPropertyType.PERMISSION, true, permsValues);
+
+ changesLog.add(ItemState.createAddedState(versionStorageNodeData));
+ changesLog.add(ItemState.createAddedState(vsPrimaryType));
+ changesLog.add(ItemState.createAddedState(exoMixinTypes));
+ changesLog.add(ItemState.createAddedState(exoPerms));
+ changesLog.add(new ItemState(versionStorageNodeData, ItemState.MIXIN_CHANGED, false, null));
+
dataManager.save(new TransactionChangesLog(changesLog));
return jcrSystem;
Modified: jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/version/FrozenNodeInitializer.java
===================================================================
--- jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/version/FrozenNodeInitializer.java 2010-11-17 15:29:19 UTC (rev 3474)
+++ jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/version/FrozenNodeInitializer.java 2010-11-17 15:40:05 UTC (rev 3475)
@@ -18,6 +18,7 @@
*/
package org.exoplatform.services.jcr.impl.core.version;
+import org.exoplatform.services.jcr.access.AccessControlList;
import org.exoplatform.services.jcr.core.nodetype.NodeDefinitionData;
import org.exoplatform.services.jcr.core.nodetype.NodeTypeDataManager;
import org.exoplatform.services.jcr.core.nodetype.PropertyDefinitionData;
@@ -249,12 +250,15 @@
}
else if (action == OnParentVersionAction.COPY)
{
+ AccessControlList acl =
+ ntManager.isNodeType(Constants.EXO_PRIVILEGEABLE, node.getPrimaryTypeName(), node.getMixinTypeNames())
+ ? node.getACL() : currentNode().getACL();
QPath frozenPath = QPath.makeChildPath(currentNode().getQPath(), qname, node.getQPath().getIndex());
frozenNode =
new TransientNodeData(frozenPath, IdGenerator.generate(), node.getPersistedVersion(), node
.getPrimaryTypeName(), node.getMixinTypeNames(), node.getOrderNumber(), currentNode().getIdentifier(), // parent
- node.getACL());
+ acl);
contextNodes.push(frozenNode);
changesLog.add(ItemState.createAddedState(frozenNode));
@@ -286,12 +290,16 @@
}
else
{ // behaviour of COPY
+ AccessControlList acl =
+ ntManager.isNodeType(Constants.EXO_PRIVILEGEABLE, node.getPrimaryTypeName(), node.getMixinTypeNames())
+ ? node.getACL() : currentNode().getACL();
+
QPath frozenPath = QPath.makeChildPath(currentNode().getQPath(), qname, node.getQPath().getIndex());
frozenNode =
new TransientNodeData(frozenPath, IdGenerator.generate(), node.getPersistedVersion(), node
.getPrimaryTypeName(), node.getMixinTypeNames(), node.getOrderNumber(),
currentNode().getIdentifier(), // parent
- node.getACL());
+ acl);
contextNodes.push(frozenNode);
changesLog.add(ItemState.createAddedState(frozenNode));
Modified: jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/TransientNodeData.java
===================================================================
--- jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/TransientNodeData.java 2010-11-17 15:29:19 UTC (rev 3474)
+++ jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/TransientNodeData.java 2010-11-17 15:40:05 UTC (rev 3475)
@@ -239,6 +239,27 @@
return nodeData;
}
+ /**
+ * Factory method
+ *
+ * @param parent NodeData
+ * @param name InternalQName
+ * @param primaryTypeName InternalQName
+ * @param identifier String
+ * @param acl AccessControlList
+ * @return
+ */
+ public static TransientNodeData createNodeData(NodeData parent, InternalQName name, InternalQName primaryTypeName,
+ String identifier, AccessControlList acl)
+ {
+ TransientNodeData nodeData = null;
+ QPath path = QPath.makeChildPath(parent.getQPath(), name);
+ nodeData =
+ new TransientNodeData(path, identifier, -1, primaryTypeName, new InternalQName[0], 0, parent.getIdentifier(),
+ acl);
+ return nodeData;
+ }
+
// ------------- Comparable /////
public int compareTo(Object obj)
@@ -254,6 +275,7 @@
this.acl = new AccessControlList();
}
+ @Override
public void writeExternal(ObjectOutput out) throws IOException
{
super.writeExternal(out);
@@ -277,6 +299,7 @@
acl.writeExternal(out);
}
+ @Override
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
{
super.readExternal(in);
Modified: jcr/branches/1.12.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/access/TestPermissions.java
===================================================================
--- jcr/branches/1.12.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/access/TestPermissions.java 2010-11-17 15:29:19 UTC (rev 3474)
+++ jcr/branches/1.12.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/access/TestPermissions.java 2010-11-17 15:40:05 UTC (rev 3475)
@@ -90,6 +90,17 @@
@Override
public void tearDown() throws Exception
{
+ if (sessionWS1.getRootNode().hasNode("MARY-ReadOnly"))
+ {
+ sessionWS1.getRootNode().getNode("MARY-ReadOnly").remove();
+ }
+
+ if (sessionWS1.getRootNode().hasNode("MARY-ReadWrite"))
+ {
+ sessionWS1.getRootNode().getNode("MARY-ReadWrite").remove();
+ }
+ sessionWS1.save();
+
sessionMaryWS.logout();
sessionMaryWS1.logout();
sessionWS.logout();
@@ -247,4 +258,42 @@
{
}
}
+
+ public void testAccessPermission() throws Exception
+ {
+ // At creation time
+ NodeImpl node = (NodeImpl)sessionWS1.getRootNode().addNode("testAccessPermission");
+ node.addMixin("mix:versionable");
+ sessionWS1.save();
+ node.addMixin("exo:privilegeable");
+ node.getSession().save();
+ node.setPermission("admin", new String[]{"read", "add_node", "set_property", "remove"});
+ node.removePermission(SystemIdentity.ANY);
+ NodeImpl subNode = (NodeImpl)node.addNode("subNode");
+ node.getSession().save();
+ node.checkin();
+ node.setPermission(SystemIdentity.ANY, new String[]{"read"});
+ node.getSession().save();
+ SessionImpl sessionJohnWS1 = null;
+
+ try
+ {
+ Credentials credentials = new CredentialsImpl("john", "exo".toCharArray());
+ sessionJohnWS1 = (SessionImpl)repositoryService.getRepository("db2").login(credentials, "ws1");
+ Node vNode = sessionJohnWS1.getRootNode().getNode("testAccessPermission");
+ assertNotNull(vNode);
+ vNode = vNode.getVersionHistory().getVersion("1");
+ assertNotNull(vNode);
+ vNode = vNode.getNode("jcr:frozenNode");
+ assertNotNull(vNode);
+ assertNotNull(vNode.getNode("subNode"));
+ }
+ finally
+ {
+ if (sessionJohnWS1 != null)
+ {
+ sessionJohnWS1.logout();
+ }
+ }
+ }
}
15 years, 6 months
exo-jcr SVN: r3474 - in jcr/trunk/exo.jcr.component.core/src: main/java/org/exoplatform/services/jcr/impl/core/version and 2 other directories.
by do-not-reply@jboss.org
Author: tolusha
Date: 2010-11-17 10:29:19 -0500 (Wed, 17 Nov 2010)
New Revision: 3474
Modified:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/ScratchWorkspaceInitializer.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/version/FrozenNodeInitializer.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/TransientNodeData.java
jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/access/TestPermissions.java
Log:
EXOJCR-1061: fix issue with ACL inconsistence when node have been put to version storage
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/ScratchWorkspaceInitializer.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/ScratchWorkspaceInitializer.java 2010-11-17 14:24:34 UTC (rev 3473)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/ScratchWorkspaceInitializer.java 2010-11-17 15:29:19 UTC (rev 3474)
@@ -21,6 +21,7 @@
import org.exoplatform.services.jcr.access.AccessControlEntry;
import org.exoplatform.services.jcr.access.AccessControlList;
import org.exoplatform.services.jcr.access.AccessControlPolicy;
+import org.exoplatform.services.jcr.access.PermissionType;
import org.exoplatform.services.jcr.access.SystemIdentity;
import org.exoplatform.services.jcr.config.RepositoryConfigurationException;
import org.exoplatform.services.jcr.config.RepositoryEntry;
@@ -326,16 +327,49 @@
}
// init version storage
+ AccessControlList acl = new AccessControlList();
+ acl.removePermissions(SystemIdentity.ANY);
+ acl.addPermissions(SystemIdentity.ANY, new String[]{PermissionType.READ});
+
+ for (AccessControlEntry entry : jcrSystem.getACL().getPermissionEntries())
+ {
+ String identity = entry.getIdentity();
+ String permission = entry.getPermission();
+
+ if (!identity.equals(SystemIdentity.ANY) || !permission.equals(PermissionType.READ))
+ {
+ acl.addPermissions(identity, new String[]{permission});
+ }
+ }
+
TransientNodeData versionStorageNodeData =
TransientNodeData.createNodeData(jcrSystem, Constants.JCR_VERSIONSTORAGE, Constants.EXO_VERSIONSTORAGE,
- Constants.VERSIONSTORAGE_UUID);
+ Constants.VERSIONSTORAGE_UUID, acl);
TransientPropertyData vsPrimaryType =
TransientPropertyData.createPropertyData(versionStorageNodeData, Constants.JCR_PRIMARYTYPE, PropertyType.NAME,
false, new TransientValueData(versionStorageNodeData.getPrimaryTypeName()));
- changesLog.add(ItemState.createAddedState(versionStorageNodeData)).add(ItemState.createAddedState(vsPrimaryType));
+ TransientPropertyData exoMixinTypes =
+ TransientPropertyData.createPropertyData(versionStorageNodeData, Constants.JCR_MIXINTYPES, PropertyType.NAME,
+ true, new TransientValueData(Constants.EXO_PRIVILEGEABLE));
+ List<ValueData> permsValues = new ArrayList<ValueData>();
+ for (int i = 0; i < acl.getPermissionEntries().size(); i++)
+ {
+ AccessControlEntry entry = acl.getPermissionEntries().get(i);
+ permsValues.add(new TransientValueData(entry));
+ }
+ TransientPropertyData exoPerms =
+ TransientPropertyData.createPropertyData(versionStorageNodeData, Constants.EXO_PERMISSIONS,
+ ExtendedPropertyType.PERMISSION, true, permsValues);
+
+ changesLog.add(ItemState.createAddedState(versionStorageNodeData));
+ changesLog.add(ItemState.createAddedState(vsPrimaryType));
+ changesLog.add(ItemState.createAddedState(exoMixinTypes));
+ changesLog.add(ItemState.createAddedState(exoPerms));
+ changesLog.add(new ItemState(versionStorageNodeData, ItemState.MIXIN_CHANGED, false, null));
+
dataManager.save(new TransactionChangesLog(changesLog));
return jcrSystem;
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/version/FrozenNodeInitializer.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/version/FrozenNodeInitializer.java 2010-11-17 14:24:34 UTC (rev 3473)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/version/FrozenNodeInitializer.java 2010-11-17 15:29:19 UTC (rev 3474)
@@ -18,6 +18,7 @@
*/
package org.exoplatform.services.jcr.impl.core.version;
+import org.exoplatform.services.jcr.access.AccessControlList;
import org.exoplatform.services.jcr.core.nodetype.NodeDefinitionData;
import org.exoplatform.services.jcr.core.nodetype.NodeTypeDataManager;
import org.exoplatform.services.jcr.core.nodetype.PropertyDefinitionData;
@@ -249,12 +250,15 @@
}
else if (action == OnParentVersionAction.COPY)
{
+ AccessControlList acl =
+ ntManager.isNodeType(Constants.EXO_PRIVILEGEABLE, node.getPrimaryTypeName(), node.getMixinTypeNames())
+ ? node.getACL() : currentNode().getACL();
QPath frozenPath = QPath.makeChildPath(currentNode().getQPath(), qname, node.getQPath().getIndex());
frozenNode =
new TransientNodeData(frozenPath, IdGenerator.generate(), node.getPersistedVersion(), node
.getPrimaryTypeName(), node.getMixinTypeNames(), node.getOrderNumber(), currentNode().getIdentifier(), // parent
- node.getACL());
+ acl);
contextNodes.push(frozenNode);
changesLog.add(ItemState.createAddedState(frozenNode));
@@ -286,12 +290,16 @@
}
else
{ // behaviour of COPY
+ AccessControlList acl =
+ ntManager.isNodeType(Constants.EXO_PRIVILEGEABLE, node.getPrimaryTypeName(), node.getMixinTypeNames())
+ ? node.getACL() : currentNode().getACL();
+
QPath frozenPath = QPath.makeChildPath(currentNode().getQPath(), qname, node.getQPath().getIndex());
frozenNode =
new TransientNodeData(frozenPath, IdGenerator.generate(), node.getPersistedVersion(), node
.getPrimaryTypeName(), node.getMixinTypeNames(), node.getOrderNumber(),
currentNode().getIdentifier(), // parent
- node.getACL());
+ acl);
contextNodes.push(frozenNode);
changesLog.add(ItemState.createAddedState(frozenNode));
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/TransientNodeData.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/TransientNodeData.java 2010-11-17 14:24:34 UTC (rev 3473)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/TransientNodeData.java 2010-11-17 15:29:19 UTC (rev 3474)
@@ -239,6 +239,27 @@
return nodeData;
}
+ /**
+ * Factory method
+ *
+ * @param parent NodeData
+ * @param name InternalQName
+ * @param primaryTypeName InternalQName
+ * @param identifier String
+ * @param acl AccessControlList
+ * @return
+ */
+ public static TransientNodeData createNodeData(NodeData parent, InternalQName name, InternalQName primaryTypeName,
+ String identifier, AccessControlList acl)
+ {
+ TransientNodeData nodeData = null;
+ QPath path = QPath.makeChildPath(parent.getQPath(), name);
+ nodeData =
+ new TransientNodeData(path, identifier, -1, primaryTypeName, new InternalQName[0], 0, parent.getIdentifier(),
+ acl);
+ return nodeData;
+ }
+
// ------------- Comparable /////
public int compareTo(Object obj)
@@ -254,6 +275,7 @@
this.acl = new AccessControlList();
}
+ @Override
public void writeExternal(ObjectOutput out) throws IOException
{
super.writeExternal(out);
@@ -277,6 +299,7 @@
acl.writeExternal(out);
}
+ @Override
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
{
super.readExternal(in);
Modified: jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/access/TestPermissions.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/access/TestPermissions.java 2010-11-17 14:24:34 UTC (rev 3473)
+++ jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/access/TestPermissions.java 2010-11-17 15:29:19 UTC (rev 3474)
@@ -100,6 +100,17 @@
@Override
public void tearDown() throws Exception
{
+ if (sessionWS1.getRootNode().hasNode("MARY-ReadOnly"))
+ {
+ sessionWS1.getRootNode().getNode("MARY-ReadOnly").remove();
+ }
+
+ if (sessionWS1.getRootNode().hasNode("MARY-ReadWrite"))
+ {
+ sessionWS1.getRootNode().getNode("MARY-ReadWrite").remove();
+ }
+ sessionWS1.save();
+
sessionMaryWS.logout();
sessionMaryWS1.logout();
sessionWS.logout();
@@ -257,4 +268,42 @@
{
}
}
+
+ public void testAccessPermission() throws Exception
+ {
+ // At creation time
+ NodeImpl node = (NodeImpl)sessionWS1.getRootNode().addNode("testAccessPermission");
+ node.addMixin("mix:versionable");
+ sessionWS1.save();
+ node.addMixin("exo:privilegeable");
+ node.getSession().save();
+ node.setPermission("admin", new String[]{"read", "add_node", "set_property", "remove"});
+ node.removePermission(SystemIdentity.ANY);
+ NodeImpl subNode = (NodeImpl)node.addNode("subNode");
+ node.getSession().save();
+ node.checkin();
+ node.setPermission(SystemIdentity.ANY, new String[]{"read"});
+ node.getSession().save();
+ SessionImpl sessionJohnWS1 = null;
+
+ try
+ {
+ Credentials credentials = new CredentialsImpl("john", "exo".toCharArray());
+ sessionJohnWS1 = (SessionImpl)repositoryService.getRepository("db2").login(credentials, "ws1");
+ Node vNode = sessionJohnWS1.getRootNode().getNode("testAccessPermission");
+ assertNotNull(vNode);
+ vNode = vNode.getVersionHistory().getVersion("1");
+ assertNotNull(vNode);
+ vNode = vNode.getNode("jcr:frozenNode");
+ assertNotNull(vNode);
+ assertNotNull(vNode.getNode("subNode"));
+ }
+ finally
+ {
+ if (sessionJohnWS1 != null)
+ {
+ sessionJohnWS1.logout();
+ }
+ }
+ }
}
15 years, 6 months
exo-jcr SVN: r3473 - in jcr/branches/1.12.x: exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/command and 4 other directories.
by do-not-reply@jboss.org
Author: dkuleshov
Date: 2010-11-17 09:24:34 -0500 (Wed, 17 Nov 2010)
New Revision: 3473
Modified:
jcr/branches/1.12.x/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/WebDavServiceImpl.java
jcr/branches/1.12.x/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/command/GetCommand.java
jcr/branches/1.12.x/exo.jcr.component.webdav/src/main/resources/xslt/get-method.xsl
jcr/branches/1.12.x/exo.jcr.component.webdav/src/test/java/org/exoplatform/services/jcr/webdav/command/TestGet.java
jcr/branches/1.12.x/exo.jcr.component.webdav/src/test/resources/conf/standalone/test-configuration.xml
jcr/branches/1.12.x/exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docbook/en-US/modules/jcr/protocols/webdav.xml
Log:
JCR-1511: modified WebDavServiceImpl to receive folde-icon-path init param, and to pass it to GetCommand
Modified: jcr/branches/1.12.x/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/WebDavServiceImpl.java
===================================================================
--- jcr/branches/1.12.x/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/WebDavServiceImpl.java 2010-11-17 14:18:55 UTC (rev 3472)
+++ jcr/branches/1.12.x/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/WebDavServiceImpl.java 2010-11-17 14:24:34 UTC (rev 3473)
@@ -75,6 +75,7 @@
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
+import java.util.Map;
import javax.jcr.NoSuchWorkspaceException;
import javax.jcr.PathNotFoundException;
@@ -136,6 +137,8 @@
private HashMap<MediaType, String> cacheControlMap = new HashMap<MediaType, String>();
+ public static final String FOLDER_ICON_PATH = "folder-icon-path";
+
/**
* Logger.
*/
@@ -182,6 +185,11 @@
private String autoVersionType = "checkout-checkin";
/**
+ * XSLT parameters.
+ */
+ private Map<String, String> xsltParams = new HashMap<String, String>();
+
+ /**
* The list of allowed methods.
*/
private static final String ALLOW;
@@ -222,6 +230,13 @@
this.repositoryService = repositoryService;
this.nullResourceLocks = new NullResourceLocksHolder();
+ ValueParam pXSLTParam = params.getValueParam(FOLDER_ICON_PATH);
+ if (pXSLTParam != null)
+ {
+ xsltParams.put(FOLDER_ICON_PATH, pXSLTParam.getValue());
+ log.info(FOLDER_ICON_PATH + " = " + pXSLTParam.getValue());
+ }
+
ValueParam pDefFolderNodeType = params.getValueParam(INIT_PARAM_DEF_FOLDER_NODE_TYPE);
if (pDefFolderNodeType != null)
{
@@ -545,7 +560,8 @@
String uri =
uriInfo.getBaseUriBuilder().path(getClass()).path(repoName).path(workspaceName(repoPath)).build()
.toString();
- return new GetCommand().get(session, path(repoPath), version, uri, ranges, ifModifiedSince, cacheControlMap);
+ return new GetCommand(xsltParams).get(session, path(repoPath), version, uri, ranges, ifModifiedSince,
+ cacheControlMap);
}
catch (PathNotFoundException exc)
Modified: jcr/branches/1.12.x/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/command/GetCommand.java
===================================================================
--- jcr/branches/1.12.x/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/command/GetCommand.java 2010-11-17 14:18:55 UTC (rev 3472)
+++ jcr/branches/1.12.x/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/command/GetCommand.java 2010-11-17 14:24:34 UTC (rev 3473)
@@ -18,26 +18,6 @@
*/
package org.exoplatform.services.jcr.webdav.command;
-import java.io.InputStream;
-import java.net.URI;
-import java.text.DateFormat;
-import java.text.SimpleDateFormat;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Locale;
-
-import javax.jcr.Node;
-import javax.jcr.PathNotFoundException;
-import javax.jcr.RepositoryException;
-import javax.jcr.Session;
-import javax.ws.rs.core.HttpHeaders;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
-import javax.xml.transform.stream.StreamSource;
-
import org.exoplatform.common.http.HTTPStatus;
import org.exoplatform.common.util.HierarchicalProperty;
import org.exoplatform.services.jcr.webdav.Range;
@@ -59,6 +39,27 @@
import org.exoplatform.services.rest.ext.provider.XSLTStreamingOutput;
import org.exoplatform.services.rest.impl.header.MediaTypeHelper;
+import java.io.InputStream;
+import java.net.URI;
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+
+import javax.jcr.Node;
+import javax.jcr.PathNotFoundException;
+import javax.jcr.RepositoryException;
+import javax.jcr.Session;
+import javax.ws.rs.core.HttpHeaders;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+import javax.xml.transform.stream.StreamSource;
+
/**
* Created by The eXo Platform SAS Author : <a
* href="gavrikvetal(a)gmail.com">Vitaly Guly</a>.
@@ -74,6 +75,17 @@
*/
private static Log log = ExoLogger.getLogger("exo.jcr.component.webdav.GetCommand");
+ private Map<String, String> xsltParams;
+
+ public GetCommand()
+ {
+ }
+
+ public GetCommand(Map<String, String> xsltParams)
+ {
+ this.xsltParams = xsltParams;
+ }
+
/**
* GET content of the resource. Can be return content of the file. The content
* returns in the XML type. If version parameter is present, returns the
@@ -206,8 +218,8 @@
resource = new CollectionResource(uri, node, nsContext);
istream = ((CollectionResource)resource).getContentAsStream(baseURI);
- XSLTStreamingOutput entity = new XSLTStreamingOutput("get.method.template", new StreamSource(istream));
-
+ XSLTStreamingOutput entity =
+ new XSLTStreamingOutput("get.method.template", new StreamSource(istream), xsltParams);
return Response.ok(entity, MediaType.TEXT_HTML).build();
}
Modified: jcr/branches/1.12.x/exo.jcr.component.webdav/src/main/resources/xslt/get-method.xsl
===================================================================
--- jcr/branches/1.12.x/exo.jcr.component.webdav/src/main/resources/xslt/get-method.xsl 2010-11-17 14:18:55 UTC (rev 3472)
+++ jcr/branches/1.12.x/exo.jcr.component.webdav/src/main/resources/xslt/get-method.xsl 2010-11-17 14:24:34 UTC (rev 3473)
@@ -2,6 +2,7 @@
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:sv="http://www.jcp.org/jcr/sv/1.0" xmlns:xlink="http://www.w3.org/1999/xlink"
exclude-result-prefixes="xlink">
<xsl:output method="html" encoding="UTF-8" />
+ <xsl:param name="folder-icon-path"></xsl:param>
<xsl:template match="/sv:node">
<html>
<head>
@@ -27,7 +28,9 @@
<xsl:attribute name="href">
<xsl:value-of select="substring(./@xlink:href, 1, string-length(./@xlink:href) - string-length(./@sv:name))" />
</xsl:attribute>
- <img src="/ecm/skin/icons/16x16/NodeTypes/DefaultSkin/nt-folder.gif" alt="" />
+ <xsl:if test="$folder-icon-path!=''">
+ <img src="{$folder-icon-path}" alt="" />
+ </xsl:if>
<xsl:text> ..</xsl:text>
</a>
<br />
@@ -50,9 +53,11 @@
<xsl:template match="sv:node">
<a>
<xsl:attribute name="href">
- <xsl:value-of select="./@xlink:href" />
- </xsl:attribute>
- <img src="/ecm/skin/icons/16x16/NodeTypes/DefaultSkin/nt-folder.gif" alt="" />
+ <xsl:value-of select="./@xlink:href" />
+ </xsl:attribute>
+ <xsl:if test="$folder-icon-path!=''">
+ <img src="{$folder-icon-path}" alt="" />
+ </xsl:if>
<xsl:text> </xsl:text>
<xsl:value-of select="./@sv:name" />
</a>
Modified: jcr/branches/1.12.x/exo.jcr.component.webdav/src/test/java/org/exoplatform/services/jcr/webdav/command/TestGet.java
===================================================================
--- jcr/branches/1.12.x/exo.jcr.component.webdav/src/test/java/org/exoplatform/services/jcr/webdav/command/TestGet.java 2010-11-17 14:18:55 UTC (rev 3472)
+++ jcr/branches/1.12.x/exo.jcr.component.webdav/src/test/java/org/exoplatform/services/jcr/webdav/command/TestGet.java 2010-11-17 14:24:34 UTC (rev 3473)
@@ -18,7 +18,21 @@
*/
package org.exoplatform.services.jcr.webdav.command;
+import org.exoplatform.common.http.HTTPStatus;
+import org.exoplatform.services.jcr.core.nodetype.ExtendedNodeTypeManager;
+import org.exoplatform.services.jcr.core.nodetype.NodeTypeDataManager;
+import org.exoplatform.services.jcr.impl.core.version.VersionImpl;
+import org.exoplatform.services.jcr.webdav.BaseStandaloneTest;
+import org.exoplatform.services.jcr.webdav.WebDavConst;
+import org.exoplatform.services.jcr.webdav.WebDavConstants.WebDAVMethods;
+import org.exoplatform.services.jcr.webdav.utils.TestUtils;
+import org.exoplatform.services.rest.ExtHttpHeaders;
+import org.exoplatform.services.rest.ext.provider.XSLTStreamingOutput;
+import org.exoplatform.services.rest.impl.ContainerResponse;
+import org.exoplatform.services.rest.impl.MultivaluedMapImpl;
+
import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;
@@ -32,18 +46,6 @@
import javax.jcr.Node;
import javax.ws.rs.core.MultivaluedMap;
-import org.exoplatform.common.http.HTTPStatus;
-import org.exoplatform.services.jcr.core.nodetype.ExtendedNodeTypeManager;
-import org.exoplatform.services.jcr.core.nodetype.NodeTypeDataManager;
-import org.exoplatform.services.jcr.impl.core.version.VersionImpl;
-import org.exoplatform.services.jcr.webdav.BaseStandaloneTest;
-import org.exoplatform.services.jcr.webdav.WebDavConst;
-import org.exoplatform.services.jcr.webdav.WebDavConstants.WebDAVMethods;
-import org.exoplatform.services.jcr.webdav.utils.TestUtils;
-import org.exoplatform.services.rest.ExtHttpHeaders;
-import org.exoplatform.services.rest.impl.ContainerResponse;
-import org.exoplatform.services.rest.impl.MultivaluedMapImpl;
-
/**
* Created by The eXo Platform SAS Author : Dmytro Katayev
* work.visor.ck(a)gmail.com Aug 13, 2008
@@ -173,6 +175,25 @@
assertEquals(HTTPStatus.NOT_MODIFIED, response.getStatus());
}
+ public void testXSLTParamsPassing() throws Exception
+ {
+ String strToTest = "/absolute/path/to/file";
+ String folderName = TestUtils.getFolderName();
+ TestUtils.addFolder(session, folderName, defaultFolderNodeType, "");
+ ContainerResponse response = service(WebDAVMethods.GET, getPathWS() + folderName, "", null, null);
+
+ assertEquals(HTTPStatus.OK, response.getStatus());
+
+ XSLTStreamingOutput XSLTout = (XSLTStreamingOutput)response.getEntity();
+ ByteArrayOutputStream BAOS = new ByteArrayOutputStream();
+ XSLTout.write(BAOS);
+
+ System.out.println("\n" + BAOS.toString() + "\n");
+
+ assertTrue(BAOS.toString().contains(strToTest));
+
+ }
+
@Override
protected String getRepositoryName()
{
Modified: jcr/branches/1.12.x/exo.jcr.component.webdav/src/test/resources/conf/standalone/test-configuration.xml
===================================================================
--- jcr/branches/1.12.x/exo.jcr.component.webdav/src/test/resources/conf/standalone/test-configuration.xml 2010-11-17 14:18:55 UTC (rev 3472)
+++ jcr/branches/1.12.x/exo.jcr.component.webdav/src/test/resources/conf/standalone/test-configuration.xml 2010-11-17 14:24:34 UTC (rev 3473)
@@ -1,13 +1,24 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
- <!--
+<!--
+ Copyright (C) 2009 eXo Platform SAS.
- Copyright (C) 2009 eXo Platform SAS. 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.
- -->
+ 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.
+
+-->
+
<configuration xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.exoplaform.org/xml/ns/kernel_1_0.xsd http://www.exoplaform.org/xml/ns/kernel_1_0.xsd"
xmlns="http://www.exoplaform.org/xml/ns/kernel_1_0.xsd">
<component>
@@ -193,6 +204,11 @@
<value>text/xml,text/html:max-age=1800;text/*:max-age=777;image/png,image/jpg:max-age=3600;*/*:no-cache;image/*:max-age=555</value>
</value-param>
+ <value-param>
+ <name>folder-icon-path</name>
+ <value>/absolute/path/to/file</value>
+ </value-param>
+
</init-params>
</component>
Modified: jcr/branches/1.12.x/exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docbook/en-US/modules/jcr/protocols/webdav.xml
===================================================================
--- jcr/branches/1.12.x/exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docbook/en-US/modules/jcr/protocols/webdav.xml 2010-11-17 14:18:55 UTC (rev 3472)
+++ jcr/branches/1.12.x/exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docbook/en-US/modules/jcr/protocols/webdav.xml 2010-11-17 14:24:34 UTC (rev 3473)
@@ -142,6 +142,15 @@
<name>cache-control</name>
<value>text/xml,text/html:max-age=3600;image/png,image/jpg:max-age=1800;*/*:no-cache;</value>
</value-param>
+
+ <!--
+ This parameter determines the absolute path to the folder icon file, which is shown
+ during WebDAV view of the contents
+ -->
+ <value-param>
+ <name>folder-icon-path</name>
+ <value>/absolute/path/to/file</value>
+ </value-param>
</init-params
</component></programlisting>
15 years, 6 months
exo-jcr SVN: r3472 - ws/branches/2.1.x/exo.ws.rest.ext/src/main/java/org/exoplatform/services/rest/ext/provider.
by do-not-reply@jboss.org
Author: dkuleshov
Date: 2010-11-17 09:18:55 -0500 (Wed, 17 Nov 2010)
New Revision: 3472
Modified:
ws/branches/2.1.x/exo.ws.rest.ext/src/main/java/org/exoplatform/services/rest/ext/provider/XSLTStreamingOutput.java
Log:
JCR-151: added XSLTStreamingOutput constructor to pass an XSLT parameters Map
Modified: ws/branches/2.1.x/exo.ws.rest.ext/src/main/java/org/exoplatform/services/rest/ext/provider/XSLTStreamingOutput.java
===================================================================
--- ws/branches/2.1.x/exo.ws.rest.ext/src/main/java/org/exoplatform/services/rest/ext/provider/XSLTStreamingOutput.java 2010-11-17 13:40:14 UTC (rev 3471)
+++ ws/branches/2.1.x/exo.ws.rest.ext/src/main/java/org/exoplatform/services/rest/ext/provider/XSLTStreamingOutput.java 2010-11-17 14:18:55 UTC (rev 3472)
@@ -28,6 +28,7 @@
import java.io.IOException;
import java.io.OutputStream;
+import java.util.Map;
import javax.ws.rs.WebApplicationException;
import javax.ws.rs.core.StreamingOutput;
@@ -51,6 +52,8 @@
private Source source;
+ private Map<String, String> xsltParams;
+
/**
* XSLTStreamingOutput constructor.
*
@@ -68,6 +71,21 @@
}
/**
+ * XSLTStreamingOutput constructor.
+ *
+ * @param schemeName XLST scheme name. Must be registered in
+ * {@link org.exoplatform.services.xml.transform.impl.trax.TRAXTemplatesLoaderPlugin
+ * TRAXTemplatesLoaderPlugin }
+ * @param source entity to write into output stream.
+ * @param xsltParams XSLT parameters
+ */
+ public XSLTStreamingOutput(String schemeName, Source source, Map<String, String> xsltParams)
+ {
+ this(schemeName, source);
+ this.xsltParams = xsltParams;
+ }
+
+ /**
* {@inheritDoc} .
*/
public void write(OutputStream outStream) throws IOException, WebApplicationException
@@ -97,6 +115,13 @@
throw new NullPointerException(msg);
}
transformer.initResult(new StreamResult(outStream));
+ if (xsltParams != null)
+ {
+ for (Map.Entry<String, String> e : xsltParams.entrySet())
+ {
+ transformer.setParameter(e.getKey(), e.getValue());
+ }
+ }
transformer.transform(source);
}
catch (TransformerConfigurationException tce)
15 years, 6 months
exo-jcr SVN: r3471 - in jcr/branches/1.12.x: exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl and 19 other directories.
by do-not-reply@jboss.org
Author: tolusha
Date: 2010-11-17 08:40:14 -0500 (Wed, 17 Nov 2010)
New Revision: 3471
Added:
jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/LockRemoverHolder.java
jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/proccess/WorkerService.java
jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/util/io/FileCleanerHolder.java
Modified:
jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/config/RepositoryInfo.java
jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/RepositoryContainer.java
jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/BackupWorkspaceInitializer.java
jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionImpl.java
jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SysViewWorkspaceInitializer.java
jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/LockManagerImpl.java
jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/LockRemover.java
jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/jbosscache/CacheableLockManagerImpl.java
jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/jbosscache/jdbc/CacheableJDBCLockManagerImpl.java
jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/value/ValueFactoryImpl.java
jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCWorkspaceDataContainer.java
jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/CQJDBCWorkspaceDataContainer.java
jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/value/StandaloneStoragePluginProvider.java
jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/value/fs/CASableSimpleFileValueStorage.java
jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/value/fs/CASableTreeFileValueStorage.java
jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/value/fs/FileValueStorage.java
jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/value/fs/SimpleFileValueStorage.java
jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/value/fs/TreeFileValueStorage.java
jcr/branches/1.12.x/exo.jcr.component.core/src/main/resources/binding.xml
jcr/branches/1.12.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/BaseStandaloneTest.java
jcr/branches/1.12.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/storage/JDBCWDCTest.java
jcr/branches/1.12.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/storage/value/fs/CASableFileIOChannelTestBase.java
jcr/branches/1.12.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/storage/value/fs/TestFileIOChannel.java
jcr/branches/1.12.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/value/TestPersistedValueData.java
jcr/branches/1.12.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/value/TestTransientValueData.java
jcr/branches/1.12.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/value/TestValueImpl.java
jcr/branches/1.12.x/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/replication/ReplicationService.java
jcr/branches/1.12.x/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/BaseStandaloneTest.java
jcr/branches/1.12.x/exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docbook/en-US/modules/jcr/configuration/exo-jcr-configuration.xml
Log:
JCR-1488: Limit the total amount of WorkerThreads
Modified: jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/config/RepositoryInfo.java
===================================================================
--- jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/config/RepositoryInfo.java 2010-11-17 13:02:14 UTC (rev 3470)
+++ jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/config/RepositoryInfo.java 2010-11-17 13:40:14 UTC (rev 3471)
@@ -46,6 +46,8 @@
protected long sessionTimeOut;
+ protected int lockRemoverMaxThreadCount;
+
public RepositoryInfo()
{
@@ -190,17 +192,43 @@
}
/**
+ * Returns LockRemovers per-repository max threads count.
+ * @return LockRemovers per-repository max threads count
+ */
+ public int getLockRemoverThreadsCount()
+ {
+ return lockRemoverMaxThreadCount;
+ }
+
+ /**
+ * Sets LockRemovers per-repository max threads count.
+ * @param lockRemoverMaxThreadCount
+ */
+ public void setLockRemoverThreadsCount(int lockRemoverMaxThreadCount)
+ {
+ this.lockRemoverMaxThreadCount = lockRemoverMaxThreadCount;
+ }
+
+ /**
* Merges the current {@link RepositoryInfo} with the given one. The current {@link RepositoryInfo}
* has the highest priority thus only absent data will be overrode
* @param entry the entry to merge with the current {@link RepositoryInfo}
*/
void merge(RepositoryInfo entry)
{
- if (systemWorkspaceName == null) setSystemWorkspaceName(entry.systemWorkspaceName);
- if (defaultWorkspaceName == null) setDefaultWorkspaceName(entry.defaultWorkspaceName);
- if (accessControl == null) setAccessControl(entry.accessControl);
- if (securityDomain == null) setSecurityDomain(entry.securityDomain);
- if (authenticationPolicy == null) setAuthenticationPolicy(entry.authenticationPolicy);
- if (sessionTimeOut == 0) setSessionTimeOut(entry.sessionTimeOut);
- }
+ if (systemWorkspaceName == null)
+ setSystemWorkspaceName(entry.systemWorkspaceName);
+ if (defaultWorkspaceName == null)
+ setDefaultWorkspaceName(entry.defaultWorkspaceName);
+ if (accessControl == null)
+ setAccessControl(entry.accessControl);
+ if (securityDomain == null)
+ setSecurityDomain(entry.securityDomain);
+ if (authenticationPolicy == null)
+ setAuthenticationPolicy(entry.authenticationPolicy);
+ if (sessionTimeOut == 0)
+ setSessionTimeOut(entry.sessionTimeOut);
+ if (lockRemoverMaxThreadCount == 0)
+ setLockRemoverThreadsCount(entry.lockRemoverMaxThreadCount);
+ }
}
Modified: jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/RepositoryContainer.java
===================================================================
--- jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/RepositoryContainer.java 2010-11-17 13:02:14 UTC (rev 3470)
+++ jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/RepositoryContainer.java 2010-11-17 13:40:14 UTC (rev 3471)
@@ -41,6 +41,7 @@
import org.exoplatform.services.jcr.impl.core.WorkspaceInitializer;
import org.exoplatform.services.jcr.impl.core.access.DefaultAccessManagerImpl;
import org.exoplatform.services.jcr.impl.core.lock.LockManagerImpl;
+import org.exoplatform.services.jcr.impl.core.lock.LockRemoverHolder;
import org.exoplatform.services.jcr.impl.core.nodetype.NodeTypeDataManagerImpl;
import org.exoplatform.services.jcr.impl.core.nodetype.NodeTypeManagerImpl;
import org.exoplatform.services.jcr.impl.core.nodetype.registration.JCRNodeTypeDataPersister;
@@ -56,15 +57,12 @@
import org.exoplatform.services.jcr.impl.dataflow.persistent.LocalWorkspaceDataManagerStub;
import org.exoplatform.services.jcr.impl.storage.SystemDataContainerHolder;
import org.exoplatform.services.jcr.impl.storage.value.StandaloneStoragePluginProvider;
-import org.exoplatform.services.jcr.impl.util.io.WorkspaceFileCleanerHolder;
+import org.exoplatform.services.jcr.impl.util.io.FileCleanerHolder;
import org.exoplatform.services.jcr.storage.WorkspaceDataContainer;
import org.exoplatform.services.jcr.util.IdGenerator;
import org.exoplatform.services.log.ExoLogger;
import org.exoplatform.services.log.Log;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Comparator;
import java.util.List;
import javax.jcr.NamespaceRegistry;
@@ -335,7 +333,6 @@
}
workspaceContainer.registerComponentImplementation(initilizerType);
workspaceContainer.registerComponentImplementation(SessionFactory.class);
- workspaceContainer.registerComponentImplementation(WorkspaceFileCleanerHolder.class);
LocalWorkspaceDataManagerStub wsDataManager =
(LocalWorkspaceDataManagerStub)workspaceContainer
@@ -480,7 +477,10 @@
{
registerComponentInstance(config);
-
+ // WorkspaceFileCleanerHolder - is a common holder for all workspaces.
+ // It is used to initialize FileValueStorage
+ registerComponentImplementation(FileCleanerHolder.class);
+ registerComponentImplementation(LockRemoverHolder.class);
registerWorkspacesComponents();
registerRepositoryComponents();
}
@@ -492,7 +492,6 @@
registerComponentImplementation(RepositoryIndexSearcherHolder.class);
- registerComponentImplementation(WorkspaceFileCleanerHolder.class);
registerComponentImplementation(LocationFactory.class);
registerComponentImplementation(ValueFactoryImpl.class);
@@ -583,5 +582,5 @@
ntManager.start();
}
-
+
}
Modified: jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/BackupWorkspaceInitializer.java
===================================================================
--- jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/BackupWorkspaceInitializer.java 2010-11-17 13:02:14 UTC (rev 3470)
+++ jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/BackupWorkspaceInitializer.java 2010-11-17 13:40:14 UTC (rev 3471)
@@ -35,8 +35,6 @@
import org.exoplatform.services.jcr.impl.Constants;
import org.exoplatform.services.jcr.impl.core.nodetype.NodeTypeManagerImpl;
import org.exoplatform.services.jcr.impl.core.value.ValueFactoryImpl;
-import org.exoplatform.services.jcr.impl.dataflow.TransientPropertyData;
-import org.exoplatform.services.jcr.impl.dataflow.TransientValueData;
import org.exoplatform.services.jcr.impl.dataflow.persistent.CacheableWorkspaceDataManager;
import org.exoplatform.services.jcr.impl.dataflow.persistent.StreamPersistedValueData;
import org.exoplatform.services.jcr.impl.storage.JCRInvalidItemStateException;
@@ -91,7 +89,7 @@
super(config, repConfig, dataManager, namespaceRegistry, locationFactory, nodeTypeManager, valueFactory,
accessManager);
- this.fileCleaner = new FileCleaner();
+ this.fileCleaner = valueFactory.getFileCleaner();
restoreDir = restorePath;
@@ -105,6 +103,7 @@
this.tempDir = new File(System.getProperty("java.io.tmpdir"));
}
+ @Override
public NodeData initWorkspace() throws RepositoryException
{
@@ -366,8 +365,6 @@
restoreChangesLog.restore();
- TransactionChangesLog log = restoreChangesLog.getItemDataChangesLog();
-
}
else if (changesLogType == RestoreChangesLog.Type.ItemDataChangesLog_without_Streams)
{
@@ -449,7 +446,7 @@
PersistedPropertyData propertyData = (PersistedPropertyData)itemData;
ValueData tvd =
- (ValueData)(propertyData.getValues().get(listFixupStream.get(i).getValueDataId()));
+ (propertyData.getValues().get(listFixupStream.get(i).getValueDataId()));
// re-init the value
propertyData.getValues().set(listFixupStream.get(i).getValueDataId(),
Modified: jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionImpl.java
===================================================================
--- jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionImpl.java 2010-11-17 13:02:14 UTC (rev 3470)
+++ jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionImpl.java 2010-11-17 13:40:14 UTC (rev 3471)
@@ -42,7 +42,7 @@
import org.exoplatform.services.jcr.impl.dataflow.persistent.LocalWorkspaceDataManagerStub;
import org.exoplatform.services.jcr.impl.ext.action.SessionActionCatalog;
import org.exoplatform.services.jcr.impl.ext.action.SessionActionInterceptor;
-import org.exoplatform.services.jcr.impl.util.io.WorkspaceFileCleanerHolder;
+import org.exoplatform.services.jcr.impl.util.io.FileCleanerHolder;
import org.exoplatform.services.jcr.impl.xml.ExportImportFactory;
import org.exoplatform.services.jcr.impl.xml.ItemDataKeeperAdapter;
import org.exoplatform.services.jcr.impl.xml.XmlMapping;
@@ -162,8 +162,8 @@
this.lazyReadThreshold =
wsConfig.getLazyReadThreshold() > 0 ? wsConfig.getLazyReadThreshold() : DEFAULT_LAZY_READ_THRESHOLD;
- WorkspaceFileCleanerHolder cleanerHolder =
- (WorkspaceFileCleanerHolder)container.getComponentInstanceOfType(WorkspaceFileCleanerHolder.class);
+ FileCleanerHolder cleanerHolder =
+ (FileCleanerHolder)container.getComponentInstanceOfType(FileCleanerHolder.class);
this.locationFactory = new LocationFactory(this);
this.valueFactory = new ValueFactoryImpl(locationFactory, wsConfig, cleanerHolder);
@@ -242,8 +242,8 @@
WorkspaceEntry wsConfig = (WorkspaceEntry)container.getComponentInstanceOfType(WorkspaceEntry.class);
- WorkspaceFileCleanerHolder cleanerHolder =
- (WorkspaceFileCleanerHolder)container.getComponentInstanceOfType(WorkspaceFileCleanerHolder.class);
+ FileCleanerHolder cleanerHolder =
+ (FileCleanerHolder)container.getComponentInstanceOfType(FileCleanerHolder.class);
ValueFactoryImpl valueFactoryImpl = new ValueFactoryImpl(factory, wsConfig, cleanerHolder);
@@ -281,8 +281,8 @@
WorkspaceEntry wsConfig = (WorkspaceEntry)container.getComponentInstanceOfType(WorkspaceEntry.class);
- WorkspaceFileCleanerHolder cleanerHolder =
- (WorkspaceFileCleanerHolder)container.getComponentInstanceOfType(WorkspaceFileCleanerHolder.class);
+ FileCleanerHolder cleanerHolder =
+ (FileCleanerHolder)container.getComponentInstanceOfType(FileCleanerHolder.class);
ValueFactoryImpl valueFactoryImpl = new ValueFactoryImpl(factory, wsConfig, cleanerHolder);
@@ -322,8 +322,8 @@
WorkspaceEntry wsConfig = (WorkspaceEntry)container.getComponentInstanceOfType(WorkspaceEntry.class);
- WorkspaceFileCleanerHolder cleanerHolder =
- (WorkspaceFileCleanerHolder)container.getComponentInstanceOfType(WorkspaceFileCleanerHolder.class);
+ FileCleanerHolder cleanerHolder =
+ (FileCleanerHolder)container.getComponentInstanceOfType(FileCleanerHolder.class);
ValueFactoryImpl valueFactoryImpl = new ValueFactoryImpl(factory, wsConfig, cleanerHolder);
@@ -361,8 +361,8 @@
WorkspaceEntry wsConfig = (WorkspaceEntry)container.getComponentInstanceOfType(WorkspaceEntry.class);
- WorkspaceFileCleanerHolder cleanerHolder =
- (WorkspaceFileCleanerHolder)container.getComponentInstanceOfType(WorkspaceFileCleanerHolder.class);
+ FileCleanerHolder cleanerHolder =
+ (FileCleanerHolder)container.getComponentInstanceOfType(FileCleanerHolder.class);
ValueFactoryImpl valueFactoryImpl = new ValueFactoryImpl(factory, wsConfig, cleanerHolder);
try
@@ -397,8 +397,8 @@
WorkspaceEntry wsConfig = (WorkspaceEntry)container.getComponentInstanceOfType(WorkspaceEntry.class);
- WorkspaceFileCleanerHolder cleanerHolder =
- (WorkspaceFileCleanerHolder)container.getComponentInstanceOfType(WorkspaceFileCleanerHolder.class);
+ FileCleanerHolder cleanerHolder =
+ (FileCleanerHolder)container.getComponentInstanceOfType(FileCleanerHolder.class);
ValueFactoryImpl valueFactoryImpl = new ValueFactoryImpl(factory, wsConfig, cleanerHolder);
try
Modified: jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SysViewWorkspaceInitializer.java
===================================================================
--- jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SysViewWorkspaceInitializer.java 2010-11-17 13:02:14 UTC (rev 3470)
+++ jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SysViewWorkspaceInitializer.java 2010-11-17 13:40:14 UTC (rev 3471)
@@ -265,7 +265,8 @@
else if (tmpFile == null && (((TempOutputStream)buff).getSize() + buffer.length) > maxBufferSize)
{
// spool to file
- FileOutputStream fout = new FileOutputStream(tmpFile = SpoolFile.createTempFile("jcrrestorewi", ".tmp", tempDir));
+ FileOutputStream fout =
+ new FileOutputStream(tmpFile = SpoolFile.createTempFile("jcrrestorewi", ".tmp", tempDir));
fout.write(((TempOutputStream)buff).getBuffer());
buff.close();
buff = fout; // use file
@@ -398,7 +399,7 @@
this.namespaceRegistry = namespaceRegistry;
this.locationFactory = locationFactory;
- this.fileCleaner = new FileCleaner(false); // cleaner should be started!
+ this.fileCleaner = valueFactory.getFileCleaner();
this.maxBufferSize =
config.getContainer().getParameterInteger(WorkspaceDataContainer.MAXBUFFERSIZE_PROP,
WorkspaceDataContainer.DEF_MAXBUFFERSIZE);
@@ -409,7 +410,7 @@
throw new RepositoryConfigurationException("Workspace (" + workspaceName
+ ") RestoreIntializer should have mandatory parameter "
+ SysViewWorkspaceInitializer.RESTORE_PATH_PARAMETER);
-
+
this.tempDir = new File(System.getProperty("java.io.tmpdir"));
}
@@ -450,12 +451,12 @@
this.namespaceRegistry = namespaceRegistry;
this.locationFactory = locationFactory;
- this.fileCleaner = new FileCleaner(false); // cleaner should be started!
+ this.fileCleaner = valueFactory.getFileCleaner();
this.maxBufferSize =
config.getContainer().getParameterInteger(WorkspaceDataContainer.MAXBUFFERSIZE_PROP,
WorkspaceDataContainer.DEF_MAXBUFFERSIZE);
this.restorePath = restorePath;
-
+
this.tempDir = new File(System.getProperty("java.io.tmpdir"));
}
@@ -771,7 +772,7 @@
}
else
{
-
+
File pfile = propertyValue.getFile();
if (pfile != null)
{
@@ -811,7 +812,6 @@
public void start()
{
- fileCleaner.start();
}
public void stop()
Modified: jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/LockManagerImpl.java
===================================================================
--- jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/LockManagerImpl.java 2010-11-17 13:02:14 UTC (rev 3470)
+++ jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/LockManagerImpl.java 2010-11-17 13:40:14 UTC (rev 3471)
@@ -146,12 +146,14 @@
* @param dataManager
* @param config
*/
- public LockManagerImpl(WorkspacePersistentDataManager dataManager, WorkspaceEntry config)
+ public LockManagerImpl(WorkspacePersistentDataManager dataManager, WorkspaceEntry config,
+ LockRemoverHolder lockRemoverHolder)
{
- this(dataManager, config, null);
+ this(dataManager, config, null, lockRemoverHolder);
}
- public LockManagerImpl(WorkspacePersistentDataManager dataManager, WorkspaceEntry config, LockPersister persister)
+ public LockManagerImpl(WorkspacePersistentDataManager dataManager, WorkspaceEntry config, LockPersister persister,
+ LockRemoverHolder lockRemoverHolder)
{
this.dataManager = dataManager;
@@ -169,6 +171,7 @@
tokensMap = new HashMap<String, LockData>();
dataManager.addItemPersistenceListener(this);
+ lockRemover = lockRemoverHolder.getLockRemover(this);
}
public synchronized void addLockToken(String sessionId, String lt)
@@ -468,7 +471,7 @@
*/
public void start()
{
- lockRemover = new LockRemover(this);
+ lockRemover.start();
}
// Quick method. We need to reconstruct
@@ -503,8 +506,8 @@
*/
public void stop()
{
- lockRemover.halt();
- lockRemover.interrupt();
+ lockRemover.stop();
+
locks.clear();
pendingLocks.clear();
tokensMap.clear();
Modified: jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/LockRemover.java
===================================================================
--- jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/LockRemover.java 2010-11-17 13:02:14 UTC (rev 3470)
+++ jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/LockRemover.java 2010-11-17 13:40:14 UTC (rev 3471)
@@ -18,47 +18,66 @@
*/
package org.exoplatform.services.jcr.impl.core.lock;
-import org.exoplatform.services.jcr.impl.proccess.WorkerThread;
-import org.exoplatform.services.log.ExoLogger;
-import org.exoplatform.services.log.Log;
+import org.exoplatform.services.jcr.impl.proccess.WorkerService;
+import java.util.concurrent.ScheduledFuture;
+
/**
* Created by The eXo Platform SAS.
*
* @author <a href="mailto:Sergey.Kabashnyuk@gmail.com">Sergey Kabashnyuk</a>
* @version $Id: LockRemover.java 11987 2008-03-17 09:06:06Z ksm $
*/
-public class LockRemover extends WorkerThread
+public class LockRemover
{
+ public static final long DEFAULT_THREAD_TIMEOUT = 30000; // 30 sec
- private final Log log = ExoLogger.getLogger("exo.jcr.component.core.LockRemover");
+ private final WorkerService workerService;
- public static final long DEFAULT_THREAD_TIMEOUT = 30000; // 30
+ private final WorkspaceLockManager lockManager;
- // sec
+ private final long timeout;
- private final WorkspaceLockManager lockManagerImpl;
+ private ScheduledFuture<?> lockRemoverTask = null;
- public LockRemover(WorkspaceLockManager lockManagerImpl)
+ class LockRemoverTask implements Runnable
{
- this(lockManagerImpl, DEFAULT_THREAD_TIMEOUT);
+ private final WorkspaceLockManager lockManager;
+
+ LockRemoverTask(WorkspaceLockManager lockManager)
+ {
+ this.lockManager = lockManager;
+ }
+
+ public void run()
+ {
+ lockManager.removeExpired();
+ }
}
- private LockRemover(WorkspaceLockManager lockManagerImpl, long timeout)
+ protected LockRemover(WorkerService workerService, WorkspaceLockManager lockManager)
{
- super(timeout);
- this.lockManagerImpl = lockManagerImpl;
- setName("LockRemover " + getId());
- setPriority(Thread.MIN_PRIORITY);
- setDaemon(true);
- start();
- if (log.isDebugEnabled())
- log.debug("LockRemover instantiated name= " + getName() + " timeout= " + timeout);
+ this(workerService, lockManager, DEFAULT_THREAD_TIMEOUT);
}
- @Override
- protected void callPeriodically() throws Exception
+ protected LockRemover(WorkerService workerService, WorkspaceLockManager lockManager, long timeout)
{
- lockManagerImpl.removeExpired();
+ this.workerService = workerService;
+ this.lockManager = lockManager;
+ this.timeout = timeout;
}
+
+ public void start()
+ {
+ if (lockRemoverTask == null)
+ {
+ lockRemoverTask = workerService.executePeriodically(new LockRemoverTask(lockManager), timeout);
+ }
+ }
+
+ public void stop()
+ {
+ lockRemoverTask.cancel(false);
+ lockRemoverTask = null;
+ }
}
Added: jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/LockRemoverHolder.java
===================================================================
--- jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/LockRemoverHolder.java (rev 0)
+++ jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/LockRemoverHolder.java 2010-11-17 13:40:14 UTC (rev 3471)
@@ -0,0 +1,83 @@
+/*
+ * Copyright (C) 2009 eXo Platform SAS.
+ *
+ * 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.exoplatform.services.jcr.impl.core.lock;
+
+import org.exoplatform.services.jcr.config.RepositoryEntry;
+import org.exoplatform.services.jcr.impl.proccess.WorkerService;
+
+/**
+ * LockRemoverHolder holds is a single per-repository LockRemover container.
+ *
+ * @author <a href="mailto:karpenko.sergiy@gmail.com">Karpenko Sergiy</a>
+ * @version $Id: exo-jboss-codetemplates.xml 34360 2009-07-22 23:58:59Z aheritier $
+ */
+public class LockRemoverHolder
+{
+
+ /**
+ * Default amount of thread that may be used by WorkerService to serve LockRemovers.
+ */
+ public final int DEFAULT_THREAD_COUNT = 1;
+
+ /**
+ * WorkerService that executed LockRemover.
+ */
+ private final WorkerService workerService;
+
+ /**
+ * Constructor.
+ * @param entry - RepositoryEntry that may contain lock-remover-max-threads parameter.
+ */
+ public LockRemoverHolder(RepositoryEntry entry)
+ {
+ int threadCount = DEFAULT_THREAD_COUNT;
+ if (entry != null)
+ {
+ if (entry.getLockRemoverThreadsCount() > 0)
+ {
+ threadCount = entry.getLockRemoverThreadsCount();
+ }
+ }
+ workerService = new WorkerService(threadCount, "lock-remover");
+ }
+
+ /**
+ * Returns LockRemover object that removes expired locks from LockManager. Default timeout used.
+ *
+ * @param lockManager - LockManager that going to be cleaned with returned LockRemover.
+ * @return LockRemover
+ */
+ public LockRemover getLockRemover(WorkspaceLockManager lockManager)
+ {
+ return new LockRemover(workerService, lockManager);
+ }
+
+ /**
+ * Returns LockRemover object that removes expired locks from LockManager.
+ *
+ * @param lockManager - LockManager that going to be cleaned with returned LockRemover.
+ * @param timeout - LockRemover will check LockManager with delay setted in timeout parameter
+ * @return LockRemover
+ */
+ public LockRemover getLockRemover(WorkspaceLockManager lockManager, long timeout)
+ {
+ return new LockRemover(workerService, lockManager, timeout);
+ }
+
+}
Modified: jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/jbosscache/CacheableLockManagerImpl.java
===================================================================
--- jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/jbosscache/CacheableLockManagerImpl.java 2010-11-17 13:02:14 UTC (rev 3470)
+++ jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/jbosscache/CacheableLockManagerImpl.java 2010-11-17 13:40:14 UTC (rev 3471)
@@ -43,6 +43,7 @@
import org.exoplatform.services.jcr.impl.Constants;
import org.exoplatform.services.jcr.impl.core.SessionDataManager;
import org.exoplatform.services.jcr.impl.core.lock.LockRemover;
+import org.exoplatform.services.jcr.impl.core.lock.LockRemoverHolder;
import org.exoplatform.services.jcr.impl.core.lock.SessionLockManager;
import org.exoplatform.services.jcr.impl.dataflow.TransientItemData;
import org.exoplatform.services.jcr.impl.dataflow.TransientPropertyData;
@@ -178,10 +179,10 @@
* @throws RepositoryConfigurationException
*/
public CacheableLockManagerImpl(WorkspacePersistentDataManager dataManager, WorkspaceEntry config,
- InitialContextInitializer context, TransactionService transactionService, ConfigurationManager cfm)
- throws RepositoryConfigurationException, RepositoryException
+ InitialContextInitializer context, TransactionService transactionService, ConfigurationManager cfm,
+ LockRemoverHolder lockRemoverHolder) throws RepositoryConfigurationException, RepositoryException
{
- this(dataManager, config, context, transactionService.getTransactionManager(), cfm);
+ this(dataManager, config, context, transactionService.getTransactionManager(), cfm, lockRemoverHolder);
}
/**
@@ -193,10 +194,10 @@
* @throws RepositoryConfigurationException
*/
public CacheableLockManagerImpl(WorkspacePersistentDataManager dataManager, WorkspaceEntry config,
- InitialContextInitializer context, ConfigurationManager cfm) throws RepositoryConfigurationException,
- RepositoryException
+ InitialContextInitializer context, ConfigurationManager cfm, LockRemoverHolder lockRemoverHolder)
+ throws RepositoryConfigurationException, RepositoryException
{
- this(dataManager, config, context, (TransactionManager)null, cfm);
+ this(dataManager, config, context, (TransactionManager)null, cfm, lockRemoverHolder);
}
@@ -211,8 +212,8 @@
* @throws RepositoryConfigurationException
*/
public CacheableLockManagerImpl(WorkspacePersistentDataManager dataManager, WorkspaceEntry config,
- InitialContextInitializer context, TransactionManager transactionManager, ConfigurationManager cfm)
- throws RepositoryConfigurationException, RepositoryException
+ InitialContextInitializer context, TransactionManager transactionManager, ConfigurationManager cfm,
+ LockRemoverHolder lockRemoverHolder) throws RepositoryConfigurationException, RepositoryException
{
lockRoot = Fqn.fromElements(LOCKS);
@@ -269,6 +270,9 @@
{
throw new RepositoryConfigurationException("Cache configuration not found");
}
+
+ lockRemover = lockRemoverHolder.getLockRemover(this);
+
}
/**
@@ -490,7 +494,7 @@
}
return true;
}
-
+
/**
* Return new instance of session lock manager.
*/
@@ -769,7 +773,7 @@
*/
public void start()
{
- lockRemover = new LockRemover(this);
+ lockRemover.start();
}
/*
@@ -778,8 +782,8 @@
*/
public void stop()
{
- lockRemover.halt();
- lockRemover.interrupt();
+ lockRemover.stop();
+
sessionLockManagers.clear();
cache.stop();
}
@@ -913,7 +917,7 @@
{
return getExactNodeOrCloseParentLock(node, true);
}
-
+
private LockData getExactNodeOrCloseParentLock(NodeData node, boolean checkHasLocks) throws RepositoryException
{
@@ -954,7 +958,7 @@
{
return getClosedChild(node, true);
}
-
+
private LockData getClosedChild(NodeData node, boolean checkHasLocks) throws RepositoryException
{
Modified: jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/jbosscache/jdbc/CacheableJDBCLockManagerImpl.java
===================================================================
--- jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/jbosscache/jdbc/CacheableJDBCLockManagerImpl.java 2010-11-17 13:02:14 UTC (rev 3470)
+++ jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/jbosscache/jdbc/CacheableJDBCLockManagerImpl.java 2010-11-17 13:40:14 UTC (rev 3471)
@@ -42,6 +42,7 @@
import org.exoplatform.services.jcr.impl.Constants;
import org.exoplatform.services.jcr.impl.core.SessionDataManager;
import org.exoplatform.services.jcr.impl.core.lock.LockRemover;
+import org.exoplatform.services.jcr.impl.core.lock.LockRemoverHolder;
import org.exoplatform.services.jcr.impl.core.lock.SessionLockManager;
import org.exoplatform.services.jcr.impl.core.lock.jbosscache.CacheableLockManager;
import org.exoplatform.services.jcr.impl.core.lock.jbosscache.CacheableSessionLockManager;
@@ -161,10 +162,10 @@
* @throws RepositoryConfigurationException
*/
public CacheableJDBCLockManagerImpl(WorkspacePersistentDataManager dataManager, WorkspaceEntry config,
- InitialContextInitializer context, TransactionService transactionService, ConfigurationManager cfm)
- throws RepositoryConfigurationException, RepositoryException
+ InitialContextInitializer context, TransactionService transactionService, ConfigurationManager cfm,
+ LockRemoverHolder lockRemoverHolder) throws RepositoryConfigurationException, RepositoryException
{
- this(dataManager, config, context, transactionService.getTransactionManager(), cfm);
+ this(dataManager, config, context, transactionService.getTransactionManager(), cfm, lockRemoverHolder);
}
/**
@@ -176,10 +177,10 @@
* @throws RepositoryConfigurationException
*/
public CacheableJDBCLockManagerImpl(WorkspacePersistentDataManager dataManager, WorkspaceEntry config,
- InitialContextInitializer context, ConfigurationManager cfm) throws RepositoryConfigurationException,
- RepositoryException
+ InitialContextInitializer context, ConfigurationManager cfm, LockRemoverHolder lockRemoverHolder)
+ throws RepositoryConfigurationException, RepositoryException
{
- this(dataManager, config, context, (TransactionManager)null, cfm);
+ this(dataManager, config, context, (TransactionManager)null, cfm, lockRemoverHolder);
}
/**
@@ -194,8 +195,8 @@
* @throws RepositoryException
*/
public CacheableJDBCLockManagerImpl(WorkspacePersistentDataManager dataManager, WorkspaceEntry config,
- InitialContextInitializer context, TransactionManager transactionManager, ConfigurationManager cfm)
- throws RepositoryConfigurationException, RepositoryException
+ InitialContextInitializer context, TransactionManager transactionManager, ConfigurationManager cfm,
+ LockRemoverHolder lockRemoverHolder) throws RepositoryConfigurationException, RepositoryException
{
lockRoot = Fqn.fromElements(LOCKS);
@@ -250,6 +251,8 @@
{
throw new RepositoryConfigurationException("Cache configuration not found");
}
+
+ lockRemover = lockRemoverHolder.getLockRemover(this);
}
@Managed
@@ -598,7 +601,7 @@
*/
public void start()
{
- lockRemover = new LockRemover(this);
+ lockRemover.start();
}
/**
@@ -606,8 +609,8 @@
*/
public void stop()
{
- lockRemover.halt();
- lockRemover.interrupt();
+ lockRemover.stop();
+
sessionLockManagers.clear();
cache.stop();
}
Modified: jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/value/ValueFactoryImpl.java
===================================================================
--- jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/value/ValueFactoryImpl.java 2010-11-17 13:02:14 UTC (rev 3470)
+++ jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/value/ValueFactoryImpl.java 2010-11-17 13:40:14 UTC (rev 3471)
@@ -30,7 +30,7 @@
import org.exoplatform.services.jcr.impl.dataflow.TransientValueData;
import org.exoplatform.services.jcr.impl.util.JCRDateFormat;
import org.exoplatform.services.jcr.impl.util.io.FileCleaner;
-import org.exoplatform.services.jcr.impl.util.io.WorkspaceFileCleanerHolder;
+import org.exoplatform.services.jcr.impl.util.io.FileCleanerHolder;
import org.exoplatform.services.jcr.storage.WorkspaceDataContainer;
import org.exoplatform.services.log.ExoLogger;
import org.exoplatform.services.log.Log;
@@ -71,7 +71,7 @@
private int maxBufferSize;
public ValueFactoryImpl(LocationFactory locationFactory, WorkspaceEntry workspaceConfig,
- WorkspaceFileCleanerHolder cleanerHolder)
+ FileCleanerHolder cleanerHolder)
{
this.locationFactory = locationFactory;
Added: jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/proccess/WorkerService.java
===================================================================
--- jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/proccess/WorkerService.java (rev 0)
+++ jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/proccess/WorkerService.java 2010-11-17 13:40:14 UTC (rev 3471)
@@ -0,0 +1,128 @@
+/*
+ * Copyright (C) 2009 eXo Platform SAS.
+ *
+ * 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.exoplatform.services.jcr.impl.proccess;
+
+import java.util.concurrent.ScheduledFuture;
+import java.util.concurrent.ScheduledThreadPoolExecutor;
+import java.util.concurrent.ThreadFactory;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicInteger;
+
+/**
+ * WorkerService.
+ *
+ * @author <a href="mailto:karpenko.sergiy@gmail.com">Karpenko Sergiy</a>
+ * @version $Id: WorkerService.java 34361 2010-08-24 23:58:59Z aheritier $
+ */
+public class WorkerService
+{
+ /**
+ * Executor that process assigned command periodically.
+ */
+ private final ScheduledThreadPoolExecutor executor;
+
+ static class WorkerThreadFactory implements ThreadFactory
+ {
+ static final AtomicInteger poolNumber = new AtomicInteger(1);
+
+ final ThreadGroup group;
+
+ final AtomicInteger threadNumber = new AtomicInteger(1);
+
+ final String namePrefix;
+
+ final boolean isDaemon;
+
+ WorkerThreadFactory(String namePrefix)
+ {
+ this(namePrefix, false);
+ }
+
+ WorkerThreadFactory(String namePrefix, boolean isDaemon)
+ {
+ this.isDaemon = isDaemon;
+ SecurityManager s = System.getSecurityManager();
+ group = (s != null) ? s.getThreadGroup() : Thread.currentThread().getThreadGroup();
+ this.namePrefix = namePrefix + "-" + poolNumber.getAndIncrement() + "-thread-";
+ }
+
+ public Thread newThread(Runnable r)
+ {
+ Thread t = new Thread(group, r, namePrefix + threadNumber.getAndIncrement(), 0);
+ t.setDaemon(isDaemon);
+ if (t.getPriority() != Thread.NORM_PRIORITY)
+ t.setPriority(Thread.NORM_PRIORITY);
+ return t;
+ }
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param threadCount - max thread count that executor may use
+ */
+ public WorkerService(int threadCount)
+ {
+ executor = new ScheduledThreadPoolExecutor(threadCount);
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param threadCount - max thread count that executor may use
+ * @param threadNamePrefix - thread name prefix
+ */
+ public WorkerService(int threadCount, String threadNamePrefix)
+ {
+ executor = new ScheduledThreadPoolExecutor(threadCount, new WorkerThreadFactory(threadNamePrefix));
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param threadCount - max thread count that executor may use
+ * @param threadNamePrefix - thread name prefix
+ * @param makeThreadsDaemon - does thread created by Service must be daemon
+ */
+ public WorkerService(int threadCount, String threadNamePrefix, boolean makeThreadsDaemon)
+ {
+ executor =
+ new ScheduledThreadPoolExecutor(threadCount, new WorkerThreadFactory(threadNamePrefix, makeThreadsDaemon));
+ }
+
+ /**
+ * Execute specified <code>command</code> periodically with <code>delay</code>.
+ *
+ * @param command - command that must be executed
+ * @param delay - delay between each command execution
+ * @return
+ */
+ public ScheduledFuture<?> executePeriodically(Runnable command, long delay)
+ {
+ return executor.scheduleWithFixedDelay(command, 0, delay, TimeUnit.MILLISECONDS);
+ }
+
+ /**
+ * Initiates an orderly shutdown in which previously submitted tasks are executed, but no new tasks will be accepted.
+ */
+ public void stop()
+ {
+ executor.shutdown();
+ }
+}
Modified: jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCWorkspaceDataContainer.java
===================================================================
--- jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCWorkspaceDataContainer.java 2010-11-17 13:02:14 UTC (rev 3470)
+++ jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCWorkspaceDataContainer.java 2010-11-17 13:40:14 UTC (rev 3471)
@@ -34,6 +34,7 @@
import org.exoplatform.services.jcr.impl.storage.jdbc.statistics.StatisticsJDBCStorageConnection;
import org.exoplatform.services.jcr.impl.storage.jdbc.update.StorageUpdateManager;
import org.exoplatform.services.jcr.impl.util.io.FileCleaner;
+import org.exoplatform.services.jcr.impl.util.io.FileCleanerHolder;
import org.exoplatform.services.jcr.impl.util.jdbc.DBInitializerException;
import org.exoplatform.services.jcr.storage.WorkspaceDataContainer;
import org.exoplatform.services.jcr.storage.WorkspaceStorageConnection;
@@ -202,8 +203,9 @@
* if JNDI exception (on DataSource lookup)
*/
public JDBCWorkspaceDataContainer(WorkspaceEntry wsConfig, RepositoryEntry repConfig,
- InitialContextInitializer contextInit, ValueStoragePluginProvider valueStorageProvider)
- throws RepositoryConfigurationException, NamingException, RepositoryException, IOException
+ InitialContextInitializer contextInit, ValueStoragePluginProvider valueStorageProvider,
+ FileCleanerHolder fileCleanerHolder) throws RepositoryConfigurationException, NamingException,
+ RepositoryException, IOException
{
// This recall is workaround for tenants creation. There is a trouble in visibility datasource
@@ -393,7 +395,7 @@
if (!swapDirectory.exists())
swapDirectory.mkdirs();
- this.swapCleaner = new FileCleaner(false);
+ this.swapCleaner = fileCleanerHolder.getFileCleaner();
initDatabase();
@@ -834,7 +836,6 @@
*/
public void start()
{
- this.swapCleaner.start();
}
/**
@@ -842,8 +843,6 @@
*/
public void stop()
{
- this.swapCleaner.halt();
- this.swapCleaner.interrupt();
// TODO HSQLDB Stop (debug)
// if (dbDialect.equals(DB_DIALECT_GENERIC) ||
Modified: jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/CQJDBCWorkspaceDataContainer.java
===================================================================
--- jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/CQJDBCWorkspaceDataContainer.java 2010-11-17 13:02:14 UTC (rev 3470)
+++ jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/CQJDBCWorkspaceDataContainer.java 2010-11-17 13:40:14 UTC (rev 3471)
@@ -33,6 +33,7 @@
import org.exoplatform.services.jcr.impl.storage.jdbc.optimisation.db.HSQLDBConnectionFactory;
import org.exoplatform.services.jcr.impl.storage.jdbc.optimisation.db.MySQLConnectionFactory;
import org.exoplatform.services.jcr.impl.storage.jdbc.optimisation.db.OracleConnectionFactory;
+import org.exoplatform.services.jcr.impl.util.io.FileCleanerHolder;
import org.exoplatform.services.jcr.impl.util.jdbc.DBInitializerException;
import org.exoplatform.services.jcr.storage.value.ValueStoragePluginProvider;
import org.exoplatform.services.naming.InitialContextInitializer;
@@ -67,10 +68,11 @@
* if JNDI exception (on DataSource lookup)
*/
public CQJDBCWorkspaceDataContainer(WorkspaceEntry wsConfig, RepositoryEntry repConfig,
- InitialContextInitializer contextInit, ValueStoragePluginProvider valueStorageProvider)
- throws RepositoryConfigurationException, NamingException, RepositoryException, IOException
+ InitialContextInitializer contextInit, ValueStoragePluginProvider valueStorageProvider,
+ FileCleanerHolder fileCleanerHolder) throws RepositoryConfigurationException, NamingException,
+ RepositoryException, IOException
{
- super(wsConfig, repConfig, contextInit, valueStorageProvider);
+ super(wsConfig, repConfig, contextInit, valueStorageProvider, fileCleanerHolder);
}
/**
Modified: jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/value/StandaloneStoragePluginProvider.java
===================================================================
--- jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/value/StandaloneStoragePluginProvider.java 2010-11-17 13:02:14 UTC (rev 3470)
+++ jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/value/StandaloneStoragePluginProvider.java 2010-11-17 13:40:14 UTC (rev 3471)
@@ -24,6 +24,8 @@
import org.exoplatform.services.jcr.config.ValueStorageFilterEntry;
import org.exoplatform.services.jcr.config.WorkspaceEntry;
import org.exoplatform.services.jcr.datamodel.PropertyData;
+import org.exoplatform.services.jcr.impl.util.io.FileCleaner;
+import org.exoplatform.services.jcr.impl.util.io.FileCleanerHolder;
import org.exoplatform.services.jcr.storage.WorkspaceStorageConnection;
import org.exoplatform.services.jcr.storage.value.ValueIOChannel;
import org.exoplatform.services.jcr.storage.value.ValuePluginFilter;
@@ -60,7 +62,8 @@
*/
private final ValueDataResourceHolder resorcesHolder;
- public StandaloneStoragePluginProvider(WorkspaceEntry wsConfig) throws RepositoryConfigurationException, IOException
+ public StandaloneStoragePluginProvider(WorkspaceEntry wsConfig, FileCleanerHolder holder)
+ throws RepositoryConfigurationException, IOException
{
this.resorcesHolder = new ValueDataResourceHolder();
@@ -82,7 +85,10 @@
Object o = null;
try
{
- o = Class.forName(storageEntry.getType()).newInstance();
+ o =
+ Class.forName(storageEntry.getType()).getConstructor(FileCleaner.class).newInstance(
+ holder.getFileCleaner());
+
}
catch (Exception e)
{
Modified: jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/value/fs/CASableSimpleFileValueStorage.java
===================================================================
--- jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/value/fs/CASableSimpleFileValueStorage.java 2010-11-17 13:02:14 UTC (rev 3470)
+++ jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/value/fs/CASableSimpleFileValueStorage.java 2010-11-17 13:40:14 UTC (rev 3471)
@@ -21,6 +21,7 @@
import org.exoplatform.services.jcr.config.RepositoryConfigurationException;
import org.exoplatform.services.jcr.impl.storage.value.ValueDataResourceHolder;
import org.exoplatform.services.jcr.impl.storage.value.cas.ValueContentAddressStorage;
+import org.exoplatform.services.jcr.impl.util.io.FileCleaner;
import org.exoplatform.services.jcr.storage.value.ValueIOChannel;
import java.io.IOException;
@@ -40,6 +41,11 @@
private String digestAlgo;
+ public CASableSimpleFileValueStorage(FileCleaner cleaner)
+ {
+ super(cleaner);
+ }
+
@Override
public void init(Properties props, ValueDataResourceHolder resources) throws IOException,
RepositoryConfigurationException
Modified: jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/value/fs/CASableTreeFileValueStorage.java
===================================================================
--- jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/value/fs/CASableTreeFileValueStorage.java 2010-11-17 13:02:14 UTC (rev 3470)
+++ jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/value/fs/CASableTreeFileValueStorage.java 2010-11-17 13:40:14 UTC (rev 3471)
@@ -21,6 +21,7 @@
import org.exoplatform.services.jcr.config.RepositoryConfigurationException;
import org.exoplatform.services.jcr.impl.storage.value.ValueDataResourceHolder;
import org.exoplatform.services.jcr.impl.storage.value.cas.ValueContentAddressStorage;
+import org.exoplatform.services.jcr.impl.util.io.FileCleaner;
import java.io.IOException;
import java.util.Properties;
@@ -38,6 +39,11 @@
private String digestAlgo;
+ public CASableTreeFileValueStorage(FileCleaner cleaner)
+ {
+ super(cleaner);
+ }
+
/**
* {@inheritDoc}
*/
Modified: jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/value/fs/FileValueStorage.java
===================================================================
--- jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/value/fs/FileValueStorage.java 2010-11-17 13:02:14 UTC (rev 3470)
+++ jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/value/fs/FileValueStorage.java 2010-11-17 13:40:14 UTC (rev 3471)
@@ -59,9 +59,9 @@
* FileValueStorage constructor.
*
*/
- public FileValueStorage()
+ public FileValueStorage(FileCleaner cleaner)
{
- this.cleaner = new FileCleaner(); // TODO use container cleaner
+ this.cleaner = cleaner;
}
/**
Modified: jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/value/fs/SimpleFileValueStorage.java
===================================================================
--- jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/value/fs/SimpleFileValueStorage.java 2010-11-17 13:02:14 UTC (rev 3470)
+++ jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/value/fs/SimpleFileValueStorage.java 2010-11-17 13:40:14 UTC (rev 3471)
@@ -18,6 +18,7 @@
*/
package org.exoplatform.services.jcr.impl.storage.value.fs;
+import org.exoplatform.services.jcr.impl.util.io.FileCleaner;
import org.exoplatform.services.jcr.storage.value.ValueIOChannel;
import java.io.IOException;
@@ -32,6 +33,11 @@
public class SimpleFileValueStorage extends FileValueStorage
{
+ public SimpleFileValueStorage(FileCleaner cleaner)
+ {
+ super(cleaner);
+ }
+
/**
* @see org.exoplatform.services.jcr.storage.value.ValueStoragePlugin#openIOChannel()
*/
Modified: jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/value/fs/TreeFileValueStorage.java
===================================================================
--- jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/value/fs/TreeFileValueStorage.java 2010-11-17 13:02:14 UTC (rev 3470)
+++ jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/value/fs/TreeFileValueStorage.java 2010-11-17 13:40:14 UTC (rev 3471)
@@ -21,7 +21,6 @@
import org.exoplatform.services.jcr.impl.util.io.FileCleaner;
import org.exoplatform.services.jcr.storage.value.ValueIOChannel;
-import java.io.File;
import java.io.IOException;
/**
@@ -33,20 +32,11 @@
public class TreeFileValueStorage extends FileValueStorage
{
- protected class TreeFileCleaner extends FileCleaner
+ public TreeFileValueStorage(FileCleaner cleaner)
{
- @Override
- public synchronized void addFile(File file)
- {
- super.addFile(new TreeFile(file.getAbsolutePath(), cleaner, rootDir));
- }
+ super(cleaner);
}
- public TreeFileValueStorage()
- {
- this.cleaner = new TreeFileCleaner(); // TODO use container cleaner
- }
-
@Override
public ValueIOChannel openIOChannel() throws IOException
{
Added: jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/util/io/FileCleanerHolder.java
===================================================================
--- jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/util/io/FileCleanerHolder.java (rev 0)
+++ jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/util/io/FileCleanerHolder.java 2010-11-17 13:40:14 UTC (rev 3471)
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2009 eXo Platform SAS.
+ *
+ * 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.exoplatform.services.jcr.impl.util.io;
+
+/**
+ * Created by The eXo Platform SAS. <br/> per workspace container file cleaner holder object
+ *
+ * @author Gennady Azarenkov
+ * @version $Id: WorkspaceFileCleanerHolder.java 11907 2008-03-13 15:36:21Z ksm $
+ */
+
+public class FileCleanerHolder
+{
+
+ private final FileCleaner fileCleaner;
+
+ public FileCleanerHolder()
+ {
+ this.fileCleaner = new FileCleaner();
+ }
+
+ public FileCleaner getFileCleaner()
+ {
+ return fileCleaner;
+ }
+
+}
Modified: jcr/branches/1.12.x/exo.jcr.component.core/src/main/resources/binding.xml
===================================================================
--- jcr/branches/1.12.x/exo.jcr.component.core/src/main/resources/binding.xml 2010-11-17 13:02:14 UTC (rev 3470)
+++ jcr/branches/1.12.x/exo.jcr.component.core/src/main/resources/binding.xml 2010-11-17 13:40:14 UTC (rev 3471)
@@ -17,6 +17,8 @@
<value name="access-control" field="accessControl" usage="optional" />
<value name="session-max-age" field="sessionTimeOut"
deserializer="org.exoplatform.services.jcr.util.ConfigurationFormat.parseTime" usage="optional" />
+ <value name="lock-remover-max-threads" field="lockRemoverMaxThreadCount"
+ deserializer="org.exoplatform.services.jcr.util.ConfigurationFormat.parseInt" usage="optional" />
<value name="authentication-policy" field="authenticationPolicy" />
<collection name="workspaces" field="workspaces" item-type="org.exoplatform.services.jcr.config.WorkspaceEntry" />
</mapping>
Modified: jcr/branches/1.12.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/BaseStandaloneTest.java
===================================================================
--- jcr/branches/1.12.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/BaseStandaloneTest.java 2010-11-17 13:02:14 UTC (rev 3470)
+++ jcr/branches/1.12.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/BaseStandaloneTest.java 2010-11-17 13:40:14 UTC (rev 3471)
@@ -30,7 +30,7 @@
import org.exoplatform.services.jcr.impl.core.SessionImpl;
import org.exoplatform.services.jcr.impl.dataflow.serialization.ReaderSpoolFileHolder;
import org.exoplatform.services.jcr.impl.util.io.FileCleaner;
-import org.exoplatform.services.jcr.impl.util.io.WorkspaceFileCleanerHolder;
+import org.exoplatform.services.jcr.impl.util.io.FileCleanerHolder;
import org.exoplatform.services.jcr.storage.WorkspaceDataContainer;
import org.exoplatform.services.log.ExoLogger;
import org.exoplatform.services.log.Log;
@@ -153,8 +153,7 @@
wconf.getContainer().getParameterInteger(WorkspaceDataContainer.MAXBUFFERSIZE_PROP,
WorkspaceDataContainer.DEF_MAXBUFFERSIZE);
- WorkspaceFileCleanerHolder wfcleaner =
- (WorkspaceFileCleanerHolder)wsc.getComponent(WorkspaceFileCleanerHolder.class);
+ FileCleanerHolder wfcleaner = (FileCleanerHolder)wsc.getComponent(FileCleanerHolder.class);
fileCleaner = wfcleaner.getFileCleaner();
holder = new ReaderSpoolFileHolder();
}
Modified: jcr/branches/1.12.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/storage/JDBCWDCTest.java
===================================================================
--- jcr/branches/1.12.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/storage/JDBCWDCTest.java 2010-11-17 13:02:14 UTC (rev 3470)
+++ jcr/branches/1.12.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/storage/JDBCWDCTest.java 2010-11-17 13:40:14 UTC (rev 3471)
@@ -35,6 +35,7 @@
import org.exoplatform.services.jcr.impl.dataflow.TransientValueData;
import org.exoplatform.services.jcr.impl.storage.jdbc.JDBCWorkspaceDataContainer;
import org.exoplatform.services.jcr.impl.storage.value.StandaloneStoragePluginProvider;
+import org.exoplatform.services.jcr.impl.util.io.FileCleanerHolder;
import org.exoplatform.services.jcr.storage.WorkspaceStorageConnection;
import org.exoplatform.services.log.ExoLogger;
import org.exoplatform.services.log.Log;
@@ -103,9 +104,11 @@
// ref.add(new StringRefAddr("database", "jdbc:hsqldb:file:data/test"));
// SimpleJNDIContextInitializer.initialize(sourceName, ref);
+ FileCleanerHolder holder = new FileCleanerHolder();
container =
- new JDBCWorkspaceDataContainer(config, repositoryEntry, null, new StandaloneStoragePluginProvider(config));
+ new JDBCWorkspaceDataContainer(config, repositoryEntry, null, new StandaloneStoragePluginProvider(config,
+ holder), holder);
Properties logProps = new Properties();
logProps.put("org.apache.commons.logging.simplelog.defaultlog", "debug");
Modified: jcr/branches/1.12.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/storage/value/fs/CASableFileIOChannelTestBase.java
===================================================================
--- jcr/branches/1.12.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/storage/value/fs/CASableFileIOChannelTestBase.java 2010-11-17 13:02:14 UTC (rev 3470)
+++ jcr/branches/1.12.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/storage/value/fs/CASableFileIOChannelTestBase.java 2010-11-17 13:40:14 UTC (rev 3471)
@@ -24,7 +24,6 @@
import org.exoplatform.services.jcr.impl.storage.value.cas.RecordAlreadyExistsException;
import org.exoplatform.services.jcr.impl.storage.value.cas.RecordNotFoundException;
import org.exoplatform.services.jcr.impl.storage.value.cas.ValueContentAddressStorage;
-import org.exoplatform.services.jcr.impl.util.io.FileCleaner;
import org.exoplatform.services.jcr.util.IdGenerator;
import org.exoplatform.services.log.ExoLogger;
import org.exoplatform.services.log.Log;
@@ -42,14 +41,12 @@
* @version $Id$
*/
public abstract class CASableFileIOChannelTestBase extends JcrImplBaseTest
-{//
+{
private static Log LOG = ExoLogger.getLogger("exo.jcr.component.core.CASableFileIOChannelTestBase");
protected ValueContentAddressStorage vcas;
- protected FileCleaner fileCleaner;
-
protected File rootDir;
protected String storageId;
@@ -61,9 +58,6 @@
{
super.setUp();
- if (fileCleaner == null)
- fileCleaner = new FileCleaner();
-
if (vcas == null)
initVCAS();
Modified: jcr/branches/1.12.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/storage/value/fs/TestFileIOChannel.java
===================================================================
--- jcr/branches/1.12.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/storage/value/fs/TestFileIOChannel.java 2010-11-17 13:02:14 UTC (rev 3470)
+++ jcr/branches/1.12.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/storage/value/fs/TestFileIOChannel.java 2010-11-17 13:40:14 UTC (rev 3471)
@@ -43,7 +43,7 @@
private File rootDir;
- private FileCleaner cleaner = new FileCleaner(2000);
+ private FileCleaner cleaner;
private ValueDataResourceHolder resources = new ValueDataResourceHolder();
@@ -57,6 +57,8 @@
{
super.setUp();
+ cleaner = new FileCleaner(2000);
+
rootDir = new File(new File("target"), "vs1");
rootDir.mkdirs();
@@ -67,6 +69,15 @@
}
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void tearDown() throws Exception
+ {
+ cleaner.halt();
+ }
+
public void testRead() throws Exception
{
Modified: jcr/branches/1.12.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/value/TestPersistedValueData.java
===================================================================
--- jcr/branches/1.12.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/value/TestPersistedValueData.java 2010-11-17 13:02:14 UTC (rev 3470)
+++ jcr/branches/1.12.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/value/TestPersistedValueData.java 2010-11-17 13:40:14 UTC (rev 3471)
@@ -81,27 +81,34 @@
public void testIfFinalizeRemovesTempFileStreamValueData() throws Exception
{
+ FileCleaner testFileCleaner = new FileCleaner(1000, true);
+ try
+ {
+ byte[] buf = "0123456789".getBytes();
+ SwapFile file = SwapFile.get(new File("target"), "testIfFinalizeRemovesTempFileStreamValueData");
+ //File file = new File("target/testIfFinalizeRemovesTempFileStreamValueData");
+ //if (file.exists())
+ // file.delete();
+ FileOutputStream out = new FileOutputStream(file);
+ out.write(buf);
+ out.close();
- byte[] buf = "0123456789".getBytes();
- SwapFile file = SwapFile.get(new File("target"), "testIfFinalizeRemovesTempFileStreamValueData");
- //File file = new File("target/testIfFinalizeRemovesTempFileStreamValueData");
- //if (file.exists())
- // file.delete();
- FileOutputStream out = new FileOutputStream(file);
- out.write(buf);
- out.close();
+ CleanableFilePersistedValueData vd = new CleanableFilePersistedValueData(0, file, testFileCleaner);
+ assertTrue(file.exists());
- CleanableFilePersistedValueData vd = new CleanableFilePersistedValueData(0, file, new FileCleaner(1000, true));
- assertTrue(file.exists());
+ vd = null;
+ System.gc();
- vd = null;
- System.gc();
+ // allows GC to call finalize on vd
+ Thread.sleep(2500);
+ System.gc();
- // allows GC to call finalize on vd
- Thread.sleep(2500);
- System.gc();
-
- assertFalse(file.exists());
+ assertFalse(file.exists());
+ }
+ finally
+ {
+ testFileCleaner.halt();
+ }
}
public void testConcurrentFileStreamValueDataReading() throws Exception
Modified: jcr/branches/1.12.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/value/TestTransientValueData.java
===================================================================
--- jcr/branches/1.12.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/value/TestTransientValueData.java 2010-11-17 13:02:14 UTC (rev 3470)
+++ jcr/branches/1.12.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/value/TestTransientValueData.java 2010-11-17 13:40:14 UTC (rev 3471)
@@ -66,37 +66,46 @@
public void testCreateFileStreamTransientValueData() throws Exception
{
+ FileCleaner testFileCleaner = new FileCleaner();
+ try
+ {
+ byte[] buf = "0123456789".getBytes();
+ File file = new File("target/testCreateFileStreamTransientValueData");
+ if (file.exists())
+ file.delete();
+ FileOutputStream out = new FileOutputStream(file);
+ out.write(buf);
+ out.close();
- byte[] buf = "0123456789".getBytes();
- File file = new File("target/testCreateFileStreamTransientValueData");
- if (file.exists())
- file.delete();
- FileOutputStream out = new FileOutputStream(file);
- out.write(buf);
- out.close();
+ FileInputStream fs1 = new FileInputStream(file);
+ TransientValueData vd =
+ new TransientValueData(0, null, fs1, null, testFileCleaner, 5, new File("target"), true);
- FileInputStream fs1 = new FileInputStream(file);
- TransientValueData vd = new TransientValueData(0, null, fs1, null, new FileCleaner(), 5, new File("target"), true);
+ // spool to file
+ InputStream fs2 = vd.getAsStream();
+ assertEquals(10, vd.getLength());
+ assertTrue(fs2 instanceof FileInputStream);
- // spool to file
- InputStream fs2 = vd.getAsStream();
- assertEquals(10, vd.getLength());
- assertTrue(fs2 instanceof FileInputStream);
+ // not the same object as new is is from spool file
+ assertNotSame(fs1, fs2);
+ // spooled to file so not a byte array
+ assertFalse(vd.isByteArray());
- // not the same object as new is is from spool file
- assertNotSame(fs1, fs2);
- // spooled to file so not a byte array
- assertFalse(vd.isByteArray());
+ // next call return not the same object as well
+ // (new stream every time)
+ assertNotSame(vd.getAsStream(), fs2);
+ assertEquals(10, vd.getLength());
- // next call return not the same object as well
- // (new stream every time)
- assertNotSame(vd.getAsStream(), fs2);
- assertEquals(10, vd.getLength());
+ // gets as byte array
+ assertEquals(10, vd.getAsByteArray().length);
+ // but still spooled to file
+ assertFalse(vd.isByteArray());
- // gets as byte array
- assertEquals(10, vd.getAsByteArray().length);
- // but still spooled to file
- assertFalse(vd.isByteArray());
+ }
+ finally
+ {
+ testFileCleaner.halt();
+ }
}
@@ -118,7 +127,7 @@
// TODO not influenced here as will be spooled to byte array anyway
//vd.setMaxBufferSize(5);
//vd.setFileCleaner(new FileCleaner());
-
+
//
InputStream fs2 = vd.getAsStream();
assertEquals(10, vd.getLength());
Modified: jcr/branches/1.12.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/value/TestValueImpl.java
===================================================================
--- jcr/branches/1.12.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/value/TestValueImpl.java 2010-11-17 13:02:14 UTC (rev 3470)
+++ jcr/branches/1.12.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/value/TestValueImpl.java 2010-11-17 13:40:14 UTC (rev 3471)
@@ -50,43 +50,51 @@
public void testNewBinaryValue() throws Exception
{
+ FileCleaner testFileCleaner = new FileCleaner();
- byte[] buf = "012345678901234567890123456789".getBytes();
- File file = new File("target/testNewBinaryValue");
- if (file.exists())
- file.delete();
- FileOutputStream out = new FileOutputStream(file);
- out.write(buf);
- out.close();
+ try
+ {
+ byte[] buf = "012345678901234567890123456789".getBytes();
+ File file = new File("target/testNewBinaryValue");
+ if (file.exists())
+ file.delete();
+ FileOutputStream out = new FileOutputStream(file);
+ out.write(buf);
+ out.close();
- FileInputStream fs1 = new FileInputStream(file);
- BinaryValue val = new BinaryValue(fs1, new FileCleaner(), tempDirectory, maxFufferSize);
- InputStream str1 = val.getStream();
- assertNotNull(str1);
+ FileInputStream fs1 = new FileInputStream(file);
+ BinaryValue val = new BinaryValue(fs1, testFileCleaner, tempDirectory, maxFufferSize);
+ InputStream str1 = val.getStream();
+ assertNotNull(str1);
- // obj returned by getStream() is not the same as incoming stream
- assertNotSame(str1, fs1);
+ // obj returned by getStream() is not the same as incoming stream
+ assertNotSame(str1, fs1);
- // streams returned by subsequent call of val.getStream() are equals
- assertEquals(str1, val.getStream());
+ // streams returned by subsequent call of val.getStream() are equals
+ assertEquals(str1, val.getStream());
- // another one value using the same string
- BinaryValue val2 = new BinaryValue(fs1, new FileCleaner(), tempDirectory, maxFufferSize);
- InputStream str2 = val2.getStream();
+ // another one value using the same string
+ BinaryValue val2 = new BinaryValue(fs1, testFileCleaner, tempDirectory, maxFufferSize);
+ InputStream str2 = val2.getStream();
- // are not the same although created from same Stream
- assertNotSame(str1, str2);
+ // are not the same although created from same Stream
+ assertNotSame(str1, str2);
- // stream already consumed
- try
- {
- val.getString();
- fail("IllegalStateException should have been thrown");
+ // stream already consumed
+ try
+ {
+ val.getString();
+ fail("IllegalStateException should have been thrown");
+ }
+ catch (IllegalStateException e)
+ {
+ }
+ // System.out.println(" >>>>>>>>STRING >>> "+);
}
- catch (IllegalStateException e)
+ finally
{
+ testFileCleaner.halt();
}
- // System.out.println(" >>>>>>>>STRING >>> "+);
}
public void testNewBinaryValueFromString() throws Exception
Modified: jcr/branches/1.12.x/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/replication/ReplicationService.java
===================================================================
--- jcr/branches/1.12.x/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/replication/ReplicationService.java 2010-11-17 13:02:14 UTC (rev 3470)
+++ jcr/branches/1.12.x/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/replication/ReplicationService.java 2010-11-17 13:40:14 UTC (rev 3471)
@@ -43,7 +43,7 @@
import org.exoplatform.services.jcr.impl.core.RepositoryImpl;
import org.exoplatform.services.jcr.impl.dataflow.serialization.ReaderSpoolFileHolder;
import org.exoplatform.services.jcr.impl.util.io.FileCleaner;
-import org.exoplatform.services.jcr.impl.util.io.WorkspaceFileCleanerHolder;
+import org.exoplatform.services.jcr.impl.util.io.FileCleanerHolder;
import org.exoplatform.services.jcr.storage.WorkspaceDataContainer;
import org.exoplatform.services.jcr.util.IdGenerator;
import org.exoplatform.services.log.ExoLogger;
@@ -398,8 +398,7 @@
wconf.getContainer().getParameterInteger(WorkspaceDataContainer.MAXBUFFERSIZE_PROP,
WorkspaceDataContainer.DEF_MAXBUFFERSIZE);
- WorkspaceFileCleanerHolder wfcleaner =
- (WorkspaceFileCleanerHolder)wsFacade.getComponent(WorkspaceFileCleanerHolder.class);
+ FileCleanerHolder wfcleaner = (FileCleanerHolder)wsFacade.getComponent(FileCleanerHolder.class);
FileCleaner fileCleaner = wfcleaner.getFileCleaner();
// create the RecoveryManager
Modified: jcr/branches/1.12.x/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/BaseStandaloneTest.java
===================================================================
--- jcr/branches/1.12.x/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/BaseStandaloneTest.java 2010-11-17 13:02:14 UTC (rev 3470)
+++ jcr/branches/1.12.x/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/BaseStandaloneTest.java 2010-11-17 13:40:14 UTC (rev 3471)
@@ -36,7 +36,7 @@
import org.exoplatform.services.jcr.impl.core.SessionImpl;
import org.exoplatform.services.jcr.impl.dataflow.serialization.ReaderSpoolFileHolder;
import org.exoplatform.services.jcr.impl.util.io.FileCleaner;
-import org.exoplatform.services.jcr.impl.util.io.WorkspaceFileCleanerHolder;
+import org.exoplatform.services.jcr.impl.util.io.FileCleanerHolder;
import org.exoplatform.services.jcr.storage.WorkspaceDataContainer;
import org.exoplatform.services.log.ExoLogger;
import org.exoplatform.services.log.Log;
@@ -139,8 +139,8 @@
wconf.getContainer().getParameterInteger(WorkspaceDataContainer.MAXBUFFERSIZE_PROP,
WorkspaceDataContainer.DEF_MAXBUFFERSIZE);
- WorkspaceFileCleanerHolder wfcleaner =
- (WorkspaceFileCleanerHolder)wsc.getComponent(WorkspaceFileCleanerHolder.class);
+ FileCleanerHolder wfcleaner =
+ (FileCleanerHolder)wsc.getComponent(FileCleanerHolder.class);
fileCleaner = wfcleaner.getFileCleaner();
holder = new ReaderSpoolFileHolder();
Modified: jcr/branches/1.12.x/exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docbook/en-US/modules/jcr/configuration/exo-jcr-configuration.xml
===================================================================
--- jcr/branches/1.12.x/exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docbook/en-US/modules/jcr/configuration/exo-jcr-configuration.xml 2010-11-17 13:02:14 UTC (rev 3470)
+++ jcr/branches/1.12.x/exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docbook/en-US/modules/jcr/configuration/exo-jcr-configuration.xml 2010-11-17 13:40:14 UTC (rev 3471)
@@ -197,6 +197,16 @@
<para><emphasis role="bold">session-max-age</emphasis>: The time after
which an idle session will be removed (called logout). If session-max-age
is not set up, idle session will never be removed.</para>
+
+ <para id="JCR.eXoJCRconfiguration.LockRemoverMaxThreads"><emphasis
+ role="bold">lock-remover-max-threads</emphasis>: Number of threads that
+ can serve LockRemover tasks. Default value is 1. Repository may have many
+ workspaces, each workspace have own LockManager. JCR supports Locks with
+ defined lifetime. Such a lock must be removed is it become expired. That
+ is what LockRemovers does. But LockRemovers is not an independent
+ timer-threads, its a task that executed each 30 seconds. Such a task is
+ served by ThreadPoolExecutor which may use different number of
+ threads.</para>
</section>
<section>
@@ -376,6 +386,13 @@
<para><emphasis role="bold">path</emphasis>: A lock folder. Each workspace
has its own one.</para>
+ <note>
+ <para>Also see <link
+ linkend="JCR.eXoJCRconfiguration.LockRemoverMaxThreads"><emphasis
+ role="bold">lock-remover-max-threads</emphasis></link> repository
+ configuration parameter.</para>
+ </note>
+
<programlisting><!ELEMENT repository-service (repositories)>
<!ATTLIST repository-service default-repository NMTOKEN #REQUIRED>
<!ELEMENT repositories (repository)>
15 years, 6 months
exo-jcr SVN: r3470 - jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/core.
by do-not-reply@jboss.org
Author: tolusha
Date: 2010-11-17 08:02:14 -0500 (Wed, 17 Nov 2010)
New Revision: 3470
Modified:
jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/core/TestRepositoryManagement.java
Log:
EXOJCR-952: fix test
Modified: jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/core/TestRepositoryManagement.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/core/TestRepositoryManagement.java 2010-11-17 12:53:30 UTC (rev 3469)
+++ jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/core/TestRepositoryManagement.java 2010-11-17 13:02:14 UTC (rev 3470)
@@ -24,8 +24,8 @@
import org.exoplatform.services.jcr.config.RepositoryEntry;
import org.exoplatform.services.jcr.config.WorkspaceEntry;
import org.exoplatform.services.jcr.impl.storage.jdbc.JDBCWorkspaceDataContainer;
+import org.exoplatform.services.jcr.util.IdGenerator;
import org.exoplatform.services.jcr.util.TesterConfigurationHelper;
-import org.exoplatform.services.jcr.util.IdGenerator;
import javax.jcr.NamespaceException;
import javax.jcr.Node;
@@ -80,8 +80,8 @@
WorkspaceEntry secondWs =
helper.getNewWs(defaultWs + IdGenerator.generate(), isDefaultWsMultiDb, isDefaultWsMultiDb ? null
- : workspaceEntry.getContainer().getParameterValue("sourceName"), "target/temp/values/"
- + IdGenerator.generate(), wsEntry.getContainer());
+ : workspaceEntry.getContainer().getParameterValue("source-name"),
+ "target/temp/values/" + IdGenerator.generate(), wsEntry.getContainer());
repositoryEntry.addWorkspace(secondWs);
15 years, 6 months
exo-jcr SVN: r3469 - jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene.
by do-not-reply@jboss.org
Author: tolusha
Date: 2010-11-17 07:53:30 -0500 (Wed, 17 Nov 2010)
New Revision: 3469
Modified:
jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/IndexInfos.java
Log:
JCR-1468: fix issue when IndexInfos read inccorect list of indexes.
Modified: jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/IndexInfos.java
===================================================================
--- jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/IndexInfos.java 2010-11-17 12:50:18 UTC (rev 3468)
+++ jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/IndexInfos.java 2010-11-17 12:53:30 UTC (rev 3469)
@@ -112,6 +112,9 @@
*/
public void read() throws IOException
{
+ // Knows issue for NFS based on ext3. Need to refresh directory to read actual data.
+ dir.list();
+
names.clear();
indexes.clear();
if (dir.fileExists(name))
15 years, 6 months
exo-jcr SVN: r3468 - jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene.
by do-not-reply@jboss.org
Author: tolusha
Date: 2010-11-17 07:50:18 -0500 (Wed, 17 Nov 2010)
New Revision: 3468
Modified:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/IndexInfos.java
Log:
EXOJCR-1043: fix issue when IndexInfos read inccorect list of indexes.
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/IndexInfos.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/IndexInfos.java 2010-11-17 12:04:00 UTC (rev 3467)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/IndexInfos.java 2010-11-17 12:50:18 UTC (rev 3468)
@@ -118,6 +118,9 @@
{
public Object run() throws Exception
{
+ // Known issue for NFS bases on ext3. Need to refresh directory to read actual data.
+ dir.list();
+
names.clear();
indexes.clear();
if (dir.fileExists(name))
15 years, 6 months