public class DocksModel
extends java.util.Observable
implements org.osgi.service.event.EventHandler
Constructor and Description |
---|
DocksModel(org.osgi.framework.BundleContext context)
Constructor of the dock model
|
Modifier and Type | Method and Description |
---|---|
protected void |
finalize()
Unregister the listener
|
java.util.Collection<DockModel> |
getAllDocks()
Returns a collection of all docks currently known in this dock model
|
DockModel |
getBestFreeDock()
Gets the next best free dock from the list of unused docks.
|
DockModel |
getDockById(java.lang.String dockId)
Return the dock status model with of the dock with the given ID
|
protected DockModel |
getDockByURI(ch.ethz.iks.r_osgi.URI uri)
Retrieve a dock status model by the docks URI.
|
java.util.List<DockModel> |
getLocalDocks()
Return a list of all local docks
|
java.util.List<DockModel> |
getRemoteDocks()
Return a list of all remote docks
|
void |
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 model
|
public DocksModel(org.osgi.framework.BundleContext context)
context
- The bundle context of the plugin which contains the dock model. Used to interact
with OSGi's event service and remote OSGiprotected void finalize() throws java.lang.Throwable
finalize
in class java.lang.Object
java.lang.Throwable
Object.finalize()
protected void removeDock(DockModel dock)
dock
- The dock which has been removed externallyprotected DockModel getDockByURI(ch.ethz.iks.r_osgi.URI uri)
uri
- The URI of the dock to retrievepublic java.util.Collection<DockModel> getAllDocks()
public DockModel getBestFreeDock() throws java.lang.InterruptedException
java.lang.InterruptedException
- Execption when the thread is terminatedpublic java.util.List<DockModel> getLocalDocks()
public java.util.List<DockModel> getRemoteDocks()
public void handleEvent(org.osgi.service.event.Event event)
handleEvent
in interface org.osgi.service.event.EventHandler
EventHandler.handleEvent(org.osgi.service.event.Event)
public DockModel getDockById(java.lang.String dockId)
dockId
- ID of the dock to retrieve. The dock with the given ID has to exist