Return-Path: Delivered-To: apmail-felix-dev-archive@www.apache.org Received: (qmail 18594 invoked from network); 17 Nov 2008 19:18:13 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 17 Nov 2008 19:18:13 -0000 Received: (qmail 9577 invoked by uid 500); 17 Nov 2008 19:18:21 -0000 Delivered-To: apmail-felix-dev-archive@felix.apache.org Received: (qmail 9286 invoked by uid 500); 17 Nov 2008 19:18:21 -0000 Mailing-List: contact dev-help@felix.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@felix.apache.org Delivered-To: mailing list dev@felix.apache.org Received: (qmail 9275 invoked by uid 99); 17 Nov 2008 19:18:20 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 17 Nov 2008 11:18:20 -0800 X-ASF-Spam-Status: No, hits=2.2 required=10.0 tests=HTML_MESSAGE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of wgedeon@gmail.com designates 64.233.182.185 as permitted sender) Received: from [64.233.182.185] (HELO nf-out-0910.google.com) (64.233.182.185) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 17 Nov 2008 19:16:58 +0000 Received: by nf-out-0910.google.com with SMTP id d3so1354959nfc.20 for ; Mon, 17 Nov 2008 11:17:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:in-reply-to:mime-version:content-type:references; bh=OLacvOpHOXrPpQJPzmAbgNbTmfW+UcctJCJryrx2fj8=; b=RLmGT3nIJfQ4XxGV5MaTpKFiQhJrthuQfncSuUhuZg/nPd4CrPJqdNO0+2InZYDD20 NGz3LdkmA8LRDNltegSFqhgS5lFJ6jqNvVDsgiPGBTiukGEkB9LReGjyYgaf37m902Mm h1BbdQ0uGnJGHj4rQRtPPMg/INXTAg6xz9+Zs= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:in-reply-to:mime-version :content-type:references; b=f0Dpk4paaDdPB2iyd4FYI5M7yWHZWsxNMzDnckw76Gst3wSYwJL6nz4o4rMyry3STR cv2z0dgvY+rU5tqCESXH5gBGNiT6JajS0NVIcnqPKrrlYax7QHIg//j3QhHaTkFiDk5L tm2mV4FEDZvC298PltYbAUnmwbd1mOPbR5AU4= Received: by 10.210.117.1 with SMTP id p1mr1701294ebc.7.1226949450829; Mon, 17 Nov 2008 11:17:30 -0800 (PST) Received: by 10.210.70.12 with HTTP; Mon, 17 Nov 2008 11:17:30 -0800 (PST) Message-ID: <120de6e60811171117v58ca9220ia7070785bab3166b@mail.gmail.com> Date: Mon, 17 Nov 2008 20:17:30 +0100 From: "Walid \"jo\" Gedeon" To: dev@felix.apache.org Subject: Re: Fragment-Host resolution fails (bug?) In-Reply-To: <4921B79B.3010003@ungoverned.org> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_38462_25357091.1226949450809" References: <120de6e60811170703o7a63b9b2kf3271d1436da4718@mail.gmail.com> <4921B79B.3010003@ungoverned.org> X-Virus-Checked: Checked by ClamAV on apache.org ------=_Part_38462_25357091.1226949450809 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Content-Disposition: inline Hello Richard, > I think the logic is correct. You cannot dynamically attach a fragment to an already > resolved host. Thus, the potential hosts for the fragment are only those that are not > yet resolved. Hmm... ok, I wasnt aware of that. > Are you resolving the host first before installing the fragment? Yes I am. So the steps would be: - install log4j -> Installed - install config fragment -> Installed - start config fragment -> Active (log4j now resolved) - start log4j -> Active. But what would happen if the host bundle has many fragments? Thanks, w On Mon, Nov 17, 2008 at 7:27 PM, Richard S. Hall wrote: > I think the logic is correct. You cannot dynamically attach a fragment to > an already resolved host. Thus, the potential hosts for the fragment are > only those that are not yet resolved. > > Are you resolving the host first before installing the fragment? > > -> richard > > Walid "jo" Gedeon wrote: > >> Hello all, >> >> I was struggling to get a fragment installed for log4j configuration, >> setup as a fragment with host=org.apache.log4j. >> However, I would keep getting the error: >> >> org.osgi.framework.BundleException: Unresolved constraint in bundle 21: >> host; (bundle-symbolic-name=org.apache.log4j) >> >> (bundle 21 is my log4jconfig-fragment), and the log4j bundle (7) seems >> correctly installed: >> >> -> headers 7 >> >> Apache Jakarta log4j Plug-in (7) >> -------------------------------- >> Bundle-ClassPath = . >> Bundle-RequiredExecutionEnvironment = J2SE-1.4 >> Export-Package = >> org.apache.log4j,org.apache.log4j.chainsaw,org.apache.log4j.config,org.apache.log4j.helpers,org.apache.log4j.jdbc,org.apache.log4j.jmx,org.apac >> >> he.log4j.lf5,org.apache.log4j.lf5.config,org.apache.log4j.lf5.util,org.apache.log4j.lf5.viewer,org.apache.log4j.lf5.viewer.categoryexplorer,org.apache.log4j.lf5 >> .viewer.configure,org.apache.log4j.lf5.viewer.images,org.apache.log4j.net< >> http://org.apache.log4j.net >> >,org.apache.log4j.nt,org.apache.log4j.or,org.apache.log4j.or.jms, >> org.apache.log4j.or.sa >> >> x,org.apache.log4j.spi,org.apache.log4j.varia,org.apache.log4j.xml >> Bundle-Version = 1.2.13.v200806030600 >> Manifest-Version = 1.0 >> Bundle-Vendor = Eclipse.org >> Bundle-ManifestVersion = 2 >> Eclipse-BuddyPolicy = registered >> Bundle-Name = Apache Jakarta log4j Plug-in >> Bundle-Localization = plugin >> Bundle-SymbolicName = org.apache.log4j >> >> In all case, stepping through the code (in >> org.apache.felix.framework.searchpolicy.R4SearchPolicyCore), it looks like >> the boolean checks have been reversed? >> >> private List getPotentialHosts(IModule fragment) >> { // ... >> IModule[] modules = m_factory.getModules(); >> for (int modIdx = 0; (hostReq != null) && (modIdx < >> modules.length); modIdx++) >> { >> if (!fragment.equals(modules[modIdx]) && >> !isResolved(modules[modIdx])) { ... >> I'm thinking this should be if >> (!fragment.equals(modules[modIdx]) && isResolved(modules[modIdx])) { >> the host bundle is resolved and it's not the same as the fragment bundle, >> and can be selected as a potential host: >> ICapability[] caps = >> modules[modIdx].getDefinition().getCapabilities(); >> for (int capIdx = 0; (caps != null) && (capIdx < >> caps.length); capIdx++) >> { >> if >> (caps[capIdx].getNamespace().equals(ICapability.HOST_NAMESPACE) >> && hostReq.isSatisfied(caps[capIdx]) >> && !modules[modIdx].isStale()) >> { >> hostList.add(modules[modIdx]); >> break; >> } >> } >> >> I've attached a patch for that change... Do you guys agree? or did I >> misunderstand some part of the logic? >> I can raise a defect and attach the patch if no one disagrees. >> >> Cheers, >> w >> > ------=_Part_38462_25357091.1226949450809--