TANGO Java API
( TangORB-7.3.3.jar)

fr.esrf.TangoApi
Class ApiUtil

java.lang.Object
  extended by fr.esrf.TangoApi.ApiUtil

public class ApiUtil
extends java.lang.Object

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


Usage example:

Version:
$Revision: 1.16 $
Author:
verdier

Constructor Summary
ApiUtil()
           
 
Method Summary
static 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..
static void create_event_consumer()
          Create the event consumer.
static fr.esrf.TangoApi.AsyncCallObject get_async_object(int id)
          Return the Asynch Object in hash table for the id
static org.omg.CORBA.Request get_async_request(int id)
          Return the request in hash table for the id
static int get_asynch_cb_sub_model()
          Set the callback sub model used (ApiDefs.PUSH_CALLBACK or ApiDefs.PULL_CALLBACK).
static void get_asynch_replies()
          Fire callback methods for all (any device) asynchronous requests(cmd and attr) with already arrived replies.
static void get_asynch_replies(DeviceProxy dev)
          Fire callback methods for all (any device) asynchronous requests(cmd and attr) with already arrived replies.
static void get_asynch_replies(DeviceProxy dev, int timeout)
          Fire callback methods for all (any device) asynchronous requests(cmd and attr) with already arrived replies.
static void get_asynch_replies(int timeout)
          Fire callback methods for all (any device) asynchronous requests(cmd and attr) with already arrived replies.
static Database get_db_obj()
          Return the database object created with TANGO_HOST environment variable .
static Database get_db_obj(java.lang.String tango_host)
          Return the database object created for specified host and port.
static Database get_db_obj(java.lang.String host, java.lang.String port)
          Return the database object created for specified host and port.
static Database get_default_db_obj()
          Return the database object created with TANGO_HOST environment variable .
static IEventConsumer get_event_consumer()
          Get the event consumer singleton object.
static org.omg.CORBA.ORB get_orb()
          Return the orb object
static java.lang.String getAccessDevname()
          Returns the ACCESS_DEVNAME found in JVM, environment, tangorc file,....
 IApiUtilDAO getApiUtilDAO()
           
static org.omg.CORBA.ORB getOrb()
           
static java.lang.String getORBgiopMaxMsgSize()
          Returns the ORBgiopMaxMsgSize found in JVM, environment, tangorc file,....
static int getReconnectionDelay()
           
static java.lang.String getStrDefaultTimeout()
          Returns the TANGO_TIMEOUT found in JVM, environment, tangorc file,....
static java.lang.String getTangoHost()
          Returns the TANGO_HOST found in JVM, environment, tangorc file,....
static boolean in_server()
          Return true if in server code or false if in client code.
static boolean isSuperTango()
          Returns the SUPER_TANGO found in JVM, environment, tangorc file,....
static java.lang.String[] parseTangoHost(java.lang.String tgh)
          Parse Tango host (check multi Tango_host)
static int pending_asynch_call(DeviceProxy dev, int reply_model)
          return the still pending asynchronous call for a reply model.
static int pending_asynch_call(int reply_model)
          return the still pending asynchronous call for a reply model.
static int put_async_request(fr.esrf.TangoApi.AsyncCallObject aco)
          Add request in hash table and return id
static java.lang.String qualityName(AttrQuality att_q)
           
static java.lang.String qualityName(short att_q_val)
           
static void remove_async_request(int id)
          Remove asynchronous call request and id from hashtable.
static void set_async_reply_cb(int id, CallBack cb)
          Set the Callback object in AsyncCallObject for the id key.
static void set_async_reply_model(int id, int reply_model)
          Set the reply_model in AsyncCallObject for the id key.
static void set_asynch_cb_sub_model(int model)
          Return the callback sub model used.
static Database set_db_obj(java.lang.String tango_host)
          Return the database object created for specified host and port.
static 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..
static void set_in_server(boolean val)
          Return the orb object
 void setApiUtilDAO(IApiUtilDAO databaseDAO)
           
static void setOrb(org.omg.CORBA.ORB orb)
           
static java.lang.String stateName(DevState state)
           
static java.lang.String stateName(short state_val)
           
static DbAttribute[] toDbAttributeArray(java.lang.String[] array, int mode)
          Convert a StringArray to a DbAttribute class array
static java.lang.String[] toStringArray(java.lang.String argin)
          Convert arguments to one String array
static java.lang.String[] toStringArray(java.lang.String objname, DbAttribute[] attr, int mode)
          Convert a DbAttribute class array to a StringArray.
static java.lang.String[] toStringArray(java.lang.String objname, java.lang.String argin)
          Convert arguments to one String array
static java.lang.String[] toStringArray(java.lang.String objname, java.lang.String[] argin)
          Convert arguments to one String array
static boolean useDefaultFactory()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ApiUtil

public ApiUtil()
Method Detail

getApiUtilDAO

public IApiUtilDAO getApiUtilDAO()

setApiUtilDAO

public void setApiUtilDAO(IApiUtilDAO databaseDAO)

useDefaultFactory

public static boolean useDefaultFactory()
Returns:
true if use the default factory (new ObjectDAODefaultImpl or false if introspection factory (mainly used when from web)

get_db_obj

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

Parameters:
tango_host - host and port (hostname:portnumber) where database is running.
Throws:
DevFailed

get_default_db_obj

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

Throws:
DevFailed

get_db_obj

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

Throws:
DevFailed

get_db_obj

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

Parameters:
host - host where database is running.
port - port for database connection.
Throws:
DevFailed

change_db_obj

public static 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..

Parameters:
host - host where database is running.
port - port for database connection.
Throws:
DevFailed

set_db_obj

public static 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..

Parameters:
host - host where database is running.
port - port for database connection.
Throws:
DevFailed

set_db_obj

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

Parameters:
tango_host - host and port (hostname:portnumber) where database is running.
Throws:
DevFailed

get_orb

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

Throws:
DevFailed

set_in_server

public static void set_in_server(boolean val)
Return the orb object


in_server

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


getReconnectionDelay

public static int getReconnectionDelay()

put_async_request

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


get_async_request

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

Throws:
DevFailed

get_async_object

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


remove_async_request

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


set_async_reply_model

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


set_async_reply_cb

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


pending_asynch_call

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

Parameters:
dev - DeviceProxy object.
reply_model - ApiDefs.ALL_ASYNCH, POLLING or CALLBACK.

pending_asynch_call

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

Parameters:
reply_model - ApiDefs.ALL_ASYNCH, POLLING or CALLBACK.

set_asynch_cb_sub_model

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

Parameters:
model - ApiDefs.PUSH_CALLBACK or ApiDefs.PULL_CALLBACK.

get_asynch_cb_sub_model

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


get_asynch_replies

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


get_asynch_replies

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


get_asynch_replies

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


get_asynch_replies

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


toStringArray

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


toStringArray

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


toStringArray

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


toStringArray

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

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 static DbAttribute[] toDbAttributeArray(java.lang.String[] array,
                                               int mode)
                                        throws DevFailed
Convert a StringArray to a DbAttribute class array

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 static java.lang.String stateName(DevState state)

stateName

public static java.lang.String stateName(short state_val)

qualityName

public static java.lang.String qualityName(AttrQuality att_q)

qualityName

public static java.lang.String qualityName(short att_q_val)

parseTangoHost

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

Throws:
DevFailed

create_event_consumer

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

Throws:
DevFailed

get_event_consumer

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

Returns:
EventConsumer

getOrb

public static org.omg.CORBA.ORB getOrb()

setOrb

public static void setOrb(org.omg.CORBA.ORB orb)

getTangoHost

public static java.lang.String getTangoHost()
                                     throws DevFailed
Returns the TANGO_HOST found in JVM, environment, tangorc file,....

Throws:
DevFailed

isSuperTango

public static boolean isSuperTango()
Returns the SUPER_TANGO found in JVM, environment, tangorc file,....


getAccessDevname

public static java.lang.String getAccessDevname()
Returns the ACCESS_DEVNAME found in JVM, environment, tangorc file,....


getStrDefaultTimeout

public static java.lang.String getStrDefaultTimeout()
Returns the TANGO_TIMEOUT found in JVM, environment, tangorc file,....


getORBgiopMaxMsgSize

public static java.lang.String getORBgiopMaxMsgSize()
Returns the ORBgiopMaxMsgSize found in JVM, environment, tangorc file,....


TANGO Java API
( TangORB-7.3.3.jar)