lumis.portal.webfilereplication
Interface IFileReplicator

Package class diagram package IFileReplicator
All Known Implementing Classes:
AbstractFileReplicator, FTPFileReplicator, LocalFileReplicator

public interface IFileReplicator

Performs a file replication, updating a destination according changes in the portal file system.

The life cycle of the file replicator is:

  1. The IFileReplicator implementation is instantiated using its no-args constructor.
  2. The method setWebFileReplication(WebFileReplication) is called providing informations about the replication to be done.
  3. The initialize() method is called.
  4. Multiple calls to write(PortalFile) or delete(PortalFile) methods may occur.
  5. The method dispose() is called. This method will be called even if a write(PortalFile) or delete(PortalFile) operation resulted in a exception.

Consider using AbstractFileReplicator as a base class when implementing a IFileReplicator, for easiness and better future compatibility.

Since:
6.0.0

Method Summary
 void delete(PortalFile file)
          Removes a file or directory from the replication destination.
 void dispose()
          Allows the replicator to complete pending operation and free any used resources.
 void initialize()
          Initializes this file replicator.
 void setWebFileReplication(WebFileReplication replication)
          Provides replication information.
 void write(PortalFile file)
          Writes a file or directory on the replication destination.
 

Method Detail

setWebFileReplication

void setWebFileReplication(WebFileReplication replication)
Provides replication information.

Parameters:
replication - the WebFileReplication that contains information about the next replication to be processed.
Since:
6.0.0

initialize

void initialize()
                throws FileReplicationException
Initializes this file replicator.

Throws:
FileReplicationException - if a problem prevents the file replication to be done.
Since:
6.0.0

write

void write(PortalFile file)
           throws FileReplicationException
Writes a file or directory on the replication destination.

If the given file is a directory, this operation must create the corresponding directory in the destination if it does not already exist.

If the given file is a normal file, this operation must create the corresponding file in the destination, with the same contents, overwriting the file if it already exists.

This operation must create any non-existant parent directories necessary for creating the corresponding directory/file in the destination.

This write operation need not to be completed when this method returns, but it must be completed before the next call to dispose() returns.

Parameters:
file - the corresponding file in the portal file system.
Throws:
FileReplicationException - if a problem prevents the file replication to be done.
Since:
6.0.0

delete

void delete(PortalFile file)
            throws FileReplicationException
Removes a file or directory from the replication destination.

If the given file is a directory and it is not empty at the destination, this operation should fail throwing FileReplicationException.

If the corresponding file in the destination does not exist, this operation must be a no-op and complete gracefully.

This delete operation need not to be completed when this method returns, but it must be completed before the next call to dispose() returns.

Parameters:
file - the corresponding file in the portal file system.
Throws:
FileReplicationException - if a problem prevents the file replication to be done.
Since:
6.0.0

dispose

void dispose()
             throws FileReplicationException
Allows the replicator to complete pending operation and free any used resources.

After this method is called, the replicator will not be used anymore, unless it is reinitialized.

Throws:
FileReplicationException - if a problem prevents pending file replications to be done. Even if this exception is thrown, the replicator must free any allocated resource.
Since:
6.0.0


Lumisportal  6.2.0.120405 - Copyright © 2006–2012 Lumis EIP Tecnologia da Informação LTDA. All Rights Reserved.