Package org.apache.sling.commons.osgi.bundleversion

Examples of org.apache.sling.commons.osgi.bundleversion.FileBundleVersionInfo


        // extract bundle version info
        final URLConnection launcherJarConn = launcherJar.openConnection();
        launcherJarConn.setUseCaches(false);
        final File tmp = new File(launchpadHome, "Loader_tmp_" + System.currentTimeMillis() + SharedConstants.LAUNCHER_JAR_REL_PATH);
        spool(launcherJarConn.getInputStream(), tmp);
        final FileBundleVersionInfo newVi = new FileBundleVersionInfo(tmp);
        boolean installNewLauncher = true;

        try {
            if(!newVi.isBundle()) {
                throw new IOException("New launcher jar is not a bundle, cannot get version info:" + launcherJar);
            }

            // Compare versions to decide whether to use the existing or new launcher jar
            if (currentLauncherJarFile.exists()) {
                final FileBundleVersionInfo currentVi = new FileBundleVersionInfo(currentLauncherJarFile);
                if(!currentVi.isBundle()) {
                    throw new IOException("Existing launcher jar is not a bundle, cannot get version info:"
                            + currentLauncherJarFile.getAbsolutePath());
                }

                String info = null;
                if(currentVi.compareTo(newVi) == 0) {
                    info = "up to date";
                    installNewLauncher = false;
                } else if(currentVi.compareTo(newVi) > 0) {
                    info = "more recent than ours";
                    installNewLauncher = false;
                }

                if(info != null) {
View Full Code Here


                if(f.getAbsolutePath().equals(current.getAbsolutePath())) {
                    continue;
                }
                String versionInfo = null;
                try {
                    FileBundleVersionInfo vi = new FileBundleVersionInfo(f);
                    versionInfo = getBundleInfo(vi);
                } catch(IOException ignored) {
                }
                info("Deleting obsolete launcher jar: " + f.getName() + ", " + versionInfo);
                f.delete();
View Full Code Here

        // Keep only those which have valid Bundle headers, and
        // sort them according to the bundle version numbers
        final List<FileBundleVersionInfo> list = new ArrayList<FileBundleVersionInfo>();
        for(File f : rawList) {
            FileBundleVersionInfo fvi = null;
            try {
                fvi = new FileBundleVersionInfo(f);
            } catch(IOException ioe) {
                // Cannot read bundle info from jar file - should never happen??
                throw new IllegalStateException("Cannot read bundle information from loader file " + f.getAbsolutePath());
            }
            if(fvi.isBundle()) {
                list.add(fvi);
            }
        }
        Collections.sort(list);
        final File [] result = new File[list.size()];
        int i = 0;
        for(FileBundleVersionInfo fvi : list) {
            result[i++] = fvi.getSource();
        }
        return result;
    }
View Full Code Here

TOP

Related Classes of org.apache.sling.commons.osgi.bundleversion.FileBundleVersionInfo

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.