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.
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_LOCAL = "local" Storage type corresponding to the local storage. |
public static final String | STORAGE_TYPE_PARAMETER = "params" Storage type corresponding to the parameter storage. |
public static final String | STORAGE_TYPE_SERVER = "server" Storage type corresponding to the server storage. |
public ClassLoader | getBundleClassLoader( Gets the ClassLoader for a bundle specified by the given bundle key. |
public ClassLoader | getBundleClassLoader( 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< | Gets the local storages defined in this storage configuration. |
public Map< | Gets the parameter storages defined in this storage configuration. |
public NestRepository | Gets the Nest repository instance that this storage configuration uses. |
public Map< | Gets the server storages defined in this storage configuration. |
public Map< | Gets the bundle storage views in the configuration. |
public Map< | Loads the external archives from the argument dependency information. |
public TaskFactory< | lookupTask( Searches the corresponding task for the specified name. |
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.
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.
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.
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.
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.0Extraneous 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.1If the repository fails to load the task with the pinned version, the lookup will fail, and no other versions will be searched for.
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 fromlocal
andserver
is visible from it.local
: A local storage. Bundles fromserver
is visible to it, but bundles fromparams
are not.server
: A server storage. It can only use bundles that it contains.
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]]"
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(
null
.
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.
null
to use the
root lookup.null
.null
if not found.
If no storage view is configured for the given storage key, null
is returned.
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 storages are mapped to their defined names by the user.
The storages are mapped to their defined names by the user.
The storages are mapped to their defined names by the user.
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.
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(
null
.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.