Author: pnedonosko
Date: 2009-11-17 12:00:52 -0500 (Tue, 17 Nov 2009)
New Revision: 734
Added:
jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/PropertyDataInfo.java
Modified:
jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JDBCCacheLoader.java
jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCStorageConnection.java
Log:
EXOJCR-248: get child props optimization
Modified:
jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JDBCCacheLoader.java
===================================================================
---
jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JDBCCacheLoader.java 2009-11-17
16:58:22 UTC (rev 733)
+++
jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JDBCCacheLoader.java 2009-11-17
17:00:52 UTC (rev 734)
@@ -25,6 +25,7 @@
import org.exoplatform.services.jcr.datamodel.PropertyData;
import org.exoplatform.services.jcr.datamodel.QPathEntry;
import org.exoplatform.services.jcr.impl.storage.jdbc.JDBCStorageConnection;
+import org.exoplatform.services.jcr.impl.storage.jdbc.PropertyDataInfo;
import org.exoplatform.services.jcr.storage.WorkspaceDataContainer;
import org.exoplatform.services.jcr.storage.WorkspaceStorageConnection;
import org.exoplatform.services.log.ExoLogger;
@@ -277,7 +278,7 @@
if (nodeData != null)
{
// TODO use dedicated select, not child datas
- List<PropertyData> childProps =
conn.getChildPropertiesData(nodeData);
+ List<PropertyDataInfo> childProps =
conn.getChildProperties(nodeId);
if (childProps.size() <= 0)
{
throw new JDBCCacheLoaderException("FATAL Empty attributes
for Node " + nodeId + " '" + name
@@ -286,9 +287,9 @@
attrs = new LinkedHashMap<Object, Object>();
attrs.put(JBossCacheStorage.ITEM_DATA, nodeData);
- for (PropertyData prop : childProps)
+ for (PropertyDataInfo prop : childProps)
{
- attrs.put(prop.getQPath().getName().getAsString(),
prop.getIdentifier());
+ attrs.put(prop.getPropertyName(), prop.getPropertyId());
}
}
else
Modified:
jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCStorageConnection.java
===================================================================
---
jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCStorageConnection.java 2009-11-17
16:58:22 UTC (rev 733)
+++
jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCStorageConnection.java 2009-11-17
17:00:52 UTC (rev 734)
@@ -1894,7 +1894,7 @@
}
// for JBC etc.
-
+
/**
* Deletes <code>NodeData</code> by identifier.
*
@@ -1994,29 +1994,34 @@
exceptionHandler.handleDeleteException(e, identifier, true);
}
}
-
+
public String getItemIdentifier(String parentId, String name) throws
RepositoryException, IllegalStateException
{
-
+
return null; // TODO
}
-
- class PropertyDataInfo {
- String propertyId;
- String propertyName;
- }
-
+
+ /**
+ * Get child properties id and name.
+ *
+ * @param parentId parent Node id.
+ * @return List of PropertyDataInfo
+ * @throws RepositoryException if error
+ * @throws IllegalStateException if the parent in illegal state
+ */
public List<PropertyDataInfo> getChildProperties(String parentId) throws
RepositoryException, IllegalStateException
{
-
+
checkIfOpened();
-
- List<PropertyDataInfo> children = new ArrayList<PropertyDataInfo>();
+
try
{
+ List<PropertyDataInfo> children = new
ArrayList<PropertyDataInfo>();
+
ResultSet prop =
findChildPropertiesIdNameByParentIdentifier(getInternalId(parentId));
- while (prop.next()) {
- //children.add((PropertyData)itemData(parent.getQPath(), prop,
I_CLASS_PROPERTY, null));
+ while (prop.next())
+ {
+ children.add(new PropertyDataInfo(prop.getString(COLUMN_ID),
prop.getString(COLUMN_NAME)));
}
return children;
@@ -2026,7 +2031,7 @@
throw new RepositoryException(e);
}
}
-
+
public List<String> getChildNodeNames(String parentId) throws
RepositoryException, IllegalStateException
{
checkIfOpened();
@@ -2035,7 +2040,7 @@
ResultSet node = findChildNodesByParentIdentifier(getInternalId(parentId));
List<String> childrens = new ArrayList<String>();
//while (node.next())
- //childrens.add((NodeData)itemData(parent.getQPath(), node, I_CLASS_NODE,
parent.getACL()));
+ //childrens.add((NodeData)itemData(parent.getQPath(), node, I_CLASS_NODE,
parent.getACL()));
return childrens;
}
@@ -2044,7 +2049,7 @@
throw new RepositoryException(e);
}
}
-
+
public List<String> getAllPropertyIdentifiers() throws RepositoryException,
IllegalStateException
{
checkIfOpened();
@@ -2053,7 +2058,7 @@
ResultSet node =
findChildNodesByParentIdentifier(getInternalId("???"));
List<String> childrens = new ArrayList<String>();
//while (node.next())
- //childrens.add((NodeData)itemData(parent.getQPath(), node, I_CLASS_NODE,
parent.getACL()));
+ //childrens.add((NodeData)itemData(parent.getQPath(), node, I_CLASS_NODE,
parent.getACL()));
return childrens;
}
@@ -2062,7 +2067,7 @@
throw new RepositoryException(e);
}
}
-
+
public List<String> getAllNodeIdentifiers() throws RepositoryException,
IllegalStateException
{
checkIfOpened();
@@ -2071,7 +2076,7 @@
ResultSet node =
findChildNodesByParentIdentifier(getInternalId("???"));
List<String> childrens = new ArrayList<String>();
//while (node.next())
- //childrens.add((NodeData)itemData(parent.getQPath(), node, I_CLASS_NODE,
parent.getACL()));
+ //childrens.add((NodeData)itemData(parent.getQPath(), node, I_CLASS_NODE,
parent.getACL()));
return childrens;
}
@@ -2096,9 +2101,10 @@
protected abstract ResultSet findChildNodesByParentIdentifier(String parentIdentifier)
throws SQLException;
protected abstract ResultSet findChildPropertiesByParentIdentifier(String
parentIdentifier) throws SQLException;
-
- protected abstract ResultSet findChildPropertiesIdNameByParentIdentifier(String
parentIdentifier) throws SQLException;
+ protected abstract ResultSet findChildPropertiesIdNameByParentIdentifier(String
parentIdentifier)
+ throws SQLException;
+
protected abstract int addReference(PropertyData data) throws SQLException,
IOException;
protected abstract int renameNode(NodeData data) throws SQLException;
Added:
jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/PropertyDataInfo.java
===================================================================
---
jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/PropertyDataInfo.java
(rev 0)
+++
jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/PropertyDataInfo.java 2009-11-17
17:00:52 UTC (rev 734)
@@ -0,0 +1,50 @@
+/*
+ * Copyright (C) 2009 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 3 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.exoplatform.services.jcr.impl.storage.jdbc;
+
+/**
+ * Created by The eXo Platform SAS.
+ *
+ * <br/>Date: 17.11.2009
+ *
+ * @author <a href="mailto:peter.nedonosko@exoplatform.com.ua">Peter
Nedonosko</a>
+ * @version $Id$
+ */
+public class PropertyDataInfo
+{
+ private final String propertyId;
+ private final String propertyName;
+
+ PropertyDataInfo(String propertyId, String propertyName) {
+ this.propertyId = propertyId;
+ this.propertyName = propertyName;
+ }
+
+ public String getPropertyId()
+ {
+ return propertyId;
+ }
+
+ public String getPropertyName()
+ {
+ return propertyName;
+ }
+
+
+}
Property changes on:
jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/PropertyDataInfo.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Id