Class Overrides


  • public final class Overrides
    extends Object
    Helper class to deal with overriden bundles at feature installation time.
    • Method Detail

      • override

        @Deprecated
        public static <T extends org.osgi.resource.Resource> void override​(Map<String,​T> resources,
                                                                           Collection<String> overrides)
        Deprecated.

        Compute a list of bundles to install, taking into account overrides

        .

        The file containing the overrides will be loaded from the given url. Blank lines and lines starting with a '#' will be ignored, all other lines are considered as urls to override bundles.

        The list of resources to resolve will be scanned and for each bundle, if a bundle override matches that resource, it will be used instead.

        Matching is done on bundle symbolic name (they have to be the same) and version (the bundle override version needs to be greater than the resource to be resolved, and less than the next minor version. A range directive can be added to the override url in which case, the matching will succeed if the resource to be resolved is within the given range.

        Type Parameters:
        T - the resource type.
        Parameters:
        resources - the list of resources to resolve
        overrides - list of bundle overrides
      • override

        public static <T extends org.osgi.resource.Resource> void override​(Map<String,​T> resources,
                                                                           Map<String,​T> overridenFrom)

        Input map of resources is checked - if there are matching resources in overridenFrom and there's no symbolic name matching, resource for original URI is restored. Effectively this method reverts maven override mode if there's no symbolic name matching.

        About versions - with previous ${karaf.etc}/overrides.properties both symbolic name should match and versions should be compatible - either using implicit rules or by means of range clause. With new mechanism, we know we should use OSGi or Maven override, but we loose information about OSGi version range matching - we assume then that version rules were applied at features JAXB model processing time.

        Type Parameters:
        T -
        Parameters:
        resources -
        overridenFrom -
      • loadOverrides

        public static Set<String> loadOverrides​(String overridesUrl)
      • extractUrl

        public static String extractUrl​(String override)