OSGi Access
Overview
OSGi Access
is an API defined to manage remotely an OSGi framework
independently of the technology used in the agent.
The
purpose
is to assure that the applications doesn’t depends on the
Management Agent that
runs in the framework. If the Management agent changes we only must to
implement the OSGi Access API for the new agent. The main reason to
create this API is the lack of a specification of remote management in
the OSGi fraework.
The
API
includes:
- Connection interface.
- ConnectionFactory class.
- ConnectionPool class.
- Several interfaces for manage the framework and
some standard services:
FrameWorkAccess, BundleAccess, ServiceAccess, StartLevelAccess,
etc… This
interfaces are implemented by the managed components that are
registered in the connection object.
- Specific exception to be thrown instead of the
captured exceptions of the implementations.
Other characteristics that will be included soon:
- Notification
of OSGi events.
- JUnit tests
to validate API implementations (and/or the framework).
Implementing
the API
There
are two implementations of this API for two management agents:
JMood and TID-JMA4O.
But
both agents use JMX
technology. It should
be interesting to validate the API for agents that use other
instrumentation/management technologies.
Usage
To use the API, you
need the osgi-access.jar
library
and one implementation. What is needed for each implementation depends
on the own implementation, but there are some share requisites. Of
course, one management agent must be running on an OSGi Framework
(JMood and TID-JMA4O runs in
OSCAR and
Knopflerfish frameworks).
Common
requisites for JMood and TID-JMAO4:
The .jar files distributed have been compiled with
j2sdk1.4.2, but have
been succesfully tested in
j2sdk1.5 too. If you use j2sdk1.4.2 you will
need some libraries of the
MX4J
project (mx4j.jar, mx4j-remote.jar and mx4j-tools.jar).
Requisites
for JMood:
The distribution includes a /jmood-impl directory with JMood.properties
(example of properties needed to create a conection),
osgi-access_jmood_impl.jar (implementation of OSGi Access for
JMood) and jmood-lib.jar (some classes of the JMood agente needed to
compile and run this impl).
Requisites
for TID-JMA4O:
The distribution includes a /tid-jma4o-impl directory with
tid-jma4o.properties
(example of properties needed to create a conection),
osgi-access_tid-jma4o_impl.jar (implementation of OSGi Access
for TID-JMA4O impl.).
An
example of how the
API can be used.
Create a connection:
Connection conn =
ConnectionFactory.newOSGiConnection(props,null);
The
connection factory needs a java.util.Properties object and a
classloader (if
you want to specify one). In this properties file must exists the
property
“osgi.connection.class” that specify what class
must be instantiated with this
properties as argument. The
distribution includes a default properties file for each implemented
agent.
All
the
other properties are no relevant for the API. The properties are the
needed by
the implementations (and can be completely different in case of
different
implementations).
When
you
have a connection object, you can get Managed Components (that has been
loaded
by the connection when created) through the interfaces. For example:
FrameworkAccess framAcc =
(FrameworkAccess)
conn.getManagedComponent(AccessConstants.FRAMEWORK);
BundleAccess bundleAcc = framAcc.getBundleById(new
Long(bundleId));
Its
important to denote that the
“AccessConstants.FRAMEWORK” string is used to
recover and expected managed component. We recover the managed
components with
this strings, and the implementations of Connection interface must
register the
managed components with the associated string defined in
“AccessConstants”.
Project Status
This API is under
development and
the actual version can't be consider as stable version. Many
improvements and changes should be done for the first version, but what
it's done works and you can see and example of an application based on
OSGi Access in the
OSGi
Manager project.
License
OSGi Access is
distributed under the
GNU Lesser General Public License,
LGPL, for detailed information visit
LGPL
The two availables implementations are distributed under GPL license too.
Team
OSGi Access has been developed in the context of the participation of
the
Departamento de
Ingeniería Telemática (DIT) and of the
Universidad Politécnica
de Madrid (UPM) in the
ITEA-OSMOSE
project.
OSGi Access programs and documentation have been created by Miguel
García, Manuel Santillan, Jose Luis Ruiz and Juan C.
Dueñas.
OSGi Access R4 is the updated version for OSGi Release 4 frameworks and its maintained and developed by Telefonica I+D in the context of the
ITEA-OSIRIS
project.