You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jackrabbit.apache.org by ju...@apache.org on 2006/06/30 23:13:26 UTC
svn commit: r418382 - in
/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/xml:
DocViewImportHandler.java ImportHandler.java Importer.java NodeInfo.java
PropInfo.java StringValue.java
Author: jukka
Date: Fri Jun 30 14:13:26 2006
New Revision: 418382
URL: http://svn.apache.org/viewvc?rev=418382&view=rev
Log:
JCR-73: Improved javadocs in o.a.j.c.xml
JCR-97: Removed unused imports in o.a.j.c.xml
Modified:
jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/xml/DocViewImportHandler.java
jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/xml/ImportHandler.java
jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/xml/Importer.java
jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/xml/NodeInfo.java
jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/xml/PropInfo.java
jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/xml/StringValue.java
Modified: jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/xml/DocViewImportHandler.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/xml/DocViewImportHandler.java?rev=418382&r1=418381&r2=418382&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/xml/DocViewImportHandler.java (original)
+++ jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/xml/DocViewImportHandler.java Fri Jun 30 14:13:26 2006
@@ -16,23 +16,22 @@
*/
package org.apache.jackrabbit.core.xml;
+import java.io.IOException;
+import java.io.Reader;
+import java.util.ArrayList;
+import java.util.Stack;
+
+import javax.jcr.PropertyType;
+import javax.jcr.RepositoryException;
+
+import org.apache.jackrabbit.core.NodeId;
import org.apache.jackrabbit.name.NameException;
import org.apache.jackrabbit.name.QName;
import org.apache.jackrabbit.util.ISO9075;
-import org.apache.jackrabbit.core.NodeId;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.xml.sax.Attributes;
import org.xml.sax.SAXException;
-
-import javax.jcr.PropertyType;
-import javax.jcr.RepositoryException;
-import javax.jcr.Value;
-
-import java.io.IOException;
-import java.io.Reader;
-import java.util.ArrayList;
-import java.util.Stack;
/**
* <code>DocViewImportHandler</code> processes Document View XML SAX events
Modified: jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/xml/ImportHandler.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/xml/ImportHandler.java?rev=418382&r1=418381&r2=418382&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/xml/ImportHandler.java (original)
+++ jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/xml/ImportHandler.java Fri Jun 30 14:13:26 2006
@@ -17,23 +17,20 @@
package org.apache.jackrabbit.core.xml;
import java.util.HashMap;
-import java.util.Iterator;
import java.util.Map;
+import javax.jcr.RepositoryException;
+
import org.apache.jackrabbit.core.NamespaceRegistryImpl;
import org.apache.jackrabbit.name.NamespaceResolver;
import org.apache.jackrabbit.name.QName;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.xml.sax.Attributes;
-import org.xml.sax.ContentHandler;
import org.xml.sax.Locator;
import org.xml.sax.SAXException;
import org.xml.sax.SAXParseException;
import org.xml.sax.helpers.DefaultHandler;
-
-import javax.jcr.NamespaceException;
-import javax.jcr.RepositoryException;
/**
* An <code>ImportHandler</code> instance can be used to import serialized
Modified: jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/xml/Importer.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/xml/Importer.java?rev=418382&r1=418381&r2=418382&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/xml/Importer.java (original)
+++ jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/xml/Importer.java Fri Jun 30 14:13:26 2006
@@ -16,37 +16,58 @@
*/
package org.apache.jackrabbit.core.xml;
-import org.apache.jackrabbit.name.NamespaceResolver;
+import java.util.List;
import javax.jcr.RepositoryException;
-import java.util.List;
/**
- * The <code>Importer</code> interface ...
+ * Content importer. The XML import handlers use this interface to submit
+ * the parsed content to the repository. The implementation of this class
+ * decides how the content is actually persisted; either through the
+ * transient space of a session, or directly into the workspace.
*/
public interface Importer {
/**
- * @throws RepositoryException
+ * Called once at the beginning of the content import.
+ *
+ * @throws RepositoryException on a repository error
*/
void start() throws RepositoryException;
/**
- * @param nodeInfo
- * @param propInfos list of <code>PropInfo</code> instances
- * @throws RepositoryException
+ * Called to start the import of a node. Information about the
+ * imported node and all it's properties are passed as arguments.
+ * Possible child nodes are imported recursively using this same
+ * method until a {@link #endNode(NodeInfo)} call is made with the
+ * same node information.
+ *
+ * @param nodeInfo information about the node being imported
+ * @param propInfos information abouth the properties being imported
+ * (list of {@link PropInfo} instances)
+ * @throws RepositoryException on a repository error
*/
void startNode(NodeInfo nodeInfo, List propInfos)
throws RepositoryException;
/**
- * @param nodeInfo
- * @throws RepositoryException
+ * Called to end the import of a node. This method is called after
+ * a {@link #startNode(NodeInfo, List)} call with the stame node
+ * information and after all the possible child nodes have been
+ * imported with respective startNode/endNode calls.
+ * <p>
+ * Just like XML elements, the startNode/endNode calls are guaranteed
+ * to be properly nested and complete.
+ *
+ * @param nodeInfo information about the node being imported
+ * @throws RepositoryException on a repository error
*/
void endNode(NodeInfo nodeInfo) throws RepositoryException;
/**
- * @throws RepositoryException
+ * Called once at the end of the content import.
+ *
+ * @throws RepositoryException on a repository error
*/
void end() throws RepositoryException;
Modified: jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/xml/NodeInfo.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/xml/NodeInfo.java?rev=418382&r1=418381&r2=418382&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/xml/NodeInfo.java (original)
+++ jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/xml/NodeInfo.java Fri Jun 30 14:13:26 2006
@@ -19,16 +19,45 @@
import org.apache.jackrabbit.core.NodeId;
import org.apache.jackrabbit.name.QName;
+/**
+ * Information about a node being imported. This class is used
+ * by the XML import handlers to pass the parsed node information through
+ * the {@link Importer} interface to the actual import process.
+ * <p>
+ * An instance of this class is simply a container for the node name,
+ * node identifier, 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 QName name;
+ /**
+ * Name of the primary type of the node being imported.
+ */
private final QName nodeTypeName;
+ /**
+ * Names of the mixin types of the node being imported.
+ */
private final QName[] mixinNames;
+ /**
+ * Identifier of the node being imported.
+ */
private final NodeId id;
+ /**
+ * Creates a node information instance.
+ *
+ * @param name name of the node being imported
+ * @param nodeTypeName name of the primary type of the node being imported
+ * @param mixinNames names of the mixin types of the node being imported
+ * @param id identifier of the node being imported
+ */
public NodeInfo(QName name, QName nodeTypeName, QName[] mixinNames,
NodeId id) {
this.name = name;
@@ -37,18 +66,38 @@
this.id = id;
}
+ /**
+ * Returns the name of the node being imported.
+ *
+ * @return node name
+ */
public QName getName() {
return name;
}
+ /**
+ * Returns the name of the primary type of the node being imported.
+ *
+ * @return primary type name
+ */
public QName getNodeTypeName() {
return nodeTypeName;
}
+ /**
+ * Returns the names of the mixin types of the node being imported.
+ *
+ * @return mixin type names
+ */
public QName[] getMixinNames() {
return mixinNames;
}
+ /**
+ * Returns the identifier of the node being imported.
+ *
+ * @return node identifier
+ */
public NodeId getId() {
return id;
}
Modified: jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/xml/PropInfo.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/xml/PropInfo.java?rev=418382&r1=418381&r2=418382&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/xml/PropInfo.java (original)
+++ jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/xml/PropInfo.java Fri Jun 30 14:13:26 2006
@@ -41,16 +41,45 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+/**
+ * Information about a property being imported. This class is used
+ * by the XML import handlers to pass the parsed property information
+ * through the {@link Importer} interface to the actual 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 NodeImpl} instance through a session or directly to a
+ * {@link NodeState} instance in a workspace.
+ */
public class PropInfo {
+ /**
+ * Logger instance.
+ */
private static Logger log = LoggerFactory.getLogger(PropInfo.class);
+ /**
+ * Name of the property being imported.
+ */
private final QName name;
+ /**
+ * Type of the property being imported.
+ */
private final int type;
+ /**
+ * Value(s) of the property being imported.
+ */
private final TextValue[] values;
+ /**
+ * Creates a proprety 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(QName name, int type, TextValue[] values) {
this.name = name;
this.type = type;
Modified: jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/xml/StringValue.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/xml/StringValue.java?rev=418382&r1=418381&r2=418382&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/xml/StringValue.java (original)
+++ jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/xml/StringValue.java Fri Jun 30 14:13:26 2006
@@ -18,8 +18,6 @@
import java.io.ByteArrayOutputStream;
import java.io.IOException;
-import java.io.Reader;
-import java.io.StringReader;
import javax.jcr.PropertyType;
import javax.jcr.RepositoryException;