Skip to content
Snippets Groups Projects
Commit 21f45de9 authored by Gwenaelle ABEILLE's avatar Gwenaelle ABEILLE
Browse files

release

parent d8bf0edf
No related branches found
No related merge requests found
Showing
with 2981 additions and 3269 deletions
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src/main/java"/>
<classpathentry kind="src" path="src/test/java"/>
<classpathentry kind="src" output="target/classes" path="src/main/java"/>
<classpathentry kind="src" path="src/main/resources"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="src" output="target/test-classes" path="src/test/java"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
<classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
<classpathentry kind="lib" path="/snapArchivingApi/configuration"/>
<classpathentry kind="output" path="target/classes"/>
</classpath>
......@@ -11,19 +11,19 @@
</arguments>
</buildCommand>
<buildCommand>
<name>org.maven.ide.eclipse.maven2Builder</name>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<name>org.maven.ide.eclipse.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.maven.ide.eclipse.maven2Nature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
</natures>
</projectDescription>
......@@ -11,7 +11,7 @@
<groupId>fr.soleil.deviceservers</groupId>
<artifactId>snapArchivingServers</artifactId>
<version>1.5.9-SNAPSHOT</version>
<version>1.6.3</version>
<name>snapArchivingServers</name>
<scm>
......@@ -42,22 +42,21 @@
</build>
<dependencies>
<dependency>
<groupId>fr.esrf.tango</groupId>
<groupId>org.tango</groupId>
<artifactId>TangORB</artifactId>
</dependency>
<dependency>
<groupId>fr.esrf.atk</groupId>
<artifactId>ATKCore</artifactId>
</dependency>
<dependency>
<groupId>fr.soleil.lib</groupId>
<artifactId>snapArchivingApi</artifactId>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
</dependency>
<dependency>
<groupId>org.tango</groupId>
<artifactId>JTangoClientLang</artifactId>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
......
......@@ -96,10 +96,18 @@
package SnapArchiver;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
import org.omg.CORBA.SystemException;
import org.omg.CORBA.UserException;
import org.tango.utils.DevFailedUtils;
import SnapArchiver.grouplink.UsePluginBuilder;
import fr.esrf.Tango.DevFailed;
......@@ -116,6 +124,7 @@ import fr.soleil.snapArchivingApi.SnapManagerApi.SnapManagerApi;
import fr.soleil.snapArchivingApi.SnapshotingApi.ConfigConst;
import fr.soleil.snapArchivingApi.SnapshotingApi.persistence.SnapshotPersistenceManager;
import fr.soleil.snapArchivingApi.SnapshotingApi.persistence.SnapshotPersistenceManagerFactory;
import fr.soleil.snapArchivingApi.SnapshotingTools.Tools.SnapAttributeExtract;
import fr.soleil.snapArchivingApi.SnapshotingTools.Tools.SnapContext;
import fr.soleil.snapArchivingApi.SnapshotingTools.Tools.SnapShot;
import fr.soleil.snapArchivingApi.SnapshotingTools.Tools.SnapshotingException;
......@@ -136,7 +145,7 @@ public class SnapArchiver extends DeviceImpl
/* WithShutdownRunnable */implements TangoConst {
protected int state;
protected SnapshotPersistenceManager manager;
private String m_version;
private final String m_version;
// --------- Start of attributes data members ----------
......@@ -177,6 +186,13 @@ public class SnapArchiver extends DeviceImpl
*/
String beansFileName;
private final ExecutorService executorService = Executors.newSingleThreadExecutor();
private final Map<Short, Future<Short>> snapshotResults = new HashMap<Short, Future<Short>>();
private String dbHost;
private String dbName;
private String dbSchema;
private String isRac;
// --------- End of properties data members ----------
// Add your own data members here
......@@ -200,6 +216,7 @@ public class SnapArchiver extends DeviceImpl
*/
// =========================================================
SnapArchiver(DeviceClass cl, String s, String version) throws DevFailed {
super(cl, s);
m_version = version;
init_device();
......@@ -219,8 +236,7 @@ public class SnapArchiver extends DeviceImpl
* The device version
*/
// =========================================================
SnapArchiver(DeviceClass cl, String s, String d, String version)
throws DevFailed {
SnapArchiver(DeviceClass cl, String s, String d, String version) throws DevFailed {
super(cl, s, d);
m_version = version;
init_device();
......@@ -231,25 +247,24 @@ public class SnapArchiver extends DeviceImpl
* Initialize the device.
*/
// =========================================================
@Override
public void init_device() throws DevFailed {
System.out.println("SnapArchiver() create " + device_name);
// Initialise variables to default values
// -------------------------------------------
get_device_property();
try {
// Db connexion est elle vraiment utile ?
SnapManagerApi.SnapshotingConfigure(dbUser, dbPassword);
SnapshotPersistenceManagerFactory factory = SnapshotPersistenceManagerFactory
.getInstance(this.beansFileName);
manager = factory.getManager();
SnapManagerApi.initSnapConnection(dbHost, dbName, dbSchema, dbUser, dbPassword, isRac);
SnapshotPersistenceManagerFactory factory = SnapshotPersistenceManagerFactory.getInstance();
manager = factory.getManager(beansFileName, dbUser, dbPassword);
set_state(DevState.ON);
} catch (SnapshotingException e) {
get_logger().warn(e.toString(), e);
throw e.toTangoException();
set_state(DevState.FAULT);
set_status(e.toString());
}
set_state(DevState.ON);
}
// ===================================================================
......@@ -260,16 +275,20 @@ public class SnapArchiver extends DeviceImpl
private void get_device_property() throws DevFailed {
// Initialize your default values here.
// ------------------------------------------
dbUser = ConfigConst.default_sauser;
dbPassword = ConfigConst.default_sapasswd;
dbUser = "";
dbPassword = "";
beansFileName = ConfigConst.default_sabeansfilename;
dbHost = "";
dbName = "";
dbSchema = "";
isRac = "";
// Read device properties from database.(Automatic code generation)
// -------------------------------------------------------------
if (Util._UseDb == false)
if (Util._UseDb == false) {
return;
}
String[] propnames = { "DbUser", "DbPassword", "BeansFileName" };
String[] propnames = { "DbUser", "DbPassword", "BeansFileName", "DbHost", "DbName", "DbSchema", "IsRac" };
// Call database and extract values
// --------------------------------------------
......@@ -277,34 +296,80 @@ public class SnapArchiver extends DeviceImpl
SnapArchiverClass ds_class = (SnapArchiverClass) get_device_class();
int i = -1;
// Extract DbUser value
if (dev_prop[++i].is_empty() == false)
if (dev_prop[++i].is_empty() == false) {
dbUser = dev_prop[i].extractString();
else {
} else {
// Try to get value from class property
DbDatum cl_prop = ds_class.get_class_property(dev_prop[i].name);
if (cl_prop.is_empty() == false)
if (cl_prop.is_empty() == false) {
dbUser = cl_prop.extractString();
}
}
// Extract DbPassword value
if (dev_prop[++i].is_empty() == false)
if (dev_prop[++i].is_empty() == false) {
dbPassword = dev_prop[i].extractString();
else {
} else {
// Try to get value from class property
DbDatum cl_prop = ds_class.get_class_property(dev_prop[i].name);
if (cl_prop.is_empty() == false)
if (cl_prop.is_empty() == false) {
dbPassword = cl_prop.extractString();
}
}
// Extract BeansFileName value
if (dev_prop[++i].is_empty() == false)
if (dev_prop[++i].is_empty() == false) {
beansFileName = dev_prop[i].extractString();
else {
} else {
// Try to get value from class property
DbDatum cl_prop = ds_class.get_class_property(dev_prop[i].name);
if (cl_prop.is_empty() == false)
if (cl_prop.is_empty() == false) {
beansFileName = cl_prop.extractString();
}
}
// Extract DbHost value
if (dev_prop[++i].is_empty() == false) {
dbHost = dev_prop[i].extractString();
} else {
// Try to get value from class property
DbDatum cl_prop = ds_class.get_class_property(dev_prop[i].name);
if (cl_prop.is_empty() == false) {
dbHost = cl_prop.extractString();
}
}
// Extract DbName value
if (dev_prop[++i].is_empty() == false) {
dbName = dev_prop[i].extractString();
} else {
// Try to get value from class property
DbDatum cl_prop = ds_class.get_class_property(dev_prop[i].name);
if (cl_prop.is_empty() == false) {
dbName = cl_prop.extractString();
}
}
// Extract DbSchema value
if (dev_prop[++i].is_empty() == false) {
dbSchema = dev_prop[i].extractString();
} else {
// Try to get value from class property
DbDatum cl_prop = ds_class.get_class_property(dev_prop[i].name);
if (cl_prop.is_empty() == false) {
dbSchema = cl_prop.extractString();
}
}
// Extract IsRac value
if (dev_prop[++i].is_empty() == false) {
isRac = dev_prop[i].extractString();
} else {
// Try to get value from class property
DbDatum cl_prop = ds_class.get_class_property(dev_prop[i].name);
if (cl_prop.is_empty() == false) {
isRac = cl_prop.extractString();
}
}
// End of Automatic code generation
// -------------------------------------------------------------
......@@ -315,6 +380,7 @@ public class SnapArchiver extends DeviceImpl
* Method always executed before command execution.
*/
// =========================================================
@Override
public void always_executed_hook() {
// get_logger().info("In always_executed_hook method()");
}
......@@ -330,27 +396,64 @@ public class SnapArchiver extends DeviceImpl
* @throws SnapshotingException
*/
// =========================================================
public synchronized short trigger_launch_snap_shot(short argin)
throws DevFailed {
// Timestamp startDate = new Timestamp(System.currentTimeMillis());
public void trigger_launch_snap_shot(short argin) throws DevFailed {
if (get_state().equals(DevState.RUNNING)) {
DevFailedUtils.throwDevFailed("STATE_ERROR", "snapshot alreadly in progress");
}
set_state(DevState.RUNNING);
get_logger().info("Entering trigger_launch_snap_shot()");
Future<Short> snapshotResult = executorService.submit(new SnapshotTask(argin));
snapshotResults.put(argin, snapshotResult);
// ---Add your Own code to control device here ---
SnapShot snapShot = null;
}
/**
* Command
*
* @param argin
* the context ID
* @return
* @throws DevFailed
*/
public short getSnapShotResult(short argin) throws DevFailed {
short result = -1;
try {
Future<Short> snap = snapshotResults.get(argin);
if (snap != null) {
result = snapshotResults.get(argin).get();
}
} catch (InterruptedException e) {
DevFailedUtils.throwDevFailed(e);
} catch (ExecutionException e) {
if (e.getCause() instanceof DevFailed) {
throw (DevFailed) e.getCause();
} else {
DevFailedUtils.throwDevFailed(e.getCause());
}
}
return result;
}
private class SnapshotTask implements Callable<Short> {
private final short contextID;
public SnapshotTask(short contextID) {
this.contextID = contextID;
}
@Override
public Short call() throws Exception {
short snapId = -1;
try {
snapShot = SnapManagerApi.registerSnapShot((int) argin);
SnapShot snapShot = SnapManagerApi.registerSnapShot(contextID);
if (snapShot == null) {
Except.throw_exception("INPUT_ERROR", "Invalid Context ID",
"SnapArchiver.TriggerLaunchSnapshot");
Except.throw_exception("INPUT_ERROR", "Invalid Context ID", "SnapArchiver.TriggerLaunchSnapshot");
}
snapId = (short) snapShot.getId_snap();
// For each attribute of the object 'Snapshot', a snapshot is
// triggered...
ArrayList attributeList = snapShot.getAttribute_List();
List<SnapAttributeExtract> attributeList = snapShot.getAttribute_List();
UsePluginBuilder builder = new UsePluginBuilder(snapId, manager);
UsePlugin group = builder.build(attributeList);
group.execute();
......@@ -358,24 +461,17 @@ public class SnapArchiver extends DeviceImpl
// Map<String, String> messages = group.getMessages();
} catch (SnapshotingException e) {
e.printStackTrace();
Util.out2
.println("Exception received during TriggerLaunchSnapshot : "
+ e.toString());
Util.out2.println("Exception received during TriggerLaunchSnapshot : " + e.toString());
throw e.toTangoException();
} catch (DevFailed e) {
throw e;
} catch (Exception e) {
Util.out2
.println("Unknown Exception is received during TriggerLaunchSnapshot : "
+ e.toString());
Except.throw_exception("ERROR", "Unknown Exception + "
+ e.toString(), "SnapArchiver.TriggerLaunchSnapshot");
} finally {
SnapArchiver.this.set_state(DevState.ON);
}
return snapId;
}
}
// =========================================================
/**
* Execute command "CreateNewContext" on device. This command is used to
......@@ -388,8 +484,7 @@ public class SnapArchiver extends DeviceImpl
* pattern).
*/
// =========================================================
public synchronized void create_new_context(String[] argin)
throws DevFailed {
public void create_new_context(String[] argin) throws DevFailed {
get_logger().info("Entering create_new_context()");
// ---Add your Own code to control device here ---
......@@ -412,7 +507,8 @@ public class SnapArchiver extends DeviceImpl
* reference to the Attribute object
*/
// ===================================================================
public synchronized void read_attr(Attribute attr) throws DevFailed {
@Override
public void read_attr(Attribute attr) throws DevFailed {
String attr_name = attr.get_name();
get_logger().info("In read_attr for attribute " + attr_name);
......@@ -454,13 +550,15 @@ public class SnapArchiver extends DeviceImpl
System.exit(-1);
}
/**
*
*/
@Override
public void delete_device() throws DevFailed {
// TODO Auto-generated method stub
snapshotResults.clear();
}
}
......
......@@ -58,6 +58,7 @@
package SnapArchiver;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
import java.util.Vector;
......@@ -66,10 +67,10 @@ import fr.esrf.Tango.DevFailed;
import fr.esrf.Tango.DispLevel;
import fr.esrf.TangoApi.DbDatum;
import fr.esrf.TangoDs.Attr;
import fr.esrf.TangoDs.Command;
import fr.esrf.TangoDs.DeviceClass;
import fr.esrf.TangoDs.DeviceImpl;
import fr.esrf.TangoDs.TangoConst;
import fr.esrf.TangoDs.TemplCommandInOut;
import fr.esrf.TangoDs.Util;
public class SnapArchiverClass extends DeviceClass implements TangoConst {
......@@ -81,7 +82,7 @@ public class SnapArchiverClass extends DeviceClass implements TangoConst {
/**
* Class properties array.
*/
private DbDatum[] cl_prop = null;
// private final DbDatum[] cl_prop = null;
// //--------- Start of properties data members ----------
//
......@@ -162,6 +163,7 @@ public class SnapArchiverClass extends DeviceClass implements TangoConst {
// Method: attribute_factory(Vector att_list)
//
// =============================================================================
@Override
public void attribute_factory(Vector att_list) throws DevFailed {
// Attribute : version
Attr version = new Attr("version", Tango_DEV_STRING, AttrWriteType.READ);
......@@ -175,27 +177,16 @@ public class SnapArchiverClass extends DeviceClass implements TangoConst {
// description : Create the command object(s) and store them in the
// command list
// ===================================================================
@Override
public void command_factory() {
command_list.addElement(new TriggerLaunchSnapShotCmd(
"TriggerLaunchSnapShot",
Tango_DEV_SHORT,
Tango_DEV_SHORT,
"The snapshot associated context's identifier.",
"The new snapshot identifier.",
DispLevel.OPERATOR));
command_list.addElement(new TriggerLaunchSnapShotCmd("TriggerLaunchSnapShot", Tango_DEV_SHORT, Tango_DEV_VOID,
"The snapshot associated context's identifier", "", DispLevel.OPERATOR));
command_list
.addElement(new CreateNewContextCmd(
"CreateNewContext",
Tango_DEVVAR_STRINGARRAY,
Tango_DEV_VOID,
"All the informations usefull to create a context ,Snapshot pattern).",
"", DispLevel.OPERATOR));
command_list.addElement(new TemplCommandInOut("GetSnapShotResult", "getSnapShotResult",
"The snapshot associated context's identifier", "The new snapshot identifier", DispLevel.OPERATOR));
// add polling if any
for (int i = 0; i < command_list.size(); i++) {
Command cmd = (Command) command_list.elementAt(i);
}
command_list.addElement(new CreateNewContextCmd("CreateNewContext", Tango_DEVVAR_STRINGARRAY, Tango_DEV_VOID,
"All the informations usefull to create a context ,Snapshot pattern).", "", DispLevel.OPERATOR));
}
// ===================================================================
......@@ -208,25 +199,28 @@ public class SnapArchiverClass extends DeviceClass implements TangoConst {
// argument : in : String[] devlist : The device name list
//
// ===================================================================
@Override
public void device_factory(String[] devlist) throws DevFailed {
String device_version = ResourceBundle.getBundle("application")
.getString("project.version");
String device_version = "unkown";
try {
device_version = ResourceBundle.getBundle("application").getString("project.version");
} catch (MissingResourceException e) {
}
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 SnapArchiver(this, devlist[i],
device_version));
device_list.addElement(new SnapArchiver(this, devlist[i], device_version));
// Export device to the outside world
// ----------------------------------------------
if (Util._UseDb == true)
export_device(((DeviceImpl) (device_list.elementAt(i))));
else
export_device(((DeviceImpl) (device_list.elementAt(i))),
devlist[i]);
if (Util._UseDb == true) {
export_device(((DeviceImpl) device_list.elementAt(i)));
} else {
export_device(((DeviceImpl) device_list.elementAt(i)), devlist[i]);
}
}
}
......@@ -236,14 +230,17 @@ public class SnapArchiverClass extends DeviceClass implements TangoConst {
*
* @param name
* The property name.
* @throws DevFailed
*/
// ===================================================================
public DbDatum get_class_property(String name) {
for (int i = 0; i < cl_prop.length; i++)
if (cl_prop[i].name.equals(name))
return cl_prop[i];
// if not found, return an empty DbDatum
return new DbDatum(name);
public DbDatum get_class_property(String name) throws DevFailed {
// for (int i = 0; i < cl_prop.length; i++) {
// if (cl_prop[i].name.equals(name)) {
// return cl_prop[i];
// }
// }
DbDatum[] classProps = get_db_class().get_property(new String[] { name });
return classProps[0];
}
// ===================================================================
......@@ -258,14 +255,15 @@ public class SnapArchiverClass extends DeviceClass implements TangoConst {
// Read class properties from database.(Automatic code generation)
// Read class properties from database.(Automatic code generation)
// -------------------------------------------------------------
if (Util._UseDb == false)
return;
String[] propnames = {};
// if (Util._UseDb == false) {
// return;
// }
// String[] propnames = {};
// Call database and extract values
// --------------------------------------------
cl_prop = get_db_class().get_property(propnames);
int i = -1;
// cl_prop = get_db_class().get_property(propnames);
// int i = -1;
// End of Automatic code generation
//
......@@ -313,8 +311,9 @@ public class SnapArchiverClass extends DeviceClass implements TangoConst {
private void write_class_property() throws DevFailed {
// First time, check if database used
// --------------------------------------------
if (Util._UseDb == false)
if (Util._UseDb == false) {
return;
}
// Prepeare DbDatum
// --------------------------------------------
......
......@@ -17,13 +17,12 @@ public class TriggerLaunchSnapShotCmd extends Command implements TangoConst {
// TODO Auto-generated constructor stub
}
public TriggerLaunchSnapShotCmd(String name, int in, int out,
String in_comments, String out_comments) {
public TriggerLaunchSnapShotCmd(String name, int in, int out, String in_comments, String out_comments) {
super(name, in, out, in_comments, out_comments);
}
public TriggerLaunchSnapShotCmd(String name, int in, int out,
String in_comments, String out_comments, DispLevel level) {
public TriggerLaunchSnapShotCmd(String name, int in, int out, String in_comments, String out_comments,
DispLevel level) {
super(name, in, out, in_comments, out_comments, level);
}
......@@ -33,13 +32,15 @@ public class TriggerLaunchSnapShotCmd extends Command implements TangoConst {
short argin = extract_DevShort(in_any);
if (argin < 0) {
Util.out2.println("Invalid Context ID");
Except.throw_exception("INPUT_ERROR", "Invalid Context ID",
"SnapArchiver.TriggerLaunchSnapShot");
Except.throw_exception("INPUT_ERROR", "Invalid Context ID", "SnapArchiver.TriggerLaunchSnapShot");
}
return insert(((SnapArchiver) (arg0)).trigger_launch_snap_shot(argin));
((SnapArchiver) arg0).trigger_launch_snap_shot(argin);
return insert();
// return insert(((SnapArchiver)
// (arg0)).trigger_launch_snap_shot(argin));
}
@Override
public boolean is_allowed(DeviceImpl device, Any data_in) {
return true;
}
......
......@@ -26,11 +26,12 @@ package SnapArchiver.grouplink;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.Hashtable;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.StringTokenizer;
import java.util.Vector;
import fr.esrf.Tango.DevFailed;
import fr.esrf.TangoApi.DeviceProxy;
......@@ -43,14 +44,14 @@ import fr.soleil.actiongroup.collectiveaction.onattributes.plugin.PersistencePlu
import fr.soleil.actiongroup.collectiveaction.onattributes.plugin.context.PluginContext;
import fr.soleil.snapArchivingApi.SnapshotingApi.persistence.SnapshotPersistenceManager;
import fr.soleil.snapArchivingApi.SnapshotingApi.persistence.context.SnapshotPersistenceContext;
import fr.soleil.snapArchivingApi.SnapshotingTools.Tools.SnapAttributeLight;
import fr.soleil.snapArchivingApi.SnapshotingTools.Tools.SnapAttributeExtract;
public class UsePluginBuilder {
private static final String TANGO_SEPARATOR = "/";
private Map<String, Integer> attributeIds;
private int snapId;
private SnapshotPersistenceManager manager;
private final int snapId;
private final SnapshotPersistenceManager manager;
public UsePluginBuilder(int _snapId, SnapshotPersistenceManager _manager) {
this.snapId = _snapId;
......@@ -59,31 +60,22 @@ public class UsePluginBuilder {
// public UsePlugin build ( List <INamedAttribute> attributeList ) throws
// DevFailed
public UsePlugin build(ArrayList attributeList) throws DevFailed {
Iterator it = attributeList.iterator();
attributeIds = new Hashtable<String, Integer>(attributeList.size());
public UsePlugin build(List<SnapAttributeExtract> attributeList) throws DevFailed {
attributeIds = new HashMap<String, Integer>(attributeList.size());
Map<String, Collection<String>> deviceToAttributes = new Hashtable<String, Collection<String>>();
// SORT ATTRIBUTES BY DEVICE
while (it.hasNext()) {
// SnapAttributeExtract nextAttribute = (SnapAttributeExtract)
// it.next ();
Object nextObject = it.next();
// System.out.println("UsePluginBuilder/build/nextObject/"+nextObject.getClass().toString());
SnapAttributeLight nextAttribute = (SnapAttributeLight) nextObject;
String completeName = nextAttribute.getAttribute_complete_name();
for (SnapAttributeExtract attribute : attributeList) {
String completeName = attribute.getAttribute_complete_name();
String[] parsedName = this.parseName(completeName);
int attributeId = nextAttribute.getAttribute_id();
int attributeId = attribute.getId_att();
attributeIds.put(completeName, attributeId);
String deviceName = parsedName[0];
String attributeName = parsedName[1];
Collection<String> attributesForThisDevice = deviceToAttributes
.get(deviceName);
Collection<String> attributesForThisDevice = deviceToAttributes.get(deviceName);
if (attributesForThisDevice == null) {
attributesForThisDevice = new Vector<String>();
attributesForThisDevice = new ArrayList<String>();
deviceToAttributes.put(deviceName, attributesForThisDevice);
}
attributesForThisDevice.add(attributeName);
......@@ -100,11 +92,11 @@ public class UsePluginBuilder {
while (it2.hasNext()) {
String nextDevice = it2.next();
try {
devices[i] = TargetFactory
.getTarget(new DeviceProxy(nextDevice));
System.out.println("snap device " + nextDevice);
devices[i] = TargetFactory.getTarget(new DeviceProxy(nextDevice));
Collection<String> attributesForThisDevice = deviceToAttributes
.get(nextDevice);
Collection<String> attributesForThisDevice = deviceToAttributes.get(nextDevice);
System.out.println("snap attributes " + attributesForThisDevice);
Iterator<String> it3 = attributesForThisDevice.iterator();
attributes[i] = new String[attributesForThisDevice.size()];
int j = 0;
......@@ -117,20 +109,16 @@ public class UsePluginBuilder {
i++;
} catch (DevFailed e) {
e.printStackTrace();
Util.out2.println(e.toString());
Util.out2.println("Failed to reach the device: " + nextDevice);
System.out.println("Failed to reach the device: " + nextDevice);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
UsePlugin ret = new UsePluginImpl(devices, attributes,
new PersistencePlugin());
UsePlugin ret = new UsePluginImpl(devices, attributes, new PersistencePlugin());
SnapshotPersistenceContext persistenceContext = new SnapshotPersistenceContext(
this.snapId, attributeIds);
SnapshotPersistenceContext persistenceContext = new SnapshotPersistenceContext(this.snapId, attributeIds);
persistenceContext.setManager(this.manager);
PluginContext context = new PluginContext();
context.setPersistenceContext(persistenceContext);
......@@ -139,8 +127,7 @@ public class UsePluginBuilder {
return ret;
}
private void traceDeviceToAttributes(
Hashtable<String, Collection<String>> deviceToAttributes) {
private void traceDeviceToAttributes(Hashtable<String, Collection<String>> deviceToAttributes) {
Iterator<String> keys = deviceToAttributes.keySet().iterator();
System.out.println("traceDeviceToAttributes VVVVVVVVVVVVVVVVVVVVVVV");
......@@ -148,8 +135,7 @@ public class UsePluginBuilder {
String nextDevice = keys.next();
System.out.println(" " + nextDevice + " VVVVVVVVVVVVVV");
Collection<String> attributesForThisDevice = deviceToAttributes
.get(nextDevice);
Collection<String> attributesForThisDevice = deviceToAttributes.get(nextDevice);
Iterator<String> attrs = attributesForThisDevice.iterator();
while (attrs.hasNext()) {
String nextAttr = attrs.next();
......
/**
*
*/
package SnapExtractor;
import java.util.Arrays;
import org.omg.CORBA.Any;
import fr.esrf.Tango.DevFailed;
import fr.esrf.Tango.DevState;
import fr.esrf.Tango.DispLevel;
import fr.esrf.TangoDs.Command;
import fr.esrf.TangoDs.DeviceImpl;
import fr.esrf.TangoDs.Except;
import fr.esrf.TangoDs.TangoConst;
/**
* @author AYADI
*
*/
public class GetSnapValuesClass extends Command implements TangoConst {
/**
* @param s
* @param in
* @param out
* @param level
*/
public GetSnapValuesClass(String s, int in, int out, DispLevel level) {
super(s, in, out, level);
// TODO Auto-generated constructor stub
}
/**
* @param s
* @param in
* @param out
* @param in_desc
* @param out_desc
* @param level
*/
public GetSnapValuesClass(String s, int in, int out, String in_desc, String out_desc, DispLevel level) {
super(s, in, out, in_desc, out_desc, level);
// TODO Auto-generated constructor stub
}
/**
* @param s
* @param in
* @param out
* @param in_desc
* @param out_desc
*/
public GetSnapValuesClass(String s, int in, int out, String in_desc, String out_desc) {
super(s, in, out, in_desc, out_desc);
// TODO Auto-generated constructor stub
}
public GetSnapValuesClass(String s, int in, int out) {
super(s, in, out);
// TODO Auto-generated constructor stub
}
/*
* (non-Javadoc)
*
* @see fr.esrf.TangoDs.Command#execute(fr.esrf.TangoDs.DeviceImpl,
* org.omg.CORBA.Any)
*/
@Override
public Any execute(DeviceImpl device, Any in_any) throws DevFailed {
String[] in = extract_DevVarStringArray(in_any);
int snapID = -1;
boolean readValues = true;
try {
snapID = Integer.parseInt(in[0]);
if (snapID < 0) {
Except.throw_exception("INPUT_ERROR", "Invalid Snapshot ID", "SnapExtractor.GetSnapValues");
}
readValues = Boolean.parseBoolean(in[1]);
} catch (Exception e) {
Except.throw_exception("INPUT_ERROR", "Invalid Snapshot ID or readValues", "SnapExtractor.GetSnapValues");
}
String[] attrNames = Arrays.copyOfRange(in, 2, in.length);
return insert(((SnapExtractor) device).getSnapValues(snapID, readValues, attrNames));
}
// ===============================================================
/**
* Check if it is allowed to execute the command.
*/
// ===============================================================
@Override
public boolean is_allowed(DeviceImpl device, Any data_in) {
if (device.get_state() == DevState.OFF || device.get_state() == DevState.INIT
|| device.get_state() == DevState.FAULT || device.get_state() == DevState.EXTRACT
|| device.get_state() == DevState.UNKNOWN) {
// End of Generated Code
// Re-Start of Generated Code
return false;
}
return true;
}
}
This diff is collapsed.
......@@ -63,7 +63,7 @@ public class SnapExtractorClass extends DeviceClass implements TangoConst {
/**
* Class properties array.
*/
private DbDatum[] cl_prop = null;
// private final DbDatum[] cl_prop = null;
// --------- Start of properties data members ----------
......@@ -130,41 +130,37 @@ public class SnapExtractorClass extends DeviceClass implements TangoConst {
// description : Create the command object(s) and store them in the
// command list
// ===================================================================
@Override
public void command_factory() {
command_list.addElement(new RemoveAllDynAttrClass("RemoveAllDynAttr",
Tango_DEV_VOID, Tango_DEV_VOID, "", "", DispLevel.EXPERT));
command_list.addElement(new RemoveAllDynAttrClass("RemoveAllDynAttr", Tango_DEV_VOID, Tango_DEV_VOID, "", "",
DispLevel.EXPERT));
command_list.addElement(new RemoveDynAttrsClass("RemoveDynAttrs",
Tango_DEVVAR_STRINGARRAY, Tango_DEV_VOID, "", "",
DispLevel.OPERATOR));
command_list.addElement(new RemoveDynAttrsClass("RemoveDynAttrs", Tango_DEVVAR_STRINGARRAY, Tango_DEV_VOID, "",
"", DispLevel.OPERATOR));
command_list.addElement(new GetSnapClass("GetSnap", Tango_DEV_LONG,
Tango_DEVVAR_STRINGARRAY, "snapID",
"[attrRealName, dynAttrNameW,dynAttrNameR]*n",
DispLevel.OPERATOR));
command_list.addElement(new GetSnapClass("GetSnap", Tango_DEV_LONG, Tango_DEVVAR_STRINGARRAY, "snapID",
"[attrRealName, dynAttrNameW,dynAttrNameR]*n", DispLevel.OPERATOR));
command_list.addElement(new GetSnapValueClass("GetSnapValue",
Tango_DEVVAR_STRINGARRAY, Tango_DEVVAR_STRINGARRAY,
"snapID and attribute name",
"Attribute's Read value and Write value", DispLevel.OPERATOR));
command_list.addElement(new GetSnapValueClass("GetSnapValue", Tango_DEVVAR_STRINGARRAY,
Tango_DEVVAR_STRINGARRAY, "snapID and attribute name", "Attribute's Read value and Write value",
DispLevel.OPERATOR));
command_list.addElement(new RemoveDynAttrClass("RemoveDynAttr",
Tango_DEV_STRING, Tango_DEV_VOID, "", "", DispLevel.OPERATOR));
command_list.addElement(new RemoveDynAttrClass("RemoveDynAttr", Tango_DEV_STRING, Tango_DEV_VOID, "", "",
DispLevel.OPERATOR));
command_list.addElement(new GetSnapsForContextClass(
"GetSnapsForContext", Tango_DEV_LONG,
command_list.addElement(new GetSnapsForContextClass("GetSnapsForContext", Tango_DEV_LONG,
Tango_DEVVAR_LONGSTRINGARRAY, "", "", DispLevel.OPERATOR));
command_list
.addElement(new GetSnapIDClass(
"GetSnapID",
Tango_DEVVAR_STRINGARRAY,
Tango_DEVVAR_LONGARRAY,
command_list.addElement(new GetSnapIDClass("GetSnapID", Tango_DEVVAR_STRINGARRAY, Tango_DEVVAR_LONGARRAY,
"ctx_id, criterion: \nSyntax: ctx_id, \"id_snap > | < | = | <= | >= nbr\",\n"
+ " \"time < | > | >= | <= yyyy-mm-dd hh:mm:ss | dd-mm-yyyy hh:mm:ss\","
+ "\n \"comment starts | ends | contains string\",\n first | last",
"list of snapshot_id", DispLevel.OPERATOR));
+ "\n \"comment starts | ends | contains string\",\n first | last", "list of snapshot_id",
DispLevel.OPERATOR));
command_list.addElement(new GetSnapValuesClass("GetSnapValues", Tango_DEVVAR_STRINGARRAY,
Tango_DEVVAR_STRINGARRAY, "snapID, true for read values or false for write values ,attribute names",
"Attribute's Read value and Write value", DispLevel.OPERATOR));
// add polling if any
for (int i = 0; i < command_list.size(); i++) {
......@@ -177,6 +173,7 @@ public class SnapExtractorClass extends DeviceClass implements TangoConst {
// Method: attribute_factory(Vector att_list)
//
// =============================================================================
@Override
public void attribute_factory(Vector att_list) throws DevFailed {
// Attribute : version
Attr version = new Attr("version", Tango_DEV_STRING, AttrWriteType.READ);
......@@ -193,25 +190,24 @@ public class SnapExtractorClass extends DeviceClass implements TangoConst {
// argument : in : String[] devlist : The device name list
//
// ===================================================================
@Override
public void device_factory(String[] devlist) throws DevFailed {
String device_version = ResourceBundle.getBundle("application")
.getString("project.version");
String device_version = ResourceBundle.getBundle("application").getString("project.version");
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 SnapExtractor(this, devlist[i],
device_version));
device_list.addElement(new SnapExtractor(this, devlist[i], device_version));
// Export device to the outside world
// ----------------------------------------------
if (Util._UseDb == true)
export_device(((DeviceImpl) (device_list.elementAt(i))));
else
export_device(((DeviceImpl) (device_list.elementAt(i))),
devlist[i]);
if (Util._UseDb == true) {
export_device(((DeviceImpl) device_list.elementAt(i)));
} else {
export_device(((DeviceImpl) device_list.elementAt(i)), devlist[i]);
}
}
}
......@@ -221,14 +217,17 @@ public class SnapExtractorClass extends DeviceClass implements TangoConst {
*
* @param name
* The property name.
* @throws DevFailed
*/
// ===================================================================
public DbDatum get_class_property(String name) {
for (int i = 0; i < cl_prop.length; i++)
if (cl_prop[i].name.equals(name))
return cl_prop[i];
// if not found, return an empty DbDatum
return new DbDatum(name);
public DbDatum get_class_property(String name) throws DevFailed {
// for (int i = 0; i < cl_prop.length; i++) {
// if (cl_prop[i].name.equals(name)) {
// return cl_prop[i];
// }
// }
DbDatum[] classProps = get_db_class().get_property(new String[] { name });
return classProps[0];
}
// ===================================================================
......@@ -242,14 +241,12 @@ public class SnapExtractorClass extends DeviceClass implements TangoConst {
// Read class properties from database.(Automatic code generation)
// -------------------------------------------------------------
if (Util._UseDb == false)
if (Util._UseDb == false) {
return;
String[] propnames = {};
}
// Call database and extract values
// --------------------------------------------
cl_prop = get_db_class().get_property(propnames);
int i = -1;
// End of Automatic code generation
// -------------------------------------------------------------
......@@ -264,8 +261,9 @@ public class SnapExtractorClass extends DeviceClass implements TangoConst {
private void write_class_property() throws DevFailed {
// First time, check if database used
// --------------------------------------------
if (Util._UseDb == false)
if (Util._UseDb == false) {
return;
}
// Prepeare DbDatum
// --------------------------------------------
......
......@@ -103,8 +103,7 @@ public class LaunchSnapShotCmd extends Command implements TangoConst {
* argout description
*/
// ===============================================================
public LaunchSnapShotCmd(String name, int in, int out, String in_comments,
String out_comments) {
public LaunchSnapShotCmd(String name, int in, int out, String in_comments, String out_comments) {
super(name, in, out, in_comments, out_comments);
}
......@@ -126,8 +125,7 @@ public class LaunchSnapShotCmd extends Command implements TangoConst {
* The command display type OPERATOR or EXPERT
*/
// ===============================================================
public LaunchSnapShotCmd(String name, int in, int out, String in_comments,
String out_comments, DispLevel level) {
public LaunchSnapShotCmd(String name, int in, int out, String in_comments, String out_comments, DispLevel level) {
super(name, in, out, in_comments, out_comments, level);
}
......@@ -136,15 +134,15 @@ public class LaunchSnapShotCmd extends Command implements TangoConst {
* return the result of the device's command.
*/
// ===============================================================
@Override
public Any execute(DeviceImpl device, Any in_any) throws DevFailed {
Util.out2.println("LaunchSnapShotCmd.execute(): arrived");
short argin = extract_DevShort(in_any);
if (argin < 0) {
Except.throw_exception("INPUT_ERROR", "Invalid Context ID",
"SnapManager.LaunchSnapshot");
Except.throw_exception("INPUT_ERROR", "Invalid Context ID", "SnapManager.LaunchSnapshot");
}
return insert(((SnapManager) (device)).launch_snap_shot(argin));
((SnapManager) device).launch_snap_shot(argin);
return insert();
}
// ===============================================================
......@@ -152,6 +150,7 @@ public class LaunchSnapShotCmd extends Command implements TangoConst {
* Check if it is allowed to execute the command.
*/
// ===============================================================
@Override
public boolean is_allowed(DeviceImpl device, Any data_in) {
// End of Generated Code
......
This diff is collapsed.
......@@ -66,6 +66,7 @@
package SnapManager;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
import java.util.Vector;
......@@ -78,6 +79,7 @@ import fr.esrf.TangoDs.Command;
import fr.esrf.TangoDs.DeviceClass;
import fr.esrf.TangoDs.DeviceImpl;
import fr.esrf.TangoDs.TangoConst;
import fr.esrf.TangoDs.TemplCommandInOut;
import fr.esrf.TangoDs.Util;
public class SnapManagerClass extends DeviceClass implements TangoConst {
......@@ -110,7 +112,7 @@ public class SnapManagerClass extends DeviceClass implements TangoConst {
/**
* Class properties array.
*/
private DbDatum[] cl_prop = null;
// private final DbDatum[] cl_prop = null;
// --------- Start of properties data members ----------
......@@ -177,18 +179,14 @@ public class SnapManagerClass extends DeviceClass implements TangoConst {
// description : Create the command object(s) and store them in the
// command list
// ===================================================================
@Override
public void command_factory() {
command_list
.addElement(new CreateNewContextClass(
"CreateNewContext",
Tango_DEVVAR_STRINGARRAY,
Tango_DEV_LONG,
"All the informations usefull to create a context ,Snapshot pattern).",
"The new assigned context ID", DispLevel.OPERATOR));
command_list.addElement(new SetEquipmentsWithSnapshotClass(
"SetEquipmentsWithSnapshot", Tango_DEVVAR_STRINGARRAY,
Tango_DEV_VOID, "The snapshot from which equipments are set.",
"", DispLevel.OPERATOR));
command_list.addElement(new CreateNewContextClass("CreateNewContext", Tango_DEVVAR_STRINGARRAY, Tango_DEV_LONG,
"All the informations usefull to create a context ,Snapshot pattern).", "The new assigned context ID",
DispLevel.OPERATOR));
command_list.addElement(new SetEquipmentsWithSnapshotClass("SetEquipmentsWithSnapshot",
Tango_DEVVAR_STRINGARRAY, Tango_DEV_VOID, "The snapshot from which equipments are set.", "",
DispLevel.OPERATOR));
command_list
.addElement(new SetEquipmentsWithCommandClass(
......@@ -203,19 +201,28 @@ public class SnapManagerClass extends DeviceClass implements TangoConst {
"SetEquipments",
Tango_DEVVAR_STRINGARRAY,
Tango_DEV_VOID,
"The attributes from which equipments are set.",
"SetEquipments arguments... <BR><blockquote> <ul> <li><strong>First Case:</strong> Setpoint is done on all the snapshot attributes <ul> <li><var>argin</var>[0]<b> =</b> the snap identifier<li><var>argin</var>[1]<b> =</b> STORED_READ_VALUE (Setpoint with theirs read values) or STORED_WRITE_VALUE (Setpoint with theirs write values)<br> </ul><li><strong>Second Case: </strong> Setpoint is done on a set of the snapshot attributes <ul> <li><var>argin</var>[0]<b> =</b> the snap identifier<li><var>argin</var>[1]<b> =</b> the number of attributes <br> Let us note <i>&quot;<var>index</var>&quot; </i>the last <var>index</var> used (for example, at this point, <i><var>index</var></i> = 2).<li><var>argin</var>[index]<b> =</b> NEW_VALUE or STORED_READ_VALUE or STORED_WRITE_VALUE<li><var>argin</var>[index+1]<b> =</b> the attribut name <li><var>argin</var>[index+2]<b> =</b> the value to set when NEW_VALUE is requested </ul> </blockquote>",
DispLevel.OPERATOR));
command_list.addElement(new UpdateSnapCommentClass("UpdateSnapComment",
Tango_DEVVAR_LONGSTRINGARRAY, Tango_DEV_VOID,
"1) snapshot identifier 2) The new comment", "",
"* First Case: Setpoint is done on all the snapshot attributes:\n"
+ " - argin[0]= the snap identifier\n"
+ " - argin[1]=STORED_READ_VALUE (Setpoint with theirs read values) or STORED_WRITE_VALUE (Setpoint with theirs write values)\n\n"
+ "* Second Case: Setpoint is done on a set of the snapshot attributes:\n "
+ " - argin[0]= the snap identifier\n" + " - argin[1]=the number of attributes.\n"
+ " Let us note index the last index used (for example, at this point,index = 2).\n"
+ " - argin[index]=NEW_VALUE or STORED_READ_VALUE or STORED_WRITE_VALUE\n"
+ " - argin[index+1]= the attribut name\n"
+ " - argin[index+2]= the value to set when NEW_VALUE is requested", "",
DispLevel.OPERATOR));
command_list.addElement(new UpdateSnapCommentClass("UpdateSnapComment", Tango_DEV_LONG, Tango_DEV_STRING,
"1) snapshot identifier 2) The new comment", "", DispLevel.OPERATOR));
// Modify LaunchSnapShot call from archiver to manager
command_list.addElement(new LaunchSnapShotCmd("LaunchSnapShot",
Tango_DEV_SHORT, Tango_DEV_SHORT,
"The snapshot associated context's identifier.", "",
DispLevel.OPERATOR));
command_list.addElement(new LaunchSnapShotCmd("LaunchSnapShot", Tango_DEV_SHORT, Tango_DEV_VOID,
"The snapshot associated context's identifier", "", DispLevel.OPERATOR));
command_list.addElement(new TemplCommandInOut("GetSnapShotResult", "getSnapShotResult",
"The snapshot associated context's identifier", "The new snapshot identifier", DispLevel.OPERATOR));
command_list.addElement(new TemplCommandInOut("GetSnapShotComment", "getSnapComment", "The snapshot id",
"The comment", DispLevel.OPERATOR));
// add polling if any
for (int i = 0; i < command_list.size(); i++) {
......@@ -228,6 +235,7 @@ public class SnapManagerClass extends DeviceClass implements TangoConst {
// Method: attribute_factory(Vector att_list)
//
// =============================================================================
@Override
public void attribute_factory(Vector att_list) throws DevFailed {
// Attribute : version
Attr version = new Attr("version", Tango_DEV_STRING, AttrWriteType.READ);
......@@ -244,25 +252,28 @@ public class SnapManagerClass extends DeviceClass implements TangoConst {
// argument : in : String[] devlist : The device name list
//
// ===================================================================
@Override
public void device_factory(String[] devlist) throws DevFailed {
String device_version = ResourceBundle.getBundle("application")
.getString("project.version");
String device_version = "unkown";
try {
device_version = ResourceBundle.getBundle("application").getString("project.version");
} catch (MissingResourceException e) {
}
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 SnapManager(this, devlist[i],
device_version));
device_list.addElement(new SnapManager(this, devlist[i], device_version));
// Export device to the outside world
// ----------------------------------------------
if (Util._UseDb == true)
export_device(((DeviceImpl) (device_list.elementAt(i))));
else
export_device(((DeviceImpl) (device_list.elementAt(i))),
devlist[i]);
if (Util._UseDb == true) {
export_device(((DeviceImpl) device_list.elementAt(i)));
} else {
export_device(((DeviceImpl) device_list.elementAt(i)), devlist[i]);
}
}
}
......@@ -272,14 +283,18 @@ public class SnapManagerClass extends DeviceClass implements TangoConst {
*
* @param name
* The property name.
* @throws DevFailed
*/
// ===================================================================
public DbDatum get_class_property(String name) {
for (int i = 0; i < cl_prop.length; i++)
if (cl_prop[i].name.equals(name))
return cl_prop[i];
// if not found, return an empty DbDatum
return new DbDatum(name);
public DbDatum get_class_property(String name) throws DevFailed {
// for (int i = 0; i < cl_prop.length; i++) {
// if (cl_prop[i].name.equals(name)) {
// return cl_prop[i];
// }
// }
DbDatum[] classProps = get_db_class().get_property(new String[] { name });
return classProps[0];
}
// ===================================================================
......@@ -307,31 +322,29 @@ public class SnapManagerClass extends DeviceClass implements TangoConst {
// -------------------------------------------------------------
// -------------------------------------------------------------
if (Util._UseDb == false)
return;
String[] propnames = { "DbHost", "DbName", "DbSchema" };
// Call database and extract values
// --------------------------------------------
cl_prop = get_db_class().get_property(propnames);
int i = -1;
// Extract DbHost value
if (cl_prop[++i].is_empty() == false)
dbHost = cl_prop[i].extractString();
else
cl_prop[i].insert(dbHost);
// Extract DbName value
if (cl_prop[++i].is_empty() == false)
dbName = cl_prop[i].extractString();
else
cl_prop[i].insert(dbName);
// Extract DbSchema value
if (cl_prop[++i].is_empty() == false)
dbSchema = cl_prop[i].extractString();
else
cl_prop[i].insert(dbSchema);
// if (Util._UseDb == false) {
// return;
// }
// String[] propnames = { "DbHost", "DbName", "DbSchema" };
//
// // Call database and extract values
// // --------------------------------------------
// cl_prop = get_db_class().get_property(propnames);
// int i = -1;
// // Extract DbHost value
// if (cl_prop[++i].is_empty() == false) {
// dbHost = cl_prop[i].extractString();
// }
//
// // Extract DbName value
// if (cl_prop[++i].is_empty() == false) {
// dbName = cl_prop[i].extractString();
// }
//
// // Extract DbSchema value
// if (cl_prop[++i].is_empty() == false) {
// dbSchema = cl_prop[i].extractString();
// }
// End of Automatic code generation
// -------------------------------------------------------------
......@@ -346,8 +359,9 @@ public class SnapManagerClass extends DeviceClass implements TangoConst {
private void write_class_property() throws DevFailed {
// First time, check if database used
// --------------------------------------------
if (Util._UseDb == false)
if (Util._UseDb == false) {
return;
}
// Prepeare DbDatum
// --------------------------------------------
......@@ -356,8 +370,7 @@ public class SnapManagerClass extends DeviceClass implements TangoConst {
data[0].insert("Tango Device Server");
data[1] = new DbDatum("Description");
data[1]
.insert("This DServer provides the connections points and methods to the SnapShot service.");
data[1].insert("This DServer provides the connections points and methods to the SnapShot service.");
// Call database and and values
// --------------------------------------------
......
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.0.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd">
<!-- DATASOURCE DEFINITION VVVVVVV-->
<bean id="dataSource"
class="org.apache.commons.dbcp.BasicDataSource"
destroy-method="close">
<property name="initialSize" value="8"/>
<property name="maxActive" value="4"/>
<property name="maxIdle" value="8"/>
<property name="driverClassName" value="com.mysql.jdbc.Driver" />
<property name="url" value="jdbc:mysql://localhost/snap?autoReconnect=true" />
<property name="username" value="snaparchiver" />
<property name="password" value="snaparchiver" />
</bean>
<!-- DATASOURCE DEFINITION ^^^^^^-->
<!-- HIBERNATE DEFINITION VVVVVVV-->
<bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource" ref="dataSource"/>
<property name="mappingResources">
<list>
<value>valueTables.hbm.xml</value>
</list>
</property>
<property name="hibernateProperties">
<value>
hibernate.dialect=org.hibernate.dialect.MySQL5Dialect
hibernate.show_sql=true
hibernate.format_sql=true
hibernate.transaction.factory_class=org.hibernate.transaction.JDBCTransactionFactory
hibernate.current_session_context_class=thread
hibernate.connection.autocommit=false
hibernate.connection.release_mode=after_transaction
hibernate.generate_statistics=true
</value>
</property>
</bean>
<!-- HIBERNATE DEFINITION ^^^^^^-->
<!-- TRANSACTIONS DEFINITIONS VVVVVVV-->
<!-- MANAGER -->
<bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory" ref="sessionFactory"/>
</bean>
<!-- DEFINES AN "ADVICE" IE. A WAY TO USE THE TRANSACTION MANAGER AROUND METHODS -->
<tx:advice id="txAdvice" transaction-manager="transactionManager"><!-- the transactional advice (i.e. what 'happens'; see the <aop:advisor/> bean below) -->
<tx:attributes><!-- the transactional semantics... -->
<tx:method name="findBy*" read-only="true"/><!-- all methods starting with 'get' are read-only -->
<tx:method name="*"/><!-- other methods use the default transaction settings -->
</tx:attributes>
</tx:advice>
<!-- DEFINES WHERE "ADVICES" WILL BE USED-->
<aop:config><!-- ensure that the above transactional advice runs for any execution of an operation defined by the FooService interface -->
<aop:pointcut id="valDAOOperation" expression="execution(* fr.soleil.snapArchivingApi.SnapshotingApi.persistence.spring.dao.ValDAO.*(..))"/>
<aop:advisor advice-ref="txAdvice" pointcut-ref="valDAOOperation"/>
</aop:config>
<!-- TRANSACTIONS DEFINITIONS ^^^^^^-->
<!-- DAO BEANS DEFINITION VVVVVVV-->
<bean id="scNum1ValDAO" class="fr.soleil.snapArchivingApi.SnapshotingApi.persistence.spring.dao.ScNum1ValDAOImpl">
<constructor-arg ref="sessionFactory" />
</bean>
<bean id="scNum2ValDAO" class="fr.soleil.snapArchivingApi.SnapshotingApi.persistence.spring.dao.ScNum2ValDAOImpl">
<constructor-arg ref="sessionFactory" />
</bean>
<bean id="scStr1ValDAO" class="fr.soleil.snapArchivingApi.SnapshotingApi.persistence.spring.dao.ScStr1ValDAOImpl">
<constructor-arg ref="sessionFactory" />
</bean>
<bean id="scStr2ValDAO" class="fr.soleil.snapArchivingApi.SnapshotingApi.persistence.spring.dao.ScStr2ValDAOImpl">
<constructor-arg ref="sessionFactory" />
</bean>
<bean id="sp1ValDAO" class="fr.soleil.snapArchivingApi.SnapshotingApi.persistence.spring.dao.Sp1ValDAOImpl">
<constructor-arg ref="sessionFactory" />
</bean>
<bean id="sp2ValDAO" class="fr.soleil.snapArchivingApi.SnapshotingApi.persistence.spring.dao.Sp2ValDAOImpl">
<constructor-arg ref="sessionFactory" />
</bean>
<bean id="im1ValDAO" class="fr.soleil.snapArchivingApi.SnapshotingApi.persistence.spring.dao.Im1ValDAOImpl">
<constructor-arg ref="sessionFactory" />
</bean>
<bean id="im2ValDAO" class="fr.soleil.snapArchivingApi.SnapshotingApi.persistence.spring.dao.Im2ValDAOImpl">
<constructor-arg ref="sessionFactory" />
</bean>
<!-- DAO BEANS DEFINITION ^^^^^^-->
</beans>
\ No newline at end of file
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.0.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd">
<!-- DATASOURCE DEFINITION VVVVVVV-->
<bean id="dataSource"
class="org.apache.commons.dbcp.BasicDataSource"
destroy-method="close">
<property name="initialSize" value="8"/>
<property name="maxActive" value="4"/>
<property name="maxIdle" value="8"/>
<property name="driverClassName" value="com.mysql.jdbc.Driver" />
<property name="url" value="jdbc:mysql://srv1/snap?autoReconnect=true" />
<property name="username" value="snaparchiver" />
<property name="password" value="snaparchiver" />
</bean>
<!-- DATASOURCE DEFINITION ^^^^^^-->
<!-- HIBERNATE DEFINITION VVVVVVV-->
<bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource" ref="dataSource"/>
<property name="mappingResources">
<list>
<value>valueTables.hbm.xml</value>
</list>
</property>
<property name="hibernateProperties">
<value>
hibernate.dialect=org.hibernate.dialect.MySQL5Dialect
hibernate.show_sql=true
hibernate.format_sql=true
hibernate.transaction.factory_class=org.hibernate.transaction.JDBCTransactionFactory
hibernate.current_session_context_class=thread
hibernate.connection.autocommit=false
hibernate.connection.release_mode=after_transaction
hibernate.generate_statistics=true
</value>
</property>
</bean>
<!-- HIBERNATE DEFINITION ^^^^^^-->
<!-- TRANSACTIONS DEFINITIONS VVVVVVV-->
<!-- MANAGER -->
<bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory" ref="sessionFactory"/>
</bean>
<!-- DEFINES AN "ADVICE" IE. A WAY TO USE THE TRANSACTION MANAGER AROUND METHODS -->
<tx:advice id="txAdvice" transaction-manager="transactionManager"><!-- the transactional advice (i.e. what 'happens'; see the <aop:advisor/> bean below) -->
<tx:attributes><!-- the transactional semantics... -->
<tx:method name="findBy*" read-only="true"/><!-- all methods starting with 'get' are read-only -->
<tx:method name="*"/><!-- other methods use the default transaction settings -->
</tx:attributes>
</tx:advice>
<!-- DEFINES WHERE "ADVICES" WILL BE USED-->
<aop:config><!-- ensure that the above transactional advice runs for any execution of an operation defined by the FooService interface -->
<aop:pointcut id="valDAOOperation" expression="execution(* fr.soleil.snapArchivingApi.SnapshotingApi.persistence.spring.dao.ValDAO.*(..))"/>
<aop:advisor advice-ref="txAdvice" pointcut-ref="valDAOOperation"/>
</aop:config>
<!-- TRANSACTIONS DEFINITIONS ^^^^^^-->
<!-- DAO BEANS DEFINITION VVVVVVV-->
<bean id="scNum1ValDAO" class="fr.soleil.snapArchivingApi.SnapshotingApi.persistence.spring.dao.ScNum1ValDAOImpl">
<constructor-arg ref="sessionFactory" />
</bean>
<bean id="scNum2ValDAO" class="fr.soleil.snapArchivingApi.SnapshotingApi.persistence.spring.dao.ScNum2ValDAOImpl">
<constructor-arg ref="sessionFactory" />
</bean>
<bean id="scStr1ValDAO" class="fr.soleil.snapArchivingApi.SnapshotingApi.persistence.spring.dao.ScStr1ValDAOImpl">
<constructor-arg ref="sessionFactory" />
</bean>
<bean id="scStr2ValDAO" class="fr.soleil.snapArchivingApi.SnapshotingApi.persistence.spring.dao.ScStr2ValDAOImpl">
<constructor-arg ref="sessionFactory" />
</bean>
<bean id="sp1ValDAO" class="fr.soleil.snapArchivingApi.SnapshotingApi.persistence.spring.dao.Sp1ValDAOImpl">
<constructor-arg ref="sessionFactory" />
</bean>
<bean id="sp2ValDAO" class="fr.soleil.snapArchivingApi.SnapshotingApi.persistence.spring.dao.Sp2ValDAOImpl">
<constructor-arg ref="sessionFactory" />
</bean>
<bean id="im1ValDAO" class="fr.soleil.snapArchivingApi.SnapshotingApi.persistence.spring.dao.Im1ValDAOImpl">
<constructor-arg ref="sessionFactory" />
</bean>
<bean id="im2ValDAO" class="fr.soleil.snapArchivingApi.SnapshotingApi.persistence.spring.dao.Im2ValDAOImpl">
<constructor-arg ref="sessionFactory" />
</bean>
<!-- DAO BEANS DEFINITION ^^^^^^-->
</beans>
\ No newline at end of file
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.0.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd">
<!-- DATASOURCE DEFINITION VVVVVVV-->
<bean id="dataSource"
class="org.apache.commons.dbcp.BasicDataSource"
destroy-method="close">
<property name="initialSize" value="2"/>
<property name="maxActive" value="5"/>
<property name="maxIdle" value="2"/>
<property name="driverClassName" value="oracle.jdbc.driver.OracleDriver" />
<property name="url" value="jdbc:oracle:thin:@PHOBOS:1521:TEST" />
<property name="username" value="SNAP" />
<property name="password" value="SNAP" />
</bean>
<!-- DATASOURCE DEFINITION ^^^^^^-->
<!-- HIBERNATE DEFINITION VVVVVVV-->
<bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource" ref="dataSource"/>
<property name="mappingResources">
<list>
<value>valueTables.hbm.xml</value>
</list>
</property>
<property name="hibernateProperties">
<value>
hibernate.dialect=org.hibernate.dialect.Oracle9Dialect
hibernate.show_sql=true
hibernate.format_sql=true
hibernate.transaction.factory_class=org.hibernate.transaction.JDBCTransactionFactory
hibernate.current_session_context_class=thread
hibernate.connection.autocommit=false
hibernate.generate_statistics=true
</value>
</property>
</bean>
<!-- HIBERNATE DEFINITION ^^^^^^-->
<!-- TRANSACTIONS DEFINITIONS VVVVVVV-->
<!-- MANAGER -->
<bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory" ref="sessionFactory"/>
</bean>
<!-- DEFINES AN "ADVICE" IE. A WAY TO USE THE TRANSACTION MANAGER AROUND METHODS -->
<tx:advice id="txAdvice" transaction-manager="transactionManager"><!-- the transactional advice (i.e. what 'happens'; see the <aop:advisor/> bean below) -->
<tx:attributes><!-- the transactional semantics... -->
<tx:method name="findBy*" read-only="true"/><!-- all methods starting with 'get' are read-only -->
<tx:method name="*"/><!-- other methods use the default transaction settings (see below) -->
</tx:attributes>
</tx:advice>
<!-- DEFINES WHERE "ADVICES" WILL BE USED-->
<aop:config><!-- ensure that the above transactional advice runs for any execution of an operation defined by the FooService interface -->
<aop:pointcut id="valDAOOperation" expression="execution(* fr.soleil.snapArchivingApi.SnapshotingApi.persistence.spring.dao.ValDAO.*(..))"/>
<aop:advisor advice-ref="txAdvice" pointcut-ref="valDAOOperation"/>
</aop:config>
<!-- TRANSACTIONS DEFINITIONS ^^^^^^-->
<!-- DAO BEANS DEFINITION VVVVVVV-->
<bean id="scNum1ValDAO" class="fr.soleil.snapArchivingApi.SnapshotingApi.persistence.spring.dao.ScNum1ValDAOImpl">
<constructor-arg ref="sessionFactory" />
</bean>
<bean id="scNum2ValDAO" class="fr.soleil.snapArchivingApi.SnapshotingApi.persistence.spring.dao.ScNum2ValDAOImpl">
<constructor-arg ref="sessionFactory" />
</bean>
<bean id="scStr1ValDAO" class="fr.soleil.snapArchivingApi.SnapshotingApi.persistence.spring.dao.ScStr1ValDAOImpl">
<constructor-arg ref="sessionFactory" />
</bean>
<bean id="scStr2ValDAO" class="fr.soleil.snapArchivingApi.SnapshotingApi.persistence.spring.dao.ScStr2ValDAOImpl">
<constructor-arg ref="sessionFactory" />
</bean>
<bean id="sp1ValDAO" class="fr.soleil.snapArchivingApi.SnapshotingApi.persistence.spring.dao.Sp1ValDAOImpl">
<constructor-arg ref="sessionFactory" />
</bean>
<bean id="sp2ValDAO" class="fr.soleil.snapArchivingApi.SnapshotingApi.persistence.spring.dao.Sp2ValDAOImpl">
<constructor-arg ref="sessionFactory" />
</bean>
<bean id="im1ValDAO" class="fr.soleil.snapArchivingApi.SnapshotingApi.persistence.spring.dao.Im1ValDAOImpl">
<constructor-arg ref="sessionFactory" />
</bean>
<bean id="im2ValDAO" class="fr.soleil.snapArchivingApi.SnapshotingApi.persistence.spring.dao.Im2ValDAOImpl">
<constructor-arg ref="sessionFactory" />
</bean>
<!-- DAO BEANS DEFINITION ^^^^^^-->
</beans>
\ No newline at end of file
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.0.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd">
<!-- DATASOURCE DEFINITION VVVVVVV-->
<bean id="dataSource"
class="org.apache.commons.dbcp.BasicDataSource"
destroy-method="close">
<property name="initialSize" value="2"/>
<property name="maxActive" value="5"/>
<property name="maxIdle" value="2"/>
<property name="driverClassName" value="oracle.jdbc.driver.OracleDriver" />
<property name="url" value="jdbc:oracle:thin:@foo:1521:SNAP" />
<property name="username" value="snaparchiver" />
<property name="password" value="snaparchiver" />
</bean>
<!-- DATASOURCE DEFINITION ^^^^^^-->
<!-- HIBERNATE DEFINITION VVVVVVV-->
<bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource" ref="dataSource"/>
<property name="mappingResources">
<list>
<value>valueTables.hbm.xml</value>
</list>
</property>
<property name="hibernateProperties">
<value>
hibernate.dialect=org.hibernate.dialect.Oracle10gDialect
hibernate.default_schema=SNAP
hibernate.show_sql=true
hibernate.format_sql=true
hibernate.transaction.factory_class=org.hibernate.transaction.JDBCTransactionFactory
hibernate.current_session_context_class=thread
hibernate.connection.autocommit=false
hibernate.generate_statistics=true
</value>
</property>
</bean>
<!-- HIBERNATE DEFINITION ^^^^^^-->
<!-- TRANSACTIONS DEFINITIONS VVVVVVV-->
<!-- MANAGER -->
<bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory" ref="sessionFactory"/>
</bean>
<!-- DEFINES AN "ADVICE" IE. A WAY TO USE THE TRANSACTION MANAGER AROUND METHODS -->
<tx:advice id="txAdvice" transaction-manager="transactionManager"><!-- the transactional advice (i.e. what 'happens'; see the <aop:advisor/> bean below) -->
<tx:attributes><!-- the transactional semantics... -->
<tx:method name="findBy*" read-only="true"/><!-- all methods starting with 'get' are read-only -->
<tx:method name="*"/><!-- other methods use the default transaction settings (see below) -->
</tx:attributes>
</tx:advice>
<!-- DEFINES WHERE "ADVICES" WILL BE USED-->
<aop:config><!-- ensure that the above transactional advice runs for any execution of an operation defined by the FooService interface -->
<aop:pointcut id="valDAOOperation" expression="execution(* fr.soleil.snapArchivingApi.SnapshotingApi.persistence.spring.dao.ValDAO.*(..))"/>
<aop:advisor advice-ref="txAdvice" pointcut-ref="valDAOOperation"/>
</aop:config>
<!-- TRANSACTIONS DEFINITIONS ^^^^^^-->
<!-- DAO BEANS DEFINITION VVVVVVV-->
<bean id="scNum1ValDAO" class="fr.soleil.snapArchivingApi.SnapshotingApi.persistence.spring.dao.ScNum1ValDAOImpl">
<constructor-arg ref="sessionFactory" />
</bean>
<bean id="scNum2ValDAO" class="fr.soleil.snapArchivingApi.SnapshotingApi.persistence.spring.dao.ScNum2ValDAOImpl">
<constructor-arg ref="sessionFactory" />
</bean>
<bean id="scStr1ValDAO" class="fr.soleil.snapArchivingApi.SnapshotingApi.persistence.spring.dao.ScStr1ValDAOImpl">
<constructor-arg ref="sessionFactory" />
</bean>
<bean id="scStr2ValDAO" class="fr.soleil.snapArchivingApi.SnapshotingApi.persistence.spring.dao.ScStr2ValDAOImpl">
<constructor-arg ref="sessionFactory" />
</bean>
<bean id="sp1ValDAO" class="fr.soleil.snapArchivingApi.SnapshotingApi.persistence.spring.dao.Sp1ValDAOImpl">
<constructor-arg ref="sessionFactory" />
</bean>
<bean id="sp2ValDAO" class="fr.soleil.snapArchivingApi.SnapshotingApi.persistence.spring.dao.Sp2ValDAOImpl">
<constructor-arg ref="sessionFactory" />
</bean>
<bean id="im1ValDAO" class="fr.soleil.snapArchivingApi.SnapshotingApi.persistence.spring.dao.Im1ValDAOImpl">
<constructor-arg ref="sessionFactory" />
</bean>
<bean id="im2ValDAO" class="fr.soleil.snapArchivingApi.SnapshotingApi.persistence.spring.dao.Im2ValDAOImpl">
<constructor-arg ref="sessionFactory" />
</bean>
<!-- DAO BEANS DEFINITION ^^^^^^-->
</beans>
\ No newline at end of file
......@@ -16,9 +16,9 @@
<property name="maxIdle" value="2"/>
<property name="driverClassName" value="oracle.jdbc.driver.OracleDriver" />
<property name="url" value="jdbc:oracle:thin:@ORION:1521:TEST" />
<property name="username" value="snap" />
<property name="password" value="snap" />
<property name="url" value="jdbc:oracle:thin:@ORION:1521:TEST3" />
<property name="username" value="toto" />
<property name="password" value="toto" />
</bean>
<!-- DATASOURCE DEFINITION ^^^^^^-->
......@@ -34,7 +34,7 @@
<property name="hibernateProperties">
<value>
hibernate.dialect=org.hibernate.dialect.Oracle9Dialect
hibernate.dialect=org.hibernate.dialect.Oracle10gDialect
hibernate.show_sql=true
hibernate.format_sql=true
hibernate.transaction.factory_class=org.hibernate.transaction.JDBCTransactionFactory
......
#définition du niveau et des Appender du rootLogger
log4j.rootLogger=INFO, monAppender
log4j.jacorb=ERROR
#configuration de "monAppender"
#nous allons envoyer les messages dans la console de Tomcat
log4j.appender.monAppender=org.apache.log4j.ConsoleAppender
......@@ -10,4 +10,4 @@ log4j.appender.monAppender.layout=org.apache.log4j.PatternLayout
#définition du pattern d'affichage pour "monAppender"
#voici un exemple de sortie que l'on va obtenir : 2005-06-18 14:53:37 DEBUG [Main] Hello World
log4j.appender.monAppender.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p [%c{1}] %m%n
\ No newline at end of file
log4j.appender.monAppender.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %C %-5p [%c{1}] %m%n
\ No newline at end of file
package SnapArchiver;
import junit.framework.TestCase;
import org.junit.Ignore;
import org.junit.Test;
import fr.esrf.Tango.DevFailed;
import fr.esrf.Tango.ErrSeverity;
import fr.esrf.TangoApi.DeviceData;
import fr.esrf.TangoApi.DeviceProxy;
public class SnapArchiverTest extends TestCase {
@Ignore
public class SnapArchiverTest {
@Test
private short testTriggerLaunchSnap(DeviceProxy deviceProxy, short ctx) {
DeviceData device_data = null;
DeviceData device_data_out = null;
......@@ -15,30 +19,23 @@ public class SnapArchiverTest extends TestCase {
try {
device_data = new DeviceData();
device_data.insert(ctx);
device_data_out = deviceProxy.command_inout(
"TriggerLaunchSnapShot", device_data);
device_data_out = deviceProxy.command_inout("TriggerLaunchSnapShot", device_data);
snapId = device_data_out.extractShort();
device_data = null;
} catch (DevFailed e) {
StringBuffer buffer = new StringBuffer(
"ERROR DevFailed : argin ctx = " + ctx + "\n");
StringBuffer buffer = new StringBuffer("ERROR DevFailed : argin ctx = " + ctx + "\n");
for (int i = 0; i < e.errors.length; i++) {
buffer.append("Error Level " + i + ":\n");
buffer.append("\t - desc: " + e.errors[i].desc.toString()
+ "\n");
buffer.append("\t - origin: " + e.errors[i].origin.toString()
+ "\n");
buffer.append("\t - reason: " + e.errors[i].reason.toString()
+ "\n");
buffer.append("\t - desc: " + e.errors[i].desc.toString() + "\n");
buffer.append("\t - origin: " + e.errors[i].origin.toString() + "\n");
buffer.append("\t - reason: " + e.errors[i].reason.toString() + "\n");
String sev = "";
if (e.errors[i].severity.value() == ErrSeverity.ERR.value()) {
sev = "ERROR";
} else if (e.errors[i].severity.value() == ErrSeverity.PANIC
.value()) {
} else if (e.errors[i].severity.value() == ErrSeverity.PANIC.value()) {
sev = "PANIC";
} else if (e.errors[i].severity.value() == ErrSeverity.WARN
.value()) {
} else if (e.errors[i].severity.value() == ErrSeverity.WARN.value()) {
sev = "WARN";
}
buffer.append("\t - severity: " + sev + "\n");
......@@ -52,10 +49,10 @@ public class SnapArchiverTest extends TestCase {
return snapId;
}
@Test
public void testTriggerLaunchSnapShot() {
try {
DeviceProxy deviceProxy = new DeviceProxy(
"archiving/snap/snaparchiver.1");
DeviceProxy deviceProxy = new DeviceProxy("archiving/snap/snaparchiver.1");
short snapId;
short ctx = -1;
// Un exception doit tre leve
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment