You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@felix.apache.org by "Arjun Panday (JIRA)" <ji...@apache.org> on 2008/08/20 15:24:44 UTC

[jira] Created: (FELIX-692) OBR should provide an API for resolving bundles dependencies regardless of locally installed bundles

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


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.


[jira] Commented: (FELIX-692) OBR should provide an API for resolving bundles dependencies regardless of locally installed bundles

Posted by "Arjun Panday (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/FELIX-692?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12837738#action_12837738 ] 

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

Well, I wouldn't pretend i was trying to resolve issue FELIX-2106, since it didn't exist at the time, and actually, i think it is different: 
Issue 2106 deals with the management of several (temporary) remote repositories, while this one focuses on the local resources, asking for the locally installed bundles and the local system bundle to be treated as 2 new independant repositories. 
The issues are somewhat related but they have very different focuses.

As for the API vs URL vs something else issue:
- i thought the "fake URL" was acceptable since it concerns only bundles already installed locally and therefore not to be downloaded
- on the other hand (and as the title suggests) i wouldn't mind an API: it would make things more clear, rather than a hidden convention inside the implementation.

For the time being, i've been using my patched version (quite successfully so far) and calling
obr.removeRepository(new URL("local://installed"));
in my code before the call to discoverResources(), but it's one of these "you have to know the trick" kind of patterns, rather than a clear feature.

As Richard suggests, maybe the RepositoryAdminImpl could be registered with both standard and extended interfaces, and we could then access the extended service API directly.

Guillaume, the patch contains quite a few changes as well as new classes.. i don't think a diff will be more readable; untar the file somewhere and then use a tool like meld to review the differences; it's a whole lot easier.

Thanks everyone for your attention on the issue :)

> 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
>            Assignee: Guillaume Nodet
>            Priority: Minor
>             Fix For: bundlerepository-1.6.0
>
>         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.


[jira] Commented: (FELIX-692) OBR should provide an API for resolving bundles dependencies regardless of locally installed bundles

Posted by "Arjun Panday (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/FELIX-692?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12837803#action_12837803 ] 

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

Richard, i just realized that i misunderstood you; you meant that the committed patch is trying to kill two birds with one stone, of course, not mine!
Sorry, just ignore my remark!

> 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
>            Assignee: Guillaume Nodet
>            Priority: Minor
>             Fix For: bundlerepository-1.6.0
>
>         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.


[jira] Commented: (FELIX-692) OBR should provide an API for resolving bundles dependencies regardless of locally installed bundles

Posted by "Guillaume Nodet (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/FELIX-692?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12838819#action_12838819 ] 

Guillaume Nodet commented on FELIX-692:
---------------------------------------

I've raised FELIX-2139 for that

> 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
>            Assignee: Guillaume Nodet
>            Priority: Minor
>             Fix For: bundlerepository-1.6.0
>
>         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.


[jira] Commented: (FELIX-692) OBR should provide an API for resolving bundles dependencies regardless of locally installed bundles

Posted by "Arjun Panday (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/FELIX-692?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12839785#action_12839785 ] 

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

I've tried the new API/Implementation the following way:

final Repository[] repolist = _repoAdmin.listRepositories();
Resolver resolver = _repoAdmin.resolver((Repository[]) (new ArrayList() {{
      add(_repoAdmin.getSystemRepository());
      addAll(Arrays.asList(repolist));
}}).toArray(new Repository[repolist.length + 1]));

It's more verbose than what I had with my URL pattern but at least it's a real API. (Maybe there's a nicer way to achieve the same result)

Indeed the new implementation is much faster (just about 10 times, as advertized). 

Strangely, on my scenario, it generates a slightly different list of requirements than the previous implementation; i'll need to investigate further this week.. 

Aside from that, it seems to work nicely (and fast!)

> 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
>            Assignee: Guillaume Nodet
>            Priority: Minor
>             Fix For: bundlerepository-1.6.0
>
>         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.


[jira] Commented: (FELIX-692) OBR should provide an API for resolving bundles dependencies regardless of locally installed bundles

Posted by "Alasdair Nottingham (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/FELIX-692?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12837774#action_12837774 ] 

Alasdair Nottingham commented on FELIX-692:
-------------------------------------------

Given that OBR is not an OSGi standard I do not understand what the issue is with changing the API.

If your concern is that the API wont make it into the OSGi standard that is true for any part of the current API as well.

> 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
>            Assignee: Guillaume Nodet
>            Priority: Minor
>             Fix For: bundlerepository-1.6.0
>
>         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.


[jira] Commented: (FELIX-692) OBR should provide an API for resolving bundles dependencies regardless of locally installed bundles

Posted by "Richard S. Hall (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/FELIX-692?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12837679#action_12837679 ] 

Richard S. Hall commented on FELIX-692:
---------------------------------------

In responding to Arjun's comments, I realized my comment about the patch missed the getSystemRepository() and getLocalRepository() methods added RepositoryAdmin. The issue here is the same, we can't expose these methods on this interface, since these are implementation concepts. As such, like Arjun indicated in his patch, we need some other way for clients to identifier the local and system repositories.

> 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
>            Assignee: Guillaume Nodet
>            Priority: Minor
>             Fix For: bundlerepository-1.6.0
>
>         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.


[jira] Commented: (FELIX-692) OBR should provide an API for resolving bundles dependencies regardless of locally installed bundles

Posted by "Guillaume Nodet (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/FELIX-692?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12837683#action_12837683 ] 

Guillaume Nodet commented on FELIX-692:
---------------------------------------

We can't use local:// at all.  The main reason is that the repository URL is ... well, a URL and not a URI.  So the protocol handler needs to be valid to be able to build the URL.  
Do we really want to write a url handler for that ? I'm not sure it make sense.

Arjun, if you could provide a diff file instead of the whole modified sources, we could more easily review your suggestion.

Richard, I disagree that there should be no modifications on the API whatsoever.  The goal is that the user is able to choose if he wants to resolve against the local resources or not.  If using a repository for that seems a bad idea (at the api level), we could add another flag when the repository is created.  But at the end, the user has to choose, and it's best reflected in the api rather than hidden.

> 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
>            Assignee: Guillaume Nodet
>            Priority: Minor
>             Fix For: bundlerepository-1.6.0
>
>         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.


[jira] Commented: (FELIX-692) OBR should provide an API for resolving bundles dependencies regardless of locally installed bundles

Posted by "Arjun Panday (JIRA)" <ji...@apache.org>.
    [ 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.


[jira] Updated: (FELIX-692) OBR should provide an API for resolving bundles dependencies regardless of locally installed bundles

Posted by "Arjun Panday (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/FELIX-692?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Arjun Panday updated FELIX-692:
-------------------------------

    Attachment: bundlerepository.tgz

> 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.


[jira] Resolved: (FELIX-692) OBR should provide an API for resolving bundles dependencies regardless of locally installed bundles

Posted by "Guillaume Nodet (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/FELIX-692?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Guillaume Nodet resolved FELIX-692.
-----------------------------------

    Resolution: Fixed

I think Richard's issue about the API has now been solved, so I'm closing this issue again.
Please reopen if there are further problems.

Arjun, for the URL/URI problem, when building a URL, you need to have an implementation of a URL handler, even if you don't open the stream.   We could use something like obr://local/ and reuse the existing URL handler, but I'm not actuallly sure it's worth it given the current api.

> 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
>            Assignee: Guillaume Nodet
>            Priority: Minor
>             Fix For: bundlerepository-1.6.0
>
>         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.


[jira] Commented: (FELIX-692) OBR should provide an API for resolving bundles dependencies regardless of locally installed bundles

Posted by "Arjun Panday (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/FELIX-692?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12837673#action_12837673 ] 

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

Hi,

I haven't had time to review in detail and test the committed patch yet, but i noticed it is quite different from the one i suggested. Amongst other differences i find the isLocal() method. My proposition was based on "local://" URLs used internally to differentiate local from remote. 

You may want to have a look at the contents of the attached tgz and see if it's more in line with your original proposal. 

Thanks,
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
>            Assignee: Guillaume Nodet
>            Priority: Minor
>             Fix For: bundlerepository-1.6.0
>
>         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.


[jira] Assigned: (FELIX-692) OBR should provide an API for resolving bundles dependencies regardless of locally installed bundles

Posted by "Guillaume Nodet (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/FELIX-692?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Guillaume Nodet reassigned FELIX-692:
-------------------------------------

    Assignee: Guillaume Nodet

> 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
>            Assignee: Guillaume Nodet
>            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.


[jira] Closed: (FELIX-692) OBR should provide an API for resolving bundles dependencies regardless of locally installed bundles

Posted by "Carsten Ziegeler (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/FELIX-692?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Carsten Ziegeler closed FELIX-692.
----------------------------------


> 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
>            Assignee: Guillaume Nodet
>            Priority: Minor
>             Fix For: bundlerepository-1.6.0
>
>         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.


[jira] Commented: (FELIX-692) OBR should provide an API for resolving bundles dependencies regardless of locally installed bundles

Posted by "Guillaume Nodet (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/FELIX-692?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12837685#action_12837685 ] 

Guillaume Nodet commented on FELIX-692:
---------------------------------------

I've removed the outer loop, thx for that.

> 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
>            Assignee: Guillaume Nodet
>            Priority: Minor
>             Fix For: bundlerepository-1.6.0
>
>         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.


[jira] Commented: (FELIX-692) OBR should provide an API for resolving bundles dependencies regardless of locally installed bundles

Posted by "Richard S. Hall (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/FELIX-692?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12837826#action_12837826 ] 

Richard S. Hall commented on FELIX-692:
---------------------------------------

Arjun, yep, that's what I meant. :-)

Alasdair, it doesn't matter if it is a standard or not, it is an RFC which we are claiming to implement. If we want to do our own thing, then we should just come up with our own API and not use the org.osgi package namespace. We should probably rollback any changes we've made to the OSGi API and put them in extended interfaces in packages we export.

> 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
>            Assignee: Guillaume Nodet
>            Priority: Minor
>             Fix For: bundlerepository-1.6.0
>
>         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.


[jira] Commented: (FELIX-692) OBR should provide an API for resolving bundles dependencies regardless of locally installed bundles

Posted by "Richard S. Hall (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/FELIX-692?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12837646#action_12837646 ] 

Richard S. Hall commented on FELIX-692:
---------------------------------------

More conceptually, the "Repository.isLocal()" is an implementation detail of our OBR and shouldn't be elevated to an interface change. The RFC doesn't differentiate between local and/or remote repositories and even newer work just leaves this open to the implementation. So, we should use some other internal way to do this, e.g., create an abstract base class with this method or check the repository name.

There was another issue, but after re-reading the patch, I see that I misinterpreted it. So, the only other issue is minor, which is the outer repository loop in ResolverImpl.searchResources() seems to serve no purpose now that the resources are passed in, no?

> 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
>            Assignee: Guillaume Nodet
>            Priority: Minor
>             Fix For: bundlerepository-1.6.0
>
>         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.


[jira] Resolved: (FELIX-692) OBR should provide an API for resolving bundles dependencies regardless of locally installed bundles

Posted by "Guillaume Nodet (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/FELIX-692?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Guillaume Nodet resolved FELIX-692.
-----------------------------------

       Resolution: Fixed
    Fix Version/s: bundlerepository-1.6.0

Committing to https://svn.apache.org/repos/asf/felix/trunk ...
	D	bundlerepository/src/test/java/org/apache/felix/bundlerepository/MockBundleContext.java
	M	bundlerepository/pom.xml
	M	bundlerepository/src/main/java/org/apache/felix/bundlerepository/LocalRepositoryImpl.java
	A	bundlerepository/src/main/java/org/apache/felix/bundlerepository/LocalResourceImpl.java
	M	bundlerepository/src/main/java/org/apache/felix/bundlerepository/Logger.java
	M	bundlerepository/src/main/java/org/apache/felix/bundlerepository/RepositoryAdminImpl.java
	M	bundlerepository/src/main/java/org/apache/felix/bundlerepository/RepositoryImpl.java
	M	bundlerepository/src/main/java/org/apache/felix/bundlerepository/ResolverImpl.java
	A	bundlerepository/src/main/java/org/apache/felix/bundlerepository/SystemRepositoryImpl.java
	M	bundlerepository/src/test/java/org/apache/felix/bundlerepository/RepositoryAdminTest.java
	M	bundlerepository/src/test/java/org/apache/felix/bundlerepository/RepositoryImplTest.java
	M	bundlerepository/src/test/java/org/apache/felix/bundlerepository/ResolverImplTest.java
	M	bundlerepository/src/test/java/org/apache/felix/bundlerepository/StaxParserTest.java
	M	org.osgi.service.obr/src/main/java/org/osgi/service/obr/Repository.java
	M	org.osgi.service.obr/src/main/java/org/osgi/service/obr/RepositoryAdmin.java
	M	org.osgi.service.obr/src/main/java/org/osgi/service/obr/Resource.java
Committed r915288


> 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
>            Assignee: Guillaume Nodet
>            Priority: Minor
>             Fix For: bundlerepository-1.6.0
>
>         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.


[jira] Commented: (FELIX-692) OBR should provide an API for resolving bundles dependencies regardless of locally installed bundles

Posted by "Richard S. Hall (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/FELIX-692?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12837691#action_12837691 ] 

Richard S. Hall commented on FELIX-692:
---------------------------------------

I don't mind if you prefer to make it API, but then it should be an extended interface provided by our OBR, not modifying the OSGi API. Thus our implementation would export this package and bundles wishing to use it would need to import it.

My suggestion of using the repo name to identify the local repos was just to avoid adding API, but technically it still ties them to our implementation, so it is really not much worse than exporting a package from our impl for people to use if they choose.

> 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
>            Assignee: Guillaume Nodet
>            Priority: Minor
>             Fix For: bundlerepository-1.6.0
>
>         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.


[jira] Reopened: (FELIX-692) OBR should provide an API for resolving bundles dependencies regardless of locally installed bundles

Posted by "Richard S. Hall (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/FELIX-692?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Richard S. Hall reopened FELIX-692:
-----------------------------------


I am a little confused about the patch, so i'll reopen this issue for now.

> 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
>            Assignee: Guillaume Nodet
>            Priority: Minor
>             Fix For: bundlerepository-1.6.0
>
>         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.


[jira] Commented: (FELIX-692) OBR should provide an API for resolving bundles dependencies regardless of locally installed bundles

Posted by "Richard S. Hall (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/FELIX-692?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12837676#action_12837676 ] 

Richard S. Hall commented on FELIX-692:
---------------------------------------

The changes result from the fact that this patch is essentially trying to kill two birds with one stone. Not only does it address this issue, but it also addresses FELIX-2106, which allows you to create a resolver instance with a specified set of repositories.

> 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
>            Assignee: Guillaume Nodet
>            Priority: Minor
>             Fix For: bundlerepository-1.6.0
>
>         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.