Class ExtensionManager
- All Implemented Interfaces:
Content
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) class(package private) classprivate static class -
Field Summary
FieldsModifier and TypeFieldDescription(package private) static final ClassPathExtenderFactory.ClassPathExtender(package private) static final ClassPathExtenderFactory.ClassPathExtenderprivate final List<ExtensionManager.ExtensionTuple> private final List<BundleRevisionImpl> private final Loggerprivate final List<BundleRevisionImpl> private final List<BundleRevisionImpl> -
Constructor Summary
ConstructorsConstructorDescriptionExtensionManager(Logger logger, Map<String, ?> configMap, Felix felix) This constructor is used to create one instance per framework instance. -
Method Summary
Modifier and TypeMethodDescription(package private) voidaddExtensionBundle(BundleImpl bundle) Add an extension bundle.protected BundleCapabilitybuildNativeCapabilites(BundleRevisionImpl revision, Map<String, ?> configMap) voidclose()This method must be called when the content is no longer needed so that any resourses being used (e.g., open files) can be closed.private Map<BundleRevisionImpl, List<BundleWire>> findResolvableExtensions(List<BundleRevisionImpl> extensions, List<BundleRevisionImpl> alt) longgetContentTime(String name) Returns an enumeration of entry names as String objects.byte[]getEntryAsBytes(String name) This method returns the named entry as an array of bytes.getEntryAsContent(String name) This method returns the named entry as an IContent Typically, this method only makes sense for entries that correspond to some form of aggregated resource (e.g., an embedded JAR file or directory), but implementations are free to interpret this however makes sense.This method returns the named entry as a file in the file system for use as a native library.getEntryAsStream(String name) This method returns the named entry as an input stream.getEntryAsURL(String name) This method allows retrieving an entry as a local URL.booleanThis method determines if the specified named entry is contained in the associated content.booleanisDirectory(String name) This method determines if the specified named entry is contained in the associated content and is a directory.voidresolveExtensionBundles(Felix felix) (package private) voidstartExtensionBundle(Felix felix, BundleImpl bundle) Start extension bundle if it has an activator(package private) void(package private) voidstopExtensionBundles(Felix felix) (package private) voidupdateRevision(Felix felix, Map<String, ?> configMap)
-
Field Details
-
m_extenderFramework
-
m_extenderBoot
-
IDENTITY
-
m_logger
-
m_systemBundleRevision
-
m_extensionTuples
-
m_resolvedExtensions
-
m_unresolvedExtensions
-
m_failedExtensions
-
-
Constructor Details
-
ExtensionManager
This constructor is used to create one instance per framework instance. The general approach is to have one private static instance that we register with the parent classloader and one instance per framework instance that keeps track of extension bundles and systembundle exports for that framework instance.- Parameters:
logger- the logger to use.
-
-
Method Details
-
buildNativeCapabilites
protected BundleCapability buildNativeCapabilites(BundleRevisionImpl revision, Map<String, ?> configMap) -
updateRevision
-
getRevision
-
addExtensionBundle
Add an extension bundle. The bundle will be added to the parent classloader and it's exported packages will be added to the module definition exports of this instance. Subsequently, they are available form the instance in it's role as content loader.- Parameters:
bundle- the extension bundle to add.- Throws:
BundleException- if extension bundles are not supported or this is not a framework extension.SecurityException- if the caller does not have the needed AdminPermission.EXTENSIONLIFECYCLE and security is enabled.Exception- in case something goes wrong.
-
resolveExtensionBundles
-
startExtensionBundle
Start extension bundle if it has an activator- Parameters:
felix- the framework instance the extension bundle is installed in.bundle- the extension bundle to start if it has a an extension bundle activator.
-
startPendingExtensionBundles
-
stopExtensionBundles
-
removeExtensionBundles
public void removeExtensionBundles() -
findResolvableExtensions
private Map<BundleRevisionImpl,List<BundleWire>> findResolvableExtensions(List<BundleRevisionImpl> extensions, List<BundleRevisionImpl> alt) -
close
public void close()Description copied from interface:ContentThis method must be called when the content is no longer needed so that any resourses being used (e.g., open files) can be closed. Once this method is called, the content is no longer usable. If the content is already closed, then calls on this method should have no effect.
-
getEntries
Description copied from interface:ContentReturns an enumeration of entry names as String objects. An entry name is a path constructed with '/' as path element separators and is relative to the root of the content. Entry names for entries that represent directories should end with the '/' character.
- Specified by:
getEntriesin interfaceContent
-
hasEntry
Description copied from interface:ContentThis method determines if the specified named entry is contained in the associated content. The entry name is a relative path with '/' separators.
-
isDirectory
Description copied from interface:ContentThis method determines if the specified named entry is contained in the associated content and is a directory. The entry name is a relative path with '/' separators.
- Specified by:
isDirectoryin interfaceContent- Parameters:
name- The name of the entry to find.- Returns:
- true if a corresponding entry was found and is a directory, false otherwise.
-
getEntryAsBytes
Description copied from interface:ContentThis method returns the named entry as an array of bytes.
- Specified by:
getEntryAsBytesin interfaceContent- Parameters:
name- The name of the entry to retrieve as a byte array.- Returns:
- An array of bytes if the corresponding entry was found, null otherwise.
-
getEntryAsStream
Description copied from interface:ContentThis method returns the named entry as an input stream.
- Specified by:
getEntryAsStreamin interfaceContent- Parameters:
name- The name of the entry to retrieve as an input stream.- Returns:
- An input stream if the corresponding entry was found, null otherwise.
- Throws:
IOException
-
getEntryAsContent
Description copied from interface:ContentThis method returns the named entry as an IContent Typically, this method only makes sense for entries that correspond to some form of aggregated resource (e.g., an embedded JAR file or directory), but implementations are free to interpret this however makes sense. This method should return a new IContent instance for every invocation and the caller is responsible for opening and closing the returned content object.
- Specified by:
getEntryAsContentin interfaceContent- Parameters:
name- The name of the entry to retrieve as an IContent.- Returns:
- An IContent instance if a corresponding entry was found, null otherwise.
-
getEntryAsNativeLibrary
Description copied from interface:ContentThis method returns the named entry as a file in the file system for use as a native library. It may not be possible for all content implementations (e.g., memory only) to implement this method, in which case it is acceptable to return null. Since native libraries can only be associated with a single class loader, this method should return a unique file per request.
- Specified by:
getEntryAsNativeLibraryin interfaceContent- Parameters:
name- The name of the entry to retrieve as a file.- Returns:
- A string corresponding to the absolute path of the file if a corresponding entry was found, null otherwise.
-
getEntryAsURL
Description copied from interface:ContentThis method allows retrieving an entry as a local URL.
- Specified by:
getEntryAsURLin interfaceContent- Parameters:
name- The name of the entry to retrieve as a URL- Returns:
- A URL using a local protocol such as file, jar or null if not possible.
-
getContentTime
- Specified by:
getContentTimein interfaceContent
-