diff --git a/config/alfresco/application-context-highlevel.xml b/config/alfresco/application-context-highlevel.xml
index 978b0d6423..8a62ef61df 100644
--- a/config/alfresco/application-context-highlevel.xml
+++ b/config/alfresco/application-context-highlevel.xml
@@ -10,6 +10,7 @@
+
diff --git a/config/alfresco/bootstrap/replicationActionSpace.xml b/config/alfresco/bootstrap/replicationActionSpace.xml
new file mode 100644
index 0000000000..25c2a0dfef
--- /dev/null
+++ b/config/alfresco/bootstrap/replicationActionSpace.xml
@@ -0,0 +1,18 @@
+
+
+
+
+
+ workspace
+ SpacesStore
+ replication_actions_space
+ ${spaces.replication.replication_actions.name}
+ ${spaces.replication.replication_actions.name}
+ ${spaces.replication.replication_actions.description}
+
+
+
+
+
diff --git a/config/alfresco/import-export-context.xml b/config/alfresco/import-export-context.xml
index 371a3f0410..2c1e4d1da1 100644
--- a/config/alfresco/import-export-context.xml
+++ b/config/alfresco/import-export-context.xml
@@ -357,6 +357,7 @@
${spaces.emailActions.childname}
${spaces.searchAction.childname}
${spaces.rendition.rendering_actions.childname}
+ ${spaces.replication.replication_actions.childname}
${spaces.wcm_deployed.childname}
diff --git a/config/alfresco/messages/bootstrap-spaces.properties b/config/alfresco/messages/bootstrap-spaces.properties
index 15188af254..09ca4e0734 100644
--- a/config/alfresco/messages/bootstrap-spaces.properties
+++ b/config/alfresco/messages/bootstrap-spaces.properties
@@ -39,6 +39,9 @@ spaces.templates.rss.description=RSS templates
spaces.rendition.rendering_actions.name=Rendering Actions Space
spaces.rendition.rendering_actions.description=A space used by the system to persist rendering actions.
+spaces.replication.replication_actions.name=Replication Actions Space
+spaces.replication.replication_actions.description=A space used by the system to persist replication actions.
+
spaces.savedsearches.name=Saved Searches
spaces.savedsearches.description=Saved Searches
diff --git a/config/alfresco/messages/patch-service.properties b/config/alfresco/messages/patch-service.properties
index 94da4838ba..5a3d2f3870 100644
--- a/config/alfresco/messages/patch-service.properties
+++ b/config/alfresco/messages/patch-service.properties
@@ -115,6 +115,10 @@ patch.rendition.rendering_actions.exists=The Rendering Actions folder already ex
patch.rendition.rendering_actions.created=The Rendering Actions folder was successfully created: {0}
patch.rendition.rendering_actions.description=Creates the Rendering Actions folder.
+patch.replication.replication_actions.exists=The Replication Actions folder already exists: {0}.
+patch.replication.replication_actions.created=The Replication Actions folder was successfully created: {0}
+patch.replication.replication_actions.description=Creates the Replication Actions folder.
+
patch.uifacetsAspectRemovalPatch.description=Removes the incorrectly applied uifacets aspect from presentation template files.
patch.uifacetsAspectRemovalPatch.updated=Successfully removed the uifacets aspect from {0} presentation template files.
diff --git a/config/alfresco/patch/patch-services-context.xml b/config/alfresco/patch/patch-services-context.xml
index 2d98a9d874..5fd159b2a7 100644
--- a/config/alfresco/patch/patch-services-context.xml
+++ b/config/alfresco/patch/patch-services-context.xml
@@ -2344,5 +2344,27 @@
+
+
+ patch.replication.replication_actions
+ patch.replication.replication_actions.description
+ 0
+ 4107
+ 4108
+
+
+
+
+
+ /${spaces.company_home.childname}/${spaces.dictionary.childname}/${spaces.replication.replication_actions.childname}
+
+
+
+ /${spaces.company_home.childname}/${spaces.dictionary.childname}
+ alfresco/bootstrap/replicationActionSpace.xml
+ alfresco/messages/bootstrap-spaces
+
+
+
-
\ No newline at end of file
+
diff --git a/config/alfresco/replication-services-context.xml b/config/alfresco/replication-services-context.xml
new file mode 100644
index 0000000000..271fdf3e1b
--- /dev/null
+++ b/config/alfresco/replication-services-context.xml
@@ -0,0 +1,80 @@
+
+
+
+
+
+
+
+
+
+ org.alfresco.service.cmr.replication.ReplicationService
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ${server.transaction.mode.default}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/config/alfresco/repository.properties b/config/alfresco/repository.properties
index 961cf581dc..3ae1580b7b 100644
--- a/config/alfresco/repository.properties
+++ b/config/alfresco/repository.properties
@@ -305,6 +305,7 @@ spaces.user_homes.childname=app:user_homes
spaces.sites.childname=st:sites
spaces.templates.email.invite.childname=cm:invite
spaces.rendition.rendering_actions.childname=app:rendering_actions
+spaces.replication.replication_actions.childname=app:replication_actions
spaces.wcm_deployed.childname=cm:wcm_deployed
spaces.transfers.childname=app:transfers
spaces.transfer_groups.childname=app:transfer_groups
diff --git a/source/java/org/alfresco/repo/replication/ReplicationDefinitionImpl.java b/source/java/org/alfresco/repo/replication/ReplicationDefinitionImpl.java
new file mode 100644
index 0000000000..df18a3276e
--- /dev/null
+++ b/source/java/org/alfresco/repo/replication/ReplicationDefinitionImpl.java
@@ -0,0 +1,132 @@
+/*
+ * 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 .
+ */
+
+package org.alfresco.repo.replication;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.alfresco.repo.action.ActionImpl;
+import org.alfresco.service.cmr.action.Action;
+import org.alfresco.service.cmr.replication.ReplicationDefinition;
+import org.alfresco.service.cmr.repository.NodeRef;
+import org.alfresco.service.namespace.QName;
+
+/**
+ * @author Nick Burch
+ * @since 3.4
+ */
+public class ReplicationDefinitionImpl extends ActionImpl implements ReplicationDefinition
+{
+ /**
+ * Serial version UID
+ */
+ private static final long serialVersionUID = 3183721054220388564L;
+
+ public static final String REPLICATION_DEFINITION_NAME = "replicationActionName";
+
+ public String description;
+ public String targetName;
+ public List payload;
+ public NodeRef localTransferReport;
+
+ /**
+ * @param id
+ * the action id
+ * @param replicationName
+ * a unique name for the replication action.
+ */
+ public ReplicationDefinitionImpl(String id, QName replicationName)
+ {
+ this(id, replicationName, null);
+ }
+
+ /**
+ * @param id
+ * the action id
+ * @param replicationName
+ * a unique name for the replication action.
+ * @param description
+ * a description of the replication
+ */
+ public ReplicationDefinitionImpl(String id, QName replicationName, String description)
+ {
+ super(null, id);
+ setParameterValue(REPLICATION_DEFINITION_NAME, replicationName);
+ setDescription(description);
+ }
+
+ public ReplicationDefinitionImpl(Action action)
+ {
+ super(action);
+ }
+
+ /*
+ * @see org.alfresco.service.cmr.replication.ReplicationDefinition#getReplicationName()
+ */
+ public QName getReplicationName()
+ {
+ Serializable parameterValue = getParameterValue(REPLICATION_DEFINITION_NAME);
+ return (QName) parameterValue;
+ }
+
+ /*
+ * @see
+ * org.alfresco.service.cmr.replication.ReplicationDefinition#getPayload()
+ */
+ public List getPayload() {
+ if(this.payload == null) {
+ this.payload = new ArrayList();
+ }
+ return this.payload;
+ }
+
+ /*
+ * @see
+ * org.alfresco.service.cmr.replication.ReplicationDefinition#getTargetName()
+ */
+ public String getTargetName() {
+ return this.targetName;
+ }
+
+ /*
+ * @see
+ * org.alfresco.service.cmr.replication.ReplicationDefinition#setTargetName(String)
+ */
+ public void setTargetName(String targetName) {
+ this.targetName = targetName;
+ }
+
+ /*
+ * @see
+ * org.alfresco.service.cmr.replication.ReplicationDefinition#getLocalTransferReport()
+ */
+ public NodeRef getLocalTransferReport() {
+ return localTransferReport;
+ }
+
+ /*
+ * @see
+ * org.alfresco.service.cmr.replication.ReplicationDefinition#setLocalTransferReport(NodeRef)
+ */
+ public void setLocalTransferReport(NodeRef report) {
+ this.localTransferReport = report;
+ }
+}
diff --git a/source/java/org/alfresco/repo/replication/ReplicationDefinitionPersister.java b/source/java/org/alfresco/repo/replication/ReplicationDefinitionPersister.java
new file mode 100644
index 0000000000..bfdb449c84
--- /dev/null
+++ b/source/java/org/alfresco/repo/replication/ReplicationDefinitionPersister.java
@@ -0,0 +1,81 @@
+/*
+ * 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 .
+ */
+
+package org.alfresco.repo.replication;
+
+import java.util.List;
+
+import org.alfresco.service.cmr.replication.ReplicationDefinition;
+import org.alfresco.service.namespace.QName;
+
+/**
+ * This class provides the implementation of ReplicationDefinition persistence.
+ *
+ * @author Nick Burch
+ * @since 3.4
+ */
+public interface ReplicationDefinitionPersister
+{
+ /**
+ * This method serializes the {@link ReplicationDefinition} and stores it in
+ * the repository. {@link ReplicationDefinition}s saved in this way may be
+ * retrieved using the load()
method.
+ *
+ * @param replicationDefinition The {@link ReplicationDefinition} to be
+ * persisted.
+ */
+ void saveReplicationDefinition(ReplicationDefinition replicationDefinition);
+
+ /**
+ * This method retrieves a {@link ReplicationDefinition} that has been stored
+ * in the repository using the save()
method. If no
+ * {@link ReplicationDefinition} exists in the repository with the specified
+ * rendition name then this method returns null.
+ *
+ * @param replicationName The unique identifier used to specify the
+ * {@link ReplicationDefinition} to retrieve.
+ * @return The specified {@link ReplicationDefinition} or null.
+ */
+ ReplicationDefinition loadReplicationDefinition(QName replicationName);
+
+ /**
+ * This method retrieves the {@link ReplicationDefinition}s that have been
+ * stored in the repository using the save()
method.
+ *
+ * If there are no such {@link ReplicationDefinition}s, an empty list is
+ * returned.
+ *
+ * @return The {@link ReplicationDefinition}s.
+ */
+ List loadReplicationDefinitions();
+
+ /**
+ * This method retrieves the stored {@link ReplicationDefinition}s that have
+ * been registered for the specified transfer target name.
+ *
+ * If there are no such rendering {@link ReplicationDefinition}s, an empty
+ * list is returned.
+ *
+ * @param targetName the name of a target.
+ * @return The {@link ReplicationDefinition}s.
+ * @throws NullPointerException if the target is null.
+ * @see #saveReplicationDefinition(ReplicationDefinition)
+ */
+ List loadReplicationDefinitions(String targetName);
+}
diff --git a/source/java/org/alfresco/repo/replication/ReplicationDefinitionPersisterImpl.java b/source/java/org/alfresco/repo/replication/ReplicationDefinitionPersisterImpl.java
new file mode 100644
index 0000000000..87e660750e
--- /dev/null
+++ b/source/java/org/alfresco/repo/replication/ReplicationDefinitionPersisterImpl.java
@@ -0,0 +1,192 @@
+/*
+ * 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 .
+ */
+
+package org.alfresco.repo.replication;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import org.alfresco.model.ContentModel;
+import org.alfresco.repo.action.ActionModel;
+import org.alfresco.repo.action.RuntimeActionService;
+import org.alfresco.service.cmr.action.Action;
+import org.alfresco.service.cmr.replication.ReplicationDefinition;
+import org.alfresco.service.cmr.replication.ReplicationServiceException;
+import org.alfresco.service.cmr.repository.ChildAssociationRef;
+import org.alfresco.service.cmr.repository.NodeRef;
+import org.alfresco.service.cmr.repository.NodeService;
+import org.alfresco.service.cmr.repository.StoreRef;
+import org.alfresco.service.namespace.QName;
+
+/**
+ * This class provides the implementation of ReplicationDefinition persistence.
+ *
+ * @author Nick Burch
+ * @since 3.4
+ */
+public class ReplicationDefinitionPersisterImpl implements ReplicationDefinitionPersister
+{
+ /** Reference to the replication action space node */
+ private static final StoreRef SPACES_STORE = new StoreRef(StoreRef.PROTOCOL_WORKSPACE, "SpacesStore");
+ protected static final NodeRef REPLICATION_ACTION_ROOT_NODE_REF = new NodeRef(SPACES_STORE, "replication_actions_space");
+
+ /* Injected services */
+ private NodeService nodeService;
+ private RuntimeActionService runtimeActionService;
+
+ /**
+ * Injects the NodeService bean.
+ *
+ * @param nodeService the NodeService.
+ */
+ public void setNodeService(NodeService nodeService)
+ {
+ this.nodeService = nodeService;
+ }
+
+ /**
+ * Injects the RuntimeActionService bean.
+ *
+ * @param runtimeActionService the RuntimeActionService.
+ */
+ public void setRuntimeActionService(RuntimeActionService runtimeActionService)
+ {
+ this.runtimeActionService = runtimeActionService;
+ }
+
+ public List loadReplicationDefinitions()
+ {
+ checkReplicationActionRootNodeExists();
+
+ // Note that in the call to getChildAssocs below, only the specified
+ // types are included.
+ // Subtypes of the type action:action will not be returned.
+ Set actionTypes = new HashSet();
+ actionTypes.add(ActionModel.TYPE_ACTION);
+
+ List childAssocs = nodeService.getChildAssocs(REPLICATION_ACTION_ROOT_NODE_REF, actionTypes);
+
+ List renderingActions = new ArrayList(childAssocs.size());
+ for (ChildAssociationRef actionAssoc : childAssocs)
+ {
+ Action nextAction = runtimeActionService.createAction(actionAssoc.getChildRef());
+ renderingActions.add(new ReplicationDefinitionImpl(nextAction));
+ }
+
+ return renderingActions;
+ }
+
+ public List loadReplicationDefinitions(String targetName)
+ {
+ if (targetName == null)
+ {
+ throw new NullPointerException("Unexpected null target");
+ }
+
+ List allReplicationDefinitions = this.loadReplicationDefinitions();
+
+ List filteredReplicationDefinitions = new ArrayList();
+ for (ReplicationDefinition replicationAction : allReplicationDefinitions)
+ {
+ if (targetName.equals(replicationAction.getTargetName()))
+ {
+ filteredReplicationDefinitions.add(replicationAction);
+ }
+ }
+
+ return filteredReplicationDefinitions;
+ }
+
+
+ public ReplicationDefinition loadReplicationDefinition(QName replicationDefinitionName)
+ {
+ NodeRef actionNode = findActionNode(replicationDefinitionName);
+ if (actionNode != null)
+ {
+ Action action = runtimeActionService.createAction(actionNode);
+ return new ReplicationDefinitionImpl(action);
+ }
+ else
+ return null;
+ }
+
+ public void saveReplicationDefinition(ReplicationDefinition replicationAction)
+ {
+ NodeRef actionNodeRef = findOrCreateActionNode(replicationAction);
+
+ // TODO Serialize using JSON content instead.
+ // The current serialization mechanism creates a complex content model
+ // structure which is verbose and a JSON-based approach using a simplified
+ // content model perhaps could offer performance improvements.
+ runtimeActionService.saveActionImpl(actionNodeRef, replicationAction);
+ }
+
+ private NodeRef findActionNode(QName replicationDefinitionName)
+ {
+ checkReplicationActionRootNodeExists();
+ List childAssocs = nodeService.getChildAssocs(//
+ REPLICATION_ACTION_ROOT_NODE_REF,//
+ ContentModel.ASSOC_CONTAINS,//
+ replicationDefinitionName);
+ if (childAssocs.isEmpty())
+ {
+ return null;
+ }
+ else
+ {
+ if (childAssocs.size() > 1)
+ {
+ throw new ReplicationServiceException("Multiple replication definitions with the name: "
+ + replicationDefinitionName + " exist!");
+ }
+ return childAssocs.get(0).getChildRef();
+ }
+ }
+
+ private NodeRef findOrCreateActionNode(ReplicationDefinition replicationAction)
+ {
+ QName actionName = replicationAction.getReplicationName();
+ NodeRef actionNode = findActionNode(actionName);
+ if (actionNode == null)
+ {
+ actionNode = runtimeActionService.createActionNodeRef(//
+ replicationAction,//
+ REPLICATION_ACTION_ROOT_NODE_REF,//
+ ContentModel.ASSOC_CONTAINS,//
+ actionName);
+ }
+ return actionNode;
+ }
+
+ /**
+ * This method checks whether the folder containing Replication Action nodes
+ * exists.
+ *
+ * @throws ReplicationServiceException if the folder node does not exist.
+ */
+ private void checkReplicationActionRootNodeExists()
+ {
+ if (nodeService.exists(REPLICATION_ACTION_ROOT_NODE_REF) == false)
+ {
+ throw new ReplicationServiceException("Unable to find replication action root node.");
+ }
+ }
+}
diff --git a/source/java/org/alfresco/repo/replication/ReplicationServiceImpl.java b/source/java/org/alfresco/repo/replication/ReplicationServiceImpl.java
new file mode 100644
index 0000000000..7396ff954f
--- /dev/null
+++ b/source/java/org/alfresco/repo/replication/ReplicationServiceImpl.java
@@ -0,0 +1,160 @@
+/*
+ * 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 .
+ */
+package org.alfresco.repo.replication;
+
+import java.util.List;
+
+import org.alfresco.service.cmr.action.ActionService;
+import org.alfresco.service.cmr.dictionary.DictionaryService;
+import org.alfresco.service.cmr.replication.ReplicationDefinition;
+import org.alfresco.service.cmr.replication.ReplicationService;
+import org.alfresco.service.cmr.repository.NodeService;
+import org.alfresco.service.cmr.transfer.TransferService;
+import org.alfresco.service.namespace.QName;
+import org.alfresco.util.GUID;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/*
+ * @author Nick Burch
+ * @since 3.4
+ */
+public class ReplicationServiceImpl implements ReplicationService, ReplicationDefinitionPersister {
+ private static final Log log = LogFactory.getLog(ReplicationServiceImpl.class);
+
+ private ActionService actionService;
+ private DictionaryService dictionaryService;
+ private TransferService transferService;
+ private NodeService nodeService;
+
+ private ReplicationDefinitionPersisterImpl replicationDefinitionPersister;
+
+ /**
+ * Injects the ReplicationDefinitionPersister bean.
+ * @param replicationDefinitionPersister
+ */
+ public void setReplicationDefinitionPersister(ReplicationDefinitionPersisterImpl replicationDefinitionPersister)
+ {
+ this.replicationDefinitionPersister = replicationDefinitionPersister;
+ }
+
+ /**
+ * Injects the TransferService bean
+ * @param transferService
+ */
+ public void setTransferService(TransferService transferService)
+ {
+ this.transferService = transferService;
+ }
+
+ /**
+ * Injects the NodeService bean.
+ * @param nodeService
+ */
+ public void setNodeService(NodeService nodeService)
+ {
+ this.nodeService = nodeService;
+ }
+
+ /**
+ * Injects the ActionService bean.
+ * @param actionService
+ */
+ public void setActionService(ActionService actionService)
+ {
+ this.actionService = actionService;
+ }
+
+ /**
+ * Injects the DictionaryService bean.
+ * @param dictionaryService
+ */
+ public void setDictionaryService(DictionaryService dictionaryService)
+ {
+ this.dictionaryService = dictionaryService;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see
+ * org.alfresco.service.cmr.replication.ReplicationService#createReplicationDefinition
+ * (org.alfresco.service.namespace.QName, java.lang.String)
+ */
+ public ReplicationDefinition createReplicationDefinition(
+ QName replicationDefinitionName, String description) {
+ if (log.isDebugEnabled())
+ {
+ StringBuilder msg = new StringBuilder();
+ msg.append("Creating replication definition ")
+ .append(replicationDefinitionName);
+ log.debug(msg.toString());
+ }
+ return new ReplicationDefinitionImpl(GUID.generate(), replicationDefinitionName, description);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see
+ * org.alfresco.service.cmr.replication.ReplicationService#loadReplicationDefinition
+ * (org.alfresco.service.namespace.QName)
+ */
+ public ReplicationDefinition loadReplicationDefinition(QName replicationDefinitionName) {
+ return replicationDefinitionPersister.loadReplicationDefinition(replicationDefinitionName);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see
+ * org.alfresco.service.cmr.replication.ReplicationService#loadReplicationDefinitions()
+ */
+ public List loadReplicationDefinitions() {
+ return replicationDefinitionPersister.loadReplicationDefinitions();
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see
+ * org.alfresco.service.cmr.replication.ReplicationService#loadReplicationDefinitions
+ * (String)
+ */
+ public List loadReplicationDefinitions(String target) {
+ return replicationDefinitionPersister.loadReplicationDefinitions(target); // TODO is this right
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see
+ * org.alfresco.service.cmr.replication.ReplicationService#saveReplicationDefinition
+ * (ReplicationDefinition)
+ */
+ public void saveReplicationDefinition(
+ ReplicationDefinition replicationDefinition) {
+ replicationDefinitionPersister.saveReplicationDefinition(replicationDefinition);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see
+ * org.alfresco.service.cmr.replication.ReplicationService#replication
+ * (ReplicationDefinition)
+ */
+ public void replicate(ReplicationDefinition replicationDefinition) {
+ // TODO Implement the replication work
+ }
+}
diff --git a/source/java/org/alfresco/service/cmr/replication/ReplicationDefinition.java b/source/java/org/alfresco/service/cmr/replication/ReplicationDefinition.java
new file mode 100644
index 0000000000..bf52f9a51f
--- /dev/null
+++ b/source/java/org/alfresco/service/cmr/replication/ReplicationDefinition.java
@@ -0,0 +1,82 @@
+/*
+ * 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 .
+ */
+package org.alfresco.service.cmr.replication;
+
+import java.io.Serializable;
+import java.util.List;
+
+import org.alfresco.service.cmr.action.Action;
+import org.alfresco.service.cmr.repository.NodeRef;
+import org.alfresco.service.namespace.QName;
+
+/**
+ * This class is used to fully specify an inter-repository replication. It
+ * specifies which node(s) should be transfered, which associated content
+ * should be sent with them, and which target they should be sent to.
+ *
+ * Every ReplicationDefinition has a replicationName
attribute
+ * which uniquely identifies it. It also has a single target.
+ *
+ * @author Nick Burch
+ */
+public interface ReplicationDefinition extends Action, Serializable {
+ /**
+ * @return the name which uniquely identifies this replication definition.
+ */
+ QName getReplicationName();
+
+ /**
+ * @return the name of the target repository.
+ */
+ String getTargetName();
+
+ /**
+ * Sets the name of the target repository.
+ */
+ void setTargetName(String targetName);
+
+ /**
+ * The list of Nodes to be transfered. This
+ * list can be edited as required.
+ * @return An editable list of the nodes to be transfered
+ */
+ List getPayload();
+
+ /**
+ * Returns the local side of the report on
+ * the transfer.
+ * The transfer service generates two reports,
+ * one on the local repository, and one on the
+ * remote repository. This returns the
+ * local version of the report.
+ * @return The transfer report on the local repository
+ */
+ NodeRef getLocalTransferReport();
+
+ /**
+ * Records the location on the local repository
+ * of the transfer service report on the
+ * replication.
+ */
+ void setLocalTransferReport(NodeRef report);
+
+ // TODO Persistent action bits of last start, last finish, worked
+
+ // TODO Replication options, such as permissions and rules
+}
diff --git a/source/java/org/alfresco/service/cmr/replication/ReplicationService.java b/source/java/org/alfresco/service/cmr/replication/ReplicationService.java
new file mode 100644
index 0000000000..953b05b401
--- /dev/null
+++ b/source/java/org/alfresco/service/cmr/replication/ReplicationService.java
@@ -0,0 +1,49 @@
+/*
+ * 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 .
+ */
+package org.alfresco.service.cmr.replication;
+
+import org.alfresco.repo.replication.ReplicationDefinitionPersister;
+import org.alfresco.service.NotAuditable;
+import org.alfresco.service.PublicService;
+import org.alfresco.service.namespace.QName;
+
+/**
+ * The Replication service.
+ * @author Nick Burch
+ */
+@PublicService
+public interface ReplicationService extends ReplicationDefinitionPersister {
+ /**
+ * Creates a new {@link ReplicationDefinition} and sets the replication
+ * name and description to the specified values.
+ * @param replicationName A unique identifier used to specify the created
+ * {@link ReplicationDefinition}
+ * @param description A description of the replication
+ * @return the created {@link ReplicationDefinition}
+ */
+ @NotAuditable
+ ReplicationDefinition createReplicationDefinition(QName replicationName, String description);
+
+ /**
+ * Runs the specified replication.
+ * @param replicationDefinition The replication to run
+ */
+ @NotAuditable
+ void replicate(ReplicationDefinition replicationDefinition);
+}
diff --git a/source/java/org/alfresco/service/cmr/replication/ReplicationServiceException.java b/source/java/org/alfresco/service/cmr/replication/ReplicationServiceException.java
new file mode 100644
index 0000000000..aca982f33f
--- /dev/null
+++ b/source/java/org/alfresco/service/cmr/replication/ReplicationServiceException.java
@@ -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 .
+ */
+package org.alfresco.service.cmr.replication;
+
+import org.alfresco.error.AlfrescoRuntimeException;
+
+/**
+ * Replication Service Exception Class
+ *
+ * @author Nick Burch
+ */
+public class ReplicationServiceException extends AlfrescoRuntimeException
+{
+ private static final long serialVersionUID = 3961767729869569556L;
+
+ /**
+ * Constructs a Replication Service Exception with the specified message.
+ *
+ * @param message the message string
+ */
+ public ReplicationServiceException(String message)
+ {
+ super(message);
+ }
+
+ /**
+ * Constructs a Replication Service Exception with the specified message and source exception.
+ *
+ * @param message the message string
+ * @param source the source exception
+ */
+ public ReplicationServiceException(String message, Throwable source)
+ {
+ super(message, source);
+ }
+}