|
Siena (v.1.5.5) API documentation | |||||||
PREV NEXT | FRAMES NO FRAMES |
See:
Description
Packages | |
---|---|
siena | Core components of the Siena API and server |
siena.comm | Communication mechanisms used by Siena. |
This is the documentation of the implementation of Siena for the Java language.
Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.1 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts and no Back-Cover Texts. A copy of the license is included in the section entitled "GNU Free Documentation License".
Please, send comments, suggestions, complaints about this documentation to Antonio Carzaniga <(firstname.lastname@unisi.ch)>.
Siena
interface. An application
typically uses an implementation of the Siena interface to publish
Notification
s or to subscribe
for some notifications of interest.
AttributeValue
). For
example:
|
Attribute names must be unique in a notifications.
Filter
. A filter is a
conjunction (logical and) of constraints on specific
attributes of a notification (see AttributeConstraint
). For example:
|
A filter can have more than one constraint for the same attribute.
Pattern
.
The current implementation supports the simple form of pattern
given by a sequence of filters.
Notifiable
interface.
Siena delivers notifications to a subscriber by calling the
notify
method on the subscriber object. Notifiable has
two variants of the notify method: notify(Notification n)
is
called to notify a single notification, while notify(Notification
s[])
is called to notify a sequence of notifications.
A subscriber must provide both implementations, even if it will never receive sequences of notifications. In this case, the subscriber can implement:
public void notify(Notification[] s) {};
HierarchicalDispatcher
class. An
instance of HierarchicalDispatcher
must be created,
and possibly connected to an external network of Siena servers.
For example:
HierarchicalDispatcher mySiena = new HierarchicalDispatcher();
Notifiable subscriber;
// ... subscriber = ...
Filter f = new Filter();
f.addConstraint("message", OP.ANY, null);
mySiena.subscribe(f, subscriber);
// ...
Notification n = new Notification();
n.putAttribute("message","Hello, World!");
mySiena.publish(n);
// ...
Notice that many different subscribers and publishers can use the
same HierarchicalDispatcher
object as their Siena
access point. In fact, HierarchicalDispatcher
performs some optimizations by exploiting commonalities among local
subscriptions, therefore it is best to create and use only one
dispatcher per virtual machine.
ThinClient
class. A
ThinClient
object implements the Siena
interface, but it does not provide a Siena service itself: it
simply forwards every publication and every subscription to the
remote server, and passes any incoming notification to its
subscriber.
Clients use a ThinClient
just like any other Siena
interface. A publisher creates a ThinClient
object
and publishes notifications to it. A subscriber creates a
ThinClient
object and subscribes.
For example:
ThinClient mySiena = new ThinClient("tcp:host.domain:4321");
Notifiable subscriber;
// ... subscriber = ...
Filter f = new Filter();
f.addConstraint("message", OP.ANY, null);
mySiena.subscribe(f, subscriber);
// ...
Notification n = new Notification();
n.putAttribute("message","Hello, World!");
mySiena.publish(n);
// ...
StartServer
.
For example:
java siena.StartServer -port 4321 -master tcp:host.domain:5432starts up a Siena server, on the local host, using port 4321, and connecting it to another Siena server running on host "host.domain" on port 5432.
This building block can be used to create a network of servers (with a hierarchical topology). It is important to create the network of Siena servers according to the topology of the underlying network. For example, suppose you have an existing topology of servers, one running in the cs.colorado.edu domain and one running at ics.uci.edu, and suppose you want to run another server at cs.colorado.edu, then the obvious thing to do is to connect it to the server running at cs.colorado.edu.
InterestedParty.java
, and
a simple object of interest in ObjectOfInterest.java
.
|
Siena (v.1.5.5) API documentation | |||||||
PREV NEXT | FRAMES NO FRAMES |