Package org.apache.karaf.features

Examples of org.apache.karaf.features.Feature


            Set<Group> groups = groupManager.listLocalGroups();

            if (groups != null && !groups.isEmpty()) {
                for (Group group : groups) {

                    Feature feature = event.getFeature();
                    String name = feature.getName();
                    String version = feature.getVersion();

                    if (isAllowed(group, Constants.FEATURES_CATEGORY, name, EventType.OUTBOUND)) {
                        FeatureEvent.EventType type = event.getType();

                        //Check the event type.
View Full Code Here


    public void installFeature(String name, String version) throws Exception {
        installFeature(name, version, EnumSet.noneOf(Option.class));
    }

    public void installFeature(String name, String version, EnumSet<Option> options) throws Exception {
        Feature f = getFeature(name, version);
        if (f == null) {
            throw new Exception("No feature named '" + name
                + "' with version '" + version + "' available");
        }
        installFeature(f, options);
View Full Code Here

            System.out.println("Installing feature " + feature.getName() + " " + feature.getVersion());
        }
        for (Feature dependency : feature.getDependencies()) {
            VersionRange range = FeatureImpl.DEFAULT_VERSION.equals(dependency.getVersion())
                        ? VersionRange.ANY_VERSION : new VersionRange(dependency.getVersion(), true, true);
            Feature fi = null;
            for (Feature f : installed.keySet()) {
                if (f.getName().equals(dependency.getName())) {
                    Version v = VersionTable.getVersion(f.getVersion());
                    if (range.contains(v)) {
                        if (fi == null || VersionTable.getVersion(fi.getVersion()).compareTo(v) < 0) {
                            fi = f;
                        }
                    }
                }
            }
            if (fi == null) {
                Map<String, Feature> avail = getFeatures().get(dependency.getName());
                if (avail != null) {
                    for (Feature f : avail.values()) {
                        Version v = VersionTable.getVersion(f.getVersion());
                        if (range.contains(v)) {
                            if (fi == null || VersionTable.getVersion(fi.getVersion()).compareTo(v) < 0) {
                                fi = f;
                            }
                        }
                    }
                }
View Full Code Here

        }
        uninstallFeature(name, versions.get(0));
    }
   
    public void uninstallFeature(String name, String version) throws Exception {
      Feature feature = getFeature(name, version);
        if (feature == null || !installed.containsKey(feature)) {
            throw new Exception("Feature named '" + name
                + "' with version '" + version + "' is not installed");
        }
        // Grab all the bundles installed by this feature
View Full Code Here

        }
        Map<String, Feature> versions = getFeatures().get(name);
        if (versions == null || versions.isEmpty()) {
            return null;
        } else {
            Feature feature = versions.get(version);
            if (feature == null) {
                if (FeatureImpl.DEFAULT_VERSION.equals(version)) {
                    Version latest = new Version(cleanupVersion(version));
                    for (String available : versions.keySet()) {
                        Version availableVersion = new Version(cleanupVersion(available));
View Full Code Here

                                featureVersion = FeatureImpl.DEFAULT_VERSION;
                            }

                            try {
                                // try to grab specific feature version
                                Feature feature = getFeature(featureName, featureVersion);
                                if (feature != null) {
                                    features.add(feature);
                                } else {
                                    LOGGER.error("Error installing boot feature " + f + ": feature not found");
                                }
View Full Code Here

        return l;
    }

    protected void saveMap(Properties props, String prefix, Map<Feature, Set<Long>> map) {
        for (Map.Entry<Feature, Set<Long>> entry : map.entrySet()) {
            Feature key = entry.getKey();
            String val = createValue(entry.getValue());
            props.put(prefix + key.toString(), val);
        }
    }
View Full Code Here

    private String getFeaturesContainingBundleList(Bundle bundle) throws Exception {
        Set<Feature> features = getFeaturesContainingBundle(bundle);
        StringBuilder buffer = new StringBuilder();
        Iterator<Feature> iter = features.iterator();
        while (iter.hasNext()) {
            Feature feature= iter.next();
            buffer.append(feature.getId());
            if (iter.hasNext()) {
                buffer.append(", ");
            }
        }
        return buffer.toString();
View Full Code Here

    public void installFeature(String name, String version) throws Exception {
        installFeature(name, version, EnumSet.noneOf(Option.class));
    }

    public void installFeature(String name, String version, EnumSet<Option> options) throws Exception {
        Feature f = getFeature(name, version);
        if (f == null) {
            throw new Exception("No feature named '" + name
                + "' with version '" + version + "' available");
        }
        installFeature(f, options);
View Full Code Here

            System.out.println("Installing feature " + feature.getName() + " " + feature.getVersion());
        }
        for (Feature dependency : feature.getDependencies()) {
            VersionRange range = FeatureImpl.DEFAULT_VERSION.equals(dependency.getVersion())
                        ? VersionRange.ANY_VERSION : new VersionRange(dependency.getVersion(), true, true);
            Feature fi = null;
            for (Feature f : installed.keySet()) {
                if (f.getName().equals(dependency.getName())) {
                    Version v = VersionTable.getVersion(f.getVersion());
                    if (range.contains(v)) {
                        if (fi == null || VersionTable.getVersion(fi.getVersion()).compareTo(v) < 0) {
                            fi = f;
                        }
                    }
                }
            }
            if (fi == null) {
                Map<String, Feature> avail = getFeatures().get(dependency.getName());
                if (avail != null) {
                    for (Feature f : avail.values()) {
                        Version v = VersionTable.getVersion(f.getVersion());
                        if (range.contains(v)) {
                            if (fi == null || VersionTable.getVersion(fi.getVersion()).compareTo(v) < 0) {
                                fi = f;
                            }
                        }
                    }
                }
View Full Code Here

TOP

Related Classes of org.apache.karaf.features.Feature

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.