From do-not-reply at jboss.org Thu Aug 11 07:14:35 2011
Content-Type: multipart/mixed; boundary="===============8687552195272567971=="
MIME-Version: 1.0
From: do-not-reply at jboss.org
To: exo-jcr-commits at lists.jboss.org
Subject: [exo-jcr-commits] 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.
Date: Thu, 11 Aug 2011 07:14:35 -0400
Message-ID: <201108111114.p7BBEZbs014272@svn01.web.mwc.hst.phx2.redhat.com>
--===============8687552195272567971==
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: quoted-printable
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/JBossCacheWorkspaceStorag=
eCache.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/exoplat=
form/services/jcr/datamodel/NullItemData.java
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatfor=
m/services/jcr/datamodel/NullItemData.java (rev 0)
+++ jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatfor=
m/services/jcr/datamodel/NullItemData.java 2011-08-11 11:14:35 UTC (rev 474=
0)
@@ -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.
+ */
+package org.exoplatform.services.jcr.datamodel;
+
+import org.exoplatform.services.jcr.dataflow.ItemDataVisitor;
+
+import javax.jcr.RepositoryException;
+
+/**
+ * Created by The eXo Platform SAS.
+ * =
+ *
Date: =
+ *
+ * @author Karpenko Sergiy =
+ * @version $Id: NullItemData.java 111 2011-05-30 11:11:11Z serg $
+ */
+public abstract class NullItemData implements ItemData
+{
+
+ public static final String NULL_ID =3D "_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 =3D parent.getIdentifier();
+ this.path =3D QPath.makeChildPath(parent.getQPath(), name);
+ this.name =3D name;
+ this.id =3D NULL_ID;
+ }
+
+ public NullItemData(String id)
+ {
+ this.parentId =3D null;
+ this.path =3D null;
+ this.name =3D null;
+ this.id =3D id;
+ }
+
+ public NullItemData()
+ {
+ this.parentId =3D null;
+ this.path =3D null;
+ this.name =3D null;
+ this.id =3D 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/exoplat=
form/services/jcr/datamodel/NullNodeData.java
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatfor=
m/services/jcr/datamodel/NullNodeData.java (rev 0)
+++ jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatfor=
m/services/jcr/datamodel/NullNodeData.java 2011-08-11 11:14:35 UTC (rev 474=
0)
@@ -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 null
value, it is designed=
to be used =
+ * into the cache to represent missing value.
+ * =
+ * @author Anatoliy Bazko
+ * @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/exoplat=
form/services/jcr/datamodel/NullPropertyData.java
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatfor=
m/services/jcr/datamodel/NullPropertyData.java (rev=
0)
+++ jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatfor=
m/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.
+ */
+package org.exoplatform.services.jcr.datamodel;
+
+import java.util.List;
+
+/**
+ * Created by The eXo Platform SAS.
+ * =
+ *
Date: =
+ *
+ * @author Karpenko Sergiy =
+ * @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 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/exop=
latform/services/jcr/impl/dataflow/persistent/CacheableWorkspaceDataManager=
.java
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatfor=
m/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/exoplatfor=
m/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 =3D 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 !=3D null && !data.isNode())
+ {
fixPropertyValues((PropertyData)data);
}
=
@@ -460,18 +465,20 @@
{
data =3D getPersistedItemData(identifier);
}
- else if (!data.isNode())
- {
- fixPropertyValues((PropertyData)data);
- }
}
finally
{
request.done();
}
}
- else if (!data.isNode())
+
+ if (data instanceof NullItemData)
{
+ return null;
+ }
+
+ if (data !=3D null && !data.isNode())
+ {
fixPropertyValues((PropertyData)data);
}
=
@@ -749,9 +756,23 @@
throws RepositoryException
{
ItemData data =3D super.getItemData(parentData, name, itemType);
- if (data !=3D null && cache.isEnabled())
+ if (cache.isEnabled())
{
- cache.put(data);
+ if (data =3D=3D null)
+ {
+ if (itemType =3D=3D ItemType.NODE || itemType =3D=3D 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 Repos=
itoryException
{
ItemData data =3D super.getItemData(identifier);
- if (data !=3D null && cache.isEnabled())
+ if (cache.isEnabled())
{
- cache.put(data);
+ if (data !=3D null)
+ {
+ cache.put(data);
+ }
+ else if (identifier !=3D null)
+ {
+ // no matter does property or node expected - store NullNodeDa=
ta
+ cache.put(new NullNodeData(identifier));
+ }
}
return data;
}
Modified: jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exop=
latform/services/jcr/impl/dataflow/persistent/VersionableWorkspaceDataManag=
er.java
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatfor=
m/services/jcr/impl/dataflow/persistent/VersionableWorkspaceDataManager.jav=
a 2011-08-11 10:41:53 UTC (rev 4739)
+++ jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatfor=
m/services/jcr/impl/dataflow/persistent/VersionableWorkspaceDataManager.jav=
a 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 =3D persistentManager.getCachedItemData(identifier);
- if (cdata !=3D null)
+ if (cdata !=3D 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 =3D versionDataManager.persistentManager.getCachedItemData(=
identifier);
- if (cdata !=3D null)
+ if (cdata !=3D 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/exop=
latform/services/jcr/impl/dataflow/persistent/jbosscache/JBossCacheWorkspac=
eStorageCache.java
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatfor=
m/services/jcr/impl/dataflow/persistent/jbosscache/JBossCacheWorkspaceStora=
geCache.java 2011-08-11 10:41:53 UTC (rev 4739)
+++ jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatfor=
m/services/jcr/impl/dataflow/persistent/jbosscache/JBossCacheWorkspaceStora=
geCache.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 ordinar=
y ItemData
+ if (item instanceof NullItemData)
+ {
+ putNullItem((NullItemData)item);
+ return;
+ }
+
boolean inTransaction =3D cache.isTransactionActive();
try
{
@@ -507,7 +517,7 @@
for (String propId : set)
{
PropertyData prop =3D (PropertyData)cache.get(makeItemFqn(prop=
Id), ITEM_DATA);
- if (prop =3D=3D null)
+ if (prop =3D=3D null || prop instanceof NullItemData)
{
return null;
}
@@ -680,23 +690,48 @@
public ItemData get(String parentId, QPathEntry name, ItemType itemType)
{
String itemId =3D null;
- if (itemType =3D=3D ItemType.NODE || itemType =3D=3D ItemType.UNKNOW=
N)
+ if (itemType =3D=3D ItemType.UNKNOWN)
{
- // try as node first
+ // Try as node first.
itemId =3D (String)cache.get(makeChildFqn(childNodes, parentId, n=
ame), ITEM_ID);
+
+ if (itemId =3D=3D 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 =3D (String)cache.get(makeChildFqn(childProps, p=
arentId, name), ITEM_ID);
+ if (propId !=3D null)
+ {
+ itemId =3D propId;
+ }
+ }
}
-
- if (itemType =3D=3D ItemType.PROPERTY || itemType =3D=3D ItemType.UN=
KNOWN && itemId =3D=3D null)
+ else if (itemType =3D=3D ItemType.NODE)
{
- // try as property
+ itemId =3D (String)cache.get(makeChildFqn(childNodes, parentId, n=
ame), ITEM_ID);
+ }
+ else
+ {
itemId =3D (String)cache.get(makeChildFqn(childProps, parentId, n=
ame), ITEM_ID);
}
=
if (itemId !=3D null)
{
- return get(itemId);
+ if (itemId.equals(NullItemData.NULL_ID))
+ {
+ if (itemType =3D=3D ItemType.UNKNOWN || itemType =3D=3D ItemTy=
pe.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 Proper=
tyData
return (ItemData)cache.get(makeItemFqn(id), ITEM_DATA);
}
=
@@ -723,7 +759,7 @@
for (Object child : set)
{
NodeData node =3D (NodeData)cache.get(makeItemFqn((String)chil=
d), ITEM_DATA);
- if (node =3D=3D null)
+ if (node =3D=3D null || node instanceof NullItemData)
{
return null;
}
@@ -788,7 +824,7 @@
for (Object child : set)
{
PropertyData prop =3D (PropertyData)cache.get(makeItemFqn((Str=
ing)child), ITEM_DATA);
- if (prop =3D=3D null)
+ if (prop =3D=3D null || prop instanceof NullItemData)
{
return null;
}
@@ -944,6 +980,54 @@
modifyListsOfChild =3D=3D ModifyChildOption.NOT_MODIFY);
}
=
+ /**
+ * Internal put NullNode.
+ *
+ * @param item, NullItemData, new data to put in the cache
+ */
+ protected void putNullItem(NullItemData item)
+ {
+ boolean inTransaction =3D 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() !=3D null && item.getParentIdentifier() !=
=3D null)
+ {
+ if (item.isNode())
+ {
+ // put in $CHILD_NODES
+ cache.putIfAbsent(makeChildFqn(childNodes, item.getParentId=
entifier(), item.getName()), ITEM_ID,
+ NullItemData.NULL_ID);
+ }
+ else
+ {
+ // put in $CHILD_PROPERTIES
+ cache.putIfAbsent(makeChildFqn(childProps, item.getParentId=
entifier(), item.getName()), ITEM_ID,
+ NullItemData.NULL_ID);
+ }
+ }
+ }
+ finally
+ {
+ cache.setLocal(false);
+ if (!inTransaction)
+ {
+ dedicatedTxCommit();
+ }
+ }
+
+ }
+
protected ItemData putNodeInBufferedCache(NodeData node, ModifyChildOpt=
ion 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 operati=
ons. =
+ ItemData returnedData =3D (ItemData)cache.putInBuffer(makeItemFqn(no=
de.getIdentifier()), ITEM_DATA, node);
+ return (returnedData instanceof NullItemData) ? null : returnedData;
}
=
/**
@@ -1008,8 +1094,11 @@
}
=
// add in ITEMS
- return (PropertyData)cache.put(makeItemFqn(prop.getIdentifier()), IT=
EM_DATA, prop,
- modifyListsOfChild =3D=3D ModifyChildOption.NOT_MODIFY);
+ // NullItemData must never be returned inside internal cache operati=
ons. =
+ ItemData returnedData =3D
+ (ItemData)cache.put(makeItemFqn(prop.getIdentifier()), ITEM_DATA,=
prop,
+ modifyListsOfChild =3D=3D 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 =3D (NodeData)cache.put(makeItemFqn(node.getIdenti=
fier()), ITEM_DATA, node);
- if (prevData !=3D null)
+ // prevent update NullNodeData
+ if (prevData !=3D null && !(prevData instanceof NullItemData))
{
// do update ACL if needed
if (prevData.getACL() =3D=3D null || !prevData.getACL().equals(no=
de.getACL()))
@@ -1119,6 +1209,7 @@
*/
protected void updateInBuffer(final NodeData node, final NodeData prevN=
ode)
{
+ // I expect that NullNodeData will never update existing NodeData.
// get previously cached NodeData and using its name remove child on=
the parent
Fqn prevFqn =3D
makeChildFqn(childNodes, node.getParentIdentifier(), prevNode.get=
QPath().getEntries()[prevNode.getQPath()
@@ -1132,6 +1223,7 @@
}
}
=
+ // node and prevNode are not NullNodeDatas
// update childs paths if index changed
int nodeIndex =3D node.getQPath().getEntries()[node.getQPath().getEn=
tries().length - 1].getIndex();
int prevNodeIndex =3D prevNode.getQPath().getEntries()[prevNode.getQ=
Path().getEntries().length - 1].getIndex();
@@ -1165,7 +1257,7 @@
=
// check is this descendant of prevRootPath
QPath nodeQPath =3D data.getQPath();
- if (nodeQPath.isDescendantOf(prevRootPath))
+ if (nodeQPath !=3D null && nodeQPath.isDescendantOf(prevRootPath))
{
=
//make relative path
Added: jcr/branches/1.12.x/patch/1.12.10-GA/JCR-1633/readme.txt
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- 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 id=
ea will be to store the value "null" into the cache to prevent useless data=
base 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
+*
+
--===============8687552195272567971==--