servicemix-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jean-Baptiste Onofré ...@nanthrax.net>
Subject Re: OSGIfy server jar of GWT
Date Sat, 07 Dec 2013 12:55:42 GMT
FYI:

https://issues.apache.org/jira/browse/SMX4-1634

Regards
JB

On 12/07/2013 01:45 PM, Jean-Baptiste Onofré wrote:
> Hi Christiano,
>
> I already did the gwt bundles in the past.
>
> I gonna create new gwt bundles (for 2.6.0) and include it in the next
> 2013.12 release.
>
> Regards
> JB
>
> On 12/07/2013 01:35 PM, Cristiano Costantini wrote:
>> Hi All,
>>
>> as there is no so many interest on supporting OSGi in the GWT community
>> (the related issue has only 5 votes:
>> https://code.google.com/p/google-web-toolkit/issues/detail?id=8424 and I
>> know all of those who have starred it :-D ),
>> I wonder if it is more appropriate to make OSGi release
>> under org.apache.servicemix.bundles.
>>
>> It has been done in the past (for
>> "org.apache.servicemix.bundles/org.apache.servicemix.bundles.gwt-user/2.4.0_1"
>>
>> and
>> "org.apache.servicemix.bundles/org.apache.servicemix.bundles.gwt-dev/2.4.0_1").
>>
>>
>> Now it is going to be released GWT version 2.6.0 and I believe it
>> should be
>> released only gwt-servlet artifact with OSGi headers (so
>> "org.apache.servicemix.bundles/org.apache.servicemix.bundles.gwt-servlet/2.6.0_1").
>>
>>
>>
>> Could someone point me to the right process (where is the source code of
>> org.apache.servicemix.bundles.*, where to open related issues, where to
>> discuss them, who to involve in the approval process) so I can try to
>> push
>> and support for this proposal?
>>
>>
>> Thank you!!!
>> Cristiano
>>
>>
>>
>>
>>
>>
>> 2013/11/19 Cristiano Costantini <cristiano.costantini@gmail.com>
>>
>>> Hi all!
>>> Just an update about my ongoing effort to OSGIfy GWT.
>>>
>>> I did proposed a patch to GWT community and to validate it I've
>>> adapted 5
>>> significant examples from the GWT distribution to run on Apache Karaf,
>>> (more precisely I used ServiceMix 4.5.3 but I'm not using neither Camel,
>>> CXF or ActiveMQ).
>>>
>>> You can find the examples here:
>>> https://github.com/cristcost/gwt-karaf-examples
>>>
>>> They require GWT compiled using this patch of mine
>>> https://gwt-review.googlesource.com/#/c/5351/
>>> If someone want to try them out, I will be glad to help and give more
>>> detailed instructions.
>>>
>>> Actually there is no so much interest from GWT community, so I would
>>> like
>>> you all supporting me by starring the related issue:
>>> https://code.google.com/p/google-web-toolkit/issues/detail?id=8424
>>> and if you are interested, apply to
>>> https://gwt-review.googlesource.com/and perform a (non binding)
>>> review of
>>> https://gwt-review.googlesource.com/#/c/5351/ so that the patch can be
>>> noticed more.
>>>
>>>
>>> The patch is not yet ideal, as the .bnd file contains some
>>> "workaround" to
>>> address complex dependencies in the GWT jar, but I hope these can be
>>> addressed by a refactoring in GWT package structure in next release.
>>> Also,
>>> there is a rare issue when two applications are deployed together and
>>> use
>>> "com.google.web.bindery.requestfactory.server.RequestFactoryServlet".
>>> Anyhow I would like it to be approved for the upcoming final release of
>>> GWT 2.6.0 which is expected beginning of december, so that community can
>>> start developing first prototype applications using this architecture.
>>>
>>> To go back to the examples, they actually don't make full use of OSGi
>>> capabilities (no OSGi service is used for this) but me and some
>>> friends are
>>> working on a *full* demo application that make use of the full
>>> ServiceMix
>>> stack and have a GWT front-end deployed on ServiceMix. For this demo,
>>> stay
>>> tuned on this other github project
>>> https://github.com/cristcost/sensormix
>>> We would like to have it working on next version of GWT (2.6.0) and also
>>> next version of ServiceMix (4.6.0). We would like to finish it before
>>> mid
>>> december, and we will present it at next "GDG Firenze Happy Hour"
>>> meeting
>>> that should be next 11th of December (you are welcome to join if you
>>> make a
>>> stop in Italy).
>>>
>>> I hope this topic interests you and if you like it I will be glad to
>>> have
>>> feedback about this so to encourage me and my friends ;-)
>>> Finally, we are open to any suggestion.
>>>
>>> Thank you
>>>
>>> Cristiano
>>>
>>>
>>>
>>>
>>> 2013/11/8 Cristiano Costantini <cristiano.costantini@gmail.com>
>>>
>>>> Hi all,
>>>> I have followed Gert suggestion and I have a small patch that integrate
>>>> osgi-fication of GWT-Servlet in the GWT ant build.
>>>>
>>>> I have one question before submitting the patch. The bnd property files
>>>> looks like this:
>>>>
>>>> Bundle-Name: Google Web Toolkit :: Servlet
>>>> Bundle-SymbolicName: gwt-servlet
>>>> Bundle-Version: @version@
>>>> Export-Package: *;version=@version@
>>>> Import-Package: javax.servlet.*, !com.google.gwt.*,
>>>> *;resolution:=optional
>>>>
>>>> the instruction !com.google.gwt.* generates the header
>>>> "Ignore-Package:",
>>>> and I have never seen it header before,
>>>> but if I leave the configuration with just "Import-Package:
>>>> *;resolution:=optional", I get a manifest with a huge list of optional
>>>> package imports.
>>>>
>>>> I'm confident that the bundle really don't need to import packages
>>>> inside
>>>> com.google.gwt.* so excluding them seems more optimized.
>>>> But I was not expecting the Ignore-Package header, and I don't know how
>>>> to interpret it.
>>>>
>>>> So, which one of the two configuration should I use?
>>>> Import-Package: *;resolution:=optional  ==> more conservative solution
>>>> Import-Package: javax.servlet.*, !com.google.gwt.*,
>>>> *;resolution:=optional  ==> probably more optimized
>>>>
>>>> both options works on my test (but it is a simple one).
>>>>
>>>> Thank you again.
>>>> Cristiano
>>>>
>>>>
>>>>
>>>>
>>>> 2013/11/6 Gert Vanthienen <gert.vanthienen@gmail.com>
>>>>
>>>>> Hi Cristiano,
>>>>>
>>>>>
>>>>> For the Import-Package, you should be able to append the resolution
>>>>> directive with a ;, just like you do with the maven-bundle-plugin
>>>>> instructions.  Something like *;resolution:=optional should work fine,
>>>>> I think.
>>>>>
>>>>> For the properties, my first suggestion would be to just use plain Ant
>>>>> to copy the file into a working directory and filter those property
>>>>> values first and then point <bnd> to the filtered file, but it
looks
>>>>> like there's a <bndexpand> task as well that might be helpful,
cfr.
>>>>>
>>>>> https://github.com/bndtools/bnd/wiki/%5Bant%5D-Loading-and-Expanding-Shared-Headers-or-Properties
>>>>>
>>>>>
>>>>>
>>>>> Regards,
>>>>>
>>>>> Gert Vanthienen
>>>>>
>>>>>
>>>>> On Wed, Nov 6, 2013 at 10:14 AM, Cristiano Costantini
>>>>> <cristiano.costantini@gmail.com> wrote:
>>>>>> Hi all
>>>>>>
>>>>>> Short story:
>>>>>> - Using "Import-Package: *" generates mandatory imports,
>>>>>> do you know how to instruct bnd tool in the .bnd property file to
>>>>>> scan
>>>>>> imports and set them as with "resolution:=optional"?
>>>>>>
>>>>>> - "Bundle-Version: 2.6.0.rc1" is hard coded,
>>>>>> do you know how to use external Ant variables in a .bnd property
file
>>>>> when
>>>>>> using Ant tasks?
>>>>>>
>>>>>>
>>>>>> Long story:
>>>>>> I have made a GWT demo project that works into Servicemix 4.5.3 (I
>>>>>> will
>>>>>> publish it as soon as I have some more time),
>>>>>> by now it resolves the dependency with gwt-servlet by installing
the
>>>>>> following bundle:
>>>>>>      install -s
>>>>>>
>>>>> wrap:mvn:com.google.gwt/gwt-servlet/${gwt.version}$Bundle-SymbolicName=gwt-servlet
>>>>>
>>>>>>
>>>>>> It creates a huge manifest for the GWT-Servlet, it heavily make
>>>>>> use of
>>>>>> optional imports, the demo is just a simple example with 1 server
>>>>>> side
>>>>> GWT
>>>>>> Rpc Service (-> a servlet), but it works.
>>>>>>
>>>>>> I then tried to automate the generation of OSGi Manifest into the
>>>>>> build
>>>>>> lifecycle of GWT so that the original Jar in the GWT distribution
is
>>>>> ready
>>>>>> for deployment to OSGi without wrapping it, but here things get a
>>>>> little
>>>>>> harder.
>>>>>>
>>>>>> The "bnd" ant task is hard to fit GWT lifecycle as the GWT-Servlet
>>>>>> Jar
>>>>> is a
>>>>>> subset of classes extracted from GWT-User and GWT-Dev.
>>>>>> I think using "bndwrap" ant task and post process GWT-Servlet is
>>>>>> preferable.
>>>>>>
>>>>>> I tried first by wrapping the Jar on the command line and I made
a
>>>>> simple
>>>>>> .bnd file with the following options contents:
>>>>>>     Bundle-Name: Google Web Toolkit :: Servlet
>>>>>>     Bundle-SymbolicName: gwt-servlet
>>>>>>     Bundle-Version: 2.6.0.rc1
>>>>>>     Export-Package: *
>>>>>>     Import-Package: *
>>>>>>
>>>>>> I got an osgi-fied bundle, I deployed it replacing the one created
>>>>>> with
>>>>>> wrap: deployer but this new one does not get resolved:
>>>>>> the difference is that the made with wrap deployer sets all
>>>>>> Imports as
>>>>>> optional.
>>>>>> It sound reasonable to me, as the classes in the GWT-Servlet have
>>>>>> been
>>>>>> accurately selected by GWT committers (remember GWT-Servlet comes
>>>>>> from
>>>>> a
>>>>>> subset of GWT-Dev and GWT-User) and may have many java imports of
>>>>> classes
>>>>>> not required on the server but are still referenced in the bytecode.
>>>>>>
>>>>>> Ideally, we should create a .bnd file that only specify the right
>>>>> Package
>>>>>> Imports and Exports, but I don't have ideas on how to make it simple.
>>>>>>
>>>>>> I guess the best would be to make a first step and achieve having
an
>>>>>> initial bundle with imports as optional but I don't know how to
>>>>>> specify
>>>>>> this to bnd for Import-Packages... (see initial question).
>>>>>> Anyone can suggest me how to do it?
>>>>>>
>>>>>>
>>>>>> Here, if someone is interested, are the headers of the two bundles:
>>>>>> This one works
>>>>>>
>>>>>>
>>>>> https://gist.github.com/cristcost/7332635#file-gwt-servlet-osgi-headers-with-wrap
>>>>>
>>>>>>
>>>>>> This one don't
>>>>>>
>>>>>>
>>>>> https://gist.github.com/cristcost/7332635#file-gwt-servlet-osgi-headers-from-command-line-bnd
>>>>>
>>>>>>
>>>>>> I'll keep you updated as I try to progress further.
>>>>>> ;-)
>>>>>>
>>>>>> Cristiano
>>>>>>
>>>>>>
>>>>>> PS. Here are the Ant rules for selecting what to put inside the
>>>>> GWT-Servlet
>>>>>> JAR. Any Idea on how to create more fine tuned .bnd files from these
>>>>> rules?
>>>>>>
>>>>>>        <fileset dir="${gwt.dev.bin}">
>>>>>>          <include name="com/google/gwt/dev/asm/**" />
>>>>>>          <include name="com/google/gwt/dev/util/Name*.class" />
>>>>>>          <include name="com/google/gwt/dev/util/StringKey.class"
/>
>>>>>>          <include name="com/google/gwt/util/tools/shared/**" />
>>>>>>          <include name="com/google/gwt/core/shared/**" />
>>>>>>        </fileset>
>>>>>>        <fileset dir="${gwt.user.bin}">
>>>>>>          <exclude name="**/rebind/**" />
>>>>>>          <exclude name="**/tools/**" />
>>>>>>          <exclude name="**/super/**" />
>>>>>>          <exclude name="com/google/gwt/json/**" />
>>>>>>          <exclude name="com/google/gwt/junit/*" />
>>>>>>          <exclude name="com/google/gwt/junit/client/GWTTestCase.*"
/>
>>>>>>          <exclude name="com/google/gwt/junit/remote/**" />
>>>>>>          <exclude name="com/google/gwt/junit/server/**" />
>>>>>>          <exclude name="com/google/gwt/benchmarks/*" />
>>>>>>          <exclude name="**/*.gwtar" />
>>>>>>        </fileset>
>>>>>
>>>>
>>>>
>>>
>>
>

-- 
Jean-Baptiste Onofré
jbonofre@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com

Mime
View raw message