On 10/8/10 11:01, Guillaume Nodet wrote:
On Fri, Oct 8, 2010 at 16:44, Richard S. Hall<[email protected]>  wrote:

  On 10/8/10 10: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?

I disagree almost completely.

Any move toward containerisms just creates bundles that do not run on all
OSGi frameworks -- they are no longer bundles, but something that is like a
bundle.

That's plain wrong.  It only means one particular thing is tied to Felix.
  The library i'm working on has two different paths wether it's deployed in
Felix or Equinox for example.

So this bundle is then tied to two different frameworks...not much better.

I agree it's not the best thing to do, but
the other way is simply to drop Felix because it can not be bend enough.
In that case, the problem is tied to the spring framework which is heavily
used, and i just can't rewrite the whole thing ;-)

I agree, you can't rewrite Spring. But that doesn't mean that we should be creating all sorts of containerisms to support any use case that anyone has. We all know how this goes, these containerisms are not considered implementation API by those who use them and they end up holding us responsible for this API as public API for the end of time. It's hard enough being able to refactor internally at will without breaking what we have to expose, let alone a lot more nuanced and fine-grained containerisms.

If that means that people have to drop the Felix framework, then so be it. It likely means they'll only work on Equinox and as long as they are content having a single supplier, I think we are fine with that too. The OSGi community has already known this distinction between the two framework implementations for a long time.

Of course, this is all a general argument. Each area in which someone might want to bend is always open for discussion on a case-by-case basis, but taken in total I believe we should avoid containerisms like the plague.

If the official OSGi API is not sufficient, then it should be pushed into a
direction that makes it sufficient. We shouldn't go about making our own
framework API, then people will really have to worry about whether Felix
bundles are tied to the Felix framework, which is something that is hard
enough to educate people about in the first place.

When you write a bundle, you can easily test it under the environment it
supposed to work.  I can't imagine someone using such a hack not being aware
it's tied to Felix ....   .  So he knows what platforms are supported.
It's the same as specifiying JDK 1.5 or JDK 1.6 when you write some java
code: you just specifiy the environment where it has been tested and it
works.  In my case, I plan to test it under Equinox and Felix and try to
ensure it works under both platforms, even if i need an if block to make
that work.  And if I want to write a bundle that only works with Felix, it's
my decision to take, not yours I think.

Purety is nice, and that's what the OSGi API is for.  Now if we want Felix
and OSGi to be as widely used as possible, we need to make things to work.
Rejecting containerisms on the principle that they are not pure will not
really help doing that I think.

Perhaps so, but I'm willing to pay that price. I'm sure you've seen all of the crap coming down the pike for R4.3...that will keep us plenty busy.

-> richard



->  richard


  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





Reply via email to