use of org.bimserver.shared.exceptions.BimServerClientException in project BIMserver by opensourceBIM.
the class TestChangeDescription method start.
private void start() {
BimServerClientInterface client = LocalDevSetup.setupJson("http://localhost:8080");
try {
SProject project = client.getServiceInterface().getProjectsByName("dfgfgdf").get(0);
IfcModelInterface model = client.getModel(project, project.getLastRevisionId(), false, true);
for (IfcWall wall : model.getAllWithSubTypes(IfcWall.class)) {
wall.setDescription(wall.getDescription() + " Changed");
}
model.commit("test");
} catch (UserException e) {
e.printStackTrace();
} catch (ServerException e) {
e.printStackTrace();
} catch (PublicInterfaceNotFoundException e) {
e.printStackTrace();
} catch (BimServerClientException e) {
e.printStackTrace();
}
}
use of org.bimserver.shared.exceptions.BimServerClientException in project BIMserver by opensourceBIM.
the class TestChangeWrappedValue method start.
private void start() {
try {
BimServerClientInterface client = LocalDevSetup.setupJson("http://localhost:8080");
long poid = 2686977;
long roid = 720899;
SProject project = client.getServiceInterface().getProjectByPoid(poid);
IfcModelInterface model = client.getModel(project, roid, true, false);
for (IfcPropertySingleValue prop : model.getAll(IfcPropertySingleValue.class)) {
// IfcValue value = ((IfcPropertySingleValue) prop).getNominalValue();
// if(value instanceof IfcLabel){
// System.out.println(prop.getOid() + " is " + ((IfcLabel) value).getWrappedValue() );
// ((IfcLabel) value).setWrappedValue(((IfcLabel) value).getWrappedValue() + " changed");
// }
IfcLabel label = model.create(IfcLabel.class);
label.setWrappedValue("blabla");
prop.setNominalValue(label);
}
model.commit("blaat");
} catch (ServiceException e) {
e.printStackTrace();
} catch (BimServerClientException e) {
e.printStackTrace();
} catch (PublicInterfaceNotFoundException e) {
e.printStackTrace();
} catch (IfcModelInterfaceException e) {
e.printStackTrace();
}
}
use of org.bimserver.shared.exceptions.BimServerClientException 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().checkinFromUrl(project.getOid(), fileName, deserializer.getOid(), fileName, downloadUrl, false, true);
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();
}
}
use of org.bimserver.shared.exceptions.BimServerClientException in project BIMserver by opensourceBIM.
the class TestMultiple method main.
public static void main(String[] args) throws InterruptedException {
try (BimServerClientFactory factory = new JsonBimServerClientFactory("http://localhost:8080")) {
BimServerClientInterface client = factory.create(new UsernamePasswordAuthenticationInfo("admin@bimserver.org", "admin"));
ThreadPoolExecutor executor = new ThreadPoolExecutor(2, 2, 1, TimeUnit.DAYS, new ArrayBlockingQueue<>(2));
for (int i = 0; i < 2; i++) {
executor.submit(new Runnable() {
@Override
public void run() {
try {
SProject project = client.getServiceInterface().addProject("P" + new Random().nextInt(), "ifc2x3tc1");
SDeserializerPluginConfiguration deserializer = client.getServiceInterface().getSuggestedDeserializerForExtension("ifc", project.getOid());
client.checkin(project.getOid(), "Test", deserializer.getOid(), false, Flow.ASYNC, Paths.get("C:\\Git\\TestFiles\\TestData\\data\\HITOS_070308.ifc"));
} catch (ServerException e) {
e.printStackTrace();
} catch (UserException e) {
e.printStackTrace();
} catch (PublicInterfaceNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
});
}
executor.shutdown();
executor.awaitTermination(1, TimeUnit.HOURS);
} catch (BimServerClientException e) {
e.printStackTrace();
} catch (ServiceException e) {
e.printStackTrace();
} catch (ChannelConnectionException e) {
e.printStackTrace();
} catch (Exception e1) {
e1.printStackTrace();
}
}
use of org.bimserver.shared.exceptions.BimServerClientException in project BIMserver by opensourceBIM.
the class TestNewQueryViaClient method start.
private void start() {
try (JsonBimServerClientFactory factory = new JsonBimServerClientFactory("http://localhost:8080")) {
BimServerClient client = factory.create(new UsernamePasswordAuthenticationInfo("admin@bimserver.org", "admin"));
String projectName = "Test " + new Random().nextInt();
SProject project = client.getServiceInterface().addProject(projectName, "ifc2x3tc1");
SDeserializerPluginConfiguration deserializer = client.getServiceInterface().getSuggestedDeserializerForExtension("ifc", project.getOid());
client.checkin(project.getOid(), "Test Model", deserializer.getOid(), false, Flow.SYNC, Paths.get("C:/Git/TestFiles/TestData/data/AC11-FZK-Haus-IFC.ifc"));
project = client.getServiceInterface().getProjectByPoid(project.getOid());
System.out.println(project.getName());
ClientIfcModel model = client.getModel(project, project.getLastRevisionId(), false, false);
Query query = new Query(model.getPackageMetaData());
QueryPart queryPart = query.createQueryPart();
queryPart.addType(Ifc2x3tc1Package.eINSTANCE.getIfcWall(), true);
for (IfcWall ifcWall : model.getAllWithSubTypes(IfcWall.class)) {
System.out.println(ifcWall.getGlobalId());
}
} catch (ServiceException e) {
e.printStackTrace();
} catch (ChannelConnectionException e) {
e.printStackTrace();
} catch (PublicInterfaceNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} catch (BimServerClientException e) {
e.printStackTrace();
} catch (Exception e1) {
e1.printStackTrace();
}
}
Aggregations