Package org.osgi.service.rest.client
Interface RestClient
@ProviderType
public interface RestClient
A Java client API for a REST service endpoint.
Provides a Java client API for accessing and managing a remote OSGi framework through the REST API. Implementations of this interface will usually take the URL to the remote REST Management Service instance as an argument in their constructor. Further arguments might be needed, for example, if the cloud provider requires URL signing.
-
Method Summary
Modifier and TypeMethodDescriptiongetBundle
(long id) Retrieve the bundle representation for a given bundle Id.Retrieve the bundle representation for a given bundle path.getBundleHeaders
(long id) Get the header for a bundle given by its bundle Id.getBundleHeaders
(String bundlePath) Get the header for a bundle given by its URI path.Get the bundles currently installed on the managed framework.Get the bundle representations for all bundles currently installed in the managed framework.getBundleStartLevel
(long id) Get the start level for a bundle given by its bundle Id.getBundleStartLevel
(String bundlePath) Get the start level for a bundle given by its URI path.int
getBundleState
(long id) Get the state for a given bundle Id.int
getBundleState
(String bundlePath) Get the state for a given bundle path.Retrieves the current framework start level.Gets a collection of URI paths to all installed services.getServicePaths
(String filter) Gets a collection of URI paths to all installed services.getServiceReference
(long id) Get the service representation for a service given by its service Id.getServiceReference
(String servicePath) Get the service representation for a service given by its URI path.Get the service representations for all services.getServiceReferences
(String filter) Get the service representations for all services.installBundle
(String location) Install a new bundle given by an externally reachable location string, typically describing a URL.installBundle
(String location, InputStream in) Install a new bundle given by anInputStream
to a bundle content.void
setBundleStartLevel
(long id, int startLevel) Set the start level for a bundle given by its bundle Id.void
setBundleStartLevel
(String bundlePath, int startLevel) void
setFrameworkStartLevel
(FrameworkStartLevelDTO startLevel) Sets the current framework start level.void
startBundle
(long id) Start a bundle given by its bundle Id.void
startBundle
(long id, int options) Start a bundle given by its bundle Id.void
startBundle
(String bundlePath) Start a bundle given by its URI path.void
startBundle
(String bundlePath, int options) Start a bundle given by its URI path.void
stopBundle
(long id) Stop a bundle given by its bundle Id.void
stopBundle
(long id, int options) Stop a bundle given by its bundle Id.void
stopBundle
(String bundlePath) Stop a bundle given by its URI path.void
stopBundle
(String bundlePath, int options) Stop a bundle given by its URI path.uninstallBundle
(long id) Uninstall a bundle given by its bundle Id.uninstallBundle
(String bundlePath) Uninstall a bundle given by its URI path.updateBundle
(long id) Updates a bundle given by its bundle Id using the bundle-internal update location.updateBundle
(long id, InputStream in) Updates a bundle given by its bundle Id and passing the new bundle content in the form of anInputStream
.updateBundle
(long id, String url) Updates a bundle given by its URI path using the content at the specified URL.
-
Method Details
-
getFrameworkStartLevel
Retrieves the current framework start level.- Returns:
- Returns the current framework start level in the form of a
FrameworkStartLevelDTO
. - Throws:
Exception
- An exception representing a failure in the underlying REST call.
-
setFrameworkStartLevel
Sets the current framework start level.- Parameters:
startLevel
- set the framework start level to this target.- Throws:
Exception
- An exception representing a failure in the underlying REST call.
-
getBundlePaths
Get the bundles currently installed on the managed framework.- Returns:
- Returns a collection of the bundle URIs in the form of Strings. The URIs are relative to the REST API root URL and can be used to retrieve bundle representations.
- Throws:
Exception
- An exception representing a failure in the underlying REST call.
-
getBundles
Get the bundle representations for all bundles currently installed in the managed framework.- Returns:
- Returns a collection of BundleDTO objects.
- Throws:
Exception
- An exception representing a failure in the underlying REST call.
-
getBundle
Retrieve the bundle representation for a given bundle Id. -
getBundle
Retrieve the bundle representation for a given bundle path. -
getBundleState
Get the state for a given bundle Id.- Parameters:
id
- Addresses the bundle by its identifier.- Returns:
- Returns the current bundle state as defined in (@link org.osgi.framework.Bundle}.
- Throws:
Exception
- An exception representing a failure in the underlying REST call.
-
getBundleState
Get the state for a given bundle path.- Parameters:
bundlePath
- Addresses the bundle by its URI path.- Returns:
- Returns the current bundle state as defined in (@link org.osgi.framework.Bundle}.
- Throws:
Exception
- An exception representing a failure in the underlying REST call.
-
startBundle
Start a bundle given by its bundle Id.- Parameters:
id
- Addresses the bundle by its identifier.- Throws:
Exception
- An exception representing a failure in the underlying REST call.
-
startBundle
Start a bundle given by its URI path.- Parameters:
bundlePath
- Addresses the bundle by its URI path.- Throws:
Exception
- An exception representing a failure in the underlying REST call.
-
startBundle
Start a bundle given by its bundle Id.- Parameters:
id
- Addresses the bundle by its identifier.options
- Passes additional options as defined inBundle.start(int)
- Throws:
Exception
- An exception representing a failure in the underlying REST call.
-
startBundle
Start a bundle given by its URI path.- Parameters:
bundlePath
- Addresses the bundle by its URI path.options
- Passes additional options as defined inBundle.start(int)
- Throws:
Exception
- An exception representing a failure in the underlying REST call.
-
stopBundle
Stop a bundle given by its bundle Id.- Parameters:
id
- Addresses the bundle by its identifier.- Throws:
Exception
- An exception representing a failure in the underlying REST call.
-
stopBundle
Stop a bundle given by its URI path.- Parameters:
bundlePath
- Addresses the bundle by its URI path.- Throws:
Exception
- An exception representing a failure in the underlying REST call.
-
stopBundle
Stop a bundle given by its bundle Id.- Parameters:
id
- Addresses the bundle by its identifier.options
- Passes additional options as defined inBundle.stop(int)
- Throws:
Exception
- An exception representing a failure in the underlying REST call.
-
stopBundle
Stop a bundle given by its URI path.- Parameters:
bundlePath
- Addresses the bundle by its URI path.options
- Passes additional options as defined inBundle.stop(int)
- Throws:
Exception
- An exception representing a failure in the underlying REST call.
-
getBundleHeaders
Get the header for a bundle given by its bundle Id.- Parameters:
id
- Addresses the bundle by its identifier.- Returns:
- Returns the map of headers entries.
- Throws:
Exception
- An exception representing a failure in the underlying REST call.
-
getBundleHeaders
Get the header for a bundle given by its URI path.- Parameters:
bundlePath
- Addresses the bundle by its URI path.- Returns:
- Returns the map of headers entries.
- Throws:
Exception
- An exception representing a failure in the underlying REST call.
-
getBundleStartLevel
Get the start level for a bundle given by its bundle Id.- Parameters:
id
- Addresses the bundle by its identifier.- Returns:
- Returns a
BundleStartLevelDTO
describing the current start level of the bundle. - Throws:
Exception
- An exception representing a failure in the underlying REST call.
-
getBundleStartLevel
Get the start level for a bundle given by its URI path.- Parameters:
bundlePath
- Addresses the bundle by its URI path.- Returns:
- Returns a
BundleStartLevelDTO
describing the current start level of the bundle. - Throws:
Exception
- An exception representing a failure in the underlying REST call.
-
setBundleStartLevel
Set the start level for a bundle given by its bundle Id.- Parameters:
id
- Addresses the bundle by its identifier.startLevel
- The target start level.- Throws:
Exception
- An exception representing a failure in the underlying REST call.
-
setBundleStartLevel
- Parameters:
bundlePath
- Addresses the bundle by its URI path.startLevel
- The target start level.- Throws:
Exception
- An exception representing a failure in the underlying REST call.
-
installBundle
Install a new bundle given by an externally reachable location string, typically describing a URL. -
installBundle
Install a new bundle given by anInputStream
to a bundle content. -
uninstallBundle
Uninstall a bundle given by its bundle Id. -
uninstallBundle
Uninstall a bundle given by its URI path. -
updateBundle
Updates a bundle given by its bundle Id using the bundle-internal update location. -
updateBundle
Updates a bundle given by its URI path using the content at the specified URL. -
updateBundle
Updates a bundle given by its bundle Id and passing the new bundle content in the form of anInputStream
. -
getServicePaths
Gets a collection of URI paths to all installed services.- Returns:
- Returns a collection of URI paths to the installed services.
- Throws:
Exception
- An exception representing a failure in the underlying REST call.
-
getServicePaths
Gets a collection of URI paths to all installed services.- Parameters:
filter
- Passes a filter to restrict the result set.- Returns:
- Returns a collection of URI paths to the installed services.
- Throws:
Exception
- An exception representing a failure in the underlying REST call.
-
getServiceReferences
Get the service representations for all services.- Returns:
- Returns the service representations in the form of
ServiceReferenceDTO
objects. - Throws:
Exception
- An exception representing a failure in the underlying REST call.
-
getServiceReferences
Get the service representations for all services.- Parameters:
filter
- Passes a filter to restrict the result set.- Returns:
- Returns the service representations in the form of
ServiceReferenceDTO
objects. - Throws:
Exception
- An exception representing a failure in the underlying REST call.
-
getServiceReference
Get the service representation for a service given by its service Id.- Parameters:
id
- Addresses the service by its identifier.- Returns:
- The service representation as
ServiceReferenceDTO
. - Throws:
Exception
- An exception representing a failure in the underlying REST call.
-
getServiceReference
Get the service representation for a service given by its URI path.- Parameters:
servicePath
- Addresses the service by its URI path.- Returns:
- The service representation as
ServiceReferenceDTO
. - Throws:
Exception
- An exception representing a failure in the underlying REST call.
-