jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ang...@apache.org
Subject svn commit: r451946 - in /jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state: ItemState.java NodeState.java PropertyState.java
Date Mon, 02 Oct 2006 10:17:10 GMT
Author: angela
Date: Mon Oct  2 03:17:09 2006
New Revision: 451946

URL: http://svn.apache.org/viewvc?view=rev&rev=451946
Log:
work in progress

- make status flag private and use ItemState.getStatus in sub classes

Modified:
    jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/ItemState.java
    jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/NodeState.java
    jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/PropertyState.java

Modified: jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/ItemState.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/ItemState.java?view=diff&rev=451946&r1=451945&r2=451946
==============================================================================
--- jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/ItemState.java
(original)
+++ jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/ItemState.java
Mon Oct  2 03:17:09 2006
@@ -74,7 +74,7 @@
     /**
      * the internal status of this item state
      */
-    protected int status;
+    private int status;
 
     /**
      * Listeners (weak references)
@@ -147,6 +147,7 @@
 
     /**
      * Copy state information from another state into this state
+     * 
      * @param state source state information
      */
     abstract void copyFrom(ItemState state);

Modified: jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/NodeState.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/NodeState.java?view=diff&rev=451946&r1=451945&r2=451946
==============================================================================
--- jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/NodeState.java
(original)
+++ jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/NodeState.java
Mon Oct  2 03:17:09 2006
@@ -511,9 +511,9 @@
                 // already removed
             }
         }
-        if (status == STATUS_EXISTING || status == STATUS_EXISTING_MODIFIED) {
+        if (getStatus() == STATUS_EXISTING || getStatus() == STATUS_EXISTING_MODIFIED) {
             setStatus(STATUS_EXISTING_REMOVED);
-        } else if (status == STATUS_NEW) {
+        } else if (getStatus() == STATUS_NEW) {
             setStatus(STATUS_REMOVED);
         }
         // now inform parent
@@ -530,7 +530,7 @@
     public void revert(Set affectedItemStates) {
         // all states except for 'new' ones must have an overlayed state in order
         // to be 'reverted'.
-        if (status != STATUS_NEW && overlayedState == null) {
+        if (getStatus() != STATUS_NEW && overlayedState == null) {
             throw new IllegalStateException("revert cannot be called on workspace state");
         }
         // copy to new list, when a property is reverted it may call this node
@@ -584,7 +584,7 @@
         }
 
         // now revert this node state
-        switch (status) {
+        switch (getStatus()) {
             case STATUS_EXISTING:
                 // nothing to do
                 break;
@@ -622,7 +622,7 @@
      * @see ItemState#collectTransientStates(Set)
      */
     public void collectTransientStates(Set transientStates) {
-        switch (status) {
+        switch (getStatus()) {
             case STATUS_EXISTING_MODIFIED:
             case STATUS_EXISTING_REMOVED:
             case STATUS_NEW:
@@ -691,7 +691,7 @@
      */
     public synchronized Collection getPropertyNames() {
         Collection names;
-        if (status == STATUS_EXISTING_MODIFIED) {
+        if (getStatus() == STATUS_EXISTING_MODIFIED) {
             names = new ArrayList();
             for (Iterator it = getPropertyEntries().iterator(); it.hasNext(); ) {
                 names.add(((ChildPropertyEntry) it.next()).getName());
@@ -711,7 +711,7 @@
      */
     public synchronized Collection getPropertyEntries() {
         Collection props;
-        if (status == STATUS_EXISTING_MODIFIED) {
+        if (getStatus() == STATUS_EXISTING_MODIFIED) {
             // filter out removed properties
             props = new ArrayList();
             for (Iterator it = properties.values().iterator(); it.hasNext(); ) {

Modified: jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/PropertyState.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/PropertyState.java?view=diff&rev=451946&r1=451945&r2=451946
==============================================================================
--- jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/PropertyState.java
(original)
+++ jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/PropertyState.java
Mon Oct  2 03:17:09 2006
@@ -95,7 +95,7 @@
      * @inheritDoc
      */
     public void remove() {
-        if (status == STATUS_NEW) {
+        if (getStatus() == STATUS_NEW) {
             setStatus(STATUS_REMOVED);
         } else {
             setStatus(STATUS_EXISTING_REMOVED);
@@ -110,10 +110,10 @@
     public void revert(Set affectedItemStates) {
         // all states except for 'new' ones must have an overlayed state in order
         // to be 'reverted'.
-        if (status != STATUS_NEW && overlayedState == null) {
+        if (getStatus() != STATUS_NEW && overlayedState == null) {
             throw new IllegalStateException("revert cannot be called on workspace state");
         }
-        switch (status) {
+        switch (getStatus()) {
             case STATUS_EXISTING:
                 // nothing to do
                 break;
@@ -151,13 +151,20 @@
      * @see ItemState#collectTransientStates(Set)
      */
     public void collectTransientStates(Set transientStates) {
-        switch (status) {
+        switch (getStatus()) {
             case STATUS_EXISTING_MODIFIED:
             case STATUS_EXISTING_REMOVED:
             case STATUS_NEW:
             case STATUS_STALE_DESTROYED:
             case STATUS_STALE_MODIFIED:
                 transientStates.add(this);
+                break;
+            case STATUS_EXISTING:
+            case STATUS_REMOVED:
+                log.debug("Collecting transient states: Ignored PropertyState with status
" + getStatus());
+                break;
+            default:
+                // should never occur. status is validated upon setStatus(int)
         }
     }
 



Mime
View raw message