Author: tolusha
Date: 2012-01-25 07:52:37 -0500 (Wed, 25 Jan 2012)
New Revision: 5515
Removed:
jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/ReadOnlySupport.java
jcr/branches/1.15.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/TestRepositoryReadOnly.java
jcr/branches/1.15.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/TestWorspaceReadOnly.java
Modified:
jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/core/ManageableRepository.java
jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/core/WorkspaceContainerFacade.java
jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/dataflow/PersistentDataManager.java
jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/RepositoryImpl.java
jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/WorkspacePersistentDataManager.java
Log:
EXOJCR-1728: Remove ReadOnly support for WorkspacePersistentDataManager
Modified:
jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/core/ManageableRepository.java
===================================================================
---
jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/core/ManageableRepository.java 2012-01-25
10:13:19 UTC (rev 5514)
+++
jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/core/ManageableRepository.java 2012-01-25
12:52:37 UTC (rev 5515)
@@ -57,11 +57,6 @@
final int ONLINE = 1;
/**
- * Repository READONLY status.
- */
- final int READONLY = 2;
-
- /**
* Repository SUSPENDED status.
*/
final int SUSPENDED = 3;
Modified:
jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/core/WorkspaceContainerFacade.java
===================================================================
---
jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/core/WorkspaceContainerFacade.java 2012-01-25
10:13:19 UTC (rev 5514)
+++
jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/core/WorkspaceContainerFacade.java 2012-01-25
12:52:37 UTC (rev 5515)
@@ -20,7 +20,6 @@
import org.exoplatform.commons.utils.SecurityHelper;
import org.exoplatform.services.jcr.core.security.JCRRuntimePermissions;
-import org.exoplatform.services.jcr.impl.ReadOnlySupport;
import org.exoplatform.services.jcr.impl.WorkspaceContainer;
import org.exoplatform.services.jcr.impl.backup.ResumeException;
import org.exoplatform.services.jcr.impl.backup.SuspendException;
@@ -113,21 +112,6 @@
*/
public int getState()
{
- boolean hasROComponents = false;
- boolean hasRWComponents = false;
- List<ReadOnlySupport> readOnlyComponents =
getComponentInstancesOfType(ReadOnlySupport.class);
- for (ReadOnlySupport component : readOnlyComponents)
- {
- if (component.isReadOnly())
- {
- hasROComponents = true;
- }
- else
- {
- hasRWComponents = true;
- }
- }
-
boolean hasSuspendedComponents = false;
boolean hasResumedComponents = false;
List<Suspendable> suspendableComponents =
getComponentInstancesOfType(Suspendable.class);
@@ -143,16 +127,12 @@
}
}
- if (hasSuspendedComponents && !hasResumedComponents &&
!hasROComponents)
+ if (hasSuspendedComponents && !hasResumedComponents)
{
return ManageableRepository.SUSPENDED;
}
- else if (hasROComponents && !hasRWComponents &&
!hasSuspendedComponents)
+ else if (!hasSuspendedComponents)
{
- return ManageableRepository.READONLY;
- }
- else if (!hasSuspendedComponents && !hasROComponents)
- {
return ManageableRepository.ONLINE;
}
else
@@ -189,9 +169,6 @@
break;
case ManageableRepository.OFFLINE :
break;
- case ManageableRepository.READONLY :
- setReadOnly(true);
- break;
case ManageableRepository.SUSPENDED :
suspend();
break;
@@ -217,18 +194,6 @@
}
/**
- * Set all components readonly.
- */
- private void setReadOnly(boolean readOnly)
- {
- List<ReadOnlySupport> components =
getComponentInstancesOfType(ReadOnlySupport.class);
- for (ReadOnlySupport component : components)
- {
- component.setReadOnly(readOnly);
- }
- }
-
- /**
* Suspend all components in workspace.
*
* @throws RepositoryException
@@ -299,7 +264,6 @@
*/
private void setOnline() throws RepositoryException
{
- setReadOnly(false);
resume();
}
}
Modified:
jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/dataflow/PersistentDataManager.java
===================================================================
---
jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/dataflow/PersistentDataManager.java 2012-01-25
10:13:19 UTC (rev 5514)
+++
jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/dataflow/PersistentDataManager.java 2012-01-25
12:52:37 UTC (rev 5515)
@@ -20,7 +20,6 @@
import org.exoplatform.services.jcr.dataflow.persistent.ItemsPersistenceListener;
import org.exoplatform.services.jcr.dataflow.persistent.ItemsPersistenceListenerFilter;
-import org.exoplatform.services.jcr.impl.ReadOnlySupport;
/**
* Created by The eXo Platform SAS.
@@ -30,7 +29,7 @@
* @author <a href="mailto:peter.nedonosko@exoplatform.com.ua">Peter
Nedonosko</a>
* @version $Id: PersistentDataManager.java 34801 2009-07-31 15:44:50Z dkatayev $
*/
-public interface PersistentDataManager extends DataManager, ReadOnlySupport
+public interface PersistentDataManager extends DataManager
{
void addItemPersistenceListener(ItemsPersistenceListener listener);
Deleted:
jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/ReadOnlySupport.java
===================================================================
---
jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/ReadOnlySupport.java 2012-01-25
10:13:19 UTC (rev 5514)
+++
jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/ReadOnlySupport.java 2012-01-25
12:52:37 UTC (rev 5515)
@@ -1,53 +0,0 @@
-/*
- * Copyright (C) 2009 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.exoplatform.services.jcr.impl;
-
-/**
- * @author <a href="mailto:anatoliy.bazko@gmail.com">Anatoliy
Bazko</a>
- * @version $Id: ReadOnlySupport.java 34360 2009-07-22 23:58:59Z tolusha $
- */
-public interface ReadOnlySupport
-{
-
- /**
- * Status of write-operations restrictions.
- *
- * Read-only status is descriptive within the container, i.e. will not prevent any
write
- * operation.
- *
- * Used in DataManager implementations.
- *
- * @return true - if write-operations allowed, false - otherwise.
- */
- boolean isReadOnly();
-
- /**
- * Set status of write-operations restrictions.
- *
- * Read-only status is descriptive within the container, i.e. will not prevent any
write
- * operation.
- *
- * Used in DataManager implementations.
- *
- * @param status
- * , true - if write-operations allowed, false - otherwise.
- */
- void setReadOnly(boolean status);
-
-}
Modified:
jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/RepositoryImpl.java
===================================================================
---
jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/RepositoryImpl.java 2012-01-25
10:13:19 UTC (rev 5514)
+++
jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/RepositoryImpl.java 2012-01-25
12:52:37 UTC (rev 5515)
@@ -763,8 +763,6 @@
return "online";
case OFFLINE :
return "offline";
- case READONLY :
- return "readonly";
case SUSPENDED :
return "suspended";
default :
Modified:
jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/WorkspacePersistentDataManager.java
===================================================================
---
jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/WorkspacePersistentDataManager.java 2012-01-25
10:13:19 UTC (rev 5514)
+++
jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/WorkspacePersistentDataManager.java 2012-01-25
12:52:37 UTC (rev 5515)
@@ -1048,20 +1048,4 @@
con.close();
}
}
-
- /**
- * {@inheritDoc}true
- */
- public boolean isReadOnly()
- {
- return readOnly;
- }
-
- /**
- * {@inheritDoc}
- */
- public void setReadOnly(boolean status)
- {
- this.readOnly = status;
- }
}
Deleted:
jcr/branches/1.15.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/TestRepositoryReadOnly.java
===================================================================
---
jcr/branches/1.15.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/TestRepositoryReadOnly.java 2012-01-25
10:13:19 UTC (rev 5514)
+++
jcr/branches/1.15.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/TestRepositoryReadOnly.java 2012-01-25
12:52:37 UTC (rev 5515)
@@ -1,71 +0,0 @@
-/*
- * Copyright (C) 2009 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.exoplatform.services.jcr.impl.dataflow.persistent;
-
-import org.exoplatform.services.jcr.JcrImplBaseTest;
-import org.exoplatform.services.jcr.dataflow.PlainChangesLogImpl;
-
-/**
- * Created by The eXo Platform SAS
- * Author : Sergey Karpenko <sergey.karpenko(a)exoplatform.com.ua>
- * @version $Id: $
- */
-
-public class TestRepositoryReadOnly extends JcrImplBaseTest
-{
-
- @Override
- public void setUp() throws Exception
- {
- super.setUp();
-
- repository.getWorkspaceContainer(session.getWorkspace().getName());
- //dataContainer = (WorkspaceDataContainer)
wsFacade.getComponent(WorkspaceDataContainer.class);
- }
-
- @Override
- protected void tearDown() throws Exception
- {
- repository.setState(repository.ONLINE);
- super.tearDown();
- }
-
- public void testRepositoryReadOnly() throws Exception
- {
-
- repository.setState(repository.READONLY);
-
- assertEquals(repository.READONLY, repository.getState());
-
- WorkspacePersistentDataManager dm =
-
(WorkspacePersistentDataManager)(repository.getWorkspaceContainer(session.getWorkspace().getName()))
- .getComponent(WorkspacePersistentDataManager.class);
-
- try
- {
- dm.save(new PlainChangesLogImpl());
- fail("Read-only container should throw an
ReadOnlyWorkspaceException");
- }
- catch (ReadOnlyWorkspaceException e)
- {
- // ok
- }
- }
-
-}
Deleted:
jcr/branches/1.15.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/TestWorspaceReadOnly.java
===================================================================
---
jcr/branches/1.15.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/TestWorspaceReadOnly.java 2012-01-25
10:13:19 UTC (rev 5514)
+++
jcr/branches/1.15.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/TestWorspaceReadOnly.java 2012-01-25
12:52:37 UTC (rev 5515)
@@ -1,84 +0,0 @@
-/*
- * Copyright (C) 2009 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.exoplatform.services.jcr.impl.dataflow.persistent;
-
-import org.exoplatform.services.jcr.JcrImplBaseTest;
-import org.exoplatform.services.jcr.core.WorkspaceContainerFacade;
-import org.exoplatform.services.jcr.dataflow.PersistentDataManager;
-import org.exoplatform.services.jcr.dataflow.PlainChangesLogImpl;
-
-/**
- * Created by The eXo Platform SAS.
- *
- * <br/>Date: 15.08.2008
- *
- * @author <a href="mailto:peter.nedonosko@exoplatform.com.ua">Peter
Nedonosko</a>
- * @version $Id: TestWorspaceReadOnly.java 34801 2009-07-31 15:44:50Z dkatayev $
- */
-public class TestWorspaceReadOnly extends JcrImplBaseTest
-{
-
- private WorkspaceContainerFacade wsFacade;
-
- private PersistentDataManager dataManager;
-
- @Override
- public void setUp() throws Exception
- {
- super.setUp();
-
- wsFacade = repository.getWorkspaceContainer(session.getWorkspace().getName());
- dataManager =
(PersistentDataManager)wsFacade.getComponent(PersistentDataManager.class);
- }
-
- @Override
- protected void tearDown() throws Exception
- {
- dataManager.setReadOnly(false);
- super.tearDown();
- }
-
- public void testWorkspaceDataContainerStatus()
- {
-
- dataManager.setReadOnly(true);
-
- assertTrue(dataManager.isReadOnly());
- }
-
- public void testWorkspaceDataManager() throws Exception
- {
-
- dataManager.setReadOnly(true);
-
- WorkspacePersistentDataManager dm =
-
(WorkspacePersistentDataManager)wsFacade.getComponent(WorkspacePersistentDataManager.class);
-
- try
- {
- dm.save(new PlainChangesLogImpl());
- fail("Read-only container should throw an
ReadOnlyWorkspaceException");
- }
- catch (ReadOnlyWorkspaceException e)
- {
- // ok
- }
- }
-
-}