Search in sources :

Example 1 with FileDataSource

use of org.bimserver.utils.FileDataSource in project BIMserver by opensourceBIM.

the class TestInstall method main.

public static void main(String[] args) {
    ArrayList<String> pluginList = new ArrayList<>();
    pluginList.add("C:/plugins/ifcplugins-0.0.15.jar");
    try (BimServerClientFactory factory = new JsonBimServerClientFactory("http://localhost:8080")) {
        BimServerClientInterface client = factory.create(new UsernamePasswordAuthenticationInfo("admin@bimserver.org", "admin"));
        for (String each : pluginList) {
            try {
                DataSource fds = new FileDataSource(new File(each));
                DataHandler handler = new DataHandler(fds);
                client.getPluginInterface().installPluginBundleFromFile(handler, true, true);
                System.out.println("Plugin " + each + " successfully installed !");
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    } catch (BimServerClientException e1) {
        e1.printStackTrace();
    } catch (ServiceException e1) {
        e1.printStackTrace();
    } catch (ChannelConnectionException e1) {
        e1.printStackTrace();
    } catch (Exception e2) {
        e2.printStackTrace();
    }
}
Also used : ChannelConnectionException(org.bimserver.shared.ChannelConnectionException) UsernamePasswordAuthenticationInfo(org.bimserver.shared.UsernamePasswordAuthenticationInfo) JsonBimServerClientFactory(org.bimserver.client.json.JsonBimServerClientFactory) ArrayList(java.util.ArrayList) DataHandler(javax.activation.DataHandler) BimServerClientException(org.bimserver.shared.exceptions.BimServerClientException) BimServerClientFactory(org.bimserver.shared.BimServerClientFactory) JsonBimServerClientFactory(org.bimserver.client.json.JsonBimServerClientFactory) ChannelConnectionException(org.bimserver.shared.ChannelConnectionException) BimServerClientException(org.bimserver.shared.exceptions.BimServerClientException) ServiceException(org.bimserver.shared.exceptions.ServiceException) FileDataSource(org.bimserver.utils.FileDataSource) DataSource(javax.activation.DataSource) ServiceException(org.bimserver.shared.exceptions.ServiceException) FileDataSource(org.bimserver.utils.FileDataSource) BimServerClientInterface(org.bimserver.plugins.services.BimServerClientInterface) File(java.io.File)

Aggregations

File (java.io.File)1 ArrayList (java.util.ArrayList)1 DataHandler (javax.activation.DataHandler)1 DataSource (javax.activation.DataSource)1 JsonBimServerClientFactory (org.bimserver.client.json.JsonBimServerClientFactory)1 BimServerClientInterface (org.bimserver.plugins.services.BimServerClientInterface)1 BimServerClientFactory (org.bimserver.shared.BimServerClientFactory)1 ChannelConnectionException (org.bimserver.shared.ChannelConnectionException)1 UsernamePasswordAuthenticationInfo (org.bimserver.shared.UsernamePasswordAuthenticationInfo)1 BimServerClientException (org.bimserver.shared.exceptions.BimServerClientException)1 ServiceException (org.bimserver.shared.exceptions.ServiceException)1 FileDataSource (org.bimserver.utils.FileDataSource)1