org.alfresco.repo.remote
Class RepoRemoteTransportService

java.lang.Object
  extended by org.alfresco.repo.remote.RepoRemoteTransportService
All Implemented Interfaces:
java.lang.Runnable, RepoRemoteTransport

public class RepoRemoteTransportService
extends java.lang.Object
implements RepoRemoteTransport, java.lang.Runnable

The server side implementation of RepoRemoteTransport. It handles ticket validation, and expiration of idle streams.


Constructor Summary
RepoRemoteTransportService()
          Default constructor.
 
Method Summary
 void closeInputHandle(java.lang.String ticket, java.lang.String handle)
          Close a remote InputStream.
 void closeOutputHandle(java.lang.String ticket, java.lang.String handle)
          Close a remote OutputStream.
 org.alfresco.service.cmr.repository.NodeRef createDirectory(java.lang.String ticket, org.alfresco.service.cmr.repository.NodeRef base, java.lang.String path)
          Create a new directory.
 java.lang.String createFile(java.lang.String ticket, org.alfresco.service.cmr.repository.NodeRef base, java.lang.String path)
          Create a file relative to a base node.
 java.util.Map getListing(java.lang.String ticket, org.alfresco.service.cmr.repository.NodeRef dir)
          Get a listing of a directory.
 org.alfresco.service.cmr.repository.NodeRef getRoot(java.lang.String ticket)
          Get the root node of the SpacesStore repo.
 void init()
          The init method.
 org.alfresco.util.Pair lookup(java.lang.String ticket, org.alfresco.service.cmr.repository.NodeRef base, java.lang.String path)
          Lookup a node by path relative to a node.
 java.lang.String readFile(java.lang.String ticket, org.alfresco.service.cmr.repository.NodeRef fileRef)
          Read a file directly.
 java.lang.String readFile(java.lang.String ticket, org.alfresco.service.cmr.repository.NodeRef base, java.lang.String path)
          Read a file from a relative path.
 byte[] readInput(java.lang.String ticket, java.lang.String handle, int count)
          Read a block of bytes over the wire.
 void removeNode(java.lang.String ticket, org.alfresco.service.cmr.repository.NodeRef toRemove)
          Remove a node directly.
 void removeNode(java.lang.String ticket, org.alfresco.service.cmr.repository.NodeRef base, java.lang.String path)
          Remove a node via a relative path.
 void rename(java.lang.String ticket, org.alfresco.service.cmr.repository.NodeRef base, java.lang.String src, java.lang.String dst)
          Rename a node
 void run()
          The body of this Runnable.
 void setAuthenticationService(AuthenticationService service)
          Set the AuthenticationService instance.
 void setIdleTimeout(long timeout)
          Set the Idle Timeout value.
 void setRepoRemote(RepoRemote remote)
          Set the RepoRemote instance.
 void shutDown()
          Shutdown the Runnable cleanly.
 java.lang.String writeFile(java.lang.String ticket, org.alfresco.service.cmr.repository.NodeRef base, java.lang.String path)
          Write to an already existing file.
 void writeOutput(java.lang.String ticket, java.lang.String handle, byte[] buff, int count)
          Write a portion of a block of bytes over the wire.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RepoRemoteTransportService

public RepoRemoteTransportService()
Default constructor.

Method Detail

setIdleTimeout

public void setIdleTimeout(long timeout)
Set the Idle Timeout value.

Parameters:
timeout - The value to set.

setRepoRemote

public void setRepoRemote(RepoRemote remote)
Set the RepoRemote instance.


setAuthenticationService

public void setAuthenticationService(AuthenticationService service)
Set the AuthenticationService instance.


init

public void init()
The init method. This fires up a thread to check for closable streams.


run

public void run()
The body of this Runnable.

Specified by:
run in interface java.lang.Runnable

shutDown

public void shutDown()
Shutdown the Runnable cleanly.


closeInputHandle

public void closeInputHandle(java.lang.String ticket,
                             java.lang.String handle)
Description copied from interface: RepoRemoteTransport
Close a remote InputStream.

Specified by:
closeInputHandle in interface RepoRemoteTransport
Parameters:
ticket - The authentication ticket.
handle - The handle.

closeOutputHandle

public void closeOutputHandle(java.lang.String ticket,
                              java.lang.String handle)
Description copied from interface: RepoRemoteTransport
Close a remote OutputStream.

Specified by:
closeOutputHandle in interface RepoRemoteTransport
Parameters:
ticket - The authentication ticket.
handle - The handle.

createDirectory

public org.alfresco.service.cmr.repository.NodeRef createDirectory(java.lang.String ticket,
                                                                   org.alfresco.service.cmr.repository.NodeRef base,
                                                                   java.lang.String path)
Description copied from interface: RepoRemoteTransport
Create a new directory.

Specified by:
createDirectory in interface RepoRemoteTransport
base - The base node ref.
path - The relative path.
Returns:
The node ref to the newly created directory.

createFile

public java.lang.String createFile(java.lang.String ticket,
                                   org.alfresco.service.cmr.repository.NodeRef base,
                                   java.lang.String path)
Description copied from interface: RepoRemoteTransport
Create a file relative to a base node.

Specified by:
createFile in interface RepoRemoteTransport
base - The base node ref.
path - The relative path.
Returns:
A handle.

getListing

public java.util.Map getListing(java.lang.String ticket,
                                org.alfresco.service.cmr.repository.NodeRef dir)
Description copied from interface: RepoRemoteTransport
Get a listing of a directory.

Specified by:
getListing in interface RepoRemoteTransport
dir - The node ref of the directory.
Returns:
A Map of names to node refs.

getRoot

public org.alfresco.service.cmr.repository.NodeRef getRoot(java.lang.String ticket)
Description copied from interface: RepoRemoteTransport
Get the root node of the SpacesStore repo.

Specified by:
getRoot in interface RepoRemoteTransport
Returns:
The root node ref.

lookup

public org.alfresco.util.Pair lookup(java.lang.String ticket,
                                     org.alfresco.service.cmr.repository.NodeRef base,
                                     java.lang.String path)
Description copied from interface: RepoRemoteTransport
Lookup a node by path relative to a node.

Specified by:
lookup in interface RepoRemoteTransport
base - The base node ref.
path - The relative path.
Returns:
The node ref or null.

readFile

public java.lang.String readFile(java.lang.String ticket,
                                 org.alfresco.service.cmr.repository.NodeRef base,
                                 java.lang.String path)
Description copied from interface: RepoRemoteTransport
Read a file from a relative path.

Specified by:
readFile in interface RepoRemoteTransport
base - The base node ref.
path - The relative path to the file.
Returns:
A handle.

readFile

public java.lang.String readFile(java.lang.String ticket,
                                 org.alfresco.service.cmr.repository.NodeRef fileRef)
Description copied from interface: RepoRemoteTransport
Read a file directly.

Specified by:
readFile in interface RepoRemoteTransport
fileRef - The node ref of the file.
Returns:
A handle.

readInput

public byte[] readInput(java.lang.String ticket,
                        java.lang.String handle,
                        int count)
Description copied from interface: RepoRemoteTransport
Read a block of bytes over the wire.

Specified by:
readInput in interface RepoRemoteTransport
Parameters:
ticket - The authentication ticket.
handle - The remote handle.
count - The number of bytes to try to read.
Returns:
A buffer of the bytes read. Length is 0 at EOF.

removeNode

public void removeNode(java.lang.String ticket,
                       org.alfresco.service.cmr.repository.NodeRef base,
                       java.lang.String path)
Description copied from interface: RepoRemoteTransport
Remove a node via a relative path.

Specified by:
removeNode in interface RepoRemoteTransport
base - The base node ref.
path - The relative path.

removeNode

public void removeNode(java.lang.String ticket,
                       org.alfresco.service.cmr.repository.NodeRef toRemove)
Description copied from interface: RepoRemoteTransport
Remove a node directly.

Specified by:
removeNode in interface RepoRemoteTransport
toRemove - The node ref to remove.

rename

public void rename(java.lang.String ticket,
                   org.alfresco.service.cmr.repository.NodeRef base,
                   java.lang.String src,
                   java.lang.String dst)
Description copied from interface: RepoRemoteTransport
Rename a node

Specified by:
rename in interface RepoRemoteTransport
base - The base node ref.
src - The relative source path.
dst - The relative target path.

writeFile

public java.lang.String writeFile(java.lang.String ticket,
                                  org.alfresco.service.cmr.repository.NodeRef base,
                                  java.lang.String path)
Description copied from interface: RepoRemoteTransport
Write to an already existing file.

Specified by:
writeFile in interface RepoRemoteTransport
base - The base node ref.
path - The relative path.
Returns:
A handle.

writeOutput

public void writeOutput(java.lang.String ticket,
                        java.lang.String handle,
                        byte[] buff,
                        int count)
Description copied from interface: RepoRemoteTransport
Write a portion of a block of bytes over the wire.

Specified by:
writeOutput in interface RepoRemoteTransport
Parameters:
ticket - The authentication ticket.
handle - The remote handle.
buff - The buffer with data.
count - The number of bytes to write.


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