|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.dbmaintain.script.repository.ScriptLocation
org.dbmaintain.script.repository.impl.ArchiveScriptLocation
public class ArchiveScriptLocation
Script container that reads all scripts from a jar file
Field Summary |
---|
Fields inherited from class org.dbmaintain.script.repository.ScriptLocation |
---|
baseLineRevision, ignoreCarriageReturnsWhenCalculatingCheckSum, LOCATION_PROPERTIES_FILENAME, patchQualifiers, postProcessingScriptDirName, qualifierRegexp, registeredQualifiers, scriptEncoding, scriptFactory, scriptFileExtensions, scriptIndexRegexp, scriptLocationName, scripts, targetDatabaseRegexp |
Constructor Summary | |
---|---|
ArchiveScriptLocation(File jarLocation,
String defaultScriptEncoding,
String defaultPostProcessingScriptDirName,
Set<Qualifier> defaultRegisteredQualifiers,
Set<Qualifier> defaultPatchQualifiers,
String defaultScriptIndexRegexp,
String defaultQualifierRegexp,
String defaultTargetDatabaseRegexp,
Set<String> defaultScriptFileExtensions,
ScriptIndexes baseLineRevision,
boolean ignoreCarriageReturnsWhenCalculatingCheckSum)
Creates a new instance based on the contents of the given jar file |
|
ArchiveScriptLocation(SortedSet<Script> scripts,
String scriptEncoding,
String postProcessingScriptDirName,
Set<Qualifier> registeredQualifiers,
Set<Qualifier> patchQualifiers,
String scriptIndexRegexp,
String qualifierRegexp,
String targetDatabaseRegexp,
Set<String> scriptFileExtensions,
ScriptIndexes baseLineRevision,
boolean ignoreCarriageReturnsWhenCalculatingCheckSum)
Creates a new instance of the ArchiveScriptLocation , while there is no jar file available yet. |
Method Summary | |
---|---|
protected void |
assertValidScriptLocation(File jarFile)
Asserts that the script archive exists |
protected JarFile |
createJarFile(File jarFile)
|
protected Properties |
getCustomProperties(File scriptLocation)
|
protected File |
getJarFileWithoutSubPath(File jarFile)
Gets jar file with the sub-path stripped off E.g. dir/my_archive.jar! |
protected Properties |
getJarProperties()
|
protected String |
getJarSubPath(File jarFile)
Gets the optional sub path in the jar file. |
protected Reader |
getPropertiesAsFile(Properties properties)
|
protected SortedSet<Script> |
loadScripts(File scriptLocation)
Initializes the scripts from the given jar file |
protected SortedSet<Script> |
loadScriptsFromJar(JarFile jarFile,
String subPath)
|
protected String |
toQualifiersPropertyValue(Set<Qualifier> qualifiers)
|
protected void |
writeJarEntry(JarOutputStream jarOutputStream,
String name,
long timestamp,
Reader entryContentReader)
Writes the entry with the given name and content to the given JarOutputStream |
void |
writeToJarFile(File jarFile)
Creates the jar containing the scripts and stores it in the file with the given file name |
Methods inherited from class org.dbmaintain.script.repository.ScriptLocation |
---|
assertValidScriptExtensions, createQualifiers, createScript, createScriptFactory, getLocationName, getPatchQualifiers, getPostProcessingScriptDirName, getQualifierRegexp, getRegisteredQualifiers, getScriptEncoding, getScriptFileExtensions, getScripts, getTargetDatabaseRegexp, isScriptFileName, overrideValuesWithCustomConfiguration |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ArchiveScriptLocation(SortedSet<Script> scripts, String scriptEncoding, String postProcessingScriptDirName, Set<Qualifier> registeredQualifiers, Set<Qualifier> patchQualifiers, String scriptIndexRegexp, String qualifierRegexp, String targetDatabaseRegexp, Set<String> scriptFileExtensions, ScriptIndexes baseLineRevision, boolean ignoreCarriageReturnsWhenCalculatingCheckSum)
ArchiveScriptLocation
, while there is no jar file available yet.
This constructor can be used to initialize the container while the scripts are still on the file system,
and to write the jar file afterwards.
scripts
- The scripts contained in the container, not nullscriptEncoding
- Encoding used to read the contents of the script, not nullpostProcessingScriptDirName
- The directory name that contains post processing scripts, may be nullregisteredQualifiers
- the registered qualifiers, not nullpatchQualifiers
- The qualifiers that indicate that this script is a patch script, not nullscriptIndexRegexp
- The regexp that identifies the script index in the filename, not nullqualifierRegexp
- The regexp that identifies a qualifier in the filename, not nulltargetDatabaseRegexp
- The regexp that indicates the target database in the filename, not nullscriptFileExtensions
- The script file extensionsbaseLineRevision
- The baseline revision. If set, all scripts with a lower revision will be ignoredignoreCarriageReturnsWhenCalculatingCheckSum
- If true, carriage return chars will be ignored when calculating check sumspublic ArchiveScriptLocation(File jarLocation, String defaultScriptEncoding, String defaultPostProcessingScriptDirName, Set<Qualifier> defaultRegisteredQualifiers, Set<Qualifier> defaultPatchQualifiers, String defaultScriptIndexRegexp, String defaultQualifierRegexp, String defaultTargetDatabaseRegexp, Set<String> defaultScriptFileExtensions, ScriptIndexes baseLineRevision, boolean ignoreCarriageReturnsWhenCalculatingCheckSum)
jarLocation
- the jar filedefaultScriptEncoding
- the default script encodingdefaultPostProcessingScriptDirName
- the default postprocessing dir namedefaultRegisteredQualifiers
- the default registered (allowed) qualifiersdefaultPatchQualifiers
- the default patch qualifiersdefaultScriptIndexRegexp
- the default script index regexpdefaultQualifierRegexp
- the default qualifier regexpdefaultTargetDatabaseRegexp
- the default target database regexpdefaultScriptFileExtensions
- the default script file extensionsbaseLineRevision
- The baseline revision. If set, all scripts with a lower revision will be ignoredignoreCarriageReturnsWhenCalculatingCheckSum
- If true, carriage return chars will be ignored when calculating check sumsMethod Detail |
---|
protected void assertValidScriptLocation(File jarFile)
assertValidScriptLocation
in class ScriptLocation
jarFile
- The location to validate, not nullprotected SortedSet<Script> loadScripts(File scriptLocation)
loadScripts
in class ScriptLocation
protected SortedSet<Script> loadScriptsFromJar(JarFile jarFile, String subPath)
protected String toQualifiersPropertyValue(Set<Qualifier> qualifiers)
protected Properties getCustomProperties(File scriptLocation)
getCustomProperties
in class ScriptLocation
scriptLocation
- The location of the jar file, not null
protected Reader getPropertiesAsFile(Properties properties) throws IOException
properties
- A properties map
IOException
- if a problem occurs opening the readerpublic void writeToJarFile(File jarFile)
jarFile
- Path where the jar file is storedprotected Properties getJarProperties()
Properties
objectprotected void writeJarEntry(JarOutputStream jarOutputStream, String name, long timestamp, Reader entryContentReader) throws IOException
JarOutputStream
jarOutputStream
- OutputStream
to the jar filename
- Name of the jar file entrytimestamp
- Last modification date of the entryentryContentReader
- Reader giving access to the content of the jar entry
IOException
- In case of disk IO problemsprotected JarFile createJarFile(File jarFile)
protected String getJarSubPath(File jarFile)
jarFile
- The jar file, not null
protected File getJarFileWithoutSubPath(File jarFile)
jarFile
- The jar file, not null
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |