org.rhq.core.util.updater
Class DeployDifferences

java.lang.Object
  extended by org.rhq.core.util.updater.DeployDifferences

public class DeployDifferences
extends Object

Manages information about deployment files such as which files have been added, deleted, etc. The calls to these methods don't necessarily come at a time when a file has actually been added, deleted, etc - these are only called when it has been determined that a file is going to be added, deleted, etc. In other words, don't use this as a realtime listener of events happening during a live deployment; instead, use this as a final report of what happened after a deployment has been completed.

Author:
John Mazzitelli

Constructor Summary
DeployDifferences()
           
 
Method Summary
 void addAddedFile(String path)
           
 void addAddedFiles(Collection<String> paths)
           
 void addBackedUpFile(String originalPath, String backupPath)
           
 void addChangedFile(String path)
           
 void addChangedFiles(Collection<String> paths)
           
 void addDeletedFile(String path)
           
 void addDeletedFiles(Collection<String> paths)
           
 void addError(String path, String errorMsg)
           
 void addIgnoredFile(String path)
           
 void addIgnoredFiles(Collection<String> paths)
           
 void addRealizedFile(String path, String content)
           
 void addRestoredFile(String restoredPath, String backupPath)
           
 boolean containsAddedFile(String path)
           
 boolean containsChangedFile(String path)
           
 boolean containsDeletedFile(String path)
           
 boolean containsIgnoredFile(String path)
           
 String convertPath(String path)
          Converts the path to the form that will be stored internally.
 Set<String> getAddedFiles()
          Returns the set of files that have been added.
 Map<String,String> getBackedUpFiles()
          Returns the set of files that have been backed up.
 Set<String> getChangedFiles()
          Returns the set of files that have been changed.
 Set<String> getDeletedFiles()
          Returns the set of files that have been deleted.
 Map<String,String> getErrors()
          Returns the set of files that caused an error during processing.
 Set<String> getIgnoredFiles()
          Returns the set of files that have been ignored.
 Map<String,String> getRealizedFiles()
          Returns the set of files that have been realized.
 Map<String,String> getRestoredFiles()
          Returns the set of files that have been restored from a backup copy.
 void removeAddedFile(String path)
           
 void removeChangedFile(String path)
           
 void removeDeletedFile(String path)
           
 void removeIgnoredFile(String path)
           
 void setCleaned(boolean cleaned)
           
 String toString()
           
 boolean wasCleaned()
          Returns true if the delpoyment's destination directory was wiped of all files/directories before the new deployment files were copied to it.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DeployDifferences

public DeployDifferences()
Method Detail

addIgnoredFile

public void addIgnoredFile(String path)

addIgnoredFiles

public void addIgnoredFiles(Collection<String> paths)

removeIgnoredFile

public void removeIgnoredFile(String path)

containsIgnoredFile

public boolean containsIgnoredFile(String path)

addDeletedFile

public void addDeletedFile(String path)

addDeletedFiles

public void addDeletedFiles(Collection<String> paths)

removeDeletedFile

public void removeDeletedFile(String path)

containsDeletedFile

public boolean containsDeletedFile(String path)

addAddedFile

public void addAddedFile(String path)

addAddedFiles

public void addAddedFiles(Collection<String> paths)

removeAddedFile

public void removeAddedFile(String path)

containsAddedFile

public boolean containsAddedFile(String path)

addChangedFile

public void addChangedFile(String path)

addChangedFiles

public void addChangedFiles(Collection<String> paths)

removeChangedFile

public void removeChangedFile(String path)

containsChangedFile

public boolean containsChangedFile(String path)

addBackedUpFile

public void addBackedUpFile(String originalPath,
                            String backupPath)

addRestoredFile

public void addRestoredFile(String restoredPath,
                            String backupPath)

addRealizedFile

public void addRealizedFile(String path,
                            String content)

addError

public void addError(String path,
                     String errorMsg)

setCleaned

public void setCleaned(boolean cleaned)

getIgnoredFiles

public Set<String> getIgnoredFiles()
Returns the set of files that have been ignored.

Returns:
the ignored files

getDeletedFiles

public Set<String> getDeletedFiles()
Returns the set of files that have been deleted.

Returns:
the deleted files

getAddedFiles

public Set<String> getAddedFiles()
Returns the set of files that have been added.

Returns:
the added files

getChangedFiles

public Set<String> getChangedFiles()
Returns the set of files that have been changed.

Returns:
the changed files

getBackedUpFiles

public Map<String,String> getBackedUpFiles()
Returns the set of files that have been backed up. The key is the original path of the file that was backed up; the value is the path to the backup file itself.

Returns:
the information on files that were backed up

getRestoredFiles

public Map<String,String> getRestoredFiles()
Returns the set of files that have been restored from a backup copy. The key is the restored path of the file (i.e. the location where the file now resides after being restored); the value is the path where the backup copy of the file is.

Returns:
the information on files that were restored

getRealizedFiles

public Map<String,String> getRealizedFiles()
Returns the set of files that have been realized. When a file is said to be "realized", it means the file was original a template with replacement tokens but those replacement tokens have been replaced with actual, real values. The key is the path of the file that was realized; the value is the actual content of the file after all replacement tokens have been replaced.

Returns:
the information on files that were realized

getErrors

public Map<String,String> getErrors()
Returns the set of files that caused an error during processing. The key is the path of the file that caused an error; the value is an error message to describe the error that occurred.

Returns:
the information on files that caused errors during processing

wasCleaned

public boolean wasCleaned()
Returns true if the delpoyment's destination directory was wiped of all files/directories before the new deployment files were copied to it. This means any ignored files or directories that were in the deployment's destination directory will have been deleted.

Returns:
the cleaned flag

toString

public String toString()
Overrides:
toString in class Object

convertPath

public String convertPath(String path)
Converts the path to the form that will be stored internally.

Parameters:
path - a filepath to be converted
Returns:
the converted path that is to be used to store in the internal sets.


Copyright © 2008-2012 Red Hat, Inc.. All Rights Reserved.