Package org.eclipse.osgi.container
Class Module
java.lang.Object
org.eclipse.osgi.container.Module
- All Implemented Interfaces:
- Comparable<Module>,- BundleReference,- BundleStartLevel
- Direct Known Subclasses:
- SystemModule
public abstract class Module
extends Object
implements BundleReference, BundleStartLevel, Comparable<Module>
A module represents a set of revisions installed in a module
 
container.- Since:
- 3.10
- 
Nested Class SummaryNested ClassesModifier and TypeClassDescriptionstatic enumAn enumeration of persistent settings for a modulestatic enumThe possible start options for a modulestatic enumAn enumeration of the possiblestatesa module may be in.static enumThe possible start options for a module
- 
Field SummaryFieldsModifier and TypeFieldDescriptionstatic final EnumSet<Module.State>A set ofstatesthat indicate a module is active.static final EnumSet<Module.State>A set ofstatesthat indicate a module is resolved.
- 
Constructor SummaryConstructorsConstructorDescriptionModule(Long id, String location, ModuleContainer container, EnumSet<Module.Settings> settings, int startlevel) Constructs a new module with the specified id, location and container.
- 
Method SummaryModifier and TypeMethodDescriptionprotected abstract voidcleanup(ModuleRevision revision) The container is done with the revision and it has been completely removed.final intfinal ModuleContainerReturns the module container this module is contained in.final ModuleRevisionReturns the currentrevisionassociated with this module.final LonggetId()Returns the module id.final longReturns the time when this module was last modified.final StringReturns the module locationfinal ModuleRevisionsReturns theModuleRevisionsassociated with this module.final intfinal Module.StategetState()Returns the currentstateof this module.final ThreadReturns the thread that currently owns the state change lock for this module, ornullif not owned.final booleanholdsTransitionEventLock(ModuleContainerAdaptor.ModuleEvent transitionEvent) Returns true if the current thread holds the state change lock for the specified transition event.final booleanbooleanReturns if this module should be activated in parallel with other modules that have the samestart level.final booleanprotected final voidlockStateChange(ModuleContainerAdaptor.ModuleEvent transitionEvent) Acquires the module lock for state changes by the current thread for the specified transition event.voidsetParallelActivation(boolean parallelActivation) Set if this module should be activated in parallel with other modules that have the samestart level.final voidsetStartLevel(int startLevel) voidstart(Module.StartOptions... options) Starts this moduleprotected voidPerforms any work associated with starting a module.voidstop(Module.StopOptions... options) Stops this module.protected voidPerforms any work associated with stopping a module.toString()protected final voidunlockStateChange(ModuleContainerAdaptor.ModuleEvent transitionEvent) Releases the lock for state changes for the specified transition event.Methods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.osgi.framework.BundleReferencegetBundle
- 
Field Details
- 
Constructor Details- 
Modulepublic Module(Long id, String location, ModuleContainer container, EnumSet<Module.Settings> settings, int startlevel) Constructs a new module with the specified id, location and container.- Parameters:
- id- the new module id
- location- the new module location
- container- the container for the new module
- settings- the persisted settings. May be- nullif there are no settings.
- startlevel- the persisted start level or initial start level.
 
 
- 
- 
Method Details- 
getIdReturns the module id.- Returns:
- the module id.
 
- 
getLocationReturns the module location- Returns:
- the module location
 
- 
getRevisionsReturns theModuleRevisionsassociated with this module.- Returns:
- the ModuleRevisionsassociated with this module
 
- 
getContainerReturns the module container this module is contained in.- Returns:
- the module container.
 
- 
getCurrentRevisionReturns the currentrevisionassociated with this module. If the module is uninstalled then the last current revision is returned.- Returns:
- the current revisionassociated with this module.
 
- 
getStateReturns the currentstateof this module.- Returns:
- the current state of this module.
 
- 
getStartLevelpublic final int getStartLevel()- Specified by:
- getStartLevelin interface- BundleStartLevel
 
- 
setStartLevelpublic final void setStartLevel(int startLevel) - Specified by:
- setStartLevelin interface- BundleStartLevel
 
- 
isPersistentlyStartedpublic final boolean isPersistentlyStarted()- Specified by:
- isPersistentlyStartedin interface- BundleStartLevel
 
- 
isActivationPolicyUsedpublic final boolean isActivationPolicyUsed()- Specified by:
- isActivationPolicyUsedin interface- BundleStartLevel
 
- 
getLastModifiedpublic final long getLastModified()Returns the time when this module was last modified. A module is considered to be modified when it is installed, updated or uninstalled.The time value is a the number of milliseconds since January 1, 1970, 00:00:00 UTC. - Returns:
- the time when this bundle was last modified.
 
- 
lockStateChangeprotected final void lockStateChange(ModuleContainerAdaptor.ModuleEvent transitionEvent) throws BundleException Acquires the module lock for state changes by the current thread for the specified transition event. Certain transition events locks may be nested within other transition event locks. For example, a resolved transition event lock may be nested within a started transition event lock. A stopped transition lock may be nested within an updated, unresolved or uninstalled transition lock.- Parameters:
- transitionEvent- the transition event to acquire the lock for.
- Throws:
- BundleException
 
- 
unlockStateChangeReleases the lock for state changes for the specified transition event.
- 
holdsTransitionEventLockReturns true if the current thread holds the state change lock for the specified transition event.- Returns:
- true if the current thread holds the state change lock for the specified transition event.
 
- 
getStateChangeOwnerReturns the thread that currently owns the state change lock for this module, ornullif not owned.- Returns:
- the owner, or nullif not owned.
 
- 
startStarts this module- Parameters:
- options- the options for starting
- Throws:
- BundleException- if an errors occurs while starting
 
- 
stopStops this module.- Parameters:
- options- options for stopping
- Throws:
- BundleException- if an error occurs while stopping
 
- 
compareTo- Specified by:
- compareToin interface- Comparable<Module>
 
- 
startWorkerPerforms any work associated with starting a module. For example, loading and calling start on an activator.- Throws:
- BundleException- if there was an exception starting the module
 
- 
stopWorkerPerforms any work associated with stopping a module. For example, calling stop on an activator.- Throws:
- BundleException- if there was an exception stopping the module
 
- 
toString
- 
setParallelActivationpublic void setParallelActivation(boolean parallelActivation) Set if this module should be activated in parallel with other modules that have the samestart level.- Parameters:
- parallelActivation- true if the module should be started in parallel; false otherwise
- Since:
- 3.15
 
- 
isParallelActivatedpublic boolean isParallelActivated()Returns if this module should be activated in parallel with other modules that have the samestart level.- Returns:
- true if the module should be started in parallel; false otherwise
- Since:
- 3.15
 
- 
cleanupThe container is done with the revision and it has been completely removed. This method allows the resources behind the revision to be cleaned up.- Parameters:
- revision- the revision to clean up
 
 
-