Index: java/org/apache/jackrabbit/decorator/DecoratingVersionIterator.java
===================================================================
--- java/org/apache/jackrabbit/decorator/DecoratingVersionIterator.java (revision 0)
+++ java/org/apache/jackrabbit/decorator/DecoratingVersionIterator.java (revision 0)
@@ -0,0 +1,50 @@
+/*
+ * Copyright 2004-2005 The Apache Software Foundation or its licensors,
+ * as applicable.
+ *
+ * Licensed 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.decorator;
+
+import org.apache.jackrabbit.decorator.DecoratorFactory;
+import org.apache.jackrabbit.decorator.DecoratingRangeIterator;
+
+import javax.jcr.version.VersionIterator;
+import javax.jcr.version.Version;
+import javax.jcr.Session;
+
+/**
+ */
+public class DecoratingVersionIterator extends DecoratingRangeIterator
+ implements VersionIterator {
+
+ /**
+ * Creates a decorating version iterator.
+ *
+ * @param factory decorator factory
+ * @param session decorated session
+ * @param iterator underlying version iterator
+ */
+ public DecoratingVersionIterator(DecoratorFactory factory,
+ Session session,
+ VersionIterator iterator) {
+ super(factory, session, iterator);
+ }
+
+ /**
+ * @inheritDoc
+ */
+ public Version nextVersion() {
+ return (Version) next();
+ }
+}
Property changes on: java/org/apache/jackrabbit/decorator/DecoratingVersionIterator.java
___________________________________________________________________
Name: svn:eol-style
+ native
Index: java/org/apache/jackrabbit/decorator/DecoratingNodeIterator.java
===================================================================
--- java/org/apache/jackrabbit/decorator/DecoratingNodeIterator.java (revision 320755)
+++ java/org/apache/jackrabbit/decorator/DecoratingNodeIterator.java (working copy)
@@ -30,15 +30,6 @@
public class DecoratingNodeIterator extends DecoratingRangeIterator
implements NodeIterator {
- /** The decorator factory. Used to decorate all returned node instances. */
- private final DecoratorFactory factory;
-
- /** The decorated session to which the returned nodes belong. */
- private final Session session;
-
- /** The underlying node iterator. */
- private final NodeIterator iterator;
-
/**
* Creates a decorating node iterator.
*
@@ -49,9 +40,6 @@
public DecoratingNodeIterator(
DecoratorFactory factory, Session session, NodeIterator iterator) {
super(factory, session, iterator);
- this.factory = factory;
- this.session = session;
- this.iterator = iterator;
}
/**
@@ -61,8 +49,7 @@
* @see NodeIterator#nextNode()
*/
public Node nextNode() {
- Node node = iterator.nextNode();
- return factory.getNodeDecorator(session, node);
+ return (Node) next();
}
}
Index: java/org/apache/jackrabbit/decorator/WorkspaceDecorator.java
===================================================================
--- java/org/apache/jackrabbit/decorator/WorkspaceDecorator.java (revision 320755)
+++ java/org/apache/jackrabbit/decorator/WorkspaceDecorator.java (working copy)
@@ -43,16 +43,10 @@
/**
* Simple workspace decorator.
*/
-public class WorkspaceDecorator implements Workspace {
+public class WorkspaceDecorator extends AbstractDecorator implements Workspace {
- /** The decorator factory. */
- private final DecoratorFactory factory;
-
- /** The session (decorator) instance. */
- private final Session session;
-
/** The underlying workspace instance. */
- private final Workspace workspace;
+ protected final Workspace workspace;
/**
* Creates a workspace decorator.
@@ -63,8 +57,7 @@
*/
public WorkspaceDecorator(
DecoratorFactory factory, Session session, Workspace workspace) {
- this.factory = factory;
- this.session = session;
+ super(factory, session);
this.workspace = workspace;
}
@@ -128,14 +121,18 @@
throws ItemExistsException,
UnsupportedRepositoryOperationException, VersionException,
LockException, InvalidItemStateException, RepositoryException {
- workspace.restore(versions, removeExisting);
+ Version[] tmp = new Version[versions.length];
+ for (int i = 0; i < versions.length; i++) {
+ tmp[i] = VersionDecorator.unwrap(versions[i]);
+ }
+ workspace.restore(tmp, removeExisting);
}
/**
* Forwards the method call to the underlying workspace.
*/
public QueryManager getQueryManager() throws RepositoryException {
- return workspace.getQueryManager();
+ return factory.getQueryManagerDecorator(session, workspace.getQueryManager());
}
/**
Index: java/org/apache/jackrabbit/decorator/ItemDecorator.java
===================================================================
--- java/org/apache/jackrabbit/decorator/ItemDecorator.java (revision 320755)
+++ java/org/apache/jackrabbit/decorator/ItemDecorator.java (working copy)
@@ -30,23 +30,52 @@
import javax.jcr.version.VersionException;
/**
- * TODO
*/
-public class ItemDecorator implements Item {
+public class ItemDecorator extends AbstractDecorator implements Item {
- private DecoratorFactory factory;
+ /**
+ * The underlying item to decorate.
+ */
+ protected final Item item;
- private Session session;
- private Item item;
-
public ItemDecorator(DecoratorFactory factory, Session session, Item item) {
- this.factory = factory;
- this.session = session;
+ super(factory, session);
this.item = item;
}
/**
+ * Returns the underlying item that this
+ * ItemDecorator decorates.
+ *
+ * @return the underlying item.
+ */
+ public Item unwrap() {
+ return item;
+ }
+
+ /**
+ * Returns the underlying item of the item
+ * that decorates it. Unwrapping null returns null.
+ *
+ * @param item decorates the underlying item.
+ * @return the underlying item.
+ * @throws IllegalStateException if item is not of type
+ * {@link ItemDecorator}.
+ */
+ public static Item unwrap(Item item) {
+ if (item == null) {
+ return null;
+ }
+ if (item instanceof ItemDecorator) {
+ item = ((ItemDecorator) item).unwrap();
+ } else {
+ throw new IllegalStateException("item is not of type ItemDecorator");
+ }
+ return item;
+ }
+
+ /**
* Returns the decorated session through which this item decorator
* was acquired.
*
@@ -101,14 +130,13 @@
}
/** {@inheritDoc} */
- public boolean isSame(Item otherItem) {
- // TODO Auto-generated method stub
- return false;
+ public boolean isSame(Item otherItem) throws RepositoryException {
+ return item.isSame(unwrap(otherItem));
}
/** {@inheritDoc} */
public void accept(ItemVisitor visitor) throws RepositoryException {
- item.accept(visitor);
+ item.accept(factory.getItemVisitorDecorator(session, visitor));
}
/** {@inheritDoc} */
@@ -131,4 +159,15 @@
item.remove();
}
+ public boolean equals(Object obj) {
+ if (obj instanceof ItemDecorator) {
+ ItemDecorator other = (ItemDecorator)obj;
+ return item.equals(other.unwrap());
+ }
+ return false;
+ }
+
+ public int hashCode() {
+ return item.hashCode();
+ }
}
Index: java/org/apache/jackrabbit/decorator/QueryManagerDecorator.java
===================================================================
--- java/org/apache/jackrabbit/decorator/QueryManagerDecorator.java (revision 0)
+++ java/org/apache/jackrabbit/decorator/QueryManagerDecorator.java (revision 0)
@@ -0,0 +1,64 @@
+/*
+ * Copyright 2004-2005 The Apache Software Foundation or its licensors,
+ * as applicable.
+ *
+ * Licensed 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.decorator;
+
+import org.apache.jackrabbit.decorator.DecoratorFactory;
+import org.apache.jackrabbit.decorator.NodeDecorator;
+
+import javax.jcr.query.QueryManager;
+import javax.jcr.query.Query;
+import javax.jcr.query.InvalidQueryException;
+import javax.jcr.RepositoryException;
+import javax.jcr.Node;
+import javax.jcr.Session;
+
+/**
+ */
+public class QueryManagerDecorator
+ extends AbstractDecorator implements QueryManager {
+
+ protected final QueryManager manager;
+
+ public QueryManagerDecorator(DecoratorFactory factory, Session session, QueryManager manager) {
+ super(factory, session);
+ this.manager = manager;
+ }
+
+ /**
+ * @inheritDoc
+ */
+ public Query createQuery(String statement, String language)
+ throws InvalidQueryException, RepositoryException {
+ return factory.getQueryDecorator(session,
+ manager.createQuery(statement, language));
+ }
+
+ /**
+ * @inheritDoc
+ */
+ public Query getQuery(Node node) throws InvalidQueryException, RepositoryException {
+ Query query = manager.getQuery(NodeDecorator.unwrap(node));
+ return factory.getQueryDecorator(session, query);
+ }
+
+ /**
+ * @inheritDoc
+ */
+ public String[] getSupportedQueryLanguages() throws RepositoryException {
+ return manager.getSupportedQueryLanguages();
+ }
+}
Property changes on: java/org/apache/jackrabbit/decorator/QueryManagerDecorator.java
___________________________________________________________________
Name: svn:eol-style
+ native
Index: java/org/apache/jackrabbit/decorator/AbstractDecorator.java
===================================================================
--- java/org/apache/jackrabbit/decorator/AbstractDecorator.java (revision 0)
+++ java/org/apache/jackrabbit/decorator/AbstractDecorator.java (revision 0)
@@ -0,0 +1,51 @@
+/*
+ * Copyright 2004-2005 The Apache Software Foundation or its licensors,
+ * as applicable.
+ *
+ * Licensed 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.decorator;
+
+import javax.jcr.Session;
+
+/**
+ * Provides fields to common objects used by any decorator:
+ *
DecoratorFactory: the decorator factory in useSession: the decorated session which was used to create
+ * this decoratorVersion of the version
+ * that decorates it. Unwrapping null returns null.
+ *
+ * @param version decorates the underlying version.
+ * @return the underlying version.
+ * @throws IllegalStateException if version is not of type
+ * {@link VersionDecorator}.
+ */
+ public static Version unwrap(Version version) {
+ if (version == null) {
+ return null;
+ }
+ if (version instanceof VersionDecorator) {
+ version = (Version) ((VersionDecorator) version).unwrap();
+ } else {
+ throw new IllegalStateException("version is not of type VersionDecorator");
+ }
+ return version;
+ }
+
+ /**
+ * @inheritDoc
+ */
+ public VersionHistory getContainingHistory() throws RepositoryException {
+ VersionHistory vHistory = version.getContainingHistory();
+ return factory.getVersionHistoryDecorator(session, vHistory);
+ }
+
+ /**
+ * @inheritDoc
+ */
+ public Calendar getCreated() throws RepositoryException {
+ return version.getCreated();
+ }
+
+ /**
+ * @inheritDoc
+ */
+ public Version[] getSuccessors() throws RepositoryException {
+ Version[] successors = version.getSuccessors();
+ for (int i = 0; i < successors.length; i++) {
+ successors[i] = factory.getVersionDecorator(session, successors[i]);
+ }
+ return successors;
+ }
+
+ /**
+ * @inheritDoc
+ */
+ public Version[] getPredecessors() throws RepositoryException {
+ Version[] predecessors = version.getPredecessors();
+ for (int i = 0; i < predecessors.length; i++) {
+ predecessors[i] = factory.getVersionDecorator(session, predecessors[i]);
+ }
+ return predecessors;
+ }
+}
Property changes on: java/org/apache/jackrabbit/decorator/VersionDecorator.java
___________________________________________________________________
Name: svn:eol-style
+ native
Index: java/org/apache/jackrabbit/decorator/NodeDecorator.java
===================================================================
--- java/org/apache/jackrabbit/decorator/NodeDecorator.java (revision 320755)
+++ java/org/apache/jackrabbit/decorator/NodeDecorator.java (working copy)
@@ -35,6 +35,7 @@
import javax.jcr.UnsupportedRepositoryOperationException;
import javax.jcr.Value;
import javax.jcr.ValueFormatException;
+import javax.jcr.MergeException;
import javax.jcr.lock.Lock;
import javax.jcr.lock.LockException;
import javax.jcr.nodetype.ConstraintViolationException;
@@ -45,23 +46,39 @@
import javax.jcr.version.VersionException;
import javax.jcr.version.VersionHistory;
-public class NodeDecorator extends ChainedItemDecorator implements Node {
+public class NodeDecorator extends ItemDecorator implements Node {
- private DecoratorFactory factory;
+ protected Node node;
- private Session session;
-
- private Node node;
-
- public NodeDecorator(
- ItemDecorator decorator,
- DecoratorFactory factory, Session session, Node node) {
- super(decorator);
- this.factory = factory;
- this.session = session;
+ public NodeDecorator(DecoratorFactory factory, Session session, Node node) {
+ super(factory, session, node);
this.node = node;
}
+ /**
+ * Returns the underlying Node of the node
+ * that decorates it. Unwrapping null returns null.
+ *
+ * @param node decorates the underlying node.
+ * @return the underlying node.
+ * @throws IllegalStateException if node is not of type
+ * {@link NodeDecorator}.
+ */
+ public static Node unwrap(Node node) {
+ if (node == null) {
+ return null;
+ }
+ if (node instanceof NodeDecorator) {
+ node = (Node) ((NodeDecorator) node).unwrap();
+ } else {
+ throw new IllegalStateException("node is not of type NodeDecorator");
+ }
+ return node;
+ }
+
+ /**
+ * @inheritDoc
+ */
public Node addNode(String name) throws ItemExistsException,
PathNotFoundException, VersionException,
ConstraintViolationException, LockException, RepositoryException {
@@ -69,6 +86,9 @@
return factory.getNodeDecorator(session, child);
}
+ /**
+ * @inheritDoc
+ */
public Node addNode(String name, String type) throws ItemExistsException,
PathNotFoundException, NoSuchNodeTypeException, LockException,
VersionException, ConstraintViolationException, RepositoryException {
@@ -76,350 +96,487 @@
return factory.getNodeDecorator(session, child);
}
- public void orderBefore(String arg0, String arg1)
+ /**
+ * @inheritDoc
+ */
+ public void orderBefore(String srcChildRelPath, String destChildRelPath)
throws UnsupportedRepositoryOperationException, VersionException,
- ConstraintViolationException, ItemNotFoundException, LockException,
- RepositoryException {
- // TODO Auto-generated method stub
-
+ ConstraintViolationException, ItemNotFoundException,
+ LockException, RepositoryException {
+ node.orderBefore(srcChildRelPath, destChildRelPath);
}
- public Property setProperty(String arg0, Value arg1)
+ /**
+ * @inheritDoc
+ */
+ public Property setProperty(String name, Value value)
throws ValueFormatException, VersionException, LockException,
ConstraintViolationException, RepositoryException {
- // TODO Auto-generated method stub
- return null;
+ Property prop = node.setProperty(name, value);
+ return factory.getPropertyDecorator(session, prop);
}
- public Property setProperty(String arg0, Value arg1, int arg2)
+ /**
+ * @inheritDoc
+ */
+ public Property setProperty(String name, Value value, int type)
throws ValueFormatException, VersionException, LockException,
ConstraintViolationException, RepositoryException {
- // TODO Auto-generated method stub
- return null;
+ Property prop = node.setProperty(name, value, type);
+ return factory.getPropertyDecorator(session, prop);
}
- public Property setProperty(String arg0, Value[] arg1)
+ /**
+ * @inheritDoc
+ */
+ public Property setProperty(String name, Value[] values)
throws ValueFormatException, VersionException, LockException,
ConstraintViolationException, RepositoryException {
- // TODO Auto-generated method stub
- return null;
+ Property prop = node.setProperty(name, values);
+ return factory.getPropertyDecorator(session, prop);
}
- public Property setProperty(String arg0, Value[] arg1, int arg2)
+ /**
+ * @inheritDoc
+ */
+ public Property setProperty(String name, Value[] values, int type)
throws ValueFormatException, VersionException, LockException,
ConstraintViolationException, RepositoryException {
- // TODO Auto-generated method stub
- return null;
+ Property prop = node.setProperty(name, values, type);
+ return factory.getPropertyDecorator(session, prop);
}
- public Property setProperty(String arg0, String[] arg1)
+ /**
+ * @inheritDoc
+ */
+ public Property setProperty(String name, String[] values)
throws ValueFormatException, VersionException, LockException,
ConstraintViolationException, RepositoryException {
- // TODO Auto-generated method stub
- return null;
+ Property prop = node.setProperty(name, values);
+ return factory.getPropertyDecorator(session, prop);
}
- public Property setProperty(String arg0, String[] arg1, int arg2)
+ /**
+ * @inheritDoc
+ */
+ public Property setProperty(String name, String[] values, int type)
throws ValueFormatException, VersionException, LockException,
ConstraintViolationException, RepositoryException {
- // TODO Auto-generated method stub
- return null;
+ Property prop = node.setProperty(name, values, type);
+ return factory.getPropertyDecorator(session, prop);
}
- public Property setProperty(String arg0, String arg1)
+ /**
+ * @inheritDoc
+ */
+ public Property setProperty(String name, String value)
throws ValueFormatException, VersionException, LockException,
ConstraintViolationException, RepositoryException {
- // TODO Auto-generated method stub
- return null;
+ Property prop = node.setProperty(name, value);
+ return factory.getPropertyDecorator(session, prop);
}
- public Property setProperty(String arg0, String arg1, int arg2)
+ /**
+ * @inheritDoc
+ */
+ public Property setProperty(String name, String value, int type)
throws ValueFormatException, VersionException, LockException,
ConstraintViolationException, RepositoryException {
- // TODO Auto-generated method stub
- return null;
+ Property prop = node.setProperty(name, value, type);
+ return factory.getPropertyDecorator(session, prop);
}
- public Property setProperty(String arg0, InputStream arg1)
+ /**
+ * @inheritDoc
+ */
+ public Property setProperty(String name, InputStream value)
throws ValueFormatException, VersionException, LockException,
ConstraintViolationException, RepositoryException {
- // TODO Auto-generated method stub
- return null;
+ Property prop = node.setProperty(name, value);
+ return factory.getPropertyDecorator(session, prop);
}
- public Property setProperty(String arg0, boolean arg1)
+ /**
+ * @inheritDoc
+ */
+ public Property setProperty(String name, boolean value)
throws ValueFormatException, VersionException, LockException,
ConstraintViolationException, RepositoryException {
- // TODO Auto-generated method stub
- return null;
+ Property prop = node.setProperty(name, value);
+ return factory.getPropertyDecorator(session, prop);
}
- public Property setProperty(String arg0, double arg1)
+ /**
+ * @inheritDoc
+ */
+ public Property setProperty(String name, double value)
throws ValueFormatException, VersionException, LockException,
ConstraintViolationException, RepositoryException {
- // TODO Auto-generated method stub
- return null;
+ Property prop = node.setProperty(name, value);
+ return factory.getPropertyDecorator(session, prop);
}
- public Property setProperty(String arg0, long arg1)
+ /**
+ * @inheritDoc
+ */
+ public Property setProperty(String name, long value)
throws ValueFormatException, VersionException, LockException,
ConstraintViolationException, RepositoryException {
- // TODO Auto-generated method stub
- return null;
+ Property prop = node.setProperty(name, value);
+ return factory.getPropertyDecorator(session, prop);
}
- public Property setProperty(String arg0, Calendar arg1)
+ /**
+ * @inheritDoc
+ */
+ public Property setProperty(String name, Calendar value)
throws ValueFormatException, VersionException, LockException,
ConstraintViolationException, RepositoryException {
- // TODO Auto-generated method stub
- return null;
+ Property prop = node.setProperty(name, value);
+ return factory.getPropertyDecorator(session, prop);
}
- public Property setProperty(String arg0, Node arg1)
+ /**
+ * @inheritDoc
+ */
+ public Property setProperty(String name, Node value)
throws ValueFormatException, VersionException, LockException,
ConstraintViolationException, RepositoryException {
- // TODO Auto-generated method stub
- return null;
+ Property prop = node.setProperty(name, NodeDecorator.unwrap(value));
+ return factory.getPropertyDecorator(session, prop);
}
- public Node getNode(String arg0) throws PathNotFoundException,
- RepositoryException {
- // TODO Auto-generated method stub
- return null;
+ /**
+ * @inheritDoc
+ */
+ public Node getNode(String relPath) throws PathNotFoundException, RepositoryException {
+ Node n = node.getNode(relPath);
+ return factory.getNodeDecorator(session, n);
}
+ /**
+ * @inheritDoc
+ */
public NodeIterator getNodes() throws RepositoryException {
- // TODO Auto-generated method stub
- return null;
+ return new DecoratingNodeIterator(factory, session, node.getNodes());
}
- public NodeIterator getNodes(String arg0) throws RepositoryException {
- // TODO Auto-generated method stub
- return null;
+ /**
+ * @inheritDoc
+ */
+ public NodeIterator getNodes(String namePattern)
+ throws RepositoryException {
+ return new DecoratingNodeIterator(factory, session, node.getNodes(namePattern));
}
- public Property getProperty(String arg0) throws PathNotFoundException,
- RepositoryException {
- // TODO Auto-generated method stub
- return null;
+ /**
+ * @inheritDoc
+ */
+ public Property getProperty(String relPath)
+ throws PathNotFoundException, RepositoryException {
+ Property prop = node.getProperty(relPath);
+ return factory.getPropertyDecorator(session, prop);
}
+ /**
+ * @inheritDoc
+ */
public PropertyIterator getProperties() throws RepositoryException {
- // TODO Auto-generated method stub
- return null;
+ return new DecoratingPropertyIterator(factory, session, node.getProperties());
}
- public PropertyIterator getProperties(String arg0)
+ /**
+ * @inheritDoc
+ */
+ public PropertyIterator getProperties(String namePattern)
throws RepositoryException {
- // TODO Auto-generated method stub
- return null;
+ return new DecoratingPropertyIterator(factory, session, node.getProperties(namePattern));
}
+ /**
+ * @inheritDoc
+ */
public Item getPrimaryItem() throws ItemNotFoundException,
RepositoryException {
- // TODO Auto-generated method stub
- return null;
+ return factory.getItemDecorator(session, node.getPrimaryItem());
}
+ /**
+ * @inheritDoc
+ */
public String getUUID() throws UnsupportedRepositoryOperationException,
RepositoryException {
- // TODO Auto-generated method stub
- return null;
+ return node.getUUID();
}
+ /**
+ * @inheritDoc
+ */
public int getIndex() throws RepositoryException {
- // TODO Auto-generated method stub
- return 0;
+ return node.getIndex();
}
+ /**
+ * @inheritDoc
+ */
public PropertyIterator getReferences() throws RepositoryException {
- // TODO Auto-generated method stub
- return null;
+ return new DecoratingPropertyIterator(factory, session, node.getReferences());
}
- public boolean hasNode(String arg0) throws RepositoryException {
- // TODO Auto-generated method stub
- return false;
+ /**
+ * @inheritDoc
+ */
+ public boolean hasNode(String relPath) throws RepositoryException {
+ return node.hasNode(relPath);
}
- public boolean hasProperty(String arg0) throws RepositoryException {
- // TODO Auto-generated method stub
- return false;
+ /**
+ * @inheritDoc
+ */
+ public boolean hasProperty(String relPath) throws RepositoryException {
+ return node.hasProperty(relPath);
}
+ /**
+ * @inheritDoc
+ */
public boolean hasNodes() throws RepositoryException {
- // TODO Auto-generated method stub
- return false;
+ return node.hasNodes();
}
+ /**
+ * @inheritDoc
+ */
public boolean hasProperties() throws RepositoryException {
- // TODO Auto-generated method stub
- return false;
+ return node.hasProperties();
}
+ /**
+ * @inheritDoc
+ */
public NodeType getPrimaryNodeType() throws RepositoryException {
- // TODO Auto-generated method stub
- return null;
+ return node.getPrimaryNodeType();
}
+ /**
+ * @inheritDoc
+ */
public NodeType[] getMixinNodeTypes() throws RepositoryException {
- // TODO Auto-generated method stub
- return null;
+ return node.getMixinNodeTypes();
}
- public boolean isNodeType(String arg0) throws RepositoryException {
- // TODO Auto-generated method stub
- return false;
+ /**
+ * @inheritDoc
+ */
+ public boolean isNodeType(String nodeTypeName) throws RepositoryException {
+ return node.isNodeType(nodeTypeName);
}
- public void addMixin(String arg0) throws NoSuchNodeTypeException,
- VersionException, ConstraintViolationException, LockException,
- RepositoryException {
- // TODO Auto-generated method stub
-
+ /**
+ * @inheritDoc
+ */
+ public void addMixin(String mixinName)
+ throws NoSuchNodeTypeException, VersionException,
+ ConstraintViolationException, LockException, RepositoryException {
+ node.addMixin(mixinName);
}
- public void removeMixin(String arg0) throws NoSuchNodeTypeException,
- VersionException, ConstraintViolationException, LockException,
- RepositoryException {
- // TODO Auto-generated method stub
-
+ /**
+ * @inheritDoc
+ */
+ public void removeMixin(String mixinName)
+ throws NoSuchNodeTypeException, VersionException,
+ ConstraintViolationException, LockException, RepositoryException {
+ node.removeMixin(mixinName);
}
- public boolean canAddMixin(String arg0) throws NoSuchNodeTypeException,
- RepositoryException {
- // TODO Auto-generated method stub
- return false;
+ /**
+ * @inheritDoc
+ */
+ public boolean canAddMixin(String mixinName)
+ throws NoSuchNodeTypeException, RepositoryException {
+ return node.canAddMixin(mixinName);
}
+ /**
+ * @inheritDoc
+ */
public NodeDefinition getDefinition() throws RepositoryException {
- // TODO Auto-generated method stub
- return null;
+ return node.getDefinition();
}
+ /**
+ * @inheritDoc
+ */
public Version checkin() throws VersionException,
UnsupportedRepositoryOperationException, InvalidItemStateException,
LockException, RepositoryException {
- // TODO Auto-generated method stub
- return null;
+ Version version = node.checkin();
+ return factory.getVersionDecorator(session, version);
}
+ /**
+ * @inheritDoc
+ */
public void checkout() throws UnsupportedRepositoryOperationException,
LockException, RepositoryException {
- // TODO Auto-generated method stub
-
+ node.checkout();
}
- public void doneMerge(Version arg0) throws VersionException,
- InvalidItemStateException, UnsupportedRepositoryOperationException,
- RepositoryException {
- // TODO Auto-generated method stub
-
+ /**
+ * @inheritDoc
+ */
+ public void doneMerge(Version version)
+ throws VersionException, InvalidItemStateException,
+ UnsupportedRepositoryOperationException, RepositoryException {
+ node.doneMerge(VersionDecorator.unwrap(version));
}
- public void cancelMerge(Version arg0) throws VersionException,
- InvalidItemStateException, UnsupportedRepositoryOperationException,
- RepositoryException {
- // TODO Auto-generated method stub
-
+ /**
+ * @inheritDoc
+ */
+ public void cancelMerge(Version version)
+ throws VersionException, InvalidItemStateException,
+ UnsupportedRepositoryOperationException, RepositoryException {
+ node.cancelMerge(VersionDecorator.unwrap(version));
}
- public void update(String arg0) throws NoSuchWorkspaceException,
- AccessDeniedException, LockException, InvalidItemStateException,
- RepositoryException {
- // TODO Auto-generated method stub
-
+ /**
+ * @inheritDoc
+ */
+ public void update(String srcWorkspaceName)
+ throws NoSuchWorkspaceException, AccessDeniedException,
+ LockException, InvalidItemStateException, RepositoryException {
+ node.update(srcWorkspaceName);
}
- public NodeIterator merge(String arg0, boolean arg1)
+ /**
+ * @inheritDoc
+ */
+ public NodeIterator merge(String srcWorkspace, boolean bestEffort)
throws NoSuchWorkspaceException, AccessDeniedException,
- VersionException, LockException, InvalidItemStateException,
+ MergeException, LockException, InvalidItemStateException,
RepositoryException {
- // TODO Auto-generated method stub
- return null;
+ NodeIterator nodes = node.merge(srcWorkspace, bestEffort);
+ return new DecoratingNodeIterator(factory, session, nodes);
}
- public String getCorrespondingNodePath(String arg0)
+ /**
+ * @inheritDoc
+ */
+ public String getCorrespondingNodePath(String workspaceName)
throws ItemNotFoundException, NoSuchWorkspaceException,
AccessDeniedException, RepositoryException {
- // TODO Auto-generated method stub
- return null;
+ return node.getCorrespondingNodePath(workspaceName);
}
+ /**
+ * @inheritDoc
+ */
public boolean isCheckedOut() throws RepositoryException {
- // TODO Auto-generated method stub
- return false;
+ return node.isCheckedOut();
}
- public void restore(String arg0, boolean arg1) throws VersionException,
- ItemExistsException, UnsupportedRepositoryOperationException,
- LockException, InvalidItemStateException, RepositoryException {
- // TODO Auto-generated method stub
-
+ /**
+ * @inheritDoc
+ */
+ public void restore(String versionName, boolean removeExisting)
+ throws VersionException, ItemExistsException,
+ UnsupportedRepositoryOperationException, LockException,
+ InvalidItemStateException, RepositoryException {
+ node.restore(versionName, removeExisting);
}
- public void restore(Version arg0, boolean arg1) throws VersionException,
- ItemExistsException, UnsupportedRepositoryOperationException,
- LockException, RepositoryException {
- // TODO Auto-generated method stub
-
+ /**
+ * @inheritDoc
+ */
+ public void restore(Version version, boolean removeExisting)
+ throws VersionException, ItemExistsException,
+ UnsupportedRepositoryOperationException, LockException,
+ RepositoryException {
+ node.restore(VersionDecorator.unwrap(version), removeExisting);
}
- public void restore(Version arg0, String arg1, boolean arg2)
+ /**
+ * @inheritDoc
+ */
+ public void restore(Version version,
+ String relPath,
+ boolean removeExisting)
throws PathNotFoundException, ItemExistsException,
VersionException, ConstraintViolationException,
UnsupportedRepositoryOperationException, LockException,
InvalidItemStateException, RepositoryException {
- // TODO Auto-generated method stub
-
+ node.restore(VersionDecorator.unwrap(version), relPath, removeExisting);
}
- public void restoreByLabel(String arg0, boolean arg1)
+ /**
+ * @inheritDoc
+ */
+ public void restoreByLabel(String versionLabel, boolean removeExisting)
throws VersionException, ItemExistsException,
UnsupportedRepositoryOperationException, LockException,
InvalidItemStateException, RepositoryException {
- // TODO Auto-generated method stub
-
+ node.restoreByLabel(versionLabel, removeExisting);
}
+ /**
+ * @inheritDoc
+ */
public VersionHistory getVersionHistory()
throws UnsupportedRepositoryOperationException, RepositoryException {
- // TODO Auto-generated method stub
- return null;
+ VersionHistory hist = node.getVersionHistory();
+ return factory.getVersionHistoryDecorator(session, hist);
}
+ /**
+ * @inheritDoc
+ */
public Version getBaseVersion()
throws UnsupportedRepositoryOperationException, RepositoryException {
- // TODO Auto-generated method stub
- return null;
+ return factory.getVersionDecorator(session, node.getBaseVersion());
}
- public Lock lock(boolean arg0, boolean arg1)
+ /**
+ * @inheritDoc
+ */
+ public Lock lock(boolean isDeep, boolean isSessionScoped)
throws UnsupportedRepositoryOperationException, LockException,
AccessDeniedException, InvalidItemStateException,
RepositoryException {
- Lock lock = node.lock(arg0, arg1);
- return factory.getLockDecorator(this, lock);
+ Lock lock = node.lock(isDeep, isSessionScoped);
+ return factory.getLockDecorator(session, lock);
}
+ /**
+ * @inheritDoc
+ */
public Lock getLock() throws UnsupportedRepositoryOperationException,
LockException, AccessDeniedException, RepositoryException {
- return node.getLock();
+ Lock lock = node.getLock();
+ return factory.getLockDecorator(session, lock);
}
+ /**
+ * @inheritDoc
+ */
public void unlock() throws UnsupportedRepositoryOperationException,
LockException, AccessDeniedException, InvalidItemStateException,
RepositoryException {
node.unlock();
}
+ /**
+ * @inheritDoc
+ */
public boolean holdsLock() throws RepositoryException {
- // TODO Auto-generated method stub
return node.holdsLock();
}
+ /**
+ * @inheritDoc
+ */
public boolean isLocked() throws RepositoryException {
return node.isLocked();
}
-
}
Index: java/org/apache/jackrabbit/decorator/LockDecorator.java
===================================================================
--- java/org/apache/jackrabbit/decorator/LockDecorator.java (revision 320755)
+++ java/org/apache/jackrabbit/decorator/LockDecorator.java (working copy)
@@ -18,46 +18,68 @@
import javax.jcr.Node;
import javax.jcr.RepositoryException;
+import javax.jcr.Session;
import javax.jcr.lock.Lock;
import javax.jcr.lock.LockException;
-public class LockDecorator implements Lock {
+/**
+ *
+ */
+public class LockDecorator extends AbstractDecorator implements Lock {
- private final Node node;
+ protected final Lock lock;
- private final Lock lock;
-
- public LockDecorator(Node node, Lock lock) {
- this.node = node;
+ public LockDecorator(DecoratorFactory factory, Session session, Lock lock) {
+ super(factory, session);
this.lock = lock;
}
+ /**
+ * @inheritDoc
+ */
public Node getNode() {
- return node;
+ return factory.getNodeDecorator(session, lock.getNode());
}
+ /**
+ * @inheritDoc
+ */
public String getLockOwner() {
return lock.getLockOwner();
}
+ /**
+ * @inheritDoc
+ */
public boolean isDeep() {
return lock.isDeep();
}
+ /**
+ * @inheritDoc
+ */
public String getLockToken() {
return lock.getLockToken();
}
+ /**
+ * @inheritDoc
+ */
public boolean isLive() throws RepositoryException {
return lock.isLive();
}
+ /**
+ * @inheritDoc
+ */
public boolean isSessionScoped() {
return lock.isSessionScoped();
}
+ /**
+ * @inheritDoc
+ */
public void refresh() throws LockException, RepositoryException {
lock.refresh();
}
-
}
Index: java/org/apache/jackrabbit/decorator/DecoratingPropertyIterator.java
===================================================================
--- java/org/apache/jackrabbit/decorator/DecoratingPropertyIterator.java (revision 0)
+++ java/org/apache/jackrabbit/decorator/DecoratingPropertyIterator.java (revision 0)
@@ -0,0 +1,47 @@
+/*
+ * Copyright 2004-2005 The Apache Software Foundation or its licensors,
+ * as applicable.
+ *
+ * Licensed 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.decorator;
+
+import javax.jcr.Session;
+import javax.jcr.PropertyIterator;
+import javax.jcr.Property;
+
+/**
+ */
+public class DecoratingPropertyIterator extends DecoratingRangeIterator
+ implements PropertyIterator {
+
+ /**
+ * Creates a decorating property iterator.
+ *
+ * @param factory decorator factory
+ * @param session decorated session
+ * @param iterator underlying property iterator
+ */
+ public DecoratingPropertyIterator(DecoratorFactory factory,
+ Session session,
+ PropertyIterator iterator) {
+ super(factory, session, iterator);
+ }
+
+ /**
+ * @inheritDoc
+ */
+ public Property nextProperty() {
+ return (Property) next();
+ }
+}
Property changes on: java/org/apache/jackrabbit/decorator/DecoratingPropertyIterator.java
___________________________________________________________________
Name: svn:eol-style
+ native