JMACS

org.jmacs
Interface IDi

All Known Implementing Classes:
Pdi

public interface IDi

device interface (DI). The following runtime configuration properties are used:

Name Default value Desc.
org.jmacs.target.hostname localhost name of target JMACS server's host
org.jmacs.target.isLocal true whether or not the DI's host should be considered to be on the target JMACS server host's local network
org.jmacs.di.port 0 (next available) port on which DI remote-objects will be exported

Note that the above target-related properties may be overridden in specific cases. See IDi.AbstractFactory.createDi(String, Class, String, String, Serializable) for details.

Instances must be in their IDi.States.UNREGISTERED state (as they are initially) when being discarded, and should be assumed to contain at least one non-daemon thread when in other states.

Thread-safety may not be assumed. The result of calling methods out of turn is undefined.

Version:
$Id: IDi.java 2768 2008-02-09 15:24:41Z rob $
Author:
Rob Dickens

Nested Class Summary
static class IDi.AbstractFactory
          for creating IDi instances.
static interface IDi.IDriver
          device-interface (DI) driver.
static interface IDi.States
          of the IDi.
static class IDi.Util
          utility class.
 
Method Summary
 boolean getAutoReregister()
          returns this property.
 Observable getObservable()
          returns observable.
 String getState()
          returns one of the fields of IDi.States.
 void register()
          registers with the target.
 void registerLater()
          as register(), but guaranteed to return, immediately.
 void registerOrWait()
          as register(), but enters a sleep-retry loop if the target is unavailable (rather than throwing an exception).
 void setAutoReregister(boolean b)
          sets automatic re-registration (in case the target should become unavailable for any reason).
 void setSamplesInPort(int port)
          sets a designated local port to which the socket that will be created to receive subscription status samples must bind.
 void setSamplesOutPort(int port)
          sets a designated local port to which the socket that will be created to send status samples must bind.
 void unregister()
          return the instance to the IDi.States.UNREGISTERED state.
 

Method Detail

setSamplesOutPort

void setSamplesOutPort(int port)
sets a designated local port to which the socket that will be created to send status samples must bind.

Throws:
IllegalStateException - if called when not unbound

setSamplesInPort

void setSamplesInPort(int port)
sets a designated local port to which the socket that will be created to receive subscription status samples must bind.

Throws:
IllegalStateException - if called when not unbound

setAutoReregister

void setAutoReregister(boolean b)
sets automatic re-registration (in case the target should become unavailable for any reason). The default setting is true.


getAutoReregister

boolean getAutoReregister()
returns this property.


register

void register()
              throws DiNameTakenException,
                     TargetUnavailableException
registers with the target.

Throws:
DiNameTakenException - if another DI is already registered as name
TargetUnavailableException - if the target DI-registry is unavailable

registerOrWait

void registerOrWait()
                    throws DiNameTakenException,
                           InterruptedException
as register(), but enters a sleep-retry loop if the target is unavailable (rather than throwing an exception).

Throws:
InterruptedException - if interrupted while sleeping
DiNameTakenException

registerLater

void registerLater()
as register(), but guaranteed to return, immediately.


unregister

void unregister()
return the instance to the IDi.States.UNREGISTERED state. (Instances are required to be in this state when being discarded.)


getState

String getState()
returns one of the fields of IDi.States.


getObservable

Observable getObservable()
returns observable. Observers should expect one of the fields of IDi.States to be supplied as the arg when impl'ting Observer.update(Observable, Object).


JMACS

jmacs.org