[exo-jcr-commits] exo-jcr SVN: r4230 - in jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr: impl/backup and 1 other directory.

do-not-reply at jboss.org do-not-reply at jboss.org
Wed Apr 13 06:47:05 EDT 2011


Author: tolusha
Date: 2011-04-13 06:47:04 -0400 (Wed, 13 Apr 2011)
New Revision: 4230

Modified:
   jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/core/ManageableRepository.java
   jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/backup/RepositorySuspendController.java
Log:
EXOJCR-1301: Allow to use external backup tools in a secure manner

Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/core/ManageableRepository.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/core/ManageableRepository.java	2011-04-13 09:55:03 UTC (rev 4229)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/core/ManageableRepository.java	2011-04-13 10:47:04 UTC (rev 4230)
@@ -60,6 +60,16 @@
    final int READONLY = 2;
 
    /**
+    * Repository SUSPENDED state.
+    */
+   public final int SUSPENDED = 3;
+
+   /**
+    * Undefined state. 
+    */
+   public final int UNDEFINED = 4;
+
+   /**
     * Add the items persistence listener to the named workspace.
     * 
     * @param workspaceName - name of workspace

Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/backup/RepositorySuspendController.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/backup/RepositorySuspendController.java	2011-04-13 09:55:03 UTC (rev 4229)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/backup/RepositorySuspendController.java	2011-04-13 10:47:04 UTC (rev 4230)
@@ -41,21 +41,6 @@
 @NameTemplate(@Property(key = "service", value = "RepositorySuspendController"))
 public class RepositorySuspendController implements Startable
 {
-   /**
-    * Repository ONLINE state.
-    */
-   private final int ONLINE = 1;
-
-   /**
-    * Repository SUSPENDED state.
-    */
-   private final int SUSPENDED = 3;
-
-   /**
-    * Undefined state. 
-    */
-   private final int UNDEFINED = 4;
-
    private final ManageableRepository repository;
 
    /**
@@ -72,11 +57,13 @@
    }
 
    /**
-    * {@inheritDoc}
+    * Suspend repository which means that allow only read operations. All writing threads will wait until resume operations invoked.
+    * 
+    * @return repository state
     */
    @Managed
    @ManagedDescription("Suspend repository which means that allow only read operations. All writing threads will wait until resume operations invoked.")
-   public void suspend()
+   public int suspend()
    {
       for (Suspendable component : getSuspendableComponents())
       {
@@ -89,14 +76,18 @@
             log.error("Can't suspend component", e);
          }
       }
+
+      return getState();
    }
 
    /**
-    * {@inheritDoc}
+    * Resume repository. All previously suspended threads continue working.
+    * 
+    * @return repository state
     */
    @Managed
    @ManagedDescription("Resume repository. All previously suspended threads continue working.")
-   public void resume()
+   public int resume()
    {
       List<Suspendable> components = getSuspendableComponents();
       Collections.reverse(components);
@@ -115,16 +106,18 @@
             log.error("Can't resume component", e);
          }
       }
+
+      return getState();
    }
 
    /**
-    * {@inheritDoc}
+    * Returns repository state.
     */
    @Managed
    @ManagedDescription("Returns repository state.")
    public int getState()
    {
-      int state = ONLINE;
+      int state = ManageableRepository.ONLINE;
       
       boolean hasSuspendedComponents = false;
       boolean hasOnlineComponents = false;
@@ -137,17 +130,17 @@
 
             if (hasOnlineComponents)
             {
-               return UNDEFINED;
+               return ManageableRepository.UNDEFINED;
             }
 
-            state = SUSPENDED;
+            state = ManageableRepository.SUSPENDED;
          }
          else
          {
             hasOnlineComponents = true;
             if (hasSuspendedComponents)
             {
-               return UNDEFINED;
+               return ManageableRepository.UNDEFINED;
             }
          }
       }



More information about the exo-jcr-commits mailing list