[exo-jcr-commits] exo-jcr SVN: r1543 - in jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl: core/lock/jbosscache and 6 other directories.
do-not-reply at jboss.org
do-not-reply at jboss.org
Fri Jan 22 07:31:30 EST 2010
Author: pnedonosko
Date: 2010-01-22 07:31:29 -0500 (Fri, 22 Jan 2010)
New Revision: 1543
Modified:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/NodeImpl.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/PropertyImpl.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/jbosscache/CacheableLockManager.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/nodetype/registration/AbstractItemDefinitionAccessProvider.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/nodetype/registration/PropertyDefinitionAccessProvider.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/value/BaseValue.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/version/VersionHistoryImpl.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/version/VersionImpl.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/AbstractPersistedValueData.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/EditableValueData.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/TransientValueData.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/FilePersistedValueData.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/xml/importing/DocumentViewImporter.java
Log:
EXOJCR-347 copy ValueData for write operations; TODO cleanup; formatting
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/NodeImpl.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/NodeImpl.java 2010-01-22 12:17:25 UTC (rev 1542)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/NodeImpl.java 2010-01-22 12:31:29 UTC (rev 1543)
@@ -489,42 +489,6 @@
}
/**
- * Return child Nodes list.
- *
- * @return List of child Nodes
- * @throws RepositoryException
- * if error occurs
- * @throws AccessDeniedException
- * if Nodes cannot be listed due to permissions on this Node
- */
- @Deprecated
- private List<NodeImpl> childNodes() throws RepositoryException, AccessDeniedException
- {
-
- List<NodeImpl> storedNodes = dataManager.getChildNodes(nodeData(), true);
- Collections.sort(storedNodes, new NodesOrderComparator());
- return storedNodes;
- }
-
- /**
- * Return child Properties list.
- *
- * @return List of child Properties
- * @throws RepositoryException
- * if error occurs
- * @throws AccessDeniedException
- * if Properties cannot be listed due to permissions on this Node
- */
- @Deprecated
- private List<PropertyImpl> childProperties() throws RepositoryException, AccessDeniedException
- {
-
- List<PropertyImpl> storedProperties = dataManager.getChildProperties(nodeData(), true);
- Collections.sort(storedProperties, new PropertiesOrderComparator());
- return storedProperties;
- }
-
- /**
* {@inheritDoc}
*/
public void clearACL() throws RepositoryException, AccessControlException
@@ -725,64 +689,6 @@
}
/**
- * Return Node corresponding to this Node. DEPRECATED.
- *
- * @param correspSession
- * session on corresponding Workspace
- * @return Node corresponding Node
- * @throws ItemNotFoundException
- * if corresponding Node not found
- * @throws AccessDeniedException
- * if read impossible due to permisions
- * @throws RepositoryException
- * if any other error occurs
- */
- @Deprecated
- public Node getCorrespondingNode(SessionImpl correspSession) throws ItemNotFoundException, AccessDeniedException,
- RepositoryException
- {
-
- if (this.isNodeType(Constants.MIX_REFERENCEABLE))
- {
- try
- {
- return correspSession.getNodeByUUID(getUUID());
- }
- catch (ItemNotFoundException e)
- {
- }
- }
- else
- {
- for (int i = getDepth(); i >= 0; i--)
- {
- NodeImpl ancestor = (NodeImpl)getAncestor(i);
- if (ancestor.isNodeType(Constants.MIX_REFERENCEABLE))
- {
- NodeImpl correspAncestor = (NodeImpl)correspSession.getNodeByUUID(ancestor.getUUID());
- JCRPath.PathElement[] relJCRPath = getLocation().getRelPath(getDepth() - i);
- try
- {
- return correspAncestor.getNode(getRelPath(relJCRPath));
- }
- catch (ItemNotFoundException e)
- {
- }
- }
- }
- }
- try
- {
- return (NodeImpl)correspSession.getItem(getPath());
- }
- catch (PathNotFoundException e)
- {
- throw new ItemNotFoundException("No corresponding path for " + getPath() + " in "
- + correspSession.getWorkspace().getName());
- }
- }
-
- /**
* Return Node corresponding to this Node.
*
* @param correspSession
@@ -1749,11 +1655,15 @@
// Check if versionable ancestor is not checked-in
if (!checkedOut())
+ {
throw new VersionException("Node " + getPath() + " or its nearest ancestor is checked-in");
+ }
// Check locking
if (!checkLocking())
+ {
throw new LockException("Node " + getPath() + " is locked ");
+ }
session.getActionHandler().preRemoveMixin(this, name);
@@ -1769,11 +1679,15 @@
// remove mix:versionable stuff
if (ntmanager.isNodeType(Constants.MIX_VERSIONABLE, removedName))
+ {
removeVersionable();
+ }
// remove mix:lockable stuff
if (ntmanager.isNodeType(Constants.MIX_LOCKABLE, removedName))
+ {
removeLockable();
+ }
// Set mixin property and locally
updateMixin(newMixin);
@@ -1819,7 +1733,6 @@
*/
public void removePermission(String identity) throws RepositoryException, AccessControlException
{
-
if (!isNodeType(Constants.EXO_PRIVILEGEABLE))
throw new AccessControlException("Node is not exo:privilegeable " + getPath());
@@ -2640,11 +2553,15 @@
PropertyData existed = (PropertyData)dataManager.getItemData(nodeData(), new QPathEntry(name, 0));
if (existed == null)
+ {
throw new RepositoryException("Property data is not found " + name.getAsString() + " for node "
+ nodeData().getQPath().getAsString());
+ }
if (!existed.isMultiValued())
+ {
throw new ValueFormatException("An existed property is single-valued " + name.getAsString());
+ }
TransientPropertyData tdata =
new TransientPropertyData(QPath.makeChildPath(getInternalPath(), name), existed.getIdentifier(), existed
@@ -2710,40 +2627,42 @@
{
EntityCollection res = new EntityCollection();
-
TransientPropertyData mergeFailed =
(TransientPropertyData)dataManager.getItemData(nodeData(), new QPathEntry(Constants.JCR_MERGEFAILED, 0));
- List<ValueData> mergeFailedRefs = null;
+ List<ValueData> mergeFailedRefs = new ArrayList<ValueData>();
int state = 0;
- if (mergeFailed != null)
+ try
{
- mergeFailed =
- new TransientPropertyData(mergeFailed.getQPath(), mergeFailed.getIdentifier(), mergeFailed
- .getPersistedVersion(), mergeFailed.getType(), mergeFailed.getParentIdentifier(), mergeFailed
- .isMultiValued(), mergeFailed.getValues());
+ if (mergeFailed != null)
+ {
+ for (ValueData mfvd : mergeFailed.getValues())
+ {
+ mergeFailedRefs.add(new TransientValueData(mfvd.getAsByteArray()));
+ }
- mergeFailedRefs = mergeFailed.getValues();
- state = ItemState.UPDATED;
- }
- else
- {
- mergeFailedRefs = new ArrayList<ValueData>();
- mergeFailed =
- TransientPropertyData.createPropertyData((NodeData)getData(), Constants.JCR_MERGEFAILED,
- PropertyType.REFERENCE, true, mergeFailedRefs);
- state = ItemState.ADDED;
- }
+ mergeFailed =
+ new TransientPropertyData(mergeFailed.getQPath(), mergeFailed.getIdentifier(), mergeFailed
+ .getPersistedVersion(), mergeFailed.getType(), mergeFailed.getParentIdentifier(), mergeFailed
+ .isMultiValued(), mergeFailedRefs);
- nextFail : for (String identifier : failed.keySet())
- {
- NodeImpl versionable = (NodeImpl)session.getNodeByUUID(identifier);
- res.add(versionable);
- String offendingIdentifier = failed.get(identifier);
+ state = ItemState.UPDATED;
+ }
+ else
+ {
+ mergeFailed =
+ TransientPropertyData.createPropertyData((NodeData)getData(), Constants.JCR_MERGEFAILED,
+ PropertyType.REFERENCE, true, mergeFailedRefs);
+ state = ItemState.ADDED;
+ }
- for (ValueData vd : mergeFailedRefs)
+ nextFail : for (String identifier : failed.keySet())
{
- try
+ NodeImpl versionable = (NodeImpl)session.getNodeByUUID(identifier);
+ res.add(versionable);
+ String offendingIdentifier = failed.get(identifier);
+
+ for (ValueData vd : mergeFailedRefs)
{
String mfIdentifier = new String(vd.getAsByteArray());
if (mfIdentifier.equals(offendingIdentifier))
@@ -2752,18 +2671,19 @@
continue nextFail;
}
}
- catch (IOException e)
- {
- throw new RepositoryException("jcr:mergeFailed read error " + e, e);
- }
+
+ mergeFailedRefs.add(new TransientValueData(offendingIdentifier));
}
- mergeFailedRefs.add(new TransientValueData(offendingIdentifier));
- }
+ changes.add(new ItemState(mergeFailed, state, true, getInternalPath(), true));
- changes.add(new ItemState(mergeFailed, state, true, getInternalPath(), true));
+ return res;
- return res;
+ }
+ catch (IOException e)
+ {
+ throw new RepositoryException("jcr:mergeFailed read error " + e, e);
+ }
}
// ----------------------------- ExtendedNode -----------------------------
@@ -2818,33 +2738,6 @@
}
- // old impl
- @Deprecated
- private int getNextChildIndex(InternalQName nameToAdd, List<NodeData> siblings, NodeData parentNode)
- throws RepositoryException, ItemExistsException
- {
-
- int ind = 0;
- for (NodeData sibling : siblings)
- {
- if (sibling.getQPath().getName().equals(nameToAdd))
- {
- NodeDefinitionData def =
- session.getWorkspace().getNodeTypesHolder().getChildNodeDefinition(nameToAdd,
- parentNode.getPrimaryTypeName(), parentNode.getMixinTypeNames());
- if (LOG.isDebugEnabled())
- LOG.debug("Calculate index for " + nameToAdd + " " + sibling.getQPath().getAsString());
-
- if (def.isAllowsSameNameSiblings())
- ind++;
- else
- throw new ItemExistsException("The node " + nameToAdd + " already exists in " + getPath()
- + " and same name sibling is not allowed ");
- }
- }
- return ind + 1;
- }
-
private NodeImpl doAddNode(NodeImpl parentNode, InternalQName name, InternalQName primaryTypeName)
throws ItemExistsException, RepositoryException, ConstraintViolationException, VersionException, LockException
{
@@ -2892,23 +2785,6 @@
return node;
}
- private int getOrderNumber()
- {
- return nodeData().getOrderNumber();
- }
-
- private String getRelPath(JCRPath.PathElement[] relPath)
- {
- String path = "";
- for (int i = 0; i < relPath.length; i++)
- {
- path += relPath[i].getAsString(false);
- if (i < relPath.length - 1)
- path += "/";
- }
- return path;
- }
-
private boolean hasProperty(InternalQName name)
{
try
@@ -2938,9 +2814,11 @@
{
try
{
- String mfIdentifier = new String(mfvd.getAsByteArray());
- if (!mfIdentifier.equals(version.getUUID()))
- mf.add(mfvd);
+ byte[] mfb = mfvd.getAsByteArray();
+ if (!version.getUUID().equals(new String(mfb)))
+ {
+ mf.add(new TransientValueData(mfb));
+ }
}
catch (IOException e)
{
@@ -3001,8 +2879,7 @@
List<AccessControlEntry> aces = acl.getPermissionEntries(); // new
for (AccessControlEntry ace : aces)
{
- ValueData vd = new TransientValueData(ace);
- permValues.add(vd);
+ permValues.add(new TransientValueData(ace));
}
PropertyData permProp =
@@ -3027,60 +2904,6 @@
// ===================== helpers =====================
- private static class NodesOrderComparator implements Comparator<NodeImpl>
- {
- public int compare(NodeImpl n1, NodeImpl n2)
- {
- return n1.getOrderNumber() - n2.getOrderNumber();
- }
- }
-
- private static class PropertiesOrderComparator implements Comparator<PropertyImpl>
- {
- public int compare(PropertyImpl p1, PropertyImpl p2)
- {
- int r = 0;
- try
- {
- InternalQName qname1 = p1.getLocation().getName().getInternalName();
- InternalQName qname2 = p2.getLocation().getName().getInternalName();
- if (qname1.equals(Constants.JCR_PRIMARYTYPE))
- {
- r = Integer.MIN_VALUE;
- }
- else if (qname2.equals(Constants.JCR_PRIMARYTYPE))
- {
- r = Integer.MAX_VALUE;
- }
- else if (qname1.equals(Constants.JCR_MIXINTYPES))
- {
- r = Integer.MIN_VALUE + 1;
- }
- else if (qname2.equals(Constants.JCR_MIXINTYPES))
- {
- r = Integer.MAX_VALUE - 1;
- }
- else if (qname1.equals(Constants.JCR_UUID))
- {
- r = Integer.MIN_VALUE + 2;
- }
- else if (qname2.equals(Constants.JCR_UUID))
- {
- r = Integer.MAX_VALUE - 2;
- }
- else
- {
- r = qname1.getAsString().compareTo(qname2.getAsString());
- }
- }
- catch (Exception e)
- {
- LOG.error("PropertiesOrderComparator error: " + e, e);
- }
- return r;
- }
- }
-
private static class PropertiesDataOrderComparator<P extends PropertyData> implements Comparator<P>
{
public int compare(P p1, P p2)
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/PropertyImpl.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/PropertyImpl.java 2010-01-22 12:17:25 UTC (rev 1542)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/PropertyImpl.java 2010-01-22 12:31:29 UTC (rev 1543)
@@ -128,22 +128,6 @@
/**
* {@inheritDoc}
*/
- @Deprecated
- void loadData(ItemData data, ItemDefinitionData itemDefinitionData) throws RepositoryException,
- ConstraintViolationException
- {
- this.data = data;
- this.propertyData = (PropertyData)data;
- this.type = propertyData.getType();
-
- this.location = null;
- this.qpath = data.getQPath();
- this.propertyDef = (PropertyDefinitionData)itemDefinitionData;
- }
-
- /**
- * {@inheritDoc}
- */
public ItemDefinitionData getItemDefinitionData()
{
return propertyDef;
@@ -337,10 +321,6 @@
throw new RepositoryException("FATAL: property definition is NULL " + getPath() + " "
+ propertyData.getValues());
}
- String name =
- locationFactory.createJCRName(propertyDef.getName() != null ? propertyDef.getName() : Constants.JCR_ANY_NAME)
- .getAsString();
- ExtendedNodeTypeManager nodeTypeManager = (ExtendedNodeTypeManager)session.getWorkspace().getNodeTypeManager();
Value[] defaultValues = new Value[propertyDef.getDefaultValues().length];
String[] propVal = propertyDef.getDefaultValues();
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/jbosscache/CacheableLockManager.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/jbosscache/CacheableLockManager.java 2010-01-22 12:17:25 UTC (rev 1542)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/jbosscache/CacheableLockManager.java 2010-01-22 12:31:29 UTC (rev 1543)
@@ -163,7 +163,7 @@
* The current Transaction Manager
*/
private TransactionManager tm;
-
+
private Cache<Serializable, Object> cache;
private final Fqn<String> lockRoot;
@@ -324,7 +324,7 @@
return cache.getChildrenNames(lockRoot).size();
}
};
-
+
@Managed
@ManagedDescription("The number of active locks")
public int getNumLocks()
@@ -360,9 +360,9 @@
}
return false;
- }
+ }
};
-
+
/**
* Check is LockManager contains lock. No matter it is in pending or persistent state.
*
@@ -378,7 +378,7 @@
catch (LockException e)
{
// ignore me will never occur
- }
+ }
return false;
}
@@ -489,7 +489,7 @@
log.error(e.getLocalizedMessage(), e);
}
}
-
+
// sort locking and unlocking operations to avoid deadlocks in JBossCache
Collections.sort(containers);
for (LockOperationContainer container : containers)
@@ -586,7 +586,7 @@
return null;
}
};
-
+
/**
* Refreshed lock data in cache
*
@@ -656,9 +656,10 @@
*/
private TransientItemData copyItemData(PropertyData prop) throws RepositoryException
{
-
if (prop == null)
+ {
return null;
+ }
// make a copy, value may be null for deleting items
TransientPropertyData newData =
@@ -730,7 +731,7 @@
return cache.getRoot().hasChild(makeLockFqn(nodeId));
}
};
-
+
private boolean lockExist(String nodeId)
{
try
@@ -835,7 +836,7 @@
return (LockData)cache.get(makeLockFqn(nodeId), LOCK_DATA);
}
};
-
+
protected LockData getLockDataById(String nodeId)
{
try
@@ -849,25 +850,26 @@
return null;
}
- private final LockActionNonTxAware<List<LockData>, Object> getLockList = new LockActionNonTxAware<List<LockData>, Object>()
- {
- public List<LockData> execute(Object arg) throws LockException
+ private final LockActionNonTxAware<List<LockData>, Object> getLockList =
+ new LockActionNonTxAware<List<LockData>, Object>()
{
- Set<Object> nodesId = cache.getChildrenNames(lockRoot);
+ public List<LockData> execute(Object arg) throws LockException
+ {
+ Set<Object> nodesId = cache.getChildrenNames(lockRoot);
- List<LockData> locksData = new ArrayList<LockData>();
- for (Object nodeId : nodesId)
- {
- LockData lockData = (LockData)cache.get(makeLockFqn((String)nodeId), LOCK_DATA);
- if (lockData != null)
+ List<LockData> locksData = new ArrayList<LockData>();
+ for (Object nodeId : nodesId)
{
- locksData.add(lockData);
+ LockData lockData = (LockData)cache.get(makeLockFqn((String)nodeId), LOCK_DATA);
+ if (lockData != null)
+ {
+ locksData.add(lockData);
+ }
}
+ return locksData;
}
- return locksData;
- }
- };
-
+ };
+
protected synchronized List<LockData> getLockList()
{
try
@@ -928,9 +930,11 @@
// lock probably removed by other thread
if (lockOwner == null && lockIsDeep == null)
+ {
return;
+ }
+
dataManager.save(new TransactionChangesLog(changesLog));
-
}
catch (JCRInvalidItemStateException e)
{
@@ -982,7 +986,7 @@
}
node.setResident(true);
}
-
+
/**
* Execute the given action outside a transaction. This is needed since the {@link Cache} used by {@link CacheableLockManager}
* manages the persistence of its locks thanks to a {@link CacheLoader} and a {@link CacheLoader} lock the JBoss cache {@link Node}
@@ -1020,9 +1024,9 @@
log.warn("Cannot resume the current transaction", e);
}
}
- }
+ }
}
-
+
/**
* Actions that are not supposed to be called within a transaction
*
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/nodetype/registration/AbstractItemDefinitionAccessProvider.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/nodetype/registration/AbstractItemDefinitionAccessProvider.java 2010-01-22 12:17:25 UTC (rev 1542)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/nodetype/registration/AbstractItemDefinitionAccessProvider.java 2010-01-22 12:31:29 UTC (rev 1543)
@@ -362,7 +362,9 @@
{
List<ValueData> parents = new ArrayList<ValueData>();
for (InternalQName nt : value)
+ {
parents.add(new TransientValueData(nt));
+ }
TransientPropertyData propertyData =
TransientPropertyData.createPropertyData(parentNode, propertyName, PropertyType.NAME, true, parents);
@@ -385,7 +387,9 @@
for (String vc : value)
{
if (vc != null)
+ {
valueDatas.add(new TransientValueData(vc));
+ }
}
TransientPropertyData propertyData =
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/nodetype/registration/PropertyDefinitionAccessProvider.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/nodetype/registration/PropertyDefinitionAccessProvider.java 2010-01-22 12:17:25 UTC (rev 1542)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/nodetype/registration/PropertyDefinitionAccessProvider.java 2010-01-22 12:31:29 UTC (rev 1543)
@@ -35,7 +35,7 @@
* Created by The eXo Platform SAS.
*
* @author <a href="mailto:Sergey.Kabashnyuk at gmail.com">Sergey Kabashnyuk</a>
- * @version $Id: $
+ * @version $Id$
*/
public class PropertyDefinitionAccessProvider extends AbstractItemDefinitionAccessProvider
{
@@ -43,16 +43,13 @@
public PropertyDefinitionAccessProvider(DataManager dataManager)
{
super(dataManager);
-
}
public PropertyDefinitionData read(NodeData nodeData, InternalQName declaringNodeType) throws NodeTypeReadException,
RepositoryException
-
{
if (Constants.NT_PROPERTYDEFINITION.equals(nodeData.getPrimaryTypeName()))
{
-
// null if residual;
InternalQName name = readName(nodeData, Constants.JCR_NAME);
boolean protectedItem = readMandatoryBoolean(nodeData, Constants.JCR_PROTECTED);
@@ -66,10 +63,10 @@
boolean multiple = readMandatoryBoolean(nodeData, Constants.JCR_MULTIPLE);
- //3 Query atributes
-// boolean isQueryOrderable = readMandatoryBoolean(nodeData, Constants.JCR_QUERYORDERABLE);
-// String[] availableQueryOperators = readMandatoryStrings(nodeData, Constants.JCR_AVAILABLEQUERYOPERATORS);
-// boolean isFullTextSearchable = readMandatoryBoolean(nodeData, Constants.JCR_ISFULLTEXTSEARCHABLE);
+ // TODO 3 Query atributes
+ // boolean isQueryOrderable = readMandatoryBoolean(nodeData, Constants.JCR_QUERYORDERABLE);
+ // String[] availableQueryOperators = readMandatoryStrings(nodeData, Constants.JCR_AVAILABLEQUERYOPERATORS);
+ // boolean isFullTextSearchable = readMandatoryBoolean(nodeData, Constants.JCR_ISFULLTEXTSEARCHABLE);
String[] valueConstraints = readStrings(nodeData, Constants.JCR_VALUECONSTRAINTS);
String[] defaultValues = readStrings(nodeData, Constants.JCR_DEFAULTVALUES);
@@ -83,7 +80,6 @@
public void write(PlainChangesLog changesLog, NodeData declaredNodeType,
PropertyDefinitionData propertyDefinitionData, int index)
{
-
NodeData propertyDefinition =
TransientNodeData.createNodeData(declaredNodeType, Constants.JCR_PROPERTYDEFINITION,
Constants.NT_PROPERTYDEFINITION, index);
@@ -98,13 +94,13 @@
writeBoolean(changesLog, propertyDefinition, Constants.JCR_MULTIPLE, propertyDefinitionData.isMultiple());
- //3 Query atributes
-// writeBoolean(changesLog, propertyDefinition, Constants.JCR_QUERYORDERABLE, propertyDefinitionData
-// .isQueryOrderable());
-// writeStrings(changesLog, propertyDefinition, Constants.JCR_AVAILABLEQUERYOPERATORS, propertyDefinitionData
-// .getAvailableQueryOperators());
-// writeBoolean(changesLog, propertyDefinition, Constants.JCR_ISFULLTEXTSEARCHABLE, propertyDefinitionData
-// .isFullTextSearchable());
+ //TODO 3 Query atributes
+ // writeBoolean(changesLog, propertyDefinition, Constants.JCR_QUERYORDERABLE, propertyDefinitionData
+ // .isQueryOrderable());
+ // writeStrings(changesLog, propertyDefinition, Constants.JCR_AVAILABLEQUERYOPERATORS, propertyDefinitionData
+ // .getAvailableQueryOperators());
+ // writeBoolean(changesLog, propertyDefinition, Constants.JCR_ISFULLTEXTSEARCHABLE, propertyDefinitionData
+ // .isFullTextSearchable());
if (propertyDefinitionData.getValueConstraints() != null
&& propertyDefinitionData.getValueConstraints().length != 0)
@@ -119,8 +115,6 @@
writeStrings(changesLog, propertyDefinition, Constants.JCR_DEFAULTVALUES, propertyDefinitionData
.getDefaultValues());
-
}
}
-
}
Property changes on: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/nodetype/registration/PropertyDefinitionAccessProvider.java
___________________________________________________________________
Name: svn:keywords
+ Id
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/value/BaseValue.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/value/BaseValue.java 2010-01-22 12:17:25 UTC (rev 1542)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/value/BaseValue.java 2010-01-22 12:31:29 UTC (rev 1543)
@@ -358,7 +358,7 @@
}
else
{
- // TODO by stream... not equals
+ // by stream... not equals
return false;
}
}
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/version/VersionHistoryImpl.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/version/VersionHistoryImpl.java 2010-01-22 12:17:25 UTC (rev 1542)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/version/VersionHistoryImpl.java 2010-01-22 12:31:29 UTC (rev 1543)
@@ -569,25 +569,28 @@
List<ValueData> predecessors =
((PropertyData)dataManager.getItemData(versionableNodeData, new QPathEntry(Constants.JCR_PREDECESSORS, 0)))
.getValues();
+ List<ValueData> predecessorsNew = new ArrayList<ValueData>();
for (ValueData predecessorValue : predecessors)
{
- String predecessorIdentifier;
+ byte[] pib;
try
{
- predecessorIdentifier = new String(predecessorValue.getAsByteArray());
+ pib = predecessorValue.getAsByteArray();
}
catch (IOException e)
{
throw new RepositoryException(e);
}
- VersionImpl predecessor = (VersionImpl)dataManager.getItemByIdentifier(predecessorIdentifier, false);
+ VersionImpl predecessor = (VersionImpl)dataManager.getItemByIdentifier(new String(pib), false);
predecessor.addSuccessor(versionData.getIdentifier(), changesLog);
+
+ predecessorsNew.add(new TransientValueData(pib));
}
// jcr:predecessors
propData =
TransientPropertyData.createPropertyData(versionData, Constants.JCR_PREDECESSORS, PropertyType.REFERENCE,
- true, predecessors);
+ true, predecessorsNew);
changesLog.add(ItemState.createAddedState(propData));
// jcr:frozenNode
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/version/VersionImpl.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/version/VersionImpl.java 2010-01-22 12:17:25 UTC (rev 1542)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/version/VersionImpl.java 2010-01-22 12:31:29 UTC (rev 1543)
@@ -53,7 +53,6 @@
* @author Gennady Azarenkov
* @version $Id: VersionImpl.java 12311 2008-03-24 12:30:51Z pnedonosko $
*/
-
public class VersionImpl extends VersionStorageDescendantNode implements Version
{
@@ -67,8 +66,8 @@
}
}
+ /* needed for VersionHistoryImpl.removeVersion */
@Override
- /* needed for VersionHistoryImpl.removeVersion */
protected void invalidate()
{
super.invalidate();
@@ -142,7 +141,9 @@
(PropertyData)dataManager.getItemData(nodeData(), new QPathEntry(Constants.JCR_PREDECESSORS, 0));
if (predecessorsData == null)
+ {
return new Version[0];
+ }
List<ValueData> predecessorsValues = predecessorsData.getValues();
Version[] predecessors = new Version[predecessorsValues.size()];
@@ -154,10 +155,14 @@
String videntifier = new String(predecessorsValues.get(i).getAsByteArray());
VersionImpl version = (VersionImpl)dataManager.getItemByIdentifier(videntifier, false);
if (version != null)
+ {
predecessors[i] = version;
+ }
else
+ {
throw new RepositoryException("Predecessor version is not found " + videntifier + ", this version "
+ getPath());
+ }
}
}
catch (IOException e)
@@ -189,10 +194,18 @@
{
// add successor
List<ValueData> newSuccessorsValue = new ArrayList<ValueData>();
- for (ValueData svd : successorsProp.getValues())
+ try
{
- newSuccessorsValue.add(svd);
+ for (ValueData svd : successorsProp.getValues())
+ {
+ newSuccessorsValue.add(new TransientValueData(svd.getAsByteArray()));
+ }
}
+ catch (IOException e)
+ {
+ throw new RepositoryException("jcr:successors read error " + e, e);
+ }
+
newSuccessorsValue.add(successorRef);
TransientPropertyData newSuccessorsProp =
@@ -224,10 +237,18 @@
{
// add predeccessor
List<ValueData> newPredeccessorValue = new ArrayList<ValueData>();
- for (ValueData svd : predeccessorsProp.getValues())
+ try
{
- newPredeccessorValue.add(svd);
+ for (ValueData svd : predeccessorsProp.getValues())
+ {
+ newPredeccessorValue.add(new TransientValueData(svd.getAsByteArray()));
+ }
}
+ catch (IOException e)
+ {
+ throw new RepositoryException("jcr:predecessors read error " + e, e);
+ }
+
newPredeccessorValue.add(predeccessorRef);
TransientPropertyData newPredeccessorsProp =
@@ -251,9 +272,10 @@
{
for (ValueData sdata : successorsProp.getValues())
{
- if (!successorIdentifier.equals(new String(sdata.getAsByteArray())))
+ byte[] sb = sdata.getAsByteArray();
+ if (!successorIdentifier.equals(new String(sb)))
{
- newSuccessors.add(sdata);
+ newSuccessors.add(new TransientValueData(sb));
}
}
}
@@ -290,9 +312,10 @@
{
for (ValueData sdata : successorsProp.getValues())
{
- if (!removedSuccessorIdentifier.equals(new String(sdata.getAsByteArray())))
+ byte[] sb = sdata.getAsByteArray();
+ if (!removedSuccessorIdentifier.equals(new String(sb)))
{
- newSuccessors.add(sdata);
+ newSuccessors.add(new TransientValueData(sb));
}
}
}
@@ -329,9 +352,10 @@
{
for (ValueData sdata : predeccessorsProp.getValues())
{
- if (!predecessorIdentifier.equals(new String(sdata.getAsByteArray())))
+ byte[] sb = sdata.getAsByteArray();
+ if (!predecessorIdentifier.equals(new String(sb)))
{
- newPredeccessors.add(sdata);
+ newPredeccessors.add(new TransientValueData(sb));
}
}
}
@@ -368,9 +392,10 @@
{
for (ValueData sdata : predeccessorsProp.getValues())
{
- if (!removedPredecessorIdentifier.equals(new String(sdata.getAsByteArray())))
+ byte[] sb = sdata.getAsByteArray();
+ if (!removedPredecessorIdentifier.equals(new String(sb)))
{
- newPredeccessors.add(sdata);
+ newPredeccessors.add(new TransientValueData(sb));
}
}
}
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/AbstractPersistedValueData.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/AbstractPersistedValueData.java 2010-01-22 12:17:25 UTC (rev 1542)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/AbstractPersistedValueData.java 2010-01-22 12:31:29 UTC (rev 1543)
@@ -70,7 +70,7 @@
}
/**
- * Create transient copy of persisted data.
+ * Create transient copy of persisted data. Used for LocalWorkspaceStorageDataManagerProxy only.
*
* @return TransientValueData
* @throws RepositoryException if error ocurs
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/EditableValueData.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/EditableValueData.java 2010-01-22 12:17:25 UTC (rev 1542)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/EditableValueData.java 2010-01-22 12:31:29 UTC (rev 1543)
@@ -501,12 +501,9 @@
public EditableValueData(byte[] bytes, int orderNumber, FileCleaner fileCleaner, int maxBufferSize,
File tempDirectory) throws IOException
{
-
this.delegate = new NewEditableValueData(bytes, orderNumber, fileCleaner, maxBufferSize, tempDirectory);
-
}
- //TODO use InputStream instead of spoolFile and use Channel.transferFrom.
public EditableValueData(File spoolFile, int orderNumber, FileCleaner fileCleaner, int maxBufferSize,
File tempDirectory) throws IOException
{
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/TransientValueData.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/TransientValueData.java 2010-01-22 12:17:25 UTC (rev 1542)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/TransientValueData.java 2010-01-22 12:31:29 UTC (rev 1543)
@@ -257,7 +257,6 @@
public long getLength()
{
// TODO try ask on FileChannel (via FileInputStream if have such stream).
-
if (isByteArrayAfterSpool())
{
return data.length;
@@ -359,7 +358,7 @@
MappedByteBuffer bb = spoolChannel.map(FileChannel.MapMode.READ_ONLY, position, length);
- WritableByteChannel ch = Channels.newChannel(stream); // TODO don't use Channels.newChannel
+ WritableByteChannel ch = Channels.newChannel(stream); // TODO don't use Channels.newChannel on java5
ch.write(bb);
ch.close();
@@ -656,8 +655,7 @@
try
{
- //TODO do refactor of work with NIO
-
+ //TODO do refactor of work with NIO and java6
ByteBuffer bb = ByteBuffer.allocate((int)fch.size());
fch.read(bb);
if (bb.hasArray())
@@ -834,6 +832,16 @@
/**
* Creates TransientValueData with incoming byte array.
+ * @param value
+ * byte[]
+ */
+ public TransientValueData(byte[] value)
+ {
+ this(0, value);
+ }
+
+ /**
+ * Creates TransientValueData with incoming byte array.
* @param orderNumber
* int
* @param value
@@ -1101,8 +1109,7 @@
* @param orderNumber
* int
*/
- // TODO make it protected
- TransientValueData()
+ protected TransientValueData()
{
}
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/FilePersistedValueData.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/FilePersistedValueData.java 2010-01-22 12:17:25 UTC (rev 1542)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/FilePersistedValueData.java 2010-01-22 12:31:29 UTC (rev 1543)
@@ -197,8 +197,7 @@
*/
private byte[] fileToByteArray() throws IOException
{
- // TODO do refactor of work with NIO
-
+ // TODO do refactor of work with NIO and java6
FileChannel fch = new FileInputStream(file).getChannel();
try
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/xml/importing/DocumentViewImporter.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/xml/importing/DocumentViewImporter.java 2010-01-22 12:17:25 UTC (rev 1542)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/xml/importing/DocumentViewImporter.java 2010-01-22 12:31:29 UTC (rev 1543)
@@ -181,7 +181,6 @@
public void startElement(String namespaceURI, String localName, String qName, Map<String, String> atts)
throws RepositoryException
{
-
String nodeName = ISO9075.decode(qName);
if ("jcr:root".equals(nodeName))
@@ -240,18 +239,14 @@
}
newProperty = endPrimaryType(nodeData.getPrimaryTypeName());
-
}
else if (propName.equals(Constants.JCR_MIXINTYPES))
{
-
newProperty = endMixinTypes(mixinNodeTypes, propName);
-
}
else if (nodeData.isMixReferenceable() && propName.equals(Constants.JCR_UUID))
{
newProperty = endUuid(nodeData, propName);
-
}
else
{
@@ -268,7 +263,6 @@
continue;
}
throw new RepositoryException("Property definition not found for " + propName.getAsString());
-
}
pDef = defs.getAnyDefinition();
@@ -281,7 +275,6 @@
if (pDef.getRequiredType() == PropertyType.BINARY)
{
newProperty = endBinary(propertiesMap, newProperty, propName);
-
}
else
{
@@ -292,7 +285,6 @@
if ("".equals(propertiesMap.get(propName)))
{
-
// Skip empty non string values
if (pType != PropertyType.STRING)
{
More information about the exo-jcr-commits
mailing list