saker.nest Documentation TaskDoc JavaDoc Packages
public interface NestBundleStorageConfiguration
The main interface that encloses configured bundle storages and provides access to them.

When the Nest repository is instantiated and configured, an instance of this interface will handle the access to the configured storages. It is responsible for providing access to the storages, the root lookup, build system tasks, and the class loaders for the bundles.

The configuration consists of named bundle storage views. The names are chosen arbitrarily by the user, and may consist of any characters.

The configuration is initialized with dependency constraints that are used to appropriately handle dependencies.

The configuration also responsible for looking up and instantiating tasks for using them with the saker.build system.

The repository storage configuration can be customized defining appropriate values for the execution user parameters when used with the build system. The possible names of the parameters and their uses are defined with the PARAMETER_* constants.

Different storage views can be configured similarly, see the appropriate storage view interface for parameter and usage information. (ParameterBundleStorageView, LocalBundleStorageView, ServerBundleStorageView)

When not used with the saker.build system, consult the associated tool or environment for the possible opportunities to pass these configuration parameters to the repository.

This interface is not to be implemented by clients.

Fields
public static final String
PARAMETER_NEST_REPOSITORY_CONSTRAINT_FORCE_BUILD_SYSTEM_VERSION = "repository.constraint.force.buildsystem.version"
Parameter for overriding the saker.build system version dependency constraint.
public static final String
PARAMETER_NEST_REPOSITORY_CONSTRAINT_FORCE_JRE_MAJOR = "repository.constraint.force.jre.major"
Parameter for overriding the default Java Runtime version dependency constraint.
public static final String
PARAMETER_NEST_REPOSITORY_CONSTRAINT_FORCE_NATIVE_ARCHITECTURE = "repository.constraint.force.architecture"
Parameter for overriding the native architecture dependency constraint.
public static final String
PARAMETER_NEST_REPOSITORY_CONSTRAINT_FORCE_REPOSITORY_VERSION = "repository.constraint.force.repo.version"
Parameter for overriding the Nest repository version dependency constraint.
public static final String
PARAMETER_NEST_REPOSITORY_PIN_TASK_VERSION = "repository.pin.task.version"
Parameter for pinning a specific task version.
public static final String
PARAMETER_NEST_REPOSITORY_STORAGE_CONFIGURATION = "repository.storage.configuration"
Parameter for configuring the bundle storages and their relations.
public static final String
Storage type corresponding to the local storage.
public static final String
Storage type corresponding to the parameter storage.
public static final String
Storage type corresponding to the server storage.
Methods
public ClassLoader
Gets the ClassLoader for a bundle specified by the given bundle key.
public ClassLoader
Gets the ClassLoader for a bundle specified by the given identifier and looked up using the specified bundle lookup.
public BundleLookup
Gets the root bundle lookup for this storage configuration.
public BundleLookup
Gets the bundle lookup in the storage configuration for the given lookup key.
public BundleStorageView
Gets the BundleStorageView that is associated with the given storage view key in this storage configuration.
public DependencyConstraintConfiguration
Gets the dependency constraint configuration that the storage configuration uses.
public Map<String, ? extends LocalBundleStorageView>
Gets the local storages defined in this storage configuration.
public Map<String, ? extends ParameterBundleStorageView>
Gets the parameter storages defined in this storage configuration.
public NestRepository
Gets the Nest repository instance that this storage configuration uses.
public Map<String, ? extends ServerBundleStorageView>
Gets the server storages defined in this storage configuration.
public Map<String, ? extends BundleStorageView>
Gets the bundle storage views in the configuration.
public Map<extends ExternalArchiveKey, ? extends ExternalArchive>
Loads the external archives from the argument dependency information.
public TaskFactory<?>
Searches the corresponding task for the specified name.
public static final String PARAMETER_NEST_REPOSITORY_CONSTRAINT_FORCE_BUILD_SYSTEM_VERSION = "repository.constraint.force.buildsystem.version"
Parameter for overriding the saker.build system version dependency constraint.

The parameter must be prefixed by the repository identifier in the following format:

 <repo-id>.<param>
 
The value of the parameter must be a valid version number. It will be used to constrain dependencies and bundle loading instead of the default value. Set it to "null" or empty string to disable the build system version version constraint.

The default value is the current full version of the saker.build system.

public static final String PARAMETER_NEST_REPOSITORY_CONSTRAINT_FORCE_JRE_MAJOR = "repository.constraint.force.jre.major"
Parameter for overriding the default Java Runtime version dependency constraint.

The parameter must be prefixed by the repository identifier in the following format:

 <repo-id>.<param>
 
The value of the parameter must be an integer that is greater or equals to 1. It will be used to constrain dependencies and bundle loading instead of the default value. Set it to "null" or empty string to disable the JRE major version constraint.

The default value is the current Java Runtime major version.

public static final String PARAMETER_NEST_REPOSITORY_CONSTRAINT_FORCE_NATIVE_ARCHITECTURE = "repository.constraint.force.architecture"
Parameter for overriding the native architecture dependency constraint.

The parameter must be prefixed by the repository identifier in the following format:

 <repo-id>.<param>
 
The value of the parameter may be any arbitrary string that corresponds to a valid native architecture. (e.g. "x86", "amd64") It is used to constrain dependencies and bundle loading instead of the default value. Set it to "null" or empty string to disable the native architecture constraint.

The default value is the current value of the "os.arch" system property.

public static final String PARAMETER_NEST_REPOSITORY_CONSTRAINT_FORCE_REPOSITORY_VERSION = "repository.constraint.force.repo.version"
Parameter for overriding the Nest repository version dependency constraint.

The parameter must be prefixed by the repository identifier in the following format:

 <repo-id>.<param>
 
The value of the parameter must be a valid version number. It will be used to constrain dependencies and bundle loading instead of the default value. Set it to "null" or empty string to disable the repository version version constraint.

The default value is the current full version of the Nest repository.

public static final String PARAMETER_NEST_REPOSITORY_PIN_TASK_VERSION = "repository.pin.task.version"
Parameter for pinning a specific task version.

The parameter must be prefixed by the repository identifier in the following format:

 <repo-id>.<param>
 
The value of the parameter is a semicolon (;) separated list that specifies the task names and their pinned version numbers. When a task lookup request is served by the repository, it will only try to load the task that has the same version number as the pinned one. Note, that this only happens if the task lookup request has no version number specified already.

Value example:

 my.task:1.0;my.task-q1:1.1;other.task:2.0
 
Extraneous semicolons and whitespace is omitted. The given pin configuration will cause the following build script to work in the following way:
 my.task(...)      # will use my.task-v1.0
 my.task-v3.0(...) # will use my.task-v3.0, no override
 my.task-q1(...)   # will use my.task-q1-v1.1
 
If the repository fails to load the task with the pinned version, the lookup will fail, and no other versions will be searched for.
public static final String PARAMETER_NEST_REPOSITORY_STORAGE_CONFIGURATION = "repository.storage.configuration"
Parameter for configuring the bundle storages and their relations.

The parameter must be prefixed by the repository identifier in the following format:

 <repo-id>.<param>
 
The value of this parameter contains the configured storage names and their types. They can be specified in a <name>:<type> format where the name must only contains alphabetic (a-z, A-Z), numberic (0-9), or underscore (_) characters. The type must be one of the STORAGE_TYPE_* constants declared in this interface.

Multiple storage declarations can be specified in a list that is enclosed in brackets ([, ]) and separated by commas (,). The list declarations can be nested. These subsequent storage declarations define the lookup behaviour assigned to each configuration.

The declared storages can be configured with parameters that begin with the repository identifier part that is the same as this parameter, and continues with the name of the storage and ends with the parameter name in a dot separated format. Parameters for bundle storages must have the following format:

 <repo-id>.<storage-name>.<param>
 

Examples:

 "server: server"
 
The only storage configuration that is used is a server storage. The configuration will only use bundles that is available from that server.

If the storage name is the same as the storage type, the storage name can be omitted. Specifying simply ":server" is the same as the above declaration.

 "[:params, :local, :server]"
 
The above is the default storage configuration if the parameter is not specified. It contains 3 storages:
  • params: A parameter storage. Bundles from local and server is visible from it.
  • local: A local storage. Bundles from server is visible to it, but bundles from params are not.
  • server: A server storage. It can only use bundles that it contains.
The definiton place of storages affect what bundles they can use. This specifically important when dependencies are resolved in the repository. If a bundle from params depend on a bundle from local, the dependency can be successfully resolved. However, if a bundle in local tries to depend on a bundle from params, the dependency resolution will fail.
 "[p1:params, p2:params]"
 
Multiple storages with the same type can be declared. In this case there are 2 parameter storages in the specified order. The parameters <repo-id>.p1.bundles and <repo-id>.p2.bundles can be used to differently configure the two storages.
 "[[p3:params, :local], p4:params]"
 
In the above example we use nested scopes to specify different lookup properties. In this case the bundles from local will be visible to p3. The bundles from p4 will not be visible to either p3 or local, as they've been declared in a different scope.

If we would want to make the bundles in p4 visible to p3, but still keep them from local, we can use the following configuration:

 "[p3:params, [:local], p4:params]"
 
In this case the bundles from local couldn't depend on p4, but the bundles in p3 could use the bundles from p4.

The bundle storages can be repeated in order to make them accessible through multiple lookup scopes. However, when doing so, all declarations must have the same tail resolution. (That is, all repeating configurations must have the same lookup scope after them.) See the following:

 "[[p5:params, :local], [p6:params, :local]]"
 
In this case both p5 and p6 have access to the bundles from local, while neither p5 can depend on bundles from p6, and the local storage doesn't see bundles in p6 as well.

Note that modifying the above configuration the following way will cause an initialization error:

 "[[p5:params, :local], [p6:params, :local, :server]]"
 
This is due to the local storage has different tail resolution defined in the locations it appears. To have the server storage visible for local (and the parameter storages as well), modify it like the following:
 "[[p5:params, :local, :server], [p6:params, :local, :server]]"
 
Putting the server storage in the outer scope (as in "[[p5:params, :local], [p6:params, :local], :server]") will not work as that will be in a different scope, and visibility from outer scopes don't work.

The configuration value format allows the type for repeating declarations to be omitted. The following configurations are the same:

 "[[p5:params, l:local], [p6:params, l:local]]"
 "[[p5:params, l:local], [p6:params, l:]]"
 "[[p5:params, l:], [p6:params, l:local]]"
 
public static final String STORAGE_TYPE_LOCAL = "local"
public static final String STORAGE_TYPE_PARAMETER = "params"
public static final String STORAGE_TYPE_SERVER = "server"
Gets the ClassLoader for a bundle specified by the given bundle key.

The method will attempt to find the bundle in the associated storage, and resolve the dependencies in order to get the class loader.

The method may fail for the same conditions as getBundleClassLoader(BundleLookup, BundleIdentifier), and additionally if the associated bundle storage is not present in this configuration.

bundlekeyThe bundle key to get the class loader of.
The class loader for the bundle. The result implements NestBundleClassLoader.
NullPointerExceptionIf the argument is null.
BundleLoadingFailedExceptionIf the bundle wasn't found or failed to be loaded.
BundleDependencyUnsatisfiedExceptionIf the dependencies of the bundle failed to be satisfied.
Gets the ClassLoader for a bundle specified by the given identifier and looked up using the specified bundle lookup.

The method will use the argument bundle lookup to find the bundle with the given identifier, and will create the ClassLoader instance for it. The class loader will use the transitive dependencies declared in the bundle with the classpath kind.

This method doesn't create a new ClassLoader but reuse them if they've been already loaded.

lookupThe bundle lookup to find the bundle identifier or null to use the root lookup.
bundleidThe bundle identifier to create the ClassLoader for.
The class loader for the bundle. The result implements NestBundleClassLoader.
NullPointerExceptionIf the bundle identifier is null.
BundleLoadingFailedExceptionIf the bundle wasn't found or failed to be loaded.
BundleDependencyUnsatisfiedExceptionIf the dependencies of the bundle failed to be satisfied.
public abstract BundleLookup getBundleLookup()
Gets the root bundle lookup for this storage configuration.
The root bundle lookup.
Gets the bundle lookup in the storage configuration for the given lookup key.
keyThe lookup key.
The associated bundle lookup or null if not found.
Gets the BundleStorageView that is associated with the given storage view key in this storage configuration.

If no storage view is configured for the given storage key, null is returned.

keyThe storage view key.
The found BundleStorageView or null if the key is null or not found.
Gets the dependency constraint configuration that the storage configuration uses.

This constraint configuration is used when classpath dependencies are resolved during ClassLoader construction for bundles. Clients may but not required to use this when resolving dependencies themselves.

The current constraint configuration.
public abstract Map<String, ? extends LocalBundleStorageView> getLocalStorages()
Gets the local storages defined in this storage configuration.

The storages are mapped to their defined names by the user.

The local storages.
Gets the parameter storages defined in this storage configuration.

The storages are mapped to their defined names by the user.

The parameter storages.
public abstract NestRepository getRepository()
Gets the Nest repository instance that this storage configuration uses.
The repository instance.
public abstract Map<String, ? extends ServerBundleStorageView> getServerStorages()
Gets the server storages defined in this storage configuration.

The storages are mapped to their defined names by the user.

The server storages.
public abstract Map<String, ? extends BundleStorageView> getStorages()
Gets the bundle storage views in the configuration.

The bundle storages are mapped to their names. The names are user specified names to reference them in the configuration only containing characters specified in PARAMETER_NEST_REPOSITORY_STORAGE_CONFIGURATION.

All the bundle storage views present in the configuration.
Loads the external archives from the argument dependency information.

The method will analyze the argument dependency information and load all dependency archives from it. Attachments (source and documentation) are only loaded if they are present and their targeted archives are also loaded.

The dependency kinds are not taken into account.

If you want to prevent loading specific archives, construct a new ExternalDependencyInformation that contains only the relevant information.

The URIs are loaded by converting them to an URL without any bundle storage specific behaviour. The resources are not loaded from any mirror servers whatsoever.

If you expect the resources to be loaded from a mirror (e.g. using the saker.nest repository server), then use BundleStorageView.loadExternalArchives(ExternalDependencyInformation) as that function takes bundle storage specific configuration into account.

depinfoThe dependency information.
The loaded external archives. Mapped to their external archive keys.
NullPointerExceptionIf the argument is null.
IllegalArgumentExceptionIf the argument dependency information contains invalid data. (E.g. multiple different hashes are defined for a given URI.)
saker.nest 0.8.5
public abstract TaskFactory<?> lookupTask(TaskName taskname) throws TaskNotFoundException
Documentation included from: BuildRepository
Searches the corresponding task for the specified name.

Looks up the task in this repository for the given name. An exception thrown with an explanation if the task cannot be found in this repository.

The lookup algorithm is implementation dependent for each repository.

Repository implementations are not required to return the same instances for the same name if this method is called consecutively.

tasknameThe name of the task to look up.
The found task for the given name.
TaskNotFoundExceptionIf the task was not found.