public class Package extends AbstractList<Artifact>
Artifact
). They are
defined using special tags in standard JVM resource manifests. Additionally,
packages support special install/uninstall hooks for calling arbitrary entry
points, allowing for custom behavior. Indeed, a package can include no
artifacts, and only implement these hooks.
Packages allow you to work around various limitations in repositories such as iBiblio/Maven, in which the smallest deployable unit is a Jar. The package specification allows you to include as many files as you need in a single Jar, greatly simplifying your deployment scheme.
Note that two different ways are supported for specifying artifacts: they can specified as files, thus referring to actual zipped entries with the Jar file in which the manifest resides, or that can be specified as general resources, in which case they will be general resource URLs to be loaded by the classloader, and thus they can reside anywhere in the classpath.
Also note what "volatile" means in this context: a "volatile" artifact is one that should be installed once and only once. This means that subsequent attempts to install the package, beyond the first, should ignore these artifacts. This is useful for marking configuration files, example files, and other files that the user should be allow to delete without worrying that they would reappear on every change to the dependency structure.
Supported manifest tags:
Modifier and Type | Field and Description |
---|---|
static String |
PACKAGE_FILES |
static String |
PACKAGE_FOLDERS |
static String |
PACKAGE_INSTALLER |
static String |
PACKAGE_RESOURCES |
static String |
PACKAGE_UNINSTALLER |
static String |
PACKAGE_VOLATILE_FILES |
static String |
PACKAGE_VOLATILE_FOLDERS |
boolean |
sorted |
modCount
Modifier and Type | Method and Description |
---|---|
Artifact |
get(int index) |
File |
getFile()
The package file (a Jar).
|
String |
getInstaller()
The installer class name.
|
String |
getUninstaller()
The uninstaller class name.
|
void |
install()
Executes the installer class's main() method, if it exists.
|
static Package |
parsePackage(URL manifestUrl,
PackagingContext packagingContext)
Creates a package instance by interpreting its manifest.
|
int |
size() |
void |
uninstall()
Executes the uninstaller class's main() method, if it exists.
|
void |
unpack(String filter,
ArtifactManager managedArtifacts,
boolean overwrite,
boolean verify)
Unpacks all artifacts, while consulting and updating the managed
artifacts database.
|
add, add, addAll, clear, equals, hashCode, indexOf, iterator, lastIndexOf, listIterator, listIterator, remove, removeRange, set, subList
addAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray, toString
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
addAll, contains, containsAll, isEmpty, remove, removeAll, replaceAll, retainAll, sort, spliterator, toArray, toArray
parallelStream, removeIf, stream
public static final String PACKAGE_FOLDERS
public static final String PACKAGE_VOLATILE_FOLDERS
public static final String PACKAGE_FILES
public static final String PACKAGE_VOLATILE_FILES
public static final String PACKAGE_RESOURCES
public static final String PACKAGE_INSTALLER
public static final String PACKAGE_UNINSTALLER
public boolean sorted
public static Package parsePackage(URL manifestUrl, PackagingContext packagingContext) throws SincerityException
manifestUrl
- The manifest URLpackagingContext
- The packaging contextSincerityException
- In case of an errorpublic String getInstaller()
public String getUninstaller()
public File getFile()
public void install() throws SincerityException
SincerityException
- In case of an errorpublic void uninstall() throws SincerityException
SincerityException
- In case of an errorpublic void unpack(String filter, ArtifactManager managedArtifacts, boolean overwrite, boolean verify) throws SincerityException
filter
- Filter artifacts (currently unused)managedArtifacts
- The managed artifacts databaseoverwrite
- True to force overwriting of modified artifactsverify
- Whether to verify the unpackingSincerityException
- In case of an errorArtifact.unpack(ArtifactManager, boolean, boolean)
public int size()
size
in interface Collection<Artifact>
size
in interface List<Artifact>
size
in class AbstractCollection<Artifact>
Copyright © 2011-2016 Three Crickets LLC.