public abstract class Archive
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
CHANGEDBY_PROPERTY |
protected static java.lang.String |
CONFIGS |
protected byte[] |
data
The byte data of the archive file.
|
static java.lang.String |
DESCRIPTION_DEFAULT_PROPERTY |
static java.lang.String |
ENV_SETTINGS_STORE |
static java.lang.String |
ENVIRONMENT_MANIFEST_FILE |
protected static java.util.List<java.lang.String> |
environmentStoreTypes |
static java.lang.String |
ID_DEFAULT_PROPERTY |
static java.lang.String |
MANIFEST_DIR |
static java.lang.String |
MANIFEST_FILE |
static java.lang.String |
NAME_DEFAULT_PROPERTY |
static java.lang.String |
POLICY_MANIFEST_FILE |
protected static java.util.List<java.lang.String> |
policyStoreTypes |
protected java.util.Map<java.lang.String,java.lang.String> |
rootProperties
Name-value property pairs
|
static java.lang.String |
TIMESTAMP_DEFAULT_PROPERTY |
static java.lang.String |
VERSION_DEFAULT_PROPERTY |
static java.lang.String |
VERSIONCOMMENT_DEFAULT_PROPERTY |
Constructor and Description |
---|
Archive() |
Modifier and Type | Method and Description |
---|---|
protected void |
addBytesToArchive(java.lang.String jarEntryfilename,
byte[] bytes,
java.util.jar.JarOutputStream jarOs)
Add byte content to archive.
|
protected void |
addEntityStoreFilesFromDirToArchive(java.io.File entityStoreDir,
boolean includePolicy,
boolean includeEnvironment,
java.util.jar.JarOutputStream jarOs)
Add entity store files (e.g.
|
protected void |
addEntityStoreFilesFromDirToArchive(java.io.File entityStoreDir,
boolean includePolicy,
boolean includeEnvironment,
java.util.jar.JarOutputStream jarOs,
java.util.List<java.lang.String> excludedStores)
Add entity store files (e.g.
|
protected void |
addEntityStoreFilesToArchive(java.util.Map<java.lang.String,byte[]> dirContents,
boolean includePolicy,
boolean includeEnvironment,
java.util.jar.JarOutputStream jarOs)
Add entity store files (e.g.
|
protected void |
addEntityStoreFilesToArchive(java.util.Map<java.lang.String,byte[]> dirContents,
boolean includePolicy,
boolean includeEnvironment,
java.util.jar.JarOutputStream jarOs,
java.util.List<java.lang.String> excludedStores)
Add entity store files (e.g.
|
protected void |
addFileToArchive(java.lang.String jarEntryfilename,
java.io.File sourceFile,
java.util.jar.JarOutputStream jarOs)
Add a file to the archive.
|
protected void |
addManifestToArchive(java.lang.String jarEntryfilename,
java.util.jar.Manifest manifest,
java.util.jar.JarOutputStream jarOs)
Add manifest to archive.
|
protected void |
addStoreMD5(java.lang.String url,
byte[] unzippedStoreData,
java.util.jar.JarOutputStream jarOs)
Add MD5 for a store to the archive.
|
protected void |
copyManifestToProperties(java.util.jar.Manifest manifest,
java.util.Map<java.lang.String,java.lang.String> properties)
Copy manifest contents to property map.
|
protected void |
copyRootPropertiesAndSetNewDefaultProps(java.util.Map<java.lang.String,java.lang.String> toCopyProperties)
Copy a set of properties to the archive's root properties without
overwriting any existing root properties.
|
static java.util.jar.Manifest |
createNewManifest(java.util.Map<java.lang.String,java.lang.String> properties)
Create a new manifest from a map of properties
|
java.io.File |
extractContentToDir(java.io.File destinationDir)
Extract the content of the archive to a directory on disk
|
java.io.File |
extractContentToDir(java.io.File destinationDir,
boolean preserveDirStructure)
Extract the content of the archive to a directory on disk
|
java.io.File |
extractContentToDir(java.lang.String destinationDirname)
Extract the content of the archive to a directory on disk.
|
protected java.util.Map<java.lang.String,java.lang.String> |
generateRootProperties()
Generate new root properties, i.e.
|
protected java.io.File |
getConfigurationAssemblyFile(java.io.File destinationDir,
boolean preserveDirStructure)
Get the configs.xml file in a directory.
|
byte[] |
getData()
Get the byte data of the archive file.
|
static java.util.Collection<java.lang.String> |
getDefaultProperties()
Get a list of the default system properties names.
|
static java.util.Map<java.lang.String,java.lang.String> |
getDefaultProperties(java.lang.String name,
java.lang.String description,
java.lang.String version,
java.lang.String versionComment)
Get a map of default system archive manifest properties populated
with values passed into this method.
|
protected java.util.Map<java.lang.String,byte[]> |
getDirectoryContentsFromArchive(java.lang.String dirname)
Get the directory contents from the archive.
|
static java.util.Map<java.lang.String,java.lang.String> |
getEmptyDefaultProperties()
Get a map of default system archive manifest properties with no values set.
|
com.vordel.es.fed.FederatedEntityStore |
getEntityStore()
Get an in-memory entity store for federated entity store data held in archive.
|
protected byte[] |
getFileContentsFromArchive(java.lang.String filename)
Get file contents from the archive.
|
abstract java.lang.String |
getFileExtension()
Get the file extension for the archive, i.e.
|
java.lang.String |
getId()
Get the archive id.
|
protected java.util.jar.Manifest |
getManifestFromArchive(java.lang.String manifestFilename)
Get a manifest from the archive.
|
protected com.vordel.es.fed.assembly.StoreManager |
getMergedStoreManager(com.vordel.es.fed.assembly.StoreManager policyStoreManager,
com.vordel.es.fed.assembly.StoreManager environmentStoreManager)
Used when construct a DeploymentArchive from a PolicyArchive and an
EnvironmentArchive to create a merged StoreManager, i.e.
|
static java.util.Collection<java.lang.String> |
getReadOnlyProperties()
Get a list of read-only archive manifest properties, i.e.
|
protected java.util.jar.Manifest |
getRootManifestFromArchive()
Get the root manifest file from the archive.
|
java.util.Map<java.lang.String,java.lang.String> |
getRootProperties()
Get the archive root manifest properties.
|
static boolean |
isReadOnlyProperty(java.lang.String name)
Check if a manifest property is read-only or not.
|
protected byte[] |
loadArchiveDataFromFile(java.io.File archiveFile)
Load archive data from File.
|
protected byte[] |
loadArchiveDataFromStream(java.io.InputStream is)
Load archive data from stream.
|
protected java.util.jar.Manifest |
loadEnvironmentManifestFromDir(java.io.File sourceDir)
Load manifest-environment.mf contents from a directory into a Manifest object.
|
protected java.util.jar.Manifest |
loadPolicyManifestFromDir(java.io.File sourceDir)
Load manifest-policy.mf contents from a directory into a manifest object.
|
protected java.util.jar.Manifest |
loadRootManifestFromDir(java.io.File sourceDir)
Load root manifest.mf contents from a directory into a Manifest object.
|
protected void |
refreshArchiveData()
This function takes the in-memory data and resets the archive data.
|
protected abstract void |
refreshArchiveData(java.util.Map<java.lang.String,byte[]> idDirContents)
This function takes the in-memory data and resets the archive data.
|
void |
setData(byte[] data)
Set the byte data of the archive file.
|
void |
setRootProperties(java.util.Map<java.lang.String,java.lang.String> props)
Set the root manifest properties.
|
void |
updateRootProperties(java.util.Map<java.lang.String,java.lang.String> props)
Update the root properties and the underlying binary archive data.
|
java.io.File |
writeToArchiveFile(java.io.File output)
Write the archive to a file on disk.
|
java.io.File |
writeToArchiveFile(java.lang.String outputDirname)
Write the archive to a file on disk.
|
public static final java.lang.String NAME_DEFAULT_PROPERTY
public static final java.lang.String DESCRIPTION_DEFAULT_PROPERTY
public static final java.lang.String VERSION_DEFAULT_PROPERTY
public static final java.lang.String VERSIONCOMMENT_DEFAULT_PROPERTY
public static final java.lang.String ID_DEFAULT_PROPERTY
public static final java.lang.String TIMESTAMP_DEFAULT_PROPERTY
public static final java.lang.String CHANGEDBY_PROPERTY
protected static final java.lang.String CONFIGS
public static final java.lang.String MANIFEST_DIR
public static final java.lang.String MANIFEST_FILE
public static final java.lang.String POLICY_MANIFEST_FILE
public static final java.lang.String ENVIRONMENT_MANIFEST_FILE
public static final java.lang.String ENV_SETTINGS_STORE
protected static java.util.List<java.lang.String> policyStoreTypes
protected static java.util.List<java.lang.String> environmentStoreTypes
protected java.util.Map<java.lang.String,java.lang.String> rootProperties
protected byte[] data
public abstract java.lang.String getFileExtension()
public java.lang.String getId()
public byte[] getData()
public void setData(byte[] data)
public java.util.Map<java.lang.String,java.lang.String> getRootProperties()
public void setRootProperties(java.util.Map<java.lang.String,java.lang.String> props)
props
- public void updateRootProperties(java.util.Map<java.lang.String,java.lang.String> props) throws java.io.IOException
props
- java.io.IOException
public java.io.File writeToArchiveFile(java.lang.String outputDirname) throws java.io.IOException
outputDirname
- A file or directory name. If this is a directory the file will be named
using the archive id, e.g. dir/archive-id.fed
.java.io.IOException
public java.io.File writeToArchiveFile(java.io.File output) throws java.io.IOException
output
- A file or directory. If this is a directory the file will be named
using the archive id, e.g. dir/archive-id.fed
.java.io.IOException
public java.io.File extractContentToDir(java.lang.String destinationDirname) throws java.io.IOException
destinationDirname
- The directory to extract tojava.io.IOException
public java.io.File extractContentToDir(java.io.File destinationDir) throws java.io.IOException
destinationDir
- The directory to extract tojava.io.IOException
public java.io.File extractContentToDir(java.io.File destinationDir, boolean preserveDirStructure) throws java.io.IOException
destinationDir
- The directory to extract topreserveDirStructure
- Maintain archive directory structure when extractjava.io.IOException
public com.vordel.es.fed.FederatedEntityStore getEntityStore() throws java.io.IOException, EntityStoreException
java.io.IOException
EntityStoreException
public static java.util.jar.Manifest createNewManifest(java.util.Map<java.lang.String,java.lang.String> properties)
properties
- The propertiespublic static java.util.Collection<java.lang.String> getReadOnlyProperties()
public static boolean isReadOnlyProperty(java.lang.String name)
name
- The name of the property to checkpublic static java.util.Map<java.lang.String,java.lang.String> getDefaultProperties(java.lang.String name, java.lang.String description, java.lang.String version, java.lang.String versionComment)
name
- Value for the default Name property.description
- Value for the default Description property.version
- Value for the default Version property.versionComment
- Value for the default VersionComment property.public static java.util.Map<java.lang.String,java.lang.String> getEmptyDefaultProperties()
public static java.util.Collection<java.lang.String> getDefaultProperties()
protected void copyRootPropertiesAndSetNewDefaultProps(java.util.Map<java.lang.String,java.lang.String> toCopyProperties)
toCopyProperties
- The properties to copy into the archive's root properties.protected java.util.jar.Manifest loadRootManifestFromDir(java.io.File sourceDir) throws java.io.IOException
sourceDir
- Directory to load manifest file fromjava.io.IOException
protected java.util.jar.Manifest loadPolicyManifestFromDir(java.io.File sourceDir) throws java.io.IOException
sourceDir
- Directory to load manifest file fromjava.io.IOException
protected java.util.jar.Manifest loadEnvironmentManifestFromDir(java.io.File sourceDir) throws java.io.IOException
sourceDir
- Directory to load manifest file fromjava.io.IOException
protected java.util.Map<java.lang.String,java.lang.String> generateRootProperties()
protected com.vordel.es.fed.assembly.StoreManager getMergedStoreManager(com.vordel.es.fed.assembly.StoreManager policyStoreManager, com.vordel.es.fed.assembly.StoreManager environmentStoreManager) throws EntityStoreException
policyStoreManager
- The store manager for configs.xml from the PolicyArchiveenvironmentStoreManager
- The store manager for configs.xml from the EnvironmentArchiveEntityStoreException
protected byte[] getFileContentsFromArchive(java.lang.String filename) throws java.io.IOException
filename
- The name of the file in the archivejava.io.IOException
protected java.util.Map<java.lang.String,byte[]> getDirectoryContentsFromArchive(java.lang.String dirname) throws java.io.IOException
dirname
- The name of the directory in the archivejava.io.IOException
protected java.util.jar.Manifest getRootManifestFromArchive() throws java.io.IOException
java.io.IOException
protected java.util.jar.Manifest getManifestFromArchive(java.lang.String manifestFilename) throws java.io.IOException
manifestFilename
- The name of the manifest file.java.io.IOException
protected java.io.File getConfigurationAssemblyFile(java.io.File destinationDir, boolean preserveDirStructure) throws java.io.IOException
destinationDir
- The directory the configs.xml resides in.preserveDirStructure
- java.io.IOException
protected void copyManifestToProperties(java.util.jar.Manifest manifest, java.util.Map<java.lang.String,java.lang.String> properties)
manifest
- The manifest.properties
- The properties to copy the manifest details into.,protected byte[] loadArchiveDataFromFile(java.io.File archiveFile) throws java.io.IOException
archiveFile
- The archive file.java.io.IOException
protected byte[] loadArchiveDataFromStream(java.io.InputStream is) throws java.io.IOException
is
- The stream.java.io.IOException
protected void addEntityStoreFilesFromDirToArchive(java.io.File entityStoreDir, boolean includePolicy, boolean includeEnvironment, java.util.jar.JarOutputStream jarOs) throws java.io.IOException
entityStoreDir
- The directory that contains the entity store files.includePolicy
- Include "policy" entity store files, i.e. Primary, External Connections, and Listeners.includeEnvironment
- Include "environment" entity store files, i.e. Certificates and Users.jarOs
- The archive output streamjava.io.IOException
protected void addEntityStoreFilesFromDirToArchive(java.io.File entityStoreDir, boolean includePolicy, boolean includeEnvironment, java.util.jar.JarOutputStream jarOs, java.util.List<java.lang.String> excludedStores) throws java.io.IOException
entityStoreDir
- The directory that contains the entity store files.includePolicy
- Include "policy" entity store files, i.e. Primary, External Connections, and Listeners.includeEnvironment
- Include "environment" entity store files, i.e. Certificates and Users.jarOs
- The archive output streamexcludedStores
- Entity store types to exclude when adding to archive. Used to exclude
EnvSettingsStore.xml as this is managed differently.java.io.IOException
protected void addEntityStoreFilesToArchive(java.util.Map<java.lang.String,byte[]> dirContents, boolean includePolicy, boolean includeEnvironment, java.util.jar.JarOutputStream jarOs) throws java.io.IOException
dirContents
- The map of entity store files.includePolicy
- Include "policy" entity store files, i.e. Primary, External Connections, and Listeners.includeEnvironment
- Include "environment" entity store files, i.e. Certificates and Users.jarOs
- The archive output streamjava.io.IOException
protected void addEntityStoreFilesToArchive(java.util.Map<java.lang.String,byte[]> dirContents, boolean includePolicy, boolean includeEnvironment, java.util.jar.JarOutputStream jarOs, java.util.List<java.lang.String> excludedStores) throws java.io.IOException
dirContents
- The map of entity store files.includePolicy
- Include "policy" entity store files, i.e. Primary, External Connections, and Listeners.includeEnvironment
- Include "environment" entity store files, i.e. Certificates and Users.jarOs
- The archive output streamexcludedStores
- Entity store types to exclude when adding to archive. Used to exclude
EnvSettingsStore.xml as this is managed differently. *java.io.IOException
protected void addFileToArchive(java.lang.String jarEntryfilename, java.io.File sourceFile, java.util.jar.JarOutputStream jarOs) throws java.io.IOException
jarEntryfilename
- The name of the entry in the archivesourceFile
- The file to addjarOs
- The archive output streamjava.io.IOException
protected void addManifestToArchive(java.lang.String jarEntryfilename, java.util.jar.Manifest manifest, java.util.jar.JarOutputStream jarOs) throws java.io.IOException
jarEntryfilename
- The name of the entry in the archivemanifest
- The manifest to add.jarOs
- The archive output streamjava.io.IOException
protected void addBytesToArchive(java.lang.String jarEntryfilename, byte[] bytes, java.util.jar.JarOutputStream jarOs) throws java.io.IOException
jarEntryfilename
- The name of the entry in the archivebytes
- The bytes to add to the archive.jarOs
- The archive output streamjava.io.IOException
protected void addStoreMD5(java.lang.String url, byte[] unzippedStoreData, java.util.jar.JarOutputStream jarOs) throws java.io.IOException
url
- The url of the store fileunzippedStoreData
- The store data, not zippedjarOs
- The archive output streamjava.io.IOException
protected void refreshArchiveData() throws java.io.IOException
java.io.IOException
protected abstract void refreshArchiveData(java.util.Map<java.lang.String,byte[]> idDirContents) throws java.io.IOException
java.io.IOException
This documentation and all its contents and graphics, copyright © 1999 - 2011 Vordel