ChannelMapping_Impl.java

00001 package ;
00002 
00003 
00011   // import configuration classes
00012 
00013 import config.*;
00014 
00015 
00016 class ChannelMapping_Impl implements ChannelMapping {
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_outputFibre;
00031   private short m_stream0Fibre;
00032   private short m_stream1Fibre;
00033 
00034 
00035     // database class relationships
00036 
00037 
00038 
00039 
00040     // constructor
00041 
00042   public ChannelMapping_Impl() {
00043     p_is_valid = false;
00044   }
00045 
00046   public ChannelMapping_Impl(config.Configuration db, config.ConfigObject obj) {
00047     init_config_params(db, obj);
00048   }
00049 
00050   public void init_config_params(config.Configuration db, config.ConfigObject obj) {
00051     p_db = db;
00052     p_obj = obj;
00053     p_was_read = false;
00054     p_is_valid = true;
00055     p_uid = p_obj.UID();
00056     p_class_name = p_obj.class_name();
00057   }
00058 
00059   public String UID() {
00060     return p_uid;
00061   }
00062 
00063   public String class_name() {
00064     return p_class_name;
00065   }
00066 
00067   public void update(boolean set_non_valid) {
00068     if(set_non_valid == true) {
00069       p_is_valid = false;
00070     }
00071     else {
00072       p_was_read = false;
00073       p_obj.clean();
00074       init();
00075     }
00076   }
00077 
00078   public void unread() {
00079     p_was_read = false;
00080   }
00081 
00082   public boolean is_valid() {
00083     return p_is_valid;
00084   }
00085 
00086 
00087 
00088   private void init() throws config.NotFoundException, config.NotValidException, config.SystemException {
00089     if(p_was_read == true) {return;}
00090 
00091     if(p_is_valid == false) {
00092       String text = "ERROR [.ChannelMapping_Impl.init()]: object " + p_uid + "@" + p_class_name + " is not valid";
00093       System.err.println(text);
00094       throw new config.NotValidException(text);
00095     }
00096 
00097     m_outputFibre = p_obj.get_short("outputFibre");
00098 
00099     m_stream0Fibre = p_obj.get_short("stream0Fibre");
00100 
00101     m_stream1Fibre = p_obj.get_short("stream1Fibre");
00102 
00103 
00104     p_was_read = true;
00105 
00106   }
00107 
00108   public short get_outputFibre() {
00109     if(p_was_read == false) {init();}
00110     return m_outputFibre;
00111   }
00112 
00113   public void set_outputFibre(short value) {
00114     p_obj.clean();
00115     p_obj.set_short("outputFibre", value);
00116   }
00117 
00118   public short get_stream0Fibre() {
00119     if(p_was_read == false) {init();}
00120     return m_stream0Fibre;
00121   }
00122 
00123   public void set_stream0Fibre(short value) {
00124     p_obj.clean();
00125     p_obj.set_short("stream0Fibre", value);
00126   }
00127 
00128   public short get_stream1Fibre() {
00129     if(p_was_read == false) {init();}
00130     return m_stream1Fibre;
00131   }
00132 
00133   public void set_stream1Fibre(short value) {
00134     p_obj.clean();
00135     p_obj.set_short("stream1Fibre", value);
00136   }
00137 
00138   public config.ConfigObject config_object() {
00139     return p_obj;
00140   }
00141 
00142   public void print(String dx) {
00143     System.out.println(dx + "ChannelMapping object:" );
00144     System.out.println(dx + "  id: \'" + UID() + "\', class name: \'" + class_name() + "\'");
00145 
00146 
00147       // print attributes
00148 
00149     System.out.println(dx + "  outputFibre: " + Long.toHexString((long)get_outputFibre()));
00150     System.out.println(dx + "  stream0Fibre: " + Long.toHexString((long)get_stream0Fibre()));
00151     System.out.println(dx + "  stream1Fibre: " + Long.toHexString((long)get_stream1Fibre()));
00152 
00153 
00154       // print relationships
00155 
00156   }
00157 
00163   public void destroy(config.Configuration db) {
00164     db.destroy(config_object());
00165   }
00166 }

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