nl.toolforge.karma.core.manifest
Class AbstractManifest

java.lang.Object
  extended bynl.toolforge.karma.core.manifest.AbstractManifest
All Implemented Interfaces:
Manifest
Direct Known Subclasses:
DevelopmentManifest, ReleaseManifest

public abstract class AbstractManifest
extends java.lang.Object
implements Manifest

General stuff for a manifest.

Check the package documentation for more information on the concepts behind Karma.

Version:
$Id: AbstractManifest.java,v 1.38 2004/11/10 23:53:09 asmedes Exp $
Author:
D.A. Smedes

Field Summary
 
Fields inherited from interface nl.toolforge.karma.core.manifest.Manifest
DEVELOPMENT_MANIFEST, HISTORY_KEY, RELEASE_MANIFEST
 
Constructor Summary
AbstractManifest(WorkingContext workingContext, ManifestStructure structure)
          A manifest is created based on its ManifestStructure, which can be loaded by the ManifestLoader.
AbstractManifest(WorkingContext workingContext, java.lang.String name)
          Constructs a manifest instance; name is mandatory.
 
Method Summary
protected abstract  void applyWorkingContext(WorkingContext context, Module module)
          A specific Manifest implementation may have to apply specific actions to modules per working context.
 boolean equals(java.lang.Object o)
          A manifest is equal to another manifest if their names are equal.
 java.util.Map getAllModules()
          Gets all modules defined in this manifest including all modules for all child manifests.
 java.io.File getBaseDirectory()
          The base location of the manifest within the current working context.
 java.io.File getBuildBaseDirectory()
          The build default child directory of the getBaseDirectory().
 java.lang.String getDescription()
           
 java.util.Collection getIncludes()
          Retrieves all included manifests.
 java.util.Map getInterdependencies()
          Calculates interdepencies between modules in the manifest; interdependencies are inverse relationships between a module and other modules (being SourceModule instances).
 Module getModule(java.lang.String moduleName)
           
 java.io.File getModuleBaseDirectory()
          The modules default child directory of the getBaseDirectory().
 java.util.Collection getModuleInterdependencies(Module module)
           
 java.util.Map getModulesForManifest()
          Gets all modules defined in this manifest (excluding includedManifests).
 java.lang.String getName()
          Gets a manifests' name (the <name>-attribute) from the manifest XML file.
 java.io.File getReportsBaseDirectory()
          The reports default child directory of the getBaseDirectory().
 Module.State getState(Module module)
           
 java.io.File getTempDirectory()
          The base location of a temp directory the manifest within the current working context.
abstract  java.lang.String getType()
           
 java.lang.String getVersion()
          Gets a manifests' version (the <version>-attribute) from the manifest XML file.
 int hashCode()
           
 boolean isLocal()
           
 boolean isLocal(Module module)
           
 void save()
          Saves the manifest to disk, including all its included manifests.
 void setDescription(java.lang.String description)
           
 void setState(Module module, Module.State state)
          Sets a modules' state when the module is locally available.
 void setVersion(java.lang.String version)
          Sets the manifests' version.
 int size()
          Counts all modules for a manifest, also counting all modules of all included manifests.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AbstractManifest

public AbstractManifest(WorkingContext workingContext,
                        java.lang.String name)
                 throws ManifestException,
                        LocationException
Constructs a manifest instance; name is mandatory.


AbstractManifest

public AbstractManifest(WorkingContext workingContext,
                        ManifestStructure structure)
                 throws LocationException
A manifest is created based on its ManifestStructure, which can be loaded by the ManifestLoader. The ManifestStructure is the basis for the Manifest; a number of checks are applied to it, including a linking of the manifest to the WorkingContext.

Parameters:
workingContext - The current working context.
structure - The ManifestStructure, which is the basis for the manifest.
Method Detail

applyWorkingContext

protected abstract void applyWorkingContext(WorkingContext context,
                                            Module module)
A specific Manifest implementation may have to apply specific actions to modules per working context. Each implementation should therefor implement this method and do what it has to do.

Parameters:
context - The current WorkingContext.
module - The module to which context should be applied.

getBaseDirectory

public final java.io.File getBaseDirectory()
Description copied from interface: Manifest
The base location of the manifest within the current working context. This location is used extensively by Karma as the base directory to checkout projects and build modules.

Specified by:
getBaseDirectory in interface Manifest
Returns:
A File reference to the manifest base directory.

getBuildBaseDirectory

public java.io.File getBuildBaseDirectory()
Description copied from interface: Manifest
The build default child directory of the Manifest.getBaseDirectory(). This location stores a manifests' build output.

Specified by:
getBuildBaseDirectory in interface Manifest
Returns:
The build default child directory of the Manifest.getBaseDirectory().

getReportsBaseDirectory

public java.io.File getReportsBaseDirectory()
Description copied from interface: Manifest
The reports default child directory of the Manifest.getBaseDirectory(). This location stores the output of commands that generate reports.

Specified by:
getReportsBaseDirectory in interface Manifest
Returns:
The reports default child directory of the Manifest.getBaseDirectory().

getModuleBaseDirectory

public java.io.File getModuleBaseDirectory()
Description copied from interface: Manifest
The modules default child directory of the Manifest.getBaseDirectory(). This location stores a manifests' modules.

Specified by:
getModuleBaseDirectory in interface Manifest
Returns:
The modules default child directory of the Manifest.getBaseDirectory().

getTempDirectory

public final java.io.File getTempDirectory()
Description copied from interface: Manifest
The base location of a temp directory the manifest within the current working context. This location is used extensively by Karma as a temporary location and should not be removed for as long as the manifest has a presence on disk.

Specified by:
getTempDirectory in interface Manifest
Returns:
A File reference to the Manifest.getBaseDirectory() + "/tmp"

getName

public final java.lang.String getName()
Gets a manifests' name (the <name>-attribute) from the manifest XML file.

Specified by:
getName in interface Manifest
Returns:
The manifests' name.
See Also:
for the time being

getType

public abstract java.lang.String getType()
Specified by:
getType in interface Manifest

getVersion

public final java.lang.String getVersion()
Gets a manifests' version (the <version>-attribute) from the manifest XML file.

Specified by:
getVersion in interface Manifest
Returns:
The manifests' version.
See Also:
for the time being

setVersion

public final void setVersion(java.lang.String version)
Sets the manifests' version. This method is called by Digester while parsing the manifest XML file.

Parameters:
version - The manifests' version (<version>-attribute); may be null.

getDescription

public final java.lang.String getDescription()

setDescription

public final void setDescription(java.lang.String description)

getModulesForManifest

public final java.util.Map getModulesForManifest()
Gets all modules defined in this manifest (excluding includedManifests).

Returns:
A Map with Module instances.
See Also:
getAllModules()

getAllModules

public final java.util.Map getAllModules()
Gets all modules defined in this manifest including all modules for all child manifests.

Specified by:
getAllModules in interface Manifest
Returns:
A Map with Module instances.
See Also:
getModulesForManifest()

size

public final int size()
Counts all modules for a manifest, also counting all modules of all included manifests. This method thus counts all child manifests as well.

Returns:
The total number of modules in this manifest (inlcuding all included manifests).

getModule

public final Module getModule(java.lang.String moduleName)
                       throws ManifestException
Specified by:
getModule in interface Manifest
Parameters:
moduleName -
Returns:
Throws:
ManifestException
See Also:
for the time being

isLocal

public final boolean isLocal()

isLocal

public final boolean isLocal(Module module)
Specified by:
isLocal in interface Manifest

getIncludes

public final java.util.Collection getIncludes()
Retrieves all included manifests.

Specified by:
getIncludes in interface Manifest
Returns:
A Collection of AbstractManifest instances, or an empty collection if no included manifests are available.

save

public void save()
          throws ManifestException
Saves the manifest to disk, including all its included manifests.

Throws:
ManifestException

equals

public final boolean equals(java.lang.Object o)
A manifest is equal to another manifest if their names are equal.

Parameters:
o - A AbstractManifest instance.

hashCode

public int hashCode()

getModuleInterdependencies

public final java.util.Collection getModuleInterdependencies(Module module)
                                                      throws ManifestException
Specified by:
getModuleInterdependencies in interface Manifest
Parameters:
module -
Returns:
Interdependencies for module or an empty Collection.
Throws:
ManifestException
See Also:
for the time being

getInterdependencies

public final java.util.Map getInterdependencies()
                                         throws ManifestException

Calculates interdepencies between modules in the manifest; interdependencies are inverse relationships between a module and other modules (being SourceModule instances).

If a module B has a dependency on module A, then this method will return a map, with a key A and its value a Collection of interdependencies (in this case, B).

Specified by:
getInterdependencies in interface Manifest
Returns:
Throws:
ManifestException
See Also:
for the time being

setState

public final void setState(Module module,
                           Module.State state)
Sets a modules' state when the module is locally available.

Specified by:
setState in interface Manifest
Parameters:
module -
state -

getState

public final Module.State getState(Module module)
Specified by:
getState in interface Manifest

toString

public final java.lang.String toString()


Copyright © 2002-2004 Toolforge. All Rights Reserved.