Jumpi v1.2.0

org.jumpi.impl
Class JumpiImpl

java.lang.Object
  |
  +--org.jumpi.impl.JumpiImpl
All Implemented Interfaces:
Component, Configurable, Jumpi, Jumpi, Manageable

public class JumpiImpl
extends java.lang.Object
implements Jumpi

The service provider implementation of the Jumpi component.


Field Summary
static java.lang.String VERSION
          The release version.
 
Constructor Summary
JumpiImpl()
          Creates a new Jumpi object.
 
Method Summary
 void configure(java.lang.String name, Properties props)
           Configure the JumpiImpl instance.
 Destination getDestination(java.lang.String url)
           Return a Destination corresponding to the Url through the default Controller.
 Destination getDestination(java.lang.String url, java.util.Hashtable clientProps)
           Return a Destination corresponding to the Url providing the implementation with implementation specific properties.
 Destination getDestination(java.lang.String controller, java.lang.String url)
           Return a Destination corresponding to the Url, associated with the named Controller.
 Destination getDestination(java.lang.String controllerName, java.lang.String url, java.util.Hashtable clientProps)
           Return a Destination corresponding to the Url, associated with the named Controller, providing the implementation with implementation specific properties.
 Logger getLogger()
          Get the Logger.
 java.lang.String getName()
          Get the fully qualified name of the instance.
 Selector getSelector()
          Get a new, empty Selector.
 SequenceGenerator getSequenceGenerator()
          Get the SequenceGenerator.
 TaskScheduler getTaskScheduler()
          Get the TaskScheduler.
 ThreadFactory getThreadFactory()
          Get the ThreadFactory.
 Timer getTimer()
          Get the Timer.
 java.lang.String getVersion()
          Get the version of the Jumpi implementation.
 void manage(Component root, Component parent, java.lang.String operation, java.util.Hashtable parameters)
          Perform a recursive management operation through the Jumpi component tree, using the parameters provided.
 void manage(java.util.Hashtable parameters)
          Manage a Jumpi instance.
 Handle recv(Destination dest)
          Start a receive operation from a Destination.
 Handle recv(Destination dest, java.util.Hashtable clientProps)
          Start a receive operation from a Destination.
 Handle recv(Destination dest, Selector sel)
          Start a receive operation from a Destination.
 Handle recv(Destination dest, Selector sel, java.util.Hashtable clientProps)
           Start a receive operation from a Destination, providing the implementation with implementation specific information as read-only properties.
 Handle send(Destination dest, java.lang.Object msg)
          Send a message to a Destination.
 Handle send(Destination dest, java.lang.Object msg, java.util.Hashtable clientProps)
          Send a message to a Destination.
 Handle send(Destination dest, java.lang.Object msg, Selector sel)
          Send a message to a Destination.
 Handle send(Destination dest, java.lang.Object msg, Selector sel, java.util.Hashtable clientProps)
           Send a message to a Destination, providing the implementation with implementation specific properties.
 void shutdown()
          Shutdown a Jumpi instance.
 void startup()
          Starts a Jumpi instance.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

VERSION

public static final java.lang.String VERSION
The release version.

See Also:
Constant Field Values
Constructor Detail

JumpiImpl

public JumpiImpl()
Creates a new Jumpi object.

Method Detail

getThreadFactory

public ThreadFactory getThreadFactory()
Get the ThreadFactory. The ThreadFactory can be used by any child components to get Threads.

Specified by:
getThreadFactory in interface Jumpi
Returns:
the ThreadFactory.

getLogger

public Logger getLogger()
Get the Logger. The Logger can be used by any child components to log errors, warnings and info messages.

Specified by:
getLogger in interface Jumpi
Returns:
the Logger.

getTimer

public Timer getTimer()
Get the Timer. The Timer can be used by any child components to interrupt TimerListeners periodically or once after a Timer has expired.

Specified by:
getTimer in interface Jumpi
Returns:
the Timer.

getTaskScheduler

public TaskScheduler getTaskScheduler()
Get the TaskScheduler. The TaskScheduler can be used by any child components to schedule themselves or components known to them which need to be scheduled in order to do useful work.

Specified by:
getTaskScheduler in interface Jumpi
Returns:
the TaskScheduler.

getSequenceGenerator

public SequenceGenerator getSequenceGenerator()
Get the SequenceGenerator. The SequenceGenerator can be used by any child components to provide unique sequence numbers.

Specified by:
getSequenceGenerator in interface Jumpi
Returns:
the SequenceGenerator.

getName

public java.lang.String getName()
Get the fully qualified name of the instance. Identical to the name used in configure.

Specified by:
getName in interface Configurable
Returns:
the fully qualified name of the instance.
See Also:
configure(java.lang.String, org.jumpi.spi.Properties)

getVersion

public java.lang.String getVersion()
Get the version of the Jumpi implementation.

Specified by:
getVersion in interface Jumpi
Returns:
the version of the Jumpi implementation.

configure

public void configure(java.lang.String name,
                      Properties props)
               throws java.lang.Exception

Configure the JumpiImpl instance.

The following configuration attributes are defined.

Component name suffixes are appended onto the Jumpi instance's fully qualified instance name. The child component's fully qualified instance name suffixed with '.classname' gives the property which determines which class to load for the instance.

Specified by:
configure in interface Configurable
Parameters:
name - the fully qualified instance name.
props - the read-only properties to configure the instance with.
Throws:
java.lang.Exception - when configuration is unsuccessful.
java.lang.IllegalArgumentException - if name or props is null or invalid parameters.

startup

public void startup()
             throws java.lang.Exception
Starts a Jumpi instance. Sending and receiving operations will fail before startup. For performance reasons, implementations may exhibit race conditions with send, recv and getDestination, but not with shutdown.

Specified by:
startup in interface Jumpi
Throws:
java.lang.Exception - when any problems occur during startup. Thereafter the result of any Jumpi operations on the instance are undefined.
See Also:
shutdown()

shutdown

public void shutdown()
              throws java.lang.Exception
Shutdown a Jumpi instance. Sending and receiving operations will fail after shutdown. The outcome of ongoing sending and receiving operations is undefined and is implementation dependent. Good implementations should fail ongoing send and receive operations if shutdown. Whether startup() can be called after shutdown() is implementation dependent.

Specified by:
shutdown in interface Jumpi
Throws:
java.lang.Exception - when any problems occurs during shutdown. Thereafter the result of any Jumpi operations on the instance are undefined.
See Also:
startup()

manage

public void manage(java.util.Hashtable parameters)
            throws java.lang.Exception
Manage a Jumpi instance. The management operations defined are implementation dependent. Management may be possible before startup and after shutdown in addition to the typical management after startup, before shutdown.

Specified by:
manage in interface Jumpi
Parameters:
parameters - in-out parameters and results container.
Throws:
java.lang.Exception - when any problems occurs during management.

manage

public void manage(Component root,
                   Component parent,
                   java.lang.String operation,
                   java.util.Hashtable parameters)
            throws java.lang.Exception
Perform a recursive management operation through the Jumpi component tree, using the parameters provided. The management operations are passed to the instance's child Components, i.e. TaskScheduler, ThreadFactory, Timer, Controllers and SequenceGenerator.

The following management actions are handled:

Specified by:
manage in interface Manageable
Parameters:
root - the Jumpi instance at the root of the component tree.
parent - the immediate parent of the component.
operation - the operation.
parameters - the operation parameters.
Throws:
java.lang.Exception - if any failure to perform management occurs.
java.lang.IllegalArgumentException - when parameters are missing.

getDestination

public Destination getDestination(java.lang.String url)

Return a Destination corresponding to the Url through the default Controller.

Specified by:
getDestination in interface Jumpi
Parameters:
url - the Url representation of the Destination.
Returns:
the Destination corresponding to the Url, or null if unsupported.
Throws:
java.lang.IllegalArgumentException - if url is null.
See Also:
getDestination(String,String,Hashtable)

getDestination

public Destination getDestination(java.lang.String controller,
                                  java.lang.String url)

Return a Destination corresponding to the Url, associated with the named Controller.

Specified by:
getDestination in interface Jumpi
Parameters:
controller - name of the Controller.
url - the Url representation of the Destination.
Returns:
the Destination corresponding to the Url, or null if unsupported.
Throws:
java.lang.IllegalArgumentException - if url is null or controller is null.
See Also:
getDestination(String,String,Hashtable)

getDestination

public Destination getDestination(java.lang.String url,
                                  java.util.Hashtable clientProps)

Return a Destination corresponding to the Url providing the implementation with implementation specific properties.

Specified by:
getDestination in interface Jumpi
Parameters:
url - the Url representation of the Destination.
clientProps - read-only properties for implementation specific use.
Returns:
the Destination corresponding to the Url, or null if unsupported.
Throws:
java.lang.IllegalArgumentException - if url or clientProps is null.
See Also:
getDestination(String,String,Hashtable)

getDestination

public Destination getDestination(java.lang.String controllerName,
                                  java.lang.String url,
                                  java.util.Hashtable clientProps)

Return a Destination corresponding to the Url, associated with the named Controller, providing the implementation with implementation specific properties.

Specified by:
getDestination in interface Jumpi
Parameters:
controllerName - name of the Controller.
url - Url representation of the Destination.
clientProps - read-only properties for implementation specific use.
Returns:
the Destination corresponding to the Url, or null if unsupported.
Throws:
java.lang.IllegalArgumentException - if any controller or url are null.

send

public Handle send(Destination dest,
                   java.lang.Object msg)
Send a message to a Destination.

Specified by:
send in interface Jumpi
Parameters:
dest - the Destination to which the message is sent.
msg - the Message.
Returns:
the Handle associated with the sending operation.
See Also:
send(Destination,Object,Selector, Hashtable)

send

public Handle send(Destination dest,
                   java.lang.Object msg,
                   Selector sel)
Send a message to a Destination.

Specified by:
send in interface Jumpi
Parameters:
dest - the Destination to which the message is sent.
msg - the Message.
sel - the Selector into which the Handle is placed.
Returns:
the Handle associated with the sending operation.
See Also:
send(Destination,Object,Selector,Hashtable)

send

public Handle send(Destination dest,
                   java.lang.Object msg,
                   java.util.Hashtable clientProps)
Send a message to a Destination.

Specified by:
send in interface Jumpi
Parameters:
dest - the Destination to which the message is sent.
msg - the Message.
clientProps - read-only properties for implementation specific use.
Returns:
the Handle associated with the sending operation.
See Also:
send(Destination,Object,Selector,Hashtable)

send

public Handle send(Destination dest,
                   java.lang.Object msg,
                   Selector sel,
                   java.util.Hashtable clientProps)

Send a message to a Destination, providing the implementation with implementation specific properties. The send operation may be asynchronous, in which case the returned Handle can be used to inquire the current status of the operation. Furthermore the operation can be cancelled and the caller can wait for the operation to complete with Handle.waitWhileBlocking(). Whether the operation is synchronous or asynchronous is implementation dependent. Any erroneous condition is stated in the status of the returned Handle. No Exceptions are thrown since with asynchronous sending, error circumstances can occur after returning, but before send completion.

The getDestination(java.lang.String) is the only means to get the Destination objects needed for sending.

The type, syntax and semantics of message are implementation dependent. For example, sending an SMS message may prescribe that the message be a java.lang.String with a maximum length of 180 characters. Sending via some other Destination may require a Serializable object. Jumpi does not dictate that messages should be Serializable or infact any restrictions at all. A Jumpi implementation is responsible for transforming the message Object into a format appropriate for the wire protocol.

Message ordering, reliability, quality of service, and performance guarantees are implementation dependent. Whether concurrent sends are possible is implementation dependent, as well as whether send and receive operations may be performed concurrently.

As a convenience, the Handle which is returned is additionally placed into the Selector provided, regardless of the Handle's status.

Specified by:
send in interface Jumpi
Parameters:
dest - the Destination to which the message is sent.
msg - the Message.
sel - the Selector into which the Handle is placed.
clientProps - read-only properties for implementation specific use.
Returns:
an Handle associated with the sending operation.
Throws:
java.lang.IllegalArgumentException - if dest or msg are null.

recv

public Handle recv(Destination dest)
Start a receive operation from a Destination.

Specified by:
recv in interface Jumpi
Parameters:
dest - the Destination to receive from.
Returns:
the Handle associated with the started receive operation.
See Also:
recv(Destination, Hashtable)

recv

public Handle recv(Destination dest,
                   Selector sel)
Start a receive operation from a Destination.

Specified by:
recv in interface Jumpi
Parameters:
dest - the Destination to receive from.
sel - the Selector into which the Handle is placed.
Returns:
the Handle associated with the started receive operation.
See Also:
recv(Destination, Selector, Hashtable)

recv

public Handle recv(Destination dest,
                   java.util.Hashtable clientProps)
Start a receive operation from a Destination.

Specified by:
recv in interface Jumpi
Parameters:
dest - the Destination to receive from.
clientProps - read-only implementation specific properties used by the implementation.
Returns:
the Handle associated with the started receive operation.
See Also:
recv(Destination, Selector, Hashtable)

recv

public Handle recv(Destination dest,
                   Selector sel,
                   java.util.Hashtable clientProps)

Start a receive operation from a Destination, providing the implementation with implementation specific information as read-only properties. A received message is made available to the Jumpi client application through the Handle.getMessage() method.

Specified by:
recv in interface Jumpi
Parameters:
dest - the Destination to receive from.
sel - the Handle into which the Handle is placed.
clientProps - read-only implementation specific properties used by the implementation.
Returns:
the Handle associated with the started receive operation.

getSelector

public Selector getSelector()
Get a new, empty Selector.

Specified by:
getSelector in interface Jumpi
Returns:
a new, empty Selector.

Jumpi v1.2.0

Copyright 2003, Peter Jonathan Klauser.