TANGO Java API
( TangORB-7.3.3.jar)

fr.esrf.TangoApi
Class ConnectionDAODefaultImpl

java.lang.Object
  extended by fr.esrf.TangoApi.ConnectionDAODefaultImpl
All Implemented Interfaces:
ApiDefs, IConnectionDAO
Direct Known Subclasses:
DatabaseDAODefaultImpl, DeviceProxyDAODefaultImpl

public class ConnectionDAODefaultImpl
extends java.lang.Object
implements ApiDefs, IConnectionDAO

Class Description: This class manage device connection for Tango objects. It is an api between user and IDL Device object.

Version:
$Revision: 1.19 $
Author:
verdier

Field Summary
 
Fields inherited from interface fr.esrf.TangoApi.ApiDefs
ALL_ASYNCH, ATT_R, ATT_W, CALLBACK, CMD, D_TCP, D_UDP, FROM_ATTR, FROM_CMD, FROM_DBASE, FROM_IOR, LOGGING_DEBUG, LOGGING_ERROR, LOGGING_FATAL, LOGGING_INFO, LOGGING_OFF, LOGGING_WARN, MISC, NO_TIMEOUT, POLLING, protocol_name, PULL_CALLBACK, PUSH_CALLBACK, TACO, TANGO
 
Constructor Summary
ConnectionDAODefaultImpl()
           
 
Method Summary
 java.lang.String adm_name(Connection connection)
          return the administartion device name.
 java.lang.String[] black_box(Connection connection, int length)
          Execute a info command to a device server.
 void build_connection(Connection connection)
           
 void checkIfTaco(Connection connection, java.lang.String cmdname)
          if not a TACO command then throw a DevFailed Exception.
 void checkIfTango(Connection connection, java.lang.String cmdname)
          if not a TACO command then throw a DevFailed Exception.
 DeviceData command_inout(Connection connection, java.lang.String command)
          Send a command to a device server.
 DeviceData command_inout(Connection connection, java.lang.String command, DeviceData argin)
          Send a command to a device server.
 CommandInfo[] command_list_query(Connection connection)
          Execute a command_list_query command to a device server.
 java.lang.String description(Connection connection)
          return the device connected dexcription.
 void dev_import(Connection connection)
          Really build the device connection.
 java.lang.String get_class_name(Connection connection)
          return the device connected class name.
 Device get_device(Connection connection)
           
 java.lang.String get_host_name(Connection connection)
          return the device connected host name.
 int get_idl_version(Connection connection)
          Returns the IDL version supported
 java.lang.String get_ior(Connection connection)
           
 java.lang.String get_name(Connection connection)
          return the device connected name.
 java.lang.String get_server_name(Connection connection)
          return the device connected server name.
 DevSource get_source(Connection connection)
          returns the device data source
 java.lang.String get_tango_host(Connection connection)
          return the name of connection (host:port)
 int get_timeout_millis(Connection connection)
          return the timeout value for a device call.
 int get_timeout(Connection connection)
          Deprecated. use get_timeout_millis() instead
 boolean get_transparency_reconnection(Connection connection)
          return the value of transparent_reconnection
 int getAccessControl(Connection connection)
           
 DevInfo_3 info_3(Connection connection)
          Execute a info command to a device server.
 DevInfo info(Connection connection)
          Execute a info command to a device server.
 void init(Connection connection)
          Connection constructor.
 void init(Connection connection, DbDevImportInfo info)
          Connection constructor.
 void init(Connection connection, java.lang.String devname)
          Connection constructor.
 void init(Connection connection, java.lang.String devname, boolean check_access)
          Connection constructor.
 void init(Connection connection, java.lang.String host, java.lang.String port)
          Connection constructor.
 void init(Connection connection, java.lang.String host, java.lang.String port, boolean auto_reconnect)
          Connection constructor.
 void init(Connection connection, java.lang.String devname, java.lang.String param, int src)
          Connection constructor.
 void init(Connection connection, java.lang.String devname, java.lang.String host, java.lang.String port)
          Connection constructor.
 boolean is_taco(Connection connection)
          return true if device is a taco device
 boolean isAllowedCommand(Connection connection, java.lang.String cmd)
           
 long ping(Connection connection)
          Execute a ping command to a device server.
 void set_source(Connection connection, DevSource new_src)
          Set the device data source
 void set_timeout_millis(Connection connection, int millis)
          Change the timeout value for a device call.
 void set_transparency_reconnection(Connection connection, boolean val)
          set the value of transparent_reconnection
 void setAccessControl(Connection connection, int access)
           
 void throw_dev_failed(Connection connection, java.lang.Exception e, java.lang.String command, boolean from_inout_cmd)
          Build reason and origin of the exception And throw it into a DevFailed exception
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConnectionDAODefaultImpl

public ConnectionDAODefaultImpl()
Method Detail

get_device

public Device get_device(Connection connection)
Specified by:
get_device in interface IConnectionDAO

init

public void init(Connection connection)
          throws DevFailed
Connection constructor. It makes a connection on database server.

Specified by:
init in interface IConnectionDAO
Throws:
DevFailed

init

public void init(Connection connection,
                 java.lang.String host,
                 java.lang.String port)
          throws DevFailed
Connection constructor. It makes a connection on database server.

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

init

public void init(Connection connection,
                 java.lang.String host,
                 java.lang.String port,
                 boolean auto_reconnect)
          throws DevFailed
Connection constructor. It makes a connection on database server.

Specified by:
init in interface IConnectionDAO
Parameters:
host - host where database is running.
port - port for database connection.
auto_reconnect - do not reconnect if false.
Throws:
DevFailed

init

public void init(Connection connection,
                 java.lang.String devname)
          throws DevFailed
Connection constructor. It imports the device.

Specified by:
init in interface IConnectionDAO
Parameters:
devname - name of the device to be imported.
Throws:
DevFailed

init

public void init(Connection connection,
                 DbDevImportInfo info)
          throws DevFailed
Connection constructor. It imports the device.

Specified by:
init in interface IConnectionDAO
Parameters:
info - exported info of the device to be imported.
Throws:
DevFailed

init

public void init(Connection connection,
                 java.lang.String devname,
                 boolean check_access)
          throws DevFailed
Connection constructor. It imports the device. And set check_access.

Specified by:
init in interface IConnectionDAO
Parameters:
devname - name of the device to be imported.
check_access - set check_access value
Throws:
DevFailed

init

public void init(Connection connection,
                 java.lang.String devname,
                 java.lang.String param,
                 int src)
          throws DevFailed
Connection constructor. It imports the device.

Specified by:
init in interface IConnectionDAO
Parameters:
devname - name of the device to be imported.
param - String parameter to import device.
src - Source to import device (ior, dbase...)
Throws:
DevFailed

init

public void init(Connection connection,
                 java.lang.String devname,
                 java.lang.String host,
                 java.lang.String port)
          throws DevFailed
Connection constructor. It imports the device.

Specified by:
init in interface IConnectionDAO
Parameters:
devname - name of the device to be imported.
host - host where database is running.
port - port for database connection.
Throws:
DevFailed

build_connection

public void build_connection(Connection connection)
                      throws DevFailed
Specified by:
build_connection in interface IConnectionDAO
Throws:
DevFailed

get_ior

public java.lang.String get_ior(Connection connection)
                         throws DevFailed
Specified by:
get_ior in interface IConnectionDAO
Throws:
DevFailed

get_host_name

public java.lang.String get_host_name(Connection connection)
                               throws DevFailed
Description copied from interface: IConnectionDAO
return the device connected host name.

Specified by:
get_host_name in interface IConnectionDAO
Throws:
DevFailed

get_server_name

public java.lang.String get_server_name(Connection connection)
                                 throws DevFailed
Description copied from interface: IConnectionDAO
return the device connected server name.

Specified by:
get_server_name in interface IConnectionDAO
Throws:
DevFailed

get_class_name

public java.lang.String get_class_name(Connection connection)
                                throws DevFailed
Description copied from interface: IConnectionDAO
return the device connected class name.

Specified by:
get_class_name in interface IConnectionDAO
Throws:
DevFailed

dev_import

public void dev_import(Connection connection)
                throws DevFailed
Really build the device connection.

Specified by:
dev_import in interface IConnectionDAO
Throws:
DevFailed

set_timeout_millis

public void set_timeout_millis(Connection connection,
                               int millis)
                        throws DevFailed
Change the timeout value for a device call.

Specified by:
set_timeout_millis in interface IConnectionDAO
Parameters:
millis - New value of the timeout in milliseconds.
Throws:
DevFailed - if orb.create_policy throws an org.omg.CORBA.PolicyError exception.

get_timeout

@Deprecated
public int get_timeout(Connection connection)
Deprecated. use get_timeout_millis() instead

return the timeout value for a device call.

Specified by:
get_timeout in interface IConnectionDAO
Returns:
the value of the timeout in milliseconds.

get_timeout_millis

public int get_timeout_millis(Connection connection)
                       throws DevFailed
return the timeout value for a device call.

Specified by:
get_timeout_millis in interface IConnectionDAO
Returns:
the value of the timeout in milliseconds.
Throws:
DevFailed

throw_dev_failed

public void throw_dev_failed(Connection connection,
                             java.lang.Exception e,
                             java.lang.String command,
                             boolean from_inout_cmd)
                      throws DevFailed
Build reason and origin of the exception And throw it into a DevFailed exception

Specified by:
throw_dev_failed in interface IConnectionDAO
Throws:
DevFailed

command_inout

public DeviceData command_inout(Connection connection,
                                java.lang.String command,
                                DeviceData argin)
                         throws DevFailed
Send a command to a device server.

Specified by:
command_inout in interface IConnectionDAO
Parameters:
command - Command name to send to the device.
argin - input command argument.
Returns:
the output argument of the command.
Throws:
DevFailed

command_inout

public DeviceData command_inout(Connection connection,
                                java.lang.String command)
                         throws DevFailed
Send a command to a device server.

Specified by:
command_inout in interface IConnectionDAO
Parameters:
command - Command name.
Returns:
the output argument of the command.
Throws:
DevFailed

ping

public long ping(Connection connection)
          throws DevFailed
Execute a ping command to a device server.

Specified by:
ping in interface IConnectionDAO
Returns:
the elapsed time for ping command in microseconds.
Throws:
DevFailed

black_box

public java.lang.String[] black_box(Connection connection,
                                    int length)
                             throws DevFailed
Execute a info command to a device server.

Specified by:
black_box in interface IConnectionDAO
Throws:
DevFailed

info_3

public DevInfo_3 info_3(Connection connection)
                 throws DevFailed
Execute a info command to a device server.

Specified by:
info_3 in interface IConnectionDAO
Throws:
DevFailed

info

public DevInfo info(Connection connection)
             throws DevFailed
Execute a info command to a device server.

Specified by:
info in interface IConnectionDAO
Throws:
DevFailed

command_list_query

public CommandInfo[] command_list_query(Connection connection)
                                 throws DevFailed
Execute a command_list_query command to a device server.

Specified by:
command_list_query in interface IConnectionDAO
Throws:
DevFailed

get_idl_version

public int get_idl_version(Connection connection)
                    throws DevFailed
Returns the IDL version supported

Specified by:
get_idl_version in interface IConnectionDAO
Returns:
the IDL version supported .
Throws:
DevFailed

get_source

public DevSource get_source(Connection connection)
                     throws DevFailed
returns the device data source

Specified by:
get_source in interface IConnectionDAO
Returns:
data source (CACHE_DEV, CACHE or DEV).
Throws:
DevFailed

set_source

public void set_source(Connection connection,
                       DevSource new_src)
                throws DevFailed
Set the device data source

Specified by:
set_source in interface IConnectionDAO
Parameters:
new_src - new data source (CACHE_DEV, CACHE or DEV).
Throws:
DevFailed

get_name

public java.lang.String get_name(Connection connection)
return the device connected name.

Specified by:
get_name in interface IConnectionDAO

description

public java.lang.String description(Connection connection)
                             throws DevFailed
return the device connected dexcription.

Specified by:
description in interface IConnectionDAO
Throws:
DevFailed

adm_name

public java.lang.String adm_name(Connection connection)
                          throws DevFailed
return the administartion device name.

Specified by:
adm_name in interface IConnectionDAO
Throws:
DevFailed

get_tango_host

public java.lang.String get_tango_host(Connection connection)
                                throws DevFailed
return the name of connection (host:port)

Specified by:
get_tango_host in interface IConnectionDAO
Throws:
DevFailed

is_taco

public boolean is_taco(Connection connection)
return true if device is a taco device

Specified by:
is_taco in interface IConnectionDAO

checkIfTaco

public void checkIfTaco(Connection connection,
                        java.lang.String cmdname)
                 throws DevFailed
if not a TACO command then throw a DevFailed Exception.

Specified by:
checkIfTaco in interface IConnectionDAO
Parameters:
cmdname - command name to be put inside reason and origin fields.
Throws:
DevFailed

checkIfTango

public void checkIfTango(Connection connection,
                         java.lang.String cmdname)
                  throws DevFailed
if not a TACO command then throw a DevFailed Exception.

Specified by:
checkIfTango in interface IConnectionDAO
Parameters:
cmdname - command name to be put inside reason and origin fields.
Throws:
DevFailed

get_transparency_reconnection

public boolean get_transparency_reconnection(Connection connection)
return the value of transparent_reconnection

Specified by:
get_transparency_reconnection in interface IConnectionDAO

set_transparency_reconnection

public void set_transparency_reconnection(Connection connection,
                                          boolean val)
set the value of transparent_reconnection

Specified by:
set_transparency_reconnection in interface IConnectionDAO

getAccessControl

public int getAccessControl(Connection connection)
Specified by:
getAccessControl in interface IConnectionDAO

setAccessControl

public void setAccessControl(Connection connection,
                             int access)
Specified by:
setAccessControl in interface IConnectionDAO

isAllowedCommand

public boolean isAllowedCommand(Connection connection,
                                java.lang.String cmd)
                         throws DevFailed
Specified by:
isAllowedCommand in interface IConnectionDAO
Throws:
DevFailed

TANGO Java API
( TangORB-7.3.3.jar)