jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mdue...@apache.org
Subject svn commit: r1170733 - in /jackrabbit/sandbox/jackrabbit-mk: jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/ jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/ jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbi...
Date Wed, 14 Sep 2011 17:48:09 GMT
Author: mduerig
Date: Wed Sep 14 17:48:09 2011
New Revision: 1170733

URL: http://svn.apache.org/viewvc?rev=1170733&view=rev
Log:
Microkernel based Jackrabbit prototype (WIP) 
refactor: reduce casting

Modified:
    jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/ItemLifeCycleListener.java
    jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/ItemManagerImpl.java
    jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/NodeImpl.java
    jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/SessionImpl.java
    jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/WorkspaceImpl.java
    jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/WorkspaceManager.java
    jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/HierarchyEntryImpl.java
    jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/NodeEntryImpl.java
    jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/PropertyEntryImpl.java
    jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/AddNode.java
    jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/RemoveVersion.java
    jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/TransientOperation.java
    jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/PropertyState.java
    jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/xml/SessionImporter.java
    jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi2microkernel/src/main/java/org/apache/jackrabbit/spi2microkernel/RepositoryServiceImpl.java

Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/ItemLifeCycleListener.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/ItemLifeCycleListener.java?rev=1170733&r1=1170732&r2=1170733&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/ItemLifeCycleListener.java
(original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/ItemLifeCycleListener.java
Wed Sep 14 17:48:09 2011
@@ -23,8 +23,6 @@ import javax.jcr.Item;
 /**
  * The {@code ItemLifeCycleListener} interface allows an implementing
  * object to be informed about changes on an {@code Item} instance.
- *
- * @see ItemImpl#addLifeCycleListener
  */
 public interface ItemLifeCycleListener {
 

Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/ItemManagerImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/ItemManagerImpl.java?rev=1170733&r1=1170732&r2=1170733&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/ItemManagerImpl.java
(original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/ItemManagerImpl.java
Wed Sep 14 17:48:09 2011
@@ -41,7 +41,6 @@ import javax.jcr.PathNotFoundException;
 import javax.jcr.Property;
 import javax.jcr.PropertyIterator;
 import javax.jcr.RepositoryException;
-import javax.jcr.Workspace;
 import java.util.Iterator;
 
 /**
@@ -77,10 +76,8 @@ public class ItemManagerImpl implements 
 
         // start listening to creation of ItemStates upon batch-reading in the
         // workspace item state factory.
-        Workspace wsp = session.getWorkspace();
-        if (wsp instanceof WorkspaceImpl) {
-            ((WorkspaceImpl) wsp).getItemStateFactory().addCreationListener(this);
-        }
+        WorkspaceImpl wsp = session.getWorkspace();
+        wsp.getItemStateFactory().addCreationListener(this);
     }
 
     //--------------------------------------------------------< ItemManager >---
@@ -88,10 +85,8 @@ public class ItemManagerImpl implements 
     @Override
     public void dispose() {
         // stop listening
-        Workspace wsp = session.getWorkspace();
-        if (wsp instanceof WorkspaceImpl) {
-            ((WorkspaceImpl) wsp).getItemStateFactory().removeCreationListener(this);
-        }
+        WorkspaceImpl wsp = session.getWorkspace();
+        wsp.getItemStateFactory().removeCreationListener(this);
         // ... and clear the cache.
         itemCache.clear();
     }

Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/NodeImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/NodeImpl.java?rev=1170733&r1=1170732&r2=1170733&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/NodeImpl.java
(original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/NodeImpl.java
Wed Sep 14 17:48:09 2011
@@ -912,7 +912,7 @@ public class NodeImpl extends ItemImpl i
         }
 
         Operation op = Update.create(getNodeState(), srcWorkspaceName);
-        ((WorkspaceImpl)session.getWorkspace()).getUpdateableItemStateManager().execute(op);
+        session.getWorkspace().getUpdateableItemStateManager().execute(op);
     }
 
     @Override
@@ -1328,11 +1328,11 @@ public class NodeImpl extends ItemImpl i
         }
         // validation check are performed by item state manager
         // NOTE: uuid is generated while creating new state.
-        Operation an = AddNode.create(getNodeState(), nodeName, nodeTypeName, null);
+        AddNode an = AddNode.create(getNodeState(), nodeName, nodeTypeName, null);
         session.getSessionItemStateManager().execute(an);
 
         // finally retrieve the new node
-        List<ItemState> addedStates = ((AddNode) an).getAddedStates();
+        List<ItemState> addedStates = an.getAddedStates();
         ItemState nState = addedStates.get(0);
         return (Node) getItemManager().getItem(nState.getHierarchyEntry());
     }

Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/SessionImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/SessionImpl.java?rev=1170733&r1=1170732&r2=1170733&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/SessionImpl.java
(original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/SessionImpl.java
Wed Sep 14 17:48:09 2011
@@ -22,7 +22,6 @@ import org.apache.jackrabbit.commons.Abs
 import org.apache.jackrabbit.jcr2spi.config.CacheBehaviour;
 import org.apache.jackrabbit.jcr2spi.config.RepositoryConfig;
 import org.apache.jackrabbit.jcr2spi.hierarchy.HierarchyEntry;
-import org.apache.jackrabbit.jcr2spi.hierarchy.HierarchyManager;
 import org.apache.jackrabbit.jcr2spi.hierarchy.HierarchyManagerImpl;
 import org.apache.jackrabbit.jcr2spi.hierarchy.NodeEntry;
 import org.apache.jackrabbit.jcr2spi.lock.LockStateManager;
@@ -60,7 +59,6 @@ import org.apache.jackrabbit.spi.commons
 import org.apache.jackrabbit.spi.commons.value.ValueFactoryQImpl;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-import org.xml.sax.ContentHandler;
 import org.xml.sax.InputSource;
 import org.xml.sax.SAXException;
 
@@ -80,7 +78,6 @@ import javax.jcr.RepositoryException;
 import javax.jcr.Session;
 import javax.jcr.UnsupportedRepositoryOperationException;
 import javax.jcr.ValueFactory;
-import javax.jcr.Workspace;
 import javax.jcr.nodetype.NodeTypeManager;
 import javax.jcr.retention.RetentionManager;
 import javax.jcr.security.AccessControlManager;
@@ -150,12 +147,12 @@ public class SessionImpl extends Abstrac
         itemStateManager = new SessionItemStateManager(workspace.getUpdateableItemStateManager(),
getValidator(),
                 getQValueFactory(), workspace.getItemStateFactory(), this);
         
-        HierarchyManager hMgr = getHierarchyManager();
+        HierarchyManagerImpl hMgr = getHierarchyManager();
         ItemCache cache = new ItemCacheImpl(this.config.getItemCacheSize());
         itemManager = new ItemManagerImpl(hMgr, this, cache);
 
         if (hMgr instanceof HierarchyManagerImpl) {
-            ((HierarchyManagerImpl) hMgr).setResolver(npResolver);
+            hMgr.setResolver(npResolver);
         }
     }
 
@@ -210,7 +207,7 @@ public class SessionImpl extends Abstrac
      * @see javax.jcr.Session#getWorkspace()
      */
     @Override
-    public Workspace getWorkspace() {
+    public WorkspaceImpl getWorkspace() {
         return workspace;
     }
 
@@ -388,7 +385,7 @@ public class SessionImpl extends Abstrac
      * @see Session#getImportContentHandler(String, int)
      */
     @Override
-    public ContentHandler getImportContentHandler(String parentAbsPath, int uuidBehavior)
throws RepositoryException {
+    public ImportHandler getImportContentHandler(String parentAbsPath, int uuidBehavior)
throws RepositoryException {
         checkSupportedOption(Repository.LEVEL_2_SUPPORTED);
         checkIsAlive();
 
@@ -408,7 +405,7 @@ public class SessionImpl extends Abstrac
     @Override
     public void importXML(String parentAbsPath, InputStream in, int uuidBehavior) throws
IOException, RepositoryException {
         // NOTE: checks are performed by 'getImportContentHandler'
-        ImportHandler handler = (ImportHandler) getImportContentHandler(parentAbsPath, uuidBehavior);
+        ImportHandler handler = getImportContentHandler(parentAbsPath, uuidBehavior);
         try {
             SAXParserFactory factory = SAXParserFactory.newInstance();
             factory.setNamespaceAware(true);
@@ -722,7 +719,7 @@ public class SessionImpl extends Abstrac
     }
 
     @Override
-    public final HierarchyManager getHierarchyManager() {
+    public final HierarchyManagerImpl getHierarchyManager() {
         return workspace.getHierarchyManager();
     }
 

Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/WorkspaceImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/WorkspaceImpl.java?rev=1170733&r1=1170732&r2=1170733&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/WorkspaceImpl.java
(original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/WorkspaceImpl.java
Wed Sep 14 17:48:09 2011
@@ -18,7 +18,7 @@ package org.apache.jackrabbit.jcr2spi;
 
 import org.apache.commons.io.IOUtils;
 import org.apache.jackrabbit.jcr2spi.config.RepositoryConfig;
-import org.apache.jackrabbit.jcr2spi.hierarchy.HierarchyManager;
+import org.apache.jackrabbit.jcr2spi.hierarchy.HierarchyManagerImpl;
 import org.apache.jackrabbit.jcr2spi.lock.LockManagerImpl;
 import org.apache.jackrabbit.jcr2spi.lock.LockStateManager;
 import org.apache.jackrabbit.jcr2spi.nodetype.EffectiveNodeTypeProvider;
@@ -155,7 +155,7 @@ public class WorkspaceImpl implements Wo
             // create session on other workspace for current subject
             // (may throw NoSuchWorkspaceException and AccessDeniedException)
             srcSession = session.switchWorkspace(srcWorkspace);
-            WorkspaceImpl srcWsp = (WorkspaceImpl) srcSession.getWorkspace();
+            WorkspaceImpl srcWsp = srcSession.getWorkspace();
 
             // do cross-workspace copy
             Operation op = Copy.create(srcPath, destPath, srcWsp.getName(), srcWsp.getHierarchyManager(),
@@ -199,7 +199,7 @@ public class WorkspaceImpl implements Wo
             // create session on other workspace for current subject
             // (may throw NoSuchWorkspaceException and AccessDeniedException)
             srcSession = session.switchWorkspace(srcWorkspace);
-            WorkspaceImpl srcWsp = (WorkspaceImpl) srcSession.getWorkspace();
+            WorkspaceImpl srcWsp = srcSession.getWorkspace();
 
             // do clone
             Operation op = Clone.create(srcPath, destPath, srcWsp.getName(), removeExisting,
@@ -351,7 +351,7 @@ public class WorkspaceImpl implements Wo
     }
 
     @Override
-    public HierarchyManager getHierarchyManager() {
+    public HierarchyManagerImpl getHierarchyManager() {
         return wspManager.getHierarchyManager();
     }
 

Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/WorkspaceManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/WorkspaceManager.java?rev=1170733&r1=1170732&r2=1170733&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/WorkspaceManager.java
(original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/WorkspaceManager.java
Wed Sep 14 17:48:09 2011
@@ -118,7 +118,7 @@ public final class WorkspaceManager impl
     private final PathFactory pathFactory;
 
     private final ItemStateFactory isf;
-    private final HierarchyManager hierarchyManager;
+    private final HierarchyManagerImpl hierarchyManager;
 
     private final CacheBehaviour cacheBehaviour;
     private final int pollTimeout;
@@ -211,7 +211,7 @@ public final class WorkspaceManager impl
         return ntRegistry;
     }
 
-    public HierarchyManager getHierarchyManager() {
+    public HierarchyManagerImpl getHierarchyManager() {
         return hierarchyManager;
     }
 
@@ -463,7 +463,7 @@ public final class WorkspaceManager impl
      * @return a new instance of {@code HierarchyManager}.
      * @throws javax.jcr.RepositoryException If an error occurs.
      */
-    private HierarchyManager createHierarchyManager(TransientItemStateFactory transientISF,
IdFactory idFactory) {
+    private HierarchyManagerImpl createHierarchyManager(TransientItemStateFactory transientISF,
IdFactory idFactory) {
         return new HierarchyManagerImpl(transientISF, idFactory, getPathFactory());
     }
 

Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/HierarchyEntryImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/HierarchyEntryImpl.java?rev=1170733&r1=1170732&r2=1170733&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/HierarchyEntryImpl.java
(original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/HierarchyEntryImpl.java
Wed Sep 14 17:48:09 2011
@@ -243,10 +243,12 @@ abstract class HierarchyEntryImpl implem
      */
     @Override
     public synchronized void setItemState(ItemState state) {
+        assert state != null;
+        assert denotesNode() == state.isNode();
+
         ItemState currentState = internalGetItemState();
-        if (state == null || state == currentState || denotesNode() != state.isNode()) {
-            throw new IllegalArgumentException();
-        }
+        assert state != currentState;
+
         if (currentState == null) {
             // not connected yet to an item state. either a new entry or
             // an unresolved hierarchy entry.

Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/NodeEntryImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/NodeEntryImpl.java?rev=1170733&r1=1170732&r2=1170733&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/NodeEntryImpl.java
(original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/NodeEntryImpl.java
Wed Sep 14 17:48:09 2011
@@ -82,7 +82,7 @@ public class NodeEntryImpl extends Hiera
     /**
      * Insertion-ordered collection of NodeEntry objects.
      */
-    private final ChildNodeEntries childNodeEntries;
+    private final ChildNodeEntriesImpl childNodeEntries;
 
     /**
      * Map used to remember transiently removed or moved childNodeEntries, that
@@ -617,7 +617,7 @@ public class NodeEntryImpl extends Hiera
     @Override
     public void setNodeEntries(Iterator<ChildInfo> childInfos) throws RepositoryException
{
         if (childNodeAttic.isEmpty()) {
-            ((ChildNodeEntriesImpl) childNodeEntries).update(childInfos);
+            childNodeEntries.update(childInfos);
         } else {
             // filter those entries that have been moved to the attic.
             List<ChildInfo> remaining = new ArrayList<ChildInfo>();
@@ -627,7 +627,7 @@ public class NodeEntryImpl extends Hiera
                     remaining.add(ci);
                 }
             }
-            ((ChildNodeEntriesImpl) childNodeEntries).update(remaining.iterator());
+            childNodeEntries.update(remaining.iterator());
         }
     }
 
@@ -1347,7 +1347,10 @@ public class NodeEntryImpl extends Hiera
         }
         if (getStatus() == Status.EXISTING_MODIFIED) {
             for (NodeEntry child : siblings) {
-                if (!EntryValidation.isValidNodeEntry(child) || ((NodeEntryImpl) child).revertInfo
!= null && ((NodeEntryImpl) child).revertInfo.oldIndex == childIndex) {
+                if (!EntryValidation.isValidNodeEntry(child) ||
+                        ((NodeEntryImpl) child).revertInfo != null &&
+                                ((NodeEntryImpl) child).revertInfo.oldIndex == childIndex)
{
+                    
                     return true;
                 }
             }
@@ -1399,7 +1402,7 @@ public class NodeEntryImpl extends Hiera
                 case PERSISTED:
                     // for autocreated/protected props, mark to be reloaded
                     // upon next access.
-                    PropertyState addedState = (PropertyState) ((PropertyEntryImpl) pe).internalGetItemState();
+                    PropertyState addedState = (PropertyState) ((HierarchyEntryImpl) pe).internalGetItemState();
                     addedState.setStatus(Status.EXISTING);
                     QPropertyDefinition pd = addedState.getDefinition();
                     if (pd.isAutoCreated() || pd.isProtected()) {
@@ -1603,8 +1606,8 @@ public class NodeEntryImpl extends Hiera
             oldParent = parent;
             oldName = name;
             oldIndex = getIndex();
-            oldSuccessor = ((ChildNodeEntriesImpl) parent.childNodeEntries).getNext(NodeEntryImpl.this);
-            oldPredecessor = ((ChildNodeEntriesImpl) parent.childNodeEntries).getPrevious(NodeEntryImpl.this);
+            oldSuccessor = parent.childNodeEntries.getNext(NodeEntryImpl.this);
+            oldPredecessor = parent.childNodeEntries.getPrevious(NodeEntryImpl.this);
         }
 
         private boolean isMoved() {
@@ -1614,7 +1617,7 @@ public class NodeEntryImpl extends Hiera
         private void dispose(boolean persisted) {
             if (!persisted) {
                 NodeEntry ne = NodeEntryImpl.this;
-                ChildNodeEntriesImpl parentCNEs = (ChildNodeEntriesImpl) parent.childNodeEntries;
+                ChildNodeEntriesImpl parentCNEs = parent.childNodeEntries;
                 parentCNEs.reorderAfter(ne, revertInfo.oldPredecessor);
                 try {
                     if (oldIndex != ne.getIndex()) {

Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/PropertyEntryImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/PropertyEntryImpl.java?rev=1170733&r1=1170732&r2=1170733&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/PropertyEntryImpl.java
(original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/PropertyEntryImpl.java
Wed Sep 14 17:48:09 2011
@@ -100,9 +100,8 @@ public class PropertyEntryImpl extends H
      */
     @Override
     public void complete(Operation operation) throws RepositoryException {
-        if (!(operation instanceof SetPropertyValue)) {
-            throw new IllegalArgumentException();
-        }
+        assert operation instanceof SetPropertyValue;
+
         SetPropertyValue op = (SetPropertyValue) operation;
         if (op.getPropertyState().getHierarchyEntry() != this) {
             throw new IllegalArgumentException();

Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/AddNode.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/AddNode.java?rev=1170733&r1=1170732&r2=1170733&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/AddNode.java
(original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/AddNode.java
Wed Sep 14 17:48:09 2011
@@ -129,7 +129,7 @@ public class AddNode extends TransientOp
      * @param uuid
      * @return a new {@code AddNode} operation.
      */
-    public static Operation create(NodeState parentState, Name nodeName,
+    public static AddNode create(NodeState parentState, Name nodeName,
                                    Name nodeTypeName, String uuid) throws RepositoryException
{
         // make sure the parent hierarchy entry has its child entries loaded
         // in order to be able to detect conflicts.

Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/RemoveVersion.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/RemoveVersion.java?rev=1170733&r1=1170732&r2=1170733&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/RemoveVersion.java
(original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/RemoveVersion.java
Wed Sep 14 17:48:09 2011
@@ -18,7 +18,6 @@ package org.apache.jackrabbit.jcr2spi.op
 
 import org.apache.jackrabbit.jcr2spi.hierarchy.NodeEntry;
 import org.apache.jackrabbit.jcr2spi.hierarchy.PropertyEntry;
-import org.apache.jackrabbit.jcr2spi.state.ItemState;
 import org.apache.jackrabbit.jcr2spi.state.NodeState;
 import org.apache.jackrabbit.jcr2spi.version.VersionManager;
 import org.slf4j.Logger;
@@ -35,10 +34,10 @@ public class RemoveVersion extends Abstr
 
     private NodeEntry versionableEntry;
 
-    private RemoveVersion(ItemState removeState, NodeState parent, VersionManager mgr) {
+    private RemoveVersion(NodeState removeState, NodeState parent, VersionManager mgr) {
         super(removeState, parent);
         try {
-            versionableEntry = mgr.getVersionableNodeEntry((NodeState) removeState);
+            versionableEntry = mgr.getVersionableNodeEntry(removeState);
         } catch (RepositoryException e) {
             log.warn("Failed to retrieve the hierarchy entry of the versionable node.", e);
         }

Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/TransientOperation.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/TransientOperation.java?rev=1170733&r1=1170732&r2=1170733&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/TransientOperation.java
(original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/TransientOperation.java
Wed Sep 14 17:48:09 2011
@@ -23,6 +23,7 @@ import org.apache.jackrabbit.jcr2spi.sta
  */
 public abstract class TransientOperation extends AbstractOperation {
     static final int NO_OPTIONS = ItemStateValidator.CHECK_NONE;
+    
     static final int DEFAULT_OPTIONS = ItemStateValidator.CHECK_LOCK
             | ItemStateValidator.CHECK_COLLISION
             | ItemStateValidator.CHECK_VERSIONING

Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/PropertyState.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/PropertyState.java?rev=1170733&r1=1170732&r2=1170733&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/PropertyState.java
(original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/PropertyState.java
Wed Sep 14 17:48:09 2011
@@ -125,9 +125,8 @@ public class PropertyState extends ItemS
     public MergeResult merge(ItemState another, boolean keepChanges) {
         boolean modified = false;
         if (another != null && another != this) {
-            if (another.isNode()) {
-                throw new IllegalArgumentException("Attempt to merge property state with
node state.");
-            }
+            assert !another.isNode();
+
             PropertyDiffer result = new PropertyDiffer(data, ((PropertyState) another).data);
 
             // reset the pInfo to point to the pInfo of another state.

Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/xml/SessionImporter.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/xml/SessionImporter.java?rev=1170733&r1=1170732&r2=1170733&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/xml/SessionImporter.java
(original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/xml/SessionImporter.java
Wed Sep 14 17:48:09 2011
@@ -422,10 +422,10 @@ public class SessionImporter implements 
                 // use default node type
                 ntName = def.getDefaultPrimaryType();
             }
-            Operation an = AddNode.create(parent, nodeInfo.getName(), ntName, nodeInfo.getUUID());
+            AddNode an = AddNode.create(parent, nodeInfo.getName(), ntName, nodeInfo.getUUID());
             stateMgr.execute(an);
             // retrieve id of state that has been created during execution of AddNode
-            NodeState childState = (NodeState) ((AddNode) an).getAddedStates().get(0);
+            NodeState childState = (NodeState) an.getAddedStates().get(0);
 
             // and set mixin types
             Name[] mixinNames = nodeInfo.getMixinNames();

Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi2microkernel/src/main/java/org/apache/jackrabbit/spi2microkernel/RepositoryServiceImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi2microkernel/src/main/java/org/apache/jackrabbit/spi2microkernel/RepositoryServiceImpl.java?rev=1170733&r1=1170732&r2=1170733&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi2microkernel/src/main/java/org/apache/jackrabbit/spi2microkernel/RepositoryServiceImpl.java
(original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi2microkernel/src/main/java/org/apache/jackrabbit/spi2microkernel/RepositoryServiceImpl.java
Wed Sep 14 17:48:09 2011
@@ -51,9 +51,9 @@ import org.apache.jackrabbit.spi.commons
 import org.apache.jackrabbit.spi.commons.QNodeDefinitionImpl;
 import org.apache.jackrabbit.spi.commons.SessionInfoImpl;
 import org.apache.jackrabbit.spi.commons.batch.ConsolidatingChangeLog;
-import org.apache.jackrabbit.spi.commons.util.Iterators;
 import org.apache.jackrabbit.spi.commons.name.NameConstants;
 import org.apache.jackrabbit.spi.commons.util.Function1;
+import org.apache.jackrabbit.spi.commons.util.Iterators;
 import org.apache.jackrabbit.spi.commons.util.Predicate1;
 import org.json.simple.parser.JSONParser;
 import org.json.simple.parser.ParseException;
@@ -69,7 +69,6 @@ import javax.jcr.PathNotFoundException;
 import javax.jcr.PropertyType;
 import javax.jcr.RepositoryException;
 import javax.jcr.UnsupportedRepositoryOperationException;
-import javax.jcr.query.InvalidQueryException;
 import javax.jcr.query.Query;
 import javax.jcr.version.OnParentVersionAction;
 import java.io.IOException;
@@ -581,7 +580,7 @@ public class RepositoryServiceImpl exten
 
     @Override
     public String[] checkQueryStatement(SessionInfo sessionInfo, String statement,
-            String language, Map<String, String> namespaces) throws InvalidQueryException,
RepositoryException {
+            String language, Map<String, String> namespaces) throws RepositoryException
{
 
         checkSessionInfo(sessionInfo);
         return queryProcessor.checkQueryStatement(statement, language, namespaces);



Mime
View raw message