Package org.osgi.framework

Examples of org.osgi.framework.Version


    public void dispose() {}

    private static Requirement resourceToRequirement(Resource resource) {
        Capability identity = ResourceUtils.getIdentityCapability(resource);
        String id = ResourceUtils.getIdentity(identity);
        Version version = ResourceUtils.getVersion(identity);
        Version dropQualifier = new Version(version.getMajor(), version.getMinor(), version.getMicro());

        AndFilter filter = new AndFilter();
        filter.addChild(new SimpleFilter(IdentityNamespace.IDENTITY_NAMESPACE, id));
        filter.addChild(new LiteralFilter(Filters.fromVersionRange(dropQualifier.toString())));

        Requirement req = new CapReqBuilder(IdentityNamespace.IDENTITY_NAMESPACE).addDirective(Namespace.REQUIREMENT_FILTER_DIRECTIVE, filter.toString()).buildSyntheticRequirement();
        return req;
    }
View Full Code Here


        Attrs attribs = new Attrs();
        String versionRangeStr;
        if (isWorkspace(resource)) {
            versionRangeStr = VERSION_LATEST;
        } else {
            Version version = ResourceUtils.getVersion(idCap);
            VersionRange versionRange = createVersionRange(version);
            versionRangeStr = versionRange.toString();
        }
        attribs.put(Constants.VERSION_ATTRIBUTE, versionRangeStr);
View Full Code Here

        List<Capability> workspaceCaps = resource.getCapabilities(CAPABILITY_WORKSPACE);
        return workspaceCaps != null && !workspaceCaps.isEmpty();
    }

    private static VersionRange createVersionRange(Version version) {
        Version base = new Version(version.getMajor(), version.getMinor(), version.getMicro());
        Version next = new Version(version.getMajor(), version.getMinor(), version.getMicro() + 1);

        return new VersionRange(String.format("[%s,%s)", base, next));
    }
View Full Code Here

                name = "<unknown>";
            }
        }
        label.append(name);

        Version version = ResourceUtils.getVersion(identity);
        if (version != null)
            label.append(" " + version, StyledString.COUNTER_STYLER);
    }
View Full Code Here

                name = "<unknown>";
            }
        }
        label.append(name, UIConstants.BOLD_STYLER);

        Version version = ResourceUtils.getVersion(identity);
        if (version != null)
            label.append(" " + version, StyledString.COUNTER_STYLER);
    }
View Full Code Here

            return 0;
        }

        if (this.getSymbolicName().equals(other.getSymbolicName())) {
            // compare version
            Version thisVersion = new Version(this.getVersion());
            Version otherVersion = new Version(other.getVersion());
            return thisVersion.compareTo(otherVersion);
        }

        return this.getSymbolicName().compareTo(other.getSymbolicName());
    }
View Full Code Here

        if (symbolicName == null || symbolicName.length() == 0) {
            throw new IOException("Missing Symbolic Name in Manifest !");
        }

        String version = manifest.getMainAttributes().getValue("Bundle-Version");
        Version v = Version.parseVersion(version);
        if (v.getQualifier().indexOf("SNAPSHOT") >= 0) {
            String tStamp;
            synchronized (DATE_FORMAT) {
                tStamp = DATE_FORMAT.format(new Date());
            }
            version = v.getMajor() + "." + v.getMinor() + "." + v.getMicro()
                + "." + v.getQualifier().replaceAll("SNAPSHOT", tStamp);
            manifest.getMainAttributes().putValue("Bundle-Version", version);
        }

        File bundle = new File(this.repoLocation, symbolicName + "-" + v + ".jar");
        OutputStream out = null;
View Full Code Here

        } else {
            String s = range.substring(1, range.length() - 1);
            String vlo = s.substring(0, s.indexOf(','));
            String vhi = s.substring(s.indexOf(',') + 1, s.length());

            this.m_low = new Version(vlo);
            this.m_isLowInclusive = range.charAt(0) == '[';
            this.m_high = new Version(vhi);
            this.m_isHighInclusive = range.charAt(range.length() - 1) == ']';
            this.m_isHighInclusive = false;
        }
    }
View Full Code Here

        return admin.discoverResources(sb.toString());
    }

    private Resource selectNewestVersion(Resource[] resources) {
        int idx = -1;
        Version v = null;
        for (int i = 0; (resources != null) && (i < resources.length); i++) {
            if (i == 0) {
                idx = 0;
                v = resources[i].getVersion();
            } else {
                Version vtmp = resources[i].getVersion();
                if (vtmp.compareTo(v) > 0) {
                    idx = i;
                    v = vtmp;
                }
            }
        }
View Full Code Here

        LoginResult authResult = LdapAuthenticationService.performAuthentication(req, resp);
        if (authResult == LoginResult.OK) {
          // redirection from
          // FormAuthenticationService.setNotAuthenticated
          String versionString = req.getHeader("Orion-Version"); //$NON-NLS-1$
          Version version = versionString == null ? null : new Version(versionString);

          // TODO: This is a workaround for calls
          // that does not include the WebEclipse version header
          String xRequestedWith = req.getHeader("X-Requested-With"); //$NON-NLS-1$
View Full Code Here

TOP

Related Classes of org.osgi.framework.Version

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.