You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@shindig.apache.org by Gary Stevens <gs...@us.ibm.com> on 2009/04/03 18:53:48 UTC

Implementing shindig-samples


Hello all,

I have been trying to implement the data persistence samples included in
Shindig and hit a problem.  I have set up a Derby\EclipseLink database with
the canonical data loaded into it and have tried to point my Shindig at it
instead of the canonicaldb.json file.  My setup uses the
EclipseEntityManagerProvider class to create an implementation of
EntityManager and hits a snag inside of JPQLUtils.java's getTotalResults
method.  The query it builds starts "select count(*)..." and when I load my
container I get a JPQL exception in my Eclipse console.  The message reads:

     Syntax error parsing the query [select count(*)  from PersonDb p where
p.objectId in (select f.friend.objectId from PersonDb p, FriendDb f where
p.objectId = f.person.objectId and p.id in (?1)) ],
      line 1, column 13: syntax error at [*].
     Internal Exception: MismatchedTokenException(66!=70)

>From looking online, I am under the impression that the problem is a
difference in syntax between SQL and JPA/JPQL - that you can use the
annotation count(*) in SQL but not in JPQL because JPQL only allows one
argument in count() but SQL allows multiple arguments.  Is this the
problem, and I need to rewrite how the getTotalResults method assembles the
query?  Or am I further away from having the persistence sample working
than I think?  If anyone else who has played around with the included
samples can offer any advice as well it would be greatly appreciated.

Thank you,
- Gary F Stevens

Re: rpc relay documentation

Posted by Jesse Cravens <je...@gmail.com>.
A couple of articles that might help out:

http://www.oqube.com/journal/journal/2009/02/05/Google-Gadgets---Shindig-RPC-Enlightment
http://www.ajaxify.com/run/crossframe/#


On Fri, Apr 10, 2009 at 6:55 PM, Brian Eaton <be...@google.com> wrote:

> On Thu, Apr 9, 2009 at 3:11 PM, John Hjelmstad <fa...@google.com> wrote:
> > It's still used because Safari < 4 and Chrome < 2 don't support any of
> the
> > methods implemented yet. I'm working on a final method that obviates the
> > need for IFPC on these browsers while enabling much faster cross-frame
> > communication, and without a relay. If successful (working out the
> kinks),
> > this provides a rationale for removing IFPC, improving performance and
> > making containers' lives easier.
>
> What is this "final method" you speak of?
>



-- 
jesse cravens
jessecravens.com
m. 210.392.1542

Re: rpc relay documentation

Posted by Brian Eaton <be...@google.com>.
On Thu, Apr 9, 2009 at 3:11 PM, John Hjelmstad <fa...@google.com> wrote:
> It's still used because Safari < 4 and Chrome < 2 don't support any of the
> methods implemented yet. I'm working on a final method that obviates the
> need for IFPC on these browsers while enabling much faster cross-frame
> communication, and without a relay. If successful (working out the kinks),
> this provides a rationale for removing IFPC, improving performance and
> making containers' lives easier.

What is this "final method" you speak of?

Re: rpc relay documentation

Posted by John Hjelmstad <fa...@google.com>.
On Thu, Apr 9, 2009 at 3:02 PM, Jordan Zimmerman <jo...@shop.com> wrote:

> Is there documentation on the different RPC relay methods used in
> rpc.js? I'm using the default method ("wpm") and it works 75% of the
> time. I've read here that 'ifpc' is deprecated so I'd like to understand
> the other methods: "dpm" and "nix". Questions:


There's also "fe".


>
>
> * Why is ifpc deprecated?


It's not deprecated quite yet, but we'd like to move that way. There are two
reasons:
1. It's slow.
2. It's painful for containers to support, since it involves active hosting
of a particular relay file, and delicate wiring to get both container and
gadget to point to it properly.

It's still used because Safari < 4 and Chrome < 2 don't support any of the
methods implemented yet. I'm working on a final method that obviates the
need for IFPC on these browsers while enabling much faster cross-frame
communication, and without a relay. If successful (working out the kinks),
this provides a rationale for removing IFPC, improving performance and
making containers' lives easier.


>
> * What's the difference between dpm and wpm? Why would I use one over
> the other?


Well technically, you never choose the communication channel. The library
does this for you.

That said, 'dpm' is document.postMessage. It was implemented by Opera 8, I
believe, before window.postMessage was standardized in HTML5.
window.postMessage is preferred over it. @see rpc.js source for details.


>
> * What is nix and how I do I use it?


You render a gadget using IE < 8. rpc.js uses the existence of ActiveXObject
as a proxy for determining whether the browser is IE. 'wpm' is preferred
over this, so IE8 gets that method.

Fairly extensive documentation on all this is available in the comments of
rpc.js itself:
http://svn.apache.org/repos/asf/incubator/shindig/trunk/features/src/main/javascript/features/rpc/rpc.js

See especially the JsDoc for function getRelayChannel().


>
>
> Jordan Zimmerman
> Principal Software Architect
> 831.647.4712
> 831.214.2990 (cell)
> jordanz@shop.com
>
> SHOP*COMTM
> Shop Smart, Save Big(tm)
> www.shop.com
>
> This message (including any attachments) is intended only for
> the use of the individual or entity to which it is addressed and
> may contain information that is non-public, proprietary,
> privileged, confidential, and exempt from disclosure under
> applicable law or may constitute as attorney work product.
> If you are not the intended recipient, you are hereby notified
> that any use, dissemination, distribution, or copying of this
> communication is strictly prohibited. If you have received this
> communication in error, notify us immediately by telephone and
> (i) destroy this message if a facsimile or (ii) delete this
> message
> immediately if this is an electronic communication.
>
> Thank you.
>

rpc relay documentation

Posted by Jordan Zimmerman <jo...@shop.com>.
Is there documentation on the different RPC relay methods used in
rpc.js? I'm using the default method ("wpm") and it works 75% of the
time. I've read here that 'ifpc' is deprecated so I'd like to understand
the other methods: "dpm" and "nix". Questions:

* Why is ifpc deprecated?
* What's the difference between dpm and wpm? Why would I use one over
the other?
* What is nix and how I do I use it?

Jordan Zimmerman
Principal Software Architect
831.647.4712
831.214.2990 (cell)
jordanz@shop.com 

SHOP*COMTM
Shop Smart, Save Big(tm)
www.shop.com

This message (including any attachments) is intended only for
the use of the individual or entity to which it is addressed and
may contain information that is non-public, proprietary,
privileged, confidential, and exempt from disclosure under
applicable law or may constitute as attorney work product.
If you are not the intended recipient, you are hereby notified
that any use, dissemination, distribution, or copying of this
communication is strictly prohibited. If you have received this
communication in error, notify us immediately by telephone and
(i) destroy this message if a facsimile or (ii) delete this 
message
immediately if this is an electronic communication.

Thank you.

Re: Implementing shindig-samples

Posted by Gary Stevens <gs...@us.ibm.com>.
Chico,

Thank you for your help.  That did the trick - I was able to get my Shindig
to run with Hibernate instead of Eclipselink, and that solved the problems
and errors I had been running into before.

The next problem I have hit happens when I load the sample container.  I
have Shindig pointing at my database and using Hibernate, and my Jetty
server starts running with no problems.  However, when I open the sample
container I get a StackOverflow inside the JsonSerializer class.  It
bounces between the appendPojo, append, and appendCollection methods until
it fills up the stack.  One of the objects it appends while looping is XA,
one of the enumerated values for network presence.  However, all the people
in my database have the value ONLINE for their network presence.  I found
this declaration in the PersonDb class:

@Transient
  protected Enum<NetworkPresence> networkPresence = new
EnumDb<NetworkPresence>(
      NetworkPresence.XA);

Is this variable not being overwritten with the data from my database?
Does Shindig look into a Transient column instead of the NETWORK_PRESENCE
column of my table, and can I fix it?  The other three objects my Shindig
appends in a loop seem to be memory addresses instead of strings:
org.apache.shindig.social.opensocial.jpa.PersonDb@d5b111,
org.apache.shindig.social.opensocial.jpa.PersonDb$1@d5d980, and.
org.apache.shindig.social.opensocial.jpa.BodyTypeDb@272111.  I have added a
toString method to EnumDb that returns value.toString(), which allowed me
to get the value 'ONLINE' into my database instead of a memory address for
network presence as well as valid values in my smoker and drinker columns.

Thank you,
Gary F Stevens

chico charlesworth <ch...@googlemail.com> wrote on 04/07/2009
03:17:01 AM:

> chico charlesworth <ch...@googlemail.com>
> 04/07/2009 03:17 AM
>
> Please respond to
> shindig-dev@incubator.apache.org
>
> To
>
> shindig-dev@incubator.apache.org
>
> cc
>
> Subject
>
> Re: Implementing shindig-samples
>
> Hi Gary,
>
> Should be very easy to use Hibernate instead of EclipseLink by changing
the
> default persistence-unit in
> shindig/java/samples/src/main/resources/META-INF/persistence.xml.
>
> There are various persistence-units defined, and if you comment out the
> current 'default' persistence-unit and change the 'hibernate'
> persistence-unit to 'default', that should get you going i think.
>
> In regards to the AddressDb problem I can't say much right now, although
I
> think the shindig-samples module is most likely not up-to-date with the
> other shindig modules.
>
> Cheers
> Chico
>
> 2009/4/6 Gary Stevens <gs...@us.ibm.com>
>
> >
> > Chico,
> >
> > I have not tried using any other databases, just tried manipulating the
> > test cases to generate databases using different the persistence-units
> > listed in persistence.xml plugged into the SpiEntityManagerFactory
class.
> >
> > I did try rewriting the query as two separate expressions and seemed to
get
> > past the syntax error, but then I get errors about a missing column in
the
> > AddressDb table called Address_Usage.  If I had to guess right now,
that
> > error may be from the fact that the social-api project has changes that
may
> > not yet be reflected in the samples project.  I have not dug very deep
into
> > it yet.
> >
> > I have also noticed when starting my Jetty server I see messages in the
> > Eclipse console about the org.eclipse.persistence.session.file and says
the
> > version and build of the Eclipse Persistence Services (INFO:
EclipseLink,
> > version: Eclipse Persistence Services - 1.0 (Build 1.0 - 20080707)).
> >
> > Is there a setting somewhere in Shindig that I can change so that
something
> > other than EclipseLink (say, Hibernate) loads in its place?
> >
> > Thank you,
> > Gary F Stevens
> >
> > chico charlesworth <ch...@googlemail.com> wrote on
04/04/2009
> > 07:03:09 AM:
> >
> > > chico charlesworth <ch...@googlemail.com>
> > > 04/04/2009 07:03 AM
> > >
> > > Please respond to
> > > shindig-dev@incubator.apache.org
> > >
> > > To
> > >
> > > shindig-dev@incubator.apache.org
> > >
> > > cc
> > >
> > > Subject
> > >
> > > Re: Implementing shindig-samples
> > >
> > > Hi Gary,
> > >
> > > Have you tried with a different database, e.g. hsqldb or mysql, or
even
> > > making sure the version of derby you are using is the latest?
> > > My other thought would be to rewrite the JPQL query as two
expressions
> > and
> > > see if that works?
> > >
> > > Cheers
> > > Chico
> > >
> > > 2009/4/3 Gary Stevens <gs...@us.ibm.com>
> > >
> > > >
> > > >
> > > > Hello all,
> > > >
> > > > I have been trying to implement the data persistence samples
included
> > in
> > > > Shindig and hit a problem.  I have set up a Derby\EclipseLink
database
> > with
> > > > the canonical data loaded into it and have tried to point my
Shindig at
> > it
> > > > instead of the canonicaldb.json file.  My setup uses the
> > > > EclipseEntityManagerProvider class to create an implementation of
> > > > EntityManager and hits a snag inside of JPQLUtils.java's
> > getTotalResults
> > > > method.  The query it builds starts "select count(*)..." and when I
> > load my
> > > > container I get a JPQL exception in my Eclipse console.  The
message
> > reads:
> > > >
> > > >     Syntax error parsing the query [select count(*)  from PersonDb
p
> > where
> > > > p.objectId in (select f.friend.objectId from PersonDb p, FriendDb f
> > where
> > > > p.objectId = f.person.objectId and p.id in (?1)) ],
> > > >      line 1, column 13: syntax error at [*].
> > > >     Internal Exception: MismatchedTokenException(66!=70)
> > > >
> > > > From looking online, I am under the impression that the problem is
a
> > > > difference in syntax between SQL and JPA/JPQL - that you can use
the
> > > > annotation count(*) in SQL but not in JPQL because JPQL only allows
one
> > > > argument in count() but SQL allows multiple arguments.  Is this the
> > > > problem, and I need to rewrite how the getTotalResults method
assembles
> > the
> > > > query?  Or am I further away from having the persistence sample
working
> > > > than I think?  If anyone else who has played around with the
included
> > > > samples can offer any advice as well it would be greatly
appreciated.
> > > >
> > > > Thank you,
> > > > - Gary F Stevens
> >

Re: Implementing shindig-samples

Posted by chico charlesworth <ch...@googlemail.com>.
Hi Gary,

Should be very easy to use Hibernate instead of EclipseLink by changing the
default persistence-unit in
shindig/java/samples/src/main/resources/META-INF/persistence.xml.

There are various persistence-units defined, and if you comment out the
current 'default' persistence-unit and change the 'hibernate'
persistence-unit to 'default', that should get you going i think.

In regards to the AddressDb problem I can't say much right now, although I
think the shindig-samples module is most likely not up-to-date with the
other shindig modules.

Cheers
Chico

2009/4/6 Gary Stevens <gs...@us.ibm.com>

>
> Chico,
>
> I have not tried using any other databases, just tried manipulating the
> test cases to generate databases using different the persistence-units
> listed in persistence.xml plugged into the SpiEntityManagerFactory class.
>
> I did try rewriting the query as two separate expressions and seemed to get
> past the syntax error, but then I get errors about a missing column in the
> AddressDb table called Address_Usage.  If I had to guess right now, that
> error may be from the fact that the social-api project has changes that may
> not yet be reflected in the samples project.  I have not dug very deep into
> it yet.
>
> I have also noticed when starting my Jetty server I see messages in the
> Eclipse console about the org.eclipse.persistence.session.file and says the
> version and build of the Eclipse Persistence Services (INFO: EclipseLink,
> version: Eclipse Persistence Services - 1.0 (Build 1.0 - 20080707)).
>
> Is there a setting somewhere in Shindig that I can change so that something
> other than EclipseLink (say, Hibernate) loads in its place?
>
> Thank you,
> Gary F Stevens
>
> chico charlesworth <ch...@googlemail.com> wrote on 04/04/2009
> 07:03:09 AM:
>
> > chico charlesworth <ch...@googlemail.com>
> > 04/04/2009 07:03 AM
> >
> > Please respond to
> > shindig-dev@incubator.apache.org
> >
> > To
> >
> > shindig-dev@incubator.apache.org
> >
> > cc
> >
> > Subject
> >
> > Re: Implementing shindig-samples
> >
> > Hi Gary,
> >
> > Have you tried with a different database, e.g. hsqldb or mysql, or even
> > making sure the version of derby you are using is the latest?
> > My other thought would be to rewrite the JPQL query as two expressions
> and
> > see if that works?
> >
> > Cheers
> > Chico
> >
> > 2009/4/3 Gary Stevens <gs...@us.ibm.com>
> >
> > >
> > >
> > > Hello all,
> > >
> > > I have been trying to implement the data persistence samples included
> in
> > > Shindig and hit a problem.  I have set up a Derby\EclipseLink database
> with
> > > the canonical data loaded into it and have tried to point my Shindig at
> it
> > > instead of the canonicaldb.json file.  My setup uses the
> > > EclipseEntityManagerProvider class to create an implementation of
> > > EntityManager and hits a snag inside of JPQLUtils.java's
> getTotalResults
> > > method.  The query it builds starts "select count(*)..." and when I
> load my
> > > container I get a JPQL exception in my Eclipse console.  The message
> reads:
> > >
> > >     Syntax error parsing the query [select count(*)  from PersonDb p
> where
> > > p.objectId in (select f.friend.objectId from PersonDb p, FriendDb f
> where
> > > p.objectId = f.person.objectId and p.id in (?1)) ],
> > >      line 1, column 13: syntax error at [*].
> > >     Internal Exception: MismatchedTokenException(66!=70)
> > >
> > > From looking online, I am under the impression that the problem is a
> > > difference in syntax between SQL and JPA/JPQL - that you can use the
> > > annotation count(*) in SQL but not in JPQL because JPQL only allows one
> > > argument in count() but SQL allows multiple arguments.  Is this the
> > > problem, and I need to rewrite how the getTotalResults method assembles
> the
> > > query?  Or am I further away from having the persistence sample working
> > > than I think?  If anyone else who has played around with the included
> > > samples can offer any advice as well it would be greatly appreciated.
> > >
> > > Thank you,
> > > - Gary F Stevens
>

Re: Implementing shindig-samples

Posted by Gary Stevens <gs...@us.ibm.com>.
Chico,

I have not tried using any other databases, just tried manipulating the
test cases to generate databases using different the persistence-units
listed in persistence.xml plugged into the SpiEntityManagerFactory class.

I did try rewriting the query as two separate expressions and seemed to get
past the syntax error, but then I get errors about a missing column in the
AddressDb table called Address_Usage.  If I had to guess right now, that
error may be from the fact that the social-api project has changes that may
not yet be reflected in the samples project.  I have not dug very deep into
it yet.

I have also noticed when starting my Jetty server I see messages in the
Eclipse console about the org.eclipse.persistence.session.file and says the
version and build of the Eclipse Persistence Services (INFO: EclipseLink,
version: Eclipse Persistence Services - 1.0 (Build 1.0 - 20080707)).

Is there a setting somewhere in Shindig that I can change so that something
other than EclipseLink (say, Hibernate) loads in its place?

Thank you,
Gary F Stevens

chico charlesworth <ch...@googlemail.com> wrote on 04/04/2009
07:03:09 AM:

> chico charlesworth <ch...@googlemail.com>
> 04/04/2009 07:03 AM
>
> Please respond to
> shindig-dev@incubator.apache.org
>
> To
>
> shindig-dev@incubator.apache.org
>
> cc
>
> Subject
>
> Re: Implementing shindig-samples
>
> Hi Gary,
>
> Have you tried with a different database, e.g. hsqldb or mysql, or even
> making sure the version of derby you are using is the latest?
> My other thought would be to rewrite the JPQL query as two expressions
and
> see if that works?
>
> Cheers
> Chico
>
> 2009/4/3 Gary Stevens <gs...@us.ibm.com>
>
> >
> >
> > Hello all,
> >
> > I have been trying to implement the data persistence samples included
in
> > Shindig and hit a problem.  I have set up a Derby\EclipseLink database
with
> > the canonical data loaded into it and have tried to point my Shindig at
it
> > instead of the canonicaldb.json file.  My setup uses the
> > EclipseEntityManagerProvider class to create an implementation of
> > EntityManager and hits a snag inside of JPQLUtils.java's
getTotalResults
> > method.  The query it builds starts "select count(*)..." and when I
load my
> > container I get a JPQL exception in my Eclipse console.  The message
reads:
> >
> >     Syntax error parsing the query [select count(*)  from PersonDb p
where
> > p.objectId in (select f.friend.objectId from PersonDb p, FriendDb f
where
> > p.objectId = f.person.objectId and p.id in (?1)) ],
> >      line 1, column 13: syntax error at [*].
> >     Internal Exception: MismatchedTokenException(66!=70)
> >
> > From looking online, I am under the impression that the problem is a
> > difference in syntax between SQL and JPA/JPQL - that you can use the
> > annotation count(*) in SQL but not in JPQL because JPQL only allows one
> > argument in count() but SQL allows multiple arguments.  Is this the
> > problem, and I need to rewrite how the getTotalResults method assembles
the
> > query?  Or am I further away from having the persistence sample working
> > than I think?  If anyone else who has played around with the included
> > samples can offer any advice as well it would be greatly appreciated.
> >
> > Thank you,
> > - Gary F Stevens

Re: Implementing shindig-samples

Posted by chico charlesworth <ch...@googlemail.com>.
Hi Gary,

Have you tried with a different database, e.g. hsqldb or mysql, or even
making sure the version of derby you are using is the latest?
My other thought would be to rewrite the JPQL query as two expressions and
see if that works?

Cheers
Chico

2009/4/3 Gary Stevens <gs...@us.ibm.com>

>
>
> Hello all,
>
> I have been trying to implement the data persistence samples included in
> Shindig and hit a problem.  I have set up a Derby\EclipseLink database with
> the canonical data loaded into it and have tried to point my Shindig at it
> instead of the canonicaldb.json file.  My setup uses the
> EclipseEntityManagerProvider class to create an implementation of
> EntityManager and hits a snag inside of JPQLUtils.java's getTotalResults
> method.  The query it builds starts "select count(*)..." and when I load my
> container I get a JPQL exception in my Eclipse console.  The message reads:
>
>     Syntax error parsing the query [select count(*)  from PersonDb p where
> p.objectId in (select f.friend.objectId from PersonDb p, FriendDb f where
> p.objectId = f.person.objectId and p.id in (?1)) ],
>      line 1, column 13: syntax error at [*].
>     Internal Exception: MismatchedTokenException(66!=70)
>
> From looking online, I am under the impression that the problem is a
> difference in syntax between SQL and JPA/JPQL - that you can use the
> annotation count(*) in SQL but not in JPQL because JPQL only allows one
> argument in count() but SQL allows multiple arguments.  Is this the
> problem, and I need to rewrite how the getTotalResults method assembles the
> query?  Or am I further away from having the persistence sample working
> than I think?  If anyone else who has played around with the included
> samples can offer any advice as well it would be greatly appreciated.
>
> Thank you,
> - Gary F Stevens