jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ste...@apache.org
Subject svn commit: r164805 - in /incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/state: LocalItemStateManager.java SessionItemStateManager.java UpdatableItemStateManager.java
Date Tue, 26 Apr 2005 15:55:59 GMT
Author: stefan
Date: Tue Apr 26 08:55:58 2005
New Revision: 164805

URL: http://svn.apache.org/viewcvs?rev=164805&view=rev
Log:
- added UpdatableItemStateManager.inEditMode() 
- cleaned up inconsistent throwing of IllegalStateException in 
  UpdatableItemStateManager methods

Modified:
    incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/state/LocalItemStateManager.java
    incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/state/SessionItemStateManager.java
    incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/state/UpdatableItemStateManager.java

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/state/LocalItemStateManager.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/state/LocalItemStateManager.java?rev=164805&r1=164804&r2=164805&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/state/LocalItemStateManager.java
(original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/state/LocalItemStateManager.java
Tue Apr 26 08:55:58 2005
@@ -227,9 +227,9 @@
     /**
      * {@inheritDoc}
      */
-    public void edit() throws ItemStateException {
+    public void edit() throws IllegalStateException {
         if (editMode) {
-            throw new ItemStateException("Already in edit mode");
+            throw new IllegalStateException("Already in edit mode");
         }
         changeLog.reset();
 
@@ -239,7 +239,16 @@
     /**
      * {@inheritDoc}
      */
-    public NodeState createNew(String uuid, QName nodeTypeName, String parentUUID) {
+    public boolean inEditMode() {
+        return editMode;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public NodeState createNew(String uuid, QName nodeTypeName,
+                               String parentUUID)
+            throws IllegalStateException {
         if (!editMode) {
             throw new IllegalStateException("Not in edit mode");
         }
@@ -253,7 +262,8 @@
     /**
      * {@inheritDoc}
      */
-    public PropertyState createNew(QName propName, String parentUUID) {
+    public PropertyState createNew(QName propName, String parentUUID)
+            throws IllegalStateException {
         if (!editMode) {
             throw new IllegalStateException("Not in edit mode");
         }
@@ -266,7 +276,7 @@
     /**
      * {@inheritDoc}
      */
-    public void store(ItemState state) {
+    public void store(ItemState state) throws IllegalStateException {
         if (!editMode) {
             throw new IllegalStateException("Not in edit mode");
         }
@@ -276,7 +286,7 @@
     /**
      * {@inheritDoc}
      */
-    public void store(NodeReferences refs) {
+    public void store(NodeReferences refs) throws IllegalStateException {
         if (!editMode) {
             throw new IllegalStateException("Not in edit mode");
         }
@@ -286,7 +296,7 @@
     /**
      * {@inheritDoc}
      */
-    public void destroy(ItemState state) {
+    public void destroy(ItemState state) throws IllegalStateException {
         if (!editMode) {
             throw new IllegalStateException("Not in edit mode");
         }
@@ -296,7 +306,7 @@
     /**
      * {@inheritDoc}
      */
-    public void cancel() {
+    public void cancel() throws IllegalStateException {
         if (!editMode) {
             throw new IllegalStateException("Not in edit mode");
         }
@@ -308,7 +318,7 @@
     /**
      * {@inheritDoc}
      */
-    public void update() throws ItemStateException {
+    public void update() throws ItemStateException, IllegalStateException {
         if (!editMode) {
             throw new IllegalStateException("Not in edit mode");
         }

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/state/SessionItemStateManager.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/state/SessionItemStateManager.java?rev=164805&r1=164804&r2=164805&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/state/SessionItemStateManager.java
(original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/state/SessionItemStateManager.java
Tue Apr 26 08:55:58 2005
@@ -210,56 +210,66 @@
     /**
      * {@inheritDoc}
      */
-    public void edit() throws ItemStateException {
+    public void edit() throws IllegalStateException {
         persistentStateMgr.edit();
     }
 
     /**
      * {@inheritDoc}
      */
-    public NodeState createNew(String uuid, QName nodeTypeName, String parentUUID) {
+    public boolean inEditMode() throws IllegalStateException {
+        return persistentStateMgr.inEditMode();
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public NodeState createNew(String uuid, QName nodeTypeName,
+                               String parentUUID)
+            throws IllegalStateException {
         return persistentStateMgr.createNew(uuid, nodeTypeName, parentUUID);
     }
 
     /**
      * {@inheritDoc}
      */
-    public PropertyState createNew(QName propName, String parentUUID) {
+    public PropertyState createNew(QName propName, String parentUUID)
+            throws IllegalStateException {
         return persistentStateMgr.createNew(propName, parentUUID);
     }
 
     /**
      * {@inheritDoc}
      */
-    public void store(ItemState state) {
+    public void store(ItemState state) throws IllegalStateException {
         persistentStateMgr.store(state);
     }
 
     /**
      * {@inheritDoc}
      */
-    public void store(NodeReferences refs) {
+    public void store(NodeReferences refs) throws IllegalStateException {
         persistentStateMgr.store(refs);
     }
 
     /**
      * {@inheritDoc}
      */
-    public void destroy(ItemState state) {
+    public void destroy(ItemState state) throws IllegalStateException {
         persistentStateMgr.destroy(state);
     }
 
     /**
      * {@inheritDoc}
      */
-    public void cancel() {
+    public void cancel() throws IllegalStateException {
         persistentStateMgr.cancel();
     }
 
     /**
      * {@inheritDoc}
      */
-    public void update() throws ItemStateException {
+    public void update() throws ItemStateException, IllegalStateException {
         persistentStateMgr.update();
     }
 
@@ -298,7 +308,7 @@
      *                                   deleted externally
      * @throws RepositoryException       if another error occurs
      */
-    public Iterator getDescendantTransientItemStates(ItemId parentId)
+    public Iterator getDescendantTransientItemStates(NodeId parentId)
             throws InvalidItemStateException, RepositoryException {
         // @todo need a more efficient way to find descendents in cache (e.g. using hierarchical
index)
         if (!transientStateMgr.hasAnyItemStates()) {
@@ -475,14 +485,14 @@
     }
 
     /**
-     * Same as <code>{@link #getDescendantTransientItemStates(ItemId)}</code>
+     * Same as <code>{@link #getDescendantTransientItemStates(NodeId)}</code>
      * except that item state instances in the attic are returned.
      *
      * @param parentId the id of the common parent of the transient item state
      *                 instances to be returned.
      * @return an iterator over descendant transient item state instances in the attic
      */
-    public Iterator getDescendantTransientItemStatesInAttic(ItemId parentId) {
+    public Iterator getDescendantTransientItemStatesInAttic(NodeId parentId) {
         // @todo need a more efficient way to find descendents in attic (e.g. using hierarchical
index)
         if (!transientStateMgr.hasAnyItemStatesInAttic()) {
             return Collections.EMPTY_LIST.iterator();

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/state/UpdatableItemStateManager.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/state/UpdatableItemStateManager.java?rev=164805&r1=164804&r2=164805&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/state/UpdatableItemStateManager.java
(original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/state/UpdatableItemStateManager.java
Tue Apr 26 08:55:58 2005
@@ -29,10 +29,21 @@
      * allows calling the operations defined below. At the end of
      * this operation, either {@link #update} or {@link #cancel}
      * must be invoked.
-     * @throws ItemStateException if the manager is already inside
-     *         edit mode.
+     *
+     * @throws IllegalStateException if the manager is already in edit mode.
+     */
+    void edit() throws IllegalStateException;
+
+    /**
+     * Returns <code>true</code> if this manager is in edit mode i.e.
+     * if an edit operation has been started by invoking {@link #edit},
+     * otherwise returns <code>false</code>.
+     *
+     * @return <code>true</code> if this manager is in edit mode, otherwise
+     *         <code>false</code>
+     * @throws IllegalStateException if the manager is not in edit mode.
      */
-    void edit() throws ItemStateException;
+    boolean inEditMode();
 
     /**
      * Creates a {@link NodeState} instance representing new,
@@ -43,9 +54,10 @@
      * @param nodeTypeName qualified node type name
      * @param parentUUID   parent node's UUID
      * @return a node state
+     * @throws IllegalStateException if the manager is not in edit mode.
      */
     NodeState createNew(String uuid, QName nodeTypeName,
-                               String parentUUID);
+                        String parentUUID) throws IllegalStateException;
 
     /**
      * Creates a {@link PropertyState} instance representing new,
@@ -55,38 +67,50 @@
      * @param propName   qualified property name
      * @param parentUUID parent node UUID
      * @return a property state
+     * @throws IllegalStateException if the manager is not in edit mode.
      */
-    PropertyState createNew(QName propName, String parentUUID);
+    PropertyState createNew(QName propName, String parentUUID)
+            throws IllegalStateException;
 
     /**
      * Store an item state.
+     *
      * @param state item state that should be stored
-      */
-    void store(ItemState state);
+     * @throws IllegalStateException if the manager is not in edit mode.
+     */
+    void store(ItemState state) throws IllegalStateException;
 
     /**
      * Store a node references object
+     *
      * @param refs node references object that should be stored
+     * @throws IllegalStateException if the manager is not in edit mode.
      */
-    void store(NodeReferences refs);
+    void store(NodeReferences refs) throws IllegalStateException;
 
     /**
      * Destroy an item state.
+     *
      * @param state item state that should be destroyed
-      */
-    void destroy(ItemState state);
+     * @throws IllegalStateException if the manager is not in edit mode.
+     */
+    void destroy(ItemState state) throws IllegalStateException;
 
     /**
      * Cancel an update operation. This will undo all changes
      * made to objects inside this item state manager.
+     *
+     * @throws IllegalStateException if the manager is not in edit mode.
      */
-    void cancel();
+    void cancel() throws IllegalStateException;
 
     /**
      * End an update operation. This will save all items
      * added to this update operation in a single step.
      * If this operation fails, no item will have been saved.
-     * @throws ItemStateException if the operation failed
+     *
+     * @throws ItemStateException    if the operation failed
+     * @throws IllegalStateException if the manager is not in edit mode.
      */
-    void update() throws ItemStateException;
+    void update() throws ItemStateException, IllegalStateException;
 }



Mime
View raw message