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