mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Follow on for ALF-4748: Provide config flag to control if replicated content is read-only (locked) on target
- flag is now controlled via subsystem named 'Replication' - property is named replication.transfer.readonly (value of true or false) git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@22581 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -3,8 +3,26 @@
|
|||||||
|
|
||||||
<beans>
|
<beans>
|
||||||
|
|
||||||
<!-- Replication Service -->
|
<!-- Replication global parameters (implemented as a subsystem) -->
|
||||||
|
<!-- NOTE: the replication service as a whole could be converted to a subsystem in the future) -->
|
||||||
|
<bean id="Replication" class="org.alfresco.repo.management.subsystems.ChildApplicationContextFactory" parent="abstractPropertyBackedBean">
|
||||||
|
<property name="autoStart">
|
||||||
|
<value>true</value>
|
||||||
|
</property>
|
||||||
|
</bean>
|
||||||
|
|
||||||
|
<bean id="replicationParams" class="org.alfresco.repo.management.subsystems.SubsystemProxyFactory">
|
||||||
|
<property name="sourceApplicationContextFactory">
|
||||||
|
<ref bean="Replication" />
|
||||||
|
</property>
|
||||||
|
<property name="interfaces">
|
||||||
|
<list>
|
||||||
|
<value>org.alfresco.repo.replication.ReplicationParams</value>
|
||||||
|
</list>
|
||||||
|
</property>
|
||||||
|
</bean>
|
||||||
|
|
||||||
|
<!-- Replication Service -->
|
||||||
<bean id="ReplicationService" class="org.springframework.aop.framework.ProxyFactoryBean">
|
<bean id="ReplicationService" class="org.springframework.aop.framework.ProxyFactoryBean">
|
||||||
<property name="proxyInterfaces">
|
<property name="proxyInterfaces">
|
||||||
<value>org.alfresco.service.cmr.replication.ReplicationService</value>
|
<value>org.alfresco.service.cmr.replication.ReplicationService</value>
|
||||||
@@ -40,20 +58,19 @@
|
|||||||
class="org.alfresco.repo.security.permissions.impl.AlwaysProceedMethodInterceptor" />
|
class="org.alfresco.repo.security.permissions.impl.AlwaysProceedMethodInterceptor" />
|
||||||
|
|
||||||
<!-- Replication Service base bean -->
|
<!-- Replication Service base bean -->
|
||||||
<bean id="replicationService" class="org.alfresco.repo.replication.ReplicationServiceImpl" >
|
<bean id="replicationService" class="org.alfresco.repo.replication.ReplicationServiceImpl" >
|
||||||
<property name="actionService" ref="ActionService"/>
|
<property name="actionService" ref="ActionService"/>
|
||||||
<property name="scheduledPersistedActionService" ref="scheduledPersistedActionService" />
|
<property name="scheduledPersistedActionService" ref="scheduledPersistedActionService" />
|
||||||
<property name="replicationDefinitionPersister" ref="replicationDefinitionPersister" />
|
<property name="replicationDefinitionPersister" ref="replicationDefinitionPersister" />
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
<bean id="replicationDefinitionPersister" class="org.alfresco.repo.replication.ReplicationDefinitionPersisterImpl" >
|
<bean id="replicationDefinitionPersister" class="org.alfresco.repo.replication.ReplicationDefinitionPersisterImpl" >
|
||||||
<property name="runtimeActionService" ref="actionService" />
|
<property name="runtimeActionService" ref="actionService" />
|
||||||
<property name="nodeService" ref="NodeService" />
|
<property name="nodeService" ref="NodeService" />
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
|
|
||||||
<!-- Replication Action executor -->
|
<!-- Replication Action executor -->
|
||||||
|
|
||||||
<bean id="replicationActionExecutor" parent="action-executer"
|
<bean id="replicationActionExecutor" parent="action-executer"
|
||||||
class="org.alfresco.repo.replication.ReplicationActionExecutor">
|
class="org.alfresco.repo.replication.ReplicationActionExecutor">
|
||||||
<property name="publicAction">
|
<property name="publicAction">
|
||||||
@@ -71,7 +88,7 @@
|
|||||||
<property name="actionTrackingService" ref="actionTrackingService" />
|
<property name="actionTrackingService" ref="actionTrackingService" />
|
||||||
<property name="transactionService" ref="transactionService" />
|
<property name="transactionService" ref="transactionService" />
|
||||||
<property name="replicationDefinitionPersister" ref="replicationDefinitionPersister" />
|
<property name="replicationDefinitionPersister" ref="replicationDefinitionPersister" />
|
||||||
<property name="readOnly" value="true" />
|
<property name="replicationParams" ref="replicationParams" />
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
<!-- JavaScript API support -->
|
<!-- JavaScript API support -->
|
||||||
|
@@ -0,0 +1,12 @@
|
|||||||
|
<?xml version='1.0' encoding='UTF-8'?>
|
||||||
|
<!DOCTYPE beans PUBLIC '-//SPRING//DTD BEAN//EN' 'http://www.springframework.org/dtd/spring-beans.dtd'>
|
||||||
|
|
||||||
|
<beans>
|
||||||
|
|
||||||
|
<bean id="replicationParams" class="org.alfresco.repo.replication.ReplicationParamsImpl">
|
||||||
|
<property name="transferReadOnly">
|
||||||
|
<value>${replication.transfer.readonly}</value>
|
||||||
|
</property>
|
||||||
|
</bean>
|
||||||
|
|
||||||
|
</beans>
|
@@ -0,0 +1 @@
|
|||||||
|
replication.transfer.readonly=true
|
@@ -69,7 +69,7 @@ public class ReplicationActionExecutor extends ActionExecuterAbstractBase {
|
|||||||
private ActionTrackingService actionTrackingService;
|
private ActionTrackingService actionTrackingService;
|
||||||
private TransactionService transactionService;
|
private TransactionService transactionService;
|
||||||
private ReplicationDefinitionPersisterImpl replicationDefinitionPersister;
|
private ReplicationDefinitionPersisterImpl replicationDefinitionPersister;
|
||||||
private Boolean readOnly;
|
private ReplicationParams replicationParams;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* By default, we lock for 30 minutes
|
* By default, we lock for 30 minutes
|
||||||
@@ -136,13 +136,13 @@ public class ReplicationActionExecutor extends ActionExecuterAbstractBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets transfer read only default value
|
* Sets Replication Parameters
|
||||||
*
|
*
|
||||||
* @param readOnly true => mark items in destination repository as read only
|
* @param replicationParams replication parameters
|
||||||
*/
|
*/
|
||||||
public void setReadOnly(Boolean readOnly)
|
public void setReplicationParams(ReplicationParams replicationParams)
|
||||||
{
|
{
|
||||||
this.readOnly = readOnly;
|
this.replicationParams = replicationParams;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -187,7 +187,7 @@ public class ReplicationActionExecutor extends ActionExecuterAbstractBase {
|
|||||||
new TransferDefinition();
|
new TransferDefinition();
|
||||||
transferDefinition.setNodes(toTransfer);
|
transferDefinition.setNodes(toTransfer);
|
||||||
transferDefinition.setSync(true);
|
transferDefinition.setSync(true);
|
||||||
transferDefinition.setReadOnly(readOnly == null ? true : readOnly);
|
transferDefinition.setReadOnly(replicationParams.getTransferReadOnly());
|
||||||
|
|
||||||
// Exclude aspects from transfer
|
// Exclude aspects from transfer
|
||||||
// NOTE: this list of aspects should be synced up with the NodeCrawler in expandPayload to
|
// NOTE: this list of aspects should be synced up with the NodeCrawler in expandPayload to
|
||||||
|
@@ -0,0 +1,34 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2005-2010 Alfresco Software Limited.
|
||||||
|
*
|
||||||
|
* This file is part of Alfresco
|
||||||
|
*
|
||||||
|
* Alfresco 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 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* Alfresco 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 Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package org.alfresco.repo.replication;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An interface for retrieving configurable replication parameters.
|
||||||
|
*/
|
||||||
|
public interface ReplicationParams
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Lock replicated items in target repository
|
||||||
|
*
|
||||||
|
* @return <code>true</code> lock replication items
|
||||||
|
*/
|
||||||
|
public boolean getTransferReadOnly();
|
||||||
|
}
|
@@ -0,0 +1,52 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2005-2010 Alfresco Software Limited.
|
||||||
|
*
|
||||||
|
* This file is part of Alfresco
|
||||||
|
*
|
||||||
|
* Alfresco 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 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* Alfresco 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 Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package org.alfresco.repo.replication;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Configurable system parameters.
|
||||||
|
*/
|
||||||
|
public class ReplicationParamsImpl implements ReplicationParams
|
||||||
|
{
|
||||||
|
/** Lock replication items? */
|
||||||
|
private boolean readOnly = true;
|
||||||
|
|
||||||
|
public ReplicationParamsImpl()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets whether to lock replicated items
|
||||||
|
*
|
||||||
|
* @param readOnly <code>true</code> lock replicated items in target repository
|
||||||
|
*/
|
||||||
|
public void setTransferReadOnly(boolean readOnly)
|
||||||
|
{
|
||||||
|
this.readOnly = readOnly;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
* @see org.alfresco.repo.replication.ReplicationParams#getTransferReadOnly()
|
||||||
|
*/
|
||||||
|
public boolean getTransferReadOnly()
|
||||||
|
{
|
||||||
|
return this.readOnly;
|
||||||
|
}
|
||||||
|
}
|
@@ -89,6 +89,7 @@ public class ReplicationServiceIntegrationTest extends TestCase
|
|||||||
|
|
||||||
private ReplicationActionExecutor replicationActionExecutor;
|
private ReplicationActionExecutor replicationActionExecutor;
|
||||||
private ReplicationService replicationService;
|
private ReplicationService replicationService;
|
||||||
|
private ReplicationParams replicationParams;
|
||||||
private TransactionService transactionService;
|
private TransactionService transactionService;
|
||||||
private TransferService2 transferService;
|
private TransferService2 transferService;
|
||||||
private ContentService contentService;
|
private ContentService contentService;
|
||||||
@@ -129,6 +130,7 @@ public class ReplicationServiceIntegrationTest extends TestCase
|
|||||||
{
|
{
|
||||||
replicationActionExecutor = (ReplicationActionExecutor) ctx.getBean("replicationActionExecutor");
|
replicationActionExecutor = (ReplicationActionExecutor) ctx.getBean("replicationActionExecutor");
|
||||||
replicationService = (ReplicationService) ctx.getBean("replicationService");
|
replicationService = (ReplicationService) ctx.getBean("replicationService");
|
||||||
|
replicationParams = (ReplicationParams) ctx.getBean("replicationParams");
|
||||||
transactionService = (TransactionService) ctx.getBean("transactionService");
|
transactionService = (TransactionService) ctx.getBean("transactionService");
|
||||||
transferService = (TransferService2) ctx.getBean("transferService2");
|
transferService = (TransferService2) ctx.getBean("transferService2");
|
||||||
contentService = (ContentService) ctx.getBean("contentService");
|
contentService = (ContentService) ctx.getBean("contentService");
|
||||||
@@ -935,7 +937,7 @@ public class ReplicationServiceIntegrationTest extends TestCase
|
|||||||
|
|
||||||
TransferDefinition td = replicationActionExecutor.buildTransferDefinition(rd, nodes);
|
TransferDefinition td = replicationActionExecutor.buildTransferDefinition(rd, nodes);
|
||||||
assertEquals(true, td.isSync());
|
assertEquals(true, td.isSync());
|
||||||
assertEquals(true, td.isReadOnly());
|
assertEquals(replicationParams.getTransferReadOnly(), td.isReadOnly());
|
||||||
assertEquals(2, td.getNodes().size());
|
assertEquals(2, td.getNodes().size());
|
||||||
assertEquals(true, td.getNodes().contains(folder1));
|
assertEquals(true, td.getNodes().contains(folder1));
|
||||||
assertEquals(true, td.getNodes().contains(content1_1));
|
assertEquals(true, td.getNodes().contains(content1_1));
|
||||||
|
Reference in New Issue
Block a user