JMACS

org.jmacs.pd
Class Pdi

java.lang.Object
  extended by org.jmacs.pd.Pdi
All Implemented Interfaces:
IDi

public class Pdi
extends Object
implements IDi

IDi for the deployment of programmable devices.

The IMonitorGui and IControlsGui named MonitorGui and ControlsGui respectively in the package named by the org.jmacs.pd.uiPkgname property (whose default value is com.lafros.jmacs.pd.ui) will be used. These should allow interactive monitoring and control of programs, and have nested in them any corresponding classes supplied as part of the device definition.

See IDi.AbstractFactory for details of how to set properties.

See package description for device definition details.

Version:
$Id: Pdi.java 2864 2008-02-21 14:21:23Z rob $
Author:
Rob Dickens

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.jmacs.IDi
IDi.AbstractFactory, IDi.IDriver, IDi.States, IDi.Util
 
Constructor Summary
Pdi(String name, Class clazz, Device.IConstants constants)
          for use where clazz is provided by the device package itself.
Pdi(String name, Device.IDriver.IContainer driverContainer, Device.IConstants constants)
          for use where the driverContainer class is provided by the device package itself.
Pdi(String name, Device.IDriver driver, Device.IConstants constants)
          for use where the driver class is provided by the device package itself.
Pdi(String name, String devicePkgname, Class clazz, Device.IConstants constants)
          creates new instance.
Pdi(String name, String devicePkgname, Device.IDriver.IContainer driverContainer, Device.IConstants constants)
          as above, but supplying a driver-container instance (rather than driver instance).
Pdi(String name, String devicePkgname, Device.IDriver driver, Device.IConstants constants)
          as above, but supplying the driver instance (rather than class).
 
Method Summary
 boolean getAutoReregister()
          impl'ts IDi.
 Observable getObservable()
          impl'ts IDi.
 String getState()
          impl'ts IDi.
 void register()
          impl'ts IDi.
 void registerLater()
          impl'ts IDi.
 void registerOrWait()
          impl'ts IDi.
 void setAutoReregister(boolean b)
          impl'ts IDi.
 void setSamplesInPort(int port)
          impl'ts IDi.
 void setSamplesOutPort(int port)
          impl'ts IDi.
 void unregister()
          impl'ts IDi.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Pdi

public Pdi(String name,
           String devicePkgname,
           Class clazz,
           Device.IConstants constants)
    throws InterruptedException,
           IOException
creates new instance.

Parameters:
name - See IDi.AbstractFactory.
devicePkgname - See package description.
clazz - class impl'ting either Device.IDriver or Device.IDriver.IContainer. In the case of the latter, the instance (which is not exposed to commands or programs) will be passed one or more context objects if the class implements one or more of the following: In both cases, the constructor may take a single argument of type Device.IConstants corr'ding to the constants supplied here.
constants - passed to clazz and GUI constructors if non-null, and to IInterpreter.interpretCmd() and IPrograms.
Throws:
IllegalArgumentException - if devicePkgname does not contain the device class/interface--whose name must be the same as the rightmost portion of the packagename (but capitalised)--or clazz does not impl't either of the prescribed interfaces
InterruptedException
IOException

Pdi

public Pdi(String name,
           String devicePkgname,
           Device.IDriver driver,
           Device.IConstants constants)
    throws InterruptedException,
           IOException
as above, but supplying the driver instance (rather than class).

Parameters:
driver - The caller undertakes to acquire the lock on this before accessing it subsequently.
Throws:
InterruptedException
IOException

Pdi

public Pdi(String name,
           String devicePkgname,
           Device.IDriver.IContainer driverContainer,
           Device.IConstants constants)
    throws InterruptedException,
           IOException
as above, but supplying a driver-container instance (rather than driver instance).

Parameters:
driverContainer - The caller undertakes to acquire the lock on this before accessing it subsequently.
Throws:
InterruptedException
IOException

Pdi

public Pdi(String name,
           Class clazz,
           Device.IConstants constants)
    throws ClassNotFoundException,
           InterruptedException,
           IOException
for use where clazz is provided by the device package itself.

Throws:
ClassNotFoundException
InterruptedException
IOException

Pdi

public Pdi(String name,
           Device.IDriver driver,
           Device.IConstants constants)
    throws InterruptedException,
           IOException
for use where the driver class is provided by the device package itself.

Throws:
InterruptedException
IOException

Pdi

public Pdi(String name,
           Device.IDriver.IContainer driverContainer,
           Device.IConstants constants)
    throws InterruptedException,
           IOException
for use where the driverContainer class is provided by the device package itself.

Throws:
InterruptedException
IOException
Method Detail

setSamplesOutPort

public void setSamplesOutPort(int port)
impl'ts IDi.

Specified by:
setSamplesOutPort in interface IDi

setSamplesInPort

public void setSamplesInPort(int port)
impl'ts IDi.

Specified by:
setSamplesInPort in interface IDi

setAutoReregister

public void setAutoReregister(boolean b)
impl'ts IDi.

Specified by:
setAutoReregister in interface IDi

getAutoReregister

public boolean getAutoReregister()
impl'ts IDi.

Specified by:
getAutoReregister in interface IDi

register

public void register()
              throws DiNameTakenException,
                     TargetUnavailableException
impl'ts IDi.

Specified by:
register in interface IDi
Throws:
DiNameTakenException - if another DI is already registered as name
TargetUnavailableException - if the target DI-registry is unavailable

registerOrWait

public void registerOrWait()
                    throws DiNameTakenException,
                           InterruptedException
impl'ts IDi.

Specified by:
registerOrWait in interface IDi
Throws:
InterruptedException - if interrupted while sleeping
DiNameTakenException

registerLater

public void registerLater()
impl'ts IDi.

Specified by:
registerLater in interface IDi

unregister

public void unregister()
impl'ts IDi.

Specified by:
unregister in interface IDi

getState

public String getState()
impl'ts IDi.

Specified by:
getState in interface IDi

getObservable

public Observable getObservable()
impl'ts IDi.

Specified by:
getObservable in interface IDi

JMACS

jmacs.org