import java.io.IOException; import java.io.FileInputStream; import java.util.Properties; import lava.net.common.Value; import lava.net.mmp.MMPMessageCenter; import lava.net.mmp.MMPMultiplexer; import lava.net.psyc.PSYCMessageCenter; import lava.net.psyc.packages.Echo; import lava.net.psyc.packages.Trace; import lava.net.psyc.packages.Statistics; /** * **/ public class PSYCServer { /** * **/ public PSYCServer() { Statistics stats = new Statistics(); stats.addEvent("Statistics package created."); PSYCMessageCenter rootCenter = new PSYCMessageCenter(); stats.addEvent("PSYC Root system is up."); MMPMultiplexer root = new MMPMultiplexer("/",// rootCenter.getMMPPacketManager(),// rootCenter.getMMPCenter()); stats.addEvent("MMP Root multiplexer is up."); rootCenter.getMMPCenter().setManager(root); rootCenter.setMMPCenter(root); stats.addEvent("MMP Root multiplexer included."); rootCenter.setName(null,"Root Center for this server"); rootCenter.setContentType(null,"text/plain"); rootCenter.addPackage(new Echo()); stats.addEvent("PSYC Root system included Echo package."); rootCenter.addPackage(new Trace()); stats.addEvent("PSYC Root system included Trace package."); rootCenter.addPackage(stats); stats.addEvent("PSYC Root system included Statistics package."); MMPMultiplexer multiplexer; PSYCPlace p; PSYCUser u; String[] list; int i; Properties settings = new Properties(); try { settings.load(new FileInputStream("server.config")); } catch(IOException e) { } list = (new Value(settings.getProperty("psyc.server.places"))).toList(); for(i = 0;i < list.length;++i) { multiplexer = new MMPMultiplexer(list[i],null,root); root.setManager(list[i],multiplexer); stats.addEvent("MMP Multiplexer " + list[i] + " is up."); p = new PSYCPlace(multiplexer,settings,list[i]); multiplexer.setManager(p.getCenter().getMMPPacketManager()); stats.addEvent("PSYC MessageCenter " + list[i] + " is up."); } list = (new Value(settings.getProperty("psyc.server.users"))).toList(); for(i = 0;i < list.length;++i) { multiplexer = new MMPMultiplexer(list[i],null,root); root.setManager(list[i],multiplexer); stats.addEvent("MMP Multiplexer " + list[i] + " is up."); u = new PSYCUser(multiplexer,settings,list[i]); multiplexer.setManager(u.getCenter().getMMPPacketManager()); stats.addEvent("PSYC MessageCenter " + list[i] + " is up."); } stats.addEvent("PSYC Root system completed initialization."); } /** * **/ public void addCenter(PSYCMessageCenter center) { if(center == null) return; } /** * **/ public static void main(String[] args) { PSYCServer s = new PSYCServer(); } }