TANGO Database API

fr.esrf.TangoApi
Class Database

java.lang.Object
  |
  +--fr.esrf.TangoApi.Connection
        |
        +--fr.esrf.TangoApi.Database

public class Database
extends Connection

Class Description: This class is the main class for TANGO database API. The TANGO database is implemented as a TANGO device server. To access it, the user has the CORBA interface command_inout(). This expects and returns all parameters as ascii strings thereby making the database laborious to use for retreing device properties and information. In order to simplify this access, a high-level API has been implemented which hides the low-level formatting necessary to convert the command_inout() return values into binary values and all CORBA aspects of the TANGO. All data types are native java types e.g. simple types an arrays.

Author:
verdier

Constructor Summary
Database()
          Database access constructor.
Database(java.lang.String host, java.lang.String port)
          Database access constructor.
 
Method Summary
 void add_device(DbDevInfo devinfo)
          Add/update a device to the database
 void add_device(java.lang.String devname, java.lang.String classname, java.lang.String servname)
          Add/update a device to the database
 void add_server(java.lang.String servname, DbDevInfo[] devinfos)
          Add a group of devices to the database.
 void delete_class_attribute_property(java.lang.String name, DbDatum[] properties)
          Delete a list of properties for the specified object.
 void delete_class_attribute_property(java.lang.String name, java.lang.String propname)
          Delete a property for the specified object.
 void delete_class_attribute_property(java.lang.String name, java.lang.String[] propnames)
          Delete a list of properties for the specified object.
 void delete_class_property(java.lang.String name, DbDatum[] properties)
          Delete a list of properties for the specified object.
 void delete_class_property(java.lang.String name, java.lang.String propname)
          Delete a property for the specified object.
 void delete_class_property(java.lang.String name, java.lang.String[] propnames)
          Delete a list of properties for the specified object.
 void delete_device_attribute_property(java.lang.String name, DbDatum[] properties)
          Delete a list of properties for the specified object.
 void delete_device_attribute_property(java.lang.String name, java.lang.String propname)
          Delete a property for the specified object.
 void delete_device_attribute_property(java.lang.String name, java.lang.String[] propnames)
          Delete a list of properties for the specified object.
 void delete_device_property(java.lang.String name, DbDatum[] properties)
          Delete a list of properties for the specified object.
 void delete_device_property(java.lang.String name, java.lang.String propname)
          Delete a property for the specified object.
 void delete_device_property(java.lang.String name, java.lang.String[] propnames)
          Delete a list of properties for the specified object.
 void delete_device(java.lang.String devname)
          Delete the device of the specified name from the database
 void delete_property(java.lang.String name, DbDatum[] properties)
          Delete a list of properties for the specified object.
 void delete_property(java.lang.String name, java.lang.String propname)
          Delete a property for the specified object.
 void delete_property(java.lang.String name, java.lang.String[] propnames)
          Delete a list of properties for the specified object.
 void delete_server(java.lang.String devname)
          Delete the device server and its associated devices from the database.
 void export_device(DbDevExportInfo devinfo)
          Update the export info fort this device in the database.
 void export_server(java.lang.String devname, DbDevExportInfo[] devinfos)
          Add a group of devices to the database.
 DbDatum[] get_class_attribute_property(java.lang.String name, DbDatum[] properties)
          Query the database for a list of class attribute properties for the pecified object.
 DbDatum get_class_attribute_property(java.lang.String name, java.lang.String propname)
          Query the database for a class attribute property for the pecified object.
 DbDatum[] get_class_attribute_property(java.lang.String name, java.lang.String[] propnames)
          Query the database for a list of class attribute properties for the pecified object.
 java.lang.String[] get_class_property_list(java.lang.String classname, java.lang.String wildcard)
          Query the database for a list of class properties for the pecified object.
 DbDatum[] get_class_property(java.lang.String name, DbDatum[] properties)
          Query the database for a list of class properties for the pecified object.
 DbDatum get_class_property(java.lang.String name, java.lang.String propname)
          Query the database for a class property for the pecified object.
 DbDatum[] get_class_property(java.lang.String name, java.lang.String[] propnames)
          Query the database for a list of class properties for the pecified object.
 java.lang.String[] get_device_alias(java.lang.String devname)
          Query the database for a list of aliases for the specified device.
 DbDatum[] get_device_attribute_property(java.lang.String name, DbDatum[] properties)
          Query the database for a list of device attribute properties for the pecified object.
 DbDatum get_device_attribute_property(java.lang.String name, java.lang.String propname)
          Query the database for device attribute property for the pecified object.
 DbDatum[] get_device_attribute_property(java.lang.String name, java.lang.String[] propnames)
          Query the database for a list of device attribute properties for the pecified object.
 java.lang.String[] get_device_class_list(java.lang.String servname)
          Query the database for server devices and classes.
 java.lang.String[] get_device_domain(java.lang.String wildcard)
          Query the database for a list of device domain names witch match the wildcard provided.
 java.lang.String[] get_device_family(java.lang.String wildcard)
          Query the database for a list of device family names witch match the wildcard provided.
 java.lang.String[] get_device_member(java.lang.String wildcard)
          Query the database for a list of device member names witch match the wildcard provided.
 java.lang.String[] get_device_name(java.lang.String servname, java.lang.String classname)
          Query the database for a list of devices served by the specified server and of the specified class.
 java.lang.String[] get_device_property_list(java.lang.String devname, java.lang.String wildcard)
          Query the database for a list of device properties for the pecified object.
 DbDatum[] get_device_property(java.lang.String name, DbDatum[] properties)
          Query the database for a list of device properties for the pecified object.
 DbDatum get_device_property(java.lang.String name, java.lang.String propname)
          Query the database for a device property for the pecified object.
 DbDatum[] get_device_property(java.lang.String name, java.lang.String[] propnames)
          Query the database for a list of device properties for the pecified object.
 java.lang.String[] get_host_list()
          Query the database for a list of host registred.
 java.lang.String[] get_host_list(java.lang.String wildcard)
          Query the database for a list of host registred.
 java.lang.String[] get_host_server_list(java.lang.String hostname)
          Query the database for a list of servers registred on the specified host.
 java.lang.String get_info()
          Query the database for general info about the table in the database.
 DbDatum[] get_property(java.lang.String name, DbDatum[] properties)
          Query the database for a list of object (i.e.
 DbDatum get_property(java.lang.String name, java.lang.String propname)
          Query the database for an object (i.e.
 DbDatum[] get_property(java.lang.String name, java.lang.String[] propnames)
          Query the database for a list of object (i.e.
 DbServInfo get_server_info(java.lang.String servname)
          Query the database for server information.
 java.lang.String[] get_server_list()
          Query the database for a list of servers registred in the database.
 java.lang.String[] get_server_list(java.lang.String wildcard)
          Query the database for a list of servers registred in the database.
 DbDevImportInfo import_device(java.lang.String devname)
          Query the database for the export info of the specified device.
 void put_class_attribute_property(java.lang.String name, DbDatum[] properties)
          Insert or update a list of properties for the specified class attribute.
 void put_class_property(java.lang.String name, DbDatum[] properties)
          Insert or update a list of properties for the specified class.
 void put_device_attribute_property(java.lang.String name, DbDatum[] properties)
          Insert or update a list of properties for the specified device attribute.
 void put_device_property(java.lang.String name, DbDatum[] properties)
          Insert or update a list of properties for the specified device The property names and their values are specified by the DbDatum array.
 void put_property(java.lang.String name, DbDatum[] properties)
          Insert or update a list of properties for the specified object The property names and their values are specified by the DbDatum array.
 void put_server_info(DbServInfo info)
          Add/update server information in databse.
 void unexport_device(java.lang.String devname)
          Mark the specified server as unexported in the database.
 void unexport_server(java.lang.String devname)
          Mark all devices exported for this device server as unexported.
 
Methods inherited from class fr.esrf.TangoApi.Connection
command_inout, command_inout, command_list_query, get_name, get_tango_host, get_timeout, info, ping, set_timeout
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Database

public Database()
         throws fr.esrf.Tango.DevFailed
Database access constructor.
Throws:
fr.esrf.Tango.DevFailed - in case of environment not corectly set.

Database

public Database(java.lang.String host,
                java.lang.String port)
         throws fr.esrf.Tango.DevFailed
Database access constructor.
Parameters:
host - host where database is running.
port - port for database connection.
Throws:
fr.esrf.Tango.DevFailed - in case of host or port not available
Method Detail

get_info

public java.lang.String get_info()
                          throws fr.esrf.Tango.DevFailed
Query the database for general info about the table in the database.
Returns:
the result of the query as String.

get_host_list

public java.lang.String[] get_host_list()
                                 throws fr.esrf.Tango.DevFailed
Query the database for a list of host registred.
Returns:
the list of all hosts registred in TANGO database.

get_host_list

public java.lang.String[] get_host_list(java.lang.String wildcard)
                                 throws fr.esrf.Tango.DevFailed
Query the database for a list of host registred.
Parameters:
wildcard - Wildcard char is '*' and matches wildvcard characters.
Returns:
the list of the hosts registred in TANGO database with the specified wildcard.

get_server_list

public java.lang.String[] get_server_list()
                                   throws fr.esrf.Tango.DevFailed
Query the database for a list of servers registred in the database.
Returns:
the list of all servers registred in TANGO database.

get_server_list

public java.lang.String[] get_server_list(java.lang.String wildcard)
                                   throws fr.esrf.Tango.DevFailed
Query the database for a list of servers registred in the database.
Parameters:
wildcard - Wildcard char is '*' and matches wildvcard characters.
Returns:
the list of all servers registred in TANGO database.

get_host_server_list

public java.lang.String[] get_host_server_list(java.lang.String hostname)
                                        throws fr.esrf.Tango.DevFailed
Query the database for a list of servers registred on the specified host.
Parameters:
hostname - the specified host name.
Returns:
the list of the servers registred in TANGO database for the specified host.

get_server_info

public DbServInfo get_server_info(java.lang.String servname)
                           throws fr.esrf.Tango.DevFailed
Query the database for server information.
Parameters:
servname - The specified server name.
Returns:
The information found for the specified server in a DBServInfo object.

put_server_info

public void put_server_info(DbServInfo info)
                     throws fr.esrf.Tango.DevFailed
Add/update server information in databse.
Parameters:
info - Server information for the specified server in a DbServinfo object.

add_device

public void add_device(DbDevInfo devinfo)
                throws fr.esrf.Tango.DevFailed
Add/update a device to the database
Parameters:
devinfo - The device name, class and server specified in object.

add_device

public void add_device(java.lang.String devname,
                       java.lang.String classname,
                       java.lang.String servname)
                throws fr.esrf.Tango.DevFailed
Add/update a device to the database
Parameters:
devname - The device name
classnmame - The class.
servname - The server name.

delete_device

public void delete_device(java.lang.String devname)
                   throws fr.esrf.Tango.DevFailed
Delete the device of the specified name from the database
Parameters:
devname - The device name.

import_device

public DbDevImportInfo import_device(java.lang.String devname)
                              throws fr.esrf.Tango.DevFailed
Query the database for the export info of the specified device.
Parameters:
devname - The device name.
Returns:
the information in a DbDevImportInfo.

unexport_device

public void unexport_device(java.lang.String devname)
                     throws fr.esrf.Tango.DevFailed
Mark the specified server as unexported in the database.
Parameters:
devname - The device name.

export_device

public void export_device(DbDevExportInfo devinfo)
                   throws fr.esrf.Tango.DevFailed
Update the export info fort this device in the database.
Parameters:
devinfo - Device information to export.

get_device_class_list

public java.lang.String[] get_device_class_list(java.lang.String servname)
                                         throws fr.esrf.Tango.DevFailed
Query the database for server devices and classes.
Parameters:
servname - The specified server name.
Returns:
The devices and classes (e.g. "id11/motor/1", "StepperMotor", "id11/motor/2", "StepperMotor",....)

get_device_name

public java.lang.String[] get_device_name(java.lang.String servname,
                                          java.lang.String classname)
                                   throws fr.esrf.Tango.DevFailed
Query the database for a list of devices served by the specified server and of the specified class.
Parameters:
servname - The server name.
clasname - The class name
Returns:
the device names are stored in an array of strings.

get_device_alias

public java.lang.String[] get_device_alias(java.lang.String devname)
                                    throws fr.esrf.Tango.DevFailed
Query the database for a list of aliases for the specified device.
Parameters:
devvname - The server name.
Returns:
the device aliases are stored in an array of strings.

get_device_domain

public java.lang.String[] get_device_domain(java.lang.String wildcard)
                                     throws fr.esrf.Tango.DevFailed
Query the database for a list of device domain names witch match the wildcard provided.
Parameters:
wildcard - Wildcard char is '*' and matches wildvcard characters.
Returns:
the device domain are stored in an array of strings.

get_device_family

public java.lang.String[] get_device_family(java.lang.String wildcard)
                                     throws fr.esrf.Tango.DevFailed
Query the database for a list of device family names witch match the wildcard provided.
Parameters:
wildcard - Wildcard char is '*' and matches wildvcard characters.
Returns:
the device family are stored in an array of strings.

get_device_member

public java.lang.String[] get_device_member(java.lang.String wildcard)
                                     throws fr.esrf.Tango.DevFailed
Query the database for a list of device member names witch match the wildcard provided.
Parameters:
wildcard - Wildcard char is '*' and matches wildvcard characters.
Returns:
the device member are stored in an array of strings.

add_server

public void add_server(java.lang.String servname,
                       DbDevInfo[] devinfos)
                throws fr.esrf.Tango.DevFailed
Add a group of devices to the database.
Parameters:
servname - Server name for these devices.
devinfo - Devices and server information.

delete_server

public void delete_server(java.lang.String devname)
                   throws fr.esrf.Tango.DevFailed
Delete the device server and its associated devices from the database.
Parameters:
devname - the device name.

export_server

public void export_server(java.lang.String devname,
                          DbDevExportInfo[] devinfos)
                   throws fr.esrf.Tango.DevFailed
Add a group of devices to the database.
Parameters:
servname - server name for these devices.
devinfo - Devices and server information.

unexport_server

public void unexport_server(java.lang.String devname)
                     throws fr.esrf.Tango.DevFailed
Mark all devices exported for this device server as unexported.
Parameters:
devname - the device name.

get_property

public DbDatum[] get_property(java.lang.String name,
                              java.lang.String[] propnames)
                       throws fr.esrf.Tango.DevFailed
Query the database for a list of object (i.e. non-device) properties for the pecified object.
Parameters:
name - Object name.
propnames - list of property names.

get_property

public DbDatum get_property(java.lang.String name,
                            java.lang.String propname)
                     throws fr.esrf.Tango.DevFailed
Query the database for an object (i.e. non-device) property for the pecified object.
Parameters:
name - Object name.
propname - list of property names.

get_property

public DbDatum[] get_property(java.lang.String name,
                              DbDatum[] properties)
                       throws fr.esrf.Tango.DevFailed
Query the database for a list of object (i.e. non-device) properties for thr dpecified object. The property names are specified by the DbDatum array objects.
Parameters:
name - Object name.
properties - list of property DbDatum objects.

put_property

public void put_property(java.lang.String name,
                         DbDatum[] properties)
                  throws fr.esrf.Tango.DevFailed
Insert or update a list of properties for the specified object The property names and their values are specified by the DbDatum array.
Parameters:
name - Object name.
properties - Properties names and values array.

delete_property

public void delete_property(java.lang.String name,
                            java.lang.String[] propnames)
                     throws fr.esrf.Tango.DevFailed
Delete a list of properties for the specified object.
Parameters:
name - Object name.
propnames - Property names.

delete_property

public void delete_property(java.lang.String name,
                            java.lang.String propname)
                     throws fr.esrf.Tango.DevFailed
Delete a property for the specified object.
Parameters:
name - Object name.
propname - Property names.

delete_property

public void delete_property(java.lang.String name,
                            DbDatum[] properties)
                     throws fr.esrf.Tango.DevFailed
Delete a list of properties for the specified object.
Parameters:
name - Object name.
properties - Property DbDatum objects.

get_class_property_list

public java.lang.String[] get_class_property_list(java.lang.String classname,
                                                  java.lang.String wildcard)
                                           throws fr.esrf.Tango.DevFailed
Query the database for a list of class properties for the pecified object.
Parameters:
classname - device name.
wildcard - propertie's wildcard (* matches any charactere).

get_device_property_list

public java.lang.String[] get_device_property_list(java.lang.String devname,
                                                   java.lang.String wildcard)
                                            throws fr.esrf.Tango.DevFailed
Query the database for a list of device properties for the pecified object.
Parameters:
devname - device name.
wildcard - propertie's wildcard (* matches any charactere).

get_device_property

public DbDatum[] get_device_property(java.lang.String name,
                                     java.lang.String[] propnames)
                              throws fr.esrf.Tango.DevFailed
Query the database for a list of device properties for the pecified object.
Parameters:
name - device name.
propnames - list of property names.

get_device_property

public DbDatum get_device_property(java.lang.String name,
                                   java.lang.String propname)
                            throws fr.esrf.Tango.DevFailed
Query the database for a device property for the pecified object.
Parameters:
name - device name.
propname - property name.

get_device_property

public DbDatum[] get_device_property(java.lang.String name,
                                     DbDatum[] properties)
                              throws fr.esrf.Tango.DevFailed
Query the database for a list of device properties for the pecified object. The property names are specified by the DbDatum array objects.
Parameters:
name - device name.
properties - list of property DbDatum objects.

put_device_property

public void put_device_property(java.lang.String name,
                                DbDatum[] properties)
                         throws fr.esrf.Tango.DevFailed
Insert or update a list of properties for the specified device The property names and their values are specified by the DbDatum array.
Parameters:
name - device name.
properties - Properties names and values array.

delete_device_property

public void delete_device_property(java.lang.String name,
                                   java.lang.String[] propnames)
                            throws fr.esrf.Tango.DevFailed
Delete a list of properties for the specified object.
Parameters:
name - Device name.
propnames - Property names.

delete_device_property

public void delete_device_property(java.lang.String name,
                                   java.lang.String propname)
                            throws fr.esrf.Tango.DevFailed
Delete a property for the specified object.
Parameters:
name - Device name.
propname - Property name.

delete_device_property

public void delete_device_property(java.lang.String name,
                                   DbDatum[] properties)
                            throws fr.esrf.Tango.DevFailed
Delete a list of properties for the specified object.
Parameters:
name - Device name.
properties - Property DbDatum objects.

get_device_attribute_property

public DbDatum[] get_device_attribute_property(java.lang.String name,
                                               java.lang.String[] propnames)
                                        throws fr.esrf.Tango.DevFailed
Query the database for a list of device attribute properties for the pecified object.
Parameters:
name - device name.
propnames - list of property names.

get_device_attribute_property

public DbDatum get_device_attribute_property(java.lang.String name,
                                             java.lang.String propname)
                                      throws fr.esrf.Tango.DevFailed
Query the database for device attribute property for the pecified object.
Parameters:
name - device name.
propname - property name.

get_device_attribute_property

public DbDatum[] get_device_attribute_property(java.lang.String name,
                                               DbDatum[] properties)
                                        throws fr.esrf.Tango.DevFailed
Query the database for a list of device attribute properties for the pecified object. The property names are specified by the DbDatum array objects.
Parameters:
name - device name.
properties - list of property DbDatum objects.

put_device_attribute_property

public void put_device_attribute_property(java.lang.String name,
                                          DbDatum[] properties)
                                   throws fr.esrf.Tango.DevFailed
Insert or update a list of properties for the specified device attribute. The property names and their values are specified by the DbDatum array.
Parameters:
name - device name.
properties - Properties names and values array.

delete_device_attribute_property

public void delete_device_attribute_property(java.lang.String name,
                                             java.lang.String[] propnames)
                                      throws fr.esrf.Tango.DevFailed
Delete a list of properties for the specified object.
Parameters:
name - Device name.
propnames - Property names.

delete_device_attribute_property

public void delete_device_attribute_property(java.lang.String name,
                                             java.lang.String propname)
                                      throws fr.esrf.Tango.DevFailed
Delete a property for the specified object.
Parameters:
name - Device name.
propname - Property name.

delete_device_attribute_property

public void delete_device_attribute_property(java.lang.String name,
                                             DbDatum[] properties)
                                      throws fr.esrf.Tango.DevFailed
Delete a list of properties for the specified object.
Parameters:
name - Device name.
properties - Property DbDatum objects.

get_class_property

public DbDatum[] get_class_property(java.lang.String name,
                                    java.lang.String[] propnames)
                             throws fr.esrf.Tango.DevFailed
Query the database for a list of class properties for the pecified object.
Parameters:
name - Class name.
propnames - list of property names.

get_class_property

public DbDatum get_class_property(java.lang.String name,
                                  java.lang.String propname)
                           throws fr.esrf.Tango.DevFailed
Query the database for a class property for the pecified object.
Parameters:
name - Class name.
propname - list of property names.

get_class_property

public DbDatum[] get_class_property(java.lang.String name,
                                    DbDatum[] properties)
                             throws fr.esrf.Tango.DevFailed
Query the database for a list of class properties for the pecified object. The property names are specified by the DbDatum array objects.
Parameters:
name - Class name.
properties - list of property DbDatum objects.

put_class_property

public void put_class_property(java.lang.String name,
                               DbDatum[] properties)
                        throws fr.esrf.Tango.DevFailed
Insert or update a list of properties for the specified class. The property names and their values are specified by the DbDatum array.
Parameters:
name - Class name.
properties - Properties names and values array.

delete_class_property

public void delete_class_property(java.lang.String name,
                                  java.lang.String[] propnames)
                           throws fr.esrf.Tango.DevFailed
Delete a list of properties for the specified object.
Parameters:
name - Class name.
propnames - Property names.

delete_class_property

public void delete_class_property(java.lang.String name,
                                  java.lang.String propname)
                           throws fr.esrf.Tango.DevFailed
Delete a property for the specified object.
Parameters:
name - Class name.
propname - Property name.

delete_class_property

public void delete_class_property(java.lang.String name,
                                  DbDatum[] properties)
                           throws fr.esrf.Tango.DevFailed
Delete a list of properties for the specified object.
Parameters:
name - Class name.
properties - Property DbDatum objects.

get_class_attribute_property

public DbDatum[] get_class_attribute_property(java.lang.String name,
                                              java.lang.String[] propnames)
                                       throws fr.esrf.Tango.DevFailed
Query the database for a list of class attribute properties for the pecified object.
Parameters:
name - Class name.
propnames - list of property names.

get_class_attribute_property

public DbDatum get_class_attribute_property(java.lang.String name,
                                            java.lang.String propname)
                                     throws fr.esrf.Tango.DevFailed
Query the database for a class attribute property for the pecified object.
Parameters:
name - Class name.
propname - property name.

get_class_attribute_property

public DbDatum[] get_class_attribute_property(java.lang.String name,
                                              DbDatum[] properties)
                                       throws fr.esrf.Tango.DevFailed
Query the database for a list of class attribute properties for the pecified object. The property names are specified by the DbDatum array objects.
Parameters:
name - Class name.
properties - list of property DbDatum objects.

put_class_attribute_property

public void put_class_attribute_property(java.lang.String name,
                                         DbDatum[] properties)
                                  throws fr.esrf.Tango.DevFailed
Insert or update a list of properties for the specified class attribute. The property names and their values are specified by the DbDatum array.
Parameters:
name - Class name.
properties - Properties names and values array.

delete_class_attribute_property

public void delete_class_attribute_property(java.lang.String name,
                                            java.lang.String[] propnames)
                                     throws fr.esrf.Tango.DevFailed
Delete a list of properties for the specified object.
Parameters:
name - Class name.
propnames - Property names.

delete_class_attribute_property

public void delete_class_attribute_property(java.lang.String name,
                                            java.lang.String propname)
                                     throws fr.esrf.Tango.DevFailed
Delete a property for the specified object.
Parameters:
name - Class name.
propname - Property names.

delete_class_attribute_property

public void delete_class_attribute_property(java.lang.String name,
                                            DbDatum[] properties)
                                     throws fr.esrf.Tango.DevFailed
Delete a list of properties for the specified object.
Parameters:
name - Class name.
properties - Property DbDatum objects.

TANGO Database API