Slave_Impl.java

00001 package ;
00002 
00003 
00011   // import configuration classes
00012 
00013 import config.*;
00014 
00015 
00016 class Slave_Impl implements Slave {
00017 
00018     // base attributes
00019 
00020   private config.Configuration p_db;
00021   private config.ConfigObject p_obj;
00022   private boolean p_was_read;
00023   private boolean p_is_valid;
00024   private String p_uid;
00025   private String p_class_name;
00026 
00027 
00028     // database class attributes
00029 
00030   private short m_id;
00031   private String m_ipramFile;
00032   private String m_idramFile;
00033   private String m_extFile;
00034 
00035 
00036     // database class relationships
00037 
00038 
00039 
00040 
00041     // constructor
00042 
00043   public Slave_Impl() {
00044     p_is_valid = false;
00045   }
00046 
00047   public Slave_Impl(config.Configuration db, config.ConfigObject obj) {
00048     init_config_params(db, obj);
00049   }
00050 
00051   public void init_config_params(config.Configuration db, config.ConfigObject obj) {
00052     p_db = db;
00053     p_obj = obj;
00054     p_was_read = false;
00055     p_is_valid = true;
00056     p_uid = p_obj.UID();
00057     p_class_name = p_obj.class_name();
00058   }
00059 
00060   public String UID() {
00061     return p_uid;
00062   }
00063 
00064   public String class_name() {
00065     return p_class_name;
00066   }
00067 
00068   public void update(boolean set_non_valid) {
00069     if(set_non_valid == true) {
00070       p_is_valid = false;
00071     }
00072     else {
00073       p_was_read = false;
00074       p_obj.clean();
00075       init();
00076     }
00077   }
00078 
00079   public void unread() {
00080     p_was_read = false;
00081   }
00082 
00083   public boolean is_valid() {
00084     return p_is_valid;
00085   }
00086 
00087 
00088 
00089   private void init() throws config.NotFoundException, config.NotValidException, config.SystemException {
00090     if(p_was_read == true) {return;}
00091 
00092     if(p_is_valid == false) {
00093       String text = "ERROR [.Slave_Impl.init()]: object " + p_uid + "@" + p_class_name + " is not valid";
00094       System.err.println(text);
00095       throw new config.NotValidException(text);
00096     }
00097 
00098     m_id = p_obj.get_short("id");
00099 
00100     m_ipramFile = p_obj.get_string("ipramFile");
00101     m_ipramFile = (String)p_db.convert((Object)m_ipramFile, p_obj, "ipramFile");
00102 
00103     m_idramFile = p_obj.get_string("idramFile");
00104     m_idramFile = (String)p_db.convert((Object)m_idramFile, p_obj, "idramFile");
00105 
00106     m_extFile = p_obj.get_string("extFile");
00107     m_extFile = (String)p_db.convert((Object)m_extFile, p_obj, "extFile");
00108 
00109 
00110     p_was_read = true;
00111 
00112   }
00113 
00114   public short get_id() {
00115     if(p_was_read == false) {init();}
00116     return m_id;
00117   }
00118 
00119   public void set_id(short value) {
00120     p_obj.clean();
00121     p_obj.set_short("id", value);
00122   }
00123 
00124   public String get_ipramFile() {
00125     if(p_was_read == false) {init();}
00126     return m_ipramFile;
00127   }
00128 
00129   public void set_ipramFile(String value) {
00130     p_obj.clean();
00131     p_obj.set_string("ipramFile", value);
00132   }
00133 
00134   public String get_idramFile() {
00135     if(p_was_read == false) {init();}
00136     return m_idramFile;
00137   }
00138 
00139   public void set_idramFile(String value) {
00140     p_obj.clean();
00141     p_obj.set_string("idramFile", value);
00142   }
00143 
00144   public String get_extFile() {
00145     if(p_was_read == false) {init();}
00146     return m_extFile;
00147   }
00148 
00149   public void set_extFile(String value) {
00150     p_obj.clean();
00151     p_obj.set_string("extFile", value);
00152   }
00153 
00154   public config.ConfigObject config_object() {
00155     return p_obj;
00156   }
00157 
00158   public void print(String dx) {
00159     System.out.println(dx + "Slave object:" );
00160     System.out.println(dx + "  id: \'" + UID() + "\', class name: \'" + class_name() + "\'");
00161 
00162 
00163       // print attributes
00164 
00165     System.out.println(dx + "  id: " + get_id());
00166     System.out.println(dx + "  ipramFile: " + get_ipramFile());
00167     System.out.println(dx + "  idramFile: " + get_idramFile());
00168     System.out.println(dx + "  extFile: " + get_extFile());
00169 
00170 
00171       // print relationships
00172 
00173   }
00174 
00180   public void destroy(config.Configuration db) {
00181     db.destroy(config_object());
00182   }
00183 }

Generated on Mon Feb 6 14:12:19 2006 for SCT DAQ/DCS Software - Java by  doxygen 1.4.6