diff --git a/snapmanager/src/main/java/SnapManager/CreateNewContextClass.java b/snapmanager/src/main/java/SnapManager/CreateNewContextClass.java deleted file mode 100644 index c59ba7345b90a2b4abce5a63eb907b6990efcd11..0000000000000000000000000000000000000000 --- a/snapmanager/src/main/java/SnapManager/CreateNewContextClass.java +++ /dev/null @@ -1,145 +0,0 @@ -// +====================================================================== -// $Source: /cvsroot/tango-cs/tango/jserver/snapshoting/SnapManager/CreateNewContextClass.java,v $ -// -// Project: Tango Device Server -// -// Description: Java source code for the command TemplateClass of the -// SnapManager class. -// -// $Author: chinkumo $ -// -// $Revision: 1.3 $ -// -// $Log: CreateNewContextClass.java,v $ -// Revision 1.3 2005/11/29 17:34:34 chinkumo -// no message -// -// Revision 1.2.2.2 2005/11/29 16:18:25 chinkumo -// Code reformated (pogo compatible) -// -// Revision 1.2.2.1 2005/11/15 13:45:32 chinkumo -// ... -// -// Revision 1.2 2005/08/19 14:03:26 chinkumo -// no message -// -// Revision 1.1 2005/06/22 09:27:21 chinkumo -// Tango V5 regenerated. -// -// -// 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: chinkumo $ - * @version $Revision: 1.3 $ - */ -package SnapManager; - -import org.omg.CORBA.Any; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import fr.esrf.Tango.DevFailed; -import fr.esrf.Tango.DispLevel; -import fr.esrf.TangoDs.Command; -import fr.esrf.TangoDs.DeviceImpl; -import fr.esrf.TangoDs.TangoConst; - -/** - * Class Description: This command is used to register a snapShot context. All - * informations concerning the snapshot pattern (creation date, reason, - * description and, the <I>list of attributes</I> that are included in the - * context) are passed through an array (DEVVAR_STRINGARRAY). - */ - -public class CreateNewContextClass extends Command implements TangoConst { - - private static final Logger LOGGER = LoggerFactory.getLogger(CreateNewContextClass.class); - - // =============================================================== - /** - * Constructor for Command class CreateNewContextClass - * - * @param name command name - * @param in argin type - * @param out argout type - */ - // =============================================================== - public CreateNewContextClass(String name, int in, int out) { - super(name, in, out); - } - - // =============================================================== - /** - * Constructor for Command class CreateNewContextClass - * - * @param name command name - * @param in argin type - * @param in_comments argin description - * @param out argout type - * @param out_comments argout description - */ - // =============================================================== - public CreateNewContextClass(String name, int in, int out, String in_comments, String out_comments) { - super(name, in, out, in_comments, out_comments); - } - - // =============================================================== - /** - * Constructor for Command class CreateNewContextClass - * - * @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 CreateNewContextClass(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 { - LOGGER.info("CreateNewContextClass.execute(): arrived"); - String[] argin = extract_DevVarStringArray(in_any); - return insert(((SnapManager) (device)).create_new_context(argin)); - } - - // =============================================================== - /** - * Check if it is allowed to execute the command. - */ - // =============================================================== - @Override - public boolean is_allowed(DeviceImpl device, Any data_in) { - // End of Generated Code - - // Re-Start of Generated Code - return true; - } -} - -// ----------------------------------------------------------------------------- -/* - * end of $Source: - * /cvsroot/tango-cs/tango/jserver/snapshoting/SnapManager/CreateNewContextClass - * .java,v $ - */ diff --git a/snapmanager/src/main/java/SnapManager/LaunchSnapShotCmd.java b/snapmanager/src/main/java/SnapManager/LaunchSnapShotCmd.java deleted file mode 100644 index b2dedb728d098392a39e588f9e8d07ffb92111a1..0000000000000000000000000000000000000000 --- a/snapmanager/src/main/java/SnapManager/LaunchSnapShotCmd.java +++ /dev/null @@ -1,157 +0,0 @@ -// +====================================================================== -// $Source$ -// -// Project: Tango Device Server -// -// Description: Java source code for the command TemplateClass of the -// SnapArchiver class. -// -// $Author: candelrg $ -// -// $Revision: 27049 $ -// -// $Log$ -// Revision 1.3 2009/12/17 10:29:53 pierrejoseph -// CheckStyle:Organize imports -// -// Revision 1.2 2009/05/29 09:08:03 soleilarc -// manage exception for the LaunchSnapshot command -// -// Revision 1.1 2009/01/27 14:05:50 soleilarc -// move LauchSnapshot command from Archiver to Manager -// -// Revision 1.5 2006/04/12 15:46:40 ounsy -// corrected the missing attributes problem -// -// Revision 1.4 2005/11/29 17:33:03 chinkumo -// no message -// -// Revision 1.3.10.2 2005/11/29 16:16:50 chinkumo -// Code reformated (pogo compatible) -// -// Revision 1.3.10.1 2005/11/15 13:46:17 chinkumo -// ... -// -// Revision 1.3 2005/06/15 14:02:53 chinkumo -// The device was regenerated in Tango V5. -// -// -// 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: candelrg $ - * @version $Revision: 27049 $ - */ -package SnapManager; - -import org.omg.CORBA.Any; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -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; - -/** - * Class Description: This command is used to trigger a snapShot. All - * informations concerning the snapshot will be retrieved with the identifier - * parameter. - */ - -public class LaunchSnapShotCmd extends Command implements TangoConst { - - private static final Logger LOGGER = LoggerFactory.getLogger(LaunchSnapShotCmd.class); - - // =============================================================== - /** - * Constructor for Command class LaunchSnapShotCmd - * - * @param name command name - * @param in argin type - * @param out argout type - */ - // =============================================================== - public LaunchSnapShotCmd(String name, int in, int out) { - super(name, in, out); - } - - // =============================================================== - /** - * Constructor for Command class LaunchSnapShotCmd - * - * @param name command name - * @param in argin type - * @param in_comments argin description - * @param out argout type - * @param out_comments argout description - */ - // =============================================================== - public LaunchSnapShotCmd(String name, int in, int out, String in_comments, String out_comments) { - super(name, in, out, in_comments, out_comments); - } - - // =============================================================== - /** - * Constructor for Command class LaunchSnapShotCmd - * - * @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 LaunchSnapShotCmd(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 { - LOGGER.info("LaunchSnapShotCmd.execute(): arrived"); - int argin = extract_DevLong(in_any); - if (argin < 0) { - Except.throw_exception("INPUT_ERROR", "Invalid Context ID", "SnapManager.LaunchSnapshot"); - } - ((SnapManager) device).launch_snap_shot(argin); - return insert(); - } - - // =============================================================== - /** - * Check if it is allowed to execute the command. - */ - // =============================================================== - @Override - public boolean is_allowed(DeviceImpl device, Any data_in) { - // End of Generated Code - - // Re-Start of Generated Code - return true; - } -} - -// ----------------------------------------------------------------------------- -/* - * end of $Source: - * /cvsroot/tango-cs/archiving/server/snapArchivingServers/src/main - * /java/SnapManager/LaunchSnapShotCmd.java,v $ - */ diff --git a/snapmanager/src/main/java/SnapManager/SetEquipmentsClass.java b/snapmanager/src/main/java/SnapManager/SetEquipmentsClass.java deleted file mode 100644 index 74cfe4269cb47bca532f90ed9b3f878ccb65d7c3..0000000000000000000000000000000000000000 --- a/snapmanager/src/main/java/SnapManager/SetEquipmentsClass.java +++ /dev/null @@ -1,128 +0,0 @@ -// +====================================================================== -// $Source: /cvsroot/tango-cs/tango/jserver/snapshoting/SnapManager/SetEquipmentsClass.java,v $ -// -// Project: Tango Device Server -// -// Description: Java source code for the command TemplateClass of the -// SnapManager class. -// -// $Author: soleilarc $ -// -// $Revision: 1.1 $ -// -// $Log: SetEquipmentsClass.java,v $ -// Revision 1.1 2007/11/16 10:17:36 soleilarc -// Author: XPigeon -// Mantis bug ID: 5341 -// Comment : Define this new class. -// -// -// 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 SnapManager; - -import org.omg.CORBA.Any; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import fr.esrf.Tango.DevFailed; -import fr.esrf.Tango.DispLevel; -import fr.esrf.TangoDs.Command; -import fr.esrf.TangoDs.DeviceImpl; -import fr.esrf.TangoDs.TangoConst; - -/** - * Class Description: This command is used to set values to equipments. - */ - -public class SetEquipmentsClass extends Command implements TangoConst { - - private static final Logger LOGGER = LoggerFactory.getLogger(SetEquipmentsClass.class); - - // =============================================================== - /** - * Constructor for Command class SetEquipmentsClass - * - * @param name command name - * @param in argin type - * @param out argout type - */ - // =============================================================== - public SetEquipmentsClass(String name, int in, int out) { - super(name, in, out); - } - - // =============================================================== - /** - * Constructor for Command class SetEquipmentsClass - * - * @param name command name - * @param in argin type - * @param in_comments argin description - * @param out argout type - * @param out_comments argout description - */ - // =============================================================== - public SetEquipmentsClass(String name, int in, int out, String in_comments, String out_comments) { - super(name, in, out, in_comments, out_comments); - } - - // =============================================================== - /** - * Constructor for Command class SetEquipmentsClass - * - * @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 SetEquipmentsClass(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 { - LOGGER.info("SetEquipmentsClass.execute(): arrived"); - String[] argin = extract_DevVarStringArray(in_any); - ((SnapManager) (device)).set_equipments(argin); - return insert(); - } - - // =============================================================== - /** - * Check if it is allowed to execute the command. - */ - // =============================================================== - @Override - public boolean is_allowed(DeviceImpl device, Any data_in) { - // End of Generated Code - - // Re-Start of Generated Code - return true; - } -} - -// ----------------------------------------------------------------------------- -/* - * end of $Source: - * /cvsroot/tango-cs/tango/jserver/snapshoting/SnapManager/SetEquipmentsClass - * .java,v $ - */ diff --git a/snapmanager/src/main/java/SnapManager/SetEquipmentsWithCommandClass.java b/snapmanager/src/main/java/SnapManager/SetEquipmentsWithCommandClass.java deleted file mode 100644 index b4831cb74cbb9098c387f9f2ce1cc40ec7283e45..0000000000000000000000000000000000000000 --- a/snapmanager/src/main/java/SnapManager/SetEquipmentsWithCommandClass.java +++ /dev/null @@ -1,102 +0,0 @@ -/** - * @author $Author: pierrejoseph $ - * @version $Revision: 13956 $ - */ -package SnapManager; - -import org.omg.CORBA.Any; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import fr.esrf.Tango.DevFailed; -import fr.esrf.Tango.DispLevel; -import fr.esrf.TangoDs.Command; -import fr.esrf.TangoDs.DeviceImpl; -import fr.esrf.TangoDs.TangoConst; - -/** - * Class Description: This command is used to set command to equipments. - */ - -public class SetEquipmentsWithCommandClass extends Command implements TangoConst { - - private static final Logger LOGGER = LoggerFactory.getLogger(SetEquipmentsWithCommandClass.class); - - // =============================================================== - /** - * Constructor for Command class SetEquipmentsWithCommandClass - * - * @param name command name - * @param in argin type - * @param out argout type - */ - // =============================================================== - public SetEquipmentsWithCommandClass(String name, int in, int out) { - super(name, in, out); - } - - // =============================================================== - /** - * Constructor for Command class SetEquipmentsWithCommandClass - * - * @param name command name - * @param in argin type - * @param in_comments argin description - * @param out argout type - * @param out_comments argout description - */ - // =============================================================== - public SetEquipmentsWithCommandClass(String name, int in, int out, String in_comments, String out_comments) { - super(name, in, out, in_comments, out_comments); - } - - // =============================================================== - /** - * Constructor for Command class SetEquipmentsWithCommandClass - * - * @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 SetEquipmentsWithCommandClass(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 { - LOGGER.info("SetEquipmentsWithCommandClass.execute(): arrived"); - String[] argin = extract_DevVarStringArray(in_any); - - return insert(((SnapManager) (device)).set_equipments_with_command(argin)); - } - - // =============================================================== - /** - * Check if it is allowed to execute the command. - */ - // =============================================================== - @Override - public boolean is_allowed(DeviceImpl device, Any data_in) { - // End of Generated Code - - // Re-Start of Generated Code - return true; - } -} - -// ----------------------------------------------------------------------------- -/* - * end of $Source: - * /cvsroot/tango-cs/archiving/server/snapArchivingServers/src/main - * /java/SnapManager/SetEquipmentsWithCommandClass.java,v $ - */ diff --git a/snapmanager/src/main/java/SnapManager/SetEquipmentsWithSnapshotClass.java b/snapmanager/src/main/java/SnapManager/SetEquipmentsWithSnapshotClass.java deleted file mode 100644 index d1df9b9b85489d781fc76c2f39cc5ce5a8d56189..0000000000000000000000000000000000000000 --- a/snapmanager/src/main/java/SnapManager/SetEquipmentsWithSnapshotClass.java +++ /dev/null @@ -1,142 +0,0 @@ -//+====================================================================== -// $Source: /cvsroot/tango-cs/tango/jserver/snapshoting/SnapManager/SetEquipmentsWithSnapshotClass.java,v $ -// -// Project: Tango Device Server -// -// Description: Java source code for the command TemplateClass of the -// SnapManager class. -// -// $Author: chinkumo $ -// -// $Revision: 1.3 $ -// -// $Log: SetEquipmentsWithSnapshotClass.java,v $ -// Revision 1.3 2005/11/29 17:34:34 chinkumo -// no message -// -// Revision 1.2.2.2 2005/11/29 16:18:25 chinkumo -// Code reformated (pogo compatible) -// -// Revision 1.2.2.1 2005/11/15 13:45:32 chinkumo -// ... -// -// Revision 1.2 2005/08/19 14:48:31 chinkumo -// no message -// -// Revision 1.1.2.1 2005/08/11 08:17:45 chinkumo -// The 'SetEquipement' command and thus functionnality was added. -// -// -// 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: chinkumo $ - * @version $Revision: 1.3 $ - */ -package SnapManager; - -import org.omg.CORBA.Any; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import fr.esrf.Tango.DevFailed; -import fr.esrf.Tango.DispLevel; -import fr.esrf.TangoDs.Command; -import fr.esrf.TangoDs.DeviceImpl; -import fr.esrf.TangoDs.TangoConst; - -/** - * Class Description: This command is used to set values to equipments. - */ - -public class SetEquipmentsWithSnapshotClass extends Command implements TangoConst { - - private static final Logger LOGGER = LoggerFactory.getLogger(SetEquipmentsWithSnapshotClass.class); - - // =============================================================== - /** - * Constructor for Command class SetEquipmentsWithSnapshotClass - * - * @param name command name - * @param in argin type - * @param out argout type - */ - // =============================================================== - public SetEquipmentsWithSnapshotClass(String name, int in, int out) { - super(name, in, out); - } - - // =============================================================== - /** - * Constructor for Command class SetEquipmentsWithSnapshotClass - * - * @param name command name - * @param in argin type - * @param in_comments argin description - * @param out argout type - * @param out_comments argout description - */ - // =============================================================== - public SetEquipmentsWithSnapshotClass(String name, int in, int out, String in_comments, String out_comments) { - super(name, in, out, in_comments, out_comments); - } - - // =============================================================== - /** - * Constructor for Command class SetEquipmentsWithSnapshotClass - * - * @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 SetEquipmentsWithSnapshotClass(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 { - LOGGER.info("SetEquipmentsWithSnapshotClass.execute(): arrived"); - String[] argin = extract_DevVarStringArray(in_any); - ((SnapManager) (device)).set_equipments_with_snapshot(argin); - return insert(); - } - - // =============================================================== - /** - * Check if it is allowed to execute the command. - */ - // =============================================================== - @Override - public boolean is_allowed(DeviceImpl device, Any data_in) { - // End of Generated Code - - // Re-Start of Generated Code - return true; - } -} - -// ----------------------------------------------------------------------------- -/* - * end of $Source:/cvsroot/tango-cs/tango/jserver/snapshoting/SnapManager/ - * SetEquipmentsWithSnapshotClass.java,v $ - */ diff --git a/snapmanager/src/main/java/SnapManager/SnapManager.java b/snapmanager/src/main/java/SnapManager/SnapManager.java deleted file mode 100644 index 93a7b1112172af935ea98508fd8f9ab201664b7a..0000000000000000000000000000000000000000 --- a/snapmanager/src/main/java/SnapManager/SnapManager.java +++ /dev/null @@ -1,745 +0,0 @@ -// +============================================================================ -//$Source: /cvsroot/tango-cs/tango/jserver/snapshoting/SnapManager/SnapManager.java,v $ - -//project : Tango Device Server - -//Description: java source code for the SnapManager 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 SnapManager are implemented -//in this file. - -//$Author: pierrejoseph $ - -//$Revision: 1.22 $ - -//$Log: SnapManager.java,v $ -//Revision 1.22 2007/12/12 17:39:42 pierrejoseph -//Add comments on the SetEquipments method for the Javadoc - -//Revision 1.21 2007/11/23 09:23:13 pierrejoseph -//Modification of set_equipements method to no more works with the SnapExtractor api - -//Revision 1.20 2007/11/20 15:27:19 pierrejoseph -//Exception are raised by the method SetEquipments - -//Revision 1.19 2007/11/16 10:14:21 soleilarc -//Author: XPigeon -//Mantis bug ID: 5341 -//Comment : -//In the init_device method, create an instance of ISnapReader. -//Define the new method named setEquipments. - -//Revision 1.18 2007/05/11 13:58:54 pierrejoseph -//Attribute addition : release version - -//Revision 1.17 2007/03/02 07:54:57 ounsy -//extend DeviceImpl instead of DeviceImplWithShutdownRunnable - -//Revision 1.16 2006/12/06 10:16:02 ounsy -//minor changes - -//Revision 1.15 2006/11/20 09:38:54 ounsy -//minor changes - -//Revision 1.14 2006/11/13 15:58:06 ounsy -//all java devices now inherit from UnexportOnShutdownDeviceImpl instead of from DeviceImpl - -//Revision 1.13 2006/05/30 13:03:10 ounsy -//minor changes - -//Revision 1.12 2006/04/21 09:05:28 ounsy -//New command "UpdateSnapComment" added - -//Revision 1.11 2006/02/15 09:09:57 ounsy -//minor changes : uncomment to debug - -//Revision 1.10 2005/11/29 17:34:34 chinkumo -//no message - -//Revision 1.9.2.2 2005/11/29 16:18:25 chinkumo -//Code reformated (pogo compatible) - -//Revision 1.9.2.1 2005/11/15 13:45:32 chinkumo -//... - -//Revision 1.9 2005/08/19 14:03:26 chinkumo -//no message - -//Revision 1.8.6.1 2005/08/11 08:16:44 chinkumo -//The 'SetEquipement' command and thus functionnality was added. - -//Revision 1.8 2005/06/28 09:10:28 chinkumo -//Changes made to improve the management of exceptions were reported here. - -//Revision 1.7 2005/06/22 09:28:34 chinkumo -//Tango V5 regenerated. - -//Revision 1.5 2005/06/15 14:03:29 chinkumo -//The device was regenerated in Tango V5. - -//Revision 1.4 2005/06/14 12:11:40 chinkumo -//Branch (snapManager_1_0_1-branch_0) and HEAD merged. - -//Revision 1.3.4.1 2005/05/11 15:53:43 chinkumo -//The create_new_context's command comment was enhanced. - -//Revision 1.3 2005/01/26 17:06:25 chinkumo -//Ultimate synchronization before real sharing. - -//Revision 1.2 2004/12/06 17:30:44 chinkumo -//Renaming package 'TangoSnap' into 'TangoSnapshoting' - -//Revision 1.1 2004/06/11 14:13:41 chinkumo -//The first team version. - -//Revision 1.1 2004/05/10 14:01:33 chinkumo -//Archiving sources - -//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 SnapManager; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Objects; -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.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.tango.utils.DevFailedUtils; - -import fr.esrf.Tango.DevError; -import fr.esrf.Tango.DevFailed; -import fr.esrf.Tango.DevState; -import fr.esrf.Tango.DevVarLongStringArray; -import fr.esrf.TangoApi.DbDevice; -import fr.esrf.TangoDs.Attribute; -import fr.esrf.TangoDs.DeviceClass; -import fr.esrf.TangoDs.DeviceImpl; -import fr.esrf.TangoDs.Except; -import fr.esrf.TangoDs.TangoConst; -import fr.esrf.TangoDs.Util; -import fr.soleil.archiving.snap.api.SnapConnectionParameters; -import fr.soleil.archiving.snap.api.manager.ISnapManager; -import fr.soleil.archiving.snap.api.manager.SnapManagerApi; -import fr.soleil.archiving.snap.api.manager.SnapManagerImpl; -import fr.soleil.archiving.snap.api.tools.SnapAttributeExtract; -import fr.soleil.archiving.snap.api.tools.SnapConst; -import fr.soleil.archiving.snap.api.tools.SnapContext; -import fr.soleil.archiving.snap.api.tools.Snapshot; -import fr.soleil.archiving.snap.api.tools.SnapshotingException; -import fr.soleil.tango.clientapi.TangoCommand; - -/** - * Class Description: This DServer provides the connections points and methods - * to the SnapShot service. - * - * @author $Author: pierrejoseph $ - * @version $Revision: 1.22 $ - */ - -// --------- Start of States Description ---------- -/* - * Device States Description: - */ -// --------- End of States Description ---------- -public class SnapManager extends DeviceImpl/* WithShutdownRunnable */ implements TangoConst { - - private static final Logger LOGGER = LoggerFactory.getLogger(SnapManager.class); - - protected int state; - private final String m_version; - // --------- Start of attributes data members ---------- - - // --------- End of attributes data members ---------- - - // --------- Start of properties data members ---------- - /** - * User identifier (name) used to connect the database for snapshots. <br> - * <b>Default value : </b> archiver - */ - protected String dbUser; - /** - * Password used to connect the database for snapshots. <br> - * <b>Default value : </b> archiver - */ - protected String dbPassword; - - // --------- End of properties data members ---------- - - // Add your own data members here - private ISnapManager m_manager; - - private final ExecutorService executorService = Executors.newSingleThreadExecutor(); - private final Map<Integer, Future<Integer>> snapshotResults = new HashMap<Integer, Future<Integer>>(); - private String dbHost; - private String dbName; - private String dbSchema; - private String isRac; - - // private DataBaseAPI snapDb; - // -------------------------------------- - - // ========================================================= - /** - * Constructor for simulated Time Device Server. - * - * @param cl - * The DeviceClass object - * @param s - * The Device name. - * @param version - * The device version - */ - // ========================================================= - public SnapManager(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 - */ - // ========================================================= - public SnapManager(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 { - LOGGER.info("SnapManager() create " + device_name); - - // Initialise variables to default values - // ------------------------------------------- - - get_device_property(); - try { - // Snap Database connection - SnapManagerApi.initSnapConnection(dbHost, dbName, dbSchema, dbUser, dbPassword, isRac); - set_state(DevState.ON); - } catch (SnapshotingException e) { - LOGGER.warn(e.toString(), e); - set_state(DevState.FAULT); - set_status(e.toString()); - // throw e.toTangoException(); - } - - } - - // =================================================================== - /** - * Read the device properties from database. - */ - // =================================================================== - private 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(); - - LOGGER.info(SnapConnectionParameters.appendSnapConnectionInfoLog(new StringBuilder("Connection info:\n")) - .toString()); - - } catch (SnapshotingException e) { - e.printStackTrace(); - } - } - - // ========================================================= - /** - * Method always executed before command execution. - */ - // ========================================================= - @Override - public void always_executed_hook() { - // LOGGER.info("In always_executed_hook method()"); - } - - // ========================================================= - /** - * Execute command "CreateNewContext" on device. This command is used to - * register a snapShot context. All informations concerning the snapshot - * pattern (creation date, reason, description and, the <I>list of - * attributes</I> that are included in the context) are passed through an - * array (DEVVAR_STRINGARRAY). - * - * - * - * @param argin - * All the informations usefull to create a context ,Snapshot - * pattern). - * @return The new assigned context ID - */ - // ========================================================= - public int create_new_context(String[] argin) throws DevFailed { - int argout = -1; - LOGGER.info("Entering create_new_context()"); - - // ---Add your Own code to control device here --- - SnapContext snapContext = new SnapContext(argin); - try { - argout = SnapManagerApi.createContext(snapContext); - } catch (SnapshotingException e) { - LOGGER.warn(e.toString(), e); - throw e.toTangoException(); - } - LOGGER.info("Exiting create_new_context()"); - return argout; - } - - // ========================================================= - /** - * Execute command "LaunchSnapShot" on device. This command is used to - * trigger a snapShot. All informations concerning the snapshot will be - * retrieved with the identifier parameter. - * - * @param argin - * The snapshot associated context's identifier. - * @throws SnapshotingException - */ - // ========================================================= - public void launch_snap_shot(int argin) throws DevFailed { - LOGGER.info("Entering launch_snap_shot()"); - if (get_state().equals(DevState.RUNNING)) { - throw DevFailedUtils.newDevFailed("STATE_ERROR", "snapshot alreadly in progress"); - } - set_state(DevState.RUNNING); - Future<Integer> snapshotResult = executorService.submit(new SnapshotTask(argin)); - snapshotResults.put(argin, snapshotResult); - } - - public int getSnapShotResult(int argin) throws DevFailed { - int result = -1; - try { - 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); - } - } - return result; - } - - private class SnapshotTask implements Callable<Integer> { - private final int contextID; - - public SnapshotTask(int contextID) { - this.contextID = contextID; - } - - @Override - public Integer call() throws Exception { - if (m_manager == null) { - m_manager = new SnapManagerImpl(); - } - SnapContext context = new SnapContext(); - Snapshot snapShot = null; - context.setId(contextID); - try { - snapShot = m_manager.launchSnapshot(context); - } catch (SnapshotingException e) { - LOGGER.warn(e.toString(), e); - throw e.toTangoException(); - } finally { - SnapManager.this.set_state(DevState.ON); - } - LOGGER.info("Exiting launch_snap_shot()"); - - return snapShot.getId_snap(); - } - } - - // ========================================================= - /** - * Execute command "SetEquipmentsWithSnapshot" on device. This command is - * used to set values to equipments. - * - * @param argin - * The snapshot from which equipments are set. - */ - // ========================================================= - public void set_equipments_with_snapshot(String[] argin) throws DevFailed { - LOGGER.info("Entering set_equipments_with_snapshot() xxx"); - try { - Snapshot snapShot = new Snapshot(argin); - // ---Add your Own code to control device here --- - SnapManagerApi.TriggerSetEquipments(snapShot); - } catch (SnapshotingException e) { - e.printStackTrace(); - LOGGER.warn(e.toString(), e); - throw e.toTangoException(); - } catch (Exception e) { - e.printStackTrace(); - throw DevFailedUtils.newDevFailed(e); - } catch (Throwable t) { - t.printStackTrace(); - } - LOGGER.info("Exiting set_equipments_with_snapshot()"); - } - - // ========================================================= - /** - * Execute command "SetEquipmentsWithCommand" on device. This command is - * used to set snapshot attribute's values as command argument to - * equipments. - * - * @param argin - * The command name and The snapshot id from which equipments are - * set. - * @throws SnapshotingException - */ - // ========================================================= - public String set_equipments_with_command(String[] argin) throws DevFailed { - try { - String command_name = argin[0]; - int snap_id = Integer.parseInt(argin[2]); - if (snap_id < 0) { - Except.throw_exception("CONFIGURATION_ERROR", "Invalid SnapId", "SnapManager.SetEquipmentsWithCommand"); - } - // The attributes of the snapshot are gotten as they were saved in - // the database. - SnapAttributeExtract[] snapAttributeExtractArray; - if (m_manager == null) { - m_manager = new SnapManagerImpl(); - } - snapAttributeExtractArray = m_manager.getSnap(snap_id); - if (snapAttributeExtractArray == null || snapAttributeExtractArray.length == 0) { - Except.throw_exception("CONFIGURATION_ERROR", "Invalid SnapId", "SnapManager.SetEquipmentsWithCommand"); - } - - SnapAttributeExtract[] selectedAttributes = null; - // If there is more than 3 arguments for this method, - // we search if they are selected attributes for this snapshot (selected attributes). - if (argin.length > 3) { - List<SnapAttributeExtract> existingAttributes = new ArrayList<SnapAttributeExtract>(); - for (SnapAttributeExtract snapshotAttribute : snapAttributeExtractArray) { - for (int index = 3; index < argin.length; ++index) { - String element = argin[index]; - if (element != null) { - if (element.equalsIgnoreCase(snapshotAttribute.getAttributeCompleteName())) { - existingAttributes.add(snapshotAttribute); - break; - } - } - } - } - if (existingAttributes.size() > 0) { - selectedAttributes = new SnapAttributeExtract[existingAttributes.size()]; - selectedAttributes = existingAttributes.toArray(selectedAttributes); - } - existingAttributes = null; - } else { - selectedAttributes = snapAttributeExtractArray; - } - - // add attributes test: 1-different devices 2-same format - if (validSnapshot(selectedAttributes)) { - List<String> result = new ArrayList<String>(); - boolean hasFailed = false; - List<DevError> errorStack = new ArrayList<DevError>(); - for (SnapAttributeExtract attributeSnap : selectedAttributes) { - try { - TangoCommand cmd = new TangoCommand(attributeSnap.getdeviceName(), command_name); - Object value = null; - if (SnapConst.STORED_READ_VALUE.equals(argin[1])) { - value = attributeSnap.getReadValue(); - if (value == null) { - value = attributeSnap.getWriteValue(); - } - } else if (SnapConst.STORED_WRITE_VALUE.equals(argin[1])) { - value = attributeSnap.getWriteValue(); - if (value == null) { - value = attributeSnap.getReadValue(); - } - } - LOGGER.info(command_name + " with " + value + " on " + attributeSnap.getdeviceName()); - cmd.execute(value); - if (!cmd.isArginVoid()) { - result.add(cmd.extractToString(",")); - } - } catch (DevFailed e) { - hasFailed = true; - DevError[] err = e.errors; - for (DevError devError : err) { - errorStack.add(devError); - } - } - } - if (hasFailed) { - throw new DevFailed(errorStack.toArray(new DevError[errorStack.size()])); - } - return Arrays.toString(result.toArray(new String[result.size()])); - } - } catch (SnapshotingException e) { - Except.throw_exception("CONFIGURATION_ERROR", e.getMessage(), "SnapManager.SetEquipmentsWithCommand"); - } catch (NumberFormatException e1) { - Except.throw_exception("CONFIGURATION_ERROR", "Invalid snapshot ID", - "SnapManager.SetEquipmentsWithCommand"); - - } - return ""; - } - - /* - * test if the attributes are from different devices and have the same - * format - */ - private boolean validSnapshot(SnapAttributeExtract[] selectedAttributes) throws DevFailed { - int format = selectedAttributes[0].getDataFormat(); - int nbOccurs = numberOfOccurrences(selectedAttributes, selectedAttributes[0].getdeviceName()); - if (nbOccurs > 1) { - Except.throw_exception("CONFIGURATION_ERROR", "A device cannot be selected more than one time", - "SnapManager.SetEquipmentsWithCommand"); - return false; - } - for (int i = 1; i < selectedAttributes.length; i++) { - if (selectedAttributes[i].getDataFormat() != format) { - Except.throw_exception( - "CONFIGURATION_ERROR", "Some attributes have incompatible format : " - + selectedAttributes[i].getDataFormat() + " and " + format, - "SnapManager.SetEquipmentsWithCommand"); - return false; - } else if (numberOfOccurrences(selectedAttributes, selectedAttributes[i].getdeviceName()) > 1) { - Except.throw_exception("CONFIGURATION_ERROR", "A device cannot be selected more than one time", - "SnapManager.SetEquipmentsWithCommand"); - } - } - return true; - } - - /** - * - * @param snapAttributeExtractArray - * @param getdeviceName - * @return occurrence number of the input device name - */ - private int numberOfOccurrences(SnapAttributeExtract[] snapAttributeExtractArray, String device) { - int occ = 0; - for (int i = 0; i < snapAttributeExtractArray.length; i++) { - if (snapAttributeExtractArray[i].getdeviceName().equals(device)) { - occ++; - } - } - return occ; - } - - // ========================================================= - /** - * Execute command "SetEquipments" on device. This command is used to set - * values to equipments. - * - * @param argin - * "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>"<var>index</var>" </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>" - */ - // ========================================================= - public void set_equipments(String[] argin) throws DevFailed { - LOGGER.info("Entering set_equipments() xxx"); - // ---Add your Own code to control device here --- - if (argin.length < 2) { - Except.throw_exception("CONFIGURATION_ERROR", "Wrong number of parameters", "SnapManager.SetEquipments"); - } else { - int snapId; - try { - // Retrieve the snapid value - snapId = Integer.parseInt(argin[0]); - if (m_manager == null) { - m_manager = new SnapManagerImpl(); - } - // The attributes of the snapshot are gotten as they were saved - // in the database. - SnapAttributeExtract[] snapAttributeExtractArray = m_manager.getSnap(snapId); - - if (snapAttributeExtractArray == null || snapAttributeExtractArray.length == 0) { - Except.throw_exception("CONFIGURATION_ERROR", "Invalid SnapId", "SnapManager.SetEquipments"); - } - Snapshot snapShot = Snapshot.getPartialSnapShot(argin, snapId, snapAttributeExtractArray); - if (snapShot == null) { - return; - } - SnapManagerApi.TriggerSetEquipments(snapShot); - } catch (SnapshotingException e) { - LOGGER.warn(e.toString(), e); - throw e.toTangoException(); - } catch (NumberFormatException e) { - Except.throw_exception("CONFIGURATION_ERROR", "Wrong parameters values ", "SnapManager.SetEquipments"); - } catch (Exception e) { - throw DevFailedUtils.newDevFailed(e); - } catch (Throwable t) { - t.printStackTrace(); - } - } - LOGGER.info("Exiting set_equipments()"); - } - - // ========================================================= - /** - * Execute command "UpdateSnapComment" on device. This command updates the - * comment of given snapshot - * - * - * @param argin - * 1) snapshot identifier 2) The new comment - */ - // ========================================================= - public void update_snap_comment(DevVarLongStringArray argin) throws DevFailed { - LOGGER.info("Entering update_snap_comment()"); - - // ---Add your Own code to control device here --- - int id_snap = argin.lvalue[0]; - String comment = argin.svalue[0]; - try { - SnapManagerApi.updateSnapComment(id_snap, comment); - } catch (SnapshotingException e) { - LOGGER.warn(e.toString(), e); - throw e.toTangoException(); - } - LOGGER.info("Exiting update_snap_comment()"); - } - - public String getSnapComment(int snapID) throws DevFailed { - try { - return Objects.toString(SnapManagerApi.getSnapComment(snapID)); - } catch (SnapshotingException e) { - throw e.toTangoException(); - } - } - - // =================================================================== - /** - * 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(); - 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); - } - } - - // ========================================================= - /** - * main part for the device server class - */ - // ========================================================= - public static void main(String[] argv) { - try { - Util tg = Util.init(argv, "SnapManager"); - tg.server_init(); - - LOGGER.info("Ready to accept request"); - - tg.server_run(); - } - - catch (OutOfMemoryError ex) { - LOGGER.error("Can't allocate memory !!!!", ex); - LOGGER.error("Exiting"); - } catch (UserException ex) { - LOGGER.error("Received a CORBA user exception", ex); - LOGGER.error("Exiting"); - } catch (SystemException ex) { - LOGGER.error("Received a CORBA system exception", ex); - LOGGER.error("Exiting"); - } - - System.exit(-1); - } - - @Override - public void delete_device() throws DevFailed { - snapshotResults.clear(); - } -} - -// -------------------------------------------------------------------------- -/* - * end of $Source: - * /cvsroot/tango-cs/tango/jserver/snapshoting/SnapManager/SnapManager.java,v $ - */ diff --git a/snapmanager/src/main/java/SnapManager/SnapManagerClass.java b/snapmanager/src/main/java/SnapManager/SnapManagerClass.java deleted file mode 100644 index 0027b4af5ead2e9f98f4c20889123374d8492d71..0000000000000000000000000000000000000000 --- a/snapmanager/src/main/java/SnapManager/SnapManagerClass.java +++ /dev/null @@ -1,271 +0,0 @@ -// +====================================================================== -// $Source: /cvsroot/tango-cs/tango/jserver/snapshoting/SnapManager/SnapManagerClass.java,v $ -// -// Project: Tango Device Server -// -// Description: java source code for the SnapManager class . -// This class is a singleton class and implements everything -// which exists only once for all the SnapManager object -// It inherits from the DeviceClass class. -// -// $Author: pierrejoseph $ -// -// $Revision: 1.14 $ -// -// $Log: SnapManagerClass.java,v $ -// Revision 1.14 2007/12/12 17:39:42 pierrejoseph -// Add comments on the SetEquipments method for the Javadoc -// -// Revision 1.13 2007/11/16 10:16:55 soleilarc -// Author: XPigeon -// Mantis bug ID: 5341 -// Comment : Add the SetEquipments method in the commands list. -// -// Revision 1.12 2007/05/11 13:58:53 pierrejoseph -// Attribute addition : release version -// -// Revision 1.11 2006/12/06 10:16:02 ounsy -// minor changes -// -// Revision 1.10 2006/04/21 09:05:28 ounsy -// New command "UpdateSnapComment" added -// -// Revision 1.9 2006/03/27 13:58:35 ounsy -// organized imports -// -// Revision 1.8 2005/11/29 17:34:34 chinkumo -// no message -// -// Revision 1.7.2.2 2005/11/29 16:18:25 chinkumo -// Code reformated (pogo compatible) -// -// Revision 1.7.2.1 2005/11/15 13:45:32 chinkumo -// ... -// -// Revision 1.7 2005/08/19 14:03:26 chinkumo -// no message -// -// Revision 1.6.6.1 2005/08/11 08:16:44 chinkumo -// The 'SetEquipement' command and thus functionnality was added. -// -// Revision 1.6 2005/06/22 09:28:34 chinkumo -// Tango V5 regenerated. -// -// -// 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 SnapManager; - -import java.util.MissingResourceException; -import java.util.ResourceBundle; -import java.util.Vector; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -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.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 { - - private static final Logger LOGGER = LoggerFactory.getLogger(SnapManagerClass.class); - - /** - * SnapManagerClass class instance (it is a singleton). - */ - private static SnapManagerClass _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 SnapManagerClass object - // once it has been initialised - // - // =================================================================== - public static SnapManagerClass instance() { - if (_instance == null) { - LOGGER.error("SnapManagerClass is not initialised !!!"); - LOGGER.error("Exiting"); - System.exit(-1); - } - return _instance; - } - - // =================================================================== - // - // method : Init() - // - // description : static method to create/retrieve the SnapManagerClass - // object. This method is the only one which enables a - // user to create the object - // - // in : - class_name : The class name - // - // =================================================================== - public static SnapManagerClass init(final String class_name) throws DevFailed { - if (_instance == null) { - _instance = new SnapManagerClass(class_name); - } - return _instance; - } - - // =================================================================== - // - // method : SnapManagerClass() - // - // description : constructor for the SnapManagerClass class - // - // argument : in : - name : The class name - // - // =================================================================== - protected SnapManagerClass(final String name) throws DevFailed { - super(name); - - LOGGER.info("Entering SnapManagerClass constructor"); - LOGGER.info("Leaving SnapManagerClass constructor"); - } - - // =================================================================== - // - // method : command_factory() - // - // description : Create the command object(s) and store them in the - // command list - // =================================================================== - @SuppressWarnings("unchecked") - @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 SetEquipmentsWithCommandClass("SetEquipmentsWithCommand", Tango_DEVVAR_STRINGARRAY, - Tango_DEV_STRING, - "The command name, STORED_READ_VALUE || STORED_WRITE_VALUE ,\n and the snapshot ID from which equipments are set.", - "", DispLevel.OPERATOR)); - - command_list.addElement(new SetEquipmentsClass("SetEquipments", Tango_DEVVAR_STRINGARRAY, Tango_DEV_VOID, - "* 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_DEVVAR_LONGSTRINGARRAY, - Tango_DEV_VOID, "1) snapshot identifier 2) The new comment", "", DispLevel.OPERATOR)); - - // Modify LaunchSnapShot call from archiver to manager - command_list.addElement(new LaunchSnapShotCmd("LaunchSnapShot", Tango_DEV_LONG, 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++) { -// final Command cmd = (Command) command_list.elementAt(i); -// } - } - - // ============================================================================= - // - // Method: attribute_factory(Vector att_list) - // - // ============================================================================= - @SuppressWarnings("unchecked") - @Override - public void attribute_factory(final Vector att_list) throws DevFailed { - // Attribute : version - final 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 - // - // =================================================================== - @SuppressWarnings("unchecked") - @Override - public void device_factory(final String[] devlist) throws DevFailed { - - String device_version = "unkown"; - try { - device_version = ResourceBundle.getBundle("application").getString("project.version"); - } catch (final 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)); - - // 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(final String name) throws DevFailed { - final DbDatum[] classProps = get_db_class().get_property(new String[] { name }); - return classProps[0]; - } -} diff --git a/snapmanager/src/main/java/SnapManager/UpdateSnapCommentClass.java b/snapmanager/src/main/java/SnapManager/UpdateSnapCommentClass.java deleted file mode 100644 index 8f7a9b92efd39e97630cdde2e9d728e1719a2c6f..0000000000000000000000000000000000000000 --- a/snapmanager/src/main/java/SnapManager/UpdateSnapCommentClass.java +++ /dev/null @@ -1,127 +0,0 @@ -// +====================================================================== -// $Source$ -// -// Project: Tango Device Server -// -// Description: Java source code for the command TemplateClass of the -// SnapManager class. -// -// $Author$ -// -// $Revision$ -// -// $Log$ -// Revision 1.1 2006/04/21 09:05:28 ounsy -// New command "UpdateSnapComment" added -// -// -// 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$ - * @version $Revision$ - */ -package SnapManager; - -import org.omg.CORBA.Any; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import fr.esrf.Tango.DevFailed; -import fr.esrf.Tango.DevVarLongStringArray; -import fr.esrf.Tango.DispLevel; -import fr.esrf.TangoDs.Command; -import fr.esrf.TangoDs.DeviceImpl; -import fr.esrf.TangoDs.TangoConst; - -/** - * Class Description: This command updates the comment of given snapshot - * - */ -public class UpdateSnapCommentClass extends Command implements TangoConst { - - private static final Logger LOGGER = LoggerFactory.getLogger(UpdateSnapCommentClass.class); - - // =============================================================== - /** - * Constructor for Command class UpdateSnapCommentClass - * - * @param name command name - * @param in argin type - * @param out argout type - */ - // =============================================================== - public UpdateSnapCommentClass(String name, int in, int out) { - super(name, in, out); - } - - // =============================================================== - /** - * Constructor for Command class UpdateSnapCommentClass - * - * @param name command name - * @param in argin type - * @param in_comments argin description - * @param out argout type - * @param out_comments argout description - */ - // =============================================================== - public UpdateSnapCommentClass(String name, int in, int out, String in_comments, String out_comments) { - super(name, in, out, in_comments, out_comments); - } - - // =============================================================== - /** - * Constructor for Command class UpdateSnapCommentClass - * - * @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 UpdateSnapCommentClass(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 { - LOGGER.info("UpdateSnapCommentClass.execute(): arrived"); - DevVarLongStringArray argin = extract_DevVarLongStringArray(in_any); - ((SnapManager) (device)).update_snap_comment(argin); - return insert(); - } - - // =============================================================== - /** - * Check if it is allowed to execute the command. - */ - // =============================================================== - @Override - public boolean is_allowed(DeviceImpl device, Any data_in) { - // End of Generated Code - - // Re-Start of Generated Code - return true; - } -} -// ----------------------------------------------------------------------------- -/* end of $Source$ */