idx
int64
0
41.2k
question
stringlengths
74
4.04k
target
stringlengths
7
750
19,900
public int log4j_to_tango_level ( Level level ) { if ( level . equals ( Level . OFF ) ) { return LOGGING_OFF ; } if ( level . equals ( Level . FATAL ) ) { return LOGGING_FATAL ; } if ( level . equals ( Level . ERROR ) ) { return LOGGING_ERROR ; } if ( level . equals ( Level . WARN ) ) { return LOGGING_WARN ; } if ( lev...
Given to log4j logging level converts it to TANGO level
19,901
public void set_rolling_file_threshold ( Logger logger , long rft ) { if ( logger == null ) { return ; } if ( rft < LOGGING_MIN_RFT ) { rft = LOGGING_MIN_RFT ; } else if ( rft > LOGGING_MAX_RFT ) { rft = LOGGING_MAX_RFT ; } String prefix = LOGGING_FILE_TARGET + LOGGING_SEPARATOR ; Enumeration all_appenders = logger . g...
Set the specified logger s rolling threshold
19,902
public void addAttribute ( final IAttributeBehavior behavior ) throws DevFailed { final AttributeConfiguration configuration = behavior . getConfiguration ( ) ; final String attributeName = configuration . getName ( ) ; xlogger . entry ( "adding dynamic attribute {}" , attributeName ) ; if ( behavior instanceof Forward...
Add attribute . Only if not already exists on device .
19,903
public void clearAttributesWithExclude ( final String ... exclude ) throws DevFailed { final String [ ] toExclude = new String [ exclude . length ] ; for ( int i = 0 ; i < toExclude . length ; i ++ ) { toExclude [ i ] = exclude [ i ] . toLowerCase ( Locale . ENGLISH ) ; } for ( final String attributeName : dynamicAttri...
Remove all dynamic attributes with exceptions
19,904
public void clearAttributes ( ) throws DevFailed { for ( final AttributeImpl attributeImpl : dynamicAttributes . values ( ) ) { deviceImpl . removeAttribute ( attributeImpl ) ; } forwardedAttributes . clear ( ) ; dynamicAttributes . clear ( ) ; }
Remove all dynamic attributes
19,905
public List < IAttributeBehavior > getDynamicAttributes ( ) { final List < IAttributeBehavior > result = new ArrayList < IAttributeBehavior > ( ) ; for ( final AttributeImpl attributeImpl : dynamicAttributes . values ( ) ) { result . add ( attributeImpl . getBehavior ( ) ) ; } return result ; }
Retrieve all dynamic attributes
19,906
public IAttributeBehavior getAttribute ( final String attributeName ) { AttributeImpl attr = dynamicAttributes . get ( attributeName . toLowerCase ( Locale . ENGLISH ) ) ; if ( attr == null ) return null ; else return attr . getBehavior ( ) ; }
Get a dynamic attribute
19,907
public void addCommand ( final ICommandBehavior behavior ) throws DevFailed { final String cmdName = behavior . getConfiguration ( ) . getName ( ) ; xlogger . entry ( "adding dynamic command {}" , cmdName ) ; final CommandImpl commandImpl = new CommandImpl ( behavior , deviceImpl . getName ( ) ) ; commandImpl . setStat...
Add command . Only if not already exists on device
19,908
public ICommandBehavior getCommand ( final String commandName ) { return dynamicCommands . get ( commandName . toLowerCase ( Locale . ENGLISH ) ) . getBehavior ( ) ; }
Get a dynamic command
19,909
public void clearCommands ( ) throws DevFailed { for ( final CommandImpl cmdImpl : dynamicCommands . values ( ) ) { deviceImpl . removeCommand ( cmdImpl ) ; } dynamicCommands . clear ( ) ; }
Remove all dynamic commands
19,910
public void clearCommandsWithExclude ( final String ... exclude ) throws DevFailed { final String [ ] toExclude = new String [ exclude . length ] ; for ( int i = 0 ; i < toExclude . length ; i ++ ) { toExclude [ i ] = exclude [ i ] . toLowerCase ( Locale . ENGLISH ) ; } for ( final String cmdName : dynamicCommands . ke...
Remove all dynamic command with exceptions
19,911
public List < ICommandBehavior > getDynamicCommands ( ) { final List < ICommandBehavior > result = new ArrayList < ICommandBehavior > ( ) ; for ( final CommandImpl cmdImpl : dynamicCommands . values ( ) ) { result . add ( cmdImpl . getBehavior ( ) ) ; } return result ; }
Retrieve all dynamic commands
19,912
public void write ( final Object value ) throws DevFailed { initDeviceAttributes ( ) ; for ( final DeviceAttribute deviceAttribute : deviceAttributes ) { if ( deviceAttribute != null ) { InsertExtractUtils . insert ( deviceAttribute , value ) ; } } group . write ( deviceAttributes ) ; }
Write a value on several attributes
19,913
public Object [ ] readExtract ( ) throws DevFailed { final DeviceAttribute [ ] da = read ( ) ; final Object [ ] results = extract ( da ) ; return results ; }
Read attributes and extract their values
19,914
public static synchronized ITangoDB getDatabase ( final String host , final String port ) throws DevFailed { final ITangoDB dbase ; if ( useDb ) { final String tangoHost = host + ":" + port ; if ( databaseMap . containsKey ( tangoHost ) ) { return databaseMap . get ( tangoHost ) ; } dbase = new Database ( host , port )...
Get the database object created for specified host and port .
19,915
public static synchronized ITangoDB getDatabase ( ) throws DevFailed { ITangoDB tangoDb = null ; if ( useDb ) { final String tangoHost = TangoHostManager . getFirstTangoHost ( ) ; if ( databaseMap . containsKey ( tangoHost ) ) { tangoDb = databaseMap . get ( tangoHost ) ; } else { DevFailed lastError = null ; final Map...
Get the database object using tango_host system property .
19,916
public static void setDbFile ( final File dbFile , final String [ ] devices , final String className ) throws DevFailed { DatabaseFactory . useDb = false ; DatabaseFactory . fileDatabase = new FileTangoDB ( dbFile , Arrays . copyOf ( devices , devices . length ) , className ) ; }
Build a mock tango db with a file containing the properties
19,917
public static void setNoDbDevices ( final String [ ] devices , final String className ) { DatabaseFactory . useDb = false ; DatabaseFactory . fileDatabase = new FileTangoDB ( Arrays . copyOf ( devices , devices . length ) , className ) ; }
Build a mock tango db
19,918
public static Object extract ( final DeviceAttribute da ) throws DevFailed { if ( da == null ) { throw DevFailedUtils . newDevFailed ( ERROR_MSG_DA ) ; } return InsertExtractFactory . getAttributeExtractor ( da . getType ( ) ) . extract ( da ) ; }
Extract read and write part values to an object for SCALAR SPECTRUM and IMAGE
19,919
public static Object extractRead ( final DeviceAttribute da , final AttrDataFormat format ) throws DevFailed { if ( da == null ) { throw DevFailedUtils . newDevFailed ( ERROR_MSG_DA ) ; } return InsertExtractFactory . getAttributeExtractor ( da . getType ( ) ) . extractRead ( da , format ) ; }
Extract read values to an object for SCALAR SPECTRUM and IMAGE
19,920
public static Object extractWriteArray ( final DeviceAttribute da , final AttrWriteType writeType , final AttrDataFormat format ) throws DevFailed { if ( da == null ) { throw DevFailedUtils . newDevFailed ( ERROR_MSG_DA ) ; } return InsertExtractFactory . getAttributeExtractor ( da . getType ( ) ) . extractWriteArray (...
Extract write values to an object for SCALAR SPECTRUM and IMAGE
19,921
public static < T > T extract ( final DeviceAttribute da , final Class < T > type ) throws DevFailed { if ( da == null ) { throw DevFailedUtils . newDevFailed ( ERROR_MSG_DA ) ; } return TypeConversionUtil . castToType ( type , extract ( da ) ) ; }
Extract read and write part values to an object for SCALAR SPECTRUM and IMAGE to the requested type
19,922
public static < T > T extractRead ( final DeviceAttribute da , final AttrDataFormat format , final Class < T > type ) throws DevFailed { if ( da == null ) { throw DevFailedUtils . newDevFailed ( ERROR_MSG_DA ) ; } return TypeConversionUtil . castToType ( type , extractRead ( da , format ) ) ; }
Extract read part values to an object for SCALAR SPECTRUM and IMAGE to the requested type
19,923
public static < T > T extractWrite ( final DeviceAttribute da , final AttrDataFormat format , final AttrWriteType writeType , final Class < T > type ) throws DevFailed { if ( da == null ) { throw DevFailedUtils . newDevFailed ( ERROR_MSG_DA ) ; } return TypeConversionUtil . castToType ( type , extractWrite ( da , write...
Extract write part values to an object for SCALAR SPECTRUM and IMAGE to the requested type
19,924
public static DServerClass instance ( ) { if ( _instance == null ) { System . err . println ( "DServerClass is not initialised !!!" ) ; System . err . println ( "Exiting" ) ; System . exit ( - 1 ) ; } return _instance ; }
Get the singleton object reference .
19,925
public void command_factory ( ) { command_list . addElement ( new DevRestartCmd ( "DevRestart" , Tango_DEV_STRING , Tango_DEV_VOID , "Device name" ) ) ; command_list . addElement ( new RestartServerCmd ( "RestartServer" , Tango_DEV_VOID , Tango_DEV_VOID ) ) ; command_list . addElement ( new QueryClassCmd ( "QueryClass"...
Create DServerClass commands .
19,926
public void device_factory ( String [ ] devlist ) throws DevFailed { Util . out4 . println ( "DServerClass::device_factory() arrived" ) ; for ( int i = 0 ; i < devlist . length ; i ++ ) { Util . out4 . println ( "Device name : " + devlist [ i ] ) ; device_list . addElement ( new DServer ( this , devlist [ i ] , "A devi...
Create and export device of the DServer class .
19,927
public String [ ] getDeviceList ( final String serverName , final String className ) { String [ ] result = new String [ 0 ] ; final Server server = servers . get ( serverName ) ; if ( server != null ) { final String [ ] devices = server . getDevices ( className ) ; if ( devices != null ) { result = Arrays . copyOf ( de...
Get devices of a server
19,928
public void build ( final Class < ? > clazz , final Field field , final DeviceImpl device , final Object businessObject ) throws DevFailed { xlogger . entry ( ) ; BuilderUtils . checkStatic ( field ) ; Method getter ; final String stateName = field . getName ( ) ; final String getterName = BuilderUtils . GET + stateNam...
Create a state
19,929
public AttributePropertiesImpl getAttributeProperties ( final String attributeName ) throws DevFailed { final AttributeImpl attr = AttributeGetterSetter . getAttribute ( attributeName , device . getAttributeList ( ) ) ; return attr . getProperties ( ) ; }
Get an attribute s properties
19,930
public void setAttributeProperties ( final String attributeName , final AttributePropertiesImpl properties ) throws DevFailed { final AttributeImpl attr = AttributeGetterSetter . getAttribute ( attributeName , device . getAttributeList ( ) ) ; attr . setProperties ( properties ) ; }
Configure an attribute s properties
19,931
public void removeAttributeProperties ( final String attributeName ) throws DevFailed { final AttributeImpl attr = AttributeGetterSetter . getAttribute ( attributeName , device . getAttributeList ( ) ) ; attr . removeProperties ( ) ; }
Remove an attribute s properties
19,932
public boolean isPolled ( final String polledObject ) throws DevFailed { try { return AttributeGetterSetter . getAttribute ( polledObject , device . getAttributeList ( ) ) . isPolled ( ) ; } catch ( final DevFailed e ) { return device . getCommand ( polledObject ) . isPolled ( ) ; } }
Check if an attribute or an command is polled
19,933
public int getPollingPeriod ( final String polledObject ) throws DevFailed { try { return AttributeGetterSetter . getAttribute ( polledObject , device . getAttributeList ( ) ) . getPollingPeriod ( ) ; } catch ( final DevFailed e ) { return device . getCommand ( polledObject ) . getPollingPeriod ( ) ; } }
Get polling period of an attribute or a command
19,934
public void startPolling ( final String polledObject , final int pollingPeriod ) throws DevFailed { try { final AttributeImpl attr = AttributeGetterSetter . getAttribute ( polledObject , device . getAttributeList ( ) ) ; attr . configurePolling ( pollingPeriod ) ; device . startPolling ( attr ) ; } catch ( final DevFai...
Configure polling of an attribute or a command and start it
19,935
public void pushEvent ( final String attributeName , final AttributeValue value , final EventType eventType ) throws DevFailed { switch ( eventType ) { case CHANGE_EVENT : case ARCHIVE_EVENT : case USER_EVENT : final AttributeImpl attribute = AttributeGetterSetter . getAttribute ( attributeName , device . getAttributeL...
Push an event if some client had register it .
19,936
public void pushDataReadyEvent ( final String attributeName , final int counter ) throws DevFailed { EventManager . getInstance ( ) . pushAttributeDataReadyEvent ( name , attributeName , counter ) ; }
Push a DATA_READY event if some client had registered it
19,937
public void pushPipeEvent ( final String pipeName , final PipeValue blob ) throws DevFailed { final PipeImpl pipe = DeviceImpl . getPipe ( pipeName , device . getPipeList ( ) ) ; try { pipe . updateValue ( blob ) ; EventManager . getInstance ( ) . pushPipeEvent ( name , pipeName , blob ) ; } catch ( final DevFailed e )...
Push a PIPE EVENT event if some client had registered it
19,938
public void execute ( ) throws DevFailed { GroupCmdReplyList replies ; if ( isArginVoid ( ) ) { replies = group . command_inout ( commandName , true ) ; } else { replies = group . command_inout ( commandName , inData , true ) ; } if ( replies . has_failed ( ) ) { for ( final Object obj : replies ) { ( ( GroupCmdReply )...
Execute the command on a single device or on a group If group is used the return data is not managed for the moment .
19,939
public void insert ( final Object value ) throws DevFailed { for ( int i = 0 ; i < group . get_size ( true ) ; i ++ ) { final int arginType = group . get_device ( i + 1 ) . command_query ( commandName ) . in_type ; InsertExtractUtils . insert ( inData [ i ] , arginType , value ) ; } }
insert a single value for all commands
19,940
public void insert ( final Object ... value ) throws DevFailed { if ( value . length == 1 ) { for ( int i = 0 ; i < group . get_size ( true ) ; i ++ ) { final int arginType = group . get_device ( i + 1 ) . command_query ( commandName ) . in_type ; InsertExtractUtils . insert ( inData [ i ] , arginType , value ) ; } } e...
insert a value per command
19,941
public static CommandImpl getCommand ( final String name , final List < CommandImpl > commandList ) throws DevFailed { CommandImpl result = null ; for ( final CommandImpl command : commandList ) { if ( command . getName ( ) . equalsIgnoreCase ( name ) ) { result = command ; break ; } } if ( result == null ) { throw Dev...
Get a command
19,942
public void set_default_properties ( UserDefaultAttrProp prop_list ) { if ( prop_list . label != null ) user_default_properties . addElement ( new AttrProperty ( "label" , prop_list . label ) ) ; if ( prop_list . description != null ) user_default_properties . addElement ( new AttrProperty ( "description" , prop_list ....
Set the attribute user default properties .
19,943
public T execute ( final Task < T > taskToWrap ) throws DevFailed { int triesLeft = tries ; do { try { return taskToWrap . call ( ) ; } catch ( final DevFailed e ) { triesLeft -- ; if ( triesLeft <= 0 ) { logger . error ( "Caught exception, all retries done for error: {}" , DevFailedUtils . toString ( e ) ) ; throw e ;...
Invokes the wrapped Callable s call method optionally retrying if an exception occurs . See class documentation for more detail .
19,944
public static void updatePollingConfigFromDB ( final PolledObjectConfig config , final AttributePropertiesManager attributePropertiesManager ) throws DevFailed { final String isPolledProp = attributePropertiesManager . getAttributePropertyFromDB ( config . getName ( ) , Constants . IS_POLLED ) ; if ( ! isPolledProp . i...
Update polling config in tango db
19,945
public void updateValue ( ) throws DevFailed { xlogger . entry ( getName ( ) ) ; if ( ! config . getWritable ( ) . equals ( AttrWriteType . READ ) && behavior instanceof ISetValueUpdater ) { try { final AttributeValue setValue = ( ( ISetValueUpdater ) behavior ) . getSetValue ( ) ; if ( setValue != null ) { writeValue ...
read attribute on device
19,946
public void updateValue ( final AttributeValue inValue ) throws DevFailed { xlogger . entry ( getName ( ) ) ; if ( inValue == null ) { throw DevFailedUtils . newDevFailed ( ExceptionMessages . ATTR_VALUE_NOT_SET , name + " read value has not been updated" ) ; } try { readValue = ( AttributeValue ) inValue . clone ( ) ;...
set the read value
19,947
public void setProperties ( final AttributePropertiesImpl properties ) throws DevFailed { if ( isMemorized ( ) ) { Object memorizedValue = getMemorizedValue ( ) ; if ( memorizedValue != null && memorizedValue . getClass ( ) . isAssignableFrom ( Number . class ) ) { final double memoValue = Double . parseDouble ( memori...
Set the attribute properties .
19,948
private Map < String , String [ ] > extractArgout ( final String [ ] result , final int startingPoint ) { final Map < String , String [ ] > map = new CaseInsensitiveMap < String [ ] > ( ) ; if ( result . length > 4 ) { int i = startingPoint ; int nextSize = Integer . valueOf ( result [ i + 1 ] ) ; while ( i < result . ...
Return a map of properties with name as key and value as entry
19,949
public Any execute ( DeviceImpl device , Any in_any ) throws DevFailed { Util . out4 . println ( "RemoveLoggingTargetCmd::execute(): arrived" ) ; String [ ] dvsa = null ; try { dvsa = extract_DevVarStringArray ( in_any ) ; } catch ( DevFailed df ) { Util . out3 . println ( "RemoveLoggingTargetCmd::execute() ) ; Except...
Executes the RemoveLoggingTargetCmd TANGO command
19,950
static String [ ] getProp ( final Map < String , String [ ] > prop , final String propertyName ) { String [ ] result = null ; if ( prop != null ) { for ( final Entry < String , String [ ] > entry : prop . entrySet ( ) ) { if ( entry . getKey ( ) . equalsIgnoreCase ( propertyName ) ) { result = entry . getValue ( ) ; } ...
Ignore case on property name
19,951
public static void setDevicePipePropertiesInDB ( final String deviceName , final String pipeName , final Map < String , String [ ] > properties ) throws DevFailed { LOGGER . debug ( "update pipe {} device properties {} in DB " , pipeName , properties . keySet ( ) ) ; DatabaseFactory . getDatabase ( ) . setDevicePipePro...
Set pipe device properties in db
19,952
public Any execute ( DeviceImpl device , Any in_any ) throws DevFailed { Util . out4 . println ( "StartLoggingCmd::execute(): arrived" ) ; Logging . instance ( ) . start_logging ( ) ; Util . out4 . println ( "Leaving StartLoggingCmd.execute()" ) ; return Util . return_empty_any ( "StartLogging" ) ; }
Executes the StartLoggingCmd TANGO command
19,953
@ StateMachine ( endState = DeviceState . ON ) public void init ( ) throws DevFailed { xlogger . entry ( ) ; TangoCacheManager . setPollSize ( pollingThreadsPoolSize ) ; status = "The device is ON\nThe polling is ON" ; tangoStats = TangoStats . getInstance ( ) ; xlogger . exit ( ) ; }
Init the device
19,954
@ Command ( name = "DevPollStatus" , inTypeDesc = DEVICE_NAME , outTypeDesc = "Device polling status" ) public String [ ] getPollStatus ( final String deviceName ) throws DevFailed { xlogger . entry ( deviceName ) ; String [ ] ret = new PollStatusCommand ( deviceName , classList ) . call ( ) ; xlogger . exit ( ret ) ; ...
get the polling status
19,955
@ Command ( name = "RestartServer" ) public void restartServer ( ) throws DevFailed { xlogger . entry ( ) ; tangoExporter . unexportAll ( ) ; tangoExporter . exportAll ( ) ; xlogger . exit ( ) ; }
Restart the whole server and its devices .
19,956
@ Command ( name = "Kill" ) public void kill ( ) throws DevFailed { xlogger . entry ( ) ; new Thread ( ) { public void run ( ) { logger . error ( "kill server" ) ; try { tangoExporter . unexportAll ( ) ; } catch ( final DevFailed e ) { } finally { ORBManager . shutdown ( ) ; System . exit ( - 1 ) ; } logger . error ( "...
Unexport everything and kill it self
19,957
@ Command ( name = "AddLoggingTarget" , inTypeDesc = "Str[i]=Device-name. Str[i+1]=Target-type::Target-name" ) public void addLoggingTarget ( final String [ ] argin ) throws DevFailed { if ( argin . length % 2 != 0 ) { throw DevFailedUtils . newDevFailed ( INPUT_ERROR , "argin must be of even size" ) ; } for ( int i = ...
Send logs to a device
19,958
@ Command ( name = "RemoveLoggingTarget" , inTypeDesc = "Str[i]=Device-name. Str[i+1]=Target-type::Target-name" ) public void removeLoggingTarget ( final String [ ] argin ) throws DevFailed { if ( argin . length % 2 != 0 ) { throw DevFailedUtils . newDevFailed ( INPUT_ERROR , "argin must be of even size" ) ; } for ( in...
remove logging to a device
19,959
@ Command ( name = "GetLoggingLevel" , inTypeDesc = "Device list" , outTypeDesc = "Lg[i]=Logging Level. Str[i]=Device name." ) public DevVarLongStringArray getLoggingLevel ( final String [ ] deviceNames ) { final int [ ] levels = new int [ deviceNames . length ] ; for ( int i = 0 ; i < levels . length ; i ++ ) { levels...
Get the logging level
19,960
@ Command ( name = "GetLoggingTarget" , inTypeDesc = DEVICE_NAME , outTypeDesc = "Logging target list" ) public String [ ] getLoggingTarget ( final String deviceName ) throws DevFailed { return LoggingManager . getInstance ( ) . getLoggingTarget ( deviceName ) ; }
Get logging target
19,961
@ Command ( name = "SetLoggingLevel" , inTypeDesc = "Lg[i]=Logging Level. Str[i]=Device name." ) public void setLoggingLevel ( final DevVarLongStringArray dvlsa ) throws DevFailed { final int [ ] levels = dvlsa . lvalue ; final String [ ] deviceNames = dvlsa . svalue ; if ( deviceNames . length != levels . length ) { t...
Set logging level
19,962
@ Command ( name = "QueryWizardClassProperty" , inTypeDesc = "Class name" , outTypeDesc = "Class property list (name - description and default value)" ) public String [ ] queryClassProp ( final String className ) throws DevFailed { xlogger . entry ( ) ; final List < String > names = new ArrayList < String > ( ) ; for (...
Get class properties
19,963
@ Command ( name = "QueryWizardDevProperty" , inTypeDesc = "Class name" , outTypeDesc = "Device property list (name - description and default value)" ) public String [ ] queryDevProp ( final String className ) { xlogger . entry ( ) ; final List < String > names = new ArrayList < String > ( ) ; for ( final DeviceClassBu...
Get device properties
19,964
private DevVarLongStringArray subcribeIDLInEventString ( final String eventTypeAndIDL , final String deviceName , final String objName ) throws DevFailed { String event = eventTypeAndIDL ; int idlversion = EventManager . MINIMUM_IDL_VERSION ; if ( eventTypeAndIDL . contains ( EventManager . IDL_LATEST ) ) { idlversion ...
Manage event subcription with event name like idl5_archive or archive
19,965
public Any execute ( DeviceImpl device , Any in_any ) throws DevFailed { Util . out4 . println ( "GetLoggingTargetCmd::execute(): arrived" ) ; String string = null ; try { string = extract_DevString ( in_any ) ; } catch ( DevFailed df ) { Util . out3 . println ( "GetLoggingTargetCmd::execute() ) ; Except . re_throw_ex...
Executes the GetLoggingTargetCmd TANGO command
19,966
public static synchronized void init ( final boolean useDb , final String adminDeviceName ) throws DevFailed { final Properties props = System . getProperties ( ) ; props . put ( "org.omg.CORBA.ORBClass" , "org.jacorb.orb.ORB" ) ; props . put ( "org.omg.CORBA.ORBSingletonClass" , "org.jacorb.orb.ORBSingleton" ) ; props...
Initialise the ORB
19,967
private static void checkServerRunning ( final DeviceImportInfo importInfo , final String toBeImported ) throws DevFailed { XLOGGER . entry ( ) ; Device_5 devIDL5 = null ; Device_4 devIDL4 = null ; Device_3 devIDL3 = null ; Device_2 devIDL2 = null ; Device devIDL1 = null ; try { try { devIDL5 = narrowIDL5 ( importInfo ...
Check the server is already running
19,968
public static void startDetached ( ) { orbStart = Executors . newSingleThreadExecutor ( new ThreadFactory ( ) { public Thread newThread ( final Runnable r ) { return new Thread ( r , "ORB run" ) ; } } ) ; orbStart . submit ( new StartTask ( ) ) ; LOGGER . debug ( "ORB started" ) ; }
Start the ORB . non blocking .
19,969
private static String checkORBgiopMaxMsgSize ( ) { String str = "20" ; final String tmp = System . getProperty ( "ORBgiopMaxMsgSize" ) ; if ( tmp != null && checkBufferSize ( tmp ) != null ) { str = tmp ; } return str ; }
Check if the checkORBgiopMaxMsgSize has been set . This environment variable should be set in Mega bytes .
19,970
public static void shutdown ( ) { if ( orbStart != null ) { orbStart . shutdown ( ) ; } if ( orb != null ) { orb . shutdown ( true ) ; LOGGER . debug ( "ORB shutdown" ) ; } }
Shutdown the ORB
19,971
public boolean isAllowed ( final DeviceState state ) { boolean isAllowed = true ; if ( deniedStates . contains ( state ) ) { isAllowed = false ; } return isAllowed ; }
Check if a state is allowed
19,972
public void build ( final Class < ? > clazz , final Field field , final DeviceImpl device , final Object businessObject ) throws DevFailed { xlogger . entry ( ) ; BuilderUtils . checkStatic ( field ) ; Method getter ; final String stateName = field . getName ( ) ; final String getterName = BuilderUtils . GET + stateNam...
Create a status
19,973
public static void waitForState ( final DeviceProxy proxy , final DevState waitState , final long timeout ) throws DevFailed , TimeoutException { waitForState ( proxy , waitState , timeout , 300 ) ; }
Wait for waitState
19,974
public static void failIfWrongStateAfterWhileState ( final DeviceProxy deviceProxy , final DevState expected , final DevState waitState , final long timeout , final long polling ) throws DevFailed , TimeoutException { waitWhileState ( deviceProxy , waitState , timeout , polling ) ; if ( ! expected . equals ( deviceProx...
Wait while waitState does not change and check the final finale
19,975
public static String getfullAttributeNameForAttribute ( final String attributeName ) throws DevFailed { String result ; final String [ ] fields = attributeName . split ( "/" ) ; final Database db = ApiUtil . get_db_obj ( ) ; if ( attributeName . contains ( DBASE_NO ) ) { result = attributeName ; } else if ( fields . le...
Get the full attribute name
19,976
public static String [ ] getDevicesForPattern ( final String deviceNamePattern ) throws DevFailed { String [ ] devices ; if ( ! deviceNamePattern . contains ( "*" ) ) { devices = new String [ 1 ] ; devices [ 0 ] = TangoUtil . getfullNameForDevice ( deviceNamePattern ) ; } else { final Database db = ApiUtil . get_db_obj...
Get the list of device names which matches the pattern p
19,977
public static String getAttributeName ( final String fullname ) throws DevFailed { final String s = TangoUtil . getfullAttributeNameForAttribute ( fullname ) ; return s . substring ( s . lastIndexOf ( '/' ) + 1 ) ; }
Return the attribute name part without device name It is able to resolve attribute alias before
19,978
protected boolean name_matches ( String pattern ) { pattern = pattern . toLowerCase ( ) . replaceAll ( "[*]{1}" , ".*?" ) ; return name . toLowerCase ( ) . matches ( pattern ) || get_fully_qualified_name ( ) . toLowerCase ( ) . matches ( pattern ) ; }
Returns true if name matches pattern
19,979
public void post_init ( final ORBInitInfo info ) { try { info . add_server_request_interceptor ( ServerRequestInterceptor . getInstance ( ) ) ; } catch ( final Exception e ) { logger . error ( "error registering server interceptor" , e ) ; } }
This method resolves the NameService and registers the interceptor .
19,980
public final static Object toPrimitiveArray ( final Object array ) { if ( ! array . getClass ( ) . isArray ( ) ) { return array ; } final Class < ? > clazz = OBJ_TO_PRIMITIVE . get ( array . getClass ( ) . getComponentType ( ) ) ; return setArray ( clazz , array ) ; }
Convert an array of Objects to primitives if possible . Return input otherwise
19,981
public final static Object toObjectArray ( final Object array ) { if ( ! array . getClass ( ) . isArray ( ) ) { return array ; } final Class < ? > clazz = PRIMITIVE_TO_OBJ . get ( array . getClass ( ) . getComponentType ( ) ) ; return setArray ( clazz , array ) ; }
Convert an array of primitives to Objects if possible . Return input otherwise
19,982
public static String [ ] toStringArray ( final Object array ) { final int length = Array . getLength ( array ) ; final String [ ] result = new String [ length ] ; for ( int i = 0 ; i < length ; i ++ ) { result [ i ] = Array . get ( array , i ) . toString ( ) ; } return result ; }
Convert an array of any type to an array of strings
19,983
public static Object addAll ( final Object array1 , final Object array2 ) { Object joinedArray ; if ( array1 == null ) { if ( array2 . getClass ( ) . isArray ( ) ) { joinedArray = array2 ; } else { joinedArray = Array . newInstance ( array2 . getClass ( ) , 1 ) ; Array . set ( joinedArray , 0 , array2 ) ; } } else if (...
Add 2 arrays
19,984
public static Object from2DArrayToArray ( final Object array2D ) { Object array = null ; if ( array2D . getClass ( ) . isArray ( ) ) { final int lengthY = Array . getLength ( array2D ) ; if ( Array . getLength ( array2D ) > 0 ) { final Object firstLine = Array . get ( array2D , 0 ) ; int lengthLineX ; if ( firstLine . ...
Convert a 2D array to a 1D array
19,985
public static boolean checkDimensions ( final Object object , final int dimX , final int dimY ) { boolean hasGoodDimensions = false ; if ( object != null ) { if ( object . getClass ( ) . isArray ( ) ) { if ( Array . getLength ( object ) == 0 && dimX == 0 ) { hasGoodDimensions = true ; } else if ( object . getClass ( ) ...
Check of size corresponds to given dimensions
19,986
public static Object fromArrayTo2DArray ( final Object array , final int dimX , final int dimY ) throws DevFailed { Object array2D = null ; if ( array . getClass ( ) . isArray ( ) ) { if ( dimY > 0 ) { array2D = Array . newInstance ( array . getClass ( ) . getComponentType ( ) , dimY , dimX ) ; for ( int y = 0 ; y < di...
Convert an array to a 2D array
19,987
public String [ ] getDeviceStateArray ( ) { final String [ ] array = new String [ deviceStateMap . size ( ) ] ; int i = 0 ; for ( final Map . Entry < String , DevState > deviceStateEntry : deviceStateMap . entrySet ( ) ) { final String deviceName = deviceStateEntry . getKey ( ) ; final DevState deviceState = deviceStat...
return an array of String which contains deviceName and his state .
19,988
public short [ ] getDeviceStateNumberArray ( ) { final short [ ] array = new short [ deviceStateMap . size ( ) ] ; int i = 0 ; for ( final Map . Entry < String , DevState > deviceStateEntry : deviceStateMap . entrySet ( ) ) { final DevState deviceState = deviceStateEntry . getValue ( ) ; array [ i ++ ] = ( short ) getP...
return an array of short which contains the priority of state of monitored devices .
19,989
public < T > T read ( final Class < T > type ) throws DevFailed { update ( ) ; return extract ( type ) ; }
Read the tango attribute with SCALAR format and convert it
19,990
public < T > Object readArray ( final Class < T > type ) throws DevFailed { update ( ) ; return extractArray ( type ) ; }
Read attribute and return result as array .
19,991
public < T > T readWritten ( final Class < T > type ) throws DevFailed { update ( ) ; return extractWritten ( type ) ; }
Read written value of attribute
19,992
public < T > T [ ] readSpecOrImage ( final Class < T > type ) throws DevFailed { update ( ) ; return extractSpecOrImage ( type ) ; }
Read attribute with format SPECTRUM or IMAGE
19,993
public String readAsString ( final String separator , final String endSeparator ) throws DevFailed { update ( ) ; return extractToString ( separator , endSeparator ) ; }
Read attribute and convert it to a String with separators
19,994
public void insert ( final Object value ) throws DevFailed { logger . debug ( LOG_INSERTING , this ) ; attributeImpl . insert ( value ) ; }
Insert scalar spectrum or image . spectrum can be arrays of Objects or primitives . image can be 2D arrays of Objects or primitives
19,995
public Number extractNumber ( ) throws DevFailed { logger . debug ( LOG_EXTRACTING , this ) ; final Object result = attributeImpl . extract ( ) ; if ( ! Number . class . isAssignableFrom ( result . getClass ( ) ) ) { throw DevFailedUtils . newDevFailed ( TANGO_WRONG_DATA_ERROR , THIS_ATTRIBUTE_MUST_BE_A_JAVA_LANG_NUMBE...
Extract value in a Number without conversion
19,996
public static void initPoolConf ( ) throws DevFailed { polledDevices . clear ( ) ; final Map < String , String [ ] > prop = PropertiesUtils . getDeviceProperties ( ServerManager . getInstance ( ) . getAdminDeviceName ( ) ) ; if ( prop . containsKey ( POLLING_THREADS_POOL_CONF ) ) { final String [ ] pollingThreadsPoolCo...
Retrieve the ordered list of polled devices
19,997
private void updatePoolConf ( ) throws DevFailed { if ( ! polledDevices . contains ( deviceName ) ) { polledDevices . add ( deviceName ) ; final Map < String , String [ ] > properties = new HashMap < String , String [ ] > ( ) ; properties . put ( POLLING_THREADS_POOL_CONF , polledDevices . toArray ( new String [ 0 ] ) ...
Add the current device in polled list and persist it as device property of admin device . This property is not used . Just here to have the same behavior as C ++ Tango API .
19,998
public synchronized void startCommandPolling ( final CommandImpl command ) throws DevFailed { addCommandPolling ( command ) ; LOGGER . debug ( "starting command {} for polling on device {}" , command . getName ( ) , deviceName ) ; if ( command . getPollingPeriod ( ) != 0 ) { commandCacheMap . get ( command ) . startRef...
Start command polling
19,999
private void addCommandPolling ( final CommandImpl command ) throws DevFailed { if ( MANAGER == null ) { startCache ( ) ; } removeCommandPolling ( command ) ; final CommandCache cache = new CommandCache ( MANAGER , command , deviceName , deviceLock , aroundInvoke ) ; if ( command . getPollingPeriod ( ) == 0 ) { extTrig...
Add command as polled