jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ang...@apache.org
Subject svn commit: r1404623 - /jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/xml/
Date Thu, 01 Nov 2012 14:58:21 GMT
Author: angela
Date: Thu Nov  1 14:58:21 2012
New Revision: 1404623

URL: http://svn.apache.org/viewvc?rev=1404623&view=rev
Log:
OAK-127 : Support for XML imports (work in progress)

- initial draft for pluggable interfaces and classes used for the import of protected items
- code is a slightly modified oak-adaption of the code we used in jackrabbit and which turned
   to be feasible to cover all cases we had so far. the distinction between methods for session
   and workspace import however looks to be redundant in the light of the oak api (-> simplified).

Added:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/xml/
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/xml/NodeInfo.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/xml/PropInfo.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/xml/ProtectedItemImporter.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/xml/ProtectedNodeImporter.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/xml/ProtectedPropertyImporter.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/xml/ReferenceChangeTracker.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/xml/TextValue.java

Added: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/xml/NodeInfo.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/xml/NodeInfo.java?rev=1404623&view=auto
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/xml/NodeInfo.java
(added)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/xml/NodeInfo.java
Thu Nov  1 14:58:21 2012
@@ -0,0 +1,102 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.oak.spi.xml;
+
+/**
+ * Information about a node being imported. This class is used
+ * by the XML import handlers to pass the parsed node information to the
+ * import process.
+ * <p>
+ * An instance of this class is simply a container for the node name,
+ * node uuidentifier, and the node type information. See the {@link PropInfo}
+ * class for the related carrier of property information.
+ */
+public class NodeInfo {
+
+    /**
+     * Name of the node being imported.
+     */
+    private final String name;
+
+    /**
+     * Name of the primary type of the node being imported.
+     */
+    private final String primaryTypeName;
+
+    /**
+     * Names of the mixin types of the node being imported.
+     */
+    private final String[] mixinTypeNames;
+
+    /**
+     * UUID of the node being imported.
+     */
+    private final String uuid;
+
+    /**
+     * Creates a node information instance.
+     *
+     * @param name name of the node being imported
+     * @param primaryTypeName name of the primary type of the node being imported
+     * @param mixinTypeNames names of the mixin types of the node being imported
+     * @param uuid uuid of the node being imported
+     */
+    public NodeInfo(String name, String primaryTypeName, String[] mixinTypeNames,
+                    String uuid) {
+        this.name = name;
+        this.primaryTypeName = primaryTypeName;
+        this.mixinTypeNames = mixinTypeNames;
+        this.uuid = uuid;
+    }
+
+    /**
+     * Returns the name of the node being imported.
+     *
+     * @return node name
+     */
+    public String getString() {
+        return name;
+    }
+
+    /**
+     * Returns the name of the primary type of the node being imported.
+     *
+     * @return primary type name
+     */
+    public String getPrimaryTypeName() {
+        return primaryTypeName;
+    }
+
+    /**
+     * Returns the names of the mixin types of the node being imported.
+     *
+     * @return mixin type names
+     */
+    public String[] getMixinTypeNames() {
+        return mixinTypeNames;
+    }
+
+    /**
+     * Returns the uuid of the node being imported.
+     *
+     * @return node uuid
+     */
+    public String getUUID() {
+        return uuid;
+    }
+
+}
\ No newline at end of file

Added: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/xml/PropInfo.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/xml/PropInfo.java?rev=1404623&view=auto
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/xml/PropInfo.java
(added)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/xml/PropInfo.java
Thu Nov  1 14:58:21 2012
@@ -0,0 +1,130 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.oak.spi.xml;
+
+import javax.jcr.PropertyType;
+import javax.jcr.RepositoryException;
+import javax.jcr.Value;
+import javax.jcr.nodetype.PropertyDefinition;
+
+import org.apache.jackrabbit.oak.api.Type;
+import org.apache.jackrabbit.oak.namepath.NamePathMapper;
+
+/**
+ * Information about a property being imported. This class is used
+ * by the XML import handlers to pass the parsed property information
+ * to the import process.
+ * <p>
+ * In addition to carrying the actual property data, instances of this
+ * class also know how to apply that data when imported either to a
+ * {@link javax.jcr.Node} instance through a session or directly to a
+ * {@link org.apache.jackrabbit.oak.api.Tree} instance on the oak level.
+ */
+public class PropInfo {
+
+    /**
+     * String of the property being imported.
+     */
+    private final String name;
+
+    /**
+     * Type of the property being imported.
+     */
+    private final Type type;
+
+    /**
+     * Value(s) of the property being imported.
+     */
+    private final TextValue[] values;
+
+    /**
+     * Hint indicating whether the property is multi- or single-value
+     */
+    public enum MultipleStatus { UNKNOWN, SINGLE, MULTIPLE }
+    private MultipleStatus multipleStatus;
+
+    /**
+     * Creates a property information instance.
+     *
+     * @param name name of the property being imported
+     * @param type type of the property being imported
+     * @param values value(s) of the property being imported
+     */
+    public PropInfo(String name, Type type, TextValue[] values) {
+        this.name = name;
+        this.type = type;
+        this.values = values;
+        multipleStatus = (values.length == 1) ? MultipleStatus.UNKNOWN : MultipleStatus.MULTIPLE;
+    }
+
+    /**
+     * Creates a property information instance.
+     *
+     * @param name name of the property being imported
+     * @param type type of the property being imported
+     * @param values value(s) of the property being imported
+     * @param multipleStatus Hint indicating whether the property is
+     *                       multi- or single-value
+     */
+    public PropInfo(String name, Type type, TextValue[] values,
+                    MultipleStatus multipleStatus) {
+        this.name = name;
+        this.type = type;
+        this.values = values;
+        this.multipleStatus = multipleStatus;
+    }
+
+    /**
+     * Disposes all values contained in this property.
+     */
+    public void dispose() {
+        for (TextValue value : values) {
+            value.dispose();
+        }
+    }
+
+    public Type getTargetType(PropertyDefinition def) {
+        int target = def.getRequiredType();
+        if (target != PropertyType.UNDEFINED) {
+            return Type.fromTag(target, def.isMultiple());
+        } else if (type.tag() != PropertyType.UNDEFINED) {
+            return type;
+        } else {
+            return Type.STRING;
+        }
+    }
+
+    public String getString() {
+        return name;
+    }
+
+    public Type getType() {
+        return type;
+    }
+
+    public TextValue[] getTextValues() {
+        return values;
+    }
+
+    public Value[] getValues(Type targetType, NamePathMapper namePathMapper) throws RepositoryException
{
+        Value[] va = new Value[values.length];
+        for (int i = 0; i < values.length; i++) {
+            va[i] = values[i].getValue(targetType, namePathMapper);
+        }
+        return va;
+    }
+}
\ No newline at end of file

Added: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/xml/ProtectedItemImporter.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/xml/ProtectedItemImporter.java?rev=1404623&view=auto
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/xml/ProtectedItemImporter.java
(added)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/xml/ProtectedItemImporter.java
Thu Nov  1 14:58:21 2012
@@ -0,0 +1,61 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.oak.spi.xml;
+
+import javax.jcr.RepositoryException;
+
+import org.apache.jackrabbit.api.JackrabbitSession;
+import org.apache.jackrabbit.oak.api.Root;
+import org.apache.jackrabbit.oak.namepath.NamePathMapper;
+
+/**
+ * Base interface for {@link ProtectedNodeImporter} and {@link ProtectedPropertyImporter}.
+ */
+public abstract interface ProtectedItemImporter {
+
+    /**
+     * Initializes the importer.
+     *
+     * @param session The session that is running the import.
+     * @param root The root associated with the import.
+     * @param namePathMapper The name/path mapper used to translate names
+     * between their jcr and oak form.
+     * @param isWorkspaceImport A flag indicating whether the import has been
+     * started from the {@link javax.jcr.Workspace} or from the
+     * {@link javax.jcr.Session}. Implementations are free to implement both
+     * types of imports or only a single one. For example it doesn't make sense
+     * to allow for importing versions along with a Session import as
+     * version operations are required to never leave transient changes behind.
+     * @param uuidBehavior The uuid behavior specified with the import call.
+     * @param referenceTracker The uuid/reference helper.
+     * @return {@code true} if this importer was successfully initialized and
+     * is able to handle an import with the given setup; {@code false} otherwise.
+     */
+    boolean init(JackrabbitSession session, Root root,
+                 NamePathMapper namePathMapper,
+                 boolean isWorkspaceImport, int uuidBehavior,
+                 ReferenceChangeTracker referenceTracker);
+
+    /**
+     * Post processing protected reference properties underneath a protected
+     * or non-protected parent node. If the parent is protected it has been
+     * handled by this importer already.
+     *
+     * @throws javax.jcr.RepositoryException If an error occurs.
+     */
+    void processReferences() throws RepositoryException;
+}
\ No newline at end of file

Added: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/xml/ProtectedNodeImporter.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/xml/ProtectedNodeImporter.java?rev=1404623&view=auto
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/xml/ProtectedNodeImporter.java
(added)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/xml/ProtectedNodeImporter.java
Thu Nov  1 14:58:21 2012
@@ -0,0 +1,111 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.oak.spi.xml;
+
+import java.util.List;
+import javax.jcr.RepositoryException;
+import javax.jcr.nodetype.ConstraintViolationException;
+
+import org.apache.jackrabbit.oak.api.Tree;
+
+/**
+ * {@code ProtectedNodeImporter} provides means to import protected
+ * {@code Node}s and the subtree defined below such nodes.
+ * <p/>
+ * The import of a protected tree is started by the {@code Importer} by
+ * calling {@link #start(Tree)}. If the {@code ProtectedNodeImporter}
+ * is able to deal with that type of protected node, it is in charge of dealing
+ * with all subsequent child {@code NodeInfo}s present below the protected
+ * parent until {@link #end(Tree)} is called. The latter resets this importer
+ * and makes it available for another protected import.
+ */
+public interface ProtectedNodeImporter extends ProtectedItemImporter {
+
+
+    /**
+     * Notifies this importer about the existence of a protected node that
+     * has either been created (NEW) or has been found to be existing.
+     * This importer implementation is in charge of evaluating the nature of
+     * that protected node in order to determine, if it is able to handle
+     * subsequent protected or non-protected child nodes in the tree below
+     * that parent.
+     *
+     * @param protectedParent A protected node that has either been created
+     * during the current XML import or that has been found to be existing
+     * without allowing same-name siblings.
+     * @return {@code true} If this importer is able to deal with the
+     * tree that may be present below the given protected Node.
+     * @throws IllegalStateException If this method is called on
+     * this importer without having reached {@link #end(Tree)}.
+     * @throws javax.jcr.RepositoryException If an error occurs.
+     */
+    boolean start(Tree protectedParent) throws IllegalStateException,
+            RepositoryException;
+
+    /**
+     * Informs this importer that the tree to be imported below
+     * {@code protectedParent} has bee completed. This allows the importer
+     * to be reset in order to be able to deal with another call to
+     * {@link #start(Tree)}.<p/>
+     * If {@link #start(Tree)} hasn't been called before, this method returns
+     * silently.
+     *
+     * @param protectedParent The protected parent tree.
+     * @throws IllegalStateException If end is called in an illegal state.
+     * @throws javax.jcr.nodetype.ConstraintViolationException If the tree
+     * that was imported is incomplete.
+     * @throws RepositoryException If another error occurs.
+     */
+    void end(Tree protectedParent) throws IllegalStateException,
+            ConstraintViolationException, RepositoryException;
+
+    /**
+     * Informs this importer about a new {@code childInfo} and it's properties.
+     * If the importer is able to successfully import the given information
+     * this method returns silently. Otherwise
+     * {@code ConstraintViolationException} is thrown, in which case the
+     * whole import fails.<p/>
+     * In case this importer deals with multiple levels of nodes, it is in
+     * charge of maintaining the hierarchical structure (see also {#link endChildInfo()}.
+     * <p/>
+     * If {@link #start(Tree)} hasn't been called before, this method returns
+     * silently.
+     *
+     * @param childInfo
+     * @param propInfos
+     * @throws IllegalStateException If called in an illegal state.
+     * @throws javax.jcr.nodetype.ConstraintViolationException If the given
+     * infos contain invalid or incomplete data and therefore cannot be properly
+     * handled by this importer.
+     * @throws RepositoryException If another error occurs.
+     */
+    void startChildInfo(NodeInfo childInfo, List<PropInfo> propInfos)
+            throws IllegalStateException, ConstraintViolationException, RepositoryException;
+
+    /**
+     * Informs this importer about the end of a child info.
+     * <p/>
+     * If {@link #start(Tree)} hasn't been called before, this method returns
+     * silently.
+     *
+     * @throws IllegalStateException If end is called in an illegal state.
+     * @throws javax.jcr.nodetype.ConstraintViolationException If this method
+     * is called before all required child information has been imported.
+     * @throws RepositoryException If another error occurs.
+     */
+    void endChildInfo() throws RepositoryException;
+}
\ No newline at end of file

Added: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/xml/ProtectedPropertyImporter.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/xml/ProtectedPropertyImporter.java?rev=1404623&view=auto
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/xml/ProtectedPropertyImporter.java
(added)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/xml/ProtectedPropertyImporter.java
Thu Nov  1 14:58:21 2012
@@ -0,0 +1,47 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.oak.spi.xml;
+
+import javax.jcr.RepositoryException;
+import javax.jcr.nodetype.PropertyDefinition;
+
+import org.apache.jackrabbit.oak.api.Tree;
+
+/**
+ * {@code ProtectedPropertyImporter} is in charge of importing single
+ * properties with a protected {@code PropertyDefinition}.
+ *
+ * @see ProtectedNodeImporter for an abstract class used to import protected
+ * nodes and the subtree below them.
+ */
+public interface ProtectedPropertyImporter extends ProtectedItemImporter {
+
+    /**
+     * Handles a single protected property.
+     *
+     * @param parent The affected parent node.
+     * @param protectedPropInfo The {@code PropInfo} to be imported.
+     * @param def The property definition determined by the importer that
+     * calls this method.
+     * @return {@code true} If the property could be successfully imported;
+     * {@code false} otherwise.
+     * @throws javax.jcr.RepositoryException If an error occurs.
+     */
+    boolean handlePropInfo(Tree parent, PropInfo protectedPropInfo,
+                           PropertyDefinition def) throws RepositoryException;
+
+}
\ No newline at end of file

Added: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/xml/ReferenceChangeTracker.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/xml/ReferenceChangeTracker.java?rev=1404623&view=auto
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/xml/ReferenceChangeTracker.java
(added)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/xml/ReferenceChangeTracker.java
Thu Nov  1 14:58:21 2012
@@ -0,0 +1,106 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.oak.spi.xml;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Helper class used to keep track of uuid mappings (e.g. if the uuid of an
+ * imported or copied node is mapped to a new uuid) and processed (e.g. imported
+ * or copied) reference properties that might need to be adjusted depending on
+ * the UUID mapping resulting from the import.
+ *
+ * @see javax.jcr.ImportUUIDBehavior
+ */
+public class ReferenceChangeTracker {
+
+    /**
+     * mapping from original uuid to new uuid of mix:referenceable nodes
+     */
+    private final Map<String, String> uuidMap = new HashMap<String, String>();
+
+    /**
+     * list of processed reference properties that might need correcting
+     */
+    private final ArrayList<Object> references = new ArrayList<Object>();
+
+    /**
+     * Returns the new node id to which {@code oldUUID} has been mapped
+     * or {@code null} if no such mapping exists.
+     *
+     * @param oldUUID old node id
+     * @return mapped new id or {@code null} if no such mapping exists
+     * @see #put(String, String)
+     */
+    public String get(String oldUUID) {
+        return uuidMap.get(oldUUID);
+    }
+
+    /**
+     * Store the given id mapping for later lookup using
+     * {@code }{@link #get(String)}</code>.
+     *
+     * @param oldUUID old node id
+     * @param newUUID new node id
+     */
+    public void put(String oldUUID, String newUUID) {
+        uuidMap.put(oldUUID, newUUID);
+    }
+
+    /**
+     * Resets all internal state.
+     */
+    public void clear() {
+        uuidMap.clear();
+        references.clear();
+    }
+
+    /**
+     * Store the given reference property for later retrieval using
+     * {@code }{@link #getProcessedReferences()}</code>.
+     *
+     * @param refProp reference property
+     */
+    public void processedReference(Object refProp) {
+        references.add(refProp);
+    }
+
+    /**
+     * Returns an iterator over all processed reference properties.
+     *
+     * @return an iterator over all processed reference properties
+     * @see #processedReference(Object)
+     */
+    public Iterator<Object> getProcessedReferences() {
+        return references.iterator();
+    }
+
+    /**
+     * Remove the given references that have already been processed from the
+     * references list.
+     *
+     * @param processedReferences
+     * @return {@code true} if the internal list of references changed.
+     */
+    public boolean removeReferences(List<Object> processedReferences) {
+        return references.removeAll(processedReferences);
+    }
+}
\ No newline at end of file

Added: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/xml/TextValue.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/xml/TextValue.java?rev=1404623&view=auto
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/xml/TextValue.java
(added)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/xml/TextValue.java
Thu Nov  1 14:58:21 2012
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.oak.spi.xml;
+
+import javax.jcr.RepositoryException;
+import javax.jcr.Value;
+import javax.jcr.ValueFormatException;
+
+import org.apache.jackrabbit.oak.api.Type;
+import org.apache.jackrabbit.oak.namepath.NamePathMapper;
+
+/**
+ * {@code TextValue} represents a serialized property value read
+ * from a System or Document View XML document.
+ */
+public interface TextValue {
+
+    // TODO: review again
+    Value getValue(Type targetType, NamePathMapper namePathMapper) throws ValueFormatException,
RepositoryException;
+
+    /**
+     * Dispose this value, i.e. free all bound resources. Once a value has
+     * been disposed, further method invocations will cause an IOException
+     * to be thrown.
+     */
+    void dispose();
+
+}
\ No newline at end of file



Mime
View raw message