} else if (args.length == 3) { // URL, username, password
CoreServiceFactory.setDefault(args[0], args[1], args[2]);
} else {
CoreServiceFactory.setDefault("http://t2013.playground");
}
ICoreService client = CoreServiceFactory.getBasicHttpClient();
duration = System.currentTimeMillis() - duration;
System.out.println(String.format("Client initialized in %.3fs", duration / 1000.0));
duration = System.currentTimeMillis();
System.out.println("Api version: " + client.getApiVersion());
UserData currentUser = client.getCurrentUser();
System.out.println("Current user: '" + currentUser.getTitle() + "' '" + currentUser.getDescription() + "' " +
currentUser.getId());
System.out.println("Publication objects:");
PublicationsFilterData filter = new PublicationsFilterData();
ArrayOfIdentifiableObjectData systemWideList = client.getSystemWideList(filter);
for (IdentifiableObjectData iod : systemWideList.getIdentifiableObjectData()) {
PublicationData publication = (PublicationData) iod;
System.out.println("\t" + publication.getTitle());
}
System.out.println("Publications XML:");
GetSystemWideListXmlResult resultXml = client.getSystemWideListXml(filter);
Element element = (Element) resultXml.getAny();
Utils.printDocument(element.getOwnerDocument(), System.out);
duration = System.currentTimeMillis() - duration;
System.out.println(String.format("Execution took %.3fs", duration / 1000.0));