exo-jcr SVN: r2047 - 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: nfilotto
Date: 2010-03-10 05:15:57 -0500 (Wed, 10 Mar 2010)
New Revision: 2047
Modified:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/CQJDBCStorageConnection.java
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/SingleDbJDBCConnection.java
Log:
EXOJCR-579: the new traverseQPath based on complex queries has been removed, we will use the old traverseQPath since the performances are very similar and we have bad performances with hsqldb
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/CQJDBCStorageConnection.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/CQJDBCStorageConnection.java 2010-03-10 09:52:09 UTC (rev 2046)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/CQJDBCStorageConnection.java 2010-03-10 10:15:57 UTC (rev 2047)
@@ -28,7 +28,6 @@
import org.exoplatform.services.jcr.datamodel.NodeData;
import org.exoplatform.services.jcr.datamodel.PropertyData;
import org.exoplatform.services.jcr.datamodel.QPath;
-import org.exoplatform.services.jcr.datamodel.QPathEntry;
import org.exoplatform.services.jcr.datamodel.ValueData;
import org.exoplatform.services.jcr.impl.Constants;
import org.exoplatform.services.jcr.impl.dataflow.persistent.ByteArrayPersistedValueData;
@@ -55,7 +54,6 @@
import java.util.StringTokenizer;
import java.util.TreeSet;
-import javax.jcr.InvalidItemStateException;
import javax.jcr.RepositoryException;
/**
@@ -93,11 +91,6 @@
protected String FIND_REFERENCE_PROPERTIES_CQ;
/**
- * FIND_ITEM_QPATH_BY_ID_CQ.
- */
- protected String FIND_ITEM_QPATH_BY_ID_CQ;
-
- /**
* The comparator used to sort the value data
*/
private static Comparator<ValueData> COMPARATOR_VALUE_DATA = new Comparator<ValueData>()
@@ -731,84 +724,6 @@
}
}
- /**
- * {@inheritDoc}
- */
- @Override
- protected QPath traverseQPath(String cpid) throws SQLException, InvalidItemStateException, IllegalNameException
- {
- String id = getIdentifier(cpid);
- if (id.equals(Constants.ROOT_UUID))
- {
- return Constants.ROOT_PATH;
- }
- // get item by Identifier usecase
- List<QPathEntry> qrpath = new ArrayList<QPathEntry>(); // reverted path
- String caid = cpid; // container ancestor id
- boolean isRoot = false;
- do
- {
- ResultSet result = null;
- try
- {
- result = findItemQPathByIdentifierCQ(caid);
- if (!result.next())
- throw new InvalidItemStateException("Parent not found, uuid: " + getIdentifier(caid));
-
- QPathEntry qpe1 =
- new QPathEntry(InternalQName.parse(result.getString(COLUMN_NAME)), result.getInt(COLUMN_INDEX));
- boolean isChild = caid.equals(result.getString(COLUMN_ID));
- caid = result.getString(COLUMN_PARENTID);
- if (result.next())
- {
- QPathEntry qpe2 =
- new QPathEntry(InternalQName.parse(result.getString(COLUMN_NAME)), result.getInt(COLUMN_INDEX));
- if (isChild)
- {
- // The child is the first result then we have the parent
- qrpath.add(qpe1);
- qrpath.add(qpe2);
- // We need to take the value of the parent node
- caid = result.getString(COLUMN_PARENTID);
- }
- else
- {
- // The parent is the first result then we have the child
- qrpath.add(qpe2);
- qrpath.add(qpe1);
- }
- }
- else
- {
- qrpath.add(qpe1);
- }
- }
- finally
- {
- result.close();
- }
- if (caid.equals(Constants.ROOT_PARENT_UUID) || (id = getIdentifier(caid)).equals(Constants.ROOT_UUID))
- {
- if (id.equals(Constants.ROOT_UUID))
- {
- qrpath.add(Constants.ROOT_PATH.getEntries()[0]);
- }
- isRoot = true;
- }
- }
- while (!isRoot);
-
- QPathEntry[] qentries = new QPathEntry[qrpath.size()];
- int qi = 0;
- for (int i = qrpath.size() - 1; i >= 0; i--)
- {
- qentries[qi++] = qrpath.get(i);
- }
- return new QPath(qentries);
- }
-
- protected abstract ResultSet findItemQPathByIdentifierCQ(String identifier) throws SQLException;
-
protected abstract ResultSet findChildNodesByParentIdentifierCQ(String parentIdentifier) throws SQLException;
protected abstract ResultSet findChildPropertiesByParentIdentifierCQ(String parentIdentifier) throws SQLException;
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 2010-03-10 09:52:09 UTC (rev 2046)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/MultiDbJDBCConnection.java 2010-03-10 10:15:57 UTC (rev 2047)
@@ -213,11 +213,6 @@
+ " 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_NODES_COUNT_BY_PARENTID = "select count(ID) from JCR_MITEM" + " where I_CLASS=1 and PARENT_ID=?";
FIND_PROPERTIES_BY_PARENTID = "select * from JCR_MITEM" + " where I_CLASS=2 and PARENT_ID=?" + " order by ID";
@@ -655,21 +650,6 @@
* {@inheritDoc}
*/
@Override
- protected ResultSet findItemQPathByIdentifierCQ(String identifier) throws SQLException
- {
- if (findItemQPathByIdentifierCQ == null)
- findItemQPathByIdentifierCQ = dbConnection.prepareStatement(FIND_ITEM_QPATH_BY_ID_CQ);
- else
- findItemQPathByIdentifierCQ.clearParameters();
-
- findItemQPathByIdentifierCQ.setString(1, identifier);
- return findItemQPathByIdentifierCQ.executeQuery();
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
protected ResultSet findReferencePropertiesCQ(String nodeIdentifier) throws SQLException
{
if (findReferencePropertiesCQ == null)
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 2010-03-10 09:52:09 UTC (rev 2046)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/SingleDbJDBCConnection.java 2010-03-10 10:15:57 UTC (rev 2047)
@@ -221,11 +221,6 @@
+ " 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_NODES_COUNT_BY_PARENTID =
"select count(ID) from JCR_SITEM" + " where I_CLASS=1 and CONTAINER_NAME=? and PARENT_ID=?";
@@ -679,21 +674,6 @@
* {@inheritDoc}
*/
@Override
- protected ResultSet findItemQPathByIdentifierCQ(String identifier) throws SQLException
- {
- if (findItemQPathByIdentifierCQ == null)
- findItemQPathByIdentifierCQ = dbConnection.prepareStatement(FIND_ITEM_QPATH_BY_ID_CQ);
- else
- findItemQPathByIdentifierCQ.clearParameters();
-
- findItemQPathByIdentifierCQ.setString(1, identifier);
- return findItemQPathByIdentifierCQ.executeQuery();
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
protected ResultSet findReferencePropertiesCQ(String nodeIdentifier) throws SQLException
{
if (findReferencePropertiesCQ == null)
16 years, 2 months
exo-jcr SVN: r2046 - ws/trunk/exo.ws.rest.ext/src/main/java/org/exoplatform/services/rest/ext/proxy.
by do-not-reply@jboss.org
Author: max_shaposhnik
Date: 2010-03-10 04:52:09 -0500 (Wed, 10 Mar 2010)
New Revision: 2046
Modified:
ws/trunk/exo.ws.rest.ext/src/main/java/org/exoplatform/services/rest/ext/proxy/BaseConnector.java
Log:
EXOJCR-154 proxy changes
Modified: ws/trunk/exo.ws.rest.ext/src/main/java/org/exoplatform/services/rest/ext/proxy/BaseConnector.java
===================================================================
--- ws/trunk/exo.ws.rest.ext/src/main/java/org/exoplatform/services/rest/ext/proxy/BaseConnector.java 2010-03-09 16:45:51 UTC (rev 2045)
+++ ws/trunk/exo.ws.rest.ext/src/main/java/org/exoplatform/services/rest/ext/proxy/BaseConnector.java 2010-03-10 09:52:09 UTC (rev 2046)
@@ -26,6 +26,7 @@
import java.util.Enumeration;
import javax.servlet.http.HttpServletRequest;
+import javax.ws.rs.core.HttpHeaders;
import org.exoplatform.common.http.client.Codecs;
import org.exoplatform.common.http.client.HTTPConnection;
@@ -170,7 +171,7 @@
{
NVPair pair = null;
String headerName = (String)en.nextElement();
- if (!headerName.startsWith("Host")) { //Do not need to send host
+ if (!headerName.equalsIgnoreCase(HttpHeaders.HOST)) { //Do not need to send host
for (Enumeration<String> en2 = httpRequest.getHeaders(headerName); en2.hasMoreElements();)
{
pair = new NVPair(headerName, en2.nextElement());
16 years, 2 months
exo-jcr SVN: r2045 - in jcr/trunk/exo.jcr.component.core/src/main: java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db and 1 other directories.
by do-not-reply@jboss.org
Author: nfilotto
Date: 2010-03-09 11:45:51 -0500 (Tue, 09 Mar 2010)
New Revision: 2045
Modified:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/CQJDBCStorageConnection.java
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/SingleDbJDBCConnection.java
jcr/trunk/exo.jcr.component.core/src/main/resources/conf/storage/jcr-mjdbc.mysql-utf8.sql
jcr/trunk/exo.jcr.component.core/src/main/resources/conf/storage/jcr-mjdbc.mysql.sql
jcr/trunk/exo.jcr.component.core/src/main/resources/conf/storage/jcr-sjdbc.mysql-utf8.sql
jcr/trunk/exo.jcr.component.core/src/main/resources/conf/storage/jcr-sjdbc.mysql.sql
Log:
EXOJCR-519: A proposal to improve performances on mysql, the idea was to ensure that no explain plans contain "Using filesort" and/or "Using temporary" since it is not recommended according to http://dev.mysql.com/doc/refman/5.1/en/using-explain.html
To remove them, I had to add indexes and remove some order by clauses to replace them by a local sort
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/CQJDBCStorageConnection.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/CQJDBCStorageConnection.java 2010-03-09 10:38:59 UTC (rev 2044)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/CQJDBCStorageConnection.java 2010-03-09 16:45:51 UTC (rev 2045)
@@ -45,10 +45,15 @@
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import java.util.Set;
+import java.util.SortedSet;
import java.util.StringTokenizer;
+import java.util.TreeSet;
import javax.jcr.InvalidItemStateException;
import javax.jcr.RepositoryException;
@@ -93,6 +98,18 @@
protected String FIND_ITEM_QPATH_BY_ID_CQ;
/**
+ * The comparator used to sort the value data
+ */
+ private static Comparator<ValueData> COMPARATOR_VALUE_DATA = new Comparator<ValueData>()
+ {
+
+ public int compare(ValueData vd1, ValueData vd2)
+ {
+ return vd1.getOrderNumber() - vd2.getOrderNumber();
+ }
+ };
+
+ /**
* Class needed to store node details (property also) since result set is not sorted in valid way.
*/
private static class TempNodeData
@@ -109,7 +126,7 @@
int cnordernumb;
- Map<String, List<byte[]>> properties = new HashMap<String, List<byte[]>>();
+ Map<String, SortedSet<TempPropertyData>> properties = new HashMap<String, SortedSet<TempPropertyData>>();
public TempNodeData(ResultSet item) throws SQLException
{
@@ -121,7 +138,27 @@
cnordernumb = item.getInt(COLUMN_NORDERNUM);
}
}
+
+ /**
+ * store temporary property data to allow to sort it manually
+ */
+ private static class TempPropertyData implements Comparable<TempPropertyData>
+ {
+ int orderNum;
+ byte[] data;
+
+ public TempPropertyData(ResultSet item) throws SQLException
+ {
+ orderNum = item.getInt(COLUMN_VORDERNUM);
+ data = item.getBytes(COLUMN_VDATA);
+ }
+ public int compareTo(TempPropertyData o)
+ {
+ return orderNum - o.orderNum;
+ }
+ }
+
/**
* JDBCStorageConnection constructor.
*
@@ -172,15 +209,15 @@
childNodes.add(nodeData);
data = new TempNodeData(resultSet);
}
- Map<String, List<byte[]>> properties = data.properties;
+ Map<String, SortedSet<TempPropertyData>> properties = data.properties;
String key = resultSet.getString("PROP_NAME");
- List<byte[]> values = properties.get(key);
+ SortedSet<TempPropertyData> values = properties.get(key);
if (values == null)
{
- values = new ArrayList<byte[]>();
+ values = new TreeSet<TempPropertyData>();
properties.put(key, values);
}
- values.add(resultSet.getBytes(COLUMN_VDATA));
+ values.add(new TempPropertyData(resultSet));
}
if (data != null)
{
@@ -275,7 +312,9 @@
isNotLast = resultSet.next();
}
while (isNotLast && resultSet.getString(COLUMN_ID).equals(cid));
-
+
+ // To avoid using a temporary table, we sort the values manually
+ Collections.sort(data, COMPARATOR_VALUE_DATA);
//create property
PersistedPropertyData pdata =
new PersistedPropertyData(identifier, qpath, getIdentifier(cpid), cversion, cptype, cpmultivalued,
@@ -405,7 +444,7 @@
copies++;
dublicatedProps.put(identifier, copies);
}
- else if (values.size() <= valueOrderNum)
+ else if (values.size() == valueOrderNum)
{
// read value and put into values buffer
final String storageId = resultSet.getString(COLUMN_VSTORAGE_DESC);
@@ -423,6 +462,7 @@
PersistedPropertyData prop = propertyBuffer.get(id);
List<ValueData> values = valuesBuffer.get(id);
+ Collections.sort(values, COMPARATOR_VALUE_DATA);
int count = dublicatedProps.get(id).intValue();
for (int i = 0; i < count; i++)
@@ -466,17 +506,17 @@
* @throws SQLException
* @throws IllegalACLException
*/
- protected List<AccessControlEntry> readACLPermisions(String cid, Map<String, List<byte[]>> properties)
+ protected List<AccessControlEntry> readACLPermisions(String cid, Map<String, SortedSet<TempPropertyData>> properties)
throws SQLException, IllegalACLException
{
List<AccessControlEntry> naPermissions = new ArrayList<AccessControlEntry>();
- List<byte[]> permValues = properties.get(Constants.EXO_PERMISSIONS.getAsString());
+ Set<TempPropertyData> permValues = properties.get(Constants.EXO_PERMISSIONS.getAsString());
if (permValues != null)
{
- for (byte[] value : permValues)
+ for (TempPropertyData value : permValues)
{
- StringTokenizer parser = new StringTokenizer(new String(value), AccessControlEntry.DELIMITER);
+ StringTokenizer parser = new StringTokenizer(new String(value.data), AccessControlEntry.DELIMITER);
naPermissions.add(new AccessControlEntry(parser.nextToken(), parser.nextToken()));
}
@@ -490,15 +530,15 @@
* Read ACL owner.
*
* @param cid - node id (used only in exception message)
- * @param properties - Proeprty name and property values
+ * @param properties - Property name and property values
* @return ACL owner
* @throws IllegalACLException
*/
- protected String readACLOwner(String cid, Map<String, List<byte[]>> properties) throws IllegalACLException
+ protected String readACLOwner(String cid, Map<String, SortedSet<TempPropertyData>> properties) throws IllegalACLException
{
- List<byte[]> ownerValues = properties.get(Constants.EXO_OWNER.getAsString());
+ SortedSet<TempPropertyData> ownerValues = properties.get(Constants.EXO_OWNER.getAsString());
if (ownerValues != null)
- return new String(ownerValues.get(0));
+ return new String(ownerValues.first().data);
else
throw new IllegalACLException("Property exo:owner is not found for node with id: " + getIdentifier(cid));
}
@@ -510,17 +550,17 @@
int cversion, int cnordernumb, AccessControlList parentACL) throws RepositoryException, SQLException
{
ResultSet ptProp = findNodeMainPropertiesByParentIdentifierCQ(cid);
- Map<String, List<byte[]>> properties = new HashMap<String, List<byte[]>>();
+ Map<String, SortedSet<TempPropertyData>> properties = new HashMap<String, SortedSet<TempPropertyData>>();
while (ptProp.next())
{
String key = ptProp.getString(COLUMN_NAME);
- List<byte[]> values = properties.get(key);
+ SortedSet<TempPropertyData> values = properties.get(key);
if (values == null)
{
- values = new ArrayList<byte[]>();
+ values = new TreeSet<TempPropertyData>();
properties.put(key, values);
}
- values.add(ptProp.getBytes(COLUMN_VDATA));
+ values.add(new TempPropertyData(ptProp));
}
return loadNodeRecord(parentPath, cname, cid, cpid, cindex, cversion, cnordernumb, properties, parentACL);
@@ -543,12 +583,12 @@
return loadNodeRecord(parentPath, tempData.cname, tempData.cid, tempData.cpid, tempData.cindex,
tempData.cversion, tempData.cnordernumb, tempData.properties, parentACL);
}
-
+
/**
* Create a new node from the given parameter.
*/
private PersistedNodeData loadNodeRecord(QPath parentPath, String cname, String cid, String cpid, int cindex,
- int cversion, int cnordernumb, Map<String, List<byte[]>> properties, AccessControlList parentACL)
+ int cversion, int cnordernumb, Map<String, SortedSet<TempPropertyData>> properties, AccessControlList parentACL)
throws RepositoryException, SQLException
{
try
@@ -580,27 +620,27 @@
}
// PRIMARY
- List<byte[]> primaryType = properties.get(Constants.JCR_PRIMARYTYPE.getAsString());
+ SortedSet<TempPropertyData> primaryType = properties.get(Constants.JCR_PRIMARYTYPE.getAsString());
if (primaryType == null || primaryType.isEmpty())
{
throw new PrimaryTypeNotFoundException("FATAL ERROR primary type record not found. Node "
+ qpath.getAsString() + ", id " + cid + ", container " + this.containerName, null);
}
- byte[] data = primaryType.get(0);
+ byte[] data = primaryType.first().data;
InternalQName ptName = InternalQName.parse(new String((data != null ? data : new byte[]{})));
// MIXIN
InternalQName[] mts;
boolean owneable = false;
boolean privilegeable = false;
- List<byte[]> mixTypes = properties.get(Constants.JCR_MIXINTYPES.getAsString());
+ Set<TempPropertyData> mixTypes = properties.get(Constants.JCR_MIXINTYPES.getAsString());
if (mixTypes != null)
{
List<InternalQName> mNames = new ArrayList<InternalQName>();
- for (byte[] mxnb : mixTypes)
+ for (TempPropertyData mxnb : mixTypes)
{
- InternalQName mxn = InternalQName.parse(new String(mxnb));
+ InternalQName mxn = InternalQName.parse(new String(mxnb.data));
mNames.add(mxn);
if (!privilegeable && Constants.EXO_PRIVILEGEABLE.equals(mxn))
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 2010-03-09 10:38:59 UTC (rev 2044)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/MultiDbJDBCConnection.java 2010-03-09 16:45:51 UTC (rev 2045)
@@ -191,7 +191,7 @@
FIND_REFERENCE_PROPERTIES_CQ =
"select P.ID, P.PARENT_ID, P.VERSION, P.P_TYPE, P.P_MULTIVALUED, P.NAME, V.ORDER_NUM, V.DATA, V.STORAGE_DESC"
+ " from JCR_MREF R, JCR_MITEM P, JCR_MVALUE V"
- + " where R.NODE_ID=? and P.ID=R.PROPERTY_ID and P.I_CLASS=2 and V.PROPERTY_ID=P.ID order by P.ID, V.ORDER_NUM";
+ + " where R.NODE_ID=? and P.ID=R.PROPERTY_ID and P.I_CLASS=2 and V.PROPERTY_ID=P.ID order by R.PROPERTY_ID";
FIND_VALUES_BY_PROPERTYID =
"select PROPERTY_ID, ORDER_NUM, DATA, STORAGE_DESC from JCR_MVALUE where PROPERTY_ID=? order by ORDER_NUM";
@@ -206,12 +206,12 @@
"select I.*, P.NAME AS PROP_NAME, V.ORDER_NUM, V.DATA"
+ " from JCR_MITEM I, JCR_MITEM P, JCR_MVALUE V"
+ " where I.PARENT_ID=? and I.I_CLASS=1 and (P.PARENT_ID=I.ID and P.I_CLASS=2 and (P.NAME='[http://www.jcp.org/jcr/1.0]primaryType' or P.NAME='[http://www.jcp.org/jcr/1.0]mixinTypes' or P.NAME='[http://www.exoplatform.com/jcr/exo/1.0]owner' or P.NAME='[http://www.exoplatform.com/jcr/exo/1.0]permissions') and V.PROPERTY_ID=P.ID)"
- + " order by I.N_ORDER_NUM, I.ID, PROP_NAME DESC, V.ORDER_NUM";
+ + " order by I.N_ORDER_NUM, I.ID";
FIND_NODE_MAIN_PROPERTIES_BY_PARENTID_CQ =
- "select I.NAME, V.DATA"
+ "select I.NAME, V.DATA, V.ORDER_NUM"
+ " 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 order by V.ORDER_NUM";
+ + " 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"
@@ -226,7 +226,7 @@
FIND_PROPERTIES_BY_PARENTID_CQ =
"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.ID, V.ORDER_NUM";
+ + " where I.I_CLASS=2 and I.PARENT_ID=? order by I.ID";
INSERT_NODE =
"insert into JCR_MITEM(ID, PARENT_ID, NAME, VERSION, I_CLASS, I_INDEX, N_ORDER_NUM) VALUES(?,?,?,?,"
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 2010-03-09 10:38:59 UTC (rev 2044)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/SingleDbJDBCConnection.java 2010-03-09 16:45:51 UTC (rev 2045)
@@ -198,7 +198,7 @@
FIND_REFERENCE_PROPERTIES_CQ =
"select P.ID, P.PARENT_ID, P.VERSION, P.P_TYPE, P.P_MULTIVALUED, P.NAME, V.ORDER_NUM, V.DATA, V.STORAGE_DESC"
+ " from JCR_SREF R, JCR_SITEM P, JCR_SVALUE V"
- + " where R.NODE_ID=? and P.CONTAINER_NAME=? and P.ID=R.PROPERTY_ID and P.I_CLASS=2 and V.PROPERTY_ID=P.ID order by P.ID, V.ORDER_NUM";
+ + " where R.NODE_ID=? and P.CONTAINER_NAME=? and P.ID=R.PROPERTY_ID and P.I_CLASS=2 and V.PROPERTY_ID=P.ID order by R.PROPERTY_ID";
FIND_VALUES_BY_PROPERTYID =
"select PROPERTY_ID, ORDER_NUM, DATA, STORAGE_DESC from JCR_SVALUE where PROPERTY_ID=? order by ORDER_NUM";
@@ -214,12 +214,12 @@
"select I.*, P.NAME AS PROP_NAME, V.ORDER_NUM, V.DATA"
+ " from JCR_SITEM I, JCR_SITEM P, JCR_SVALUE V"
+ " where I.CONTAINER_NAME=? and I.PARENT_ID=? and I.I_CLASS=1 and (P.CONTAINER_NAME=? and P.PARENT_ID=I.ID and P.I_CLASS=2 and (P.NAME='[http://www.jcp.org/jcr/1.0]primaryType' or P.NAME='[http://www.jcp.org/jcr/1.0]mixinTypes' or P.NAME='[http://www.exoplatform.com/jcr/exo/1.0]owner' or P.NAME='[http://www.exoplatform.com/jcr/exo/1.0]permissions') and V.PROPERTY_ID=P.ID)"
- + " order by I.N_ORDER_NUM, I.ID, PROP_NAME DESC, V.ORDER_NUM";
+ + " order by I.N_ORDER_NUM, I.ID";
FIND_NODE_MAIN_PROPERTIES_BY_PARENTID_CQ =
- "select I.NAME, V.DATA"
+ "select I.NAME, V.DATA, V.ORDER_NUM"
+ " 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 order by V.ORDER_NUM";
+ + " 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"
@@ -235,7 +235,7 @@
FIND_PROPERTIES_BY_PARENTID_CQ =
"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 CONTAINER_NAME=? and I.PARENT_ID=? order by I.ID, V.ORDER_NUM";
+ + " where I.I_CLASS=2 and CONTAINER_NAME=? and I.PARENT_ID=? order by I.ID";
INSERT_NODE =
"insert into JCR_SITEM(ID, PARENT_ID, NAME, CONTAINER_NAME, VERSION, I_CLASS, I_INDEX, N_ORDER_NUM) VALUES(?,?,?,?,?,"
Modified: jcr/trunk/exo.jcr.component.core/src/main/resources/conf/storage/jcr-mjdbc.mysql-utf8.sql
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/resources/conf/storage/jcr-mjdbc.mysql-utf8.sql 2010-03-09 10:38:59 UTC (rev 2044)
+++ jcr/trunk/exo.jcr.component.core/src/main/resources/conf/storage/jcr-mjdbc.mysql-utf8.sql 2010-03-09 16:45:51 UTC (rev 2045)
@@ -18,6 +18,7 @@
CREATE UNIQUE INDEX JCR_IDX_MITEM_PARENT ON JCR_MITEM(PARENT_ID, NAME(255), I_INDEX, I_CLASS, VERSION DESC);
CREATE UNIQUE INDEX JCR_IDX_MITEM_PARENT_NAME ON JCR_MITEM(I_CLASS, PARENT_ID, NAME(255), I_INDEX, VERSION DESC);
CREATE UNIQUE INDEX JCR_IDX_MITEM_PARENT_ID ON JCR_MITEM(I_CLASS, PARENT_ID, ID, VERSION DESC);
+CREATE INDEX JCR_IDX_MITEM_PARENT_N_ORDER_NUM ON JCR_MITEM(I_CLASS, PARENT_ID, N_ORDER_NUM, ID);
CREATE TABLE JCR_MVALUE(
ID SERIAL NOT NULL,
DATA LONGBLOB,
@@ -28,6 +29,7 @@
CONSTRAINT JCR_FK_MVALUE_PROPERTY FOREIGN KEY(PROPERTY_ID) REFERENCES JCR_MITEM(ID)
);
CREATE UNIQUE INDEX JCR_IDX_MVALUE_PROPERTY ON JCR_MVALUE(PROPERTY_ID, ORDER_NUM);
+CREATE INDEX JCR_IDX_MVALUE_STORAGE_DESC ON JCR_MVALUE(PROPERTY_ID, STORAGE_DESC);
CREATE TABLE JCR_MREF(
NODE_ID VARCHAR(56) NOT NULL,
PROPERTY_ID VARCHAR(56) NOT NULL,
Modified: jcr/trunk/exo.jcr.component.core/src/main/resources/conf/storage/jcr-mjdbc.mysql.sql
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/resources/conf/storage/jcr-mjdbc.mysql.sql 2010-03-09 10:38:59 UTC (rev 2044)
+++ jcr/trunk/exo.jcr.component.core/src/main/resources/conf/storage/jcr-mjdbc.mysql.sql 2010-03-09 16:45:51 UTC (rev 2045)
@@ -18,6 +18,7 @@
CREATE UNIQUE INDEX JCR_IDX_MITEM_PARENT ON JCR_MITEM(PARENT_ID, NAME, I_INDEX, I_CLASS, VERSION DESC);
CREATE UNIQUE INDEX JCR_IDX_MITEM_PARENT_NAME ON JCR_MITEM(I_CLASS, PARENT_ID, NAME, I_INDEX, VERSION DESC);
CREATE UNIQUE INDEX JCR_IDX_MITEM_PARENT_ID ON JCR_MITEM(I_CLASS, PARENT_ID, ID, VERSION DESC);
+CREATE INDEX JCR_IDX_MITEM_PARENT_N_ORDER_NUM ON JCR_MITEM(I_CLASS, PARENT_ID, N_ORDER_NUM, ID);
CREATE TABLE JCR_MVALUE(
ID SERIAL NOT NULL,
DATA LONGBLOB,
@@ -28,6 +29,7 @@
CONSTRAINT JCR_FK_MVALUE_PROPERTY FOREIGN KEY(PROPERTY_ID) REFERENCES JCR_MITEM(ID)
);
CREATE UNIQUE INDEX JCR_IDX_MVALUE_PROPERTY ON JCR_MVALUE(PROPERTY_ID, ORDER_NUM);
+CREATE INDEX JCR_IDX_MVALUE_STORAGE_DESC ON JCR_MVALUE(PROPERTY_ID, STORAGE_DESC);
CREATE TABLE JCR_MREF(
NODE_ID VARCHAR(96) NOT NULL,
PROPERTY_ID VARCHAR(96) NOT NULL,
Modified: jcr/trunk/exo.jcr.component.core/src/main/resources/conf/storage/jcr-sjdbc.mysql-utf8.sql
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/resources/conf/storage/jcr-sjdbc.mysql-utf8.sql 2010-03-09 10:38:59 UTC (rev 2044)
+++ jcr/trunk/exo.jcr.component.core/src/main/resources/conf/storage/jcr-sjdbc.mysql-utf8.sql 2010-03-09 16:45:51 UTC (rev 2045)
@@ -19,6 +19,7 @@
CREATE UNIQUE INDEX JCR_IDX_SITEM_PARENT ON JCR_SITEM(CONTAINER_NAME, PARENT_ID, NAME(255), I_INDEX, I_CLASS, VERSION DESC);
CREATE UNIQUE INDEX JCR_IDX_SITEM_PARENT_NAME ON JCR_SITEM(I_CLASS, CONTAINER_NAME, PARENT_ID, NAME(255), I_INDEX, VERSION DESC);
CREATE UNIQUE INDEX JCR_IDX_SITEM_PARENT_ID ON JCR_SITEM(I_CLASS, CONTAINER_NAME, PARENT_ID, ID, VERSION DESC);
+CREATE INDEX JCR_IDX_SITEM_PARENT_N_ORDER_NUM ON JCR_SITEM(I_CLASS, CONTAINER_NAME, PARENT_ID, N_ORDER_NUM, ID);
CREATE TABLE JCR_SVALUE(
ID SERIAL NOT NULL,
DATA LONGBLOB,
@@ -29,6 +30,7 @@
CONSTRAINT JCR_FK_SVALUE_PROPERTY FOREIGN KEY(PROPERTY_ID) REFERENCES JCR_SITEM(ID)
);
CREATE UNIQUE INDEX JCR_IDX_SVALUE_PROPERTY ON JCR_SVALUE(PROPERTY_ID, ORDER_NUM);
+CREATE INDEX JCR_IDX_SVALUE_STORAGE_DESC ON JCR_SVALUE(PROPERTY_ID, STORAGE_DESC);
CREATE TABLE JCR_SREF(
NODE_ID VARCHAR(56) NOT NULL,
PROPERTY_ID VARCHAR(56) NOT NULL,
Modified: jcr/trunk/exo.jcr.component.core/src/main/resources/conf/storage/jcr-sjdbc.mysql.sql
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/resources/conf/storage/jcr-sjdbc.mysql.sql 2010-03-09 10:38:59 UTC (rev 2044)
+++ jcr/trunk/exo.jcr.component.core/src/main/resources/conf/storage/jcr-sjdbc.mysql.sql 2010-03-09 16:45:51 UTC (rev 2045)
@@ -19,6 +19,7 @@
CREATE UNIQUE INDEX JCR_IDX_SITEM_PARENT ON JCR_SITEM(CONTAINER_NAME, PARENT_ID, NAME, I_INDEX, I_CLASS, VERSION DESC);
CREATE UNIQUE INDEX JCR_IDX_SITEM_PARENT_NAME ON JCR_SITEM(I_CLASS, CONTAINER_NAME, PARENT_ID, NAME, I_INDEX, VERSION DESC);
CREATE UNIQUE INDEX JCR_IDX_SITEM_PARENT_ID ON JCR_SITEM(I_CLASS, CONTAINER_NAME, PARENT_ID, ID, VERSION DESC);
+CREATE INDEX JCR_IDX_SITEM_PARENT_N_ORDER_NUM ON JCR_SITEM(I_CLASS, CONTAINER_NAME, PARENT_ID, N_ORDER_NUM, ID);
CREATE TABLE JCR_SVALUE(
ID SERIAL NOT NULL,
DATA LONGBLOB,
@@ -29,6 +30,7 @@
CONSTRAINT JCR_FK_SVALUE_PROPERTY FOREIGN KEY(PROPERTY_ID) REFERENCES JCR_SITEM(ID)
);
CREATE UNIQUE INDEX JCR_IDX_SVALUE_PROPERTY ON JCR_SVALUE(PROPERTY_ID, ORDER_NUM);
+CREATE INDEX JCR_IDX_SVALUE_STORAGE_DESC ON JCR_SVALUE(PROPERTY_ID, STORAGE_DESC);
CREATE TABLE JCR_SREF(
NODE_ID VARCHAR(96) NOT NULL,
PROPERTY_ID VARCHAR(96) NOT NULL,
16 years, 2 months
exo-jcr SVN: r2044 - jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/usecases.
by do-not-reply@jboss.org
Author: areshetnyak
Date: 2010-03-09 05:38:59 -0500 (Tue, 09 Mar 2010)
New Revision: 2044
Modified:
jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/usecases/RemoveVDTest.java
Log:
EXOJCR-571 : The test RemoveVDTest was fixed (imitation save in JCR on deserialized PersistedValueData).
Modified: jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/usecases/RemoveVDTest.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/usecases/RemoveVDTest.java 2010-03-09 10:17:48 UTC (rev 2043)
+++ jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/usecases/RemoveVDTest.java 2010-03-09 10:38:59 UTC (rev 2044)
@@ -82,6 +82,8 @@
}
or.close();
+ // Imitation save
+ ((StreamPersistedValueData) vd1).setPersistedFile(((StreamPersistedValueData) vd1).getTempFile());
// read second time
or = new ObjectReaderImpl(new FileInputStream(serf));
@@ -96,6 +98,8 @@
fail(e.getMessage());
}
or.close();
+ // Imitation save
+ ((StreamPersistedValueData) vd2).setPersistedFile(((StreamPersistedValueData) vd2).getTempFile());
assertTrue(vd1.getFile().exists());
assertTrue(vd2.getFile().exists());
16 years, 2 months
exo-jcr SVN: r2043 - jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/serialization.
by do-not-reply@jboss.org
Author: areshetnyak
Date: 2010-03-09 05:17:48 -0500 (Tue, 09 Mar 2010)
New Revision: 2043
Modified:
jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/serialization/JcrImplSerializationBaseTest.java
Log:
EXOJCR-571 : The tests be serialization was fixed (imitation save in JCR on deserialized changes log)
Modified: jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/serialization/JcrImplSerializationBaseTest.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/serialization/JcrImplSerializationBaseTest.java 2010-03-08 12:41:47 UTC (rev 2042)
+++ jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/serialization/JcrImplSerializationBaseTest.java 2010-03-09 10:17:48 UTC (rev 2043)
@@ -18,23 +18,36 @@
*/
package org.exoplatform.services.jcr.impl.dataflow.serialization;
-import org.exoplatform.services.jcr.JcrImplBaseTest;
-import org.exoplatform.services.jcr.dataflow.ItemState;
-import org.exoplatform.services.jcr.dataflow.TransactionChangesLog;
-import org.exoplatform.services.jcr.dataflow.serialization.UnknownClassIdException;
-import org.exoplatform.services.jcr.datamodel.ItemData;
-import org.exoplatform.services.jcr.datamodel.PropertyData;
-import org.exoplatform.services.jcr.datamodel.ValueData;
-
import java.io.EOFException;
import java.io.File;
import java.io.FileInputStream;
+import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.nio.ByteBuffer;
+import java.nio.channels.Channels;
+import java.nio.channels.FileChannel;
+import java.nio.channels.ReadableByteChannel;
+import java.nio.channels.WritableByteChannel;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
+import org.exoplatform.services.jcr.JcrImplBaseTest;
+import org.exoplatform.services.jcr.dataflow.ChangesLogIterator;
+import org.exoplatform.services.jcr.dataflow.ItemState;
+import org.exoplatform.services.jcr.dataflow.PlainChangesLog;
+import org.exoplatform.services.jcr.dataflow.TransactionChangesLog;
+import org.exoplatform.services.jcr.dataflow.serialization.UnknownClassIdException;
+import org.exoplatform.services.jcr.datamodel.ItemData;
+import org.exoplatform.services.jcr.datamodel.PropertyData;
+import org.exoplatform.services.jcr.datamodel.ValueData;
+import org.exoplatform.services.jcr.impl.dataflow.persistent.StreamPersistedValueData;
+import org.exoplatform.services.jcr.impl.storage.value.fs.operations.ValueFileIOHelper;
+import org.exoplatform.services.jcr.storage.value.ValueIOChannel;
+
/**
* Created by The eXo Platform SAS. <br/>Date: 16.02.2009
*
@@ -126,10 +139,113 @@
{
// ok
}
+
+
+ //Imitation of save.
+ imitationSave(readed);
return readed;
}
- // public void test() throws Exception {
- // }
+ /**
+ * Imitation of JCR save
+ *
+ * @param readed
+ * @return
+ * @throws IOException
+ */
+ private void imitationSave(List<TransactionChangesLog> readed) throws IOException
+ {
+ for (TransactionChangesLog tLog : readed)
+ {
+ ChangesLogIterator it = tLog.getLogIterator();
+
+ while (it.hasNextLog())
+ {
+ PlainChangesLog pLog = it.nextLog();
+
+ for (ItemState state : pLog.getAllStates())
+ {
+ ItemData itemData = state.getData();
+
+ if (!itemData.isNode())
+ {
+ PropertyData propData = (PropertyData)itemData;
+
+ for(ValueData valueData : propData.getValues())
+ {
+ if (valueData instanceof StreamPersistedValueData) {
+ // imitation of JCR save
+ if (((StreamPersistedValueData) valueData).getTempFile() != null)
+ {
+ ((StreamPersistedValueData) valueData).setPersistedFile(((StreamPersistedValueData) valueData).getTempFile());
+ }
+ else
+ {
+ File file = File.createTempFile("tempFile", "tmp");
+ file.deleteOnExit();
+
+ copy(((StreamPersistedValueData) valueData).getStream(), new FileOutputStream(file));
+ ((StreamPersistedValueData) valueData).setPersistedFile(file);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ protected long copy(InputStream in, OutputStream out) throws IOException
+ {
+ // compare classes as in Java6 Channels.newChannel(), Java5 has a bug in newChannel().
+ boolean inFile = in instanceof FileInputStream && FileInputStream.class.equals(in.getClass());
+ boolean outFile = out instanceof FileOutputStream && FileOutputStream.class.equals(out.getClass());
+ if (inFile && outFile)
+ {
+ // it's user file
+ FileChannel infch = ((FileInputStream)in).getChannel();
+ FileChannel outfch = ((FileOutputStream)out).getChannel();
+
+ long size = 0;
+ long r = 0;
+ do
+ {
+ r = outfch.transferFrom(infch, r, infch.size());
+ size += r;
+ }
+ while (r < infch.size());
+ return size;
+ }
+ else
+ {
+ // it's user stream (not a file)
+ ReadableByteChannel inch = inFile ? ((FileInputStream)in).getChannel() : Channels.newChannel(in);
+ WritableByteChannel outch = outFile ? ((FileOutputStream)out).getChannel() : Channels.newChannel(out);
+
+ long size = 0;
+ int r = 0;
+ ByteBuffer buff = ByteBuffer.allocate(32 * 1024);
+ buff.clear();
+ while ((r = inch.read(buff)) >= 0)
+ {
+ buff.flip();
+
+ // copy all
+ do
+ {
+ outch.write(buff);
+ }
+ while (buff.hasRemaining());
+
+ buff.clear();
+ size += r;
+ }
+
+ if (outFile)
+ ((FileChannel)outch).force(true); // force all data to FS
+
+ return size;
+ }
+ }
}
16 years, 2 months
exo-jcr SVN: r2042 - jcr/trunk/docs/reference/en.
by do-not-reply@jboss.org
Author: nfilotto
Date: 2010-03-08 07:41:47 -0500 (Mon, 08 Mar 2010)
New Revision: 2042
Modified:
jcr/trunk/docs/reference/en/pom.xml
Log:
EXOJCR-562: use the property to get the version id of doc-style
Modified: jcr/trunk/docs/reference/en/pom.xml
===================================================================
--- jcr/trunk/docs/reference/en/pom.xml 2010-03-08 12:33:57 UTC (rev 2041)
+++ jcr/trunk/docs/reference/en/pom.xml 2010-03-08 12:41:47 UTC (rev 2042)
@@ -59,12 +59,12 @@
<dependency>
<groupId>org.exoplatform.doc</groupId>
<artifactId>exo-docbook-xslt</artifactId>
- <version>1</version>
+ <version>${org.exoplatform.doc-style.version}</version>
</dependency>
<dependency>
<groupId>org.exoplatform.doc</groupId>
<artifactId>exo-jdocbook-style</artifactId>
- <version>1</version>
+ <version>${org.exoplatform.doc-style.version}</version>
<type>jdocbook-style</type>
</dependency>
<!-- dependency>
16 years, 2 months
exo-jcr SVN: r2041 - jcr/trunk.
by do-not-reply@jboss.org
Author: nfilotto
Date: 2010-03-08 07:33:57 -0500 (Mon, 08 Mar 2010)
New Revision: 2041
Modified:
jcr/trunk/pom.xml
Log:
EXOJCR-562: set the trunk version of the doc-style project
Modified: jcr/trunk/pom.xml
===================================================================
--- jcr/trunk/pom.xml 2010-03-08 12:29:01 UTC (rev 2040)
+++ jcr/trunk/pom.xml 2010-03-08 12:33:57 UTC (rev 2041)
@@ -41,7 +41,8 @@
<exo.product.specification>1.12</exo.product.specification>
<org.exoplatform.kernel.version>2.2.1-GA-SNAPSHOT</org.exoplatform.kernel.version>
<org.exoplatform.core.version>2.3.1-GA-SNAPSHOT</org.exoplatform.core.version>
- <org.exoplatform.ws.version>2.1.1-GA-SNAPSHOT</org.exoplatform.ws.version>
+ <org.exoplatform.ws.version>2.1.1-GA-SNAPSHOT</org.exoplatform.ws.version>
+ <org.exoplatform.doc-style.version>2-SNAPSHOT</org.exoplatform.doc-style.version>
</properties>
<dependencyManagement>
<dependencies>
16 years, 2 months
exo-jcr SVN: r2040 - docs-style/trunk.
by do-not-reply@jboss.org
Author: nfilotto
Date: 2010-03-08 07:29:01 -0500 (Mon, 08 Mar 2010)
New Revision: 2040
Modified:
docs-style/trunk/pom.xml
Log:
EXOJCR-562: set the parent pom trunk version
Modified: docs-style/trunk/pom.xml
===================================================================
--- docs-style/trunk/pom.xml 2010-03-08 11:16:32 UTC (rev 2039)
+++ docs-style/trunk/pom.xml 2010-03-08 12:29:01 UTC (rev 2040)
@@ -4,7 +4,7 @@
<parent>
<groupId>org.exoplatform</groupId>
<artifactId>foundation-parent</artifactId>
- <version>5</version>
+ <version>6-SNAPSHOT</version>
</parent>
<groupId>org.exoplatform.doc</groupId>
16 years, 2 months
exo-jcr SVN: r2039 - in kernel/trunk/exo.kernel.component.ext.cache.impl.jboss.v3/src: main/java/org/exoplatform/services/cache/impl/jboss/ea and 3 other directories.
by do-not-reply@jboss.org
Author: nfilotto
Date: 2010-03-08 06:16:32 -0500 (Mon, 08 Mar 2010)
New Revision: 2039
Added:
kernel/trunk/exo.kernel.component.ext.cache.impl.jboss.v3/src/main/java/org/exoplatform/services/cache/impl/jboss/ea/
kernel/trunk/exo.kernel.component.ext.cache.impl.jboss.v3/src/main/java/org/exoplatform/services/cache/impl/jboss/ea/EAExoCacheConfig.java
kernel/trunk/exo.kernel.component.ext.cache.impl.jboss.v3/src/main/java/org/exoplatform/services/cache/impl/jboss/ea/EAExoCacheCreator.java
kernel/trunk/exo.kernel.component.ext.cache.impl.jboss.v3/src/test/java/org/exoplatform/services/cache/impl/jboss/TestEACache.java
Modified:
kernel/trunk/exo.kernel.component.ext.cache.impl.jboss.v3/src/main/java/org/exoplatform/services/cache/impl/jboss/AbstractExoCache.java
kernel/trunk/exo.kernel.component.ext.cache.impl.jboss.v3/src/main/java/org/exoplatform/services/cache/impl/jboss/lfu/LFUExoCacheCreator.java
kernel/trunk/exo.kernel.component.ext.cache.impl.jboss.v3/src/test/resources/conf/portal/test-configuration.xml
Log:
EXOJCR-576
Modified: kernel/trunk/exo.kernel.component.ext.cache.impl.jboss.v3/src/main/java/org/exoplatform/services/cache/impl/jboss/AbstractExoCache.java
===================================================================
--- kernel/trunk/exo.kernel.component.ext.cache.impl.jboss.v3/src/main/java/org/exoplatform/services/cache/impl/jboss/AbstractExoCache.java 2010-03-08 11:16:14 UTC (rev 2038)
+++ kernel/trunk/exo.kernel.component.ext.cache.impl.jboss.v3/src/main/java/org/exoplatform/services/cache/impl/jboss/AbstractExoCache.java 2010-03-08 11:16:32 UTC (rev 2039)
@@ -245,7 +245,7 @@
/**
* Only puts the data into the cache nothing more
*/
- private V putOnly(K key, V value)
+ protected V putOnly(K key, V value)
{
return cache.put(getFqn(key), key, value);
}
@@ -428,7 +428,7 @@
/**
* Returns the Fqn related to the given name
*/
- private Fqn<Serializable> getFqn(Serializable name)
+ protected Fqn<Serializable> getFqn(Serializable name)
{
return Fqn.fromElements(name);
}
Added: kernel/trunk/exo.kernel.component.ext.cache.impl.jboss.v3/src/main/java/org/exoplatform/services/cache/impl/jboss/ea/EAExoCacheConfig.java
===================================================================
--- kernel/trunk/exo.kernel.component.ext.cache.impl.jboss.v3/src/main/java/org/exoplatform/services/cache/impl/jboss/ea/EAExoCacheConfig.java (rev 0)
+++ kernel/trunk/exo.kernel.component.ext.cache.impl.jboss.v3/src/main/java/org/exoplatform/services/cache/impl/jboss/ea/EAExoCacheConfig.java 2010-03-08 11:16:32 UTC (rev 2039)
@@ -0,0 +1,70 @@
+/*
+ * 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.cache.impl.jboss.ea;
+
+import org.exoplatform.services.cache.ExoCacheConfig;
+import org.jboss.cache.eviction.ExpirationAlgorithm;
+
+
+/**
+ * The {@link org.exoplatform.services.cache.ExoCacheConfig} for the {@link ExpirationAlgorithm}
+ * implementation
+ *
+ * Created by The eXo Platform SAS
+ * Author : Nicolas Filotto
+ * nicolas.filotto(a)exoplatform.com
+ * 8 mars 2010
+ */
+public class EAExoCacheConfig extends ExoCacheConfig
+{
+
+ private int maxNodes;
+
+ private long minTimeToLive;
+
+ private long expirationTimeout;
+
+ public int getMaxNodes()
+ {
+ return maxNodes;
+ }
+
+ public void setMaxNodes(int maxNodes)
+ {
+ this.maxNodes = maxNodes;
+ }
+
+ public long getMinTimeToLive()
+ {
+ return minTimeToLive;
+ }
+
+ public void setMinTimeToLive(long minTimeToLive)
+ {
+ this.minTimeToLive = minTimeToLive;
+ }
+
+ public long getExpirationTimeout()
+ {
+ return expirationTimeout;
+ }
+
+ public void setExpirationTimeout(long expirationTimeout)
+ {
+ this.expirationTimeout = expirationTimeout;
+ }
+}
Added: kernel/trunk/exo.kernel.component.ext.cache.impl.jboss.v3/src/main/java/org/exoplatform/services/cache/impl/jboss/ea/EAExoCacheCreator.java
===================================================================
--- kernel/trunk/exo.kernel.component.ext.cache.impl.jboss.v3/src/main/java/org/exoplatform/services/cache/impl/jboss/ea/EAExoCacheCreator.java (rev 0)
+++ kernel/trunk/exo.kernel.component.ext.cache.impl.jboss.v3/src/main/java/org/exoplatform/services/cache/impl/jboss/ea/EAExoCacheCreator.java 2010-03-08 11:16:32 UTC (rev 2039)
@@ -0,0 +1,180 @@
+/*
+ * 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.cache.impl.jboss.ea;
+
+import org.exoplatform.management.annotations.Managed;
+import org.exoplatform.management.annotations.ManagedDescription;
+import org.exoplatform.management.annotations.ManagedName;
+import org.exoplatform.services.cache.ExoCache;
+import org.exoplatform.services.cache.ExoCacheConfig;
+import org.exoplatform.services.cache.ExoCacheInitException;
+import org.exoplatform.services.cache.impl.jboss.AbstractExoCache;
+import org.exoplatform.services.cache.impl.jboss.ExoCacheCreator;
+import org.jboss.cache.Cache;
+import org.jboss.cache.Fqn;
+import org.jboss.cache.config.Configuration;
+import org.jboss.cache.config.EvictionConfig;
+import org.jboss.cache.config.EvictionRegionConfig;
+import org.jboss.cache.eviction.ExpirationAlgorithm;
+import org.jboss.cache.eviction.ExpirationAlgorithmConfig;
+
+import java.io.Serializable;
+
+/**
+ * The {@link ExpirationAlgorithm} Implementation of an {@link org.exoplatform.services.cache.impl.jboss.ExoCacheCreator}
+ * Created by The eXo Platform SAS
+ * Author : Nicolas Filotto
+ * nicolas.filotto(a)exoplatform.com
+ * 8 mars 2010
+ */
+public class EAExoCacheCreator implements ExoCacheCreator
+{
+
+ /**
+ * The expected implementation name
+ */
+ public static final String EXPECTED_IMPL = "EA";
+
+ /**
+ * The default value for the parameter expirationTimeout
+ */
+ protected long defaultExpirationTimeout;
+
+ /**
+ * {@inheritDoc}
+ */
+ public String getExpectedImplementation()
+ {
+ return EXPECTED_IMPL;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public Class<? extends ExoCacheConfig> getExpectedConfigType()
+ {
+ return EAExoCacheConfig.class;
+ }
+
+ /**
+ * @see org.exoplatform.services.cache.impl.jboss.ExoCacheCreator#create(org.exoplatform.services.cache.ExoCacheConfig, org.jboss.cache.Cache)
+ */
+ public ExoCache<Serializable, Object> create(ExoCacheConfig config, Cache<Serializable, Object> cache)
+ throws ExoCacheInitException
+ {
+ if (config instanceof EAExoCacheConfig)
+ {
+ final EAExoCacheConfig eaConfig = (EAExoCacheConfig)config;
+ return create(config, cache, eaConfig.getMaxNodes(), eaConfig.getMinTimeToLive(), eaConfig
+ .getExpirationTimeout());
+ }
+ else
+ {
+ final long period = config.getLiveTime();
+ return create(config, cache, config.getMaxSize(), period > 0 ? period * 1000 : 0, defaultExpirationTimeout);
+ }
+ }
+
+ /**
+ * Creates a new ExoCache instance with the relevant parameters
+ */
+ private ExoCache<Serializable, Object> create(ExoCacheConfig config, Cache<Serializable, Object> cache,
+ int maxNodes, long minTimeToLive, long expirationTimeout) throws ExoCacheInitException
+ {
+ final Configuration configuration = cache.getConfiguration();
+ final ExpirationAlgorithmConfig ea = new ExpirationAlgorithmConfig();
+ ea.setMaxNodes(maxNodes);
+ ea.setMinTimeToLive(minTimeToLive);
+ ea.setExpirationKeyName(ExpirationAlgorithmConfig.EXPIRATION_KEY);
+ // Create an eviction region config
+ final EvictionRegionConfig erc = new EvictionRegionConfig(Fqn.ROOT, ea);
+
+ final EvictionConfig evictionConfig = configuration.getEvictionConfig();
+ evictionConfig.setDefaultEvictionRegionConfig(erc);
+
+ return new EAExoCache(config, cache, ea, expirationTimeout);
+ }
+
+ /**
+ * The {@link ExpirationAlgorithm} implementation of an ExoCache
+ */
+ public static class EAExoCache extends AbstractExoCache<Serializable, Object>
+ {
+ private long expirationTimeout;
+
+ private final ExpirationAlgorithmConfig ea;
+
+ public EAExoCache(ExoCacheConfig config, Cache<Serializable, Object> cache, ExpirationAlgorithmConfig ea,
+ long expirationTimeout)
+ {
+ super(config, cache);
+ this.ea = ea;
+ this.expirationTimeout = expirationTimeout;
+ }
+
+ /**
+ * We set the <code>ExpirationAlgorithmConfig.EXPIRATION_KEY</code> based on the <code>expirationTimeout</code>
+ * @see org.exoplatform.services.cache.impl.jboss.AbstractExoCache#putOnly(java.io.Serializable, java.lang.Object)
+ */
+ @Override
+ protected Object putOnly(Serializable key, Object value)
+ {
+ Fqn<Serializable> fqn = getFqn(key);
+ Long future = new Long(System.currentTimeMillis() + expirationTimeout);
+ cache.put(fqn, ExpirationAlgorithmConfig.EXPIRATION_KEY, future);
+ return cache.put(fqn, key, value);
+ }
+
+ public void setMaxSize(int max)
+ {
+ ea.setMaxNodes(max);
+ }
+
+ public void setLiveTime(long period)
+ {
+ ea.setMinTimeToLive(period);
+ }
+
+ @ManagedName("MaxNodes")
+ @ManagedDescription("This is the maximum number of nodes allowed in this region. 0 denotes immediate expiry, -1 denotes no limit.")
+ public int getMaxSize()
+ {
+ return ea.getMaxNodes();
+ }
+
+ @ManagedName("MinTimeToLive")
+ @ManagedDescription("the minimum amount of time a node must be allowed to live after being accessed before it is allowed to be considered for eviction. 0 denotes that this feature is disabled, which is the default value.")
+ public long getLiveTime()
+ {
+ return ea.getMinTimeToLive();
+ }
+
+ @Managed
+ @ManagedName("ExpirationTimeout")
+ @ManagedDescription("This is the timeout after which the cache entry must be evicted.")
+ public long getExpirationTimeout()
+ {
+ return expirationTimeout;
+ }
+
+ @Managed
+ public void setExpirationTimeout(long expirationTimeout)
+ {
+ this.expirationTimeout = expirationTimeout;
+ }
+ }
+}
Modified: kernel/trunk/exo.kernel.component.ext.cache.impl.jboss.v3/src/main/java/org/exoplatform/services/cache/impl/jboss/lfu/LFUExoCacheCreator.java
===================================================================
--- kernel/trunk/exo.kernel.component.ext.cache.impl.jboss.v3/src/main/java/org/exoplatform/services/cache/impl/jboss/lfu/LFUExoCacheCreator.java 2010-03-08 11:16:14 UTC (rev 2038)
+++ kernel/trunk/exo.kernel.component.ext.cache.impl.jboss.v3/src/main/java/org/exoplatform/services/cache/impl/jboss/lfu/LFUExoCacheCreator.java 2010-03-08 11:16:32 UTC (rev 2039)
@@ -51,7 +51,7 @@
public static final String EXPECTED_IMPL = "LFU";
/**
- * The default value for the parameter maxAge
+ * The default value for the parameter minNodes
*/
protected int defaultMinNodes;
Added: kernel/trunk/exo.kernel.component.ext.cache.impl.jboss.v3/src/test/java/org/exoplatform/services/cache/impl/jboss/TestEACache.java
===================================================================
--- kernel/trunk/exo.kernel.component.ext.cache.impl.jboss.v3/src/test/java/org/exoplatform/services/cache/impl/jboss/TestEACache.java (rev 0)
+++ kernel/trunk/exo.kernel.component.ext.cache.impl.jboss.v3/src/test/java/org/exoplatform/services/cache/impl/jboss/TestEACache.java 2010-03-08 11:16:32 UTC (rev 2039)
@@ -0,0 +1,84 @@
+/*
+ * 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 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.cache.impl.jboss;
+
+import org.exoplatform.container.PortalContainer;
+import org.exoplatform.services.cache.CacheService;
+import org.exoplatform.services.cache.impl.jboss.ea.EAExoCacheCreator.EAExoCache;
+import org.exoplatform.test.BasicTestCase;
+
+/**
+ * Created by The eXo Platform SAS
+ * Author : eXoPlatform
+ * exo(a)exoplatform.com
+ * 21 juil. 2009
+ */
+public class TestEACache extends BasicTestCase
+{
+
+ CacheService service_;
+
+ public TestEACache(String name)
+ {
+ super(name);
+ }
+
+ public void setUp() throws Exception
+ {
+ service_ = (CacheService)PortalContainer.getInstance().getComponentInstanceOfType(CacheService.class);
+ }
+
+ public void testPolicy() throws Exception
+ {
+ testPolicy("test-ea");
+ testPolicy("test-ea-with-old-config");
+ }
+
+ private void testPolicy(String cacheName) throws Exception
+ {
+ EAExoCache cache = (EAExoCache)service_.getCacheInstance(cacheName);
+ cache.put("a", "a");
+ cache.put("b", "a");
+ cache.put("c", "a");
+ cache.put("d", "a");
+ Thread.sleep(1000);
+ assertEquals(4, cache.getCacheSize());
+ cache.put("e", "a");
+ assertEquals(5, cache.getCacheSize());
+ cache.put("f", "a");
+ assertEquals(6, cache.getCacheSize());
+ Thread.sleep(1100);
+ assertEquals(2, cache.getCacheSize());
+ Thread.sleep(1000);
+ assertEquals(0, cache.getCacheSize());
+ cache.setMaxSize(3);
+ cache.setLiveTime(400);
+ cache.setExpirationTimeout(500);
+ cache.put("a", "a");
+ cache.put("b", "a");
+ cache.put("c", "a");
+ cache.put("d", "a");
+ assertEquals(4, cache.getCacheSize());
+ cache.put("e", "a");
+ assertEquals(5, cache.getCacheSize());
+ cache.put("f", "a");
+ Thread.sleep(600);
+ assertEquals(0, cache.getCacheSize());
+ }
+}
Modified: kernel/trunk/exo.kernel.component.ext.cache.impl.jboss.v3/src/test/resources/conf/portal/test-configuration.xml
===================================================================
--- kernel/trunk/exo.kernel.component.ext.cache.impl.jboss.v3/src/test/resources/conf/portal/test-configuration.xml 2010-03-08 11:16:14 UTC (rev 2038)
+++ kernel/trunk/exo.kernel.component.ext.cache.impl.jboss.v3/src/test/resources/conf/portal/test-configuration.xml 2010-03-08 11:16:32 UTC (rev 2039)
@@ -122,7 +122,27 @@
<field name="maxAge"><long>2000</long></field>
<field name="timeToLive"><long>1500</long></field>
</object>
- </object-param>
+ </object-param>
+ <object-param>
+ <name>test-ea-with-old-config</name>
+ <description>The default cache configuration</description>
+ <object type="org.exoplatform.services.cache.ExoCacheConfig">
+ <field name="name"><string>test-ea-with-old-config</string></field>
+ <field name="maxSize"><int>5</int></field>
+ <field name="liveTime"><long>1</long></field>
+ <field name="implementation"><string>EA</string></field>
+ </object>
+ </object-param>
+ <object-param>
+ <name>test-ea</name>
+ <description>The default cache configuration</description>
+ <object type="org.exoplatform.services.cache.impl.jboss.ea.EAExoCacheConfig">
+ <field name="name"><string>test-ea</string></field>
+ <field name="maxNodes"><int>5</int></field>
+ <field name="minTimeToLive"><long>1000</long></field>
+ <field name="expirationTimeout"><long>2000</long></field>
+ </object>
+ </object-param>
</init-params>
</component>
@@ -174,7 +194,14 @@
<field name="defaultTimeToLive"><long>1500</long></field>
<field name="defaultMaxAge"><long>2000</long></field>
</object>
- </object-param>
+ </object-param>
+ <object-param>
+ <name>EA</name>
+ <description>The ea cache creator</description>
+ <object type="org.exoplatform.services.cache.impl.jboss.ea.EAExoCacheCreator">
+ <field name="defaultExpirationTimeout"><long>2000</long></field>
+ </object>
+ </object-param>
</init-params>
</component-plugin>
</external-component-plugins>
16 years, 2 months
exo-jcr SVN: r2038 - jcr/trunk/docs/reference/en/src/main/docbook/en-US/modules/kernel.
by do-not-reply@jboss.org
Author: nfilotto
Date: 2010-03-08 06:16:14 -0500 (Mon, 08 Mar 2010)
New Revision: 2038
Modified:
jcr/trunk/docs/reference/en/src/main/docbook/en-US/modules/kernel/cache.xml
Log:
EXOJCR-576
Modified: jcr/trunk/docs/reference/en/src/main/docbook/en-US/modules/kernel/cache.xml
===================================================================
--- jcr/trunk/docs/reference/en/src/main/docbook/en-US/modules/kernel/cache.xml 2010-03-05 16:17:20 UTC (rev 2037)
+++ jcr/trunk/docs/reference/en/src/main/docbook/en-US/modules/kernel/cache.xml 2010-03-08 11:16:14 UTC (rev 2038)
@@ -137,7 +137,7 @@
</tgroup>
</table>
- <para> </para>
+ <para></para>
</section>
<section>
@@ -377,8 +377,8 @@
<name>LRU</name>
<description>The lru cache creator</description>
<object type="org.exoplatform.services.cache.impl.jboss.lru.LRUExoCacheCreator">
- <field name="defaultTimeToLive"><long>${my-value}</long></field>
- <field name="defaultMaxAge"><long>${my-value}</long></field>
+ <field name="defaultTimeToLive"><long>${my-value}</long></field>
+ <field name="defaultMaxAge"><long>${my-value}</long></field>
</object>
</object-param>
...</programlisting>
@@ -394,8 +394,8 @@
<entry>This is the default value of the field
<emphasis>timeToLive</emphasis> described in the section
dedicated to this cache type. This value is only use when we
- defined a cache of this type with the super type
- <envar>ExoCacheConfig</envar>.</entry>
+ define a cache of this type with the old
+ configuration.</entry>
</row>
<row>
@@ -404,8 +404,8 @@
<entry>his is the default value of the field
<emphasis>maxAge</emphasis> described in the section
dedicated to this cache type. This value is only use when we
- defined a cache of this type with the super type
- <envar>ExoCacheConfig</envar>.</entry>
+ define a cache of this type with the old
+ configuration.</entry>
</row>
</tbody>
</tgroup>
@@ -444,7 +444,7 @@
<name>LFU</name>
<description>The lfu cache creator</description>
<object type="org.exoplatform.services.cache.impl.jboss.lfu.LFUExoCacheCreator">
- <field name="defaultMinNodes"><int>${my-value}</int></field>
+ <field name="defaultMinNodes"><int>${my-value}</int></field>
</object>
</object-param>
...</programlisting>
@@ -460,13 +460,45 @@
<entry>This is the default value of the field
<emphasis>minNodes</emphasis> described in the section
dedicated to this cache type. This value is only use when we
- defined a cache of this type with the super type
- <envar>ExoCacheConfig</envar>.</entry>
+ define a cache of this type with the old
+ configuration.</entry>
</row>
</tbody>
</tgroup>
</table>
</section>
+
+ <section>
+ <title>EA Cache Creator - Expiration Algorithm</title>
+
+ <programlisting>...
+<object-param>
+ <name>EA</name>
+ <description>The ea cache creator</description>
+ <object type="org.exoplatform.services.cache.impl.jboss.ea.EAExoCacheCreator">
+ <field name="defaultExpirationTimeout"><long>2000</long></field>
+ </object>
+</object-param>
+...</programlisting>
+
+ <table>
+ <title>Fields description</title>
+
+ <tgroup cols="2">
+ <tbody>
+ <row>
+ <entry>defaultExpirationTimeout</entry>
+
+ <entry>This is the default value of the field
+ <emphasis>minNodes</emphasis> described in the section
+ dedicated to this cache type. This value is only use when we
+ define a cache of this type with the old
+ configuration.</entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
+ </section>
</section>
</section>
@@ -476,7 +508,7 @@
<section>
<title>How to define a cache?</title>
- <para>You have 2 ways to define a cache which are: </para>
+ <para>You have 2 ways to define a cache which are:</para>
<itemizedlist>
<listitem>
@@ -952,6 +984,105 @@
</listitem>
</itemizedlist>
</section>
+
+ <section>
+ <title>EA Cache - Expiration Algorithm</title>
+
+ <itemizedlist>
+ <listitem>
+ <para>New configuration<programlisting>...
+ <object-param>
+ <name>ea</name>
+ <description>The ea cache configuration</description>
+ <object type="org.exoplatform.services.cache.impl.jboss.ea.EAExoCacheConfig">
+ <field name="name"><string>ea</string></field>
+ <field name="maxNodes"><int>${my-value}</int></field>
+ <field name="minTimeToLive"><long>${my-value}</long></field>
+ <field name="expirationTimeout"><long>${my-value}</long></field>
+ </object>
+ </object-param>
+...</programlisting></para>
+
+ <table>
+ <title>Fields description</title>
+
+ <tgroup cols="2">
+ <tbody>
+ <row>
+ <entry>maxNodes</entry>
+
+ <entry>This is the maximum number of nodes allowed in this
+ region. 0 denotes immediate expiry, -1 denotes no
+ limit.</entry>
+ </row>
+
+ <row>
+ <entry>minTimeToLive</entry>
+
+ <entry>The minimum amount of time (in milliseconds) a node
+ must be allowed to live after being accessed before it is
+ allowed to be considered for eviction. 0 denotes that this
+ feature is disabled, which is the default value.</entry>
+ </row>
+
+ <row>
+ <entry>expirationTimeout</entry>
+
+ <entry>This is the timeout after which the cache entry
+ must be evicted.</entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
+ </listitem>
+
+ <listitem>
+ <para>Old configuration<programlisting>...
+ <object-param>
+ <name>ea-with-old-config</name>
+ <description>The ea cache configuration</description>
+ <object type="org.exoplatform.services.cache.ExoCacheConfig">
+ <field name="name"><string>lfu-with-old-config</string></field>
+ <field name="maxSize"><int>${my-value}</int></field>
+ <field name="liveTime"><long>${my-value}</long></field>
+ <field name="implementation"><string>EA</string></field>
+ </object>
+ </object-param>
+...</programlisting></para>
+
+ <table>
+ <title>Fields description</title>
+
+ <tgroup cols="2">
+ <tbody>
+ <row>
+ <entry>maxSize</entry>
+
+ <entry>This is the maximum number of nodes allowed in this
+ region. 0 denotes immediate expiry, -1 denotes no
+ limit.</entry>
+ </row>
+
+ <row>
+ <entry>liveTime</entry>
+
+ <entry>The minimum amount of time (in milliseconds) a node
+ must be allowed to live after being accessed before it is
+ allowed to be considered for eviction. 0 denotes that this
+ feature is disabled, which is the default value.</entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
+
+ <para><note>
+ <para>For the fields <emphasis>expirationTimeout</emphasis>
+ needed by JBoss cache, we will use the default values provided
+ by the creator.</para>
+ </note></para>
+ </listitem>
+ </itemizedlist>
+ </section>
</section>
</section>
</chapter>
16 years, 2 months