public SPluginBundle convertToSObject(PluginBundle input) { if (input == null) { return null; } SPluginBundle result = new SPluginBundle(); result.setOid(input.getOid()); result.setRid(input.getRid()); result.setOrganization(input.getOrganization()); result.setName(input.getName()); PluginBundleVersion latestVersionVal = input.getLatestVersion(); result.setLatestVersion(convertToSObject(latestVersionVal)); List<SPluginBundleVersion> listavailableVersions = new ArrayList<SPluginBundleVersion>(); for (PluginBundleVersion v : input.getAvailableVersions()) { listavailableVersions.add(convertToSObject(v)); } result.setAvailableVersions(listavailableVersions); PluginBundleVersion installedVersionVal = input.getInstalledVersion(); result.setInstalledVersion(convertToSObject(installedVersionVal)); return result; }
@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 Object sGet(SField sField) { if (sField.getName().equals("organization")) { return getOrganization(); } if (sField.getName().equals("name")) { return getName(); } if (sField.getName().equals("latestVersion")) { return getLatestVersion(); } if (sField.getName().equals("availableVersions")) { return getAvailableVersions(); } if (sField.getName().equals("installedVersion")) { return getInstalledVersion(); } if (sField.getName().equals("oid")) { return getOid(); } if (sField.getName().equals("rid")) { return getRid(); } throw new RuntimeException("Field " + sField.getName() + " not found"); } @SuppressWarnings("unchecked")
@Override public SPluginBundle getPluginBundle() { SPluginBundle result = new SPluginBundle(); result.setName(model.getName()); result.setOrganization(model.getOrganization().getName()); return result; }
public SPluginBundle processMavenPluginLocation(MavenPluginLocation mavenPluginLocation, boolean strictVersionChecking, ArtifactVersion bimserverVersion) { SPluginBundle pluginBundle = new SPluginBundle(); boolean usefulBundle = false; Iterator<MavenPluginVersion> iterateAllVersions = mavenPluginLocation.iterateAllVersions(); sPluginBundleVersion.setDescription(mavenPluginVersion.getModel().getDescription()); pluginBundle.setName(mavenPluginVersion.getModel().getName()); pluginBundle.setOrganization(mavenPluginVersion.getModel().getOrganization().getName()); if (pluginBundle.getLatestVersion() == null) { pluginBundle.setLatestVersion(sPluginBundleVersion); pluginBundle.getAvailableVersions().add(sPluginBundleVersion); try { sPluginBundleVersion.setIcon(mavenPluginLocation.getVersionIcon(mavenPluginVersion.getVersion().toString()));
public PluginBundle convertFromSObject(SPluginBundle input, PluginBundle result, DatabaseSession session) throws BimserverDatabaseException { if (input == null) { return null; } result.setOrganization(input.getOrganization()); result.setName(input.getName()); result.setLatestVersion(convertFromSObject(input.getLatestVersion(), session)); List<PluginBundleVersion> listavailableVersions = result.getAvailableVersions(); for (SPluginBundleVersion v : input.getAvailableVersions()) { listavailableVersions.add(convertFromSObject(v, session)); } result.setInstalledVersion(convertFromSObject(input.getInstalledVersion(), session)); return result; }
SPluginBundle sPluginBundle = new SPluginBundle(); if (model.getOrganization() == null) { throw new PluginException("Plugis are required to have an organization in the pom.xml file"); sPluginBundle.setOrganization(model.getOrganization().getName()); sPluginBundle.setName(model.getName()); sPluginBundle.setInstalledVersion(sPluginBundleVersion);
for (SPluginBundleVersion sPluginBundleVersion : sPluginBundle.getAvailableVersions()) { if (sPluginBundleVersion.getVersion().equals(currentlyInstalledPluginBundle.getPluginBundleVersion().getVersion())) { found = true; sPluginBundle.getAvailableVersions().add(currentlyInstalledPluginBundle.getPluginBundleVersion()); sPluginBundle.setInstalledVersion(installedVersion); Collections.sort(sPluginBundle.getAvailableVersions(), new Comparator<SPluginBundleVersion>() { private List<Integer> split(String in) { List<Integer> result = new ArrayList<>();
public PluginBundle convertFromSObject(SPluginBundle input, DatabaseSession session) throws BimserverDatabaseException { if (session == null) { throw new BimserverDatabaseException("session == null, use the other method"); } LOGGER.info("Potential unlinked object created"); PluginBundle result = convertFromSObject(input, StoreFactory.eINSTANCE.createPluginBundle(), session); ((IdEObjectImpl)result).setOid(input.getOid()); ((IdEObjectImpl)result).setRid(input.getRid()); return result; }
public Object newInstance() { return new org.bimserver.interfaces.objects.SPluginBundle(); } }));
@SuppressWarnings({ "unchecked", "rawtypes" }) private PluginBundle loadPlugins(PluginBundleVersionIdentifier pluginBundleVersionIdentifier, ResourceLoader resourceLoader, ClassLoader classLoader, URI location, String classLocation, PluginDescriptor pluginDescriptor, PluginSourceType pluginType, Set<org.bimserver.plugins.Dependency> dependencies, SPluginBundle sPluginBundle, SPluginBundleVersion sPluginBundleVersion) throws PluginException { sPluginBundle.setInstalledVersion(sPluginBundleVersion); PluginBundle pluginBundle = new PluginBundleImpl(pluginBundleVersionIdentifier, sPluginBundle, sPluginBundleVersion, pluginDescriptor);
if (existingPluginBundle.getPluginBundle().getInstalledVersion().getType() == SPluginBundleType.MAVEN) { Path target = pluginsDir.resolve(currentVersion.getFileName()); Files.delete(target);
public SPluginBundle extractPluginBundleFromJar(Path jarFilePath) throws PluginException { String filename = jarFilePath.getFileName().toString(); PluginBundleVersionIdentifier pluginBundleVersionIdentifier = PluginBundleVersionIdentifier.fromFileName(filename); try (JarFile jarFile = new JarFile(jarFilePath.toFile())) { String pomLocation = "META-INF/maven/" + pluginBundleVersionIdentifier.getPluginBundleIdentifier().getGroupId() + "/" + pluginBundleVersionIdentifier.getPluginBundleIdentifier().getArtifactId() + "/" + "pom.xml"; ZipEntry pomEntry = jarFile.getEntry(pomLocation); if (pomEntry == null) { throw new PluginException("No pom.xml found in JAR file " + jarFilePath.toString() + ", " + pomLocation); } MavenXpp3Reader mavenreader = new MavenXpp3Reader(); Model model = mavenreader.read(jarFile.getInputStream(pomEntry)); SPluginBundle sPluginBundle = new SPluginBundle(); sPluginBundle.setOrganization(model.getOrganization().getName()); sPluginBundle.setName(model.getName()); return sPluginBundle; } catch (IOException e) { throw new PluginException(e); } catch (XmlPullParserException e) { throw new PluginException(e); } }
setOrganization((String)val); return; setName((String)val); return; setLatestVersion((SPluginBundleVersion)val); return; setAvailableVersions((List<SPluginBundleVersion>)val); return; setInstalledVersion((SPluginBundleVersion)val); return; setOid((Long)val); return; setRid((Integer)val); return;
SPluginBundle sPluginBundle = new SPluginBundle(); Model model = mavenreader.read(jarFile.getInputStream(entry)); sPluginBundle.setOrganization(model.getOrganization().getName()); sPluginBundle.setName(model.getName());
pluginBundle = loadPluginsFromJar(pluginBundleVersionIdentifier, target, sPluginBundle, pluginBundleVersion, parentClassLoader); if (plugins.isEmpty()) { LOGGER.warn("No plugins given to install for bundle " + sPluginBundle.getName());
model = mavenreader.read(fileReader); SPluginBundle sPluginBundle = new SPluginBundle(); sPluginBundle.setOrganization(model.getOrganization().getName()); sPluginBundle.setName(model.getName());