Author: areshetnyak
Date: 2011-08-11 11:31:41 -0400 (Thu, 11 Aug 2011)
New Revision: 4747
Removed:
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 : Changes from revision 4740 was reverted.
Deleted:
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 2011-08-11
15:11:36 UTC (rev 4746)
+++
jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/datamodel/NullItemData.java 2011-08-11
15:31:41 UTC (rev 4747)
@@ -1,98 +0,0 @@
-/*
- * 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;
- }
-
-}
Deleted:
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 2011-08-11
15:11:36 UTC (rev 4746)
+++
jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/datamodel/NullNodeData.java 2011-08-11
15:31:41 UTC (rev 4747)
@@ -1,88 +0,0 @@
-/*
- * 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");
- }
-
-}
Deleted:
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 2011-08-11
15:11:36 UTC (rev 4746)
+++
jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/datamodel/NullPropertyData.java 2011-08-11
15:31:41 UTC (rev 4747)
@@ -1,79 +0,0 @@
-/*
- * 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
15:11:36 UTC (rev 4746)
+++
jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/CacheableWorkspaceDataManager.java 2011-08-11
15:31:41 UTC (rev 4747)
@@ -23,9 +23,6 @@
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;
@@ -421,20 +418,18 @@
{
data = getPersistedItemData(parentData, name, itemType);
}
+ else if (!data.isNode())
+ {
+ fixPropertyValues((PropertyData)data);
+ }
}
finally
{
request.done();
}
}
-
- if (data instanceof NullItemData)
+ else if (!data.isNode())
{
- return null;
- }
-
- if (data != null && !data.isNode())
- {
fixPropertyValues((PropertyData)data);
}
@@ -465,20 +460,18 @@
{
data = getPersistedItemData(identifier);
}
+ else if (!data.isNode())
+ {
+ fixPropertyValues((PropertyData)data);
+ }
}
finally
{
request.done();
}
}
-
- if (data instanceof NullItemData)
+ else if (!data.isNode())
{
- return null;
- }
-
- if (data != null && !data.isNode())
- {
fixPropertyValues((PropertyData)data);
}
@@ -756,23 +749,9 @@
throws RepositoryException
{
ItemData data = super.getItemData(parentData, name, itemType);
- if (cache.isEnabled())
+ if (data != null && cache.isEnabled())
{
- 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);
- }
+ cache.put(data);
}
return data;
}
@@ -787,17 +766,9 @@
protected ItemData getPersistedItemData(String identifier) throws RepositoryException
{
ItemData data = super.getItemData(identifier);
- if (cache.isEnabled())
+ if (data != null && cache.isEnabled())
{
- if (data != null)
- {
- cache.put(data);
- }
- else if (identifier != null)
- {
- // no matter does property or node expected - store NullNodeData
- cache.put(new NullNodeData(identifier));
- }
+ cache.put(data);
}
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
15:11:36 UTC (rev 4746)
+++
jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/VersionableWorkspaceDataManager.java 2011-08-11
15:31:41 UTC (rev 4747)
@@ -28,7 +28,6 @@
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;
@@ -158,14 +157,14 @@
{
// from cache at first
ItemData cdata = persistentManager.getCachedItemData(identifier);
- if (cdata != null && !(cdata instanceof NullItemData))
+ if (cdata != null)
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 && !(cdata instanceof NullItemData))
+ if (cdata != null)
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
15:11:36 UTC (rev 4746)
+++
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
15:31:41 UTC (rev 4747)
@@ -30,9 +30,6 @@
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;
@@ -399,13 +396,6 @@
*/
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
{
@@ -517,7 +507,7 @@
for (String propId : set)
{
PropertyData prop = (PropertyData)cache.get(makeItemFqn(propId), ITEM_DATA);
- if (prop == null || prop instanceof NullItemData)
+ if (prop == null)
{
return null;
}
@@ -690,48 +680,23 @@
public ItemData get(String parentId, QPathEntry name, ItemType itemType)
{
String itemId = null;
- if (itemType == ItemType.UNKNOWN)
+ if (itemType == ItemType.NODE || 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;
- }
- }
}
- else if (itemType == ItemType.NODE)
+
+ if (itemType == ItemType.PROPERTY || itemType == ItemType.UNKNOWN && itemId
== null)
{
- itemId = (String)cache.get(makeChildFqn(childNodes, parentId, name), ITEM_ID);
- }
- else
- {
+ // try as property
itemId = (String)cache.get(makeChildFqn(childProps, parentId, name), ITEM_ID);
}
if (itemId != null)
{
- 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 get(itemId);
}
+
return null;
}
@@ -740,7 +705,6 @@
*/
public ItemData get(String id)
{
- // NullNodeData with id may be stored as ordinary NodeData or PropertyData
return (ItemData)cache.get(makeItemFqn(id), ITEM_DATA);
}
@@ -759,7 +723,7 @@
for (Object child : set)
{
NodeData node = (NodeData)cache.get(makeItemFqn((String)child), ITEM_DATA);
- if (node == null || node instanceof NullItemData)
+ if (node == null)
{
return null;
}
@@ -824,7 +788,7 @@
for (Object child : set)
{
PropertyData prop = (PropertyData)cache.get(makeItemFqn((String)child),
ITEM_DATA);
- if (prop == null || prop instanceof NullItemData)
+ if (prop == null)
{
return null;
}
@@ -980,54 +944,6 @@
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
@@ -1044,9 +960,7 @@
}
}
// add in ITEMS
- // 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;
+ return (ItemData)cache.putInBuffer(makeItemFqn(node.getIdentifier()), ITEM_DATA,
node);
}
/**
@@ -1094,11 +1008,8 @@
}
// add in ITEMS
- // 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;
+ return (PropertyData)cache.put(makeItemFqn(prop.getIdentifier()), ITEM_DATA, prop,
+ modifyListsOfChild == ModifyChildOption.NOT_MODIFY);
}
protected void removeItem(ItemData item)
@@ -1154,8 +1065,7 @@
protected void updateMixin(NodeData node)
{
NodeData prevData = (NodeData)cache.put(makeItemFqn(node.getIdentifier()),
ITEM_DATA, node);
- // prevent update NullNodeData
- if (prevData != null && !(prevData instanceof NullItemData))
+ if (prevData != null)
{
// do update ACL if needed
if (prevData.getACL() == null || !prevData.getACL().equals(node.getACL()))
@@ -1209,7 +1119,6 @@
*/
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()
@@ -1223,7 +1132,6 @@
}
}
- // 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();
@@ -1257,7 +1165,7 @@
// check is this descendant of prevRootPath
QPath nodeQPath = data.getQPath();
- if (nodeQPath != null && nodeQPath.isDescendantOf(prevRootPath))
+ if (nodeQPath.isDescendantOf(prevRootPath))
{
//make relative path
Deleted: 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 2011-08-11 15:11:36 UTC (rev
4746)
+++ jcr/branches/1.12.x/patch/1.12.10-GA/JCR-1633/readme.txt 2011-08-11 15:31:41 UTC (rev
4747)
@@ -1,65 +0,0 @@
-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
-*
-