package bb; import java.net.URL; import bb.server.LoginProcessor; import bb.server.Processor; import bb.server.auth.Authentication; import ks.framework.common.Message; import ks.framework.communicator.Communicator; import ks.framework.interfaces.*; import ks.framework.mbus.Bus; import ks.framework.sipc.Server; /** * Hard-wired hack to show things working OUTSIDE of the CompUnit component model * @author George Heineman */ public class MultipleServer { public static void main(String[] args) throws Exception { // configure underlying code to use this schema URL u = new URL ("http://www.wpi.edu/~heineman/xml/ks.xsd"); Message.configure("ks.xsd", u); Processor proc = new Processor(); LoginProcessor log = new LoginProcessor(); Communicator comm = new Communicator(); Server s = new Server (); Bus mbus = new Bus(); Authentication auth = new Authentication(); // connect the s_ipc component to the mbus. s.connect(comm, IRegistration.class.getName()); s.connect(mbus, IProcessMessage.class.getName()); // server needs an authentication agent s.connect(auth, IAuthorization.class.getName()); // set up the subscriptions... mbus.connect(proc, ISubscribe.class.getName()); mbus.connect(log, ISubscribe.class.getName()); // login processor has local requests to make, so it must // be connected to the MBUS. If you desire to make a local // message to be processed only locally, this is how to do it. log.connect(mbus, ILocal.class.getName()); // make sure each component can still output messages. proc.connect(comm, IOutput.class.getName()); log.connect(comm, IOutput.class.getName()); // activate everyone mbus.activate(null); comm.activate(null); proc.activate(null); log.activate(null); s.activate(null); System.out.println ("Ready"); } } package bb; import java.net.URL; import gui.sample.Sample; import gui.tmgui.SampleTMGUI; import gui.umgui.SampleUMGUI; import ks.framework.cipc.Client; import ks.framework.common.Message; import ks.framework.interfaces.*; import ks.framework.mbus.Bus; /** * Hard-wired hack to show things working OUTSIDE of the CompUnit component model * @author George Heineman */ public class KSClient { public static void main(String[] args) throws Exception { // configure underlying code to use this schema URL u = new URL ("http://www.wpi.edu/~heineman/xml/ks.xsd"); Message.configure("ks.xsd", u); // these components form our application Client cipc = new Client(); Sample roomGUI= new Sample(); SampleUMGUI umg = new SampleUMGUI(); SampleTMGUI tmg = new SampleTMGUI(); Bus bus = new Bus(); // Sample RoomGUI needs to be connected to a user manager // and tableManager to get their visual representations to be shown roomGUI.connect(umg, IVisualRepresentation.class.getName()); roomGUI.connect(tmg, IVisualRepresentation.class.getName()); // Tell Room GUI to directly connect to CIPC to deal // with connection interface; this is a two-way communication // so we need to connect cipc to roomGUI also. roomGUI.connect(cipc, IConnection.class.getName()); cipc.connect(roomGUI, IConnectionHandler.class.getName()); // CIPC needs to be told what to do with messages. These // are handed off to the bus. cipc.connect(bus, IProcessMessage.class.getName()); // RoomGUI sends commands directly on to CIPC. So do TMGUI // and UMGUI roomGUI.connect(cipc, IProcessMessage.class.getName()); tmg.connect(cipc, IProcessMessage.class.getName()); umg.connect(cipc, IProcessMessage.class.getName()); // for now, only UM-GUI is subscribed. TM-GUI will need // to be subscribed as well... These are requests coming // back from the server... bus.connect(umg, ISubscribe.class.getName()); bus.connect(roomGUI, ISubscribe.class.getName()); // activate components. bus.activate(null); cipc.activate(null); umg.activate(null); tmg.activate(null); roomGUI.activate(null); cipc.activate(null); } }