exo-jcr SVN: r994 - jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/value/fs/operations.
by do-not-reply@jboss.org
Author: tolusha
Date: 2009-12-10 12:08:09 -0500 (Thu, 10 Dec 2009)
New Revision: 994
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
Log:
EXOJCR-300: fix ClassCastException
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 2009-12-10 16:39:00 UTC (rev 993)
+++ jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/value/fs/operations/ValueFileIOHelper.java 2009-12-10 17:08:09 UTC (rev 994)
@@ -131,7 +131,7 @@
}
else
{
- // transient Value
+ // stream Value
File tempFile;
if ((tempFile = ((StreamPersistedValueData)value).getTempFile()) != null)
{
@@ -152,7 +152,7 @@
else
{
// not spooled, use InputStream
- copyClose(value.getAsStream(), new FileOutputStream(file));
+ copyClose(((StreamPersistedValueData)value).getStream(), new FileOutputStream(file));
}
// map this transient Value to file in VS
((StreamPersistedValueData)value).setPersistedFile(file);
16 years, 7 months
exo-jcr SVN: r993 - jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/value/fs/operations.
by do-not-reply@jboss.org
Author: tolusha
Date: 2009-12-10 11:39:00 -0500 (Thu, 10 Dec 2009)
New Revision: 993
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
Log:
EXOJCR-300: fix ClassCastException in ValueFileIOHelper
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 2009-12-10 16:29:10 UTC (rev 992)
+++ jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/value/fs/operations/ValueFileIOHelper.java 2009-12-10 16:39:00 UTC (rev 993)
@@ -117,9 +117,7 @@
*/
protected void writeValue(File file, ValueData value) throws IOException
{
- StreamPersistedValueData streamValue = (StreamPersistedValueData)value;
-
- if (streamValue.isByteArray())
+ if (value.isByteArray())
{
OutputStream out = new FileOutputStream(file);
try
@@ -135,7 +133,7 @@
{
// transient Value
File tempFile;
- if ((tempFile = streamValue.getTempFile()) != null)
+ if ((tempFile = ((StreamPersistedValueData)value).getTempFile()) != null)
{
// it's spooled Value, try move its file to VS
if (!tempFile.renameTo(file))
@@ -154,10 +152,10 @@
else
{
// not spooled, use InputStream
- copyClose(streamValue.getAsStream(), new FileOutputStream(file));
+ copyClose(value.getAsStream(), new FileOutputStream(file));
}
// map this transient Value to file in VS
- streamValue.setPersistedFile(file);
+ ((StreamPersistedValueData)value).setPersistedFile(file);
}
}
16 years, 7 months
exo-jcr SVN: r992 - jcr/branches/1.12.0-JBC/component/core/src/main/resources/conf/portal.
by do-not-reply@jboss.org
Author: areshetnyak
Date: 2009-12-10 11:29:10 -0500 (Thu, 10 Dec 2009)
New Revision: 992
Modified:
jcr/branches/1.12.0-JBC/component/core/src/main/resources/conf/portal/jbosscache-configuration_repository_backup.xml
jcr/branches/1.12.0-JBC/component/core/src/main/resources/conf/portal/jbosscache-configuration_repository_digital-assets.xml
jcr/branches/1.12.0-JBC/component/core/src/main/resources/conf/portal/jbosscache-configuration_repository_production.xml
Log:
EXOJCR-286 : The confifuration to JBossCache in conf/portal was changed.
Modified: jcr/branches/1.12.0-JBC/component/core/src/main/resources/conf/portal/jbosscache-configuration_repository_backup.xml
===================================================================
--- jcr/branches/1.12.0-JBC/component/core/src/main/resources/conf/portal/jbosscache-configuration_repository_backup.xml 2009-12-10 16:24:35 UTC (rev 991)
+++ jcr/branches/1.12.0-JBC/component/core/src/main/resources/conf/portal/jbosscache-configuration_repository_backup.xml 2009-12-10 16:29:10 UTC (rev 992)
@@ -63,6 +63,15 @@
</loaders>
+ <locking
+ isolationLevel="REPEATABLE_READ"
+ lockParentForChildInsertRemove="false"
+ lockAcquisitionTimeout="10000"
+ nodeLockingScheme="mvcc"
+ writeSkewCheck="false"
+ useLockStriping="false"
+ concurrencyLevel="10000" />
+
<!-- Enable batching -->
<invocationBatching enabled="true"/>
</jbosscache>
Modified: jcr/branches/1.12.0-JBC/component/core/src/main/resources/conf/portal/jbosscache-configuration_repository_digital-assets.xml
===================================================================
--- jcr/branches/1.12.0-JBC/component/core/src/main/resources/conf/portal/jbosscache-configuration_repository_digital-assets.xml 2009-12-10 16:24:35 UTC (rev 991)
+++ jcr/branches/1.12.0-JBC/component/core/src/main/resources/conf/portal/jbosscache-configuration_repository_digital-assets.xml 2009-12-10 16:29:10 UTC (rev 992)
@@ -63,6 +63,15 @@
</loaders>
+ <locking
+ isolationLevel="REPEATABLE_READ"
+ lockParentForChildInsertRemove="false"
+ lockAcquisitionTimeout="10000"
+ nodeLockingScheme="mvcc"
+ writeSkewCheck="false"
+ useLockStriping="false"
+ concurrencyLevel="10000" />
+
<!-- Enable batching -->
<invocationBatching enabled="true"/>
</jbosscache>
Modified: jcr/branches/1.12.0-JBC/component/core/src/main/resources/conf/portal/jbosscache-configuration_repository_production.xml
===================================================================
--- jcr/branches/1.12.0-JBC/component/core/src/main/resources/conf/portal/jbosscache-configuration_repository_production.xml 2009-12-10 16:24:35 UTC (rev 991)
+++ jcr/branches/1.12.0-JBC/component/core/src/main/resources/conf/portal/jbosscache-configuration_repository_production.xml 2009-12-10 16:29:10 UTC (rev 992)
@@ -63,6 +63,15 @@
</loaders>
+ <locking
+ isolationLevel="REPEATABLE_READ"
+ lockParentForChildInsertRemove="false"
+ lockAcquisitionTimeout="10000"
+ nodeLockingScheme="mvcc"
+ writeSkewCheck="false"
+ useLockStriping="false"
+ concurrencyLevel="10000" />
+
<!-- Enable batching -->
<invocationBatching enabled="true"/>
</jbosscache>
16 years, 7 months
exo-jcr SVN: r991 - in jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl: core/value and 1 other directories.
by do-not-reply@jboss.org
Author: tolusha
Date: 2009-12-10 11:24:35 -0500 (Thu, 10 Dec 2009)
New Revision: 991
Modified:
jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/NodeImpl.java
jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/value/ValueConstraintsMatcher.java
jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/session/SessionChangesLog.java
Log:
EXOJCR-300: fix ClassCastException
Modified: jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/NodeImpl.java
===================================================================
--- jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/NodeImpl.java 2009-12-10 16:23:39 UTC (rev 990)
+++ jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/NodeImpl.java 2009-12-10 16:24:35 UTC (rev 991)
@@ -577,9 +577,8 @@
newMixin.add(type.getName());
values.add(new TransientValueData(type.getName()));
- TransientPropertyData prop =
- (TransientPropertyData)dataManager.getItemData(((NodeData)getData()), new QPathEntry(Constants.JCR_MIXINTYPES,
- 0));
+ PropertyData prop =
+ (PropertyData)dataManager.getItemData(((NodeData)getData()), new QPathEntry(Constants.JCR_MIXINTYPES, 0));
ItemState state;
if (prop != null)
@@ -1655,8 +1654,8 @@
session.getActionHandler().preRemoveMixin(this, name);
- TransientPropertyData propData =
- (TransientPropertyData)dataManager.getItemData(nodeData(), new QPathEntry(Constants.JCR_MIXINTYPES, 0));
+ PropertyData propData =
+ (PropertyData)dataManager.getItemData(nodeData(), new QPathEntry(Constants.JCR_MIXINTYPES, 0));
// create new property data with new values
TransientPropertyData prop =
@@ -2918,8 +2917,8 @@
permValues.add(vd);
}
- TransientPropertyData permProp =
- (TransientPropertyData)dataManager.getItemData(nodeData(), new QPathEntry(Constants.EXO_PERMISSIONS, 0));
+ PropertyData permProp =
+ (PropertyData)dataManager.getItemData(nodeData(), new QPathEntry(Constants.EXO_PERMISSIONS, 0));
permProp =
new TransientPropertyData(permProp.getQPath(), permProp.getIdentifier(), permProp.getPersistedVersion(),
Modified: jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/value/ValueConstraintsMatcher.java
===================================================================
--- jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/value/ValueConstraintsMatcher.java 2009-12-10 16:23:39 UTC (rev 990)
+++ jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/value/ValueConstraintsMatcher.java 2009-12-10 16:24:35 UTC (rev 991)
@@ -85,7 +85,7 @@
boolean invalid = true;
// do not use getString because of string consuming
- TransientValueData valueData = (TransientValueData)value;
+ ValueData valueData = (ValueData)value;
if (type == PropertyType.STRING)
{
try
Modified: jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/session/SessionChangesLog.java
===================================================================
--- jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/session/SessionChangesLog.java 2009-12-10 16:23:39 UTC (rev 990)
+++ jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/session/SessionChangesLog.java 2009-12-10 16:24:35 UTC (rev 991)
@@ -406,7 +406,7 @@
for (int i = 0; i < items.size(); i++)
{
- TransientItemData item = (TransientItemData)items.get(i).getData();
+ ItemData item = items.get(i).getData();
if (item.getIdentifier().equals(rootData.getIdentifier()))
{
// the node
16 years, 7 months
exo-jcr SVN: r990 - jcr/branches/1.12.0-JBC/component/core/src/main/resources/conf/portal.
by do-not-reply@jboss.org
Author: areshetnyak
Date: 2009-12-10 11:23:39 -0500 (Thu, 10 Dec 2009)
New Revision: 990
Modified:
jcr/branches/1.12.0-JBC/component/core/src/main/resources/conf/portal/jbosscache-configuration_repository_backup.xml
jcr/branches/1.12.0-JBC/component/core/src/main/resources/conf/portal/jbosscache-configuration_repository_digital-assets.xml
jcr/branches/1.12.0-JBC/component/core/src/main/resources/conf/portal/jbosscache-configuration_repository_production.xml
Log:
EXOJCR-286 : The confifuration to JBossCache in conf/portal was changed.
Modified: jcr/branches/1.12.0-JBC/component/core/src/main/resources/conf/portal/jbosscache-configuration_repository_backup.xml
===================================================================
--- jcr/branches/1.12.0-JBC/component/core/src/main/resources/conf/portal/jbosscache-configuration_repository_backup.xml 2009-12-10 16:23:38 UTC (rev 989)
+++ jcr/branches/1.12.0-JBC/component/core/src/main/resources/conf/portal/jbosscache-configuration_repository_backup.xml 2009-12-10 16:23:39 UTC (rev 990)
@@ -7,6 +7,7 @@
transactionManagerLookupClass="org.jboss.cache.transaction.GenericTransactionManagerLookup" />
<clustering mode="replication" clusterName="JBoss-Cache-Cluster_repository_backup">
+ <stateRetrieval timeout="20000" fetchInMemoryState="false" />
<jgroupsConfig>
<!--UDP discard_incompatible_packets="true" enable_bundling="false" enable_diagnostics="false" ip_ttl="2"
@@ -55,7 +56,7 @@
<loaders passivation="false" shared="false">
<loader class="org.exoplatform.services.jcr.impl.storage.jbosscache.JDBCCacheLoader"
- async="false" fetchPersistentState="true" ignoreModifications="false" purgeOnStartup="false">
+ async="false" fetchPersistentState="false" ignoreModifications="false" purgeOnStartup="false">
<properties>
</properties>
</loader>
Modified: jcr/branches/1.12.0-JBC/component/core/src/main/resources/conf/portal/jbosscache-configuration_repository_digital-assets.xml
===================================================================
--- jcr/branches/1.12.0-JBC/component/core/src/main/resources/conf/portal/jbosscache-configuration_repository_digital-assets.xml 2009-12-10 16:23:38 UTC (rev 989)
+++ jcr/branches/1.12.0-JBC/component/core/src/main/resources/conf/portal/jbosscache-configuration_repository_digital-assets.xml 2009-12-10 16:23:39 UTC (rev 990)
@@ -7,6 +7,7 @@
transactionManagerLookupClass="org.jboss.cache.transaction.GenericTransactionManagerLookup" />
<clustering mode="replication" clusterName="JBoss-Cache-Cluster_repository_digital-assets">
+ <stateRetrieval timeout="20000" fetchInMemoryState="false" />
<jgroupsConfig>
<!--UDP discard_incompatible_packets="true" enable_bundling="false" enable_diagnostics="false" ip_ttl="2"
@@ -55,7 +56,7 @@
<loaders passivation="false" shared="false">
<loader class="org.exoplatform.services.jcr.impl.storage.jbosscache.JDBCCacheLoader"
- async="false" fetchPersistentState="true" ignoreModifications="false" purgeOnStartup="false">
+ async="false" fetchPersistentState="false" ignoreModifications="false" purgeOnStartup="false">
<properties>
</properties>
</loader>
Modified: jcr/branches/1.12.0-JBC/component/core/src/main/resources/conf/portal/jbosscache-configuration_repository_production.xml
===================================================================
--- jcr/branches/1.12.0-JBC/component/core/src/main/resources/conf/portal/jbosscache-configuration_repository_production.xml 2009-12-10 16:23:38 UTC (rev 989)
+++ jcr/branches/1.12.0-JBC/component/core/src/main/resources/conf/portal/jbosscache-configuration_repository_production.xml 2009-12-10 16:23:39 UTC (rev 990)
@@ -7,6 +7,7 @@
transactionManagerLookupClass="org.jboss.cache.transaction.GenericTransactionManagerLookup" />
<clustering mode="replication" clusterName="JBoss-Cache-Cluster_repository_production">
+ <stateRetrieval timeout="20000" fetchInMemoryState="false" />
<jgroupsConfig>
<!--UDP discard_incompatible_packets="true" enable_bundling="false" enable_diagnostics="false" ip_ttl="2"
@@ -55,7 +56,7 @@
<loaders passivation="false" shared="false">
<loader class="org.exoplatform.services.jcr.impl.storage.jbosscache.JDBCCacheLoader"
- async="false" fetchPersistentState="true" ignoreModifications="false" purgeOnStartup="false">
+ async="false" fetchPersistentState="false" ignoreModifications="false" purgeOnStartup="false">
<properties>
</properties>
</loader>
16 years, 7 months
exo-jcr SVN: r989 - in jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr: impl/core and 2 other directories.
by do-not-reply@jboss.org
Author: pnedonosko
Date: 2009-12-10 11:23:38 -0500 (Thu, 10 Dec 2009)
New Revision: 989
Modified:
jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/dataflow/persistent/PersistedItemData.java
jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/dataflow/persistent/PersistedNodeData.java
jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/dataflow/persistent/PersistedPropertyData.java
jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/PropertyImpl.java
jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/AbstractValueData.java
jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/EditableValueData.java
jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/PersistedValueData.java
jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/TransientValueData.java
jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/ByteArrayPersistedValueData.java
jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/FileStreamPersistedValueData.java
jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/StreamPersistedValueData.java
Log:
EXOJCR-274 createTransientCopy deprecated; ValueData.equals right impl
Modified: jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/dataflow/persistent/PersistedItemData.java
===================================================================
--- jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/dataflow/persistent/PersistedItemData.java 2009-12-10 15:26:20 UTC (rev 988)
+++ jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/dataflow/persistent/PersistedItemData.java 2009-12-10 16:23:38 UTC (rev 989)
@@ -89,6 +89,7 @@
*
* @throws RepositoryException if ValueData IOException occurs.
*/
+ @Deprecated
public abstract TransientItemData createTransientCopy() throws RepositoryException;
/**
Modified: jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/dataflow/persistent/PersistedNodeData.java
===================================================================
--- jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/dataflow/persistent/PersistedNodeData.java 2009-12-10 15:26:20 UTC (rev 988)
+++ jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/dataflow/persistent/PersistedNodeData.java 2009-12-10 16:23:38 UTC (rev 989)
@@ -106,14 +106,18 @@
return true;
}
+ /**
+ * {@inheritDoc}
+ */
@Override
public TransientItemData createTransientCopy()
{
- TransientNodeData dataCopy =
- new TransientNodeData(getQPath(), getIdentifier(), getPersistedVersion(), getPrimaryTypeName(),
- getMixinTypeNames(), getOrderNumber(), getParentIdentifier() != null ? getParentIdentifier() : null,
- getACL());
-
- return dataCopy;
+// TransientNodeData dataCopy =
+// new TransientNodeData(getQPath(), getIdentifier(), getPersistedVersion(), getPrimaryTypeName(),
+// getMixinTypeNames(), getOrderNumber(), getParentIdentifier() != null ? getParentIdentifier() : null,
+// getACL());
+//
+// return dataCopy;
+ throw new IllegalStateException("createTransientCopy deprecated");
}
}
Modified: jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/dataflow/persistent/PersistedPropertyData.java
===================================================================
--- jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/dataflow/persistent/PersistedPropertyData.java 2009-12-10 15:26:20 UTC (rev 988)
+++ jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/dataflow/persistent/PersistedPropertyData.java 2009-12-10 16:23:38 UTC (rev 989)
@@ -98,19 +98,25 @@
visitor.visit(this);
}
+ /**
+ * {@inheritDoc}
+ */
@Override
+ @Deprecated
public TransientItemData createTransientCopy() throws RepositoryException
{
- List<ValueData> copyValues = new ArrayList<ValueData>();
- for (ValueData vdata : getValues())
- {
- copyValues.add(((PersistedValueData)vdata).createTransientCopy());
- }
-
- TransientPropertyData dataCopy =
- new TransientPropertyData(getQPath(), getIdentifier(), getPersistedVersion(), getType(),
- getParentIdentifier(), isMultiValued(), copyValues);
-
- return dataCopy;
+// List<ValueData> copyValues = new ArrayList<ValueData>();
+// for (ValueData vdata : getValues())
+// {
+// copyValues.add(((PersistedValueData)vdata).createTransientCopy());
+// }
+//
+// TransientPropertyData dataCopy =
+// new TransientPropertyData(getQPath(), getIdentifier(), getPersistedVersion(), getType(),
+// getParentIdentifier(), isMultiValued(), copyValues);
+//
+// return dataCopy;
+
+ throw new IllegalStateException("createTransientCopy deprecated");
}
}
Modified: jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/PropertyImpl.java
===================================================================
--- jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/PropertyImpl.java 2009-12-10 15:26:20 UTC (rev 988)
+++ jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/PropertyImpl.java 2009-12-10 16:23:38 UTC (rev 989)
@@ -550,7 +550,7 @@
Value[] values = new Value[propertyData.getValues().size()];
for (int i = 0; i < values.length; i++)
{
- values[i] = valueFactory.loadValue((ValueData)propertyData.getValues().get(i), propertyData.getType());
+ values[i] = valueFactory.loadValue(propertyData.getValues().get(i), propertyData.getType());
}
return values;
}
Modified: jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/AbstractValueData.java
===================================================================
--- jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/AbstractValueData.java 2009-12-10 15:26:20 UTC (rev 988)
+++ jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/AbstractValueData.java 2009-12-10 16:23:38 UTC (rev 989)
@@ -33,8 +33,6 @@
public abstract class AbstractValueData implements ValueData
{
- protected final static Log log = ExoLogger.getLogger("jcr.AbstractValueData");
-
protected int orderNumber;
protected AbstractValueData(int orderNumber)
Modified: jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/EditableValueData.java
===================================================================
--- jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/EditableValueData.java 2009-12-10 15:26:20 UTC (rev 988)
+++ jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/EditableValueData.java 2009-12-10 16:23:38 UTC (rev 989)
@@ -19,6 +19,8 @@
package org.exoplatform.services.jcr.impl.dataflow;
import org.exoplatform.services.jcr.impl.util.io.FileCleaner;
+import org.exoplatform.services.log.ExoLogger;
+import org.exoplatform.services.log.Log;
import java.io.ByteArrayInputStream;
import java.io.File;
@@ -37,6 +39,8 @@
public class EditableValueData extends TransientValueData
{
+ protected final static Log LOG = ExoLogger.getLogger("jcr.EditableValueData");
+
protected final int maxIOBuffSize;
public EditableValueData(byte[] bytes, int orderNumber, FileCleaner fileCleaner, int maxBufferSize,
@@ -408,12 +412,12 @@
{
if (fileCleaner != null)
{
- log.info("Could not remove file. Add to fileCleaner " + spoolFile);
+ LOG.info("Could not remove file. Add to fileCleaner " + spoolFile);
fileCleaner.addFile(spoolFile);
}
else
{
- log.warn("Could not remove temporary file on switch to bytes, fileCleaner not found. "
+ LOG.warn("Could not remove temporary file on switch to bytes, fileCleaner not found. "
+ spoolFile.getAbsolutePath());
}
}
Modified: jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/PersistedValueData.java
===================================================================
--- jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/PersistedValueData.java 2009-12-10 15:26:20 UTC (rev 988)
+++ jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/PersistedValueData.java 2009-12-10 16:23:38 UTC (rev 989)
@@ -19,6 +19,8 @@
package org.exoplatform.services.jcr.impl.dataflow;
import org.exoplatform.services.jcr.datamodel.ValueData;
+import org.exoplatform.services.log.ExoLogger;
+import org.exoplatform.services.log.Log;
import javax.jcr.RepositoryException;
@@ -29,6 +31,8 @@
public abstract class PersistedValueData implements ValueData
{
+ protected final static Log LOG = ExoLogger.getLogger("jcr.PersistedValueData");
+
protected int orderNumber;
protected PersistedValueData(int orderNumber)
@@ -50,5 +54,6 @@
* @return TransientValueData
* @throws RepositoryException if error ocurs
*/
+ @Deprecated
public abstract TransientValueData createTransientCopy() throws RepositoryException;
}
Modified: jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/TransientValueData.java
===================================================================
--- jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/TransientValueData.java 2009-12-10 15:26:20 UTC (rev 988)
+++ jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/TransientValueData.java 2009-12-10 16:23:38 UTC (rev 989)
@@ -22,10 +22,14 @@
import org.exoplatform.services.jcr.datamodel.Identifier;
import org.exoplatform.services.jcr.datamodel.InternalQName;
import org.exoplatform.services.jcr.datamodel.QPath;
+import org.exoplatform.services.jcr.datamodel.ValueData;
import org.exoplatform.services.jcr.impl.Constants;
+import org.exoplatform.services.jcr.impl.dataflow.persistent.StreamPersistedValueData;
import org.exoplatform.services.jcr.impl.util.JCRDateFormat;
import org.exoplatform.services.jcr.impl.util.io.FileCleaner;
import org.exoplatform.services.jcr.impl.util.io.SpoolFile;
+import org.exoplatform.services.log.ExoLogger;
+import org.exoplatform.services.log.Log;
import java.io.ByteArrayInputStream;
import java.io.Externalizable;
@@ -58,6 +62,8 @@
public class TransientValueData extends AbstractValueData implements Externalizable
{
+ protected final static Log LOG = ExoLogger.getLogger("jcr.TransientValueData");
+
private static final long serialVersionUID = -5280857006905550884L;
protected byte[] data;
@@ -177,7 +183,7 @@
if (this.tmpStream != null)
{
this.tmpStream.close();
- this.tmpStream = null;
+ this.tmpStream = null;
}
this.spooled = true;
@@ -376,17 +382,17 @@
public long getLength()
{
// TODO try ask on FileChannel (via FileInputStream if have such stream).
-
+
if (isByteArrayAfterSpool())
{
- if (log.isDebugEnabled())
- log.debug("getLength data : " + data.length);
+ if (LOG.isDebugEnabled())
+ LOG.debug("getLength data : " + data.length);
return data.length;
}
else
{
- if (log.isDebugEnabled())
- log.debug("getLength spoolFile : " + spoolFile.length());
+ if (LOG.isDebugEnabled())
+ LOG.debug("getLength spoolFile : " + spoolFile.length());
return spoolFile.length();
}
}
@@ -400,36 +406,36 @@
}
// TODO
-// /**
-// * {@inheritDoc}
-// */
-// @Override
-// public TransientValueData createTransientCopy() throws RepositoryException
-// {
-// if (isByteArray())
-// {
-// // bytes, make a copy of real data
-// // TODO JCR-992 don't copy bytes
-// // byte[] newBytes = new byte[data.length];
-// // System.arraycopy(data, 0, newBytes, 0, newBytes.length);
-//
-// try
-// {
-// return new TransientValueData(orderNumber, data, // TODO JCR-992
-// null, null, fileCleaner, maxBufferSize, tempDirectory, deleteSpoolFile);
-// }
-// catch (IOException e)
-// {
-// throw new RepositoryException(e);
-// }
-// }
-// else
-// {
-// // stream (or file) based , i.e. shared across sessions
-// return this;
-// }
-// }
-
+ // /**
+ // * {@inheritDoc}
+ // */
+ // @Override
+ // public TransientValueData createTransientCopy() throws RepositoryException
+ // {
+ // if (isByteArray())
+ // {
+ // // bytes, make a copy of real data
+ // // TODO JCR-992 don't copy bytes
+ // // byte[] newBytes = new byte[data.length];
+ // // System.arraycopy(data, 0, newBytes, 0, newBytes.length);
+ //
+ // try
+ // {
+ // return new TransientValueData(orderNumber, data, // TODO JCR-992
+ // null, null, fileCleaner, maxBufferSize, tempDirectory, deleteSpoolFile);
+ // }
+ // catch (IOException e)
+ // {
+ // throw new RepositoryException(e);
+ // }
+ // }
+ // else
+ // {
+ // // stream (or file) based , i.e. shared across sessions
+ // return this;
+ // }
+ // }
+
/**
* Create TransientCopy of data.
*
@@ -563,32 +569,32 @@
}
// TODO cleanup
-// /**
-// * Set spool as persisted file. It's means ValueData has its data stored to a External Value
-// * Storage. And it's a file with the content which cannot be deleted or moved outside Value
-// * Storage.
-// *
-// * @param persistedFile
-// * File
-// * @throws IOException
-// * if any Exception is occurred
-// */
-// public void setPersistedFile(File persistedFile) throws IOException
-// {
-// if (isTransient())
-// {
-// deleteCurrentSpoolFile();
-// }
-//
-// this.spoolFile = persistedFile;
-// this.deleteSpoolFile = false;
-// this.spooled = true;
-//
-// this.tmpStream = null;
-// this.data = null;
-//
-// this.isTransient = false;
-// }
+ // /**
+ // * Set spool as persisted file. It's means ValueData has its data stored to a External Value
+ // * Storage. And it's a file with the content which cannot be deleted or moved outside Value
+ // * Storage.
+ // *
+ // * @param persistedFile
+ // * File
+ // * @throws IOException
+ // * if any Exception is occurred
+ // */
+ // public void setPersistedFile(File persistedFile) throws IOException
+ // {
+ // if (isTransient())
+ // {
+ // deleteCurrentSpoolFile();
+ // }
+ //
+ // this.spoolFile = persistedFile;
+ // this.deleteSpoolFile = false;
+ // this.spooled = true;
+ //
+ // this.tmpStream = null;
+ // this.data = null;
+ //
+ // this.isTransient = false;
+ // }
/**
* Helper method to simplify operations that requires stringified data.
@@ -599,8 +605,8 @@
*/
public String getString() throws IOException
{
- if (log.isDebugEnabled())
- log.debug("getString");
+ if (LOG.isDebugEnabled())
+ LOG.debug("getString");
return new String(getAsByteArray(), Constants.DEFAULT_ENCODING);
}
@@ -652,26 +658,62 @@
return true;
}
- if (obj instanceof TransientValueData)
+ if (obj instanceof ValueData)
{
- TransientValueData other = (TransientValueData)obj;
- if (isByteArray() != other.isByteArray())
- return false;
- try
+ ValueData other = (ValueData)obj;
+ if (isByteArray() == other.isByteArray())
{
- if (isByteArray())
+ // by content
+ try
{
- return Arrays.equals(getAsByteArray(), other.getAsByteArray());
+ if (isByteArray())
+ {
+ // compare bytes
+ return Arrays.equals(getAsByteArray(), other.getAsByteArray());
+ }
+ else
+ {
+ // compare files
+ if (other instanceof TransientValueData)
+ {
+ // if both transient... or stream of file can be equal
+ TransientValueData transnt = (TransientValueData)other;
+
+ if (tmpStream == transnt.tmpStream)
+ {
+ return true;
+ }
+ else if (spoolFile != null)
+ {
+ return spoolFile.equals(transnt.spoolFile);
+ }
+ }
+ else if (other instanceof StreamPersistedValueData)
+ {
+ // else - it's comparison of values from transient and peristent layers
+ // they can be equal in theory, but we will not check BLOB files content due to performance
+ // check only if it's not a same file or stream (not real) backed both
+
+ StreamPersistedValueData persisted = (StreamPersistedValueData)other;
+
+ if (tmpStream == persisted.getStream())
+ {
+ return true;
+ }
+ else if (spoolFile != null)
+ {
+ return spoolFile.equals(persisted.getFile());
+ }
+ }
+ }
}
- else
- return getSpoolFile().equals(other.getSpoolFile());
+ catch (IOException e)
+ {
+ LOG.error("Read error", e);
+ return false;
+ }
}
- catch (IOException e)
- {
- log.error("Read error", e);
- return false;
- }
}
return false;
}
@@ -719,7 +761,7 @@
}
catch (IOException e)
{
- log.error("Error of spool output close.", e);
+ LOG.error("Error of spool output close.", e);
}
if (this.closeTmpStream)
@@ -729,7 +771,7 @@
}
catch (IOException e)
{
- log.error("Error of source input close.", e);
+ LOG.error("Error of source input close.", e);
}
this.tmpStream = null;
}
@@ -832,7 +874,7 @@
}
catch (IOException e)
{
- log.error("Error of spool output close.", e);
+ LOG.error("Error of spool output close.", e);
}
if (this.closeTmpStream)
@@ -842,7 +884,7 @@
}
catch (IOException e)
{
- log.error("Error of source input close.", e);
+ LOG.error("Error of source input close.", e);
}
this.tmpStream = null;
}
@@ -858,9 +900,9 @@
{
FileChannel fch = new FileInputStream(spoolFile).getChannel();
- if (log.isDebugEnabled() && fch.size() > maxBufferSize)
+ if (LOG.isDebugEnabled() && fch.size() > maxBufferSize)
{
- log.debug("Potential lack of memory due to call getAsByteArray() on stream data exceeded " + fch.size()
+ LOG.debug("Potential lack of memory due to call getAsByteArray() on stream data exceeded " + fch.size()
+ " bytes");
}
@@ -911,28 +953,28 @@
{
fileCleaner.addFile(spoolFile);
- if (log.isDebugEnabled())
+ if (LOG.isDebugEnabled())
{
- log.debug("Could not remove file. Add to fileCleaner " + spoolFile.getAbsolutePath());
+ LOG.debug("Could not remove file. Add to fileCleaner " + spoolFile.getAbsolutePath());
}
}
else
{
- log.warn("Could not remove temporary file on finalize " + spoolFile.getAbsolutePath());
+ LOG.warn("Could not remove temporary file on finalize " + spoolFile.getAbsolutePath());
}
}
}
}
}
-
+
// TODO
-// /**
-// * {@inheritDoc}
-// */
-// public final void setOrderNumber(int orderNumber)
-// {
-// this.orderNumber = orderNumber;
-// }
+ // /**
+ // * {@inheritDoc}
+ // */
+ // public final void setOrderNumber(int orderNumber)
+ // {
+ // this.orderNumber = orderNumber;
+ // }
// ------------- Serializable
Modified: jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/ByteArrayPersistedValueData.java
===================================================================
--- jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/ByteArrayPersistedValueData.java 2009-12-10 15:26:20 UTC (rev 988)
+++ jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/ByteArrayPersistedValueData.java 2009-12-10 16:23:38 UTC (rev 989)
@@ -18,8 +18,11 @@
*/
package org.exoplatform.services.jcr.impl.dataflow.persistent;
+import org.exoplatform.services.jcr.datamodel.ValueData;
import org.exoplatform.services.jcr.impl.dataflow.PersistedValueData;
import org.exoplatform.services.jcr.impl.dataflow.TransientValueData;
+import org.exoplatform.services.log.ExoLogger;
+import org.exoplatform.services.log.Log;
import java.io.ByteArrayInputStream;
import java.io.FileInputStream;
@@ -30,6 +33,7 @@
import java.nio.channels.Channels;
import java.nio.channels.FileChannel;
import java.nio.channels.WritableByteChannel;
+import java.util.Arrays;
import javax.jcr.RepositoryException;
@@ -113,6 +117,36 @@
return true;
}
+ @Override
+ public boolean equals(Object obj)
+ {
+ if (this == obj)
+ {
+ return true;
+ }
+
+ if (obj instanceof ValueData)
+ {
+
+ ValueData other = (ValueData)obj;
+ if (isByteArray() && other.isByteArray())
+ {
+ // by content
+ try
+ {
+ return Arrays.equals(getAsByteArray(), other.getAsByteArray());
+ }
+ catch (IOException e)
+ {
+ LOG.error("Read error", e);
+ return false;
+ }
+ }
+ }
+
+ return false;
+ }
+
/**
* {@inheritDoc}
*/
Modified: jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/FileStreamPersistedValueData.java
===================================================================
--- jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/FileStreamPersistedValueData.java 2009-12-10 15:26:20 UTC (rev 988)
+++ jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/FileStreamPersistedValueData.java 2009-12-10 16:23:38 UTC (rev 989)
@@ -18,6 +18,7 @@
*/
package org.exoplatform.services.jcr.impl.dataflow.persistent;
+import org.exoplatform.services.jcr.datamodel.ValueData;
import org.exoplatform.services.jcr.impl.dataflow.PersistedValueData;
import org.exoplatform.services.jcr.impl.dataflow.TransientValueData;
@@ -31,6 +32,7 @@
import java.nio.channels.Channels;
import java.nio.channels.FileChannel;
import java.nio.channels.WritableByteChannel;
+import java.util.Arrays;
import javax.jcr.RepositoryException;
@@ -60,6 +62,11 @@
this.file = file;
}
+ public File getFile() throws IOException
+ {
+ return file;
+ }
+
/**
* {@inheritDoc}
*/
@@ -131,6 +138,46 @@
return false;
}
+ @Override
+ public boolean equals(Object obj)
+ {
+ if (this == obj)
+ {
+ return true;
+ }
+
+ if (obj instanceof ValueData)
+ {
+ ValueData other = (ValueData)obj;
+ if (!isByteArray() && !other.isByteArray())
+ {
+ // by content
+ try
+ {
+ // compare files
+ if (other instanceof TransientValueData)
+ {
+ // if other transient... files can be equal
+ return file.equals(((TransientValueData)other).getSpoolFile());
+ }
+ else if (other instanceof FileStreamPersistedValueData)
+ {
+ // else - it's comparison of values from peristent layer
+ // they can be equal by file backed them
+
+ return file.equals(((FileStreamPersistedValueData)other).getFile());
+ }
+ }
+ catch (IOException e)
+ {
+ LOG.error("Read error", e);
+ return false;
+ }
+ }
+ }
+ return false;
+ }
+
/**
* {@inheritDoc}
*/
Modified: jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/StreamPersistedValueData.java
===================================================================
--- jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/StreamPersistedValueData.java 2009-12-10 15:26:20 UTC (rev 988)
+++ jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/StreamPersistedValueData.java 2009-12-10 16:23:38 UTC (rev 989)
@@ -125,6 +125,24 @@
}
}
+ // TODO
+ // @Override
+ // public boolean equals(Object obj)
+ // {
+ // if (super.equals(obj))
+ // {
+ // return true;
+ // }
+ // else
+ // {
+ // // we can check stream and temp file additional
+ // if (tempFile != null)
+ // {
+ //
+ // }
+ // }
+ // }
+
/**
* {@inheritDoc}
*/
16 years, 7 months
exo-jcr SVN: r988 - in jcr/branches/1.12.0-JBC/component/core/src: main/java/org/exoplatform/services/jcr/impl/core/query/jbosscache and 2 other directories.
by do-not-reply@jboss.org
Author: nzamosenchuk
Date: 2009-12-10 10:26:20 -0500 (Thu, 10 Dec 2009)
New Revision: 988
Modified:
jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/core/query/DefaultChangesFilter.java
jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/core/query/QueryHandler.java
jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/core/query/jbosscache/IndexerCacheLoader.java
jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/MultiIndex.java
jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/SearchIndex.java
jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/api/core/query/lucene/SlowQueryHandler.java
Log:
EXOJCR-291: READ_ONLY set by default and Multiindex is now launches recover only if READ_WRITE. Default filter sets RW on creation.
Modified: jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/core/query/DefaultChangesFilter.java
===================================================================
--- jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/core/query/DefaultChangesFilter.java 2009-12-10 14:59:45 UTC (rev 987)
+++ jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/core/query/DefaultChangesFilter.java 2009-12-10 15:26:20 UTC (rev 988)
@@ -49,6 +49,8 @@
QueryHandler parentHandler)
{
super(searchManager, parentSearchManager, config, indexingTree, parentIndexingTree, handler, parentHandler);
+ handler.setIndexerIoMode(IndexerIoMode.READ_WRITE);
+ parentHandler.setIndexerIoMode(IndexerIoMode.READ_WRITE);
}
/**
Modified: jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/core/query/QueryHandler.java
===================================================================
--- jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/core/query/QueryHandler.java 2009-12-10 14:59:45 UTC (rev 987)
+++ jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/core/query/QueryHandler.java 2009-12-10 15:26:20 UTC (rev 988)
@@ -110,7 +110,7 @@
*/
void logErrorChanges(Set<String> removed, Set<String> added) throws IOException;
- void setIndexerIoMode(IndexerIoMode ioMode) throws IOException, RepositoryException;
+ void setIndexerIoMode(IndexerIoMode ioMode);
/**
* @return the name of the query class to use.
Modified: jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/core/query/jbosscache/IndexerCacheLoader.java
===================================================================
--- jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/core/query/jbosscache/IndexerCacheLoader.java 2009-12-10 14:59:45 UTC (rev 987)
+++ jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/core/query/jbosscache/IndexerCacheLoader.java 2009-12-10 15:26:20 UTC (rev 988)
@@ -49,6 +49,15 @@
private QueryHandler parentHandler;
+ /**
+ * Inject dependencies needed for CacheLoader: SearchManagers and QueryHandlers.
+ *
+ * @param searchManager
+ * @param parentSearchManager
+ * @param handler
+ * @param parentHandler
+ * @throws RepositoryConfigurationException
+ */
public void init(SearchManager searchManager, SearchManager parentSearchManager, QueryHandler handler,
QueryHandler parentHandler) throws RepositoryConfigurationException
{
@@ -71,7 +80,6 @@
log.info("Received list wrapper, start indexing...");
}
ChangesFilterListsWrapper wrapper = (ChangesFilterListsWrapper)val;
- log.info("Loader=" + this + " changes=" + wrapper.dump());
updateIndex(wrapper.getAddedNodes(), wrapper.getRemovedNodes(), wrapper.getParentAddedNodes(), wrapper
.getParentRemovedNodes());
}
@@ -89,6 +97,7 @@
protected void updateIndex(Set<String> addedNodes, Set<String> removedNodes, Set<String> parentAddedNodes,
Set<String> parentRemovedNodes)
{
+ // pass lists to search manager
if (searchManager != null && (addedNodes.size() > 0 || removedNodes.size() > 0))
{
try
@@ -112,6 +121,7 @@
}
}
}
+ // pass lists to parent search manager
if (parentSearchManager != null && (parentAddedNodes.size() > 0 || parentRemovedNodes.size() > 0))
{
try
@@ -138,42 +148,19 @@
}
/**
- * Switches Indexer mode from RO to RW, or
+ * Switches Indexer mode from RO to RW, or from RW to RO
*
* @param ioMode
*/
public void setMode(IndexerIoMode ioMode)
{
- log.info("Setting indexer mode to: "+ioMode);
if (handler != null)
{
- try
- {
- handler.setIndexerIoMode(ioMode);
- }
- catch (IOException e)
- {
- log.error(e);
- }
- catch (RepositoryException e)
- {
- log.error(e);
- }
+ handler.setIndexerIoMode(ioMode);
}
if (parentHandler != null)
{
- try
- {
- parentHandler.setIndexerIoMode(ioMode);
- }
- catch (IOException e)
- {
- log.error(e);
- }
- catch (RepositoryException e)
- {
- log.error(e);
- }
+ parentHandler.setIndexerIoMode(ioMode);
}
}
Modified: jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/MultiIndex.java
===================================================================
--- jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/MultiIndex.java 2009-12-10 14:59:45 UTC (rev 987)
+++ jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/MultiIndex.java 2009-12-10 15:26:20 UTC (rev 988)
@@ -171,7 +171,7 @@
* Task that is periodically called by {@link #FLUSH_TIMER} and checks if
* index should be flushed.
*/
- private final TimerTask flushTask;
+ private TimerTask flushTask;
/**
* The RedoLog of this <code>MultiIndex</code>.
@@ -211,7 +211,7 @@
/**
* Indexer io mode
*/
- private IndexerIoMode ioMode = IndexerIoMode.READ_WRITE;
+ private IndexerIoMode ioMode;
/**
* Creates a new MultiIndex.
@@ -224,8 +224,9 @@
* @throws IOException
* if an error occurs
*/
- MultiIndex(SearchIndex handler, IndexingTree indexingTree) throws IOException
+ MultiIndex(SearchIndex handler, IndexingTree indexingTree, IndexerIoMode ioMode) throws IOException
{
+ this.ioMode = ioMode;
this.directoryManager = handler.getDirectoryManager();
this.indexDir = directoryManager.getDirectory(".");
this.handler = handler;
@@ -233,7 +234,7 @@
this.redoLog = new RedoLog(indexDir);
this.indexingTree = indexingTree;
this.nsMappings = handler.getNamespaceMappings();
-
+ this.flushTask = null;
if (indexNames.exists(indexDir))
{
indexNames.read(indexDir);
@@ -294,47 +295,44 @@
indexingQueue.initialize(this);
- redoLogApplied = redoLog.hasEntries();
+ if (ioMode == IndexerIoMode.READ_WRITE)
+ {
+ redoLogApplied = redoLog.hasEntries();
- // run recovery
- Recovery.run(this, redoLog);
+ // run recovery
+ Recovery.run(this, redoLog);
- // enqueue unused segments for deletion
- enqueueUnusedSegments();
- attemptDelete();
+ // enqueue unused segments for deletion
+ enqueueUnusedSegments();
+ attemptDelete();
- // now that we are ready, start index merger
- merger.start();
+ // now that we are ready, start index merger
+ merger.start();
- if (redoLogApplied)
- {
- // wait for the index merge to finish pending jobs
- try
+ if (redoLogApplied)
{
- merger.waitUntilIdle();
+ // wait for the index merge to finish pending jobs
+ try
+ {
+ merger.waitUntilIdle();
+ }
+ catch (InterruptedException e)
+ {
+ // move on
+ }
+ flush();
}
- catch (InterruptedException e)
+
+ if (indexNames.size() > 0)
{
- // move on
+ scheduleFlushTask();
}
- flush();
}
-
- flushTask = new TimerTask()
+ else
{
- public void run()
- {
- // check if there are any indexing jobs finished
- checkIndexingQueue();
- // check if volatile index should be flushed
- checkFlush();
- }
- };
+ redoLogApplied = false;
+ }
- if (indexNames.size() > 0)
- {
- scheduleFlushTask();
- }
}
/**
@@ -900,7 +898,10 @@
synchronized (this)
{
// stop timer
- flushTask.cancel();
+ if (flushTask != null)
+ {
+ flushTask.cancel();
+ }
// commit / close indexes
try
@@ -1132,6 +1133,20 @@
private void scheduleFlushTask()
{
lastFlushTime = System.currentTimeMillis();
+ if (flushTask != null)
+ {
+ flushTask.cancel();
+ }
+ flushTask = new TimerTask()
+ {
+ public void run()
+ {
+ // check if there are any indexing jobs finished
+ checkIndexingQueue();
+ // check if volatile index should be flushed
+ checkFlush();
+ }
+ };
FLUSH_TIMER.schedule(flushTask, 0, 1000);
}
Modified: jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/SearchIndex.java
===================================================================
--- jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/SearchIndex.java 2009-12-10 14:59:45 UTC (rev 987)
+++ jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/SearchIndex.java 2009-12-10 15:26:20 UTC (rev 988)
@@ -418,7 +418,7 @@
/**
* Indexer io mode
*/
- private IndexerIoMode ioMode = IndexerIoMode.READ_WRITE;
+ private IndexerIoMode ioMode = IndexerIoMode.READ_ONLY;
/**
* Working constructor.
@@ -520,7 +520,7 @@
indexingConfig = createIndexingConfiguration(nsMappings);
analyzer.setIndexingConfig(indexingConfig);
- index = new MultiIndex(this, context.getIndexingTree());
+ index = new MultiIndex(this, context.getIndexingTree(), ioMode);
if (index.numDocs() == 0 && context.isCreateInitialIndex())
{
@@ -2648,7 +2648,7 @@
/**
* @see org.exoplatform.services.jcr.impl.core.query.QueryHandler#setIndexerIoMode(org.exoplatform.services.jcr.impl.core.query.IndexerIoMode)
*/
- public void setIndexerIoMode(IndexerIoMode ioMode) throws IOException, RepositoryException
+ public void setIndexerIoMode(IndexerIoMode ioMode)
{
log.info("Indexer io mode=" + ioMode);
//do some thing if changed
Modified: jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/api/core/query/lucene/SlowQueryHandler.java
===================================================================
--- jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/api/core/query/lucene/SlowQueryHandler.java 2009-12-10 14:59:45 UTC (rev 987)
+++ jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/api/core/query/lucene/SlowQueryHandler.java 2009-12-10 15:26:20 UTC (rev 988)
@@ -99,7 +99,7 @@
/**
* @see org.exoplatform.services.jcr.impl.core.query.QueryHandler#setIndexerIoMode(org.exoplatform.services.jcr.impl.core.query.IndexerIoMode)
*/
- public void setIndexerIoMode(IndexerIoMode ioMode) throws IOException, RepositoryException
+ public void setIndexerIoMode(IndexerIoMode ioMode)
{
this.ioMode = ioMode;
16 years, 7 months
exo-jcr SVN: r987 - jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent.
by do-not-reply@jboss.org
Author: pnedonosko
Date: 2009-12-10 09:59:45 -0500 (Thu, 10 Dec 2009)
New Revision: 987
Modified:
jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/WorkspacePersistentDataManager.java
Log:
EXOJCR-274 fix of connection open error
Modified: jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/WorkspacePersistentDataManager.java
===================================================================
--- jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/WorkspacePersistentDataManager.java 2009-12-10 14:30:52 UTC (rev 986)
+++ jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/WorkspacePersistentDataManager.java 2009-12-10 14:59:45 UTC (rev 987)
@@ -352,9 +352,9 @@
protected WorkspaceStorageConnection getSystemConnection() throws RepositoryException
{
- return thisConnection = systemConnection == null
+ return systemConnection == null
// we need system connection but it's not exist
- ? (systemDataContainer != dataContainer
+ ? systemConnection = (systemDataContainer != dataContainer
// if it's different container instances
? systemDataContainer.equals(dataContainer) && thisConnection != null
// but container confugrations are same and non-system connnection open
@@ -374,9 +374,9 @@
protected WorkspaceStorageConnection getThisConnection() throws RepositoryException
{
- return thisConnection = thisConnection == null
+ return thisConnection == null
// we need this conatiner conection
- ? (systemDataContainer != dataContainer
+ ? thisConnection = (systemDataContainer != dataContainer
// if it's different container instances
? dataContainer.equals(systemDataContainer) && systemConnection != null
// but container confugrations are same and system connnection open
16 years, 7 months
exo-jcr SVN: r986 - in jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl: core/version and 1 other directories.
by do-not-reply@jboss.org
Author: pnedonosko
Date: 2009-12-10 09:30:52 -0500 (Thu, 10 Dec 2009)
New Revision: 986
Modified:
jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionDataManager.java
jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/version/VersionHistoryImpl.java
jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/WorkspacePersistentDataManager.java
Log:
EXOJCR-274 save don't copy persistent items; VersionHistoryImpl cleanup.
Modified: jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionDataManager.java
===================================================================
--- jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionDataManager.java 2009-12-10 14:13:56 UTC (rev 985)
+++ jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionDataManager.java 2009-12-10 14:30:52 UTC (rev 986)
@@ -1041,6 +1041,7 @@
NodeData nextSibling =
(NodeData)dataManager.getItemData(parentNodeData, new QPathEntry(cause.getQPath().getName(), cause.getQPath()
.getIndex() + 1));
+
String reindexedId = null;
// repeat till next sibling exists and it's not a caused Node (deleted or moved to) or just
// reindexed
Modified: jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/version/VersionHistoryImpl.java
===================================================================
--- jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/version/VersionHistoryImpl.java 2009-12-10 14:13:56 UTC (rev 985)
+++ jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/version/VersionHistoryImpl.java 2009-12-10 14:30:52 UTC (rev 986)
@@ -75,7 +75,9 @@
super(data, session);
if (!this.isNodeType(Constants.NT_VERSIONHISTORY))
+ {
throw new RepositoryException("Node " + getLocation().getAsString(true) + " is not nt:versionHistory type");
+ }
}
/**
@@ -147,7 +149,6 @@
*/
public VersionIterator getAllVersions() throws RepositoryException
{
-
checkValid();
List<NodeData> versionsDataList = getData().getAllVersionsData();
@@ -168,7 +169,6 @@
*/
public Version getVersion(String versionName) throws VersionException, RepositoryException
{
-
checkValid();
return version(versionName, true);
@@ -196,7 +196,6 @@
*/
public Version getVersionByLabel(String label) throws RepositoryException
{
-
checkValid();
NodeData versionData = getVersionDataByLabel(label);
@@ -218,7 +217,6 @@
*/
public boolean hasVersionLabel(String label) throws RepositoryException
{
-
checkValid();
if (this.getVersionDataByLabel(label) == null)
@@ -232,7 +230,6 @@
*/
public boolean hasVersionLabel(Version version, String label) throws VersionException, RepositoryException
{
-
checkValid();
NodeData versionData = getVersionDataByLabel(label);
@@ -247,7 +244,6 @@
*/
public String[] getVersionLabels() throws RepositoryException
{
-
checkValid();
List<PropertyData> versionLabels = getData().getVersionLabels();
@@ -263,8 +259,10 @@
protected List<String> getVersionLabelsList(Version version) throws VersionException, RepositoryException
{
if (!isVersionBelongToThis(version))
+ {
throw new VersionException("There are no version '" + version.getPath() + "' in the version history "
+ getPath());
+ }
List<PropertyData> labelsList = getData().getVersionLabels();
List<String> vlabels = new ArrayList<String>();
@@ -293,7 +291,6 @@
*/
public String[] getVersionLabels(Version version) throws VersionException, RepositoryException
{
-
checkValid();
List<String> vlabels = getVersionLabelsList(version);
@@ -310,7 +307,6 @@
public void removeVersion(String versionName) throws ReferentialIntegrityException, AccessDeniedException,
UnsupportedRepositoryOperationException, VersionException, RepositoryException
{
-
// get version (pool it to be able to invalidate the version on final)
VersionImpl version = (VersionImpl)version(versionName, true);
@@ -444,14 +440,15 @@
{
NodeData labels = getData().getVersionLabelsData();
if (labels == null)
+ {
throw new VersionException("Mandatory node jcr:versionLabels is not found for version history " + getPath());
+ }
return labels;
}
protected NodeData getVersionDataByLabel(String labelName) throws VersionException, RepositoryException
{
-
JCRName jcrLabelName = locationFactory.parseJCRName(labelName);
InternalQName labelQName = jcrLabelName.getInternalName();
@@ -460,10 +457,11 @@
protected NodeData getVersionDataByIdentifier(String versionIdentifier) throws VersionException, RepositoryException
{
-
NodeData version = (NodeData)dataManager.getItemData(versionIdentifier);
if (version == null)
+ {
throw new VersionException("Version is not found, uuid: " + versionIdentifier);
+ }
return version;
}
@@ -474,7 +472,6 @@
public void addVersionLabel(String versionName, String label, boolean moveLabel) throws VersionException,
RepositoryException
{
-
checkValid();
JCRName jcrLabelName = locationFactory.parseJCRName(label);
@@ -514,7 +511,6 @@
*/
public void removeVersionLabel(String labelName) throws VersionException, RepositoryException
{
-
checkValid();
JCRName jcrLabelName = locationFactory.parseJCRName(labelName);
@@ -539,7 +535,6 @@
public void addVersion(NodeData versionableNodeData, String uuid, SessionChangesLog changesLog)
throws RepositoryException
{
-
// nt:version
NodeData versionData =
TransientNodeData.createNodeData(nodeData(), new InternalQName(null, nextVersionName()), Constants.NT_VERSION,
@@ -616,15 +611,15 @@
new TransientValueData(frozenData.getIdentifier()));
changesLog.add(ItemState.createAddedState(propData));
- // NodeTypeManagerImpl ntManager =
- // session.getWorkspace().getNodeTypesHolder();
FrozenNodeInitializer visitor =
new FrozenNodeInitializer(frozenData, session.getTransientNodesManager(), session.getWorkspace()
.getNodeTypesHolder(), changesLog, session.getValueFactory());
if (LOG.isDebugEnabled())
+ {
LOG.debug("Before frozen visitor: " + changesLog.dump());
-
+ }
+
versionableNodeData.accept(visitor);
}
Modified: jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/WorkspacePersistentDataManager.java
===================================================================
--- jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/WorkspacePersistentDataManager.java 2009-12-10 14:13:56 UTC (rev 985)
+++ jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/WorkspacePersistentDataManager.java 2009-12-10 14:30:52 UTC (rev 986)
@@ -29,6 +29,7 @@
import org.exoplatform.services.jcr.dataflow.persistent.ItemsPersistenceListener;
import org.exoplatform.services.jcr.dataflow.persistent.ItemsPersistenceListenerFilter;
import org.exoplatform.services.jcr.dataflow.persistent.MandatoryItemsPersistenceListener;
+import org.exoplatform.services.jcr.dataflow.persistent.PersistedItemData;
import org.exoplatform.services.jcr.dataflow.persistent.PersistedNodeData;
import org.exoplatform.services.jcr.dataflow.persistent.PersistedPropertyData;
import org.exoplatform.services.jcr.datamodel.ItemData;
@@ -214,7 +215,9 @@
// check if this workspace container is not read-only
if (readOnly && !(changesLog instanceof ReadOnlyThroughChanges))
+ {
throw new ReadOnlyWorkspaceException("Workspace container '" + dataContainer.getName() + "' is read-only.");
+ }
ChangesLogPersister persister = new ChangesLogPersister();
@@ -402,73 +405,75 @@
for (Iterator<ItemState> iter = changesLog.getAllStates().iterator(); iter.hasNext();)
{
ItemState prevState = iter.next();
+ ItemData newData;
- ItemData newData;
- if (prevState.isNode())
+ if (prevState.getData() instanceof PersistedItemData)
{
- NodeData prevData = (NodeData)prevState.getData();
- newData =
- new PersistedNodeData(prevData.getIdentifier(), prevData.getQPath(), prevData.getParentIdentifier(),
- prevData.getPersistedVersion() + 1, prevData.getOrderNumber(), prevData.getPrimaryTypeName(),
- prevData.getMixinTypeNames(), prevData.getACL());
+ // use existing if persisted
+ newData = prevState.getData();
}
else
{
- PropertyData prevData = (PropertyData)prevState.getData();
+ // copy transient as persisted
+ if (prevState.isNode())
+ {
+ NodeData prevData = (NodeData)prevState.getData();
+ newData =
+ new PersistedNodeData(prevData.getIdentifier(), prevData.getQPath(), prevData
+ .getParentIdentifier(), prevData.getPersistedVersion() + 1, prevData.getOrderNumber(), prevData
+ .getPrimaryTypeName(), prevData.getMixinTypeNames(), prevData.getACL());
+ }
+ else
+ {
+ PropertyData prevData = (PropertyData)prevState.getData();
- newData =
- new PersistedPropertyData(prevData.getIdentifier(), prevData.getQPath(), prevData
- .getParentIdentifier(), prevData.getPersistedVersion() + 1, prevData.getType(), prevData
- .isMultiValued(), prevData.getValues());
+ // newData =
+ // new PersistedPropertyData(prevData.getIdentifier(), prevData.getQPath(), prevData
+ // .getParentIdentifier(), prevData.getPersistedVersion() + 1, prevData.getType(), prevData
+ // .isMultiValued(), prevData.getValues());
- // if (prevData.getValues() != null)
- // {
- // List<ValueData> values = new ArrayList<ValueData>();
- // for (ValueData vd : prevData.getValues())
- // {
- // if (vd.isByteArray())
- // {
- // values.add(new ByteArrayPersistedValueData(vd.getAsByteArray(), vd.getOrderNumber()));
- // }
- // else
- // {
- // // TODO ask dest file from VS provider, can be null after
- // // TODO what if JDBC spool used, i.e. without VS = storage will setPersistedFile()
- // // TODO for JBC case, the storage connection will evict the replicated Value to read it from the DB
- // File destFile = null;
- //
- // if (vd instanceof TransientValueData)
- // {
- // TransientValueData tvd = (TransientValueData)vd;
- // // TODO review TransientValueData logic about spool file and stream
- // values.add(new StreamPersistedValueData(destFile, tvd.getSpoolFile(),
- // tvd.getSpoolFile() == null ? tvd.getAsStream(false) : null, vd.getOrderNumber()));
- // }
- // else if (vd instanceof PersistedValueData)
- // {
- // values.add(((PersistedValueData)vd).createTransientCopy());
- // }
- // else
- // {
- // throw new RepositoryException(
- // "Unexpected ValueData implementaion on persistent level, only TransientValueData or PersistedValueData allowed. "
- // + vd.getClass());
- // }
- // }
- // }
- //
- // newData =
- // new PersistedPropertyData(prevData.getIdentifier(), prevData.getQPath(), prevData
- // .getParentIdentifier(), prevData.getPersistedVersion() + 1, prevData.getType(), prevData
- // .isMultiValued(), values);
- // }
- // else
- // {
- // newData =
- // new PersistedPropertyData(prevData.getIdentifier(), prevData.getQPath(), prevData
- // .getParentIdentifier(), prevData.getPersistedVersion() + 1, prevData.getType(), prevData
- // .isMultiValued(), null);
- // }
+ if (prevData.getValues() != null)
+ {
+ List<ValueData> values = new ArrayList<ValueData>();
+ for (ValueData vd : prevData.getValues())
+ {
+ if (vd.isByteArray())
+ {
+ values.add(new ByteArrayPersistedValueData(vd.getAsByteArray(), vd.getOrderNumber()));
+ }
+ else
+ {
+ // TODO ask dest file from VS provider, can be null after
+ // TODO what if JDBC spool used, i.e. without VS = storage will setPersistedFile()
+ // TODO for JBC case, the storage connection will evict the replicated Value to read it from the DB
+ File destFile = null;
+
+ TransientValueData tvd = (TransientValueData)vd;
+ // TODO review TransientValueData logic about spool file and stream
+ values.add(new StreamPersistedValueData(destFile, tvd.getSpoolFile(),
+ tvd.getSpoolFile() == null ? tvd.getAsStream(false) : null, vd.getOrderNumber()));
+
+ // {
+ // throw new RepositoryException(
+ // "Unexpected stream based ValueData implementaion on persistent level, only TransientValueData or PersistedValueData allowed. "
+ // + vd.getClass());
+ // }
+ }
+ }
+
+ newData =
+ new PersistedPropertyData(prevData.getIdentifier(), prevData.getQPath(), prevData
+ .getParentIdentifier(), prevData.getPersistedVersion() + 1, prevData.getType(), prevData
+ .isMultiValued(), values);
+ }
+ else
+ {
+ newData =
+ new PersistedPropertyData(prevData.getIdentifier(), prevData.getQPath(), prevData
+ .getParentIdentifier(), prevData.getPersistedVersion() + 1, prevData.getType(), prevData
+ .isMultiValued(), null);
+ }
+ }
}
ItemState itemState =
16 years, 7 months
exo-jcr SVN: r985 - in jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl: dataflow/persistent and 1 other directory.
by do-not-reply@jboss.org
Author: tolusha
Date: 2009-12-10 09:13:56 -0500 (Thu, 10 Dec 2009)
New Revision: 985
Modified:
jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/NodeImpl.java
jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/PropertyImpl.java
jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionDataManager.java
jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/WorkspacePersistentDataManager.java
Log:
EXOJCR-300: adoption
Modified: jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/NodeImpl.java
===================================================================
--- jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/NodeImpl.java 2009-12-10 12:17:44 UTC (rev 984)
+++ jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/NodeImpl.java 2009-12-10 14:13:56 UTC (rev 985)
@@ -2421,14 +2421,23 @@
// change same name index
if (sdata.getQPath().getName().equals(srcPath.getName()) && sdata.getQPath().getIndex() != sameNameIndex)
{
- newData = ((TransientNodeData)sdata).cloneAsSibling(sameNameIndex);
+ // update with new index
+ QPath siblingPath =
+ QPath.makeChildPath(newData.getQPath().makeParentPath(), newData.getQPath().getName(), sameNameIndex);
+
+ newData =
+ new TransientNodeData(siblingPath, newData.getIdentifier(), newData.getPersistedVersion(), newData
+ .getPrimaryTypeName(), newData.getMixinTypeNames(), j, newData.getParentIdentifier(), newData
+ .getACL());
}
+ else
+ {
+ newData =
+ new TransientNodeData(newData.getQPath(), newData.getIdentifier(), newData.getPersistedVersion(),
+ newData.getPrimaryTypeName(), newData.getMixinTypeNames(), j, newData.getParentIdentifier(), newData
+ .getACL());
+ }
- // create update
- newData =
- new TransientNodeData(newData.getQPath(), newData.getIdentifier(), newData.getPersistedVersion(), newData
- .getPrimaryTypeName(), newData.getMixinTypeNames(), j, newData.getParentIdentifier(), newData.getACL());
-
/*
* 8.3.7.8 Re-ordering a set of Child Nodes. When an orderBefore(A, B) is
* performed, an implementation must generate a NODE_REMOVED for node A
Modified: jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/PropertyImpl.java
===================================================================
--- jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/PropertyImpl.java 2009-12-10 12:17:44 UTC (rev 984)
+++ jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/PropertyImpl.java 2009-12-10 14:13:56 UTC (rev 985)
@@ -26,6 +26,7 @@
import org.exoplatform.services.jcr.datamodel.ItemData;
import org.exoplatform.services.jcr.datamodel.NodeData;
import org.exoplatform.services.jcr.datamodel.PropertyData;
+import org.exoplatform.services.jcr.datamodel.ValueData;
import org.exoplatform.services.jcr.impl.Constants;
import org.exoplatform.services.jcr.impl.core.nodetype.PropertyDefinitionImpl;
import org.exoplatform.services.jcr.impl.core.value.BaseValue;
@@ -357,7 +358,7 @@
{
throw new ConstraintViolationException("Definition for property " + getPath() + " not found.");
}
-
+
propertyDef = definitions.getDefinition(multiple);
}
@@ -549,8 +550,7 @@
Value[] values = new Value[propertyData.getValues().size()];
for (int i = 0; i < values.length; i++)
{
- values[i] =
- valueFactory.loadValue((TransientValueData)propertyData.getValues().get(i), propertyData.getType());
+ values[i] = valueFactory.loadValue((ValueData)propertyData.getValues().get(i), propertyData.getType());
}
return values;
}
Modified: jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionDataManager.java
===================================================================
--- jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionDataManager.java 2009-12-10 12:17:44 UTC (rev 984)
+++ jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionDataManager.java 2009-12-10 14:13:56 UTC (rev 985)
@@ -1038,9 +1038,9 @@
NodeData parentNodeData = (NodeData)dataManager.getItemData(cause.getParentIdentifier());
- TransientNodeData nextSibling =
- (TransientNodeData)dataManager.getItemData(parentNodeData, new QPathEntry(cause.getQPath().getName(), cause
- .getQPath().getIndex() + 1));
+ NodeData nextSibling =
+ (NodeData)dataManager.getItemData(parentNodeData, new QPathEntry(cause.getQPath().getName(), cause.getQPath()
+ .getIndex() + 1));
String reindexedId = null;
// repeat till next sibling exists and it's not a caused Node (deleted or moved to) or just
// reindexed
@@ -1048,7 +1048,15 @@
&& !nextSibling.getIdentifier().equals(reindexedId))
{
// update with new index
- NodeData reindexed = nextSibling.cloneAsSibling(nextSibling.getQPath().getIndex() - 1);
+ QPath siblingPath =
+ QPath.makeChildPath(nextSibling.getQPath().makeParentPath(), nextSibling.getQPath().getName(), nextSibling
+ .getQPath().getIndex() - 1);
+
+ NodeData reindexed =
+ new TransientNodeData(siblingPath, nextSibling.getIdentifier(), nextSibling.getPersistedVersion(),
+ nextSibling.getPrimaryTypeName(), nextSibling.getMixinTypeNames(), nextSibling.getOrderNumber(),
+ nextSibling.getParentIdentifier(), nextSibling.getACL());
+
reindexedId = reindexed.getIdentifier();
ItemState reindexedState = ItemState.createUpdatedState(reindexed);
@@ -1062,7 +1070,7 @@
// next...
nextSibling =
- (TransientNodeData)dataManager.getItemData(parentNodeData, new QPathEntry(nextSibling.getQPath().getName(),
+ (NodeData)dataManager.getItemData(parentNodeData, new QPathEntry(nextSibling.getQPath().getName(),
nextSibling.getQPath().getIndex() + 1));
}
Modified: jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/WorkspacePersistentDataManager.java
===================================================================
--- jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/WorkspacePersistentDataManager.java 2009-12-10 12:17:44 UTC (rev 984)
+++ jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/WorkspacePersistentDataManager.java 2009-12-10 14:13:56 UTC (rev 985)
@@ -416,44 +416,59 @@
{
PropertyData prevData = (PropertyData)prevState.getData();
- List<ValueData> values = new ArrayList<ValueData>();
- for (ValueData vd : prevData.getValues())
- {
- if (vd.isByteArray())
- {
- values.add(new ByteArrayPersistedValueData(vd.getAsByteArray(), vd.getOrderNumber()));
- }
- else
- {
- // TODO ask dest file from VS provider, can be null after
- // TODO what if JDBC spool used, i.e. without VS = storage will setPersistedFile()
- // TODO for JBC case, the storage connection will evict the replicated Value to read it from the DB
- File destFile = null;
-
- if (vd instanceof TransientValueData)
- {
- TransientValueData tvd = (TransientValueData)vd;
- // TODO review TransientValueData logic about spool file and stream
- values.add(new StreamPersistedValueData(destFile, tvd.getSpoolFile(),
- tvd.getSpoolFile() == null ? tvd.getAsStream(false) : null, vd.getOrderNumber()));
- }
- else if (vd instanceof PersistedValueData)
- {
- values.add(((PersistedValueData)vd).createTransientCopy());
- }
- else
- {
- throw new RepositoryException(
- "Unexpected ValueData implementaion on persistent level, only TransientValueData or PersistedValueData allowed. "
- + vd.getClass());
- }
- }
- }
-
newData =
new PersistedPropertyData(prevData.getIdentifier(), prevData.getQPath(), prevData
.getParentIdentifier(), prevData.getPersistedVersion() + 1, prevData.getType(), prevData
- .isMultiValued(), values);
+ .isMultiValued(), prevData.getValues());
+
+ // if (prevData.getValues() != null)
+ // {
+ // List<ValueData> values = new ArrayList<ValueData>();
+ // for (ValueData vd : prevData.getValues())
+ // {
+ // if (vd.isByteArray())
+ // {
+ // values.add(new ByteArrayPersistedValueData(vd.getAsByteArray(), vd.getOrderNumber()));
+ // }
+ // else
+ // {
+ // // TODO ask dest file from VS provider, can be null after
+ // // TODO what if JDBC spool used, i.e. without VS = storage will setPersistedFile()
+ // // TODO for JBC case, the storage connection will evict the replicated Value to read it from the DB
+ // File destFile = null;
+ //
+ // if (vd instanceof TransientValueData)
+ // {
+ // TransientValueData tvd = (TransientValueData)vd;
+ // // TODO review TransientValueData logic about spool file and stream
+ // values.add(new StreamPersistedValueData(destFile, tvd.getSpoolFile(),
+ // tvd.getSpoolFile() == null ? tvd.getAsStream(false) : null, vd.getOrderNumber()));
+ // }
+ // else if (vd instanceof PersistedValueData)
+ // {
+ // values.add(((PersistedValueData)vd).createTransientCopy());
+ // }
+ // else
+ // {
+ // throw new RepositoryException(
+ // "Unexpected ValueData implementaion on persistent level, only TransientValueData or PersistedValueData allowed. "
+ // + vd.getClass());
+ // }
+ // }
+ // }
+ //
+ // newData =
+ // new PersistedPropertyData(prevData.getIdentifier(), prevData.getQPath(), prevData
+ // .getParentIdentifier(), prevData.getPersistedVersion() + 1, prevData.getType(), prevData
+ // .isMultiValued(), values);
+ // }
+ // else
+ // {
+ // newData =
+ // new PersistedPropertyData(prevData.getIdentifier(), prevData.getQPath(), prevData
+ // .getParentIdentifier(), prevData.getPersistedVersion() + 1, prevData.getType(), prevData
+ // .isMultiValued(), null);
+ // }
}
ItemState itemState =
16 years, 7 months