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

java.lang.Object
  extended by java.util.AbstractCollection<E>
      extended by java.util.AbstractList<E>
          extended by java.util.Vector
              extended by edu.stanford.slac.aida.lib.util.common._DaReference
                  extended by edu.stanford.slac.aida.lib.da.DaReference
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, java.lang.Iterable, java.util.Collection, java.util.List, java.util.RandomAccess

public class DaReference
extends _DaReference

This class encapsulates a reference to a given AIDA query, including parameters. It can be parsed, compiled and executed using relevant methods.

Version:
1-Nov-2007 Greg White Added getCount and getService
Author:
25-Jul-2002 George McIntyre
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class edu.stanford.slac.aida.lib.util.common._DaReference
_DaReference.Type
 
Field Summary
 
Fields inherited from class edu.stanford.slac.aida.lib.util.common._DaReference
attribute, bounds, instance, m_args, m_err, m_ref, m_refI, name, type
 
Fields inherited from class java.util.Vector
capacityIncrement, elementCount, elementData
 
Fields inherited from class java.util.AbstractList
modCount
 
Constructor Summary
DaReference()
          Creates a new instance of DaReference.
DaReference(java.lang.String target)
          Constructor of a DaReference that takes a target string as a parameter.
DaReference(java.lang.String target, DaObject da)
          This constructor creates a DaReference object, parses the given AIDA Query Specification and then compiles it against a valid DaObject (Data Access Object)
 
Method Summary
 int getCount()
          Get the number of Aida Data Provider services that would partake in processing the query of this DaReference.
 int[] getServices()
          Get the Service IDs of the Aida Data Providers that would partake in processing the query of this DaReference.
 int getType()
          Get the expected type of the object that this query would return.
protected  void init()
          Initialise the DaReference object
 void setCount(int count)
          Set count of elements in the array that is expected to be returned from this DaReference.
 void setParam(java.lang.String parmlist)
          Set parameters for an Aida query in one string.
 void setParam(java.lang.String name, java.lang.String value)
          Set a single parameter for this DaReference.
 void setTarget(java.lang.String target)
          To set the target of this DaReference.
 void setType(int type)
          Set the type data expected from this DaReference.
 
Methods inherited from class edu.stanford.slac.aida.lib.util.common._DaReference
compile, get_boolean, get_boolean, get_boolean, get_boolean, get_booleana, get_booleana, get_booleana, get_booleana, get_byte, get_byte, get_byte, get_byte, get_bytea, get_bytea, get_bytea, get_bytea, get_char, get_char, get_char, get_char, get_chara, get_chara, get_chara, get_chara, get_double, get_double, get_double, get_double, get_doublea, get_doublea, get_doublea, get_doublea, get_float, get_float, get_float, get_float, get_floata, get_floata, get_floata, get_floata, get_long, get_long, get_long, get_long, get_longa, get_longa, get_longa, get_longa, get_short, get_short, get_short, get_short, get_shorta, get_shorta, get_shorta, get_shorta, get_string, get_string, get_string, get_string, get_stringa, get_stringa, get_stringa, get_stringa, get, get, get, get, get, geta, geta, geta, geta, geta, getAny, getAny, getAny, getAny, getAny, getArgs, getDaValue, getDaValue, getDaValue, getDaValue, getDaValue, isSimpleReference, remove, set, set, set, toNewString, toString
 
Methods inherited from class java.util.Vector
add, add, addAll, addAll, addElement, capacity, clear, clone, contains, containsAll, copyInto, elementAt, elements, ensureCapacity, equals, firstElement, get, hashCode, indexOf, indexOf, insertElementAt, isEmpty, lastElement, lastIndexOf, lastIndexOf, remove, remove, removeAll, removeAllElements, removeElement, removeElementAt, removeRange, retainAll, set, setElementAt, setSize, size, subList, toArray, toArray, trimToSize
 
Methods inherited from class java.util.AbstractList
iterator, listIterator, listIterator
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.List
iterator, listIterator, listIterator
 

Constructor Detail

DaReference

public DaReference()
Creates a new instance of DaReference. This is a reference to an AIDA data object. If you use this, no-argument, constructor the DaReference must be initialised later with setTarget().


DaReference

public DaReference(java.lang.String target)
            throws edu.stanford.slac.except.UndefinedNameException
Constructor of a DaReference that takes a target string as a parameter. This string is immediately parsed against the AIDA Query Specification language.

Parameters:
target - This is the string representation of the AIDA Query that is to be referenced by this object
Throws:
edu.stanford.slac.except.UndefinedNameException

DaReference

public DaReference(java.lang.String target,
                   DaObject da)
            throws edu.stanford.slac.except.UndefinedNameException
This constructor creates a DaReference object, parses the given AIDA Query Specification and then compiles it against a valid DaObject (Data Access Object)

Parameters:
target - AIDA Query Specification that specifies the required target Data Access.
da - A data access object with with to compile the DaReference target string
Throws:
edu.stanford.slac.except.UndefinedNameException
Method Detail

setTarget

public void setTarget(java.lang.String target)
               throws edu.stanford.slac.except.UndefinedNameException
To set the target of this DaReference. Can be called after a DaReference is constructed with no parameters to assign the target AQS.

Overrides:
setTarget in class _DaReference
Parameters:
target - AIDA Query Specification that specifies the required target Data Access.
Throws:
edu.stanford.slac.except.UndefinedNameException

init

protected void init()
Initialise the DaReference object

Overrides:
init in class _DaReference

setParam

public void setParam(java.lang.String parmlist)
Set parameters for an Aida query in one string. For example "parm=value;parm=value;parm=value".

Parameters:
parmlist - String containing parameter/value pairs in the form. PARAMETER=VALUE;PARAMETER=VALUE...

setParam

public void setParam(java.lang.String name,
                     java.lang.String value)
Set a single parameter for this DaReference.

Parameters:
name - Name of the parameter whose value is being set
value - The value of the parameter being set. This is always specified as a string and is converted as necessary.

setType

public void setType(int type)
Set the type data expected from this DaReference.

Parameters:
type - A DaValue.Type code specifying the expected return type of the query
See Also:
DaValue.Type

setCount

public void setCount(int count)
Set count of elements in the array that is expected to be returned from this DaReference. Note that this works only for simple arrays.

Parameters:
count - The expected length of the array to be returned

getType

public int getType()
Get the expected type of the object that this query would return.

Returns:
DaValue.Type code representing the expected return type of the query

getServices

public int[] getServices()
Get the Service IDs of the Aida Data Providers that would partake in processing the query of this DaReference. For example see test/java/ApiTests.java.

Returns:
array of service IDs in the order in which they would be called; the 1st element will be valued -1 if the DaReference has not yet been setup.

getCount

public int getCount()
Get the number of Aida Data Provider services that would partake in processing the query of this DaReference. For example see test/java/ApiTests.java.

Returns:
The expected length of the array of services (may be used to size an array receiving return from getServices), or -1 if DaReference has not been set up.