Search in sources :

Example 1 with LocalMavenPluginBundle

use of org.bimserver.plugins.LocalMavenPluginBundle in project BIMserver by opensourceBIM.

the class InstallPluginBundleFromBytes method execute.

@Override
public Void execute() throws UserException, BimserverLockConflictException, BimserverDatabaseException, ServerException {
    LocalMavenPluginBundle mavenPluginBundle = new LocalMavenPluginBundle(data);
    try {
        List<SPluginInformation> pluginInformationFromPluginFile = bimServer.getPluginManager().getPluginInformationFromJar(new ByteArrayInputStream(data));
        for (SPluginInformation sPluginInformation : pluginInformationFromPluginFile) {
            sPluginInformation.setEnabled(true);
            if (installAllPluginsForAllUsers) {
                sPluginInformation.setInstallForAllUsers(true);
            }
            if (installAllPluginsForNewUsers) {
                sPluginInformation.setInstallForNewUsers(true);
            }
        }
        bimServer.getPluginManager().install(mavenPluginBundle, pluginInformationFromPluginFile, false);
    } catch (Exception e) {
        LOGGER.error("", e);
        throw new UserException(e);
    }
    return null;
}
Also used : ByteArrayInputStream(java.io.ByteArrayInputStream) SPluginInformation(org.bimserver.interfaces.objects.SPluginInformation) UserException(org.bimserver.shared.exceptions.UserException) LocalMavenPluginBundle(org.bimserver.plugins.LocalMavenPluginBundle) BimserverLockConflictException(org.bimserver.database.BimserverLockConflictException) UserException(org.bimserver.shared.exceptions.UserException) ServerException(org.bimserver.shared.exceptions.ServerException) BimserverDatabaseException(org.bimserver.BimserverDatabaseException)

Aggregations

ByteArrayInputStream (java.io.ByteArrayInputStream)1 BimserverDatabaseException (org.bimserver.BimserverDatabaseException)1 BimserverLockConflictException (org.bimserver.database.BimserverLockConflictException)1 SPluginInformation (org.bimserver.interfaces.objects.SPluginInformation)1 LocalMavenPluginBundle (org.bimserver.plugins.LocalMavenPluginBundle)1 ServerException (org.bimserver.shared.exceptions.ServerException)1 UserException (org.bimserver.shared.exceptions.UserException)1