exo-jcr SVN: r1284 - in jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl: storage/value/fs/operations and 1 other directories.
by do-not-reply@jboss.org
Author: tolusha
Date: 2010-01-05 04:11:11 -0500 (Tue, 05 Jan 2010)
New Revision: 1284
Modified:
jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCStorageConnection.java
jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/value/fs/operations/ValueFileIOHelper.java
jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/util/io/SwapFile.java
Log:
EXOJCR-363: refactoring, using ValueFileIOHelper for write value operation
Modified: jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCStorageConnection.java
===================================================================
--- jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCStorageConnection.java 2010-01-05 09:07:48 UTC (rev 1283)
+++ jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCStorageConnection.java 2010-01-05 09:11:11 UTC (rev 1284)
@@ -40,6 +40,7 @@
import org.exoplatform.services.jcr.impl.storage.value.ValueStorageNotFoundException;
import org.exoplatform.services.jcr.impl.storage.value.fs.operations.ValueFileIOHelper;
import org.exoplatform.services.jcr.impl.util.io.FileCleaner;
+import org.exoplatform.services.jcr.impl.util.io.SpoolFile;
import org.exoplatform.services.jcr.impl.util.io.SwapFile;
import org.exoplatform.services.jcr.storage.WorkspaceStorageConnection;
import org.exoplatform.services.jcr.storage.value.ValueIOChannel;
@@ -49,7 +50,6 @@
import java.io.ByteArrayInputStream;
import java.io.File;
-import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
@@ -76,6 +76,20 @@
{
/**
+ * Helper.
+ */
+ class WriteValueHelper extends ValueFileIOHelper
+ {
+ /**
+ * {@inheritDoc}
+ */
+ public void writeStreamedValue(File file, ValueData value) throws IOException
+ {
+ super.writeStreamedValue(file, value);
+ }
+ }
+
+ /**
* Connection logger.
*/
protected static final Log LOG = ExoLogger.getLogger("jcr.JDBCStorageConnection");
@@ -106,6 +120,8 @@
protected final List<ValueIOChannel> valueChanges;
+ protected final WriteValueHelper writeValueHelper = new WriteValueHelper();
+
/**
* Read-only flag, if true the connection is marked as READ-ONLY.
*/
@@ -1843,57 +1859,6 @@
}
/**
- * Writes value data to swap file.
- *
- * @param cid
- * Property id
- * @param orderNumber
- * Value order number
- * @param version
- * persistent version (used for BLOB swapping)
- * @param content
- * @return ValueData
- * @throws SQLException
- * database error
- * @throws IOException
- * I/O error (swap)
- */
- protected SwapFile swapValueData(String cid, int orderNumber, int version, final InputStream content)
- throws SQLException, IOException
- {
-
- byte[] spoolBuffer = new byte[ValueFileIOHelper.IOBUFFER_SIZE];
- int read;
- int len = 0;
-
- SwapFile swapFile = SwapFile.get(swapDirectory, cid + orderNumber + "." + version);
- OutputStream out = new FileOutputStream(swapFile);;
-
- if (swapFile.isSpooled())
- {
- return swapFile;
- }
-
- try
- {
- if (content != null)
- while ((read = content.read(spoolBuffer)) >= 0)
- {
- // spool to temp file
- out.write(spoolBuffer, 0, read);
- len += read;
- }
- }
- finally
- {
- out.close();
- swapFile.spoolDone();
- }
-
- return swapFile;
- }
-
- /**
* Add Values to Property record.
*
* @param data
@@ -1926,32 +1891,21 @@
}
else
{
- // it's StreamPersistedValueData
- File file;
StreamPersistedValueData streamData = (StreamPersistedValueData)vd;
- if ((file = streamData.getTempFile()) != null)
+ SwapFile swapFile = SwapFile.get(swapDirectory, cid + i + "." + data.getPersistedVersion());
+ try
{
- stream = new FileInputStream(streamData.getTempFile());
+ writeValueHelper.writeStreamedValue(swapFile, streamData);
}
- else
+ finally
{
- stream = streamData.getStream();
-
- // TODO spool on JDBC driver read - multiplexing the data to two stores, database and spool file, with one read.
- file = swapValueData(cid, i, data.getPersistedVersion(), stream);
+ swapFile.spoolDone();
}
- long vlen = file.length();
- if (vlen < 0)
+ long vlen = swapFile.length();
+ if (vlen <= Integer.MAX_VALUE)
{
- // TODO not actual with SwapFile, but if it will be reworked can be so
- streamLength = stream.available();
- LOG.warn("Cannot obtain exact Value data length, will use available from the stream " + streamLength
- + ". Property " + data.getQPath().getAsString());
- }
- else if (vlen <= Integer.MAX_VALUE)
- {
streamLength = (int)vlen;
}
else
@@ -1960,8 +1914,6 @@
+ ". Property " + data.getQPath().getAsString());
}
- // set persistent file to ValueData, will be available for saving Property.
- streamData.setPersistedFile(file);
stream = streamData.getAsStream();
}
storageId = null;
Modified: jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/value/fs/operations/ValueFileIOHelper.java
===================================================================
--- jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/value/fs/operations/ValueFileIOHelper.java 2010-01-05 09:07:48 UTC (rev 1283)
+++ jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/value/fs/operations/ValueFileIOHelper.java 2010-01-05 09:11:11 UTC (rev 1284)
@@ -119,65 +119,94 @@
{
if (value.isByteArray())
{
- OutputStream out = new FileOutputStream(file);
- try
- {
- out.write(value.getAsByteArray());
- }
- finally
- {
- out.close();
- }
+ writeByteArrayValue(file, value);
}
else
{
- // stream Value
+ writeStreamedValue(file, value);
+ }
+ }
- if (value instanceof StreamPersistedValueData)
+ /**
+ * Write value array of bytes to a file.
+ *
+ * @param file
+ * File
+ * @param value
+ * ValueData
+ * @throws IOException
+ * if error occurs
+ */
+ protected void writeByteArrayValue(File file, ValueData value) throws IOException
+ {
+ OutputStream out = new FileOutputStream(file);
+ try
+ {
+ out.write(value.getAsByteArray());
+ }
+ finally
+ {
+ out.close();
+ }
+ }
+
+ /**
+ * Write streamed value to a file.
+ *
+ * @param file
+ * File
+ * @param value
+ * ValueData
+ * @throws IOException
+ * if error occurs
+ */
+ protected void writeStreamedValue(File file, ValueData value) throws IOException
+ {
+ // stream Value
+ if (value instanceof StreamPersistedValueData)
+ {
+ StreamPersistedValueData streamed = (StreamPersistedValueData)value;
+
+ if (streamed.isPersisted())
{
- StreamPersistedValueData streamed = (StreamPersistedValueData)value;
-
- if (streamed.isPersisted())
+ // already persisted in another Value, copy it to this Value
+ copyClose(streamed.getAsStream(), new FileOutputStream(file));
+ }
+ else
+ {
+ // the Value not yet persisted, i.e. or in client stream or spooled to a temp file
+ File tempFile;
+ if ((tempFile = streamed.getTempFile()) != null)
{
- // already persisted in another Value, copy it to this Value
- copyClose(streamed.getAsStream(), new FileOutputStream(file));
- }
- else
- {
- // the Value not yet persisted, i.e. or in client stream or spooled to a temp file
- File tempFile;
- if ((tempFile = streamed.getTempFile()) != null)
+ // it's spooled Value, try move its file to VS
+ if (!tempFile.renameTo(file))
{
- // it's spooled Value, try move its file to VS
- if (!tempFile.renameTo(file))
+ // not succeeded - copy bytes, temp file will be deleted by transient ValueData
+ if (LOG.isDebugEnabled())
{
- // not succeeded - copy bytes, temp file will be deleted by transient ValueData
- if (LOG.isDebugEnabled())
- {
- LOG
- .debug("Value spool file move (rename) to Values Storage is not succeeded. Trying bytes copy. Spool file: "
- + tempFile.getAbsolutePath() + ". Destination: " + file.getAbsolutePath());
- }
+ LOG
+ .debug("Value spool file move (rename) to Values Storage is not succeeded. Trying bytes copy. Spool file: "
+ + tempFile.getAbsolutePath() + ". Destination: " + file.getAbsolutePath());
+ }
- copyClose(new FileInputStream(tempFile), new FileOutputStream(file));
- }
+ copyClose(new FileInputStream(tempFile), new FileOutputStream(file));
}
- else
- {
- // not spooled, use client InputStream
- copyClose(streamed.getStream(), new FileOutputStream(file));
- }
+ }
+ else
+ {
+ // not spooled, use client InputStream
+ copyClose(streamed.getStream(), new FileOutputStream(file));
+ }
- // link this Value to file in VS
- streamed.setPersistedFile(file);
- }
+ // link this Value to file in VS
+ streamed.setPersistedFile(file);
}
- else
- {
- // copy from Value stream to the file, e.g. from FilePersistedValueData to this Value
- copyClose(value.getAsStream(), new FileOutputStream(file));
- }
}
+ else
+ {
+ // copy from Value stream to the file, e.g. from FilePersistedValueData to this Value
+ copyClose(value.getAsStream(), new FileOutputStream(file));
+ }
}
/**
Modified: jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/util/io/SwapFile.java
===================================================================
--- jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/util/io/SwapFile.java 2010-01-05 09:07:48 UTC (rev 1283)
+++ jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/util/io/SwapFile.java 2010-01-05 09:11:11 UTC (rev 1284)
@@ -96,6 +96,7 @@
{
CountDownLatch spoolLatch = swapped.spoolLatch;
if (spoolLatch != null)
+ {
try
{
spoolLatch.await(); // wait till the file will be done
@@ -112,6 +113,8 @@
}
};
}
+ }
+ swapped.spoolLatch = new CountDownLatch(1);
return swapped;
}
16 years, 4 months
exo-jcr SVN: r1283 - jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db.
by do-not-reply@jboss.org
Author: sergiykarpenko
Date: 2010-01-05 04:07:48 -0500 (Tue, 05 Jan 2010)
New Revision: 1283
Modified:
jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/MultiDbJDBCConnection.java
jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/SingleDbJDBCConnection.java
Log:
EXOJCR-302: queries updated
Modified: jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/MultiDbJDBCConnection.java
===================================================================
--- jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/MultiDbJDBCConnection.java 2010-01-04 17:14:19 UTC (rev 1282)
+++ jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/MultiDbJDBCConnection.java 2010-01-05 09:07:48 UTC (rev 1283)
@@ -218,7 +218,8 @@
// property may contain no values
FIND_PROPERTIES_BY_PARENTID_CQ =
- "select I.*, V.ORDER_NUM, V.DATA, V.STORAGE_DESC from JCR_MITEM I LEFT OUTER JOIN JCR_MVALUE V ON (V.PROPERTY_ID=I.ID)"
+ "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";
INSERT_NODE =
Modified: jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/SingleDbJDBCConnection.java
===================================================================
--- jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/SingleDbJDBCConnection.java 2010-01-04 17:14:19 UTC (rev 1282)
+++ jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/SingleDbJDBCConnection.java 2010-01-05 09:07:48 UTC (rev 1283)
@@ -226,8 +226,9 @@
"select * from JCR_SITEM" + " where I_CLASS=2 and CONTAINER_NAME=? and PARENT_ID=?" + " order by ID";
FIND_PROPERTIES_BY_PARENTID_CQ =
- "select I.*, 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 ID, ORDER_NUM";
+ "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";
INSERT_NODE =
"insert into JCR_SITEM(ID, PARENT_ID, NAME, CONTAINER_NAME, VERSION, I_CLASS, I_INDEX, N_ORDER_NUM) VALUES(?,?,?,?,?,"
16 years, 4 months
exo-jcr SVN: r1282 - in jcr/branches/1.12.0-OPT/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: sergiykarpenko
Date: 2010-01-04 12:14:19 -0500 (Mon, 04 Jan 2010)
New Revision: 1282
Modified:
jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/CQJDBCStorageConnection.java
jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/MultiDbJDBCConnection.java
jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/SingleDbJDBCConnection.java
Log:
EXOJCR-302: getReferenceProperties added
Modified: jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/CQJDBCStorageConnection.java
===================================================================
--- jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/CQJDBCStorageConnection.java 2010-01-04 16:03:31 UTC (rev 1281)
+++ jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/CQJDBCStorageConnection.java 2010-01-04 17:14:19 UTC (rev 1282)
@@ -34,6 +34,8 @@
import org.exoplatform.services.jcr.impl.storage.jdbc.PrimaryTypeNotFoundException;
import org.exoplatform.services.jcr.impl.util.io.FileCleaner;
import org.exoplatform.services.jcr.storage.value.ValueStoragePluginProvider;
+import org.exoplatform.services.log.ExoLogger;
+import org.exoplatform.services.log.Log;
import java.io.File;
import java.io.IOException;
@@ -59,6 +61,11 @@
{
/**
+ * Connection logger.
+ */
+ protected static final Log LOG = ExoLogger.getLogger("jcr.optimisation.CQJDBCStorageConnection");
+
+ /**
* FIND_NODES_BY_PARENTID NEW.
*/
protected String FIND_NODES_BY_PARENTID_CQ;
@@ -73,6 +80,8 @@
*/
protected String FIND_NODE_MAIN_PROPERTIES_BY_PARENTID_CQ;
+ protected String FIND_REFERENCE_PROPERTIES;
+
/**
* Class needed to store node details (property also) since result set is not sorted in valid way.
*/
@@ -209,6 +218,33 @@
}
}
+ /**
+ * {@inheritDoc}
+ */
+ public List<PropertyData> getReferencesData(String nodeIdentifier) throws RepositoryException, IllegalStateException
+ {
+ checkIfOpened();
+ try
+ {
+ ResultSet refProps = findReferencePropertiesCQ(getInternalId(nodeIdentifier));
+ List<PropertyData> references = new ArrayList<PropertyData>();
+ while (refProps.next())
+ {
+ while (!refProps.isAfterLast())
+ references.add(loadPropertyRecord(refProps, null));
+ }
+ return references;
+ }
+ catch (SQLException e)
+ {
+ throw new RepositoryException(e);
+ }
+ catch (IOException e)
+ {
+ throw new RepositoryException(e);
+ }
+ }
+
protected List<AccessControlEntry> readACLPermisions(String cid, Map<String, List<byte[]>> properties)
throws SQLException, IllegalACLException
{
@@ -460,16 +496,19 @@
List<ValueData> data = new ArrayList<ValueData>();
String identifier = getIdentifier(cid);
+ int orderNum = -1;
+
do
{
- final int orderNum = resultSet.getInt(COLUMN_VORDERNUM);
+ orderNum = resultSet.getInt(COLUMN_VORDERNUM);
final String storageId = resultSet.getString(COLUMN_VSTORAGE_DESC);
ValueData vdata =
resultSet.wasNull() ? readValueData(cid, orderNum, cversion, resultSet.getBinaryStream(COLUMN_VDATA))
: readValueData(identifier, orderNum, storageId);
data.add(vdata);
}
- while (resultSet.next() && resultSet.getString(COLUMN_ID).equals(cid));
+ while (resultSet.next() && resultSet.getString(COLUMN_ID).equals(cid)
+ && (resultSet.getInt(COLUMN_VORDERNUM)) > orderNum);
PersistedPropertyData pdata =
new PersistedPropertyData(identifier, qpath, getIdentifier(cpid), cversion, cptype, cpmultivalued, data);
@@ -646,4 +685,6 @@
protected abstract ResultSet findChildPropertiesByParentIdentifierCQ(String parentIdentifier) throws SQLException;
protected abstract ResultSet findNodeMainPropertiesByParentIdentifierCQ(String parentIdentifier) throws SQLException;
+
+ protected abstract ResultSet findReferencePropertiesCQ(String nodeIdentifier) throws SQLException;
}
Modified: jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/MultiDbJDBCConnection.java
===================================================================
--- jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/MultiDbJDBCConnection.java 2010-01-04 16:03:31 UTC (rev 1281)
+++ jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/MultiDbJDBCConnection.java 2010-01-04 17:14:19 UTC (rev 1282)
@@ -67,7 +67,7 @@
protected PreparedStatement findReferences;
- protected PreparedStatement findReferenceProperties;
+ protected PreparedStatement findReferencePropertiesCQ;
protected PreparedStatement findValuesByPropertyId;
@@ -187,6 +187,11 @@
"select P.ID, P.PARENT_ID, P.VERSION, P.P_TYPE, P.P_MULTIVALUED, P.NAME" + " from JCR_MREF R, JCR_MITEM P"
+ " where R.NODE_ID=? and P.ID=R.PROPERTY_ID and P.I_CLASS=2";
+ FIND_REFERENCE_PROPERTIES =
+ "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";
+
FIND_VALUES_BY_PROPERTYID =
"select PROPERTY_ID, ORDER_NUM, DATA, STORAGE_DESC from JCR_MVALUE where PROPERTY_ID=? order by ORDER_NUM";
@@ -214,7 +219,7 @@
// property may contain no values
FIND_PROPERTIES_BY_PARENTID_CQ =
"select I.*, 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 ID, ORDER_NUM";
+ + " where I.I_CLASS=2 and I.PARENT_ID=? order by I.ID, V.ORDER_NUM";
INSERT_NODE =
"insert into JCR_MITEM(ID, PARENT_ID, NAME, VERSION, I_CLASS, I_INDEX, N_ORDER_NUM) VALUES(?,?,?,?,"
@@ -632,4 +637,20 @@
findNodeMainPropertiesByParentIdentifierCQ.setString(1, parentIdentifier);
return findNodeMainPropertiesByParentIdentifierCQ.executeQuery();
}
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected ResultSet findReferencePropertiesCQ(String nodeIdentifier) throws SQLException
+ {
+ if (findReferencePropertiesCQ == null)
+ findReferencePropertiesCQ = dbConnection.prepareStatement(FIND_REFERENCE_PROPERTIES);
+ else
+ findReferencePropertiesCQ.clearParameters();
+
+ findReferencePropertiesCQ.setString(1, nodeIdentifier);
+ return findReferencePropertiesCQ.executeQuery();
+ }
+
}
Modified: jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/SingleDbJDBCConnection.java
===================================================================
--- jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/SingleDbJDBCConnection.java 2010-01-04 16:03:31 UTC (rev 1281)
+++ jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/SingleDbJDBCConnection.java 2010-01-04 17:14:19 UTC (rev 1282)
@@ -65,6 +65,8 @@
protected PreparedStatement findReferences;
+ protected PreparedStatement findReferencePropertiesCQ;
+
protected PreparedStatement findValuesByPropertyId;
protected PreparedStatement findValuesStorageDescriptorsByPropertyId;
@@ -191,6 +193,11 @@
"select P.ID, P.PARENT_ID, P.VERSION, P.P_TYPE, P.P_MULTIVALUED, P.NAME" + " from JCR_SREF R, JCR_SITEM P"
+ " where R.NODE_ID=? and P.CONTAINER_NAME=? and P.ID=R.PROPERTY_ID and P.I_CLASS=2";
+ FIND_REFERENCE_PROPERTIES =
+ "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";
+
FIND_VALUES_BY_PROPERTYID =
"select PROPERTY_ID, ORDER_NUM, DATA, STORAGE_DESC from JCR_SVALUE where PROPERTY_ID=? order by ORDER_NUM";
@@ -647,4 +654,17 @@
findNodeMainPropertiesByParentIdentifierCQ.setString(2, parentIdentifier);
return findNodeMainPropertiesByParentIdentifierCQ.executeQuery();
}
+
+ @Override
+ protected ResultSet findReferencePropertiesCQ(String nodeIdentifier) throws SQLException
+ {
+ if (findReferencePropertiesCQ == null)
+ findReferencePropertiesCQ = dbConnection.prepareStatement(FIND_REFERENCE_PROPERTIES);
+ else
+ findReferencePropertiesCQ.clearParameters();
+
+ findReferencePropertiesCQ.setString(1, nodeIdentifier);
+ findReferencePropertiesCQ.setString(2, containerName);
+ return findReferencePropertiesCQ.executeQuery();
+ }
}
16 years, 4 months
exo-jcr SVN: r1281 - jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache.
by do-not-reply@jboss.org
Author: areshetnyak
Date: 2010-01-04 11:03:31 -0500 (Mon, 04 Jan 2010)
New Revision: 1281
Modified:
jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/ExoEvictionActionPolicy.java
Log:
EXOJCR-333 : The ExoEvictionActionPolicy was changed.
Modified: jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/ExoEvictionActionPolicy.java
===================================================================
--- jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/ExoEvictionActionPolicy.java 2010-01-04 16:02:20 UTC (rev 1280)
+++ jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/ExoEvictionActionPolicy.java 2010-01-04 16:03:31 UTC (rev 1281)
@@ -68,7 +68,8 @@
}
catch (Exception e)
{
- LOG.error("Unable to evict " + fqn, e);
+ if (LOG.isDebugEnabled())
+ LOG.debug("Unable to evict " + fqn, e);
return false;
}
}
16 years, 4 months
exo-jcr SVN: r1280 - jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/cluster/functional.
by do-not-reply@jboss.org
Author: nzamosenchuk
Date: 2010-01-04 11:02:20 -0500 (Mon, 04 Jan 2010)
New Revision: 1280
Added:
jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/cluster/functional/WebdavQueryTest.java
Log:
EXOJCR-340: Added simple query tests for clustered environment.
Added: jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/cluster/functional/WebdavQueryTest.java
===================================================================
--- jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/cluster/functional/WebdavQueryTest.java (rev 0)
+++ jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/cluster/functional/WebdavQueryTest.java 2010-01-04 16:02:20 UTC (rev 1280)
@@ -0,0 +1,155 @@
+/*
+ * 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.cluster.functional;
+
+import org.exoplatform.common.http.client.HTTPResponse;
+import org.exoplatform.services.jcr.cluster.BaseClusteringFunctionalTest;
+import org.exoplatform.services.jcr.cluster.JCRWebdavConnection;
+
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.FactoryConfigurationError;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.events.StartElement;
+
+/**
+ * Class contains set of query tests for clustered environment
+ *
+ * @author <a href="mailto:nikolazius@gmail.com">Nikolay Zamosenchuk</a>
+ * @version $Id: WebdavQueryTest.java 34360 2009-07-22 23:58:59Z nzamosenchuk $
+ *
+ */
+public class WebdavQueryTest extends BaseClusteringFunctionalTest
+{
+
+ public void testSimpleGetAllSql() throws Exception
+ {
+ String testLocalRootName = "node";
+ JCRWebdavConnection conn = getConnection();
+ conn.addDir(testLocalRootName);
+ List<String> expected = new ArrayList<String>();
+ expected.add("exo_String");
+ expected.add("exo_Boolean");
+ expected.add("exo_Integer");
+ expected.add("exo_Long");
+ expected.add("exo_Float");
+ expected.add("exo_Double");
+
+ for (String name : expected)
+ {
+ conn.addNode(testLocalRootName + "/" + name, "_data_".getBytes());
+ System.out.println("added: " + name);
+ }
+
+ HTTPResponse response =
+ conn.sqlQuery("SELECT * FROM nt:base WHERE jcr:path LIKE '/" + testLocalRootName + "[%]/%'");
+ assertEquals(207, response.getStatusCode());
+ List<String> found = parseNodeNames(response.getData());
+ assertTrue("Some nodes not found", assertLists(expected, found));
+ conn.removeNode(testLocalRootName);
+ }
+
+ /**
+ * Extracts names of nodes from response XML
+ *
+ * TODO: fix
+ * /!\ During parsing method accumulates nodes in SET, because of https://jira.jboss.org/jira/browse/EXOJCR-364 /!\
+ *
+ * @param data
+ * @return
+ * @throws XMLStreamException
+ * @throws FactoryConfigurationError
+ * @throws IOException
+ */
+ public List<String> parseNodeNames(byte[] data) throws XMLStreamException, FactoryConfigurationError, IOException
+ {
+ // flag, that notifies when parser is inside <D:displayname></D:displayname>
+ boolean displayName = false;
+ Set<String> nodes = new HashSet<String>();
+ InputStream input = new ByteArrayInputStream(data);
+ XMLStreamReader reader = XMLInputFactory.newInstance().createXMLStreamReader(input);
+ QName name = QName.valueOf("{DAV:}displayname");
+ try
+ {
+ while (reader.hasNext())
+ {
+ int eventCode = reader.next();
+ switch (eventCode)
+ {
+ case StartElement.START_ELEMENT : {
+ // if {DAV:}displayname opening element
+ if (reader.getName().equals(name))
+ {
+ displayName = true;
+ }
+ break;
+ }
+ case StartElement.CHARACTERS : {
+ if (displayName)
+ {
+ // currently reader is inside <D:displayname>nodeName</D:displayname>
+ // adding name to list if not empty
+ String nodeName = reader.getText();
+ if (nodeName != null && !nodeName.equals(""))
+ {
+ nodes.add(nodeName);
+ }
+ }
+ break;
+ }
+ default : {
+ displayName = false;
+ break;
+ }
+ }
+ }
+ }
+ finally
+ {
+ reader.close();
+ input.close();
+ }
+ return new ArrayList<String>(nodes);
+ }
+
+ /**
+ * returns true if lists are equals (order doesn't matter)
+ *
+ * @param expected
+ * @param found
+ * @return
+ */
+ public boolean assertLists(List<String> expected, List<String> found)
+ {
+ if (expected == null || found == null)
+ {
+ return false;
+ }
+ return expected.containsAll(found) && found.containsAll(expected);
+ }
+}
Property changes on: jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/cluster/functional/WebdavQueryTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
16 years, 4 months
exo-jcr SVN: r1279 - jcr/branches/1.12.0-JBCCACHE/applications/cluster.test.client/src/main/java/org/exoplatform/services/jcr/cluster.
by do-not-reply@jboss.org
Author: nzamosenchuk
Date: 2010-01-04 11:00:57 -0500 (Mon, 04 Jan 2010)
New Revision: 1279
Modified:
jcr/branches/1.12.0-JBCCACHE/applications/cluster.test.client/src/main/java/org/exoplatform/services/jcr/cluster/JCRWebdavConnection.java
Log:
EXOJCR-340: Added SQL and XPATH query methods.
Modified: jcr/branches/1.12.0-JBCCACHE/applications/cluster.test.client/src/main/java/org/exoplatform/services/jcr/cluster/JCRWebdavConnection.java
===================================================================
--- jcr/branches/1.12.0-JBCCACHE/applications/cluster.test.client/src/main/java/org/exoplatform/services/jcr/cluster/JCRWebdavConnection.java 2010-01-04 14:19:33 UTC (rev 1278)
+++ jcr/branches/1.12.0-JBCCACHE/applications/cluster.test.client/src/main/java/org/exoplatform/services/jcr/cluster/JCRWebdavConnection.java 2010-01-04 16:00:57 UTC (rev 1279)
@@ -16,19 +16,18 @@
*/
package org.exoplatform.services.jcr.cluster;
-import java.io.IOException;
-
-import javax.ws.rs.core.HttpHeaders;
-
import org.exoplatform.common.http.client.CookieModule;
import org.exoplatform.common.http.client.HTTPConnection;
import org.exoplatform.common.http.client.HTTPResponse;
-import org.exoplatform.common.http.client.HttpHeaderElement;
import org.exoplatform.common.http.client.HttpOutputStream;
import org.exoplatform.common.http.client.ModuleException;
import org.exoplatform.common.http.client.NVPair;
import org.exoplatform.services.rest.ExtHttpHeaders;
+import java.io.IOException;
+
+import javax.ws.rs.core.HttpHeaders;
+
/**
* Created by The eXo Platform SAS.
*
@@ -52,7 +51,7 @@
super(host, port);
CookieModule.setCookiePolicyHandler(null);
-
+
this.user = user;
this.pass = password;
this.realm = realm;
@@ -60,7 +59,7 @@
addBasicAuthorization(this.realm, this.user, this.pass);
}
-
+
public HTTPResponse addNode(String name, byte[] data) throws IOException, ModuleException
{
HTTPResponse response = Put(workspacePath + name, data);
@@ -84,7 +83,7 @@
{
HTTPResponse response = Delete(workspacePath + name);
response.getStatusCode();
-
+
return response;
}
@@ -92,7 +91,7 @@
{
Get(workspacePath + name).getStatusCode();
}*/
-
+
public HTTPResponse getNode(String name) throws IOException, ModuleException
{
HTTPResponse response = Get(workspacePath + name);
@@ -100,7 +99,6 @@
return response;
}
-
public HTTPResponse addProperty(String nodeName, String property) throws IOException, ModuleException
{
String xmlBody =
@@ -113,7 +111,7 @@
HTTPResponse response = ExtensionMethod("PROPPATCH", workspacePath + nodeName, xmlBody.getBytes(), headers);
response.getStatusCode();
-
+
return response;
}
@@ -132,14 +130,12 @@
return response;
}
-
+
public HTTPResponse getProperty(String nodeName, String property) throws IOException, ModuleException
{
String xmlBody =
- "<?xml version='1.0' encoding='utf-8' ?>"
- + "<D:propfind xmlns:D='DAV:' >"
- + "<D:prop><" + property + "/></D:prop>"
- + "</D:propfind>";
+ "<?xml version='1.0' encoding='utf-8' ?>" + "<D:propfind xmlns:D='DAV:' >" + "<D:prop><" + property
+ + "/></D:prop>" + "</D:propfind>";
NVPair[] headers = new NVPair[2];
headers[0] = new NVPair(HttpHeaders.CONTENT_TYPE, "text/xml; charset='utf-8'");
@@ -147,7 +143,7 @@
HTTPResponse response = ExtensionMethod("PROPFIND", workspacePath + nodeName, xmlBody.getBytes(), headers);
response.getStatusCode();
-
+
return response;
}
@@ -164,7 +160,7 @@
HTTPResponse response = ExtensionMethod("PROPPATCH", workspacePath + nodeName, xmlBody.getBytes(), headers);
response.getStatusCode();
-
+
return response;
}
@@ -236,7 +232,7 @@
{
MkCol(workspacePath + path).getStatusCode();
}
-
+
public HTTPResponse restore(String node, String version) throws IOException, ModuleException
{
NVPair[] query = new NVPair[1];
@@ -244,20 +240,71 @@
HTTPResponse response = Get(workspacePath + node, query);
response.getStatusCode();
-
+
return response;
}
-
+
public HTTPResponse moveNode(String path, String destination) throws IOException, ModuleException
{
NVPair[] headers = new NVPair[2];
- headers[0] = new NVPair(ExtHttpHeaders.DESTINATION, this.getProtocol() + "://" + this.getHost() + ":" + this.getPort() + workspacePath + destination);
+ headers[0] =
+ new NVPair(ExtHttpHeaders.DESTINATION, this.getProtocol() + "://" + this.getHost() + ":" + this.getPort()
+ + workspacePath + destination);
headers[1] = new NVPair(HttpHeaders.CONTENT_LENGTH, Integer.toString("".length()));
HTTPResponse response = ExtensionMethod("MOVE", workspacePath + path, "".getBytes(), headers);
response.getStatusCode();
-
+
return response;
}
+ /**
+ * Performs XPath query on workspace and returns plain HTTPResponse. It should be returned with status 207
+ * and must contain the XML with node collection.
+ *
+ * @param query
+ * @return
+ * @throws IOException
+ * @throws ModuleException
+ */
+ public HTTPResponse xpathQuery(String query) throws IOException, ModuleException
+ {
+ String xmlBody =
+ "<?xml version='1.0' encoding='utf-8' ?><D:searchrequest xmlns:D='DAV:'>" + "<D:xpath>" + query + "</D:xpath>"
+ + "</D:searchrequest>";
+
+ NVPair[] headers = new NVPair[2];
+ headers[0] = new NVPair(HttpHeaders.CONTENT_TYPE, "text/xml; charset='utf-8'");
+ headers[1] = new NVPair(HttpHeaders.CONTENT_LENGTH, Integer.toString(xmlBody.length()));
+
+ HTTPResponse response = ExtensionMethod("SEARCH", workspacePath, xmlBody.getBytes(), headers);
+ response.getStatusCode();
+
+ return response;
+ }
+
+ /**
+ * Performs SQL query on workspace and returns plain HTTPResponse. It should be returned with status 207
+ * and must contain the XML with node collection.
+ * @param query
+ * @return
+ * @throws IOException
+ * @throws ModuleException
+ */
+ public HTTPResponse sqlQuery(String query) throws IOException, ModuleException
+ {
+ String xmlBody =
+ "<?xml version='1.0' encoding='utf-8' ?><D:searchrequest xmlns:D='DAV:'>" + "<D:sql>" + query + "</D:sql>"
+ + "</D:searchrequest>";
+
+ NVPair[] headers = new NVPair[2];
+ headers[0] = new NVPair(HttpHeaders.CONTENT_TYPE, "text/xml; charset='utf-8'");
+ headers[1] = new NVPair(HttpHeaders.CONTENT_LENGTH, Integer.toString(xmlBody.length()));
+
+ HTTPResponse response = ExtensionMethod("SEARCH", workspacePath, xmlBody.getBytes(), headers);
+ response.getStatusCode();
+
+ return response;
+ }
+
}
\ No newline at end of file
16 years, 4 months
exo-jcr SVN: r1278 - jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster.
by do-not-reply@jboss.org
Author: skabashnyuk
Date: 2010-01-04 09:19:33 -0500 (Mon, 04 Jan 2010)
New Revision: 1278
Modified:
jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/test-jbosscache-config-ws.xml
jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/test-jbosscache-config-ws1.xml
jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/test-jbosscache-config-ws2.xml
jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/test-jbosscache-config-ws3.xml
jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/test-jbosscache-config-wstck.xml
jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/test-jbosscache-config-wstck1.xml
jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/test-jbosscache-config-wstck2.xml
Log:
EXOJCR-361 : Now fetchInMemoryState="true" for tests
Modified: jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/test-jbosscache-config-ws.xml
===================================================================
--- jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/test-jbosscache-config-ws.xml 2010-01-04 13:42:24 UTC (rev 1277)
+++ jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/test-jbosscache-config-ws.xml 2010-01-04 14:19:33 UTC (rev 1278)
@@ -9,7 +9,7 @@
Fetch in memory state is enable, because second cluster-node
currently doesn't work properly on clear cache
-->
- <stateRetrieval timeout="20000" fetchInMemoryState="false" nonBlocking="true"/>
+ <stateRetrieval timeout="20000" fetchInMemoryState="true" nonBlocking="true"/>
<!--
This JGroups configuration is taken from JBC branch, but
"enable_bundling" is set to false, because of notice, that appeared
Modified: jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/test-jbosscache-config-ws1.xml
===================================================================
--- jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/test-jbosscache-config-ws1.xml 2010-01-04 13:42:24 UTC (rev 1277)
+++ jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/test-jbosscache-config-ws1.xml 2010-01-04 14:19:33 UTC (rev 1278)
@@ -9,7 +9,7 @@
Fetch in memory state is enable, because second cluster-node
currently doesn't work properly on clear cache
-->
- <stateRetrieval timeout="20000" fetchInMemoryState="false" nonBlocking="true"/>
+ <stateRetrieval timeout="20000" fetchInMemoryState="true" nonBlocking="true"/>
<!--
This JGroups configuration is taken from JBC branch, but
"enable_bundling" is set to false, because of notice, that appeared
Modified: jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/test-jbosscache-config-ws2.xml
===================================================================
--- jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/test-jbosscache-config-ws2.xml 2010-01-04 13:42:24 UTC (rev 1277)
+++ jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/test-jbosscache-config-ws2.xml 2010-01-04 14:19:33 UTC (rev 1278)
@@ -9,7 +9,7 @@
Fetch in memory state is enable, because second cluster-node
currently doesn't work properly on clear cache
-->
- <stateRetrieval timeout="20000" fetchInMemoryState="false" nonBlocking="true"/>
+ <stateRetrieval timeout="20000" fetchInMemoryState="true" nonBlocking="true"/>
<!--
This JGroups configuration is taken from JBC branch, but
"enable_bundling" is set to false, because of notice, that appeared
Modified: jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/test-jbosscache-config-ws3.xml
===================================================================
--- jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/test-jbosscache-config-ws3.xml 2010-01-04 13:42:24 UTC (rev 1277)
+++ jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/test-jbosscache-config-ws3.xml 2010-01-04 14:19:33 UTC (rev 1278)
@@ -9,7 +9,7 @@
Fetch in memory state is enable, because second cluster-node
currently doesn't work properly on clear cache
-->
- <stateRetrieval timeout="20000" fetchInMemoryState="false" nonBlocking="true"/>
+ <stateRetrieval timeout="20000" fetchInMemoryState="true" nonBlocking="true"/>
<!--
This JGroups configuration is taken from JBC branch, but
"enable_bundling" is set to false, because of notice, that appeared
Modified: jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/test-jbosscache-config-wstck.xml
===================================================================
--- jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/test-jbosscache-config-wstck.xml 2010-01-04 13:42:24 UTC (rev 1277)
+++ jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/test-jbosscache-config-wstck.xml 2010-01-04 14:19:33 UTC (rev 1278)
@@ -9,7 +9,7 @@
Fetch in memory state is enable, because second cluster-node
currently doesn't work properly on clear cache
-->
- <stateRetrieval timeout="20000" fetchInMemoryState="false" nonBlocking="true"/>
+ <stateRetrieval timeout="20000" fetchInMemoryState="true" nonBlocking="true"/>
<!--
This JGroups configuration is taken from JBC branch, but
"enable_bundling" is set to false, because of notice, that appeared
Modified: jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/test-jbosscache-config-wstck1.xml
===================================================================
--- jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/test-jbosscache-config-wstck1.xml 2010-01-04 13:42:24 UTC (rev 1277)
+++ jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/test-jbosscache-config-wstck1.xml 2010-01-04 14:19:33 UTC (rev 1278)
@@ -9,7 +9,7 @@
Fetch in memory state is enable, because second cluster-node
currently doesn't work properly on clear cache
-->
- <stateRetrieval timeout="20000" fetchInMemoryState="false" nonBlocking="true"/>
+ <stateRetrieval timeout="20000" fetchInMemoryState="true" nonBlocking="true"/>
<!--
This JGroups configuration is taken from JBC branch, but
"enable_bundling" is set to false, because of notice, that appeared
Modified: jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/test-jbosscache-config-wstck2.xml
===================================================================
--- jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/test-jbosscache-config-wstck2.xml 2010-01-04 13:42:24 UTC (rev 1277)
+++ jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/test-jbosscache-config-wstck2.xml 2010-01-04 14:19:33 UTC (rev 1278)
@@ -9,7 +9,7 @@
Fetch in memory state is enable, because second cluster-node
currently doesn't work properly on clear cache
-->
- <stateRetrieval timeout="20000" fetchInMemoryState="false" nonBlocking="true"/>
+ <stateRetrieval timeout="20000" fetchInMemoryState="true" nonBlocking="true"/>
<!--
This JGroups configuration is taken from JBC branch, but
"enable_bundling" is set to false, because of notice, that appeared
16 years, 4 months
exo-jcr SVN: r1277 - jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster.
by do-not-reply@jboss.org
Author: skabashnyuk
Date: 2010-01-04 08:42:24 -0500 (Mon, 04 Jan 2010)
New Revision: 1277
Modified:
jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/test-jbosscache-config-ws.xml
jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/test-jbosscache-config-ws1.xml
jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/test-jbosscache-config-ws2.xml
jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/test-jbosscache-config-ws3.xml
jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/test-jbosscache-config-wstck.xml
jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/test-jbosscache-config-wstck1.xml
jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/test-jbosscache-config-wstck2.xml
Log:
EXOJCR-361 : Now fetchInMemoryState="false"
Modified: jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/test-jbosscache-config-ws.xml
===================================================================
--- jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/test-jbosscache-config-ws.xml 2010-01-04 13:20:35 UTC (rev 1276)
+++ jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/test-jbosscache-config-ws.xml 2010-01-04 13:42:24 UTC (rev 1277)
@@ -9,7 +9,7 @@
Fetch in memory state is enable, because second cluster-node
currently doesn't work properly on clear cache
-->
- <stateRetrieval timeout="20000" fetchInMemoryState="true" nonBlocking="true"/>
+ <stateRetrieval timeout="20000" fetchInMemoryState="false" nonBlocking="true"/>
<!--
This JGroups configuration is taken from JBC branch, but
"enable_bundling" is set to false, because of notice, that appeared
Modified: jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/test-jbosscache-config-ws1.xml
===================================================================
--- jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/test-jbosscache-config-ws1.xml 2010-01-04 13:20:35 UTC (rev 1276)
+++ jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/test-jbosscache-config-ws1.xml 2010-01-04 13:42:24 UTC (rev 1277)
@@ -9,7 +9,7 @@
Fetch in memory state is enable, because second cluster-node
currently doesn't work properly on clear cache
-->
- <stateRetrieval timeout="20000" fetchInMemoryState="true" nonBlocking="true"/>
+ <stateRetrieval timeout="20000" fetchInMemoryState="false" nonBlocking="true"/>
<!--
This JGroups configuration is taken from JBC branch, but
"enable_bundling" is set to false, because of notice, that appeared
Modified: jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/test-jbosscache-config-ws2.xml
===================================================================
--- jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/test-jbosscache-config-ws2.xml 2010-01-04 13:20:35 UTC (rev 1276)
+++ jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/test-jbosscache-config-ws2.xml 2010-01-04 13:42:24 UTC (rev 1277)
@@ -9,7 +9,7 @@
Fetch in memory state is enable, because second cluster-node
currently doesn't work properly on clear cache
-->
- <stateRetrieval timeout="20000" fetchInMemoryState="true" nonBlocking="true"/>
+ <stateRetrieval timeout="20000" fetchInMemoryState="false" nonBlocking="true"/>
<!--
This JGroups configuration is taken from JBC branch, but
"enable_bundling" is set to false, because of notice, that appeared
Modified: jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/test-jbosscache-config-ws3.xml
===================================================================
--- jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/test-jbosscache-config-ws3.xml 2010-01-04 13:20:35 UTC (rev 1276)
+++ jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/test-jbosscache-config-ws3.xml 2010-01-04 13:42:24 UTC (rev 1277)
@@ -9,7 +9,7 @@
Fetch in memory state is enable, because second cluster-node
currently doesn't work properly on clear cache
-->
- <stateRetrieval timeout="20000" fetchInMemoryState="true" nonBlocking="true"/>
+ <stateRetrieval timeout="20000" fetchInMemoryState="false" nonBlocking="true"/>
<!--
This JGroups configuration is taken from JBC branch, but
"enable_bundling" is set to false, because of notice, that appeared
Modified: jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/test-jbosscache-config-wstck.xml
===================================================================
--- jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/test-jbosscache-config-wstck.xml 2010-01-04 13:20:35 UTC (rev 1276)
+++ jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/test-jbosscache-config-wstck.xml 2010-01-04 13:42:24 UTC (rev 1277)
@@ -9,7 +9,7 @@
Fetch in memory state is enable, because second cluster-node
currently doesn't work properly on clear cache
-->
- <stateRetrieval timeout="20000" fetchInMemoryState="true" nonBlocking="true"/>
+ <stateRetrieval timeout="20000" fetchInMemoryState="false" nonBlocking="true"/>
<!--
This JGroups configuration is taken from JBC branch, but
"enable_bundling" is set to false, because of notice, that appeared
Modified: jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/test-jbosscache-config-wstck1.xml
===================================================================
--- jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/test-jbosscache-config-wstck1.xml 2010-01-04 13:20:35 UTC (rev 1276)
+++ jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/test-jbosscache-config-wstck1.xml 2010-01-04 13:42:24 UTC (rev 1277)
@@ -9,7 +9,7 @@
Fetch in memory state is enable, because second cluster-node
currently doesn't work properly on clear cache
-->
- <stateRetrieval timeout="20000" fetchInMemoryState="true" nonBlocking="true"/>
+ <stateRetrieval timeout="20000" fetchInMemoryState="false" nonBlocking="true"/>
<!--
This JGroups configuration is taken from JBC branch, but
"enable_bundling" is set to false, because of notice, that appeared
Modified: jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/test-jbosscache-config-wstck2.xml
===================================================================
--- jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/test-jbosscache-config-wstck2.xml 2010-01-04 13:20:35 UTC (rev 1276)
+++ jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/test-jbosscache-config-wstck2.xml 2010-01-04 13:42:24 UTC (rev 1277)
@@ -9,7 +9,7 @@
Fetch in memory state is enable, because second cluster-node
currently doesn't work properly on clear cache
-->
- <stateRetrieval timeout="20000" fetchInMemoryState="true" nonBlocking="true"/>
+ <stateRetrieval timeout="20000" fetchInMemoryState="false" nonBlocking="true"/>
<!--
This JGroups configuration is taken from JBC branch, but
"enable_bundling" is set to false, because of notice, that appeared
16 years, 4 months
exo-jcr SVN: r1276 - jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc.
by do-not-reply@jboss.org
Author: tolusha
Date: 2010-01-04 08:20:35 -0500 (Mon, 04 Jan 2010)
New Revision: 1276
Modified:
jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCStorageConnection.java
Log:
EXOJCR-363: get stream form tempFile if exists
Modified: jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCStorageConnection.java
===================================================================
--- jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCStorageConnection.java 2010-01-04 12:51:33 UTC (rev 1275)
+++ jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCStorageConnection.java 2010-01-04 13:20:35 UTC (rev 1276)
@@ -49,6 +49,7 @@
import java.io.ByteArrayInputStream;
import java.io.File;
+import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
@@ -1926,13 +1927,22 @@
else
{
// it's StreamPersistedValueData
+ File file;
StreamPersistedValueData streamData = (StreamPersistedValueData)vd;
- stream = streamData.getStream();
- // TODO spool on JDBC driver read - multiplexing the data to two stores, database and spool file, with one read.
- SwapFile swapFile = swapValueData(cid, i, data.getPersistedVersion(), stream);
+ if ((file = streamData.getTempFile()) != null)
+ {
+ stream = new FileInputStream(streamData.getTempFile());
+ }
+ else
+ {
+ stream = streamData.getStream();
- long vlen = swapFile.length();
+ // TODO spool on JDBC driver read - multiplexing the data to two stores, database and spool file, with one read.
+ file = swapValueData(cid, i, data.getPersistedVersion(), stream);
+ }
+
+ long vlen = file.length();
if (vlen < 0)
{
// TODO not actual with SwapFile, but if it will be reworked can be so
@@ -1951,7 +1961,7 @@
}
// set persistent file to ValueData, will be available for saving Property.
- streamData.setPersistedFile(swapFile);
+ streamData.setPersistedFile(file);
stream = streamData.getAsStream();
}
storageId = null;
16 years, 4 months
exo-jcr SVN: r1275 - jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation.
by do-not-reply@jboss.org
Author: sergiykarpenko
Date: 2010-01-04 07:51:33 -0500 (Mon, 04 Jan 2010)
New Revision: 1275
Modified:
jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/CQJDBCStorageConnection.java
Log:
EXOJCR-302: code cleanup
Modified: jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/CQJDBCStorageConnection.java
===================================================================
--- jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/CQJDBCStorageConnection.java 2010-01-04 12:49:51 UTC (rev 1274)
+++ jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/CQJDBCStorageConnection.java 2010-01-04 12:51:33 UTC (rev 1275)
@@ -209,24 +209,6 @@
}
}
- /**
- * {@inheritDoc}
- */
- public List<PropertyData> listChildPropertiesData(NodeData parent) throws RepositoryException, IllegalStateException
- {
- // nothing to optimize
- return super.listChildPropertiesData(parent);
- }
-
- /**
- * {@inheritDoc}
- */
- public List<PropertyData> getReferencesData(String nodeIdentifier) throws RepositoryException, IllegalStateException
- {
- // can't optimize - result may return same node more than one time, so parse result set is difficult
- return super.getReferencesData(nodeIdentifier);
- }
-
protected List<AccessControlEntry> readACLPermisions(String cid, Map<String, List<byte[]>> properties)
throws SQLException, IllegalACLException
{
@@ -256,7 +238,7 @@
throw new IllegalACLException("Property exo:owner is not found for node with id: " + getIdentifier(cid));
}
-
+
/**
* {@inheritDoc}
*/
@@ -278,7 +260,7 @@
}
return loadNodeRecord(parentPath, cname, cid, cpid, cindex, cversion, cnordernumb, properties, parentACL);
- }
+ }
/**
* Create NodeData from TempNodeData content.
@@ -445,7 +427,7 @@
throw new RepositoryException(e);
}
}
-
+
/**
* Load property record from result set. Result set must be ordered by property id.
* In other way there may be mistaces.
@@ -662,6 +644,6 @@
protected abstract ResultSet findChildNodesByParentIdentifierCQ(String parentIdentifier) throws SQLException;
protected abstract ResultSet findChildPropertiesByParentIdentifierCQ(String parentIdentifier) throws SQLException;
-
+
protected abstract ResultSet findNodeMainPropertiesByParentIdentifierCQ(String parentIdentifier) throws SQLException;
}
16 years, 4 months