Hi Adriano,

I continued testing retrotranslator. Here's what I've done up to now.

1. Downloaded the modified code from [1].

2. Downloaded SCA modules from [2] and installed as shown below:

svn checkout --revision 643746
https://svn.apache.org/repos/asf/incubator/tuscany/java/sca/modules

cd modules

mvn clean install -Dtest=no
mvn -Peclipse eclipse:eclipse -Dtest=no

 3. Created a new eclipse workspace and set the M2_REPO variable as shown
below:

mvn -Declipse.workspace=/Users/.../workspace eclipse:add-maven-repo

 4. Adjusted buildpath to eliminate build errors, added Android library to
required modules, fixed references to jar files and other libraries.

5. Uncommented lines in

org.apache.tuscany.sca.implementation.java.module.JavaRuntimeModuleActivator

6. Ran retrotranslator as instructed on the project site [3] and shown
below:

Voyager-2:30May ocastaneda$ java -jar
/../retrotranslator-transformer-1.2.6.jar -srcdir /../workspace
-target 1.5 -reflection safe -stripannot -classpath
/../retrotranslator-android-1.2.6.jar -verbose

 The output can be found in [4].
7. Rebuilt project after uncommenting lines in

org.apache.tuscany.sca.implementation.java.module.JavaRuntimeModuleActivator

and then re-ran retrotranslator.
8. Debugging in Eclipse shows errors shown in [5] and Android errors in [6].



As always, I'm documenting my progress on the project log. I haven't fully
tested out Luciano's suggestions. I guess I'm puzzled by what you mean by
this:

"code that checks for @Remotable you force to true, otherwise force to
false."

I'll continue looking into it and hopefully get retrotranslator to work. I
also think it's a simpler option.

Luciano: Thanks for your suggestions.

[1]
https://svn.apache.org/repos/asf/incubator/tuscany/sandbox/mobile-android

[2] https://svn.apache.org/repos/asf/incubator/tuscany/java/sca/modules/

[3] http://retrotranslator.sourceforge.net/#android

[4] http://androidindelft.googlepages.com/rt_output_30may2008.txt

[5] http://cwiki.apache.org/confluence/display/TUSCANYWIKI/2Jun2008
[6] http://androidindelft.googlepages.com/2Jun1.jpg


On Tue, May 27, 2008 at 6:33 PM, Adriano Crestani <
[EMAIL PROTECTED]> wrote:

> Hi,
>
> I tried what Luciano suggested. It really works. To get it working you
> simply need to search on all modules where the code checks for @Remotable
> annotation and force it to true:
>
> "clazz.getAnnotation(Remotable.class) != null"   => true
> "clazz.isAnnotationPresent(Remotable.class)" => true
>
> It works fine on the sca revision we are testing on Android and the most
> recent revision. I only tested it as a java application, not as an android
> application.
>
> Unfortunatelly, I still think retrotranslator is a faster and simpler
> solution. Because the Luciano's suggestion only forces the SCA to recognize
> the services with no annotations declared on their interfaces, but it does
> not avoid the Exceptions we are getting when the SCA invokes methods that
> read annotations. So, our current problem is that we are not being able to
> use these methods and not only because we are not being able to read the
> annotations.
>
> Oscar, if you want to try the Luciano's suggestion, you will need to
> comment/adapt every sca code that tries to read the class annotations. It
> is
> not necessary to comment/adapt the methods that read Method annotations,
> they are not throwning any exception. So, every code that checks for
> @Remotable you force to true, otherwise force to false.
>
> Any doubt about what I have said, just let me know ; )
>
> Suggestions are welcome : )
>
> Adriano Crestani
>
> On Wed, May 21, 2008 at 12:57 PM, Luciano Resende <[EMAIL PROTECTED]>
> wrote:
>
> > FYI, if you comment out the code that checks if a interface is
> > remoteble, you could have a version of the calculator without any
> > annotations, and the runtime would introspect the references for the
> > multiple services. But note that, the introspection code will only be
> > activated if there is no SCA annotations on the class.
> >
> > On Wed, May 21, 2008 at 1:21 AM, Adriano Crestani
> > <[EMAIL PROTECTED]> wrote:
> > > Ah, the expected exception should look like this on android emulator:
> > > http://people.apache.org/~adrianocrestani/android_emulator.jpg<http://people.apache.org/%7Eadrianocrestani/android_emulator.jpg>
> <http://people.apache.org/%7Eadrianocrestani/android_emulator.jpg>
> > >
> > > On Tue, May 20, 2008 at 11:54 PM, Adriano Crestani <
> > > [EMAIL PROTECTED]> wrote:
> > >
> > >> Hi Oscar,
> > >>
> > >> I was indeed using the sca modules not from the sandbox. As you
> > suggested,
> > >> I
> > >> removed the tuscany-contribution-impl from my workspace and added the
> > >> version you uploaded to the sandbox. Then, I uncommented the lines in
> > >>
> > >>
> > >>
> >
> org.apache.tuscany.sca.implementation.java.module.JavaRuntimeModuleActivator
> > >>
> > >> following the comments pointing out why those lines had been
> commented.
> > I'm
> > >> no longer getting the ClassNotFoundException. However, it's getting
> > stuck
> > >> somewhere else (before getting there I guess)...I think this is the
> case
> > >> because before and after commenting the code I get the same error in
> the
> > >> Android emulator, an InstantiationException [1].
> > >>
> > >> Have you debugged to check exactly where this exception is being
> thrown?
> > I
> > >> have done the procedure I previously described  again and I got it
> > "running"
> > >> as expected, which means, running till the expected exception is
> thrown.
> > >>
> > >> I also started tinkering with retrotranslator. First I tried doing it
> > with
> > >> Ant, but it seems that in order to build I have to include the whole
> > >> tuscany
> > >> projects in a way similar to how I now have in Eclipse. I also tried
> > making
> > >> a jar out of
> > >>
> > >>
> > >>
> >
> org.apache.tuscany.sca.implementation.java.module.JavaRuntimeModuleActivator
> > >>
> > >> and then feeding it to retrotranslator but unfortunately it's not
> > >> translating anything, as shown below.
> > >>
> > >> Voyager-2:Retrotranslator-1.2
> > >> .6-bin ocastaneda$ java -jar
> > >> retrotranslator-transformer-1.2.6.jar -srcjar
> > >> JavaRuntimeModuleActivator.jar
> > >> -target 1.5 -reflection safe -stripannot -classpath
> > >> retrotranslator-android-1.2.6.jar
> > >> Processing 136 file(s) in JavaRuntimeModuleActivator.jar.
> > >> Transformed 0 file(s).
> > >>
> > >> There's also a maven plugin, so I might try that...but first I'll give
> > Ant
> > >> another go. Hopefully Google will release a new SDK soon, otherwise as
> > you
> > >> say...retrotranslator will have to be the workaround to proceed with
> our
> > >> project ;-)
> > >>
> > >> Unfortunately the rumors say the new SDK version will not be released
> > until
> > >> july 28th :S. So, it's really good you have already started working on
> > the
> > >> retrotranslator, it will probably be the best workaround for the
> > annotations
> > >> problem till the next SDK release.
> > >>
> > >> I suggest you to forget about the build process right now, before,
> check
> > if
> > >> this retrotranslator works and if it really works on android platform.
> > I´m
> > >> really getting upset with Android, even its API methods does not work
> as
> > >> expected :@. Anyway, try initially to compile a simple class (coded by
> > you),
> > >> which contains annotations, and access these annotations. If it works,
> > make
> > >> it more complex and test again, do it until you reach a scenario as
> > complex
> > >> as the SCA (a lot of external jars with annotated classes accessed by
> > the
> > >> other external jars and the Android app). Got it? : )
> > >>
> > >> Regards,
> > >> Adriano Crestani
> > >>
> > >>
> > >> On Tue, May 20, 2008 at 1:53 PM, Oscar Castaneda <
> > >> [EMAIL PROTECTED]> wrote:
> > >>
> > >>> Hi Adriano,
> > >>>
> > >>> I was indeed using the sca modules not from the sandbox. As you
> > suggested,
> > >>> I
> > >>> removed the tuscany-contribution-impl from my workspace and added the
> > >>> version you uploaded to the sandbox. Then, I uncommented the lines in
> > >>>
> > >>>
> > >>>
> >
> org.apache.tuscany.sca.implementation.java.module.JavaRuntimeModuleActivator
> > >>>
> > >>> following the comments pointing out why those lines had been
> commented.
> > >>> I'm
> > >>> no longer getting the ClassNotFoundException. However, it's getting
> > stuck
> > >>> somewhere else (before getting there I guess)...I think this is the
> > case
> > >>> because before and after commenting the code I get the same error in
> > the
> > >>> Android emulator, an InstantiationException [1].
> > >>>
> > >>> I also started tinkering with retrotranslator. First I tried doing it
> > with
> > >>> Ant, but it seems that in order to build I have to include the whole
> > >>> tuscany
> > >>> projects in a way similar to how I now have in Eclipse. I also tried
> > >>> making
> > >>> a jar out of
> > >>>
> > >>>
> > >>>
> >
> org.apache.tuscany.sca.implementation.java.module.JavaRuntimeModuleActivator
> > >>>
> > >>> and then feeding it to retrotranslator but unfortunately it's not
> > >>> translating anything, as shown below.
> > >>>
> > >>> Voyager-2:Retrotranslator-1.2.6-bin ocastaneda$ java -jar
> > >>> retrotranslator-transformer-1.2.6.jar -srcjar
> > >>> JavaRuntimeModuleActivator.jar
> > >>> -target 1.5 -reflection safe -stripannot -classpath
> > >>> retrotranslator-android-1.2.6.jar
> > >>> Processing 136 file(s) in JavaRuntimeModuleActivator.jar.
> > >>> Transformed 0 file(s).
> > >>>
> > >>> There's also a maven plugin, so I might try that...but first I'll
> give
> > Ant
> > >>> another go. Hopefully Google will release a new SDK soon, otherwise
> as
> > you
> > >>> say...retrotranslator will have to be the workaround to proceed with
> > our
> > >>> project ;-)
> > >>>
> > >>> Thanks again for all your help...I'm getting ready for the official
> > start
> > >>> :-)
> > >>>
> > >>> [1] http://androidindelft.googlepages.com/20may2008.html
> > >>>
> > >>>
> > >>>
> > >>> On Fri, May 16, 2008 at 12:20 PM, Adriano Crestani <
> > >>> [EMAIL PROTECTED]> wrote:
> > >>>
> > >>> > Hi Oscar,
> > >>> >
> > >>> > My mistake again, the eclipse project files of contribution-impl
> > module
> > >>> > were
> > >>> > not uploaded, so you are probably using the modules you have
> > downloaded
> > >>> > from
> > >>> > the sca modules. If you remove the tuscany-contribution-impl from
> > your
> > >>> > workspace and add this module from the sandbox it will probably
> work.
> > >>> > Anyway, you will need to update your trunk again to get the project
> > >>> files
> > >>> > I'm uploading right now ; )
> > >>> >
> > >>> > OK, if you wanna try the retrotranslator as a solution here is a
> tip:
> > >>> most
> > >>> > of the code that were using the Reflection API was commented on
> > >>> >
> > >>> >
> > >>>
> >
> org.apache.tuscany.sca.implementation.java.module.JavaRuntimeModuleActivator
> > >>> > class, you just need to edit this class and remove the commented
> code
> > >>> (it's
> > >>> > described there).
> > >>> >
> > >>> > So, if you uncomment the code and the retrotranslador successfuly
> > work,
> > >>> and
> > >>> > I hope it will, you will reach the
> > >>> >
> > org.apache.tuscany.sca.binding.sca.impl.RuntimeSCAServiceBindingProvider
> > >>> > constructor and it should run OK. Exactly on this constructor I'm
> > >>> getting a
> > >>> > NPE when the code described above is commented.
> > >>> >
> > >>> > About the ant, go on and use it. Further we can evaluate better
> where
> > we
> > >>> > place it in the entire SCA build process. BTW, we even dont know if
> > we
> > >>> will
> > >>> > still be using the retrotranslator in future, right?! : )
> > >>> >
> > >>> > Use the retrotranslator may help us a lot to workaround this
> problem
> > for
> > >>> > now
> > >>> > and go on with our project ; )
> > >>> >
> > >>> > Kind Regards,
> > >>> > Adriano Crestani
> > >>> >
> > >>> > On Wed, May 14, 2008 at 2:57 PM, Oscar Castaneda <
> > >>> > [EMAIL PROTECTED]> wrote:
> > >>> >
> > >>> > > Hi Adriano,
> > >>> > >
> > >>> > > Thanks alot for your answers. I was able to build the entire
> > workspace
> > >>> > from
> > >>> > > your instructions. When running calculator-android as an "Android
> > >>> > > application" I'm getting a ClassNotFoundException [1] for
> > >>> > >
> > >>> > >
> > >>> >
> > >>>
> >
> org.apache.tuscany.sca.contribution.processor.impl.DexContributionProcessor.
> > >>> > > Is the exception you referred to in your original email?
> > >>> > >
> > >>> > > ...when
> > >>> > > > you run the calculator-android project as an "Android
> > application"
> > >>> you
> > >>> > > > should get an exception, that was generated initially by a NPE
> > >>> thrown
> > >>> > by
> > >>> > > >
> > >>> >
> > org.apache.tuscany.sca.binding.sca.impl.RuntimeSCAServiceBindingProvider
> > >>> > > > constructor. This is caused because the latest Android SDK does
> > not
> > >>> > > support
> > >>> > > > the Reflection API yet. So, the SCA cannot check the @Reference
> > >>> > > annotations
> > >>> > > > (I commented the code which tries to read the annotations, so
> > when
> > >>> the
> > >>> > > > execution reach this constructor it throws the NPE).
> > >>> > > >
> > >>> > >
> > >>> > >
> > >>> > > Searching for the class in the exception I'm getting I found
> > >>> > > org.apache.tuscany.sca.extensibility.ServiceDiscovery. In
> > >>> > getServiceClasses
> > >>> > > it loads the service class I'm getting problems with when running
> > >>> > > calculator-android as an "Android application":
> > >>> > >
> > >>> > >
> > >>> > >
> > >>> >
> > >>>
> >
> "org.apache.tuscany.sca.contribution.processor.impl.DexContributionProcessor;type=application/x-dex"
> > >>> > >
> > >>> > >
> > >>> > > I couldn't find the corresponding java file in my imported
> > workspace
> > >>> and
> > >>> > > found that there is no package like
> > >>> > > org.apache.tuscany.sca.contribution.processor.impl.
> > >>> > >
> > >>> > > Am I missing something? Or are these the errors you would expect?
> > >>> > >
> > >>> > > I would like to get to the point where I get the exception you
> > >>> described
> > >>> > > and
> > >>> > > try to run retrotranslator from there. However, as I'm using the
> > ADT
> > >>> > plugin
> > >>> > > in eclipse I would need to extract code that "declares or
> analyzes
> > >>> > > annotations you may extract it into a separate library that can
> be
> > >>> > > processed
> > >>> > > with Retrotranslator and added to the main project." That is,
> > unless I
> > >>> > use
> > >>> > > Ant, in which case I would only need to add a few lines to
> > build.xml.
> > >>> I'm
> > >>> > > continuing to look into this, any thoughts are more than welcome
> > :-)
> > >>> > >
> > >>> > > [1] http://delftandroid.googlepages.com/14may2008.html
> > >>> > >
> > >>> > >
> > >>> > > On Mon, May 12, 2008 at 9:13 AM, Adriano Crestani <
> > >>> > > [EMAIL PROTECTED]> wrote:
> > >>> > >
> > >>> > > > Hi,
> > >>> > > >
> > >>> > > > Thanks all for the feedback ; )
> > >>> > > >
> > >>> > > > At first, I want to correct one mistake, on the first step I
> > >>> described
> > >>> > on
> > >>> > > > my
> > >>> > > > previous email, I should not have added the word "install", it
> > >>> probably
> > >>> > > > would lead the reader to run the "mvn clean install" in the
> > >>> downloaded
> > >>> > > > files, as Oscar did. Also, on this same step, the code should
> not
> > be
> > >>> > > > downloaded from [1], but from [2].
> > >>> > > >
> > >>> > > > Simon:
> > >>> > > > Thanks for the link ; ). As the Sun Java source codes are under
> > CDDL
> > >>> > 1.0
> > >>> > > > license, it's only needed to include the CDDL license header on
> > each
> > >>> > > file,
> > >>> > > > and it's already done : )
> > >>> > > >
> > >>> > > > Jean:
> > >>> > > > I think it is better to keep the code in the sandbox for now.
> At
> > >>> first,
> > >>> > > > it's
> > >>> > > > not working on the current SCA modules revision yet. And also,
> > I'm
> > >>> > > > commenting many lines at some modules just to get a "first run"
> > of
> > >>> > > > calculator-sample to further evaluate why and how this
> commented
> > >>> lines
> > >>> > > will
> > >>> > > > be adapted to be compatible with both: SCA Java and SCA
> Android.
> > >>> > > >
> > >>> > > > Oscar:
> > >>> > > >
> > >>> > > > - Are host-android and core-android a part of
> calculator-android?
> > >>> > > >
> > >>> > > > What do you mean when you say "part"? They are used by
> > >>> > > calculator-android,
> > >>> > > > and will prabably be added to tuscany sca modules in future
> > >>> > > >
> > >>> > > > - Should the calculator-android included in [1] have included
> an
> > >>> > > > "AndroidManifest.xml" file?
> > >>> > > >
> > >>> > > > Sorry, my mistake, I forgot to add to svn the eclipse project
> > files
> > >>> of
> > >>> > > > these
> > >>> > > > projects. I have already commited these files and if you update
> > your
> > >>> > > trunk
> > >>> > > > you will get them ; ). So, delete the ones you have created.
> > >>> > > >
> > >>> > > > - How can I fix the build errors? Is there something else
> needed
> > in
> > >>> > > > addition
> > >>> > > > to including the Android Library?
> > >>> > > >
> > >>> > > > No, the Android library is really simples, it only contains the
> > >>> > > android.jar
> > >>> > > > file located in your Android SDK.
> > >>> > > >
> > >>> > > > Please, do not run the "mvn clean build" and "mvn -Peclipse
> > >>> > > > eclipse:eclipse"
> > >>> > > > commands on the sandbox files, the eclipse project files are
> > already
> > >>> in
> > >>> > > > modules and you should build the modules using the eclipse for
> > now.
> > >>> The
> > >>> > > > maven config files are not updated yet with the modifications I
> > have
> > >>> > done
> > >>> > > > on
> > >>> > > > these modules, so they will not generate the correct project
> > files,
> > >>> > > worse,
> > >>> > > > they will override the ones I have created.
> > >>> > > >
> > >>> > > > Then, clean and build your entire workspace, if you still get
> any
> > >>> > errors,
> > >>> > > > let me know ; )
> > >>> > > >
> > >>> > > > - Should I import 'tuscany-databinding-saxon'? Or, why should
> > this
> > >>> not
> > >>> > be
> > >>> > > > imported?
> > >>> > > >
> > >>> > > > It seems the revision I suggested already had the saxon module
> > >>> removed
> > >>> > > from
> > >>> > > > repo. So, you mistakenly removed another one that shouldn´t.
> > Please,
> > >>> > > import
> > >>> > > > the databinding-saxon module again into your workspace.
> > >>> > > >
> > >>> > > >
> > >>> > > > Regards,
> > >>> > > > Adriano Crestani
> > >>> > > >
> > >>> > > >
> > >>> > > > [1] -
> > https://svn.apache.org/repos/asf/incubator/tuscany/sandbox/<
> > >>> > > >
> > >>> > >
> > >>> >
> > >>>
> >
> https://svn.apache.org/repos/asf/incubator/tuscany/sandbox/mobile-android/android-jdk-classes/src/javax/xml/
> > >>> > > > >
> > >>> > > > [2] -
> > >>> > > >
> > >>> > >
> > >>> >
> > >>>
> >
> https://svn.apache.org/repos/asf/incubator/tuscany/sandbox/mobile-android
> > >>> > > >
> > >>> > > > On Sun, May 11, 2008 at 11:05 AM, Jean-Sebastien Delfino <
> > >>> > > > [EMAIL PROTECTED]> wrote:
> > >>> > > >
> > >>> > > > > Mike Edwards wrote:
> > >>> > > > >
> > >>> > > > > > Jean-Sebastien Delfino wrote:
> > >>> > > > > >
> > >>> > > > > > > Oscar Castaneda wrote:
> > >>> > > > > > >
> > >>> > > > > > >  1. Downloaded the modified code from [1] and installed
> as
> > >>> shown
> > >>> > > > > > > > below:
> > >>> > > > > > > >
> > >>> > > > > > > > svn checkout
> > >>> > > > > > > >
> > https://svn.apache.org/repos/asf/incubator/tuscany/sandbox/
> > >>> > > > > > > >
> > >>> > > > > > > > cd mobile-android
> > >>> > > > > > > >
> > >>> > > > > > > >
> > >>> > > > > > > If there's no objection from others, I'd be happy to see
> > this
> > >>> > code
> > >>> > > > > > > move from sandbox to trunk as we now have several people
> > doing
> > >>> > > > development
> > >>> > > > > > > on this android integration.
> > >>> > > > > > >
> > >>> > > > > > > Adriano, you could start with something like
> > >>> > trunk/java/sca/android
> > >>> > > > > > > and later progressively try to converge the code with the
> > code
> > >>> in
> > >>> > > > trunk,
> > >>> > > > > > > with architected plug points for the android specific
> code
> > >>> etc.
> > >>> > > > > > >
> > >>> > > > > > > Thoughts?
> > >>> > > > > > >
> > >>> > > > > >
> > >>> > > > > > I assume that moving to trunk does not also imply "making
> > part
> > >>> of
> > >>> > the
> > >>> > > > > > main build"?
> > >>> > > > > >
> > >>> > > > > > I'd be a bit concerned at experimental code entering the
> > build
> > >>> at
> > >>> > > this
> > >>> > > > > > stage.
> > >>> > > > > >
> > >>> > > > > >
> > >>> > > > > > Yours,  Mike.
> > >>> > > > > >
> > >>> > > > >
> > >>> > > > > I think it's business as usual, code that doesn't work does
> not
> > go
> > >>> in
> > >>> > > the
> > >>> > > > > main build, code that's getting stable can go in the main
> build
> > at
> > >>> > some
> > >>> > > > > point when people have no specific objections, and different
> > >>> profiles
> > >>> > > can
> > >>> > > > be
> > >>> > > > > used to subset particular builds.
> > >>> > > > >
> > >>> > > > > --
> > >>> > > > > Jean-Sebastien
> > >>> > > > >
> > >>> > > >
> > >>> > >
> > >>> > >
> > >>> > >
> > >>> > > --
> > >>> > > best,
> > >>> > > -oscar
> > >>> > >
> > >>> > > Oscar Castañeda
> > >>> > >
> > >>> >
> > >>>
> > >>>
> > >>>
> > >>> --
> > >>> best,
> > >>> -oscar
> > >>>
> > >>> Oscar Castañeda
> > >>>
> > >>
> > >>
> > >
> >
> >
> >
> > --
> > Luciano Resende
> > Apache Tuscany Committer
> > http://people.apache.org/~lresende<http://people.apache.org/%7Elresende><
> http://people.apache.org/%7Elresende>
> > http://lresende.blogspot.com/
> >
>



-- 
best,
-oscar

Oscar Castañeda

Reply via email to