__AnyObject__.java

00001 package ;
00002 
00003   // import configuration classes
00004 
00005 import config.Configuration;
00006 import config.DalObject;
00007 
00008 public class __AnyObject__ {
00009 
00010   public static config.DalObject get(config.Configuration db, String class_name, String object_id) throws config.SystemException, config.NotFoundException {
00011 
00012     try {
00013       Class c = Class.forName("." + class_name + "_Impl");
00014 
00015       config.DalObject dal_obj = (config.DalObject)db.get(class_name, object_id);
00016 
00017       if(dal_obj == null) {
00018         config.ConfigObject conf_obj = db.get_object(class_name, object_id);
00019         if(conf_obj != null) {
00020           config.DalObject o = (config.DalObject)c.newInstance();
00021           o.init_config_params(db, conf_obj);
00022           db.add(class_name, object_id, o);
00023           return o;
00024         }
00025       }
00026       else {
00027         return dal_obj;
00028       }
00029     }
00030     catch(ClassNotFoundException ex) {
00031       throw new config.SystemException(".__AnyObject__.get() caught 'ClassNotFoundException': " + ex.getMessage());
00032     }
00033     catch(IllegalAccessException ex) {
00034       throw new config.SystemException(".__AnyObject__.get() caught 'IllegalAccessException': " + ex.getMessage());
00035     }
00036     catch(InstantiationException ex) {
00037       throw new config.SystemException(".__AnyObject__.get() caught 'InstantiationException': " + ex.getMessage());
00038     }
00039 
00040     return null;
00041   }
00042 
00043   public static config.DalObject[] get(config.Configuration db, String class_name, config.Query query) throws config.SystemException, config.NotFoundException {
00044     config.ConfigObject[] objs = db.get_objects(class_name, query);
00045     config.DalObject[] result = new config.DalObject[objs.length];
00046 
00047     for (int i = 0; i < objs.length; i++) {
00048       result[i] = get(db, class_name, objs[i].UID());
00049     }
00050 
00051     return result;
00052   }
00053 }

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