edu.stanford.slac.aida.lib.da
Class DaObject

java.lang.Object
  extended by edu.stanford.slac.aida.lib.util.common._DaObjectBase
      extended by edu.stanford.slac.aida.lib.util.common._DaObject
          extended by edu.stanford.slac.aida.lib.da.DaObject

public class DaObject
extends _DaObject

The basic AIDA data access API class. This is the user-level class that encapsulates an AIDA Data Access Object. Use methods of this class to get data.

Version:
04-Dec-2006, Bob Hall (rdh) Added logging of client request for set operation to methods set and setDaValue., 17-Nov-2006, Bob Hall (rdh) Added set method., 18-Oct-2006, Bob Hall (rdh) Changed method setDaValue to accept a DaValue argument and return a DaValue., 28-Sep-2006, Bob Hall (rdh) Added the passing of arguments to the AidaObjectI set method in method setDaValue., 18-Sep-2006, Bob Hall (rdh) Added method setDaValue., 07-Oct-2004, Greg White (greg) Use args from reference when called with DaReference., 28-Sep-2004, Greg White (greg) Removed err import, not used here., 17-Sep-2004, Greg White (greg): More exception handling and comments and javadoc., 16-Sep-2004, Greg White (greg): Add exception handling. Up-translate constructor exceptions to UNCHECKED, so users of the basic AIDA API don't have to add code to catch initialization exceptions., 20-Nov-2002, Ron MacKenzie: Convert from using aida exceptions to package except.
Author:
July-2002, George McIntyre

Field Summary
 AidaObjectI m_da
          Callable interface of the Data Access Server (DaServer).
 
Fields inherited from class edu.stanford.slac.aida.lib.util.common._DaObject
m_args
 
Fields inherited from class edu.stanford.slac.aida.lib.util.common._DaObjectBase
DAO_PROPS, m_consumerPOA, m_err, m_event_channel, m_orb, m_POA_manager, m_props, m_rootPOA
 
Constructor Summary
DaObject()
          No-argument constructor of DaObject.
DaObject(java.lang.String[] args)
          Constructs a DaObject with command line arguments
DaObject(java.lang.String[] args, boolean events)
          Constructs a DaObject with command line arguments and conditional event service init
 
Method Summary
 java.lang.Object get(DaReference r)
          Gets data specified by a given DaReference.
 java.lang.Object get(java.lang.String target, int type)
          Gets data referenced by given target.
 java.lang.Object[] geta(DaReference r)
          Gets given DaReference.
 java.lang.Object[] geta(java.lang.String target, int type)
          Gets data referenced by a given target.
 org.omg.CORBA.Any getAny(DaReference r)
          Gets given DaReference, giving a CORBA Any.
 org.omg.CORBA.Any getAny(java.lang.String target)
          Gets data specified by given target query, giving a CORBA Any.
 DaValue getDaValue(DaReference r)
          Gets given DaReference.
 DaValue getDaValue(java.lang.String target)
          Gets data referenced by given target.
protected  void init()
          Initialise any fields
 void reset()
          Reset this DaObject.
 DaValue set(java.lang.String target)
          Performs a set operation for a server specified by a target.
 DaValue setDaValue(java.lang.String target, DaValue v)
          Sets data specified by a DaValue for a server specified by a target.
 void setParam(java.lang.String parmlist)
          This method is used to set global Data Access Object parameters.
 void setParam(java.lang.String name, java.lang.String value)
          This method is used to set global Data Access Object parameters.
 
Methods inherited from class edu.stanford.slac.aida.lib.util.common._DaObject
concatArgs, getAidaServerI, getArgs, getNameServerI, GetObjRef, getTargetRef, StoreObjRef, toStringArgs
 
Methods inherited from class edu.stanford.slac.aida.lib.util.common._DaObjectBase
EventConnect, getNameServerIOR, getORB, getPPConsumer, init, initEventService, setNameServerIOR, Start
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_da

public AidaObjectI m_da
Callable interface of the Data Access Server (DaServer). This interface is resolved automatically on creation of a DaObject.

Constructor Detail

DaObject

public DaObject()
         throws edu.stanford.slac.except.AidaInitException
No-argument constructor of DaObject. Use when there are no command line

Throws:
edu.stanford.slac.except.AidaInitException - Probably CORBA failed to initialize.

DaObject

public DaObject(java.lang.String[] args)
         throws edu.stanford.slac.except.AidaInitException
Constructs a DaObject with command line arguments

Parameters:
args - Command line arguments that may contain CORBA arguments that expert users may wish to pass to the low level subsystems to custom initialise the ORB
Throws:
edu.stanford.slac.except.AidaInitException - Probably CORBA failed to initialize.

DaObject

public DaObject(java.lang.String[] args,
                boolean events)
         throws edu.stanford.slac.except.AidaInitException
Constructs a DaObject with command line arguments and conditional event service init

Parameters:
args - Command line arguments that may contain CORBA arguments that expert users may wish to pass to the low level subsystems to custom initialise the ORB
events - Initialise event service?
Throws:
edu.stanford.slac.except.AidaInitException - Probably CORBA failed to initialize.
Method Detail

init

protected void init()
             throws edu.stanford.slac.except.AidaInitException
Initialise any fields

Overrides:
init in class _DaObject
Throws:
edu.stanford.slac.except.AidaInitException - Probably CORBA failed to initialize.

setParam

public void setParam(java.lang.String parmlist)
This method is used to set global Data Access Object parameters. These parameters will be used each time any service is called via this connection either directly or via a reference object. This version allows multiple parameters to be set at once

Parameters:
parmlist - parameter/value pairs in the form "parm=value;parm=value;parm=value;"

setParam

public void setParam(java.lang.String name,
                     java.lang.String value)
This method is used to set global Data Access Object parameters. These parameters will be used each time any service is called via this connection either directly or via a reference object.

Parameters:
name - Parameter name. Has meaning only in implementing services
value - New value for given parameter name

reset

public void reset()
Reset this DaObject. Use this method to clear any parameters that have been set for this DaObject.


get

public java.lang.Object get(DaReference r)
                     throws edu.stanford.slac.except.UndefinedNameException,
                            edu.stanford.slac.except.UnableToGetDataException
Gets data specified by a given DaReference. Returns an intrinsic Object.

Parameters:
r - A DaReference object that encapsulates a well formed parsed AQS (AIDA Query Specification) query. The type of this reference must have either been successfully gleaned from the compilation process or set manually with setType()
Returns:
An arbitrary intrinsic object. The user may call generic methods on the returned object, like toString() but in order to use the value the programmer needs to know what type was really returned and cast the returned value to that type.
Throws:
edu.stanford.slac.except.UndefinedNameException - when the Directory Service cannot resolve the query in the given DaReference.
edu.stanford.slac.except.UnableToGetDataException

get

public java.lang.Object get(java.lang.String target,
                            int type)
                     throws edu.stanford.slac.except.UnableToGetDataException
Gets data referenced by given target. Returns an intrinsic Object.

Parameters:
target - A AQS string target to be evaluated
type - The expected return type of the query
Returns:
An arbitrary intrinsic Object. The user may call generic methods on the returned object, like toString() but in order to use the value the programmer needs to know what type was really returned and cast the returned value to that type.
Throws:
edu.stanford.slac.except.UnableToGetDataException - error executing query

geta

public java.lang.Object[] geta(DaReference r)
                        throws edu.stanford.slac.except.UnableToGetDataException,
                               edu.stanford.slac.except.UndefinedNameException
Gets given DaReference. Return an array of intrinsic objects

Parameters:
r - A DaReference object that encapsulates a well formed parsed AQS (AIDA Query Specification) query. The type of this reference must have either been successfully gleaned from the compilation process or set manually with setType()
Returns:
An arbitrary array of intrinsic objects. The user may call generic methods on the returned array elements, like toString() but in order to use the values the programmer needs to know what type was really returned and cast the returned value to that type.
Throws:
edu.stanford.slac.except.UndefinedNameException - query string is invalid; not in Directory Service or bad syntax.
edu.stanford.slac.except.UnableToGetDataException - error executing query

geta

public java.lang.Object[] geta(java.lang.String target,
                               int type)
                        throws edu.stanford.slac.except.UnableToGetDataException
Gets data referenced by a given target.

Parameters:
target - A AQS string target to be evaluated
type - The expected return type of the query
Returns:
An arbitrary array of intrinsic objects. The user may call generic methods on the returned array elements, like toString() but in order to use the values the programmer needs to know what type was really returned and cast the returned value to that type.
Throws:
edu.stanford.slac.except.UnableToGetDataException - error executing query

getAny

public org.omg.CORBA.Any getAny(DaReference r)
                         throws edu.stanford.slac.except.UnableToGetDataException,
                                edu.stanford.slac.except.UndefinedNameException
Gets given DaReference, giving a CORBA Any. This get method should be used only when it is known that, for the specific named data item in the given DaReference, the corresponding Data Provider will return a raw CORBA Any which encapsulates a special purpose CORBA structure intended just for data of that structure. For instance, at the time of writing, the c++ CHADS Data Provider returns history data in a CORBA Any encapsulating a histData CORBA structure, so history data queries to that data provider should use this method to get an unmollested histData inserted into an Any.

Parameters:
r - A DaReference object that encapsulates a well formed parsed AQS (AIDA Query Specification) query. The type of this reference must have either been successfully gleaned from the compilation process or set manually with setType()
Returns:
A CORBA Any. If the user has access to the original helper stubs for the Any then data can be accessed like that.
Throws:
edu.stanford.slac.except.UndefinedNameException - query string is invalid; not in Directory Service or bad syntax.
edu.stanford.slac.except.UnableToGetDataException - error executing query

getAny

public org.omg.CORBA.Any getAny(java.lang.String target)
                         throws edu.stanford.slac.except.UnableToGetDataException
Gets data specified by given target query, giving a CORBA Any. See comments for getAny(DaReference).

Parameters:
target - A AQS string target to be evaluated
Returns:
A CORBA Any. If the user has access to the oiginal helper stubs for the Any then data can be accessed like that.
Throws:
edu.stanford.slac.except.UnableToGetDataException - error executing query

getDaValue

public DaValue getDaValue(DaReference r)
                   throws edu.stanford.slac.except.UnableToGetDataException,
                          edu.stanford.slac.except.UndefinedNameException
Gets given DaReference. Return a DaValue

Parameters:
r - A DaReference object that encapsulates a well formed parsed AQS (AIDA Query Specification) query. The type of this reference must have either been successfully gleaned from the compilation process or set manually with setType()
Returns:
A DaValue.
Throws:
edu.stanford.slac.except.UnableToGetDataException - error executing query
edu.stanford.slac.except.UndefinedNameException - query string is invalid; not in Directory Service or bad syntax.
See Also:
DaValue

getDaValue

public DaValue getDaValue(java.lang.String target)
                   throws edu.stanford.slac.except.UnableToGetDataException
Gets data referenced by given target. Return a DaValue

Parameters:
target - A AQS string target to be evaluated
Returns:
A DaValue.
Throws:
edu.stanford.slac.except.UnableToGetDataException - error executing query
See Also:
DaValue

set

public DaValue set(java.lang.String target)
            throws edu.stanford.slac.except.UnableToSetDataException
Performs a set operation for a server specified by a target.

Parameters:
target - A AQS string target to be evaluated
Returns:
A DaValue containing the returned data.
Throws:
edu.stanford.slac.except.UnableToGetDataException - error executing query
edu.stanford.slac.except.UnableToSetDataException

setDaValue

public DaValue setDaValue(java.lang.String target,
                          DaValue v)
                   throws edu.stanford.slac.except.UnableToSetDataException
Sets data specified by a DaValue for a server specified by a target.

Parameters:
target - A AQS string target to be evaluated
v - A DaValue containing the data to be set.
Returns:
A DaValue containing the returned data.
Throws:
edu.stanford.slac.except.UnableToGetDataException - error executing query
edu.stanford.slac.except.UnableToSetDataException