import java.applet.*; import java.awt.*; import java.awt.event.*; import org.omg.CORBA.*; import WebFlow.*; import WebFlow.event.*; import java.io.*; import java.net.*; import java.util.*; //swing interface import javax.swing.*; public class ProcessTreeFrame extends JInternalFrame implements ActionListener{ private ORB orb; private String IOR; private WebFlowContext ws = null; //shows the current modules hierarchy private JTextArea status; //editfield for the root module IOR file URL private JTextField URLfield; private String IorURL; //Offset to indicate step left for each next layer private String Offset = " "; private desktop d; //=============================functions declaration========================= public ProcessTreeFrame (desktop d) { super("Context Tree", true, true, true, true); this.d = d; IorURL= d.IORfileURL; //create orb if (!createOrb()) { status.append("Error creating ORB"); System.out.println("Error creating ORB"); return; } if (IorURL==null) IorURL = new String(); System.err.println(IorURL); //set up the applet interface setAppletInterface(""); IOR = ReadSTRFromURL(IorURL); if (!IORtoWebFlowContext(IOR)) { status.append("\n\nError establishing connection\n"); return; } //Processing Hierarchy System.out.println("Tree for the master IOR file URL " + IorURL + "\n"); status.append("Tree for the master IOR file URL " + IorURL +"\n"); status.append(getHierarchy(0, ws)); } //create ORB public boolean createOrb() { String[] args = new String[1]; args[0] = new String(""); try { orb = ORB.init(args, new java.util.Properties()); return true; } catch (Exception e) { orb=null; return false; } } //Accepts IOR of the server to connect //Returns true if connects false otherwise public boolean IORtoWebFlowContext(String IOR) { try { org.omg.CORBA.Object MasterObj=orb.string_to_object(IOR); if (MasterObj!=null) System.out.println("orb.string_to_object Ok"); else { System.out.println("orb.string_to_object returned null"); return false; } ws = WebFlowContextHelper.narrow(MasterObj); System.out.println("Narrowed"); return true; } catch (Exception e) { return false; } } //recursively adds module hierarchy into the string result public String getHierarchy(int level, WebFlowContext node) { org.omg.CORBA.Object[] SlaveServers = node.toArray(); //get the number of staces at the beginning of the line to pront "nice" String thisOffset = new String(""); for (int j=0; j