edu.stanford.slac.aida.lib.util.common
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
Direct Known Subclasses:
_PersistentDaObject, DaObject

public class _DaObject
extends _DaObjectBase

Encapsulates interactions with the Aida Name Server and acquisition parameter handling, for the AIDA data access API DaObject class hierarchy. _DaObject is used in preference to the DaObject when coding AIDA system components, since it contains methods for registering with AIDA, and finding the Name Server and other system interfaces etc.

Version:
10-Feb-2009, Greg White (greg): Added toStringArgs method, 16-Sep-2004, Greg White (greg): Extended, added error handling and comments.
Author:
24-Jun-2002, George McIntyre

Field Summary
 java.util.Hashtable m_args
          Arguments to be passed to the service that will execute any requests that are transmitted via this Data Access Object.
 
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-arg constructor.
_DaObject(java.lang.String[] args)
          Constructs a _DaObject without EventService.
_DaObject(java.lang.String[] args, boolean events)
          Constructs a _DaObject including EventService initialization if desired
_DaObject(java.lang.String[] args, java.lang.String childPersistentPOAName)
          Create and initialise a DaObject, with argument list.
_DaObject(java.lang.String[] args, java.lang.String childPersistentPOAName, boolean events)
          Create and initialise a DaObject, with argument list Make a connection to the ORB.
 
Method Summary
 java.lang.String[] concatArgs(java.lang.String[] concatenee)
          Method that allows addition of a set of arguments specified in an array similar to that returned from getArgs() to be added the current set of args.
 AidaObjectI getAidaServerI(java.lang.String service)
          Gets a Service's callable interface given its service name, as recorded in the Directory Service.
 java.lang.String[] getArgs()
          Gets all the parameters that have been set so far for this Data Access Object
 DaNameServerI getNameServerI()
          Get the Name Service's callable interface
 byte[] GetObjRef(java.lang.String aidaObjectName)
          Retrieves CORBA IOR for an Aida server for clients.
 AidaObjectRef getTargetRef(java.lang.String target)
          Gets a AIDA target reference structure that refers to the given target.
protected  void init()
          Initializes the hash table of queries to data-providers, and acquires the Name Server's CORBA interface.
 void StoreObjRef(java.lang.String aidaObjectName, java.lang.String ior)
          Stores CORBA IOR for an Aida server in a place where clients can access them
 java.lang.String toStringArgs()
          Converts the String array args to a single String suitable for printing.
 
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_args

public java.util.Hashtable m_args
Arguments to be passed to the service that will execute any requests that are transmitted via this Data Access Object.

Constructor Detail

_DaObject

public _DaObject()
          throws edu.stanford.slac.except.AidaInitException
No-arg constructor. Make a connection to the ORB. Find the Name Server.

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

_DaObject

public _DaObject(java.lang.String[] args,
                 java.lang.String childPersistentPOAName)
          throws edu.stanford.slac.except.AidaInitException
Create and initialise a DaObject, with argument list. Make a connection to the ORB. Find the Name Server.

Parameters:
args - a list of CORBA properties name value pairs, in particular the -ORBconfig configfilename
childPersistentPOAName - Name of this persistent server
Throws:
edu.stanford.slac.except.AidaInitException - Probably CORBA failed to initialize.

_DaObject

public _DaObject(java.lang.String[] args,
                 java.lang.String childPersistentPOAName,
                 boolean events)
          throws edu.stanford.slac.except.AidaInitException
Create and initialise a DaObject, with argument list Make a connection to the ORB. Find the Name Server.

Parameters:
args - a list of CORBA properties name value pairs, in particular the -ORBconfig configfilename
childPersistentPOAName - Name of this persistent server
events - whether to initialize EventService. If this is true a push_consumerImpl must be in the classpath
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 without EventService. Make a connection to the ORB. Find the Name Server.

Parameters:
args - a list of CORBA properties name value pairs, in particular the -ORBconfig configfilename
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 including EventService initialization if desired

Parameters:
args - a list of CORBA properties name value pairs, in particular the -ORBconfig configfilename
events - whether to initialize EventService. If this is true a push_consumerImpl must be in the classpath
Throws:
edu.stanford.slac.except.AidaInitException - Probably CORBA failed to initialize.
Method Detail

init

protected void init()
             throws edu.stanford.slac.except.AidaInitException
Initializes the hash table of queries to data-providers, and acquires the Name Server's CORBA interface. _DaObject::init extends _DaObjectBase::init, which has initialized CORBA communications.

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

getTargetRef

public AidaObjectRef getTargetRef(java.lang.String target)
                           throws edu.stanford.slac.except.UndefinedNameException
Gets a AIDA target reference structure that refers to the given target.

Parameters:
target - The given String AQS (AIDA Query Specification)
Returns:
An AidaObjectRef, IDL structure with details of run-time info to get a target.
Throws:
edu.stanford.slac.except.UndefinedNameException - The Directory Service could not resolve the target. Either there is no such name in the Directories database, or it was poorly specified in the database.

StoreObjRef

public void StoreObjRef(java.lang.String aidaObjectName,
                        java.lang.String ior)
Stores CORBA IOR for an Aida server in a place where clients can access them

Parameters:
aidaObjectName - the name of the server under which to store the IOR
ior - the Interoperable Object Reference (IOR) of the proxy object implementing the interface in the name parameter.

GetObjRef

public byte[] GetObjRef(java.lang.String aidaObjectName)
Retrieves CORBA IOR for an Aida server for clients. A CORBA IOR is an Inter-Operable Reference to a CORBA object (Interface, type, etc). The IOR can be used by ORB functions to access stub objects referencing the given AIDA Server object.

Parameters:
aidaObjectName - The name of the AIDA Server Object for which the IOR is required
Returns:
IOR for the given server name, retrieved from the Name Server

getAidaServerI

public AidaObjectI getAidaServerI(java.lang.String service)
Gets a Service's callable interface given its service name, as recorded in the Directory Service.

Parameters:
service - Name of service whose interface is desired
Returns:
A CORBA server stub containg the callable interface to the given service
Throws:
java.lang.IllegalStateException - couldn't narrow CORBA IOR for Aida Server.

getNameServerI

public DaNameServerI getNameServerI()
Get the Name Service's callable interface

Returns:
A CORBA server stub containg the callable interface of the Aida Name Service

getArgs

public java.lang.String[] getArgs()
Gets all the parameters that have been set so far for this Data Access Object

Returns:
an array of Strings containing the parameter/value pairs in even/odd respective indicies

concatArgs

public java.lang.String[] concatArgs(java.lang.String[] concatenee)
Method that allows addition of a set of arguments specified in an array similar to that returned from getArgs() to be added the current set of args. This method simply concatenates and does not merge. The current set of args are left unchanged.

Parameters:
a1 - Parameter list 1
a2 - Parameter List 2
Returns:
An array of Strings containing the concatenated parameter list

toStringArgs

public java.lang.String toStringArgs()
Converts the String array args to a single String suitable for printing.

Parameters:
args - The parameters client program supplied to a DaObject method
Returns:
A single String, formed by concatenation of String[] args.