doAll.java

00001 import org.omg.CORBA.IntHolder;
00002 import ipc.*;
00003 
00004 public class doAll {
00005     public static void main(String args[]) {
00006         //System.setProperty("ipc.ref.file", "/work/daq-1/installed/com/ipc_root.ref");
00007         System.out.println("Trying to get partition SCT");
00008         Partition pt= new Partition("SCT");
00009         if (pt==null) {
00010            System.out.println("failed to get partition SCT");
00011         } else {
00012            System.out.println("(probably) succeded in getting partition SCT");
00013         }
00014         System.out.println("Finished trying to get partition SCT");
00015 
00016         sctConf.Configuration h = null;
00017 
00018         try {
00019             System.out.println("Trying to lookup sctConf.Configuration");
00020             org.omg.CORBA.Object ob = pt.lookup(sctConf.Configuration.class, 
00021                                                 sctConf.Configuration.instanceName); 
00022             if (ob ==null) {
00023                System.out.println("Object not found: " + sctConf.Configuration.instanceName);
00024             } else {
00025                 System.out.println("Object "+ sctConf.Configuration.instanceName+" (probably) found.");
00026             };
00027             h=sctConf.ConfigurationHelper.narrow(ob);
00028         } catch (org.omg.CORBA.BAD_PARAM bp) {
00029             System.err.println("Couldn't get api object: " + bp);
00030         } catch (org.omg.CORBA.COMM_FAILURE cf) {
00031             System.err.println("CORBA communications error: " + cf);
00032         } catch (java.lang.Exception e) {
00033             System.err.println("Other error" + e);
00034         }
00035 
00036         if (h==null) {
00037             System.err.println("Error (check configuration server)");
00038             return;
00039         }
00040         System.out.println("Found configuration");
00041 
00042         try {
00043             int[] parts = h.listPartitions();
00044             for(int p=0; p<parts.length; p++) {
00045                 System.out.println("Partition " + p + " " + parts[p]);
00046                 int[] crates = h.listCratesInPartition(parts[p]);
00047                 for(int c=0; c<crates.length; c++) {
00048                     System.out.println("Crate " + c + " " + crates[c]);
00049                     int[] rods = h.listRodsInCrate(parts[p], crates[c]);
00050                     for(int r=0; r<rods.length; r++) {
00051                         System.out.println("Rod " + r + " " + rods[r]);
00052                         //                      sct.RodConfig rodConf = h.getRodConfig(parts[p], crates[c], rods[r]);
00053                         //                      System.out.println(rodConf.slaves[0].emifFile);
00054 
00055                         int[] MURs = h.listMURSInRod(parts[p], crates[c], rods[r]);
00056                         for(int mur=0; mur<MURs.length; mur++) {
00057                             System.out.println("MUR " + mur + " " + MURs[mur]);
00058                             String[] modules = h.listModulesInMUR(parts[p], MURs[mur]);
00059 
00060                             for(int m=0; m<modules.length; m++) {
00061                                 System.out.println("Module " + m + " " + modules[m]);
00062 
00063                                 IntHolder MUR = new IntHolder(), num = new IntHolder();
00064                                 h.translateFromSN(modules[m], MUR, num);
00065 
00066                                 IntHolder barrel = new IntHolder(), row = new IntHolder(), number = new IntHolder();
00067                                 h.translateToBarrel(MUR.value, num.value, 
00068                                                     barrel, row, number);
00069                                 System.out.println("Barrel " + barrel.value + " Row " + row.value + " Number " + number.value);
00070                             }
00071                         }
00072                     }
00073                 }
00074             }
00075         } catch(sctConf.ConfigurationException e) {
00076             System.out.println("Java caught an exception!");
00077         }
00078     }
00079 }

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