-
Notifications
You must be signed in to change notification settings - Fork 0
GridManager
The GridManager is responsible for managing the life-cycle of bundles deployed via the grid’s infrastructure. It is also responsible for accepting method calls to services offered by those bundles. Since neither bundle lifecycle actions nor service method calls are initiated locally, a Java interface is not a necessity. Instead the manager has to expose its API to remote clients. We decided to use HTTP for this.
Unless you want to manually push bundles to a node, you should never have to call this API yourself. It’s automatically called by the aspect GridWeaver into your code.
The following actions are offered:
- install a bundle
- uninstall a bundle
- start a bundle
- stop a bundle
In this context a bundle is uniquely specified by its symbolic name and its version number (both manifest headers).
So a call to any of the methods mentioned above has the form:
http://hostname:port/bundlebee/manager/methodname/symbolicname/versionnumber
Obviously, hostname, port, methodname, symbolicname and versionnumber have to be replaced with meaningful values.
hostname for the local manager defaults to the local address (not localhost), but can also be set manually through the system property org.bundlebee.manager.localaddress
.
port for the built-in HTTP server is specified through the system property org.osgi.service.http.port
.
Possible values for methodname are:
- install
- uninstall
- start
- stop
Note, that since we are not getting anything from the server, we need to POST these requests.
Response statuscodes are defined as follows:
- 200 – Success
- 400 – The server was unable to figure out what symbolicname and version you want
- 500 – Whatever you tried didn’t work out.
Just like the lifecycle management API, you should never have to call it yourself. It’s called by the aspect GridWeaver into your code.
Actually calling a method on a remote bundle can be achieved by calling a URL that follows this pattern:
http://hostname:port/bundlebee/manager/service
Only the HTTP POST method is supported and the caller needs to send a serialized org.bundlebee.remoteservicecall.Call
object, the response is a serialized org.bundlebee.remoteservicecall.Result
object.
The complete call can easily be handled by org.bundlebee.remoteservicecall.Call#send(java.net.URL)
, which hides most of the remote functionality.
Response statuscodes are defined as follows:
- 200 – Success, the body contains the return value.
- 404 – The service couldn’t be located, the body may contain more info, like a serialized exception.
- 500 – Whatever you tried didn’t work out.