public class DeploymentsMetadata extends Object
| Modifier and Type | Field and Description |
|---|---|
static String |
BACKUP_DIR |
static String |
CURRENT_DEPLOYMENT_FILE |
static String |
DEPLOYMENT_FILE |
static String |
EXT_BACKUP_DIR |
static String |
HASHCODES_FILE |
static String |
METADATA_DIR |
static String |
PREVIOUS_DEPLOYMENT_FILE |
| Constructor and Description |
|---|
DeploymentsMetadata(File rootDirectory)
Creates the metadata object given the root directory where the bundle deployment is installed.
|
| Modifier and Type | Method and Description |
|---|---|
FileHashcodeMap |
getCurrentDeploymentFileHashcodes()
Returns the files and their hashcodes for the current deployment.
|
DeploymentProperties |
getCurrentDeploymentProperties()
Returns information about the current deployment.
|
File |
getDeploymentBackupDirectory(int deploymentId)
Returns a metadata directory that is appropriate to place backup files for the deployment.
|
Map<String,File> |
getDeploymentExternalBackupDirectoriesForWindows(int deploymentId)
Returns all the metadata directories that contain backup files for external directories
(i.e.
|
File |
getDeploymentExternalBackupDirectory(int deploymentId)
Returns a metadata directory that is appropriate to place backup files for the deployment.
|
FileHashcodeMap |
getDeploymentFileHashcodes(int deploymentId)
Returns the files and their hashcodes for the given deployment.
|
DeploymentProperties |
getDeploymentProperties(int deploymentId)
Returns information about the deployment with the given ID.
|
String |
getExternalBackupDirectoryNameForWindows(String driveLetter)
Given a Windows drive letter, this will return the name of the external backup directory
where all backups for external files should be copied to.
|
File |
getMetadataDirectory() |
File |
getMetadataDirectoryOnlyIfExists()
Same as
getMetadataDirectory(), however, if the directory doesn't exist, an exception is thrown. |
DeploymentProperties |
getPreviousDeploymentProperties(int deploymentId)
Returns information about the previous deployment given a specific deployment ID.
|
File |
getRootDirectory() |
boolean |
isManaged()
If this object's
getRootDirectory() refers to a directory containing managed deployments,
this returns true. |
void |
setCurrentDeployment(DeploymentProperties deploymentProps,
FileHashcodeMap fileHashcodeMap,
boolean rememberPrevious)
Call this when you already know the properties, and files/hashcodes for the current live deployment.
|
FileHashcodeMap |
snapshotLiveDeployment(DeploymentProperties deploymentProps,
Pattern ignoreRegex,
Set<String> ignored)
Looks at the live deployment and takes a snapshot of it and stores its metadata in its appropriate
deployment metadata directory.
|
String |
toString() |
public static final String METADATA_DIR
public static final String CURRENT_DEPLOYMENT_FILE
public static final String PREVIOUS_DEPLOYMENT_FILE
public static final String DEPLOYMENT_FILE
public static final String HASHCODES_FILE
public static final String BACKUP_DIR
public static final String EXT_BACKUP_DIR
public DeploymentsMetadata(File rootDirectory)
rootDirectory - the location where the bundle deployments will go and where the metadata directory is locatedpublic File getRootDirectory()
public boolean isManaged()
getRootDirectory() refers to a directory containing managed deployments,
this returns true. If that root location is not managed, false is returned.public File getMetadataDirectory()
public File getMetadataDirectoryOnlyIfExists() throws Exception
getMetadataDirectory(), however, if the directory doesn't exist, an exception is thrown.Exception - if the directory does not existpublic DeploymentProperties getCurrentDeploymentProperties() throws Exception
Exception - if could not determine the current deploymentpublic DeploymentProperties getDeploymentProperties(int deploymentId) throws Exception
id - identifies which deployment the caller wants information onException - if could not find the deployment informationpublic DeploymentProperties getPreviousDeploymentProperties(int deploymentId) throws Exception
id - identifies which deployment whose previous deployment props are to be returnednull if there was no previous deploymentException - if could not load the previous deployment information or the given deployment ID is invalidpublic FileHashcodeMap getCurrentDeploymentFileHashcodes() throws Exception
Exceptionpublic FileHashcodeMap getDeploymentFileHashcodes(int deploymentId) throws Exception
deploymentId - the ID of the deployment whose files/hashcodes are to be returnedExceptionpublic File getDeploymentBackupDirectory(int deploymentId) throws Exception
deploymentId - the ID of the deployment whose backup directory is to be returnedExceptionpublic File getDeploymentExternalBackupDirectory(int deploymentId) throws Exception
deploymentId - the ID of the deployment whose backup directory is to be returnedExceptionpublic Map<String,File> getDeploymentExternalBackupDirectoriesForWindows(int deploymentId) throws Exception
null is returned.deploymentId - the ID of the deployment whose backup directories are to be returnedExceptionpublic String getExternalBackupDirectoryNameForWindows(String driveLetter)
external backup directory
to obtain the full path.driveLetter - public void setCurrentDeployment(DeploymentProperties deploymentProps, FileHashcodeMap fileHashcodeMap, boolean rememberPrevious) throws Exception
rememberPrevious is true, this will take the previous
deployment information and backup that data - pass false if you merely want to update
the current deployment properties without affecting anything else, specifically the backed up
previous deployment data.deploymentProps - identifies the deployment information for the live deploymentfileHashcodeMap - the files and their hashcodes of the current live deploymentrememberPrevious - if true, this will create a backup of the previous deployment dataException - if failed to write out the necessary metadata about the given live data informationpublic FileHashcodeMap snapshotLiveDeployment(DeploymentProperties deploymentProps, Pattern ignoreRegex, Set<String> ignored) throws Exception
deploymentProps - identifies the deployment information for the live dataignoreRegex - the live files/directories to ignoreignored - a set that will contain those files/directories that were ignored while scanning the deploymentException - if failed to calculate and store the metadataCopyright © 2008-2014 Red Hat, Inc.. All Rights Reserved.