M
- The module classpublic abstract class Dependencies<M extends Module> extends Object
Container
, including its classpath of
Jars as well as other managed artifacts. With this class you can add or
remove dependencies to a Sincerity container.
Dependencies are only actually installed when
install(boolean, boolean)
is called. To access the installed
modules, see getModules()
.
To access the Jars, use getClasspaths(boolean)
. To access the
artifacts, use getArtifacts()
or getPackages()
. See also
the ArtifactManager
class.
Constructor and Description |
---|
Dependencies(File artifactsFile,
Container<M,?> container)
Parses the Ivy module descriptor, and loads the managed artifacts
database.
|
Modifier and Type | Method and Description |
---|---|
abstract boolean |
addExplicitDependency(String group,
String name,
String version,
boolean force,
boolean transitive)
Adds an explicit dependency.
|
abstract boolean |
excludeDependency(String group,
String name)
Excludes an implicit dependency.
|
abstract void |
freezeVersions()
Sets the required versions of all explicit and implicit dependencies to
the those that were last resolved.
|
ArtifactManager |
getArtifactManager()
The artifact manager.
|
Set<Artifact> |
getArtifacts()
Retrieves the artifacts based on currently installed packages.
|
abstract Set<Artifact> |
getArtifacts(boolean install,
boolean overwrite,
boolean verify)
Retrieves or installs the artifacts based on currently installed
packages.
|
String |
getClasspath(boolean includeSystem)
The classpath based on currently installed artifacts.
|
abstract List<File> |
getClasspaths(boolean includeSystem)
The classpath based on currently installed artifacts.
|
Container<M,?> |
getContainer()
The container.
|
abstract Modules<M> |
getModules()
The installed modules (explicit and implicit dependencies), based on the
last
install(boolean, boolean) . |
Packages |
getPackages()
The packages among the currently installed artifacts.
|
boolean |
hasExplicitDependency(String group,
String name)
True if the module is an explicit dependency, whatever its version.
|
abstract boolean |
hasExplicitDependency(String group,
String name,
String version)
True if the module is an explicit dependency with a particular version.
|
abstract void |
install(boolean overwrite,
boolean verify)
Installs/upgrades dependencies.
|
abstract boolean |
overrideDependency(String group,
String name,
String version)
Overrides the version of an implicit dependency.
|
protected void |
printDisclaimer(PrintWriter out)
Prints the Sincerity installation disclaimer.
|
void |
prune()
Deletes all artifacts which no longer have a dependency.
|
abstract boolean |
removeExplicitDependency(String group,
String name)
Revokes an explicit dependency.
|
abstract void |
reset()
Revokes all explicit and implicit dependencies.
|
abstract boolean |
reviseExplicitDependency(String group,
String name,
String newVersion)
Changes the version for an explicit dependency that has already been
specified.
|
void |
uninstallPackages()
Uninstalls all packages.
|
public Dependencies(File artifactsFile, Container<M,?> container) throws SincerityException
artifactsFile
- The managed artifacts database file (usually
"/configuration/sincerity/artifacts.conf")container
- The containerSincerityException
- In case of an errorpublic boolean hasExplicitDependency(String group, String name)
group
- The module's groupname
- The module's namepublic abstract boolean hasExplicitDependency(String group, String name, String version)
group
- The module's groupname
- The module's nameversion
- The module's version or nullpublic abstract Modules<M> getModules() throws SincerityException
install(boolean, boolean)
.SincerityException
- In case of an errorpublic Set<Artifact> getArtifacts() throws SincerityException
SincerityException
- In case of an errorpublic abstract Set<Artifact> getArtifacts(boolean install, boolean overwrite, boolean verify) throws SincerityException
install
- True to allow installation of packagesoverwrite
- True to force overwriting of existing filesverify
- Whether to verify the unpackingSincerityException
- In case of an errorpublic ArtifactManager getArtifactManager() throws SincerityException
SincerityException
- In case of an errorpublic Packages getPackages() throws SincerityException
SincerityException
- In case of an errorpublic String getClasspath(boolean includeSystem) throws SincerityException
includeSystem
- True to include the system classpathSincerityException
- In case of an errorgetClasspaths(boolean)
public abstract List<File> getClasspaths(boolean includeSystem) throws SincerityException
includeSystem
- True to include the system classpathSincerityException
- In case of an errorgetClasspath(boolean)
public abstract void reset() throws SincerityException
Does not resolve; only changes the specification.
SincerityException
- In case of an errorpublic abstract boolean addExplicitDependency(String group, String name, String version, boolean force, boolean transitive) throws SincerityException
Will not add the dependency if it is already specified.
group
- The dependency's groupname
- The dependency's nameversion
- The dependency's versionforce
- Whether to force the dependencytransitive
- Whether to pull in dependencies of the dependencySincerityException
- In case of an errorpublic abstract boolean reviseExplicitDependency(String group, String name, String newVersion) throws SincerityException
group
- The dependency's groupname
- The dependency's namenewVersion
- The dependency's new versionSincerityException
- In case of an errorpublic abstract boolean removeExplicitDependency(String group, String name) throws SincerityException
group
- The dependency's groupname
- The dependency's nameSincerityException
- In case of an errorpublic abstract boolean excludeDependency(String group, String name) throws SincerityException
group
- The dependency's groupname
- The dependency's nameSincerityException
- In case of an errorpublic abstract boolean overrideDependency(String group, String name, String version) throws SincerityException
group
- The dependency's groupname
- The dependency's nameversion
- The dependency's versionSincerityException
- In case of an errorpublic abstract void freezeVersions() throws SincerityException
SincerityException
- In case of an errorpublic void prune() throws SincerityException
SincerityException
- In case of an errorpublic void uninstallPackages() throws SincerityException
SincerityException
- In case of an errorpublic abstract void install(boolean overwrite, boolean verify) throws SincerityException
overwrite
- True to force overwrite of existing artifact filesverify
- Whether to verify the unpackingSincerityException
- In case of an errorprotected void printDisclaimer(PrintWriter out)
out
- The print writerCopyright © 2011-2016 Three Crickets LLC.