use of org.bimserver.interfaces.objects.SPluginBundleVersion in project BIMserver by opensourceBIM.
the class PluginManager method createPluginBundleVersionFromMavenModel.
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");
// TODO
sPluginBundleVersion.setMismatch(false);
sPluginBundleVersion.setOrganization(model.getOrganization().getName());
sPluginBundleVersion.setName(model.getName());
return sPluginBundleVersion;
}
use of org.bimserver.interfaces.objects.SPluginBundleVersion in project BIMserver by opensourceBIM.
the class PluginManager method extractPluginBundleVersionFromJar.
public SPluginBundleVersion extractPluginBundleVersionFromJar(Path jarFilePath, boolean isLocal) throws PluginException {
String filename = jarFilePath.getFileName().toString();
PluginBundleVersionIdentifier pluginBundleVersionIdentifier = PluginBundleVersionIdentifier.fromFileName(filename);
PluginBundleIdentifier pluginBundleIdentifier = pluginBundleVersionIdentifier.getPluginBundleIdentifier();
try (JarFile jarFile = new JarFile(jarFilePath.toFile())) {
ZipEntry pomEntry = jarFile.getEntry("META-INF/maven/" + pluginBundleIdentifier.getGroupId() + "/" + pluginBundleIdentifier.getArtifactId() + "/" + "pom.xml");
if (pomEntry == null) {
throw new PluginException("No pom.xml found in JAR file " + jarFilePath.toString());
}
MavenXpp3Reader mavenreader = new MavenXpp3Reader();
Model model = mavenreader.read(jarFile.getInputStream(pomEntry));
SPluginBundleVersion sPluginBundleVersion = createPluginBundleVersionFromMavenModel(model, isLocal);
return sPluginBundleVersion;
} catch (IOException e) {
throw new PluginException(e);
} catch (XmlPullParserException e) {
throw new PluginException(e);
}
}
use of org.bimserver.interfaces.objects.SPluginBundleVersion in project BIMserver by opensourceBIM.
the class MavenPluginLocation method getPluginBundleVersion.
public SPluginBundleVersion getPluginBundleVersion(String version) {
try {
Path pomFile = getVersionPom(version);
MavenXpp3Reader mavenreader = new MavenXpp3Reader();
Model model = null;
try (FileReader fileReader = new FileReader(pomFile.toFile())) {
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);
try {
sPluginBundleVersion.setIcon(getVersionIcon(version));
} catch (ArtifactResolutionException e) {
// Not a problem
}
try {
GregorianCalendar date = getVersionDate(version);
// DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ");
if (date != null) {
sPluginBundleVersion.setDate(date.getTime());
}
} catch (ArtifactResolutionException e) {
// Not a problem
} catch (Exception e) {
LOGGER.error("", e);
}
return sPluginBundleVersion;
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} catch (XmlPullParserException e) {
e.printStackTrace();
} catch (ArtifactResolutionException e) {
e.printStackTrace();
}
return null;
}
use of org.bimserver.interfaces.objects.SPluginBundleVersion in project BIMserver by opensourceBIM.
the class LocalMavenPluginBundle method getPluginBundleVersion.
@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");
// TODO
sPluginBundleVersion.setMismatch(false);
sPluginBundleVersion.setOrganization(model.getOrganization().getName());
sPluginBundleVersion.setName(model.getName());
return sPluginBundleVersion;
}
Aggregations