diff --git a/formersnapextractor/pom.xml b/formersnapextractor/pom.xml deleted file mode 100644 index 4c2a5ac12d66031656efba6c8bc11479197d3fa1..0000000000000000000000000000000000000000 --- a/formersnapextractor/pom.xml +++ /dev/null @@ -1,67 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd" -> - <modelVersion>4.0.0</modelVersion> - <parent> - <groupId>fr.soleil.deviceservers</groupId> - <artifactId>snaparchivingservers</artifactId> - <version>1.7.14-SNAPSHOT</version> - </parent> - - <artifactId>formersnapextractor</artifactId> - - <name>Former SnapExtractor</name> - <description>Former implementation of SnapExtractor device</description> - <scm> - <connection> - scm:svn:${scm.connection.svn.tango-cs}:archiving/server/snapArchivingServers/formersnapextractor - </connection> - <developerConnection> - scm:svn:${scm.developerConnection.svn.tango-cs}:archiving/server/snapArchivingServers/formersnapextractor - </developerConnection> - <url>${scm.url.svn.tango-cs}/archiving/server/snapArchivingServers/formersnapextractor</url> - </scm> - <build> - <plugins> - <plugin> - <artifactId>maven-resources-plugin</artifactId> - <configuration> - <encoding>UTF-8</encoding> - </configuration> - </plugin> - <plugin> - <artifactId>maven-compiler-plugin</artifactId> - <configuration> - <encoding>UTF-8</encoding> - </configuration> - </plugin> - </plugins> - </build> - <dependencies> - <dependency> - <groupId>org.tango</groupId> - <artifactId>TangORB</artifactId> - </dependency> - <dependency> - <groupId>fr.soleil.lib</groupId> - <artifactId>snapArchivingApi</artifactId> - </dependency> - <dependency> - <groupId>org.tango</groupId> - <artifactId>JTangoClientLang</artifactId> - </dependency> - <dependency> - <groupId>org.slf4j</groupId> - <artifactId>slf4j-log4j12</artifactId> - </dependency> - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <scope>test</scope> - </dependency> - </dependencies> - <properties> - <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> - </properties> -</project> \ No newline at end of file diff --git a/formersnapextractor/src/main/java/SnapExtractor/GetSnapClass.java b/formersnapextractor/src/main/java/SnapExtractor/GetSnapClass.java deleted file mode 100644 index 4da493e5d77b67170f07b82e3a25f73dc173cb05..0000000000000000000000000000000000000000 --- a/formersnapextractor/src/main/java/SnapExtractor/GetSnapClass.java +++ /dev/null @@ -1,154 +0,0 @@ -// +====================================================================== -// $Source: /cvsroot/tango-cs/tango/jserver/snapshoting/SnapExtractor/GetSnapClass.java,v $ -// -// Project: Tango Device Server -// -// Description: Java source code for the command TemplateClass of the -// SnapExtractor class. -// -// $Author: ounsy $ -// -// $Revision: 1.1 $ -// -// $Log: GetSnapClass.java,v $ -// Revision 1.1 2006/02/07 13:03:52 ounsy -// moved from the Archiving package -// -// Revision 1.1 2006/01/27 14:39:14 ounsy -// new device for snap extracting -// -// -// copyleft : European Synchrotron Radiation Facility -// BP 220, Grenoble 38043 -// FRANCE -// -//-====================================================================== -// -// This file is generated by POGO -// (Program Obviously used to Generate tango Object) -// -// (c) - Software Engineering Group - ESRF -//============================================================================= - -/** - * @author $Author: ounsy $ - * @version $Revision: 1.1 $ - */ -package SnapExtractor; - -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; -import fr.esrf.TangoDs.Util; - -/** - * Class Description: - * - */ - -public class GetSnapClass extends Command implements TangoConst { - // =============================================================== - /** - * Constructor for Command class GetSnapClass - * - * @param name - * command name - * @param in - * argin type - * @param out - * argout type - */ - // =============================================================== - public GetSnapClass(String name, int in, int out) { - super(name, in, out); - } - - // =============================================================== - /** - * Constructor for Command class GetSnapClass - * - * @param name - * command name - * @param in - * argin type - * @param in_comments - * argin description - * @param out - * argout type - * @param out_comments - * argout description - */ - // =============================================================== - public GetSnapClass(String name, int in, int out, String in_comments, String out_comments) { - super(name, in, out, in_comments, out_comments); - } - - // =============================================================== - /** - * Constructor for Command class GetSnapClass - * - * @param name - * command name - * @param in - * argin type - * @param in_comments - * argin description - * @param out - * argout type - * @param out_comments - * argout description - * @param level - * The command display type OPERATOR or EXPERT - */ - // =============================================================== - public GetSnapClass(String name, int in, int out, String in_comments, String out_comments, DispLevel level) { - super(name, in, out, in_comments, out_comments, level); - } - - // =============================================================== - /** - * return the result of the device's command. - */ - // =============================================================== - @Override - public Any execute(DeviceImpl device, Any in_any) throws DevFailed { - Util.out2.println("GetSnapClass.execute(): arrived"); - int argin = extract_DevLong(in_any); - if (argin < 0) { - Except.throw_exception("INPUT_ERROR", "Invalid Snapshot ID", "SnapExtractor.GetSnap"); - - } - return insert(((SnapExtractor) (device)).get_snap(argin)); - - } - - // =============================================================== - /** - * 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; - } -} -// ----------------------------------------------------------------------------- -/* - * end of $Source: - * /cvsroot/tango-cs/tango/jserver/snapshoting/SnapExtractor/GetSnapClass.java,v - * $ - */ diff --git a/formersnapextractor/src/main/java/SnapExtractor/GetSnapIDClass.java b/formersnapextractor/src/main/java/SnapExtractor/GetSnapIDClass.java deleted file mode 100644 index 1cafb9616560126d2babc3e2d8725b972c41f57c..0000000000000000000000000000000000000000 --- a/formersnapextractor/src/main/java/SnapExtractor/GetSnapIDClass.java +++ /dev/null @@ -1,103 +0,0 @@ -/** - * - */ -package SnapExtractor; - -import org.omg.CORBA.Any; - -import fr.esrf.Tango.DevFailed; -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; -import fr.esrf.TangoDs.Util; - -/** - * @author AYADI - * - */ -public class GetSnapIDClass extends Command implements TangoConst { - - /** - * @param s - * @param in - * @param out - */ - public GetSnapIDClass(String s, int in, int out) { - super(s, in, out); - // TODO Auto-generated constructor stub - } - - /** - * @param s - * @param in - * @param out - * @param level - */ - public GetSnapIDClass(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 - */ - public GetSnapIDClass(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 - } - - /** - * @param s - * @param in - * @param out - * @param in_desc - * @param out_desc - * @param level - */ - public GetSnapIDClass(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 - } - - /* - * (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 { - // TODO Auto-generated method stub - Util.out2.println("GetSnapIDClass.execute(): arrived"); - String[] in = extract_DevVarStringArray(in_any); - int ctxID = -1; - try { - ctxID = Integer.parseInt(in[0]); - if (ctxID < 0) { - Except.throw_exception("INPUT_ERROR", "Invalid Context ID", "SnapExtractor.GetSnapID"); - } - } catch (Exception e) { - Except.throw_exception("INPUT_ERROR", "Invalid Context ID", "SnapExtractor.GetSnapID"); - } - String[] criterions = getCriterions(in); - - return insert(((SnapExtractor) (device)).get_snap_id(ctxID, criterions)); - - } - - private String[] getCriterions(String[] in) { - // TODO Auto-generated method stub - String[] res = new String[in.length - 1]; - for (int i = 1; i < in.length; i++) { - res[i - 1] = in[i]; - } - return res; - } - -} diff --git a/formersnapextractor/src/main/java/SnapExtractor/GetSnapValueClass.java b/formersnapextractor/src/main/java/SnapExtractor/GetSnapValueClass.java deleted file mode 100644 index e805943802e688b2b44c1584bb14efdc1e8b1908..0000000000000000000000000000000000000000 --- a/formersnapextractor/src/main/java/SnapExtractor/GetSnapValueClass.java +++ /dev/null @@ -1,108 +0,0 @@ -/** - * - */ -package SnapExtractor; - -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; -import fr.esrf.TangoDs.Util; - -/** - * @author AYADI - * - */ -public class GetSnapValueClass extends Command implements TangoConst { - - /** - * @param s - * @param in - * @param out - * @param level - */ - public GetSnapValueClass(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 GetSnapValueClass(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 GetSnapValueClass(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 GetSnapValueClass(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 { - // TODO Auto-generated method stub - Util.out2.println("GetSnapValueClass.execute(): arrived"); - String[] in = extract_DevVarStringArray(in_any); - int snapID = -1; - try { - snapID = Integer.parseInt(in[0]); - if (snapID < 0) { - Except.throw_exception("INPUT_ERROR", "Invalid Snapshot ID", "SnapExtractor.GetSnapValue"); - } - } catch (Exception e) { - Except.throw_exception("INPUT_ERROR", "Invalid Snapshot ID", "SnapExtractor.GetSnapValue"); - } - - String attr_name = in[1]; - return insert(((SnapExtractor) (device)).get_snap_value(snapID, attr_name)); - - } - - // =============================================================== - /** - * 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; - } - -} diff --git a/formersnapextractor/src/main/java/SnapExtractor/GetSnapValuesClass.java b/formersnapextractor/src/main/java/SnapExtractor/GetSnapValuesClass.java deleted file mode 100644 index 3d7cb2913a6b86465c6805ba49b1c80bd83670a8..0000000000000000000000000000000000000000 --- a/formersnapextractor/src/main/java/SnapExtractor/GetSnapValuesClass.java +++ /dev/null @@ -1,109 +0,0 @@ -/** - * - */ -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; - } - -} diff --git a/formersnapextractor/src/main/java/SnapExtractor/GetSnapsForContextClass.java b/formersnapextractor/src/main/java/SnapExtractor/GetSnapsForContextClass.java deleted file mode 100644 index d33ea14c09dd3eed936640e31f69f68c7523cd6a..0000000000000000000000000000000000000000 --- a/formersnapextractor/src/main/java/SnapExtractor/GetSnapsForContextClass.java +++ /dev/null @@ -1,147 +0,0 @@ -// +====================================================================== -// $Source: /cvsroot/tango-cs/tango/jserver/snapshoting/SnapExtractor/GetSnapsForContextClass.java,v $ -// -// Project: Tango Device Server -// -// Description: Java source code for the command TemplateClass of the -// SnapExtractor class. -// -// $Author: ounsy $ -// -// $Revision: 1.1 $ -// -// $Log: GetSnapsForContextClass.java,v $ -// Revision 1.1 2006/02/07 13:03:52 ounsy -// moved from the Archiving package -// -// Revision 1.1 2006/01/27 14:39:14 ounsy -// new device for snap extracting -// -// -// copyleft : European Synchrotron Radiation Facility -// BP 220, Grenoble 38043 -// FRANCE -// -//-====================================================================== -// -// This file is generated by POGO -// (Program Obviously used to Generate tango Object) -// -// (c) - Software Engineering Group - ESRF -//============================================================================= - -/** - * @author $Author: ounsy $ - * @version $Revision: 1.1 $ - */ -package SnapExtractor; - -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.TangoConst; -import fr.esrf.TangoDs.Util; - -/** - * Class Description: Returns snapshots for a given context id - */ -public class GetSnapsForContextClass extends Command implements TangoConst { - // =============================================================== - /** - * Constructor for Command class GetSnapsForContextClass - * - * @param name - * command name - * @param in - * argin type - * @param out - * argout type - */ - // =============================================================== - public GetSnapsForContextClass(String name, int in, int out) { - super(name, in, out); - } - - // =============================================================== - /** - * Constructor for Command class GetSnapsForContextClass - * - * @param name - * command name - * @param in - * argin type - * @param in_comments - * argin description - * @param out - * argout type - * @param out_comments - * argout description - */ - // =============================================================== - public GetSnapsForContextClass(String name, int in, int out, String in_comments, String out_comments) { - super(name, in, out, in_comments, out_comments); - } - - // =============================================================== - /** - * Constructor for Command class GetSnapsForContextClass - * - * @param name - * command name - * @param in - * argin type - * @param in_comments - * argin description - * @param out - * argout type - * @param out_comments - * argout description - * @param level - * The command display type OPERATOR or EXPERT - */ - // =============================================================== - public GetSnapsForContextClass(String name, int in, int out, String in_comments, String out_comments, - DispLevel level) { - super(name, in, out, in_comments, out_comments, level); - } - - // =============================================================== - /** - * return the result of the device's command. - */ - // =============================================================== - @Override - public Any execute(DeviceImpl device, Any in_any) throws DevFailed { - Util.out2.println("GetSnapsForContextClass.execute(): arrived"); - int argin = extract_DevLong(in_any); - return insert(((SnapExtractor) (device)).get_snaps_for_context(argin)); - } - - // =============================================================== - /** - * 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; - } -} -// ----------------------------------------------------------------------------- -/* - * end of $Source: - * /cvsroot/tango-cs/tango/jserver/snapshoting/SnapExtractor/GetSnapsForContextClass - * .java,v $ - */ diff --git a/formersnapextractor/src/main/java/SnapExtractor/RemoveAllDynAttrClass.java b/formersnapextractor/src/main/java/SnapExtractor/RemoveAllDynAttrClass.java deleted file mode 100644 index 92068cbcee94163b1fb98588419d44cb8f90970e..0000000000000000000000000000000000000000 --- a/formersnapextractor/src/main/java/SnapExtractor/RemoveAllDynAttrClass.java +++ /dev/null @@ -1,105 +0,0 @@ -package SnapExtractor; - -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.TangoConst; -import fr.esrf.TangoDs.Util; - -/** - * Class Description: Remove the dynamic attribute. - */ - -public class RemoveAllDynAttrClass extends Command implements TangoConst { - // =============================================================== - /** - * Constructor for Command class RemoveAllDynAttrClass - * - * @param name - * command name - * @param in - * argin type - * @param out - * argout type - */ - // =============================================================== - public RemoveAllDynAttrClass(String name, int in, int out) { - super(name, in, out); - } - - // =============================================================== - /** - * Constructor for Command class RemoveAllDynAttrClass - * - * @param name - * command name - * @param in - * argin type - * @param in_comments - * argin description - * @param out - * argout type - * @param out_comments - * argout description - */ - // =============================================================== - public RemoveAllDynAttrClass(String name, int in, int out, String in_comments, String out_comments) { - super(name, in, out, in_comments, out_comments); - } - - // =============================================================== - /** - * Constructor for Command class RemoveAllDynAttrClass - * - * @param name - * command name - * @param in - * argin type - * @param in_comments - * argin description - * @param out - * argout type - * @param out_comments - * argout description - * @param level - * The command display type OPERATOR or EXPERT - */ - // =============================================================== - public RemoveAllDynAttrClass(String name, int in, int out, String in_comments, String out_comments, DispLevel level) { - super(name, in, out, in_comments, out_comments, level); - } - - // =============================================================== - /** - * return the result of the device's command. - */ - // =============================================================== - @Override - public Any execute(DeviceImpl device, Any in_any) throws DevFailed { - Util.out2.println("RemoveAllDynAttrClass.execute(): arrived"); - ((SnapExtractor) (device)).remove_all_dyn_attr(); - return insert(); - } - - // =============================================================== - /** - * 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; - } -} diff --git a/formersnapextractor/src/main/java/SnapExtractor/RemoveDynAttrClass.java b/formersnapextractor/src/main/java/SnapExtractor/RemoveDynAttrClass.java deleted file mode 100644 index e6120950198d1b6f05f806d627b134728ca90331..0000000000000000000000000000000000000000 --- a/formersnapextractor/src/main/java/SnapExtractor/RemoveDynAttrClass.java +++ /dev/null @@ -1,144 +0,0 @@ -// +====================================================================== -// $Source: /cvsroot/tango-cs/tango/jserver/snapshoting/SnapExtractor/RemoveDynAttrClass.java,v $ -// -// Project: Tango Device Server -// -// Description: Java source code for the command TemplateClass of the -// SnapExtractor class. -// -// $Author: ounsy $ -// -// $Revision: 1.1 $ -// -// $Log: RemoveDynAttrClass.java,v $ -// Revision 1.1 2006/02/07 13:03:52 ounsy -// moved from the Archiving package -// -// Revision 1.1 2006/01/27 14:39:14 ounsy -// new device for snap extracting -// -// -// copyleft : European Synchrotron Radiation Facility -// BP 220, Grenoble 38043 -// FRANCE -// -//-====================================================================== -// -// This file is generated by POGO -// (Program Obviously used to Generate tango Object) -// -// (c) - Software Engineering Group - ESRF -//============================================================================= - -/** - * @author $Author: ounsy $ - * @version $Revision: 1.1 $ - */ -package SnapExtractor; - -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.TangoConst; -import fr.esrf.TangoDs.Util; - -public class RemoveDynAttrClass extends Command implements TangoConst { - // =============================================================== - /** - * Constructor for Command class RemoveDynAttrClass - * - * @param name - * command name - * @param in - * argin type - * @param out - * argout type - */ - // =============================================================== - public RemoveDynAttrClass(String name, int in, int out) { - super(name, in, out); - } - - // =============================================================== - /** - * Constructor for Command class RemoveDynAttrClass - * - * @param name - * command name - * @param in - * argin type - * @param in_comments - * argin description - * @param out - * argout type - * @param out_comments - * argout description - */ - // =============================================================== - public RemoveDynAttrClass(String name, int in, int out, String in_comments, String out_comments) { - super(name, in, out, in_comments, out_comments); - } - - // =============================================================== - /** - * Constructor for Command class RemoveDynAttrClass - * - * @param name - * command name - * @param in - * argin type - * @param in_comments - * argin description - * @param out - * argout type - * @param out_comments - * argout description - * @param level - * The command display type OPERATOR or EXPERT - */ - // =============================================================== - public RemoveDynAttrClass(String name, int in, int out, String in_comments, String out_comments, DispLevel level) { - super(name, in, out, in_comments, out_comments, level); - } - - // =============================================================== - /** - * return the result of the device's command. - */ - // =============================================================== - @Override - public Any execute(DeviceImpl device, Any in_any) throws DevFailed { - Util.out2.println("RemoveDynAttrClass.execute(): arrived"); - String argin = extract_DevString(in_any); - ((SnapExtractor) (device)).remove_dyn_attr(argin); - return insert(); - } - - // =============================================================== - /** - * 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; - } -} -// ----------------------------------------------------------------------------- -/* - * end of $Source: - * /cvsroot/tango-cs/tango/jserver/snapshoting/SnapExtractor/RemoveDynAttrClass - * .java,v $ - */ diff --git a/formersnapextractor/src/main/java/SnapExtractor/RemoveDynAttrsClass.java b/formersnapextractor/src/main/java/SnapExtractor/RemoveDynAttrsClass.java deleted file mode 100644 index 8da6239a8bf1ee616aec6745715eebf6bd9cd852..0000000000000000000000000000000000000000 --- a/formersnapextractor/src/main/java/SnapExtractor/RemoveDynAttrsClass.java +++ /dev/null @@ -1,112 +0,0 @@ -/** - * @author $Author: ounsy $ - * @version $Revision: 1.1 $ - */ -package SnapExtractor; - -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.TangoConst; -import fr.esrf.TangoDs.Util; - -public class RemoveDynAttrsClass extends Command implements TangoConst { - // =============================================================== - /** - * Constructor for Command class RemoveDynAttrsClass - * - * @param name - * command name - * @param in - * argin type - * @param out - * argout type - */ - // =============================================================== - public RemoveDynAttrsClass(String name, int in, int out) { - super(name, in, out); - } - - // =============================================================== - /** - * Constructor for Command class RemoveDynAttrsClass - * - * @param name - * command name - * @param in - * argin type - * @param in_comments - * argin description - * @param out - * argout type - * @param out_comments - * argout description - */ - // =============================================================== - public RemoveDynAttrsClass(String name, int in, int out, String in_comments, String out_comments) { - super(name, in, out, in_comments, out_comments); - } - - // =============================================================== - /** - * Constructor for Command class RemoveDynAttrsClass - * - * @param name - * command name - * @param in - * argin type - * @param in_comments - * argin description - * @param out - * argout type - * @param out_comments - * argout description - * @param level - * The command display type OPERATOR or EXPERT - */ - // =============================================================== - public RemoveDynAttrsClass(String name, int in, int out, String in_comments, String out_comments, DispLevel level) { - super(name, in, out, in_comments, out_comments, level); - } - - // =============================================================== - /** - * return the result of the device's command. - */ - // =============================================================== - @Override - public Any execute(DeviceImpl device, Any in_any) throws DevFailed { - Util.out2.println("RemoveDynAttrsClass.execute(): arrived"); - String[] argin = extract_DevVarStringArray(in_any); - ((SnapExtractor) (device)).remove_dyn_attrs(argin); - return insert(); - } - - // =============================================================== - /** - * 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; - } -} -// ----------------------------------------------------------------------------- -/* - * end of $Source: - * /cvsroot/tango-cs/tango/jserver/snapshoting/SnapExtractor/RemoveDynAttrsClass - * .java,v $ - */ diff --git a/formersnapextractor/src/main/java/SnapExtractor/SnapExtractor.java b/formersnapextractor/src/main/java/SnapExtractor/SnapExtractor.java deleted file mode 100644 index 91cf2a0425828541fecd6e8f0027a379fcf57127..0000000000000000000000000000000000000000 --- a/formersnapextractor/src/main/java/SnapExtractor/SnapExtractor.java +++ /dev/null @@ -1,1021 +0,0 @@ -//+============================================================================ -//$Source: /cvsroot/tango-cs/tango/jserver/snapshoting/SnapExtractor/SnapExtractor.java,v $ - -//project : Tango Device Server - -//Description: java source code for the SnapExtractor class and its commands. -//This class is derived from DeviceImpl class. -//It represents the CORBA servant obbject which -//will be accessed from the network. All commands which -//can be executed on the SnapExtractor are implemented -//in this file. - -//$Author: soleilarc $ - -//$Revision: 1.16 $ - -//$Log: SnapExtractor.java,v $ -//Revision 1.16 2007/10/15 15:14:53 soleilarc -//Author: XP -//Mantis bug ID: 6256 -//Comment: -//In the init_device method, put the call to get_device_property method at the beginning. -//In the get_device_property method, the values of the table propnames must be �DbUser� and �DbPassword�, instead of �SnapUser� and �SnapPassword�. - -//Revision 1.15 2007/05/11 13:58:55 pierrejoseph -//Attribute addition : release version - -//Revision 1.14 2007/03/14 15:47:01 ounsy -//passes its user and password to the APIs - -//Revision 1.13 2007/03/02 07:54:57 ounsy -//extend DeviceImpl instead of DeviceImplWithShutdownRunnable - -//Revision 1.12 2006/12/06 10:16:02 ounsy -//minor changes - -//Revision 1.11 2006/11/20 09:38:54 ounsy -//minor changes - -//Revision 1.10 2006/11/13 15:58:06 ounsy -//all java devices now inherit from UnexportOnShutdownDeviceImpl instead of from DeviceImpl - -//Revision 1.9 2006/10/31 16:54:15 ounsy -//milliseconds and null values management - -//Revision 1.8 2006/04/12 15:47:03 ounsy -//organized imports - -//Revision 1.7 2006/04/12 08:40:35 ounsy -//cleaned the code and added a better error logging - -//Revision 1.6 2006/03/29 11:35:12 ounsy -//small modification of the remove_dyn_attrs method so that in case the removal of an attribute fails, the others are still removed - -//Revision 1.5 2006/03/27 13:58:18 ounsy -//added the commands removeAllDynAttr et removeDynAttrs - -//Revision 1.4 2006/03/14 13:05:16 ounsy -//corrected the SNAP/spectrums/RW problem -//about the read and write values having the same length - -//Revision 1.3 2006/03/08 16:31:13 ounsy -//added the global POGO class comments for the devices SnapExtractor - -//Revision 1.2 2006/03/08 14:36:42 ounsy -//added pogo comments - -//Revision 1.1 2006/02/07 13:03:52 ounsy -//moved from the Archiving package - -//Revision 1.2 2006/02/06 13:11:20 ounsy -//corrected a bug for WO attributes - -//Revision 1.1 2006/01/27 14:39:14 ounsy -//new device for snap extracting - -//copyleft : European Synchrotron Radiation Facility -//BP 220, Grenoble 38043 -//FRANCE - -//-============================================================================ - -//This file is generated by POGO -//(Program Obviously used to Generate tango Object) - -//(c) - Software Engineering Group - ESRF -//============================================================================= - -package SnapExtractor; - -import org.omg.CORBA.SystemException; -import org.omg.CORBA.UserException; -import org.tango.utils.DevFailedUtils; - -import fr.esrf.Tango.AttrDataFormat; -import fr.esrf.Tango.AttrWriteType; -import fr.esrf.Tango.DevFailed; -import fr.esrf.Tango.DevState; -import fr.esrf.Tango.DevVarLongStringArray; -import fr.esrf.TangoApi.DbDevice; -import fr.esrf.TangoDs.Attr; -import fr.esrf.TangoDs.Attribute; -import fr.esrf.TangoDs.DeviceClass; -import fr.esrf.TangoDs.DeviceImpl; -import fr.esrf.TangoDs.Except; -import fr.esrf.TangoDs.ImageAttr; -import fr.esrf.TangoDs.SpectrumAttr; -import fr.esrf.TangoDs.TangoConst; -import fr.esrf.TangoDs.TimedAttrData; -import fr.esrf.TangoDs.Util; -import fr.soleil.archiving.common.api.tools.DbData; -import fr.soleil.archiving.snap.api.SnapConnectionParameters; -import fr.soleil.archiving.snap.api.extractor.convert.ConverterFactory; -import fr.soleil.archiving.snap.api.extractor.convert.IConverter; -import fr.soleil.archiving.snap.api.extractor.datasources.db.ISnapReader; -import fr.soleil.archiving.snap.api.extractor.datasources.db.SnapReaderFactory; -import fr.soleil.archiving.snap.api.extractor.devicelink.Warnable; -import fr.soleil.archiving.snap.api.extractor.naming.DynamicAttributeNamerFactory; -import fr.soleil.archiving.snap.api.extractor.naming.IDynamicAttributeNamer; -import fr.soleil.archiving.snap.api.extractor.tools.Tools; -import fr.soleil.archiving.snap.api.manager.SnapManagerApi; -import fr.soleil.archiving.snap.api.tools.SnapAttributeExtract; -import fr.soleil.archiving.snap.api.tools.SnapshotingException; - -/** - * Class Description: This device is in charge of extracting snapshots from the - * SNAP database. It can look up the snapshots for a given context, and extract - * those snapshots. - * - * @author $Author: soleilarc $ - * @version $Revision: 1.16 $ - */ - -// --------- Start of States Description ---------- -/* - * Device States Description: DevState.ON : DevState.OFF : DevState.INIT : - * DevState.FAULT : DevState.EXTRACT : DevState.UNKNOWN : - */ -// --------- End of States Description ---------- - -public class SnapExtractor extends DeviceImpl -/* WithShutdownRunnable */implements TangoConst { - protected int state; - private final String m_version; - - // --------- Start of attributes data members ---------- - private int id = 0; - // --------- End of attributes data members ---------- - - // --------- Start of properties data members ---------- - - /** - * User identifier (name) used to connect the database SNAP. <br> - * <b>Default value : </b> snap - */ - String dbUser; - /** - * Password used to connect the database SNAP. <br> - * <b>Default value : </b> snap - */ - String dbPassword; - - // --------- End of properties data members ---------- - - // Add your own data members here - protected int formerState = DevState._UNKNOWN; - - private String dbHost; - private String dbName; - private String dbSchema; - private String isRac; - private ISnapReader snapReader; - - // -------------------------------------- - - // ========================================================= - /** - * Constructor for simulated Time Device Server. - * - * @param cl - * The DeviceClass object - * @param s - * The Device name. - * @param version - * The device version - */ - // ========================================================= - SnapExtractor(DeviceClass cl, String s, String version) throws DevFailed { - super(cl, s); - m_version = version; - init_device(); - } - - // ========================================================= - /** - * Constructor for simulated Time Device Server. - * - * @param cl - * The DeviceClass object - * @param s - * The Device name. - * @param d - * Device description. - * @param version - * The device version - */ - // ========================================================= - SnapExtractor(DeviceClass cl, String s, String d, String version) throws DevFailed { - super(cl, s, d); - m_version = version; - init_device(); - } - - // ========================================================= - /** - * Initialize the device. - */ - // ========================================================= - @Override - public void init_device() throws DevFailed { - System.out.println("SnapExtractor() create " + device_name); - - // Initialise variables to default values - get_device_property(); - // LifeCycleManagerFactory.setUser(this.snapUser); - // LifeCycleManagerFactory.setPassword(this.snapPassword); - // LifeCycleManager lifeCycleManager = LifeCycleManagerFactory - // .getImpl(LifeCycleManagerFactory.DEFAULT_LIFE_CYCLE); - // lifeCycleManager.setWatcherToWarn(this); - // - // Thread apiThread = lifeCycleManager.getAsThread(); - // apiThread.start(); - // ------------------------------------------- - try { - // Snap Database connection - SnapManagerApi.initSnapConnection(dbHost, dbName, dbSchema, dbUser, dbPassword, isRac); - snapReader = SnapReaderFactory.getImpl(SnapReaderFactory.REAL); - snapReader.openConnection(); - } catch (SnapshotingException e) { - get_logger().warn(e.toString(), e); - throw e.toTangoException(); - } - - set_state(DevState.ON); - } - - // ========================================================= - /** - * Execute command "RemoveDynamicAttribute" on device. Remove the dynamic - * attribute specified by its name argin. - * - * @param argin - * The dynamic attribute's name - */ - // ========================================================= - public void remove_dyn_attr(String argin) throws DevFailed { - get_logger().info("Entering remove_dynamic_attribute()"); - - // ---Add your Own code to control device here --- - // Remove prop for the attribute - String[] obj_to_del = new String[3]; - obj_to_del[0] = device_name; - obj_to_del[1] = "attribute"; - obj_to_del[2] = argin; - Util tg = Util.instance(); - tg.get_dserver_device().rem_obj_polling(obj_to_del, false); - - // Remove the attribute - remove_attribute(argin); - get_logger().info("Exiting remove_dynamic_attribute()"); - } - - // ========================================================= - /** - * Execute command "RemoveDynamicAttributes" on device. Remove the dynamic - * attributes specified by the names list. - * - * @param argin - * The dynamic attributes names - */ - // ========================================================= - public void remove_dyn_attrs(String[] argin) throws DevFailed { - get_logger().info("Entering remove_dyn_attrs()"); - - // ---Add your Own code to control device here --- - // Remove prop for the attribute - if (argin == null) { - return; - } - - for (int i = 0; i < argin.length; i++) { - try { - String[] obj_to_del = new String[3]; - - obj_to_del[0] = device_name; - obj_to_del[1] = "attribute"; - obj_to_del[2] = argin[i]; - - Util tg = Util.instance(); - tg.get_dserver_device().rem_obj_polling(obj_to_del, false); - - // Remove the attribute - this.remove_attribute(argin[i]); - } catch (Throwable t) { - Tools.printIfDevFailed(t); - - continue; - } - } - - get_logger().info("Exiting remove_dyn_attrs()"); - } - - // ========================================================= - /** - * Execute command "RemoveAllDynamicAttribute" on device. Remove all - * existing dynamic attributes. - * - * @param argin - * The dynamic attribute's name - */ - // ========================================================= - public void remove_all_dyn_attr() throws DevFailed { - get_logger().info("Entering remove_dynamic_attribute()"); - - // ---Add your Own code to control device here --- - - int numberOfAttributes = this.dev_attr == null ? 0 : this.dev_attr.get_attr_nb(); - String[] attributesToRemove = new String[numberOfAttributes]; - for (int i = 0; i < numberOfAttributes; i++) { - Attribute nextAttribute = this.dev_attr.get_attr_by_ind(i); - String attributeName = nextAttribute.get_name(); - // System.out.println ( "CLA/attributeName/"+attributeName); - attributesToRemove[i] = attributeName; - } - - this.remove_dyn_attrs(attributesToRemove); - } - - // =================================================================== - /** - * Read the device properties from database. - */ - // =================================================================== - public void get_device_property() throws DevFailed { - // Initialize your default values here. - // ------------------------------------------ - dbUser = ""; - dbPassword = ""; - dbHost = ""; - dbName = ""; - dbSchema = ""; - isRac = ""; - - DbDevice device = get_db_device(); - try { - SnapConnectionParameters.performSnapInit(device, true, true); - - dbHost = SnapConnectionParameters.getSnapHost(); - dbName = SnapConnectionParameters.getSnapName(); - dbSchema = SnapConnectionParameters.getSnapSchema(); - dbUser = SnapConnectionParameters.getSnapUser(); - dbPassword = SnapConnectionParameters.getSnapPassword(); - isRac = SnapConnectionParameters.getSnapRac(); - - SnapConnectionParameters.printSnapConnectionInfoLog(); - - } catch (SnapshotingException e) { - e.printStackTrace(); - } - - } - - // ========================================================= - /** - * Method always executed before command execution. - */ - // ========================================================= - @Override - public void always_executed_hook() { - // get_logger().info("In always_executed_hook method()"); - } - - // ========================================================= - /** - * Execute command "GetSnap" on device. Loads a snapshot of given ID: if the - * snapshot exists, creates for each one of the snapshot's attributes a - * dynamic attribute for its read part, and, if the attribute isn't - * read-only, for its write part. Returns a table containing, as many times - * as there are attributes for the specified snapshot: - * <UL> - * <LI>the attribute complete name - * <LI>the name of the dynamic attribute containing the attribute's read - * value (if it has one, otherwise blank) - * <LI>the name of the dynamic attribute containing the attribute's write - * value (if it has one, otherwise blank) - * </UL> - * - * @param argin - * the snapshot's ID - * @return A table containing [attrRealName, dynAttrNameR,dynAttrNameW]*n - * @throws DevFailed - */ - // ========================================================= - public String[] get_snap(int argin) throws DevFailed { - String[] argout = new String[5]; - get_logger().info("Entering get_snap()"); - - // ---Add your Own code to control device here --- - - try { - SnapAttributeExtract[] sae = snapReader.getSnap(argin); - if (sae == null || sae.length == 0) { - Except.throw_exception("INPUT_ERROR", "Snapshot ID does not exist", "SnapExtractor.GetSnap"); - - } - - // return emptyResult (); - - argout = this.add_attributes(sae); - } catch (Throwable t) { - Tools.printIfDevFailed(t); - if (t instanceof DevFailed) { - throw (DevFailed) t; - } - } - // ------------------------------------------------ - - get_logger().info("Exiting get_snap()"); - - return argout; - } - - // ========================================================= - /** - * Execute command "GetSnapValue" on device. Loads a snapshot of given ID: - * if the snapshot exists, find if the attribute exists for this snapshot if - * the attribute exists, Returns an attribute value - * - * @param snapID - * the snapshot's ID - * @param attr_name - * the attribute name - * @return the attribute value - * @throws DevFailed - */ - // ========================================================= - public String[] get_snap_value(int snapID, String attr_name) throws DevFailed { - get_logger().info("Entering get_snap_value()"); - - SnapAttributeExtract[] extraction = snapReader.getSnapValues(snapID, attr_name); - String[] argout = get_attribute_value(extraction[0]); - - get_logger().info("Exiting get_snap_value()"); - return argout; - } - - public String[] getSnapValues(int snapID, boolean readValues, String... attributeNames) throws DevFailed { - String[] argout = new String[attributeNames.length]; - SnapAttributeExtract[] extraction = snapReader.getSnapValues(snapID, attributeNames); - int i = 0; - for (SnapAttributeExtract snapAttributeExtract : extraction) { - if (readValues) { - argout[i++] = snapAttributeExtract.valueToString(0); - } else { - argout[i++] = snapAttributeExtract.valueToString(1); - } - } - return argout; - } - - // ========================================================= - /** - * Execute command "GetSnapID" on device. Loads the list of snapshot' id of - * a given context that respect the given criterion. - * - * @param ctxID - * the context's ID - * @param criterion - * the search criterion - * @return the list of snapshot ids. - * @throws DevFailed - * @throws SnapshotingException - */ - // ========================================================= - public int[] get_snap_id(int ctxID, String[] criterions) throws DevFailed { - get_logger().info("Entering get_snap_id()"); - - int[] snap_ids = snapReader.getSnapshotsID(ctxID, criterions); - if (snap_ids == null) { - Except.throw_exception("INPUT_ERROR", "Invalid Criterions", "SnapExtractor.GetSnapID"); - - } - get_logger().info("Exiting get_snaps_id()"); - return snap_ids; - } - - // /** - // * - // * @return a String[2] for an invalid attribute name callback - // */ - // private String[] getInvalidAttributeName() { - // // TODO Auto-generated method stub - // return new String[]{"Invalid attribute name",""}; - // } - - // /** - // * - // * @param sae - // * : list of SnapAttributeExtract - // * @param attr_name - // * : the given attribute name - // * @return the index of the attribute in the list of SnapAttributeExtract. - // */ - // private int getIndexOfAttribute(SnapAttributeExtract[] sae, String - // attr_name) { - // // TODO Auto-generated method stub - // int index = -1; - // for (int i = 0; i < sae.length; i++) { - // if (sae[i].getAttributeCompleteName().equalsIgnoreCase(attr_name)) { - // index = i; - // break; - // } - // } - // - // return index; - // } - - /** - * - * @param snapAttributeExtract - * @return read_value and write_value - */ - private String[] get_attribute_value(SnapAttributeExtract snapAttributeExtract) { - // TODO Auto-generated method stub - - String[] argout = { "NaN", "NaN" }; - try { - SnapAttributeExtract currentExtract = snapAttributeExtract; - - argout[0] = currentExtract.valueToString(0); - argout[1] = currentExtract.valueToString(1); - - } catch (Exception e) { - - } - - return argout; - - } - - /** - * Loads the list of snapshots attached to a given context, specified by its - * ID. Returns a DevVarLongStringArray object, where the array is as long as - * there are many snapshots for the context. The Long part is the snapshot's - * ID, the String part is the concatenation of its Date and Comment fields - * values. - * - * @param argin - * The context ID - * @return The snapshots: [ID, Date + Comment]*n - * @throws DevFailed - */ - public DevVarLongStringArray get_snaps_for_context(int argin) throws DevFailed { - get_logger().info("Entering get_snaps_for_context()"); - - // ---Add your Own code to control device here --- - DevVarLongStringArray snapshots = snapReader.getSnapshotsForContext(argin); - if (snapshots == null) { - return emptyDevVarLongStringArrayResult(); - } - // ------------------------------------------------ - - get_logger().info("Exiting get_snaps_for_context()"); - return snapshots; - } - - /** - * @return - */ - private DevVarLongStringArray emptyDevVarLongStringArrayResult() { - DevVarLongStringArray ret = new DevVarLongStringArray(); - int[] lvalue = new int[1]; - java.lang.String[] svalue = new java.lang.String[1]; - - lvalue[0] = -1; - svalue[0] = "NO SNAPSHOT FOR THIS CONTEXT ID"; - - ret.lvalue = lvalue; - ret.svalue = svalue; - - return ret; - } - - // /** - // * @return - // */ - // private String[] emptyResult() { - // String[] argout = new String[3]; - // - // argout[0] = "NO SUCH SNAPSHOT"; - // argout[1] = ""; - // argout[2] = ""; - // - // return argout; - // } - - // ========================================================= - /** - * main part for the device server class - */ - // ========================================================= - public static void main(String[] argv) { - try { - Util tg = Util.init(argv, "SnapExtractor"); - tg.server_init(); - - System.out.println("Ready to accept request"); - - tg.server_run(); - } - - catch (OutOfMemoryError ex) { - System.err.println("Can't allocate memory !!!!"); - System.err.println("Exiting"); - } catch (UserException ex) { - Except.print_exception(ex); - - System.err.println("Received a CORBA user exception"); - System.err.println("Exiting"); - } catch (SystemException ex) { - Except.print_exception(ex); - - System.err.println("Received a CORBA system exception"); - System.err.println("Exiting"); - } - - System.exit(-1); - } - - private String[] add_attributes(SnapAttributeExtract[] sae) throws DevFailed { - int numberOfAttributes = sae.length; - - String[] argout = new String[3 * numberOfAttributes]; - int j = 0; - for (int i = 0; i < numberOfAttributes; i++) { - SnapAttributeExtract currentExtract = sae[i]; - String realName = currentExtract.getAttributeCompleteName(); - - // Object val = currentExtract.getValue(); - try { - String[] names = this.addAttribute(currentExtract); - String read_name = names[0]; - String write_name = names[1]; - argout[j] = realName; - argout[j + 1] = read_name; - argout[j + 2] = write_name; - } catch (DevFailed e) { - DevFailedUtils.printDevFailed(e); - System.err.println("cannot add attr " + realName); - } - - j += 3; - } - - return argout; - } - - /** - * @param currentExtract - * @return - * @throws DevFailed - */ - private String[] addAttribute(SnapAttributeExtract currentExtract) throws DevFailed { - if (currentExtract.getValue() == null) { - String message = "Null value for attribute |" + currentExtract.getAttributeCompleteName() + "|"; - this.trace(message, Warnable.LOG_LEVEL_WARN); - return getErrorNames(currentExtract); - } - - IConverter converter = ConverterFactory.getImpl(ConverterFactory.DEFAULT); - DbData dbData = converter.convert(currentExtract); - if (dbData == null) { - String message = "Null DbData for attribute |" + currentExtract.getAttributeCompleteName() - + "| (if the attribute is R/W or is a spectrum, at least one of its value's component is null)"; - this.trace(message, Warnable.LOG_LEVEL_WARN); - return getErrorNames(currentExtract); - } - - String[] names = this.buildDynamicAttributesNames(currentExtract); - - this.createDynamicAttribute(dbData, names); - - return names; - } - - private String[] getErrorNames(SnapAttributeExtract currentExtract) { - String[] errorNames = new String[2]; - String name = currentExtract.getAttributeCompleteName(); - - errorNames[0] = name + "_ERROR"; - errorNames[1] = name + "_ERROR"; - - return errorNames; - } - - /** - * @param currentExtract - * @return - */ - private String[] buildDynamicAttributesNames(SnapAttributeExtract currentExtract) { - String random_name_1 = "", random_name_2 = ""; - String[] names; - - // String name = currentExtract.getAttribute_complete_name (); - // String dynamicAttributeName = ""; - // get_logger().info("CLA/buildRandomNames/name/"+name+"/"); - boolean hasBothReadAndWriteValues = currentExtract.getWritable() == AttrWriteType._READ_WITH_WRITE - || currentExtract.getWritable() == AttrWriteType._READ_WRITE; - - // Build new Attribute's name - IDynamicAttributeNamer dynamicAttributeNamer = DynamicAttributeNamerFactory - .getImpl(DynamicAttributeNamerFactory.DEFAULT); - - boolean firstIsRead = currentExtract.getWritable() != AttrWriteType._WRITE; - random_name_1 = dynamicAttributeNamer.getName(currentExtract, id, firstIsRead); - // id++; - // get_logger().info("CLA/buildRandomNames/random_name_1/"+random_name_1+"/"); - if (hasBothReadAndWriteValues) { - random_name_2 = dynamicAttributeNamer.getName(currentExtract, id, !firstIsRead); - // id++; - // get_logger().info("CLA/buildRandomNames/random_name_2/"+random_name_2+"/"); - } - id++; - - names = new String[2]; - names[0] = random_name_1; - names[1] = random_name_2; - - return names; - } - - private DevVarLongStringArray createDynamicAttribute(DbData dbData /* - * added - * by CLA - */, String[] names) throws DevFailed { - try { - DevVarLongStringArray argout = new DevVarLongStringArray(); - - boolean _2value = dbData.getWritable() == AttrWriteType._READ_WITH_WRITE - || dbData.getWritable() == AttrWriteType._READ_WRITE ? true : false; - - // CLA modified - String random_name_1 = names[0]; - String random_name_2 = names[1]; - - if (dbData.getDataType() == Tango_DEV_STATE) { - // We have to convert state vars to int otherwise they're not - // recognised by the method fr.esrf.TangoDs.check_type() - dbData.setDataType(Tango_DEV_LONG); - } - - // Create the attribute depends on DataFormat - switch (dbData.getDataFormat()) { - case AttrDataFormat._SCALAR: - add_attribute(new Attr(random_name_1, dbData.getDataType(), AttrWriteType.READ)); - if (_2value) { - add_attribute(new Attr(random_name_2, dbData.getDataType(), AttrWriteType.READ)); - } - break; - case AttrDataFormat._SPECTRUM: - - add_attribute(new SpectrumAttr(random_name_1, dbData.getDataType(), dbData.getMaxX())); - if (_2value) { - - add_attribute(new SpectrumAttr(random_name_2, dbData.getDataType(), dbData.getMaxX())); - } - break; - case AttrDataFormat._IMAGE: - add_attribute(new ImageAttr(random_name_1, dbData.getDataType(), dbData.getMaxX(), dbData.getMaxY())); - break; - } - - set_polled_attr(names); - set_poll_ring_depth(dbData.size()); - - // Start polling for this device in external sync. mode (udt = 0) - DevVarLongStringArray poll_1, poll_2; - poll_1 = new DevVarLongStringArray(); - poll_2 = new DevVarLongStringArray(); - - poll_1.lvalue = new int[1]; - poll_1.lvalue[0] = 0; - poll_1.svalue = new String[3]; - poll_1.svalue[0] = device_name; - poll_1.svalue[1] = "attribute"; - poll_1.svalue[2] = random_name_1; - - if (_2value) { - poll_2.lvalue = new int[1]; - poll_2.lvalue[0] = 0; - poll_2.svalue = new String[3]; - poll_2.svalue[0] = device_name; - poll_2.svalue[1] = "attribute"; - poll_2.svalue[2] = random_name_2; - } - Util tg_1 = Util.instance(); - tg_1.get_dserver_device().add_obj_polling(poll_1, false); - - Util tg_2 = Util.instance(); - if (_2value) { - tg_2.get_dserver_device().add_obj_polling(poll_2, false); - } - - // And fill buffer with database's data - - if (_2value) { - // System.out.println ( "CLA/SnapExtractor/" +dbData.); - - DbData[] dbDatas = dbData.splitDbData(); - DbData readDbData = dbDatas[0]; - DbData writeDbData = dbDatas[1]; - - TimedAttrData[] readTimedAttrDatas = readDbData.getDataAsTimedAttrData(); - - TimedAttrData[] writeTimedAttrDatas = writeDbData.getDataAsTimedAttrData(); - - updateWriteData(writeTimedAttrDatas); - - tg_1.fill_attr_polling_buffer(this, random_name_1, readTimedAttrDatas); - tg_2.fill_attr_polling_buffer(this, random_name_2, writeTimedAttrDatas); - } else { - tg_1.fill_attr_polling_buffer(this, random_name_1, dbData.getDataAsTimedAttrData()); - } - - argout = new DevVarLongStringArray(); - argout.lvalue = new int[1]; - if (!_2value) { - argout.svalue = new String[1]; - } else { - argout.svalue = new String[2]; - } - - argout.lvalue[0] = dbData.getTimedData().length; - argout.svalue[0] = random_name_1; - if (_2value) { - argout.svalue[1] = random_name_2; - } - - return argout; - } catch (Throwable t) { - Tools.throwDevFailed(t); - } - return null; - } - - /** - * update x dimension to the data array length - * - * @param data - */ - private void updateWriteData(TimedAttrData[] data) { - // TODO Auto-generated method stub - - for (int i = 0; i < data.length; i++) { - - int size = 0; - - switch (data[i].data_type) { - case Tango_DEV_BOOLEAN: - size = data[i].bool_ptr.length; - break; - - case Tango_DEV_SHORT: - size = data[i].sh_ptr.length; - break; - - case Tango_DEV_LONG: - size = data[i].lg_ptr.length; - break; - - case Tango_DEV_LONG64: - size = data[i].lg64_ptr.length; - break; - - case Tango_DEV_FLOAT: - size = data[i].fl_ptr.length; - break; - - case Tango_DEV_DOUBLE: - size = data[i].db_ptr.length; - break; - - case Tango_DEV_STRING: - size = data[i].str_ptr.length; - break; - default: - ; - } - data[i].x = size; - } - - } - - // /** - // * @param i - // */ - // private String formatStatus(int _state) { - // switch (_state) { - // case DevState._ALARM: - // return "Archiving problems have been detected."; - // - // case DevState._FAULT: - // return "This device isn't working properly."; - // - // case DevState._INIT: - // return "No control step has been completed yet. Please wait."; - // - // case DevState._OFF: - // return "This device is waiting."; - // - // case DevState._ON: - // return "This device is running normally."; - // - // default: - // return "Unknown"; - // } - // } - - public void trace(String msg, int level) throws DevFailed { - switch (level) { - case Warnable.LOG_LEVEL_DEBUG: - get_logger().debug(msg); - break; - - case Warnable.LOG_LEVEL_INFO: - get_logger().info(msg); - break; - - case Warnable.LOG_LEVEL_WARN: - get_logger().warn(msg); - break; - - case Warnable.LOG_LEVEL_ERROR: - get_logger().error(msg); - break; - - case Warnable.LOG_LEVEL_FATAL: - get_logger().fatal(msg); - break; - - default: - Tools.throwDevFailed(new IllegalArgumentException( - "Expected LOG_LEVEL_DEBUG(9), LOG_LEVEL_INFO(7), LOG_LEVEL_WARN(5), LOG_LEVEL_ERROR(3), or LOG_LEVEL_FATAL(1), got " - + level + "instead.")); - } - } - - public void trace(String msg, Throwable t, int level) throws DevFailed { - switch (level) { - case Warnable.LOG_LEVEL_DEBUG: - get_logger().debug(msg, t); - break; - - case Warnable.LOG_LEVEL_INFO: - get_logger().info(msg, t); - break; - - case Warnable.LOG_LEVEL_WARN: - get_logger().warn(msg, t); - break; - - case Warnable.LOG_LEVEL_ERROR: - get_logger().error(msg, t); - break; - - case Warnable.LOG_LEVEL_FATAL: - get_logger().fatal(msg, t); - break; - - default: - Tools.throwDevFailed(new IllegalArgumentException( - "Expected LOG_LEVEL_DEBUG(9), LOG_LEVEL_INFO(7), LOG_LEVEL_WARN(5), LOG_LEVEL_ERROR(3), or LOG_LEVEL_FATAL(1), got " - + level + "instead.")); - } - } - - // =================================================================== - /** - * Method called by the read_attributes CORBA operation to set internal - * attribute value. - * - * @param attr - * reference to the Attribute object - */ - // =================================================================== - @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); - - // Switch on attribute name - // --------------------------------- - if (attr_name == "version") { - // Add your own code here - attr.set_value(m_version); - } - } - - @Override - public void delete_device() throws DevFailed { - // TODO Auto-generated method stub - - } -} -// -------------------------------------------------------------------------- -/* - * end of $Source: - * /cvsroot/tango-cs/tango/jserver/snapshoting/SnapExtractor/SnapExtractor - * .java,v $ - */ diff --git a/formersnapextractor/src/main/java/SnapExtractor/SnapExtractorClass.java b/formersnapextractor/src/main/java/SnapExtractor/SnapExtractorClass.java deleted file mode 100644 index 95f4575c1b1ae9667edd4bf99f2d92c08181dd75..0000000000000000000000000000000000000000 --- a/formersnapextractor/src/main/java/SnapExtractor/SnapExtractorClass.java +++ /dev/null @@ -1,282 +0,0 @@ -// +====================================================================== -// $Source: /cvsroot/tango-cs/tango/jserver/snapshoting/SnapExtractor/SnapExtractorClass.java,v $ -// -// Project: Tango Device Server -// -// Description: java source code for the SnapExtractor class . -// This class is a singleton class and implements everything -// which exists only once for all the SnapExtractor object -// It inherits from the DeviceClass class. -// -// $Author: pierrejoseph $ -// -// $Revision: 1.3 $ -// -// $Log: SnapExtractorClass.java,v $ -// Revision 1.3 2007/05/11 13:58:54 pierrejoseph -// Attribute addition : release version -// -// Revision 1.2 2006/03/27 13:58:18 ounsy -// added the commands removeAllDynAttr et removeDynAttrs -// -// Revision 1.1 2006/02/07 13:03:52 ounsy -// moved from the Archiving package -// -// Revision 1.1 2006/01/27 14:39:14 ounsy -// new device for snap extracting -// -// -// copyleft : European Synchrotron Radiation Facility -// BP 220, Grenoble 38043 -// FRANCE -// -//-====================================================================== -// -// This file is generated by POGO -// (Program Obviously used to Generate tango Object) -// -// (c) - Software Engineering Group - ESRF -//============================================================================= - -package SnapExtractor; - -import java.util.ResourceBundle; -import java.util.Vector; - -import fr.esrf.Tango.AttrWriteType; -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.Util; - -public class SnapExtractorClass extends DeviceClass implements TangoConst { - /** - * SnapExtractorClass class instance (it is a singleton). - */ - private static SnapExtractorClass _instance = null; - - /** - * Class properties array. - */ - // private final DbDatum[] cl_prop = null; - - // --------- Start of properties data members ---------- - - // --------- End of properties data members ---------- - - // =================================================================== - // - // method : instance() - // - // description : static method to retrieve the SnapExtractorClass object - // once it has been initialised - // - // =================================================================== - public static SnapExtractorClass instance() { - if (_instance == null) { - System.err.println("SnapExtractorClass is not initialised !!!"); - System.err.println("Exiting"); - System.exit(-1); - } - return _instance; - } - - // =================================================================== - // - // method : Init() - // - // description : static method to create/retrieve the SnapExtractorClass - // object. This method is the only one which enables a - // user to create the object - // - // in : - class_name : The class name - // - // =================================================================== - public static SnapExtractorClass init(String class_name) throws DevFailed { - if (_instance == null) { - _instance = new SnapExtractorClass(class_name); - } - return _instance; - } - - // =================================================================== - // - // method : SnapExtractorClass() - // - // description : constructor for the SnapExtractorClass class - // - // argument : in : - name : The class name - // - // =================================================================== - protected SnapExtractorClass(String name) throws DevFailed { - super(name); - - Util.out2.println("Entering SnapExtractorClass constructor"); - // write_class_property(); - get_class_property(); - - Util.out2.println("Leaving SnapExtractorClass constructor"); - } - - // =================================================================== - // - // method : command_factory() - // - // 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 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 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 GetSnapsForContextClass("GetSnapsForContext", Tango_DEV_LONG, - Tango_DEVVAR_LONGSTRINGARRAY, "", "", DispLevel.OPERATOR)); - - 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)); - - 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++) { - Command cmd = (Command) command_list.elementAt(i); - } - } - - // ============================================================================= - // - // 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); - att_list.addElement(version); - } - - // =================================================================== - // - // method : device_factory() - // - // description : Create the device object(s) and store them in the - // device list - // - // 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"); - - 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)); - - // 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]); - } - } - } - - // =================================================================== - /** - * Get the class property for specified name. - * - * @param name - * The property name. - * @throws DevFailed - */ - // =================================================================== - 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]; - } - - // =================================================================== - /** - * Read the class properties from database. - */ - // =================================================================== - public void get_class_property() throws DevFailed { - // Initialize your default values here. - // ------------------------------------------ - - // Read class properties from database.(Automatic code generation) - // ------------------------------------------------------------- - if (Util._UseDb == false) { - return; - } - - // Call database and extract values - // -------------------------------------------- - - // End of Automatic code generation - // ------------------------------------------------------------- - - } - - // =================================================================== - /** - * Set class description as property in database - */ - // =================================================================== -// private void write_class_property() throws DevFailed { -// // First time, check if database used -// // -------------------------------------------- -// if (Util._UseDb == false) { -// return; -// } -// -// // Prepeare DbDatum -// // -------------------------------------------- -// DbDatum[] data = new DbDatum[2]; -// data[0] = new DbDatum("ProjectTitle"); -// data[0].insert("Tango Device Server"); -// -// data[1] = new DbDatum("Description"); -// data[1].insert("SnapExtractor"); -// -// // Call database and and values -// // -------------------------------------------- -// get_db_class().put_property(data); -// } - -} diff --git a/formersnapextractor/src/main/resources/application.properties b/formersnapextractor/src/main/resources/application.properties deleted file mode 100644 index 256553fd996bcf6edfc00d2799b25e9767957e5d..0000000000000000000000000000000000000000 --- a/formersnapextractor/src/main/resources/application.properties +++ /dev/null @@ -1,5 +0,0 @@ -#application properties -project.name=${project.name} -project.version=${project.version} -build.date=${buildNumber} - diff --git a/formersnapextractor/src/main/resources/log4j.xml b/formersnapextractor/src/main/resources/log4j.xml deleted file mode 100644 index 1eaef2ac37ab4553472d764f196255b04f9b8045..0000000000000000000000000000000000000000 --- a/formersnapextractor/src/main/resources/log4j.xml +++ /dev/null @@ -1,29 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" ?> -<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd"> - -<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/"> - - <appender name="stdout-appender" class="org.apache.log4j.ConsoleAppender"> - <layout class="org.apache.log4j.PatternLayout"> - <param name="ConversionPattern" value="%d{yyyy-MM-dd HH:mm:ss.SSS} %5p %C{5}.%l: %m%n" /> - </layout> - </appender> - - <logger name="org.jacorb"> - <level value="ERROR" /> - </logger> - - <logger name="org.hibernate"> - <level value="ERROR" /> - </logger> - - <logger name="org.springframework"> - <level value="ERROR" /> - </logger> - - <root> - <level value="DEBUG" /> - <appender-ref ref="stdout-appender" /> - </root> - -</log4j:configuration> diff --git a/formersnapextractor/src/test/resources/beans.xml b/formersnapextractor/src/test/resources/beans.xml deleted file mode 100644 index 3c548cc70a4bc88b89c1598581345b5f3474009c..0000000000000000000000000000000000000000 --- a/formersnapextractor/src/test/resources/beans.xml +++ /dev/null @@ -1,104 +0,0 @@ -<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.archiving.snap.api.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.archiving.snap.api.persistence.spring.dao.ScNum1ValDAOImpl"> - <constructor-arg ref="sessionFactory" /> - </bean> - - <bean id="scNum2ValDAO" class="fr.soleil.archiving.snap.api.persistence.spring.dao.ScNum2ValDAOImpl"> - <constructor-arg ref="sessionFactory" /> - </bean> - - <bean id="scStr1ValDAO" class="fr.soleil.archiving.snap.api.persistence.spring.dao.ScStr1ValDAOImpl"> - <constructor-arg ref="sessionFactory" /> - </bean> - - <bean id="scStr2ValDAO" class="fr.soleil.archiving.snap.api.persistence.spring.dao.ScStr2ValDAOImpl"> - <constructor-arg ref="sessionFactory" /> - </bean> - - <bean id="sp1ValDAO" class="fr.soleil.archiving.snap.api.persistence.spring.dao.Sp1ValDAOImpl"> - <constructor-arg ref="sessionFactory" /> - </bean> - - <bean id="sp2ValDAO" class="fr.soleil.archiving.snap.api.persistence.spring.dao.Sp2ValDAOImpl"> - <constructor-arg ref="sessionFactory" /> - </bean> - - <bean id="im1ValDAO" class="fr.soleil.archiving.snap.api.persistence.spring.dao.Im1ValDAOImpl"> - <constructor-arg ref="sessionFactory" /> - </bean> - - <bean id="im2ValDAO" class="fr.soleil.archiving.snap.api.persistence.spring.dao.Im2ValDAOImpl"> - <constructor-arg ref="sessionFactory" /> - </bean> - <!-- DAO BEANS DEFINITION ^^^^^^--> -</beans> \ No newline at end of file diff --git a/formersnapextractor/src/test/resources/beans_Orion.xml b/formersnapextractor/src/test/resources/beans_Orion.xml deleted file mode 100644 index 1750253c17b6edb6c6029e93925f3e67713f4131..0000000000000000000000000000000000000000 --- a/formersnapextractor/src/test/resources/beans_Orion.xml +++ /dev/null @@ -1,103 +0,0 @@ -<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:@LUTIN:1521:TEST11" /> - <property name="username" value="toto" /> - <property name="password" value="toto" /> - </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.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.archiving.snap.api.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.archiving.snap.api.persistence.spring.dao.ScNum1ValDAOImpl"> - <constructor-arg ref="sessionFactory" /> - </bean> - - <bean id="scNum2ValDAO" class="fr.soleil.archiving.snap.api.persistence.spring.dao.ScNum2ValDAOImpl"> - <constructor-arg ref="sessionFactory" /> - </bean> - - <bean id="scStr1ValDAO" class="fr.soleil.archiving.snap.api.persistence.spring.dao.ScStr1ValDAOImpl"> - <constructor-arg ref="sessionFactory" /> - </bean> - - <bean id="scStr2ValDAO" class="fr.soleil.archiving.snap.api.persistence.spring.dao.ScStr2ValDAOImpl"> - <constructor-arg ref="sessionFactory" /> - </bean> - - <bean id="sp1ValDAO" class="fr.soleil.archiving.snap.api.persistence.spring.dao.Sp1ValDAOImpl"> - <constructor-arg ref="sessionFactory" /> - </bean> - - <bean id="sp2ValDAO" class="fr.soleil.archiving.snap.api.persistence.spring.dao.Sp2ValDAOImpl"> - <constructor-arg ref="sessionFactory" /> - </bean> - - <bean id="im1ValDAO" class="fr.soleil.archiving.snap.api.persistence.spring.dao.Im1ValDAOImpl"> - <constructor-arg ref="sessionFactory" /> - </bean> - - <bean id="im2ValDAO" class="fr.soleil.archiving.snap.api.persistence.spring.dao.Im2ValDAOImpl"> - <constructor-arg ref="sessionFactory" /> - </bean> - <!-- DAO BEANS DEFINITION ^^^^^^--> -</beans> \ No newline at end of file diff --git a/formersnapextractor/src/test/resources/mysql.properties b/formersnapextractor/src/test/resources/mysql.properties deleted file mode 100644 index f3a887bfa71d54e8fbbfff68e3e8ffd96ad34ef6..0000000000000000000000000000000000000000 --- a/formersnapextractor/src/test/resources/mysql.properties +++ /dev/null @@ -1,7 +0,0 @@ -#change the mysql driver to the more recent com.mysql.jdbc.Driver -#DRIVER_CLASS_NAME = org.gjt.mm.mysql.Driver -DRIVER_CLASS_NAME = com.mysql.jdbc.Driver -URL = jdbc:mysql://localhost/snap?autoReconnect=true -USERNAME = snaparchiver -PASSWORD = snaparchiver -HIBERNATE_DIALECT = org.hibernate.dialect.MySQL5Dialect \ No newline at end of file diff --git a/formersnapextractor/src/test/resources/oracle.properties b/formersnapextractor/src/test/resources/oracle.properties deleted file mode 100644 index 297aa6c3c895a15117b9efadbb5f85f7798afda8..0000000000000000000000000000000000000000 --- a/formersnapextractor/src/test/resources/oracle.properties +++ /dev/null @@ -1,8 +0,0 @@ -DRIVER_CLASS_NAME = oracle.jdbc.driver.OracleDriver -#URL DEV -URL = jdbc:oracle:thin:@BIZET:1521:LET -#URL RCM -#URL = jdbc:oracle:thin:@jacquard:1521:HDB -USERNAME = SNAP -PASSWORD = SNAP -HIBERNATE_DIALECT = org.hibernate.dialect.Oracle9Dialect \ No newline at end of file diff --git a/formersnapextractor/src/test/resources/valueTables.hbm.xml b/formersnapextractor/src/test/resources/valueTables.hbm.xml deleted file mode 100644 index 8bf5854c7839f677cee9c73c95ccf46a34193a4f..0000000000000000000000000000000000000000 --- a/formersnapextractor/src/test/resources/valueTables.hbm.xml +++ /dev/null @@ -1,82 +0,0 @@ -<?xml version="1.0"?> -<!DOCTYPE hibernate-mapping PUBLIC - "-//Hibernate/Hibernate Mapping DTD 3.0//EN" - "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> - -<hibernate-mapping package="fr.soleil.archiving.snap.api.persistence.spring.dto"> - - <class name="ScNum1Val" table="t_sc_num_1val"> - <composite-id name="compositeId" class="CompositeId"> - <key-property name="idSnap" column="ID_SNAP"/> - <key-property name="idAtt" column="ID_ATT"/> - </composite-id> - <property name="value" column="VALUE"/> - </class> - - <class name="ScNum2Val" table="t_sc_num_2val"> - <composite-id name="compositeId" class="CompositeId"> - <key-property name="idSnap" column="ID_SNAP"/> - <key-property name="idAtt" column="ID_ATT"/> - </composite-id> - <property name="readValue" column="READ_VALUE"/> - <property name="writeValue" column="WRITE_VALUE"/> - </class> - - <class name="ScStr1Val" table="t_sc_str_1val"> - <composite-id name="compositeId" class="CompositeId"> - <key-property name="idSnap" column="ID_SNAP"/> - <key-property name="idAtt" column="ID_ATT"/> - </composite-id> - <property name="value" column="VALUE"/> - </class> - - <class name="ScStr2Val" table="t_sc_str_2val"> - <composite-id name="compositeId" class="CompositeId"> - <key-property name="idSnap" column="ID_SNAP"/> - <key-property name="idAtt" column="ID_ATT"/> - </composite-id> - <property name="readValue" column="READ_VALUE"/> - <property name="writeValue" column="WRITE_VALUE"/> - </class> - - <class name="Sp1Val" table="t_sp_1val"> - <composite-id name="compositeId" class="CompositeId"> - <key-property name="idSnap" column="ID_SNAP"/> - <key-property name="idAtt" column="ID_ATT"/> - </composite-id> - <property name="dimX" column="DIM_X"/> - <property name="value" column="VALUE"/> - </class> - - <class name="Sp2Val" table="t_sp_2val"> - <composite-id name="compositeId" class="CompositeId"> - <key-property name="idSnap" column="ID_SNAP"/> - <key-property name="idAtt" column="ID_ATT"/> - </composite-id> - <property name="dimX" column="DIM_X"/> - <property name="readValue" column="READ_VALUE"/> - <property name="writeValue" column="WRITE_VALUE"/> - </class> - - <class name="Im1Val" table="t_im_1val"> - <composite-id name="compositeId" class="CompositeId"> - <key-property name="idSnap" column="ID_SNAP"/> - <key-property name="idAtt" column="ID_ATT"/> - </composite-id> - <property name="dimX" column="DIM_X"/> - <property name="dimY" column="DIM_Y"/> - <property name="value" column="VALUE"/> - </class> - - <class name="Im2Val" table="t_im_2val"> - <composite-id name="compositeId" class="CompositeId"> - <key-property name="idSnap" column="ID_SNAP"/> - <key-property name="idAtt" column="ID_ATT"/> - </composite-id> - <property name="dimX" column="DIM_X"/> - <property name="dimY" column="DIM_Y"/> - <property name="readValue" column="READ_VALUE"/> - <property name="writeValue" column="WRITE_VALUE"/> - </class> - -</hibernate-mapping> \ No newline at end of file