use of org.osgi.framework.Version in project dbeaver by serge-rider.
the class FireBirdUtils method getViewSourceWithHeader.
public static String getViewSourceWithHeader(DBRProgressMonitor monitor, GenericTable view, String source) throws DBException {
Version version = getFireBirdServerVersion(view.getDataSource());
StringBuilder sql = new StringBuilder();
sql.append("CREATE ");
if (version.getMajor() > 2 || (version.getMajor() == 2 && version.getMinor() >= 5)) {
sql.append("OR ALTER ");
}
sql.append("VIEW ").append(view.getName()).append(" ");
Collection<GenericTableColumn> columns = view.getAttributes(monitor);
if (columns != null) {
sql.append("(");
boolean first = true;
for (GenericTableColumn column : columns) {
if (!first) {
sql.append(", ");
}
first = false;
sql.append(DBUtils.getQuotedIdentifier(column));
}
sql.append(")\n");
}
sql.append("AS\n").append(source);
return sql.toString();
}
use of org.osgi.framework.Version in project dbeaver by serge-rider.
the class FireBirdUtils method getFireBirdServerVersion.
public static Version getFireBirdServerVersion(DBPDataSource dataSource) {
String versionInfo = dataSource.getInfo().getDatabaseProductVersion();
Matcher matcher = VERSION_PATTERN.matcher(versionInfo);
if (matcher.matches()) {
return new Version(matcher.group(1));
}
return new Version(0, 0, 0);
}
use of org.osgi.framework.Version in project tesb-studio-se by Talend.
the class DependencyVersionPart method getVersion.
/**
* Gets the version.
*
* @return the version
*/
public String getVersion() {
if (fIsRanged) {
// if versions are equal they must be inclusive for a range to be
// valid
// blindly set for the user
String minV = getMinVersion();
String maxV = getMaxVersion();
boolean minI = getMinInclusive();
boolean maxI = getMaxInclusive();
if (minV.equals(maxV))
minI = maxI = true;
VersionRange versionRange = new VersionRange(new Version(minV), minI, new Version(maxV), maxI);
if (!versionRange.equals(VersionRange.emptyRange)) {
return versionRange.toString();
}
} else {
String singleversion = extractSingleVersionFromText();
if (!singleversion.isEmpty()) {
Version versionBean = new Version(singleversion);
if (!versionBean.equals(Version.emptyVersion)) {
return versionBean.toString();
}
}
}
return null;
}
use of org.osgi.framework.Version in project EnrichmentMapApp by BaderLab.
the class Em21Handler method isEM21Installed.
private static boolean isEM21Installed(BundleContext bc) {
for (Bundle bundle : bc.getBundles()) {
String name = bundle.getSymbolicName();
Version version = bundle.getVersion();
if (name.equals("org.baderlab.csplugins.enrichmentmap") && version.equals(new Version(2, 1, 0))) {
return true;
}
}
return false;
}
use of org.osgi.framework.Version in project aries by apache.
the class ApplicationMetadataImpl method setup.
/**
* setup the application metadata from the appManifest
* @param appManifest application.mf manifest
*/
private void setup(Manifest appManifest) {
Map<String, String> appMap = readManifestIntoMap(appManifest);
// configure the appSymbolicName and appVersion
this.appSymbolicName = appMap.get(AppConstants.APPLICATION_SYMBOLIC_NAME);
this.appVersion = new Version(appMap.get(AppConstants.APPLICATION_VERSION));
this.appName = appMap.get(AppConstants.APPLICATION_NAME);
this.appScope = this.appSymbolicName + "_" + this.appVersion.toString();
if (this.appSymbolicName == null || this.appVersion == null) {
throw new IllegalArgumentException("Failed to create ApplicationMetadataImpl object from Manifest " + appManifest);
}
// configure appContents
// use parseImportString as we don't allow appContents to be duplicate
String applicationContents = appMap.get(AppConstants.APPLICATION_CONTENT);
Map<String, Map<String, String>> appContentsMap = ManifestHeaderProcessor.parseImportString(applicationContents);
for (Map.Entry<String, Map<String, String>> e : appContentsMap.entrySet()) {
this.appContents.add(new ContentImpl(e.getKey(), e.getValue()));
}
String useBundleStr = appMap.get(AppConstants.APPLICATION_USE_BUNDLE);
if (useBundleStr != null) {
Map<String, Map<String, String>> useBundleMap = ManifestHeaderProcessor.parseImportString(useBundleStr);
for (Map.Entry<String, Map<String, String>> e : useBundleMap.entrySet()) {
this.useBundle.add(new ContentImpl(e.getKey(), e.getValue()));
}
}
String allServiceImports = appMap.get(AppConstants.APPLICATION_IMPORT_SERVICE);
List<String> serviceImports = ManifestHeaderProcessor.split(allServiceImports, ",");
for (String s : serviceImports) {
try {
ServiceDeclaration dec = new ServiceDeclarationImpl(s);
importServices.add(dec);
} catch (InvalidSyntaxException ise) {
_logger.warn("APPUTILS0013E", new Object[] { s, appSymbolicName });
}
}
String allServiceExports = appMap.get(AppConstants.APPLICATION_EXPORT_SERVICE);
List<String> serviceExports = ManifestHeaderProcessor.split(allServiceExports, ",");
for (String s : serviceExports) {
try {
ServiceDeclaration dec = new ServiceDeclarationImpl(s);
exportServices.add(dec);
} catch (InvalidSyntaxException ise) {
_logger.warn("APPUTILS0014E", new Object[] { s, appSymbolicName });
}
}
}
Aggregations