Information Technology Reference
In-Depth Information
ExecutorService
class). Group-type specializations of the goal handler class exist, such
as
ANDGoalHandler
and
ORGoalHandler
, which are used, respectively, to define con-
junctions and disjunctions of groups of service goals. Noticeably, using group goal
handlers breaks the POJO programming model, as the developer needs to incorporate
these
Self
-OSGi specific classes into its code.
Finally, the
Self
-OSGI
PerformanceMonitor
class collects the performance statis-
tics for all the component plan options. This class associates a priority to each compo-
nent option. By default, the priority is computed by considering both the success rate
(the rate between the number of successful invocation and the total number of invoca-
tion) and the speed to which the component had satisfied past requests, but the devel-
oper can easily fit other, application or domain-specific ranking mechanisms. As other
features of
Self
-OSGi, this is done by leveraging the OSGi service registry to regis-
ter ranking components, execution schedulers, and other application or domain-specific
service, which will be then retrieved and used by
Self
-OSGi.
6T s
Self
-OSGi is being used to refactor a number of pre-existing applications, including
robot control and distributed information retrieval systems. Developers can add Self-
* capabilities to their OSGi applications by using the Self-OSGi Core bundle (which
consumes 31K on the file system).
6.1
Robotic Example
As a way of example, the following is part of the XML documents describing a
MoveTo
,
a
CameraLocalization
and a
LaserLocalization
component plans used by a mobile robot
agent.
In order to clarify its correspondence with the BDI model it represents, each XML is
preceded with a comment in the ECA form
e
:
P
where
P
is the body of the plan,
e
is the event that triggers the plan (the plan's post-conditions), and
Ψ
←
is the context for
which the plan can be applied (which corresponds to the preconditions of the plan).
GoalMoveTo
(
?
Agent
)
:
true
←{
achieve
(
GoalLocalization
(
?
Agent
))
;
...}
Ψ
<scr:component ... factory="Navigation" name="MoveTo">
<implementation class= "MoveTo"/>
<property name="?Agent" type="String" value="The name of the robot
supposed to move">
<service>
<provide interface="GoalNavigation"/>
</service>
<reference cardinality="0..1" interface= "GoalLocalization"
policy="dynamic" target="(Agent=?Agent)>
</scr:component>
GoalLocalization
(
?
Agent
)
:
(
light
>
30
)
←{
achieve
(
GoalVideo
(
?
Agent
))
;
...}
<scr:component ... factory="CameraLocalization"
name="CameraLocalization">