diff --git a/snaparchiver/src/main/java/SnapArchiver/CreateNewContextCmd.java b/snaparchiver/src/main/java/SnapArchiver/CreateNewContextCmd.java deleted file mode 100644 index c000d0283391e00033b028d7a11e8cae683269ce..0000000000000000000000000000000000000000 --- a/snaparchiver/src/main/java/SnapArchiver/CreateNewContextCmd.java +++ /dev/null @@ -1,152 +0,0 @@ -// +====================================================================== -// $Source: /cvsroot/tango-cs/tango/jserver/snapshoting/SnapArchiver/CreateNewContextCmd.java,v $ -// -// Project: Tango Device Server -// -// Description: Java source code for the command TemplateClass of the -// SnapArchiver class. -// -// $Author: chinkumo $ -// -// $Revision: 1.5 $ -// -// $Log: CreateNewContextCmd.java,v $ -// Revision 1.5 2005/11/29 17:33:03 chinkumo -// no message -// -// Revision 1.4.10.2 2005/11/29 16:16:50 chinkumo -// Code reformated (pogo compatible) -// -// Revision 1.4.10.1 2005/11/15 13:46:17 chinkumo -// ... -// -// Revision 1.4 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: chinkumo $ - * @version $Revision: 1.5 $ - */ -package SnapArchiver; - -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.TangoConst; -import fr.esrf.TangoDs.Util; - -/** - * Class Description: This command is used to register a snapShot context. All - * informations concerning the snapshot - * (fr.soleil.archiving.snap.api.tools.SnapContext) are passed through an array - * (DEVVAR_STRINGARRAY). - */ - -public class CreateNewContextCmd extends Command implements TangoConst { - // =============================================================== - /** - * Constructor for Command class CreateNewContextCmd - * - * @param name - * command name - * @param in - * argin type - * @param out - * argout type - */ - // =============================================================== - public CreateNewContextCmd(String name, int in, int out) { - super(name, in, out); - } - - // =============================================================== - /** - * Constructor for Command class CreateNewContextCmd - * - * @param name - * command name - * @param in - * argin type - * @param in_comments - * argin description - * @param out - * argout type - * @param out_comments - * argout description - */ - // =============================================================== - public CreateNewContextCmd(String name, int in, int out, String in_comments, String out_comments) { - super(name, in, out, in_comments, out_comments); - } - - // =============================================================== - /** - * Constructor for Command class CreateNewContextCmd - * - * @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 CreateNewContextCmd(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("CreateNewContextCmd.execute(): arrived"); - String[] argin = extract_DevVarStringArray(in_any); - ((SnapArchiver) (device)).create_new_context(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/SnapArchiver/CreateNewContextCmd - * .java,v $ - */ diff --git a/snaparchiver/src/main/java/SnapArchiver/SnapArchiver.java b/snaparchiver/src/main/java/SnapArchiver/SnapArchiver.java deleted file mode 100644 index 539d95ca4de767a88446ed2cb782081be37796d6..0000000000000000000000000000000000000000 --- a/snaparchiver/src/main/java/SnapArchiver/SnapArchiver.java +++ /dev/null @@ -1,515 +0,0 @@ -// +============================================================================ -// $Source: /cvsroot/tango-cs/tango/jserver/snapshoting/SnapArchiver/SnapArchiver.java,v $ -// -// project : Tango Device Server -// -// Description: java source code for the SnapArchiver 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 SnapArchiver are implemented -// in this file. -// -// $Author: pierrejoseph $ -// -// $Revision: 1.18 $ -// -// $Log: SnapArchiver.java,v $ -// Revision 1.18 2007/05/11 13:58:53 pierrejoseph -// Attribute addition : release version -// -// Revision 1.17 2007/04/25 12:19:51 ounsy -// *** empty log message *** -// -// Revision 1.16 2007/04/06 09:40:39 ounsy -// refactoring -// -// Revision 1.15 2007/04/05 09:54:17 ounsy -// added the beansFileName property -// -// Revision 1.14 2007/04/04 13:45:30 ounsy -// new LaunchSnapShot command management -// -// Revision 1.13.2.3 2007/03/27 09:25:18 ounsy -// removed logs -// -// Revision 1.13.2.2 2007/03/14 15:47:32 ounsy -// new LaunchSnapShot implementation -// -// Revision 1.13.2.1 2007/03/05 10:14:15 ounsy -// test branche -// -// Revision 1.13 2007/03/02 07:54:57 ounsy -// extend DeviceImpl instead of DeviceImplWithShutdownRunnable -// -// Revision 1.12 2006/11/20 09:38:54 ounsy -// minor changes -// -// Revision 1.11 2006/11/13 15:58:06 ounsy -// all java devices now inherit from UnexportOnShutdownDeviceImpl instead of from DeviceImpl -// -// Revision 1.10 2006/06/15 08:41:17 ounsy -// minor changes -// -// Revision 1.9 2006/04/12 15:45:41 ounsy -// corrected the missing attributes problem -// -// Revision 1.8 2006/03/27 13:57:18 ounsy -// organized imports -// -// Revision 1.7 2005/11/29 17:33:03 chinkumo -// no message -// -// Revision 1.6.2.2 2005/11/29 16:16:50 chinkumo -// Code reformated (pogo compatible) -// -// Revision 1.6.2.1 2005/11/15 13:46:17 chinkumo -// ... -// -// Revision 1.6 2005/08/19 14:03:47 chinkumo -// no message -// -// Revision 1.5 2005/06/28 09:10:11 chinkumo -// Changes made to improve the management of exceptions were reported here. -// -// Revision 1.4 2005/06/15 14:02:53 chinkumo -// The device was regenerated in Tango V5. -// -// Revision 1.3 2005/01/26 17:03:59 chinkumo -// Ultimate synchronization before real sharing. -// -// Revision 1.2 2004/12/06 17:30:44 chinkumo -// Renaming package 'TangoSnap' into 'TangoSnapshoting' -// -// -// 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 SnapArchiver; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.concurrent.Callable; -import java.util.concurrent.ExecutionException; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; -import java.util.concurrent.Future; - -import org.omg.CORBA.SystemException; -import org.omg.CORBA.UserException; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.tango.utils.DevFailedUtils; - -import SnapArchiver.grouplink.UsePluginBuilder; -import fr.esrf.Tango.DevFailed; -import fr.esrf.Tango.DevState; -import fr.esrf.TangoApi.DbDatum; -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.actiongroup.collectiveaction.onattributes.UsePlugin; -import fr.soleil.archiving.snap.api.ConfigConst; -import fr.soleil.archiving.snap.api.SnapConnectionParameters; -import fr.soleil.archiving.snap.api.manager.SnapManagerApi; -import fr.soleil.archiving.snap.api.persistence.SnapshotPersistenceManager; -import fr.soleil.archiving.snap.api.persistence.SnapshotPersistenceManagerFactory; -import fr.soleil.archiving.snap.api.tools.SnapAttributeExtract; -import fr.soleil.archiving.snap.api.tools.SnapContext; -import fr.soleil.archiving.snap.api.tools.Snapshot; -import fr.soleil.archiving.snap.api.tools.SnapshotingException; - -/** - * Class Description: Device of Snapshoting system - * - * @author $Author: pierrejoseph $ - * @version $Revision: 1.18 $ - */ - -// --------- Start of States Description ---------- -/* - * Device States Description: - */ -// --------- End of States Description ---------- -public class SnapArchiver extends DeviceImpl/* WithShutdownRunnable */ implements TangoConst { - - private static final Logger LOGGER = LoggerFactory.getLogger(SnapArchiver.class); - - protected int state; - protected SnapshotPersistenceManager manager; - private final String m_version; - - // --------- Start of attributes data members ---------- - - // --------- End of attributes data members ---------- - - // --------- Start of properties data members ---------- - - // /** - // * Computer identifier on wich is settled the database HDB. The identifier - // * can be the computer name or its IP address. <br> - // * <b>Default value : </b> localhost. - // */ - // String dbHost; - // /** - // * Database name.<br> - // * <b>Default value : </b> hdb - // */ - // String dbName; - // /** - // * Database schema name.<br> - // * <b>Default value : </b> snap - // */ - // String dbSchema; - - /** - * 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; - /** - * The name of the spring beans file <br> - * <b>Default value : </b> beans.xml - */ - protected String beansFileName; - - 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; - - // --------- End of properties data members ---------- - - // Add your own data members here - // private DataBaseAPI snapDb; - - // CLA - // private Hashtable collectorsForSnapshots = new Hashtable(); - - // -------------------------------------- - - // ========================================================= - /** - * Constructor for simulated Time Device Server. - * - * @param cl The DeviceClass object - * @param s The Device name. - * @param version The device version - */ - // ========================================================= - public SnapArchiver(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 SnapArchiver(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("SnapArchiver() create " + device_name); - // Initialise variables to default values - // ------------------------------------------- - - get_device_property(); - try { - SnapManagerApi.initSnapConnection(dbHost, dbName, dbSchema, dbUser, dbPassword, isRac); - SnapshotPersistenceManagerFactory factory = SnapshotPersistenceManagerFactory.getInstance(); - manager = factory.getManager(beansFileName, dbUser, dbPassword); - set_state(DevState.ON); - } catch (SnapshotingException e) { - LOGGER.warn(e.toString(), e); - set_state(DevState.FAULT); - set_status(e.toString()); - } - } - - // =================================================================== - /** - * Read the device properties from database. - */ - // =================================================================== - private void get_device_property() throws DevFailed { - // Initialize your default values here. - // ------------------------------------------ - dbUser = ""; - dbPassword = ""; - beansFileName = ConfigConst.default_sabeansfilename; - 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(); - } - - // Read device properties from database.(Automatic code generation) - // ------------------------------------------------------------- - if (Util._UseDb == false) { - return; - } - - String[] propnames = { "BeansFileName" }; - - // Call database and extract values - // -------------------------------------------- - DbDatum[] dev_prop = get_db_device().get_property(propnames); - SnapArchiverClass ds_class = (SnapArchiverClass) get_device_class(); - int i = -1; - - // Extract BeansFileName value - if (dev_prop[++i].is_empty() == false) { - beansFileName = dev_prop[i].extractString(); - } else { - // Try to get value from class property - DbDatum cl_prop = ds_class.get_class_property(dev_prop[i].name); - if (cl_prop.is_empty() == false) { - beansFileName = cl_prop.extractString(); - } - } - } - - // ========================================================= - /** - * Method always executed before command execution. - */ - // ========================================================= - @Override - public void always_executed_hook() { - // LOGGER.info("In always_executed_hook method()"); - } - - // ========================================================= - /** - * Execute command "TriggerLaunchSnapShot" 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 trigger_launch_snap_shot(int argin) throws DevFailed { - if (get_state().equals(DevState.RUNNING)) { - throw DevFailedUtils.newDevFailed("STATE_ERROR", "snapshot alreadly in progress"); - } - set_state(DevState.RUNNING); - LOGGER.info("Entering trigger_launch_snap_shot()"); - Future<Integer> snapshotResult = executorService.submit(new SnapshotTask(argin)); - snapshotResults.put(argin, snapshotResult); - - } - - /** - * Command - * - * @param argin - * the context ID - * @return - * @throws DevFailed - */ - public int getSnapShotResult(int argin) throws DevFailed { - int result = -1; - try { - Future<Integer> snap = snapshotResults.get(argin); - if (snap != null) { - result = snapshotResults.get(argin).get(); - } - } catch (InterruptedException e) { - DevFailedUtils.throwDevFailed(e); - } catch (ExecutionException e) { - if (e.getCause() instanceof DevFailed) { - throw (DevFailed) e.getCause(); - } else { - DevFailedUtils.throwDevFailed(e.getCause()); - } - } - return result; - } - - private class SnapshotTask implements Callable<Integer> { - private final int contextID; - - public SnapshotTask(int contextID) { - this.contextID = contextID; - } - - @Override - public Integer call() throws Exception { - int snapId = -1; - - try { - Snapshot snapShot = SnapManagerApi.registerSnapShot(contextID); - if (snapShot == null) { - Except.throw_exception("INPUT_ERROR", "Invalid Context ID", "SnapArchiver.TriggerLaunchSnapshot"); - } - snapId = snapShot.getId_snap(); - // For each attribute of the object 'Snapshot', a snapshot is - // triggered... - List<SnapAttributeExtract> attributeList = snapShot.getAttribute_List(); - UsePluginBuilder builder = new UsePluginBuilder(snapId, manager); - UsePlugin group = builder.build(attributeList); - group.execute(); - group.getMessages(); - // Map<String, String> messages = group.getMessages(); - } catch (SnapshotingException e) { - LOGGER.error("Exception received during TriggerLaunchSnapshot", e); - throw e.toTangoException(); - } finally { - SnapArchiver.this.set_state(DevState.ON); - } - - return snapId; - } - - } - - // ========================================================= - /** - * Execute command "CreateNewContext" on device. This command is used to - * register a snapShot context. All informations concerning the snapshot - * (fr.soleil.archiving.snap.api.tools.SnapContext) are passed through an - * array (DEVVAR_STRINGARRAY). - * - * @param argin - * All the informations usefull to create a context ,Snapshot - * pattern). - */ - // ========================================================= - public void create_new_context(String[] argin) throws DevFailed { - LOGGER.info("Entering create_new_context()"); - - // ---Add your Own code to control device here --- - SnapContext snapContext = new SnapContext(argin); - try { - SnapManagerApi.createContext(snapContext); - } catch (SnapshotingException e) { - LOGGER.warn(e.toString(), e); - throw e.toTangoException(); - } - LOGGER.info("Exiting create_new_context()"); - } - - // =================================================================== - /** - * 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, "SnapArchiver"); - tg.server_init(); - - LOGGER.info("Ready to accept request"); - - tg.server_run(); - } catch (OutOfMemoryError ex) { - LOGGER.error("Can't allocate memory !!!!"); - 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/SnapArchiver/SnapArchiver.java,v - * $ - */ diff --git a/snaparchiver/src/main/java/SnapArchiver/SnapArchiverClass.java b/snaparchiver/src/main/java/SnapArchiver/SnapArchiverClass.java deleted file mode 100644 index b62c71f6694c76d6a81ddec18002cf681162cdfa..0000000000000000000000000000000000000000 --- a/snaparchiver/src/main/java/SnapArchiver/SnapArchiverClass.java +++ /dev/null @@ -1,337 +0,0 @@ -// +====================================================================== -// $Source: /cvsroot/tango-cs/tango/jserver/snapshoting/SnapArchiver/SnapArchiverClass.java,v $ -// -// Project: Tango Device Server -// -// Description: java source code for the SnapArchiver class . -// This class is a singleton class and implements everything -// which exists only once for all the SnapArchiver object -// It inherits from the DeviceClass class. -// -// $Author: pierrejoseph $ -// -// $Revision: 1.10 $ -// -// $Log: SnapArchiverClass.java,v $ -// Revision 1.10 2007/05/11 13:58:53 pierrejoseph -// Attribute addition : release version -// -// Revision 1.9 2007/04/04 13:45:29 ounsy -// new LaunchSnapShot command management -// -// Revision 1.8.2.1 2007/03/14 15:47:32 ounsy -// new LaunchSnapShot implementation -// -// Revision 1.8 2006/04/12 15:46:40 ounsy -// corrected the missing attributes problem -// -// Revision 1.7 2006/03/27 13:57:34 ounsy -// organized imports -// -// Revision 1.6 2005/11/29 17:33:03 chinkumo -// no message -// -// Revision 1.5.2.2 2005/11/29 16:16:50 chinkumo -// Code reformated (pogo compatible) -// -// Revision 1.5.2.1 2005/11/15 13:46:17 chinkumo -// ... -// -// Revision 1.5 2005/08/19 14:03:47 chinkumo -// no message -// -// Revision 1.4 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 -//============================================================================= - -package SnapArchiver; - -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 SnapArchiverClass extends DeviceClass implements TangoConst { - - final static Logger logger = LoggerFactory.getLogger(SnapArchiverClass.class); - /** - * SnapArchiverClass class instance (it is a singleton). - */ - private static SnapArchiverClass _instance = null; - - /** - * Class properties array. - */ - // private final DbDatum[] cl_prop = null; - - // //--------- Start of properties data members ---------- - // - // /** - // * Computer identifier on wich is settled the database HDB. The identifier - // can be the computer name or its IP address. <br> <b>Default value : </b> - // localhost. - // */ - // String dbHost; - // /** - // * Database name.<br> <b>Default value : </b> hdb - // */ - // String dbName; - // /** - // * Database schema name.<br> <b>Default value : </b> snap - // */ - // String dbSchema; - // - // //--------- End of properties data members ---------- - // - - // =================================================================== - // - // method : instance() - // - // description : static method to retrieve the SnapArchiverClass object - // once it has been initialised - // - // =================================================================== - public static SnapArchiverClass instance() { - if (_instance == null) { - logger.error("SnapArchiverClass is not initialised !!!"); - logger.error("Exiting"); - System.exit(-1); - } - return _instance; - } - - // =================================================================== - // - // method : Init() - // - // description : static method to create/retrieve the SnapArchiverClass - // object. This method is the only one which enables a - // user to create the object - // - // in : - class_name : The class name - // - // =================================================================== - public static SnapArchiverClass init(String class_name) throws DevFailed { - if (_instance == null) { - _instance = new SnapArchiverClass(class_name); - } - return _instance; - } - - // =================================================================== - // - // method : SnapArchiverClass() - // - // description : constructor for the SnapArchiverClass class - // - // argument : in : - name : The class name - // - // =================================================================== - protected SnapArchiverClass(String name) throws DevFailed { - super(name); - - Util.out2.println("Entering SnapArchiverClass constructor"); - // write_class_property(); - get_class_property(); - - Util.out2.println("Leaving SnapArchiverClass constructor"); - } - - // ============================================================================= - // - // 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 : command_factory() - // - // description : Create the command object(s) and store them in the - // command list - // =================================================================== - @Override - public void command_factory() { - command_list.addElement(new TriggerLaunchSnapShotCmd("TriggerLaunchSnapShot", Tango_DEV_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 CreateNewContextCmd("CreateNewContext", Tango_DEVVAR_STRINGARRAY, Tango_DEV_VOID, - "All the informations usefull to create a context ,Snapshot pattern).", "", DispLevel.OPERATOR)); - } - - // =================================================================== - // - // 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 = "unkown"; - try { - device_version = ResourceBundle.getBundle("application").getString("project.version"); - } catch (MissingResourceException e) { - } - - for (int i = 0; i < devlist.length; i++) { - // Util.out4.println("Device name : " + devlist[ i ]); - - // Create device and add it into the device list - // ---------------------------------------------- - device_list.addElement(new SnapArchiver(this, devlist[i], device_version)); - - // 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) - // Read class properties from database.(Automatic code generation) - // ------------------------------------------------------------- - // if (Util._UseDb == false) { - // return; - // } - // String[] propnames = {}; - - // Call database and extract values - // -------------------------------------------- - // cl_prop = get_db_class().get_property(propnames); - // int i = -1; - - // End of Automatic code generation - // - // //------------------------------------------------------------- - // if ( Util._UseDb == false ) - // return; - // String[] propnames = { - // "DbHost", - // "DbName", - // "DbSchema" - // }; - // - // // Call database and extract values - // //-------------------------------------------- - // cl_prop = get_db_class().get_property(propnames); - // int i = -1; - // // Extract DbHost value - // if ( cl_prop[ ++i ].is_empty() == false ) - // dbHost = cl_prop[ i ].extractString(); - // else - // cl_prop[ i ].insert(dbHost); - // - // // Extract DbName value - // if ( cl_prop[ ++i ].is_empty() == false ) - // dbName = cl_prop[ i ].extractString(); - // else - // cl_prop[ i ].insert(dbName); - // - // // Extract DbSchema value - // if ( cl_prop[ ++i ].is_empty() == false ) - // dbSchema = cl_prop[ i ].extractString(); - // else - // cl_prop[ i ].insert(dbSchema); - // - // // 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("Device of Snapshoting system"); -// -// // Call database and and values -// // -------------------------------------------- -// get_db_class().put_property(data); -// } - -} diff --git a/snaparchiver/src/main/java/SnapArchiver/TriggerLaunchSnapShotCmd.java b/snaparchiver/src/main/java/SnapArchiver/TriggerLaunchSnapShotCmd.java deleted file mode 100644 index 1c0481c95fd423e9733ce27c0826e603c232956e..0000000000000000000000000000000000000000 --- a/snaparchiver/src/main/java/SnapArchiver/TriggerLaunchSnapShotCmd.java +++ /dev/null @@ -1,47 +0,0 @@ -package SnapArchiver; - -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; - -public class TriggerLaunchSnapShotCmd extends Command implements TangoConst { - - public TriggerLaunchSnapShotCmd(String arg0, int arg1, int arg2) { - super(arg0, arg1, arg2); - // TODO Auto-generated constructor stub - } - - public TriggerLaunchSnapShotCmd(String name, int in, int out, String in_comments, String out_comments) { - super(name, in, out, in_comments, out_comments); - } - - public TriggerLaunchSnapShotCmd(String name, int in, int out, String in_comments, String out_comments, - DispLevel level) { - super(name, in, out, in_comments, out_comments, level); - } - - @Override - public Any execute(DeviceImpl arg0, Any in_any) throws DevFailed { - Util.out2.println("TriggerLaunchSnapShotCmd.execute(): arrived"); - int argin = extract_DevLong(in_any); - if (argin < 0) { - Util.out2.println("Invalid Context ID"); - Except.throw_exception("INPUT_ERROR", "Invalid Context ID", "SnapArchiver.TriggerLaunchSnapShot"); - } - ((SnapArchiver) arg0).trigger_launch_snap_shot(argin); - return insert(); - // return insert(((SnapArchiver) - // (arg0)).trigger_launch_snap_shot(argin)); - } - - @Override - public boolean is_allowed(DeviceImpl device, Any data_in) { - return true; - } -}