Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id AD372200CF8 for ; Thu, 14 Sep 2017 12:09:12 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id AC3881609CE; Thu, 14 Sep 2017 10:09:12 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id C852F1609CD for ; Thu, 14 Sep 2017 12:09:11 +0200 (CEST) Received: (qmail 2554 invoked by uid 500); 14 Sep 2017 10:09:09 -0000 Mailing-List: contact dev-help@karaf.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@karaf.apache.org Delivered-To: mailing list dev@karaf.apache.org Received: (qmail 2355 invoked by uid 99); 14 Sep 2017 10:09:09 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 14 Sep 2017 10:09:09 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id A4BB0D5505 for ; Thu, 14 Sep 2017 10:09:08 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -0.121 X-Spam-Level: X-Spam-Status: No, score=-0.121 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_PASS=-0.001] autolearn=disabled Authentication-Results: spamd1-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id TI0h_4r-0Cgx for ; Thu, 14 Sep 2017 10:09:07 +0000 (UTC) Received: from mail-qt0-f174.google.com (mail-qt0-f174.google.com [209.85.216.174]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTPS id CEF3C61010 for ; Thu, 14 Sep 2017 10:09:06 +0000 (UTC) Received: by mail-qt0-f174.google.com with SMTP id i50so6201958qtf.0 for ; Thu, 14 Sep 2017 03:09:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-transfer-encoding; bh=i7MLLAi/AJh6q1qclnHWmHjwBR/QtgQpkUgN91uY+UU=; b=dXkkf5g8hKzPZDhzZuLie1JQnG27nZQFGyVFNio6NFEUfcL+MD5304la3o+p6lORdt NBhmlTRnsmSTifxsVvhJats75eL27OPnxtEWVkXMQ62X86F4b4vA3ubd+Jcor0N5alV1 ZadW+u9Z2V4MAesI5xfVwQNdA7ackQ6MMYDumVaK5TtRTU7R7Q/SBTn87QdRpUadcEl0 Jjp2cgI4aK9W/hZhsSZrT3WO0mvQ8Owh1CCtgETYN+SlZXumCT9vLAE+MNU1QNHQV+/6 XEAtBKkhrjy9rVbMOq+aqBZ5qS1JU2MSrYH1G+eAG+Ed9pOb7IwTL/qWCdX44sTIAztg 4OFw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:content-transfer-encoding; bh=i7MLLAi/AJh6q1qclnHWmHjwBR/QtgQpkUgN91uY+UU=; b=fFiyo1JZhoj2pLHN6oEE6BnVm1twDNsgMzJO961hxJDxsaBO2vPNZPhwsI9AQfXT8d KePZFspk53hAEkPERoe1mWY2Zk1YvlZ9tQMUIROT3TNcnQ4386oVJYueBMrbryDqccib 5DOFlQFn32ZbTBXpmwsPAa7TmQ/O+wpESUlBw7tVjtkqBlbnxOXXvXaOagFV4TzZeTSb LmzzQ9dhb9XigxPzme/e2ctc0oA7pQtcu4+p/A5IC1SdHVVQooFecspW1P8Y20CwTNhz afEW6oSDqG5Y65rsu967smKvLiKwlcf1oiD6jhEL78JVobqCD95n5WWCyNjpFrmu8LXQ LTvg== X-Gm-Message-State: AHPjjUjnzq9XZUQr79+pfyXekoebqdrwyEt3kzJU/dLDQ6OAZcG8iVpt E3b71Obbjs0r3+5WnX0x8GOE4CkPCgLCSy6t1v+wXQqa X-Google-Smtp-Source: AOwi7QAcIU0wH1FJ9mxPYl9+lCuGHhF8bXzLydA+ae36JsYn659H2W5bjpOyVE+F4ag7VscJ5pN/JFxrKCTnKUyD2K0= X-Received: by 10.237.34.24 with SMTP id n24mr18499255qtc.218.1505383746218; Thu, 14 Sep 2017 03:09:06 -0700 (PDT) MIME-Version: 1.0 Received: by 10.237.32.235 with HTTP; Thu, 14 Sep 2017 03:09:05 -0700 (PDT) In-Reply-To: References: From: Grzegorz Grzybek Date: Thu, 14 Sep 2017 12:09:05 +0200 Message-ID: Subject: Re: "Dynamic" org.apache.karaf.features.internal.service.Overrides#override() To: dev@karaf.apache.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable archived-at: Thu, 14 Sep 2017 10:09:12 -0000 I've created https://issues.apache.org/jira/browse/KARAF-5376 to track this regards Grzegorz Grzybek 2017-09-14 11:58 GMT+02:00 Grzegorz Grzybek : > Thanks for answer > > 2017-09-14 11:40 GMT+02:00 Guillaume Nodet : >> >> 2017-09-14 9:59 GMT+02:00 Grzegorz Grzybek : >> >> > By default we can use etc/overrides.properties file to instruct Karaf = to >> > install e.g., mvn:commons-beanutils/commons-beanutils/1.9.3 instead of >> > 1.9.2, but can't tell it to use 1.9.0 instead of 1.8.3. Which is of co= urse >> > reasonable. >> > >> >> Actually, this is only a default behavior. You can force this case using >> mvn:commons-beanutils/commons-beanutils/1.9.3;range=3D[1.0,1.9.3) >> which would replace any commons-beanutils in the range. >> But I think that's slightly irrelevant with the rest of your email. > > Yes - I meant default behavior and at best - slightly configurable > with "range" clause > >> > >> > So my idea is to generalize "overrides" mechanism - change it into kin= d of >> > features service hook and provide dedicated, explicit other mechanisms= . >> > >> > For example I could create a maven plugin, that could use some input >> > information about groupId:artifactId alternatives, some preconfigured >> > overrides, etc. This maven plugin could be used at karaf-maven-plugin = run >> > time to generate additional ("compiled") file acting as enhanced >> > etc/overrides.properties. >> > And this file could be read/used by features service "hook", which cou= ld >> > not only (as Overrides.shouldOverride() does) "translate" bundle URIs,= but >> > change entire features during installation: >> > =E2=80=93 add some new bundles (configs?) to a feature >> > =E2=80=93 use different groupId:artifactId of >> > =E2=80=93 skip some bundle >> > =E2=80=93 ... >> > >> > Currently Karaf features are NOT like Maven dependencies - Maven build= s >> > transitive graph of dependencies and may choose between deps with same >> > groupId:artifactId and different version. >> > >> > With my "hook" idea, static feature definition from *-features.xml fil= e >> > would only be a "declaration" of a feature, which MAY be changed at >> > runtime. >> > >> > I imagine that it's not that trivial and features service has huge run= time >> > part (resolver) that would be (would it?) affected, but I'd like to kn= ow >> > what do you think? >> > >> >> I'm not entirely sure what you have in mind, but what could be quite sim= ple >> to implement, without requiring any real resolver change, would be a >> service that pre-processes a set of features just before it's used by th= e >> resolver. > > Exactly - I meant kind of "phase" after reading feature descriptors > from XML and before passing them to resolver. > >> The features set is an input to the resolver, it's currently stored at t= he >> following location: >> >> https://github.com/apache/karaf/blob/master/features/core/src/main/java/= org/apache/karaf/features/internal/service/Deployer.java#L168 >> >> In a usual scenario, the values comes from the following: >> >> https://github.com/apache/karaf/blob/master/features/core/src/main/java/= org/apache/karaf/features/internal/service/FeaturesServiceImpl.java#L596-L5= 99 >> >> What can be easily achieved, is to pre-process this set through a servic= e >> with a simple interface such as >> interface FeaturesProcessor { >> Map process(Map features); >> } >> >> Note that we also have a different mechanism that has an effect on featu= res >> at runtime, it's the blacklisting policy. >> The difference is that this one is actually done when the repositories a= re >> loaded: >> >> https://github.com/apache/karaf/blob/master/features/core/src/main/java/= org/apache/karaf/features/internal/service/RepositoryImpl.java#L85 > > The blacklisting of features/repositories could be part of this > dynamic postprocessing. > >> >> The difference is also because, given the overrides mechanism uses the >> resource symbolic name + version to see if an override should take place= , >> it has to actually load the resources, and *then* eventually override it= . > > As above - "overrides" could stay as is (possibly changed to hooked > version instead of static dependency) as "postprocessor that requires > resource manifest access" > >> >> Anyway, big +1 to investigate something around that, as I think it is >> clearly missing. >> This may also indicates that the fact that application development and >> deployment are somewhat conflated in the same xml feature repository nee= d >> to be revisited somehow. > > I'm trying to find analogies with Maven. And we did it countless times > - when library developer publishes not-so-good POM, we can try > some wrong > dependencies or override versions. I meant to create something for > features - original author could declare the "rough" feature, but > given runtime (e.g., Karaf with clever hooks) could postprocess these > "feature declarations". > > I'll have a look at the idea and try to prepare some draft solution. > > regards Grzegorz Grzybek