use of org.bimserver.database.actions.InstallPluginBundleFromBytes in project BIMserver by opensourceBIM.
the class PluginServiceImpl method installPluginBundleFromUrl.
public void installPluginBundleFromUrl(String url, Boolean installAllPluginsForAllUsers, Boolean installAllPluginsForNewUsers) throws UserException, ServerException {
requireRealUserAuthentication();
DatabaseSession session = getBimServer().getDatabase().createSession(OperationType.POSSIBLY_WRITE);
try {
byte[] data = NetUtils.getContentAsBytes(new URL(url), 5000);
session.executeAndCommitAction(new InstallPluginBundleFromBytes(session, getInternalAccessMethod(), getBimServer(), data, installAllPluginsForAllUsers, installAllPluginsForNewUsers));
} catch (Exception e) {
handleException(e);
} finally {
session.close();
}
}
use of org.bimserver.database.actions.InstallPluginBundleFromBytes in project BIMserver by opensourceBIM.
the class PluginServiceImpl method installPluginBundleFromFile.
public void installPluginBundleFromFile(DataHandler file, Boolean installAllPluginsForAllUsers, Boolean installAllPluginsForNewUsers) throws UserException, ServerException {
requireRealUserAuthentication();
DatabaseSession session = getBimServer().getDatabase().createSession(OperationType.POSSIBLY_WRITE);
try {
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
IOUtils.copy(file.getInputStream(), byteArrayOutputStream);
session.executeAndCommitAction(new InstallPluginBundleFromBytes(session, getInternalAccessMethod(), getBimServer(), byteArrayOutputStream.toByteArray(), installAllPluginsForAllUsers, installAllPluginsForNewUsers));
} catch (Exception e) {
handleException(e);
} finally {
session.close();
}
}
Aggregations