org.alfresco.deployment.impl.server
Class DeploymentReceiverEngineImpl

java.lang.Object
  extended by org.alfresco.deployment.impl.server.DeploymentReceiverEngineImpl
All Implemented Interfaces:
java.lang.Runnable, DeploymentReceiverService, DeploymentReceiverTransport, DeploymentTargetRegistry, org.springframework.context.ApplicationContextAware

public class DeploymentReceiverEngineImpl
extends java.lang.Object
implements DeploymentReceiverTransport, DeploymentTargetRegistry, java.lang.Runnable, org.springframework.context.ApplicationContextAware

This is the implementation of the Alfresco Deployment Receiver Engine The Deployment Receiver Engine manages the communications with a host instance of alfresco and then delegates the deployment to one of the deployment targets. It also manages some server based functionality to do with start up / shut down and housekeeping.


Constructor Summary
DeploymentReceiverEngineImpl()
           
 
Method Summary
 void abort(java.lang.String ticket)
          Signals that the deployment should be aborted and rolled back.
 DeploymentToken begin(java.lang.String targetName, java.lang.String storeName, int version, java.lang.String user, char[] password)
          Start a deployment.
 void commit(java.lang.String ticket)
          Signals that the deployment should commit.
 void createDirectory(java.lang.String ticket, java.lang.String path, java.lang.String guid, java.util.Set aspects, java.util.Map props)
          Create a new directory.
 void delete(java.lang.String ticket, java.lang.String path)
          Delete a file or directory.
 void finishSend(java.lang.String ticket, java.lang.String outputToken)
          Tell the deployment receiver that a send is finished.
 DeploymentReceiverAuthenticator getAuthenticator()
           
 DeploymentCommandQueue getCommandQueue()
           
 java.util.Set getHousekeepers()
           
 java.util.List getListing(java.lang.String ticket, java.lang.String path)
          Get a listing of a directory.
 long getPollDelay()
           
 ReaderManagement getReaderManagement()
           
 java.lang.String getSendToken(java.lang.String ticket, boolean create, java.lang.String path, java.lang.String guid, java.lang.String encoding, java.lang.String mimeType, java.util.Set aspects, java.util.Map props)
          Get an OutputStream token.
 java.util.Map getTargets()
          Get the targets for this deployment engine.
 java.util.List getTransformers()
          Get the content transformers for this transport - if the transport does not support content transformation then simply return null;
 void init()
           
 boolean isDaemonThread()
           
 void prepare(java.lang.String ticket)
          Signals that the deployment should prepare
 void registerTarget(java.lang.String name, DeploymentTarget target)
          Register a new deployment target.
 void run()
          This is the keep-alive thread of the FSR.
 java.io.OutputStream send(java.lang.String token, boolean create, java.lang.String path, java.lang.String guid, java.lang.String encoding, java.lang.String mimeType, java.util.Set aspects, java.util.Map props)
          Send a file to a path.
 void setApplicationContext(org.springframework.context.ApplicationContext applicationContext)
           
 void setAuthenticator(DeploymentReceiverAuthenticator authenticator)
           
 void setCommandQueue(DeploymentCommandQueue commandQueue)
           
 void setDaemonThread(boolean isDemonThread)
           
 void setHousekeepers(java.util.Set housekeepers)
           
 void setPollDelay(long pollDelay)
           
 void setReaderManagement(ReaderManagement readerManagement)
           
 void setTransformers(java.util.List transformers)
           
 void shutDown()
           
 void shutDown(java.lang.String user, char[] password)
          Shut down the Deployment Receiver.
 void unregisterTarget(java.lang.String name)
          Unregister a deployment target
 void updateDirectory(java.lang.String ticket, java.lang.String path, java.lang.String guid, java.util.Set aspects, java.util.Map properties)
          Set the Guid (Version) on a directory.
 void write(java.lang.String ticket, java.lang.String outputToken, byte[] data, int offset, int count)
          Write a block of bytes to a file that is being sent.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DeploymentReceiverEngineImpl

public DeploymentReceiverEngineImpl()
Method Detail

init

public void init()

shutDown

public void shutDown()

shutDown

public void shutDown(java.lang.String user,
                     char[] password)
Description copied from interface: DeploymentReceiverTransport
Shut down the Deployment Receiver.

Specified by:
shutDown in interface DeploymentReceiverTransport

run

public void run()
This is the keep-alive thread of the FSR. When fDone = true this thread exits and the JVM will terminate. And since we have to have a thread - may as well use it to process our event queues.

Specified by:
run in interface java.lang.Runnable
See Also:
Runnable.run()

setApplicationContext

public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext)
                           throws org.springframework.beans.BeansException
Specified by:
setApplicationContext in interface org.springframework.context.ApplicationContextAware
Throws:
org.springframework.beans.BeansException

getTransformers

public java.util.List getTransformers()
Get the content transformers for this transport - if the transport does not support content transformation then simply return null;

Returns:
the content transformers or null if there are no transformers.

setTransformers

public void setTransformers(java.util.List transformers)

registerTarget

public void registerTarget(java.lang.String name,
                           DeploymentTarget target)
Register a new deployment target. If an entry with the old name already exists then the new value replaces the old value.

Specified by:
registerTarget in interface DeploymentTargetRegistry
Parameters:
name - the name of the target
target - the implementation of the target

unregisterTarget

public void unregisterTarget(java.lang.String name)
Unregister a deployment target

Specified by:
unregisterTarget in interface DeploymentTargetRegistry
Parameters:
name - the name of the target

getTargets

public java.util.Map getTargets()
Get the targets for this deployment engine.

Specified by:
getTargets in interface DeploymentTargetRegistry
Returns:
the targets for this deployment engine

begin

public DeploymentToken begin(java.lang.String targetName,
                             java.lang.String storeName,
                             int version,
                             java.lang.String user,
                             char[] password)
Description copied from interface: DeploymentReceiverService
Start a deployment.

Specified by:
begin in interface DeploymentReceiverService
Parameters:
targetName - The target to deploy to. A target is simply a key to a receiver side deployment configuration.
storeName - - the name of the store being deployed.
version - - the version being deployed.
user - The user name for authentication.
password - The password for the user.
Returns:
information on the new deployment.

abort

public void abort(java.lang.String ticket)
Description copied from interface: DeploymentReceiverService
Signals that the deployment should be aborted and rolled back.

Specified by:
abort in interface DeploymentReceiverService

prepare

public void prepare(java.lang.String ticket)
Description copied from interface: DeploymentReceiverService
Signals that the deployment should prepare

Specified by:
prepare in interface DeploymentReceiverService
Parameters:
ticket - The transaction ticket.

commit

public void commit(java.lang.String ticket)
Description copied from interface: DeploymentReceiverService
Signals that the deployment should commit.

Specified by:
commit in interface DeploymentReceiverService
Parameters:
ticket - The transaction ticket.

delete

public void delete(java.lang.String ticket,
                   java.lang.String path)
Description copied from interface: DeploymentReceiverService
Delete a file or directory.

Specified by:
delete in interface DeploymentReceiverService

getListing

public java.util.List getListing(java.lang.String ticket,
                                 java.lang.String path)
Description copied from interface: DeploymentReceiverService
Get a listing of a directory.

Specified by:
getListing in interface DeploymentReceiverService
Returns:
The listing in name sorted order.

createDirectory

public void createDirectory(java.lang.String ticket,
                            java.lang.String path,
                            java.lang.String guid,
                            java.util.Set aspects,
                            java.util.Map props)
Description copied from interface: DeploymentReceiverService
Create a new directory.

Specified by:
createDirectory in interface DeploymentReceiverService
guid - The GUID (Version) of the directory to be created.

updateDirectory

public void updateDirectory(java.lang.String ticket,
                            java.lang.String path,
                            java.lang.String guid,
                            java.util.Set aspects,
                            java.util.Map properties)
Description copied from interface: DeploymentReceiverService
Set the Guid (Version) on a directory.

Specified by:
updateDirectory in interface DeploymentReceiverService

send

public java.io.OutputStream send(java.lang.String token,
                                 boolean create,
                                 java.lang.String path,
                                 java.lang.String guid,
                                 java.lang.String encoding,
                                 java.lang.String mimeType,
                                 java.util.Set aspects,
                                 java.util.Map props)
Description copied from interface: DeploymentReceiverService
Send a file to a path.

Specified by:
send in interface DeploymentReceiverService
create - - true new file
aspects - - full qualified names of the aspects that this file is associated with.
Returns:
an open output steam for writing content

getSendToken

public java.lang.String getSendToken(java.lang.String ticket,
                                     boolean create,
                                     java.lang.String path,
                                     java.lang.String guid,
                                     java.lang.String encoding,
                                     java.lang.String mimeType,
                                     java.util.Set aspects,
                                     java.util.Map props)
Description copied from interface: DeploymentReceiverTransport
Get an OutputStream token.

Specified by:
getSendToken in interface DeploymentReceiverTransport
Returns:
the token to identify this file.

write

public void write(java.lang.String ticket,
                  java.lang.String outputToken,
                  byte[] data,
                  int offset,
                  int count)
Description copied from interface: DeploymentReceiverTransport
Write a block of bytes to a file that is being sent.

Specified by:
write in interface DeploymentReceiverTransport

finishSend

public void finishSend(java.lang.String ticket,
                       java.lang.String outputToken)
Description copied from interface: DeploymentReceiverTransport
Tell the deployment receiver that a send is finished.

Specified by:
finishSend in interface DeploymentReceiverTransport

setAuthenticator

public void setAuthenticator(DeploymentReceiverAuthenticator authenticator)

getAuthenticator

public DeploymentReceiverAuthenticator getAuthenticator()

setHousekeepers

public void setHousekeepers(java.util.Set housekeepers)

getHousekeepers

public java.util.Set getHousekeepers()

setPollDelay

public void setPollDelay(long pollDelay)

getPollDelay

public long getPollDelay()

setCommandQueue

public void setCommandQueue(DeploymentCommandQueue commandQueue)

getCommandQueue

public DeploymentCommandQueue getCommandQueue()

setReaderManagement

public void setReaderManagement(ReaderManagement readerManagement)

getReaderManagement

public ReaderManagement getReaderManagement()

setDaemonThread

public void setDaemonThread(boolean isDemonThread)

isDaemonThread

public boolean isDaemonThread()


Copyright © 2005 - 2010 Alfresco Software, Inc. All Rights Reserved.