|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnl.toolforge.karma.core.cmd.util.DependencyHelper
Dependency management is heavily used by Karma. This helper class provides methods to resolve dependencies, check them, etc.
Field Summary | |
static java.lang.String |
MODULE_DEPENDENCIES_PROPERTIES
|
Constructor Summary | |
DependencyHelper(Manifest currentManifest)
|
Method Summary | |
void |
createModuleDependenciesFilter(Module module)
Create a properties file that contains mappings from module name to module name plus version. |
java.util.Set |
getAllDependencies(Module module,
boolean doTest,
boolean doPackage)
|
java.util.Set |
getAllLevels(Module module)
Traverses the modules' dependencies, and traverses all module dependencies as well (recursively), calculating the set of dependencies that are unique. |
java.lang.String |
getClassPath(Module module)
Returns the classpath for module , or an empty String if no dependencies exist. |
java.util.Set |
getJarDependencies(Module module,
boolean doPackage)
Gets a Set of DependencyPath s, each one identifying a jar -file. |
java.util.Set |
getModuleDependencies(Module module,
boolean doTest,
boolean doPackage)
Gets a Set of DependencyPath s, each one identifying the path to a module dependency (a
dependency of module to another Module ). |
java.util.Set |
getModuleDependencies(Module module,
boolean doTest,
boolean doPackage,
Module.Type moduleType)
Gets a Set of DependencyPath s, each one identifying the path to a module dependency (a
dependency of module to another Module ). |
java.lang.String |
getTestClassPath(Module module)
Returns the classpath for module , or an empty String if no dependencies exist. |
boolean |
hasModuleDependency(Module module,
Module dependency,
boolean doPackage)
Check whether a certain module has an other module as a dependency. |
java.lang.String |
resolveArchiveName(Module module)
Determines the correct archive name for module . |
java.lang.String |
resolveArtifactName(Module module)
Determines the correct artifact name for module . |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final java.lang.String MODULE_DEPENDENCIES_PROPERTIES
Constructor Detail |
public DependencyHelper(Manifest currentManifest)
Method Detail |
public java.lang.String getClassPath(Module module) throws ModuleTypeException, DependencyException
module
, or an empty String
if no dependencies exist.
module
- The module for which a classpath should be determined.
ModuleTypeException
DependencyException
public java.lang.String getTestClassPath(Module module) throws ModuleTypeException, DependencyException
module
, or an empty String
if no dependencies exist.
The classpath consists of:
module
- The module for which the test classpath should be determined.
ModuleTypeException
DependencyException
public java.util.Set getAllDependencies(Module module, boolean doTest, boolean doPackage) throws ModuleTypeException, DependencyException
ModuleTypeException
DependencyException
public java.util.Set getModuleDependencies(Module module, boolean doTest, boolean doPackage, Module.Type moduleType) throws ModuleTypeException, DependencyException
Set
of DependencyPath
s, each one identifying the path to a module dependency (a
dependency of module
to another Module
).
module
- The module for which a dependency-path should be determined.doTest
- Whether to include test resources for all deps.doPackage
- Whether to include only the deps that are to be packaged or all deps.moduleType
- Only return modules of the specified type. Return all types when null.
DependencyException
- When a dependency for a module is not available.
ModuleTypeException
public java.util.Set getModuleDependencies(Module module, boolean doTest, boolean doPackage) throws ModuleTypeException, DependencyException
Set
of DependencyPath
s, each one identifying the path to a module dependency (a
dependency of module
to another Module
).
module
- The module for which a dependency-path should be determined.doTest
- Whether to include test resources for all deps.doPackage
- Whether to include only the deps that are to be packaged or all deps.
DependencyException
- When a dependency for a module is not available.
ModuleTypeException
public void createModuleDependenciesFilter(Module module) throws DependencyException
The properties file is called 'module-dependencies.properties' and is stored in the build directory of the given module.
DependencyException
public boolean hasModuleDependency(Module module, Module dependency, boolean doPackage)
module
- The module for which is checked whether it has dependency
as a dependency.dependency
- The module for which to check whether it is a dependency of the current module.doPackage
- Whether to include only the deps that are to be packaged or all deps.
public java.util.Set getJarDependencies(Module module, boolean doPackage) throws DependencyException
Gets a Set
of DependencyPath
s, each one identifying a jar
-file. Jar files are looked
up Maven-style (see ModuleDependency
.
module
- The module for which jar dependencies should be determined.doPackage
- Indicate if the dependencies that are to be packaged (<package="true">
)
should be included (true
) or all dependencies should be included
(false
).
Set
containing DependencyPath
s
DependencyException
- When a jar dependency is not phsyically available on disk. A check is performed on the
existence of the jar file in either the local jar repository (WorkingContext.getLocalRepository()
) or in
the lib module that is specified as being part of the manifest.public java.lang.String resolveArtifactName(Module module) throws DependencyException
module
.
The artifact-name is determined as follows:
WORKING
, the artifact-name is
<module-name>-WORKING
.
If the state of the module is DYNAMIC
, the artifact-name is
<module-name>-<latest-versions>
.
If the state of the module is STATIC
, the artifact-name is
<module-name>-<version>
.
module
- The module for which to determine the artifact name.
DependencyException
public java.lang.String resolveArchiveName(Module module) throws ModuleTypeException, DependencyException
Determines the correct archive name for module
. The archive
name is determined as follows:
WORKING
, the archive-name is
<module-name>_WORKING.jar
.
If the state of the module is DYNAMIC
, the archive-name is
<module-name>_<latest-versions>.jar
.
If the state of the module is STATIC
, the archive-name is
<module-name>_<version>.jar
.
The extension is .war
if the module is a
webapp
-module and .ear
if the module is an
eapp
-module
module
- A SourceModule
instance.
ModuleTypeException
DependencyException
public java.util.Set getAllLevels(Module module) throws ManifestException, DependencyException
module
-
Set
containing all dependencies, all the way down to the lowest
ManifestException
DependencyException
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |