com.kuka.resource
Interface IResourceManager


public interface IResourceManager

User interface of the resource manager. The resource manager maintains a central list of all resources (IResource) in the station.

Resources are registered at the resource manager as completely instantiated and fully operational objects. Resources can also potentially leave the system at any time when they become unavailable and are unregistered.

You can request for a specific resource using its unique name or query for resources that have certain capabilities.


Method Summary
 void addResourceListener(IResourceManagerListener listener)
          Adds a listener to the resource manager.
 Collection<IResource> getAllResources()
          Returns all registered resources.
 IResource getResource(String name)
          Returns a registered resource with the given name in the local context.
 Collection<IResource> getResources(Class<?>... capabilities)
          Returns every registered resource providing at least all the requested capabilities.
 Collection<IResource> getResources(Collection<Class<?>> capabilities)
          Returns every registered resource providing at least the requested capabilities.
 void removeResourceListener(IResourceManagerListener listener)
          Removes a previously registered listener from the resource manager.
 IResource tryGetResource(String name)
          Returns a registered resource with the given name in the local context or null if no resource with such name is registered.
 

Method Detail

getAllResources

Collection<IResource> getAllResources()
Returns all registered resources.

Returns:
a read only collection of registered resources. Returns an empty collection if none found.

getResource

IResource getResource(String name)
                      throws ResourceNotRegisteredException
Returns a registered resource with the given name in the local context.

A ResourceNotRegisteredException is thrown if no resource with such name is registered.

Parameters:
name - the name of a resource
Returns:
the registered resource with the given name
Throws:
ResourceNotRegisteredException - if a resource with the given name is not registered.

tryGetResource

IResource tryGetResource(String name)
Returns a registered resource with the given name in the local context or null if no resource with such name is registered.

Parameters:
name - the name of a resource
Returns:
the registered resource with the given name or null

getResources

Collection<IResource> getResources(Class<?>... capabilities)
Returns every registered resource providing at least all the requested capabilities.

A requested capability is searched only by direct implementations of the class. I.e. the capability should be registered at a resource under the specified interface, inheritance hierarchy of he implementing class will be ignored.

Parameters:
capabilities - a list of capabilities to look for. Double instances are ignored.
Returns:
resources providing the requested capabilities. Returns an empty collection if none found.

getResources

Collection<IResource> getResources(Collection<Class<?>> capabilities)
Returns every registered resource providing at least the requested capabilities. Double instances are ignored.

A requested capability is searched only by direct implementations of the class. I.e. the capability should be registered at resource under the specified interface, inheritance hierarchy of he implementing class will be ignored.

Parameters:
capabilities - a list of capabilities to look for. Double instances are ignored.
Returns:
resources providing requested capabilities. Returns an empty collection if none found.

addResourceListener

void addResourceListener(IResourceManagerListener listener)
Adds a listener to the resource manager. The listener is notified when resources are registered and unregistered.

Parameters:
listener - a listener to be registered for event notifications.

removeResourceListener

void removeResourceListener(IResourceManagerListener listener)
Removes a previously registered listener from the resource manager.

Parameters:
listener - a listener to be removed from event notifications.


Copyright © 2019. All rights reserved.