TANGO Java API
( TangORB-7.3.3.jar)

fr.esrf.TangoApi
Class ApiUtilDAODefaultImpl

java.lang.Object
  extended by fr.esrf.TangoApi.ApiUtilDAODefaultImpl
All Implemented Interfaces:
IApiUtilDAO

public class ApiUtilDAODefaultImpl
extends java.lang.Object
implements IApiUtilDAO

Class Description: This class manage a static vector of Database object.


Usage example:

Version:
$Revision: 1.15 $
Author:
verdier

Constructor Summary
ApiUtilDAODefaultImpl()
           
 
Method Summary
 Database change_db_obj(java.lang.String host, java.lang.String port)
          Return the database object created for specified host and port, and set this database object for all following uses..
 void create_event_consumer()
          Create the event consumer.
 fr.esrf.TangoApi.AsyncCallObject get_async_object(int id)
          Return the Asynch Object in hash table for the id
 org.omg.CORBA.Request get_async_request(int id)
          Return the request in hash table for the id
 int get_asynch_cb_sub_model()
          Set the callback sub model used (ApiDefs.PUSH_CALLBACK or ApiDefs.PULL_CALLBACK).
 void get_asynch_replies()
          Fire callback methods for all (any device) asynchronous requests(cmd and attr) with already arrived replies.
 void get_asynch_replies(DeviceProxy dev)
          Fire callback methods for all (any device) asynchronous requests(cmd and attr) with already arrived replies.
 void get_asynch_replies(DeviceProxy dev, int timeout)
          Fire callback methods for all (any device) asynchronous requests(cmd and attr) with already arrived replies.
 void get_asynch_replies(int timeout)
          Fire callback methods for all (any device) asynchronous requests(cmd and attr) with already arrived replies.
 Database get_db_obj()
          Return the database object created with TANGO_HOST environment variable .
 Database get_db_obj(java.lang.String tango_host)
          Return the database object created for specified host and port.
 Database get_db_obj(java.lang.String host, java.lang.String port)
          Return the database object created for specified host and port.
 Database get_default_db_obj()
          Return the database object created with TANGO_HOST environment variable .
 IEventConsumer get_event_consumer()
          Get the event consumer singleton object.
 org.omg.CORBA.ORB get_orb()
          Return the orb object
 int getReconnectionDelay()
          Return reconnection delay for controle system.
 boolean in_server()
          Return true if in server code or false if in client code.
 java.lang.String[] parseTangoHost(java.lang.String tgh)
          Parse Tango host (check multi Tango_host)
 int pending_asynch_call(DeviceProxy dev, int reply_model)
          return the still pending asynchronous call for a reply model.
 int pending_asynch_call(int reply_model)
          return the still pending asynchronous call for a reply model.
 int put_async_request(fr.esrf.TangoApi.AsyncCallObject aco)
          Add request in hash table and return id
 java.lang.String qualityName(AttrQuality att_q)
           
 java.lang.String qualityName(short att_q_val)
           
 void remove_async_request(int id)
          Remove asynchronous call request and id from hashtable.
static void removePendingRepliesOfDevice(Connection connection)
           
static void removePendingRepliesOfRequest(org.omg.CORBA.Request request)
           
 void set_async_reply_cb(int id, CallBack cb)
          Set the Callback object in AsyncCallObject for the id key.
 void set_async_reply_model(int id, int reply_model)
          Set the reply_model in AsyncCallObject for the id key.
 void set_asynch_cb_sub_model(int model)
          Return the callback sub model used.
 Database set_db_obj(java.lang.String tango_host)
          Return the database object created for specified host and port.
 Database set_db_obj(java.lang.String host, java.lang.String port)
          Return the database object created for specified host and port, and set this database object for all following uses..
 void set_in_server(boolean val)
          Return the orb object
 java.lang.String stateName(DevState state)
           
 java.lang.String stateName(short state_val)
           
 DbAttribute[] toDbAttributeArray(java.lang.String[] array, int mode)
          Convert a StringArray to a DbAttribute class array
 java.lang.String[] toStringArray(java.lang.String argin)
          Convert arguments to one String array
 java.lang.String[] toStringArray(java.lang.String objname, DbAttribute[] attr, int mode)
          Convert a DbAttribute class array to a StringArray.
 java.lang.String[] toStringArray(java.lang.String objname, java.lang.String argin)
          Convert arguments to one String array
 java.lang.String[] toStringArray(java.lang.String objname, java.lang.String[] argin)
          Convert arguments to one String array
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ApiUtilDAODefaultImpl

public ApiUtilDAODefaultImpl()
Method Detail

get_db_obj

public Database get_db_obj(java.lang.String tango_host)
                    throws DevFailed
Return the database object created for specified host and port.

Specified by:
get_db_obj in interface IApiUtilDAO
Parameters:
tango_host - host and port (hostname:portnumber) where database is running.
Throws:
DevFailed

get_default_db_obj

public Database get_default_db_obj()
                            throws DevFailed
Return the database object created with TANGO_HOST environment variable .

Specified by:
get_default_db_obj in interface IApiUtilDAO
Throws:
DevFailed

get_db_obj

public Database get_db_obj()
                    throws DevFailed
Return the database object created with TANGO_HOST environment variable .

Specified by:
get_db_obj in interface IApiUtilDAO
Throws:
DevFailed

get_db_obj

public Database get_db_obj(java.lang.String host,
                           java.lang.String port)
                    throws DevFailed
Return the database object created for specified host and port.

Specified by:
get_db_obj in interface IApiUtilDAO
Parameters:
host - host where database is running.
port - port for database connection.
Throws:
DevFailed

change_db_obj

public Database change_db_obj(java.lang.String host,
                              java.lang.String port)
                       throws DevFailed
Return the database object created for specified host and port, and set this database object for all following uses..

Specified by:
change_db_obj in interface IApiUtilDAO
Parameters:
host - host where database is running.
port - port for database connection.
Throws:
DevFailed

set_db_obj

public Database set_db_obj(java.lang.String host,
                           java.lang.String port)
                    throws DevFailed
Return the database object created for specified host and port, and set this database object for all following uses..

Specified by:
set_db_obj in interface IApiUtilDAO
Parameters:
host - host where database is running.
port - port for database connection.
Throws:
DevFailed

set_db_obj

public Database set_db_obj(java.lang.String tango_host)
                    throws DevFailed
Return the database object created for specified host and port.

Specified by:
set_db_obj in interface IApiUtilDAO
Parameters:
tango_host - host and port (hostname:portnumber) where database is running.
Throws:
DevFailed

get_orb

public org.omg.CORBA.ORB get_orb()
                          throws DevFailed
Return the orb object

Specified by:
get_orb in interface IApiUtilDAO
Throws:
DevFailed

set_in_server

public void set_in_server(boolean val)
Return the orb object

Specified by:
set_in_server in interface IApiUtilDAO

in_server

public boolean in_server()
Return true if in server code or false if in client code.

Specified by:
in_server in interface IApiUtilDAO

getReconnectionDelay

public int getReconnectionDelay()
Description copied from interface: IApiUtilDAO
Return reconnection delay for controle system.

Specified by:
getReconnectionDelay in interface IApiUtilDAO

put_async_request

public int put_async_request(fr.esrf.TangoApi.AsyncCallObject aco)
Add request in hash table and return id

Specified by:
put_async_request in interface IApiUtilDAO

get_async_request

public org.omg.CORBA.Request get_async_request(int id)
                                        throws DevFailed
Return the request in hash table for the id

Specified by:
get_async_request in interface IApiUtilDAO
Throws:
DevFailed

get_async_object

public fr.esrf.TangoApi.AsyncCallObject get_async_object(int id)
Return the Asynch Object in hash table for the id

Specified by:
get_async_object in interface IApiUtilDAO

remove_async_request

public void remove_async_request(int id)
Remove asynchronous call request and id from hashtable.

Specified by:
remove_async_request in interface IApiUtilDAO

removePendingRepliesOfRequest

public static void removePendingRepliesOfRequest(org.omg.CORBA.Request request)

removePendingRepliesOfDevice

public static void removePendingRepliesOfDevice(Connection connection)

set_async_reply_model

public void set_async_reply_model(int id,
                                  int reply_model)
Set the reply_model in AsyncCallObject for the id key.

Specified by:
set_async_reply_model in interface IApiUtilDAO

set_async_reply_cb

public void set_async_reply_cb(int id,
                               CallBack cb)
Set the Callback object in AsyncCallObject for the id key.

Specified by:
set_async_reply_cb in interface IApiUtilDAO

pending_asynch_call

public int pending_asynch_call(DeviceProxy dev,
                               int reply_model)
return the still pending asynchronous call for a reply model.

Specified by:
pending_asynch_call in interface IApiUtilDAO
Parameters:
dev - DeviceProxy object.
reply_model - ApiDefs.ALL_ASYNCH, POLLING or CALLBACK.

pending_asynch_call

public int pending_asynch_call(int reply_model)
return the still pending asynchronous call for a reply model.

Specified by:
pending_asynch_call in interface IApiUtilDAO
Parameters:
reply_model - ApiDefs.ALL_ASYNCH, POLLING or CALLBACK.

set_asynch_cb_sub_model

public void set_asynch_cb_sub_model(int model)
Return the callback sub model used.

Specified by:
set_asynch_cb_sub_model in interface IApiUtilDAO
Parameters:
model - ApiDefs.PUSH_CALLBACK or ApiDefs.PULL_CALLBACK.

get_asynch_cb_sub_model

public int get_asynch_cb_sub_model()
Set the callback sub model used (ApiDefs.PUSH_CALLBACK or ApiDefs.PULL_CALLBACK).

Specified by:
get_asynch_cb_sub_model in interface IApiUtilDAO

get_asynch_replies

public void get_asynch_replies()
Fire callback methods for all (any device) asynchronous requests(cmd and attr) with already arrived replies.

Specified by:
get_asynch_replies in interface IApiUtilDAO

get_asynch_replies

public void get_asynch_replies(int timeout)
Fire callback methods for all (any device) asynchronous requests(cmd and attr) with already arrived replies.

Specified by:
get_asynch_replies in interface IApiUtilDAO

get_asynch_replies

public void get_asynch_replies(DeviceProxy dev)
Fire callback methods for all (any device) asynchronous requests(cmd and attr) with already arrived replies.

Specified by:
get_asynch_replies in interface IApiUtilDAO

get_asynch_replies

public void get_asynch_replies(DeviceProxy dev,
                               int timeout)
Fire callback methods for all (any device) asynchronous requests(cmd and attr) with already arrived replies.

Specified by:
get_asynch_replies in interface IApiUtilDAO

toStringArray

public java.lang.String[] toStringArray(java.lang.String objname,
                                        java.lang.String[] argin)
Convert arguments to one String array

Specified by:
toStringArray in interface IApiUtilDAO

toStringArray

public java.lang.String[] toStringArray(java.lang.String objname,
                                        java.lang.String argin)
Convert arguments to one String array

Specified by:
toStringArray in interface IApiUtilDAO

toStringArray

public java.lang.String[] toStringArray(java.lang.String argin)
Convert arguments to one String array

Specified by:
toStringArray in interface IApiUtilDAO

toStringArray

public java.lang.String[] toStringArray(java.lang.String objname,
                                        DbAttribute[] attr,
                                        int mode)
Convert a DbAttribute class array to a StringArray.

Specified by:
toStringArray in interface IApiUtilDAO
Parameters:
objname - object name (used in first index of output array)..
attr - DbAttribute array to be converted
Returns:
the String array created from input argument.

toDbAttributeArray

public DbAttribute[] toDbAttributeArray(java.lang.String[] array,
                                        int mode)
                                 throws DevFailed
Convert a StringArray to a DbAttribute class array

Specified by:
toDbAttributeArray in interface IApiUtilDAO
Parameters:
array - String array to be converted
mode - decode argout params mode (mode=2 added 26/10/04)
Returns:
the DbAtribute class array created from input argument.
Throws:
DevFailed

stateName

public java.lang.String stateName(DevState state)
Specified by:
stateName in interface IApiUtilDAO

stateName

public java.lang.String stateName(short state_val)
Specified by:
stateName in interface IApiUtilDAO

qualityName

public java.lang.String qualityName(AttrQuality att_q)
Specified by:
qualityName in interface IApiUtilDAO

qualityName

public java.lang.String qualityName(short att_q_val)
Specified by:
qualityName in interface IApiUtilDAO

parseTangoHost

public java.lang.String[] parseTangoHost(java.lang.String tgh)
                                  throws DevFailed
Parse Tango host (check multi Tango_host)

Specified by:
parseTangoHost in interface IApiUtilDAO
Throws:
DevFailed

create_event_consumer

public void create_event_consumer()
                           throws DevFailed
Create the event consumer. This will automatically start a new thread which is waiting indefinitely for events.

Specified by:
create_event_consumer in interface IApiUtilDAO
Throws:
DevFailed

get_event_consumer

public IEventConsumer get_event_consumer()
Get the event consumer singleton object.

Specified by:
get_event_consumer in interface IApiUtilDAO
Returns:
EventConsumer

TANGO Java API
( TangORB-7.3.3.jar)