Search in sources :

Example 31 with SSerializerPluginConfiguration

use of org.bimserver.interfaces.objects.SSerializerPluginConfiguration in project BIMserver by opensourceBIM.

the class TestNotification method main.

@SuppressWarnings("unused")
public static void main(String[] args) {
    try {
        BimServerClientInterface client = LocalDevSetup.setupJson("http://localhost:8080");
        // SProject newProject = client.getServiceInterface().addProject("test" + Math.random());
        // SDeserializerPluginConfiguration deserializerByName = client.getServiceInterface().getDeserializerByName("IfcStepDeserializer");
        // client.checkin(newProject.getOid(), "test", deserializerByName.getOid(), false, true, new File("../TestData/data/AC11-Institute-Var-2-IFC.ifc"));
        // newProject = client.getServiceInterface().getProjectByPoid(newProject.getOid());
        SProject project = client.getServiceInterface().getProjectByPoid(458753L);
        SSerializerPluginConfiguration geometrySerializer = client.getServiceInterface().getSerializerByName("JsonGeometrySerializer");
        for (int i = 0; i < 100; i++) {
        // final CountDownLatch countDownLatch = new CountDownLatch(1);
        // final Long downloadByTypes = client.getServiceInterface().downloadByTypes(Collections.singleton(project.getLastRevisionId()), "ifc2x3tc1", Collections.singleton("IfcWindow"), geometrySerializer.getOid(), true, false, false, false);
        // final ProgressHandler progressHandler = new ProgressHandler() {
        // @Override
        // public void progress(SLongActionState state) {
        // if (state.getProgress() == 100) {
        // countDownLatch.countDown();
        // }
        // }
        // };
        // client.getNotificationsManager().registerProgressHandler(downloadByTypes, progressHandler);
        // try {
        // countDownLatch.await(20, TimeUnit.SECONDS);
        // client.getNotificationsManager().unregisterProgressHandler(downloadByTypes, progressHandler);
        // } catch (InterruptedException e) {
        // e.printStackTrace();
        // }
        }
        client.disconnect();
        System.out.println("Done");
    } catch (ServiceException e) {
        e.printStackTrace();
    } catch (PublicInterfaceNotFoundException e) {
        e.printStackTrace();
    }
}
Also used : ServiceException(org.bimserver.shared.exceptions.ServiceException) PublicInterfaceNotFoundException(org.bimserver.shared.exceptions.PublicInterfaceNotFoundException) BimServerClientInterface(org.bimserver.plugins.services.BimServerClientInterface) SSerializerPluginConfiguration(org.bimserver.interfaces.objects.SSerializerPluginConfiguration) SProject(org.bimserver.interfaces.objects.SProject)

Aggregations

SSerializerPluginConfiguration (org.bimserver.interfaces.objects.SSerializerPluginConfiguration)31 SProject (org.bimserver.interfaces.objects.SProject)24 BimServerClientInterface (org.bimserver.plugins.services.BimServerClientInterface)23 SDeserializerPluginConfiguration (org.bimserver.interfaces.objects.SDeserializerPluginConfiguration)17 UsernamePasswordAuthenticationInfo (org.bimserver.shared.UsernamePasswordAuthenticationInfo)15 Test (org.junit.Test)15 IOException (java.io.IOException)11 URL (java.net.URL)11 PublicInterfaceNotFoundException (org.bimserver.shared.exceptions.PublicInterfaceNotFoundException)10 ServerException (org.bimserver.shared.exceptions.ServerException)10 UserException (org.bimserver.shared.exceptions.UserException)10 BimserverDatabaseException (org.bimserver.BimserverDatabaseException)7 IfcModelInterface (org.bimserver.emf.IfcModelInterface)6 ByteArrayOutputStream (java.io.ByteArrayOutputStream)5 DatabaseSession (org.bimserver.database.DatabaseSession)5 ServiceException (org.bimserver.shared.exceptions.ServiceException)5 FileOutputStream (java.io.FileOutputStream)4 InputStream (java.io.InputStream)4 Path (java.nio.file.Path)4 SModelComparePluginConfiguration (org.bimserver.interfaces.objects.SModelComparePluginConfiguration)4