id int32 0 165k | repo stringlengths 7 58 | path stringlengths 12 218 | func_name stringlengths 3 140 | original_string stringlengths 73 34.1k | language stringclasses 1 value | code stringlengths 73 34.1k | code_tokens list | docstring stringlengths 3 16k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 105 339 |
|---|---|---|---|---|---|---|---|---|---|---|---|
140,300 | tango-controls/JTango | dao/src/main/java/fr/esrf/TangoDs/Logging.java | Logging.get_logging_target | public String[] get_logging_target (String dev_name) throws DevFailed {
//- Get device by name
DeviceImpl dev = Util.instance().get_device_by_name(dev_name);
//- Get device targets (i.e appenders)
Enumeration all_appenders = dev.get_logger().getAllAppenders();
//- Instanciate returned value
int num_appenders = 0;
Enumeration a_shame_copy = dev.get_logger().getAllAppenders();
while (a_shame_copy.hasMoreElements()) {
num_appenders++;
a_shame_copy.nextElement();
}
String[] targets = new String[num_appenders];
//- Populate the returned value
num_appenders = 0;
while (all_appenders.hasMoreElements()) {
Appender appender = (Appender)all_appenders.nextElement();
targets[num_appenders++] = appender.getName();
}
return targets;
} | java | public String[] get_logging_target (String dev_name) throws DevFailed {
//- Get device by name
DeviceImpl dev = Util.instance().get_device_by_name(dev_name);
//- Get device targets (i.e appenders)
Enumeration all_appenders = dev.get_logger().getAllAppenders();
//- Instanciate returned value
int num_appenders = 0;
Enumeration a_shame_copy = dev.get_logger().getAllAppenders();
while (a_shame_copy.hasMoreElements()) {
num_appenders++;
a_shame_copy.nextElement();
}
String[] targets = new String[num_appenders];
//- Populate the returned value
num_appenders = 0;
while (all_appenders.hasMoreElements()) {
Appender appender = (Appender)all_appenders.nextElement();
targets[num_appenders++] = appender.getName();
}
return targets;
} | [
"public",
"String",
"[",
"]",
"get_logging_target",
"(",
"String",
"dev_name",
")",
"throws",
"DevFailed",
"{",
"//- Get device by name",
"DeviceImpl",
"dev",
"=",
"Util",
".",
"instance",
"(",
")",
".",
"get_device_by_name",
"(",
"dev_name",
")",
";",
"//- Get device targets (i.e appenders)",
"Enumeration",
"all_appenders",
"=",
"dev",
".",
"get_logger",
"(",
")",
".",
"getAllAppenders",
"(",
")",
";",
"//- Instanciate returned value",
"int",
"num_appenders",
"=",
"0",
";",
"Enumeration",
"a_shame_copy",
"=",
"dev",
".",
"get_logger",
"(",
")",
".",
"getAllAppenders",
"(",
")",
";",
"while",
"(",
"a_shame_copy",
".",
"hasMoreElements",
"(",
")",
")",
"{",
"num_appenders",
"++",
";",
"a_shame_copy",
".",
"nextElement",
"(",
")",
";",
"}",
"String",
"[",
"]",
"targets",
"=",
"new",
"String",
"[",
"num_appenders",
"]",
";",
"//- Populate the returned value",
"num_appenders",
"=",
"0",
";",
"while",
"(",
"all_appenders",
".",
"hasMoreElements",
"(",
")",
")",
"{",
"Appender",
"appender",
"=",
"(",
"Appender",
")",
"all_appenders",
".",
"nextElement",
"(",
")",
";",
"targets",
"[",
"num_appenders",
"++",
"]",
"=",
"appender",
".",
"getName",
"(",
")",
";",
"}",
"return",
"targets",
";",
"}"
] | Get logging target for the specified devices
@param dev_name The device names | [
"Get",
"logging",
"target",
"for",
"the",
"specified",
"devices"
] | 1ccc9dcb83e6de2359a9f1906d170571cacf1345 | https://github.com/tango-controls/JTango/blob/1ccc9dcb83e6de2359a9f1906d170571cacf1345/dao/src/main/java/fr/esrf/TangoDs/Logging.java#L648-L668 |
140,301 | tango-controls/JTango | dao/src/main/java/fr/esrf/TangoDs/Logging.java | Logging.stop_logging | public void stop_logging () {
Vector dl = Util.instance().get_device_list("*");
for (Object aDl : dl) {
((DeviceImpl) aDl).stop_logging();
}
} | java | public void stop_logging () {
Vector dl = Util.instance().get_device_list("*");
for (Object aDl : dl) {
((DeviceImpl) aDl).stop_logging();
}
} | [
"public",
"void",
"stop_logging",
"(",
")",
"{",
"Vector",
"dl",
"=",
"Util",
".",
"instance",
"(",
")",
".",
"get_device_list",
"(",
"\"*\"",
")",
";",
"for",
"(",
"Object",
"aDl",
":",
"dl",
")",
"{",
"(",
"(",
"DeviceImpl",
")",
"aDl",
")",
".",
"stop_logging",
"(",
")",
";",
"}",
"}"
] | For each device, save its current logging Level then set it to OFF | [
"For",
"each",
"device",
"save",
"its",
"current",
"logging",
"Level",
"then",
"set",
"it",
"to",
"OFF"
] | 1ccc9dcb83e6de2359a9f1906d170571cacf1345 | https://github.com/tango-controls/JTango/blob/1ccc9dcb83e6de2359a9f1906d170571cacf1345/dao/src/main/java/fr/esrf/TangoDs/Logging.java#L673-L678 |
140,302 | tango-controls/JTango | dao/src/main/java/fr/esrf/TangoDs/Logging.java | Logging.log4j_to_tango_level | 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 (level.equals(Level.INFO)) {
return LOGGING_INFO;
}
return LOGGING_DEBUG;
} | java | 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 (level.equals(Level.INFO)) {
return LOGGING_INFO;
}
return LOGGING_DEBUG;
} | [
"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",
"(",
"level",
".",
"equals",
"(",
"Level",
".",
"INFO",
")",
")",
"{",
"return",
"LOGGING_INFO",
";",
"}",
"return",
"LOGGING_DEBUG",
";",
"}"
] | Given to log4j logging level, converts it to TANGO level | [
"Given",
"to",
"log4j",
"logging",
"level",
"converts",
"it",
"to",
"TANGO",
"level"
] | 1ccc9dcb83e6de2359a9f1906d170571cacf1345 | https://github.com/tango-controls/JTango/blob/1ccc9dcb83e6de2359a9f1906d170571cacf1345/dao/src/main/java/fr/esrf/TangoDs/Logging.java#L819-L837 |
140,303 | tango-controls/JTango | dao/src/main/java/fr/esrf/TangoDs/Logging.java | Logging.set_rolling_file_threshold | 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.getAllAppenders();
while (all_appenders.hasMoreElements()) {
Appender appender = (Appender)all_appenders.nextElement();
if (appender.getName().indexOf(prefix) != -1) {
TangoRollingFileAppender trfa = (TangoRollingFileAppender) appender;
trfa.setMaximumFileSize(rft * 1024);
}
}
} | java | 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.getAllAppenders();
while (all_appenders.hasMoreElements()) {
Appender appender = (Appender)all_appenders.nextElement();
if (appender.getName().indexOf(prefix) != -1) {
TangoRollingFileAppender trfa = (TangoRollingFileAppender) appender;
trfa.setMaximumFileSize(rft * 1024);
}
}
} | [
"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",
".",
"getAllAppenders",
"(",
")",
";",
"while",
"(",
"all_appenders",
".",
"hasMoreElements",
"(",
")",
")",
"{",
"Appender",
"appender",
"=",
"(",
"Appender",
")",
"all_appenders",
".",
"nextElement",
"(",
")",
";",
"if",
"(",
"appender",
".",
"getName",
"(",
")",
".",
"indexOf",
"(",
"prefix",
")",
"!=",
"-",
"1",
")",
"{",
"TangoRollingFileAppender",
"trfa",
"=",
"(",
"TangoRollingFileAppender",
")",
"appender",
";",
"trfa",
".",
"setMaximumFileSize",
"(",
"rft",
"*",
"1024",
")",
";",
"}",
"}",
"}"
] | Set the specified logger's rolling threshold | [
"Set",
"the",
"specified",
"logger",
"s",
"rolling",
"threshold"
] | 1ccc9dcb83e6de2359a9f1906d170571cacf1345 | https://github.com/tango-controls/JTango/blob/1ccc9dcb83e6de2359a9f1906d170571cacf1345/dao/src/main/java/fr/esrf/TangoDs/Logging.java#L842-L860 |
140,304 | tango-controls/JTango | server/src/main/java/org/tango/server/dynamic/DynamicManager.java | DynamicManager.addAttribute | 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 ForwardedAttribute) {
// init attribute with either the attribute property value, or the value defined in its constructor
final ForwardedAttribute att = (ForwardedAttribute) behavior;
final String deviceName = deviceImpl.getName();
final String rootAttributeName = behavior.getConfiguration().getAttributeProperties()
.loadAttributeRootName(deviceName, attributeName);
if (rootAttributeName == null || rootAttributeName.isEmpty()
|| rootAttributeName.equalsIgnoreCase(Constants.NOT_SPECIFIED)) {
att.init(deviceName);
// persist root attribute name in tango db
behavior.getConfiguration().getAttributeProperties()
.persistAttributeRootName(deviceName, attributeName);
} else {
// use attribute property
att.init(deviceName, rootAttributeName);
}
// check if this attribute is already created
final String lower = att.getRootName().toLowerCase(Locale.ENGLISH);
if (forwardedAttributes.contains(lower)) {
throw DevFailedUtils.newDevFailed(ExceptionMessages.FWD_DOUBLE_USED,
"root attribute already used in this device");
} else {
forwardedAttributes.add(lower);
}
} else {
// set default properties
final AttributePropertiesImpl prop = configuration.getAttributeProperties();
if (prop.getLabel().isEmpty()) {
prop.setLabel(configuration.getName());
}
if (prop.getFormat().equals(Constants.NOT_SPECIFIED)) {
prop.setDefaultFormat(configuration.getScalarType());
}
}
final AttributeImpl attrImpl = new AttributeImpl(behavior, deviceImpl.getName());
attrImpl.setStateMachine(behavior.getStateMachine());
deviceImpl.addAttribute(attrImpl);
dynamicAttributes.put(attributeName.toLowerCase(Locale.ENGLISH), attrImpl);
deviceImpl.pushInterfaceChangeEvent(false);
if (configuration.isPolled() && configuration.getPollingPeriod() > 0) {
deviceImpl.addAttributePolling(attributeName, configuration.getPollingPeriod());
}
xlogger.exit();
} | java | 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 ForwardedAttribute) {
// init attribute with either the attribute property value, or the value defined in its constructor
final ForwardedAttribute att = (ForwardedAttribute) behavior;
final String deviceName = deviceImpl.getName();
final String rootAttributeName = behavior.getConfiguration().getAttributeProperties()
.loadAttributeRootName(deviceName, attributeName);
if (rootAttributeName == null || rootAttributeName.isEmpty()
|| rootAttributeName.equalsIgnoreCase(Constants.NOT_SPECIFIED)) {
att.init(deviceName);
// persist root attribute name in tango db
behavior.getConfiguration().getAttributeProperties()
.persistAttributeRootName(deviceName, attributeName);
} else {
// use attribute property
att.init(deviceName, rootAttributeName);
}
// check if this attribute is already created
final String lower = att.getRootName().toLowerCase(Locale.ENGLISH);
if (forwardedAttributes.contains(lower)) {
throw DevFailedUtils.newDevFailed(ExceptionMessages.FWD_DOUBLE_USED,
"root attribute already used in this device");
} else {
forwardedAttributes.add(lower);
}
} else {
// set default properties
final AttributePropertiesImpl prop = configuration.getAttributeProperties();
if (prop.getLabel().isEmpty()) {
prop.setLabel(configuration.getName());
}
if (prop.getFormat().equals(Constants.NOT_SPECIFIED)) {
prop.setDefaultFormat(configuration.getScalarType());
}
}
final AttributeImpl attrImpl = new AttributeImpl(behavior, deviceImpl.getName());
attrImpl.setStateMachine(behavior.getStateMachine());
deviceImpl.addAttribute(attrImpl);
dynamicAttributes.put(attributeName.toLowerCase(Locale.ENGLISH), attrImpl);
deviceImpl.pushInterfaceChangeEvent(false);
if (configuration.isPolled() && configuration.getPollingPeriod() > 0) {
deviceImpl.addAttributePolling(attributeName, configuration.getPollingPeriod());
}
xlogger.exit();
} | [
"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",
"ForwardedAttribute",
")",
"{",
"// init attribute with either the attribute property value, or the value defined in its constructor",
"final",
"ForwardedAttribute",
"att",
"=",
"(",
"ForwardedAttribute",
")",
"behavior",
";",
"final",
"String",
"deviceName",
"=",
"deviceImpl",
".",
"getName",
"(",
")",
";",
"final",
"String",
"rootAttributeName",
"=",
"behavior",
".",
"getConfiguration",
"(",
")",
".",
"getAttributeProperties",
"(",
")",
".",
"loadAttributeRootName",
"(",
"deviceName",
",",
"attributeName",
")",
";",
"if",
"(",
"rootAttributeName",
"==",
"null",
"||",
"rootAttributeName",
".",
"isEmpty",
"(",
")",
"||",
"rootAttributeName",
".",
"equalsIgnoreCase",
"(",
"Constants",
".",
"NOT_SPECIFIED",
")",
")",
"{",
"att",
".",
"init",
"(",
"deviceName",
")",
";",
"// persist root attribute name in tango db",
"behavior",
".",
"getConfiguration",
"(",
")",
".",
"getAttributeProperties",
"(",
")",
".",
"persistAttributeRootName",
"(",
"deviceName",
",",
"attributeName",
")",
";",
"}",
"else",
"{",
"// use attribute property",
"att",
".",
"init",
"(",
"deviceName",
",",
"rootAttributeName",
")",
";",
"}",
"// check if this attribute is already created",
"final",
"String",
"lower",
"=",
"att",
".",
"getRootName",
"(",
")",
".",
"toLowerCase",
"(",
"Locale",
".",
"ENGLISH",
")",
";",
"if",
"(",
"forwardedAttributes",
".",
"contains",
"(",
"lower",
")",
")",
"{",
"throw",
"DevFailedUtils",
".",
"newDevFailed",
"(",
"ExceptionMessages",
".",
"FWD_DOUBLE_USED",
",",
"\"root attribute already used in this device\"",
")",
";",
"}",
"else",
"{",
"forwardedAttributes",
".",
"add",
"(",
"lower",
")",
";",
"}",
"}",
"else",
"{",
"// set default properties",
"final",
"AttributePropertiesImpl",
"prop",
"=",
"configuration",
".",
"getAttributeProperties",
"(",
")",
";",
"if",
"(",
"prop",
".",
"getLabel",
"(",
")",
".",
"isEmpty",
"(",
")",
")",
"{",
"prop",
".",
"setLabel",
"(",
"configuration",
".",
"getName",
"(",
")",
")",
";",
"}",
"if",
"(",
"prop",
".",
"getFormat",
"(",
")",
".",
"equals",
"(",
"Constants",
".",
"NOT_SPECIFIED",
")",
")",
"{",
"prop",
".",
"setDefaultFormat",
"(",
"configuration",
".",
"getScalarType",
"(",
")",
")",
";",
"}",
"}",
"final",
"AttributeImpl",
"attrImpl",
"=",
"new",
"AttributeImpl",
"(",
"behavior",
",",
"deviceImpl",
".",
"getName",
"(",
")",
")",
";",
"attrImpl",
".",
"setStateMachine",
"(",
"behavior",
".",
"getStateMachine",
"(",
")",
")",
";",
"deviceImpl",
".",
"addAttribute",
"(",
"attrImpl",
")",
";",
"dynamicAttributes",
".",
"put",
"(",
"attributeName",
".",
"toLowerCase",
"(",
"Locale",
".",
"ENGLISH",
")",
",",
"attrImpl",
")",
";",
"deviceImpl",
".",
"pushInterfaceChangeEvent",
"(",
"false",
")",
";",
"if",
"(",
"configuration",
".",
"isPolled",
"(",
")",
"&&",
"configuration",
".",
"getPollingPeriod",
"(",
")",
">",
"0",
")",
"{",
"deviceImpl",
".",
"addAttributePolling",
"(",
"attributeName",
",",
"configuration",
".",
"getPollingPeriod",
"(",
")",
")",
";",
"}",
"xlogger",
".",
"exit",
"(",
")",
";",
"}"
] | Add attribute. Only if not already exists on device.
@param behavior
@throws DevFailed | [
"Add",
"attribute",
".",
"Only",
"if",
"not",
"already",
"exists",
"on",
"device",
"."
] | 1ccc9dcb83e6de2359a9f1906d170571cacf1345 | https://github.com/tango-controls/JTango/blob/1ccc9dcb83e6de2359a9f1906d170571cacf1345/server/src/main/java/org/tango/server/dynamic/DynamicManager.java#L92-L139 |
140,305 | tango-controls/JTango | server/src/main/java/org/tango/server/dynamic/DynamicManager.java | DynamicManager.clearAttributesWithExclude | 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 : dynamicAttributes.keySet()) {
if (!ArrayUtils.contains(toExclude, attributeName)) {
removeAttribute(attributeName);
}
}
} | java | 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 : dynamicAttributes.keySet()) {
if (!ArrayUtils.contains(toExclude, attributeName)) {
removeAttribute(attributeName);
}
}
} | [
"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",
":",
"dynamicAttributes",
".",
"keySet",
"(",
")",
")",
"{",
"if",
"(",
"!",
"ArrayUtils",
".",
"contains",
"(",
"toExclude",
",",
"attributeName",
")",
")",
"{",
"removeAttribute",
"(",
"attributeName",
")",
";",
"}",
"}",
"}"
] | Remove all dynamic attributes with exceptions
@param exclude The attribute that will not be removed
@throws DevFailed | [
"Remove",
"all",
"dynamic",
"attributes",
"with",
"exceptions"
] | 1ccc9dcb83e6de2359a9f1906d170571cacf1345 | https://github.com/tango-controls/JTango/blob/1ccc9dcb83e6de2359a9f1906d170571cacf1345/server/src/main/java/org/tango/server/dynamic/DynamicManager.java#L199-L209 |
140,306 | tango-controls/JTango | server/src/main/java/org/tango/server/dynamic/DynamicManager.java | DynamicManager.clearAttributes | public void clearAttributes() throws DevFailed {
for (final AttributeImpl attributeImpl : dynamicAttributes.values()) {
deviceImpl.removeAttribute(attributeImpl);
}
forwardedAttributes.clear();
dynamicAttributes.clear();
} | java | public void clearAttributes() throws DevFailed {
for (final AttributeImpl attributeImpl : dynamicAttributes.values()) {
deviceImpl.removeAttribute(attributeImpl);
}
forwardedAttributes.clear();
dynamicAttributes.clear();
} | [
"public",
"void",
"clearAttributes",
"(",
")",
"throws",
"DevFailed",
"{",
"for",
"(",
"final",
"AttributeImpl",
"attributeImpl",
":",
"dynamicAttributes",
".",
"values",
"(",
")",
")",
"{",
"deviceImpl",
".",
"removeAttribute",
"(",
"attributeImpl",
")",
";",
"}",
"forwardedAttributes",
".",
"clear",
"(",
")",
";",
"dynamicAttributes",
".",
"clear",
"(",
")",
";",
"}"
] | Remove all dynamic attributes
@throws DevFailed | [
"Remove",
"all",
"dynamic",
"attributes"
] | 1ccc9dcb83e6de2359a9f1906d170571cacf1345 | https://github.com/tango-controls/JTango/blob/1ccc9dcb83e6de2359a9f1906d170571cacf1345/server/src/main/java/org/tango/server/dynamic/DynamicManager.java#L216-L222 |
140,307 | tango-controls/JTango | server/src/main/java/org/tango/server/dynamic/DynamicManager.java | DynamicManager.getDynamicAttributes | public List<IAttributeBehavior> getDynamicAttributes() {
final List<IAttributeBehavior> result = new ArrayList<IAttributeBehavior>();
for (final AttributeImpl attributeImpl : dynamicAttributes.values()) {
result.add(attributeImpl.getBehavior());
}
return result;
} | java | public List<IAttributeBehavior> getDynamicAttributes() {
final List<IAttributeBehavior> result = new ArrayList<IAttributeBehavior>();
for (final AttributeImpl attributeImpl : dynamicAttributes.values()) {
result.add(attributeImpl.getBehavior());
}
return result;
} | [
"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
@return Dynamic attributes | [
"Retrieve",
"all",
"dynamic",
"attributes"
] | 1ccc9dcb83e6de2359a9f1906d170571cacf1345 | https://github.com/tango-controls/JTango/blob/1ccc9dcb83e6de2359a9f1906d170571cacf1345/server/src/main/java/org/tango/server/dynamic/DynamicManager.java#L242-L248 |
140,308 | tango-controls/JTango | server/src/main/java/org/tango/server/dynamic/DynamicManager.java | DynamicManager.getAttribute | public IAttributeBehavior getAttribute(final String attributeName) {
AttributeImpl attr = dynamicAttributes.get(attributeName.toLowerCase(Locale.ENGLISH));
if (attr == null) return null;
else return attr.getBehavior();
} | java | public IAttributeBehavior getAttribute(final String attributeName) {
AttributeImpl attr = dynamicAttributes.get(attributeName.toLowerCase(Locale.ENGLISH));
if (attr == null) return null;
else return attr.getBehavior();
} | [
"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
@param attributeName the attribute name
@return The dynamic attribute | [
"Get",
"a",
"dynamic",
"attribute"
] | 1ccc9dcb83e6de2359a9f1906d170571cacf1345 | https://github.com/tango-controls/JTango/blob/1ccc9dcb83e6de2359a9f1906d170571cacf1345/server/src/main/java/org/tango/server/dynamic/DynamicManager.java#L256-L260 |
140,309 | tango-controls/JTango | server/src/main/java/org/tango/server/dynamic/DynamicManager.java | DynamicManager.addCommand | 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.setStateMachine(behavior.getStateMachine());
deviceImpl.addCommand(commandImpl);
dynamicCommands.put(cmdName.toLowerCase(Locale.ENGLISH), commandImpl);
deviceImpl.pushInterfaceChangeEvent(false);
xlogger.exit();
} | java | 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.setStateMachine(behavior.getStateMachine());
deviceImpl.addCommand(commandImpl);
dynamicCommands.put(cmdName.toLowerCase(Locale.ENGLISH), commandImpl);
deviceImpl.pushInterfaceChangeEvent(false);
xlogger.exit();
} | [
"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",
".",
"setStateMachine",
"(",
"behavior",
".",
"getStateMachine",
"(",
")",
")",
";",
"deviceImpl",
".",
"addCommand",
"(",
"commandImpl",
")",
";",
"dynamicCommands",
".",
"put",
"(",
"cmdName",
".",
"toLowerCase",
"(",
"Locale",
".",
"ENGLISH",
")",
",",
"commandImpl",
")",
";",
"deviceImpl",
".",
"pushInterfaceChangeEvent",
"(",
"false",
")",
";",
"xlogger",
".",
"exit",
"(",
")",
";",
"}"
] | Add command. Only if not already exists on device
@param behavior
@throws DevFailed | [
"Add",
"command",
".",
"Only",
"if",
"not",
"already",
"exists",
"on",
"device"
] | 1ccc9dcb83e6de2359a9f1906d170571cacf1345 | https://github.com/tango-controls/JTango/blob/1ccc9dcb83e6de2359a9f1906d170571cacf1345/server/src/main/java/org/tango/server/dynamic/DynamicManager.java#L268-L277 |
140,310 | tango-controls/JTango | server/src/main/java/org/tango/server/dynamic/DynamicManager.java | DynamicManager.getCommand | public ICommandBehavior getCommand(final String commandName) {
return dynamicCommands.get(commandName.toLowerCase(Locale.ENGLISH)).getBehavior();
} | java | public ICommandBehavior getCommand(final String commandName) {
return dynamicCommands.get(commandName.toLowerCase(Locale.ENGLISH)).getBehavior();
} | [
"public",
"ICommandBehavior",
"getCommand",
"(",
"final",
"String",
"commandName",
")",
"{",
"return",
"dynamicCommands",
".",
"get",
"(",
"commandName",
".",
"toLowerCase",
"(",
"Locale",
".",
"ENGLISH",
")",
")",
".",
"getBehavior",
"(",
")",
";",
"}"
] | Get a dynamic command
@param commandName command name
@return The dynamic command | [
"Get",
"a",
"dynamic",
"command"
] | 1ccc9dcb83e6de2359a9f1906d170571cacf1345 | https://github.com/tango-controls/JTango/blob/1ccc9dcb83e6de2359a9f1906d170571cacf1345/server/src/main/java/org/tango/server/dynamic/DynamicManager.java#L298-L300 |
140,311 | tango-controls/JTango | server/src/main/java/org/tango/server/dynamic/DynamicManager.java | DynamicManager.clearCommands | public void clearCommands() throws DevFailed {
for (final CommandImpl cmdImpl : dynamicCommands.values()) {
deviceImpl.removeCommand(cmdImpl);
}
dynamicCommands.clear();
} | java | public void clearCommands() throws DevFailed {
for (final CommandImpl cmdImpl : dynamicCommands.values()) {
deviceImpl.removeCommand(cmdImpl);
}
dynamicCommands.clear();
} | [
"public",
"void",
"clearCommands",
"(",
")",
"throws",
"DevFailed",
"{",
"for",
"(",
"final",
"CommandImpl",
"cmdImpl",
":",
"dynamicCommands",
".",
"values",
"(",
")",
")",
"{",
"deviceImpl",
".",
"removeCommand",
"(",
"cmdImpl",
")",
";",
"}",
"dynamicCommands",
".",
"clear",
"(",
")",
";",
"}"
] | Remove all dynamic commands
@throws DevFailed | [
"Remove",
"all",
"dynamic",
"commands"
] | 1ccc9dcb83e6de2359a9f1906d170571cacf1345 | https://github.com/tango-controls/JTango/blob/1ccc9dcb83e6de2359a9f1906d170571cacf1345/server/src/main/java/org/tango/server/dynamic/DynamicManager.java#L307-L312 |
140,312 | tango-controls/JTango | server/src/main/java/org/tango/server/dynamic/DynamicManager.java | DynamicManager.clearCommandsWithExclude | 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.keySet()) {
if (!ArrayUtils.contains(toExclude, cmdName)) {
removeCommand(cmdName);
}
}
} | java | 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.keySet()) {
if (!ArrayUtils.contains(toExclude, cmdName)) {
removeCommand(cmdName);
}
}
} | [
"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",
".",
"keySet",
"(",
")",
")",
"{",
"if",
"(",
"!",
"ArrayUtils",
".",
"contains",
"(",
"toExclude",
",",
"cmdName",
")",
")",
"{",
"removeCommand",
"(",
"cmdName",
")",
";",
"}",
"}",
"}"
] | Remove all dynamic command with exceptions
@param exclude The commands that will not be removed
@throws DevFailed | [
"Remove",
"all",
"dynamic",
"command",
"with",
"exceptions"
] | 1ccc9dcb83e6de2359a9f1906d170571cacf1345 | https://github.com/tango-controls/JTango/blob/1ccc9dcb83e6de2359a9f1906d170571cacf1345/server/src/main/java/org/tango/server/dynamic/DynamicManager.java#L320-L330 |
140,313 | tango-controls/JTango | server/src/main/java/org/tango/server/dynamic/DynamicManager.java | DynamicManager.getDynamicCommands | public List<ICommandBehavior> getDynamicCommands() {
final List<ICommandBehavior> result = new ArrayList<ICommandBehavior>();
for (final CommandImpl cmdImpl : dynamicCommands.values()) {
result.add(cmdImpl.getBehavior());
}
return result;
} | java | public List<ICommandBehavior> getDynamicCommands() {
final List<ICommandBehavior> result = new ArrayList<ICommandBehavior>();
for (final CommandImpl cmdImpl : dynamicCommands.values()) {
result.add(cmdImpl.getBehavior());
}
return result;
} | [
"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
@return Dynamic commands | [
"Retrieve",
"all",
"dynamic",
"commands"
] | 1ccc9dcb83e6de2359a9f1906d170571cacf1345 | https://github.com/tango-controls/JTango/blob/1ccc9dcb83e6de2359a9f1906d170571cacf1345/server/src/main/java/org/tango/server/dynamic/DynamicManager.java#L337-L343 |
140,314 | tango-controls/JTango | client/src/main/java/fr/soleil/tango/clientapi/TangoGroupAttribute.java | TangoGroupAttribute.write | public void write(final Object value) throws DevFailed {
initDeviceAttributes();
for (final DeviceAttribute deviceAttribute : deviceAttributes) {
if (deviceAttribute != null) {
// may be null if read failed and throwExceptions is false
InsertExtractUtils.insert(deviceAttribute, value);
}
}
group.write(deviceAttributes);
} | java | public void write(final Object value) throws DevFailed {
initDeviceAttributes();
for (final DeviceAttribute deviceAttribute : deviceAttributes) {
if (deviceAttribute != null) {
// may be null if read failed and throwExceptions is false
InsertExtractUtils.insert(deviceAttribute, value);
}
}
group.write(deviceAttributes);
} | [
"public",
"void",
"write",
"(",
"final",
"Object",
"value",
")",
"throws",
"DevFailed",
"{",
"initDeviceAttributes",
"(",
")",
";",
"for",
"(",
"final",
"DeviceAttribute",
"deviceAttribute",
":",
"deviceAttributes",
")",
"{",
"if",
"(",
"deviceAttribute",
"!=",
"null",
")",
"{",
"// may be null if read failed and throwExceptions is false",
"InsertExtractUtils",
".",
"insert",
"(",
"deviceAttribute",
",",
"value",
")",
";",
"}",
"}",
"group",
".",
"write",
"(",
"deviceAttributes",
")",
";",
"}"
] | Write a value on several attributes
@param value
Can be an array
@throws DevFailed | [
"Write",
"a",
"value",
"on",
"several",
"attributes"
] | 1ccc9dcb83e6de2359a9f1906d170571cacf1345 | https://github.com/tango-controls/JTango/blob/1ccc9dcb83e6de2359a9f1906d170571cacf1345/client/src/main/java/fr/soleil/tango/clientapi/TangoGroupAttribute.java#L79-L89 |
140,315 | tango-controls/JTango | client/src/main/java/fr/soleil/tango/clientapi/TangoGroupAttribute.java | TangoGroupAttribute.readExtract | public Object[] readExtract() throws DevFailed {
final DeviceAttribute[] da = read();
final Object[] results = extract(da);
return results;
} | java | public Object[] readExtract() throws DevFailed {
final DeviceAttribute[] da = read();
final Object[] results = extract(da);
return results;
} | [
"public",
"Object",
"[",
"]",
"readExtract",
"(",
")",
"throws",
"DevFailed",
"{",
"final",
"DeviceAttribute",
"[",
"]",
"da",
"=",
"read",
"(",
")",
";",
"final",
"Object",
"[",
"]",
"results",
"=",
"extract",
"(",
"da",
")",
";",
"return",
"results",
";",
"}"
] | Read attributes and extract their values
@return an array of objects. Same size as the number of attributes. Contains READ and WRITE parts
@throws DevFailed | [
"Read",
"attributes",
"and",
"extract",
"their",
"values"
] | 1ccc9dcb83e6de2359a9f1906d170571cacf1345 | https://github.com/tango-controls/JTango/blob/1ccc9dcb83e6de2359a9f1906d170571cacf1345/client/src/main/java/fr/soleil/tango/clientapi/TangoGroupAttribute.java#L149-L153 |
140,316 | tango-controls/JTango | client/src/main/java/org/tango/client/database/DatabaseFactory.java | DatabaseFactory.getDatabase | public static synchronized ITangoDB getDatabase(final String host, final String port) throws DevFailed {
final ITangoDB dbase;
if (useDb) {
final String tangoHost = host + ":" + port;
// Search if database object already created for this host and port
if (databaseMap.containsKey(tangoHost)) {
return databaseMap.get(tangoHost);
}
// Else, create a new database object
dbase = new Database(host, port);
databaseMap.put(tangoHost, dbase);
} else {
dbase = fileDatabase;
}
return dbase;
} | java | public static synchronized ITangoDB getDatabase(final String host, final String port) throws DevFailed {
final ITangoDB dbase;
if (useDb) {
final String tangoHost = host + ":" + port;
// Search if database object already created for this host and port
if (databaseMap.containsKey(tangoHost)) {
return databaseMap.get(tangoHost);
}
// Else, create a new database object
dbase = new Database(host, port);
databaseMap.put(tangoHost, dbase);
} else {
dbase = fileDatabase;
}
return dbase;
} | [
"public",
"static",
"synchronized",
"ITangoDB",
"getDatabase",
"(",
"final",
"String",
"host",
",",
"final",
"String",
"port",
")",
"throws",
"DevFailed",
"{",
"final",
"ITangoDB",
"dbase",
";",
"if",
"(",
"useDb",
")",
"{",
"final",
"String",
"tangoHost",
"=",
"host",
"+",
"\":\"",
"+",
"port",
";",
"// Search if database object already created for this host and port",
"if",
"(",
"databaseMap",
".",
"containsKey",
"(",
"tangoHost",
")",
")",
"{",
"return",
"databaseMap",
".",
"get",
"(",
"tangoHost",
")",
";",
"}",
"// Else, create a new database object",
"dbase",
"=",
"new",
"Database",
"(",
"host",
",",
"port",
")",
";",
"databaseMap",
".",
"put",
"(",
"tangoHost",
",",
"dbase",
")",
";",
"}",
"else",
"{",
"dbase",
"=",
"fileDatabase",
";",
"}",
"return",
"dbase",
";",
"}"
] | Get the database object created for specified host and port.
@param host
host where database is running.
@param port
port for database connection. | [
"Get",
"the",
"database",
"object",
"created",
"for",
"specified",
"host",
"and",
"port",
"."
] | 1ccc9dcb83e6de2359a9f1906d170571cacf1345 | https://github.com/tango-controls/JTango/blob/1ccc9dcb83e6de2359a9f1906d170571cacf1345/client/src/main/java/org/tango/client/database/DatabaseFactory.java#L38-L53 |
140,317 | tango-controls/JTango | client/src/main/java/org/tango/client/database/DatabaseFactory.java | DatabaseFactory.getDatabase | public static synchronized ITangoDB getDatabase() throws DevFailed {
ITangoDB tangoDb = null;
if (useDb) {
final String tangoHost = TangoHostManager.getFirstTangoHost();
// Search if database object already created for this host and port
if (databaseMap.containsKey(tangoHost)) {
tangoDb = databaseMap.get(tangoHost);
} else {
// Else, create a new database object
DevFailed lastError = null;
// try all tango hosts until connection is established
final Map<String, String> tangoHostMap = TangoHostManager.getTangoHostPortMap();
for (final Entry<String, String> entry : tangoHostMap.entrySet()) {
try {
lastError = null;
tangoDb = new Database(entry.getKey(), entry.getValue());
databaseMap.put(tangoHost, tangoDb);
break;
} catch (final DevFailed e) {
lastError = e;
}
}
if (lastError != null) {
throw lastError;
}
}
} else {
tangoDb = fileDatabase;
}
return tangoDb;
} | java | public static synchronized ITangoDB getDatabase() throws DevFailed {
ITangoDB tangoDb = null;
if (useDb) {
final String tangoHost = TangoHostManager.getFirstTangoHost();
// Search if database object already created for this host and port
if (databaseMap.containsKey(tangoHost)) {
tangoDb = databaseMap.get(tangoHost);
} else {
// Else, create a new database object
DevFailed lastError = null;
// try all tango hosts until connection is established
final Map<String, String> tangoHostMap = TangoHostManager.getTangoHostPortMap();
for (final Entry<String, String> entry : tangoHostMap.entrySet()) {
try {
lastError = null;
tangoDb = new Database(entry.getKey(), entry.getValue());
databaseMap.put(tangoHost, tangoDb);
break;
} catch (final DevFailed e) {
lastError = e;
}
}
if (lastError != null) {
throw lastError;
}
}
} else {
tangoDb = fileDatabase;
}
return tangoDb;
} | [
"public",
"static",
"synchronized",
"ITangoDB",
"getDatabase",
"(",
")",
"throws",
"DevFailed",
"{",
"ITangoDB",
"tangoDb",
"=",
"null",
";",
"if",
"(",
"useDb",
")",
"{",
"final",
"String",
"tangoHost",
"=",
"TangoHostManager",
".",
"getFirstTangoHost",
"(",
")",
";",
"// Search if database object already created for this host and port",
"if",
"(",
"databaseMap",
".",
"containsKey",
"(",
"tangoHost",
")",
")",
"{",
"tangoDb",
"=",
"databaseMap",
".",
"get",
"(",
"tangoHost",
")",
";",
"}",
"else",
"{",
"// Else, create a new database object",
"DevFailed",
"lastError",
"=",
"null",
";",
"// try all tango hosts until connection is established",
"final",
"Map",
"<",
"String",
",",
"String",
">",
"tangoHostMap",
"=",
"TangoHostManager",
".",
"getTangoHostPortMap",
"(",
")",
";",
"for",
"(",
"final",
"Entry",
"<",
"String",
",",
"String",
">",
"entry",
":",
"tangoHostMap",
".",
"entrySet",
"(",
")",
")",
"{",
"try",
"{",
"lastError",
"=",
"null",
";",
"tangoDb",
"=",
"new",
"Database",
"(",
"entry",
".",
"getKey",
"(",
")",
",",
"entry",
".",
"getValue",
"(",
")",
")",
";",
"databaseMap",
".",
"put",
"(",
"tangoHost",
",",
"tangoDb",
")",
";",
"break",
";",
"}",
"catch",
"(",
"final",
"DevFailed",
"e",
")",
"{",
"lastError",
"=",
"e",
";",
"}",
"}",
"if",
"(",
"lastError",
"!=",
"null",
")",
"{",
"throw",
"lastError",
";",
"}",
"}",
"}",
"else",
"{",
"tangoDb",
"=",
"fileDatabase",
";",
"}",
"return",
"tangoDb",
";",
"}"
] | Get the database object using tango_host system property.
@return
@throws DevFailed | [
"Get",
"the",
"database",
"object",
"using",
"tango_host",
"system",
"property",
"."
] | 1ccc9dcb83e6de2359a9f1906d170571cacf1345 | https://github.com/tango-controls/JTango/blob/1ccc9dcb83e6de2359a9f1906d170571cacf1345/client/src/main/java/org/tango/client/database/DatabaseFactory.java#L61-L91 |
140,318 | tango-controls/JTango | client/src/main/java/org/tango/client/database/DatabaseFactory.java | DatabaseFactory.setDbFile | 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);
} | java | 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);
} | [
"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
@param dbFile
@param devices
@param classes
@throws DevFailed | [
"Build",
"a",
"mock",
"tango",
"db",
"with",
"a",
"file",
"containing",
"the",
"properties"
] | 1ccc9dcb83e6de2359a9f1906d170571cacf1345 | https://github.com/tango-controls/JTango/blob/1ccc9dcb83e6de2359a9f1906d170571cacf1345/client/src/main/java/org/tango/client/database/DatabaseFactory.java#L105-L108 |
140,319 | tango-controls/JTango | client/src/main/java/org/tango/client/database/DatabaseFactory.java | DatabaseFactory.setNoDbDevices | public static void setNoDbDevices(final String[] devices, final String className) {
DatabaseFactory.useDb = false;
DatabaseFactory.fileDatabase = new FileTangoDB(Arrays.copyOf(devices, devices.length), className);
} | java | public static void setNoDbDevices(final String[] devices, final String className) {
DatabaseFactory.useDb = false;
DatabaseFactory.fileDatabase = new FileTangoDB(Arrays.copyOf(devices, devices.length), className);
} | [
"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
@param devices
@param classes | [
"Build",
"a",
"mock",
"tango",
"db"
] | 1ccc9dcb83e6de2359a9f1906d170571cacf1345 | https://github.com/tango-controls/JTango/blob/1ccc9dcb83e6de2359a9f1906d170571cacf1345/client/src/main/java/org/tango/client/database/DatabaseFactory.java#L116-L119 |
140,320 | tango-controls/JTango | client/src/main/java/fr/soleil/tango/clientapi/InsertExtractUtils.java | InsertExtractUtils.extract | 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);
} | java | 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);
} | [
"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
@param da
@return array of primitives for SCALAR, array of primitives for SPECTRUM, array of primitives array of primitives
for IMAGE
@throws DevFailed | [
"Extract",
"read",
"and",
"write",
"part",
"values",
"to",
"an",
"object",
"for",
"SCALAR",
"SPECTRUM",
"and",
"IMAGE"
] | 1ccc9dcb83e6de2359a9f1906d170571cacf1345 | https://github.com/tango-controls/JTango/blob/1ccc9dcb83e6de2359a9f1906d170571cacf1345/client/src/main/java/fr/soleil/tango/clientapi/InsertExtractUtils.java#L30-L35 |
140,321 | tango-controls/JTango | client/src/main/java/fr/soleil/tango/clientapi/InsertExtractUtils.java | InsertExtractUtils.extractRead | 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);
} | java | 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);
} | [
"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
@param da
@return single value for SCALAR, array of primitives for SPECTRUM, 2D array of primitives for IMAGE
@throws DevFailed | [
"Extract",
"read",
"values",
"to",
"an",
"object",
"for",
"SCALAR",
"SPECTRUM",
"and",
"IMAGE"
] | 1ccc9dcb83e6de2359a9f1906d170571cacf1345 | https://github.com/tango-controls/JTango/blob/1ccc9dcb83e6de2359a9f1906d170571cacf1345/client/src/main/java/fr/soleil/tango/clientapi/InsertExtractUtils.java#L44-L49 |
140,322 | tango-controls/JTango | client/src/main/java/fr/soleil/tango/clientapi/InsertExtractUtils.java | InsertExtractUtils.extractWriteArray | 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(da, writeType, format);
} | java | 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(da, writeType, format);
} | [
"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",
"(",
"da",
",",
"writeType",
",",
"format",
")",
";",
"}"
] | Extract write values to an object for SCALAR, SPECTRUM and IMAGE
@param da
@return single value for SCALAR, array of primitives for SPECTRUM and IMAGE
@throws DevFailed | [
"Extract",
"write",
"values",
"to",
"an",
"object",
"for",
"SCALAR",
"SPECTRUM",
"and",
"IMAGE"
] | 1ccc9dcb83e6de2359a9f1906d170571cacf1345 | https://github.com/tango-controls/JTango/blob/1ccc9dcb83e6de2359a9f1906d170571cacf1345/client/src/main/java/fr/soleil/tango/clientapi/InsertExtractUtils.java#L87-L93 |
140,323 | tango-controls/JTango | client/src/main/java/fr/soleil/tango/clientapi/InsertExtractUtils.java | InsertExtractUtils.extract | 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));
} | java | 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));
} | [
"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
@param <T>
@param da
@param type
the output type (e.g. double[].class for SCALAR, double[].class for SPECTRUM, double[][].class for
IMAGE)
@return array of primitives for SCALAR, array of primitives for SPECTRUM, 2D array of primitives for IMAGE
@throws DevFailed | [
"Extract",
"read",
"and",
"write",
"part",
"values",
"to",
"an",
"object",
"for",
"SCALAR",
"SPECTRUM",
"and",
"IMAGE",
"to",
"the",
"requested",
"type"
] | 1ccc9dcb83e6de2359a9f1906d170571cacf1345 | https://github.com/tango-controls/JTango/blob/1ccc9dcb83e6de2359a9f1906d170571cacf1345/client/src/main/java/fr/soleil/tango/clientapi/InsertExtractUtils.java#L106-L111 |
140,324 | tango-controls/JTango | client/src/main/java/fr/soleil/tango/clientapi/InsertExtractUtils.java | InsertExtractUtils.extractRead | 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));
} | java | 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));
} | [
"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
@param <T>
@param da
@param type
the output type (e.g. double.class for SCALAR, double[].class for SPECTRUM, double[][].class for
IMAGE)
@return single value for SCALAR, array of primitives for SPECTRUM, 2D array of primitives for IMAGE
@throws DevFailed | [
"Extract",
"read",
"part",
"values",
"to",
"an",
"object",
"for",
"SCALAR",
"SPECTRUM",
"and",
"IMAGE",
"to",
"the",
"requested",
"type"
] | 1ccc9dcb83e6de2359a9f1906d170571cacf1345 | https://github.com/tango-controls/JTango/blob/1ccc9dcb83e6de2359a9f1906d170571cacf1345/client/src/main/java/fr/soleil/tango/clientapi/InsertExtractUtils.java#L124-L130 |
140,325 | tango-controls/JTango | client/src/main/java/fr/soleil/tango/clientapi/InsertExtractUtils.java | InsertExtractUtils.extractWrite | 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, writeType, format));
} | java | 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, writeType, format));
} | [
"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",
",",
"writeType",
",",
"format",
")",
")",
";",
"}"
] | Extract write part values to an object for SCALAR, SPECTRUM and IMAGE to the requested type
@param <T>
@param da
@param type
the output type (e.g. double.class for SCALAR, double[].class for SPECTRUM, double[][].class for
IMAGE)
@return single value for SCALAR, array of primitives for SPECTRUM, 2D array of primitives for IMAGE
@throws DevFailed | [
"Extract",
"write",
"part",
"values",
"to",
"an",
"object",
"for",
"SCALAR",
"SPECTRUM",
"and",
"IMAGE",
"to",
"the",
"requested",
"type"
] | 1ccc9dcb83e6de2359a9f1906d170571cacf1345 | https://github.com/tango-controls/JTango/blob/1ccc9dcb83e6de2359a9f1906d170571cacf1345/client/src/main/java/fr/soleil/tango/clientapi/InsertExtractUtils.java#L161-L167 |
140,326 | tango-controls/JTango | dao/src/main/java/fr/esrf/TangoDs/DServerClass.java | DServerClass.instance | public static DServerClass instance()
{
if (_instance == null)
{
System.err.println("DServerClass is not initialised !!!");
System.err.println("Exiting");
System.exit(-1);
}
return _instance;
} | java | public static DServerClass instance()
{
if (_instance == null)
{
System.err.println("DServerClass is not initialised !!!");
System.err.println("Exiting");
System.exit(-1);
}
return _instance;
} | [
"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.
This method returns a reference to the object of the DServerClass class.
If the class has not been initialised with it's init method, this method
print a message and abort the device server process
@return The DServerClass object reference | [
"Get",
"the",
"singleton",
"object",
"reference",
"."
] | 1ccc9dcb83e6de2359a9f1906d170571cacf1345 | https://github.com/tango-controls/JTango/blob/1ccc9dcb83e6de2359a9f1906d170571cacf1345/dao/src/main/java/fr/esrf/TangoDs/DServerClass.java#L128-L137 |
140,327 | tango-controls/JTango | dao/src/main/java/fr/esrf/TangoDs/DServerClass.java | DServerClass.command_factory | 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",
Tango_DEV_VOID,
Tango_DEVVAR_STRINGARRAY,
"Device server class(es) list"));
command_list.addElement(new QueryDeviceCmd(
"QueryDevice",
Tango_DEV_VOID,
Tango_DEVVAR_STRINGARRAY,
"Device server device(s) list"));
command_list.addElement(new KillCmd(
"Kill",
Tango_DEV_VOID,
Tango_DEV_VOID));
command_list.addElement(new AddLoggingTargetCmd(
"AddLoggingTarget",
Tango_DEVVAR_STRINGARRAY,
Tango_DEV_VOID,
"Str[i]=Device-name - Str[i+1]=target_type::target_name"));
command_list.addElement(new RemoveLoggingTargetCmd(
"RemoveLoggingTarget",
Tango_DEVVAR_STRINGARRAY,
Tango_DEV_VOID,
"Str[i]=Device-name - Str[i+1]=target_type::target_name"));
command_list.addElement(new GetLoggingTargetCmd("GetLoggingTarget",
Tango_DEV_STRING,
Tango_DEVVAR_STRINGARRAY,
"Device name",
"Logging target list"));
command_list.addElement(new SetLoggingLevelCmd(
"SetLoggingLevel",
Tango_DEVVAR_LONGSTRINGARRAY,
Tango_DEV_VOID,
"Lg[i]=Logging level. Str[i]=Device name."));
command_list.addElement(new GetLoggingLevelCmd(
"GetLoggingLevel",
Tango_DEVVAR_STRINGARRAY,
Tango_DEVVAR_LONGSTRINGARRAY,
"Device list",
"Lg[i]=Logging level. Str[i]=Device name."));
command_list.addElement(new StopLoggingCmd(
"StopLogging",
Tango_DEV_VOID,
Tango_DEV_VOID));
command_list.addElement(new StartLoggingCmd(
"StartLogging",
Tango_DEV_VOID,
Tango_DEV_VOID));
// Now, commands related to polling
command_list.addElement(new PolledDeviceCmd(
"PolledDevice",
Tango_DEV_VOID,
Tango_DEVVAR_STRINGARRAY,
"Polled device name list"));
command_list.addElement(new DevPollStatusCmd(
"DevPollStatus",
Tango_DEV_STRING,
Tango_DEVVAR_STRINGARRAY,
"Device name",
"Device polling status"));
String msg = "Lg[0]=Upd period. Str[0]=Device name. Str[1]=Object type. Str[2]=Object name";
command_list.addElement(new AddObjPollingCmd(
"AddObjPolling",
Tango_DEVVAR_LONGSTRINGARRAY,
Tango_DEV_VOID,
msg));
command_list.addElement(new UpdObjPollingPeriodCmd(
"UpdObjPollingPeriod",
Tango_DEVVAR_LONGSTRINGARRAY,
Tango_DEV_VOID,
msg));
msg = "Lg[0]=Upd period. Str[0]=Device name. Str[1]=Object type. Str[2]=Object name";
command_list.addElement(new RemObjPollingCmd(
"RemObjPolling",
Tango_DEVVAR_STRINGARRAY,
Tango_DEV_VOID,
msg));
command_list.addElement(new StopPollingCmd(
"StopPolling",
Tango_DEV_VOID,
Tango_DEV_VOID));
command_list.addElement(new StartPollingCmd(
"StartPolling",
Tango_DEV_VOID,
Tango_DEV_VOID));
} | java | 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",
Tango_DEV_VOID,
Tango_DEVVAR_STRINGARRAY,
"Device server class(es) list"));
command_list.addElement(new QueryDeviceCmd(
"QueryDevice",
Tango_DEV_VOID,
Tango_DEVVAR_STRINGARRAY,
"Device server device(s) list"));
command_list.addElement(new KillCmd(
"Kill",
Tango_DEV_VOID,
Tango_DEV_VOID));
command_list.addElement(new AddLoggingTargetCmd(
"AddLoggingTarget",
Tango_DEVVAR_STRINGARRAY,
Tango_DEV_VOID,
"Str[i]=Device-name - Str[i+1]=target_type::target_name"));
command_list.addElement(new RemoveLoggingTargetCmd(
"RemoveLoggingTarget",
Tango_DEVVAR_STRINGARRAY,
Tango_DEV_VOID,
"Str[i]=Device-name - Str[i+1]=target_type::target_name"));
command_list.addElement(new GetLoggingTargetCmd("GetLoggingTarget",
Tango_DEV_STRING,
Tango_DEVVAR_STRINGARRAY,
"Device name",
"Logging target list"));
command_list.addElement(new SetLoggingLevelCmd(
"SetLoggingLevel",
Tango_DEVVAR_LONGSTRINGARRAY,
Tango_DEV_VOID,
"Lg[i]=Logging level. Str[i]=Device name."));
command_list.addElement(new GetLoggingLevelCmd(
"GetLoggingLevel",
Tango_DEVVAR_STRINGARRAY,
Tango_DEVVAR_LONGSTRINGARRAY,
"Device list",
"Lg[i]=Logging level. Str[i]=Device name."));
command_list.addElement(new StopLoggingCmd(
"StopLogging",
Tango_DEV_VOID,
Tango_DEV_VOID));
command_list.addElement(new StartLoggingCmd(
"StartLogging",
Tango_DEV_VOID,
Tango_DEV_VOID));
// Now, commands related to polling
command_list.addElement(new PolledDeviceCmd(
"PolledDevice",
Tango_DEV_VOID,
Tango_DEVVAR_STRINGARRAY,
"Polled device name list"));
command_list.addElement(new DevPollStatusCmd(
"DevPollStatus",
Tango_DEV_STRING,
Tango_DEVVAR_STRINGARRAY,
"Device name",
"Device polling status"));
String msg = "Lg[0]=Upd period. Str[0]=Device name. Str[1]=Object type. Str[2]=Object name";
command_list.addElement(new AddObjPollingCmd(
"AddObjPolling",
Tango_DEVVAR_LONGSTRINGARRAY,
Tango_DEV_VOID,
msg));
command_list.addElement(new UpdObjPollingPeriodCmd(
"UpdObjPollingPeriod",
Tango_DEVVAR_LONGSTRINGARRAY,
Tango_DEV_VOID,
msg));
msg = "Lg[0]=Upd period. Str[0]=Device name. Str[1]=Object type. Str[2]=Object name";
command_list.addElement(new RemObjPollingCmd(
"RemObjPolling",
Tango_DEVVAR_STRINGARRAY,
Tango_DEV_VOID,
msg));
command_list.addElement(new StopPollingCmd(
"StopPolling",
Tango_DEV_VOID,
Tango_DEV_VOID));
command_list.addElement(new StartPollingCmd(
"StartPolling",
Tango_DEV_VOID,
Tango_DEV_VOID));
} | [
"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\"",
",",
"Tango_DEV_VOID",
",",
"Tango_DEVVAR_STRINGARRAY",
",",
"\"Device server class(es) list\"",
")",
")",
";",
"command_list",
".",
"addElement",
"(",
"new",
"QueryDeviceCmd",
"(",
"\"QueryDevice\"",
",",
"Tango_DEV_VOID",
",",
"Tango_DEVVAR_STRINGARRAY",
",",
"\"Device server device(s) list\"",
")",
")",
";",
"command_list",
".",
"addElement",
"(",
"new",
"KillCmd",
"(",
"\"Kill\"",
",",
"Tango_DEV_VOID",
",",
"Tango_DEV_VOID",
")",
")",
";",
"command_list",
".",
"addElement",
"(",
"new",
"AddLoggingTargetCmd",
"(",
"\"AddLoggingTarget\"",
",",
"Tango_DEVVAR_STRINGARRAY",
",",
"Tango_DEV_VOID",
",",
"\"Str[i]=Device-name - Str[i+1]=target_type::target_name\"",
")",
")",
";",
"command_list",
".",
"addElement",
"(",
"new",
"RemoveLoggingTargetCmd",
"(",
"\"RemoveLoggingTarget\"",
",",
"Tango_DEVVAR_STRINGARRAY",
",",
"Tango_DEV_VOID",
",",
"\"Str[i]=Device-name - Str[i+1]=target_type::target_name\"",
")",
")",
";",
"command_list",
".",
"addElement",
"(",
"new",
"GetLoggingTargetCmd",
"(",
"\"GetLoggingTarget\"",
",",
"Tango_DEV_STRING",
",",
"Tango_DEVVAR_STRINGARRAY",
",",
"\"Device name\"",
",",
"\"Logging target list\"",
")",
")",
";",
"command_list",
".",
"addElement",
"(",
"new",
"SetLoggingLevelCmd",
"(",
"\"SetLoggingLevel\"",
",",
"Tango_DEVVAR_LONGSTRINGARRAY",
",",
"Tango_DEV_VOID",
",",
"\"Lg[i]=Logging level. Str[i]=Device name.\"",
")",
")",
";",
"command_list",
".",
"addElement",
"(",
"new",
"GetLoggingLevelCmd",
"(",
"\"GetLoggingLevel\"",
",",
"Tango_DEVVAR_STRINGARRAY",
",",
"Tango_DEVVAR_LONGSTRINGARRAY",
",",
"\"Device list\"",
",",
"\"Lg[i]=Logging level. Str[i]=Device name.\"",
")",
")",
";",
"command_list",
".",
"addElement",
"(",
"new",
"StopLoggingCmd",
"(",
"\"StopLogging\"",
",",
"Tango_DEV_VOID",
",",
"Tango_DEV_VOID",
")",
")",
";",
"command_list",
".",
"addElement",
"(",
"new",
"StartLoggingCmd",
"(",
"\"StartLogging\"",
",",
"Tango_DEV_VOID",
",",
"Tango_DEV_VOID",
")",
")",
";",
"// Now, commands related to polling",
"command_list",
".",
"addElement",
"(",
"new",
"PolledDeviceCmd",
"(",
"\"PolledDevice\"",
",",
"Tango_DEV_VOID",
",",
"Tango_DEVVAR_STRINGARRAY",
",",
"\"Polled device name list\"",
")",
")",
";",
"command_list",
".",
"addElement",
"(",
"new",
"DevPollStatusCmd",
"(",
"\"DevPollStatus\"",
",",
"Tango_DEV_STRING",
",",
"Tango_DEVVAR_STRINGARRAY",
",",
"\"Device name\"",
",",
"\"Device polling status\"",
")",
")",
";",
"String",
"msg",
"=",
"\"Lg[0]=Upd period. Str[0]=Device name. Str[1]=Object type. Str[2]=Object name\"",
";",
"command_list",
".",
"addElement",
"(",
"new",
"AddObjPollingCmd",
"(",
"\"AddObjPolling\"",
",",
"Tango_DEVVAR_LONGSTRINGARRAY",
",",
"Tango_DEV_VOID",
",",
"msg",
")",
")",
";",
"command_list",
".",
"addElement",
"(",
"new",
"UpdObjPollingPeriodCmd",
"(",
"\"UpdObjPollingPeriod\"",
",",
"Tango_DEVVAR_LONGSTRINGARRAY",
",",
"Tango_DEV_VOID",
",",
"msg",
")",
")",
";",
"msg",
"=",
"\"Lg[0]=Upd period. Str[0]=Device name. Str[1]=Object type. Str[2]=Object name\"",
";",
"command_list",
".",
"addElement",
"(",
"new",
"RemObjPollingCmd",
"(",
"\"RemObjPolling\"",
",",
"Tango_DEVVAR_STRINGARRAY",
",",
"Tango_DEV_VOID",
",",
"msg",
")",
")",
";",
"command_list",
".",
"addElement",
"(",
"new",
"StopPollingCmd",
"(",
"\"StopPolling\"",
",",
"Tango_DEV_VOID",
",",
"Tango_DEV_VOID",
")",
")",
";",
"command_list",
".",
"addElement",
"(",
"new",
"StartPollingCmd",
"(",
"\"StartPolling\"",
",",
"Tango_DEV_VOID",
",",
"Tango_DEV_VOID",
")",
")",
";",
"}"
] | Create DServerClass commands.
Create one instance of all classes representing command available for
device of the DServer class.
These commands are QueryDevice, QueryClass, Kill, SetTraceLevel,
GetTraceLevel, SetTraceOutput and GetTraceOutput | [
"Create",
"DServerClass",
"commands",
"."
] | 1ccc9dcb83e6de2359a9f1906d170571cacf1345 | https://github.com/tango-controls/JTango/blob/1ccc9dcb83e6de2359a9f1906d170571cacf1345/dao/src/main/java/fr/esrf/TangoDs/DServerClass.java#L195-L297 |
140,328 | tango-controls/JTango | dao/src/main/java/fr/esrf/TangoDs/DServerClass.java | DServerClass.device_factory | 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]);
//
// Create device and add it into the device list
//
device_list.addElement(new DServer(this,
devlist[i],
"A device server device !!",
DevState.ON,
"The device is ON"));
//
// Export device to the outside world
//
Util.out4.println("Util._UseDb = " + Util._UseDb);
if (Util._UseDb == true)
export_device(((DeviceImpl)(device_list.elementAt(i))));
else
export_device(((DeviceImpl)(device_list.elementAt(i))),devlist[i]);
}
} | java | 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]);
//
// Create device and add it into the device list
//
device_list.addElement(new DServer(this,
devlist[i],
"A device server device !!",
DevState.ON,
"The device is ON"));
//
// Export device to the outside world
//
Util.out4.println("Util._UseDb = " + Util._UseDb);
if (Util._UseDb == true)
export_device(((DeviceImpl)(device_list.elementAt(i))));
else
export_device(((DeviceImpl)(device_list.elementAt(i))),devlist[i]);
}
} | [
"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",
"]",
")",
";",
"//",
"// Create device and add it into the device list",
"//",
"device_list",
".",
"addElement",
"(",
"new",
"DServer",
"(",
"this",
",",
"devlist",
"[",
"i",
"]",
",",
"\"A device server device !!\"",
",",
"DevState",
".",
"ON",
",",
"\"The device is ON\"",
")",
")",
";",
"//",
"// Export device to the outside world",
"//",
"Util",
".",
"out4",
".",
"println",
"(",
"\"Util._UseDb = \"",
"+",
"Util",
".",
"_UseDb",
")",
";",
"if",
"(",
"Util",
".",
"_UseDb",
"==",
"true",
")",
"export_device",
"(",
"(",
"(",
"DeviceImpl",
")",
"(",
"device_list",
".",
"elementAt",
"(",
"i",
")",
")",
")",
")",
";",
"else",
"export_device",
"(",
"(",
"(",
"DeviceImpl",
")",
"(",
"device_list",
".",
"elementAt",
"(",
"i",
")",
")",
")",
",",
"devlist",
"[",
"i",
"]",
")",
";",
"}",
"}"
] | Create and export device of the DServer class.
@param devlist The device(s) to be created name list
@exception DevFailed If the device creation or export failed.
Click <a href="../../tango_basic/idl_html/Tango.html#DevFailed">here</a> to read
<b>DevFailed</b> exception specification | [
"Create",
"and",
"export",
"device",
"of",
"the",
"DServer",
"class",
"."
] | 1ccc9dcb83e6de2359a9f1906d170571cacf1345 | https://github.com/tango-controls/JTango/blob/1ccc9dcb83e6de2359a9f1906d170571cacf1345/dao/src/main/java/fr/esrf/TangoDs/DServerClass.java#L321-L349 |
140,329 | tango-controls/JTango | client/src/main/java/org/tango/client/database/cache/ServerCache.java | ServerCache.getDeviceList | 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(devices, devices.length);
}
}
return result;
} | java | 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(devices, devices.length);
}
}
return result;
} | [
"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",
"(",
"devices",
",",
"devices",
".",
"length",
")",
";",
"}",
"}",
"return",
"result",
";",
"}"
] | Get devices of a server
@return | [
"Get",
"devices",
"of",
"a",
"server"
] | 1ccc9dcb83e6de2359a9f1906d170571cacf1345 | https://github.com/tango-controls/JTango/blob/1ccc9dcb83e6de2359a9f1906d170571cacf1345/client/src/main/java/org/tango/client/database/cache/ServerCache.java#L284-L294 |
140,330 | tango-controls/JTango | server/src/main/java/org/tango/server/build/StateBuilder.java | StateBuilder.build | 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 + stateName.substring(0, 1).toUpperCase(Locale.ENGLISH)
+ stateName.substring(1);
try {
getter = clazz.getMethod(getterName);
} catch (final NoSuchMethodException e) {
throw DevFailedUtils.newDevFailed(e);
}
if (getter.getParameterTypes().length != 0) {
throw DevFailedUtils.newDevFailed(DevFailedUtils.TANGO_BUILD_FAILED, getter + " must not have a parameter");
}
logger.debug("Has an state : {}", field.getName());
if (getter.getReturnType() != DeviceState.class && getter.getReturnType() != DevState.class) {
throw DevFailedUtils.newDevFailed(DevFailedUtils.TANGO_BUILD_FAILED, getter + " must have a return type of "
+ DeviceState.class.getCanonicalName() + " or " + DevState.class.getCanonicalName());
}
Method setter;
final String setterName = BuilderUtils.SET + stateName.substring(0, 1).toUpperCase(Locale.ENGLISH)
+ stateName.substring(1);
try {
setter = clazz.getMethod(setterName, DeviceState.class);
} catch (final NoSuchMethodException e) {
try {
setter = clazz.getMethod(setterName, DevState.class);
} catch (final NoSuchMethodException e1) {
throw DevFailedUtils.newDevFailed(e1);
}
}
device.setStateImpl(new StateImpl(businessObject, getter, setter));
final State annot = field.getAnnotation(State.class);
if (annot.isPolled()) {
device.addAttributePolling(DeviceImpl.STATE_NAME, annot.pollingPeriod());
}
xlogger.exit();
} | java | 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 + stateName.substring(0, 1).toUpperCase(Locale.ENGLISH)
+ stateName.substring(1);
try {
getter = clazz.getMethod(getterName);
} catch (final NoSuchMethodException e) {
throw DevFailedUtils.newDevFailed(e);
}
if (getter.getParameterTypes().length != 0) {
throw DevFailedUtils.newDevFailed(DevFailedUtils.TANGO_BUILD_FAILED, getter + " must not have a parameter");
}
logger.debug("Has an state : {}", field.getName());
if (getter.getReturnType() != DeviceState.class && getter.getReturnType() != DevState.class) {
throw DevFailedUtils.newDevFailed(DevFailedUtils.TANGO_BUILD_FAILED, getter + " must have a return type of "
+ DeviceState.class.getCanonicalName() + " or " + DevState.class.getCanonicalName());
}
Method setter;
final String setterName = BuilderUtils.SET + stateName.substring(0, 1).toUpperCase(Locale.ENGLISH)
+ stateName.substring(1);
try {
setter = clazz.getMethod(setterName, DeviceState.class);
} catch (final NoSuchMethodException e) {
try {
setter = clazz.getMethod(setterName, DevState.class);
} catch (final NoSuchMethodException e1) {
throw DevFailedUtils.newDevFailed(e1);
}
}
device.setStateImpl(new StateImpl(businessObject, getter, setter));
final State annot = field.getAnnotation(State.class);
if (annot.isPolled()) {
device.addAttributePolling(DeviceImpl.STATE_NAME, annot.pollingPeriod());
}
xlogger.exit();
} | [
"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",
"+",
"stateName",
".",
"substring",
"(",
"0",
",",
"1",
")",
".",
"toUpperCase",
"(",
"Locale",
".",
"ENGLISH",
")",
"+",
"stateName",
".",
"substring",
"(",
"1",
")",
";",
"try",
"{",
"getter",
"=",
"clazz",
".",
"getMethod",
"(",
"getterName",
")",
";",
"}",
"catch",
"(",
"final",
"NoSuchMethodException",
"e",
")",
"{",
"throw",
"DevFailedUtils",
".",
"newDevFailed",
"(",
"e",
")",
";",
"}",
"if",
"(",
"getter",
".",
"getParameterTypes",
"(",
")",
".",
"length",
"!=",
"0",
")",
"{",
"throw",
"DevFailedUtils",
".",
"newDevFailed",
"(",
"DevFailedUtils",
".",
"TANGO_BUILD_FAILED",
",",
"getter",
"+",
"\" must not have a parameter\"",
")",
";",
"}",
"logger",
".",
"debug",
"(",
"\"Has an state : {}\"",
",",
"field",
".",
"getName",
"(",
")",
")",
";",
"if",
"(",
"getter",
".",
"getReturnType",
"(",
")",
"!=",
"DeviceState",
".",
"class",
"&&",
"getter",
".",
"getReturnType",
"(",
")",
"!=",
"DevState",
".",
"class",
")",
"{",
"throw",
"DevFailedUtils",
".",
"newDevFailed",
"(",
"DevFailedUtils",
".",
"TANGO_BUILD_FAILED",
",",
"getter",
"+",
"\" must have a return type of \"",
"+",
"DeviceState",
".",
"class",
".",
"getCanonicalName",
"(",
")",
"+",
"\" or \"",
"+",
"DevState",
".",
"class",
".",
"getCanonicalName",
"(",
")",
")",
";",
"}",
"Method",
"setter",
";",
"final",
"String",
"setterName",
"=",
"BuilderUtils",
".",
"SET",
"+",
"stateName",
".",
"substring",
"(",
"0",
",",
"1",
")",
".",
"toUpperCase",
"(",
"Locale",
".",
"ENGLISH",
")",
"+",
"stateName",
".",
"substring",
"(",
"1",
")",
";",
"try",
"{",
"setter",
"=",
"clazz",
".",
"getMethod",
"(",
"setterName",
",",
"DeviceState",
".",
"class",
")",
";",
"}",
"catch",
"(",
"final",
"NoSuchMethodException",
"e",
")",
"{",
"try",
"{",
"setter",
"=",
"clazz",
".",
"getMethod",
"(",
"setterName",
",",
"DevState",
".",
"class",
")",
";",
"}",
"catch",
"(",
"final",
"NoSuchMethodException",
"e1",
")",
"{",
"throw",
"DevFailedUtils",
".",
"newDevFailed",
"(",
"e1",
")",
";",
"}",
"}",
"device",
".",
"setStateImpl",
"(",
"new",
"StateImpl",
"(",
"businessObject",
",",
"getter",
",",
"setter",
")",
")",
";",
"final",
"State",
"annot",
"=",
"field",
".",
"getAnnotation",
"(",
"State",
".",
"class",
")",
";",
"if",
"(",
"annot",
".",
"isPolled",
"(",
")",
")",
"{",
"device",
".",
"addAttributePolling",
"(",
"DeviceImpl",
".",
"STATE_NAME",
",",
"annot",
".",
"pollingPeriod",
"(",
")",
")",
";",
"}",
"xlogger",
".",
"exit",
"(",
")",
";",
"}"
] | Create a state
@param clazz
@param field
@param device
@param businessObject
@throws DevFailed | [
"Create",
"a",
"state"
] | 1ccc9dcb83e6de2359a9f1906d170571cacf1345 | https://github.com/tango-controls/JTango/blob/1ccc9dcb83e6de2359a9f1906d170571cacf1345/server/src/main/java/org/tango/server/build/StateBuilder.java#L64-L104 |
140,331 | tango-controls/JTango | server/src/main/java/org/tango/server/device/DeviceManager.java | DeviceManager.getAttributeProperties | public AttributePropertiesImpl getAttributeProperties(final String attributeName) throws DevFailed {
final AttributeImpl attr = AttributeGetterSetter.getAttribute(attributeName, device.getAttributeList());
return attr.getProperties();
} | java | public AttributePropertiesImpl getAttributeProperties(final String attributeName) throws DevFailed {
final AttributeImpl attr = AttributeGetterSetter.getAttribute(attributeName, device.getAttributeList());
return attr.getProperties();
} | [
"public",
"AttributePropertiesImpl",
"getAttributeProperties",
"(",
"final",
"String",
"attributeName",
")",
"throws",
"DevFailed",
"{",
"final",
"AttributeImpl",
"attr",
"=",
"AttributeGetterSetter",
".",
"getAttribute",
"(",
"attributeName",
",",
"device",
".",
"getAttributeList",
"(",
")",
")",
";",
"return",
"attr",
".",
"getProperties",
"(",
")",
";",
"}"
] | Get an attribute's properties
@param attributeName the attribute name
@return its properties
@throws DevFailed | [
"Get",
"an",
"attribute",
"s",
"properties"
] | 1ccc9dcb83e6de2359a9f1906d170571cacf1345 | https://github.com/tango-controls/JTango/blob/1ccc9dcb83e6de2359a9f1906d170571cacf1345/server/src/main/java/org/tango/server/device/DeviceManager.java#L98-L101 |
140,332 | tango-controls/JTango | server/src/main/java/org/tango/server/device/DeviceManager.java | DeviceManager.setAttributeProperties | public void setAttributeProperties(final String attributeName, final AttributePropertiesImpl properties)
throws DevFailed {
final AttributeImpl attr = AttributeGetterSetter.getAttribute(attributeName, device.getAttributeList());
attr.setProperties(properties);
} | java | public void setAttributeProperties(final String attributeName, final AttributePropertiesImpl properties)
throws DevFailed {
final AttributeImpl attr = AttributeGetterSetter.getAttribute(attributeName, device.getAttributeList());
attr.setProperties(properties);
} | [
"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
@param attributeName the attribute name
@param properties its properties
@throws DevFailed | [
"Configure",
"an",
"attribute",
"s",
"properties"
] | 1ccc9dcb83e6de2359a9f1906d170571cacf1345 | https://github.com/tango-controls/JTango/blob/1ccc9dcb83e6de2359a9f1906d170571cacf1345/server/src/main/java/org/tango/server/device/DeviceManager.java#L110-L114 |
140,333 | tango-controls/JTango | server/src/main/java/org/tango/server/device/DeviceManager.java | DeviceManager.removeAttributeProperties | public void removeAttributeProperties(final String attributeName) throws DevFailed {
final AttributeImpl attr = AttributeGetterSetter.getAttribute(attributeName, device.getAttributeList());
attr.removeProperties();
} | java | public void removeAttributeProperties(final String attributeName) throws DevFailed {
final AttributeImpl attr = AttributeGetterSetter.getAttribute(attributeName, device.getAttributeList());
attr.removeProperties();
} | [
"public",
"void",
"removeAttributeProperties",
"(",
"final",
"String",
"attributeName",
")",
"throws",
"DevFailed",
"{",
"final",
"AttributeImpl",
"attr",
"=",
"AttributeGetterSetter",
".",
"getAttribute",
"(",
"attributeName",
",",
"device",
".",
"getAttributeList",
"(",
")",
")",
";",
"attr",
".",
"removeProperties",
"(",
")",
";",
"}"
] | Remove an attribute's properties
@param attributeName the attribute name
@throws DevFailed | [
"Remove",
"an",
"attribute",
"s",
"properties"
] | 1ccc9dcb83e6de2359a9f1906d170571cacf1345 | https://github.com/tango-controls/JTango/blob/1ccc9dcb83e6de2359a9f1906d170571cacf1345/server/src/main/java/org/tango/server/device/DeviceManager.java#L122-L125 |
140,334 | tango-controls/JTango | server/src/main/java/org/tango/server/device/DeviceManager.java | DeviceManager.isPolled | 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();
}
} | java | 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();
}
} | [
"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
@param polledObject The name of the polled object (attribute or command)
@return true if polled
@throws DevFailed | [
"Check",
"if",
"an",
"attribute",
"or",
"an",
"command",
"is",
"polled"
] | 1ccc9dcb83e6de2359a9f1906d170571cacf1345 | https://github.com/tango-controls/JTango/blob/1ccc9dcb83e6de2359a9f1906d170571cacf1345/server/src/main/java/org/tango/server/device/DeviceManager.java#L134-L140 |
140,335 | tango-controls/JTango | server/src/main/java/org/tango/server/device/DeviceManager.java | DeviceManager.getPollingPeriod | 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();
}
} | java | 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();
}
} | [
"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
@param polledObject The name of the polled object (attribute or command)
@return The polling period
@throws DevFailed | [
"Get",
"polling",
"period",
"of",
"an",
"attribute",
"or",
"a",
"command"
] | 1ccc9dcb83e6de2359a9f1906d170571cacf1345 | https://github.com/tango-controls/JTango/blob/1ccc9dcb83e6de2359a9f1906d170571cacf1345/server/src/main/java/org/tango/server/device/DeviceManager.java#L149-L155 |
140,336 | tango-controls/JTango | server/src/main/java/org/tango/server/device/DeviceManager.java | DeviceManager.startPolling | 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 DevFailed e) {
if (polledObject.equalsIgnoreCase(DeviceImpl.STATE_NAME)
|| polledObject.equalsIgnoreCase(DeviceImpl.STATUS_NAME)) {
final CommandImpl cmd = device.getCommand(polledObject);
cmd.configurePolling(pollingPeriod);
device.startPolling(cmd);
} else {
throw e;
}
}
} | java | 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 DevFailed e) {
if (polledObject.equalsIgnoreCase(DeviceImpl.STATE_NAME)
|| polledObject.equalsIgnoreCase(DeviceImpl.STATUS_NAME)) {
final CommandImpl cmd = device.getCommand(polledObject);
cmd.configurePolling(pollingPeriod);
device.startPolling(cmd);
} else {
throw e;
}
}
} | [
"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",
"DevFailed",
"e",
")",
"{",
"if",
"(",
"polledObject",
".",
"equalsIgnoreCase",
"(",
"DeviceImpl",
".",
"STATE_NAME",
")",
"||",
"polledObject",
".",
"equalsIgnoreCase",
"(",
"DeviceImpl",
".",
"STATUS_NAME",
")",
")",
"{",
"final",
"CommandImpl",
"cmd",
"=",
"device",
".",
"getCommand",
"(",
"polledObject",
")",
";",
"cmd",
".",
"configurePolling",
"(",
"pollingPeriod",
")",
";",
"device",
".",
"startPolling",
"(",
"cmd",
")",
";",
"}",
"else",
"{",
"throw",
"e",
";",
"}",
"}",
"}"
] | Configure polling of an attribute or a command and start it
@param polledObject The name of the polled object (attribute or command)
@param pollingPeriod The polling period
@throws DevFailed | [
"Configure",
"polling",
"of",
"an",
"attribute",
"or",
"a",
"command",
"and",
"start",
"it"
] | 1ccc9dcb83e6de2359a9f1906d170571cacf1345 | https://github.com/tango-controls/JTango/blob/1ccc9dcb83e6de2359a9f1906d170571cacf1345/server/src/main/java/org/tango/server/device/DeviceManager.java#L164-L179 |
140,337 | tango-controls/JTango | server/src/main/java/org/tango/server/device/DeviceManager.java | DeviceManager.pushEvent | 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:
// set attribute value
final AttributeImpl attribute = AttributeGetterSetter.getAttribute(attributeName,
device.getAttributeList());
attribute.lock();
try {
attribute.updateValue(value);
// push the event
EventManager.getInstance().pushAttributeValueEvent(name, attributeName, eventType);
} catch (final DevFailed e) {
EventManager.getInstance().pushAttributeErrorEvent(name, attributeName, e);
} finally {
attribute.unlock();
}
break;
default:
throw DevFailedUtils.newDevFailed("Only USER, ARCHIVE or CHANGE event can be send");
}
} | java | 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:
// set attribute value
final AttributeImpl attribute = AttributeGetterSetter.getAttribute(attributeName,
device.getAttributeList());
attribute.lock();
try {
attribute.updateValue(value);
// push the event
EventManager.getInstance().pushAttributeValueEvent(name, attributeName, eventType);
} catch (final DevFailed e) {
EventManager.getInstance().pushAttributeErrorEvent(name, attributeName, e);
} finally {
attribute.unlock();
}
break;
default:
throw DevFailedUtils.newDevFailed("Only USER, ARCHIVE or CHANGE event can be send");
}
} | [
"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",
":",
"// set attribute value",
"final",
"AttributeImpl",
"attribute",
"=",
"AttributeGetterSetter",
".",
"getAttribute",
"(",
"attributeName",
",",
"device",
".",
"getAttributeList",
"(",
")",
")",
";",
"attribute",
".",
"lock",
"(",
")",
";",
"try",
"{",
"attribute",
".",
"updateValue",
"(",
"value",
")",
";",
"// push the event",
"EventManager",
".",
"getInstance",
"(",
")",
".",
"pushAttributeValueEvent",
"(",
"name",
",",
"attributeName",
",",
"eventType",
")",
";",
"}",
"catch",
"(",
"final",
"DevFailed",
"e",
")",
"{",
"EventManager",
".",
"getInstance",
"(",
")",
".",
"pushAttributeErrorEvent",
"(",
"name",
",",
"attributeName",
",",
"e",
")",
";",
"}",
"finally",
"{",
"attribute",
".",
"unlock",
"(",
")",
";",
"}",
"break",
";",
"default",
":",
"throw",
"DevFailedUtils",
".",
"newDevFailed",
"(",
"\"Only USER, ARCHIVE or CHANGE event can be send\"",
")",
";",
"}",
"}"
] | Push an event if some client had register it.
@param attributeName The attribute name
@param eventType The type of event to fire
@throws DevFailed | [
"Push",
"an",
"event",
"if",
"some",
"client",
"had",
"register",
"it",
"."
] | 1ccc9dcb83e6de2359a9f1906d170571cacf1345 | https://github.com/tango-controls/JTango/blob/1ccc9dcb83e6de2359a9f1906d170571cacf1345/server/src/main/java/org/tango/server/device/DeviceManager.java#L264-L287 |
140,338 | tango-controls/JTango | server/src/main/java/org/tango/server/device/DeviceManager.java | DeviceManager.pushDataReadyEvent | public void pushDataReadyEvent(final String attributeName, final int counter) throws DevFailed {
EventManager.getInstance().pushAttributeDataReadyEvent(name, attributeName, counter);
} | java | public void pushDataReadyEvent(final String attributeName, final int counter) throws DevFailed {
EventManager.getInstance().pushAttributeDataReadyEvent(name, attributeName, counter);
} | [
"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
@param attributeName The attribute name
@param counter
@throws DevFailed | [
"Push",
"a",
"DATA_READY",
"event",
"if",
"some",
"client",
"had",
"registered",
"it"
] | 1ccc9dcb83e6de2359a9f1906d170571cacf1345 | https://github.com/tango-controls/JTango/blob/1ccc9dcb83e6de2359a9f1906d170571cacf1345/server/src/main/java/org/tango/server/device/DeviceManager.java#L296-L298 |
140,339 | tango-controls/JTango | server/src/main/java/org/tango/server/device/DeviceManager.java | DeviceManager.pushPipeEvent | public void pushPipeEvent(final String pipeName, final PipeValue blob) throws DevFailed {
// set attribute value
final PipeImpl pipe = DeviceImpl.getPipe(pipeName, device.getPipeList());
try {
pipe.updateValue(blob);
// push the event
EventManager.getInstance().pushPipeEvent(name, pipeName, blob);
} catch (final DevFailed e) {
EventManager.getInstance().pushPipeEvent(name, pipeName, e);
}
} | java | public void pushPipeEvent(final String pipeName, final PipeValue blob) throws DevFailed {
// set attribute value
final PipeImpl pipe = DeviceImpl.getPipe(pipeName, device.getPipeList());
try {
pipe.updateValue(blob);
// push the event
EventManager.getInstance().pushPipeEvent(name, pipeName, blob);
} catch (final DevFailed e) {
EventManager.getInstance().pushPipeEvent(name, pipeName, e);
}
} | [
"public",
"void",
"pushPipeEvent",
"(",
"final",
"String",
"pipeName",
",",
"final",
"PipeValue",
"blob",
")",
"throws",
"DevFailed",
"{",
"// set attribute value",
"final",
"PipeImpl",
"pipe",
"=",
"DeviceImpl",
".",
"getPipe",
"(",
"pipeName",
",",
"device",
".",
"getPipeList",
"(",
")",
")",
";",
"try",
"{",
"pipe",
".",
"updateValue",
"(",
"blob",
")",
";",
"// push the event",
"EventManager",
".",
"getInstance",
"(",
")",
".",
"pushPipeEvent",
"(",
"name",
",",
"pipeName",
",",
"blob",
")",
";",
"}",
"catch",
"(",
"final",
"DevFailed",
"e",
")",
"{",
"EventManager",
".",
"getInstance",
"(",
")",
".",
"pushPipeEvent",
"(",
"name",
",",
"pipeName",
",",
"e",
")",
";",
"}",
"}"
] | Push a PIPE EVENT event if some client had registered it
@param pipeName The pipe name
@param blob The pipe data
@throws DevFailed | [
"Push",
"a",
"PIPE",
"EVENT",
"event",
"if",
"some",
"client",
"had",
"registered",
"it"
] | 1ccc9dcb83e6de2359a9f1906d170571cacf1345 | https://github.com/tango-controls/JTango/blob/1ccc9dcb83e6de2359a9f1906d170571cacf1345/server/src/main/java/org/tango/server/device/DeviceManager.java#L307-L317 |
140,340 | tango-controls/JTango | client/src/main/java/fr/soleil/tango/clientapi/TangoGroupCommand.java | TangoGroupCommand.execute | 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()) {
// get data to throw e
for (final Object obj : replies) {
((GroupCmdReply) obj).get_data();
}
}
} | java | 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()) {
// get data to throw e
for (final Object obj : replies) {
((GroupCmdReply) obj).get_data();
}
}
} | [
"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",
"(",
")",
")",
"{",
"// get data to throw e",
"for",
"(",
"final",
"Object",
"obj",
":",
"replies",
")",
"{",
"(",
"(",
"GroupCmdReply",
")",
"obj",
")",
".",
"get_data",
"(",
")",
";",
"}",
"}",
"}"
] | Execute the command on a single device or on a group If group is used the return data is not managed for the
moment.
@throws DevFailed | [
"Execute",
"the",
"command",
"on",
"a",
"single",
"device",
"or",
"on",
"a",
"group",
"If",
"group",
"is",
"used",
"the",
"return",
"data",
"is",
"not",
"managed",
"for",
"the",
"moment",
"."
] | 1ccc9dcb83e6de2359a9f1906d170571cacf1345 | https://github.com/tango-controls/JTango/blob/1ccc9dcb83e6de2359a9f1906d170571cacf1345/client/src/main/java/fr/soleil/tango/clientapi/TangoGroupCommand.java#L55-L68 |
140,341 | tango-controls/JTango | client/src/main/java/fr/soleil/tango/clientapi/TangoGroupCommand.java | TangoGroupCommand.insert | 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);
}
} | java | 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);
}
} | [
"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
@param value
@throws DevFailed | [
"insert",
"a",
"single",
"value",
"for",
"all",
"commands"
] | 1ccc9dcb83e6de2359a9f1906d170571cacf1345 | https://github.com/tango-controls/JTango/blob/1ccc9dcb83e6de2359a9f1906d170571cacf1345/client/src/main/java/fr/soleil/tango/clientapi/TangoGroupCommand.java#L76-L81 |
140,342 | tango-controls/JTango | client/src/main/java/fr/soleil/tango/clientapi/TangoGroupCommand.java | TangoGroupCommand.insert | 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);
}
} else {
if (value.length != group.get_size(true)) {
throw DevFailedUtils.newDevFailed(TANGO_WRONG_DATA_ERROR, group.get_size(true) + " values must be provided");
}
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[i]);
}
}
} | java | 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);
}
} else {
if (value.length != group.get_size(true)) {
throw DevFailedUtils.newDevFailed(TANGO_WRONG_DATA_ERROR, group.get_size(true) + " values must be provided");
}
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[i]);
}
}
} | [
"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",
")",
";",
"}",
"}",
"else",
"{",
"if",
"(",
"value",
".",
"length",
"!=",
"group",
".",
"get_size",
"(",
"true",
")",
")",
"{",
"throw",
"DevFailedUtils",
".",
"newDevFailed",
"(",
"TANGO_WRONG_DATA_ERROR",
",",
"group",
".",
"get_size",
"(",
"true",
")",
"+",
"\" values must be provided\"",
")",
";",
"}",
"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",
"[",
"i",
"]",
")",
";",
"}",
"}",
"}"
] | insert a value per command
@param value
The values to insert. Size must be equals to the number of commands
@throws DevFailed | [
"insert",
"a",
"value",
"per",
"command"
] | 1ccc9dcb83e6de2359a9f1906d170571cacf1345 | https://github.com/tango-controls/JTango/blob/1ccc9dcb83e6de2359a9f1906d170571cacf1345/client/src/main/java/fr/soleil/tango/clientapi/TangoGroupCommand.java#L90-L105 |
140,343 | tango-controls/JTango | server/src/main/java/org/tango/server/servant/CommandGetter.java | CommandGetter.getCommand | 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 DevFailedUtils.newDevFailed(ExceptionMessages.COMMAND_NOT_FOUND, "Command " + name + " not found");
}
return result;
} | java | 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 DevFailedUtils.newDevFailed(ExceptionMessages.COMMAND_NOT_FOUND, "Command " + name + " not found");
}
return result;
} | [
"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",
"DevFailedUtils",
".",
"newDevFailed",
"(",
"ExceptionMessages",
".",
"COMMAND_NOT_FOUND",
",",
"\"Command \"",
"+",
"name",
"+",
"\" not found\"",
")",
";",
"}",
"return",
"result",
";",
"}"
] | Get a command
@param name
@return The command
@throws DevFailed | [
"Get",
"a",
"command"
] | 1ccc9dcb83e6de2359a9f1906d170571cacf1345 | https://github.com/tango-controls/JTango/blob/1ccc9dcb83e6de2359a9f1906d170571cacf1345/server/src/main/java/org/tango/server/servant/CommandGetter.java#L44-L56 |
140,344 | tango-controls/JTango | dao/src/main/java/fr/esrf/TangoDs/Attr.java | Attr.set_default_properties | 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.description));
if (prop_list.unit != null)
user_default_properties.addElement(new AttrProperty("unit",prop_list.unit));
if (prop_list.standard_unit != null)
user_default_properties.addElement(new AttrProperty("standard_unit",prop_list.standard_unit));
if (prop_list.display_unit != null)
user_default_properties.addElement(new AttrProperty("display_unit",prop_list.display_unit));
if (prop_list.format != null)
user_default_properties.addElement(new AttrProperty("format",prop_list.format));
if (prop_list.min_value != null)
user_default_properties.addElement(new AttrProperty("min_value",prop_list.min_value));
if (prop_list.max_value != null)
user_default_properties.addElement(new AttrProperty("max_value",prop_list.max_value));
if (prop_list.min_alarm != null)
user_default_properties.addElement(new AttrProperty("min_alarm",prop_list.min_alarm));
if (prop_list.max_alarm != null)
user_default_properties.addElement(new AttrProperty("max_alarm",prop_list.max_alarm));
} | java | 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.description));
if (prop_list.unit != null)
user_default_properties.addElement(new AttrProperty("unit",prop_list.unit));
if (prop_list.standard_unit != null)
user_default_properties.addElement(new AttrProperty("standard_unit",prop_list.standard_unit));
if (prop_list.display_unit != null)
user_default_properties.addElement(new AttrProperty("display_unit",prop_list.display_unit));
if (prop_list.format != null)
user_default_properties.addElement(new AttrProperty("format",prop_list.format));
if (prop_list.min_value != null)
user_default_properties.addElement(new AttrProperty("min_value",prop_list.min_value));
if (prop_list.max_value != null)
user_default_properties.addElement(new AttrProperty("max_value",prop_list.max_value));
if (prop_list.min_alarm != null)
user_default_properties.addElement(new AttrProperty("min_alarm",prop_list.min_alarm));
if (prop_list.max_alarm != null)
user_default_properties.addElement(new AttrProperty("max_alarm",prop_list.max_alarm));
} | [
"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",
".",
"description",
")",
")",
";",
"if",
"(",
"prop_list",
".",
"unit",
"!=",
"null",
")",
"user_default_properties",
".",
"addElement",
"(",
"new",
"AttrProperty",
"(",
"\"unit\"",
",",
"prop_list",
".",
"unit",
")",
")",
";",
"if",
"(",
"prop_list",
".",
"standard_unit",
"!=",
"null",
")",
"user_default_properties",
".",
"addElement",
"(",
"new",
"AttrProperty",
"(",
"\"standard_unit\"",
",",
"prop_list",
".",
"standard_unit",
")",
")",
";",
"if",
"(",
"prop_list",
".",
"display_unit",
"!=",
"null",
")",
"user_default_properties",
".",
"addElement",
"(",
"new",
"AttrProperty",
"(",
"\"display_unit\"",
",",
"prop_list",
".",
"display_unit",
")",
")",
";",
"if",
"(",
"prop_list",
".",
"format",
"!=",
"null",
")",
"user_default_properties",
".",
"addElement",
"(",
"new",
"AttrProperty",
"(",
"\"format\"",
",",
"prop_list",
".",
"format",
")",
")",
";",
"if",
"(",
"prop_list",
".",
"min_value",
"!=",
"null",
")",
"user_default_properties",
".",
"addElement",
"(",
"new",
"AttrProperty",
"(",
"\"min_value\"",
",",
"prop_list",
".",
"min_value",
")",
")",
";",
"if",
"(",
"prop_list",
".",
"max_value",
"!=",
"null",
")",
"user_default_properties",
".",
"addElement",
"(",
"new",
"AttrProperty",
"(",
"\"max_value\"",
",",
"prop_list",
".",
"max_value",
")",
")",
";",
"if",
"(",
"prop_list",
".",
"min_alarm",
"!=",
"null",
")",
"user_default_properties",
".",
"addElement",
"(",
"new",
"AttrProperty",
"(",
"\"min_alarm\"",
",",
"prop_list",
".",
"min_alarm",
")",
")",
";",
"if",
"(",
"prop_list",
".",
"max_alarm",
"!=",
"null",
")",
"user_default_properties",
".",
"addElement",
"(",
"new",
"AttrProperty",
"(",
"\"max_alarm\"",
",",
"prop_list",
".",
"max_alarm",
")",
")",
";",
"}"
] | Set the attribute user default properties.
@param prop_list The user default attribute properties | [
"Set",
"the",
"attribute",
"user",
"default",
"properties",
"."
] | 1ccc9dcb83e6de2359a9f1906d170571cacf1345 | https://github.com/tango-controls/JTango/blob/1ccc9dcb83e6de2359a9f1906d170571cacf1345/dao/src/main/java/fr/esrf/TangoDs/Attr.java#L353-L384 |
140,345 | tango-controls/JTango | client/src/main/java/fr/soleil/tango/errorstrategy/RetriableTask.java | RetriableTask.execute | public T execute(final Task<T> taskToWrap) throws DevFailed {
int triesLeft = tries;
do {
try {
return taskToWrap.call();
} catch (final DevFailed e) {
triesLeft--;
// Are we allowed to try again?
if (triesLeft <= 0) {
// No -- throw
logger.error("Caught exception, all retries done for error: {}", DevFailedUtils.toString(e));
throw e;
}
// Yes -- log and allow to loop
logger.info("Caught exception, retrying... Error was: {}" + DevFailedUtils.toString(e));
try {
Thread.sleep(delay);
} catch (final InterruptedException e1) {
}
}
} while (triesLeft > 0);
return null;
} | java | public T execute(final Task<T> taskToWrap) throws DevFailed {
int triesLeft = tries;
do {
try {
return taskToWrap.call();
} catch (final DevFailed e) {
triesLeft--;
// Are we allowed to try again?
if (triesLeft <= 0) {
// No -- throw
logger.error("Caught exception, all retries done for error: {}", DevFailedUtils.toString(e));
throw e;
}
// Yes -- log and allow to loop
logger.info("Caught exception, retrying... Error was: {}" + DevFailedUtils.toString(e));
try {
Thread.sleep(delay);
} catch (final InterruptedException e1) {
}
}
} while (triesLeft > 0);
return null;
} | [
"public",
"T",
"execute",
"(",
"final",
"Task",
"<",
"T",
">",
"taskToWrap",
")",
"throws",
"DevFailed",
"{",
"int",
"triesLeft",
"=",
"tries",
";",
"do",
"{",
"try",
"{",
"return",
"taskToWrap",
".",
"call",
"(",
")",
";",
"}",
"catch",
"(",
"final",
"DevFailed",
"e",
")",
"{",
"triesLeft",
"--",
";",
"// Are we allowed to try again?",
"if",
"(",
"triesLeft",
"<=",
"0",
")",
"{",
"// No -- throw",
"logger",
".",
"error",
"(",
"\"Caught exception, all retries done for error: {}\"",
",",
"DevFailedUtils",
".",
"toString",
"(",
"e",
")",
")",
";",
"throw",
"e",
";",
"}",
"// Yes -- log and allow to loop",
"logger",
".",
"info",
"(",
"\"Caught exception, retrying... Error was: {}\"",
"+",
"DevFailedUtils",
".",
"toString",
"(",
"e",
")",
")",
";",
"try",
"{",
"Thread",
".",
"sleep",
"(",
"delay",
")",
";",
"}",
"catch",
"(",
"final",
"InterruptedException",
"e1",
")",
"{",
"}",
"}",
"}",
"while",
"(",
"triesLeft",
">",
"0",
")",
";",
"return",
"null",
";",
"}"
] | Invokes the wrapped Callable's call method, optionally retrying if an
exception occurs. See class documentation for more detail.
@return the return value of the wrapped call() method | [
"Invokes",
"the",
"wrapped",
"Callable",
"s",
"call",
"method",
"optionally",
"retrying",
"if",
"an",
"exception",
"occurs",
".",
"See",
"class",
"documentation",
"for",
"more",
"detail",
"."
] | 1ccc9dcb83e6de2359a9f1906d170571cacf1345 | https://github.com/tango-controls/JTango/blob/1ccc9dcb83e6de2359a9f1906d170571cacf1345/client/src/main/java/fr/soleil/tango/errorstrategy/RetriableTask.java#L53-L78 |
140,346 | tango-controls/JTango | server/src/main/java/org/tango/server/cache/PollingUtils.java | PollingUtils.updatePollingConfigFromDB | public static void updatePollingConfigFromDB(final PolledObjectConfig config,
final AttributePropertiesManager attributePropertiesManager) throws DevFailed {
final String isPolledProp = attributePropertiesManager.getAttributePropertyFromDB(config.getName(),
Constants.IS_POLLED);
if (!isPolledProp.isEmpty()) {
config.setPolled(Boolean.valueOf(isPolledProp));
final String periodProp = attributePropertiesManager.getAttributePropertyFromDB(config.getName(),
Constants.POLLING_PERIOD);
if (!periodProp.isEmpty()) {
config.setPollingPeriod(Integer.valueOf(periodProp));
}
}
} | java | public static void updatePollingConfigFromDB(final PolledObjectConfig config,
final AttributePropertiesManager attributePropertiesManager) throws DevFailed {
final String isPolledProp = attributePropertiesManager.getAttributePropertyFromDB(config.getName(),
Constants.IS_POLLED);
if (!isPolledProp.isEmpty()) {
config.setPolled(Boolean.valueOf(isPolledProp));
final String periodProp = attributePropertiesManager.getAttributePropertyFromDB(config.getName(),
Constants.POLLING_PERIOD);
if (!periodProp.isEmpty()) {
config.setPollingPeriod(Integer.valueOf(periodProp));
}
}
} | [
"public",
"static",
"void",
"updatePollingConfigFromDB",
"(",
"final",
"PolledObjectConfig",
"config",
",",
"final",
"AttributePropertiesManager",
"attributePropertiesManager",
")",
"throws",
"DevFailed",
"{",
"final",
"String",
"isPolledProp",
"=",
"attributePropertiesManager",
".",
"getAttributePropertyFromDB",
"(",
"config",
".",
"getName",
"(",
")",
",",
"Constants",
".",
"IS_POLLED",
")",
";",
"if",
"(",
"!",
"isPolledProp",
".",
"isEmpty",
"(",
")",
")",
"{",
"config",
".",
"setPolled",
"(",
"Boolean",
".",
"valueOf",
"(",
"isPolledProp",
")",
")",
";",
"final",
"String",
"periodProp",
"=",
"attributePropertiesManager",
".",
"getAttributePropertyFromDB",
"(",
"config",
".",
"getName",
"(",
")",
",",
"Constants",
".",
"POLLING_PERIOD",
")",
";",
"if",
"(",
"!",
"periodProp",
".",
"isEmpty",
"(",
")",
")",
"{",
"config",
".",
"setPollingPeriod",
"(",
"Integer",
".",
"valueOf",
"(",
"periodProp",
")",
")",
";",
"}",
"}",
"}"
] | Update polling config in tango db
@param config
@param attributePropertiesManager
@throws DevFailed | [
"Update",
"polling",
"config",
"in",
"tango",
"db"
] | 1ccc9dcb83e6de2359a9f1906d170571cacf1345 | https://github.com/tango-controls/JTango/blob/1ccc9dcb83e6de2359a9f1906d170571cacf1345/server/src/main/java/org/tango/server/cache/PollingUtils.java#L91-L103 |
140,347 | tango-controls/JTango | server/src/main/java/org/tango/server/attribute/AttributeImpl.java | AttributeImpl.updateValue | @Override
public void updateValue() throws DevFailed {
xlogger.entry(getName());
// invoke on device
// final Profiler profilerPeriod = new Profiler("read attribute " + name);
// profilerPeriod.start("invoke");
if (!config.getWritable().equals(AttrWriteType.READ) && behavior instanceof ISetValueUpdater) {
// write value is managed by the user
try {
final AttributeValue setValue = ((ISetValueUpdater) behavior).getSetValue();
if (setValue != null) {
writeValue = (AttributeValue) ((ISetValueUpdater) behavior).getSetValue().clone();
// get as array if necessary (for image)
writeValue.setValueWithoutDim(ArrayUtils.from2DArrayToArray(writeValue.getValue()));
} else {
writeValue = null;
}
} catch (final CloneNotSupportedException e) {
throw DevFailedUtils.newDevFailed(e);
}
}
if (config.getWritable().equals(AttrWriteType.WRITE)) {
if (writeValue == null) {
readValue = new AttributeValue();
readValue.setValue(AttributeTangoType.getDefaultValue(config.getType()));
} else {
readValue = writeValue;
}
} else {
// attribute with a read part
final AttributeValue returnedValue = behavior.getValue();
this.updateValue(returnedValue);
}
// profilerPeriod.stop().print();
xlogger.exit(getName());
} | java | @Override
public void updateValue() throws DevFailed {
xlogger.entry(getName());
// invoke on device
// final Profiler profilerPeriod = new Profiler("read attribute " + name);
// profilerPeriod.start("invoke");
if (!config.getWritable().equals(AttrWriteType.READ) && behavior instanceof ISetValueUpdater) {
// write value is managed by the user
try {
final AttributeValue setValue = ((ISetValueUpdater) behavior).getSetValue();
if (setValue != null) {
writeValue = (AttributeValue) ((ISetValueUpdater) behavior).getSetValue().clone();
// get as array if necessary (for image)
writeValue.setValueWithoutDim(ArrayUtils.from2DArrayToArray(writeValue.getValue()));
} else {
writeValue = null;
}
} catch (final CloneNotSupportedException e) {
throw DevFailedUtils.newDevFailed(e);
}
}
if (config.getWritable().equals(AttrWriteType.WRITE)) {
if (writeValue == null) {
readValue = new AttributeValue();
readValue.setValue(AttributeTangoType.getDefaultValue(config.getType()));
} else {
readValue = writeValue;
}
} else {
// attribute with a read part
final AttributeValue returnedValue = behavior.getValue();
this.updateValue(returnedValue);
}
// profilerPeriod.stop().print();
xlogger.exit(getName());
} | [
"@",
"Override",
"public",
"void",
"updateValue",
"(",
")",
"throws",
"DevFailed",
"{",
"xlogger",
".",
"entry",
"(",
"getName",
"(",
")",
")",
";",
"// invoke on device",
"// final Profiler profilerPeriod = new Profiler(\"read attribute \" + name);",
"// profilerPeriod.start(\"invoke\");",
"if",
"(",
"!",
"config",
".",
"getWritable",
"(",
")",
".",
"equals",
"(",
"AttrWriteType",
".",
"READ",
")",
"&&",
"behavior",
"instanceof",
"ISetValueUpdater",
")",
"{",
"// write value is managed by the user",
"try",
"{",
"final",
"AttributeValue",
"setValue",
"=",
"(",
"(",
"ISetValueUpdater",
")",
"behavior",
")",
".",
"getSetValue",
"(",
")",
";",
"if",
"(",
"setValue",
"!=",
"null",
")",
"{",
"writeValue",
"=",
"(",
"AttributeValue",
")",
"(",
"(",
"ISetValueUpdater",
")",
"behavior",
")",
".",
"getSetValue",
"(",
")",
".",
"clone",
"(",
")",
";",
"// get as array if necessary (for image)",
"writeValue",
".",
"setValueWithoutDim",
"(",
"ArrayUtils",
".",
"from2DArrayToArray",
"(",
"writeValue",
".",
"getValue",
"(",
")",
")",
")",
";",
"}",
"else",
"{",
"writeValue",
"=",
"null",
";",
"}",
"}",
"catch",
"(",
"final",
"CloneNotSupportedException",
"e",
")",
"{",
"throw",
"DevFailedUtils",
".",
"newDevFailed",
"(",
"e",
")",
";",
"}",
"}",
"if",
"(",
"config",
".",
"getWritable",
"(",
")",
".",
"equals",
"(",
"AttrWriteType",
".",
"WRITE",
")",
")",
"{",
"if",
"(",
"writeValue",
"==",
"null",
")",
"{",
"readValue",
"=",
"new",
"AttributeValue",
"(",
")",
";",
"readValue",
".",
"setValue",
"(",
"AttributeTangoType",
".",
"getDefaultValue",
"(",
"config",
".",
"getType",
"(",
")",
")",
")",
";",
"}",
"else",
"{",
"readValue",
"=",
"writeValue",
";",
"}",
"}",
"else",
"{",
"// attribute with a read part",
"final",
"AttributeValue",
"returnedValue",
"=",
"behavior",
".",
"getValue",
"(",
")",
";",
"this",
".",
"updateValue",
"(",
"returnedValue",
")",
";",
"}",
"// profilerPeriod.stop().print();",
"xlogger",
".",
"exit",
"(",
"getName",
"(",
")",
")",
";",
"}"
] | read attribute on device
@throws DevFailed | [
"read",
"attribute",
"on",
"device"
] | 1ccc9dcb83e6de2359a9f1906d170571cacf1345 | https://github.com/tango-controls/JTango/blob/1ccc9dcb83e6de2359a9f1906d170571cacf1345/server/src/main/java/org/tango/server/attribute/AttributeImpl.java#L197-L233 |
140,348 | tango-controls/JTango | server/src/main/java/org/tango/server/attribute/AttributeImpl.java | AttributeImpl.updateValue | @Override
public void updateValue(final AttributeValue inValue) throws DevFailed {
xlogger.entry(getName());
// final Profiler profilerPeriod = new Profiler("read attribute " + name);
// profilerPeriod.start("in");
if (inValue == null) {
throw DevFailedUtils.newDevFailed(ExceptionMessages.ATTR_VALUE_NOT_SET,
name + " read value has not been updated");
}
try {
// copy value
readValue = (AttributeValue) inValue.clone();
} catch (final CloneNotSupportedException e) {
throw DevFailedUtils.newDevFailed(e);
}
// update quality if necessary
if (readValue.getValue() != null && !readValue.getQuality().equals(AttrQuality.ATTR_INVALID)) {
updateQuality(readValue);
}
// profilerPeriod.start("clone");
// profilerPeriod.stop().print();
try {
if (readValue.getValue() != null) {
// profilerPeriod.start("checkUpdateErrors");
checkUpdateErrors(readValue);
// profilerPeriod.start("from2DArrayToArray");
// get as array if necessary (for image)
readValue.setValueWithoutDim(ArrayUtils.from2DArrayToArray(readValue.getValue()));
// force conversion to check types
// profilerPeriod.start("toAttributeValue5");
TangoIDLAttributeUtil.toAttributeValue5(this, readValue, null);
} else {
throw DevFailedUtils.newDevFailed(ExceptionMessages.ATTR_VALUE_NOT_SET,
name + " read value has not been updated");
}
// profilerPeriod.start("updateDefaultWritePart");
updateDefaultWritePart();
// profilerPeriod.stop().print();
} catch (final DevFailed e) {
// readValue.setQuality(AttrQuality.ATTR_INVALID);
readValue.setXDim(0);
readValue.setYDim(0);
lastError = e;
throw e;
}
xlogger.exit(getName());
} | java | @Override
public void updateValue(final AttributeValue inValue) throws DevFailed {
xlogger.entry(getName());
// final Profiler profilerPeriod = new Profiler("read attribute " + name);
// profilerPeriod.start("in");
if (inValue == null) {
throw DevFailedUtils.newDevFailed(ExceptionMessages.ATTR_VALUE_NOT_SET,
name + " read value has not been updated");
}
try {
// copy value
readValue = (AttributeValue) inValue.clone();
} catch (final CloneNotSupportedException e) {
throw DevFailedUtils.newDevFailed(e);
}
// update quality if necessary
if (readValue.getValue() != null && !readValue.getQuality().equals(AttrQuality.ATTR_INVALID)) {
updateQuality(readValue);
}
// profilerPeriod.start("clone");
// profilerPeriod.stop().print();
try {
if (readValue.getValue() != null) {
// profilerPeriod.start("checkUpdateErrors");
checkUpdateErrors(readValue);
// profilerPeriod.start("from2DArrayToArray");
// get as array if necessary (for image)
readValue.setValueWithoutDim(ArrayUtils.from2DArrayToArray(readValue.getValue()));
// force conversion to check types
// profilerPeriod.start("toAttributeValue5");
TangoIDLAttributeUtil.toAttributeValue5(this, readValue, null);
} else {
throw DevFailedUtils.newDevFailed(ExceptionMessages.ATTR_VALUE_NOT_SET,
name + " read value has not been updated");
}
// profilerPeriod.start("updateDefaultWritePart");
updateDefaultWritePart();
// profilerPeriod.stop().print();
} catch (final DevFailed e) {
// readValue.setQuality(AttrQuality.ATTR_INVALID);
readValue.setXDim(0);
readValue.setYDim(0);
lastError = e;
throw e;
}
xlogger.exit(getName());
} | [
"@",
"Override",
"public",
"void",
"updateValue",
"(",
"final",
"AttributeValue",
"inValue",
")",
"throws",
"DevFailed",
"{",
"xlogger",
".",
"entry",
"(",
"getName",
"(",
")",
")",
";",
"// final Profiler profilerPeriod = new Profiler(\"read attribute \" + name);",
"// profilerPeriod.start(\"in\");",
"if",
"(",
"inValue",
"==",
"null",
")",
"{",
"throw",
"DevFailedUtils",
".",
"newDevFailed",
"(",
"ExceptionMessages",
".",
"ATTR_VALUE_NOT_SET",
",",
"name",
"+",
"\" read value has not been updated\"",
")",
";",
"}",
"try",
"{",
"// copy value",
"readValue",
"=",
"(",
"AttributeValue",
")",
"inValue",
".",
"clone",
"(",
")",
";",
"}",
"catch",
"(",
"final",
"CloneNotSupportedException",
"e",
")",
"{",
"throw",
"DevFailedUtils",
".",
"newDevFailed",
"(",
"e",
")",
";",
"}",
"// update quality if necessary",
"if",
"(",
"readValue",
".",
"getValue",
"(",
")",
"!=",
"null",
"&&",
"!",
"readValue",
".",
"getQuality",
"(",
")",
".",
"equals",
"(",
"AttrQuality",
".",
"ATTR_INVALID",
")",
")",
"{",
"updateQuality",
"(",
"readValue",
")",
";",
"}",
"// profilerPeriod.start(\"clone\");",
"// profilerPeriod.stop().print();",
"try",
"{",
"if",
"(",
"readValue",
".",
"getValue",
"(",
")",
"!=",
"null",
")",
"{",
"// profilerPeriod.start(\"checkUpdateErrors\");",
"checkUpdateErrors",
"(",
"readValue",
")",
";",
"// profilerPeriod.start(\"from2DArrayToArray\");",
"// get as array if necessary (for image)",
"readValue",
".",
"setValueWithoutDim",
"(",
"ArrayUtils",
".",
"from2DArrayToArray",
"(",
"readValue",
".",
"getValue",
"(",
")",
")",
")",
";",
"// force conversion to check types",
"// profilerPeriod.start(\"toAttributeValue5\");",
"TangoIDLAttributeUtil",
".",
"toAttributeValue5",
"(",
"this",
",",
"readValue",
",",
"null",
")",
";",
"}",
"else",
"{",
"throw",
"DevFailedUtils",
".",
"newDevFailed",
"(",
"ExceptionMessages",
".",
"ATTR_VALUE_NOT_SET",
",",
"name",
"+",
"\" read value has not been updated\"",
")",
";",
"}",
"// profilerPeriod.start(\"updateDefaultWritePart\");",
"updateDefaultWritePart",
"(",
")",
";",
"// profilerPeriod.stop().print();",
"}",
"catch",
"(",
"final",
"DevFailed",
"e",
")",
"{",
"// readValue.setQuality(AttrQuality.ATTR_INVALID);",
"readValue",
".",
"setXDim",
"(",
"0",
")",
";",
"readValue",
".",
"setYDim",
"(",
"0",
")",
";",
"lastError",
"=",
"e",
";",
"throw",
"e",
";",
"}",
"xlogger",
".",
"exit",
"(",
"getName",
"(",
")",
")",
";",
"}"
] | set the read value
@throws DevFailed | [
"set",
"the",
"read",
"value"
] | 1ccc9dcb83e6de2359a9f1906d170571cacf1345 | https://github.com/tango-controls/JTango/blob/1ccc9dcb83e6de2359a9f1906d170571cacf1345/server/src/main/java/org/tango/server/attribute/AttributeImpl.java#L240-L290 |
140,349 | tango-controls/JTango | server/src/main/java/org/tango/server/attribute/AttributeImpl.java | AttributeImpl.setProperties | 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(memorizedValue.toString());
if (properties.getMaxValueDouble() < memoValue || properties.getMinValueDouble() > memoValue) {
throw DevFailedUtils.newDevFailed("min or max value not possible for current memorized value");
}
}
}
config.setAttributeProperties(properties);
if (isFwdAttribute) {
// set config on forwarded attribute
final ForwardedAttribute fwdAttr = (ForwardedAttribute) behavior;
properties.setRootAttribute(fwdAttr.getRootName());
fwdAttr.setAttributeConfiguration(config);
}
config.persist(deviceName);
EventManager.getInstance().pushAttributeConfigEvent(deviceName, name);
} | java | 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(memorizedValue.toString());
if (properties.getMaxValueDouble() < memoValue || properties.getMinValueDouble() > memoValue) {
throw DevFailedUtils.newDevFailed("min or max value not possible for current memorized value");
}
}
}
config.setAttributeProperties(properties);
if (isFwdAttribute) {
// set config on forwarded attribute
final ForwardedAttribute fwdAttr = (ForwardedAttribute) behavior;
properties.setRootAttribute(fwdAttr.getRootName());
fwdAttr.setAttributeConfiguration(config);
}
config.persist(deviceName);
EventManager.getInstance().pushAttributeConfigEvent(deviceName, name);
} | [
"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",
"(",
"memorizedValue",
".",
"toString",
"(",
")",
")",
";",
"if",
"(",
"properties",
".",
"getMaxValueDouble",
"(",
")",
"<",
"memoValue",
"||",
"properties",
".",
"getMinValueDouble",
"(",
")",
">",
"memoValue",
")",
"{",
"throw",
"DevFailedUtils",
".",
"newDevFailed",
"(",
"\"min or max value not possible for current memorized value\"",
")",
";",
"}",
"}",
"}",
"config",
".",
"setAttributeProperties",
"(",
"properties",
")",
";",
"if",
"(",
"isFwdAttribute",
")",
"{",
"// set config on forwarded attribute",
"final",
"ForwardedAttribute",
"fwdAttr",
"=",
"(",
"ForwardedAttribute",
")",
"behavior",
";",
"properties",
".",
"setRootAttribute",
"(",
"fwdAttr",
".",
"getRootName",
"(",
")",
")",
";",
"fwdAttr",
".",
"setAttributeConfiguration",
"(",
"config",
")",
";",
"}",
"config",
".",
"persist",
"(",
"deviceName",
")",
";",
"EventManager",
".",
"getInstance",
"(",
")",
".",
"pushAttributeConfigEvent",
"(",
"deviceName",
",",
"name",
")",
";",
"}"
] | Set the attribute properties.
@param properties The attribute properties
@throws DevFailed | [
"Set",
"the",
"attribute",
"properties",
"."
] | 1ccc9dcb83e6de2359a9f1906d170571cacf1345 | https://github.com/tango-controls/JTango/blob/1ccc9dcb83e6de2359a9f1906d170571cacf1345/server/src/main/java/org/tango/server/attribute/AttributeImpl.java#L590-L609 |
140,350 | tango-controls/JTango | client/src/main/java/org/tango/client/database/cache/NoCacheDatabase.java | NoCacheDatabase.extractArgout | private Map<String, String[]> extractArgout(final String[] result, final int startingPoint) {
final Map<String, String[]> map = new CaseInsensitiveMap<String[]>();
if (result.length > 4) {
// System.out.println(result[0]);// device name
// System.out.println(Integer.valueOf(result[1]));// prop size
// System.out.println(result[2]);// prop name
int i = startingPoint;
int nextSize = Integer.valueOf(result[i + 1]);
while (i < result.length) {
// System.out.println("i " + i);
if (nextSize > 0) {
final String name = result[i].toLowerCase(Locale.ENGLISH);
final String[] propValues = Arrays.copyOfRange(result, i + 2, nextSize + i + 2);
map.put(name, propValues);
// System.out.println("name " + name);
// System.out.println("prop1 " + Arrays.toString(propValues));
}
final int idxNextPropSize;
if (nextSize == 0) {
// System.out.println("zero");
idxNextPropSize = i + 4;
i = i + 3;
} else {
idxNextPropSize = nextSize + i + 3;
i = nextSize + i + 2;
}
// System.out.println("idxNextPropSize " + idxNextPropSize);
if (idxNextPropSize >= result.length) {
break;
}
// System.out.println("idxNextPropSize value " +
// result[idxNextPropSize]);
nextSize = Integer.valueOf(result[idxNextPropSize]);
// System.out.println("nextSize " + nextSize);
}
}
return map;
} | java | private Map<String, String[]> extractArgout(final String[] result, final int startingPoint) {
final Map<String, String[]> map = new CaseInsensitiveMap<String[]>();
if (result.length > 4) {
// System.out.println(result[0]);// device name
// System.out.println(Integer.valueOf(result[1]));// prop size
// System.out.println(result[2]);// prop name
int i = startingPoint;
int nextSize = Integer.valueOf(result[i + 1]);
while (i < result.length) {
// System.out.println("i " + i);
if (nextSize > 0) {
final String name = result[i].toLowerCase(Locale.ENGLISH);
final String[] propValues = Arrays.copyOfRange(result, i + 2, nextSize + i + 2);
map.put(name, propValues);
// System.out.println("name " + name);
// System.out.println("prop1 " + Arrays.toString(propValues));
}
final int idxNextPropSize;
if (nextSize == 0) {
// System.out.println("zero");
idxNextPropSize = i + 4;
i = i + 3;
} else {
idxNextPropSize = nextSize + i + 3;
i = nextSize + i + 2;
}
// System.out.println("idxNextPropSize " + idxNextPropSize);
if (idxNextPropSize >= result.length) {
break;
}
// System.out.println("idxNextPropSize value " +
// result[idxNextPropSize]);
nextSize = Integer.valueOf(result[idxNextPropSize]);
// System.out.println("nextSize " + nextSize);
}
}
return map;
} | [
"private",
"Map",
"<",
"String",
",",
"String",
"[",
"]",
">",
"extractArgout",
"(",
"final",
"String",
"[",
"]",
"result",
",",
"final",
"int",
"startingPoint",
")",
"{",
"final",
"Map",
"<",
"String",
",",
"String",
"[",
"]",
">",
"map",
"=",
"new",
"CaseInsensitiveMap",
"<",
"String",
"[",
"]",
">",
"(",
")",
";",
"if",
"(",
"result",
".",
"length",
">",
"4",
")",
"{",
"// System.out.println(result[0]);// device name",
"// System.out.println(Integer.valueOf(result[1]));// prop size",
"// System.out.println(result[2]);// prop name",
"int",
"i",
"=",
"startingPoint",
";",
"int",
"nextSize",
"=",
"Integer",
".",
"valueOf",
"(",
"result",
"[",
"i",
"+",
"1",
"]",
")",
";",
"while",
"(",
"i",
"<",
"result",
".",
"length",
")",
"{",
"// System.out.println(\"i \" + i);",
"if",
"(",
"nextSize",
">",
"0",
")",
"{",
"final",
"String",
"name",
"=",
"result",
"[",
"i",
"]",
".",
"toLowerCase",
"(",
"Locale",
".",
"ENGLISH",
")",
";",
"final",
"String",
"[",
"]",
"propValues",
"=",
"Arrays",
".",
"copyOfRange",
"(",
"result",
",",
"i",
"+",
"2",
",",
"nextSize",
"+",
"i",
"+",
"2",
")",
";",
"map",
".",
"put",
"(",
"name",
",",
"propValues",
")",
";",
"// System.out.println(\"name \" + name);",
"// System.out.println(\"prop1 \" + Arrays.toString(propValues));",
"}",
"final",
"int",
"idxNextPropSize",
";",
"if",
"(",
"nextSize",
"==",
"0",
")",
"{",
"// System.out.println(\"zero\");",
"idxNextPropSize",
"=",
"i",
"+",
"4",
";",
"i",
"=",
"i",
"+",
"3",
";",
"}",
"else",
"{",
"idxNextPropSize",
"=",
"nextSize",
"+",
"i",
"+",
"3",
";",
"i",
"=",
"nextSize",
"+",
"i",
"+",
"2",
";",
"}",
"// System.out.println(\"idxNextPropSize \" + idxNextPropSize);",
"if",
"(",
"idxNextPropSize",
">=",
"result",
".",
"length",
")",
"{",
"break",
";",
"}",
"// System.out.println(\"idxNextPropSize value \" +",
"// result[idxNextPropSize]);",
"nextSize",
"=",
"Integer",
".",
"valueOf",
"(",
"result",
"[",
"idxNextPropSize",
"]",
")",
";",
"// System.out.println(\"nextSize \" + nextSize);",
"}",
"}",
"return",
"map",
";",
"}"
] | Return a map of properties with name as key and value as entry
@param result
Array {propName, propSize, values...,propNameN, propSizeN,
valuesN}
@param startingPoint
@return | [
"Return",
"a",
"map",
"of",
"properties",
"with",
"name",
"as",
"key",
"and",
"value",
"as",
"entry"
] | 1ccc9dcb83e6de2359a9f1906d170571cacf1345 | https://github.com/tango-controls/JTango/blob/1ccc9dcb83e6de2359a9f1906d170571cacf1345/client/src/main/java/org/tango/client/database/cache/NoCacheDatabase.java#L311-L351 |
140,351 | tango-controls/JTango | dao/src/main/java/fr/esrf/TangoDs/RemoveLoggingTargetCmd.java | RemoveLoggingTargetCmd.execute | 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() --> Wrong argument type");
Except.re_throw_exception(df,
"API_IncompatibleCmdArgumentType",
"Imcompatible command argument type, expected type is : DevVarStringArray",
"RemoveLoggingTargetCmd.execute");
}
Logging.instance().remove_logging_target(dvsa);
return Util.return_empty_any("RemoveLoggingTarget");
} | java | 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() --> Wrong argument type");
Except.re_throw_exception(df,
"API_IncompatibleCmdArgumentType",
"Imcompatible command argument type, expected type is : DevVarStringArray",
"RemoveLoggingTargetCmd.execute");
}
Logging.instance().remove_logging_target(dvsa);
return Util.return_empty_any("RemoveLoggingTarget");
} | [
"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() --> Wrong argument type\"",
")",
";",
"Except",
".",
"re_throw_exception",
"(",
"df",
",",
"\"API_IncompatibleCmdArgumentType\"",
",",
"\"Imcompatible command argument type, expected type is : DevVarStringArray\"",
",",
"\"RemoveLoggingTargetCmd.execute\"",
")",
";",
"}",
"Logging",
".",
"instance",
"(",
")",
".",
"remove_logging_target",
"(",
"dvsa",
")",
";",
"return",
"Util",
".",
"return_empty_any",
"(",
"\"RemoveLoggingTarget\"",
")",
";",
"}"
] | Executes the RemoveLoggingTargetCmd TANGO command | [
"Executes",
"the",
"RemoveLoggingTargetCmd",
"TANGO",
"command"
] | 1ccc9dcb83e6de2359a9f1906d170571cacf1345 | https://github.com/tango-controls/JTango/blob/1ccc9dcb83e6de2359a9f1906d170571cacf1345/dao/src/main/java/fr/esrf/TangoDs/RemoveLoggingTargetCmd.java#L55-L74 |
140,352 | tango-controls/JTango | server/src/main/java/org/tango/server/properties/PropertiesUtils.java | PropertiesUtils.getProp | 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();
}
}
}
return result;
} | java | 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();
}
}
}
return result;
} | [
"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",
"(",
")",
";",
"}",
"}",
"}",
"return",
"result",
";",
"}"
] | Ignore case on property name
@param prop
@param propertyName
@return The property value | [
"Ignore",
"case",
"on",
"property",
"name"
] | 1ccc9dcb83e6de2359a9f1906d170571cacf1345 | https://github.com/tango-controls/JTango/blob/1ccc9dcb83e6de2359a9f1906d170571cacf1345/server/src/main/java/org/tango/server/properties/PropertiesUtils.java#L148-L158 |
140,353 | tango-controls/JTango | server/src/main/java/org/tango/server/properties/PropertiesUtils.java | PropertiesUtils.setDevicePipePropertiesInDB | 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().setDevicePipeProperties(deviceName, pipeName, properties);
} | java | 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().setDevicePipeProperties(deviceName, pipeName, properties);
} | [
"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",
"(",
")",
".",
"setDevicePipeProperties",
"(",
"deviceName",
",",
"pipeName",
",",
"properties",
")",
";",
"}"
] | Set pipe device properties in db
@param deviceName
@param pipeName
@param properties
@throws DevFailed | [
"Set",
"pipe",
"device",
"properties",
"in",
"db"
] | 1ccc9dcb83e6de2359a9f1906d170571cacf1345 | https://github.com/tango-controls/JTango/blob/1ccc9dcb83e6de2359a9f1906d170571cacf1345/server/src/main/java/org/tango/server/properties/PropertiesUtils.java#L286-L290 |
140,354 | tango-controls/JTango | dao/src/main/java/fr/esrf/TangoDs/StartLoggingCmd.java | StartLoggingCmd.execute | 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");
} | java | 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");
} | [
"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 | [
"Executes",
"the",
"StartLoggingCmd",
"TANGO",
"command"
] | 1ccc9dcb83e6de2359a9f1906d170571cacf1345 | https://github.com/tango-controls/JTango/blob/1ccc9dcb83e6de2359a9f1906d170571cacf1345/dao/src/main/java/fr/esrf/TangoDs/StartLoggingCmd.java#L53-L62 |
140,355 | tango-controls/JTango | server/src/main/java/org/tango/server/admin/AdminDevice.java | AdminDevice.init | @Init
@StateMachine(endState = DeviceState.ON)
public void init() throws DevFailed {
xlogger.entry();
TangoCacheManager.setPollSize(pollingThreadsPoolSize);
// logger.debug("init admin device with quartzThreadsPoolSize = {}",
// quartzThreadsPoolSize);
status = "The device is ON\nThe polling is ON";
tangoStats = TangoStats.getInstance();
xlogger.exit();
} | java | @Init
@StateMachine(endState = DeviceState.ON)
public void init() throws DevFailed {
xlogger.entry();
TangoCacheManager.setPollSize(pollingThreadsPoolSize);
// logger.debug("init admin device with quartzThreadsPoolSize = {}",
// quartzThreadsPoolSize);
status = "The device is ON\nThe polling is ON";
tangoStats = TangoStats.getInstance();
xlogger.exit();
} | [
"@",
"Init",
"@",
"StateMachine",
"(",
"endState",
"=",
"DeviceState",
".",
"ON",
")",
"public",
"void",
"init",
"(",
")",
"throws",
"DevFailed",
"{",
"xlogger",
".",
"entry",
"(",
")",
";",
"TangoCacheManager",
".",
"setPollSize",
"(",
"pollingThreadsPoolSize",
")",
";",
"// logger.debug(\"init admin device with quartzThreadsPoolSize = {}\",",
"// quartzThreadsPoolSize);",
"status",
"=",
"\"The device is ON\\nThe polling is ON\"",
";",
"tangoStats",
"=",
"TangoStats",
".",
"getInstance",
"(",
")",
";",
"xlogger",
".",
"exit",
"(",
")",
";",
"}"
] | Init the device
@throws DevFailed | [
"Init",
"the",
"device"
] | 1ccc9dcb83e6de2359a9f1906d170571cacf1345 | https://github.com/tango-controls/JTango/blob/1ccc9dcb83e6de2359a9f1906d170571cacf1345/server/src/main/java/org/tango/server/admin/AdminDevice.java#L112-L122 |
140,356 | tango-controls/JTango | server/src/main/java/org/tango/server/admin/AdminDevice.java | AdminDevice.getPollStatus | @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);
return ret;
} | java | @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);
return ret;
} | [
"@",
"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",
")",
";",
"return",
"ret",
";",
"}"
] | get the polling status
@param deviceName Device name
@return Device polling status
@throws DevFailed | [
"get",
"the",
"polling",
"status"
] | 1ccc9dcb83e6de2359a9f1906d170571cacf1345 | https://github.com/tango-controls/JTango/blob/1ccc9dcb83e6de2359a9f1906d170571cacf1345/server/src/main/java/org/tango/server/admin/AdminDevice.java#L149-L156 |
140,357 | tango-controls/JTango | server/src/main/java/org/tango/server/admin/AdminDevice.java | AdminDevice.restartServer | @Command(name = "RestartServer")
public void restartServer() throws DevFailed {
xlogger.entry();
tangoExporter.unexportAll();
tangoExporter.exportAll();
xlogger.exit();
} | java | @Command(name = "RestartServer")
public void restartServer() throws DevFailed {
xlogger.entry();
tangoExporter.unexportAll();
tangoExporter.exportAll();
xlogger.exit();
} | [
"@",
"Command",
"(",
"name",
"=",
"\"RestartServer\"",
")",
"public",
"void",
"restartServer",
"(",
")",
"throws",
"DevFailed",
"{",
"xlogger",
".",
"entry",
"(",
")",
";",
"tangoExporter",
".",
"unexportAll",
"(",
")",
";",
"tangoExporter",
".",
"exportAll",
"(",
")",
";",
"xlogger",
".",
"exit",
"(",
")",
";",
"}"
] | Restart the whole server and its devices.
@throws DevFailed | [
"Restart",
"the",
"whole",
"server",
"and",
"its",
"devices",
"."
] | 1ccc9dcb83e6de2359a9f1906d170571cacf1345 | https://github.com/tango-controls/JTango/blob/1ccc9dcb83e6de2359a9f1906d170571cacf1345/server/src/main/java/org/tango/server/admin/AdminDevice.java#L244-L250 |
140,358 | tango-controls/JTango | server/src/main/java/org/tango/server/admin/AdminDevice.java | AdminDevice.kill | @Command(name = "Kill")
public void kill() throws DevFailed {
xlogger.entry();
// do it in a thread to avoid throwing error to client
new Thread() {
@Override
public void run() {
logger.error("kill server");
try {
tangoExporter.unexportAll();
} catch (final DevFailed e) {
} finally {
ORBManager.shutdown();
System.exit(-1);
}
logger.error("everything has been shutdown normally");
}
}.start();
xlogger.exit();
} | java | @Command(name = "Kill")
public void kill() throws DevFailed {
xlogger.entry();
// do it in a thread to avoid throwing error to client
new Thread() {
@Override
public void run() {
logger.error("kill server");
try {
tangoExporter.unexportAll();
} catch (final DevFailed e) {
} finally {
ORBManager.shutdown();
System.exit(-1);
}
logger.error("everything has been shutdown normally");
}
}.start();
xlogger.exit();
} | [
"@",
"Command",
"(",
"name",
"=",
"\"Kill\"",
")",
"public",
"void",
"kill",
"(",
")",
"throws",
"DevFailed",
"{",
"xlogger",
".",
"entry",
"(",
")",
";",
"// do it in a thread to avoid throwing error to client",
"new",
"Thread",
"(",
")",
"{",
"@",
"Override",
"public",
"void",
"run",
"(",
")",
"{",
"logger",
".",
"error",
"(",
"\"kill server\"",
")",
";",
"try",
"{",
"tangoExporter",
".",
"unexportAll",
"(",
")",
";",
"}",
"catch",
"(",
"final",
"DevFailed",
"e",
")",
"{",
"}",
"finally",
"{",
"ORBManager",
".",
"shutdown",
"(",
")",
";",
"System",
".",
"exit",
"(",
"-",
"1",
")",
";",
"}",
"logger",
".",
"error",
"(",
"\"everything has been shutdown normally\"",
")",
";",
"}",
"}",
".",
"start",
"(",
")",
";",
"xlogger",
".",
"exit",
"(",
")",
";",
"}"
] | Unexport everything and kill it self
@throws DevFailed | [
"Unexport",
"everything",
"and",
"kill",
"it",
"self"
] | 1ccc9dcb83e6de2359a9f1906d170571cacf1345 | https://github.com/tango-controls/JTango/blob/1ccc9dcb83e6de2359a9f1906d170571cacf1345/server/src/main/java/org/tango/server/admin/AdminDevice.java#L257-L278 |
140,359 | tango-controls/JTango | server/src/main/java/org/tango/server/admin/AdminDevice.java | AdminDevice.addLoggingTarget | @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 = 0; i < argin.length - 1; i = i + 2) {
final String deviceName = argin[i];
final String[] config = argin[i + 1].split(LoggingManager.LOGGING_TARGET_SEPARATOR);
if (config.length != 2) {
throw DevFailedUtils.newDevFailed(INPUT_ERROR, "config must be of size 2: targetType::targetName");
}
if (config[0].equalsIgnoreCase(LoggingManager.LOGGING_TARGET_DEVICE)) {
Class<?> className = null;
for (final DeviceClassBuilder deviceClass : classList) {
if (deviceClass.containsDevice(deviceName)) {
className = deviceClass.getDeviceClass();
break;
}
}
if (className != null) {
LoggingManager.getInstance().addDeviceAppender(config[1], className, deviceName);
}
} else {
LoggingManager.getInstance().addFileAppender(config[1], deviceName);
}
}
} | java | @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 = 0; i < argin.length - 1; i = i + 2) {
final String deviceName = argin[i];
final String[] config = argin[i + 1].split(LoggingManager.LOGGING_TARGET_SEPARATOR);
if (config.length != 2) {
throw DevFailedUtils.newDevFailed(INPUT_ERROR, "config must be of size 2: targetType::targetName");
}
if (config[0].equalsIgnoreCase(LoggingManager.LOGGING_TARGET_DEVICE)) {
Class<?> className = null;
for (final DeviceClassBuilder deviceClass : classList) {
if (deviceClass.containsDevice(deviceName)) {
className = deviceClass.getDeviceClass();
break;
}
}
if (className != null) {
LoggingManager.getInstance().addDeviceAppender(config[1], className, deviceName);
}
} else {
LoggingManager.getInstance().addFileAppender(config[1], deviceName);
}
}
} | [
"@",
"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",
"=",
"0",
";",
"i",
"<",
"argin",
".",
"length",
"-",
"1",
";",
"i",
"=",
"i",
"+",
"2",
")",
"{",
"final",
"String",
"deviceName",
"=",
"argin",
"[",
"i",
"]",
";",
"final",
"String",
"[",
"]",
"config",
"=",
"argin",
"[",
"i",
"+",
"1",
"]",
".",
"split",
"(",
"LoggingManager",
".",
"LOGGING_TARGET_SEPARATOR",
")",
";",
"if",
"(",
"config",
".",
"length",
"!=",
"2",
")",
"{",
"throw",
"DevFailedUtils",
".",
"newDevFailed",
"(",
"INPUT_ERROR",
",",
"\"config must be of size 2: targetType::targetName\"",
")",
";",
"}",
"if",
"(",
"config",
"[",
"0",
"]",
".",
"equalsIgnoreCase",
"(",
"LoggingManager",
".",
"LOGGING_TARGET_DEVICE",
")",
")",
"{",
"Class",
"<",
"?",
">",
"className",
"=",
"null",
";",
"for",
"(",
"final",
"DeviceClassBuilder",
"deviceClass",
":",
"classList",
")",
"{",
"if",
"(",
"deviceClass",
".",
"containsDevice",
"(",
"deviceName",
")",
")",
"{",
"className",
"=",
"deviceClass",
".",
"getDeviceClass",
"(",
")",
";",
"break",
";",
"}",
"}",
"if",
"(",
"className",
"!=",
"null",
")",
"{",
"LoggingManager",
".",
"getInstance",
"(",
")",
".",
"addDeviceAppender",
"(",
"config",
"[",
"1",
"]",
",",
"className",
",",
"deviceName",
")",
";",
"}",
"}",
"else",
"{",
"LoggingManager",
".",
"getInstance",
"(",
")",
".",
"addFileAppender",
"(",
"config",
"[",
"1",
"]",
",",
"deviceName",
")",
";",
"}",
"}",
"}"
] | Send logs to a device
@param argin
@throws DevFailed | [
"Send",
"logs",
"to",
"a",
"device"
] | 1ccc9dcb83e6de2359a9f1906d170571cacf1345 | https://github.com/tango-controls/JTango/blob/1ccc9dcb83e6de2359a9f1906d170571cacf1345/server/src/main/java/org/tango/server/admin/AdminDevice.java#L302-L329 |
140,360 | tango-controls/JTango | server/src/main/java/org/tango/server/admin/AdminDevice.java | AdminDevice.removeLoggingTarget | @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 (int i = 0; i < argin.length - 1; i = i + 2) {
final String deviceName = argin[i];
final String[] config = argin[i + 1].split(LoggingManager.LOGGING_TARGET_SEPARATOR);
if (config.length != 2) {
throw DevFailedUtils.newDevFailed(INPUT_ERROR, "config must be of size 2: targetType::targetName");
}
LoggingManager.getInstance().removeAppender(deviceName, config[0]);
}
} | java | @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 (int i = 0; i < argin.length - 1; i = i + 2) {
final String deviceName = argin[i];
final String[] config = argin[i + 1].split(LoggingManager.LOGGING_TARGET_SEPARATOR);
if (config.length != 2) {
throw DevFailedUtils.newDevFailed(INPUT_ERROR, "config must be of size 2: targetType::targetName");
}
LoggingManager.getInstance().removeAppender(deviceName, config[0]);
}
} | [
"@",
"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",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"argin",
".",
"length",
"-",
"1",
";",
"i",
"=",
"i",
"+",
"2",
")",
"{",
"final",
"String",
"deviceName",
"=",
"argin",
"[",
"i",
"]",
";",
"final",
"String",
"[",
"]",
"config",
"=",
"argin",
"[",
"i",
"+",
"1",
"]",
".",
"split",
"(",
"LoggingManager",
".",
"LOGGING_TARGET_SEPARATOR",
")",
";",
"if",
"(",
"config",
".",
"length",
"!=",
"2",
")",
"{",
"throw",
"DevFailedUtils",
".",
"newDevFailed",
"(",
"INPUT_ERROR",
",",
"\"config must be of size 2: targetType::targetName\"",
")",
";",
"}",
"LoggingManager",
".",
"getInstance",
"(",
")",
".",
"removeAppender",
"(",
"deviceName",
",",
"config",
"[",
"0",
"]",
")",
";",
"}",
"}"
] | remove logging to a device
@param argin
@throws DevFailed | [
"remove",
"logging",
"to",
"a",
"device"
] | 1ccc9dcb83e6de2359a9f1906d170571cacf1345 | https://github.com/tango-controls/JTango/blob/1ccc9dcb83e6de2359a9f1906d170571cacf1345/server/src/main/java/org/tango/server/admin/AdminDevice.java#L337-L350 |
140,361 | tango-controls/JTango | server/src/main/java/org/tango/server/admin/AdminDevice.java | AdminDevice.getLoggingLevel | @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[i] = LoggingManager.getInstance().getLoggingLevel(deviceNames[i]);
}
return new DevVarLongStringArray(levels, deviceNames);
} | java | @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[i] = LoggingManager.getInstance().getLoggingLevel(deviceNames[i]);
}
return new DevVarLongStringArray(levels, deviceNames);
} | [
"@",
"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",
"[",
"i",
"]",
"=",
"LoggingManager",
".",
"getInstance",
"(",
")",
".",
"getLoggingLevel",
"(",
"deviceNames",
"[",
"i",
"]",
")",
";",
"}",
"return",
"new",
"DevVarLongStringArray",
"(",
"levels",
",",
"deviceNames",
")",
";",
"}"
] | Get the logging level
@param deviceNames
@return the current logging levels | [
"Get",
"the",
"logging",
"level"
] | 1ccc9dcb83e6de2359a9f1906d170571cacf1345 | https://github.com/tango-controls/JTango/blob/1ccc9dcb83e6de2359a9f1906d170571cacf1345/server/src/main/java/org/tango/server/admin/AdminDevice.java#L358-L365 |
140,362 | tango-controls/JTango | server/src/main/java/org/tango/server/admin/AdminDevice.java | AdminDevice.getLoggingTarget | @Command(name = "GetLoggingTarget", inTypeDesc = DEVICE_NAME, outTypeDesc = "Logging target list")
public String[] getLoggingTarget(final String deviceName) throws DevFailed {
return LoggingManager.getInstance().getLoggingTarget(deviceName);
} | java | @Command(name = "GetLoggingTarget", inTypeDesc = DEVICE_NAME, outTypeDesc = "Logging target list")
public String[] getLoggingTarget(final String deviceName) throws DevFailed {
return LoggingManager.getInstance().getLoggingTarget(deviceName);
} | [
"@",
"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
@param deviceName
@return Logging target list
@throws DevFailed | [
"Get",
"logging",
"target"
] | 1ccc9dcb83e6de2359a9f1906d170571cacf1345 | https://github.com/tango-controls/JTango/blob/1ccc9dcb83e6de2359a9f1906d170571cacf1345/server/src/main/java/org/tango/server/admin/AdminDevice.java#L375-L378 |
140,363 | tango-controls/JTango | server/src/main/java/org/tango/server/admin/AdminDevice.java | AdminDevice.setLoggingLevel | @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) {
throw DevFailedUtils.newDevFailed(INPUT_ERROR, "argin must be of same size for string and long ");
}
for (int i = 0; i < levels.length; i++) {
LoggingManager.getInstance().setLoggingLevel(deviceNames[i], levels[i]);
}
} | java | @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) {
throw DevFailedUtils.newDevFailed(INPUT_ERROR, "argin must be of same size for string and long ");
}
for (int i = 0; i < levels.length; i++) {
LoggingManager.getInstance().setLoggingLevel(deviceNames[i], levels[i]);
}
} | [
"@",
"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",
")",
"{",
"throw",
"DevFailedUtils",
".",
"newDevFailed",
"(",
"INPUT_ERROR",
",",
"\"argin must be of same size for string and long \"",
")",
";",
"}",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"levels",
".",
"length",
";",
"i",
"++",
")",
"{",
"LoggingManager",
".",
"getInstance",
"(",
")",
".",
"setLoggingLevel",
"(",
"deviceNames",
"[",
"i",
"]",
",",
"levels",
"[",
"i",
"]",
")",
";",
"}",
"}"
] | Set logging level
@param dvlsa Lg[i]=Logging Level. Str[i]=Device name.
@throws DevFailed | [
"Set",
"logging",
"level"
] | 1ccc9dcb83e6de2359a9f1906d170571cacf1345 | https://github.com/tango-controls/JTango/blob/1ccc9dcb83e6de2359a9f1906d170571cacf1345/server/src/main/java/org/tango/server/admin/AdminDevice.java#L386-L397 |
140,364 | tango-controls/JTango | server/src/main/java/org/tango/server/admin/AdminDevice.java | AdminDevice.queryClassProp | @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 (final DeviceClassBuilder deviceClass : classList) {
if (deviceClass.getClassName().equalsIgnoreCase(className)) {
final List<DeviceImpl> devices = deviceClass.getDeviceImplList();
if (devices.size() > 0) {
final DeviceImpl dev = devices.get(0);
final List<ClassPropertyImpl> props = dev.getClassPropertyList();
for (final ClassPropertyImpl prop : props) {
names.add(prop.getName());
names.add(prop.getDescription());
names.add("");// default value
}
}
break;
}
}
xlogger.exit();
return names.toArray(new String[names.size()]);
} | java | @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 (final DeviceClassBuilder deviceClass : classList) {
if (deviceClass.getClassName().equalsIgnoreCase(className)) {
final List<DeviceImpl> devices = deviceClass.getDeviceImplList();
if (devices.size() > 0) {
final DeviceImpl dev = devices.get(0);
final List<ClassPropertyImpl> props = dev.getClassPropertyList();
for (final ClassPropertyImpl prop : props) {
names.add(prop.getName());
names.add(prop.getDescription());
names.add("");// default value
}
}
break;
}
}
xlogger.exit();
return names.toArray(new String[names.size()]);
} | [
"@",
"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",
"(",
"final",
"DeviceClassBuilder",
"deviceClass",
":",
"classList",
")",
"{",
"if",
"(",
"deviceClass",
".",
"getClassName",
"(",
")",
".",
"equalsIgnoreCase",
"(",
"className",
")",
")",
"{",
"final",
"List",
"<",
"DeviceImpl",
">",
"devices",
"=",
"deviceClass",
".",
"getDeviceImplList",
"(",
")",
";",
"if",
"(",
"devices",
".",
"size",
"(",
")",
">",
"0",
")",
"{",
"final",
"DeviceImpl",
"dev",
"=",
"devices",
".",
"get",
"(",
"0",
")",
";",
"final",
"List",
"<",
"ClassPropertyImpl",
">",
"props",
"=",
"dev",
".",
"getClassPropertyList",
"(",
")",
";",
"for",
"(",
"final",
"ClassPropertyImpl",
"prop",
":",
"props",
")",
"{",
"names",
".",
"add",
"(",
"prop",
".",
"getName",
"(",
")",
")",
";",
"names",
".",
"add",
"(",
"prop",
".",
"getDescription",
"(",
")",
")",
";",
"names",
".",
"add",
"(",
"\"\"",
")",
";",
"// default value",
"}",
"}",
"break",
";",
"}",
"}",
"xlogger",
".",
"exit",
"(",
")",
";",
"return",
"names",
".",
"toArray",
"(",
"new",
"String",
"[",
"names",
".",
"size",
"(",
")",
"]",
")",
";",
"}"
] | Get class properties
@param className
@return class properties
@throws DevFailed | [
"Get",
"class",
"properties"
] | 1ccc9dcb83e6de2359a9f1906d170571cacf1345 | https://github.com/tango-controls/JTango/blob/1ccc9dcb83e6de2359a9f1906d170571cacf1345/server/src/main/java/org/tango/server/admin/AdminDevice.java#L558-L579 |
140,365 | tango-controls/JTango | server/src/main/java/org/tango/server/admin/AdminDevice.java | AdminDevice.queryDevProp | @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 DeviceClassBuilder deviceClass : classList) {
if (deviceClass.getClassName().equalsIgnoreCase(className)) {
final List<DeviceImpl> devices = deviceClass.getDeviceImplList();
if (devices.size() > 0) {
final DeviceImpl dev = devices.get(0);
final List<DevicePropertyImpl> props = dev.getDevicePropertyList();
for (final DevicePropertyImpl prop : props) {
names.add(prop.getName());
names.add(prop.getDescription());
// default value
if (prop.getDefaultValue().length == 0) {
names.add("");
} else {
names.add(prop.getDefaultValue()[0]);
}
}
}
break;
}
}
xlogger.exit(names);
return names.toArray(new String[names.size()]);
} | java | @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 DeviceClassBuilder deviceClass : classList) {
if (deviceClass.getClassName().equalsIgnoreCase(className)) {
final List<DeviceImpl> devices = deviceClass.getDeviceImplList();
if (devices.size() > 0) {
final DeviceImpl dev = devices.get(0);
final List<DevicePropertyImpl> props = dev.getDevicePropertyList();
for (final DevicePropertyImpl prop : props) {
names.add(prop.getName());
names.add(prop.getDescription());
// default value
if (prop.getDefaultValue().length == 0) {
names.add("");
} else {
names.add(prop.getDefaultValue()[0]);
}
}
}
break;
}
}
xlogger.exit(names);
return names.toArray(new String[names.size()]);
} | [
"@",
"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",
"DeviceClassBuilder",
"deviceClass",
":",
"classList",
")",
"{",
"if",
"(",
"deviceClass",
".",
"getClassName",
"(",
")",
".",
"equalsIgnoreCase",
"(",
"className",
")",
")",
"{",
"final",
"List",
"<",
"DeviceImpl",
">",
"devices",
"=",
"deviceClass",
".",
"getDeviceImplList",
"(",
")",
";",
"if",
"(",
"devices",
".",
"size",
"(",
")",
">",
"0",
")",
"{",
"final",
"DeviceImpl",
"dev",
"=",
"devices",
".",
"get",
"(",
"0",
")",
";",
"final",
"List",
"<",
"DevicePropertyImpl",
">",
"props",
"=",
"dev",
".",
"getDevicePropertyList",
"(",
")",
";",
"for",
"(",
"final",
"DevicePropertyImpl",
"prop",
":",
"props",
")",
"{",
"names",
".",
"add",
"(",
"prop",
".",
"getName",
"(",
")",
")",
";",
"names",
".",
"add",
"(",
"prop",
".",
"getDescription",
"(",
")",
")",
";",
"// default value",
"if",
"(",
"prop",
".",
"getDefaultValue",
"(",
")",
".",
"length",
"==",
"0",
")",
"{",
"names",
".",
"add",
"(",
"\"\"",
")",
";",
"}",
"else",
"{",
"names",
".",
"add",
"(",
"prop",
".",
"getDefaultValue",
"(",
")",
"[",
"0",
"]",
")",
";",
"}",
"}",
"}",
"break",
";",
"}",
"}",
"xlogger",
".",
"exit",
"(",
"names",
")",
";",
"return",
"names",
".",
"toArray",
"(",
"new",
"String",
"[",
"names",
".",
"size",
"(",
")",
"]",
")",
";",
"}"
] | Get device properties
@param className
@return device properties and descriptions | [
"Get",
"device",
"properties"
] | 1ccc9dcb83e6de2359a9f1906d170571cacf1345 | https://github.com/tango-controls/JTango/blob/1ccc9dcb83e6de2359a9f1906d170571cacf1345/server/src/main/java/org/tango/server/admin/AdminDevice.java#L587-L613 |
140,366 | tango-controls/JTango | server/src/main/java/org/tango/server/admin/AdminDevice.java | AdminDevice.subcribeIDLInEventString | private DevVarLongStringArray subcribeIDLInEventString(final String eventTypeAndIDL, final String deviceName,
final String objName) throws DevFailed {
// event name like "idl5_archive" or "archive"
String event = eventTypeAndIDL;
int idlversion = EventManager.MINIMUM_IDL_VERSION;
if (eventTypeAndIDL.contains(EventManager.IDL_LATEST)) {
idlversion = DeviceImpl.SERVER_VERSION;
event = eventTypeAndIDL.substring(eventTypeAndIDL.indexOf("_") + 1, eventTypeAndIDL.length());
}
final EventType eventType = EventType.getEvent(event);
logger.debug("event subscription/confirmation for {}, attribute/pipe {} with type {} and IDL {}", new Object[]{
deviceName, objName, eventType, idlversion});
final Pair<PipeImpl, AttributeImpl> result = findSubscribers(eventType, deviceName, objName);
return subscribeEvent(eventType, deviceName, idlversion, result.getRight(), result.getLeft());
} | java | private DevVarLongStringArray subcribeIDLInEventString(final String eventTypeAndIDL, final String deviceName,
final String objName) throws DevFailed {
// event name like "idl5_archive" or "archive"
String event = eventTypeAndIDL;
int idlversion = EventManager.MINIMUM_IDL_VERSION;
if (eventTypeAndIDL.contains(EventManager.IDL_LATEST)) {
idlversion = DeviceImpl.SERVER_VERSION;
event = eventTypeAndIDL.substring(eventTypeAndIDL.indexOf("_") + 1, eventTypeAndIDL.length());
}
final EventType eventType = EventType.getEvent(event);
logger.debug("event subscription/confirmation for {}, attribute/pipe {} with type {} and IDL {}", new Object[]{
deviceName, objName, eventType, idlversion});
final Pair<PipeImpl, AttributeImpl> result = findSubscribers(eventType, deviceName, objName);
return subscribeEvent(eventType, deviceName, idlversion, result.getRight(), result.getLeft());
} | [
"private",
"DevVarLongStringArray",
"subcribeIDLInEventString",
"(",
"final",
"String",
"eventTypeAndIDL",
",",
"final",
"String",
"deviceName",
",",
"final",
"String",
"objName",
")",
"throws",
"DevFailed",
"{",
"// event name like \"idl5_archive\" or \"archive\"",
"String",
"event",
"=",
"eventTypeAndIDL",
";",
"int",
"idlversion",
"=",
"EventManager",
".",
"MINIMUM_IDL_VERSION",
";",
"if",
"(",
"eventTypeAndIDL",
".",
"contains",
"(",
"EventManager",
".",
"IDL_LATEST",
")",
")",
"{",
"idlversion",
"=",
"DeviceImpl",
".",
"SERVER_VERSION",
";",
"event",
"=",
"eventTypeAndIDL",
".",
"substring",
"(",
"eventTypeAndIDL",
".",
"indexOf",
"(",
"\"_\"",
")",
"+",
"1",
",",
"eventTypeAndIDL",
".",
"length",
"(",
")",
")",
";",
"}",
"final",
"EventType",
"eventType",
"=",
"EventType",
".",
"getEvent",
"(",
"event",
")",
";",
"logger",
".",
"debug",
"(",
"\"event subscription/confirmation for {}, attribute/pipe {} with type {} and IDL {}\"",
",",
"new",
"Object",
"[",
"]",
"{",
"deviceName",
",",
"objName",
",",
"eventType",
",",
"idlversion",
"}",
")",
";",
"final",
"Pair",
"<",
"PipeImpl",
",",
"AttributeImpl",
">",
"result",
"=",
"findSubscribers",
"(",
"eventType",
",",
"deviceName",
",",
"objName",
")",
";",
"return",
"subscribeEvent",
"(",
"eventType",
",",
"deviceName",
",",
"idlversion",
",",
"result",
".",
"getRight",
"(",
")",
",",
"result",
".",
"getLeft",
"(",
")",
")",
";",
"}"
] | Manage event subcription with event name like "idl5_archive" or "archive"
@param eventTypeAndIDL
@param deviceName
@param objName
@return
@throws DevFailed | [
"Manage",
"event",
"subcription",
"with",
"event",
"name",
"like",
"idl5_archive",
"or",
"archive"
] | 1ccc9dcb83e6de2359a9f1906d170571cacf1345 | https://github.com/tango-controls/JTango/blob/1ccc9dcb83e6de2359a9f1906d170571cacf1345/server/src/main/java/org/tango/server/admin/AdminDevice.java#L691-L705 |
140,367 | tango-controls/JTango | dao/src/main/java/fr/esrf/TangoDs/GetLoggingTargetCmd.java | GetLoggingTargetCmd.execute | 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() --> Wrong argument type");
Except.re_throw_exception(df,
"API_IncompatibleCmdArgumentType",
"Imcompatible command argument type, expected type is : DevVarStringArray",
"GetLoggingTargetCmd.execute");
}
Any out_any = insert(Logging.instance().get_logging_target(string));
Util.out4.println("Leaving GetLoggingTargetCmd.execute()");
return out_any;
} | java | 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() --> Wrong argument type");
Except.re_throw_exception(df,
"API_IncompatibleCmdArgumentType",
"Imcompatible command argument type, expected type is : DevVarStringArray",
"GetLoggingTargetCmd.execute");
}
Any out_any = insert(Logging.instance().get_logging_target(string));
Util.out4.println("Leaving GetLoggingTargetCmd.execute()");
return out_any;
} | [
"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() --> Wrong argument type\"",
")",
";",
"Except",
".",
"re_throw_exception",
"(",
"df",
",",
"\"API_IncompatibleCmdArgumentType\"",
",",
"\"Imcompatible command argument type, expected type is : DevVarStringArray\"",
",",
"\"GetLoggingTargetCmd.execute\"",
")",
";",
"}",
"Any",
"out_any",
"=",
"insert",
"(",
"Logging",
".",
"instance",
"(",
")",
".",
"get_logging_target",
"(",
"string",
")",
")",
";",
"Util",
".",
"out4",
".",
"println",
"(",
"\"Leaving GetLoggingTargetCmd.execute()\"",
")",
";",
"return",
"out_any",
";",
"}"
] | Executes the GetLoggingTargetCmd TANGO command | [
"Executes",
"the",
"GetLoggingTargetCmd",
"TANGO",
"command"
] | 1ccc9dcb83e6de2359a9f1906d170571cacf1345 | https://github.com/tango-controls/JTango/blob/1ccc9dcb83e6de2359a9f1906d170571cacf1345/dao/src/main/java/fr/esrf/TangoDs/GetLoggingTargetCmd.java#L55-L76 |
140,368 | tango-controls/JTango | server/src/main/java/org/tango/orb/ORBManager.java | ORBManager.init | public static synchronized void init(final boolean useDb, final String adminDeviceName) throws DevFailed {
// Modified properties fo ORB usage.
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");
// register interceptors
props.put("org.omg.PortableInterceptor.ORBInitializerClass.ForwardInit",
InterceptorInitializer.class.getCanonicalName());
// Set retry properties
props.put("jacorb.retries", "0");
props.put("jacorb.retry_interval", "100");
props.put("jacorb.codeset", true);
// props.put("jacorb.config.dir", "fr/esrf/TangoApi");
// Initial timeout for establishing a connection.
props.put("jacorb.connection.client.connect_timeout", "5000");
// Set the Largest transfert.
final String str = checkORBgiopMaxMsgSize();
props.put("jacorb.maxManagedBufSize", str);
// Set jacorb verbosity at minimum value
props.put("jacorb.config.log.verbosity", "0");
// only used for no db device
props.setProperty("jacorb.implname", SERVER_IMPL_NAME);
// System.setProperties(props);
// props.setProperty("jacorb.net.tcp_listener",
// ConnectionListener.class.getName());
// Initialize ORB
orb = ORB.init(new String[] {}, props);
try {
poa = POAHelper.narrow(orb.resolve_initial_references("RootPOA"));
// boot_manager =
// BootManagerHelper.narrow(orb.resolve_initial_references("BootManager"));
} catch (final InvalidName e) {
throw DevFailedUtils.newDevFailed(e);
} catch (final INITIALIZE e) {
// ignore, occurs when starting several times a server that failed
if (!useDb) {
throw DevFailedUtils.newDevFailed(e);
}
}
try {
if (!useDb) {
// If the database is not used, create a POA with the
// USER_ID policy
final org.omg.CORBA.Policy[] policies = new org.omg.CORBA.Policy[2];
policies[0] = poa.create_id_assignment_policy(IdAssignmentPolicyValue.USER_ID);
policies[1] = poa.create_lifespan_policy(LifespanPolicyValue.PERSISTENT);
final org.omg.PortableServer.POAManager manager = poa.the_POAManager();
poa = poa.create_POA(NODB_POA, manager, policies);
}
} catch (final org.omg.PortableServer.POAPackage.AdapterAlreadyExists e) {
throw DevFailedUtils.newDevFailed(e);
} catch (final org.omg.PortableServer.POAPackage.InvalidPolicy e) {
throw DevFailedUtils.newDevFailed(e);
}
final POAManager manager = poa.the_POAManager();
try {
manager.activate();
} catch (final org.omg.PortableServer.POAManagerPackage.AdapterInactive ex) {
throw DevFailedUtils.newDevFailed("API_CantActivatePOAManager", "The POA activate method throws an exception");
}
if (useDb) {
// Build device name and try to import it from database
final DeviceImportInfo importInfo = DatabaseFactory.getDatabase().importDevice(adminDeviceName);
if (importInfo.isExported()) {
LOGGER.debug("{} is set as exported in tango db - checking if it is already running", adminDeviceName);
// if is exported, try to connect to it
ORBManager.checkServerRunning(importInfo, adminDeviceName);
}
}
} | java | public static synchronized void init(final boolean useDb, final String adminDeviceName) throws DevFailed {
// Modified properties fo ORB usage.
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");
// register interceptors
props.put("org.omg.PortableInterceptor.ORBInitializerClass.ForwardInit",
InterceptorInitializer.class.getCanonicalName());
// Set retry properties
props.put("jacorb.retries", "0");
props.put("jacorb.retry_interval", "100");
props.put("jacorb.codeset", true);
// props.put("jacorb.config.dir", "fr/esrf/TangoApi");
// Initial timeout for establishing a connection.
props.put("jacorb.connection.client.connect_timeout", "5000");
// Set the Largest transfert.
final String str = checkORBgiopMaxMsgSize();
props.put("jacorb.maxManagedBufSize", str);
// Set jacorb verbosity at minimum value
props.put("jacorb.config.log.verbosity", "0");
// only used for no db device
props.setProperty("jacorb.implname", SERVER_IMPL_NAME);
// System.setProperties(props);
// props.setProperty("jacorb.net.tcp_listener",
// ConnectionListener.class.getName());
// Initialize ORB
orb = ORB.init(new String[] {}, props);
try {
poa = POAHelper.narrow(orb.resolve_initial_references("RootPOA"));
// boot_manager =
// BootManagerHelper.narrow(orb.resolve_initial_references("BootManager"));
} catch (final InvalidName e) {
throw DevFailedUtils.newDevFailed(e);
} catch (final INITIALIZE e) {
// ignore, occurs when starting several times a server that failed
if (!useDb) {
throw DevFailedUtils.newDevFailed(e);
}
}
try {
if (!useDb) {
// If the database is not used, create a POA with the
// USER_ID policy
final org.omg.CORBA.Policy[] policies = new org.omg.CORBA.Policy[2];
policies[0] = poa.create_id_assignment_policy(IdAssignmentPolicyValue.USER_ID);
policies[1] = poa.create_lifespan_policy(LifespanPolicyValue.PERSISTENT);
final org.omg.PortableServer.POAManager manager = poa.the_POAManager();
poa = poa.create_POA(NODB_POA, manager, policies);
}
} catch (final org.omg.PortableServer.POAPackage.AdapterAlreadyExists e) {
throw DevFailedUtils.newDevFailed(e);
} catch (final org.omg.PortableServer.POAPackage.InvalidPolicy e) {
throw DevFailedUtils.newDevFailed(e);
}
final POAManager manager = poa.the_POAManager();
try {
manager.activate();
} catch (final org.omg.PortableServer.POAManagerPackage.AdapterInactive ex) {
throw DevFailedUtils.newDevFailed("API_CantActivatePOAManager", "The POA activate method throws an exception");
}
if (useDb) {
// Build device name and try to import it from database
final DeviceImportInfo importInfo = DatabaseFactory.getDatabase().importDevice(adminDeviceName);
if (importInfo.isExported()) {
LOGGER.debug("{} is set as exported in tango db - checking if it is already running", adminDeviceName);
// if is exported, try to connect to it
ORBManager.checkServerRunning(importInfo, adminDeviceName);
}
}
} | [
"public",
"static",
"synchronized",
"void",
"init",
"(",
"final",
"boolean",
"useDb",
",",
"final",
"String",
"adminDeviceName",
")",
"throws",
"DevFailed",
"{",
"// Modified properties fo ORB usage.",
"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\"",
")",
";",
"// register interceptors",
"props",
".",
"put",
"(",
"\"org.omg.PortableInterceptor.ORBInitializerClass.ForwardInit\"",
",",
"InterceptorInitializer",
".",
"class",
".",
"getCanonicalName",
"(",
")",
")",
";",
"// Set retry properties",
"props",
".",
"put",
"(",
"\"jacorb.retries\"",
",",
"\"0\"",
")",
";",
"props",
".",
"put",
"(",
"\"jacorb.retry_interval\"",
",",
"\"100\"",
")",
";",
"props",
".",
"put",
"(",
"\"jacorb.codeset\"",
",",
"true",
")",
";",
"// props.put(\"jacorb.config.dir\", \"fr/esrf/TangoApi\");",
"// Initial timeout for establishing a connection.",
"props",
".",
"put",
"(",
"\"jacorb.connection.client.connect_timeout\"",
",",
"\"5000\"",
")",
";",
"// Set the Largest transfert.",
"final",
"String",
"str",
"=",
"checkORBgiopMaxMsgSize",
"(",
")",
";",
"props",
".",
"put",
"(",
"\"jacorb.maxManagedBufSize\"",
",",
"str",
")",
";",
"// Set jacorb verbosity at minimum value",
"props",
".",
"put",
"(",
"\"jacorb.config.log.verbosity\"",
",",
"\"0\"",
")",
";",
"// only used for no db device",
"props",
".",
"setProperty",
"(",
"\"jacorb.implname\"",
",",
"SERVER_IMPL_NAME",
")",
";",
"// System.setProperties(props);",
"// props.setProperty(\"jacorb.net.tcp_listener\",",
"// ConnectionListener.class.getName());",
"// Initialize ORB",
"orb",
"=",
"ORB",
".",
"init",
"(",
"new",
"String",
"[",
"]",
"{",
"}",
",",
"props",
")",
";",
"try",
"{",
"poa",
"=",
"POAHelper",
".",
"narrow",
"(",
"orb",
".",
"resolve_initial_references",
"(",
"\"RootPOA\"",
")",
")",
";",
"// boot_manager =",
"// BootManagerHelper.narrow(orb.resolve_initial_references(\"BootManager\"));",
"}",
"catch",
"(",
"final",
"InvalidName",
"e",
")",
"{",
"throw",
"DevFailedUtils",
".",
"newDevFailed",
"(",
"e",
")",
";",
"}",
"catch",
"(",
"final",
"INITIALIZE",
"e",
")",
"{",
"// ignore, occurs when starting several times a server that failed",
"if",
"(",
"!",
"useDb",
")",
"{",
"throw",
"DevFailedUtils",
".",
"newDevFailed",
"(",
"e",
")",
";",
"}",
"}",
"try",
"{",
"if",
"(",
"!",
"useDb",
")",
"{",
"// If the database is not used, create a POA with the",
"// USER_ID policy",
"final",
"org",
".",
"omg",
".",
"CORBA",
".",
"Policy",
"[",
"]",
"policies",
"=",
"new",
"org",
".",
"omg",
".",
"CORBA",
".",
"Policy",
"[",
"2",
"]",
";",
"policies",
"[",
"0",
"]",
"=",
"poa",
".",
"create_id_assignment_policy",
"(",
"IdAssignmentPolicyValue",
".",
"USER_ID",
")",
";",
"policies",
"[",
"1",
"]",
"=",
"poa",
".",
"create_lifespan_policy",
"(",
"LifespanPolicyValue",
".",
"PERSISTENT",
")",
";",
"final",
"org",
".",
"omg",
".",
"PortableServer",
".",
"POAManager",
"manager",
"=",
"poa",
".",
"the_POAManager",
"(",
")",
";",
"poa",
"=",
"poa",
".",
"create_POA",
"(",
"NODB_POA",
",",
"manager",
",",
"policies",
")",
";",
"}",
"}",
"catch",
"(",
"final",
"org",
".",
"omg",
".",
"PortableServer",
".",
"POAPackage",
".",
"AdapterAlreadyExists",
"e",
")",
"{",
"throw",
"DevFailedUtils",
".",
"newDevFailed",
"(",
"e",
")",
";",
"}",
"catch",
"(",
"final",
"org",
".",
"omg",
".",
"PortableServer",
".",
"POAPackage",
".",
"InvalidPolicy",
"e",
")",
"{",
"throw",
"DevFailedUtils",
".",
"newDevFailed",
"(",
"e",
")",
";",
"}",
"final",
"POAManager",
"manager",
"=",
"poa",
".",
"the_POAManager",
"(",
")",
";",
"try",
"{",
"manager",
".",
"activate",
"(",
")",
";",
"}",
"catch",
"(",
"final",
"org",
".",
"omg",
".",
"PortableServer",
".",
"POAManagerPackage",
".",
"AdapterInactive",
"ex",
")",
"{",
"throw",
"DevFailedUtils",
".",
"newDevFailed",
"(",
"\"API_CantActivatePOAManager\"",
",",
"\"The POA activate method throws an exception\"",
")",
";",
"}",
"if",
"(",
"useDb",
")",
"{",
"// Build device name and try to import it from database",
"final",
"DeviceImportInfo",
"importInfo",
"=",
"DatabaseFactory",
".",
"getDatabase",
"(",
")",
".",
"importDevice",
"(",
"adminDeviceName",
")",
";",
"if",
"(",
"importInfo",
".",
"isExported",
"(",
")",
")",
"{",
"LOGGER",
".",
"debug",
"(",
"\"{} is set as exported in tango db - checking if it is already running\"",
",",
"adminDeviceName",
")",
";",
"// if is exported, try to connect to it",
"ORBManager",
".",
"checkServerRunning",
"(",
"importInfo",
",",
"adminDeviceName",
")",
";",
"}",
"}",
"}"
] | Initialise the ORB
@param useDb
is using tango db
@param adminDeviceName
admin device name
@throws DevFailed | [
"Initialise",
"the",
"ORB"
] | 1ccc9dcb83e6de2359a9f1906d170571cacf1345 | https://github.com/tango-controls/JTango/blob/1ccc9dcb83e6de2359a9f1906d170571cacf1345/server/src/main/java/org/tango/orb/ORBManager.java#L84-L164 |
140,369 | tango-controls/JTango | server/src/main/java/org/tango/orb/ORBManager.java | ORBManager.checkServerRunning | 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 IDL5
try {
devIDL5 = narrowIDL5(importInfo);
} catch (final BAD_PARAM e) {
// try IDL4
try {
devIDL4 = narrowIDL4(importInfo);
} catch (final BAD_PARAM e4) {
// maybe another IDL is currently running
// try IDL3
try {
devIDL3 = narrowIDL3(importInfo);
} catch (final BAD_PARAM e1) {
// maybe another IDL is currently running
// try IDL2
try {
devIDL2 = narrowIDL2(importInfo);
} catch (final BAD_PARAM e2) {
// maybe another IDL is currently running
// try IDL1
try {
devIDL1 = narrowIDL1(importInfo);
} catch (final BAD_PARAM e3) {
// may not occur, unknown CORBA server
throw DevFailedUtils.newDevFailed(e);
}
}
}
}
}
if (devIDL5 == null && devIDL4 == null && devIDL3 == null && devIDL2 == null && devIDL1 == null) {
LOGGER.debug("out, device is not running");
} else {
checkDeviceName(toBeImported, devIDL5, devIDL4, devIDL3, devIDL2, devIDL1);
}
} catch (final org.omg.CORBA.TIMEOUT e) {
// Receive a Timeout exception ---> It is not running !!!!
LOGGER.debug("out on TIMEOUT");
} catch (final BAD_OPERATION e) {
// System.err.println("Can't pack/unpack data sent to/from database in/to Any object");
throw DevFailedUtils.newDevFailed(e);
} catch (final TRANSIENT e) {
LOGGER.debug("out on TRANSIENT, device is not running");
} catch (final OBJECT_NOT_EXIST e) {
LOGGER.debug("out on OBJECT_NOT_EXIST, device is not running");
} catch (final COMM_FAILURE e) {
LOGGER.debug("out on COMM_FAILURE,, device is not running");
} catch (final BAD_INV_ORDER e) {
LOGGER.debug("out on BAD_INV_ORDER,, device is not running");
}
XLOGGER.exit();
} | java | 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 IDL5
try {
devIDL5 = narrowIDL5(importInfo);
} catch (final BAD_PARAM e) {
// try IDL4
try {
devIDL4 = narrowIDL4(importInfo);
} catch (final BAD_PARAM e4) {
// maybe another IDL is currently running
// try IDL3
try {
devIDL3 = narrowIDL3(importInfo);
} catch (final BAD_PARAM e1) {
// maybe another IDL is currently running
// try IDL2
try {
devIDL2 = narrowIDL2(importInfo);
} catch (final BAD_PARAM e2) {
// maybe another IDL is currently running
// try IDL1
try {
devIDL1 = narrowIDL1(importInfo);
} catch (final BAD_PARAM e3) {
// may not occur, unknown CORBA server
throw DevFailedUtils.newDevFailed(e);
}
}
}
}
}
if (devIDL5 == null && devIDL4 == null && devIDL3 == null && devIDL2 == null && devIDL1 == null) {
LOGGER.debug("out, device is not running");
} else {
checkDeviceName(toBeImported, devIDL5, devIDL4, devIDL3, devIDL2, devIDL1);
}
} catch (final org.omg.CORBA.TIMEOUT e) {
// Receive a Timeout exception ---> It is not running !!!!
LOGGER.debug("out on TIMEOUT");
} catch (final BAD_OPERATION e) {
// System.err.println("Can't pack/unpack data sent to/from database in/to Any object");
throw DevFailedUtils.newDevFailed(e);
} catch (final TRANSIENT e) {
LOGGER.debug("out on TRANSIENT, device is not running");
} catch (final OBJECT_NOT_EXIST e) {
LOGGER.debug("out on OBJECT_NOT_EXIST, device is not running");
} catch (final COMM_FAILURE e) {
LOGGER.debug("out on COMM_FAILURE,, device is not running");
} catch (final BAD_INV_ORDER e) {
LOGGER.debug("out on BAD_INV_ORDER,, device is not running");
}
XLOGGER.exit();
} | [
"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 IDL5",
"try",
"{",
"devIDL5",
"=",
"narrowIDL5",
"(",
"importInfo",
")",
";",
"}",
"catch",
"(",
"final",
"BAD_PARAM",
"e",
")",
"{",
"// try IDL4",
"try",
"{",
"devIDL4",
"=",
"narrowIDL4",
"(",
"importInfo",
")",
";",
"}",
"catch",
"(",
"final",
"BAD_PARAM",
"e4",
")",
"{",
"// maybe another IDL is currently running",
"// try IDL3",
"try",
"{",
"devIDL3",
"=",
"narrowIDL3",
"(",
"importInfo",
")",
";",
"}",
"catch",
"(",
"final",
"BAD_PARAM",
"e1",
")",
"{",
"// maybe another IDL is currently running",
"// try IDL2",
"try",
"{",
"devIDL2",
"=",
"narrowIDL2",
"(",
"importInfo",
")",
";",
"}",
"catch",
"(",
"final",
"BAD_PARAM",
"e2",
")",
"{",
"// maybe another IDL is currently running",
"// try IDL1",
"try",
"{",
"devIDL1",
"=",
"narrowIDL1",
"(",
"importInfo",
")",
";",
"}",
"catch",
"(",
"final",
"BAD_PARAM",
"e3",
")",
"{",
"// may not occur, unknown CORBA server",
"throw",
"DevFailedUtils",
".",
"newDevFailed",
"(",
"e",
")",
";",
"}",
"}",
"}",
"}",
"}",
"if",
"(",
"devIDL5",
"==",
"null",
"&&",
"devIDL4",
"==",
"null",
"&&",
"devIDL3",
"==",
"null",
"&&",
"devIDL2",
"==",
"null",
"&&",
"devIDL1",
"==",
"null",
")",
"{",
"LOGGER",
".",
"debug",
"(",
"\"out, device is not running\"",
")",
";",
"}",
"else",
"{",
"checkDeviceName",
"(",
"toBeImported",
",",
"devIDL5",
",",
"devIDL4",
",",
"devIDL3",
",",
"devIDL2",
",",
"devIDL1",
")",
";",
"}",
"}",
"catch",
"(",
"final",
"org",
".",
"omg",
".",
"CORBA",
".",
"TIMEOUT",
"e",
")",
"{",
"// Receive a Timeout exception ---> It is not running !!!!",
"LOGGER",
".",
"debug",
"(",
"\"out on TIMEOUT\"",
")",
";",
"}",
"catch",
"(",
"final",
"BAD_OPERATION",
"e",
")",
"{",
"// System.err.println(\"Can't pack/unpack data sent to/from database in/to Any object\");",
"throw",
"DevFailedUtils",
".",
"newDevFailed",
"(",
"e",
")",
";",
"}",
"catch",
"(",
"final",
"TRANSIENT",
"e",
")",
"{",
"LOGGER",
".",
"debug",
"(",
"\"out on TRANSIENT, device is not running\"",
")",
";",
"}",
"catch",
"(",
"final",
"OBJECT_NOT_EXIST",
"e",
")",
"{",
"LOGGER",
".",
"debug",
"(",
"\"out on OBJECT_NOT_EXIST, device is not running\"",
")",
";",
"}",
"catch",
"(",
"final",
"COMM_FAILURE",
"e",
")",
"{",
"LOGGER",
".",
"debug",
"(",
"\"out on COMM_FAILURE,, device is not running\"",
")",
";",
"}",
"catch",
"(",
"final",
"BAD_INV_ORDER",
"e",
")",
"{",
"LOGGER",
".",
"debug",
"(",
"\"out on BAD_INV_ORDER,, device is not running\"",
")",
";",
"}",
"XLOGGER",
".",
"exit",
"(",
")",
";",
"}"
] | Check the server is already running
@param importInfo
@param toBeImported
@throws DevFailed | [
"Check",
"the",
"server",
"is",
"already",
"running"
] | 1ccc9dcb83e6de2359a9f1906d170571cacf1345 | https://github.com/tango-controls/JTango/blob/1ccc9dcb83e6de2359a9f1906d170571cacf1345/server/src/main/java/org/tango/orb/ORBManager.java#L183-L244 |
140,370 | tango-controls/JTango | server/src/main/java/org/tango/orb/ORBManager.java | ORBManager.startDetached | public static void startDetached() {
orbStart = Executors.newSingleThreadExecutor(new ThreadFactory() {
@Override
public Thread newThread(final Runnable r) {
return new Thread(r, "ORB run");
}
});
orbStart.submit(new StartTask());
LOGGER.debug("ORB started");
} | java | public static void startDetached() {
orbStart = Executors.newSingleThreadExecutor(new ThreadFactory() {
@Override
public Thread newThread(final Runnable r) {
return new Thread(r, "ORB run");
}
});
orbStart.submit(new StartTask());
LOGGER.debug("ORB started");
} | [
"public",
"static",
"void",
"startDetached",
"(",
")",
"{",
"orbStart",
"=",
"Executors",
".",
"newSingleThreadExecutor",
"(",
"new",
"ThreadFactory",
"(",
")",
"{",
"@",
"Override",
"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. | [
"Start",
"the",
"ORB",
".",
"non",
"blocking",
"."
] | 1ccc9dcb83e6de2359a9f1906d170571cacf1345 | https://github.com/tango-controls/JTango/blob/1ccc9dcb83e6de2359a9f1906d170571cacf1345/server/src/main/java/org/tango/orb/ORBManager.java#L341-L350 |
140,371 | tango-controls/JTango | server/src/main/java/org/tango/orb/ORBManager.java | ORBManager.checkORBgiopMaxMsgSize | private static String checkORBgiopMaxMsgSize() {
/*
* JacORB definition (see jacorb.properties file):
*
* This is NOT the maximum buffer size that can be used, but just the
* largest size of buffers that will be kept and managed. This value
* will be added to an internal constant of 5, so the real value in
* bytes is 2**(5+maxManagedBufSize-1). You only need to increase this
* value if you are dealing with LOTS of LARGE data structures. You may
* decrease it to make the buffer manager release large buffers
* immediately rather than keeping them for later reuse.
*/
String str = "20"; // Set to 16 Mbytes
// Check if environment ask for bigger size.
final String tmp = System.getProperty("ORBgiopMaxMsgSize");
if (tmp != null && checkBufferSize(tmp) != null) {
str = tmp;
}
return str;
} | java | private static String checkORBgiopMaxMsgSize() {
/*
* JacORB definition (see jacorb.properties file):
*
* This is NOT the maximum buffer size that can be used, but just the
* largest size of buffers that will be kept and managed. This value
* will be added to an internal constant of 5, so the real value in
* bytes is 2**(5+maxManagedBufSize-1). You only need to increase this
* value if you are dealing with LOTS of LARGE data structures. You may
* decrease it to make the buffer manager release large buffers
* immediately rather than keeping them for later reuse.
*/
String str = "20"; // Set to 16 Mbytes
// Check if environment ask for bigger size.
final String tmp = System.getProperty("ORBgiopMaxMsgSize");
if (tmp != null && checkBufferSize(tmp) != null) {
str = tmp;
}
return str;
} | [
"private",
"static",
"String",
"checkORBgiopMaxMsgSize",
"(",
")",
"{",
"/*\n * JacORB definition (see jacorb.properties file):\n *\n * This is NOT the maximum buffer size that can be used, but just the\n * largest size of buffers that will be kept and managed. This value\n * will be added to an internal constant of 5, so the real value in\n * bytes is 2**(5+maxManagedBufSize-1). You only need to increase this\n * value if you are dealing with LOTS of LARGE data structures. You may\n * decrease it to make the buffer manager release large buffers\n * immediately rather than keeping them for later reuse.\n */",
"String",
"str",
"=",
"\"20\"",
";",
"// Set to 16 Mbytes",
"// Check if environment ask for bigger size.",
"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. | [
"Check",
"if",
"the",
"checkORBgiopMaxMsgSize",
"has",
"been",
"set",
".",
"This",
"environment",
"variable",
"should",
"be",
"set",
"in",
"Mega",
"bytes",
"."
] | 1ccc9dcb83e6de2359a9f1906d170571cacf1345 | https://github.com/tango-controls/JTango/blob/1ccc9dcb83e6de2359a9f1906d170571cacf1345/server/src/main/java/org/tango/orb/ORBManager.java#L364-L384 |
140,372 | tango-controls/JTango | server/src/main/java/org/tango/orb/ORBManager.java | ORBManager.shutdown | public static void shutdown() {
if (orbStart != null) {
orbStart.shutdown();
}
if (orb != null) {
orb.shutdown(true);
LOGGER.debug("ORB shutdown");
}
} | java | public static void shutdown() {
if (orbStart != null) {
orbStart.shutdown();
}
if (orb != null) {
orb.shutdown(true);
LOGGER.debug("ORB shutdown");
}
} | [
"public",
"static",
"void",
"shutdown",
"(",
")",
"{",
"if",
"(",
"orbStart",
"!=",
"null",
")",
"{",
"orbStart",
".",
"shutdown",
"(",
")",
";",
"}",
"if",
"(",
"orb",
"!=",
"null",
")",
"{",
"orb",
".",
"shutdown",
"(",
"true",
")",
";",
"LOGGER",
".",
"debug",
"(",
"\"ORB shutdown\"",
")",
";",
"}",
"}"
] | Shutdown the ORB | [
"Shutdown",
"the",
"ORB"
] | 1ccc9dcb83e6de2359a9f1906d170571cacf1345 | https://github.com/tango-controls/JTango/blob/1ccc9dcb83e6de2359a9f1906d170571cacf1345/server/src/main/java/org/tango/orb/ORBManager.java#L444-L452 |
140,373 | tango-controls/JTango | server/src/main/java/org/tango/server/StateMachineBehavior.java | StateMachineBehavior.isAllowed | public boolean isAllowed(final DeviceState state) {
boolean isAllowed = true;
if (deniedStates.contains(state)) {
isAllowed = false;
}
return isAllowed;
} | java | public boolean isAllowed(final DeviceState state) {
boolean isAllowed = true;
if (deniedStates.contains(state)) {
isAllowed = false;
}
return isAllowed;
} | [
"public",
"boolean",
"isAllowed",
"(",
"final",
"DeviceState",
"state",
")",
"{",
"boolean",
"isAllowed",
"=",
"true",
";",
"if",
"(",
"deniedStates",
".",
"contains",
"(",
"state",
")",
")",
"{",
"isAllowed",
"=",
"false",
";",
"}",
"return",
"isAllowed",
";",
"}"
] | Check if a state is allowed
@param state
@return true if allowed | [
"Check",
"if",
"a",
"state",
"is",
"allowed"
] | 1ccc9dcb83e6de2359a9f1906d170571cacf1345 | https://github.com/tango-controls/JTango/blob/1ccc9dcb83e6de2359a9f1906d170571cacf1345/server/src/main/java/org/tango/server/StateMachineBehavior.java#L59-L65 |
140,374 | tango-controls/JTango | server/src/main/java/org/tango/server/build/StatusBuilder.java | StatusBuilder.build | 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 + stateName.substring(0, 1).toUpperCase(Locale.ENGLISH)
+ stateName.substring(1);
try {
getter = clazz.getMethod(getterName);
} catch (final NoSuchMethodException e) {
throw DevFailedUtils.newDevFailed(e);
}
if (getter.getParameterTypes().length != 0) {
throw DevFailedUtils.newDevFailed(DevFailedUtils.TANGO_BUILD_FAILED, getter + " must not have a parameter");
}
logger.debug("Has an status : {}", field.getName());
if (getter.getReturnType() != String.class) {
throw DevFailedUtils.newDevFailed(DevFailedUtils.TANGO_BUILD_FAILED, getter + " must have a return type of "
+ String.class);
}
Method setter;
final String setterName = BuilderUtils.SET + stateName.substring(0, 1).toUpperCase(Locale.ENGLISH)
+ stateName.substring(1);
try {
setter = clazz.getMethod(setterName, String.class);
} catch (final NoSuchMethodException e) {
throw DevFailedUtils.newDevFailed(e);
}
device.setStatusImpl(new StatusImpl(businessObject, getter, setter));
final Status annot = field.getAnnotation(Status.class);
if (annot.isPolled()) {
device.addAttributePolling(DeviceImpl.STATUS_NAME, annot.pollingPeriod());
}
xlogger.exit();
} | java | 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 + stateName.substring(0, 1).toUpperCase(Locale.ENGLISH)
+ stateName.substring(1);
try {
getter = clazz.getMethod(getterName);
} catch (final NoSuchMethodException e) {
throw DevFailedUtils.newDevFailed(e);
}
if (getter.getParameterTypes().length != 0) {
throw DevFailedUtils.newDevFailed(DevFailedUtils.TANGO_BUILD_FAILED, getter + " must not have a parameter");
}
logger.debug("Has an status : {}", field.getName());
if (getter.getReturnType() != String.class) {
throw DevFailedUtils.newDevFailed(DevFailedUtils.TANGO_BUILD_FAILED, getter + " must have a return type of "
+ String.class);
}
Method setter;
final String setterName = BuilderUtils.SET + stateName.substring(0, 1).toUpperCase(Locale.ENGLISH)
+ stateName.substring(1);
try {
setter = clazz.getMethod(setterName, String.class);
} catch (final NoSuchMethodException e) {
throw DevFailedUtils.newDevFailed(e);
}
device.setStatusImpl(new StatusImpl(businessObject, getter, setter));
final Status annot = field.getAnnotation(Status.class);
if (annot.isPolled()) {
device.addAttributePolling(DeviceImpl.STATUS_NAME, annot.pollingPeriod());
}
xlogger.exit();
} | [
"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",
"+",
"stateName",
".",
"substring",
"(",
"0",
",",
"1",
")",
".",
"toUpperCase",
"(",
"Locale",
".",
"ENGLISH",
")",
"+",
"stateName",
".",
"substring",
"(",
"1",
")",
";",
"try",
"{",
"getter",
"=",
"clazz",
".",
"getMethod",
"(",
"getterName",
")",
";",
"}",
"catch",
"(",
"final",
"NoSuchMethodException",
"e",
")",
"{",
"throw",
"DevFailedUtils",
".",
"newDevFailed",
"(",
"e",
")",
";",
"}",
"if",
"(",
"getter",
".",
"getParameterTypes",
"(",
")",
".",
"length",
"!=",
"0",
")",
"{",
"throw",
"DevFailedUtils",
".",
"newDevFailed",
"(",
"DevFailedUtils",
".",
"TANGO_BUILD_FAILED",
",",
"getter",
"+",
"\" must not have a parameter\"",
")",
";",
"}",
"logger",
".",
"debug",
"(",
"\"Has an status : {}\"",
",",
"field",
".",
"getName",
"(",
")",
")",
";",
"if",
"(",
"getter",
".",
"getReturnType",
"(",
")",
"!=",
"String",
".",
"class",
")",
"{",
"throw",
"DevFailedUtils",
".",
"newDevFailed",
"(",
"DevFailedUtils",
".",
"TANGO_BUILD_FAILED",
",",
"getter",
"+",
"\" must have a return type of \"",
"+",
"String",
".",
"class",
")",
";",
"}",
"Method",
"setter",
";",
"final",
"String",
"setterName",
"=",
"BuilderUtils",
".",
"SET",
"+",
"stateName",
".",
"substring",
"(",
"0",
",",
"1",
")",
".",
"toUpperCase",
"(",
"Locale",
".",
"ENGLISH",
")",
"+",
"stateName",
".",
"substring",
"(",
"1",
")",
";",
"try",
"{",
"setter",
"=",
"clazz",
".",
"getMethod",
"(",
"setterName",
",",
"String",
".",
"class",
")",
";",
"}",
"catch",
"(",
"final",
"NoSuchMethodException",
"e",
")",
"{",
"throw",
"DevFailedUtils",
".",
"newDevFailed",
"(",
"e",
")",
";",
"}",
"device",
".",
"setStatusImpl",
"(",
"new",
"StatusImpl",
"(",
"businessObject",
",",
"getter",
",",
"setter",
")",
")",
";",
"final",
"Status",
"annot",
"=",
"field",
".",
"getAnnotation",
"(",
"Status",
".",
"class",
")",
";",
"if",
"(",
"annot",
".",
"isPolled",
"(",
")",
")",
"{",
"device",
".",
"addAttributePolling",
"(",
"DeviceImpl",
".",
"STATUS_NAME",
",",
"annot",
".",
"pollingPeriod",
"(",
")",
")",
";",
"}",
"xlogger",
".",
"exit",
"(",
")",
";",
"}"
] | Create a status
@param clazz
@param field
@param device
@param businessObject
@throws DevFailed | [
"Create",
"a",
"status"
] | 1ccc9dcb83e6de2359a9f1906d170571cacf1345 | https://github.com/tango-controls/JTango/blob/1ccc9dcb83e6de2359a9f1906d170571cacf1345/server/src/main/java/org/tango/server/build/StatusBuilder.java#L61-L97 |
140,375 | tango-controls/JTango | client/src/main/java/fr/soleil/tango/util/WaitStateUtilities.java | WaitStateUtilities.waitForState | public static void waitForState(final DeviceProxy proxy, final DevState waitState, final long timeout)
throws DevFailed, TimeoutException {
waitForState(proxy, waitState, timeout, 300);
} | java | public static void waitForState(final DeviceProxy proxy, final DevState waitState, final long timeout)
throws DevFailed, TimeoutException {
waitForState(proxy, waitState, timeout, 300);
} | [
"public",
"static",
"void",
"waitForState",
"(",
"final",
"DeviceProxy",
"proxy",
",",
"final",
"DevState",
"waitState",
",",
"final",
"long",
"timeout",
")",
"throws",
"DevFailed",
",",
"TimeoutException",
"{",
"waitForState",
"(",
"proxy",
",",
"waitState",
",",
"timeout",
",",
"300",
")",
";",
"}"
] | Wait for waitState
@param proxy
the proxy on which to monitor the state
@param waitState
the state to wait
@param timeout
a timeout in ms
@throws DevFailed
@throws TimeoutException | [
"Wait",
"for",
"waitState"
] | 1ccc9dcb83e6de2359a9f1906d170571cacf1345 | https://github.com/tango-controls/JTango/blob/1ccc9dcb83e6de2359a9f1906d170571cacf1345/client/src/main/java/fr/soleil/tango/util/WaitStateUtilities.java#L81-L84 |
140,376 | tango-controls/JTango | client/src/main/java/fr/soleil/tango/util/WaitStateUtilities.java | WaitStateUtilities.failIfWrongStateAfterWhileState | 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(deviceProxy.state())) {
throw DevFailedUtils.newDevFailed("State not reach", "fail to reach state "
+ TangoConst.Tango_DevStateName[expected.value()] + " after wait "
+ TangoConst.Tango_DevStateName[waitState.value()]);
}
} | java | 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(deviceProxy.state())) {
throw DevFailedUtils.newDevFailed("State not reach", "fail to reach state "
+ TangoConst.Tango_DevStateName[expected.value()] + " after wait "
+ TangoConst.Tango_DevStateName[waitState.value()]);
}
} | [
"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",
"(",
"deviceProxy",
".",
"state",
"(",
")",
")",
")",
"{",
"throw",
"DevFailedUtils",
".",
"newDevFailed",
"(",
"\"State not reach\"",
",",
"\"fail to reach state \"",
"+",
"TangoConst",
".",
"Tango_DevStateName",
"[",
"expected",
".",
"value",
"(",
")",
"]",
"+",
"\" after wait \"",
"+",
"TangoConst",
".",
"Tango_DevStateName",
"[",
"waitState",
".",
"value",
"(",
")",
"]",
")",
";",
"}",
"}"
] | Wait while waitState does not change, and check the final finale
@param deviceProxy
the proxy on which to monitor the state
@param expected
the final expected state. Throw DevFailed the final state f is not the expected one
@param waitState
the state to wait
@param timeout
a timeout in ms
@param polling
the polling period in ms
@throws DevFailed
@throws TimeoutException | [
"Wait",
"while",
"waitState",
"does",
"not",
"change",
"and",
"check",
"the",
"final",
"finale"
] | 1ccc9dcb83e6de2359a9f1906d170571cacf1345 | https://github.com/tango-controls/JTango/blob/1ccc9dcb83e6de2359a9f1906d170571cacf1345/client/src/main/java/fr/soleil/tango/util/WaitStateUtilities.java#L134-L142 |
140,377 | tango-controls/JTango | client/src/main/java/fr/soleil/tango/util/TangoUtil.java | TangoUtil.getfullAttributeNameForAttribute | 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.length == 1) {
result = db.get_attribute_from_alias(fields[0]);
} else if (fields.length == 2) {
result = db.get_device_from_alias(fields[0]) + "/" + fields[1];
} else {
result = attributeName;
}
return result;
} | java | 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.length == 1) {
result = db.get_attribute_from_alias(fields[0]);
} else if (fields.length == 2) {
result = db.get_device_from_alias(fields[0]) + "/" + fields[1];
} else {
result = attributeName;
}
return result;
} | [
"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",
".",
"length",
"==",
"1",
")",
"{",
"result",
"=",
"db",
".",
"get_attribute_from_alias",
"(",
"fields",
"[",
"0",
"]",
")",
";",
"}",
"else",
"if",
"(",
"fields",
".",
"length",
"==",
"2",
")",
"{",
"result",
"=",
"db",
".",
"get_device_from_alias",
"(",
"fields",
"[",
"0",
"]",
")",
"+",
"\"/\"",
"+",
"fields",
"[",
"1",
"]",
";",
"}",
"else",
"{",
"result",
"=",
"attributeName",
";",
"}",
"return",
"result",
";",
"}"
] | Get the full attribute name
@param attributeName
@return
@throws DevFailed | [
"Get",
"the",
"full",
"attribute",
"name"
] | 1ccc9dcb83e6de2359a9f1906d170571cacf1345 | https://github.com/tango-controls/JTango/blob/1ccc9dcb83e6de2359a9f1906d170571cacf1345/client/src/main/java/fr/soleil/tango/util/TangoUtil.java#L102-L116 |
140,378 | tango-controls/JTango | client/src/main/java/fr/soleil/tango/util/TangoUtil.java | TangoUtil.getDevicesForPattern | public static String[] getDevicesForPattern(final String deviceNamePattern) throws DevFailed {
String[] devices;
// is p a device name or a device name pattern ?
if (!deviceNamePattern.contains("*")) {
// p is a pure device name
devices = new String[1];
devices[0] = TangoUtil.getfullNameForDevice(deviceNamePattern);
} else {
// ask the db the list of device matching pattern p
final Database db = ApiUtil.get_db_obj();
devices = db.get_device_exported(deviceNamePattern);
}
return devices;
} | java | public static String[] getDevicesForPattern(final String deviceNamePattern) throws DevFailed {
String[] devices;
// is p a device name or a device name pattern ?
if (!deviceNamePattern.contains("*")) {
// p is a pure device name
devices = new String[1];
devices[0] = TangoUtil.getfullNameForDevice(deviceNamePattern);
} else {
// ask the db the list of device matching pattern p
final Database db = ApiUtil.get_db_obj();
devices = db.get_device_exported(deviceNamePattern);
}
return devices;
} | [
"public",
"static",
"String",
"[",
"]",
"getDevicesForPattern",
"(",
"final",
"String",
"deviceNamePattern",
")",
"throws",
"DevFailed",
"{",
"String",
"[",
"]",
"devices",
";",
"// is p a device name or a device name pattern ?",
"if",
"(",
"!",
"deviceNamePattern",
".",
"contains",
"(",
"\"*\"",
")",
")",
"{",
"// p is a pure device name",
"devices",
"=",
"new",
"String",
"[",
"1",
"]",
";",
"devices",
"[",
"0",
"]",
"=",
"TangoUtil",
".",
"getfullNameForDevice",
"(",
"deviceNamePattern",
")",
";",
"}",
"else",
"{",
"// ask the db the list of device matching pattern p",
"final",
"Database",
"db",
"=",
"ApiUtil",
".",
"get_db_obj",
"(",
")",
";",
"devices",
"=",
"db",
".",
"get_device_exported",
"(",
"deviceNamePattern",
")",
";",
"}",
"return",
"devices",
";",
"}"
] | Get the list of device names which matches the pattern p
@param deviceNamePattern
The pattern. The wild char is *
@return A list of device names
@throws DevFailed | [
"Get",
"the",
"list",
"of",
"device",
"names",
"which",
"matches",
"the",
"pattern",
"p"
] | 1ccc9dcb83e6de2359a9f1906d170571cacf1345 | https://github.com/tango-controls/JTango/blob/1ccc9dcb83e6de2359a9f1906d170571cacf1345/client/src/main/java/fr/soleil/tango/util/TangoUtil.java#L154-L167 |
140,379 | tango-controls/JTango | client/src/main/java/fr/soleil/tango/util/TangoUtil.java | TangoUtil.getAttributeName | public static String getAttributeName(final String fullname) throws DevFailed {
final String s = TangoUtil.getfullAttributeNameForAttribute(fullname);
return s.substring(s.lastIndexOf('/') + 1);
} | java | public static String getAttributeName(final String fullname) throws DevFailed {
final String s = TangoUtil.getfullAttributeNameForAttribute(fullname);
return s.substring(s.lastIndexOf('/') + 1);
} | [
"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
@param fullname
@return
@throws DevFailed | [
"Return",
"the",
"attribute",
"name",
"part",
"without",
"device",
"name",
"It",
"is",
"able",
"to",
"resolve",
"attribute",
"alias",
"before"
] | 1ccc9dcb83e6de2359a9f1906d170571cacf1345 | https://github.com/tango-controls/JTango/blob/1ccc9dcb83e6de2359a9f1906d170571cacf1345/client/src/main/java/fr/soleil/tango/util/TangoUtil.java#L176-L179 |
140,380 | tango-controls/JTango | common/src/main/java/fr/esrf/TangoApi/Group/GroupElement.java | GroupElement.name_matches | protected boolean name_matches(String pattern) {
pattern = pattern.toLowerCase().replaceAll("[*]{1}", ".*?");
return name.toLowerCase().matches(pattern) || get_fully_qualified_name().toLowerCase().matches(pattern);
} | java | protected boolean name_matches(String pattern) {
pattern = pattern.toLowerCase().replaceAll("[*]{1}", ".*?");
return name.toLowerCase().matches(pattern) || get_fully_qualified_name().toLowerCase().matches(pattern);
} | [
"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 | [
"Returns",
"true",
"if",
"name",
"matches",
"pattern"
] | 1ccc9dcb83e6de2359a9f1906d170571cacf1345 | https://github.com/tango-controls/JTango/blob/1ccc9dcb83e6de2359a9f1906d170571cacf1345/common/src/main/java/fr/esrf/TangoApi/Group/GroupElement.java#L159-L162 |
140,381 | tango-controls/JTango | server/src/main/java/org/tango/orb/InterceptorInitializer.java | InterceptorInitializer.post_init | 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);
}
} | java | 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);
}
} | [
"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. | [
"This",
"method",
"resolves",
"the",
"NameService",
"and",
"registers",
"the",
"interceptor",
"."
] | 1ccc9dcb83e6de2359a9f1906d170571cacf1345 | https://github.com/tango-controls/JTango/blob/1ccc9dcb83e6de2359a9f1906d170571cacf1345/server/src/main/java/org/tango/orb/InterceptorInitializer.java#L52-L58 |
140,382 | tango-controls/JTango | common/src/main/java/org/tango/utils/ArrayUtils.java | ArrayUtils.toPrimitiveArray | 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);
} | java | 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);
} | [
"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
@param array
the array to convert
@return The array of primitives | [
"Convert",
"an",
"array",
"of",
"Objects",
"to",
"primitives",
"if",
"possible",
".",
"Return",
"input",
"otherwise"
] | 1ccc9dcb83e6de2359a9f1906d170571cacf1345 | https://github.com/tango-controls/JTango/blob/1ccc9dcb83e6de2359a9f1906d170571cacf1345/common/src/main/java/org/tango/utils/ArrayUtils.java#L45-L51 |
140,383 | tango-controls/JTango | common/src/main/java/org/tango/utils/ArrayUtils.java | ArrayUtils.toObjectArray | 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);
} | java | 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);
} | [
"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
@param array
the array to convert
@return The array of Objects | [
"Convert",
"an",
"array",
"of",
"primitives",
"to",
"Objects",
"if",
"possible",
".",
"Return",
"input",
"otherwise"
] | 1ccc9dcb83e6de2359a9f1906d170571cacf1345 | https://github.com/tango-controls/JTango/blob/1ccc9dcb83e6de2359a9f1906d170571cacf1345/common/src/main/java/org/tango/utils/ArrayUtils.java#L60-L66 |
140,384 | tango-controls/JTango | common/src/main/java/org/tango/utils/ArrayUtils.java | ArrayUtils.toStringArray | 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;
} | java | 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;
} | [
"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
@param array
@return | [
"Convert",
"an",
"array",
"of",
"any",
"type",
"to",
"an",
"array",
"of",
"strings"
] | 1ccc9dcb83e6de2359a9f1906d170571cacf1345 | https://github.com/tango-controls/JTango/blob/1ccc9dcb83e6de2359a9f1906d170571cacf1345/common/src/main/java/org/tango/utils/ArrayUtils.java#L96-L103 |
140,385 | tango-controls/JTango | common/src/main/java/org/tango/utils/ArrayUtils.java | ArrayUtils.addAll | 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 (array2 == null) {
if (array1.getClass().isArray()) {
joinedArray = array1;
} else {
joinedArray = Array.newInstance(array1.getClass(), 1);
Array.set(joinedArray, 0, array1);
}
} else {
int length1 = 1;
if (array1.getClass().isArray()) {
length1 = Array.getLength(array1);
}
int length2 = 1;
if (array2.getClass().isArray()) {
length2 = Array.getLength(array2);
}
if (array1.getClass().isArray()) {
joinedArray = Array.newInstance(array1.getClass().getComponentType(), length1 + length2);
} else {
joinedArray = Array.newInstance(array1.getClass(), length1 + length2);
}
if (array1.getClass().isArray()) {
System.arraycopy(array1, 0, joinedArray, 0, length1);
} else {
Array.set(joinedArray, 0, array1);
}
if (array2.getClass().isArray()) {
System.arraycopy(array2, 0, joinedArray, length1, length2);
} else {
Array.set(joinedArray, length1, array2);
}
}
return joinedArray;
} | java | 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 (array2 == null) {
if (array1.getClass().isArray()) {
joinedArray = array1;
} else {
joinedArray = Array.newInstance(array1.getClass(), 1);
Array.set(joinedArray, 0, array1);
}
} else {
int length1 = 1;
if (array1.getClass().isArray()) {
length1 = Array.getLength(array1);
}
int length2 = 1;
if (array2.getClass().isArray()) {
length2 = Array.getLength(array2);
}
if (array1.getClass().isArray()) {
joinedArray = Array.newInstance(array1.getClass().getComponentType(), length1 + length2);
} else {
joinedArray = Array.newInstance(array1.getClass(), length1 + length2);
}
if (array1.getClass().isArray()) {
System.arraycopy(array1, 0, joinedArray, 0, length1);
} else {
Array.set(joinedArray, 0, array1);
}
if (array2.getClass().isArray()) {
System.arraycopy(array2, 0, joinedArray, length1, length2);
} else {
Array.set(joinedArray, length1, array2);
}
}
return joinedArray;
} | [
"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",
"(",
"array2",
"==",
"null",
")",
"{",
"if",
"(",
"array1",
".",
"getClass",
"(",
")",
".",
"isArray",
"(",
")",
")",
"{",
"joinedArray",
"=",
"array1",
";",
"}",
"else",
"{",
"joinedArray",
"=",
"Array",
".",
"newInstance",
"(",
"array1",
".",
"getClass",
"(",
")",
",",
"1",
")",
";",
"Array",
".",
"set",
"(",
"joinedArray",
",",
"0",
",",
"array1",
")",
";",
"}",
"}",
"else",
"{",
"int",
"length1",
"=",
"1",
";",
"if",
"(",
"array1",
".",
"getClass",
"(",
")",
".",
"isArray",
"(",
")",
")",
"{",
"length1",
"=",
"Array",
".",
"getLength",
"(",
"array1",
")",
";",
"}",
"int",
"length2",
"=",
"1",
";",
"if",
"(",
"array2",
".",
"getClass",
"(",
")",
".",
"isArray",
"(",
")",
")",
"{",
"length2",
"=",
"Array",
".",
"getLength",
"(",
"array2",
")",
";",
"}",
"if",
"(",
"array1",
".",
"getClass",
"(",
")",
".",
"isArray",
"(",
")",
")",
"{",
"joinedArray",
"=",
"Array",
".",
"newInstance",
"(",
"array1",
".",
"getClass",
"(",
")",
".",
"getComponentType",
"(",
")",
",",
"length1",
"+",
"length2",
")",
";",
"}",
"else",
"{",
"joinedArray",
"=",
"Array",
".",
"newInstance",
"(",
"array1",
".",
"getClass",
"(",
")",
",",
"length1",
"+",
"length2",
")",
";",
"}",
"if",
"(",
"array1",
".",
"getClass",
"(",
")",
".",
"isArray",
"(",
")",
")",
"{",
"System",
".",
"arraycopy",
"(",
"array1",
",",
"0",
",",
"joinedArray",
",",
"0",
",",
"length1",
")",
";",
"}",
"else",
"{",
"Array",
".",
"set",
"(",
"joinedArray",
",",
"0",
",",
"array1",
")",
";",
"}",
"if",
"(",
"array2",
".",
"getClass",
"(",
")",
".",
"isArray",
"(",
")",
")",
"{",
"System",
".",
"arraycopy",
"(",
"array2",
",",
"0",
",",
"joinedArray",
",",
"length1",
",",
"length2",
")",
";",
"}",
"else",
"{",
"Array",
".",
"set",
"(",
"joinedArray",
",",
"length1",
",",
"array2",
")",
";",
"}",
"}",
"return",
"joinedArray",
";",
"}"
] | Add 2 arrays
@param array1
@param array2
@return | [
"Add",
"2",
"arrays"
] | 1ccc9dcb83e6de2359a9f1906d170571cacf1345 | https://github.com/tango-controls/JTango/blob/1ccc9dcb83e6de2359a9f1906d170571cacf1345/common/src/main/java/org/tango/utils/ArrayUtils.java#L112-L154 |
140,386 | tango-controls/JTango | common/src/main/java/org/tango/utils/ArrayUtils.java | ArrayUtils.from2DArrayToArray | public static Object from2DArrayToArray(final Object array2D) {
// final Profiler profilerPeriod = new Profiler("from2DArrayToArray");
// profilerPeriod.start("from2DArrayToArray");
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.getClass().isArray()) {
lengthLineX = Array.getLength(firstLine);
final Class<?> compType = firstLine.getClass().getComponentType();
array = Array.newInstance(compType, lengthY * lengthLineX);
if (lengthLineX > 0 && lengthY > 0) {
for (int y = 0; y < lengthY; y++) {
final Object line = Array.get(array2D, y);
System.arraycopy(line, 0, array, lengthLineX * y, lengthLineX);
}
}
} else { // is not a 2D array
array = Array.newInstance(array2D.getClass().getComponentType(), Array.getLength(array2D));
System.arraycopy(array2D, 0, array, 0, Array.getLength(array2D));
}
} else { // empty array
if (array2D.getClass().getComponentType().isArray()) {
array = Array.newInstance(array2D.getClass().getComponentType().getComponentType(),
Array.getLength(array2D));
} else {
array = Array.newInstance(array2D.getClass().getComponentType(), Array.getLength(array2D));
}
}
} else { // is not an array
array = array2D;
}
// profilerPeriod.stop().print();
return array;
} | java | public static Object from2DArrayToArray(final Object array2D) {
// final Profiler profilerPeriod = new Profiler("from2DArrayToArray");
// profilerPeriod.start("from2DArrayToArray");
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.getClass().isArray()) {
lengthLineX = Array.getLength(firstLine);
final Class<?> compType = firstLine.getClass().getComponentType();
array = Array.newInstance(compType, lengthY * lengthLineX);
if (lengthLineX > 0 && lengthY > 0) {
for (int y = 0; y < lengthY; y++) {
final Object line = Array.get(array2D, y);
System.arraycopy(line, 0, array, lengthLineX * y, lengthLineX);
}
}
} else { // is not a 2D array
array = Array.newInstance(array2D.getClass().getComponentType(), Array.getLength(array2D));
System.arraycopy(array2D, 0, array, 0, Array.getLength(array2D));
}
} else { // empty array
if (array2D.getClass().getComponentType().isArray()) {
array = Array.newInstance(array2D.getClass().getComponentType().getComponentType(),
Array.getLength(array2D));
} else {
array = Array.newInstance(array2D.getClass().getComponentType(), Array.getLength(array2D));
}
}
} else { // is not an array
array = array2D;
}
// profilerPeriod.stop().print();
return array;
} | [
"public",
"static",
"Object",
"from2DArrayToArray",
"(",
"final",
"Object",
"array2D",
")",
"{",
"// final Profiler profilerPeriod = new Profiler(\"from2DArrayToArray\");",
"// profilerPeriod.start(\"from2DArrayToArray\");",
"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",
".",
"getClass",
"(",
")",
".",
"isArray",
"(",
")",
")",
"{",
"lengthLineX",
"=",
"Array",
".",
"getLength",
"(",
"firstLine",
")",
";",
"final",
"Class",
"<",
"?",
">",
"compType",
"=",
"firstLine",
".",
"getClass",
"(",
")",
".",
"getComponentType",
"(",
")",
";",
"array",
"=",
"Array",
".",
"newInstance",
"(",
"compType",
",",
"lengthY",
"*",
"lengthLineX",
")",
";",
"if",
"(",
"lengthLineX",
">",
"0",
"&&",
"lengthY",
">",
"0",
")",
"{",
"for",
"(",
"int",
"y",
"=",
"0",
";",
"y",
"<",
"lengthY",
";",
"y",
"++",
")",
"{",
"final",
"Object",
"line",
"=",
"Array",
".",
"get",
"(",
"array2D",
",",
"y",
")",
";",
"System",
".",
"arraycopy",
"(",
"line",
",",
"0",
",",
"array",
",",
"lengthLineX",
"*",
"y",
",",
"lengthLineX",
")",
";",
"}",
"}",
"}",
"else",
"{",
"// is not a 2D array",
"array",
"=",
"Array",
".",
"newInstance",
"(",
"array2D",
".",
"getClass",
"(",
")",
".",
"getComponentType",
"(",
")",
",",
"Array",
".",
"getLength",
"(",
"array2D",
")",
")",
";",
"System",
".",
"arraycopy",
"(",
"array2D",
",",
"0",
",",
"array",
",",
"0",
",",
"Array",
".",
"getLength",
"(",
"array2D",
")",
")",
";",
"}",
"}",
"else",
"{",
"// empty array",
"if",
"(",
"array2D",
".",
"getClass",
"(",
")",
".",
"getComponentType",
"(",
")",
".",
"isArray",
"(",
")",
")",
"{",
"array",
"=",
"Array",
".",
"newInstance",
"(",
"array2D",
".",
"getClass",
"(",
")",
".",
"getComponentType",
"(",
")",
".",
"getComponentType",
"(",
")",
",",
"Array",
".",
"getLength",
"(",
"array2D",
")",
")",
";",
"}",
"else",
"{",
"array",
"=",
"Array",
".",
"newInstance",
"(",
"array2D",
".",
"getClass",
"(",
")",
".",
"getComponentType",
"(",
")",
",",
"Array",
".",
"getLength",
"(",
"array2D",
")",
")",
";",
"}",
"}",
"}",
"else",
"{",
"// is not an array",
"array",
"=",
"array2D",
";",
"}",
"// profilerPeriod.stop().print();",
"return",
"array",
";",
"}"
] | Convert a 2D array to a 1D array
@param array2D
@return | [
"Convert",
"a",
"2D",
"array",
"to",
"a",
"1D",
"array"
] | 1ccc9dcb83e6de2359a9f1906d170571cacf1345 | https://github.com/tango-controls/JTango/blob/1ccc9dcb83e6de2359a9f1906d170571cacf1345/common/src/main/java/org/tango/utils/ArrayUtils.java#L162-L198 |
140,387 | tango-controls/JTango | common/src/main/java/org/tango/utils/ArrayUtils.java | ArrayUtils.checkDimensions | 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) {// is a 0D Array
hasGoodDimensions = true;
} else if (object.getClass().getComponentType().isArray()) {// is a 2D Array
final Object line = Array.get(object, 0);
if (dimX * dimY == Array.getLength(object) * Array.getLength(line)) {
hasGoodDimensions = true;
}
} else {// 1 D array
final int length = Array.getLength(object);
if (dimX == length && dimY == 0) {
hasGoodDimensions = true;
} else if (dimX * dimY == length) {
hasGoodDimensions = true;
}
}
} else {// not an array
if (dimX == 1 && dimY == 0) {
hasGoodDimensions = true;
}
}
}
return hasGoodDimensions;
} | java | 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) {// is a 0D Array
hasGoodDimensions = true;
} else if (object.getClass().getComponentType().isArray()) {// is a 2D Array
final Object line = Array.get(object, 0);
if (dimX * dimY == Array.getLength(object) * Array.getLength(line)) {
hasGoodDimensions = true;
}
} else {// 1 D array
final int length = Array.getLength(object);
if (dimX == length && dimY == 0) {
hasGoodDimensions = true;
} else if (dimX * dimY == length) {
hasGoodDimensions = true;
}
}
} else {// not an array
if (dimX == 1 && dimY == 0) {
hasGoodDimensions = true;
}
}
}
return hasGoodDimensions;
} | [
"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",
")",
"{",
"// is a 0D Array",
"hasGoodDimensions",
"=",
"true",
";",
"}",
"else",
"if",
"(",
"object",
".",
"getClass",
"(",
")",
".",
"getComponentType",
"(",
")",
".",
"isArray",
"(",
")",
")",
"{",
"// is a 2D Array",
"final",
"Object",
"line",
"=",
"Array",
".",
"get",
"(",
"object",
",",
"0",
")",
";",
"if",
"(",
"dimX",
"*",
"dimY",
"==",
"Array",
".",
"getLength",
"(",
"object",
")",
"*",
"Array",
".",
"getLength",
"(",
"line",
")",
")",
"{",
"hasGoodDimensions",
"=",
"true",
";",
"}",
"}",
"else",
"{",
"// 1 D array",
"final",
"int",
"length",
"=",
"Array",
".",
"getLength",
"(",
"object",
")",
";",
"if",
"(",
"dimX",
"==",
"length",
"&&",
"dimY",
"==",
"0",
")",
"{",
"hasGoodDimensions",
"=",
"true",
";",
"}",
"else",
"if",
"(",
"dimX",
"*",
"dimY",
"==",
"length",
")",
"{",
"hasGoodDimensions",
"=",
"true",
";",
"}",
"}",
"}",
"else",
"{",
"// not an array",
"if",
"(",
"dimX",
"==",
"1",
"&&",
"dimY",
"==",
"0",
")",
"{",
"hasGoodDimensions",
"=",
"true",
";",
"}",
"}",
"}",
"return",
"hasGoodDimensions",
";",
"}"
] | Check of size corresponds to given dimensions
@param object
@param dimX
@param dimY
@return | [
"Check",
"of",
"size",
"corresponds",
"to",
"given",
"dimensions"
] | 1ccc9dcb83e6de2359a9f1906d170571cacf1345 | https://github.com/tango-controls/JTango/blob/1ccc9dcb83e6de2359a9f1906d170571cacf1345/common/src/main/java/org/tango/utils/ArrayUtils.java#L232-L259 |
140,388 | tango-controls/JTango | common/src/main/java/org/tango/utils/ArrayUtils.java | ArrayUtils.fromArrayTo2DArray | public static Object fromArrayTo2DArray(final Object array, final int dimX, final int dimY) throws DevFailed {
Object array2D = null;
// final Profiler profilerPeriod = new Profiler("fromArrayTo2DArray");
// profilerPeriod.start("fromArrayTo2DArray");
if (array.getClass().isArray()) {
if (dimY > 0) {// to a 2D Array
array2D = Array.newInstance(array.getClass().getComponentType(), dimY, dimX);
for (int y = 0; y < dimY; y++) {
final Object line = Array.get(array2D, y);
System.arraycopy(array, y * dimX, line, 0, Array.getLength(line));
}
} else {
array2D = Array.newInstance(array.getClass().getComponentType(), Array.getLength(array));
System.arraycopy(array, 0, array2D, 0, Array.getLength(array));
}
} else {
array2D = array;
}
// profilerPeriod.stop().print();
return array2D;
} | java | public static Object fromArrayTo2DArray(final Object array, final int dimX, final int dimY) throws DevFailed {
Object array2D = null;
// final Profiler profilerPeriod = new Profiler("fromArrayTo2DArray");
// profilerPeriod.start("fromArrayTo2DArray");
if (array.getClass().isArray()) {
if (dimY > 0) {// to a 2D Array
array2D = Array.newInstance(array.getClass().getComponentType(), dimY, dimX);
for (int y = 0; y < dimY; y++) {
final Object line = Array.get(array2D, y);
System.arraycopy(array, y * dimX, line, 0, Array.getLength(line));
}
} else {
array2D = Array.newInstance(array.getClass().getComponentType(), Array.getLength(array));
System.arraycopy(array, 0, array2D, 0, Array.getLength(array));
}
} else {
array2D = array;
}
// profilerPeriod.stop().print();
return array2D;
} | [
"public",
"static",
"Object",
"fromArrayTo2DArray",
"(",
"final",
"Object",
"array",
",",
"final",
"int",
"dimX",
",",
"final",
"int",
"dimY",
")",
"throws",
"DevFailed",
"{",
"Object",
"array2D",
"=",
"null",
";",
"// final Profiler profilerPeriod = new Profiler(\"fromArrayTo2DArray\");",
"// profilerPeriod.start(\"fromArrayTo2DArray\");",
"if",
"(",
"array",
".",
"getClass",
"(",
")",
".",
"isArray",
"(",
")",
")",
"{",
"if",
"(",
"dimY",
">",
"0",
")",
"{",
"// to a 2D Array",
"array2D",
"=",
"Array",
".",
"newInstance",
"(",
"array",
".",
"getClass",
"(",
")",
".",
"getComponentType",
"(",
")",
",",
"dimY",
",",
"dimX",
")",
";",
"for",
"(",
"int",
"y",
"=",
"0",
";",
"y",
"<",
"dimY",
";",
"y",
"++",
")",
"{",
"final",
"Object",
"line",
"=",
"Array",
".",
"get",
"(",
"array2D",
",",
"y",
")",
";",
"System",
".",
"arraycopy",
"(",
"array",
",",
"y",
"*",
"dimX",
",",
"line",
",",
"0",
",",
"Array",
".",
"getLength",
"(",
"line",
")",
")",
";",
"}",
"}",
"else",
"{",
"array2D",
"=",
"Array",
".",
"newInstance",
"(",
"array",
".",
"getClass",
"(",
")",
".",
"getComponentType",
"(",
")",
",",
"Array",
".",
"getLength",
"(",
"array",
")",
")",
";",
"System",
".",
"arraycopy",
"(",
"array",
",",
"0",
",",
"array2D",
",",
"0",
",",
"Array",
".",
"getLength",
"(",
"array",
")",
")",
";",
"}",
"}",
"else",
"{",
"array2D",
"=",
"array",
";",
"}",
"// profilerPeriod.stop().print();",
"return",
"array2D",
";",
"}"
] | Convert an array to a 2D array
@param array
@param dimX
@param dimY
@return
@throws DevFailed | [
"Convert",
"an",
"array",
"to",
"a",
"2D",
"array"
] | 1ccc9dcb83e6de2359a9f1906d170571cacf1345 | https://github.com/tango-controls/JTango/blob/1ccc9dcb83e6de2359a9f1906d170571cacf1345/common/src/main/java/org/tango/utils/ArrayUtils.java#L271-L292 |
140,389 | tango-controls/JTango | client/src/main/java/fr/soleil/tango/statecomposer/PriorityStateManager.java | PriorityStateManager.getDeviceStateArray | 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 = deviceStateEntry.getValue();
array[i++] = deviceName + " - " + StateUtilities.getNameForState(deviceState);
}
return array;
} | java | 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 = deviceStateEntry.getValue();
array[i++] = deviceName + " - " + StateUtilities.getNameForState(deviceState);
}
return array;
} | [
"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",
"=",
"deviceStateEntry",
".",
"getValue",
"(",
")",
";",
"array",
"[",
"i",
"++",
"]",
"=",
"deviceName",
"+",
"\" - \"",
"+",
"StateUtilities",
".",
"getNameForState",
"(",
"deviceState",
")",
";",
"}",
"return",
"array",
";",
"}"
] | return an array of String which contains deviceName and his state.
@return String[] | [
"return",
"an",
"array",
"of",
"String",
"which",
"contains",
"deviceName",
"and",
"his",
"state",
"."
] | 1ccc9dcb83e6de2359a9f1906d170571cacf1345 | https://github.com/tango-controls/JTango/blob/1ccc9dcb83e6de2359a9f1906d170571cacf1345/client/src/main/java/fr/soleil/tango/statecomposer/PriorityStateManager.java#L114-L124 |
140,390 | tango-controls/JTango | client/src/main/java/fr/soleil/tango/statecomposer/PriorityStateManager.java | PriorityStateManager.getDeviceStateNumberArray | 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) getPriorityForState(deviceState);
}
return array;
} | java | 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) getPriorityForState(deviceState);
}
return array;
} | [
"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",
")",
"getPriorityForState",
"(",
"deviceState",
")",
";",
"}",
"return",
"array",
";",
"}"
] | return an array of short which contains the priority of state of monitored devices.
@return short[] | [
"return",
"an",
"array",
"of",
"short",
"which",
"contains",
"the",
"priority",
"of",
"state",
"of",
"monitored",
"devices",
"."
] | 1ccc9dcb83e6de2359a9f1906d170571cacf1345 | https://github.com/tango-controls/JTango/blob/1ccc9dcb83e6de2359a9f1906d170571cacf1345/client/src/main/java/fr/soleil/tango/statecomposer/PriorityStateManager.java#L131-L140 |
140,391 | tango-controls/JTango | client/src/main/java/fr/soleil/tango/clientapi/TangoAttribute.java | TangoAttribute.read | public <T> T read(final Class<T> type) throws DevFailed {
update();
return extract(type);
} | java | public <T> T read(final Class<T> type) throws DevFailed {
update();
return extract(type);
} | [
"public",
"<",
"T",
">",
"T",
"read",
"(",
"final",
"Class",
"<",
"T",
">",
"type",
")",
"throws",
"DevFailed",
"{",
"update",
"(",
")",
";",
"return",
"extract",
"(",
"type",
")",
";",
"}"
] | Read the tango attribute with SCALAR format and convert it
@param <T>
@param type
The requested output type
@return
@throws DevFailed | [
"Read",
"the",
"tango",
"attribute",
"with",
"SCALAR",
"format",
"and",
"convert",
"it"
] | 1ccc9dcb83e6de2359a9f1906d170571cacf1345 | https://github.com/tango-controls/JTango/blob/1ccc9dcb83e6de2359a9f1906d170571cacf1345/client/src/main/java/fr/soleil/tango/clientapi/TangoAttribute.java#L101-L104 |
140,392 | tango-controls/JTango | client/src/main/java/fr/soleil/tango/clientapi/TangoAttribute.java | TangoAttribute.readArray | public <T> Object readArray(final Class<T> type) throws DevFailed {
update();
return extractArray(type);
} | java | public <T> Object readArray(final Class<T> type) throws DevFailed {
update();
return extractArray(type);
} | [
"public",
"<",
"T",
">",
"Object",
"readArray",
"(",
"final",
"Class",
"<",
"T",
">",
"type",
")",
"throws",
"DevFailed",
"{",
"update",
"(",
")",
";",
"return",
"extractArray",
"(",
"type",
")",
";",
"}"
] | Read attribute and return result as array.
@param type
The requested output type, is the component type (double,
Double...).
@return
@throws DevFailed | [
"Read",
"attribute",
"and",
"return",
"result",
"as",
"array",
"."
] | 1ccc9dcb83e6de2359a9f1906d170571cacf1345 | https://github.com/tango-controls/JTango/blob/1ccc9dcb83e6de2359a9f1906d170571cacf1345/client/src/main/java/fr/soleil/tango/clientapi/TangoAttribute.java#L137-L140 |
140,393 | tango-controls/JTango | client/src/main/java/fr/soleil/tango/clientapi/TangoAttribute.java | TangoAttribute.readWritten | public <T> T readWritten(final Class<T> type) throws DevFailed {
update();
return extractWritten(type);
} | java | public <T> T readWritten(final Class<T> type) throws DevFailed {
update();
return extractWritten(type);
} | [
"public",
"<",
"T",
">",
"T",
"readWritten",
"(",
"final",
"Class",
"<",
"T",
">",
"type",
")",
"throws",
"DevFailed",
"{",
"update",
"(",
")",
";",
"return",
"extractWritten",
"(",
"type",
")",
";",
"}"
] | Read written value of attribute
@param <T>
@param type
The requested output type
@return
@throws DevFailed | [
"Read",
"written",
"value",
"of",
"attribute"
] | 1ccc9dcb83e6de2359a9f1906d170571cacf1345 | https://github.com/tango-controls/JTango/blob/1ccc9dcb83e6de2359a9f1906d170571cacf1345/client/src/main/java/fr/soleil/tango/clientapi/TangoAttribute.java#L156-L159 |
140,394 | tango-controls/JTango | client/src/main/java/fr/soleil/tango/clientapi/TangoAttribute.java | TangoAttribute.readSpecOrImage | public <T> T[] readSpecOrImage(final Class<T> type) throws DevFailed {
update();
return extractSpecOrImage(type);
} | java | public <T> T[] readSpecOrImage(final Class<T> type) throws DevFailed {
update();
return extractSpecOrImage(type);
} | [
"public",
"<",
"T",
">",
"T",
"[",
"]",
"readSpecOrImage",
"(",
"final",
"Class",
"<",
"T",
">",
"type",
")",
"throws",
"DevFailed",
"{",
"update",
"(",
")",
";",
"return",
"extractSpecOrImage",
"(",
"type",
")",
";",
"}"
] | Read attribute with format SPECTRUM or IMAGE
@param <T>
@param type
@return
@throws DevFailed | [
"Read",
"attribute",
"with",
"format",
"SPECTRUM",
"or",
"IMAGE"
] | 1ccc9dcb83e6de2359a9f1906d170571cacf1345 | https://github.com/tango-controls/JTango/blob/1ccc9dcb83e6de2359a9f1906d170571cacf1345/client/src/main/java/fr/soleil/tango/clientapi/TangoAttribute.java#L185-L188 |
140,395 | tango-controls/JTango | client/src/main/java/fr/soleil/tango/clientapi/TangoAttribute.java | TangoAttribute.readAsString | public String readAsString(final String separator, final String endSeparator) throws DevFailed {
update();
return extractToString(separator, endSeparator);
} | java | public String readAsString(final String separator, final String endSeparator) throws DevFailed {
update();
return extractToString(separator, endSeparator);
} | [
"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
@param separator
between each value (for SPECTRUM and IMAGE only)
@param endSeparator
between each dimension (for IMAGE only)
@return The formatted string
@throws DevFailed | [
"Read",
"attribute",
"and",
"convert",
"it",
"to",
"a",
"String",
"with",
"separators"
] | 1ccc9dcb83e6de2359a9f1906d170571cacf1345 | https://github.com/tango-controls/JTango/blob/1ccc9dcb83e6de2359a9f1906d170571cacf1345/client/src/main/java/fr/soleil/tango/clientapi/TangoAttribute.java#L222-L225 |
140,396 | tango-controls/JTango | client/src/main/java/fr/soleil/tango/clientapi/TangoAttribute.java | TangoAttribute.insert | public void insert(final Object value) throws DevFailed {
logger.debug(LOG_INSERTING, this);
attributeImpl.insert(value);
} | java | public void insert(final Object value) throws DevFailed {
logger.debug(LOG_INSERTING, this);
attributeImpl.insert(value);
} | [
"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
@param value
@throws DevFailed | [
"Insert",
"scalar",
"spectrum",
"or",
"image",
".",
"spectrum",
"can",
"be",
"arrays",
"of",
"Objects",
"or",
"primitives",
".",
"image",
"can",
"be",
"2D",
"arrays",
"of",
"Objects",
"or",
"primitives"
] | 1ccc9dcb83e6de2359a9f1906d170571cacf1345 | https://github.com/tango-controls/JTango/blob/1ccc9dcb83e6de2359a9f1906d170571cacf1345/client/src/main/java/fr/soleil/tango/clientapi/TangoAttribute.java#L234-L237 |
140,397 | tango-controls/JTango | client/src/main/java/fr/soleil/tango/clientapi/TangoAttribute.java | TangoAttribute.extractNumber | 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_NUMBER);
}
return (Number) result;
} | java | 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_NUMBER);
}
return (Number) result;
} | [
"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_NUMBER",
")",
";",
"}",
"return",
"(",
"Number",
")",
"result",
";",
"}"
] | Extract value in a Number without conversion
@return
@throws DevFailed | [
"Extract",
"value",
"in",
"a",
"Number",
"without",
"conversion"
] | 1ccc9dcb83e6de2359a9f1906d170571cacf1345 | https://github.com/tango-controls/JTango/blob/1ccc9dcb83e6de2359a9f1906d170571cacf1345/client/src/main/java/fr/soleil/tango/clientapi/TangoAttribute.java#L265-L272 |
140,398 | tango-controls/JTango | server/src/main/java/org/tango/server/cache/TangoCacheManager.java | TangoCacheManager.initPoolConf | 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[] pollingThreadsPoolConf = prop.get(POLLING_THREADS_POOL_CONF);
for (int i = 0; i < pollingThreadsPoolConf.length; i++) {
if (cacheList.containsKey(pollingThreadsPoolConf[i]) && !pollingThreadsPoolConf[i].isEmpty()
&& !polledDevices.contains(pollingThreadsPoolConf[i])) {
polledDevices.add(pollingThreadsPoolConf[i]);
}
}
}
} | java | 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[] pollingThreadsPoolConf = prop.get(POLLING_THREADS_POOL_CONF);
for (int i = 0; i < pollingThreadsPoolConf.length; i++) {
if (cacheList.containsKey(pollingThreadsPoolConf[i]) && !pollingThreadsPoolConf[i].isEmpty()
&& !polledDevices.contains(pollingThreadsPoolConf[i])) {
polledDevices.add(pollingThreadsPoolConf[i]);
}
}
}
} | [
"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",
"[",
"]",
"pollingThreadsPoolConf",
"=",
"prop",
".",
"get",
"(",
"POLLING_THREADS_POOL_CONF",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"pollingThreadsPoolConf",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"cacheList",
".",
"containsKey",
"(",
"pollingThreadsPoolConf",
"[",
"i",
"]",
")",
"&&",
"!",
"pollingThreadsPoolConf",
"[",
"i",
"]",
".",
"isEmpty",
"(",
")",
"&&",
"!",
"polledDevices",
".",
"contains",
"(",
"pollingThreadsPoolConf",
"[",
"i",
"]",
")",
")",
"{",
"polledDevices",
".",
"add",
"(",
"pollingThreadsPoolConf",
"[",
"i",
"]",
")",
";",
"}",
"}",
"}",
"}"
] | Retrieve the ordered list of polled devices
@throws DevFailed | [
"Retrieve",
"the",
"ordered",
"list",
"of",
"polled",
"devices"
] | 1ccc9dcb83e6de2359a9f1906d170571cacf1345 | https://github.com/tango-controls/JTango/blob/1ccc9dcb83e6de2359a9f1906d170571cacf1345/server/src/main/java/org/tango/server/cache/TangoCacheManager.java#L128-L141 |
140,399 | tango-controls/JTango | server/src/main/java/org/tango/server/cache/TangoCacheManager.java | TangoCacheManager.updatePoolConf | 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]));
DatabaseFactory.getDatabase().setDeviceProperties(ServerManager.getInstance().getAdminDeviceName(),
properties);
}
} | java | 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]));
DatabaseFactory.getDatabase().setDeviceProperties(ServerManager.getInstance().getAdminDeviceName(),
properties);
}
} | [
"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",
"]",
")",
")",
";",
"DatabaseFactory",
".",
"getDatabase",
"(",
")",
".",
"setDeviceProperties",
"(",
"ServerManager",
".",
"getInstance",
"(",
")",
".",
"getAdminDeviceName",
"(",
")",
",",
"properties",
")",
";",
"}",
"}"
] | 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.
@throws DevFailed | [
"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",
"."
] | 1ccc9dcb83e6de2359a9f1906d170571cacf1345 | https://github.com/tango-controls/JTango/blob/1ccc9dcb83e6de2359a9f1906d170571cacf1345/server/src/main/java/org/tango/server/cache/TangoCacheManager.java#L174-L182 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.