You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jackrabbit.apache.org by md...@apache.org on 2011/09/01 13:52:13 UTC
svn commit: r1164026 [9/11] - in
/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi:
./ config/ hierarchy/ lock/ nodetype/ observation/ operation/ query/
security/ state/ util/ version/ xml/
Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/TransientOperationVisitor.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/TransientOperationVisitor.java?rev=1164026&r1=1164025&r2=1164026&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/TransientOperationVisitor.java (original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/TransientOperationVisitor.java Thu Sep 1 11:52:08 2011
@@ -34,154 +34,97 @@ import javax.jcr.version.VersionExceptio
*/
public abstract class TransientOperationVisitor implements OperationVisitor {
- /**
- * @throws UnsupportedOperationException
- * @see OperationVisitor#visit(Clone)
- */
- public void visit(Clone operation) throws NoSuchWorkspaceException, LockException, ConstraintViolationException, AccessDeniedException, ItemExistsException, UnsupportedRepositoryOperationException, VersionException, RepositoryException {
+ @Override
+ public void visit(Clone operation) throws RepositoryException {
throw new UnsupportedOperationException("Internal error: Clone isn't a transient operation.");
}
- /**
- * @throws UnsupportedOperationException
- * @see OperationVisitor#visit(Copy)
- */
- public void visit(Copy operation) throws NoSuchWorkspaceException, LockException, ConstraintViolationException, AccessDeniedException, ItemExistsException, UnsupportedRepositoryOperationException, VersionException, RepositoryException {
+ @Override
+ public void visit(Copy operation) throws RepositoryException {
throw new UnsupportedOperationException("Internal error: Copy isn't a transient operation.");
}
- /**
- * @throws UnsupportedOperationException
- * @see OperationVisitor#visit(Checkout)
- */
- public void visit(Checkout operation) throws RepositoryException, UnsupportedRepositoryOperationException {
+ @Override
+ public void visit(Checkout operation) throws RepositoryException {
throw new UnsupportedOperationException("Internal error: Checkout isn't a transient operation.");
}
- /**
- * @throws UnsupportedOperationException
- * @see OperationVisitor#visit(Checkin)
- */
- public void visit(Checkin operation) throws UnsupportedRepositoryOperationException, LockException, InvalidItemStateException, RepositoryException {
+ @Override
+ public void visit(Checkin operation) throws RepositoryException {
throw new UnsupportedOperationException("Internal error: Checkin isn't a transient operation.");
}
- /**
- * @throws UnsupportedOperationException
- * @see OperationVisitor#visit(Checkpoint)
- */
- public void visit(Checkpoint operation) throws UnsupportedRepositoryOperationException, LockException, InvalidItemStateException, RepositoryException {
+ @Override
+ public void visit(Checkpoint operation) throws RepositoryException {
throw new UnsupportedOperationException("Internal error: Checkin isn't a transient operation.");
}
- /**
- * @throws UnsupportedOperationException
- * @see OperationVisitor#visit(Update)
- */
- public void visit(Update operation) throws NoSuchWorkspaceException, AccessDeniedException, LockException, InvalidItemStateException, RepositoryException {
+ @Override
+ public void visit(Update operation) throws RepositoryException {
throw new UnsupportedOperationException("Internal error: Update isn't a transient operation.");
}
- /**
- * @throws UnsupportedOperationException
- * @see OperationVisitor#visit(Restore)
- */
- public void visit(Restore operation) throws VersionException, PathNotFoundException, ItemExistsException, UnsupportedRepositoryOperationException, LockException, InvalidItemStateException, RepositoryException {
+ @Override
+ public void visit(Restore operation) throws RepositoryException {
throw new UnsupportedOperationException("Internal error: Restore isn't a transient operation.");
}
- /**
- * @throws UnsupportedOperationException
- * @see OperationVisitor#visit(Merge)
- */
- public void visit(Merge operation) throws NoSuchWorkspaceException, AccessDeniedException, MergeException, LockException, InvalidItemStateException, RepositoryException {
+ @Override
+ public void visit(Merge operation) throws RepositoryException {
throw new UnsupportedOperationException("Internal error: Merge isn't a transient operation.");
}
- /**
- * @throws UnsupportedOperationException
- * @see OperationVisitor#visit(ResolveMergeConflict)
- */
- public void visit(ResolveMergeConflict operation) throws VersionException, InvalidItemStateException, UnsupportedRepositoryOperationException, RepositoryException {
+ @Override
+ public void visit(ResolveMergeConflict operation) throws RepositoryException {
throw new UnsupportedOperationException("Internal error: ResolveMergeConflict isn't a transient operation.");
}
- /**
- * @throws UnsupportedOperationException
- * @see OperationVisitor#visit(LockOperation)
- */
- public void visit(LockOperation operation) throws AccessDeniedException, InvalidItemStateException, UnsupportedRepositoryOperationException, LockException, RepositoryException {
+ @Override
+ public void visit(LockOperation operation) throws RepositoryException {
throw new UnsupportedOperationException("Internal error: Lock isn't a transient operation.");
}
- /**
- * @throws UnsupportedOperationException
- * @see OperationVisitor#visit(LockRefresh)
- */
- public void visit(LockRefresh operation) throws AccessDeniedException, InvalidItemStateException, UnsupportedRepositoryOperationException, LockException, RepositoryException {
+ @Override
+ public void visit(LockRefresh operation) throws RepositoryException {
throw new UnsupportedOperationException("Internal error: LockRefresh isn't a transient operation.");
}
- /**
- * @throws UnsupportedOperationException
- * @see OperationVisitor#visit(LockRelease)
- */
- public void visit(LockRelease operation) throws AccessDeniedException, InvalidItemStateException, UnsupportedRepositoryOperationException, LockException, RepositoryException {
+ @Override
+ public void visit(LockRelease operation) throws RepositoryException {
throw new UnsupportedOperationException("Internal error: LockRelease isn't a transient operation.");
}
- /**
- * @throws UnsupportedOperationException
- * @see OperationVisitor#visit(AddLabel)
- */
- public void visit(AddLabel operation) throws VersionException, RepositoryException {
+ @Override
+ public void visit(AddLabel operation) throws RepositoryException {
throw new UnsupportedOperationException("Internal error: AddLabel isn't a transient operation.");
}
- /**
- * @throws UnsupportedOperationException
- * @see OperationVisitor#visit(RemoveLabel)
- */
- public void visit(RemoveLabel operation) throws VersionException, RepositoryException {
+ @Override
+ public void visit(RemoveLabel operation) throws RepositoryException {
throw new UnsupportedOperationException("Internal error: RemoveLabel isn't a transient operation.");
}
- /**
- * @throws UnsupportedOperationException
- * @see OperationVisitor#visit(RemoveVersion)
- */
- public void visit(RemoveVersion operation) throws VersionException, AccessDeniedException, ReferentialIntegrityException, RepositoryException {
+ @Override
+ public void visit(RemoveVersion operation) throws RepositoryException {
throw new UnsupportedOperationException("Internal error: RemoveVersion isn't a transient operation.");
}
- /**
- * @throws UnsupportedOperationException
- * @see OperationVisitor#visit(WorkspaceImport)
- */
+ @Override
public void visit(WorkspaceImport operation) throws RepositoryException {
throw new UnsupportedOperationException("Internal error: WorkspaceImport isn't a transient operation.");
}
- /**
- * @throws UnsupportedOperationException
- * @see OperationVisitor#visit(CreateActivity)
- */
+ @Override
public void visit(CreateActivity operation) throws RepositoryException {
throw new UnsupportedOperationException("Internal error: CreateActivity isn't a transient operation.");
}
- /**
- * @throws UnsupportedOperationException
- * @see OperationVisitor#visit(RemoveActivity)
- */
+ @Override
public void visit(RemoveActivity operation) throws RepositoryException {
throw new UnsupportedOperationException("Internal error: RemoveActivity isn't a transient operation.");
}
- /**
- * @throws UnsupportedOperationException
- * @see OperationVisitor#visit(CreateConfiguration)
- */
+ @Override
public void visit(CreateConfiguration operation) throws RepositoryException {
throw new UnsupportedOperationException("Internal error: CreateConfiguration isn't a transient operation.");
}
Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/Update.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/Update.java?rev=1164026&r1=1164025&r2=1164026&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/Update.java (original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/Update.java Thu Sep 1 11:52:08 2011
@@ -31,7 +31,6 @@ import javax.jcr.version.VersionExceptio
* <code>Update</code>...
*/
public class Update extends AbstractOperation {
-
private final NodeState nodeState;
private final String srcWorkspaceName;
@@ -43,20 +42,23 @@ public class Update extends AbstractOper
}
//----------------------------------------------------------< Operation >---
+
/**
* @see Operation#accept(OperationVisitor)
*/
- public void accept(OperationVisitor visitor) throws RepositoryException, ConstraintViolationException, AccessDeniedException, ItemExistsException, NoSuchNodeTypeException, UnsupportedRepositoryOperationException, VersionException {
+ @Override
+ public void accept(OperationVisitor visitor) throws RepositoryException {
assert status == STATUS_PENDING;
visitor.visit(this);
}
/**
* Invalidates the <code>NodeState</code> that has been updated and all
- * its decendants.
+ * its descendants.
*
* @see Operation#persisted()
*/
+ @Override
public void persisted() {
assert status == STATUS_PENDING;
status = STATUS_PERSISTED;
@@ -64,6 +66,7 @@ public class Update extends AbstractOper
}
//----------------------------------------< Access Operation Parameters >---
+
public NodeId getNodeId() throws RepositoryException {
return nodeState.getNodeEntry().getWorkspaceId();
}
@@ -73,6 +76,7 @@ public class Update extends AbstractOper
}
//------------------------------------------------------------< Factory >---
+
/**
*
* @param nodeState
@@ -80,7 +84,6 @@ public class Update extends AbstractOper
* @return
*/
public static Operation create(NodeState nodeState, String srcWorkspaceName) {
- Update up = new Update(nodeState, srcWorkspaceName);
- return up;
+ return new Update(nodeState, srcWorkspaceName);
}
}
\ No newline at end of file
Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/WorkspaceImport.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/WorkspaceImport.java?rev=1164026&r1=1164025&r2=1164026&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/WorkspaceImport.java (original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/WorkspaceImport.java Thu Sep 1 11:52:08 2011
@@ -34,7 +34,6 @@ import java.io.InputStream;
* <code>WorkspaceImport</code>...
*/
public class WorkspaceImport extends AbstractOperation {
-
private final NodeState nodeState;
private final InputStream xmlStream;
private final int uuidBehaviour;
@@ -51,20 +50,23 @@ public class WorkspaceImport extends Abs
}
//----------------------------------------------------------< Operation >---
+
/**
* @see Operation#accept(OperationVisitor)
*/
- public void accept(OperationVisitor visitor) throws RepositoryException, ConstraintViolationException, AccessDeniedException, ItemExistsException, NoSuchNodeTypeException, UnsupportedRepositoryOperationException, VersionException {
+ @Override
+ public void accept(OperationVisitor visitor) throws RepositoryException {
assert status == STATUS_PENDING;
visitor.visit(this);
}
/**
* Invalidates the <code>NodeState</code> that has been updated and all
- * its decendants.
+ * its descendants.
*
* @see Operation#persisted()
*/
+ @Override
public void persisted() {
assert status == STATUS_PENDING;
status = STATUS_PERSISTED;
@@ -85,6 +87,7 @@ public class WorkspaceImport extends Abs
}
//----------------------------------------< Access Operation Parameters >---
+
public NodeId getNodeId() throws RepositoryException {
return nodeState.getNodeId();
}
@@ -98,6 +101,7 @@ public class WorkspaceImport extends Abs
}
//------------------------------------------------------------< Factory >---
+
/**
*
* @param nodeState
Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/query/NodeIteratorImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/query/NodeIteratorImpl.java?rev=1164026&r1=1164025&r2=1164026&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/query/NodeIteratorImpl.java (original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/query/NodeIteratorImpl.java Thu Sep 1 11:52:08 2011
@@ -53,7 +53,7 @@ public class NodeIteratorImpl implements
private int pos = -1;
/** Number of invalid nodes */
- private int invalid = 0;
+ private int invalid;
/** Id of the next Node */
private NodeId nextId;
@@ -72,24 +72,24 @@ public class NodeIteratorImpl implements
* HierarchyEntry objects from the ids returned by the query.
* @param queryInfo the query result.
*/
- public NodeIteratorImpl(ItemManager itemMgr, HierarchyManager hierarchyMgr,
- QueryInfo queryInfo) {
+ public NodeIteratorImpl(ItemManager itemMgr, HierarchyManager hierarchyMgr, QueryInfo queryInfo) {
this.itemMgr = itemMgr;
this.hierarchyMgr = hierarchyMgr;
- this.rows = queryInfo.getRows();
+ rows = queryInfo.getRows();
fetchNext();
}
//------------------------------------------------------< ScoreIterator >---
+
/**
* Returns the score of the node returned by {@link #nextNode()}. In other
* words, this method returns the score value of the next <code>Node</code>.
*
* @return the score of the node returned by {@link #nextNode()}.
* @throws NoSuchElementException if there is no next node.
- * @see ScoreNodeIterator#getScore()
*/
+ @Override
public double getScore() throws NoSuchElementException {
if (!hasNext()) {
throw new NoSuchElementException();
@@ -98,6 +98,7 @@ public class NodeIteratorImpl implements
}
//-------------------------------------------------------< NodeIterator >---
+
/**
* Returns the next <code>Node</code> in the result set.
*
@@ -105,6 +106,7 @@ public class NodeIteratorImpl implements
* @throws NoSuchElementException if iteration has no more <code>Node</code>s.
* @see javax.jcr.NodeIterator#nextNode()
*/
+ @Override
public Node nextNode() throws NoSuchElementException {
if (next == null) {
throw new NoSuchElementException();
@@ -115,6 +117,7 @@ public class NodeIteratorImpl implements
}
//------------------------------------------------------< RangeIterator >---
+
/**
* Skip a number of <code>Node</code>s in this iterator.
*
@@ -123,6 +126,7 @@ public class NodeIteratorImpl implements
* in this iterator.
* @see javax.jcr.NodeIterator#skip(long)
*/
+ @Override
public void skip(long skipNum) throws NoSuchElementException {
if (skipNum < 0) {
throw new IllegalArgumentException("skipNum must not be negative");
@@ -149,11 +153,12 @@ public class NodeIteratorImpl implements
* @return the number of node in this iterator.
* @see javax.jcr.RangeIterator#getSize()
*/
+ @Override
public long getSize() {
- if (rows.getSize() != -1) {
- return rows.getSize() - invalid;
- } else {
+ if (rows.getSize() == -1) {
return -1;
+ } else {
+ return rows.getSize() - invalid;
}
}
@@ -163,6 +168,7 @@ public class NodeIteratorImpl implements
* @return the current position in this <code>NodeIterator</code>.
* @see javax.jcr.RangeIterator#getPosition()
*/
+ @Override
public long getPosition() {
return pos - invalid;
}
@@ -174,6 +180,7 @@ public class NodeIteratorImpl implements
* @throws NoSuchElementException if iteration has no more <code>Node</code>s.
* @see java.util.Iterator#next()
*/
+ @Override
public Object next() throws NoSuchElementException {
return nextNode();
}
@@ -186,6 +193,7 @@ public class NodeIteratorImpl implements
* available; <code>false</code> otherwise.
* @see java.util.Iterator#hasNext()
*/
+ @Override
public boolean hasNext() {
return next != null;
}
@@ -194,11 +202,13 @@ public class NodeIteratorImpl implements
* @throws UnsupportedOperationException always.
* @see Iterator#remove()
*/
+ @Override
public void remove() {
throw new UnsupportedOperationException("remove");
}
//------------------------------------------------------------< private >---
+
/**
* Clears {@link #next} and tries to fetch the next Node instance.
* When this method returns {@link #next} refers to the next available
Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/query/QueryImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/query/QueryImpl.java?rev=1164026&r1=1164025&r2=1164026&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/query/QueryImpl.java (original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/query/QueryImpl.java Thu Sep 1 11:52:08 2011
@@ -70,12 +70,12 @@ public class QueryImpl implements Query
/**
* The query statement
*/
- private String statement;
+ private final String statement;
/**
* The syntax of the query statement
*/
- private String language;
+ private final String language;
/**
* The node where this query is persisted. Only set when this is a persisted
@@ -86,7 +86,7 @@ public class QueryImpl implements Query
/**
* The WorkspaceManager used to execute queries.
*/
- private WorkspaceManager wspManager;
+ private final WorkspaceManager wspManager;
/**
* The maximum result size
@@ -123,28 +123,21 @@ public class QueryImpl implements Query
* query.
* @throws InvalidQueryException if the query is invalid.
*/
- public QueryImpl(Session session,
- ManagerProvider mgrProvider,
- ItemManager itemMgr,
- WorkspaceManager wspManager,
- String statement,
- String language,
- Node node)
- throws InvalidQueryException, RepositoryException {
+ public QueryImpl(Session session, ManagerProvider mgrProvider, ItemManager itemMgr, WorkspaceManager wspManager,
+ String statement, String language, Node node) throws RepositoryException {
+
this.session = session;
this.mgrProvider = mgrProvider;
- this.itemManager = itemMgr;
+ itemManager = itemMgr;
this.statement = statement;
this.language = language;
this.wspManager = wspManager;
- this.varNames = Arrays.asList(this.wspManager.checkQueryStatement(
+ varNames = Arrays.asList(this.wspManager.checkQueryStatement(
statement, language, getNamespaceMappings()));
this.node = node;
}
- /**
- * @see Query#execute()
- */
+ @Override
public QueryResult execute() throws RepositoryException {
QueryInfo qI = wspManager.executeQuery(
statement, language, getNamespaceMappings(), limit, offset, boundValues);
@@ -166,37 +159,26 @@ public class QueryImpl implements Query
return mappings;
}
- /**
- * @see Query#getStatement()
- */
+ @Override
public String getStatement() {
return statement;
}
- /**
- * @see Query#getLanguage()
- */
+ @Override
public String getLanguage() {
return language;
}
- /**
- * @see Query#getStoredQueryPath()
- */
- public String getStoredQueryPath() throws ItemNotFoundException, RepositoryException {
+ @Override
+ public String getStoredQueryPath() throws RepositoryException {
if (node == null) {
throw new ItemNotFoundException("Not a persistent query.");
}
return node.getPath();
}
- /**
- * @see Query#storeAsNode(String)
- */
- public Node storeAsNode(String absPath) throws ItemExistsException,
- PathNotFoundException, VersionException, ConstraintViolationException,
- LockException, UnsupportedRepositoryOperationException, RepositoryException {
-
+ @Override
+ public Node storeAsNode(String absPath) throws RepositoryException {
NamePathResolver resolver = mgrProvider.getNamePathResolver();
try {
Path p = resolver.getQPath(absPath).getNormalizedPath();
@@ -220,16 +202,12 @@ public class QueryImpl implements Query
}
}
- /**
- * @see Query#getBindVariableNames()
- */
+ @Override
public String[] getBindVariableNames() throws RepositoryException {
return varNames.toArray(new String[varNames.size()]);
}
- /**
- * @see Query#bindValue(String, Value)
- */
+ @Override
public void bindValue(String varName, Value value) throws RepositoryException {
if (!varNames.contains(varName)) {
throw new IllegalArgumentException(varName + " is not a known bind variable name in this query");
@@ -241,16 +219,12 @@ public class QueryImpl implements Query
}
}
- /**
- * @see Query#setLimit(long)
- */
+ @Override
public void setLimit(long limit) {
this.limit = limit;
}
- /**
- * @see Query#setOffset(long)
- */
+ @Override
public void setOffset(long offset) {
this.offset = offset;
}
Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/query/QueryManagerImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/query/QueryManagerImpl.java?rev=1164026&r1=1164025&r2=1164026&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/query/QueryManagerImpl.java (original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/query/QueryManagerImpl.java Thu Sep 1 11:52:08 2011
@@ -77,32 +77,25 @@ public class QueryManagerImpl implements
* @throws RepositoryException if an error occurs while initializing this
* query manager.
*/
- public QueryManagerImpl(Session session,
- ManagerProvider mgrProvider,
- ItemManager itemMgr,
- WorkspaceManager wspManager) throws RepositoryException {
+ public QueryManagerImpl(Session session, ManagerProvider mgrProvider, ItemManager itemMgr,
+ WorkspaceManager wspManager) throws RepositoryException {
+
this.session = session;
- this.valueFactory = mgrProvider.getJcrValueFactory();
+ valueFactory = mgrProvider.getJcrValueFactory();
this.mgrProvider = mgrProvider;
this.itemMgr = itemMgr;
this.wspManager = wspManager;
}
- /**
- * @see QueryManager#createQuery(String, String)
- */
- public Query createQuery(String statement, String language)
- throws InvalidQueryException, RepositoryException {
+ @Override
+ public Query createQuery(String statement, String language) throws RepositoryException {
checkIsAlive();
return new QueryImpl(session, mgrProvider, itemMgr, wspManager,
statement, language, null);
}
- /**
- * @see QueryManager#getQuery(Node)
- */
- public Query getQuery(Node node)
- throws InvalidQueryException, RepositoryException {
+ @Override
+ public Query getQuery(Node node) throws RepositoryException {
checkIsAlive();
NamePathResolver resolver = mgrProvider.getNamePathResolver();
@@ -125,21 +118,18 @@ public class QueryManagerImpl implements
}
}
- /**
- * @see QueryManager#getSupportedQueryLanguages()
- */
+ @Override
public String[] getSupportedQueryLanguages() throws RepositoryException {
return wspManager.getSupportedQueryLanguages();
}
- /**
- * @see QueryManager#getQOMFactory()
- */
+ @Override
public QueryObjectModelFactory getQOMFactory() {
return new QOMFactory(null, mgrProvider.getNamePathResolver());
}
//------------------------------------------------------------< private >---
+
/**
* Checks if this <code>QueryManagerImpl</code> instance is still usable,
* otherwise throws a {@link javax.jcr.RepositoryException}.
@@ -163,8 +153,7 @@ public class QueryManagerImpl implements
}
@Override
- protected QueryObjectModel createQuery(QueryObjectModelTree qomTree)
- throws InvalidQueryException, RepositoryException {
+ protected QueryObjectModel createQuery(QueryObjectModelTree qomTree) throws RepositoryException {
return new QueryObjectModelImpl(session, mgrProvider, itemMgr,
wspManager, qomTree, node);
}
Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/query/QueryObjectModelImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/query/QueryObjectModelImpl.java?rev=1164026&r1=1164025&r2=1164026&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/query/QueryObjectModelImpl.java (original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/query/QueryObjectModelImpl.java Thu Sep 1 11:52:08 2011
@@ -52,13 +52,9 @@ public class QueryObjectModelImpl extend
*/
private final QueryObjectModelTree qomTree;
- public QueryObjectModelImpl(Session session,
- ManagerProvider mgrProvider,
- ItemManager itemMgr,
- WorkspaceManager wspManager,
- QueryObjectModelTree qomTree,
- Node node)
- throws InvalidQueryException, RepositoryException {
+ public QueryObjectModelImpl(Session session, ManagerProvider mgrProvider, ItemManager itemMgr,
+ WorkspaceManager wspManager, QueryObjectModelTree qomTree, Node node) throws RepositoryException {
+
super(session, mgrProvider, itemMgr, wspManager,
getSQL2ForQOM(qomTree), Query.JCR_SQL2, node);
this.qomTree = qomTree;
@@ -72,30 +68,22 @@ public class QueryObjectModelImpl extend
return Query.JCR_JQOM;
}
- /**
- * {@inheritDoc}
- */
+ @Override
public Source getSource() {
return qomTree.getSource();
}
- /**
- * {@inheritDoc}
- */
+ @Override
public Constraint getConstraint() {
return qomTree.getConstraint();
}
- /**
- * {@inheritDoc}
- */
+ @Override
public Ordering[] getOrderings() {
return qomTree.getOrderings();
}
- /**
- * {@inheritDoc}
- */
+ @Override
public Column[] getColumns() {
return qomTree.getColumns();
}
@@ -116,72 +104,70 @@ public class QueryObjectModelImpl extend
this.qomTree = qomTree;
}
- /**
- * {@inheritDoc}
- */
+ @Override
public Source getSource() {
return qomTree.getSource();
}
- /**
- * {@inheritDoc}
- */
+ @Override
public Constraint getConstraint() {
return qomTree.getConstraint();
}
- /**
- * {@inheritDoc}
- */
+ @Override
public Ordering[] getOrderings() {
return qomTree.getOrderings();
}
- /**
- * {@inheritDoc}
- */
+ @Override
public Column[] getColumns() {
return qomTree.getColumns();
}
- public QueryResult execute()
- throws InvalidQueryException, RepositoryException {
+ @Override
+ public QueryResult execute() throws RepositoryException {
throw new UnsupportedOperationException();
}
+ @Override
public void setLimit(long limit) {
throw new UnsupportedOperationException();
}
+ @Override
public void setOffset(long offset) {
throw new UnsupportedOperationException();
}
+ @Override
public String getStatement() {
throw new UnsupportedOperationException();
}
+ @Override
public String getLanguage() {
throw new UnsupportedOperationException();
}
+ @Override
public String getStoredQueryPath()
- throws ItemNotFoundException, RepositoryException {
+ throws RepositoryException {
throw new UnsupportedOperationException();
}
- public Node storeAsNode(String absPath) throws ItemExistsException,
- PathNotFoundException, VersionException,
- ConstraintViolationException, LockException,
- UnsupportedRepositoryOperationException, RepositoryException {
+ @Override
+ public Node storeAsNode(String absPath) throws
+ RepositoryException {
throw new UnsupportedOperationException();
}
+ @Override
public void bindValue(String varName, Value value)
throws IllegalArgumentException, RepositoryException {
throw new UnsupportedOperationException();
}
+ @Override
public String[] getBindVariableNames() throws RepositoryException {
throw new UnsupportedOperationException();
}
Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/query/QueryResultImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/query/QueryResultImpl.java?rev=1164026&r1=1164025&r2=1164026&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/query/QueryResultImpl.java (original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/query/QueryResultImpl.java Thu Sep 1 11:52:08 2011
@@ -54,17 +54,13 @@ class QueryResultImpl implements QueryRe
* @param mgrProvider the manager provider.
* @param queryInfo the spi query result.
*/
- QueryResultImpl(ItemManager itemMgr,
- ManagerProvider mgrProvider,
- QueryInfo queryInfo) {
+ QueryResultImpl(ItemManager itemMgr, ManagerProvider mgrProvider, QueryInfo queryInfo) {
this.itemMgr = itemMgr;
this.mgrProvider = mgrProvider;
this.queryInfo = queryInfo;
}
- /**
- * {@inheritDoc}
- */
+ @Override
public String[] getSelectorNames() throws RepositoryException {
Name[] names = queryInfo.getSelectorNames();
String[] sn = new String[names.length];
@@ -75,27 +71,20 @@ class QueryResultImpl implements QueryRe
return sn;
}
- /**
- * {@inheritDoc}
- */
+ @Override
public String[] getColumnNames() throws RepositoryException {
return queryInfo.getColumnNames();
}
- /**
- * {@inheritDoc}
- */
+ @Override
public NodeIterator getNodes() throws RepositoryException {
return getNodeIterator();
}
- /**
- * {@inheritDoc}
- */
+ @Override
public RowIterator getRows() throws RepositoryException {
- return new RowIteratorImpl(queryInfo, mgrProvider.getNamePathResolver(),
- mgrProvider.getJcrValueFactory(), itemMgr,
- mgrProvider.getHierarchyManager());
+ return new RowIteratorImpl(queryInfo, mgrProvider.getNamePathResolver(), mgrProvider.getJcrValueFactory(),
+ itemMgr, mgrProvider.getHierarchyManager());
}
/**
@@ -103,7 +92,6 @@ class QueryResultImpl implements QueryRe
* @return a node iterator over the result nodes.
*/
private ScoreNodeIterator getNodeIterator() {
- return new NodeIteratorImpl(itemMgr,
- mgrProvider.getHierarchyManager(), queryInfo);
+ return new NodeIteratorImpl(itemMgr, mgrProvider.getHierarchyManager(), queryInfo);
}
}
Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/query/RowIteratorImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/query/RowIteratorImpl.java?rev=1164026&r1=1164025&r2=1164026&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/query/RowIteratorImpl.java (original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/query/RowIteratorImpl.java Thu Sep 1 11:52:08 2011
@@ -74,7 +74,7 @@ class RowIteratorImpl implements RowIter
/**
* The hierarchy manager.
*/
- private final HierarchyManager hmgr;
+ private final HierarchyManager hierarchyManager;
/**
* Creates a new <code>RowIteratorImpl</code> that iterates over the result
@@ -85,32 +85,34 @@ class RowIteratorImpl implements RowIter
* <code>Session</code>.
* @param vFactory the JCR value factory.
* @param itemMgr the item manager.
- * @param hmgr the hierarchy manager.
+ * @param hierarchyManager the hierarchy manager.
*/
- RowIteratorImpl(QueryInfo queryInfo, NamePathResolver resolver,
- ValueFactory vFactory, ItemManager itemMgr,
- HierarchyManager hmgr) {
- this.rows = queryInfo.getRows();
- this.columnNames = queryInfo.getColumnNames();
+ RowIteratorImpl(QueryInfo queryInfo, NamePathResolver resolver, ValueFactory vFactory, ItemManager itemMgr,
+ HierarchyManager hierarchyManager) {
+
+ rows = queryInfo.getRows();
+ columnNames = queryInfo.getColumnNames();
this.resolver = resolver;
this.vFactory = vFactory;
this.itemMgr = itemMgr;
- this.hmgr = hmgr;
+ this.hierarchyManager = hierarchyManager;
}
//--------------------------------------------------------< RowIterator >---
+
/**
* Returns the next <code>Row</code> in the iteration.
*
* @return the next <code>Row</code> in the iteration.
* @throws NoSuchElementException if iteration has no more <code>Row</code>s.
- * @see RowIterator#nextRow()
*/
+ @Override
public Row nextRow() throws NoSuchElementException {
return new RowImpl((QueryResultRow) rows.next());
}
//------------------------------------------------------< RangeIterator >---
+
/**
* Skip a number of <code>Row</code>s in this iterator.
*
@@ -119,6 +121,7 @@ class RowIteratorImpl implements RowIter
* in this iterator.
* @see javax.jcr.RangeIterator#skip(long)
*/
+ @Override
public void skip(long skipNum) throws NoSuchElementException {
rows.skip(skipNum);
}
@@ -129,6 +132,7 @@ class RowIteratorImpl implements RowIter
* @return the number of <code>Row</code>s in this iterator.
* @see RangeIterator#getSize()
*/
+ @Override
public long getSize() {
return rows.getSize();
}
@@ -144,6 +148,7 @@ class RowIteratorImpl implements RowIter
* @return the current position withing this iterator.
* @see RangeIterator#getPosition()
*/
+ @Override
public long getPosition() {
return rows.getPosition();
}
@@ -152,6 +157,7 @@ class RowIteratorImpl implements RowIter
* @throws UnsupportedOperationException always.
* @see Iterator#remove()
*/
+ @Override
public void remove() {
throw new UnsupportedOperationException("remove");
}
@@ -164,6 +170,7 @@ class RowIteratorImpl implements RowIter
* @return <code>true</code> if the iterator has more elements.
* @see Iterator#hasNext()
*/
+ @Override
public boolean hasNext() {
return rows.hasNext();
}
@@ -175,11 +182,13 @@ class RowIteratorImpl implements RowIter
* @throws NoSuchElementException if iteration has no more <code>Row</code>s.
* @see Iterator#next()
*/
+ @Override
public Object next() throws NoSuchElementException {
return nextRow();
}
//---------------------< inner class RowImpl >------------------------------
+
/**
* Implements the {@link javax.jcr.query.Row} interface, which represents
* a row in the query result.
@@ -213,6 +222,7 @@ class RowIteratorImpl implements RowIter
}
//------------------------------------------------------------< Row >---
+
/**
* Returns an array of all the values in the same order as the property
* names (column names) returned by
@@ -221,8 +231,8 @@ class RowIteratorImpl implements RowIter
* @return a <code>Value</code> array.
* @throws RepositoryException if an error occurs while retrieving the
* values from the <code>Node</code>.
- * @see Row#getValues()
*/
+ @Override
public Value[] getValues() throws RepositoryException {
if (values == null) {
QValue[] qVals = row.getValues();
@@ -254,9 +264,9 @@ class RowIteratorImpl implements RowIter
* among the column names of the query result table.
* @throws RepositoryException if <code>propertyName</code> is not a
* valid property name.
- * @see Row#getValue(String)
*/
- public Value getValue(String propertyName) throws ItemNotFoundException, RepositoryException {
+ @Override
+ public Value getValue(String propertyName) throws RepositoryException {
if (propertyMap == null) {
// create the map first
Map<String, Integer> tmp = new HashMap<String, Integer>();
@@ -280,23 +290,17 @@ class RowIteratorImpl implements RowIter
}
}
- /**
- * @see Row#getNode()
- */
+ @Override
public Node getNode() throws RepositoryException {
return getNode(row.getNodeId(null));
}
- /**
- * @see Row#getNode(String)
- */
+ @Override
public Node getNode(String selectorName) throws RepositoryException {
return getNode(row.getNodeId(resolver.getQName(selectorName)));
}
- /**
- * @see Row#getPath()
- */
+ @Override
public String getPath() throws RepositoryException {
String path = null;
Node n = getNode();
@@ -306,9 +310,7 @@ class RowIteratorImpl implements RowIter
return path;
}
- /**
- * @see Row#getPath(String)
- */
+ @Override
public String getPath(String selectorName) throws RepositoryException {
String path = null;
Node n = getNode(selectorName);
@@ -318,16 +320,12 @@ class RowIteratorImpl implements RowIter
return path;
}
- /**
- * @see Row#getScore()
- */
+ @Override
public double getScore() throws RepositoryException {
return row.getScore(null);
}
- /**
- * @see Row#getScore(String)
- */
+ @Override
public double getScore(String selectorName) throws RepositoryException {
return row.getScore(resolver.getQName(selectorName));
}
@@ -344,7 +342,7 @@ class RowIteratorImpl implements RowIter
private Node getNode(NodeId id) throws RepositoryException {
Node node = null;
if (id != null) {
- node = (Node) itemMgr.getItem(hmgr.getNodeEntry(id));
+ node = (Node) itemMgr.getItem(hierarchyManager.getNodeEntry(id));
}
return node;
}
Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/query/ScoreNodeIterator.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/query/ScoreNodeIterator.java?rev=1164026&r1=1164025&r2=1164026&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/query/ScoreNodeIterator.java (original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/query/ScoreNodeIterator.java Thu Sep 1 11:52:08 2011
@@ -33,5 +33,5 @@ public interface ScoreNodeIterator exten
* @return the score of the node returned by {@link #nextNode()}.
* @throws java.util.NoSuchElementException if there is no next node.
*/
- public double getScore();
+ double getScore();
}
Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/security/AccessManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/security/AccessManager.java?rev=1164026&r1=1164025&r2=1164026&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/security/AccessManager.java (original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/security/AccessManager.java Thu Sep 1 11:52:08 2011
@@ -33,13 +33,13 @@ public interface AccessManager {
/**
* predefined action constants
*/
- public String READ_ACTION = javax.jcr.Session.ACTION_READ;
- public String REMOVE_ACTION = javax.jcr.Session.ACTION_REMOVE;
- public String ADD_NODE_ACTION = javax.jcr.Session.ACTION_ADD_NODE;
- public String SET_PROPERTY_ACTION = javax.jcr.Session.ACTION_SET_PROPERTY;
+ String READ_ACTION = javax.jcr.Session.ACTION_READ;
+ String REMOVE_ACTION = javax.jcr.Session.ACTION_REMOVE;
+ String ADD_NODE_ACTION = javax.jcr.Session.ACTION_ADD_NODE;
+ String SET_PROPERTY_ACTION = javax.jcr.Session.ACTION_SET_PROPERTY;
- public String[] READ = new String[] {READ_ACTION};
- public String[] REMOVE = new String[] {REMOVE_ACTION};
+ String[] READ = new String[] {READ_ACTION};
+ String[] REMOVE = new String[] {REMOVE_ACTION};
/**
* Determines whether the specified <code>permissions</code> are granted
@@ -52,7 +52,8 @@ public interface AccessManager {
* @throws ItemNotFoundException if the target item does not exist
* @throws RepositoryException if another error occurs
*/
- boolean isGranted(NodeState parentState, Path relPath, String[] actions) throws ItemNotFoundException, RepositoryException;
+ boolean isGranted(NodeState parentState, Path relPath, String[] actions) throws ItemNotFoundException,
+ RepositoryException;
/**
* Determines whether the specified <code>permissions</code> are granted
Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/AbstractItemStateFactory.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/AbstractItemStateFactory.java?rev=1164026&r1=1164025&r2=1164026&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/AbstractItemStateFactory.java (original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/AbstractItemStateFactory.java Thu Sep 1 11:52:08 2011
@@ -26,24 +26,18 @@ import org.slf4j.LoggerFactory;
* <code>AbstractItemStateFactory</code>...
*/
public abstract class AbstractItemStateFactory implements ItemStateFactory {
-
- private static Logger log = LoggerFactory.getLogger(AbstractItemStateFactory.class);
-
private final Set<ItemStateCreationListener> creationListeners = new HashSet<ItemStateCreationListener>();
//---------------------------------------------------< ItemStateFactory >---
- /**
- * @see ItemStateFactory#addCreationListener(ItemStateCreationListener)
- */
+
+ @Override
public void addCreationListener(ItemStateCreationListener listener) {
synchronized (creationListeners) {
creationListeners.add(listener);
}
}
- /**
- * @see ItemStateFactory#removeCreationListener(ItemStateCreationListener)
- */
+ @Override
public void removeCreationListener(ItemStateCreationListener listener) {
synchronized (creationListeners) {
creationListeners.remove(listener);
@@ -51,6 +45,7 @@ public abstract class AbstractItemStateF
}
//------------------------------------------------< private | protected >---
+
/**
*
* @return
@@ -67,11 +62,11 @@ public abstract class AbstractItemStateF
*/
void notifyCreated(ItemState createdState) {
ItemStateCreationListener[] listeners = getListeners();
- for (int i = 0; i < listeners.length; i++) {
+ for (ItemStateCreationListener listener : listeners) {
// notify listeners when this item state is saved or invalidated
- createdState.addListener(listeners[i]);
+ createdState.addListener(listener);
// now inform about creation
- listeners[i].created(createdState);
+ listener.created(createdState);
}
}
@@ -81,9 +76,9 @@ public abstract class AbstractItemStateF
*/
void notifyUpdated(ItemState state, int previousStatus) {
ItemStateCreationListener[] listeners = getListeners();
- for (int i = 0; i < listeners.length; i++) {
+ for (ItemStateCreationListener listener : listeners) {
// now inform about creation
- listeners[i].statusChanged(state, previousStatus);
+ listener.statusChanged(state, previousStatus);
}
}
}
\ No newline at end of file
Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/ChangeLog.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/ChangeLog.java?rev=1164026&r1=1164025&r2=1164026&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/ChangeLog.java (original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/ChangeLog.java Thu Sep 1 11:52:08 2011
@@ -65,14 +65,14 @@ public class ChangeLog {
* @throws InvalidItemStateException
* @throws ConstraintViolationException
*/
- ChangeLog(ItemState target, Set<Operation> operations, Set<ItemState> affectedStates)
- throws InvalidItemStateException, ConstraintViolationException {
+ ChangeLog(ItemState target, Set<Operation> operations, Set<ItemState> affectedStates) {
this.target = target;
this.operations = operations;
this.affectedStates = affectedStates;
}
//-----------------------------------------------< Inform the ChangeLog >---
+
/**
* Call this method when this change log has been successfully persisted.
* This implementation will call {@link Operation#persisted()} on the
@@ -84,14 +84,15 @@ public class ChangeLog {
List<NodeState> changedPrimaryTypes = new ArrayList<NodeState>();
Operation[] ops = operations.toArray(new Operation[operations.size()]);
- for (int i = 0; i < ops.length; i++) {
- ops[i].persisted();
- if (ops[i] instanceof SetMixin) {
- changedMixins.add(((SetMixin) ops[i]).getNodeState());
- } else if (ops[i] instanceof SetPrimaryType) {
- changedPrimaryTypes.add(((SetPrimaryType) ops[i]).getNodeState());
+ for (Operation op : ops) {
+ op.persisted();
+ if (op instanceof SetMixin) {
+ changedMixins.add(((SetMixin) op).getNodeState());
+ } else if (op instanceof SetPrimaryType) {
+ changedPrimaryTypes.add(((SetPrimaryType) op).getNodeState());
}
}
+
// process all remaining states that were not covered by the
// operation persistence.
for (ItemState state : affectedStates) {
@@ -181,6 +182,7 @@ public class ChangeLog {
}
}
//----------------------< Retrieve information present in the ChangeLog >---
+
/**
* @return the target state
*/
Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/ItemState.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/ItemState.java?rev=1164026&r1=1164025&r2=1164026&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/ItemState.java (original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/ItemState.java Thu Sep 1 11:52:08 2011
@@ -42,7 +42,7 @@ public abstract class ItemState {
/**
* Logger instance
*/
- private static Logger log = LoggerFactory.getLogger(ItemState.class);
+ private static final Logger log = LoggerFactory.getLogger(ItemState.class);
/**
* the internal status of this item state
@@ -75,8 +75,7 @@ public abstract class ItemState {
* @param isf
* @param definitionProvider
*/
- protected ItemState(HierarchyEntry entry, ItemStateFactory isf,
- ItemDefinitionProvider definitionProvider) {
+ protected ItemState(HierarchyEntry entry, ItemStateFactory isf, ItemDefinitionProvider definitionProvider) {
this(getInitialStatus(entry.getParent()), entry, isf, definitionProvider);
}
@@ -87,9 +86,9 @@ public abstract class ItemState {
* @param isf
* @param definitionProvider
*/
- protected ItemState(int initialStatus, HierarchyEntry entry,
- ItemStateFactory isf,
- ItemDefinitionProvider definitionProvider) {
+ protected ItemState(int initialStatus, HierarchyEntry entry, ItemStateFactory isf,
+ ItemDefinitionProvider definitionProvider) {
+
if (entry == null) {
throw new IllegalArgumentException("Cannot build ItemState from 'null' HierarchyEntry");
}
@@ -104,7 +103,7 @@ public abstract class ItemState {
log.debug(msg);
throw new IllegalArgumentException(msg);
}
- this.hierarchyEntry = entry;
+ hierarchyEntry = entry;
this.isf = isf;
this.definitionProvider = definitionProvider;
}
@@ -129,6 +128,7 @@ public abstract class ItemState {
}
//----------------------------------------------------------< ItemState >---
+
/**
* The <code>HierarchyEntry</code> corresponding to this <code>ItemState</code>.
*
@@ -206,7 +206,7 @@ public abstract class ItemState {
* @throws ItemNotFoundException
* @throws RepositoryException
*/
- public NodeState getParent() throws ItemNotFoundException, RepositoryException {
+ public NodeState getParent() throws RepositoryException {
return getHierarchyEntry().getParent().getNodeState();
}
@@ -247,9 +247,9 @@ public abstract class ItemState {
synchronized (listeners) {
la = listeners.toArray(new ItemStateLifeCycleListener[listeners.size()]);
}
- for (int i = 0; i < la.length; i++) {
- if (la[i] != null) {
- la[i].statusChanged(this, oldStatus);
+ for (ItemStateLifeCycleListener aLa : la) {
+ if (aLa != null) {
+ aLa.statusChanged(this, oldStatus);
}
}
if (status == Status.MODIFIED) {
@@ -304,15 +304,6 @@ public abstract class ItemState {
}
/**
- * Unmodifiable iterator over the listeners present on this item state.
- *
- * @return iterator over <code>ItemStateLifeCycleListener</code>s.
- */
- public Iterator<ItemStateLifeCycleListener> getListeners() {
- return Collections.unmodifiableCollection(listeners).iterator();
- }
-
- /**
* Invalidates this state: set its {@link Status} to {@link Status#INVALIDATED}
* if the current status is {@link Status#EXISTING}. Does nothing otherwise.
*/
@@ -363,13 +354,13 @@ public abstract class ItemState {
* @return true iff the target state of {@link ItemState#merge(ItemState, boolean)}
* was modified.
*/
- public boolean modified();
+ boolean modified();
/**
* Dispose this MergeResult and release all internal resources that
* are not needed any more.
*/
- public void dispose();
+ void dispose();
}
/**
@@ -377,7 +368,7 @@ public abstract class ItemState {
* The {@link #modified()} method just returns the modification status passed
* to the constructor.
*/
- protected class SimpleMergeResult implements MergeResult {
+ protected static class SimpleMergeResult implements MergeResult {
private final boolean modified;
/**
@@ -387,10 +378,12 @@ public abstract class ItemState {
this.modified = modified;
}
+ @Override
public boolean modified() {
return modified;
}
+ @Override
public void dispose() {
// nothing to do.
}
Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/ItemStateCreationListener.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/ItemStateCreationListener.java?rev=1164026&r1=1164025&r2=1164026&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/ItemStateCreationListener.java (original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/ItemStateCreationListener.java Thu Sep 1 11:52:08 2011
@@ -25,5 +25,5 @@ public interface ItemStateCreationListen
*
* @param state
*/
- public void created(ItemState state);
+ void created(ItemState state);
}
Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/ItemStateFactory.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/ItemStateFactory.java?rev=1164026&r1=1164025&r2=1164026&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/ItemStateFactory.java (original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/ItemStateFactory.java Thu Sep 1 11:52:08 2011
@@ -40,7 +40,7 @@ public interface ItemStateFactory {
* @throws ItemNotFoundException
* @throws RepositoryException
*/
- public NodeState createRootState(NodeEntry entry) throws ItemNotFoundException, RepositoryException;
+ NodeState createRootState(NodeEntry entry) throws ItemNotFoundException, RepositoryException;
/**
* Creates the child <code>NodeState</code> with the given
@@ -53,8 +53,7 @@ public interface ItemStateFactory {
* @throws ItemNotFoundException if there is no such <code>NodeState</code>.
* @throws RepositoryException if an error occurs while retrieving the <code>NodeState</code>.
*/
- public NodeState createNodeState(NodeId nodeId, NodeEntry entry)
- throws ItemNotFoundException, RepositoryException;
+ NodeState createNodeState(NodeId nodeId, NodeEntry entry) throws ItemNotFoundException, RepositoryException;
/**
@@ -68,8 +67,7 @@ public interface ItemStateFactory {
* @throws ItemNotFoundException if there is no such <code>NodeState</code>.
* @throws RepositoryException if an error occurs while retrieving the <code>NodeState</code>.
*/
- public NodeState createDeepNodeState(NodeId nodeId, NodeEntry anyParent)
- throws ItemNotFoundException, RepositoryException;
+ NodeState createDeepNodeState(NodeId nodeId, NodeEntry anyParent) throws ItemNotFoundException, RepositoryException;
/**
@@ -84,8 +82,8 @@ public interface ItemStateFactory {
* @throws RepositoryException if an error occurs while retrieving the
* <code>PropertyState</code>.
*/
- public PropertyState createPropertyState(PropertyId propertyId, PropertyEntry entry)
- throws ItemNotFoundException, RepositoryException;
+ PropertyState createPropertyState(PropertyId propertyId, PropertyEntry entry) throws ItemNotFoundException,
+ RepositoryException;
/**
@@ -99,7 +97,8 @@ public interface ItemStateFactory {
* @throws ItemNotFoundException if there is no such <code>NodeState</code>.
* @throws RepositoryException if an error occurs while retrieving the <code>NodeState</code>.
*/
- public PropertyState createDeepPropertyState(PropertyId propertyId, NodeEntry anyParent) throws ItemNotFoundException, RepositoryException;
+ PropertyState createDeepPropertyState(PropertyId propertyId, NodeEntry anyParent) throws ItemNotFoundException,
+ RepositoryException;
/**
* Returns an Iterator over <code>ChildInfo</code>s for the given <code>NodeState</code>.
@@ -108,7 +107,7 @@ public interface ItemStateFactory {
* @throws ItemNotFoundException
* @throws RepositoryException
*/
- public Iterator<ChildInfo> getChildNodeInfos(NodeId nodeId) throws ItemNotFoundException, RepositoryException;
+ Iterator<ChildInfo> getChildNodeInfos(NodeId nodeId) throws ItemNotFoundException, RepositoryException;
/**
* Returns the identifiers of all reference properties that point to
@@ -120,19 +119,19 @@ public interface ItemStateFactory {
* returned or not.
* @return reference property identifiers
*/
- public Iterator<PropertyId> getNodeReferences(NodeState nodeState, Name propertyName, boolean weak);
+ Iterator<PropertyId> getNodeReferences(NodeState nodeState, Name propertyName, boolean weak);
/**
* Adds the given <code>ItemStateCreationListener</code>.
*
* @param listener
*/
- public void addCreationListener(ItemStateCreationListener listener);
+ void addCreationListener(ItemStateCreationListener listener);
/**
* Removes the given <code>ItemStateCreationListener</code>.
*
* @param listener
*/
- public void removeCreationListener(ItemStateCreationListener listener);
+ void removeCreationListener(ItemStateCreationListener listener);
}
Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/ItemStateLifeCycleListener.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/ItemStateLifeCycleListener.java?rev=1164026&r1=1164025&r2=1164026&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/ItemStateLifeCycleListener.java (original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/ItemStateLifeCycleListener.java Thu Sep 1 11:52:08 2011
@@ -29,5 +29,5 @@ public interface ItemStateLifeCycleListe
* @param state the item state, which changed its <code>status</code>.
* @param previousStatus the previous status of <code>state</code>.
*/
- public void statusChanged(ItemState state, int previousStatus);
+ void statusChanged(ItemState state, int previousStatus);
}
Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/ItemStateValidator.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/ItemStateValidator.java?rev=1164026&r1=1164025&r2=1164026&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/ItemStateValidator.java (original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/ItemStateValidator.java Thu Sep 1 11:52:08 2011
@@ -52,7 +52,7 @@ public class ItemStateValidator {
/**
* Logger instance for this class
*/
- private static Logger log = LoggerFactory.getLogger(ItemStateValidator.class);
+ private static final Logger log = LoggerFactory.getLogger(ItemStateValidator.class);
/**
* option for <code>{@link #checkAddNode}</code> and
@@ -60,18 +60,21 @@ public class ItemStateValidator {
* check access rights
*/
public static final int CHECK_ACCESS = 1;
+
/**
* option for <code>{@link #checkAddNode}</code> and
* <code>{@link #checkRemoveItem}</code> methods:<p/>
* check lock status
*/
public static final int CHECK_LOCK = 2;
+
/**
* option for <code>{@link #checkAddNode}</code> and
* <code>{@link #checkRemoveItem}</code> methods:<p/>
* check checked-out status
*/
public static final int CHECK_VERSIONING = 4;
+
/**
* option for <code>{@link #checkAddNode}</code> and
* <code>{@link #checkRemoveItem}</code> methods:<p/>
@@ -104,71 +107,10 @@ public class ItemStateValidator {
this.pathFactory = pathFactory;
}
- /**
- * Checks whether the given node state satisfies the constraints specified
- * by its primary and mixin node types. The following validations/checks are
- * performed:
- * <ul>
- * <li>check if its node type satisfies the 'required node types' constraint
- * specified in its definition</li>
- * <li>check if all 'mandatory' child items exist</li>
- * <li>for every property: check if the property value satisfies the
- * value constraints specified in the property's definition</li>
- * </ul>
- *
- * @param nodeState state of node to be validated
- * @throws ConstraintViolationException if any of the validations fail
- * @throws RepositoryException if another error occurs
- */
- public void validate(NodeState nodeState) throws ConstraintViolationException,
- RepositoryException {
- // effective primary node type
- EffectiveNodeType entPrimary = mgrProvider.getEffectiveNodeTypeProvider().getEffectiveNodeType(nodeState.getNodeTypeName());
- QNodeDefinition def = nodeState.getDefinition();
-
- // check if primary type satisfies the 'required node types' constraint
- Name[] requiredPrimaryTypes = def.getRequiredPrimaryTypes();
- for (int i = 0; i < requiredPrimaryTypes.length; i++) {
- if (!entPrimary.includesNodeType(requiredPrimaryTypes[i])) {
- String msg = safeGetJCRPath(nodeState)
- + ": missing required primary type "
- + requiredPrimaryTypes[i];
- log.debug(msg);
- throw new ConstraintViolationException(msg);
- }
- }
- // mandatory properties
- // effective node type (primary type incl. mixins)
- Name[] ntNames = nodeState.getAllNodeTypeNames();
- EffectiveNodeType entPrimaryAndMixins = mgrProvider.getEffectiveNodeTypeProvider().getEffectiveNodeType(ntNames);
- QPropertyDefinition[] pda = entPrimaryAndMixins.getMandatoryQPropertyDefinitions();
- for (int i = 0; i < pda.length; i++) {
- QPropertyDefinition pd = pda[i];
- if (!nodeState.hasPropertyName(pd.getName())) {
- String msg = safeGetJCRPath(nodeState)
- + ": mandatory property " + pd.getName()
- + " does not exist";
- log.debug(msg);
- throw new ConstraintViolationException(msg);
- }
- }
- // mandatory child nodes
- QNodeDefinition[] cnda = entPrimaryAndMixins.getMandatoryQNodeDefinitions();
- for (int i = 0; i < cnda.length; i++) {
- QNodeDefinition cnd = cnda[i];
- if (!nodeState.getNodeEntry().hasNodeEntry(cnd.getName())) {
- String msg = safeGetJCRPath(nodeState)
- + ": mandatory child node " + cnd.getName()
- + " does not exist";
- log.debug(msg);
- throw new ConstraintViolationException(msg);
- }
- }
- }
-
//-------------------------------------------------< misc. helper methods >
+
/**
- * Failsafe translation of internal <code>ItemState</code> to JCR path for use
+ * Fail safe translation of internal <code>ItemState</code> to JCR path for use
* in error messages etc.
*
* @param itemState
@@ -180,6 +122,7 @@ public class ItemStateValidator {
}
//------------------------------------------------------< check methods >---
+
/**
*
* @param parentState
@@ -191,8 +134,7 @@ public class ItemStateValidator {
* @throws PathNotFoundException
* @throws RepositoryException
*/
- public void checkIsWritable(NodeState parentState, int options) throws VersionException,
- LockException, ItemNotFoundException, ItemExistsException, PathNotFoundException, RepositoryException {
+ public void checkIsWritable(NodeState parentState, int options) throws RepositoryException {
if ((options & CHECK_ACCESS) == CHECK_ACCESS) {
// make sure current session is granted read access on parent node
@@ -200,14 +142,17 @@ public class ItemStateValidator {
throw new ItemNotFoundException(safeGetJCRPath(parentState));
}
}
+
// make sure there's no foreign lock on parent node
if ((options & CHECK_LOCK) == CHECK_LOCK) {
checkLock(parentState);
}
+
// make sure parent node is checked-out
if ((options & CHECK_VERSIONING) == CHECK_VERSIONING) {
checkIsCheckedOut(parentState);
}
+
// constraints
if ((options & CHECK_CONSTRAINTS) == CHECK_CONSTRAINTS) {
// make sure parent node is not protected
@@ -218,7 +163,7 @@ public class ItemStateValidator {
/**
*
* @param propState
- * @param options bit-wise OR'ed flags specifying the checks that should be
+ * @param options bit-wise OR ed flags specifying the checks that should be
* performed; any combination of the following constants:
* <ul>
* <li><code>{@link #CHECK_ACCESS}</code>: make sure current session is
@@ -243,11 +188,7 @@ public class ItemStateValidator {
* @throws PathNotFoundException
* @throws RepositoryException
*/
- public void checkSetProperty(PropertyState propState, int options)
- throws ConstraintViolationException, AccessDeniedException,
- VersionException, LockException, ItemNotFoundException,
- ItemExistsException, PathNotFoundException, RepositoryException {
-
+ public void checkSetProperty(PropertyState propState, int options) throws RepositoryException {
NodeState parent = propState.getParent();
QPropertyDefinition def = propState.getDefinition();
checkWriteProperty(parent, propState.getName(), def, options);
@@ -257,7 +198,7 @@ public class ItemStateValidator {
*
* @param parentState
* @param propertyName
- * @param options bit-wise OR'ed flags specifying the checks that should be
+ * @param options bit-wise OR ed flags specifying the checks that should be
* performed; any combination of the following constants:
* <ul>
* <li><code>{@link #CHECK_ACCESS}</code>: make sure current session is
@@ -283,9 +224,7 @@ public class ItemStateValidator {
* @throws RepositoryException
*/
public void checkAddProperty(NodeState parentState, Name propertyName, QPropertyDefinition definition, int options)
- throws ConstraintViolationException, AccessDeniedException,
- VersionException, LockException, ItemNotFoundException,
- ItemExistsException, PathNotFoundException, RepositoryException {
+ throws RepositoryException {
checkWriteProperty(parentState, propertyName, definition, options);
}
@@ -306,9 +245,7 @@ public class ItemStateValidator {
* @throws RepositoryException
*/
private void checkWriteProperty(NodeState parentState, Name propertyName, QPropertyDefinition definition, int options)
- throws ConstraintViolationException, AccessDeniedException,
- VersionException, LockException, ItemNotFoundException,
- ItemExistsException, PathNotFoundException, RepositoryException {
+ throws RepositoryException {
checkIsWritable(parentState, options);
@@ -316,15 +253,20 @@ public class ItemStateValidator {
if ((options & CHECK_ACCESS) == CHECK_ACCESS) {
// make sure current session is granted write access on new prop
Path relPath = pathFactory.create(propertyName);
- if (!mgrProvider.getAccessManager().isGranted(parentState, relPath, new String[] {AccessManager.SET_PROPERTY_ACTION})) {
- throw new AccessDeniedException(safeGetJCRPath(parentState) + ": not allowed to create property with name " + propertyName);
+ if (!mgrProvider.getAccessManager().isGranted(parentState, relPath, new
+ String[] {AccessManager.SET_PROPERTY_ACTION})) {
+
+ throw new AccessDeniedException(safeGetJCRPath(parentState) +
+ ": not allowed to create property with name " + propertyName);
}
}
+
// constraints on property
if ((options & CHECK_CONSTRAINTS) == CHECK_CONSTRAINTS) {
// if definition is available check if prop-def is not protected either.
checkProtection(definition);
}
+
// collisions
if ((options & CHECK_COLLISION) == CHECK_COLLISION) {
checkCollision(parentState, propertyName);
@@ -339,7 +281,7 @@ public class ItemStateValidator {
* @param parentState
* @param nodeName
* @param nodeTypeName
- * @param options bit-wise OR'ed flags specifying the checks that should be
+ * @param options bit-wise OR ed flags specifying the checks that should be
* performed; any combination of the following constants:
* <ul>
* <li><code>{@link #CHECK_ACCESS}</code>: make sure current session is
@@ -363,11 +305,9 @@ public class ItemStateValidator {
* @throws ItemExistsException
* @throws RepositoryException
*/
- public void checkAddNode(NodeState parentState, Name nodeName,
- Name nodeTypeName, int options)
- throws ConstraintViolationException, AccessDeniedException,
- VersionException, LockException, ItemNotFoundException,
- ItemExistsException, RepositoryException {
+ public void checkAddNode(NodeState parentState, Name nodeName, Name nodeTypeName, int options)
+ throws
+ RepositoryException {
checkIsWritable(parentState, options);
@@ -376,7 +316,8 @@ public class ItemStateValidator {
// make sure current session is granted write access on parent node
Path relPath = pathFactory.create(nodeName);
if (!mgrProvider.getAccessManager().isGranted(parentState, relPath, new String[] {AccessManager.ADD_NODE_ACTION})) {
- throw new AccessDeniedException(safeGetJCRPath(parentState) + ": not allowed to add child node '" + nodeName +"'");
+ throw new AccessDeniedException(safeGetJCRPath(parentState) + ": not allowed to add child node '" +
+ nodeName + '\'');
}
}
// node type constraints
@@ -397,7 +338,7 @@ public class ItemStateValidator {
* Checks if removing the given target state is allowed in the current context.
*
* @param targetState
- * @param options bit-wise OR'ed flags specifying the checks that should be
+ * @param options bit-wise OR ed flags specifying the checks that should be
* performed; any combination of the following constants:
* <ul>
* <li><code>{@link #CHECK_ACCESS}</code>: make sure
@@ -418,11 +359,7 @@ public class ItemStateValidator {
* @throws ReferentialIntegrityException
* @throws RepositoryException
*/
- public void checkRemoveItem(ItemState targetState, int options)
- throws ConstraintViolationException, AccessDeniedException,
- VersionException, LockException, ItemNotFoundException,
- ReferentialIntegrityException, RepositoryException {
-
+ public void checkRemoveItem(ItemState targetState, int options) throws RepositoryException {
if (targetState.isNode() && ((NodeState)targetState).isRoot()) {
// root node
throw new ConstraintViolationException("Cannot remove root node.");
@@ -465,10 +402,8 @@ public class ItemStateValidator {
* @throws VersionException
* @throws RepositoryException
*/
- private void checkIsCheckedOut(ItemState itemState)
- throws PathNotFoundException, VersionException, RepositoryException {
-
- NodeState nodeState = (itemState.isNode()) ? (NodeState)itemState : itemState.getParent();
+ private void checkIsCheckedOut(ItemState itemState) throws RepositoryException {
+ NodeState nodeState = itemState.isNode() ? (NodeState)itemState : itemState.getParent();
mgrProvider.getVersionStateManager().checkIsCheckedOut(nodeState);
}
@@ -481,10 +416,10 @@ public class ItemStateValidator {
* @throws LockException if write access to the specified path is not allowed
* @throws RepositoryException if another error occurs
*/
- private void checkLock(ItemState itemState) throws LockException, RepositoryException {
+ private void checkLock(ItemState itemState) throws RepositoryException {
// make sure there's no foreign lock present the node (or the parent node
// in case the state represents a PropertyState).
- NodeState nodeState = (itemState.isNode()) ? ((NodeState)itemState) : itemState.getParent();
+ NodeState nodeState = itemState.isNode() ? (NodeState)itemState : itemState.getParent();
mgrProvider.getLockStateManager().checkLock(nodeState);
}
@@ -497,8 +432,7 @@ public class ItemStateValidator {
* item state indicates that the state is protected.
* @see QItemDefinition#isProtected()
*/
- private void checkProtection(ItemState itemState)
- throws ConstraintViolationException, RepositoryException {
+ private static void checkProtection(ItemState itemState) throws RepositoryException {
QItemDefinition def;
if (itemState.isNode()) {
def = ((NodeState)itemState).getDefinition();
@@ -515,7 +449,7 @@ public class ItemStateValidator {
* @throws ConstraintViolationException If {@link QItemDefinition#isProtected()}
* returns true.
*/
- private void checkProtection(QItemDefinition definition) throws ConstraintViolationException {
+ private static void checkProtection(QItemDefinition definition) throws ConstraintViolationException {
if (definition.isProtected()) {
throw new ConstraintViolationException("Item is protected");
}
@@ -528,8 +462,7 @@ public class ItemStateValidator {
* @throws ConstraintViolationException
* @see #checkProtection(ItemState)
*/
- private void checkRemoveConstraints(ItemState itemState)
- throws ConstraintViolationException, RepositoryException {
+ private static void checkRemoveConstraints(ItemState itemState) throws RepositoryException {
QItemDefinition definition;
if (itemState.isNode()) {
definition = ((NodeState)itemState).getDefinition();
@@ -546,7 +479,7 @@ public class ItemStateValidator {
* @throws ItemExistsException
* @throws RepositoryException
*/
- private void checkCollision(NodeState parentState, Name propertyName) throws ItemExistsException, RepositoryException {
+ private static void checkCollision(NodeState parentState, Name propertyName) throws RepositoryException {
NodeEntry parentEntry = (NodeEntry) parentState.getHierarchyEntry();
// NOTE: check for name collisions with existing child node has been
// removed as with JSR 283 having same-named node and property can be
@@ -575,7 +508,7 @@ public class ItemStateValidator {
* @throws ConstraintViolationException
* @throws NoSuchNodeTypeException
*/
- private void checkCollision(NodeState parentState, Name nodeName, Name nodeTypeName) throws RepositoryException, ConstraintViolationException, NoSuchNodeTypeException {
+ private void checkCollision(NodeState parentState, Name nodeName, Name nodeTypeName) throws RepositoryException {
// NOTE: check for name collisions with existing child property has been
// removed as with JSR 283 having same-named node and property may be
// allowed. thus delegate the corresponding validation to the underlying
@@ -587,7 +520,8 @@ public class ItemStateValidator {
try {
NodeState conflictingState = parentState.getChildNodeState(nodeName, Path.INDEX_DEFAULT);
QNodeDefinition conflictDef = conflictingState.getDefinition();
- QNodeDefinition newDef = mgrProvider.getItemDefinitionProvider().getQNodeDefinition(parentState.getAllNodeTypeNames(), nodeName, nodeTypeName);
+ QNodeDefinition newDef = mgrProvider.getItemDefinitionProvider()
+ .getQNodeDefinition(parentState.getAllNodeTypeNames(), nodeName, nodeTypeName);
// check same-name sibling setting of both target and existing node
if (!(conflictDef.allowsSameNameSiblings() && newDef.allowsSameNameSiblings())) {