mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Stub the replication service action executor
Doesn't trigger a transfer yet, as waiting on the appropriate node finder git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@20967 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -48,24 +48,32 @@
|
||||
<property name="replicationDefinitionPersister" ref="replicationDefinitionPersister" />
|
||||
</bean>
|
||||
|
||||
<!--
|
||||
<bean id="perform-replication" class="org.alfresco.repo.replication.PerformReplicationActionExecuter" parent="action-executer">
|
||||
<property name="publicAction">
|
||||
<value>false</value>
|
||||
</property>
|
||||
<property name="nodeService" ref="NodeService" />
|
||||
<property name="actionService" ref="ActionService"/>
|
||||
<property name="replicationService" ref="replicationService" />
|
||||
<property name="transferService" ref="TransferService" />
|
||||
</bean>
|
||||
-->
|
||||
|
||||
<bean id="replicationDefinitionPersister" class="org.alfresco.repo.replication.ReplicationDefinitionPersisterImpl" >
|
||||
<property name="runtimeActionService" ref="actionService" />
|
||||
<property name="nodeService" ref="NodeService" />
|
||||
</bean>
|
||||
|
||||
|
||||
<!-- Replication Action executor -->
|
||||
|
||||
<bean id="replicationActionExecutor" parent="action-executer"
|
||||
class="org.alfresco.repo.replication.ReplicationActionExecutor">
|
||||
<property name="publicAction">
|
||||
<value>false</value>
|
||||
</property>
|
||||
<property name="applicableTypes">
|
||||
<list>
|
||||
<value>{http://www.alfresco.org/model/content/1.0}content</value>
|
||||
<value>{http://www.alfresco.org/model/content/1.0}folder</value>
|
||||
</list>
|
||||
</property>
|
||||
<property name="nodeService" ref="NodeService" />
|
||||
<property name="jobLockService" ref="JobLockService" />
|
||||
<property name="transferService" ref="TransferService" />
|
||||
<property name="replicationService" ref="ReplicationService" />
|
||||
</bean>
|
||||
|
||||
|
||||
<!-- JavaScript API support -->
|
||||
<!--
|
||||
<bean id="replicationServiceScript" parent="baseJavaScriptExtension"
|
||||
|
@@ -0,0 +1,100 @@
|
||||
/*
|
||||
* 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;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.alfresco.repo.action.executer.ActionExecuterAbstractBase;
|
||||
import org.alfresco.repo.lock.JobLockService;
|
||||
import org.alfresco.service.cmr.action.Action;
|
||||
import org.alfresco.service.cmr.action.ParameterDefinition;
|
||||
import org.alfresco.service.cmr.replication.ReplicationService;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.cmr.repository.NodeService;
|
||||
import org.alfresco.service.cmr.transfer.TransferService;
|
||||
|
||||
/**
|
||||
* @author Nick Burch
|
||||
* @since 3.4
|
||||
*/
|
||||
public class ReplicationActionExecutor extends ActionExecuterAbstractBase {
|
||||
private NodeService nodeService;
|
||||
private JobLockService jobLockService;
|
||||
private ReplicationService replicationService;
|
||||
private TransferService transferService;
|
||||
|
||||
/**
|
||||
* Injects the NodeService bean.
|
||||
*
|
||||
* @param nodeService the NodeService.
|
||||
*/
|
||||
public void setNodeService(NodeService nodeService)
|
||||
{
|
||||
this.nodeService = nodeService;
|
||||
}
|
||||
|
||||
/**
|
||||
* Injects the JobLockService bean.
|
||||
*
|
||||
* @param nodeService the JobLockService.
|
||||
*/
|
||||
public void setJobLockService(JobLockService jobLockService)
|
||||
{
|
||||
this.jobLockService = jobLockService;
|
||||
}
|
||||
|
||||
/**
|
||||
* Injects the ReplicationService bean.
|
||||
*
|
||||
* @param nodeService the ReplicationService.
|
||||
*/
|
||||
public void setReplicationService(ReplicationService replicationService)
|
||||
{
|
||||
this.replicationService = replicationService;
|
||||
}
|
||||
|
||||
/**
|
||||
* Injects the TransferService bean.
|
||||
*
|
||||
* @param transferService the TransferService.
|
||||
*/
|
||||
public void setTransferService(TransferService transferService)
|
||||
{
|
||||
this.transferService = transferService;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void addParameterDefinitions(List<ParameterDefinition> paramList) {
|
||||
// TODO
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void executeImpl(Action action, NodeRef actionedUponNodeRef) {
|
||||
// Lock the service - only one instance of the replication
|
||||
// should occur at a time
|
||||
|
||||
// Turn our payload list of root nodes into something that
|
||||
// the transfer service can work with
|
||||
|
||||
// Ask the transfer service to do the replication
|
||||
// work for us
|
||||
|
||||
// TODO
|
||||
}
|
||||
}
|
@@ -66,7 +66,7 @@ public class ReplicationDefinitionImpl extends ActionImpl implements Replication
|
||||
*/
|
||||
public ReplicationDefinitionImpl(String id, QName replicationName, String description)
|
||||
{
|
||||
super(null, id, description);
|
||||
super(null, id, "replicationActionExecutor");
|
||||
setParameterValue(REPLICATION_DEFINITION_NAME, replicationName);
|
||||
setDescription(description);
|
||||
}
|
||||
|
@@ -155,6 +155,9 @@ public class ReplicationServiceImpl implements ReplicationService, ReplicationDe
|
||||
* (ReplicationDefinition)
|
||||
*/
|
||||
public void replicate(ReplicationDefinition replicationDefinition) {
|
||||
// TODO Implement the replication work
|
||||
actionService.executeAction(
|
||||
replicationDefinition,
|
||||
ReplicationDefinitionPersisterImpl.REPLICATION_ACTION_ROOT_NODE_REF
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@@ -38,6 +38,8 @@ public class ReplicationServiceIntegrationTest extends BaseAlfrescoSpringTest
|
||||
private ReplicationService replicationService;
|
||||
private NodeService nodeService;
|
||||
|
||||
private NodeRef replicationRoot;
|
||||
|
||||
private final QName ACTION_NAME = QName.createQName(NamespaceService.ALFRESCO_URI, "testName");
|
||||
private final QName ACTION_NAME2 = QName.createQName(NamespaceService.ALFRESCO_URI, "testName2");
|
||||
|
||||
@@ -52,7 +54,7 @@ public class ReplicationServiceIntegrationTest extends BaseAlfrescoSpringTest
|
||||
AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getAdminUserName());
|
||||
|
||||
// Zap any existing entries
|
||||
NodeRef replicationRoot = ReplicationDefinitionPersisterImpl.REPLICATION_ACTION_ROOT_NODE_REF;
|
||||
replicationRoot = ReplicationDefinitionPersisterImpl.REPLICATION_ACTION_ROOT_NODE_REF;
|
||||
for(ChildAssociationRef child : nodeService.getChildAssocs(replicationRoot)) {
|
||||
QName type = nodeService.getType( child.getChildRef() );
|
||||
if(ReplicationDefinitionPersisterImpl.ACTION_TYPES.contains(type)) {
|
||||
@@ -137,4 +139,31 @@ public class ReplicationServiceIntegrationTest extends BaseAlfrescoSpringTest
|
||||
assertEquals(0, replicationService.loadReplicationDefinitions("TestTarget2").size());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test that the action service can find the executor
|
||||
* for us, and that it has everything it needs
|
||||
*/
|
||||
public void testBasicExecution() throws Exception
|
||||
{
|
||||
// First with a transient definition
|
||||
ReplicationDefinition rd = replicationService.createReplicationDefinition(ACTION_NAME, "Test");
|
||||
rd.setTargetName("TestTarget");
|
||||
rd.getPayload().add(
|
||||
new NodeRef("workspace://SpacesStore/Testing")
|
||||
);
|
||||
|
||||
actionService.executeAction(rd, replicationRoot);
|
||||
|
||||
// Now with one that's in the repo
|
||||
}
|
||||
|
||||
/**
|
||||
* Test that, with a mock transfer service, we
|
||||
* pick the right things to replicate and call
|
||||
* the transfer service correctly.
|
||||
*/
|
||||
public void testReplicationExecution() throws Exception
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user