On 10/11/10 10:40, Guillaume Nodet wrote:
On Mon, Oct 11, 2010 at 16:29, Richard S. Hall<[email protected]>  wrote:

  On 10/11/10 10:15, Guillaume Nodet wrote:

It helps me a bit because it gives me the basics for what I need.   What I
really need is a way to have the useJarUlr() method returns always true
(with a specific value for the org.apache.felix.jarurl dir), which I bet
you
won't let me to put that in.

So , now, we implement some part of 4.3 draft and I can easily override
the
method and return what I need. Where's the problem here?

No problem. You just said it didn't help you, so I wondered if we could
remove it.

BTW, why does m_jarUrl need to be a thread local?

Mostly because there's no easy way to pass along the fact that the
getResource / getResources call comes from the OSGi API or from the module
classloader.  My understanding of the draft is that only calls from the osgi
classloader should be able to use jar urls, not those from the Bundle
object.
However, things are a bit intricated, especially if the call actually
delagate to an imported package across another module.   I found that an
easy way instead of having to change the whole api for just a hack ;-)

Ok, I see what you're doing. I'll have to think about that. I was wondering about that issue when I read the spec description too.

-> richard



->  richard

  On Mon, Oct 11, 2010 at 15:38, Richard S. Hall<[email protected]>
  wrote:

   On 10/11/10 3:51, Guillaume Nodet wrote:
  I've committed the addition of the org.apache.felix.jarurls property,
though
after some testing, it does not really solve my problem anyway ...
I've removed one "TODO: remove that when class path scanning is
implemented"
as the new method I added on the Module is necessary in order to
implement
this behavior.

  Well, if it doesn't really help you, should we keep it at all? We're
not
required to implement it and it is a hack.

->   richard


  On Fri, Oct 8, 2010 at 21:22, Richard S. Hall<[email protected]>

  wrote:


  On 10/8/10 15:16, Guillaume Nodet wrote:
  On Fri, Oct 8, 2010 at 21:11, Guillaume Nodet<[email protected]>

wrote:


  On Fri, Oct 8, 2010 at 20:41, Richard S. Hall<[email protected]

wrote:
    On 10/8/10 14:08, Guillaume Nodet wrote:
   On Fri, Oct 8, 2010 at 18:43, Felix Meschberger<[email protected]
   wrote:
  Hi,

  First of all: I agree with Richard in that we should at all cost

prevent
containerisms.

Second: I do not really understand what the problem is, that must
be
solved with this containerism and which cannot be solved with
regular
OSGi API.

  The real problem is to be able to discover resources in the
bundle

  class

space. For example, i want to know all resources in
foo/bar/**/*.xml
The
OSGi API does not provide any way to do that atm and a lot of
libraries
use
  some custom things based on jars / file urls to actually iterate
and
discover those resources.

  BTW, are you familiar with org.osgi.framework.jarurls from
R4.3...this

  sounds like it is intended to do exactly what you want, no?
->     richard


  No, I missed that point in the draft, thx for the pointer.  So what
if

  I
want to bring that into Felix Framework?
I guess I'd have to use an "org.apache.felix.jarurls" property for
now
?
Would that work for everyone ?


  Note that I don't really see how that would be different from what I

  tried.
  It's still a containerism until it's standardized (if it is ever) ...

  Yeah, except we have it on pretty good authority that this is going

into
the spec. For example, we never started prototyping composite bundles
based
on the old proposed API, since it wasn't clear where it was going, but
once
things become more certain then that's a different story.

And this property will still go away once the spec is final and may go
away
if it doesn't come to pass. This is the whole "provisional API"
discussion
again.

And for the record, I was against this property during the spec
discussions
too.

->    richard



    The problem is just about a way to actually do things.  It seems in

the

  enterprise world (JEE, middleware),  we're more keen on bending the
purity a
bit to the benfit of being able to achieve our goals and we're also
more
keen on doing that for third party libraries.

It's true that if you write the whole osgi application from
scratch,
you
don't really care about supporting third party libraries.
  Unfortunately,
people just won't rewrite a third party product they already use
just
because they want to play nicely in OSGi.  That's my use case, and
it
seems
it doesn't fit well with Felix goals, so I guess i'll have to
support
a
custom felix version in order to do that or only support equinox.

I think I'll revert my commit as if the plan is to ditch it in the
next
felix version, there's really no point in even using such a hack
from
my
pov.


  Third: For us outsiders of the specification process it is very
hard
to

  understand what insiders are talking of with respect to upcoming

specifications (I only learned 5 minutes ago, that there is a
public
draft for 4.3). This issue must probably be solved by OSGi...

Regards
Felix

On 08.10.2010 16:37, Guillaume Nodet wrote:

  I was planning to start a discussion around that, so let's do
that

  now.
I'm not convinced we should remove this hack when classpath
scanning
is
implemented, mostly because even if then ultimately try to solve
the
same
problem, they will certainly do it in a different way.  What I
mean
is

  that

   AFAIK, the classpath scanning stuff will result in a new api on
the

   bundle
   or bundleContext to iterate through resources, which means that
in

  order
  to

   support existing libraries, you kinda have to rewrite the whole
thing

  in
order to accomodate those apis (especially if they are written so
that

  they

   work outside of osgi).
  I think the hack i've written allows a smoother integration of
those
libraries, with the drawback that you know it can break in
certain
conditions.

Also, your comment says "Do not make containerisms public."
In that case, it's not really public because the public face of
the
Felix
Framework is the OSGi api.
I guess the question comes down to wether we want Felix to remain
pure
(without containerisms) or make it easier for people to use it
(by

  bending

   the edges when it makes sense to allow people to deploy their
  existing
libraries without rewriting the whole thing).
Imho, Felix is not a research prototype, nor supposed to be the
cleaneest
reference implementation of OSGi, so adapting to the users makes
sense

  imho,

   provided that it's done conciensouly by the user by activating
a
flag

  or
accessing a non public api (we fall in that case here imho).

Thoughts?

On Fri, Oct 8, 2010 at 16:22,<[email protected]>      wrote:

  Author: rickhall

  Date: Fri Oct  8 14:22:39 2010

New Revision: 1005843

URL: http://svn.apache.org/viewvc?rev=1005843&view=rev
Log:
Do not make containerisms public. (FELIX-2645)

Modified:





  
felix/trunk/framework/src/main/java/org/apache/felix/framework/ExtensionManager.java



  felix/trunk/framework/src/main/java/org/apache/felix/framework/ModuleImpl.java



  
felix/trunk/framework/src/main/java/org/apache/felix/framework/URLHandlersBundleURLConnection.java



  
felix/trunk/framework/src/main/java/org/apache/felix/framework/cache/ContentDirectoryContent.java



  
felix/trunk/framework/src/main/java/org/apache/felix/framework/cache/DirectoryContent.java



  
felix/trunk/framework/src/main/java/org/apache/felix/framework/cache/JarContent.java



  
felix/trunk/framework/src/main/java/org/apache/felix/framework/resolver/Content.java



  
felix/trunk/framework/src/main/java/org/apache/felix/framework/resolver/Module.java

  Modified:

felix/trunk/framework/src/main/java/org/apache/felix/framework/ExtensionManager.java

  URL:


http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/apache/felix/framework/ExtensionManager.java?rev=1005843&r1=1005842&r2=1005843&view=diff



==============================================================================

  ---

felix/trunk/framework/src/main/java/org/apache/felix/framework/ExtensionManager.java

  (original)

  +++



felix/trunk/framework/src/main/java/org/apache/felix/framework/ExtensionManager.java

  Fri Oct  8 14:22:39 2010

  @@ -610,6 +610,7 @@ class ExtensionManager extends URLStream

         return null;
     }

+    // TODO: REMOVE - Remove when class path scanning is
implemented.
     public URL getEntryAsURL(String name)
     {
         return null;
@@ -763,6 +764,7 @@ class ExtensionManager extends URLStream
             return
getClass().getClassLoader().getResourceAsStream(urlPath);
         }

+        // TODO: REMOVE - Remove when class path scanning is

  implemented.

          public URL getLocalURL(int index, String urlPath)
          {

             return
getClass().getClassLoader().getResource(urlPath);

Modified:




felix/trunk/framework/src/main/java/org/apache/felix/framework/ModuleImpl.java

  URL:


http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/apache/felix/framework/ModuleImpl.java?rev=1005843&r1=1005842&r2=1005843&view=diff



==============================================================================

  ---

felix/trunk/framework/src/main/java/org/apache/felix/framework/ModuleImpl.java

  (original)

  +++



felix/trunk/framework/src/main/java/org/apache/felix/framework/ModuleImpl.java

  Fri Oct  8 14:22:39 2010

  @@ -1091,6 +1091,7 @@ public class ModuleImpl implements Modul

         return getContentPath()[index -
1].getEntryAsStream(urlPath);
     }

+    // TODO: REMOVE - Remove when class path scanning is
implemented.
     public URL getLocalURL(int index, String urlPath)
     {
         if (urlPath.startsWith("/"))

Modified:




felix/trunk/framework/src/main/java/org/apache/felix/framework/URLHandlersBundleURLConnection.java

  URL:


http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/apache/felix/framework/URLHandlersBundleURLConnection.java?rev=1005843&r1=1005842&r2=1005843&view=diff



==============================================================================

  ---

felix/trunk/framework/src/main/java/org/apache/felix/framework/URLHandlersBundleURLConnection.java

  (original)

  +++



felix/trunk/framework/src/main/java/org/apache/felix/framework/URLHandlersBundleURLConnection.java

  Fri Oct  8 14:22:39 2010

  @@ -28,7 +28,7 @@ import org.apache.felix.framework.resolv

  import org.apache.felix.framework.util.Util;

-public class URLHandlersBundleURLConnection extends
URLConnection
+class URLHandlersBundleURLConnection extends URLConnection
  {
     private Felix m_framework;
     private Module m_targetModule;
@@ -201,7 +201,8 @@ public class URLHandlersBundleURLConnect
      *
      * @return the local URL
      */
-    public URL getLocalURL()
+    // TODO: REMOVE - Remove when class path scanning is
implemented.
+    URL getLocalURL()
     {
         if ((m_targetModule == null) || (m_classPathIdx<      0))
         {

Modified:




felix/trunk/framework/src/main/java/org/apache/felix/framework/cache/ContentDirectoryContent.java

  URL:


http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/apache/felix/framework/cache/ContentDirectoryContent.java?rev=1005843&r1=1005842&r2=1005843&view=diff



==============================================================================

  ---

felix/trunk/framework/src/main/java/org/apache/felix/framework/cache/ContentDirectoryContent.java

  (original)

  +++



felix/trunk/framework/src/main/java/org/apache/felix/framework/cache/ContentDirectoryContent.java

  Fri Oct  8 14:22:39 2010

  @@ -82,6 +82,7 @@ public class ContentDirectoryContent imp

         return m_content.getEntryAsStream(m_rootPath + name);
     }

+    // TODO: REMOVE - Remove when class path scanning is
implemented.
     public URL getEntryAsURL(String name)
     {
         return m_content.getEntryAsURL(m_rootPath + name);

Modified:




felix/trunk/framework/src/main/java/org/apache/felix/framework/cache/DirectoryContent.java

  URL:


http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/apache/felix/framework/cache/DirectoryContent.java?rev=1005843&r1=1005842&r2=1005843&view=diff



==============================================================================

  ---

felix/trunk/framework/src/main/java/org/apache/felix/framework/cache/DirectoryContent.java

  (original)

  +++



felix/trunk/framework/src/main/java/org/apache/felix/framework/cache/DirectoryContent.java

  Fri Oct  8 14:22:39 2010

  @@ -133,6 +133,7 @@ public class DirectoryContent implements

         return new FileInputStream(new File(m_dir, name));
     }

+    // TODO: REMOVE - Remove when class path scanning is
implemented.
     public URL getEntryAsURL(String name)
     {
         if ((name.length()>      0)&&      (name.charAt(0) ==
'/'))

Modified:




felix/trunk/framework/src/main/java/org/apache/felix/framework/cache/JarContent.java

  URL:


http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/apache/felix/framework/cache/JarContent.java?rev=1005843&r1=1005842&r2=1005843&view=diff



==============================================================================

  ---

felix/trunk/framework/src/main/java/org/apache/felix/framework/cache/JarContent.java

  (original)

  +++



felix/trunk/framework/src/main/java/org/apache/felix/framework/cache/JarContent.java

  Fri Oct  8 14:22:39 2010

  @@ -192,6 +192,7 @@ public class JarContent implements Conte

         return is;
     }

+    // TODO: REMOVE - Remove when class path scanning is
implemented.
     public URL getEntryAsURL(String name)
     {
         try

Modified:




felix/trunk/framework/src/main/java/org/apache/felix/framework/resolver/Content.java

  URL:


http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/apache/felix/framework/resolver/Content.java?rev=1005843&r1=1005842&r2=1005843&view=diff



==============================================================================

  ---

felix/trunk/framework/src/main/java/org/apache/felix/framework/resolver/Content.java

  (original)

  +++



felix/trunk/framework/src/main/java/org/apache/felix/framework/resolver/Content.java

  Fri Oct  8 14:22:39 2010

  @@ -120,5 +120,6 @@ public interface Content

      * @return A URL using a standard protocol such as file, jar
      *           or null if not possible.
      */
+    // TODO: REMOVE - Remove when class path scanning is
implemented.
     URL getEntryAsURL(String name);
  }
\ No newline at end of file

Modified:




felix/trunk/framework/src/main/java/org/apache/felix/framework/resolver/Module.java

  URL:


http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/apache/felix/framework/resolver/Module.java?rev=1005843&r1=1005842&r2=1005843&view=diff



==============================================================================

  ---

felix/trunk/framework/src/main/java/org/apache/felix/framework/resolver/Module.java

  (original)

  +++



felix/trunk/framework/src/main/java/org/apache/felix/framework/resolver/Module.java

  Fri Oct  8 14:22:39 2010

  @@ -72,5 +72,6 @@ public interface Module

         throws IOException;
     InputStream getInputStream(int index, String urlPath)
         throws IOException;
+    // TODO: REMOVE - Remove when class path scanning is
implemented.
     URL getLocalURL(int index, String urlPath);
  }
\ No newline at end of file





  --

Cheers,
Guillaume Nodet
------------------------
Blog: http://gnodet.blogspot.com/
------------------------
Open Source SOA
http://fusesource.com







Reply via email to