* TransferId, Lock
*/
- private Map
- * Then the tree needs to be walked upwards to mark all parent
+ * Then the tree needs to be walked upwards to mark all parent
* transferred nodes as alien.
*/
public void onCreateChildAssociation(ChildAssociationRef childAssocRef,
boolean isNewNode)
{
-
+
log.debug("on create child association to transferred node");
-
+
final String localRepositoryId = descriptorService.getCurrentRepositoryDescriptor().getId();
- alienProcessor.onCreateChild(childAssocRef, localRepositoryId, isNewNode);
+ alienProcessor.onCreateChild(childAssocRef, localRepositoryId, isNewNode);
}
-
+
/**
* When an alien node is deleted the it may be the last alien invader
*
@@ -1230,9 +1230,9 @@ public class RepoTransferReceiverImpl implements TransferReceiver,
log.debug("on delete node - need to check for transferred node");
alienProcessor.beforeDeleteAlien(deletedNodeRef, null);
}
-
+
/**
- * When a transferred node is restored it may be a new invader or it may no
+ * When a transferred node is restored it may be a new invader or it may no
* longer be an invader.
*
* Walk the tree checking the invasion status!
@@ -1243,22 +1243,22 @@ public class RepoTransferReceiverImpl implements TransferReceiver,
log.debug("restoredAssocRef:" + childAssocRef);
alienProcessor.afterMoveAlien(childAssocRef);
}
-
+
/**
- * When an alien node is moved it may un-invade its old location and invade a new
+ * When an alien node is moved it may un-invade its old location and invade a new
* location. The node may also cease to be alien.
*/
public void onMoveNode(ChildAssociationRef oldChildAssocRef,
ChildAssociationRef newChildAssocRef)
{
- log.debug("onMoveNode");
+ log.debug("onMoveNode");
log.debug("oldChildAssocRef:" + oldChildAssocRef);
log.debug("newChildAssocRef:" + newChildAssocRef);
-
+
NodeRef oldParentRef = oldChildAssocRef.getParentRef();
NodeRef newParentRef = newChildAssocRef.getParentRef();
-
+
if(newParentRef.equals(oldParentRef))
{
log.debug("old parent and new parent are the same - this is a rename, do nothing");
@@ -1273,35 +1273,35 @@ public class RepoTransferReceiverImpl implements TransferReceiver,
alienProcessor.afterMoveAlien(newChildAssocRef);
}
}
-
+
/**
* When a transferred node is copied, don't copy the transferred aspect.
*/
public CopyBehaviourCallback onCopyTransferred(QName classRef,
CopyDetails copyDetails)
{
- return TransferredAspectCopyBehaviourCallback.INSTANCE;
+ return TransferredAspectCopyBehaviourCallback.INSTANCE;
}
-
+
/**
* When an alien node is copied, don't copy the alien aspect.
*/
public CopyBehaviourCallback onCopyAlien(QName classRef,
CopyDetails copyDetails)
{
- return AlienAspectCopyBehaviourCallback.INSTANCE;
+ return AlienAspectCopyBehaviourCallback.INSTANCE;
}
-
+
/**
* Extends the default copy behaviour to prevent copying of transferred aspect and properties.
- *
+ *
* @author Mark Rogers
* @since 3.4
*/
private static class TransferredAspectCopyBehaviourCallback extends DefaultCopyBehaviourCallback
{
private static final CopyBehaviourCallback INSTANCE = new TransferredAspectCopyBehaviourCallback();
-
+
/**
* @return Returns an empty map
*/
@@ -1311,10 +1311,10 @@ public class RepoTransferReceiverImpl implements TransferReceiver,
{
return Collections.emptyMap();
}
-
+
/**
* Don't copy the transferred aspect.
- *
+ *
* @return Returns true always
*/
@Override
@@ -1330,17 +1330,17 @@ public class RepoTransferReceiverImpl implements TransferReceiver,
}
}
}
-
+
/**
* Extends the default copy behaviour to prevent copying of alien aspect and properties.
- *
+ *
* @author Mark Rogers
* @since 3.4
*/
private static class AlienAspectCopyBehaviourCallback extends DefaultCopyBehaviourCallback
{
private static final CopyBehaviourCallback INSTANCE = new AlienAspectCopyBehaviourCallback();
-
+
/**
* @return Returns an empty map
*/
@@ -1350,10 +1350,10 @@ public class RepoTransferReceiverImpl implements TransferReceiver,
{
return Collections.emptyMap();
}
-
+
/**
* Don't copy the transferred aspect.
- *
+ *
* @return Returns true always
*/
@Override
@@ -1370,7 +1370,7 @@ public class RepoTransferReceiverImpl implements TransferReceiver,
}
}
-
+
public void setDescriptorService(DescriptorService descriptorService)
{
this.descriptorService = descriptorService;
@@ -1380,7 +1380,7 @@ public class RepoTransferReceiverImpl implements TransferReceiver,
{
return descriptorService;
}
-
+
public void setAlienProcessor(AlienProcessor alienProcessor)
{
this.alienProcessor = alienProcessor;
@@ -1404,7 +1404,7 @@ public class RepoTransferReceiverImpl implements TransferReceiver,
nodeService.setProperty(nodeRef, TransferModel.PROP_FROM_CONTENT, null);
}
}
-
+
public void setJobLockService(JobLockService jobLockService)
{
this.jobLockService = jobLockService;
@@ -1464,41 +1464,41 @@ public class RepoTransferReceiverImpl implements TransferReceiver,
* The name of the lock - unique for each domain
*/
QName lockQName;
-
+
/**
* The unique token for this lock instance.
*/
String lockToken;
-
+
/**
* The transfer that this lock belongs to.
*/
String transferId;
-
+
/**
* Is the lock active ?
*/
private boolean active = false;
-
+
/**
* Is the server processing ?
*/
private boolean processing = false;
-
+
/**
* When did we last check whether the lock is active
*/
Date lastActive = new Date();
-
+
public Lock(QName lockQName)
{
this.lockQName = lockQName;
}
-
-
+
+
/**
* Make the lock - called on main thread
- *
+ *
* @throws LockAquisitionException
*/
public void makeLock()
@@ -1507,14 +1507,14 @@ public class RepoTransferReceiverImpl implements TransferReceiver,
{
log.debug("makeLock" + lockQName);
}
-
+
lockToken = getJobLockService().getLock(lockQName, getLockRefreshTime(), getLockRetryWait(), getLockRetryCount());
-
+
synchronized(this)
{
active = true;
}
-
+
if (log.isDebugEnabled())
{
log.debug("lock taken: name" + lockQName + " token:" +lockToken);
@@ -1523,10 +1523,10 @@ public class RepoTransferReceiverImpl implements TransferReceiver,
getJobLockService().refreshLock(lockToken, lockQName, getLockRefreshTime(), this);
log.debug("refreshLock callback registered");
}
-
+
/**
- * Check that the lock is still active
- *
+ * Check that the lock is still active
+ *
* Called on main transfer thread as transfer proceeds.
* @throws TransferException (Lock timeout)
*/
@@ -1535,7 +1535,7 @@ public class RepoTransferReceiverImpl implements TransferReceiver,
log.debug("suspend lock called");
if(active)
{
- processing = true;
+ processing = true;
}
else
{
@@ -1544,24 +1544,24 @@ public class RepoTransferReceiverImpl implements TransferReceiver,
throw new TransferException(MSG_LOCK_TIMED_OUT);
}
}
-
+
public void enableLockTimeout()
{
Date now = new Date();
-
+
// Update lastActive to 1S boundary
if(now.getTime() > lastActive.getTime() + 1000)
{
lastActive = new Date();
log.debug("start waiting : lastActive:" + lastActive);
}
-
+
processing = false;
}
-
+
/**
* Release the lock
- *
+ *
* Called on main thread
*/
public void releaseLock()
@@ -1570,7 +1570,7 @@ public class RepoTransferReceiverImpl implements TransferReceiver,
{
log.debug("transfer service about to releaseLock : " + lockQName);
}
-
+
synchronized(this)
{
if(active)
@@ -1580,7 +1580,7 @@ public class RepoTransferReceiverImpl implements TransferReceiver,
active = false;
}
}
-
+
/**
* Called by Job Lock Service to determine whether the lock is still active
*/
@@ -1588,7 +1588,7 @@ public class RepoTransferReceiverImpl implements TransferReceiver,
public boolean isActive()
{
Date now = new Date();
-
+
synchronized(this)
{
if(active)
@@ -1601,7 +1601,7 @@ public class RepoTransferReceiverImpl implements TransferReceiver,
}
}
}
-
+
if(log.isDebugEnabled())
{
log.debug("transfer service callback isActive: " + active);
@@ -1624,7 +1624,7 @@ public class RepoTransferReceiverImpl implements TransferReceiver,
log.info("transfer service: lock has timed out, timeout :" + lockQName);
timeout(transferId);
}
-
+
active = false;
}
}
@@ -1642,7 +1642,7 @@ public class RepoTransferReceiverImpl implements TransferReceiver,
log.debug("checkTransfer fromRepository:" + fromRepository + ", transferToSelf:" + transferToSelf );
}
final String localRepositoryId = descriptorService.getCurrentRepositoryDescriptor().getId();
-
+
if(!transferToSelf)
{
if(fromRepository != null)
@@ -1658,7 +1658,7 @@ public class RepoTransferReceiverImpl implements TransferReceiver,
}
}
}
-
+
public void setTransferVersionChecker(TransferVersionChecker transferVersionChecker)
{
this.transferVersionChecker = transferVersionChecker;
@@ -1675,5 +1675,10 @@ public class RepoTransferReceiverImpl implements TransferReceiver,
Descriptor d = descriptorService.getServerDescriptor();
// needs to be serverDescriptor to pick up versionEdition
return new TransferVersionImpl(d);
- }
+ }
+
+ public void setFileTransferRootNodeFileFileSystem(String rootFileSystem)
+ {
+ //just ignore, no relevant for transferring on file system
+ }
}
diff --git a/source/java/org/alfresco/repo/transfer/TransferCommons.java b/source/java/org/alfresco/repo/transfer/TransferCommons.java
index 5db62c8cbf..4beab04ed4 100644
--- a/source/java/org/alfresco/repo/transfer/TransferCommons.java
+++ b/source/java/org/alfresco/repo/transfer/TransferCommons.java
@@ -19,10 +19,10 @@
package org.alfresco.repo.transfer;
/**
- * A bucket for little odds and ends for the transfer service.
- *
+ * A bucket for little odds and ends for the transfer service.
+ *
* If this becomes a big class then refactor it away.
- *
+ *
* @author Mark Rogers
*/
public class TransferCommons
@@ -31,45 +31,51 @@ public class TransferCommons
* The Mime Part Name of the manifest file
*/
public final static String PART_NAME_MANIFEST = "manifest";
-
+
/**
* The Query String for the begin method.
*/
public final static String PARAM_FROM_REPOSITORYID = "fromRepositoryId";
-
+
/**
* The Query String for the begin method.
*/
public final static String PARAM_ALLOW_TRANSFER_TO_SELF = "allowTransferToSelf";
-
+
/**
- * TransferId
+ * TransferId
*/
public final static String PARAM_TRANSFER_ID = "transferId";
-
+
/**
- * Major version
+ * Major version
*/
public final static String PARAM_VERSION_MAJOR = "versionMajor";
-
+
/**
* Minor version
- */
+ */
public final static String PARAM_VERSION_MINOR = "versionMinor";
-
+
/**
- * Revision version
+ * Revision version
*/
public final static String PARAM_VERSION_REVISION = "versionRevision";
-
+
/**
* Edition
*/
public final static String PARAM_VERSION_EDITION = "versionEdition";
+ /**
+ * File Root File Transfer
+ */
+ public final static String PARAM_ROOT_FILE_TRANSFER = "rootFileTransfer";
+
+
/**
* Mapping between contentUrl and part name.
- *
+ *
* @param URL
* @return the part name
*/
diff --git a/source/java/org/alfresco/repo/transfer/TransferModel.java b/source/java/org/alfresco/repo/transfer/TransferModel.java
index 5c0a35201f..d0d57cb007 100644
--- a/source/java/org/alfresco/repo/transfer/TransferModel.java
+++ b/source/java/org/alfresco/repo/transfer/TransferModel.java
@@ -22,7 +22,7 @@ import org.alfresco.service.namespace.QName;
/**
* Transfer Model Constants
- *
+ *
* @author Mark Rogers
* @author Brian Remmington
*/
@@ -32,7 +32,7 @@ public interface TransferModel
static final QName ASPECT_ENABLEABLE = QName.createQName(TRANSFER_MODEL_1_0_URI, "enableable");
// static final QName ASSOC_IMAP_ATTACHMENTS_FOLDER = QName.createQName(IMAP_MODEL_1_0_URI, "attachmentsFolder");
-
+
/**
* Aspect : transferred
*/
@@ -47,11 +47,17 @@ public interface TransferModel
static final QName ASPECT_ALIEN = QName.createQName(TRANSFER_MODEL_1_0_URI, "alien");
static final QName PROP_INVADED_BY = QName.createQName(TRANSFER_MODEL_1_0_URI, "invadedBy");
+ /**
+ * Aspect : fileTransferTarget
+ */
+ static final QName ASPECT_FILE_TRANSFER_TARGET = QName.createQName(TRANSFER_MODEL_1_0_URI, "fileTransferTarget");
+ static final QName ASSOC_ROOT_FILE_TRANSFER = QName.createQName(TRANSFER_MODEL_1_0_URI, "rootFileTransfer");
+
/*
* Type : Transfer Group
*/
static final QName TYPE_TRANSFER_GROUP = QName.createQName(TRANSFER_MODEL_1_0_URI, "transferGroup");
-
+
/*
* Type : Transfer Target
*/
@@ -62,7 +68,7 @@ public interface TransferModel
static final QName PROP_ENDPOINT_PATH = QName.createQName(TRANSFER_MODEL_1_0_URI, "endpointpath");
static final QName PROP_USERNAME = QName.createQName(TRANSFER_MODEL_1_0_URI, "username");
static final QName PROP_PASSWORD = QName.createQName(TRANSFER_MODEL_1_0_URI, "password");
-
+
static final QName PROP_ENABLED = QName.createQName(TRANSFER_MODEL_1_0_URI, "enabled");
/*
@@ -79,7 +85,7 @@ public interface TransferModel
static final QName PROP_PROGRESS_ENDPOINT = QName.createQName(TRANSFER_MODEL_1_0_URI, "progressEndpoint");
static final QName PROP_TRANSFER_STATUS = QName.createQName(TRANSFER_MODEL_1_0_URI, "transferStatus");
static final QName PROP_TRANSFER_ERROR = QName.createQName(TRANSFER_MODEL_1_0_URI, "transferError");
-
+
/*
* Type : Transfer report
*/
@@ -91,5 +97,6 @@ public interface TransferModel
*/
static final QName TYPE_TEMP_TRANSFER_STORE = QName.createQName(TRANSFER_MODEL_1_0_URI, "tempTransferStore");
static final QName ASSOC_TRANSFER_ORPHAN = QName.createQName(TRANSFER_MODEL_1_0_URI, "orphan");
-
+
+
}
diff --git a/source/java/org/alfresco/repo/transfer/TransferVersionImpl.java b/source/java/org/alfresco/repo/transfer/TransferVersionImpl.java
index 5835f35c66..42942f7015 100644
--- a/source/java/org/alfresco/repo/transfer/TransferVersionImpl.java
+++ b/source/java/org/alfresco/repo/transfer/TransferVersionImpl.java
@@ -27,9 +27,9 @@ public class TransferVersionImpl implements TransferVersion
private String versionMinor;
private String versionRevision;
private String edition;
-
+
/**
- *
+ *
* @param versionMajor
* @param versionMinor
* @param versionRevision
@@ -42,7 +42,7 @@ public class TransferVersionImpl implements TransferVersion
this.versionRevision = versionRevision;
this.edition = edition;
}
-
+
/**
* Construct a transferVersion from a system descriptor
* @param d the system descriptor
@@ -54,7 +54,7 @@ public class TransferVersionImpl implements TransferVersion
this.versionRevision = d.getVersionRevision();
this.edition = d.getEdition();
}
-
+
@Override
public String getVersionMajor()
{
@@ -78,7 +78,7 @@ public class TransferVersionImpl implements TransferVersion
{
return edition;
}
-
+
public String toString()
{
StringBuilder version = new StringBuilder();
@@ -89,10 +89,10 @@ public class TransferVersionImpl implements TransferVersion
version.append(getVersionMinor());
version.append(".");
version.append(getVersionRevision());
-
+
return version.toString();
}
-
+
public int hashCode()
{
if(edition != null && versionMinor != null)
@@ -104,18 +104,18 @@ public class TransferVersionImpl implements TransferVersion
return 1;
}
}
-
+
public boolean equals(Object other)
{
if(other == null)
{
return false;
}
-
+
if (other instanceof TransferVersion)
{
TransferVersion v = (TransferVersion)other;
-
+
if(!edition.equalsIgnoreCase(v.getEdition()))
{
return false;
diff --git a/source/java/org/alfresco/service/cmr/transfer/TransferReceiver.java b/source/java/org/alfresco/service/cmr/transfer/TransferReceiver.java
index 237439ea7e..f442e756b4 100644
--- a/source/java/org/alfresco/service/cmr/transfer/TransferReceiver.java
+++ b/source/java/org/alfresco/service/cmr/transfer/TransferReceiver.java
@@ -33,19 +33,19 @@ import org.alfresco.service.cmr.repository.NodeRef;
public interface TransferReceiver
{
/**
- *
+ *
* @param transferId
* @return
*/
File getStagingFolder(String transferId);
-
+
/**
- *
+ *
* @param transferId
* @return
*/
NodeRef getTempFolder(String transferId);
-
+
/**
* Asks the receiver to setup a new transfer.
* @param fromRepositoryId the repositoryId of the sending system
@@ -66,14 +66,14 @@ public interface TransferReceiver
/**
* Store the specified snapshot file into the transfer staging area.
* The specified transfer must currently be the holder of the transfer lock, otherwise an exception is thrown.
- * This operation does not close the supplied stream, so the caller must do it as appropriate. The caller
+ * This operation does not close the supplied stream, so the caller must do it as appropriate. The caller
* should assume that the supplied stream has been fully read when this operation returns.
* @param transferId The identifier of the transfer with which this snapshot is associated
* @param snapshotStream The open stream that holds the snapshot file.
* @throws TransferException If an error occurs while saving the snapshot file.
*/
void saveSnapshot(String transferId, InputStream snapshotStream) throws TransferException;
-
+
/**
* Save a content item
* @param transferId
@@ -82,28 +82,28 @@ public interface TransferReceiver
* @throws TransferException
*/
void saveContent(String transferId, String contentId, InputStream contentStream) throws TransferException;
-
+
/**
* Write the requsite (the bits required to support the Manifest) to the output stream.
* @param requsiteStream an open stream to receive the requisite
* @throws TransferException
*/
void generateRequsite(String transferId, OutputStream requsiteStream) throws TransferException;
-
+
/**
- * Prepare
+ * Prepare
* @param transferId
* @throws TransferException
*/
void prepare(String transferId) throws TransferException;
-
+
/**
* Abort
* @param transferId
* @throws TransferException
*/
void cancel(String transferId) throws TransferException;
-
+
/**
* Commit asynchronously
* @param transferId
@@ -117,29 +117,35 @@ public interface TransferReceiver
* @throws TransferException
*/
void commit(String transferId) throws TransferException;
-
+
/**
- *
+ *
* @param transferId
* @return the trabsfer progress
* @throws TransferException
*/
TransferProgress getStatus(String transferId) throws TransferException;
-
+
/**
* Get the version that we are transfering to.
*/
TransferVersion getVersion();
-
+
/**
- *
+ *
* @return
*/
TransferProgressMonitor getProgressMonitor();
-
+
/**
* get the transfer report for the specified transfer
* @param transferId
*/
InputStream getTransferReport(String transferId);
+
+ /**
+ * set the root node for the file system receiver
+ * @param rootFileSystem
+ */
+ void setFileTransferRootNodeFileFileSystem(String rootFileSystem);
}
\ No newline at end of file
diff --git a/source/java/org/alfresco/service/cmr/transfer/TransferVersion.java b/source/java/org/alfresco/service/cmr/transfer/TransferVersion.java
index 7ba49e17fe..46f0ef17df 100644
--- a/source/java/org/alfresco/service/cmr/transfer/TransferVersion.java
+++ b/source/java/org/alfresco/service/cmr/transfer/TransferVersion.java
@@ -19,33 +19,33 @@
package org.alfresco.service.cmr.transfer;
public interface TransferVersion
-{
+{
/**
* Gets the major version number, e.g. 1.2.3
- *
+ *
* @return major version number
*/
public String getVersionMajor();
/**
* Gets the minor version number, e.g. 1.2.3
- *
+ *
* @return minor version number
*/
public String getVersionMinor();
-
+
/**
* Gets the version revision number, e.g. 1.2.3
- *
+ *
* @return revision number
*/
public String getVersionRevision();
-
+
/**
* Gets the edition
- *
+ *
* @return the edition
*/
public String getEdition();
-
+
}