exo-jcr SVN: r4751 - core/trunk/exo.core.component.document/src/main/java/org/exoplatform/services/document/impl/tika.
by do-not-reply@jboss.org
Author: dkuleshov
Date: 2011-08-12 09:45:06 -0400 (Fri, 12 Aug 2011)
New Revision: 4751
Modified:
core/trunk/exo.core.component.document/src/main/java/org/exoplatform/services/document/impl/tika/TikaDocumentReader.java
Log:
EXOJCR-1438: added checking for empty input stream
Modified: core/trunk/exo.core.component.document/src/main/java/org/exoplatform/services/document/impl/tika/TikaDocumentReader.java
===================================================================
--- core/trunk/exo.core.component.document/src/main/java/org/exoplatform/services/document/impl/tika/TikaDocumentReader.java 2011-08-12 08:11:55 UTC (rev 4750)
+++ core/trunk/exo.core.component.document/src/main/java/org/exoplatform/services/document/impl/tika/TikaDocumentReader.java 2011-08-12 13:45:06 UTC (rev 4751)
@@ -141,6 +141,10 @@
public String getContentAsText(final InputStream is) throws IOException, DocumentReadException
{
+ if (is.available() == 0)
+ {
+ return "";
+ }
try
{
return SecurityHelper.doPrivilegedExceptionAction(new PrivilegedExceptionAction<String>()
@@ -204,6 +208,10 @@
public String getContentAsText(final InputStream is, final String encoding) throws IOException,
DocumentReadException
{
+ if (is.available() == 0)
+ {
+ return "";
+ }
try
{
return SecurityHelper.doPrivilegedExceptionAction(new PrivilegedExceptionAction<String>()
@@ -271,6 +279,10 @@
public Properties getProperties(final InputStream is) throws IOException, DocumentReadException
{
+ if (is.available() == 0)
+ {
+ return new Properties();
+ }
try
{
return SecurityHelper.doPrivilegedExceptionAction(new PrivilegedExceptionAction<Properties>()
12 years, 9 months
exo-jcr SVN: r4750 - in jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr: storage and 1 other directory.
by do-not-reply@jboss.org
Author: nzamosenchuk
Date: 2011-08-12 04:11:55 -0400 (Fri, 12 Aug 2011)
New Revision: 4750
Modified:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionFactory.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionImpl.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/storage/WorkspaceDataContainer.java
Log:
EXOJCR-267 : (partial commit)
Changed minimal page size and warning policy
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionFactory.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionFactory.java 2011-08-12 07:48:51 UTC (rev 4749)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionFactory.java 2011-08-12 08:11:55 UTC (rev 4750)
@@ -24,6 +24,7 @@
import org.exoplatform.services.jcr.access.DynamicIdentity;
import org.exoplatform.services.jcr.config.WorkspaceEntry;
import org.exoplatform.services.jcr.core.security.JCRRuntimePermissions;
+import org.exoplatform.services.jcr.storage.WorkspaceDataContainer;
import org.exoplatform.services.log.ExoLogger;
import org.exoplatform.services.log.Log;
import org.exoplatform.services.security.ConversationState;
@@ -93,6 +94,13 @@
LOG.error(e.getLocalizedMessage(), e);
}
}
+
+ if (config.getContainer().getParameterInteger(WorkspaceDataContainer.LAZY_NODE_ITERATOR_PAGE_SIZE,
+ WorkspaceDataContainer.LAZY_NODE_ITERATOR_PAGE_SIZE_DEFAULT) < WorkspaceDataContainer.LAZY_NODE_ITERATOR_PAGE_SIZE_MIN)
+ {
+ LOG.warn("Value for \"lazy-node-iterator-page-size\" is too small. Using allowed minimum page size : "
+ + WorkspaceDataContainer.LAZY_NODE_ITERATOR_PAGE_SIZE_MIN + ".");
+ }
}
/**
@@ -111,7 +119,7 @@
if (security != null)
{
security.checkPermission(JCRRuntimePermissions.CREATE_SYSTEM_SESSION_PERMISSION);
- }
+ }
}
else if (DynamicIdentity.DYNAMIC.equals(user.getIdentity().getUserId()))
{
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionImpl.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionImpl.java 2011-08-12 07:48:51 UTC (rev 4749)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionImpl.java 2011-08-12 08:11:55 UTC (rev 4750)
@@ -260,9 +260,6 @@
if (this.lazyNodeIteatorPageSize < WorkspaceDataContainer.LAZY_NODE_ITERATOR_PAGE_SIZE_MIN)
{
this.lazyNodeIteatorPageSize = WorkspaceDataContainer.LAZY_NODE_ITERATOR_PAGE_SIZE_MIN;
- log.warn("Value for \"lazy-node-iterator-page-size\" is too small. Allowed minimum page size is "
- + WorkspaceDataContainer.LAZY_NODE_ITERATOR_PAGE_SIZE_MIN + ". Using required value: "
- + WorkspaceDataContainer.LAZY_NODE_ITERATOR_PAGE_SIZE_MIN + ".");
}
}
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/storage/WorkspaceDataContainer.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/storage/WorkspaceDataContainer.java 2011-08-12 07:48:51 UTC (rev 4749)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/storage/WorkspaceDataContainer.java 2011-08-12 08:11:55 UTC (rev 4750)
@@ -46,7 +46,7 @@
public static final int LAZY_NODE_ITERATOR_PAGE_SIZE_DEFAULT = 100;
- public static final int LAZY_NODE_ITERATOR_PAGE_SIZE_MIN = 75;
+ public static final int LAZY_NODE_ITERATOR_PAGE_SIZE_MIN = 20;
public final static String CONTAINER_NAME = "containerName";
12 years, 9 months
exo-jcr SVN: r4749 - jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/metadata.
by do-not-reply@jboss.org
Author: dkuleshov
Date: 2011-08-12 03:48:51 -0400 (Fri, 12 Aug 2011)
New Revision: 4749
Modified:
jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/metadata/AddMetadataAction.java
Log:
EXOJCR-1438: removed exception printing
Modified: jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/metadata/AddMetadataAction.java
===================================================================
--- jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/metadata/AddMetadataAction.java 2011-08-12 03:08:05 UTC (rev 4748)
+++ jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/metadata/AddMetadataAction.java 2011-08-12 07:48:51 UTC (rev 4749)
@@ -127,7 +127,7 @@
}
catch (DocumentReadException e)
{
- log.warn(e.getMessage(), e);
+ log.warn(e.getMessage());
}
Iterator entries = props.entrySet().iterator();
12 years, 9 months
exo-jcr SVN: r4748 - 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 23:08:05 -0400 (Thu, 11 Aug 2011)
New Revision: 4748
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
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/LinkedWorkspaceStorageCacheImpl.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
jcr/branches/1.12.x/patch/1.12.10-GA/JCR-1633/JCR-1633.patch
Log:
JCR-1633: apply the right patch, update the patch with the full path
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-12 03:08:05 UTC (rev 4748)
@@ -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-12 03:08:05 UTC (rev 4748)
@@ -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-12 03:08:05 UTC (rev 4748)
@@ -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 15:31:41 UTC (rev 4747)
+++ jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/CacheableWorkspaceDataManager.java 2011-08-12 03:08:05 UTC (rev 4748)
@@ -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/LinkedWorkspaceStorageCacheImpl.java
===================================================================
--- jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/LinkedWorkspaceStorageCacheImpl.java 2011-08-11 15:31:41 UTC (rev 4747)
+++ jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/LinkedWorkspaceStorageCacheImpl.java 2011-08-12 03:08:05 UTC (rev 4748)
@@ -27,6 +27,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;
@@ -916,6 +917,12 @@
{
if (enabled && item != null)
{
+
+ if (item instanceof NullItemData)
+ {
+ // skip null values
+ return;
+ }
writeLock.lock();
try
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:31:41 UTC (rev 4747)
+++ jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/VersionableWorkspaceDataManager.java 2011-08-12 03:08:05 UTC (rev 4748)
@@ -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 15:31:41 UTC (rev 4747)
+++ jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/JBossCacheWorkspaceStorageCache.java 2011-08-12 03:08:05 UTC (rev 4748)
@@ -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
Modified: jcr/branches/1.12.x/patch/1.12.10-GA/JCR-1633/JCR-1633.patch
===================================================================
--- jcr/branches/1.12.x/patch/1.12.10-GA/JCR-1633/JCR-1633.patch 2011-08-11 15:31:41 UTC (rev 4747)
+++ jcr/branches/1.12.x/patch/1.12.10-GA/JCR-1633/JCR-1633.patch 2011-08-12 03:08:05 UTC (rev 4748)
@@ -1,7 +1,7 @@
-Index: src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/VersionableWorkspaceDataManager.java
+Index: exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/VersionableWorkspaceDataManager.java
===================================================================
---- src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/VersionableWorkspaceDataManager.java (revision 4711)
-+++ src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/VersionableWorkspaceDataManager.java (working copy)
+--- exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/VersionableWorkspaceDataManager.java (revision 4747)
++++ exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/VersionableWorkspaceDataManager.java (working copy)
@@ -28,6 +28,7 @@
import org.exoplatform.services.jcr.datamodel.ItemData;
import org.exoplatform.services.jcr.datamodel.ItemType;
@@ -27,10 +27,10 @@
if (isSystemDescendant(cdata.getQPath()))
return versionDataManager.getItemData(identifier);
else
-Index: src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/LinkedWorkspaceStorageCacheImpl.java
+Index: exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/LinkedWorkspaceStorageCacheImpl.java
===================================================================
---- src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/LinkedWorkspaceStorageCacheImpl.java (revision 4711)
-+++ src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/LinkedWorkspaceStorageCacheImpl.java (working copy)
+--- exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/LinkedWorkspaceStorageCacheImpl.java (revision 4747)
++++ exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/LinkedWorkspaceStorageCacheImpl.java (working copy)
@@ -27,6 +27,7 @@
import org.exoplatform.services.jcr.datamodel.ItemData;
import org.exoplatform.services.jcr.datamodel.ItemType;
@@ -52,10 +52,10 @@
writeLock.lock();
try
-Index: src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/JBossCacheWorkspaceStorageCache.java
+Index: exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/JBossCacheWorkspaceStorageCache.java
===================================================================
---- src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/JBossCacheWorkspaceStorageCache.java (revision 4711)
-+++ src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/JBossCacheWorkspaceStorageCache.java (working copy)
+--- exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/JBossCacheWorkspaceStorageCache.java (revision 4747)
++++ exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/JBossCacheWorkspaceStorageCache.java (working copy)
@@ -30,6 +30,9 @@
import org.exoplatform.services.jcr.datamodel.ItemData;
import org.exoplatform.services.jcr.datamodel.ItemType;
@@ -286,10 +286,10 @@
{
//make relative path
-Index: src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/CacheableWorkspaceDataManager.java
+Index: exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/CacheableWorkspaceDataManager.java
===================================================================
---- src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/CacheableWorkspaceDataManager.java (revision 4711)
-+++ src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/CacheableWorkspaceDataManager.java (working copy)
+--- exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/CacheableWorkspaceDataManager.java (revision 4747)
++++ exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/CacheableWorkspaceDataManager.java (working copy)
@@ -23,6 +23,9 @@
import org.exoplatform.services.jcr.datamodel.ItemData;
import org.exoplatform.services.jcr.datamodel.ItemType;
@@ -398,10 +398,10 @@
}
return data;
}
-Index: src/main/java/org/exoplatform/services/jcr/datamodel/NullPropertyData.java
+Index: exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/datamodel/NullPropertyData.java
===================================================================
---- src/main/java/org/exoplatform/services/jcr/datamodel/NullPropertyData.java (revision 0)
-+++ src/main/java/org/exoplatform/services/jcr/datamodel/NullPropertyData.java (revision 0)
+--- exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/datamodel/NullPropertyData.java (revision 0)
++++ exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/datamodel/NullPropertyData.java (revision 0)
@@ -0,0 +1,79 @@
+/*
+ * Copyright (C) 2003-2010 eXo Platform SAS.
@@ -482,10 +482,10 @@
+ }
+
+}
-Index: src/main/java/org/exoplatform/services/jcr/datamodel/NullNodeData.java
+Index: exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/datamodel/NullNodeData.java
===================================================================
---- src/main/java/org/exoplatform/services/jcr/datamodel/NullNodeData.java (revision 0)
-+++ src/main/java/org/exoplatform/services/jcr/datamodel/NullNodeData.java (revision 0)
+--- exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/datamodel/NullNodeData.java (revision 0)
++++ exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/datamodel/NullNodeData.java (revision 0)
@@ -0,0 +1,88 @@
+/*
+ * Copyright (C) 2010 eXo Platform SAS.
@@ -575,10 +575,10 @@
+ }
+
+}
-Index: src/main/java/org/exoplatform/services/jcr/datamodel/NullItemData.java
+Index: exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/datamodel/NullItemData.java
===================================================================
---- src/main/java/org/exoplatform/services/jcr/datamodel/NullItemData.java (revision 0)
-+++ src/main/java/org/exoplatform/services/jcr/datamodel/NullItemData.java (revision 0)
+--- exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/datamodel/NullItemData.java (revision 0)
++++ exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/datamodel/NullItemData.java (revision 0)
@@ -0,0 +1,98 @@
+/*
+ * Copyright (C) 2003-2010 eXo Platform SAS.
12 years, 9 months
exo-jcr SVN: r4747 - 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: 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
-*
-
12 years, 9 months
exo-jcr SVN: r4746 - jcr/branches/1.12.x/patch/1.12.10-GA/JCR-1633.
by do-not-reply@jboss.org
Author: areshetnyak
Date: 2011-08-11 11:11:36 -0400 (Thu, 11 Aug 2011)
New Revision: 4746
Modified:
jcr/branches/1.12.x/patch/1.12.10-GA/JCR-1633/JCR-1633.patch
Log:
JCR-1633 : Update patch.
Modified: jcr/branches/1.12.x/patch/1.12.10-GA/JCR-1633/JCR-1633.patch
===================================================================
--- jcr/branches/1.12.x/patch/1.12.10-GA/JCR-1633/JCR-1633.patch 2011-08-11 14:20:57 UTC (rev 4745)
+++ jcr/branches/1.12.x/patch/1.12.10-GA/JCR-1633/JCR-1633.patch 2011-08-11 15:11:36 UTC (rev 4746)
@@ -1,7 +1,7 @@
-Index: exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/VersionableWorkspaceDataManager.java
+Index: src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/VersionableWorkspaceDataManager.java
===================================================================
---- exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/VersionableWorkspaceDataManager.java (revision 4692)
-+++ exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/VersionableWorkspaceDataManager.java (working copy)
+--- src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/VersionableWorkspaceDataManager.java (revision 4711)
++++ src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/VersionableWorkspaceDataManager.java (working copy)
@@ -28,6 +28,7 @@
import org.exoplatform.services.jcr.datamodel.ItemData;
import org.exoplatform.services.jcr.datamodel.ItemType;
@@ -27,10 +27,35 @@
if (isSystemDescendant(cdata.getQPath()))
return versionDataManager.getItemData(identifier);
else
-Index: exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/JBossCacheWorkspaceStorageCache.java
+Index: src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/LinkedWorkspaceStorageCacheImpl.java
===================================================================
---- exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/JBossCacheWorkspaceStorageCache.java (revision 4692)
-+++ exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/JBossCacheWorkspaceStorageCache.java (working copy)
+--- src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/LinkedWorkspaceStorageCacheImpl.java (revision 4711)
++++ src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/LinkedWorkspaceStorageCacheImpl.java (working copy)
+@@ -27,6 +27,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;
+@@ -916,6 +917,12 @@
+ {
+ if (enabled && item != null)
+ {
++
++ if (item instanceof NullItemData)
++ {
++ // skip null values
++ return;
++ }
+
+ writeLock.lock();
+ try
+Index: src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/JBossCacheWorkspaceStorageCache.java
+===================================================================
+--- src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/JBossCacheWorkspaceStorageCache.java (revision 4711)
++++ src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/JBossCacheWorkspaceStorageCache.java (working copy)
@@ -30,6 +30,9 @@
import org.exoplatform.services.jcr.datamodel.ItemData;
import org.exoplatform.services.jcr.datamodel.ItemType;
@@ -261,10 +286,10 @@
{
//make relative path
-Index: exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/CacheableWorkspaceDataManager.java
+Index: src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/CacheableWorkspaceDataManager.java
===================================================================
---- exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/CacheableWorkspaceDataManager.java (revision 4692)
-+++ exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/CacheableWorkspaceDataManager.java (working copy)
+--- src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/CacheableWorkspaceDataManager.java (revision 4711)
++++ src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/CacheableWorkspaceDataManager.java (working copy)
@@ -23,6 +23,9 @@
import org.exoplatform.services.jcr.datamodel.ItemData;
import org.exoplatform.services.jcr.datamodel.ItemType;
@@ -373,10 +398,10 @@
}
return data;
}
-Index: exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/datamodel/NullPropertyData.java
+Index: src/main/java/org/exoplatform/services/jcr/datamodel/NullPropertyData.java
===================================================================
---- exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/datamodel/NullPropertyData.java (revision 0)
-+++ exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/datamodel/NullPropertyData.java (revision 0)
+--- src/main/java/org/exoplatform/services/jcr/datamodel/NullPropertyData.java (revision 0)
++++ src/main/java/org/exoplatform/services/jcr/datamodel/NullPropertyData.java (revision 0)
@@ -0,0 +1,79 @@
+/*
+ * Copyright (C) 2003-2010 eXo Platform SAS.
@@ -457,10 +482,10 @@
+ }
+
+}
-Index: exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/datamodel/NullNodeData.java
+Index: src/main/java/org/exoplatform/services/jcr/datamodel/NullNodeData.java
===================================================================
---- exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/datamodel/NullNodeData.java (revision 0)
-+++ exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/datamodel/NullNodeData.java (revision 0)
+--- src/main/java/org/exoplatform/services/jcr/datamodel/NullNodeData.java (revision 0)
++++ src/main/java/org/exoplatform/services/jcr/datamodel/NullNodeData.java (revision 0)
@@ -0,0 +1,88 @@
+/*
+ * Copyright (C) 2010 eXo Platform SAS.
@@ -550,10 +575,10 @@
+ }
+
+}
-Index: exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/datamodel/NullItemData.java
+Index: src/main/java/org/exoplatform/services/jcr/datamodel/NullItemData.java
===================================================================
---- exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/datamodel/NullItemData.java (revision 0)
-+++ exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/datamodel/NullItemData.java (revision 0)
+--- src/main/java/org/exoplatform/services/jcr/datamodel/NullItemData.java (revision 0)
++++ src/main/java/org/exoplatform/services/jcr/datamodel/NullItemData.java (revision 0)
@@ -0,0 +1,98 @@
+/*
+ * Copyright (C) 2003-2010 eXo Platform SAS.
12 years, 9 months
exo-jcr SVN: r4745 - jcr/trunk/exo.jcr.component.core.
by do-not-reply@jboss.org
Author: areshetnyak
Date: 2011-08-11 10:20:57 -0400 (Thu, 11 Aug 2011)
New Revision: 4745
Modified:
jcr/trunk/exo.jcr.component.core/pom.xml
Log:
EXOJCR-1478 : Wrong changes from pom.xml was reverted.
Modified: jcr/trunk/exo.jcr.component.core/pom.xml
===================================================================
--- jcr/trunk/exo.jcr.component.core/pom.xml 2011-08-11 14:05:08 UTC (rev 4744)
+++ jcr/trunk/exo.jcr.component.core/pom.xml 2011-08-11 14:20:57 UTC (rev 4745)
@@ -30,7 +30,7 @@
<name>eXo JCR :: Component :: Core Service</name>
<description>eXo JCR Service core component</description>
<properties>
- <jcr.test.configuration.file>/conf/standalone/test-configuration-sjdbc-jbc.xml</jcr.test.configuration.file>
+ <jcr.test.configuration.file>/conf/standalone/test-configuration-jbc.xml</jcr.test.configuration.file>
<jbosscache.shareable>true</jbosscache.shareable>
<jbc.specific.1>**/jbc/**</jbc.specific.1>
<jbc.specific.2>**/jbosscache/**</jbc.specific.2>
@@ -261,7 +261,7 @@
<scope>test</scope>
</dependency>
<!-- For Oracle 10g support (local-jcr repository) -->
- <dependency>
+ <!-- dependency>
<groupId>ojdbc</groupId>
<artifactId>ojdbc</artifactId>
<version>14</version>
@@ -272,7 +272,7 @@
<artifactId>orai18n</artifactId>
<version>14</version>
<scope>test</scope>
- </dependency>
+ </dependency -->
<!-- For IBM DB2 support (local-jcr repository) -->
<!-- dependency>
<groupId>com.ibm.db2</groupId>
12 years, 9 months
exo-jcr SVN: r4744 - in jcr/trunk/exo.jcr.component.core: src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db and 1 other directory.
by do-not-reply@jboss.org
Author: areshetnyak
Date: 2011-08-11 10:05:08 -0400 (Thu, 11 Aug 2011)
New Revision: 4744
Modified:
jcr/trunk/exo.jcr.component.core/pom.xml
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/MultiDbJDBCConnection.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/OracleMultiDbJDBCConnection.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/OracleSingleDbJDBCConnection.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/SingleDbJDBCConnection.java
Log:
EXOJCR-1478 : Query optimization for DB Oracle.
Modified: jcr/trunk/exo.jcr.component.core/pom.xml
===================================================================
--- jcr/trunk/exo.jcr.component.core/pom.xml 2011-08-11 13:22:33 UTC (rev 4743)
+++ jcr/trunk/exo.jcr.component.core/pom.xml 2011-08-11 14:05:08 UTC (rev 4744)
@@ -30,7 +30,7 @@
<name>eXo JCR :: Component :: Core Service</name>
<description>eXo JCR Service core component</description>
<properties>
- <jcr.test.configuration.file>/conf/standalone/test-configuration-jbc.xml</jcr.test.configuration.file>
+ <jcr.test.configuration.file>/conf/standalone/test-configuration-sjdbc-jbc.xml</jcr.test.configuration.file>
<jbosscache.shareable>true</jbosscache.shareable>
<jbc.specific.1>**/jbc/**</jbc.specific.1>
<jbc.specific.2>**/jbosscache/**</jbc.specific.2>
@@ -261,7 +261,7 @@
<scope>test</scope>
</dependency>
<!-- For Oracle 10g support (local-jcr repository) -->
- <!-- dependency>
+ <dependency>
<groupId>ojdbc</groupId>
<artifactId>ojdbc</artifactId>
<version>14</version>
@@ -272,7 +272,7 @@
<artifactId>orai18n</artifactId>
<version>14</version>
<scope>test</scope>
- </dependency -->
+ </dependency>
<!-- For IBM DB2 support (local-jcr repository) -->
<!-- dependency>
<groupId>com.ibm.db2</groupId>
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/MultiDbJDBCConnection.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/MultiDbJDBCConnection.java 2011-08-11 13:22:33 UTC (rev 4743)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/MultiDbJDBCConnection.java 2011-08-11 14:05:08 UTC (rev 4744)
@@ -63,7 +63,13 @@
"select I.ID, I.PARENT_ID, I.NAME, I.VERSION, I.I_CLASS, I.I_INDEX, I.N_ORDER_NUM, I.P_TYPE, I.P_MULTIVALUED,"
+ " V.ORDER_NUM, V.DATA, V.STORAGE_DESC from JCR_MITEM I LEFT OUTER JOIN JCR_MVALUE V ON (V.PROPERTY_ID=I.ID)"
+ " where I.I_CLASS=2 and I.PARENT_ID=? order by I.NAME";
+
+ protected static final String FIND_ITEM_QPATH_BY_ID_CQ_QUERY =
+ "select I.ID, I.PARENT_ID, I.NAME, I.I_INDEX"
+ + " from JCR_MITEM I, (SELECT ID, PARENT_ID from JCR_MITEM where ID=?) J"
+ + " where I.ID = J.ID or I.ID = J.PARENT_ID";
+
protected String PATTERN_ESCAPE_STRING = "\\"; //valid for HSQL, Sybase, DB2, MSSQL, ORACLE
/**
@@ -152,10 +158,7 @@
+ " from JCR_MITEM I, JCR_MVALUE V"
+ " where I.I_CLASS=2 and I.PARENT_ID=? and (I.NAME='[http://www.jcp.org/jcr/1.0]primaryType' or I.NAME='[http://www.jcp.org/jcr/1.0]mixinTypes' or I.NAME='[http://www.exoplatform.com/jcr/exo/1.0]owner' or I.NAME='[http://www.exoplatform.com/jcr/exo/1.0]permissions') and I.ID=V.PROPERTY_ID";
- FIND_ITEM_QPATH_BY_ID_CQ =
- "select I.ID, I.PARENT_ID, I.NAME, I.I_INDEX"
- + " from JCR_MITEM I, (SELECT ID, PARENT_ID from JCR_MITEM where ID=?) J"
- + " where I.ID = J.ID or I.ID = J.PARENT_ID";
+ FIND_ITEM_QPATH_BY_ID_CQ = FIND_ITEM_QPATH_BY_ID_CQ_QUERY;
FIND_LAST_ORDER_NUMBER_BY_PARENTID =
"select count(*), max(N_ORDER_NUM) from JCR_MITEM where I_CLASS=1 and PARENT_ID=?";
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/OracleMultiDbJDBCConnection.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/OracleMultiDbJDBCConnection.java 2011-08-11 13:22:33 UTC (rev 4743)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/OracleMultiDbJDBCConnection.java 2011-08-11 14:05:08 UTC (rev 4744)
@@ -41,7 +41,12 @@
protected static final String FIND_PROPERTIES_BY_PARENTID_CQ_QUERY =
MultiDbJDBCConnection.FIND_PROPERTIES_BY_PARENTID_CQ_QUERY.replaceFirst("select",
"select /*+ INDEX(I JCR_IDX_MITEM_PARENT_ID) INDEX(V JCR_IDX_MVALUE_PROPERTY)*/");
+
+ protected static final String FIND_ITEM_QPATH_BY_ID_CQ_QUERY =
+ MultiDbJDBCConnection.FIND_ITEM_QPATH_BY_ID_CQ_QUERY.replaceFirst("SELECT",
+ "SELECT /*+ INDEX(JCR_MITEM JCR_PK_MITEM) */");
+
/**
* Oracle Multidatabase JDBC Connection constructor.
*
@@ -80,6 +85,7 @@
super.prepareQueries();
FIND_NODES_BY_PARENTID_CQ = FIND_NODES_BY_PARENTID_CQ_QUERY;
FIND_PROPERTIES_BY_PARENTID_CQ = FIND_PROPERTIES_BY_PARENTID_CQ_QUERY;
+ FIND_ITEM_QPATH_BY_ID_CQ = FIND_ITEM_QPATH_BY_ID_CQ_QUERY;
FIND_PROPERTIES_BY_PARENTID_AND_PATTERN_CQ_TEMPLATE =
"select /*+ INDEX(I JCR_IDX_MITEM_PARENT_ID) INDEX(V JCR_IDX_MVALUE_PROPERTY)*/ I.ID, I.PARENT_ID, I.NAME, I.VERSION, I.I_CLASS, I.I_INDEX, I.N_ORDER_NUM, I.P_TYPE, I.P_MULTIVALUED,"
+ " V.ORDER_NUM, V.DATA, V.STORAGE_DESC from JCR_MITEM I LEFT OUTER JOIN JCR_MVALUE V ON (V.PROPERTY_ID=I.ID)";
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/OracleSingleDbJDBCConnection.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/OracleSingleDbJDBCConnection.java 2011-08-11 13:22:33 UTC (rev 4743)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/OracleSingleDbJDBCConnection.java 2011-08-11 14:05:08 UTC (rev 4744)
@@ -42,6 +42,10 @@
SingleDbJDBCConnection.FIND_PROPERTIES_BY_PARENTID_CQ_QUERY.replaceFirst("select",
"select /*+ INDEX(I JCR_IDX_SITEM_PARENT_ID) INDEX(V JCR_IDX_SVALUE_PROPERTY)*/");
+ protected static final String FIND_ITEM_QPATH_BY_ID_CQ_QUERY =
+ SingleDbJDBCConnection.FIND_ITEM_QPATH_BY_ID_CQ_QUERY.replaceFirst("SELECT",
+ "SELECT /*+ INDEX(JCR_SITEM JCR_PK_SITEM) */");
+
/**
* Oracle Singledatabase JDBC Connection constructor.
*
@@ -81,6 +85,7 @@
super.prepareQueries();
FIND_NODES_BY_PARENTID_CQ = FIND_NODES_BY_PARENTID_CQ_QUERY;
FIND_PROPERTIES_BY_PARENTID_CQ = FIND_PROPERTIES_BY_PARENTID_CQ_QUERY;
+ FIND_ITEM_QPATH_BY_ID_CQ = FIND_ITEM_QPATH_BY_ID_CQ_QUERY;
FIND_PROPERTIES_BY_PARENTID_AND_PATTERN_CQ_TEMPLATE =
"select /*+ INDEX(I JCR_IDX_SITEM_PARENT_ID) INDEX(V JCR_IDX_SVALUE_PROPERTY)*/ I.ID, I.PARENT_ID, I.NAME, I.VERSION, I.I_CLASS, I.I_INDEX, I.N_ORDER_NUM, I.P_TYPE, I.P_MULTIVALUED, V.ORDER_NUM,"
+ " V.DATA, V.STORAGE_DESC from JCR_SITEM I LEFT OUTER JOIN JCR_SVALUE V ON (V.PROPERTY_ID=I.ID)";
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/SingleDbJDBCConnection.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/SingleDbJDBCConnection.java 2011-08-11 13:22:33 UTC (rev 4743)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/SingleDbJDBCConnection.java 2011-08-11 14:05:08 UTC (rev 4744)
@@ -61,6 +61,11 @@
"select I.ID, I.PARENT_ID, I.NAME, I.VERSION, I.I_CLASS, I.I_INDEX, I.N_ORDER_NUM, I.P_TYPE, I.P_MULTIVALUED, V.ORDER_NUM,"
+ " V.DATA, V.STORAGE_DESC from JCR_SITEM I LEFT OUTER JOIN JCR_SVALUE V ON (V.PROPERTY_ID=I.ID)"
+ " where I.I_CLASS=2 and I.CONTAINER_NAME=? and I.PARENT_ID=? order by I.NAME";
+
+ protected static final String FIND_ITEM_QPATH_BY_ID_CQ_QUERY =
+ "select I.ID, I.PARENT_ID, I.NAME, I.I_INDEX"
+ + " from JCR_SITEM I, (SELECT ID, PARENT_ID from JCR_SITEM where ID=?) J"
+ + " where I.ID = J.ID or I.ID = J.PARENT_ID";
protected static final String PATTERN_ESCAPE_STRING = "\\"; //valid for HSQL, Sybase, DB2, MSSQL, ORACLE
@@ -158,10 +163,7 @@
+ " from JCR_SITEM I, JCR_SVALUE V"
+ " where I.I_CLASS=2 and I.CONTAINER_NAME=? and I.PARENT_ID=? and (I.NAME='[http://www.jcp.org/jcr/1.0]primaryType' or I.NAME='[http://www.jcp.org/jcr/1.0]mixinTypes' or I.NAME='[http://www.exoplatform.com/jcr/exo/1.0]owner' or I.NAME='[http://www.exoplatform.com/jcr/exo/1.0]permissions') and I.ID=V.PROPERTY_ID";
- FIND_ITEM_QPATH_BY_ID_CQ =
- "select I.ID, I.PARENT_ID, I.NAME, I.I_INDEX"
- + " from JCR_SITEM I, (SELECT ID, PARENT_ID from JCR_SITEM where ID=?) J"
- + " where I.ID = J.ID or I.ID = J.PARENT_ID";
+ FIND_ITEM_QPATH_BY_ID_CQ = FIND_ITEM_QPATH_BY_ID_CQ_QUERY;
FIND_LAST_ORDER_NUMBER_BY_PARENTID =
"select count(*), max(N_ORDER_NUM) from JCR_SITEM where I_CLASS=1 and CONTAINER_NAME=? and PARENT_ID=?";
12 years, 9 months
exo-jcr SVN: r4743 - in jcr/trunk/exo.jcr.component.core/src: main/java/org/exoplatform/services/jcr/impl/core and 5 other directories.
by do-not-reply@jboss.org
Author: nzamosenchuk
Date: 2011-08-11 09:22:33 -0400 (Thu, 11 Aug 2011)
New Revision: 4743
Modified:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/dataflow/persistent/WorkspaceStorageCache.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionImpl.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/CacheableWorkspaceDataManager.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/LinkedWorkspaceStorageCacheImpl.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/WorkspacePersistentDataManager.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan/ISPNCacheWorkspaceStorageCache.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/JBossCacheWorkspaceStorageCache.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/storage/WorkspaceDataContainer.java
jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/TestCacheableWorkspaceDataManager.java
Log:
EXOJCR-267 : (partial commit)
1. Limited minimal page size
2. Added isChildNodesByPageSupported() to WorkspaceStorageCache according to remark: "In WorkspaceStorageCache, we need to add a method of type isChildNodesByPageSupported to be able to call getChildNodesData(NodeData) and return false directly when we call CacheableWorkspaceDataManager.getChildNodesDataByPage otherwise for implementation like LinkedWorkspaceStorageCacheImpl that doesn't support this feature the result will never be stored into the cache so it will be very slow."
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/dataflow/persistent/WorkspaceStorageCache.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/dataflow/persistent/WorkspaceStorageCache.java 2011-08-11 13:18:23 UTC (rev 4742)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/dataflow/persistent/WorkspaceStorageCache.java 2011-08-11 13:22:33 UTC (rev 4743)
@@ -248,7 +248,7 @@
* @return enabled status flag, if true then cache is enabled
*/
@Managed
- @ManagedDescription("Indicates whether the cache is enabled or not")
+ @ManagedDescription("Indicates whether the cache is enabled or not")
boolean isEnabled();
/**
@@ -258,12 +258,18 @@
boolean isPatternSupported();
/**
+ * @return isPatternSupported status flag, if true then cache can store child lists grouped
+ * by pages
+ */
+ boolean isChildNodesByPageSupported();
+
+ /**
* Cache size.
*
* @return long value
*/
@Managed
- @ManagedDescription("Indicates the total amount of items into the cache")
+ @ManagedDescription("Indicates the total amount of items into the cache")
long getSize();
/**
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionImpl.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionImpl.java 2011-08-11 13:18:23 UTC (rev 4742)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionImpl.java 2011-08-11 13:22:33 UTC (rev 4743)
@@ -127,7 +127,7 @@
}
private static final AtomicLong SEQUENCE = new AtomicLong();
-
+
public static final int DEFAULT_LAZY_READ_THRESHOLD = 100;
private final RepositoryImpl repository;
@@ -249,7 +249,7 @@
sessionRegistry.registerSession(this);
this.lastAccessTime = System.currentTimeMillis();
-
+
this.triggerEventsForDescendentsOnRename =
wsConfig.getContainer().getParameterBoolean(WorkspaceDataContainer.TRIGGER_EVENTS_FOR_DESCENDENTS_ON_RENAME,
WorkspaceDataContainer.TRIGGER_EVENTS_FOR_DESCENDENTS_ON_RENAME_DEFAULT);
@@ -257,6 +257,13 @@
this.lazyNodeIteatorPageSize =
wsConfig.getContainer().getParameterInteger(WorkspaceDataContainer.LAZY_NODE_ITERATOR_PAGE_SIZE,
WorkspaceDataContainer.LAZY_NODE_ITERATOR_PAGE_SIZE_DEFAULT);
+ if (this.lazyNodeIteatorPageSize < WorkspaceDataContainer.LAZY_NODE_ITERATOR_PAGE_SIZE_MIN)
+ {
+ this.lazyNodeIteatorPageSize = WorkspaceDataContainer.LAZY_NODE_ITERATOR_PAGE_SIZE_MIN;
+ log.warn("Value for \"lazy-node-iterator-page-size\" is too small. Allowed minimum page size is "
+ + WorkspaceDataContainer.LAZY_NODE_ITERATOR_PAGE_SIZE_MIN + ". Using required value: "
+ + WorkspaceDataContainer.LAZY_NODE_ITERATOR_PAGE_SIZE_MIN + ".");
+ }
}
/**
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/CacheableWorkspaceDataManager.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/CacheableWorkspaceDataManager.java 2011-08-11 13:18:23 UTC (rev 4742)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/CacheableWorkspaceDataManager.java 2011-08-11 13:22:33 UTC (rev 4743)
@@ -97,7 +97,7 @@
* The resource manager
*/
private final TransactionableResourceManager txResourceManager;
-
+
private TransactionManager transactionManager;
/**
@@ -362,7 +362,7 @@
* the service for executing commands on all nodes of cluster
*/
public CacheableWorkspaceDataManager(WorkspaceDataContainer dataContainer, WorkspaceStorageCache cache,
- SystemDataContainerHolder systemDataContainerHolder, TransactionableResourceManager txResourceManager,
+ SystemDataContainerHolder systemDataContainerHolder, TransactionableResourceManager txResourceManager,
TransactionService transactionService, RPCService rpcService)
{
super(dataContainer, systemDataContainerHolder, txResourceManager);
@@ -422,7 +422,8 @@
try
{
- transactionManager = (TransactionManager)cache.getClass().getMethod("getTransactionManager", null).invoke(null, null);
+ transactionManager =
+ (TransactionManager)cache.getClass().getMethod("getTransactionManager", null).invoke(null, null);
}
catch (Exception e)
{
@@ -431,7 +432,7 @@
}
this.rpcService = rpcService;
- this.txResourceManager = txResourceManager;
+ this.txResourceManager = txResourceManager;
doInitRemoteCommands();
}
@@ -517,6 +518,14 @@
public boolean getChildNodesDataByPage(final NodeData nodeData, final int fromOrderNum, final int limit,
final List<NodeData> childs) throws RepositoryException
{
+ // if child nodes lazy iteration feature not supported by cache
+ // then call old-style getChildNodes method
+ if (!cache.isChildNodesByPageSupported())
+ {
+ childs.addAll(getChildNodesData(nodeData));
+ return false;
+ }
+ // if child nodes by page iteration supported, then do it
List<NodeData> childNodes = null;
if (cache.isEnabled())
{
@@ -638,7 +647,8 @@
* {@inheritDoc}
*/
@Override
- public ItemData getItemData(final NodeData parentData, final QPathEntry name, final ItemType itemType) throws RepositoryException
+ public ItemData getItemData(final NodeData parentData, final QPathEntry name, final ItemType itemType)
+ throws RepositoryException
{
if (cache.isEnabled())
{
@@ -825,7 +835,7 @@
doSave(changesLog);
return null;
}
- });
+ });
}
catch (PrivilegedActionException e)
{
@@ -891,9 +901,9 @@
// notify listeners after storage commit
notifySaveItems(logWrapper.getChangesLog(), false);
- }
+ }
}
-
+
/**
* Commits the tx
* @throws RepositoryException if the tx could not be committed.
@@ -925,7 +935,7 @@
throw new RepositoryException("Could not create a new Tx", e);
}
}
-
+
/**
* Performs rollback of the action.
*/
@@ -978,7 +988,7 @@
if (status == Status.STATUS_COMMITTED)
{
// Since the tx is successfully committed we can call components non tx aware
-
+
// The listeners will need to be executed outside the current tx so we suspend
// the current tx we can face enlistment issues on product like ISPN
transactionManager.suspend();
@@ -1098,8 +1108,8 @@
}
}
- protected List<NodeData> getChildNodesDataByPattern(final NodeData parentData, final List<QPathEntryFilter> patternFilters)
- throws RepositoryException
+ protected List<NodeData> getChildNodesDataByPattern(final NodeData parentData,
+ final List<QPathEntryFilter> patternFilters) throws RepositoryException
{
if (!cache.isEnabled())
{
@@ -1975,7 +1985,7 @@
public String getId()
{
return "org.exoplatform.services.jcr.impl.dataflow.persistent.CacheableWorkspaceDataManager"
- + "-requestForResponsibilityForResuming-" + dataContainer.getUniqueName();
+ + "-requestForResponsibilityForResuming-" + dataContainer.getUniqueName();
}
public Serializable execute(Serializable[] args) throws Throwable
@@ -1987,7 +1997,7 @@
rpcService.registerTopologyChangeListener(this);
}
}
-
+
private <T> T executeAction(PrivilegedExceptionAction<T> action) throws RepositoryException
{
try
@@ -2033,16 +2043,16 @@
{
// use parent ACL
node =
- new TransientNodeData(node.getQPath(), node.getIdentifier(), node.getPersistedVersion(),
- node.getPrimaryTypeName(), node.getMixinTypeNames(), node.getOrderNumber(),
+ new TransientNodeData(node.getQPath(), node.getIdentifier(), node.getPersistedVersion(), node
+ .getPrimaryTypeName(), node.getMixinTypeNames(), node.getOrderNumber(),
node.getParentIdentifier(), parent.getACL());
}
else
{
// use nearest ancestor ACL... case of get by id
node =
- new TransientNodeData(node.getQPath(), node.getIdentifier(), node.getPersistedVersion(),
- node.getPrimaryTypeName(), node.getMixinTypeNames(), node.getOrderNumber(),
+ new TransientNodeData(node.getQPath(), node.getIdentifier(), node.getPersistedVersion(), node
+ .getPrimaryTypeName(), node.getMixinTypeNames(), node.getOrderNumber(),
node.getParentIdentifier(), getNearestACAncestorAcl(node));
}
}
@@ -2052,9 +2062,9 @@
AccessControlList ancestorAcl = getNearestACAncestorAcl(node);
node =
- new TransientNodeData(node.getQPath(), node.getIdentifier(), node.getPersistedVersion(),
- node.getPrimaryTypeName(), node.getMixinTypeNames(), node.getOrderNumber(),
- node.getParentIdentifier(), new AccessControlList(acl.getOwner(), ancestorAcl.getPermissionEntries()));
+ new TransientNodeData(node.getQPath(), node.getIdentifier(), node.getPersistedVersion(), node
+ .getPrimaryTypeName(), node.getMixinTypeNames(), node.getOrderNumber(), node.getParentIdentifier(),
+ new AccessControlList(acl.getOwner(), ancestorAcl.getPermissionEntries()));
}
else if (!acl.hasOwner())
{
@@ -2062,9 +2072,9 @@
AccessControlList ancestorAcl = getNearestACAncestorAcl(node);
node =
- new TransientNodeData(node.getQPath(), node.getIdentifier(), node.getPersistedVersion(),
- node.getPrimaryTypeName(), node.getMixinTypeNames(), node.getOrderNumber(),
- node.getParentIdentifier(), new AccessControlList(ancestorAcl.getOwner(), acl.getPermissionEntries()));
+ new TransientNodeData(node.getQPath(), node.getIdentifier(), node.getPersistedVersion(), node
+ .getPrimaryTypeName(), node.getMixinTypeNames(), node.getOrderNumber(), node.getParentIdentifier(),
+ new AccessControlList(ancestorAcl.getOwner(), acl.getPermissionEntries()));
}
}
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/LinkedWorkspaceStorageCacheImpl.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/LinkedWorkspaceStorageCacheImpl.java 2011-08-11 13:18:23 UTC (rev 4742)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/LinkedWorkspaceStorageCacheImpl.java 2011-08-11 13:22:33 UTC (rev 4743)
@@ -1709,6 +1709,14 @@
{
return false;
}
+
+ /**
+ * {@inheritDoc}
+ */
+ public boolean isChildNodesByPageSupported()
+ {
+ return false;
+ }
/**
* Enable cache.
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/WorkspacePersistentDataManager.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/WorkspacePersistentDataManager.java 2011-08-11 13:18:23 UTC (rev 4742)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/WorkspacePersistentDataManager.java 2011-08-11 13:22:33 UTC (rev 4743)
@@ -597,10 +597,14 @@
if (skipVersionStorage)
{
if (!ref.getQPath().isDescendantOf(Constants.JCR_VERSION_STORAGE_PATH))
+ {
refProps.add(ref);
+ }
}
else
+ {
refProps.add(ref);
+ }
}
return refProps;
}
@@ -832,9 +836,13 @@
{
if (item.isNode())
+ {
con.delete((NodeData)item);
+ }
else
+ {
con.delete((PropertyData)item);
+ }
}
/**
@@ -933,22 +941,34 @@
public void addItemPersistenceListener(ItemsPersistenceListener listener)
{
if (listener instanceof MandatoryItemsPersistenceListener)
+ {
mandatoryListeners.add((MandatoryItemsPersistenceListener)listener);
+ }
else
+ {
listeners.add(listener);
+ }
if (LOG.isDebugEnabled())
+ {
LOG.debug("Workspace '" + this.dataContainer.getName() + "' listener registered: " + listener);
+ }
}
public void removeItemPersistenceListener(ItemsPersistenceListener listener)
{
if (listener instanceof MandatoryItemsPersistenceListener)
+ {
mandatoryListeners.remove(listener);
+ }
else
+ {
listeners.remove(listener);
+ }
if (LOG.isDebugEnabled())
+ {
LOG.debug("Workspace '" + this.dataContainer.getName() + "' listener unregistered: " + listener);
+ }
}
/**
@@ -980,7 +1000,9 @@
for (ItemsPersistenceListenerFilter f : liestenerFilters)
{
if (!f.accept(listener))
+ {
return false;
+ }
}
return true;
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan/ISPNCacheWorkspaceStorageCache.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan/ISPNCacheWorkspaceStorageCache.java 2011-08-11 13:18:23 UTC (rev 4742)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan/ISPNCacheWorkspaceStorageCache.java 2011-08-11 13:22:33 UTC (rev 4743)
@@ -94,7 +94,6 @@
*/
public class ISPNCacheWorkspaceStorageCache implements WorkspaceStorageCache, Backupable
{
-
private static final Log LOG = ExoLogger.getLogger("exo.jcr.component.core.ISPNCacheWorkspaceStorageCache");
private final boolean enabled;
@@ -1016,6 +1015,14 @@
{
return true;
}
+
+ /**
+ * {@inheritDoc}
+ */
+ public boolean isChildNodesByPageSupported()
+ {
+ return true;
+ }
/**
* Internal put Item.
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/JBossCacheWorkspaceStorageCache.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/JBossCacheWorkspaceStorageCache.java 2011-08-11 13:18:23 UTC (rev 4742)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/JBossCacheWorkspaceStorageCache.java 2011-08-11 13:22:33 UTC (rev 4743)
@@ -1361,6 +1361,14 @@
{
return true;
}
+
+ /**
+ * {@inheritDoc}
+ */
+ public boolean isChildNodesByPageSupported()
+ {
+ return true;
+ }
// non-public members
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/storage/WorkspaceDataContainer.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/storage/WorkspaceDataContainer.java 2011-08-11 13:18:23 UTC (rev 4742)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/storage/WorkspaceDataContainer.java 2011-08-11 13:22:33 UTC (rev 4743)
@@ -46,6 +46,8 @@
public static final int LAZY_NODE_ITERATOR_PAGE_SIZE_DEFAULT = 100;
+ public static final int LAZY_NODE_ITERATOR_PAGE_SIZE_MIN = 75;
+
public final static String CONTAINER_NAME = "containerName";
public final static String MAXBUFFERSIZE_PROP = "max-buffer-size";
Modified: jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/TestCacheableWorkspaceDataManager.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/TestCacheableWorkspaceDataManager.java 2011-08-11 13:18:23 UTC (rev 4742)
+++ jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/TestCacheableWorkspaceDataManager.java 2011-08-11 13:22:33 UTC (rev 4743)
@@ -361,6 +361,14 @@
{
return false;
}
+
+ /**
+ * {@inheritDoc}
+ */
+ public boolean isChildNodesByPageSupported()
+ {
+ return false;
+ }
public List<PropertyData> listChildProperties(NodeData parentData)
{
12 years, 9 months
exo-jcr SVN: r4742 - jcr/branches/1.12.x/patch/1.12.10-GA/JCR-1650.
by do-not-reply@jboss.org
Author: dkuleshov
Date: 2011-08-11 09:18:23 -0400 (Thu, 11 Aug 2011)
New Revision: 4742
Modified:
jcr/branches/1.12.x/patch/1.12.10-GA/JCR-1650/JCR-1650.patch
Log:
JCR-1650: fix added to patch
Modified: jcr/branches/1.12.x/patch/1.12.10-GA/JCR-1650/JCR-1650.patch
===================================================================
--- jcr/branches/1.12.x/patch/1.12.10-GA/JCR-1650/JCR-1650.patch 2011-08-11 11:53:23 UTC (rev 4741)
+++ jcr/branches/1.12.x/patch/1.12.10-GA/JCR-1650/JCR-1650.patch 2011-08-11 13:18:23 UTC (rev 4742)
@@ -1,8 +1,8 @@
Index: exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/TestJBossCacheWorkspaceStorageCacheInClusterMode.java
===================================================================
---- exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/TestJBossCacheWorkspaceStorageCacheInClusterMode.java (revision 4633)
+--- exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/TestJBossCacheWorkspaceStorageCacheInClusterMode.java (revision 4734)
+++ exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/TestJBossCacheWorkspaceStorageCacheInClusterMode.java (working copy)
-@@ -80,7 +80,7 @@
+@@ -80,12 +80,12 @@
transactionService == null ? null : transactionService, new ConfigurationManagerImpl());
}
@@ -11,13 +11,19 @@
{
JBossCacheWorkspaceStorageCache cache1 = null, cache2 = null;
try
+ {
+- MyWorkspaceStorageConnection con = new MyWorkspaceStorageConnection();
++ MyWorkspaceSC con = new MyWorkspaceSC();
+ WorkspaceDataContainer wdc = new MyWorkspaceDataContainer(con);
+ CacheableWorkspaceDataManager cwdmNode1 =
+ new CacheableWorkspaceDataManager(wdc, cache1 = getCacheImpl(), new SystemDataContainerHolder(wdc));
@@ -273,6 +273,106 @@
assertEquals(2, cwdmNode1.getItemData(parentNode, qpe, ItemType.PROPERTY).getPersistedVersion());
assertNotNull(cwdmNode2.getItemData(parentNode, qpe, ItemType.PROPERTY));
assertEquals(2, cwdmNode2.getItemData(parentNode, qpe, ItemType.PROPERTY).getPersistedVersion());
+
+ // testConsistency
-+ con = new MyWorkspaceStorageConnection(true);
++ con = new MyWorkspaceSC(true);
+ wdc = new MyWorkspaceDataContainer(con);
+ cwdmNode1 = new CacheableWorkspaceDataManager(wdc, cache1, new SystemDataContainerHolder(wdc));
+ cwdmNode2 = new CacheableWorkspaceDataManager(wdc, cache2, new SystemDataContainerHolder(wdc));
@@ -118,6 +124,15 @@
}
finally
{
+@@ -308,7 +408,7 @@
+ * @param idNode
+ * @throws InterruptedException
+ */
+- private void executeConcurrentReadNWrite(final MyWorkspaceStorageConnection con, final Action readAction,
++ private void executeConcurrentReadNWrite(final MyWorkspaceSC con, final Action readAction,
+ final Action writeAction, final Mode mode, final NodeData parentNode) throws InterruptedException
+ {
+ final CountDownLatch goSignal = con.initCountDownLatch();
@@ -336,6 +436,8 @@
{
if (mode == Mode.WRITE_FIRST) goSignal.countDown();
@@ -154,7 +169,7 @@
}
- private static class MyWorkspaceStorageConnection implements WorkspaceStorageConnection
+
-+ public static class MyWorkspaceStorageConnection implements WorkspaceStorageConnection
++ public static class MyWorkspaceSC implements WorkspaceStorageConnection
{
public ThreadLocal<Boolean> wait = new ThreadLocal<Boolean>();
+
@@ -168,11 +183,11 @@
+
+ private boolean itemDeleted;
+
-+ public MyWorkspaceStorageConnection()
++ public MyWorkspaceSC()
+ {
+ }
+
-+ public MyWorkspaceStorageConnection(boolean canModify)
++ public MyWorkspaceSC(boolean canModify)
+ {
+ this.canModify = canModify;
+ }
@@ -286,3 +301,42 @@
}
catch (UnsupportedEncodingException e)
{
+Index: exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/BufferedJBossCache.java
+===================================================================
+--- exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/BufferedJBossCache.java (revision 4734)
++++ exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/BufferedJBossCache.java (working copy)
+@@ -30,6 +30,7 @@
+ import org.jboss.cache.NodeNotExistsException;
+ import org.jboss.cache.Region;
+ import org.jboss.cache.config.Configuration;
++import org.jboss.cache.config.Configuration.CacheMode;
+ import org.jboss.cache.eviction.ExpirationAlgorithmConfig;
+ import org.jboss.cache.interceptors.base.CommandInterceptor;
+ import org.jgroups.Address;
+@@ -993,6 +994,12 @@
+ LOG.error("Unexpected object found by FQN:" + getFqn() + " and key:" + key + ". Expected Set, but found:"
+ + existingObject.getClass().getName());
+ }
++ else if (!localMode && cache.getConfiguration().getCacheMode() != CacheMode.LOCAL)
++ {
++ // to prevent consistency issue since we don't have the list in the local cache, we are in cluster env
++ // and we are in a non local mode, we clear the list in order to enforce other cluster nodes to reload it from the db
++ cache.put(fqn, key, null);
++ }
+ }
+
+ @Override
+@@ -1022,6 +1029,13 @@
+ @Override
+ public void apply()
+ {
++ if (!localMode && cache.getConfiguration().getCacheMode() != CacheMode.LOCAL)
++ {
++ // to prevent consistency issue since we don't have the list in the local cache, we are in cluster env
++ // and we are in a non local mode, we remove all the patterns in order to enforce other cluster nodes to reload them from the db
++ cache.removeNode(fqn);
++ return;
++ }
+ // force writeLock on next read
+ cache.getInvocationContext().getOptionOverrides().setForceWriteLock(true);
+ // object found by FQN and key;
12 years, 9 months