use of org.bimserver.plugins.MavenPluginLocation in project BIMserver by opensourceBIM.
the class GetPluginBundle method execute.
@Override
public SPluginBundle execute() throws UserException, BimserverLockConflictException, BimserverDatabaseException, ServerException {
if (bimServer.getVersionChecker() != null && bimServer.getVersionChecker().getLocalVersion() != null) {
bimserverVersion = new DefaultArtifactVersion(bimServer.getVersionChecker().getLocalVersion().getFullString());
}
MavenPluginLocation pluginLocation = bimServer.getMavenPluginRepository().getPluginLocation(repository, groupId, artifactId);
PluginBundle pluginBundle = bimServer.getPluginManager().getPluginBundle(pluginLocation.getPluginIdentifier());
// Skipping all plugin bundles that already have an installed version
if (pluginBundle == null) {
SPluginBundle sPluginBundle = processPluginLocation(pluginLocation, false, bimserverVersion);
if (sPluginBundle != null) {
return sPluginBundle;
}
}
throw new UserException("Plugin bundle already installed " + groupId + "." + artifactId);
}
use of org.bimserver.plugins.MavenPluginLocation in project BIMserver by opensourceBIM.
the class InstallPluginBundle method execute.
@Override
public Void execute() throws UserException, BimserverLockConflictException, BimserverDatabaseException, ServerException {
LOGGER.info("Installing plugin " + repository + " " + groupId + "." + artifactId + "." + version);
MavenPluginLocation mavenPluginLocation = bimServer.getMavenPluginRepository().getPluginLocation(repository, groupId, artifactId);
if (version == null) {
String latestVersion = mavenPluginLocation.getLatestVersionString();
LOGGER.info("Using version " + latestVersion + " because no version given");
version = latestVersion;
}
try {
LOGGER.info(mavenPluginLocation.getRepository(version));
} catch (Exception e1) {
e1.printStackTrace();
}
MavenPluginBundle mavenPluginBundle = mavenPluginLocation.getMavenPluginBundle(version);
LOGGER.info(mavenPluginBundle.getVersion());
try {
bimServer.getPluginManager().install(mavenPluginBundle, plugins, false);
} catch (Exception e) {
LOGGER.error("", e);
throw new UserException(e);
}
return null;
}
use of org.bimserver.plugins.MavenPluginLocation in project BIMserver by opensourceBIM.
the class UpdatePluginBundle method execute.
@Override
public Void execute() throws UserException, BimserverLockConflictException, BimserverDatabaseException, ServerException {
MavenPluginLocation mavenPluginLocation = bimServer.getMavenPluginRepository().getPluginLocation(repository, groupId, artifactId);
try {
Path jarFile = mavenPluginLocation.getVersionJar(version);
Path pomFile = mavenPluginLocation.getVersionPom(version);
try {
List<SPluginInformation> plugins = null;
try {
plugins = bimServer.getPluginManager().getPluginInformationFromPluginFile(new ByteArrayInputStream(mavenPluginLocation.getVersionPluginXml(version)));
} catch (ArtifactResolutionException e) {
plugins = bimServer.getPluginManager().getPluginInformationFromJar(jarFile);
}
// IfcModelInterface allOfType = getDatabaseSession().getAllOfType(StorePackage.eINSTANCE.getPluginDescriptor(), OldQuery.getDefault());
// for (SPluginInformation sPluginInformation : plugins) {
// update plugin information with data from potentially existing plugins
// }
bimServer.getPluginManager().update(mavenPluginLocation.getPluginVersionIdentifier(version), mavenPluginLocation.getPluginBundle(version), mavenPluginLocation.getPluginBundleVersion(version), jarFile, pomFile, plugins);
} catch (Exception e) {
throw new UserException(e);
}
} catch (Exception e) {
LOGGER.error("", e);
throw new UserException(e);
}
return null;
}
Aggregations