nl.toolforge.karma.core.module
Class BaseModule

java.lang.Object
  extended bynl.toolforge.karma.core.module.BaseModule
All Implemented Interfaces:
Module
Direct Known Subclasses:
JavaEnterpriseApplicationModule, JavaWebApplicationModule, LibModule, LocationStore.LocationModule, ManifestStore.ManifestModule, OtherModule, SourceModule, UntypedModule

public abstract class BaseModule
extends java.lang.Object
implements Module

The name says it all. This class is the base (template) for a module.

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

Nested Class Summary
 
Nested classes inherited from class nl.toolforge.karma.core.module.Module
Module.State, Module.Type
 
Field Summary
protected static org.apache.commons.logging.Log logger
           
 
Fields inherited from interface nl.toolforge.karma.core.module.Module
DYNAMIC, JAVA_ENTERPRISE_APPLICATION, JAVA_SOURCE_MODULE, JAVA_WEB_APPLICATION, LIBRARY_MODULE, MODULE_DESCRIPTOR, OTHER_MODULE, STATIC, UNKNOWN, WORKING
 
Constructor Summary
BaseModule(java.lang.String name, Location location)
           
BaseModule(java.lang.String name, Location location, Version version)
           
 
Method Summary
 void createRemote(Authenticator authenticator, java.lang.String createComment)
           
 boolean equals(java.lang.Object obj)
           
 java.io.File getBaseDir()
          The base directory of the module relative to the active manifest.
 java.util.Set getDependencies()
          See Module.getDependencies().
abstract  ModuleLayoutTemplate getLayoutTemplate()
          Returns the correct layout template for the module.
 Location getLocation()
          Gets the modules' location.
 java.lang.String getName()
          Gets the modules' name.
 DevelopmentLine getPatchLine()
          Returns the PatchLine for this module, if the module matches the correct criteria as specified in markPatchLine(boolean).
 Module.Type getType()
          Reads module-descriptor.xml-file from the module base directory.
 Version getVersion()
          If a module has a <version>-attribute, this method returns a Version instance representing the version number of the module.
 java.lang.String getVersionAsString()
          If the module element in the manifest contains a version attribute, this method will return the value of that attribute.
 boolean hasDevelopmentLine()
          Future functionality.
 int hashCode()
           
 boolean hasPatchLine()
          Checks if this module has been patched (and is thus part of a ReleaseManifest).
 boolean hasVersion()
          Checks if a module has a <version>-attribute.
 void markDevelopmentLine(boolean mark)
          Marks this modules as being developed in a DevelopmentLine.
 void markPatchLine(boolean mark)
          Marks this module as being developed in a PatchLine.
 void setBaseDir(java.io.File baseDir)
          When initialized by AbstractManifest, a module is assigned its base directory, relative to the manifest.
 java.lang.String toString()
          Returns the module name.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

logger

protected static org.apache.commons.logging.Log logger
Constructor Detail

BaseModule

public BaseModule(java.lang.String name,
                  Location location,
                  Version version)

BaseModule

public BaseModule(java.lang.String name,
                  Location location)
Method Detail

getName

public final java.lang.String getName()
Gets the modules' name.

Specified by:
getName in interface Module
Returns:
The modules' name.
See Also:
Module.getName()

getLocation

public final Location getLocation()
Gets the modules' location.

Specified by:
getLocation in interface Module
Returns:
See Location, and all implementing classes.

equals

public boolean equals(java.lang.Object obj)

hashCode

public int hashCode()

hasDevelopmentLine

public final boolean hasDevelopmentLine()
Future functionality. Not yet supported. Returns false.

Specified by:
hasDevelopmentLine in interface Module
Returns:
false.

markDevelopmentLine

public final void markDevelopmentLine(boolean mark)
Description copied from interface: Module
Marks this modules as being developed in a DevelopmentLine. This feature is NOT supported as yet.

Specified by:
markDevelopmentLine in interface Module

getPatchLine

public final DevelopmentLine getPatchLine()
Description copied from interface: Module
Returns the PatchLine for this module, if the module matches the correct criteria as specified in Module.markPatchLine(boolean).

Specified by:
getPatchLine in interface Module
Returns:
null if a PatchLine does not exist for this module, otherwise the PatchLine instance for this module.
See Also:
Module.markPatchLine(boolean)

markPatchLine

public final void markPatchLine(boolean mark)
Description copied from interface: Module
Marks this module as being developed in a PatchLine. This can only happen when the manifest in which the module is used is a ReleaseManifest and the module has a STATIC state. When the manifest is loaded, this method will be called when the module matches the criteria.

Specified by:
markPatchLine in interface Module

getVersion

public final Version getVersion()
Description copied from interface: Module
If a module has a <version>-attribute, this method returns a Version instance representing the version number of the module.

Specified by:
getVersion in interface Module
Returns:
The version of the module if it has one.

getVersionAsString

public final java.lang.String getVersionAsString()
If the module element in the manifest contains a version attribute, this method will return the value of that attribute.

Specified by:
getVersionAsString in interface Module
Returns:
The module version, or N/A, when no version number exists.

hasVersion

public final boolean hasVersion()
Description copied from interface: Module
Checks if a module has a <version>-attribute.

Specified by:
hasVersion in interface Module
Returns:
true if the module has a <version>-attribute or false if it hasn't.

hasPatchLine

public final boolean hasPatchLine()
Checks if this module has been patched (and is thus part of a ReleaseManifest).

Specified by:
hasPatchLine in interface Module
Returns:
true when this module has a PatchLine attached to it, false if it hasn't.

setBaseDir

public final void setBaseDir(java.io.File baseDir)
When initialized by AbstractManifest, a module is assigned its base directory, relative to the manifest. The base directory is used internally for base-directory-aware methods.

Specified by:
setBaseDir in interface Module
Parameters:
baseDir -

getBaseDir

public final java.io.File getBaseDir()
Description copied from interface: Module
The base directory of the module relative to the active manifest.

Specified by:
getBaseDir in interface Module
Returns:
The base directory of the module relative to the active manifest.

getLayoutTemplate

public abstract ModuleLayoutTemplate getLayoutTemplate()
Description copied from interface: Module
Returns the correct layout template for the module.

Specified by:
getLayoutTemplate in interface Module
Returns:
A ModuleLayoutTemplate for the specific module type.

createRemote

public final void createRemote(Authenticator authenticator,
                               java.lang.String createComment)
                        throws AuthenticationException,
                               VersionControlException
Specified by:
createRemote in interface Module
Parameters:
createComment -
Throws:
VersionControlException
AuthenticationException

getType

public final Module.Type getType()
                          throws ModuleTypeException
Reads module-descriptor.xml-file from the module base directory. If the base directory does not exist, Module.UNKNOWN is returned.

Specified by:
getType in interface Module
Returns:
The module type.
Throws:
ModuleTypeException - When module-descriptor is non-existing. This is possible when the module is not locally available.

getDependencies

public final java.util.Set getDependencies()
See Module.getDependencies(). This implementation throws a KarmaRuntimeException when the modules' dependencies.xml could not be parsed properly. When no dependencies have been specified, or when the file does not exist, the method returns an empty Set.

Specified by:
getDependencies in interface Module
Returns:
A Set containing ModuleDependency instances.

toString

public java.lang.String toString()
Returns the module name.

Returns:


Copyright © 2002-2004 Toolforge. All Rights Reserved.