Class DocksModel
java.lang.Object
java.util.Observable
de.uka.ipd.sdq.codegen.simucontroller.dockmodel.DocksModel
- All Implemented Interfaces:
org.osgi.service.event.EventHandler
The dock model class is used to store the central model of the simulation docks. A simulation
dock is an OSGi service capable of accepting a simulation bundle. It simulates the bundle
informing is dock model via OSGi events of its progress. The dock model uses the events to
synchronize its view. It also uses remote OSGi events to discover new remote docks.
-
Constructor Summary
ConstructorDescriptionDocksModel
(org.osgi.framework.BundleContext context) Constructor of the dock model -
Method Summary
Modifier and TypeMethodDescriptionprotected void
finalize()
Unregister the listenerReturns a collection of all docks currently known in this dock modelGets the next best free dock from the list of unused docks.getDockById
(String dockId) Return the dock status model with of the dock with the given IDprotected DockModel
getDockByURI
(ch.ethz.iks.r_osgi.URI uri) Retrieve a dock status model by the docks URI.Return a list of all local docksReturn a list of all remote docksvoid
handleEvent
(org.osgi.service.event.Event event) Method to handle OSGi Events sent by the SimulationDock to inform about status updates (non-Javadoc).protected void
removeDock
(DockModel dock) Called by service unregister events to remove the dock from this modelMethods inherited from class java.util.Observable
addObserver, clearChanged, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers, setChanged
-
Constructor Details
-
DocksModel
public DocksModel(org.osgi.framework.BundleContext context) Constructor of the dock model- Parameters:
context
- The bundle context of the plugin which contains the dock model. Used to interact with OSGi's event service and remote OSGi
-
-
Method Details
-
finalize
Unregister the listener -
removeDock
Called by service unregister events to remove the dock from this model- Parameters:
dock
- The dock which has been removed externally
-
getDockByURI
Retrieve a dock status model by the docks URI. Returns null if the dock is unknown or a local dock.- Parameters:
uri
- The URI of the dock to retrieve- Returns:
- The requested dock or null if the dock does not exist or is local
-
getAllDocks
Returns a collection of all docks currently known in this dock model- Returns:
- A collection of all docks currently known in this dock model
-
getBestFreeDock
Gets the next best free dock from the list of unused docks. Waits for a dock to become available if all docks are busy. The dock is removed from the list of free docks.- Returns:
- The next best dock available to process a request
- Throws:
InterruptedException
- Execption when the thread is terminated
-
getLocalDocks
Return a list of all local docks- Returns:
- A list of local docks
-
getRemoteDocks
Return a list of all remote docks- Returns:
- A list of remote docks
-
handleEvent
public void handleEvent(org.osgi.service.event.Event event) Method to handle OSGi Events sent by the SimulationDock to inform about status updates (non-Javadoc). The method is not intended to be called directly!- Specified by:
handleEvent
in interfaceorg.osgi.service.event.EventHandler
- See Also:
-
EventHandler.handleEvent(org.osgi.service.event.Event)
-
getDockById
Return the dock status model with of the dock with the given ID- Parameters:
dockId
- ID of the dock to retrieve. The dock with the given ID has to exist- Returns:
- The model of the requested dock
-