use of org.bimserver.interfaces.objects.SJavaInfo in project BIMserver by opensourceBIM.
the class AdminServiceImpl method getJavaInfo.
@Override
public SJavaInfo getJavaInfo() throws UserException {
requireAdminAuthentication();
SJavaInfo javaInfo = new SJavaInfo();
javaInfo.setHeapTotal(Runtime.getRuntime().totalMemory());
javaInfo.setHeapUsed(Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory());
javaInfo.setHeapFree(Runtime.getRuntime().freeMemory());
javaInfo.setHeapMax(Runtime.getRuntime().maxMemory());
javaInfo.setThreads(Thread.activeCount());
javaInfo.setJavaHome(System.getProperty("java.home"));
javaInfo.setJavaVersion(System.getProperty("java.version"));
javaInfo.setJavaVendor(System.getProperty("java.vendor"));
javaInfo.setJavaVendorurl(System.getProperty("java.vendor.url"));
javaInfo.setJavavmVersion(System.getProperty("java.vm.version"));
javaInfo.setJavavmVendor(System.getProperty("java.vm.vendor"));
javaInfo.setJavavmName(System.getProperty("java.vm.name"));
javaInfo.setJavaspecVersion(System.getProperty("java.specification.version"));
javaInfo.setJavaspecVendor(System.getProperty("java.specification.vendor"));
javaInfo.setJavaspecName(System.getProperty("java.specification.name"));
javaInfo.setJavaClassVersion(System.getProperty("java.class.version"));
for (String classp : System.getProperty("java.class.path").split(File.pathSeparator)) {
javaInfo.getJavaClasspath().add(classp);
}
for (String classp : System.getProperty("java.library.path").split(File.pathSeparator)) {
javaInfo.getJavaLibrarypath().add(classp);
}
javaInfo.setJavaIoTmp(System.getProperty("java.io.tmpdir"));
javaInfo.setJavaExtdir(System.getProperty("java.ext.dirs"));
javaInfo.setJavaFileSeparator(System.getProperty("file.separator"));
javaInfo.setJavaPathSeparator(System.getProperty("path.separator"));
javaInfo.setJavaLineSeparator(System.getProperty("line.separator"));
return javaInfo;
}
use of org.bimserver.interfaces.objects.SJavaInfo in project BIMserver by opensourceBIM.
the class TestBigFilesRemote method start.
private void start(String[] args) {
String address = args[0];
String username = args[1];
String password = args[2];
String basepath = args[3];
System.out.println("Address: " + address);
System.out.println("Username: " + username);
System.out.println("Password: " + password);
System.out.println("Basepath: " + basepath);
try (JsonBimServerClientFactory factory = new JsonBimServerClientFactory(null, address)) {
BimServerClient client = factory.create(new UsernamePasswordAuthenticationInfo(args[1], args[2]));
String[] fileNames = new String[] { "4NC Whole Model.ifc", "1006 General withIFC_exportLayerCombos.ifc", "12001_17 MOS_AC17SpecialBigVersion.ifc", "12510_MASTER_Drofus_Test.ifc", "BondBryan10-134 (06) Proposed Site-1.ifc", "HLM_39090_12259 University of Sheffield NEB [PR-BIM-01-bhelberg].ifc" };
DateFormat dateFormat = new SimpleDateFormat("dd-MM-yyyy hh:mm:ss");
for (String fileName : fileNames) {
String projectName = fileName.substring(0, fileName.lastIndexOf(".ifc"));
List<SProject> projectsByName = client.getServiceInterface().getProjectsByName(projectName);
SProject project = null;
if (projectsByName.size() == 1) {
project = projectsByName.get(0);
} else {
System.out.println("Creating project " + fileName);
project = client.getServiceInterface().addProject(projectName, "ifc2x3tc1");
}
SDeserializerPluginConfiguration deserializer = client.getServiceInterface().getSuggestedDeserializerForExtension("ifc", project.getOid());
System.out.println(dateFormat.format(new Date()));
SDatabaseInformation databaseInformation = client.getAdminInterface().getDatabaseInformation();
System.out.println("Database size: " + Formatters.bytesToString(databaseInformation.getDatabaseSizeInBytes()) + " (" + databaseInformation.getDatabaseSizeInBytes() + ")");
SJavaInfo javaInfo = client.getAdminInterface().getJavaInfo();
System.out.println("Used: " + Formatters.bytesToString(javaInfo.getHeapUsed()) + ", Free: " + Formatters.bytesToString(javaInfo.getHeapFree()) + ", Max: " + Formatters.bytesToString(javaInfo.getHeapMax()) + ", Total: " + Formatters.bytesToString(javaInfo.getHeapTotal()));
String downloadUrl = basepath + UrlEscapers.urlPathSegmentEscaper().escape(fileName);
System.out.println("Download URL: " + downloadUrl);
client.getServiceInterface().checkinFromUrlSync(project.getOid(), fileName, deserializer.getOid(), fileName, downloadUrl, false);
System.out.println("Done checking in " + fileName);
}
} catch (ServiceException e) {
e.printStackTrace();
} catch (ChannelConnectionException e) {
e.printStackTrace();
} catch (PublicInterfaceNotFoundException e) {
e.printStackTrace();
} catch (BimServerClientException e) {
e.printStackTrace();
} catch (Exception e1) {
e1.printStackTrace();
}
}
Aggregations