-
@ProviderType public interface AtomosLayer
An Atomos Layer may represents aModuleLayer
that was added to aAtomos
using theaddLayer(String, LoaderType, Path...)
addLayer} method or the Atomos Layer could represent theboot layer
. An Atomos Layer will contain one or moreAtomos contents
which can then be used toinstall
them as OSGi connected bundles into theConnectFrameworkFactory.newFramework(Map, ModuleConnector)
framework}.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static class
AtomosLayer.LoaderType
The loader type used for the class loaders of an Atomos layer.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description <T> Optional<T>
adapt(Class<T> type)
Adapt this Atomos layer to the specified type.AtomosLayer
addLayer(String name, AtomosLayer.LoaderType loaderType, Path... modulePaths)
Adds a layer as a child of this layer and loads modules from the specified module pathsAtomosLayer
addModules(String name, Path path)
A convenience method that adds the modules found at the specified path to a new child layer of this layer.Optional<AtomosContent>
findAtomosContent(String symbolicName)
Returns the Atomos content with the given name in this layer, or if not in this layer, the parent layers.Set<AtomosContent>
getAtomosContents()
The Atomos contents contained in this layerSet<AtomosLayer>
getChildren()
The Atomos Layer children of this layerlong
getId()
Returns this Atomos Layer's unique identifier.AtomosLayer.LoaderType
getLoaderType()
Returns the loader type used for this Atomos layer.String
getName()
The name of the Atomos Layer.List<AtomosLayer>
getParents()
The Atomos parents of this layerboolean
isAddLayerSupported()
Returnstrue
if additional layers are supported.void
uninstall()
Uninstalls this Atomos Layer along with anychildren
layers.
-
-
-
Method Detail
-
adapt
<T> Optional<T> adapt(Class<T> type)
Adapt this Atomos layer to the specified type. For example, if running in a module layer then the layer can be adapted to a ModuleLayer associated with this Atomos Layer.- Type Parameters:
T
- The type to which this Atomos layer is to be adapted.- Parameters:
type
- Class object for the type to which this Atomos layer is to be adapted.- Returns:
- The object, of the specified type, to which this Atomos layer has been
adapted or
empty
if this layer cannot be adapted to the specified type.
-
addLayer
AtomosLayer addLayer(String name, AtomosLayer.LoaderType loaderType, Path... modulePaths)
Adds a layer as a child of this layer and loads modules from the specified module paths- Parameters:
name
- the name of the new layerloaderType
- the type of class loader to usemodulePaths
- the paths to load modules for the new layer- Returns:
- a newly created layer
- Throws:
UnsupportedOperationException
- ifisAddLayerSupported()
returns false.
-
addModules
AtomosLayer addModules(String name, Path path)
A convenience method that adds the modules found at the specified path to a new child layer of this layer.- Parameters:
name
- The name of the layer.path
- The path to the modules. Ifnull
then the default will try to determine the location on disk of the atomos runtime module and look for a folder with the same name as the specified name of the layer.- Returns:
- a newly created layer
- Throws:
UnsupportedOperationException
- ifisAddLayerSupported()
returns false.
-
isAddLayerSupported
boolean isAddLayerSupported()
Returnstrue
if additional layers are supported.- Returns:
- if modules and additional layers are supported.
-
getChildren
Set<AtomosLayer> getChildren()
The Atomos Layer children of this layer- Returns:
- The children of this layer
-
getParents
List<AtomosLayer> getParents()
The Atomos parents of this layer- Returns:
- the parnets of this layer
-
getAtomosContents
Set<AtomosContent> getAtomosContents()
The Atomos contents contained in this layer- Returns:
- the Atomos contents
-
findAtomosContent
Optional<AtomosContent> findAtomosContent(String symbolicName)
Returns the Atomos content with the given name in this layer, or if not in this layer, the parent layers. Finding content in parent layers is equivalent to invokingfindAtomosContent
on each parent, in search order, until the content is found or all parents have been searched. In a tree of layers then this is equivalent to a depth-first search.- Parameters:
symbolicName
- the name of the content to find- Returns:
- The content with the given name or an empty
Optional
if there isn't a content with this name in this layer or any parent layer
-
getName
String getName()
The name of the Atomos Layer. By default the Atomos Layer name is the empty string. Atomos Layer names are not required to be unique. All Atomos contents contained in a layer will havelocations
that use the layer name as a prefix. If the layer name is not the empty string then the location prefix will be the layer name followed by a colon (:
). This allows two different layers to load the same content in different layers.- Returns:
- the name of the layer
-
getId
long getId()
Returns this Atomos Layer's unique identifier. This Atomos Layer is assigned a unique identifier when it was installed in the Atomos runtime.A Atomos Layer's unique identifier has the following attributes:
- Is unique and persistent.
- Is a
long
. - Its value is not reused for another layer, even after a layer is uninstalled.
- Does not change while a layer remains installed.
- Returns:
- The unique identifier of this layer.
-
getLoaderType
AtomosLayer.LoaderType getLoaderType()
Returns the loader type used for this Atomos layer.- Returns:
- the loader type
-
uninstall
void uninstall() throws BundleException
Uninstalls this Atomos Layer along with anychildren
layers.- Throws:
BundleException
- If an error happened while uninstalling any connected bundles in the layer
-
-