Package com.viam.sdk.core.resource
Class ResourceManager
java.lang.Object
com.viam.sdk.core.resource.ResourceManager
- All Implemented Interfaces:
Closeable
,AutoCloseable
- Direct Known Subclasses:
Server
Manager containing all resources registered to this server.
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds a new resource with the manager.void
close()
Close the resource manager by removing all resources.<ResourceT>
ResourceTgetResource
(Class<ResourceT> resourceClass, Common.ResourceName name) Return a resource from the manager.boolean
void
Remove the resource with the specified ResourceName.
-
Field Details
-
resources
-
-
Constructor Details
-
ResourceManager
-
-
Method Details
-
add
Adds a new resource with the manager. Resources may not have the same name. If a resource is remote and the short name is unique, save a short name version.- Parameters:
resource
- The resource to add- Throws:
DuplicateResourceException
-
getResource
Return a resource from the manager. If a unique short name version is given, return a remote resource with the name.- Type Parameters:
ResourceT
- The type of the resource- Parameters:
name
- The name of the resource- Returns:
- The resource
-
removeResource
Remove the resource with the specified ResourceName.- Parameters:
name
- The ResourceName of the resource
-
isManaging
-
resourceNames
-
close
public void close()Close the resource manager by removing all resources. Please note that any errors will not throw an exception. Errors will still be logged.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
-