Top Description Methods
org.osgi.service.rest.client

public Interface RestClient

Annotations
@ProviderType
Imports
java.io.InputStream, java.util.Collection, .Map, org.osgi.annotation.versioning.ProviderType, org.osgi.framework.dto.BundleDTO, .ServiceReferenceDTO, org.osgi.framework.startlevel.dto.BundleStartLevelDTO, .FrameworkStartLevelDTO

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.

Author
$Id: d9d76beee113e88629a436c0545dc31e6c47787f $

Method Summary

Modifier and TypeMethod and Description
public BundleDTO

Returns:

A BundleDTO for the requested bundle.
getBundle
(long
Addresses the bundle by its identifier.
id
)

Retrieve the bundle representation for a given bundle Id.

public BundleDTO

Returns:

A BundleDTO for the requested bundle.
getBundle
(String
Addresses the bundle by its URI path.
bundlePath
)

Retrieve the bundle representation for a given bundle path.

public Map<String, String>

Returns:

Returns the map of headers entries.
getBundleHeaders
(long
Addresses the bundle by its identifier.
id
)

Get the header for a bundle given by its bundle Id.

public Map<String, String>

Returns:

Returns the map of headers entries.
getBundleHeaders
(String
Addresses the bundle by its URI path.
bundlePath
)

Get the header for a bundle given by its URI path.

public Collection<String>

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.
getBundlePaths
()

Get the bundles currently installed on the managed framework.

public Collection<BundleDTO>

Returns:

Returns a collection of BundleDTO objects.
getBundles
()

Get the bundle representations for all bundles currently installed in the managed framework.

public BundleStartLevelDTO

Returns:

Returns a BundleStartLevelDTO describing the current start level of the bundle.
getBundleStartLevel
(long
Addresses the bundle by its identifier.
id
)

Get the start level for a bundle given by its bundle Id.

public BundleStartLevelDTO

Returns:

Returns a BundleStartLevelDTO describing the current start level of the bundle.
getBundleStartLevel
(String
Addresses the bundle by its URI path.
bundlePath
)

Get the start level for a bundle given by its URI path.

public int

Returns:

Returns the current bundle state as defined in (@link org.osgi.framework.Bundle}.
getBundleState
(long
Addresses the bundle by its identifier.
id
)

Get the state for a given bundle Id.

public int

Returns:

Returns the current bundle state as defined in (@link org.osgi.framework.Bundle}.
getBundleState
(String
Addresses the bundle by its URI path.
bundlePath
)

Get the state for a given bundle path.

public FrameworkStartLevelDTO

Returns:

Returns the current framework start level in the form of a FrameworkStartLevelDTO.
getFrameworkStartLevel
()

Retrieves the current framework start level.

public Collection<String>

Returns:

Returns a collection of URI paths to the installed services.
getServicePaths
()

Gets a collection of URI paths to all installed services.

public Collection<String>

Returns:

Returns a collection of URI paths to the installed services.
getServicePaths
(String
Passes a filter to restrict the result set.
filter
)

Gets a collection of URI paths to all installed services.

public ServiceReferenceDTO

Returns:

The service representation as ServiceReferenceDTO.
getServiceReference
(long
Addresses the service by its identifier.
id
)

Get the service representation for a service given by its service Id.

public ServiceReferenceDTO

Returns:

The service representation as ServiceReferenceDTO.
getServiceReference
(String
Addresses the service by its URI path.
servicePath
)

Get the service representation for a service given by its URI path.

public Collection<ServiceReferenceDTO>

Returns:

Returns the service representations in the form of ServiceReferenceDTO objects.
getServiceReferences
()

Get the service representations for all services.

public Collection<ServiceReferenceDTO>

Returns:

Returns the service representations in the form of ServiceReferenceDTO objects.
getServiceReferences
(String
Passes a filter to restrict the result set.
filter
)

Get the service representations for all services.

public BundleDTO

Returns:

Returns the BundleDTO of the newly installed bundle.
installBundle
(String
Passes the location string to retrieve the bundle content from.
location
)

Install a new bundle given by an externally reachable location string, typically describing a URL.

public BundleDTO

Returns:

Returns the BundleDTO of the newly installed bundle.
installBundle
(String
Passes the location string to be used to install the new bundle.
location
,
InputStream
Passes the input stream to a bundle.
in
)

Install a new bundle given by an InputStream to a bundle content.

public void
setBundleStartLevel(long
Addresses the bundle by its identifier.
id
,
int
The target start level.
startLevel
)

Set the start level for a bundle given by its bundle Id.

public void
setBundleStartLevel(String
Addresses the bundle by its URI path.
bundlePath
,
int
The target start level.
startLevel
)

public void
setFrameworkStartLevel(FrameworkStartLevelDTO
set the framework start level to this target.
startLevel
)

Sets the current framework start level.

public void
startBundle(long
Addresses the bundle by its identifier.
id
)

Start a bundle given by its bundle Id.

public void
startBundle(String
Addresses the bundle by its URI path.
bundlePath
)

Start a bundle given by its URI path.

public void
startBundle(long
Addresses the bundle by its identifier.
id
,
int
Passes additional options as defined in org.osgi.framework.Bundle#start(int)
options
)

Start a bundle given by its bundle Id.

public void
startBundle(String
Addresses the bundle by its URI path.
bundlePath
,
int
Passes additional options as defined in org.osgi.framework.Bundle#start(int)
options
)

Start a bundle given by its URI path.

public void
stopBundle(long
Addresses the bundle by its identifier.
id
)

Stop a bundle given by its bundle Id.

public void
stopBundle(String
Addresses the bundle by its URI path.
bundlePath
)

Stop a bundle given by its URI path.

public void
stopBundle(long
Addresses the bundle by its identifier.
id
,
int
Passes additional options as defined in org.osgi.framework.Bundle#stop(int)
options
)

Stop a bundle given by its bundle Id.

public void
stopBundle(String
Addresses the bundle by its URI path.
bundlePath
,
int
Passes additional options as defined in org.osgi.framework.Bundle#stop(int)
options
)

Stop a bundle given by its URI path.

public BundleDTO

Returns:

Returns the BundleDTO of the uninstalled bundle.
uninstallBundle
(long
Addresses the bundle by its identifier.
id
)

Uninstall a bundle given by its bundle Id.

public BundleDTO

Returns:

Returns the BundleDTO of the uninstalled bundle.
uninstallBundle
(String
Addresses the bundle by its URI path.
bundlePath
)

Uninstall a bundle given by its URI path.

public BundleDTO

Returns:

Returns the BundleDTO of the updated bundle.
updateBundle
(long
Addresses the bundle by its identifier.
id
)

Updates a bundle given by its bundle Id using the bundle-internal update location.

public BundleDTO

Returns:

Returns the BundleDTO of the updated bundle.
updateBundle
(long
Addresses the bundle by its identifier.
id
,
String
The URL whose content is to be used to update the bundle.
url
)

Updates a bundle given by its URI path using the content at the specified URL.

public BundleDTO

Returns:

Returns the BundleDTO of the updated bundle.
updateBundle
(long
Addresses the bundle by its identifier.
id
,
InputStream
Passes an input stream to the new bundle content.
in
)

Updates a bundle given by its bundle Id and passing the new bundle content in the form of an InputStream.

Method Detail

getBundleback to summary
public BundleDTO getBundle(long id) throws Exception

Retrieve the bundle representation for a given bundle Id.

Parameters
id:long

Addresses the bundle by its identifier.

Returns:BundleDTO

A BundleDTO for the requested bundle.

Exceptions
Exception:
An exception representing a failure in the underlying REST call.
getBundleback to summary
public BundleDTO getBundle(String bundlePath) throws Exception

Retrieve the bundle representation for a given bundle path.

Parameters
bundlePath:String

Addresses the bundle by its URI path.

Returns:BundleDTO

A BundleDTO for the requested bundle.

Exceptions
Exception:
An exception representing a failure in the underlying REST call.
getBundleHeadersback to summary
public Map<String, String> getBundleHeaders(long id) throws Exception

Get the header for a bundle given by its bundle Id.

Parameters
id:long

Addresses the bundle by its identifier.

Returns:Map<String, String>

Returns the map of headers entries.

Exceptions
Exception:
An exception representing a failure in the underlying REST call.
getBundleHeadersback to summary
public Map<String, String> getBundleHeaders(String bundlePath) throws Exception

Get the header for a bundle given by its URI path.

Parameters
bundlePath:String

Addresses the bundle by its URI path.

Returns:Map<String, String>

Returns the map of headers entries.

Exceptions
Exception:
An exception representing a failure in the underlying REST call.
getBundlePathsback to summary
public Collection<String> getBundlePaths() throws Exception

Get the bundles currently installed on the managed framework.

Returns:Collection<String>

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.

Exceptions
Exception:
An exception representing a failure in the underlying REST call.
getBundlesback to summary
public Collection<BundleDTO> getBundles() throws Exception

Get the bundle representations for all bundles currently installed in the managed framework.

Returns:Collection<BundleDTO>

Returns a collection of BundleDTO objects.

Exceptions
Exception:
An exception representing a failure in the underlying REST call.
getBundleStartLevelback to summary
public BundleStartLevelDTO getBundleStartLevel(long id) throws Exception

Get the start level for a bundle given by its bundle Id.

Parameters
id:long

Addresses the bundle by its identifier.

Returns:BundleStartLevelDTO

Returns a BundleStartLevelDTO describing the current start level of the bundle.

Exceptions
Exception:
An exception representing a failure in the underlying REST call.
getBundleStartLevelback to summary
public BundleStartLevelDTO getBundleStartLevel(String bundlePath) throws Exception

Get the start level for a bundle given by its URI path.

Parameters
bundlePath:String

Addresses the bundle by its URI path.

Returns:BundleStartLevelDTO

Returns a BundleStartLevelDTO describing the current start level of the bundle.

Exceptions
Exception:
An exception representing a failure in the underlying REST call.
getBundleStateback to summary
public int getBundleState(long id) throws Exception

Get the state for a given bundle Id.

Parameters
id:long

Addresses the bundle by its identifier.

Returns:int

Returns the current bundle state as defined in (@link org.osgi.framework.Bundle}.

Exceptions
Exception:
An exception representing a failure in the underlying REST call.
getBundleStateback to summary
public int getBundleState(String bundlePath) throws Exception

Get the state for a given bundle path.

Parameters
bundlePath:String

Addresses the bundle by its URI path.

Returns:int

Returns the current bundle state as defined in (@link org.osgi.framework.Bundle}.

Exceptions
Exception:
An exception representing a failure in the underlying REST call.
getFrameworkStartLevelback to summary
public FrameworkStartLevelDTO getFrameworkStartLevel() throws Exception

Retrieves the current framework start level.

Returns:FrameworkStartLevelDTO

Returns the current framework start level in the form of a FrameworkStartLevelDTO.

Exceptions
Exception:
An exception representing a failure in the underlying REST call.
getServicePathsback to summary
public Collection<String> getServicePaths() throws Exception

Gets a collection of URI paths to all installed services.

Returns:Collection<String>

Returns a collection of URI paths to the installed services.

Exceptions
Exception:
An exception representing a failure in the underlying REST call.
getServicePathsback to summary
public Collection<String> getServicePaths(String filter) throws Exception

Gets a collection of URI paths to all installed services.

Parameters
filter:String

Passes a filter to restrict the result set.

Returns:Collection<String>

Returns a collection of URI paths to the installed services.

Exceptions
Exception:
An exception representing a failure in the underlying REST call.
getServiceReferenceback to summary
public ServiceReferenceDTO getServiceReference(long id) throws Exception

Get the service representation for a service given by its service Id.

Parameters
id:long

Addresses the service by its identifier.

Returns:ServiceReferenceDTO

The service representation as ServiceReferenceDTO.

Exceptions
Exception:
An exception representing a failure in the underlying REST call.
getServiceReferenceback to summary
public ServiceReferenceDTO getServiceReference(String servicePath) throws Exception

Get the service representation for a service given by its URI path.

Parameters
servicePath:String

Addresses the service by its URI path.

Returns:ServiceReferenceDTO

The service representation as ServiceReferenceDTO.

Exceptions
Exception:
An exception representing a failure in the underlying REST call.
getServiceReferencesback to summary
public Collection<ServiceReferenceDTO> getServiceReferences() throws Exception

Get the service representations for all services.

Returns:Collection<ServiceReferenceDTO>

Returns the service representations in the form of ServiceReferenceDTO objects.

Exceptions
Exception:
An exception representing a failure in the underlying REST call.
getServiceReferencesback to summary
public Collection<ServiceReferenceDTO> getServiceReferences(String filter) throws Exception

Get the service representations for all services.

Parameters
filter:String

Passes a filter to restrict the result set.

Returns:Collection<ServiceReferenceDTO>

Returns the service representations in the form of ServiceReferenceDTO objects.

Exceptions
Exception:
An exception representing a failure in the underlying REST call.
installBundleback to summary
public BundleDTO installBundle(String location) throws Exception

Install a new bundle given by an externally reachable location string, typically describing a URL.

Parameters
location:String

Passes the location string to retrieve the bundle content from.

Returns:BundleDTO

Returns the BundleDTO of the newly installed bundle.

Exceptions
Exception:
An exception representing a failure in the underlying REST call.
installBundleback to summary
public BundleDTO installBundle(String location, InputStream in) throws Exception

Install a new bundle given by an InputStream to a bundle content.

Parameters
location:String

Passes the location string to be used to install the new bundle.

in:InputStream

Passes the input stream to a bundle.

Returns:BundleDTO

Returns the BundleDTO of the newly installed bundle.

Exceptions
Exception:
An exception representing a failure in the underlying REST call.
setBundleStartLevelback to summary
public void setBundleStartLevel(long id, int startLevel) throws Exception

Set the start level for a bundle given by its bundle Id.

Parameters
id:long

Addresses the bundle by its identifier.

startLevel:int

The target start level.

Exceptions
Exception:
An exception representing a failure in the underlying REST call.
setBundleStartLevelback to summary
public void setBundleStartLevel(String bundlePath, int startLevel) throws Exception
Parameters
bundlePath:String

Addresses the bundle by its URI path.

startLevel:int

The target start level.

Exceptions
Exception:
An exception representing a failure in the underlying REST call.
setFrameworkStartLevelback to summary
public void setFrameworkStartLevel(FrameworkStartLevelDTO startLevel) throws Exception

Sets the current framework start level.

Parameters
startLevel:FrameworkStartLevelDTO

set the framework start level to this target.

Exceptions
Exception:
An exception representing a failure in the underlying REST call.
startBundleback to summary
public void startBundle(long id) throws Exception

Start a bundle given by its bundle Id.

Parameters
id:long

Addresses the bundle by its identifier.

Exceptions
Exception:
An exception representing a failure in the underlying REST call.
startBundleback to summary
public void startBundle(String bundlePath) throws Exception

Start a bundle given by its URI path.

Parameters
bundlePath:String

Addresses the bundle by its URI path.

Exceptions
Exception:
An exception representing a failure in the underlying REST call.
startBundleback to summary
public void startBundle(long id, int options) throws Exception

Start a bundle given by its bundle Id.

Parameters
id:long

Addresses the bundle by its identifier.

options:int

Passes additional options as defined in org.osgi.framework.Bundle#start(int)

Exceptions
Exception:
An exception representing a failure in the underlying REST call.
startBundleback to summary
public void startBundle(String bundlePath, int options) throws Exception

Start a bundle given by its URI path.

Parameters
bundlePath:String

Addresses the bundle by its URI path.

options:int

Passes additional options as defined in org.osgi.framework.Bundle#start(int)

Exceptions
Exception:
An exception representing a failure in the underlying REST call.
stopBundleback to summary
public void stopBundle(long id) throws Exception

Stop a bundle given by its bundle Id.

Parameters
id:long

Addresses the bundle by its identifier.

Exceptions
Exception:
An exception representing a failure in the underlying REST call.
stopBundleback to summary
public void stopBundle(String bundlePath) throws Exception

Stop a bundle given by its URI path.

Parameters
bundlePath:String

Addresses the bundle by its URI path.

Exceptions
Exception:
An exception representing a failure in the underlying REST call.
stopBundleback to summary
public void stopBundle(long id, int options) throws Exception

Stop a bundle given by its bundle Id.

Parameters
id:long

Addresses the bundle by its identifier.

options:int

Passes additional options as defined in org.osgi.framework.Bundle#stop(int)

Exceptions
Exception:
An exception representing a failure in the underlying REST call.
stopBundleback to summary
public void stopBundle(String bundlePath, int options) throws Exception

Stop a bundle given by its URI path.

Parameters
bundlePath:String

Addresses the bundle by its URI path.

options:int

Passes additional options as defined in org.osgi.framework.Bundle#stop(int)

Exceptions
Exception:
An exception representing a failure in the underlying REST call.
uninstallBundleback to summary
public BundleDTO uninstallBundle(long id) throws Exception

Uninstall a bundle given by its bundle Id.

Parameters
id:long

Addresses the bundle by its identifier.

Returns:BundleDTO

Returns the BundleDTO of the uninstalled bundle.

Exceptions
Exception:
An exception representing a failure in the underlying REST call.
uninstallBundleback to summary
public BundleDTO uninstallBundle(String bundlePath) throws Exception

Uninstall a bundle given by its URI path.

Parameters
bundlePath:String

Addresses the bundle by its URI path.

Returns:BundleDTO

Returns the BundleDTO of the uninstalled bundle.

Exceptions
Exception:
An exception representing a failure in the underlying REST call.
updateBundleback to summary
public BundleDTO updateBundle(long id) throws Exception

Updates a bundle given by its bundle Id using the bundle-internal update location.

Parameters
id:long

Addresses the bundle by its identifier.

Returns:BundleDTO

Returns the BundleDTO of the updated bundle.

Exceptions
Exception:
An exception representing a failure in the underlying REST call.
updateBundleback to summary
public BundleDTO updateBundle(long id, String url) throws Exception

Updates a bundle given by its URI path using the content at the specified URL.

Parameters
id:long

Addresses the bundle by its identifier.

url:String

The URL whose content is to be used to update the bundle.

Returns:BundleDTO

Returns the BundleDTO of the updated bundle.

Exceptions
Exception:
An exception representing a failure in the underlying REST call.
updateBundleback to summary
public BundleDTO updateBundle(long id, InputStream in) throws Exception

Updates a bundle given by its bundle Id and passing the new bundle content in the form of an InputStream.

Parameters
id:long

Addresses the bundle by its identifier.

in:InputStream

Passes an input stream to the new bundle content.

Returns:BundleDTO

Returns the BundleDTO of the updated bundle.

Exceptions
Exception:
An exception representing a failure in the underlying REST call.