import org.gxos.Defaults; import org.gxos.DatabaseManager; import org.gxos.xml.Database; import org.gxos.xml.XMLException; import org.gxos.xml.XMLObject; import org.gxos.Users; import commgrids.schema.User; import org.gxos.Collections; import commgrids.pda.schema.*; import org.gxos.Devices; import org.gxos.schema.types.DeviceTypeType; public class TestPDA { public static void main(String[] args) { // if no path is specified, it is assumed to be in the classpath. String configFile = "c:\\gxos\\lib\\gxosconfig.xml"; try { if(args.length > 0) // config file can be the first parameter. configFile = args[0]; DatabaseManager.initialize( Defaults.getXMLConfiguration(configFile) ); XMLObject db = DatabaseManager.getDatabase("gxos://okctest"); XMLObject users = db.getChild("Users"); User soh = (User)Users.constructUser(new User(), "soh", // user id "Pda_Me", // passwd "Sangyoon Oh", // full name "", "", // prefixes and suffixes if any, i.e. Mr, Jr "soh@indiana.edu"); // email users.addObject(soh); // sub XML collection under soh soh.addObject( Collections.constructCollection("myPDAs") ); PDADevice pda = (PDADevice)Devices.constructDevice( new PDADevice(), "handy", "ucs.indiana.edu", "156.56.104.12", DeviceTypeType.PDA); pda.setScreen(new Screen()); pda.getScreen().setSize(new Size()); pda.getScreen().getSize().setHeight(180); pda.getScreen().getSize().setWidth(150); Type t = new Type(); t.setBitDepth(16); t.setColor(true); pda.getScreen().setType(t); Multimedia mm = new Multimedia(); mm.setAudio(true); mm.setVideo(false); pda.setMultimedia(mm); XMLObject pdas = soh.getChild("myPDAs"); pdas.addObject(pda); System.out.println(pda.getXML()); } catch(Exception e) { e.printStackTrace(); } } }