Node Director
|
Implements basic packaging functions for Director's native package format. More...
Public Member Functions | |
DirectorPackage () | |
DirectorPackage (DBObject desc) throws DirectorException | |
Init package object from a database entry. | |
void | close () |
Close this package object. | |
DBObject | todb () throws DirectorException |
Dump package description into a database entry of class directorApplication. | |
DBObject | topkgdb () throws DirectorException |
Dump package description into a database entry of class directorApplicationPackage. | |
void | setReleaseDir (String dir) |
Set release directory. | |
void | setRelease (String release) throws DirectorException |
Set release number. | |
void | setFreezeMode (int mode) |
Set freeze mode for next freeze(). | |
void | incrementRelease () |
increment the release number by one. | |
void | getInfo (ZipInputStream archive) throws DirectorException |
Read application info from a package file. | |
void | getInfo () throws DirectorException |
Read application info from .rel/meta/app_info.dat file this is mainly used when using "app_import" to import an application from another director environment. | |
void | getInfo (BufferedReader info) throws DirectorException |
Read application info from an anonymous app_info.dat stream. | |
String | getRelease () throws DirectorException |
return string representation of the application's release | |
boolean | haveFreeze () throws DirectorException |
return true if there is an archive containing a freeze for the current release, false otherwise. | |
void | writeInfo () throws DirectorException |
Dump application info into .rel/meta/app_info.dat. | |
void | determineFilesInRelease (OutputStream fullInfo, OutputStream list, OutputStream deleteList, String baseListName) throws DirectorException |
Determine the paths of all the files that should be included in the current release. | |
int | execScript (String nameAndArgs) |
Execute a package related script. | |
int | execMetaScript (String name) throws DirectorException |
Execute a package related script, e.g. | |
void | setReason (String reason) |
Set reason for next freeze(). | |
void | setUser (String user) |
Set freezing user for next freeze(). | |
synchronized void | freeze () throws DirectorException |
Freeze a specified application. | |
void | unpackCpio (InputStream archive, String targetDir) throws DirectorException |
void | install (InputStream packageStream) throws DirectorException |
Install a package. |
Static Public Member Functions | |
static Vector | deleteTree (Vector tree) |
Recursively delete all files listed in a Vector. | |
static void | scanRepository (RemoteJob job) throws DirectorException |
Scan a directory for director packages and send a list of found packages back to our caller. | |
static void | main (String args[]) |
Static Public Attributes | |
static final int | BASELINE = 0 |
possible freeze modes set via setFreezeMode are BASELINE, UPDATE and PATCH. | |
static final int | UPDATE = 1 |
static final int | PATCH = 2 |
Protected Member Functions | |
void | finalize () |
File | removeOnClose (File file) |
Add file to the list of files to be deleted during close(). | |
File | removeOnClose (String filename) |
Create file object for file with the specified name and add it to the list of files to be deleted during close() | |
void | fromDesc (DBObject desc) throws DirectorException |
Set package variables from a database entry. | |
String | relDir () throws DirectorException |
String | metaDir () throws DirectorException |
void | determineRelease (boolean next) throws DirectorException |
OutputStream | packCpio (final OutputStream archive) throws DirectorException |
void | setExecutable (String path) |
void | deleteRecursively (String fname, int depth) |
DirectorException | moveFiles (String source, String target, int depth) |
Move a directory tree located under 'source' to a directory 'target'. | |
synchronized void | unpackUsingArchiver (final InputStream archive, String targetDir, String command, boolean packNmove, boolean verboseList) throws DirectorException |
ZipEntry | extractMetaFiles (ZipEntry next, String prefix, ZipInputStream archive) throws IOException, DirectorException |
void | cleanUpSub (FileListComparer comparer, String dir, String prefix) throws DirectorException |
void | cleanUp (String dir, String prefix, BufferedReader fileList) throws DirectorException |
Protected Attributes | |
Process | packer = null |
StoppableThread | packerThread = null |
DirectorException | bgerror = null |
Implements basic packaging functions for Director's native package format.
Functions include creation and installation of packages.
sfi.director.application.DirectorPackage.DirectorPackage | ( | ) |
Referenced by sfi.director.application.DirectorPackage.main().
sfi.director.application.DirectorPackage.DirectorPackage | ( | DBObject | desc | ) | throws DirectorException |
Init package object from a database entry.
References sfi.director.application.DirectorPackage.fromDesc().
|
protected |
References sfi.director.application.DirectorPackage.cleanUpSub().
Referenced by sfi.director.application.DirectorPackage.install().
|
protected |
References sfi.director.util.Tools.debug(), sfi.director.application.DirectorPackage.deleteRecursively(), sfi.director.system.FileStats.DIRECTORY, sfi.director.system.FileStats.FILE, sfi.director.util.Setup.fileSeparator, sfi.director.system.FileStats.getFileType(), sfi.director.system.Files.lstat(), and sfi.director.util.Tools.sort().
Referenced by sfi.director.application.DirectorPackage.cleanUp().
void sfi.director.application.DirectorPackage.close | ( | ) |
Close this package object.
Cleans up temporary files, etc.
References sfi.director.application.DirectorPackage.deleteTree().
Referenced by sfi.director.application.DirectorPackage.finalize().
|
protected |
References sfi.director.system.FileStats.DIRECTORY, sfi.director.util.Setup.fileSeparator, sfi.director.system.FileStats.getFileType(), and sfi.director.system.Files.lstat().
Referenced by sfi.director.application.DirectorPackage.cleanUpSub(), sfi.director.application.DirectorPackage.freeze(), sfi.director.application.DirectorPackage.moveFiles(), and sfi.director.application.DirectorPackage.unpackUsingArchiver().
|
static |
Recursively delete all files listed in a Vector.
Referenced by sfi.director.application.DirectorPackage.close(), and sfi.director.application.DirectorPackage.unpackUsingArchiver().
void sfi.director.application.DirectorPackage.determineFilesInRelease | ( | OutputStream | fullInfo, |
OutputStream | list, | ||
OutputStream | deleteList, | ||
String | baseListName | ||
) | throws DirectorException |
Determine the paths of all the files that should be included in the current release.
fullInfo | stream where the full file info (including file attributes) is written to |
list | stream where the paths (one per line) are written to |
deleteList | stream where the paths of the files to be deleted in this release are written to |
baseListName | name of a file containing the full file info of a former (baseline) release this release is an incremental from. The baseListName file is a file originally written by determineFilesInRelease via the fullInfo argument. |
References sfi.director.application.DirectorPackage.BASELINE, sfi.director.util.FileListComparer.close(), sfi.director.util.FileListComparer.compareNext(), sfi.director.util.FileListComparer.getDeleted(), sfi.director.application.DirectorPackage.relDir(), and sfi.director.system.Files.stat().
Referenced by sfi.director.application.DirectorPackage.freeze().
|
protected |
int sfi.director.application.DirectorPackage.execMetaScript | ( | String | name | ) | throws DirectorException |
Execute a package related script, e.g.
a post-install script.
References sfi.director.application.DirectorPackage.execScript(), sfi.director.application.DirectorPackage.metaDir(), and sfi.director.application.DirectorPackage.setExecutable().
Referenced by sfi.director.application.DirectorPackage.freeze(), and sfi.director.application.DirectorPackage.install().
int sfi.director.application.DirectorPackage.execScript | ( | String | nameAndArgs | ) |
Execute a package related script.
ExecScript changes directory to the release/installation directory before invoking the script.
References sfi.director.util.Tools.execWait().
Referenced by sfi.director.application.DirectorPackage.execMetaScript(), and sfi.director.application.DirectorPackage.install().
|
protected |
|
protected |
References sfi.director.application.DirectorPackage.close().
synchronized void sfi.director.application.DirectorPackage.freeze | ( | ) | throws DirectorException |
Freeze a specified application.
References sfi.director.application.DirectorPackage.BASELINE, sfi.director.application.DirectorPackage.bgerror, sfi.director.application.DirectorPackage.deleteRecursively(), sfi.director.application.DirectorPackage.determineFilesInRelease(), sfi.director.application.DirectorPackage.determineRelease(), sfi.director.application.DirectorPackage.execMetaScript(), sfi.director.util.Setup.fileSeparator, sfi.director.application.DirectorPackage.getRelease(), sfi.director.util.Lock.LocalLock(), sfi.director.util.Tools.log(), sfi.director.util.Tools.makeZip(), sfi.director.application.DirectorPackage.metaDir(), sfi.director.util.Logger.NOTICE, sfi.director.application.DirectorPackage.packCpio(), sfi.director.application.DirectorPackage.packer, sfi.director.application.DirectorPackage.packerThread, sfi.director.application.DirectorPackage.relDir(), sfi.director.util.Lock.unlock(), sfi.director.util.Tools.workingWaitFor(), and sfi.director.application.DirectorPackage.writeInfo().
Referenced by sfi.director.application.DirectorPackage.main().
|
protected |
Set package variables from a database entry.
References sfi.director.application.DirectorPackage.setRelease(), and sfi.director.application.DirectorPackage.setReleaseDir().
Referenced by sfi.director.application.DirectorPackage.DirectorPackage().
void sfi.director.application.DirectorPackage.getInfo | ( | ZipInputStream | archive | ) | throws DirectorException |
Read application info from a package file.
References sfi.director.application.DirectorPackage.getInfo().
Referenced by sfi.director.application.DirectorPackage.main(), and sfi.director.application.Director3PackageHandler.pkgFromFile().
void sfi.director.application.DirectorPackage.getInfo | ( | ) | throws DirectorException |
Read application info from .rel/meta/app_info.dat file this is mainly used when using "app_import" to import an application from another director environment.
References sfi.director.application.DirectorPackage.metaDir().
Referenced by sfi.director.application.DirectorPackage.getInfo(), and sfi.director.application.DirectorPackage.install().
void sfi.director.application.DirectorPackage.getInfo | ( | BufferedReader | info | ) | throws DirectorException |
Read application info from an anonymous app_info.dat stream.
References sfi.director.application.DirectorPackage.setRelease(), and sfi.director.util.Tools.split().
String sfi.director.application.DirectorPackage.getRelease | ( | ) | throws DirectorException |
return string representation of the application's release
Referenced by sfi.director.application.DirectorPackage.freeze(), sfi.director.application.DirectorPackage.haveFreeze(), sfi.director.application.DirectorPackage.install(), sfi.director.application.DirectorPackage.todb(), sfi.director.application.DirectorPackage.topkgdb(), and sfi.director.application.DirectorPackage.writeInfo().
boolean sfi.director.application.DirectorPackage.haveFreeze | ( | ) | throws DirectorException |
return true if there is an archive containing a freeze for the current release, false otherwise.
References sfi.director.application.DirectorPackage.getRelease(), and sfi.director.application.DirectorPackage.relDir().
void sfi.director.application.DirectorPackage.incrementRelease | ( | ) |
increment the release number by one.
Depending on the contents of the update variable the respective chunk of the number will be incremented.
Referenced by sfi.director.application.DirectorPackage.determineRelease().
void sfi.director.application.DirectorPackage.install | ( | InputStream | packageStream | ) | throws DirectorException |
Install a package.
The input file must be an archive as created by the freeze() method.
References sfi.director.application.DirectorPackage.BASELINE, sfi.director.application.DirectorPackage.cleanUp(), sfi.director.util.Tools.copy(), sfi.director.util.TempFile.create(), sfi.director.util.Tools.debug(), sfi.director.util.Logger.ERR, sfi.director.application.DirectorPackage.execMetaScript(), sfi.director.application.DirectorPackage.execScript(), sfi.director.application.DirectorPackage.extractMetaFiles(), sfi.director.util.Setup.fileSeparator, sfi.director.application.DirectorPackage.getInfo(), sfi.director.application.DirectorPackage.getRelease(), sfi.director.util.Setup.hostnames, sfi.director.util.Lock.LocalLock(), sfi.director.util.Tools.log(), sfi.director.application.DirectorPackage.metaDir(), sfi.director.util.Logger.NOTICE, sfi.director.application.DirectorPackage.relDir(), sfi.director.application.DirectorPackage.setExecutable(), sfi.director.util.Tools.timeStamp(), sfi.director.util.Lock.unlock(), and sfi.director.application.DirectorPackage.unpackCpio().
Referenced by sfi.director.application.Director3PackageHandler.install(), sfi.director.application.DirectorPackage.main(), and sfi.director.cli.app_extract.run().
|
static |
References sfi.director.util.Tools.debuglev, sfi.director.application.DirectorPackage.DirectorPackage(), sfi.director.application.DirectorPackage.freeze(), sfi.director.application.DirectorPackage.getInfo(), sfi.director.application.DirectorPackage.install(), sfi.director.application.DirectorPackage.setFreezeMode(), sfi.director.application.DirectorPackage.setReleaseDir(), and sfi.director.util.Init.setup().
|
protected |
References sfi.director.util.Setup.fileSeparator, and sfi.director.application.DirectorPackage.relDir().
Referenced by sfi.director.application.DirectorPackage.execMetaScript(), sfi.director.application.DirectorPackage.extractMetaFiles(), sfi.director.application.DirectorPackage.freeze(), sfi.director.application.DirectorPackage.getInfo(), sfi.director.application.DirectorPackage.install(), and sfi.director.application.DirectorPackage.writeInfo().
|
protected |
Move a directory tree located under 'source' to a directory 'target'.
Do not throw Exceptions. Instead, try to traverse the whole tree and only then return a possible Exception as the return value.
References sfi.director.application.DirectorPackage.deleteRecursively(), sfi.director.util.Setup.fileSeparator, sfi.director.system.FileStats.isDirectory(), and sfi.director.system.Files.lstat().
Referenced by sfi.director.application.DirectorPackage.unpackUsingArchiver().
|
protected |
References sfi.director.util.Tools.attachErrorLogger(), sfi.director.application.DirectorPackage.bgerror, sfi.director.util.Tools.consume(), sfi.director.util.Tools.copyData(), sfi.director.util.Tools.exec(), sfi.director.application.DirectorPackage.packer, sfi.director.application.DirectorPackage.packerThread, and sfi.director.util.Tools.workingWaitFor().
Referenced by sfi.director.application.DirectorPackage.freeze().
|
protected |
References sfi.director.util.Setup.fileSeparator.
Referenced by sfi.director.application.DirectorPackage.determineFilesInRelease(), sfi.director.application.DirectorPackage.determineRelease(), sfi.director.application.DirectorPackage.freeze(), sfi.director.application.DirectorPackage.haveFreeze(), sfi.director.application.DirectorPackage.install(), sfi.director.application.DirectorPackage.metaDir(), and sfi.director.application.DirectorPackage.topkgdb().
|
protected |
Add file to the list of files to be deleted during close().
|
protected |
Create file object for file with the specified name and add it to the list of files to be deleted during close()
|
static |
Scan a directory for director packages and send a list of found packages back to our caller.
If job argument "freeze" is set baseline freeze any application which is not frozen yet.
References sfi.director.retriever.RemoteFile.connectSend(), sfi.director.util.Logger.ERR, sfi.director.util.Setup.fileSeparator, sfi.director.retriever.RetrieverManager.getConnection(), sfi.director.util.Tools.log(), sfi.director.util.Setup.pathSeparator, and sfi.director.util.Tools.split().
|
protected |
void sfi.director.application.DirectorPackage.setFreezeMode | ( | int | mode | ) |
Set freeze mode for next freeze().
Valid freeze modes are BASELINE, UPDATE and PATCH.
Referenced by sfi.director.application.DirectorPackage.main(), and sfi.director.application.DirectorPackage.setRelease().
void sfi.director.application.DirectorPackage.setReason | ( | String | reason | ) |
Set reason for next freeze().
void sfi.director.application.DirectorPackage.setRelease | ( | String | release | ) | throws DirectorException |
Set release number.
References sfi.director.application.DirectorPackage.BASELINE, sfi.director.application.DirectorPackage.PATCH, sfi.director.application.DirectorPackage.setFreezeMode(), sfi.director.util.Tools.split(), and sfi.director.application.DirectorPackage.UPDATE.
Referenced by sfi.director.application.DirectorPackage.determineRelease(), sfi.director.application.DirectorPackage.fromDesc(), and sfi.director.application.DirectorPackage.getInfo().
void sfi.director.application.DirectorPackage.setReleaseDir | ( | String | dir | ) |
Set release directory.
Referenced by sfi.director.application.DirectorPackage.fromDesc(), and sfi.director.application.DirectorPackage.main().
void sfi.director.application.DirectorPackage.setUser | ( | String | user | ) |
Set freezing user for next freeze().
DBObject sfi.director.application.DirectorPackage.todb | ( | ) | throws DirectorException |
Dump package description into a database entry of class directorApplication.
References sfi.director.application.DirectorPackage.getRelease(), and sfi.director.repository.DBObject.setDN().
DBObject sfi.director.application.DirectorPackage.topkgdb | ( | ) | throws DirectorException |
Dump package description into a database entry of class directorApplicationPackage.
References sfi.director.application.DirectorPackage.getRelease(), sfi.director.repository.DBObject.getValue(), sfi.director.application.DirectorPackage.relDir(), sfi.director.repository.DBObject.setDN(), and sfi.director.util.Tools.split().
Referenced by sfi.director.application.Director3PackageHandler.pkgFromFile().
void sfi.director.application.DirectorPackage.unpackCpio | ( | InputStream | archive, |
String | targetDir | ||
) | throws DirectorException |
References sfi.director.application.DirectorPackage.unpackUsingArchiver().
Referenced by sfi.director.application.DirectorPackage.install().
|
protected |
References sfi.director.util.Tools.attachErrorLogger(), sfi.director.application.DirectorPackage.bgerror, sfi.director.util.Tools.consume(), sfi.director.util.Tools.copyData(), sfi.director.application.DirectorPackage.deleteRecursively(), sfi.director.application.DirectorPackage.deleteTree(), sfi.director.util.Tools.exec(), sfi.director.util.Setup.fileSeparator, sfi.director.application.DirectorPackage.moveFiles(), sfi.director.application.DirectorPackage.packer, and sfi.director.util.Tools.workingWaitFor().
Referenced by sfi.director.application.DirectorPackage.unpackCpio().
void sfi.director.application.DirectorPackage.writeInfo | ( | ) | throws DirectorException |
Dump application info into .rel/meta/app_info.dat.
References sfi.director.retriever.RemoteFile.connectSend(), sfi.director.retriever.RetrieverManager.getConnection(), sfi.director.application.DirectorPackage.getRelease(), sfi.director.util.Tools.join(), and sfi.director.application.DirectorPackage.metaDir().
Referenced by sfi.director.application.DirectorPackage.freeze().
|
static |
possible freeze modes set via setFreezeMode are BASELINE, UPDATE and PATCH.
A release number is always a three-chunk number like 001.02.03. The BASELINE/UPDATE/PATCH constants correspond with the respective chunk's index.
Referenced by sfi.director.application.scripttask.FreezeApplication.create(), sfi.director.application.DirectorPackage.determineFilesInRelease(), sfi.director.application.DirectorPackage.determineRelease(), sfi.director.application.DirectorPackage.freeze(), sfi.director.application.DirectorPackage.install(), and sfi.director.application.DirectorPackage.setRelease().
|
protected |
|
protected |
|
protected |
|
static |
|
static |