jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ste...@apache.org
Subject svn commit: r106895 - in incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core: . nodetype state state/obj state/tx state/xml version virtual
Date Mon, 29 Nov 2004 08:37:46 GMT
Author: stefan
Date: Mon Nov 29 00:37:44 2004
New Revision: 106895

URL: http://svn.apache.org/viewcvs?view=rev&rev=106895
Log:
- added 'multiValued' flag to ProperyState
- misc. minor fixes and java doc corrections
Modified:
   incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/ItemManager.java
   incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/NodeImpl.java
   incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/PropertyImpl.java
   incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/WorkspaceImpl.java
   incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/nodetype/NodeTypeRegistry.java
   incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/state/PersistentItemStateManager.java
   incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/state/PropertyState.java
   incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/state/obj/ObjectPersistenceManager.java
   incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/state/tx/DefaultTransactionalStore.java
   incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/state/tx/TransactionImpl.java
   incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/state/xml/XMLPersistenceManager.java
   incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/version/PersistentNode.java
   incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/virtual/DefaultItemStateProvider.java

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/ItemManager.java
Url: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/ItemManager.java?view=diff&rev=106895&p1=incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/ItemManager.java&r1=106894&p2=incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/ItemManager.java&r2=106895
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/ItemManager.java	(original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/ItemManager.java	Mon Nov
29 00:37:44 2004
@@ -17,6 +17,8 @@
 
 import org.apache.commons.collections.ReferenceMap;
 import org.apache.jackrabbit.core.nodetype.NodeTypeRegistry;
+import org.apache.jackrabbit.core.nodetype.PropDefId;
+import org.apache.jackrabbit.core.nodetype.NodeDefId;
 import org.apache.jackrabbit.core.state.*;
 import org.apache.log4j.Logger;
 
@@ -143,6 +145,38 @@
         itemCache.clear();
     }
 
+    private NodeDef getDefinition(NodeState state)
+            throws RepositoryException {
+        NodeDefId defId = state.getDefinitionId();
+        NodeDef def = session.getNodeTypeManager().getNodeDef(defId);
+        if (def == null) {
+            log.warn("node at " + safeGetJCRPath(state.getId()) + " has invalid definitionId
(" + defId + ")");
+
+            // fallback: try finding applicable definition
+            NodeId parentId = new NodeId(state.getParentUUID());
+            NodeImpl parent = (NodeImpl) getItem(parentId);
+            NodeState parentState = (NodeState) parent.getItemState();
+            NodeState.ChildNodeEntry cne = (NodeState.ChildNodeEntry) parentState.getChildNodeEntries(state.getUUID()).get(0);
+            def = parent.getApplicableChildNodeDef(cne.getName(), state.getNodeTypeName());
+        }
+        return def;
+    }
+
+    private PropertyDef getDefinition(PropertyState state)
+            throws RepositoryException {
+        PropDefId defId = state.getDefinitionId();
+        PropertyDef def = session.getNodeTypeManager().getPropDef(defId);
+        if (def == null) {
+            log.warn("property at " + safeGetJCRPath(state.getId()) + " has invalid definitionId
(" + defId + ")");
+
+            // fallback: try finding applicable definition
+            NodeId parentId = new NodeId(state.getParentUUID());
+            NodeImpl parent = (NodeImpl) getItem(parentId);
+            def = parent.getApplicablePropertyDef(state.getName(), state.getType(), state.isMultiValued());
+        }
+        return def;
+    }
+
     //--------------------------------------------------< item access methods >
     /**
      * Checks if the item with the given path exists.
@@ -550,8 +584,7 @@
         // in order to maintain item cache consistency
         ItemLifeCycleListener[] listeners = new ItemLifeCycleListener[]{this};
 
-
-        // check spezial nodes
+        // check special nodes
         if (state.getNodeTypeName().equals(NodeTypeRegistry.NT_VERSION)) {
             return session.versionMgr.createVersionInstance(session, state, def, this, listeners);
         } else if (state.getNodeTypeName().equals(NodeTypeRegistry.NT_VERSION_HISTORY)) {
@@ -565,12 +598,7 @@
 
     NodeImpl createNodeInstance(NodeState state) throws RepositoryException {
         // 1. get definition of the specified node
-        NodeDef def = session.getNodeTypeManager().getNodeDef(state.getDefinitionId());
-        if (def == null) {
-            String msg = "internal error: no definition found for node " + safeGetJCRPath(state.getId());
-            log.error(msg);
-            throw new RepositoryException(msg);
-        }
+        NodeDef def = getDefinition(state);
         // 2. create instance
         return createNodeInstance(state, def);
     }
@@ -587,12 +615,7 @@
 
     PropertyImpl createPropertyInstance(PropertyState state) throws RepositoryException {
         // 1. get definition for the specified property
-        PropertyDef def = session.getNodeTypeManager().getPropDef(state.getDefinitionId());
-        if (def == null) {
-            String msg = "internal error: no definition found for property " + safeGetJCRPath(state.getId());
-            log.error(msg);
-            throw new RepositoryException(msg);
-        }
+        PropertyDef def = getDefinition(state);
         // 2. create instance
         return createPropertyInstance(state, def);
     }

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/NodeImpl.java
Url: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/NodeImpl.java?view=diff&rev=106895&p1=incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/NodeImpl.java&r1=106894&p2=incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/NodeImpl.java&r2=106895
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/NodeImpl.java	(original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/NodeImpl.java	Mon Nov 29
00:37:44 2004
@@ -222,6 +222,7 @@
         try {
             propState = itemStateMgr.createTransientPropertyState(parentUUID, name, ItemState.STATUS_NEW);
             propState.setType(type);
+            propState.setMultiValued(def.isMultiple());
             propState.setDefinitionId(new PropDefId(def.unwrap()));
             // compute system generated values if necessary
             InternalValue[] genValues = computeSystemGeneratedPropertyValues(name, def);

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/PropertyImpl.java
Url: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/PropertyImpl.java?view=diff&rev=106895&p1=incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/PropertyImpl.java&r1=106894&p2=incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/PropertyImpl.java&r2=106895
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/PropertyImpl.java	(original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/PropertyImpl.java	Mon Nov
29 00:37:44 2004
@@ -98,6 +98,7 @@
             // copy state from transient state
             persistentState.setDefinitionId(transientState.getDefinitionId());
             persistentState.setType(transientState.getType());
+            persistentState.setMultiValued(transientState.isMultiValued());
             persistentState.setValues(transientState.getValues());
             // make state persistent
             persistentState.store();

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/WorkspaceImpl.java
Url: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/WorkspaceImpl.java?view=diff&rev=106895&p1=incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/WorkspaceImpl.java&r1=106894&p2=incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/WorkspaceImpl.java&r2=106895
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/WorkspaceImpl.java	(original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/WorkspaceImpl.java	Mon
Nov 29 00:37:44 2004
@@ -506,6 +506,7 @@
             PropDefId defId = srcState.getDefinitionId();
             newState.setDefinitionId(defId);
             newState.setType(srcState.getType());
+            newState.setMultiValued(srcState.isMultiValued());
             InternalValue[] values = srcState.getValues();
             if (values != null) {
                 InternalValue[] newValues = new InternalValue[values.length];

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/nodetype/NodeTypeRegistry.java
Url: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/nodetype/NodeTypeRegistry.java?view=diff&rev=106895&p1=incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/nodetype/NodeTypeRegistry.java&r1=106894&p2=incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/nodetype/NodeTypeRegistry.java&r2=106895
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/nodetype/NodeTypeRegistry.java
(original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/nodetype/NodeTypeRegistry.java
Mon Nov 29 00:37:44 2004
@@ -32,6 +32,7 @@
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.PrintStream;
+import java.io.OutputStream;
 import java.util.*;
 
 /**
@@ -505,11 +506,32 @@
                 log.error(reason);
                 throw new InvalidNodeTypeDefException(reason);
             }
-            ValueConstraint[] constraints = pd.getValueConstraints();
+            /**
+             * check default values:
+             * make sure type of value is consistent with required property type
+             */
             InternalValue[] defVals = pd.getDefaultValues();
+            if (defVals != null && defVals.length != 0) {
+                int reqType = pd.getRequiredType();
+                for (int j = 0; j < defVals.length; j++) {
+                    if (reqType == PropertyType.UNDEFINED) {
+                        reqType = defVals[j].getType();
+                    } else {
+                        if (defVals[j].getType() != reqType) {
+                            String reason = "type of default value(s) is not consistent with
required property type";
+                            log.error(reason);
+                            throw new InvalidNodeTypeDefException(reason);
+                        }
+                    }
+                }
+            }
+            /**
+             * todo check that auto-created properties have have at least either default
values or system generated values
+             */
+            // check that default values satisfy value constraints
+            ValueConstraint[] constraints = pd.getValueConstraints();
             if (constraints != null && constraints.length != 0
                     && defVals != null && defVals.length != 0) {
-                // check that default values satisfy value constraints
                 for (int j = 0; j < constraints.length; j++) {
                     for (int k = 0; k < defVals.length; k++) {
                         try {
@@ -873,8 +895,8 @@
      * <li>Aggregation of supertypes must not result in name conflicts,
      * ambiguities, etc.</li>
      * <li>Definitions of auto-created properties must specify a name</li>
-     * <li>Default values in property definitions must satisfy value constrains
-     * in the same property child-node definition</li>
+     * <li>Default values in property definitions must satisfy value constraints
+     * specified in the same property definition</li>
      * <li>Definitions of auto-created child-nodes must specify a name</li>
      * <li>Default node type in child-node definitions must exist and be
      * registered</li>
@@ -884,13 +906,13 @@
      * node types which would lead to infinite child node creation
      * (e.g. node type 'A' defines auto-created child node with default
      * node type 'A' ...)</li>
-     * <li>Nodetypes specified as constraints in child-node definitions
+     * <li>Node types specified as constraints in child-node definitions
      * must exist and be registered</li>
      * <li>The aggregation of the node types specified as constraints in
      * child-node definitions must not result in name conflicts, ambiguities,
      * etc.</li>
      * <li>Default node types in child-node definitions must satisfy
-     * node type constraints in the same child-node definition</li>
+     * node type constraints specified in the same child-node definition</li>
      * </ul>
      *
      * @param ntd the definition of the new node type
@@ -904,8 +926,10 @@
         EffectiveNodeType ent = internalRegister(ntd);
         // persist new node type definition
         customNTDefs.add(ntd);
+        OutputStream out = null;
         try {
-            customNTDefs.store(customNodeTypesResource.getOutputStream(), nsReg);
+            out = customNodeTypesResource.getOutputStream();
+            customNTDefs.store(out, nsReg);
         } catch (IOException ioe) {
             String error = "internal error: failed to write custom node type definition to
" + customNodeTypesResource.getPath();
             log.error(error, ioe);
@@ -914,6 +938,14 @@
             String error = "internal error: failed to write custom node type definition to
" + customNodeTypesResource.getPath();
             log.error(error, fse);
             throw new RepositoryException(error, fse);
+        } finally {
+            if (out != null) {
+                try {
+                    out.close();
+                } catch (IOException ioe) {
+                    // ignore
+                }
+            }
         }
 
         // notify listeners
@@ -923,6 +955,92 @@
     }
 
     /**
+     * Same as <code>{@link #registerNodeType(NodeTypeDef)}</code> except
+     * that a collection of <code>NodeTypeDef</code>s is registered instead of
+     * just one.
+     * <p/>
+     * This method can be used to register a set of node types that have
+     * dependencies on each other.
+     * <p/>
+     * Note that in the case an exception is thrown, some node types might have
+     * been nevertheless successfully registered.
+     *
+     * @param ntDefs a collection of <code>NodeTypeDef<code>s
+     * @throws InvalidNodeTypeDefException
+     * @throws RepositoryException
+     */
+    public synchronized void registerNodeTypes(Collection ntDefs)
+            throws InvalidNodeTypeDefException, RepositoryException {
+        // exceptions that might be thrown by internalRegister(Collection)
+        RepositoryException re = null;
+        InvalidNodeTypeDefException intde = null;
+
+        // store names of currently registered node types before proceeding
+        HashSet oldNTNames = new HashSet(registeredNTDefs.keySet());
+
+        try {
+            // validate and register new node type definitions
+            internalRegister(ntDefs);
+        } catch (RepositoryException e) {
+            // store exception so it can be re-thrown later on
+            re = e;
+        } catch (InvalidNodeTypeDefException e) {
+            // store exception so it can be re-thrown later on
+            intde = e;
+        }
+
+        /**
+         * build set of names of actually registered new node types
+         * (potentially a subset of those specified in ntDefs if an exception
+         * had been thrown)
+         */
+        HashSet newNTNames = new HashSet(registeredNTDefs.keySet());
+        newNTNames.removeAll(oldNTNames);
+
+        if (newNTNames.size() > 0) {
+            // persist new node type definitions
+            for (Iterator iter = newNTNames.iterator(); iter.hasNext(); ) {
+                QName ntName = (QName) iter.next();
+                customNTDefs.add((NodeTypeDef) registeredNTDefs.get(ntName));
+            }
+            OutputStream out = null;
+            try {
+                out = customNodeTypesResource.getOutputStream();
+                customNTDefs.store(out, nsReg);
+            } catch (IOException ioe) {
+                String error = "internal error: failed to write custom node type definition
to " + customNodeTypesResource.getPath();
+                log.error(error, ioe);
+                throw new RepositoryException(error, ioe);
+            } catch (FileSystemException fse) {
+                String error = "internal error: failed to write custom node type definition
to " + customNodeTypesResource.getPath();
+                log.error(error, fse);
+                throw new RepositoryException(error, fse);
+            } finally {
+                if (out != null) {
+                    try {
+                        out.close();
+                    } catch (IOException ioe) {
+                        // ignore
+                    }
+                }
+            }
+
+            // notify listeners
+            for (Iterator iter = newNTNames.iterator(); iter.hasNext(); ) {
+                QName ntName = (QName) iter.next();
+                notifyRegistered(ntName);
+            }
+        }
+
+        // re-throw exception as necessary
+        if (re != null) {
+            throw re;
+        } else if (intde != null) {
+            throw intde;
+        }
+    }
+
+    /**
      * @param name
      * @throws NoSuchNodeTypeException
      * @throws RepositoryException
@@ -969,8 +1087,10 @@
 
         // persist removal of node type definition
         customNTDefs.remove(name);
+        OutputStream out = null;
         try {
-            customNTDefs.store(customNodeTypesResource.getOutputStream(), nsReg);
+            out = customNodeTypesResource.getOutputStream();
+            customNTDefs.store(out, nsReg);
         } catch (IOException ioe) {
             String error = "internal error: failed to write custom node type definition to
" + customNodeTypesResource.getPath();
             log.error(error, ioe);
@@ -979,6 +1099,14 @@
             String error = "internal error: failed to write custom node type definition to
" + customNodeTypesResource.getPath();
             log.error(error, fse);
             throw new RepositoryException(error, fse);
+        } finally {
+            if (out != null) {
+                try {
+                    out.close();
+                } catch (IOException ioe) {
+                    // ignore
+                }
+            }
         }
 
         // @todo remove also any node types & aggregates which have dependencies on this
node type

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/state/PersistentItemStateManager.java
Url: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/state/PersistentItemStateManager.java?view=diff&rev=106895&p1=incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/state/PersistentItemStateManager.java&r1=106894&p2=incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/state/PersistentItemStateManager.java&r2=106895
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/state/PersistentItemStateManager.java
(original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/state/PersistentItemStateManager.java
Mon Nov 29 00:37:44 2004
@@ -97,6 +97,7 @@
         PersistentPropertyState prop = createPropertyState(rootNodeUUID, propName);
         prop.setValues(new InternalValue[]{InternalValue.create(NodeTypeRegistry.NT_UNSTRUCTURED)});
         prop.setType(PropertyType.NAME);
+        prop.setMultiValued(false);
         prop.setDefinitionId(propDefId);
 
         rootState.store();

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/state/PropertyState.java
Url: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/state/PropertyState.java?view=diff&rev=106895&p1=incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/state/PropertyState.java&r1=106894&p2=incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/state/PropertyState.java&r2=106895
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/state/PropertyState.java
(original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/state/PropertyState.java
Mon Nov 29 00:37:44 2004
@@ -36,6 +36,7 @@
     protected QName name;
     protected InternalValue[] values;
     protected int type;
+    protected boolean multiValued;
 
     protected PropDefId defId;
 
@@ -63,6 +64,7 @@
         this.name = name;
         type = PropertyType.UNDEFINED;
         values = new InternalValue[0];
+        multiValued = false;
     }
 
     /**
@@ -76,7 +78,8 @@
         type = propState.getType();
         defId = propState.getDefinitionId();
         values = propState.getValues();
-    }    
+        multiValued = propState.isMultiValued();
+    }
 
     //-------------------------------------------------------< public methods >
     /**
@@ -109,6 +112,15 @@
     }
 
     /**
+     * Sets the flag indicating whether this property is multi-valued.
+     *
+     * @param multiValued flag indicating whether this property is multi-valued
+     */
+    public void setMultiValued(boolean multiValued) {
+        this.multiValued = multiValued;
+    }
+
+    /**
      * Returns the type of this property.
      *
      * @return the type of this property.
@@ -119,6 +131,15 @@
     }
 
     /**
+     * Returns true if this property is multi-valued, otherwise false.
+     *
+     * @return true if this property is multi-valued, otherwise false.
+     */
+    public boolean isMultiValued() {
+        return multiValued;
+    }
+
+    /**
      * Returns the id of the definition applicable to this property state.
      *
      * @return the id of the definition
@@ -160,6 +181,7 @@
         // read in readObject(ObjectInputStream)
         out.writeObject(name);
         out.writeInt(type);
+        out.writeBoolean(multiValued);
         if (values == null) {
             out.writeObject(null);
         } else {
@@ -199,6 +221,7 @@
         // written in writeObject(ObjectOutputStream)
         name = (QName) in.readObject();
         type = in.readInt();
+        multiValued = in.readBoolean();
         Object obj = in.readObject();
         if (obj == null) {
             values = null;

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/state/obj/ObjectPersistenceManager.java
Url: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/state/obj/ObjectPersistenceManager.java?view=diff&rev=106895&p1=incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/state/obj/ObjectPersistenceManager.java&r1=106894&p2=incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/state/obj/ObjectPersistenceManager.java&r2=106895
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/state/obj/ObjectPersistenceManager.java
(original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/state/obj/ObjectPersistenceManager.java
Mon Nov 29 00:37:44 2004
@@ -247,6 +247,8 @@
         DataOutputStream out = new DataOutputStream(stream);
         // type
         out.writeInt(state.getType());
+        // multiValued
+        out.writeBoolean(state.isMultiValued());
         // definitionId
         out.writeUTF(state.getDefinitionId().toString());
         // values
@@ -292,6 +294,9 @@
         // type
         int type = in.readInt();
         state.setType(type);
+        // multiValued
+        boolean multiValued = in.readBoolean();
+        state.setMultiValued(multiValued);
         // definitionId
         String s = in.readUTF();
         state.setDefinitionId(PropDefId.valueOf(s));

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/state/tx/DefaultTransactionalStore.java
Url: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/state/tx/DefaultTransactionalStore.java?view=diff&rev=106895&p1=incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/state/tx/DefaultTransactionalStore.java&r1=106894&p2=incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/state/tx/DefaultTransactionalStore.java&r2=106895
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/state/tx/DefaultTransactionalStore.java
(original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/state/tx/DefaultTransactionalStore.java
Mon Nov 29 00:37:44 2004
@@ -134,6 +134,7 @@
             PersistentPropertyState to = getOrCreateState(from);
             to.setDefinitionId(from.getDefinitionId());
             to.setType(from.getType());
+            to.setMultiValued(from.isMultiValued());
             to.setValues(from.getValues());
             to.store();
         }

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/state/tx/TransactionImpl.java
Url: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/state/tx/TransactionImpl.java?view=diff&rev=106895&p1=incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/state/tx/TransactionImpl.java&r1=106894&p2=incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/state/tx/TransactionImpl.java&r2=106895
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/state/tx/TransactionImpl.java
(original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/state/tx/TransactionImpl.java
Mon Nov 29 00:37:44 2004
@@ -431,6 +431,7 @@
                 p.getProperty("parentUUID"), this);
 
         state.setType(PropertyType.valueFromName(p.getProperty("type")));
+        state.setMultiValued(Boolean.getBoolean(p.getProperty("multiValued")));
         state.setDefinitionId(PropDefId.valueOf(p.getProperty("definitionId")));
         state.setValues(getValues(p, "values", state.getType()));
 
@@ -483,6 +484,7 @@
 
         p.setProperty("type", PropertyType.nameFromValue(state.getType()));
         p.setProperty("definitionId", state.getDefinitionId().toString());
+        p.setProperty("multiValued", Boolean.toString(state.isMultiValued()));
         setValues(p, "values", state.getValues());
 
         return store(p, "P");

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/state/xml/XMLPersistenceManager.java
Url: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/state/xml/XMLPersistenceManager.java?view=diff&rev=106895&p1=incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/state/xml/XMLPersistenceManager.java&r1=106894&p2=incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/state/xml/XMLPersistenceManager.java&r2=106895
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/state/xml/XMLPersistenceManager.java
(original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/state/xml/XMLPersistenceManager.java
Mon Nov 29 00:37:44 2004
@@ -73,6 +73,7 @@
     private static final String PROPERTY_ELEMENT = "property";
     private static final String NAME_ATTRIBUTE = "name";
     private static final String TYPE_ATTRIBUTE = "type";
+    private static final String MULTIVALUED_ATTRIBUTE = "multiValued";
 
     private static final String VALUES_ELEMENT = "values";
     private static final String VALUE_ELEMENT = "value";
@@ -268,6 +269,10 @@
         }
         state.setType(type);
 
+        // multiValued
+        String multiValued = propElement.getAttributeValue(MULTIVALUED_ATTRIBUTE);
+        state.setMultiValued(Boolean.getBoolean(multiValued));
+
         // definition id
         String definitionId = propElement.getAttributeValue(DEFINITIONID_ATTRIBUTE);
         state.setDefinitionId(PropDefId.valueOf(definitionId));
@@ -593,6 +598,7 @@
                 writer.write("<" + PROPERTY_ELEMENT + " " +
                         NAME_ATTRIBUTE + "=\"" + state.getName() + "\" " +
                         PARENTUUID_ATTRIBUTE + "=\"" + state.getParentUUID() + "\" " +
+                        MULTIVALUED_ATTRIBUTE + "=\"" + Boolean.toString(state.isMultiValued())
+ "\" " +
                         DEFINITIONID_ATTRIBUTE + "=\"" + state.getDefinitionId().toString()
+ "\" " +
                         TYPE_ATTRIBUTE + "=\"" + typeName + "\">\n");
                 // values

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/version/PersistentNode.java
Url: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/version/PersistentNode.java?view=diff&rev=106895&p1=incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/version/PersistentNode.java&r1=106894&p2=incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/version/PersistentNode.java&r2=106895
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/version/PersistentNode.java
(original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/version/PersistentNode.java
Mon Nov 29 00:37:44 2004
@@ -229,6 +229,7 @@
                 PropertyDefImpl def = getApplicablePropertyDef(name, type, multiValued);
                 PersistentPropertyState propState = stateMgr.createPropertyState(nodeState.getUUID(),
name);
                 propState.setType(type);
+                propState.setMultiValued(multiValued);
                 propState.setDefinitionId(new PropDefId(def.unwrap()));
 
                 // need to store nodestate

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/virtual/DefaultItemStateProvider.java
Url: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/virtual/DefaultItemStateProvider.java?view=diff&rev=106895&p1=incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/virtual/DefaultItemStateProvider.java&r1=106894&p2=incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/virtual/DefaultItemStateProvider.java&r2=106895
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/virtual/DefaultItemStateProvider.java
(original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/virtual/DefaultItemStateProvider.java
Mon Nov 29 00:37:44 2004
@@ -289,6 +289,7 @@
                 PropertyDefImpl def = getApplicablePropertyDef(parentState, name, type, multiValued);
                 VirtualPropertyState propState = createPropertyState(parentState.getUUID(),
name);
                 propState.setType(type);
+                propState.setMultiValued(multiValued);
                 propState.setDefinitionId(new PropDefId(def.unwrap()));
                 parentState.addPropertyEntry(name);
                 return propState;

Mime
View raw message