exo-jcr SVN: r4741 - in jcr/branches/1.12.x: patch/1.12.10-GA/JCR-1654 and 1 other directory.
by do-not-reply@jboss.org
Author: trang_vu
Date: 2011-08-11 07:53:23 -0400 (Thu, 11 Aug 2011)
New Revision: 4741
Added:
jcr/branches/1.12.x/patch/1.12.10-GA/JCR-1654/readme.txt
Modified:
jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionImpl.java
Log:
JCR-1654: Performance issues due to SecureRandom.nextBytes under heavy load
Fix description
* Avoid UUID generation for id of SessionImpl.
Now, id of Sessionimpl is generated as "System.currentTimeMillis() + "_" + SEQUENCE.incrementAndGet()"
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 2011-08-11 11:14:35 UTC (rev 4740)
+++ jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionImpl.java 2011-08-11 11:53:23 UTC (rev 4741)
@@ -49,7 +49,6 @@
import org.exoplatform.services.jcr.impl.xml.exporting.BaseXmlExporter;
import org.exoplatform.services.jcr.impl.xml.importing.ContentImporter;
import org.exoplatform.services.jcr.impl.xml.importing.StreamImporter;
-import org.exoplatform.services.jcr.util.IdGenerator;
import org.exoplatform.services.security.ConversationState;
import org.exoplatform.services.security.Identity;
import org.xml.sax.ContentHandler;
@@ -67,6 +66,7 @@
import java.util.List;
import java.util.Map;
import java.util.Set;
+import java.util.concurrent.atomic.AtomicLong;
import javax.jcr.AccessDeniedException;
import javax.jcr.Credentials;
@@ -100,6 +100,8 @@
public class SessionImpl implements ExtendedSession, NamespaceAccessor
{
+ private static final AtomicLong SEQUENCE = new AtomicLong();
+
public static final int DEFAULT_LAZY_READ_THRESHOLD = 100;
private final RepositoryImpl repository;
@@ -150,7 +152,7 @@
this.workspaceName = workspaceName;
this.container = container;
this.live = true;
- this.id = IdGenerator.generate();
+ this.id = System.currentTimeMillis() + "_" + SEQUENCE.incrementAndGet();
this.userState = userState;
this.repository = (RepositoryImpl)container.getComponentInstanceOfType(RepositoryImpl.class);
Added: jcr/branches/1.12.x/patch/1.12.10-GA/JCR-1654/readme.txt
===================================================================
--- jcr/branches/1.12.x/patch/1.12.10-GA/JCR-1654/readme.txt (rev 0)
+++ jcr/branches/1.12.x/patch/1.12.10-GA/JCR-1654/readme.txt 2011-08-11 11:53:23 UTC (rev 4741)
@@ -0,0 +1,60 @@
+Summary
+
+ * Status: Performance issues due to SecureRandom.nextBytes under heavy load
+ * CCP Issue: CCP-1032, Product Jira Issue: JCR-1654.
+ * Complexity: low
+
+The Proposal
+Problem description
+
+What is the problem to fix?
+During the benchmarks we encounter a weird slowness off UUID generation in the system.
+A detailed study has been performed and in short it occurs sometimes and for some OS the UUID method is really slow under heavy load which causes a huge bottleneck.
+
+Fix description
+
+How is the problem fixed?
+ * Avoid UUID generation for id of SessionImpl. Now, id of Sessionimpl is generated as "System.currentTimeMillis() + "_" + SEQUENCE.incrementAndGet()"
+
+Patch file: JCR-1654.patch
+
+Tests to perform
+
+Reproduction test
+* No
+
+Tests performed at DevLevel
+* No
+
+Tests performed at QA/Support Level
+* No
+Documentation changes
+
+Documentation changes:
+* No
+Configuration changes
+
+Configuration changes:
+* No
+
+Will previous configuration continue to work?
+* No
+Risks and impacts
+
+Can this bug fix have any side effects on current client projects?
+
+ * Function or ClassName change
+
+Is there a performance risk/cost?
+* Little increase performance under heavy load.
+
+Validation (PM/Support/QA)
+
+PM Comment
+* Patch approved.
+
+Support Comment
+*
+
+QA Feedbacks
+*
12 years, 10 months
exo-jcr SVN: r4740 - in jcr/branches/1.12.x: exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent and 2 other directories.
by do-not-reply@jboss.org
Author: trang_vu
Date: 2011-08-11 07:14:35 -0400 (Thu, 11 Aug 2011)
New Revision: 4740
Added:
jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/datamodel/NullItemData.java
jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/datamodel/NullNodeData.java
jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/datamodel/NullPropertyData.java
jcr/branches/1.12.x/patch/1.12.10-GA/JCR-1633/readme.txt
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/VersionableWorkspaceDataManager.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-1633: Allow to keep missing values into the JCR Cache
Fix description
* Keep NullNodeData and NullPropertyData in cache for missing values.
Added: jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/datamodel/NullItemData.java
===================================================================
--- jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/datamodel/NullItemData.java (rev 0)
+++ jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/datamodel/NullItemData.java 2011-08-11 11:14:35 UTC (rev 4740)
@@ -0,0 +1,98 @@
+/*
+ * Copyright (C) 2003-2010 eXo Platform SAS.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Affero General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see<http://www.gnu.org/licenses/>.
+ */
+package org.exoplatform.services.jcr.datamodel;
+
+import org.exoplatform.services.jcr.dataflow.ItemDataVisitor;
+
+import javax.jcr.RepositoryException;
+
+/**
+ * Created by The eXo Platform SAS.
+ *
+ * <br/>Date:
+ *
+ * @author <a href="karpenko.sergiy(a)gmail.com">Karpenko Sergiy</a>
+ * @version $Id: NullItemData.java 111 2011-05-30 11:11:11Z serg $
+ */
+public abstract class NullItemData implements ItemData
+{
+
+ public static final String NULL_ID = "_null_id";
+
+ private final String id;
+
+ private final String parentId;
+
+ private final QPathEntry name;
+
+ private final QPath path;
+
+ public NullItemData(NodeData parent, QPathEntry name)
+ {
+ this.parentId = parent.getIdentifier();
+ this.path = QPath.makeChildPath(parent.getQPath(), name);
+ this.name = name;
+ this.id = NULL_ID;
+ }
+
+ public NullItemData(String id)
+ {
+ this.parentId = null;
+ this.path = null;
+ this.name = null;
+ this.id = id;
+ }
+
+ public NullItemData()
+ {
+ this.parentId = null;
+ this.path = null;
+ this.name = null;
+ this.id = NULL_ID;
+ }
+
+ public void accept(ItemDataVisitor visitor) throws RepositoryException
+ {
+ throw new UnsupportedOperationException("Method is not supported");
+ }
+
+ public String getIdentifier()
+ {
+ return id;
+ }
+
+ public String getParentIdentifier()
+ {
+ return parentId;
+ }
+
+ public int getPersistedVersion()
+ {
+ throw new UnsupportedOperationException("Method is not supported");
+ }
+
+ public QPath getQPath()
+ {
+ return path;
+ }
+
+ public QPathEntry getName()
+ {
+ return name;
+ }
+
+}
Added: jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/datamodel/NullNodeData.java
===================================================================
--- jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/datamodel/NullNodeData.java (rev 0)
+++ jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/datamodel/NullNodeData.java 2011-08-11 11:14:35 UTC (rev 4740)
@@ -0,0 +1,88 @@
+/*
+ * Copyright (C) 2010 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.datamodel;
+
+import org.exoplatform.services.jcr.access.AccessControlList;
+
+/**
+ * This class is used to represent <code>null</code> value, it is designed to be used
+ * into the cache to represent missing value.
+ *
+ * @author <a href="anatoliy.bazko(a)exoplatform.org">Anatoliy Bazko</a>
+ * @version $Id: NullNodeData.java 111 2011-05-30 11:11:11Z tolusha $
+ */
+public class NullNodeData extends NullItemData implements NodeData
+{
+
+ public NullNodeData(NodeData parent, QPathEntry name)
+ {
+ super(parent, name);
+ }
+
+ public NullNodeData(String id)
+ {
+ super(id);
+ }
+
+ public NullNodeData()
+ {
+ super();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public boolean isNode()
+ {
+ return true;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public AccessControlList getACL()
+ {
+ throw new UnsupportedOperationException("Method is not supported");
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public InternalQName[] getMixinTypeNames()
+ {
+ throw new UnsupportedOperationException("Method is not supported");
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public int getOrderNumber()
+ {
+ throw new UnsupportedOperationException("Method is not supported");
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public InternalQName getPrimaryTypeName()
+ {
+ throw new UnsupportedOperationException("Method is not supported");
+ }
+
+}
Added: jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/datamodel/NullPropertyData.java
===================================================================
--- jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/datamodel/NullPropertyData.java (rev 0)
+++ jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/datamodel/NullPropertyData.java 2011-08-11 11:14:35 UTC (rev 4740)
@@ -0,0 +1,79 @@
+/*
+ * Copyright (C) 2003-2010 eXo Platform SAS.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Affero General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see<http://www.gnu.org/licenses/>.
+ */
+package org.exoplatform.services.jcr.datamodel;
+
+import java.util.List;
+
+/**
+ * Created by The eXo Platform SAS.
+ *
+ * <br/>Date:
+ *
+ * @author <a href="karpenko.sergiy(a)gmail.com">Karpenko Sergiy</a>
+ * @version $Id: NullPropertyData.java 111 2011-05-30 11:11:11Z serg $
+ */
+public class NullPropertyData extends NullItemData implements PropertyData
+{
+
+ public NullPropertyData(NodeData parent, QPathEntry name)
+ {
+ super(parent, name);
+ }
+
+ public NullPropertyData(String id)
+ {
+ super(id);
+ }
+
+ public NullPropertyData()
+ {
+ super();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public int getType()
+ {
+ throw new UnsupportedOperationException("Method is not supported");
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public List<ValueData> getValues()
+ {
+ throw new UnsupportedOperationException("Method is not supported");
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public boolean isMultiValued()
+ {
+ throw new UnsupportedOperationException("Method is not supported");
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public boolean isNode()
+ {
+ return false;
+ }
+
+}
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 2011-08-11 10:41:53 UTC (rev 4739)
+++ jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/CacheableWorkspaceDataManager.java 2011-08-11 11:14:35 UTC (rev 4740)
@@ -23,6 +23,9 @@
import org.exoplatform.services.jcr.datamodel.ItemData;
import org.exoplatform.services.jcr.datamodel.ItemType;
import org.exoplatform.services.jcr.datamodel.NodeData;
+import org.exoplatform.services.jcr.datamodel.NullItemData;
+import org.exoplatform.services.jcr.datamodel.NullNodeData;
+import org.exoplatform.services.jcr.datamodel.NullPropertyData;
import org.exoplatform.services.jcr.datamodel.PropertyData;
import org.exoplatform.services.jcr.datamodel.QPathEntry;
import org.exoplatform.services.jcr.datamodel.ValueData;
@@ -418,18 +421,20 @@
{
data = getPersistedItemData(parentData, name, itemType);
}
- else if (!data.isNode())
- {
- fixPropertyValues((PropertyData)data);
- }
}
finally
{
request.done();
}
}
- else if (!data.isNode())
+
+ if (data instanceof NullItemData)
{
+ return null;
+ }
+
+ if (data != null && !data.isNode())
+ {
fixPropertyValues((PropertyData)data);
}
@@ -460,18 +465,20 @@
{
data = getPersistedItemData(identifier);
}
- else if (!data.isNode())
- {
- fixPropertyValues((PropertyData)data);
- }
}
finally
{
request.done();
}
}
- else if (!data.isNode())
+
+ if (data instanceof NullItemData)
{
+ return null;
+ }
+
+ if (data != null && !data.isNode())
+ {
fixPropertyValues((PropertyData)data);
}
@@ -749,9 +756,23 @@
throws RepositoryException
{
ItemData data = super.getItemData(parentData, name, itemType);
- if (data != null && cache.isEnabled())
+ if (cache.isEnabled())
{
- cache.put(data);
+ if (data == null)
+ {
+ if (itemType == ItemType.NODE || itemType == ItemType.UNKNOWN)
+ {
+ cache.put(new NullNodeData(parentData, name));
+ }
+ else
+ {
+ cache.put(new NullPropertyData(parentData, name));
+ }
+ }
+ else
+ {
+ cache.put(data);
+ }
}
return data;
}
@@ -766,9 +787,17 @@
protected ItemData getPersistedItemData(String identifier) throws RepositoryException
{
ItemData data = super.getItemData(identifier);
- if (data != null && cache.isEnabled())
+ if (cache.isEnabled())
{
- cache.put(data);
+ if (data != null)
+ {
+ cache.put(data);
+ }
+ else if (identifier != null)
+ {
+ // no matter does property or node expected - store NullNodeData
+ cache.put(new NullNodeData(identifier));
+ }
}
return data;
}
Modified: jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/VersionableWorkspaceDataManager.java
===================================================================
--- jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/VersionableWorkspaceDataManager.java 2011-08-11 10:41:53 UTC (rev 4739)
+++ jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/VersionableWorkspaceDataManager.java 2011-08-11 11:14:35 UTC (rev 4740)
@@ -28,6 +28,7 @@
import org.exoplatform.services.jcr.datamodel.ItemData;
import org.exoplatform.services.jcr.datamodel.ItemType;
import org.exoplatform.services.jcr.datamodel.NodeData;
+import org.exoplatform.services.jcr.datamodel.NullItemData;
import org.exoplatform.services.jcr.datamodel.PropertyData;
import org.exoplatform.services.jcr.datamodel.QPath;
import org.exoplatform.services.jcr.datamodel.QPathEntry;
@@ -157,14 +158,14 @@
{
// from cache at first
ItemData cdata = persistentManager.getCachedItemData(identifier);
- if (cdata != null)
+ if (cdata != null && !(cdata instanceof NullItemData))
return super.getItemData(identifier);
if (!this.equals(versionDataManager) && !identifier.equals(Constants.ROOT_UUID))
{
// search in System cache for /jcr:system nodes only
cdata = versionDataManager.persistentManager.getCachedItemData(identifier);
- if (cdata != null)
+ if (cdata != null && !(cdata instanceof NullItemData))
if (isSystemDescendant(cdata.getQPath()))
return versionDataManager.getItemData(identifier);
else
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 2011-08-11 10:41:53 UTC (rev 4739)
+++ jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/JBossCacheWorkspaceStorageCache.java 2011-08-11 11:14:35 UTC (rev 4740)
@@ -30,6 +30,9 @@
import org.exoplatform.services.jcr.datamodel.ItemData;
import org.exoplatform.services.jcr.datamodel.ItemType;
import org.exoplatform.services.jcr.datamodel.NodeData;
+import org.exoplatform.services.jcr.datamodel.NullItemData;
+import org.exoplatform.services.jcr.datamodel.NullNodeData;
+import org.exoplatform.services.jcr.datamodel.NullPropertyData;
import org.exoplatform.services.jcr.datamodel.PropertyData;
import org.exoplatform.services.jcr.datamodel.QPath;
import org.exoplatform.services.jcr.datamodel.QPathEntry;
@@ -396,6 +399,13 @@
*/
public void put(ItemData item)
{
+ // There is different commit processing for NullNodeData and ordinary ItemData
+ if (item instanceof NullItemData)
+ {
+ putNullItem((NullItemData)item);
+ return;
+ }
+
boolean inTransaction = cache.isTransactionActive();
try
{
@@ -507,7 +517,7 @@
for (String propId : set)
{
PropertyData prop = (PropertyData)cache.get(makeItemFqn(propId), ITEM_DATA);
- if (prop == null)
+ if (prop == null || prop instanceof NullItemData)
{
return null;
}
@@ -680,23 +690,48 @@
public ItemData get(String parentId, QPathEntry name, ItemType itemType)
{
String itemId = null;
- if (itemType == ItemType.NODE || itemType == ItemType.UNKNOWN)
+ if (itemType == ItemType.UNKNOWN)
{
- // try as node first
+ // Try as node first.
itemId = (String)cache.get(makeChildFqn(childNodes, parentId, name), ITEM_ID);
+
+ if (itemId == null || itemId.equals(NullItemData.NULL_ID))
+ {
+ // node with such a name is not found or marked as not-exist, so check the properties
+ String propId = (String)cache.get(makeChildFqn(childProps, parentId, name), ITEM_ID);
+ if (propId != null)
+ {
+ itemId = propId;
+ }
+ }
}
-
- if (itemType == ItemType.PROPERTY || itemType == ItemType.UNKNOWN && itemId == null)
+ else if (itemType == ItemType.NODE)
{
- // try as property
+ itemId = (String)cache.get(makeChildFqn(childNodes, parentId, name), ITEM_ID);
+ }
+ else
+ {
itemId = (String)cache.get(makeChildFqn(childProps, parentId, name), ITEM_ID);
}
if (itemId != null)
{
- return get(itemId);
+ if (itemId.equals(NullItemData.NULL_ID))
+ {
+ if (itemType == ItemType.UNKNOWN || itemType == ItemType.NODE)
+ {
+ return new NullNodeData();
+ }
+ else
+ {
+ return new NullPropertyData();
+ }
+ }
+ else
+ {
+ return get(itemId);
+ }
}
-
return null;
}
@@ -705,6 +740,7 @@
*/
public ItemData get(String id)
{
+ // NullNodeData with id may be stored as ordinary NodeData or PropertyData
return (ItemData)cache.get(makeItemFqn(id), ITEM_DATA);
}
@@ -723,7 +759,7 @@
for (Object child : set)
{
NodeData node = (NodeData)cache.get(makeItemFqn((String)child), ITEM_DATA);
- if (node == null)
+ if (node == null || node instanceof NullItemData)
{
return null;
}
@@ -788,7 +824,7 @@
for (Object child : set)
{
PropertyData prop = (PropertyData)cache.get(makeItemFqn((String)child), ITEM_DATA);
- if (prop == null)
+ if (prop == null || prop instanceof NullItemData)
{
return null;
}
@@ -944,6 +980,54 @@
modifyListsOfChild == ModifyChildOption.NOT_MODIFY);
}
+ /**
+ * Internal put NullNode.
+ *
+ * @param item, NullItemData, new data to put in the cache
+ */
+ protected void putNullItem(NullItemData item)
+ {
+ boolean inTransaction = cache.isTransactionActive();
+ try
+ {
+ if (!inTransaction)
+ {
+ cache.beginTransaction();
+ }
+ cache.setLocal(true);
+
+ if (!item.getIdentifier().equals(NullItemData.NULL_ID))
+ {
+ //put in $ITEMS
+ cache.putIfAbsent(makeItemFqn(item.getIdentifier()), ITEM_DATA, item);
+ }
+ else if (item.getName() != null && item.getParentIdentifier() != null)
+ {
+ if (item.isNode())
+ {
+ // put in $CHILD_NODES
+ cache.putIfAbsent(makeChildFqn(childNodes, item.getParentIdentifier(), item.getName()), ITEM_ID,
+ NullItemData.NULL_ID);
+ }
+ else
+ {
+ // put in $CHILD_PROPERTIES
+ cache.putIfAbsent(makeChildFqn(childProps, item.getParentIdentifier(), item.getName()), ITEM_ID,
+ NullItemData.NULL_ID);
+ }
+ }
+ }
+ finally
+ {
+ cache.setLocal(false);
+ if (!inTransaction)
+ {
+ dedicatedTxCommit();
+ }
+ }
+
+ }
+
protected ItemData putNodeInBufferedCache(NodeData node, ModifyChildOption modifyListsOfChild)
{
// if not a root node
@@ -960,7 +1044,9 @@
}
}
// add in ITEMS
- return (ItemData)cache.putInBuffer(makeItemFqn(node.getIdentifier()), ITEM_DATA, node);
+ // NullNodeData must never be returned inside internal cache operations.
+ ItemData returnedData = (ItemData)cache.putInBuffer(makeItemFqn(node.getIdentifier()), ITEM_DATA, node);
+ return (returnedData instanceof NullItemData) ? null : returnedData;
}
/**
@@ -1008,8 +1094,11 @@
}
// add in ITEMS
- return (PropertyData)cache.put(makeItemFqn(prop.getIdentifier()), ITEM_DATA, prop,
- modifyListsOfChild == ModifyChildOption.NOT_MODIFY);
+ // NullItemData must never be returned inside internal cache operations.
+ ItemData returnedData =
+ (ItemData)cache.put(makeItemFqn(prop.getIdentifier()), ITEM_DATA, prop,
+ modifyListsOfChild == ModifyChildOption.NOT_MODIFY);
+ return (returnedData instanceof NullItemData) ? null : (PropertyData)returnedData;
}
protected void removeItem(ItemData item)
@@ -1065,7 +1154,8 @@
protected void updateMixin(NodeData node)
{
NodeData prevData = (NodeData)cache.put(makeItemFqn(node.getIdentifier()), ITEM_DATA, node);
- if (prevData != null)
+ // prevent update NullNodeData
+ if (prevData != null && !(prevData instanceof NullItemData))
{
// do update ACL if needed
if (prevData.getACL() == null || !prevData.getACL().equals(node.getACL()))
@@ -1119,6 +1209,7 @@
*/
protected void updateInBuffer(final NodeData node, final NodeData prevNode)
{
+ // I expect that NullNodeData will never update existing NodeData.
// get previously cached NodeData and using its name remove child on the parent
Fqn<String> prevFqn =
makeChildFqn(childNodes, node.getParentIdentifier(), prevNode.getQPath().getEntries()[prevNode.getQPath()
@@ -1132,6 +1223,7 @@
}
}
+ // node and prevNode are not NullNodeDatas
// update childs paths if index changed
int nodeIndex = node.getQPath().getEntries()[node.getQPath().getEntries().length - 1].getIndex();
int prevNodeIndex = prevNode.getQPath().getEntries()[prevNode.getQPath().getEntries().length - 1].getIndex();
@@ -1165,7 +1257,7 @@
// check is this descendant of prevRootPath
QPath nodeQPath = data.getQPath();
- if (nodeQPath.isDescendantOf(prevRootPath))
+ if (nodeQPath != null && nodeQPath.isDescendantOf(prevRootPath))
{
//make relative path
Added: jcr/branches/1.12.x/patch/1.12.10-GA/JCR-1633/readme.txt
===================================================================
--- jcr/branches/1.12.x/patch/1.12.10-GA/JCR-1633/readme.txt (rev 0)
+++ jcr/branches/1.12.x/patch/1.12.10-GA/JCR-1633/readme.txt 2011-08-11 11:14:35 UTC (rev 4740)
@@ -0,0 +1,65 @@
+Summary
+
+ * Status: Allow to keep missing values into the JCR Cache
+ * CCP Issue: CCP-1032, Product Jira Issue: JCR-1633.
+ * Complexity: low
+
+The Proposal
+Problem description
+
+What is the problem to fix?
+
+ * Allow to keep missing values into the JCR Cache.
+
+Fix description
+
+How is the problem fixed?
+
+ * Keep NullNodeData and NullPropertyData in cache for missing values.
+
+Patch file: JCR-1633.patch
+
+Tests to perform
+
+Reproduction test
+
+ * When a node or a property value is missing, we keep nothing into the JCR cache so if an application on a top of the JCR tries to access several time to a missing data, the JCR will access the database each time. The idea will be to store the value "null" into the cache to prevent useless database accesses.
+
+Tests performed at DevLevel
+* No
+
+Tests performed at QA/Support Level
+* No
+
+Documentation changes
+
+Documentation changes:
+* No
+
+Configuration changes
+
+Configuration changes:
+* No
+
+Will previous configuration continue to work?
+* No
+
+Risks and impacts
+
+Can this bug fix have any side effects on current client projects?
+
+ * Function or ClassName change
+
+Is there a performance risk/cost?
+*
+Validation (PM/Support/QA)
+
+PM Comment
+* Patch approved.
+
+Support Comment
+*
+
+QA Feedbacks
+*
+
12 years, 10 months
exo-jcr SVN: r4739 - jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/access.
by do-not-reply@jboss.org
Author: trang_vu
Date: 2011-08-11 06:41:53 -0400 (Thu, 11 Aug 2011)
New Revision: 4739
Added:
jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/access/DynamicIdentity.java
Log:
JCR-1636: commit DynamicIdentity.java
Added: jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/access/DynamicIdentity.java
===================================================================
--- jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/access/DynamicIdentity.java (rev 0)
+++ jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/access/DynamicIdentity.java 2011-08-11 10:41:53 UTC (rev 4739)
@@ -0,0 +1,32 @@
+/*
+ * Copyright (C) 2003-2011 eXo Platform SAS.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Affero General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see<http://www.gnu.org/licenses/>.
+ */
+package org.exoplatform.services.jcr.access;
+
+
+/**
+ * Created by The eXo Platform SAS.
+ *
+ * <br/>Date: 2011
+ *
+ * @author <a href="mailto:alex.reshetnyak@exoplatform.com.ua">Alex Reshetnyak</a>
+ * @version $Id: FakeUserIdentity.java 111 2011-11-11 11:11:11Z rainf0x $
+ */
+public class DynamicIdentity
+ extends SystemIdentity
+{
+ public static final String DYNAMIC = "__dynamic".intern();
+}
12 years, 10 months
exo-jcr SVN: r4738 - in jcr/branches/1.12.x: exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/core and 7 other directories.
by do-not-reply@jboss.org
Author: trang_vu
Date: 2011-08-11 06:41:11 -0400 (Thu, 11 Aug 2011)
New Revision: 4738
Added:
jcr/branches/1.12.x/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/common/
jcr/branches/1.12.x/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/common/DynamicSessionProviderTest.java
jcr/branches/1.12.x/patch/1.12.10-GA/JCR-1636/readme.txt
Modified:
jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/access/AccessManager.java
jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/core/ManageableRepository.java
jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/RepositoryImpl.java
jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/jndi/BindableRepositoryImpl.java
jcr/branches/1.12.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/access/TestUserAccess.java
jcr/branches/1.12.x/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/common/SessionProvider.java
jcr/branches/1.12.x/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/BaseStandaloneTest.java
Log:
JCR-1636: Allow to create sessions from ACLs
Fix description
* Create session with custom set of ACL.
Modified: jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/access/AccessManager.java
===================================================================
--- jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/access/AccessManager.java 2011-08-11 09:34:12 UTC (rev 4737)
+++ jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/access/AccessManager.java 2011-08-11 10:41:11 UTC (rev 4738)
@@ -192,7 +192,9 @@
}
else if (user.isMemberOf(ace.getMembershipEntry()))
+ {
return true;
+ }
}
}
return false;
Modified: jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/core/ManageableRepository.java
===================================================================
--- jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/core/ManageableRepository.java 2011-08-11 09:34:12 UTC (rev 4737)
+++ jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/core/ManageableRepository.java 2011-08-11 10:41:11 UTC (rev 4738)
@@ -23,9 +23,11 @@
import org.exoplatform.services.jcr.config.WorkspaceEntry;
import org.exoplatform.services.jcr.core.nodetype.ExtendedNodeTypeManager;
import org.exoplatform.services.jcr.dataflow.persistent.ItemsPersistenceListener;
+import org.exoplatform.services.security.MembershipEntry;
import java.io.IOException;
import java.io.InputStream;
+import java.util.Collection;
import javax.jcr.NamespaceRegistry;
import javax.jcr.NoSuchWorkspaceException;
@@ -117,6 +119,15 @@
Session getSystemSession(String workspaceName) throws RepositoryException;
/**
+ * @param workspaceName - name of workspace
+ * @param membershipEntries - list of memberships
+ * @return the Dynamic session (session with Dynamic identity)
+ * @throws RepositoryException
+ */
+ Session getDynamicSession(String workspaceName, Collection<MembershipEntry> membershipEntries)
+ throws RepositoryException;
+
+ /**
* @return array of workspace names
*/
String[] getWorkspaceNames();
Modified: jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/RepositoryImpl.java
===================================================================
--- jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/RepositoryImpl.java 2011-08-11 09:34:12 UTC (rev 4737)
+++ jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/RepositoryImpl.java 2011-08-11 10:41:11 UTC (rev 4738)
@@ -19,6 +19,7 @@
package org.exoplatform.services.jcr.impl.core;
import org.exoplatform.services.jcr.access.AuthenticationPolicy;
+import org.exoplatform.services.jcr.access.DynamicIdentity;
import org.exoplatform.services.jcr.access.SystemIdentity;
import org.exoplatform.services.jcr.config.RepositoryConfigurationException;
import org.exoplatform.services.jcr.config.RepositoryEntry;
@@ -39,11 +40,14 @@
import org.exoplatform.services.log.ExoLogger;
import org.exoplatform.services.log.Log;
import org.exoplatform.services.security.ConversationState;
+import org.exoplatform.services.security.Identity;
+import org.exoplatform.services.security.MembershipEntry;
import org.picocontainer.ComponentAdapter;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
+import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
@@ -342,6 +346,29 @@
}
/**
+ * {@inheritDoc}
+ */
+ public SessionImpl getDynamicSession(String workspaceName, Collection<MembershipEntry> membershipEntries)
+ throws RepositoryException
+ {
+
+ if (getState() == OFFLINE)
+ LOG.warn("Repository " + getName() + " is OFFLINE.");
+
+ WorkspaceContainer workspaceContainer = repositoryContainer.getWorkspaceContainer(workspaceName);
+ if (workspaceContainer == null || !workspaceContainer.getWorkspaceInitializer().isWorkspaceInitialized())
+ {
+ throw new RepositoryException("Workspace " + workspaceName + " not found or workspace is not initialized");
+ }
+
+ SessionFactory sessionFactory = workspaceContainer.getSessionFactory();
+
+ Identity id = new Identity(DynamicIdentity.DYNAMIC, membershipEntries);
+
+ return sessionFactory.createSession(new ConversationState(id));
+ }
+
+ /**
* @return system workspace name as it configured in jcr configuration
*/
public String getSystemWorkspaceName()
Modified: jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/jndi/BindableRepositoryImpl.java
===================================================================
--- jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/jndi/BindableRepositoryImpl.java 2011-08-11 09:34:12 UTC (rev 4737)
+++ jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/jndi/BindableRepositoryImpl.java 2011-08-11 10:41:11 UTC (rev 4738)
@@ -25,10 +25,12 @@
import org.exoplatform.services.jcr.core.WorkspaceContainerFacade;
import org.exoplatform.services.jcr.core.nodetype.ExtendedNodeTypeManager;
import org.exoplatform.services.jcr.dataflow.persistent.ItemsPersistenceListener;
+import org.exoplatform.services.security.MembershipEntry;
import java.io.IOException;
import java.io.InputStream;
import java.io.Serializable;
+import java.util.Collection;
import javax.jcr.Credentials;
import javax.jcr.LoginException;
@@ -133,6 +135,18 @@
/*
* (non-Javadoc)
* @see
+ * org.exoplatform.services.jcr.core.ManageableRepository#getDynamicSession
+ * (java.lang.String)
+ */
+ public Session getDynamicSession(String workspaceName, Collection<MembershipEntry> membershipEntries)
+ throws RepositoryException
+ {
+ return delegatee.getDynamicSession(workspaceName, membershipEntries);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see
* org.exoplatform.services.jcr.core.ManageableRepository#getWorkspaceNames()
*/
public String[] getWorkspaceNames()
Modified: jcr/branches/1.12.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/access/TestUserAccess.java
===================================================================
--- jcr/branches/1.12.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/access/TestUserAccess.java 2011-08-11 09:34:12 UTC (rev 4737)
+++ jcr/branches/1.12.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/access/TestUserAccess.java 2011-08-11 10:41:11 UTC (rev 4738)
@@ -23,9 +23,13 @@
import org.exoplatform.services.jcr.access.SystemIdentity;
import org.exoplatform.services.jcr.core.CredentialsImpl;
import org.exoplatform.services.jcr.impl.core.NodeImpl;
+import org.exoplatform.services.security.MembershipEntry;
import java.security.AccessControlException;
+import java.util.ArrayList;
+import java.util.List;
+import javax.jcr.AccessDeniedException;
import javax.jcr.Node;
import javax.jcr.Session;
@@ -72,7 +76,7 @@
public void testUser() throws Exception
{
// Mary only node, Mary membership is '*:/exo', seems it's user
- NodeImpl maryNode = (NodeImpl)testRoot.addNode("mary");
+ NodeImpl maryNode = (NodeImpl) testRoot.addNode("mary");
maryNode.addMixin("exo:privilegeable");
if (!session.getUserID().equals("mary"))
{
@@ -175,4 +179,100 @@
}
}
+ /**
+ * Check if Dynamic user has rights to a node with user "mary".
+ *
+ * @throws Exception
+ */
+ public void testDynamicUserRead() throws Exception
+ {
+ // Mary only node, Mary membership is '*:/platform/users', seems it's user
+ NodeImpl maryNode = (NodeImpl) testRoot.addNode("mary_dynamic");
+ maryNode.addMixin("exo:privilegeable");
+ if (!session.getUserID().equals("mary"))
+ {
+ maryNode.setPermission("*:/platform/users", new String[] {PermissionType.READ});
+ maryNode.setPermission("mary", PermissionType.ALL);
+ maryNode.removePermission(session.getUserID());
+ }
+ maryNode.removePermission(SystemIdentity.ANY);
+ testRoot.save();
+
+ Session marySession =
+ repository.login(new CredentialsImpl("mary", "exo".toCharArray()), session.getWorkspace().getName());
+ NodeImpl myNode = (NodeImpl) marySession.getItem(maryNode.getPath());
+ Node test = myNode.addNode("test");
+ test.setProperty("property", "any data");
+ myNode.save();
+
+ //Dynamic session fail read
+ List<MembershipEntry> dynamicMembershipEntries = new ArrayList<MembershipEntry>();
+ dynamicMembershipEntries.add(new MembershipEntry("/platform/administrators"));
+
+ try
+ {
+ Session dynamicSession =
+ repository.getDynamicSession(session.getWorkspace().getName(), dynamicMembershipEntries);
+ NodeImpl maryNodeDynamic = (NodeImpl) dynamicSession.getItem(maryNode.getPath());
+ fail("Dynamic session with membership '*:/platform/users' should not read node with membership '*:/platform/users'");
+ }
+ catch (AccessDeniedException e)
+ {
+ //ok
+ }
+
+ //Dynamic session successful read
+ dynamicMembershipEntries = new ArrayList<MembershipEntry>();
+ dynamicMembershipEntries.add(new MembershipEntry("/platform/users"));
+
+ //check get
+ try
+ {
+ Session dynamicSession =
+ repository.getDynamicSession(session.getWorkspace().getName(), dynamicMembershipEntries);
+ NodeImpl maryNodeDynamic = (NodeImpl) dynamicSession.getItem(maryNode.getPath());
+ //ok
+ }
+ catch (AccessDeniedException e)
+ {
+
+ e.printStackTrace();
+ fail("Dynamic session with membership '*:/platform/users' should read node with membership '*:/platform/users'. Exception message :"
+ + e.getMessage());
+ }
+
+ //check add
+ try
+ {
+ Session dynamicSession =
+ repository.getDynamicSession(session.getWorkspace().getName(), dynamicMembershipEntries);
+ NodeImpl maryNodeDynamic = (NodeImpl) dynamicSession.getItem(maryNode.getPath());
+
+ maryNodeDynamic.addNode("test2");
+ maryNodeDynamic.save();
+ fail("Dynamic session with membership '*:/platform/users' should be not add child node with membership '*:/platform/users READ'");
+ }
+ catch (AccessDeniedException e)
+ {
+ //ok
+ }
+
+ //check remove
+ try
+ {
+ Session dynamicSession =
+ repository.getDynamicSession(session.getWorkspace().getName(), dynamicMembershipEntries);
+ NodeImpl maryNodeDynamic = (NodeImpl) dynamicSession.getItem(maryNode.getPath());
+
+ maryNodeDynamic.getNode("test").remove();
+ maryNodeDynamic.save();
+ fail("Dynamic session with membership '*:/platform/users' should be not remove child node with membership '*:/platform/users READ'");
+ }
+ catch (AccessDeniedException e)
+ {
+ //ok
+ }
+
+ }
+
}
Modified: jcr/branches/1.12.x/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/common/SessionProvider.java
===================================================================
--- jcr/branches/1.12.x/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/common/SessionProvider.java 2011-08-11 09:34:12 UTC (rev 4737)
+++ jcr/branches/1.12.x/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/common/SessionProvider.java 2011-08-11 10:41:11 UTC (rev 4738)
@@ -18,6 +18,8 @@
*/
package org.exoplatform.services.jcr.ext.common;
+import org.exoplatform.services.jcr.access.AccessControlEntry;
+import org.exoplatform.services.jcr.access.DynamicIdentity;
import org.exoplatform.services.jcr.access.SystemIdentity;
import org.exoplatform.services.jcr.core.ExtendedSession;
import org.exoplatform.services.jcr.core.ManageableRepository;
@@ -28,6 +30,7 @@
import java.util.HashMap;
import java.util.HashSet;
+import java.util.List;
import java.util.Map;
import javax.jcr.LoginException;
@@ -67,6 +70,8 @@
private String currentWorkspace;
private boolean closed;
+
+ private ConversationState conversationState;
/**
* Creates SessionProvider for certain identity.
@@ -81,6 +86,18 @@
}
/**
+ * Creates SessionProvider for a dynamic identity.
+ *
+ * @param membershipEntries the expected memberships
+ */
+ private SessionProvider(HashSet<MembershipEntry> membershipEntries)
+ {
+ this(false);
+ Identity id = new Identity(DynamicIdentity.DYNAMIC, membershipEntries);
+ this.conversationState = new ConversationState(id);
+ }
+
+ /**
* Internal constructor.
*
* @param isSystem
@@ -113,6 +130,25 @@
return new SessionProvider(new ConversationState(id));
}
+ public static SessionProvider createProvider(List<AccessControlEntry> accessList)
+ {
+ if (accessList == null || accessList.isEmpty())
+ {
+ return createAnonimProvider();
+ }
+ else
+ {
+ HashSet<MembershipEntry> membershipEntries = new HashSet<MembershipEntry>();
+
+ for (AccessControlEntry ace : accessList)
+ {
+ membershipEntries.add(ace.getMembershipEntry());
+ }
+ return new SessionProvider(membershipEntries);
+ }
+
+ }
+
/**
* Gets the session from internal cache or creates and caches new one.
*
@@ -142,11 +178,18 @@
if (session == null)
{
-
- if (!isSystem)
+ if (conversationState != null)
+ {
+ session = (ExtendedSession) repository.getDynamicSession(workspaceName, conversationState.getIdentity().getMemberships());
+ }
+ else if (!isSystem)
+ {
session = (ExtendedSession)repository.login(workspaceName);
+ }
else
+ {
session = (ExtendedSession)repository.getSystemSession(workspaceName);
+ }
session.registerLifecycleListener(this);
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 2011-08-11 09:34:12 UTC (rev 4737)
+++ jcr/branches/1.12.x/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/BaseStandaloneTest.java 2011-08-11 10:41:11 UTC (rev 4738)
@@ -53,6 +53,7 @@
import javax.jcr.NodeIterator;
import javax.jcr.PathNotFoundException;
import javax.jcr.RepositoryException;
+import javax.jcr.Session;
import javax.jcr.ValueFactory;
import javax.jcr.Workspace;
@@ -154,10 +155,10 @@
log.info("tearDown() BEGIN " + getClass().getName() + "." + getName());
if (session != null)
{
+ Session sysSession = repository.getSystemSession(session.getWorkspace().getName());
try
{
- session.refresh(false);
- Node rootNode = session.getRootNode();
+ Node rootNode = sysSession.getRootNode();
if (rootNode.hasNodes())
{
// clean test root
@@ -171,7 +172,7 @@
node.remove();
}
}
- session.save();
+ sysSession.save();
}
}
catch (Exception e)
@@ -181,6 +182,7 @@
}
finally
{
+ sysSession.logout();
session.logout();
}
}
Added: jcr/branches/1.12.x/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/common/DynamicSessionProviderTest.java
===================================================================
--- jcr/branches/1.12.x/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/common/DynamicSessionProviderTest.java (rev 0)
+++ jcr/branches/1.12.x/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/common/DynamicSessionProviderTest.java 2011-08-11 10:41:11 UTC (rev 4738)
@@ -0,0 +1,210 @@
+/*
+ * Copyright (C) 2003-2011 eXo Platform SAS.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Affero General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see<http://www.gnu.org/licenses/>.
+ */
+package org.exoplatform.services.jcr.ext.common;
+
+import org.exoplatform.services.jcr.access.AccessControlEntry;
+import org.exoplatform.services.jcr.access.PermissionType;
+import org.exoplatform.services.jcr.access.SystemIdentity;
+import org.exoplatform.services.jcr.core.CredentialsImpl;
+import org.exoplatform.services.jcr.ext.BaseStandaloneTest;
+import org.exoplatform.services.jcr.ext.common.SessionProvider;
+import org.exoplatform.services.jcr.impl.core.NodeImpl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.jcr.AccessDeniedException;
+import javax.jcr.Session;
+
+/**
+ * Created by The eXo Platform SAS.
+ *
+ * <br/>Date: 2011
+ *
+ * @author <a href="mailto:alex.reshetnyak@exoplatform.com.ua">Alex Reshetnyak</a>
+ * @version $Id: DynamicSessionProviderTest.java 111 2011-11-11 11:11:11Z rainf0x $
+ */
+public class DynamicSessionProviderTest
+ extends BaseStandaloneTest
+{
+ private NodeImpl testRoot;
+
+ @Override
+ public void setUp() throws Exception
+ {
+ super.setUp();
+
+ testRoot = (NodeImpl)root.addNode("testDynamicSession");
+ root.save();
+ }
+
+ public void testDynamicSession() throws Exception
+ {
+ // Mary only node, Mary membership is '*:/platform/users', seems it's user
+ NodeImpl maryNode = (NodeImpl) testRoot.addNode("mary_dynamic");
+ maryNode.addMixin("exo:privilegeable");
+ if (!session.getUserID().equals("mary"))
+ {
+ maryNode.setPermission("*:/platform/users", new String[] {PermissionType.READ});
+ maryNode.setPermission("mary", PermissionType.ALL);
+ maryNode.removePermission(session.getUserID());
+ }
+ maryNode.removePermission(SystemIdentity.ANY);
+ testRoot.save();
+
+ Session marySession =
+ repository.login(new CredentialsImpl("mary", "exo".toCharArray()), session.getWorkspace().getName());
+ NodeImpl myNode = (NodeImpl) marySession.getItem(maryNode.getPath());
+ NodeImpl test = (NodeImpl) myNode.addNode("test");
+ test.setProperty("property", "any data");
+ myNode.save();
+ marySession.logout();
+
+ //Dynamic session fail read
+ List<AccessControlEntry> accessControlEntries = new ArrayList<AccessControlEntry>();
+ accessControlEntries.add(new AccessControlEntry("*:/platform/administrators", "READ"));
+ SessionProvider dynamicProvider = SessionProvider.createProvider(accessControlEntries);
+
+ Session dynamicSession = null;
+ try
+ {
+ dynamicSession = dynamicProvider.getSession(session.getWorkspace().getName(), repository);
+ NodeImpl maryNodeDynamic = (NodeImpl) dynamicSession.getItem(maryNode.getPath());
+ fail("Dynamic session with membership '*:/platform/users' should not read node with membership '*:/platform/users'");
+ }
+ catch (AccessDeniedException e)
+ {
+ //ok
+ }
+
+ //Dynamic session successful read
+ accessControlEntries = new ArrayList<AccessControlEntry>();
+ accessControlEntries.add(new AccessControlEntry("*:/platform/users", "READ"));
+ dynamicProvider = SessionProvider.createProvider(accessControlEntries);
+
+ //check get
+ try
+ {
+ dynamicSession = dynamicProvider.getSession(session.getWorkspace().getName(), repository);
+ NodeImpl maryNodeDynamic = (NodeImpl) dynamicSession.getItem(maryNode.getPath());
+ //ok
+ }
+ catch (AccessDeniedException e)
+ {
+
+ e.printStackTrace();
+ fail("Dynamic session with membership '*:/platform/users' should read node with membership '*:/platform/users'. Exception message :"
+ + e.getMessage());
+ }
+
+ //check add
+ try
+ {
+ dynamicSession = dynamicProvider.getSession(session.getWorkspace().getName(), repository);
+ NodeImpl maryNodeDynamic = (NodeImpl) dynamicSession.getItem(maryNode.getPath());
+
+ maryNodeDynamic.addNode("test2");
+ maryNodeDynamic.save();
+ fail("Dynamic session with membership '*:/platform/users' should be not add child node with membership '*:/platform/users READ'");
+ }
+ catch (AccessDeniedException e)
+ {
+ //ok
+ }
+
+ //check remove
+ try
+ {
+ dynamicSession = dynamicProvider.getSession(session.getWorkspace().getName(), repository);
+ NodeImpl maryNodeDynamic = (NodeImpl) dynamicSession.getItem(maryNode.getPath());
+
+ maryNodeDynamic.getNode("test").remove();
+ maryNodeDynamic.save();
+ fail("Dynamic session with membership '*:/platform/users' should be not remove child node with membership '*:/platform/users READ'");
+ }
+ catch (AccessDeniedException e)
+ {
+ //ok
+ }
+ }
+
+ public void testCreateSystemSessionProviderAfterDynamic() throws Exception
+ {
+ // System only node.
+ NodeImpl systemNode = (NodeImpl) testRoot.addNode("system_dynamic");
+ systemNode.addMixin("exo:privilegeable");
+
+ systemNode.setPermission("*:/platform/users", new String[]
+ {PermissionType.READ});
+ systemNode.removePermission(session.getUserID());
+ testRoot.save();
+
+
+ //Dynamic session successful read
+ List<AccessControlEntry> accessControlEntries = new ArrayList<AccessControlEntry>();
+ accessControlEntries.add(new AccessControlEntry("*:/platform/users", "READ"));
+ SessionProvider dynamicProvider = SessionProvider.createProvider(accessControlEntries);
+
+ Session dynamicSession = null;
+
+ //check get
+ try
+ {
+ dynamicSession = dynamicProvider.getSession(session.getWorkspace().getName(), repository);
+ NodeImpl maryNodeDynamic = (NodeImpl) dynamicSession.getItem(systemNode.getPath());
+ //ok
+ }
+ catch (AccessDeniedException e)
+ {
+ e.printStackTrace();
+ fail("Dynamic session with membership '*:/platform/users' should read node with membership '*:/platform/users'. Exception message : "
+ + e.getMessage());
+ }
+
+ //System provider successful read
+ SessionProvider systemProvider = SessionProvider.createSystemProvider();
+ Session systemSession = null;
+ try
+ {
+ systemSession = systemProvider.getSession(session.getWorkspace().getName(), repository);
+ NodeImpl systemNodeOverSystemSession = (NodeImpl) systemSession.getItem(systemNode.getPath());
+ //ok
+ }
+ catch (AccessDeniedException e)
+ {
+ e.printStackTrace();
+ fail("System session should read node with membership '*:/platform/users'. Exception message : "
+ + e.getMessage());
+ }
+
+ //check remove
+ try
+ {
+ systemSession = systemProvider.getSession(session.getWorkspace().getName(), repository);
+ NodeImpl systemNodeOverSystemSession = (NodeImpl) systemSession.getItem(systemNode.getPath());
+
+ systemNodeOverSystemSession.remove();
+ systemSession.save();
+ //ok
+ }
+ catch (AccessDeniedException e)
+ {
+ fail("System session should remove node with membership '*:/platform/users'.");
+ }
+
+ }
+}
Added: jcr/branches/1.12.x/patch/1.12.10-GA/JCR-1636/readme.txt
===================================================================
--- jcr/branches/1.12.x/patch/1.12.10-GA/JCR-1636/readme.txt (rev 0)
+++ jcr/branches/1.12.x/patch/1.12.10-GA/JCR-1636/readme.txt 2011-08-11 10:41:11 UTC (rev 4738)
@@ -0,0 +1,78 @@
+Summary
+
+ * Status: Allow to create sessions from ACLs
+ * CCP Issue: CCP-1032, Product Jira Issue: JCR-1636.
+ * Complexity: Low
+
+The Proposal
+Problem description
+
+What is the problem to fix?
+In authenticated mode, there's a request to cache contents and share the cache for all users. We need to retrieve the contents first then we use a portlet cache to cache the resulting markup and share it between users.
+
+We have three ways to retrieve contents from the JCR :
+
+ * System: if we use this, we will end up with contents visible by unauthorized users
+ * User session: if we use this, the first to access the contents will cache the results. Thus, the resulting markup is based on the first user to access them. The resulting effect is like the System session, we end up with possible visible contents, not authorized for some users.
+ * Anonymous: The last one, if we're authenticated, we can still create an anonymous session. But, we will then see the "public" contents only (with "Any READ" permission). For an intranet need, it's not enough. Most of the time, a folder will contain public contents ("Any READ") and intranet contents ("*:/platform/users READ"). Thus, when authenticated, you see more contents than in public mode.
+
+So, the request is to be able for WCM Services to create a fake session (like we do with the anonymous one)
+Here is a proposal of a possible call:
+SessionProvider.createProvider(List<AccessControlEntry> accessList);
+accessList==null or empty: anonymous session
+ACL = {"*:/platform/users READ"} => we have a private session
+
+Fix description
+
+How is the problem fixed?
+
+ * Create session with custom set of ACL
+
+Patch file: JCR-1636.patch
+
+Tests to perform
+
+Reproduction test
+* N/A
+
+Tests performed at DevLevel
+
+ * Functional tests
+
+Tests performed at QA/Support Level
+*
+Documentation changes
+
+Documentation changes:
+ * No
+Configuration changes
+
+Configuration changes:
+
+ * No
+
+Will previous configuration continue to work?
+
+ * Yes
+
+Risks and impacts
+
+Can this bug fix have any side effects on current client projects?
+
+ * No
+
+Is there a performance risk/cost?
+
+ * No
+
+Validation (PM/Support/QA)
+
+PM Comment
+* Patch approved
+
+Support Comment
+*
+
+QA Feedbacks
+*
+
12 years, 10 months
exo-jcr SVN: r4737 - in core/branches/2.3.x: patch/2.3.10/COR-237 and 1 other directory.
by do-not-reply@jboss.org
Author: trang_vu
Date: 2011-08-11 05:34:12 -0400 (Thu, 11 Aug 2011)
New Revision: 4737
Added:
core/branches/2.3.x/patch/2.3.10/COR-237/readme.txt
Modified:
core/branches/2.3.x/exo.core.component.ldap/src/main/java/org/exoplatform/services/ldap/impl/LDAPServiceImpl.java
Log:
COR-237: minConnection and maxConnection params in the LDAP configuration are not used.
Fix description
Use minConnection and maxConnection to set up com.sun.jndi.ldap.connect.pool.initsize and com.sun.jndi.ldap.connect.pool.prefsize.
Modified: core/branches/2.3.x/exo.core.component.ldap/src/main/java/org/exoplatform/services/ldap/impl/LDAPServiceImpl.java
===================================================================
--- core/branches/2.3.x/exo.core.component.ldap/src/main/java/org/exoplatform/services/ldap/impl/LDAPServiceImpl.java 2011-08-11 08:46:44 UTC (rev 4736)
+++ core/branches/2.3.x/exo.core.component.ldap/src/main/java/org/exoplatform/services/ldap/impl/LDAPServiceImpl.java 2011-08-11 09:34:12 UTC (rev 4737)
@@ -86,6 +86,17 @@
// TODO move it in configuration ?
env.put("com.sun.jndi.ldap.connect.timeout", "60000");
+ if (config.getMinConnection() > 0)
+ {
+ env.put("com.sun.jndi.ldap.connect.pool.initsize", Integer.toString(config.getMinConnection()));
+ env.put("com.sun.jndi.ldap.connect.pool.prefsize", Integer.toString(config.getMinConnection()));
+ }
+
+ if (config.getMaxConnection() > 0)
+ {
+ env.put("com.sun.jndi.ldap.connect.pool.maxsize", Integer.toString(config.getMaxConnection()));
+ }
+
env.put("com.sun.jndi.ldap.connect.pool", "true");
env.put("java.naming.ldap.version", config.getVerion());
env.put("java.naming.ldap.attributes.binary", "tokenGroups");
Added: core/branches/2.3.x/patch/2.3.10/COR-237/readme.txt
===================================================================
--- core/branches/2.3.x/patch/2.3.10/COR-237/readme.txt (rev 0)
+++ core/branches/2.3.x/patch/2.3.10/COR-237/readme.txt 2011-08-11 09:34:12 UTC (rev 4737)
@@ -0,0 +1,67 @@
+Summary
+
+ * Status: minConnection and maxConnection params in the ldap configuration are not used
+ * CCP Issue: CCP-1032, Product Jira Issue: COR-237.
+ * Complexity: N/A
+
+The Proposal
+Problem description
+
+What is the problem to fix?
+
+ * minConnection and maxConnection params in the ldap configuration are not used
+
+Fix description
+
+How is the problem fixed?
+Use minConnection and maxConnection to set up com.sun.jndi.ldap.connect.pool.initsize and com.sun.jndi.ldap.connect.pool.prefsize, precisely:
+ * com.sun.jndi.ldap.connect.pool.initsize and com.sun.jndi.ldap.connect.pool.prefsize are set to minConnection if minConnection > 0
+ * com.sun.jndi.ldap.connect.pool.maxsize are set to maxConnection if maxConnection > 0
+
+Patch file: COR-237.patch
+
+Tests to perform
+
+Reproduction test
+
+ * org.exoplatform.services.ldap.impl.LDAPServiceImpl does not use minConnection and maxConnection params to init the ldap connection pool (should be used for com.sun.jndi.ldap.connect.pool.initsize and com.sun.jndi.ldap.connect.pool.maxsize env params).
+
+Tests performed at DevLevel
+*
+
+Tests performed at QA/Support Level
+*
+Documentation changes
+
+Documentation changes:
+* No
+
+Configuration changes
+
+Configuration changes:
+* No
+
+Will previous configuration continue to work?
+* Yes
+
+Risks and impacts
+
+Can this bug fix have any side effects on current client projects?
+
+ * Function or ClassName change: no
+
+Is there a performance risk/cost?
+* No
+
+Validation (PM/Support/QA)
+
+PM Comment
+
+ * Patch approved.
+
+Support Comment
+
+ * Patch validated on behalf of Support.
+
+QA Feedbacks
+*
12 years, 10 months
exo-jcr SVN: r4736 - jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core.
by do-not-reply@jboss.org
Author: areshetnyak
Date: 2011-08-11 04:46:44 -0400 (Thu, 11 Aug 2011)
New Revision: 4736
Modified:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/NodeImpl.java
Log:
EXOJCR-1468 : Clean code.
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 2011-08-11 08:03:20 UTC (rev 4735)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/NodeImpl.java 2011-08-11 08:46:44 UTC (rev 4736)
@@ -297,15 +297,15 @@
if (nodeDef.getName().equals(name) || primaryTypeName.equals(Constants.JCR_ANY_NAME))
{
- if (nodeDef.getDefaultPrimaryType() == null)
+ primaryTypeName = nodeDef.getDefaultPrimaryType();
+
+ if (primaryTypeName == null)
{
throw new ConstraintViolationException("Can not define node type for " + name.getAsString()
+ ". No default primary type defined for child nodes in \""
+ nodeData().getPrimaryTypeName().getAsString()
+ "\" node type and no explicit primary type given to create a child node.");
}
-
- primaryTypeName = nodeDef.getDefaultPrimaryType();
}
// try to make new node
return doAddNode(parent, name, primaryTypeName, nodeDef);
12 years, 10 months
exo-jcr SVN: r4735 - in jcr/trunk/exo.jcr.component.core/src: test/java/org/exoplatform/services/jcr/api/nodetypes and 1 other directory.
by do-not-reply@jboss.org
Author: areshetnyak
Date: 2011-08-11 04:03:20 -0400 (Thu, 11 Aug 2011)
New Revision: 4735
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/test/java/org/exoplatform/services/jcr/api/nodetypes/TestNodeDefinition.java
Log:
EXOJCR-1468 : Problem with NullPointerExceptin if default primary type not defined and no explicit primary type given to create a child node was fixed. Now, for this use case will be throw a ConstraintViolationException.
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 2011-08-10 14:46:39 UTC (rev 4734)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/NodeImpl.java 2011-08-11 08:03:20 UTC (rev 4735)
@@ -297,6 +297,14 @@
if (nodeDef.getName().equals(name) || primaryTypeName.equals(Constants.JCR_ANY_NAME))
{
+ if (nodeDef.getDefaultPrimaryType() == null)
+ {
+ throw new ConstraintViolationException("Can not define node type for " + name.getAsString()
+ + ". No default primary type defined for child nodes in \""
+ + nodeData().getPrimaryTypeName().getAsString()
+ + "\" node type and no explicit primary type given to create a child node.");
+ }
+
primaryTypeName = nodeDef.getDefaultPrimaryType();
}
// try to make new node
Modified: jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/api/nodetypes/TestNodeDefinition.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/api/nodetypes/TestNodeDefinition.java 2011-08-10 14:46:39 UTC (rev 4734)
+++ jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/api/nodetypes/TestNodeDefinition.java 2011-08-11 08:03:20 UTC (rev 4735)
@@ -24,6 +24,7 @@
import javax.jcr.Node;
import javax.jcr.RepositoryException;
+import javax.jcr.nodetype.ConstraintViolationException;
import javax.jcr.version.Version;
/**
@@ -111,4 +112,38 @@
fail();
}
}
+
+ public void testNodeTypeNotDeterminedNtFolder() throws Exception
+ {
+ Node root = session.getRootNode();
+ Node folder = root.addNode("abc", "nt:folder");
+
+ try
+ {
+ folder.addNode("def");
+ fail("Should be throw ConstraintViolationException, because node type for node \"def\" "
+ + "was not defined and default primary type for child nodes in \"nt:folder\" node type is not define.");
+ }
+ catch (ConstraintViolationException e)
+ {
+ // ok
+ }
+ }
+
+ public void testNodeTypeNotDeterminedNtFile2() throws Exception
+ {
+ Node root = session.getRootNode();
+ Node folder = root.addNode("abc", "nt:file");
+
+ try
+ {
+ folder.addNode("jcr:content");
+ fail("Should be throw ConstraintViolationException, because node type for node \"jcr:content\" "
+ + "was not defined and default primary type for child nodes in \"nt:file\" node type is not define.");
+ }
+ catch (ConstraintViolationException e)
+ {
+ // ok
+ }
+ }
}
12 years, 10 months
exo-jcr SVN: r4734 - kernel/trunk/exo.kernel.commons/src/main/java/org/exoplatform/commons/utils.
by do-not-reply@jboss.org
Author: dkuleshov
Date: 2011-08-10 10:46:39 -0400 (Wed, 10 Aug 2011)
New Revision: 4734
Modified:
kernel/trunk/exo.kernel.commons/src/main/java/org/exoplatform/commons/utils/MimeTypeResolver.java
Log:
EXOJCR-1463: moved MimeDetector registration to static block
Modified: kernel/trunk/exo.kernel.commons/src/main/java/org/exoplatform/commons/utils/MimeTypeResolver.java
===================================================================
--- kernel/trunk/exo.kernel.commons/src/main/java/org/exoplatform/commons/utils/MimeTypeResolver.java 2011-08-10 12:50:17 UTC (rev 4733)
+++ kernel/trunk/exo.kernel.commons/src/main/java/org/exoplatform/commons/utils/MimeTypeResolver.java 2011-08-10 14:46:39 UTC (rev 4734)
@@ -19,13 +19,13 @@
package org.exoplatform.commons.utils;
import eu.medsea.mimeutil.MimeUtil;
-import eu.medsea.mimeutil.detector.MimeDetector;
import org.exoplatform.services.log.ExoLogger;
import org.exoplatform.services.log.Log;
import java.io.IOException;
import java.io.InputStream;
+import java.security.PrivilegedAction;
import java.security.PrivilegedExceptionAction;
import java.util.ArrayList;
import java.util.Collection;
@@ -38,7 +38,16 @@
{
protected static Log log = ExoLogger.getLogger("org.exoplatform.commons.utils.MimeTypeResolver");
- private static MimeDetector magicMimeDetector;
+ static {
+ SecurityHelper.doPrivilegedAction(new PrivilegedAction<Void>()
+ {
+ public Void run()
+ {
+ MimeUtil.registerMimeDetector("eu.medsea.mimeutil.detector.MagicMimeMimeDetector");
+ return null;
+ }
+ });
+ }
private Map<String, List<String>> mimeTypes = new HashMap<String, List<String>>();
@@ -54,11 +63,6 @@
{
public Void run() throws Exception
{
- if (magicMimeDetector == null)
- {
- magicMimeDetector =
- MimeUtil.registerMimeDetector("eu.medsea.mimeutil.detector.MagicMimeMimeDetector");
- }
Scanner scanner = null;
String mimeTypeProperties = System.getProperty("org.exoplatform.mimetypes");
if (mimeTypeProperties != null)
12 years, 10 months
exo-jcr SVN: r4733 - jcr/branches/1.12.x/patch/1.12.10-GA/JCR-1636.
by do-not-reply@jboss.org
Author: areshetnyak
Date: 2011-08-10 08:50:17 -0400 (Wed, 10 Aug 2011)
New Revision: 4733
Modified:
jcr/branches/1.12.x/patch/1.12.10-GA/JCR-1636/JCR-1636.patch
Log:
JCR-1636 : Patch was updated.
Modified: jcr/branches/1.12.x/patch/1.12.10-GA/JCR-1636/JCR-1636.patch
===================================================================
--- jcr/branches/1.12.x/patch/1.12.10-GA/JCR-1636/JCR-1636.patch 2011-08-10 09:03:22 UTC (rev 4732)
+++ jcr/branches/1.12.x/patch/1.12.10-GA/JCR-1636/JCR-1636.patch 2011-08-10 12:50:17 UTC (rev 4733)
@@ -1,6 +1,6 @@
Index: exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/access/TestUserAccess.java
===================================================================
---- exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/access/TestUserAccess.java (revision 4449)
+--- exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/access/TestUserAccess.java (revision 4711)
+++ exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/access/TestUserAccess.java (working copy)
@@ -23,9 +23,13 @@
import org.exoplatform.services.jcr.access.SystemIdentity;
@@ -128,7 +128,7 @@
}
Index: exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/access/AccessManager.java
===================================================================
---- exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/access/AccessManager.java (revision 4449)
+--- exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/access/AccessManager.java (revision 4711)
+++ exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/access/AccessManager.java (working copy)
@@ -192,7 +192,9 @@
@@ -179,7 +179,7 @@
+}
Index: exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/jndi/BindableRepositoryImpl.java
===================================================================
---- exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/jndi/BindableRepositoryImpl.java (revision 4449)
+--- exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/jndi/BindableRepositoryImpl.java (revision 4711)
+++ exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/jndi/BindableRepositoryImpl.java (working copy)
@@ -25,10 +25,12 @@
import org.exoplatform.services.jcr.core.WorkspaceContainerFacade;
@@ -215,7 +215,7 @@
public String[] getWorkspaceNames()
Index: exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/RepositoryImpl.java
===================================================================
---- exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/RepositoryImpl.java (revision 4449)
+--- exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/RepositoryImpl.java (revision 4711)
+++ exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/RepositoryImpl.java (working copy)
@@ -19,6 +19,7 @@
package org.exoplatform.services.jcr.impl.core;
@@ -272,7 +272,7 @@
public String getSystemWorkspaceName()
Index: exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/core/ManageableRepository.java
===================================================================
---- exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/core/ManageableRepository.java (revision 4449)
+--- exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/core/ManageableRepository.java (revision 4711)
+++ exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/core/ManageableRepository.java (working copy)
@@ -23,9 +23,11 @@
import org.exoplatform.services.jcr.config.WorkspaceEntry;
@@ -304,7 +304,7 @@
String[] getWorkspaceNames();
Index: exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/BaseStandaloneTest.java
===================================================================
---- exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/BaseStandaloneTest.java (revision 4449)
+--- exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/BaseStandaloneTest.java (revision 4711)
+++ exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/BaseStandaloneTest.java (working copy)
@@ -53,6 +53,7 @@
import javax.jcr.NodeIterator;
@@ -561,22 +561,18 @@
+}
Index: exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/common/SessionProvider.java
===================================================================
---- exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/common/SessionProvider.java (revision 4449)
+--- exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/common/SessionProvider.java (revision 4711)
+++ exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/common/SessionProvider.java (working copy)
-@@ -18,16 +18,19 @@
+@@ -18,6 +18,8 @@
*/
package org.exoplatform.services.jcr.ext.common;
--import org.exoplatform.services.jcr.access.SystemIdentity;
+import org.exoplatform.services.jcr.access.AccessControlEntry;
+import org.exoplatform.services.jcr.access.DynamicIdentity;
+ import org.exoplatform.services.jcr.access.SystemIdentity;
import org.exoplatform.services.jcr.core.ExtendedSession;
import org.exoplatform.services.jcr.core.ManageableRepository;
- import org.exoplatform.services.jcr.core.SessionLifecycleListener;
- import org.exoplatform.services.security.ConversationState;
- import org.exoplatform.services.security.Identity;
-+import org.exoplatform.services.security.IdentityConstants;
- import org.exoplatform.services.security.MembershipEntry;
+@@ -28,6 +30,7 @@
import java.util.HashMap;
import java.util.HashSet;
@@ -612,12 +608,7 @@
* Internal constructor.
*
* @param isSystem
-@@ -109,10 +126,29 @@
- */
- public static SessionProvider createAnonimProvider()
- {
-- Identity id = new Identity(SystemIdentity.ANONIM, new HashSet<MembershipEntry>());
-+ Identity id = new Identity(IdentityConstants.ANONIM, new HashSet<MembershipEntry>());
+@@ -113,6 +130,25 @@
return new SessionProvider(new ConversationState(id));
}
12 years, 10 months
exo-jcr SVN: r4732 - kernel/trunk/exo.kernel.commons/src/main/java/org/exoplatform/commons/utils.
by do-not-reply@jboss.org
Author: dkuleshov
Date: 2011-08-10 05:03:22 -0400 (Wed, 10 Aug 2011)
New Revision: 4732
Modified:
kernel/trunk/exo.kernel.commons/src/main/java/org/exoplatform/commons/utils/MimeTypeResolver.java
Log:
EXOJCR-1463: added check if MimeDetector is already registered, to avoid warning messages
Modified: kernel/trunk/exo.kernel.commons/src/main/java/org/exoplatform/commons/utils/MimeTypeResolver.java
===================================================================
--- kernel/trunk/exo.kernel.commons/src/main/java/org/exoplatform/commons/utils/MimeTypeResolver.java 2011-08-10 08:16:58 UTC (rev 4731)
+++ kernel/trunk/exo.kernel.commons/src/main/java/org/exoplatform/commons/utils/MimeTypeResolver.java 2011-08-10 09:03:22 UTC (rev 4732)
@@ -19,6 +19,7 @@
package org.exoplatform.commons.utils;
import eu.medsea.mimeutil.MimeUtil;
+import eu.medsea.mimeutil.detector.MimeDetector;
import org.exoplatform.services.log.ExoLogger;
import org.exoplatform.services.log.Log;
@@ -37,6 +38,8 @@
{
protected static Log log = ExoLogger.getLogger("org.exoplatform.commons.utils.MimeTypeResolver");
+ private static MimeDetector magicMimeDetector;
+
private Map<String, List<String>> mimeTypes = new HashMap<String, List<String>>();
private Map<String, List<String>> extentions = new HashMap<String, List<String>>();
@@ -51,7 +54,11 @@
{
public Void run() throws Exception
{
- MimeUtil.registerMimeDetector("eu.medsea.mimeutil.detector.MagicMimeMimeDetector");
+ if (magicMimeDetector == null)
+ {
+ magicMimeDetector =
+ MimeUtil.registerMimeDetector("eu.medsea.mimeutil.detector.MagicMimeMimeDetector");
+ }
Scanner scanner = null;
String mimeTypeProperties = System.getProperty("org.exoplatform.mimetypes");
if (mimeTypeProperties != null)
12 years, 10 months