org.wso2.carbon.registry.synchronization.operation
Class UpdateCommand

java.lang.Object
  extended by org.wso2.carbon.registry.synchronization.operation.UpdateCommand

public class UpdateCommand
extends Object

This command is used to perform a update operation which will download any changes to the resources and collections from the provided registry instance into a checked out set of files and directories local filesystem.


Constructor Summary
UpdateCommand(String outputFile, String workingLocation, String userUrl, boolean isSilentUpdate, String username, boolean cleanRegistry)
          Creates an instance of a update command which can be executed against a provided registry instance.
 
Method Summary
 boolean execute(Registry registry)
          This method will execute the update command utilizing the various parameters passed when creating the instance of the command.
 boolean execute(Registry registry, UserInputCallback callback)
          This method will execute the update command utilizing the various parameters passed when creating the instance of the command.
 int getAddedCount()
          Method to obtain the count of files added.
 int getConflictedCount()
          Method to obtain the count of files conflicted.
 int getDeletedCount()
          Method to obtain the count of files deleted.
 int getNotDeletedCount()
          Method to obtain the count of files that were not deleted.
 int getUpdatedCount()
          Method to obtain the count of files updated.
 void setSilentUpdate(boolean silentUpdate)
          Method to specify that an operation is a silent update (requires user intervention or not).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UpdateCommand

public UpdateCommand(String outputFile,
                     String workingLocation,
                     String userUrl,
                     boolean isSilentUpdate,
                     String username,
                     boolean cleanRegistry)
              throws SynchronizationException
Creates an instance of a update command which can be executed against a provided registry instance.

Parameters:
outputFile - if the content is to be downloaded into a single meta file, this parameter can be used to specify the path to the meta file.
workingLocation - if the content is to be downloaded into a directory on the filesystem, this parameter can be used to specify the path to the corresponding location.
userUrl - aggregate URL containing a concatenation of the registry URL and the resource path that is capable of referencing a remote resource. This url will contain only the resource path if the resource was local to the given registry instance.
isSilentUpdate - whether this update requires user's intervention or not.
username - the name of the user (which should be a valid username on the target server on which the provided registry instance is running) that performs this operation.
cleanRegistry - whether the embedded registry instance must be cleaned after the execution of the operation.
Throws:
SynchronizationException - if the operation failed.
Method Detail

getAddedCount

public int getAddedCount()
Method to obtain the count of files added.

Returns:
the count of files added.

getUpdatedCount

public int getUpdatedCount()
Method to obtain the count of files updated.

Returns:
the count of files updated.

getConflictedCount

public int getConflictedCount()
Method to obtain the count of files conflicted.

Returns:
the count of files conflicted.

getDeletedCount

public int getDeletedCount()
Method to obtain the count of files deleted.

Returns:
the count of files deleted.

getNotDeletedCount

public int getNotDeletedCount()
Method to obtain the count of files that were not deleted.

Returns:
the count of files that were not deleted.

setSilentUpdate

public void setSilentUpdate(boolean silentUpdate)
Method to specify that an operation is a silent update (requires user intervention or not).

Parameters:
silentUpdate - whether this operation is a silent update.

execute

public boolean execute(Registry registry,
                       UserInputCallback callback)
                throws SynchronizationException
This method will execute the update command utilizing the various parameters passed when creating the instance of the command. This method accepts the users preference to whether a file or directory should be deleted on the filesystem.

Parameters:
registry - the registry instance to be used.
callback - the instance of a callback that can be used to determine the user's preference before deleting an existing file or directory during operation. If this parameter is null, the default behaviour of deleting the existing file will be used.
Returns:
whether file system updated
Throws:
SynchronizationException - if the operation failed.

execute

public boolean execute(Registry registry)
                throws SynchronizationException
This method will execute the update command utilizing the various parameters passed when creating the instance of the command.

Parameters:
registry - the registry instance to be used.
Returns:
whether file system updated
Throws:
SynchronizationException - if the operation failed.


Copyright © 2013 WSO2 Inc. All Rights Reserved.