The information in this class consists of the following:
- Bundle identifier
- Classpath information
- Dependencies
- Tasks
- Other meta-data
META-INF/nest/
directory.
When an instance of this class is constructed, all of the information are validated to have a valid format. A Nest bundle that is any way malformatted is considered invalid.
During construction, other structural integrity changes are also validated to prevent possible malicious use-case:
- There may not be duplicate entries in the bundle. The entry names are checked in a case-insensitive manner, and ensured that an entry with a given name can only occurr once.
- Bundle entry names must use the forward slash as a name separator.
- Bundle entry names cannot contain path names that correspond to specially interpreted relative names.
(
"."
and".."
) - Bundle entry names cannot contain colon (
':'
) and semicolon (';'
) characters. - The class files for the declared tasks must exist in the bundle.
"Nest-Bundle-Format-Version"
attribute that is set to a valid version
recognized by this class. Currently it must be 1
.
The manifest file must contain an attribute for "Nest-Bundle-Identifier"
. However, it is not required
for that to contain a version qualifier.
Any other possible and optional manifest attributes are declared in this class with the MANIFEST_NAME_*
name. Other attributes which start with "Nest-"
are reserved, and may not appear.
The bundles can contain meta-data files under the path META-INF/nest/
which are described in the
appropriate entry name declaration in this class. The bundle is not verified if it contains any extra unrecognized
files under the nest meta-data directory. See ENTRY_BUNDLE_TASKS and ENTRY_BUNDLE_DEPENDENCIES.
The class can be instantiated using one of the declared constructors, except the no-arg one which is reserved for Externalizable implementation.
public static final String | DEPENDENCY_KIND_CLASSPATH = "classpath" Dependency kind for specifying that the dependency is required to be on the classpath. |
public static final String | DEPENDENCY_META_BUILD_SYSTEM_VERSION = "buildsystem-version" Dependency meta-data name for specifying the saker.build systems versions the dependency applies to. |
public static final String | DEPENDENCY_META_JRE_VERSION = "jre-version" Dependency meta-data name for specifying the Java Runtime versions the dependency applies to. |
public static final String | DEPENDENCY_META_NATIVE_ARCHITECTURE = "native-architecture" Dependency meta-data name for specifying the architectures that the dependency applies to. |
public static final String | DEPENDENCY_META_OPTIONAL = "optional" Bundle dependency meta data name for specifying that a dependency is optional. |
public static final String | DEPENDENCY_META_PRIVATE = "private" Bundle dependency meta data name for specifying that a dependency is optional. |
public static final String | DEPENDENCY_META_REPOSITORY_VERSION = "repo-version" Dependency meta-data name for specifying the Nest repository versions the dependency applies to. |
public static final String | DIR_META_INF_NEST = "META-INF/nest/" Name of the bundle directory entry under which the meta-information files for the saker.nest bundles reside. |
public static final String | ENTRY_BUNDLE_DEPENDENCIES = "META-INF/nest/dependencies" Bundle entry name for the bundle dependencies. |
public static final String | ENTRY_BUNDLE_EXTERNAL_DEPENDENCIES = "META-INF/nest/external_dependencies" Bundle entry name for external dependencies. |
public static final String | ENTRY_BUNDLE_TASKS = "META-INF/nest/tasks" Bundle entry name for the task declarations. |
public static final Name | Manifest attribute name for the bundle information version number. |
public static final Name | Manifest attribute name for the bundle identifier. |
public static final Name | Manifest attribute name for specifying special dependencies on the classpath of the bundle. |
public static final Name | Manifest attribute name for specifying the architecture that the bundle's classpath may be loaded on. |
public static final Name | Manifest attribute name for specifying the suitable build system versions that this bundle can load its classpath
on. |
public static final Name | Manifest attribute name for specifying the suitable Java versions this bundle can load its classpath on. |
public static final Name | Manifest attribute name for specifying the suitable repository versions that this bundle can load its classpath
on. |
public static final Name | Manifest attribute name containing a BundleIdentifier of the associated documentation for this bundle. |
public static final Name | Manifest attribute name containing a BundleIdentifier of the sources for this bundle. |
public static final String | SPECIAL_CLASSPATH_DEPENDENCY_JDK_COMPILER_OPEN = "jdk.compiler-open" Constant for the manifest attribute MANIFEST_NAME_CLASSPATH_SPECIAL_DEPENDENCY. |
public static final String | SPECIAL_CLASSPATH_DEPENDENCY_JDK_TOOLS = "jdktools" Constant for the manifest attribute MANIFEST_NAME_CLASSPATH_SPECIAL_DEPENDENCY. |
public | For Externalizable. |
public | Creates a new instance based on the contents of the argument JAR file. |
public | Creates a new instance based on the contents of the argument JAR input stream. |
public | Creates a new instance based on the contents of the argument ZIP file. |
public static BundleInformation | Creates a new instance based on the contents of the argument JAR file. |
public static BundleInformation | Creates a new instance based on the contents of the argument JAR input stream. |
public static BundleInformation | Creates a new instance based on the contents of the argument ZIP file. |
public boolean | Indicates whether some other object is "equal to" this one. |
public BundleIdentifier | Gets the bundle identifier. |
public BundleDependencyInformation | Gets the dependency information for this bundle. |
public BundleIdentifier | Gets the documentation attachment for this bundle. |
public ExternalDependencyInformation | Gets the external dependencies of this bundle. |
public String | Gets the declared main class in the manifest of this bundle. |
public BundleIdentifier | Gets the source attachment for this bundle. |
public Set< | Gets the set of supported classpath architectures by this bundle. |
public VersionRange | Gets the version range declaration of the supported saker.build system versions. |
public VersionRange | Gets the version range declaration of the supported classpath Java Runtime versions. |
public VersionRange | Gets the version range declaration of the supported Nest repository versions. |
public NavigableMap< | Gets the declared tasks mapped to their class names in this bundle. |
public int | hashCode() Returns a hash code value for the object. |
public boolean | Checks if this bundle requires the opened jdk.compiler module (or Java tools belov Java 9) on the
classpath. |
public boolean | Checks if this bundle requires the JDK tools to be present on the classpath. |
public void | The object implements the readExternal method to restore its
contents by calling the methods of DataInput for primitive
types and readObject for objects, strings and arrays. |
public String | toString() Returns a string representation of the object. |
public void | The object implements the writeExternal method to save its contents
by calling the methods of DataOutput for its primitive values or
calling the writeObject method of ObjectOutput for objects, strings,
and arrays. |
The denoted archive is used to lookup classes which are required by classes contained in this bundle.
The value of the meta-data is a VersionRange that specifies the build system version number range that the dependency should be applied to. If the current build system version constraint is not included in the specified version range, the associated dependency will be omitted.
This works similarly to MANIFEST_NAME_CLASSPATH_SUPPORTED_BUILD_SYSTEM_VERSIONS, but is declared on a dependency level instead of on the bundles.
Dependency resolvers may or may not take this meta-data into account. The repository will use this meta-data when creating the ClassLoader for the bundle.
The value of the meta-data is a VersionRange that specifies the JRE major version number range that the dependency should be applied to. If the current JRE version constraint is not included in the specified version range, the associated dependency will be omitted.
This works similarly to MANIFEST_NAME_CLASSPATH_SUPPORTED_JRE_VERSIONS, but is declared on a dependency level instead of on the bundles.
Dependency resolvers may or may not take this meta-data into account. The repository will use this meta-data when creating the ClassLoader for the bundle.
E.g. This meta-data name can be used to load different bundles on different Java versions:
bundle.for.jdk8 classpath: [0) jre-version: 8 bundle.for.jdk9 classpath: [0) jre-version: 9This will cause the
bundle.for.jdk8
to be loaded on Java 8, and bundle.for.jdk9
to be
loaded on Java 9. Only one of them will be on the classpath.The value of the meta-data is a comma separated architecture list that contains the architectures the dependency applies to. If the current architecture constraint is not included in the specified list, the associated dependency will be omitted.
This works similarly to MANIFEST_NAME_CLASSPATH_SUPPORTED_ARCHITECTURES, but is declared on a dependency level instead of on the bundles.
Dependency resolvers may or may not take this meta-data into account. The repository will use this meta-data when creating the ClassLoader for the bundle.
E.g. This meta-data can be used to load different bundles for different architectures:
bundle.for.x86 classpath: [0) native-architecture: x86 bundle.for.x64 classpath: [0) native-architecture: amd64This will cause
bundle.for.x86
to be loaded on x86
and bundle.for.x64
to
be loaded on amd64
. Only one of them will be on the classpath.The denoted bundle dependency is not required for the safe operation of this bundle.
A private bundle dependency is considered to be an implementation detail for the bundle. The bundle doesn't publish data from a private through it's API.
The value of the meta-data is a VersionRange that specifies the Nest repository version number range that the dependency should be applied to. If the current repository version constraint is not included in the specified version range, the associated dependency will be omitted.
This works similarly to MANIFEST_NAME_CLASSPATH_SUPPORTED_REPOSITORY_VERSIONS, but is declared on a dependency level instead of on the bundles.
Dependency resolvers may or may not take this meta-data into account. The repository will use this meta-data when creating the ClassLoader for the bundle.
The file contains BundleDependencyInformation data in the format specified by
BundleDependencyInformation.readFrom(
The this
tokens in version ranges will be resolved to be the same as the enclosing bundle.
The "classpath"
dependency kind is used to create the runtime
ClassLoader for the classes in the bundle. These dependencies are transitively resolved to create the
classpath for the bundle.
The classpath dependencies can have various meta-datas that can be used to configure the classpath loading for
various environments. See the DEPENDENCY_META_*
constants declared in this class.
The file contains ExternalDependencyInformation data in the format specified by
ExternalDependencyInformation.readFrom(
Dependencies declared with the "classpath"
kind will be added tot he runtime
classpath of the bundle.
The classpath dependencies can have various meta-datas that can be used to configure the classpath loading for
various environments. See the DEPENDENCY_META_*
constants declared in this class.
If a bundle entry is present at the value of this constant, then that file is used to read the declared tasks in the bundle. The file must have the following format in each line:
[task.name]=[class-name]Extra whitespace is allowed around the equals (
'='
) sign, and before and after the line contents.
Lines that contain only whitespace are ignored.
Comments are not allowed.
The task name part must have the format defined by the TaskName class. It must not have qualifiers.
The class name must be the binary name of the task. It will be verified that the associated class file is present in the bundle.
Duplicate task declarations may not exists.
Allowed values are:
1
: The initial version.
The manifest attribute is required and must contain a valid BundleIdentifier for the bundle.
This manifest attribute can be used to specify comma separated names that should be included in the classpath when loading the ClassLoader for this bundle.
Currently the following special classpath dependencies are allowed:
- SPECIAL_CLASSPATH_DEPENDENCY_JDK_TOOLS with the value
jdktools
.
The value is a comma (,
) separated list of architecture names that the bundle classpath can be
loaded on.
When the bundle classpath is loaded, the JVM reported architecture (os.arch property) is used to test if the bundle supports it. The architecture value is searched for in the attribute value. It is compared in a case-sensitive way.
If the manifest attribute is not specified, no restriction is placed for the supported architectures.
If the attribute is specified, it must specify at least one architecture, it cannot be empty.
The value of the attribute is a VersionRange that specifies the allowed build system versons on which the bundle's classpath can be loaded. The full version of saker.build is tested for the specified range.
If the attribute is not specified, no restriction is placed on the build system version.
The value of the attribute is a VersionRange that specifies which version can the enclosing bundle's classpath loaded on. The version range may only contain version numbers with a single major number. E.g.
8
: The bundle may be loaded only on version 8. Same as[8]
.[8, 10]
: Allows the bundle to be loaded on JDK 8, 9, and 10, but not on later versions.{8, 10, 12}
: The bundle may be loaded only on versions 8, 10 and 12.8.0.1
: Invalid version range, as it may only contain version numbers with a single component.
The value of the attribute is a VersionRange that specifies the allowed repository versons on which the bundle's classpath can be loaded. The full version of the Nest repository is tested for the specified range.
If the attribute is not specified, no restriction is placed on the repository version.
The bundle that is specified by the value of this attribute is considered to contain the documentation for this bundle. The format of the files are unspecified. It may include documentation for different languages as well.
The bundle that is specified by the value of this attribute is considered to contain the sources for this bundle. The format of the files are unspecified. It may include sources from different languages, other from Java as well.
Requires the Java compiler related classes as the parent to the bundle class loader.
On JDK8 this works the same way as SPECIAL_CLASSPATH_DEPENDENCY_JDK_TOOLS, it loads the
tools.jar
for the classpath.
On later JDK versions, the repository runtime will load the jdk.compiler
module in a way that it
opens its packages to the bundle classloader. This means that the bundle classes will be able to access
non-exported classes and packages from the jdk.compiler
module.
Special care should be taken as the jdk.compiler
module is essentially reloaded by the repository
runtime. Its classes will be defined multiple times in the same JVM specifically for the repository operation.
Bundles that use this feature should perform testing on the JDK versions it's expected to run. You will not be
able to typecast object from the opened jdk.compiler
module to types in the boot
jdk.compiler
module.
If both this value and "jdktools" are specified, this takes precedence.
Requires the Java compiler related classes as the parent to the bundle class loader.
On JDK8 this will mean that the tools.jar
in the JDK will be loaded and used as parent.
On later JDK version the platform class loader will be present as a parent class loader.
null
.null
.null
.The method also performs strict validation of the bundle properties. Strict validation ensures that the bundle declares facilities only that is supported by the current repository runtime.
null
.The method also performs strict validation of the bundle properties. Strict validation ensures that the bundle declares facilities only that is supported by the current repository runtime.
null
.The method also performs strict validation of the bundle properties. Strict validation ensures that the bundle declares facilities only that is supported by the current repository runtime.
null
.
The equals
method implements an equivalence relation on non-null object references:
- It is reflexive: for any non-null reference value
x
,x.equals(x)
should returntrue
. - It is symmetric: for any non-null reference values
x
andy
,x.equals(y)
should returntrue
if and only ify.equals(x)
returnstrue
. - It is transitive: for any non-null reference values
x
,y
, andz
, ifx.equals(y)
returnstrue
andy.equals(z)
returnstrue
, thenx.equals(z)
should returntrue
. - It is consistent: for any non-null reference values
x
andy
, multiple invocations ofx.equals(y)
consistently returntrue
or consistently returnfalse
, provided no information used inequals
comparisons on the objects is modified. - For any non-null reference value
x
,x.equals(null)
should returnfalse
.
The equals
method for class Object
implements the most discriminating possible equivalence
relation on objects; that is, for any non-null reference values x
and y
, this method returns
true
if and only if x
and y
refer to the same object (x == y
has the value
true
).
Note that it is generally necessary to override the hashCode
method whenever this method is overridden,
so as to maintain the general contract for the hashCode
method, which states that equal objects must have
equal hash codes.
true
if this object is the same as the obj argument; false
otherwise.null
.null
.null
if none.If the bundle declares no external dependencies, an empty informaiton object is returned.
null
.
This is determined using the Main-Class
attribute.
null
if none.null
if none.The architectures correspond to the manifest attribute MANIFEST_NAME_CLASSPATH_SUPPORTED_ARCHITECTURES.
null
if not restricted by this bundle.The version range corresponds to the manifest attribute MANIFEST_NAME_CLASSPATH_SUPPORTED_BUILD_SYSTEM_VERSIONS.
null
if not restricted by this bundle.The version range corresponds to the manifest attribute MANIFEST_NAME_CLASSPATH_SUPPORTED_JRE_VERSIONS.
null
if not restricted by this bundle.The version range corresponds to the manifest attribute MANIFEST_NAME_CLASSPATH_SUPPORTED_REPOSITORY_VERSIONS.
null
if not restricted by this bundle.
The general contract of hashCode
is:
- Whenever it is invoked on the same object more than once during an execution of a Java application, the
hashCode
method must consistently return the same integer, provided no information used inequals
comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application. - If two objects are equal according to the
equals(Object)
method, then calling thehashCode
method on each of the two objects must produce the same integer result. - It is not required that if two objects are unequal according to the
Object.equals(
Object) method, then calling thehashCode
method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.
As much as is reasonably practical, the hashCode method defined by class Object
does return distinct
integers for distinct objects. (This is typically implemented by converting the internal address of the object
into an integer, but this implementation technique is not required by the Java™ programming language.)
jdk.compiler
module (or Java tools belov Java 9) on the
classpath.true
if the bundle requires the opened JDK compiler classes.true
if the bundle requires the JDK tools classes.toString
method returns a string that
"textually represents" this object. The result should be a concise but informative representation that is easy
for a person to read. It is recommended that all subclasses override this method.
The toString
method for class Object
returns a string consisting of the name of the class of
which the object is an instance, the at-sign character `@
', and the unsigned hexadecimal representation
of the hash code of the object. In other words, this method returns a string equal to the value of:
getClass().getName() + '@' + Integer.toHexString(hashCode())