private SPluginBundleVersion createPluginBundleVersionFromMavenModel(Model model, boolean isLocalDev) { SPluginBundleVersion sPluginBundleVersion = new SPluginBundleVersion(); sPluginBundleVersion.setType(isLocalDev ? SPluginBundleType.LOCAL_DEV : SPluginBundleType.MAVEN); sPluginBundleVersion.setGroupId(model.getGroupId()); sPluginBundleVersion.setArtifactId(model.getArtifactId()); sPluginBundleVersion.setVersion(model.getVersion()); sPluginBundleVersion.setDescription(model.getDescription()); sPluginBundleVersion.setRepository("local"); sPluginBundleVersion.setMismatch(false); // TODO sPluginBundleVersion.setOrganization(model.getOrganization().getName()); sPluginBundleVersion.setName(model.getName()); return sPluginBundleVersion; }
@Override public SPluginBundle getPluginBundle() { SPluginBundle result = new SPluginBundle(); result.setName(sPluginBundle.getName()); result.setOrganization(sPluginBundle.getOrganization()); if (sPluginBundle.getInstalledVersion() != null) { SPluginBundleVersion installedVersion = new SPluginBundleVersion(); installedVersion.setArtifactId(sPluginBundle.getInstalledVersion().getArtifactId()); installedVersion.setDescription(sPluginBundle.getInstalledVersion().getDescription()); installedVersion.setGroupId(sPluginBundle.getInstalledVersion().getGroupId()); installedVersion.setIcon(sPluginBundle.getInstalledVersion().getIcon()); installedVersion.setMismatch(sPluginBundle.getInstalledVersion().isMismatch()); installedVersion.setName(sPluginBundle.getInstalledVersion().getName()); installedVersion.setOrganization(sPluginBundle.getInstalledVersion().getOrganization()); installedVersion.setRepository(sPluginBundle.getInstalledVersion().getRepository()); installedVersion.setType(sPluginBundle.getInstalledVersion().getType()); installedVersion.setVersion(sPluginBundle.getInstalledVersion().getVersion()); result.setInstalledVersion(installedVersion); } return result; }
public PluginBundleVersion convertFromSObject(SPluginBundleVersion input, PluginBundleVersion result, DatabaseSession session) throws BimserverDatabaseException { if (input == null) { return null; } result.setVersion(input.getVersion()); result.setType(PluginBundleType.values()[input.getType().ordinal()]); result.setDescription(input.getDescription()); result.setMismatch(input.isMismatch()); result.setRepository(input.getRepository()); result.setGroupId(input.getGroupId()); result.setArtifactId(input.getArtifactId()); result.setIcon(input.getIcon()); result.setOrganization(input.getOrganization()); result.setName(input.getName()); result.setDate(input.getDate()); return result; } public SPluginBundleType convertToSObject(PluginBundleType input) {
version.put("groupId", pluginContext.getPluginBundle().getPluginBundleVersion().getGroupId()); version.put("artifactId", pluginContext.getPluginBundle().getPluginBundleVersion().getArtifactId()); version.put("version", pluginContext.getPluginBundle().getPluginBundleVersion().getVersion()); version.put("description", pluginContext.getPluginBundle().getPluginBundleVersion().getDescription()); version.put("icon", pluginContext.getPluginBundle().getPluginBundleVersion().getIcon()); version.put("name", pluginContext.getPluginBundle().getPluginBundleVersion().getName()); version.put("organization", pluginContext.getPluginBundle().getPluginBundleVersion().getOrganization()); return true; } else if (getPluginContext().getPluginType() == PluginSourceType.JAR_FILE) { version.put("nonce", pluginContext.getPluginBundle().getPluginBundleVersion().getVersion()); response.setContentType("application/json"); response.getOutputStream().write(version.toString().getBytes(Charsets.UTF_8));
SPluginBundleVersion installedVersion = currentlyInstalledPluginBundle.getPluginBundleVersion(); for (PluginBundleVersion pluginBundleVersion : getDatabaseSession().getAll(PluginBundleVersion.class)) { if (pluginBundleVersion.getArtifactId().equals(installedVersion.getArtifactId()) && pluginBundleVersion.getGroupId().equals(installedVersion.getGroupId()) && pluginBundleVersion.getVersion().equals(installedVersion.getVersion())) { installedVersion.setOid(pluginBundleVersion.getOid()); PluginBundleIdentifier pluginBundleIdentifier = new PluginBundleIdentifier(installedVersion.getGroupId(), installedVersion.getArtifactId()); PluginLocation<?> pluginLocation = repositoryKnownLocation.get(pluginBundleIdentifier);
ZipEntry entry = jarFile.getEntry("META-INF/maven/" + pluginBundleVersion.getGroupId() + "/" + pluginBundleVersion.getArtifactId() + "/pom.xml"); Model model = mavenreader.read(jarFile.getInputStream(entry)); if (strictDependencyChecking) { VersionRange versionRange = VersionRange.createFromVersion(dependency.getVersion()); String version = pluginBundleIdentifierToPluginBundle.get(pluginBundleIdentifier).getPluginBundleVersion().getVersion(); ArtifactVersion artifactVersion = new DefaultArtifactVersion(version); if (versionRange.containsVersion(artifactVersion)) {
public Path getTempDir() { return pluginManager.getTempDir().resolve(getPluginBundle().getPluginBundleVersion().getGroupId() + "." + getPluginBundle().getPluginBundleVersion().getArtifactId()); }
+ pluginBundleIdentifierToPluginBundle.get(pluginBundleVersionIdentifier.getPluginBundleIdentifier()).getPluginBundleVersion().getVersion() + ")"); if (Files.exists(icon)) { byte[] iconBytes = Files.readAllBytes(icon); sPluginBundleVersion.setIcon(iconBytes);
@Override public String getVersion() { return pluginBundleVersion.getVersion(); }
public Object newInstance() { return new org.bimserver.interfaces.objects.SPluginBundleVersion(); } }));
if (existingPluginBundle.getPluginBundle().getInstalledVersion().getType() == SPluginBundleType.MAVEN) { Path target = pluginsDir.resolve(currentVersion.getFileName()); Files.delete(target);
public Object sGet(SField sField) { if (sField.getName().equals("version")) { return getVersion(); return getType(); return getDescription(); return isMismatch(); return getRepository(); return getGroupId(); return getArtifactId(); return getIcon(); return getOrganization(); return getName(); return getDate(); return getOid(); return getRid();
PluginBundleIdentifier pluginBundleIdentifier = pluginBundleVersionIdentifier.getPluginBundleIdentifier(); if (pluginBundleIdentifierToPluginBundle.containsKey(pluginBundleIdentifier)) { throw new PluginException("Plugin " + pluginBundleIdentifier.getHumanReadable() + " already loaded (version " + pluginBundleIdentifierToPluginBundle.get(pluginBundleIdentifier).getPluginBundleVersion().getVersion() + ")");
@Override public SPluginBundleVersion getPluginBundleVersion() { SPluginBundleVersion sPluginBundleVersion = new SPluginBundleVersion(); sPluginBundleVersion.setType(SPluginBundleType.LOCAL); sPluginBundleVersion.setGroupId(model.getGroupId()); sPluginBundleVersion.setArtifactId(model.getArtifactId()); sPluginBundleVersion.setVersion(model.getVersion()); sPluginBundleVersion.setDescription(model.getDescription()); sPluginBundleVersion.setRepository("local"); sPluginBundleVersion.setMismatch(false); // TODO sPluginBundleVersion.setOrganization(model.getOrganization().getName()); sPluginBundleVersion.setName(model.getName()); return sPluginBundleVersion; } }
IfcModelInterface allOfType = session.getAllOfType(StorePackage.eINSTANCE.getPluginBundleVersion(), OldQuery.getDefault()); for (PluginBundleVersion pbv : allOfType.getAll(PluginBundleVersion.class)) { if (pbv.getGroupId().equals(pluginBundle.getPluginBundleVersion().getGroupId()) && pbv.getArtifactId().equals(pluginBundle.getPluginBundleVersion().getArtifactId())) { current.setDescription(sPluginBundleVersion.getArtifactId()); current.setIcon(sPluginBundleVersion.getIcon()); current.setMismatch(sPluginBundleVersion.isMismatch()); current.setRepository(sPluginBundleVersion.getRepository()); current.setType(getSConverter().convertFromSObject(sPluginBundleVersion.getType())); current.setVersion(sPluginBundleVersion.getVersion()); current.setOrganization(sPluginBundleVersion.getOrganization()); current.setName(sPluginBundleVersion.getName()); current.setDate(sPluginBundleVersion.getDate());
if (sPluginBundleVersion.getVersion().equals(currentlyInstalledPluginBundle.getPluginBundleVersion().getVersion())) { found = true;
public SPluginBundleVersion convertToSObject(PluginBundleVersion input) { if (input == null) { return null; } SPluginBundleVersion result = new SPluginBundleVersion(); result.setOid(input.getOid()); result.setRid(input.getRid()); result.setVersion(input.getVersion()); result.setType(SPluginBundleType.values()[input.getType().ordinal()]); result.setDescription(input.getDescription()); result.setMismatch(input.isMismatch()); result.setRepository(input.getRepository()); result.setGroupId(input.getGroupId()); result.setArtifactId(input.getArtifactId()); result.setIcon(input.getIcon()); result.setOrganization(input.getOrganization()); result.setName(input.getName()); result.setDate(input.getDate()); return result; }
IfcModelInterface allOfType = session.getAllOfType(StorePackage.eINSTANCE.getPluginBundleVersion(), OldQuery.getDefault()); for (PluginBundleVersion pbv : allOfType.getAll(PluginBundleVersion.class)) { if (pbv.getGroupId().equals(pluginBundle.getPluginBundleVersion().getGroupId()) && pbv.getArtifactId().equals(pluginBundle.getPluginBundleVersion().getArtifactId())) { pluginBundleVersion.setArtifactId(sPluginBundleVersion.getArtifactId()); pluginBundleVersion.setDescription(sPluginBundleVersion.getArtifactId()); pluginBundleVersion.setGroupId(sPluginBundleVersion.getGroupId()); pluginBundleVersion.setIcon(sPluginBundleVersion.getIcon()); pluginBundleVersion.setMismatch(sPluginBundleVersion.isMismatch()); pluginBundleVersion.setRepository(sPluginBundleVersion.getRepository()); pluginBundleVersion.setType(getSConverter().convertFromSObject(sPluginBundleVersion.getType())); pluginBundleVersion.setVersion(sPluginBundleVersion.getVersion()); pluginBundleVersion.setOrganization(sPluginBundleVersion.getOrganization()); pluginBundleVersion.setName(sPluginBundleVersion.getName()); pluginBundleVersion.setDate(sPluginBundleVersion.getDate());
model = mavenreader.read(fileReader); SPluginBundleVersion sPluginBundleVersion = new SPluginBundleVersion(); sPluginBundleVersion.setOrganization(model.getOrganization().getName()); sPluginBundleVersion.setName(model.getName()); sPluginBundleVersion.setType(SPluginBundleType.MAVEN); sPluginBundleVersion.setGroupId(groupId); sPluginBundleVersion.setArtifactId(artifactId); sPluginBundleVersion.setVersion(version); sPluginBundleVersion.setDescription(model.getDescription()); sPluginBundleVersion.setRepository(defaultrepository); sPluginBundleVersion.setMismatch(false); sPluginBundleVersion.setIcon(getVersionIcon(version)); } catch (ArtifactResolutionException e) { sPluginBundleVersion.setDate(date.getTime());
SPluginBundleVersion sPluginBundleVersion = new SPluginBundleVersion(); boolean useful = true; boolean hasPluginBaseDependency = false; sPluginBundleVersion.setMismatch(true); if (strictVersionChecking) { useful = false; sPluginBundleVersion.setName(mavenPluginVersion.getModel().getName()); sPluginBundleVersion.setOrganization(mavenPluginVersion.getModel().getOrganization().getName()); sPluginBundleVersion.setArtifactId(mavenPluginLocation.getArtifactId()); sPluginBundleVersion.setGroupId(mavenPluginLocation.getGroupId()); try { sPluginBundleVersion.setRepository(mavenPluginLocation.getRepository(mavenPluginVersion.getVersion().toString())); } catch (ArtifactResolutionException e) { LOGGER.error("", e); sPluginBundleVersion.setType(SPluginBundleType.MAVEN); sPluginBundleVersion.setVersion(mavenPluginVersion.getVersion().toString()); sPluginBundleVersion.setDescription(mavenPluginVersion.getModel().getDescription()); sPluginBundleVersion.setIcon(mavenPluginLocation.getVersionIcon(mavenPluginVersion.getVersion().toString())); } catch (ArtifactResolutionException e) { GregorianCalendar date = mavenPluginLocation.getVersionDate(mavenPluginVersion.getVersion().toString()); if (date != null) { sPluginBundleVersion.setDate(date.getTime());