felix-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Arjun Panday (JIRA)" <j...@apache.org>
Subject [jira] Commented: (FELIX-692) OBR should provide an API for resolving bundles dependencies regardless of locally installed bundles
Date Wed, 21 Oct 2009 16:08:59 GMT

    [ https://issues.apache.org/jira/browse/FELIX-692?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12768302#action_12768302
] 

Arjun Panday commented on FELIX-692:
------------------------------------

Richard,

Here's my implementation of the design you suggested for this issue:
The LocaRepositoryImpl is split into a LocalSystemRepositoryImpl and a LocalInstalledRepositoryImpl

They are stored in RepositoryAdmin using "fake URL" keys, respectively "local://system" and
"local://installed". 
This way, a user may call 
repositoryAdmin.remove(new URL("local://installed"));
before resolution in order to have the resolver ignore all installed bundles and provide a
complete list of dependencies that can be deployed into a new empty framework. 

(I'm not extremely fond of my URLs.. feel free to suggest a better idea!)

I hope it helps and can serve as a proof of concept at least. 
This implementation works fine with our scenario. 

Best regards,
Arjun

> OBR should provide an API for resolving bundles dependencies regardless of locally installed
bundles
> ----------------------------------------------------------------------------------------------------
>
>                 Key: FELIX-692
>                 URL: https://issues.apache.org/jira/browse/FELIX-692
>             Project: Felix
>          Issue Type: Improvement
>          Components: Bundle Repository (OBR)
>            Reporter: Arjun Panday
>            Priority: Minor
>         Attachments: bundlerepository.tgz
>
>
> Currently the dependencies that are installed locally are stripped from the OBR Resolver
response, because it is assumed that the new bundles are to be installed locally. But i cannot
use the OBR to launch a separate JVM or store the result for later reference... 
> It would be interesting to have a pure Resolver API, distinct from the OBR's "installation
process".
> And/Or, as Richard Hall suggested, the OBR could provide better control over the repositories
used during the resolve process (specifically the local repository).
> (see thread "OBR and the referral tag" in users@felix.apache.org)
> Merely as a hint and for what it's worth, here's how i slightly modified the Resolver
in bundlerepository 1.0.3 to serve my purpose (avoid ignoring locally installed bundles):
> @@ -308,6 +309,7 @@ public class ResolverImpl implements Resolver
>       */
>      private List searchLocalResources(Requirement req)
>      {
> +       String systemPackages = (String) m_context.getBundle(0).getHeaders().get("Export-Package");//
only match system bundle
>          List matchingCandidates = new ArrayList();
>          Resource[] resources = m_local.getResources();
>          for (int resIdx = 0; (resources != null) && (resIdx < resources.length);
resIdx++)
> @@ -315,7 +317,8 @@ public class ResolverImpl implements Resolver
>              Capability[] caps = resources[resIdx].getCapabilities();
>              for (int capIdx = 0; (caps != null) && (capIdx < caps.length);
capIdx++)
>              {
> -                if (req.isSatisfied(caps[capIdx]))
> +                if (req.isSatisfied(caps[capIdx])
> +                   && systemPackages.indexOf(caps[capIdx].getName()) != -1)
// only match system bundle
>                  {
>                      matchingCandidates.add(resources[resIdx]);
>                  }
> @@ -91,7 +91,7 @@ public class LocalRepositoryImpl implements Repository
>          synchronized (this)
>          {
>              m_snapshotTimeStamp = m_currentTimeStamp = new Date().getTime();
> -            bundles = m_context.getBundles();
> +            bundles = new Bundle[]{ m_context.getBundle(0) }; // only match system bundle...
m_context.getBundles();
>          }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message