[appengine-java] Object not persisted JDO

2009-11-02 Thread Julio Faerman

Hi,

I am trying to persist an object using JDO, but the object is not
beeing persisted to the datastore. Can anyone please help me
understand why?
Here is what i can see in the logs from the moment i .makePersistent()
to the point EM is closed:

[DataNucleus.Persistence] - Making object persistent :
br.com.ximp.vike.server.model.games.ww.ac...@1392743
[DataNucleus.Cache] - Object
br.com.ximp.vike.server.model.games.ww.ac...@1392743 
(id=org.datanucleus.identity.identityrefere...@6506f0)
added to Level 1 cache (loadedFlags=[YYY])
[DataNucleus.Transaction] - Outstanding nontx update being committed
to datastore
[DataNucleus.Transaction] - Transaction created [DataNucleus
Transaction, ID=Xid=
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Google App Engine for Java group.
To post to this group, send email to google-appengine-java@googlegroups.com
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en
-~--~~~~--~~--~--~---



[appengine-java] Re: Object not persisted JDO

2009-11-02 Thread Julio Faerman

Ops, i think the log got truncated.
I published it here: http://docs.google.com/View?id=ddqrb56f_348c58jq6hg


On Nov 2, 12:31 pm, Julio Faerman jfaer...@gmail.com wrote:
 Hi,

 I am trying to persist an object using JDO, but the object is not
 beeing persisted to the datastore. Can anyone please help me
 understand why?
 Here is what i can see in the logs from the moment i .makePersistent()
 to the point EM is closed:

 [DataNucleus.Persistence] - Making object persistent :
 br.com.ximp.vike.server.model.games.ww.ac...@1392743
 [DataNucleus.Cache] - Object
 br.com.ximp.vike.server.model.games.ww.ac...@1392743 
 (id=org.datanucleus.identity.identityrefere...@6506f0)
 added to Level 1 cache (loadedFlags=[YYY])
 [DataNucleus.Transaction] - Outstanding nontx update being committed
 to datastore
 [DataNucleus.Transaction] - Transaction created [DataNucleus
 Transaction, ID=Xid=
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Google App Engine for Java group.
To post to this group, send email to google-appengine-java@googlegroups.com
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en
-~--~~~~--~~--~--~---



[appengine-java] Problems with entity groups in transactions

2009-11-02 Thread Patrizio Munzi





Hi all,

I found another strange (unexpected behavior for me) with my two simple
Parent and Child classes and Entity Groups.
ASAIK in a transaction can be manipulated any object as long as they
belong to the same entity group.
Now, I cannot understand why I'm getting a Fatal exception when I try
to persist in a transaction an object for whom I set the encoded key as
child of the same parent.
Snippet in the following.

Hope, Someone can help!

Thanks

Here's the snippet and my classes:

-
SNIPPET --
    public void testTransactions()  {
        String parentId = "parent";
        String childId_1 = "child-1";
        String childId_2 = "child-2";

        PersistenceManager pm = PMF.get().getPersistenceManager();
        pm.currentTransaction().begin();
        Parent parent = new Parent();
        parent.setId(parentId);
        Child child = new Child();
        child.setId(childId_1);
        child.setValue(100);
        parent.setChild(child);
        pm.makePersistent(parent);
        pm.currentTransaction().commit();
        pm.close();

        pm = PMF.get().getPersistenceManager();
        pm.currentTransaction().begin();
        String parentEncodedKey =
KeyFactory.createKeyString(Parent.class.getSimpleName(), parentId);
        parent = pm.getObjectById(Parent.class, parentEncodedKey);
        assertEquals(100, parent.getChild().getValue());
        parent.getChild().setValue(1000);
        child = new Child();
        child.setId(childId_2);
        Key child2Key =
KeyFactory.createKey(KeyFactory.stringToKey(parentEncodedKey),
Child.class.getSimpleName(), childId_2);
        child.setEncodedKey(KeyFactory.keyToString(child2Key));
        child.setValue(10);
        pm.makePersistent(child);
        pm.makePersistent(parent);
        pm.currentTransaction().commit();
        pm.close();

        pm = PMF.get().getPersistenceManager();
        pm.currentTransaction().begin();        
        parentEncodedKey =
KeyFactory.createKeyString(Parent.class.getSimpleName(), parentId);
        parent = pm.getObjectById(Parent.class, parentEncodedKey);
        assertEquals(1000, parent.getChild().getValue());
        pm.currentTransaction().commit();
        pm.close();

    }        
---
 PARENT ---
@PersistenceCapable(identityType = IdentityType.APPLICATION)
public class Parent implements Serializable {

    private static final long serialVersionUID = -3051163582728562957L;

    @PrimaryKey
    @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
    @Extension(vendorName="datanucleus", key="gae.encoded-pk",
value="true")
    protected String encodedKey;

    @Persistent
    @Extension(vendorName="datanucleus", key="gae.pk-name",
value="true")
    private String id;
    
    @Persistent(defaultFetchGroup="true")
    @Element(dependent="true")
    private Child child;
    
    public String getEncodedKey() {
        return encodedKey;
    }

    public void setEncodedKey(String encodedKey) {
        this.encodedKey = encodedKey;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public Child getChild() {
        return child;
    }

    public void setChild(Child child) {
        this.child = child;
    }
    
}
---
--- CHILD 
@PersistenceCapable(identityType = IdentityType.APPLICATION)
public class Child implements Serializable {

    private static final long serialVersionUID = -3051163582728562957L;

    @PrimaryKey
    @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
    @Extension(vendorName="datanucleus", key="gae.encoded-pk",
value="true")
    protected String encodedKey;

    @Persistent
    @Extension(vendorName="datanucleus", key="gae.pk-name",
value="true")
    private String id;
    
    @Persistent
    private long value;
    
    public String getEncodedKey() {
        return encodedKey;
    }

    public void setEncodedKey(String encodedKey) {
        this.encodedKey = encodedKey;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public long getValue() {
        return value;
    }

    public void setValue(long value) {
        this.value = value;
    }
    
}
---


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Google App Engine for Java group.  To post to this group, send email to google-appengine-java@googlegroups.com  To unsubscribe from this group, send email to google-appengine-java+unsubscr...@googlegroups.com  For more options, visit this group at http://groups.google.com/group/google-appengine-java?hl=en
-~--~~~~--~~--~--~---





[appengine-java] does usage of buffered writer in servlet make sense

2009-11-02 Thread Raphael André Bauer

hey,


i am wondering if it makes sense to wrap the printwriter of a servlet
into a bufferedwriter. depending on the underlaying implementation
that can make sense imho, but i am not sure about the google app
engine... any recommendations?


thanks!


raphael

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Google App Engine for Java group.
To post to this group, send email to google-appengine-java@googlegroups.com
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en
-~--~~~~--~~--~--~---



[appengine-java] Re: Problems with entity groups in transactions

2009-11-02 Thread datanucleus

No idea if GAE/J's plugin supports this extension property but we
provide it in DataNucleus as a whole to only impose the value
strategy for the field when it is null (i.e not already set by the
user). Add this to the PK field that is being set

@Extension(vendorName=datanucleus, key=strategy-when-notnull ,
value=false)
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Google App Engine for Java group.
To post to this group, send email to google-appengine-java@googlegroups.com
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en
-~--~~~~--~~--~--~---



[appengine-java] Re: Using the Synchronous Interface

2009-11-02 Thread edarroyo

Yes, so that's just not suggested?

On Nov 2, 1:20 am, leszek leszek.ptokar...@gmail.com wrote:
 http://groups.google.com/group/Google-Web-Toolkit?pli=1

 But what do you want to achieve ?
 To call :
 SearchResult res = dataService.searchSomething(...)

 instead of

 dataServiceAsync.searchSomething(... new CallBack()); ?

 Rather impossible, you would block the browser until RPC returns.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Google App Engine for Java group.
To post to this group, send email to google-appengine-java@googlegroups.com
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en
-~--~~~~--~~--~--~---



[appengine-java] Re: Problems with entity groups in transactions

2009-11-02 Thread John Patterson
Not related to JDO but... parent-child relationships are really simple to
define with Twig... you don't need to use keys at all.  Just use a
@Entity(Parent) annotation or @Entity(Child) or you could even simply
declare that any field named parent is automatically set to the parent
object.

http://code.google.com/p/twig-persist/

Its an option if you don't need your code to run on another platform

2009/11/2 datanucleus andy_jeffer...@yahoo.com


 No idea if GAE/J's plugin supports this extension property but we
 provide it in DataNucleus as a whole to only impose the value
 strategy for the field when it is null (i.e not already set by the
 user). Add this to the PK field that is being set

 @Extension(vendorName=datanucleus, key=strategy-when-notnull ,
 value=false)
 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Google App Engine for Java group.
To post to this group, send email to google-appengine-java@googlegroups.com
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en
-~--~~~~--~~--~--~---



[appengine-java] Re: Problems with entity groups in transactions

2009-11-02 Thread datanucleus

Perhaps GAE/J doesn't respect that metadata extension tag then. Raise
a bug on their DataNucleus plugin for it.

 Not related to JDO but... parent-child relationships are really simple to
 define with Twig... you don't need to use keys at all.

FWIW You don't need Keys ***in JDO*** at all either ... when the JDO
interface is respected and implementation details don't leak out into
user space; keys should not be presented to the user IMHO. JDO is then
a very good option whether you want your code to run on another
platform or not.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Google App Engine for Java group.
To post to this group, send email to google-appengine-java@googlegroups.com
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en
-~--~~~~--~~--~--~---



[appengine-java] Other way to verify an GAE Account? SMS doesn't work for me

2009-11-02 Thread Nicolas Melendez
Hi, i am from argentina, and my cellphone company (which is call Claro),
doesn't recive international
SMS. i have tried for two days and a i can't verify my account.
Can someone from google help me,  please?

my cellphone is +54911589700139
my google account : *nfmelen...@gmail.com*

i really need it.
Thanks!
NM

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Google App Engine for Java group.
To post to this group, send email to google-appengine-java@googlegroups.com
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en
-~--~~~~--~~--~--~---



[appengine-java] ubuntu9.10 eclipse jee install Google Plugin for Eclipse error

2009-11-02 Thread ddawster zhang

Cannot complete the install because one or more required items could
not be found.
  Software being installed: Google Plugin for Eclipse 3.4
1.1.2.v200910130758
(com.google.gdt.eclipse.suite.e34.feature.feature.group
1.1.2.v200910130758)
  Missing requirement: Google Plugin for Eclipse 3.4
1.1.2.v200910130758
(com.google.gdt.eclipse.suite.e34.feature.feature.group
1.1.2.v200910130758) requires 'org.eclipse.platform.feature.group
[3.4.0,3.5.0)' but it could not be found

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Google App Engine for Java group.
To post to this group, send email to google-appengine-java@googlegroups.com
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en
-~--~~~~--~~--~--~---



[appengine-java] The Detroit Java User Group - Speakers

2009-11-02 Thread David McKinnon

Hello,

I organize the Detroit Java User Group.  We are looking for a speaker
with Google App Engine for Java experience.

We meet the third Wednesday of each month, 6:30PM to 8:30PM  in
Pleasant Ridge, MI at ePrize near the intersection of I-75 and
696. If anyone in the group is in Michigan or Ohio and would like
to give a talk, please let me know.


Cheers!
David McKinnon
www.detroitjug.org
www.1devday.org
@detroitjava

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Google App Engine for Java group.
To post to this group, send email to google-appengine-java@googlegroups.com
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en
-~--~~~~--~~--~--~---



[appengine-java] Problem with using Federated Login (OpenID + OAuth)

2009-11-02 Thread Pradheep A R


 Hello everyone,

 I am sure i am asking something that some one here knows the answer.

 I am trying to implement the OpenID client to authenticate my users
in
 the Google App Engine website and then use Google Accounts API to
 access their profile (All i want is to show their profile pics, show
 their contacts when they want to notify some information to their
 friends when they use my websitewww.letsvoteonline.com)
 I am using OpenID for Java library for this purpose. The problem here
 is i am getting the following exception.

 java.security.AccessControlException: access denied
 (java.lang.RuntimePermission modifyThreadGroup)
 at java.security.AccessControlContext.checkPermission(Unknown
Source)
 at java.security.AccessController.checkPermission(Unknown
Source)
 at java.lang.SecurityManager.checkPermission(Unknown Source)
 at com.google.appengine.tools.development.DevAppServerFactory
 $CustomSecurityManager.checkPermission(DevAppServerFactory.java:151)
 at com.google.appengine.tools.development.DevAppServerFactory
 $CustomSecurityManager.checkAccess(DevAppServerFactory.java:176)
 at java.lang.ThreadGroup.checkAccess(Unknown Source)
 at java.lang.Thread.init(Unknown Source)
 at java.lang.Thread.(Unknown Source)
 at
org.apache.commons.httpclient.MultiThreadedHttpConnectionManager
 $ReferenceQueueThread.(MultiThreadedHttpConnectionManager.java:1039)
 at
 
org.apache.commons.httpclient.MultiThreadedHttpConnectionManager.storeRefer
enceToConnection
 (MultiThreadedHttpConnectionManager.java:164)
 at
 
org.apache.commons.httpclient.MultiThreadedHttpConnectionManager.access
 $900(MultiThreadedHttpConnectionManager.java:64)
 at
org.apache.commons.httpclient.MultiThreadedHttpConnectionManager
 $ConnectionPool.createConnection
 (MultiThreadedHttpConnectionManager.java:750)
 at
 
org.apache.commons.httpclient.MultiThreadedHttpConnectionManager.doGetConne
ction
 (MultiThreadedHttpConnectionManager.java:469)
 at
 
org.apache.commons.httpclient.MultiThreadedHttpConnectionManager.getConnect
ionWithTimeout
 (MultiThreadedHttpConnectionManager.java:394)
 at
org.apache.commons.httpclient.HttpMethodDirector.executeMethod
 (HttpMethodDirector.java:152)
 at org.apache.commons.httpclient.HttpClient.executeMethod
 (HttpClient.java:396)
 at org.apache.commons.httpclient.HttpClient.executeMethod
 (HttpClient.java:324)
 at org.openid4java.util.HttpCache.head(HttpCache.java:296)
 at
org.openid4java.discovery.yadis.YadisResolver.retrieveXrdsLocation
 (YadisResolver.java:360)
 at org.openid4java.discovery.yadis.YadisResolver.discover
 (YadisResolver.java:229)
 at org.openid4java.discovery.yadis.YadisResolver.discover
 (YadisResolver.java:221)
 at org.openid4java.discovery.yadis.YadisResolver.discover
 (YadisResolver.java:179)
 at org.openid4java.discovery.Discovery.discover
(Discovery.java:134)
 at org.openid4java.discovery.Discovery.discover
(Discovery.java:114)
 at org.openid4java.consumer.ConsumerManager.discover
 (ConsumerManager.java:527)
 at letsvote.webapps.Letsvote_test1Servlet.authRequest
 (Letsvote_test1Servlet.java:170)
 at letsvote.webapps.Letsvote_test1Servlet.doGet
 (Letsvote_test1Servlet.java:93)
 at javax.servlet.http.HttpServlet.service(HttpServlet.java:
693)
 at javax.servlet.http.HttpServlet.service(HttpServlet.java:
806)
 at org.mortbay.jetty.servlet.ServletHolder.handle
(ServletHolder.java:
 487)
 at org.mortbay.jetty.servlet.ServletHandler
$CachedChain.doFilter
 (ServletHandler.java:1093)
 at
 com.google.apphosting.utils.servlet.TransactionCleanupFilter.doFilter
 (TransactionCleanupFilter.java:43)
 at org.mortbay.jetty.servlet.ServletHandler
$CachedChain.doFilter
 (ServletHandler.java:1084)
 at
com.google.appengine.tools.development.StaticFileFilter.doFilter
 (StaticFileFilter.java:121)
 at org.mortbay.jetty.servlet.ServletHandler
$CachedChain.doFilter
 (ServletHandler.java:1084)
 at org.mortbay.jetty.servlet.ServletHandler.handle
 (ServletHandler.java:360)
 at org.mortbay.jetty.security.SecurityHandler.handle
 (SecurityHandler.java:216)
 at org.mortbay.jetty.servlet.SessionHandler.handle
 (SessionHandler.java:181)
 at org.mortbay.jetty.handler.ContextHandler.handle
 (ContextHandler.java:712)
 at org.mortbay.jetty.webapp.WebAppContext.handle
(WebAppContext.java:
 405)
 at
com.google.apphosting.utils.jetty.DevAppEngineWebAppContext.handle
 (DevAppEngineWebAppContext.java:54)
 at org.mortbay.jetty.handler.HandlerWrapper.handle
 (HandlerWrapper.java:139)
 at
com.google.appengine.tools.development.JettyContainerService
 $ApiProxyHandler.handle(JettyContainerService.java:342)
 at org.mortbay.jetty.handler.HandlerWrapper.handle
 (HandlerWrapper.java:139)
 at 

[appengine-java] Re: PDF Generator Library

2009-11-02 Thread edragoev

Hello Jason,


I took Francois tweaks and also added support for PNG files that
doesn't depend on the AWT classes.

We have new GAE compatible Open Source version now:

http://pdfjet.com/os/download.html


Best Regards,

Eugene

P.S. The PNG decoder I wrote currently supports Truecolor PNG files
with Bit Depth 8 and paletted PNG files with Bit Depth 4 and 8.
Currently there is no support for grayscale images. If there is
interest we may add support for more types of PNG files and possibly
GIF support.


On Oct 7, 4:14 pm, Jason (Google) apija...@google.com wrote:
 Hi mably. Can you describe the tweaks you need to make in more detail? I'd
 like to add this to the Will it play in App Engine page.

 Thanks,
 - Jason

 On Tue, Oct 6, 2009 at 6:44 AM, mably fm2...@mably.com wrote:

  The PDFJet library seems to works fine on GAE after a few tweaks to
  replace files by streams.

  It's a quite low-level library but should be ok for simple tasks.

 http://www.pdfjet.com/os/edition.html

  On 28 sep, 19:09, Jason (Google) apija...@google.com wrote:
   You're correct. As far as I know, no one has been able to use
  JasperReports
   within App Engine because of the reliance on iText which in turn requires
   several AWT classes that aren't currently on the JRE class white list.

   - Jason

   On Thu, Sep 24, 2009 at 10:12 AM, mably fm2...@mably.com wrote:

Are you sure that JasperReports works fine on GAE ?

I thought it was using iText which doesn't seem to run on GAE (it
needs an unsupported patch).

Mian Rashid a écrit :
 Use can use Jasper Report and there is also designer tool available
 for that is IReport.

 On Sep 23, 6:57 pm, mably fm2...@mably.com wrote:
  Does anybody know of a java PDF generator library working with
  Google
  App Engine ?  Even a low-level one.

  Any help would be greatly appreciated.

  Thanx in advance.

  Francois
  Bordeaux, FRANCE

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Google App Engine for Java group.
To post to this group, send email to google-appengine-java@googlegroups.com
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en
-~--~~~~--~~--~--~---



[appengine-java] How not to Retain Values in development server?

2009-11-02 Thread Tito George

When ever i modify the PersistenceCapable classes i am getting error
due to mismatch in the persisted data. Is there any way for not
retaining data between sessions. In the jdoconfig i can see a property
like -- property name=javax.jdo.option.RetainValues value=true/.
What is this for, i tried setting it to false, but is not working.
Values are retained.

Tito

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Google App Engine for Java group.
To post to this group, send email to google-appengine-java@googlegroups.com
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en
-~--~~~~--~~--~--~---



[appengine-java] Re: JDO/JPA Snippets That Work - Creating a bidirectional, owned, one-to-many relationship

2009-11-02 Thread Solvek

Now. How to retrieve a book and its chapters having only Chapter's
title (imagine all titles in whole systems are unique)

On Sep 15, 1:07 am, Max Ross maxr+appeng...@google.com wrote:
 Hello hello and welcome to the very first installment of JDO/JPA Snippets
 That Work!

 Creating A Bidrectional Owned One-To-Many

 Suppose you're building a book catalog application and you want to model
 books and chapters.  Books contain chapters.  A chapter cannot exist without
 a book, so if you delete a book you want its chapters automatically deleted
 along with it.  You also want to each chapter to have a reference to the
 book that owns it.  Sounds like a bidrectional, owned, one-to-many
 relationship is just the thing.  First we'll set up our model objects and
 then we'll add some code to create a Book with 2 Chapters.

 JPA:
 @Entity
 public class Book {
     @Id
     @GeneratedValue(strategy=GenerationType.IDENTITY)
     private Key id;

     private String title;

     @OneToMany(mappedBy = book, cascade = CascadeType.ALL)
     private ListChapter chapters = new ArrayListChapter();

     // getters and setters

 }

 @Entity
 public class Chapter {
     @Id
     @GeneratedValue(strategy=GenerationType.IDENTITY)
     private Key id;

     private String title;
     private int numPages;

     @ManyToOne(fetch = FetchType.LAZY)
     private Book book;

     // getters and setters

 }

 Now let's create a book with two chapters (we'll assume someone else is
 creating and closing an EntityManager named 'em' for us):

 Book b = new Book();
 b.setTitle(JPA 4eva);
 Chapter c1 = new Chapter();
 c1.setTitle(Intro);
 c1.setNumPages(10);
 b.getChapters().add(c1);
 Chapter c2 = new Chapter();
 c2.setTitle(Configuration);
 c2.setNumPages(9);
 b.getChapters().add(c2);

 em.getTransaction().begin();
 try {
     em.persist(b);
     em.getTransaction().commit();} finally {

     if (em.getTransaction().isActive()) {
         em.getTransaction().rollback();
     }

 }

 JDO:

 @PersistenceCapable(identityType = IdentityType.APPLICATION, detachable =
 true)
 public class Book {

     @PrimaryKey
     @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
     private Key id;

     private String title;

     @Persistent(mappedBy = book)
     @Element(dependent = true)
     private ListChapter chapters = new ArrayListChapter();

     // getters and setters

 }

 @PersistenceCapable(identityType = IdentityType.APPLICATION, detachable =
 true)
 public class Chapter {
     @PrimaryKey
     @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
     private Key id;

     private String title;
     private int numPages;

     @Persistent
     private Book book;

     // getters and setters

 }

 Now let's create a book with two chapters (we'll assume someone else is
 creating and closing a PersistenceManager named 'pm' for us):

 Book b = new Book();
 b.setTitle(JDO 4eva);
 Chapter c1 = new Chapter();
 c1.setTitle(Intro);
 c1.setNumPages(10);
 b.getChapters().add(c1);
 Chapter c2 = new Chapter();
 c2.setTitle(Configuration);
 c2.setNumPages(9);
 b.getChapters().add(c2);

 pm.currentTransaction().begin();
 try {
     pm.makePersistent(b);
     pm.currentTransaction().commit();} finally {

     if (pm.currentTransaction().isActive()) {
         pm.currentTransaction().rollback();
     }

 }

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Google App Engine for Java group.
To post to this group, send email to google-appengine-java@googlegroups.com
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en
-~--~~~~--~~--~--~---



[appengine-java] Re: implementing GAE XMPP service as an external component to an existing XMPP server (e.g. ejabberd or OpenFire)

2009-11-02 Thread Jason (Google)
App Engine uses standard XMPP federation to send messages to other XMPP
servers.

- Jason

On Wed, Oct 28, 2009 at 11:38 PM, asianCoolz second.co...@gmail.com wrote:


 may i know what integration technique that you folks use to implement
 external component to an existing XMPP server (e.g. ejabberd or
 OpenFire) . Is it through sending xmpp message to another
 u...@externaldomain directly or using mechanism like urlfetch?
 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Google App Engine for Java group.
To post to this group, send email to google-appengine-java@googlegroups.com
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en
-~--~~~~--~~--~--~---



[appengine-java] Re: JDO/JPA Snippets That Work - Creating a bidirectional, owned, one-to-many relationship

2009-11-02 Thread John Patterson

Just to show how easy this sort of query and mapping is in Twig.   
Notice the lack of Keys - the Book id is optional.

public class Book {
 private long id;
 private String title;

 @Entity(Child)
 private ListChapter chapters = new ArrayListChapter();
}

The @Entity(Child) annotation applies to all the elements of the  
collection

public class Chapter {

 @Key
 private String title;
 private int numPages;

 @Entity(Parent)
 private Book book;
}

The Chapter title has been configured to be the key name so it is  
automatically encoded in the key.

Getting the book is as easy as:

session.find(Chapter.class, War and Peace).getBook()

Notice that because Twig was written from scratch using generics the  
result of find() is known to be a Chapter so we can then just call  
getBook() on the result.

http://code.google.com/p/twig-persist/

On 3 Nov 2009, at 00:03, Solvek wrote:


 Now. How to retrieve a book and its chapters having only Chapter's
 title (imagine all titles in whole systems are unique)

 On Sep 15, 1:07 am, Max Ross maxr+appeng...@google.com wrote:
 Hello hello and welcome to the very first installment of JDO/JPA  
 Snippets
 That Work!

 Creating A Bidrectional Owned One-To-Many

 Suppose you're building a book catalog application and you want to  
 model
 books and chapters.  Books contain chapters.  A chapter cannot  
 exist without
 a book, so if you delete a book you want its chapters automatically  
 deleted
 along with it.  You also want to each chapter to have a reference  
 to the
 book that owns it.  Sounds like a bidrectional, owned, one-to-many
 relationship is just the thing.  First we'll set up our model  
 objects and
 then we'll add some code to create a Book with 2 Chapters.

 JPA:
 @Entity
 public class Book {
 @Id
 @GeneratedValue(strategy=GenerationType.IDENTITY)
 private Key id;

 private String title;

 @OneToMany(mappedBy = book, cascade = CascadeType.ALL)
 private ListChapter chapters = new ArrayListChapter();

 // getters and setters

 }

 @Entity
 public class Chapter {
 @Id
 @GeneratedValue(strategy=GenerationType.IDENTITY)
 private Key id;

 private String title;
 private int numPages;

 @ManyToOne(fetch = FetchType.LAZY)
 private Book book;

 // getters and setters

 }

 Now let's create a book with two chapters (we'll assume someone  
 else is
 creating and closing an EntityManager named 'em' for us):

 Book b = new Book();
 b.setTitle(JPA 4eva);
 Chapter c1 = new Chapter();
 c1.setTitle(Intro);
 c1.setNumPages(10);
 b.getChapters().add(c1);
 Chapter c2 = new Chapter();
 c2.setTitle(Configuration);
 c2.setNumPages(9);
 b.getChapters().add(c2);

 em.getTransaction().begin();
 try {
 em.persist(b);
 em.getTransaction().commit();} finally {

 if (em.getTransaction().isActive()) {
 em.getTransaction().rollback();
 }

 }

 JDO:

 @PersistenceCapable(identityType = IdentityType.APPLICATION,  
 detachable =
 true)
 public class Book {

 @PrimaryKey
 @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
 private Key id;

 private String title;

 @Persistent(mappedBy = book)
 @Element(dependent = true)
 private ListChapter chapters = new ArrayListChapter();

 // getters and setters

 }

 @PersistenceCapable(identityType = IdentityType.APPLICATION,  
 detachable =
 true)
 public class Chapter {
 @PrimaryKey
 @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
 private Key id;

 private String title;
 private int numPages;

 @Persistent
 private Book book;

 // getters and setters

 }

 Now let's create a book with two chapters (we'll assume someone  
 else is
 creating and closing a PersistenceManager named 'pm' for us):

 Book b = new Book();
 b.setTitle(JDO 4eva);
 Chapter c1 = new Chapter();
 c1.setTitle(Intro);
 c1.setNumPages(10);
 b.getChapters().add(c1);
 Chapter c2 = new Chapter();
 c2.setTitle(Configuration);
 c2.setNumPages(9);
 b.getChapters().add(c2);

 pm.currentTransaction().begin();
 try {
 pm.makePersistent(b);
 pm.currentTransaction().commit();} finally {

 if (pm.currentTransaction().isActive()) {
 pm.currentTransaction().rollback();
 }

 }

 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Google App Engine for Java group.
To post to this group, send email to google-appengine-java@googlegroups.com
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en
-~--~~~~--~~--~--~---



[appengine-java] Re: No handlers matched this URL.

2009-11-02 Thread Kris

This turned out to be a simple problem. On the client, http://
localhost/adminpoll matches the servlet.

Once uploaded to GAE however, that URL no longer mathces - but http://
localhost/adminpoll/ does. (Note the trailing slash).

On Nov 1, 9:39 am, Kris krismat...@gmail.com wrote:
 I'm having some trouble after uploading my app. In my web.xml I have:

         servlet
                 servlet-namePoll/servlet-name
                 servlet-classcom.matthews.poll.Controller/servlet-class
         /servlet

         servlet-mapping
                 servlet-namePoll/servlet-name
                 url-pattern/adminpoll/*/url-pattern
         /servlet-mapping

 Anecdotally this works on my machine. When I upload it however, I'm
 greeted with a 404 and the following log message:

 W 11-01 07:30AM 56.854
 No handlers matched this URL.

 com.matthews.poll is a package I added to my eclipse project post
 creation (e.g. it's not the default one eclipse created for me). Do I
 need to do something special to get this package to upload to app
 engine? Can anyone point out something I'm doing wrong?

 Thanks :)
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Google App Engine for Java group.
To post to this group, send email to google-appengine-java@googlegroups.com
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en
-~--~~~~--~~--~--~---



[appengine-java] Re: JDO/JPA Snippets That Work - Updating a bidirectional, owned, one-to-many relationship with a new child

2009-11-02 Thread Max Ross (Google)
Looking in the debugger is not a good indication of what is and is not set
because jdo-enhanced classes perform lazy loading when the fields are
accessed.  If you call a getter method and System.out.println() the result
is it still null?  Feel free to send me your model objects and your
persistence code with some println()s showing me the problem and I'll have a
look.

Max

On Tue, Oct 27, 2009 at 5:28 PM, stanlick stanl...@gmail.com wrote:


 Hey Max --

 At what point are you validating this?  I am breaking after the commit
 and also after a subsequent query.execute().  Dude, it is about to
 make me jump off a bridge.

 P.S. I'm not a good swimmer, so please throw me a clue.

 Scott

 On Oct 27, 12:25 pm, Max Ross (Google) 
 maxr+appeng...@google.commaxr%2bappeng...@google.com
 
 wrote:
  At what point are you checking to see if the parent property of the child
 is
  populated?  I see that the newly created Chapter's Book property is
  populated when addChapterToBook() completes.
 
  Max
 
  On Tue, Oct 27, 2009 at 8:31 AM, stanlick stanl...@gmail.com wrote:
 
   This code saves the child for me, however, the parent property of the
   child (in your case book) is null in the child.  I have tried
   deliberately setting this child parent property myself to the parent
   prior to commit, but nothing seems to work.
 
   On Sep 28, 6:45 pm, Max Ross 
   maxr+appeng...@google.commaxr%2bappeng...@google.com
 maxr%2bappeng...@google.com maxr%252bappeng...@google.com
   wrote:
Hello again and welcome to Episode 3 of JDO/JPA Snippets That Work.
Today's
episode is called..
 
Updating A Bidrectional Owned One-To-Many With A New Child
 
All the way back in episode one we demonstrated how to create both a
   parent
and a child of a bidirectional, owned, one-to-many relationship
at the same time.  This week we're going to see how to add a child to
 an
existing parent.  We'll use the same model objects we used in episode
   one:
 
JPA:
@Entity
public class Book {
@Id
@GeneratedValue(strategy=GenerationType.IDENTITY)
private Key id;
 
private String title;
 
@OneToMany(mappedBy = book, cascade = CascadeType.ALL)
private ListChapter chapters = new ArrayListChapter();
 
// getters and setters
 
}
 
@Entity
public class Chapter {
@Id
@GeneratedValue(strategy=GenerationType.IDENTITY)
private Key id;
 
private String title;
private int numPages;
 
@ManyToOne(fetch = FetchType.LAZY)
private Book book;
 
// getters and setters
 
}
 
Now let's assume we've already created a book with a few chapters in
 the
datastore and we want to add a brand new chapter to a Book with a
 given
   id
(we'll assume someone else is creating and closing an EntityManager
 named
'em' for us):
 
public void addChapterToBook(EntityManager em, Key bookKey, Chapter
   chapter)
{
em.getTransaction().begin();
try {
Book b = em.find(Book.class, bookKey);
if (b == null) {
throw new RuntimeException(Book  + bookKey +  not
   found!);
}
b.getChapters().add(chapter);
em.getTransaction().commit();
} finally {
if (em.getTransaction().isActive()) {
em.getTransaction().rollback();
}
}
 
}
 
JDO:
 
@PersistenceCapable(identityType = IdentityType.APPLICATION,
 detachable =
true)
public class Book {
 
@PrimaryKey
@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
private Key id;
 
private String title;
 
@Persistent(mappedBy = book)
@Element(dependent = true)
@Order(extensions = @Extension(vendorName=datanucleus, key=
list-ordering, value=id asc))
private ListChapter chapters = new ArrayListChapter();
 
// getters and setters
 
}
 
@PersistenceCapable(identityType = IdentityType.APPLICATION,
 detachable =
true)
public class Chapter {
@PrimaryKey
@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
private Key id;
 
private String title;
private int numPages;
 
@Persistent
private Book book;
 
// getters and setters
 
}
 
Now let's assume we've already created a book with a few chapters in
 the
datastore and we want to add a brand new chapter to a Book with a
 given
   id
(we'll assume someone else is creating and closing a
 PersistenceManager
named 'pm' for us):
 
public void addChapterToBook(PersistenceManager pm, Key bookKey,
 Chapter
chapter) {
pm.currentTransaction().begin();
try {
// throws a runtime exception if book is not found
Book b = pm.getObjectById(Book.class, bookKey);
b.getChapters().add(chapter);

[appengine-java] Re: NullPointerException when adding relationship keys

2009-11-02 Thread Rusty Wright

Out comes the ruler to whack your knuckles; you're doing your testing and 
experimenting on the dev server.

It's really quite simple to do it on your desktop if you follow their 
instructions for unit testing.  And much faster; none of that uploading, 
waiting, etc.  Make a change, recompile, right click on package or java file 
and select Run as JUnit test (in eclipse).


dataStorm wrote:
 I don't think it made a difference, if I check the online datastore it
 says null for selectedTags. I think I am still missing
 something.
 
 Here is my other 'tags' class, not sure if it matters for my datastore
 relationship :
 
 
 ===
 
 
 
   @PrimaryKey
   @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY,
 defaultFetchGroup=true)
   private Key tagid;
 
   @Persistent(defaultFetchGroup= true)
   private SetKey selectedLinks;
 
 
   @Persistent
   private String tagname;
 
   @Persistent
   private Date date;
 
   public Tagstore(String tagname, Date date) {
 
   this.tagname = tagname;
   this.date = date;
   }
 
   public Key getId() {
   return tagid;
   }
 
 
   public String getKeyAsString() {
   if (tagid == null) return null;
   return KeyFactory.keyToString(tagid);
   }
 
 
   public String getTag() {
   return tagname;
   }
 
   public Date getDate() {
   return date;
   }
 
   public void setTag(String tagname) {
   this.tagname = tagname;
   }
 
   public void setDate(Date date) {
   this.date = date;
   }
 
 
 
 
 
 ===
 
 I'm putting defaultFetchGroup=true everywhere hoping it would
 help 
 
 
 ===
 
 
 On Nov 1, 9:11 pm, Rusty Wright rwright.li...@gmail.com wrote:
 Linkstore doesn't have a no-arg constructor does it?  If so, then 
 selectedTags could be null.  You could change its declaration to

 @Persistent(defaultFetchGroup = true)
 private SetKey selectedTags = new HashSetKey(0);

 I've always initialized my Collections at the declaration.

 Just for experimentation, try changing its declaration to that and see what 
 happens.

 WATCH OUT THOUGH: if you you're using eclipse you may have it configured to 
 add a final to fields and variables that are set when they're declared and 
 not subsequently written to.  If that happens then DataNucleus ignores final 
 fields.  (I wish I could change some setting to have DN throw an exception 
 in that situation.)

 dataStorm wrote:
 Hello, can someone help me with this, I am trying to follow this post
 http://code.google.com/appengine/docs/java/datastore/relationships.html
 to
 create relationship between LINKS and TAGS.
 I am getting an error:
 Caused by:
 java.lang.NullPointerException
at com.linkytty.Linkstore.addNewTag(Linkstore.java:101)
at com.linkytty.TagLinker.doPost(TagLinker.java:52)
 This happens when I try to add a key using .add()  :
 public void addNewTag(Key tagKey) {
 selectedTags.add(tagKey);
 }
 addNewTag() is called from my
 PersistenceManager pm = PMF.get().getPersistenceManager();
 Linkstore linkObject = pm.getObjectById(Linkstore.class, objectKey);
 linkObject.addNewTag(objectKey);
 I've logged my objectKey and etc. and it seems that it gets those
 right
 (
 String linkKeyId = req.getParameter(key);
 linkKeyID : aghsaW5reXR0eXIPCxIJTGlua3N0b3JlGAUM
 Key objectKey = KeyFactory.stringToKey(linkKeyId);
 objectKey: Linkstore(5)
 )
 My Classes:
 the class that creates links:
 public class Linkstore {
@PrimaryKey
@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
private Key linkid;
@Persistent(defaultFetchGroup = true)
private SetKey selectedTags;
 //STUFF HERE
public Linkstore(User author, String linkcontent, String linkcomment,
 Date
 date) {
this.author = author;
this.linkcontent = linkcontent;
this.linkcomment = linkcomment;
this.date = date;
selectedTags = new HashSetKey();
}
public Key getId() {
return linkid;
}
public String getKeyAsString() {
if (linkid == null)
return null;
return KeyFactory.keyToString(linkid);
}
// STUFF HERE
public void addNewTag(Key tagKey) {
selectedTags.add(tagKey);
}
 }
 The class that captures the post:
public void doPost(HttpServletRequest req, HttpServletResponse resp)
throws IOException {
String linkKeyId = req.getParameter(key);
Key objectKey = KeyFactory.stringToKey(linkKeyId);
String tagStringKey = req.getParameter(tagkey);
Key tagObjectKey = KeyFactory.stringToKey(tagStringKey);
PersistenceManager pm = PMF.get().getPersistenceManager();
Linkstore linkObject = pm.getObjectById(Linkstore.class, 
 objectKey);

[appengine-java] Re: ubuntu9.10 eclipse jee install Google Plugin for Eclipse error

2009-11-02 Thread Jason Parekh
Hey DDawster,

It looks like the Eclipse version included with Ubuntu 9.10 is Eclipse 3.5.
 You will need to use the 3.5 update site, which is
http://dl.google.com/eclipse/plugin/3.5 .

jason

On Sun, Nov 1, 2009 at 11:39 AM, ddawster zhang ddaws...@gmail.com wrote:


 Cannot complete the install because one or more required items could
 not be found.
  Software being installed: Google Plugin for Eclipse 3.4
 1.1.2.v200910130758
 (com.google.gdt.eclipse.suite.e34.feature.feature.group
 1.1.2.v200910130758)
  Missing requirement: Google Plugin for Eclipse 3.4
 1.1.2.v200910130758
 (com.google.gdt.eclipse.suite.e34.feature.feature.group
 1.1.2.v200910130758) requires 'org.eclipse.platform.feature.group
 [3.4.0,3.5.0)' but it could not be found

 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Google App Engine for Java group.
To post to this group, send email to google-appengine-java@googlegroups.com
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en
-~--~~~~--~~--~--~---



[appengine-java] Re: JDO/JPA Snippets That Work - Creating a bidirectional, owned, one-to-many relationship

2009-11-02 Thread Rusty Wright

That is very nice.

This isn't meant to rain on Twig's parade, but if you're going the JDO route 
you can also use generics to simplify things via a generic dao;

abstract class AbstractJdoDaoE extends JdoDaoSupport {
protected final transient Logger log = LoggerFactory.getLogger(getClass());

protected final ClassE entityClass;

AbstractJdoDao(final ClassE _entityClass, final PersistenceManagerFactory 
pmf) {
this.entityClass = _entityClass;

setPersistenceManagerFactory(pmf);
}

public E findById(final String id) {
final E result = 
getPersistenceManager().getObjectById(this.entityClass, id);


return (getPersistenceManager().detachCopy(result));
}

Then my FacilityDao starts with

@Repository
public class FacilityDao extends AbstractJdoDaoFacility {
/**
 * @param pmf
 */
@Autowired
public FacilityDao(final PersistenceManagerFactory pmf) {
super(Facility.class, pmf);
}

Notice how it passes the class it's working with, which is stored in the 
abstract dao as entityClass.

Still not as easy as Twig though!


John Patterson wrote:
 Just to show how easy this sort of query and mapping is in Twig.   
 Notice the lack of Keys - the Book id is optional.
 
 public class Book {
  private long id;
  private String title;
 
  @Entity(Child)
  private ListChapter chapters = new ArrayListChapter();
 }
 
 The @Entity(Child) annotation applies to all the elements of the  
 collection
 
 public class Chapter {
 
  @Key
  private String title;
  private int numPages;
 
  @Entity(Parent)
  private Book book;
 }
 
 The Chapter title has been configured to be the key name so it is  
 automatically encoded in the key.
 
 Getting the book is as easy as:
 
 session.find(Chapter.class, War and Peace).getBook()
 
 Notice that because Twig was written from scratch using generics the  
 result of find() is known to be a Chapter so we can then just call  
 getBook() on the result.
 
 http://code.google.com/p/twig-persist/
 
 On 3 Nov 2009, at 00:03, Solvek wrote:
 
 Now. How to retrieve a book and its chapters having only Chapter's
 title (imagine all titles in whole systems are unique)

 On Sep 15, 1:07 am, Max Ross maxr+appeng...@google.com wrote:
 Hello hello and welcome to the very first installment of JDO/JPA  
 Snippets
 That Work!

 Creating A Bidrectional Owned One-To-Many

 Suppose you're building a book catalog application and you want to  
 model
 books and chapters.  Books contain chapters.  A chapter cannot  
 exist without
 a book, so if you delete a book you want its chapters automatically  
 deleted
 along with it.  You also want to each chapter to have a reference  
 to the
 book that owns it.  Sounds like a bidrectional, owned, one-to-many
 relationship is just the thing.  First we'll set up our model  
 objects and
 then we'll add some code to create a Book with 2 Chapters.

 JPA:
 @Entity
 public class Book {
 @Id
 @GeneratedValue(strategy=GenerationType.IDENTITY)
 private Key id;

 private String title;

 @OneToMany(mappedBy = book, cascade = CascadeType.ALL)
 private ListChapter chapters = new ArrayListChapter();

 // getters and setters

 }

 @Entity
 public class Chapter {
 @Id
 @GeneratedValue(strategy=GenerationType.IDENTITY)
 private Key id;

 private String title;
 private int numPages;

 @ManyToOne(fetch = FetchType.LAZY)
 private Book book;

 // getters and setters

 }

 Now let's create a book with two chapters (we'll assume someone  
 else is
 creating and closing an EntityManager named 'em' for us):

 Book b = new Book();
 b.setTitle(JPA 4eva);
 Chapter c1 = new Chapter();
 c1.setTitle(Intro);
 c1.setNumPages(10);
 b.getChapters().add(c1);
 Chapter c2 = new Chapter();
 c2.setTitle(Configuration);
 c2.setNumPages(9);
 b.getChapters().add(c2);

 em.getTransaction().begin();
 try {
 em.persist(b);
 em.getTransaction().commit();} finally {

 if (em.getTransaction().isActive()) {
 em.getTransaction().rollback();
 }

 }

 JDO:

 @PersistenceCapable(identityType = IdentityType.APPLICATION,  
 detachable =
 true)
 public class Book {

 @PrimaryKey
 @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
 private Key id;

 private String title;

 @Persistent(mappedBy = book)
 @Element(dependent = true)
 private ListChapter chapters = new ArrayListChapter();

 // getters and setters

 }

 @PersistenceCapable(identityType = IdentityType.APPLICATION,  
 detachable =
 true)
 public class Chapter {
 @PrimaryKey
 @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
 private Key id;

 private String title;
 private int numPages;

 @Persistent
 private Book book;

 // getters and setters

 }

 Now let's create a book with two chapters (we'll assume someone  
 else is
 creating and closing a PersistenceManager named 'pm' for us):

 Book b = 

[appengine-java] Re: SimpleDS: an alternative for Datastore persistence

2009-11-02 Thread Stakka

One feature I see useful for a layer atop the Low-Level API is
asynchronization. Since you'll never know how much time a Low-Level
API call will take it should automatically create Tasks for them,
writes atleast.


On Oct 22, 10:37 am, Nacho Coloma icol...@gmail.com wrote:
 Hi all,

 We have been developing a persistence framework for the AppEngine
 Datastore based on the raw DatastoreService API. For our (simple)
 persistence case, both JDO and JPA were a bit overkill as we were
 spending a significant amount of time jumping through hoops to make
 our application roll, but at the same time the Datastore API was a too
 low-level solution to be usable.

 So we reinvented our wheel. In two days.

 SimpleDS is a light wrapper around the DatastoreService APIs that
 provide a simple interface for java persistent classes. It does not
 include fancy stuff or any super features, it's just the
 DatastoreService ported to a world where Java entities can be
 persisted directly (using a subset of JPA annotations).  This is _not_
 a JPA/JDO replacement, and will never be. But we have been using it
 for some weeks and are quite happy with it.

 Any kind of feedback from the AppEngine  community would be welcome.
 Before calling the typical but we already have JPA/JDO! argument,
 please notice the following:

 * There are lots of considerations in a relational database that do
 not apply to AppEngine. This allows a specific solution to be
 simplified big time. Just see the depth of your typical stack trace to
 understand what I am talking about.
 * Solutions can be designed for specific cases that are common
 practice in AppEngine but do not apply to a relational database. See,
 for example, saving entities with a parent instance.
 * Transactions also behave a bit differently, where a one size fits
 all approach would probably not be the best solution.

 To better ilustrate with an example, these are some typical tasks
 performed with SimpleDS:

 Retrieve instance:
 FooBar bar = entityManager.get(key);

 Transform from Google Datastore Entity to java and viceversa:
 Entity entity = entityManager.datastoreToJava(bar);

 Save generating a  primary key, with a parent instance:
 FooBar bar = new FooBar();
 entityManager.put(parentKey, bar);

 More can be seen here:http://code.google.com/p/simpleds/wiki/SimpleTasks

 Any discussion about the current API state is welcome. This entire
 thing was rolled in two days and tested in a couple of weeks so there
 should be some bugs in between.

 It is important to keep in mind the current list of limitations:

 * Only the Key class is a supported primary key.
 * IN and != are not supported (yet). I have big concerns about
 supporting this, performance-wise.
 * Relationships are not supported. You can use Keys and collections of
 Keys for that purpose.
 * Transactions are not yet included. We are not yet sure about how to
 proceed here.

 As I said, this is not conceived to become a feature-complete JPA
 replacement, so please don't treat it like that.

 Best regards,

 Nacho.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Google App Engine for Java group.
To post to this group, send email to google-appengine-java@googlegroups.com
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en
-~--~~~~--~~--~--~---



[appengine-java] error 500 from server when starting the guestbook demo app

2009-11-02 Thread Tomas

Hi I'm Tomas  - a newbe.

I get error 500 from server when trying a demo application to
according to instructions: 
http://code.google.com/appengine/docs/java/gettingstarted/installing.html
Response from localserver:8080 look here:
http://docs.google.com/Doc?docid=0Afhb3u6SCF24ZGN2cjN2cTNfM2ZwODkyN2Yyhl=en

what' wrong?

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Google App Engine for Java group.
To post to this group, send email to google-appengine-java@googlegroups.com
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en
-~--~~~~--~~--~--~---



[appengine-java] Re: RESTful- 503 Error

2009-11-02 Thread Jason (Google)
Can you print the full stack trace? Which class is not found?

- Jason

On Thu, Oct 29, 2009 at 1:12 AM, Shreyas Goel fenzo...@gmail.com wrote:


 I am trying to prepare an app using Restlets for GAE, however even
 after following instructions mentioned at
 http://wiki.restlet.org/docs_1.2/13-restlet/275-restlet/252-restlet.html
  downloading all the relevant files  doing changes as mentioned in
 http://wiki.restlet.org/developers/172-restlet/251-restlet/version/10.pdf.

 I am using Eclipse for the development  i have followed all the steps
 mentioned at
 http://wiki.restlet.org/developers/179-restlet/216-restlet.html.
 Even then i am getting errors:

 javax.servlet.UnavailableException:
 java.lang.ClassNotFoundException:

 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Google App Engine for Java group.
To post to this group, send email to google-appengine-java@googlegroups.com
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en
-~--~~~~--~~--~--~---



[appengine-java] Re: struts 2.1.8 met AccessControlException with app engine's local server

2009-11-02 Thread Rusty Wright

With Google App Engine your app can't write to the disk (by using files), it 
can only write to the Google data store.  You can read files that were in your 
war, but not write anything.  Perhaps Struts was trying to do some disk 
writing?  With Stripes (a superior alternative to Struts in my opinion) you 
need to provide a simple workaround for this because its multipart uploader 
interceptor (or something, I forget now) tries to create a file or directory 
when your app is loaded.

zhiw...@gmail.com wrote:
 i got the solution.  it was because i turn the devMode on
 
 constant name=struts.devMode value=true /
 
 when i delete it from struts.xml, every thing work well.
 
 isn't it a bug for struts 2.1.8 ?
 
 On Nov 1, 4:29 pm, zhiw...@gmail.com zhiw...@gmail.com wrote:
 oh my god.   i bulid a new web app and it runs well , does not throw
 that exception again.

 On Nov 1, 10:27 am, zhiw...@gmail.com zhiw...@gmail.com wrote:



 now i have to use 2.1.6 in my computer and replace the lib to 2.1.8
 when i update to app engine server
 On Oct 31, 10:56 pm, zhiw...@gmail.com zhiw...@gmail.com wrote:
 when i use struts 2.1.8 and app engine sdk 1.2.6(1.2.5 also the
 same)  ,   when web app start, it throw the exception
 java.security.AccessControlException: access denied
 (java.io.FilePermission jar:file:\F:\mysrc\Guestbook\build\web\WEB-INF
 \lib\struts2-core-2.1.8.1.jar read)
 at java.security.AccessControlContext.checkPermission
 (AccessControlContext.java:323)
 at java.security.AccessController.checkPermission
 (AccessController.java:546)
 at java.lang.SecurityManager.checkPermission(SecurityManager.java:
 532)
 at com.google.appengine.tools.development.DevAppServerFactory
 $CustomSecurityManager.checkPermission(DevAppServerFactory.java:139)
 at java.lang.SecurityManager.checkRead(SecurityManager.java:871)
 at java.util.zip.ZipFile.(ZipFile.java:109)
 at java.util.jar.JarFile.(JarFile.java:133)
 at java.util.jar.JarFile.(JarFile.java:70)  ..
 the exception happend  in local server  .  but  when i update my app
 to app engine server.  it runs well  .
 struts 2.1.6 didn't appear this,   but version 2.1.8 fixed some things
 that make struts-convention-plugin can work on app engine and also
 have offical json plugin.  so i have to  use v 2.1.8.
 i have read the   'Will it play in App Engine ' ,it does not have
 a solution.
  how can make struts 2.1.8 work well on local server? thanks  in
 advance!
  

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Google App Engine for Java group.
To post to this group, send email to google-appengine-java@googlegroups.com
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en
-~--~~~~--~~--~--~---



[appengine-java] Re: AppEngine, Crowd SingleSignOn, XFireFault access denied exception

2009-11-02 Thread Jason (Google)
Hi Stavros. App Engine's production sandbox does not permit applications or
any frameworks/libraries used to spawn new processes or threads:

http://code.google.com/appengine/docs/java/runtime.html#The_Sandbox

I'm not familiar with XFireFault so I can't offer any specific tips, but
some libraries enable you to disable threading, so you may want to pose this
question in their support channels.

- Jason

On Thu, Oct 29, 2009 at 6:52 AM, skounis skou...@gmail.com wrote:


 Hi all

 i try to use crowd as user authentication mechanism for app engine
 java applications.

 I have setup a Crowd instance and modify default GWT project (created
 by eclipe) to send username and password to this instance.

 To do that i use java libraries provided from Atlassian for Crowd.
 Those libraries do nothing more to handle SOAP request to (and from)
 crowd instance.

 Under eclipse everything works fine. I can successfully authorize the
 user and get users principal from Crowd.

 When i publish this GWT application to appengine, soap request to
 crowd instance is blocked.

 The error message is

 Could not invoke service.. Nested exception is
 org.codehaus.xfire.fault.XFireFault: access denied
 (java.lang.RuntimePermission modifyThreadGroup)

 Is something extra i have to configure to make this work?

 Let me notice that under eclipse everything works like a harm.

 Any idea?

 thank you in advance

 Stavros


 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Google App Engine for Java group.
To post to this group, send email to google-appengine-java@googlegroups.com
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en
-~--~~~~--~~--~--~---



[appengine-java] Re: SimpleDS: an alternative for Datastore persistence

2009-11-02 Thread Vince Bonfanti

You might be interested in my CachingDatastoreService class:

  
http://code.google.com/p/gaevfs/source/browse/trunk/src/com/newatlanta/appengine/datastore/CachingDatastoreService.java

It has the following features:

 - Implements the com.google.appengine.api.datastore.DatastoreService,
so it's a plug-in replacement for the standard implementation.
 - Automatically caches entities in memcache for datastore reads and writes.
 - Has a write-behind option (the default) that queues all datastore
writes as background tasks (except for transactions, which are always
write-through directly to the datastore).
 - A watchdog task makes sure the write-behind task is always available.
 - If the write-behind task isn't available, defaults to write-through
to insure no loss of data.
 - Supports configurable expiration of memcache entities (the default
is no expiration).

In order to use the CachingDatastoreService, first configure the
write-behind task in web.xml:

servlet
servlet-nameCachingDatastoreService/servlet-name

servlet-classcom.newatlanta.appengine.datastore.CachingDatastoreService/servlet-class
/servlet
servlet-mapping
servlet-nameCachingDatastoreService/servlet-name
url-pattern/_ah/queue/write-behind-task/url-pattern
/servlet-mapping

Then configure the write-behind-task queue in queue.xml (use whatever
rate you want):

queue
namewrite-behind-task/name
rate5/s/rate
/queue

Then replace the following code:

DatastoreService ds = DatastoreServiceFactory().getDatastoreService();

with this code, and then use the DatastoreService methods as you normally would:

DatastoreService ds = new CachingDatastoreService();

The default CachingDatastoreService constructor enables the
CacheOptions.WRITE_BEHIND option and sets the expiration to null (no
expiration). There are additional constructors that allow you to
specify CacheOptions.WRITE_THROUGH and/or specify a memcache
expiration value.

Vince

On Mon, Nov 2, 2009 at 2:21 PM, Stakka henrik.lindqv...@gmail.com wrote:

 One feature I see useful for a layer atop the Low-Level API is
 asynchronization. Since you'll never know how much time a Low-Level
 API call will take it should automatically create Tasks for them,
 writes atleast.


 On Oct 22, 10:37 am, Nacho Coloma icol...@gmail.com wrote:
 Hi all,

 We have been developing a persistence framework for the AppEngine
 Datastore based on the raw DatastoreService API. For our (simple)
 persistence case, both JDO and JPA were a bit overkill as we were
 spending a significant amount of time jumping through hoops to make
 our application roll, but at the same time the Datastore API was a too
 low-level solution to be usable.

 So we reinvented our wheel. In two days.

 SimpleDS is a light wrapper around the DatastoreService APIs that
 provide a simple interface for java persistent classes. It does not
 include fancy stuff or any super features, it's just the
 DatastoreService ported to a world where Java entities can be
 persisted directly (using a subset of JPA annotations).  This is _not_
 a JPA/JDO replacement, and will never be. But we have been using it
 for some weeks and are quite happy with it.

 Any kind of feedback from the AppEngine  community would be welcome.
 Before calling the typical but we already have JPA/JDO! argument,
 please notice the following:

 * There are lots of considerations in a relational database that do
 not apply to AppEngine. This allows a specific solution to be
 simplified big time. Just see the depth of your typical stack trace to
 understand what I am talking about.
 * Solutions can be designed for specific cases that are common
 practice in AppEngine but do not apply to a relational database. See,
 for example, saving entities with a parent instance.
 * Transactions also behave a bit differently, where a one size fits
 all approach would probably not be the best solution.

 To better ilustrate with an example, these are some typical tasks
 performed with SimpleDS:

 Retrieve instance:
 FooBar bar = entityManager.get(key);

 Transform from Google Datastore Entity to java and viceversa:
 Entity entity = entityManager.datastoreToJava(bar);

 Save generating a  primary key, with a parent instance:
 FooBar bar = new FooBar();
 entityManager.put(parentKey, bar);

 More can be seen here:http://code.google.com/p/simpleds/wiki/SimpleTasks

 Any discussion about the current API state is welcome. This entire
 thing was rolled in two days and tested in a couple of weeks so there
 should be some bugs in between.

 It is important to keep in mind the current list of limitations:

 * Only the Key class is a supported primary key.
 * IN and != are not supported (yet). I have big concerns about
 supporting this, performance-wise.
 * Relationships are not supported. You can use Keys and collections of
 Keys for that purpose.
 * Transactions are not yet included. We are not yet sure about how to
 proceed here.

 As I 

[appengine-java] Re: App Engine Refactoring / Adaptable Design

2009-11-02 Thread Jason (Google)
Hi Hans. Aside from the article on modeling entity relationships and the JDO
documentation, there aren't a lot of resources on http://code.google.com on
this subject, which is something we'll try to address going forward. You may
be able to find blog posts from other developers on this, but it's a
generally hard topic to write about in the abstract since needs vary so much
from app to app. I'm happy to help with specific questions you might have.

It sounds like you want to add a new kind (as opposed to a new property for
an existing kind) and establish a relationship with this new kind
(FundingOrganization) and an existing kind (Campaign). For many-to-many
relationships such as this, one approach you can take is similar to what you
might do for an RDBMS schema: introduce a new table (kind) to model the
relationship between FundingOrganization and Campaign entities. This third
kind would have only two properties, one storing a FundingOrganization Key
and the other a Campaign Key, then you can use it to query for all
FundingOrganization entities associated with a given Campaign and vice
versa. This approach doesn't require you to modify your Campaign kind at
all, so you don't necessarily need to make it aware of the
FundingOrganization kind, which was one of your requirements.

Let me know if this answers your question or if you have any other
questions.

- Jason

On Thu, Oct 29, 2009 at 1:55 PM, Hans gcbo...@gmail.com wrote:


 Hoping someone might help me with a somewhat OT question.

 I developed an object model for a GAE/J application that worked fairly
 well for awhile (and it was fun watching how easy it was to persist
 the instances to the datastore). But now I need to extend the model.
 Each Campaign instance I use needs to be related (many-to-many) with
 new FundingOrganization instances. I'm suspecting there may be other
 similar extensions I'll need to make to the model after the fact
 (additional categories associated with the Campaign).

 I can think of approaches to refactoring the application that include
 changing the Campaign class to know about FundingOrganization (http://
 code.google.com/appengine/docs/java/datastore/
 relationships.html#Unowned_Relationships), but I'd prefer to keep the
 entities pretty simple without adding a property for each new category
 that comes up.

 Can someone point this rookie to intro material/URLs for building and
 refactoring designs that lend themselves to these type of changes? I'm
 looking for info on adaptable design, especially when you're using a
 datastore and not using a RDBMS, junction tables, etc.

 thanks,
 Hans
 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Google App Engine for Java group.
To post to this group, send email to google-appengine-java@googlegroups.com
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en
-~--~~~~--~~--~--~---



[appengine-java] Re: read file

2009-11-02 Thread Jason (Google)
You should be able to read it if you put it in your war directory and
configure it as a resource file. I believe the second step is done
automatically -- all files are configured as both resource and static by
default, though you can override it by following the instructions at
http://code.google.com/appengine/docs/java/config/appconfig.html#Static_Files_and_Resource_Files
.

You should be able to read resource files using the same APIs that you use
to read files from disk in other Java application environments.

- Jason

On Thu, Oct 29, 2009 at 2:21 PM, Andreas Blomqvist 
blomqvist.andr...@gmail.com wrote:

 stupid question, but anyway

 I want to include a myData.csv file and read it from my app. Where do I put
 it ? and what is the path to the file when I read it in the code?

 Thanks


 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Google App Engine for Java group.
To post to this group, send email to google-appengine-java@googlegroups.com
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en
-~--~~~~--~~--~--~---



[appengine-java] Re: upload error

2009-11-02 Thread Jason (Google)
Are you still seeing this error? What's your application ID?

- Jason

On Thu, Oct 29, 2009 at 3:30 PM, Andreas Blomqvist 
blomqvist.andr...@gmail.com wrote:

 getting SEVERE: Version still not ready to serve, aborting.
 when I try and deploy. Did server rollbacks.  What could be wrong?



 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Google App Engine for Java group.
To post to this group, send email to google-appengine-java@googlegroups.com
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en
-~--~~~~--~~--~--~---



[appengine-java] Re: images over http

2009-11-02 Thread Jason (Google)
Just to clarify:

Your URL Fetch request for a given image on your server fails after 6
seconds even though you've configured the deadline to be the maximum 10
seconds, and you've tried serving the image from another App Engine servlet
as well and saw the same issue. Is this right?

Can you send me the image URL that you are trying to fetch?

- Jason

On Fri, Oct 30, 2009 at 2:11 AM, nicanor.babula nicanor.bab...@gmail.comwrote:


 First of all, thanks for your answer.
 I think further information is needed for you to understand my
 problem. The server which encounters this problem, practically takes
 as input some template pseudo-code, that contains references to images
 (like html img src=img url/), and generates some output based on
 that. In order to generate the output data, it has to download (via
 java.net.HTTPConnection) the images from the various urls and
 transform them. The problem is that already the first attempt to
 download an image times out under 10 secs, although I did
 setConnectTimeout(1).

 On Oct 29, 9:51 pm, Jason (Google) apija...@google.com wrote:
  Is the server on which your JPEG is hosted especially slow?

 The server where the JPEGs are hosted is not slow. In fact, as I
 mentioned above, I tried serving the images with an google app engine
 servlet, but the error still remains. I supposed than, that the issue
 is not on the server that serves the images.

  Note that the
  default timeout limit for URL Fetch requests is 5 seconds. You can
 increase
  this up to 10 by passing 1 (ms) into setConnectTimeout().
 Already did that, but the browser's ends after 6 seconds.
 
  Also keep in mind that your image will have to be smaller than 1 MB if
  you're planning to use it with the Images service or store it in the
  datastore.

 As I already mentioned, that is not a problem, as I tried retrieving
 the images from an application engine servlet.
 Besides, I am very aware about the limits specified in the docs.

 
  - Jason
 
  On Wed, Oct 28, 2009 at 8:37 AM, nicanor.babula 
 nicanor.bab...@gmail.comwrote:
 
 
 
   Hello everyone,
 
   I have somewhere on the net a servlet that serves jpeg images. In
   order to verify that it works I made a html page with:
   img src=http://myurl/servlet?id=123; /
   and the image is displayed well.
 
   Now, I am trying to create an GAE image object from the data arriving
   from that servlet. How can I do?
   So far I tried this code*[1], with a lot of variations, and I keep
   getting timeouts and The API call urlfetch.Fetch() took too long to
   respond and was cancelled. error message in my application's logs.
 
   Locally, in the development server, it works.
 
   I also tried storing this images in the datastore and serving them
   directly from GAE.
   Example of image url:http://almaoffice0.appspot.com/GetImage?id=24001
 
   Any ideas?
 
   *[1]: the code:
 
 ImagesService imagesService =
   ImagesServiceFactory.getImagesService();
  try {
  URL url = new URL(stringUrl);
  HttpURLConnection connection = (HttpURLConnection)
   url.openConnection();
  connection.setRequestMethod(GET);
  connection.setReadTimeout(0);
  connection.setRequestProperty(ContentType, image/
   jpeg);
  connection.setDoInput(true);
 
  if(connection.getResponseCode() ==
   HttpURLConnection.HTTP_OK){
  InputStream in = connection.getInputStream();
  byte[] imgData = new byte[in.available()];
  in.read(imgData);
  Image oldImg = ImagesServiceFactory.makeImage
   (imgData);
  Transform resize = ImagesServiceFactory.makeResize
   (oldImg.getWidth(), oldImg.getHeight());
   // I do an useless transformation, in order to force
   the conversion to jpeg
  return imagesService.applyTransform(resize, oldImg,
   ImagesService.OutputEncoding.JPEG);
  } else {
  throw new Exception(cannot retrieve image @  +
   stringUrl);
  }
 
 
 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Google App Engine for Java group.
To post to this group, send email to google-appengine-java@googlegroups.com
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en
-~--~~~~--~~--~--~---



[appengine-java] Re: Problem deploying app - Version not ready

2009-11-02 Thread Jason (Google)
Hi Jed. There was some deployment latency late last week, but this didn't
last very long, and everything should be up and running smoothly. Please let
me know if you continue to see this error and make sure to provide your
application ID in future posts.

- Jason

On Thu, Oct 29, 2009 at 4:04 PM, JedIrv jed...@gmail.com wrote:


 Hello,

 I'm in my first days of experimenting with Google App Engine and am
 getting an error when I try to deploy using the eclipse plugin.  My
 initial deploy went smoothly a couple of days ago, and several updates
 as well, but trying to redeploy now, I see the console output indicate
 some sort of connection issue develops:

 .
 .
 .
 Deploying new version.
 Will check again in 1 seconds.
 Will check again in 2 seconds.
 ...(falls back to waiting twice as long until it gets to 128)...
 Will check again in 128 seconds.
 Rolling back the update.
 javaj.lang.RuntimeException:  Version not ready.

 the stack trace in the log has this:

 Unable to update:
 java.lang.RuntimeException: Version not ready.
at com.google.appengine.tools.admin.AppVersionUpload.commit
 (AppVersionUpload.java:361)
at com.google.appengine.tools.admin.AppVersionUpload.doUpload
 (AppVersionUpload.java:114)
at com.google.appengine.tools.admin.AppAdminImpl.update
 (AppAdminImpl.java:56)
at
 com.google.appengine.eclipse.core.proxy.AppEngineBridgeImpl.deploy
 (AppEngineBridgeImpl.java:271)
at
 com.google.appengine.eclipse.core.deploy.DeployProjectJob.runInWorkspace
 (DeployProjectJob.java:148)
at org.eclipse.core.internal.resources.InternalWorkspaceJob.run
 (InternalWorkspaceJob.java:38)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)

 yet, my admin console log page indicates the update went ok (or at
 least no problem is indicated).  Checking the url reveals the update
 did not succeed.

 Any help would be greatly appreciated!

 Jed

 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Google App Engine for Java group.
To post to this group, send email to google-appengine-java@googlegroups.com
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en
-~--~~~~--~~--~--~---



[appengine-java] Re: first Wave Robot

2009-11-02 Thread Jason (Google)
You may want to post this in the Wave developers discussion group as well:

http://groups.google.com/group/google-wave-api

- Jason

On Thu, Oct 29, 2009 at 11:39 AM, VTR vtrraviku...@gmail.com wrote:


 Hi ,

 I just downloaded the eclipse IDE and was trying the first Wave Robot.
 But seem to be getting the messages twice everytime this robot is
 added in a wave


 vtrraviku...@appspot.com:

  I'm alive!I'm alive!

 12:55 am

 vtrraviku...@appspot.com:

  Good Evening, everybody!!Good Evening, everybody!!

 Did anyone else see similar behaviour

 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Google App Engine for Java group.
To post to this group, send email to google-appengine-java@googlegroups.com
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en
-~--~~~~--~~--~--~---



[appengine-java] Re: RPC SerializationException if detachable=true

2009-11-02 Thread Jason (Google)
It looks like returning the list of detachable objects attempts to send a
list of generic Object instances over the wire. The Object class doesn't
implement Serializable so GWT will trigger an exception.

Try doing something like the following and see if the error goes away:

ListMySerializableClass myList = (ListMySerializableClass)
pm.detachCopyAll(results);
return myList;

Also note that you cannot return a List of query results directly since the
List class used to store the results doesn't implement Serializable either.
To get around this, you can create a new ArrayList or other Serializable
List, copy all of your result objects into it, and return this new list
instead.

- Jason

On Fri, Oct 30, 2009 at 6:52 AM, Patrizio Munzi patrizio.mu...@eris4.comwrote:

  Hi all,

 a strange thing happens when I try to serialize via RPC a list of
 PersitentCapable objects after having called detachCopyAll().
 If the PersistentCapable objects have the property detachable=true the
 serialization throw the following exception.
 Instead if the property detachable=true isn't set everything works fine.

 Do you have any idea what's the problem???

 Regards

 --
 SEVERE: [1256913851734000] javax.servlet.ServletContext log: Exception
 while dispatching incoming RPC call
 com.google.gwt.user.client.rpc.SerializationException: Type
 '[Ljava.lang.Object;' was not included in the set of types which can be
 serialized by this SerializationPolicy or its Class object could not be
 loaded. For security purposes, this type will not be serialized.
 at
 com.google.gwt.user.server.rpc.impl.StandardSerializationPolicy.validateSerialize(StandardSerializationPolicy.java:83)
 at
 com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter.serialize(ServerSerializationStreamWriter.java:591)
 at
 com.google.gwt.user.client.rpc.impl.AbstractSerializationStreamWriter.writeObject(AbstractSerializationStreamWriter.java:129)
 at
 com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter$ValueWriter$8.write(ServerSerializationStreamWriter.java:146)
 at
 com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter.serializeValue(ServerSerializationStreamWriter.java:530)
 at
 com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter.serializeClass(ServerSerializationStreamWriter.java:636)
 at
 com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter.serializeImpl(ServerSerializationStreamWriter.java:666)
 at
 com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter.serializeClass(ServerSerializationStreamWriter.java:648)
 at
 com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter.serializeImpl(ServerSerializationStreamWriter.java:666)
 at
 com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter.serialize(ServerSerializationStreamWriter.java:593)
 at
 com.google.gwt.user.client.rpc.impl.AbstractSerializationStreamWriter.writeObject(AbstractSerializationStreamWriter.java:129)
 at
 com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter$VectorWriter$8.write(ServerSerializationStreamWriter.java:247)
 at
 com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter.serializeArray(ServerSerializationStreamWriter.java:613)
 at
 com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter.serializeImpl(ServerSerializationStreamWriter.java:661)
 at
 com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter.serialize(ServerSerializationStreamWriter.java:593)
 at
 com.google.gwt.user.client.rpc.impl.AbstractSerializationStreamWriter.writeObject(AbstractSerializationStreamWriter.java:129)
 at
 com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter$ValueWriter$8.write(ServerSerializationStreamWriter.java:146)
 at
 com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter.serializeValue(ServerSerializationStreamWriter.java:530)
 at com.google.gwt.user.server.rpc.RPC.encodeResponse(RPC.java:573)
 at
 com.google.gwt.user.server.rpc.RPC.encodeResponseForSuccess(RPC.java:441)
 at
 com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:529)
 at
 com.google.gwt.user.server.rpc.RemoteServiceServlet.processCall(RemoteServiceServlet.java:166)
 at
 com.google.gwt.user.server.rpc.RemoteServiceServlet.doPost(RemoteServiceServlet.java:86)
 at javax.servlet.http.HttpServlet.service(HttpServlet.java:713)
 at javax.servlet.http.HttpServlet.service(HttpServlet.java:806)
 [...]
 --


 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Google App Engine for Java group.
To post to this group, send email to google-appengine-java@googlegroups.com
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com
For more options, visit this group at 

[appengine-java] Re: App Engine Refactoring / Adaptable Design

2009-11-02 Thread Hans

thanks Jason - I'll need to think more about how this would work in my
case.

It sounds like I'll be able to query that new kind (return all the
Campaign keys for a FundingOrganization of ABC) to get a collection
of keys. But then if I wanted to extract only the entities from that
result that meet certain criteria (Campaign.Duration  30) , I'll need
to do that outside of the query language.

I'm sure my questions reflect a newness to OOD. I do appreciate your
response.

Hans

On Nov 2, 3:27 pm, Jason (Google) apija...@google.com wrote:
 Hi Hans. Aside from the article on modeling entity relationships and the JDO

...


 It sounds like you want to add a new kind (as opposed to a new property for
 an existing kind) and establish a relationship with this new kind
 (FundingOrganization) and an existing kind (Campaign). For many-to-many
 relationships such as this, one approach you can take is similar to what you
 might do for an RDBMS schema: introduce a new table (kind) to model the
 relationship between FundingOrganization and Campaign entities. This third
 kind would have only two properties, one storing a FundingOrganization Key
 and the other a Campaign Key, then you can use it to query for all
 FundingOrganization entities associated with a given Campaign and vice
 versa. This approach doesn't require you to modify your Campaign kind at
 all, so you don't necessarily need to make it aware of the
 FundingOrganization kind, which was one of your requirements.

 Let me know if this answers your question or if you have any other
 questions.

 - Jason

 On Thu, Oct 29, 2009 at 1:55 PM, Hans gcbo...@gmail.com wrote:

  Hoping someone might help me with a somewhat OT question.

  I developed an object model for a GAE/J application that worked fairly

...

  Can someone point this rookie to intro material/URLs for building and
  refactoring designs that lend themselves to these type of changes? I'm
  looking for info on adaptable design, especially when you're using a
  datastore and not using a RDBMS, junction tables, etc.

  thanks,
  Hans


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Google App Engine for Java group.
To post to this group, send email to google-appengine-java@googlegroups.com
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en
-~--~~~~--~~--~--~---



[appengine-java] Re: JDO Best Practices

2009-11-02 Thread Jason (Google)
Hi Julio. Can you clarify what you mean by this statement:

If i change the code to the mail handler class, it works.

As Andy says, creating a new PersistenceManager isn't very expensive, so I
wouldn't store an instance in a static variable or worry about sharing an
instance with other classes -- just create one when you need it and close it
as soon as you're done. You should, on the other hand, make sure to only
load one PersistenceManagerFactory. I see you're using a static variable,
but you can also use a singleton:

http://code.google.com/appengine/docs/java/datastore/usingjdo.html#Getting_a_PersistenceManager_Instance

Please make sure you're closing your PersistenceManager after every
datastore operation -- I notice that you have commented out a few of your
close() calls in a few places. For what it's worth, this is what a typical
method in my own DAO looks like:

public void storeEvent(Event event) {
  PersistenceManager pm = PMF.get().getPersistenceManager();

  try {
pm.makePersistence(event);
  } finally {
pm.close();
  }
}

- Jason

On Fri, Oct 30, 2009 at 4:36 PM, Julio Faerman jfaer...@gmail.com wrote:


 Here is what the log reads:

 22:29:41,776 DEBUG [DataNucleus.Persistence] - Making object
 persistent : br.com.ximp.vike.server.model.games.ww.ac...@d4ddfd
 22:32:02,701 DEBUG [DataNucleus.Persistence] - ObjectManager
 internalFlush() process started - 1 dirty objects
 22:32:02,701 DEBUG [DataNucleus.Persistence] - ObjectManager
 internalFlush() process finished
 22:32:02,702 DEBUG [DataNucleus.Persistence] - Disconnecting
 br.com.ximp.vike.server.model.games.ww.ac...@d4ddfd from StateManager
 [pc=br.com.ximp.vike.server.model.games.ww.ac...@d4ddfd,
 lifecycle=P_NEW]
 22:32:02,703 DEBUG [DataNucleus.Persistence] - Object Manager
 org.datanucleus.objectmanageri...@1d4c2ba closed

 But the object (ac...@d4ddfd)  is not persisted on PM close.

 On Oct 30, 5:10 pm, datanucleus andy_jeffer...@yahoo.com wrote:
   - No error is logged
 
  As I already said, the log would tell you what happens. Sure you may
  have to set things to DEBUG level, but then you're supposed to be
  debugging so thats taken as read. As DN docs state very clearly non-tx
  updates will only be persisted to the datastore by a subsequent
  update, or pm close. All changes do get to the datastore when you
  close the PM
 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Google App Engine for Java group.
To post to this group, send email to google-appengine-java@googlegroups.com
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en
-~--~~~~--~~--~--~---



[appengine-java] Re: ClassCastException after changing PK from Long to String

2009-11-02 Thread Jason (Google)
Hi Peter. Do you have any existing entities in the datastore that were
stored before you made this change? If so, the exception is likely being
thrown when one of these entities is retrieved. Since you've changed the
primary key field, you may have to remove the original entity and re-add it.

You can inspect the data in your production datastore by signing in to the
Admin Console: http://appengine.google.com.

- Jason

On Fri, Oct 30, 2009 at 12:14 PM, pgoetz pgo...@pgoetz.de wrote:


 Hello Group!

 I hope you can help me with a ClassCastException in my web
 application. I refactored my entity classes (JDO) to use a String
 primary key instead of a Long. In my local environment everything
 works fine. But when I deploy the application to appspot.com, I get
 this exception:
 javax.servlet.ServletException: java.lang.ClassCastException: cannot
 assign instance of java.lang.Long to field
 de.pgoetz.jannalinda.jdo.User.id of type java.lang.String in instance
 of de.pgoetz.jannalinda.jdo.User
at com.google.apphosting.runtime.jetty.AppVersionHandlerMap.handle
 (AppVersionHandlerMap.java:240)
at org.mortbay.jetty.handler.HandlerWrapper.handle
 (HandlerWrapper.java:139)
at org.mortbay.jetty.Server.handle(Server.java:313)
at
 org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:
 506)
at org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete
 (HttpConnection.java:830)
at
 com.google.apphosting.runtime.jetty.RpcRequestParser.parseAvailable
 (RpcRequestParser.java:76)
at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:381)
at

 com.google.apphosting.runtime.jetty.JettyServletEngineAdapter.serviceRequest
 (JettyServletEngineAdapter.java:139)
at com.google.apphosting.runtime.JavaRuntime.handleRequest
 (JavaRuntime.java:239)
at com.google.apphosting.base.RuntimePb$EvaluationRuntime
 $6.handleBlockingRequest(RuntimePb.java:5135)
at com.google.apphosting.base.RuntimePb$EvaluationRuntime
 $6.handleBlockingRequest(RuntimePb.java:5133)
at com.google.net.rpc.impl.BlockingApplicationHandler.handleRequest
 (BlockingApplicationHandler.java:24)
at com.google.net.rpc.impl.RpcUtil.runRpcInApplication(RpcUtil.java:
 363)
at com.google.net.rpc.impl.Server$2.run(Server.java:814)
at com.google.tracing.LocalTraceSpanRunnable.run
 (LocalTraceSpanRunnable.java:56)
at com.google.tracing.LocalTraceSpanBuilder.internalContinueSpan
 (LocalTraceSpanBuilder.java:516)
at com.google.net.rpc.impl.Server.startRpc(Server.java:769)
at com.google.net.rpc.impl.Server.processRequest(Server.java:351)
at com.google.net.rpc.impl.ServerConnection.messageReceived
 (ServerConnection.java:437)
at com.google.net.rpc.impl.RpcConnection.parseMessages
 (RpcConnection.java:319)
at com.google.net.rpc.impl.RpcConnection.dataReceived
 (RpcConnection.java:290)
at com.google.net.async.Connection.handleReadEvent(Connection.java:
 436)
at com.google.net.async.EventDispatcher.processNetworkEvents
 (EventDispatcher.java:762)
at com.google.net.async.EventDispatcher.internalLoop
 (EventDispatcher.java:207)
at com.google.net.async.EventDispatcher.loop(EventDispatcher.java:
 101)
at com.google.net.rpc.RpcService.runUntilServerShutdown
 (RpcService.java:251)
at com.google.apphosting.runtime.JavaRuntime$RpcRunnable.run
 (JavaRuntime.java:396)
at java.lang.Thread.run(Unknown Source)
 Caused by: java.lang.ClassCastException: cannot assign instance of
 java.lang.Long to field de.pgoetz.jannalinda.jdo.User.id of type
 java.lang.String in instance of de.pgoetz.jannalinda.jdo.User
at
 java.io.ObjectStreamClass$FieldReflector.setObjFieldValues(Unknown
 Source)
at java.io.ObjectStreamClass.setObjFieldValues(Unknown Source)
at java.io.ObjectInputStream.defaultReadFields(Unknown Source)
at java.io.ObjectInputStream.readSerialData(Unknown Source)
at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
at java.io.ObjectInputStream.readObject0(Unknown Source)
at java.io.ObjectInputStream.defaultReadFields(Unknown Source)
at java.io.ObjectInputStream.readSerialData(Unknown Source)
at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
at java.io.ObjectInputStream.readObject0(Unknown Source)
at java.io.ObjectInputStream.readObject(Unknown Source)
at java.util.HashMap.readObject(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at java.io.ObjectStreamClass.invokeReadObject(Unknown Source)
at java.io.ObjectInputStream.readSerialData(Unknown Source)
at 

[appengine-java] Re: How to upload File from Client to Server

2009-11-02 Thread Jason (Google)
You might also be interested in this project, which handles the splitting
and persistence for you transparently:

http://code.google.com/p/gaevfs/

- Jason

On Thu, Oct 29, 2009 at 8:23 PM, le anh leanhduc1...@gmail.com wrote:


 Hi, everybody .
 I'm creating a web site by Google Appengine.
 In my web ,users can upload some files ( images , video ... ) to
 server .
 I use java language ,means this site is JSP pages .
 How can I do ?? How to write Code for uploading File from Client to
 Server ??
 Someone help me ??
 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Google App Engine for Java group.
To post to this group, send email to google-appengine-java@googlegroups.com
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en
-~--~~~~--~~--~--~---



[appengine-java] Re: Downloading and Uploading All Data for JAVA application...

2009-11-02 Thread Jason (Google)
This isn't available for Java just yet, but you can use the Python bulk
loader tool with your Java deployed apps. You may have to deploy remote_api
to a new version of your application using the Python SDK, but all versions
share the same datastore, so you can still download the original data stored
by your Java code, and similarly, any new entities you add this way can be
accessed using your Java code as well.

- Jason

On Fri, Oct 30, 2009 at 11:33 AM, Sanjith Chungath csanj...@gmail.comwrote:

 Hi All,
I found a topic Downloading and Uploading All Data under
 Python--Tools in google-appengine-docs-20090921'. I have java sdk
 downloaded and installed. So i dont have the file bulkloader.py with me.

- Is similar feature/ tool available for java?
- I can download the python SDK and use it, but is it possible to use
it in a Java application?

 -Sanjith

 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Google App Engine for Java group.
To post to this group, send email to google-appengine-java@googlegroups.com
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en
-~--~~~~--~~--~--~---



[appengine-java] Re: Data Store Indexes

2009-11-02 Thread Jason (Google)
Yes, that is the correct doc for the Java indexes.

Regarding your GQL query, the name of the kind is not the full name of the
class (including the package) but the simple name. So try using MDsIri
instead of com.col.server. MDsIri. You should be able to see any entities
you saved in the data viewer and the valid kind names are provided in the
drop down.

- Jason

On Fri, Oct 30, 2009 at 12:05 PM, Pion onlee2...@gmail.com wrote:


 I found this
 http://code.google.com/appengine/docs/java/datastore/queriesandindexes.html#Defining_Indexes_With_Configuration
 with the following example:
 ?xml version=1.0 encoding=utf-8?
 datastore-indexes
   xmlns=http://appengine.google.com/ns/datastore-indexes/1.0;
  autoGenerate=true
datastore-index kind=Person ancestor=false
property name=lastName direction=asc /
property name=height direction=desc /
/datastore-index
 /datastore-indexes

 But I still cannot solve my query error.

 On Oct 30, 9:34 am, Pion onlee2...@gmail.com wrote:
  I just deployedmy app to the GAE for the first time.
 
  I went to the Admin Console - DataStore - Indexes which says, You
  have not created indexes for this application. Some types of queries
  require an index to be built. You can manage your indexes in an
  index.yaml file. Learn more abouthttp://
 code.google.com/appengine/kb/general.html#indexes
  .
 
  http://code.google.com/appengine/kb/general.html#indexeslinks tohttp://
 code.google.com/appengine/docs/python/datastore/queriesandinde
  It seems to be Python specific.
 
  What's the corresponding one on Java? It seems to be on war\WEB-INF
  \appengine-generated\datastore-indexes.xml. Please correct me if I am
  wrong. My datastore-indexes.xml is empty.
 
  ?xml version=1.0 encoding=utf-8?
  datastore-indexes  autoGenerate=true
 
  /datastore-indexes
 
  Also, I didi the following:
 
  o Go to the Admin Console - DataStore - Data Viewer. It displays my
  low-level datastore contents.
  o Click the Query (using GQL). It displays SELECT * FROM
  com.col.server.MDsIri automatically by default.
  o Click Run Query button
  o It says, Invalid GQL query string.
 
  I suspect because I do not have any indexes yet.
 
  What are the syntax to populate datastore-indexes.xml so I can do the
  above query.
 
  Thanks in advance for your help.
 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Google App Engine for Java group.
To post to this group, send email to google-appengine-java@googlegroups.com
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en
-~--~~~~--~~--~--~---



[appengine-java] Re: JDO Unowned Relationship Issue

2009-11-02 Thread Jason (Google)
Ah, my apologies. I overlooked that he was using public field instead of a
getter.

- Jason

On Fri, Oct 30, 2009 at 11:07 AM, datanucleus andy_jeffer...@yahoo.comwrote:


   I'm not sure if method: employeeCheck.computerKeys.isEmpty())
   launches lazy loading.

  It should, but adding the annotation won't hurt.

 I don't see how it should. He's accessing a field directly. This has
 no way of being intercepted by JDO hence cannot load the field
 contents (no @PersistenceAware is evident). Accessing via a getter,
 makes sense.
 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Google App Engine for Java group.
To post to this group, send email to google-appengine-java@googlegroups.com
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en
-~--~~~~--~~--~--~---



[appengine-java] Error while uploading app to GAE

2009-11-02 Thread Vik
Hie

Today all of a sudden when i tried to deploy my app to GAE throws errors:
An internal error occurred during: Deploying SakshumWebProduction to
Google.
Received IOException parsing the input stream for
D:/eclipse/vskumar/workspace/SakshumWebProduction/war\WEB-INF/web.xml

The contents of web.xml are just fine. here it is:
?xml version=1.0 encoding=utf-8?
!DOCTYPE web-app PUBLIC
-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN
http://java.sun.com/dtd/web-app_2_3.dtd;

web-app xmlns=http://java.sun.com/xml/ns/javaee; version=2.5
servlet
servlet-namesakshumweb/servlet-name
servlet-classvik.sakshum.sakshumweb.SakshumWebServlet/servlet-class
/servlet
servlet-mapping
servlet-namesakshumweb/servlet-name
url-pattern/sakshumweb/ui/page/url-pattern
/servlet-mapping
welcome-file-list
welcome-fileindex.html/welcome-file
/welcome-file-list
/web-app

Thankx and Regards

Vik
Founder
www.sakshum.com
www.sakshum.blogspot.com

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Google App Engine for Java group.
To post to this group, send email to google-appengine-java@googlegroups.com
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en
-~--~~~~--~~--~--~---



[appengine-java] Re: SimpleDS: an alternative for Datastore persistence

2009-11-02 Thread Roy Smith
Hi Vince

Thanks for sharing.
I've modified my persistence framework to incorporate your class and it
works very well.

kind regards
Roy


On Mon, Nov 2, 2009 at 8:15 PM, Vince Bonfanti vbonfa...@gmail.com wrote:


 P.S. Because of issue 2097
 (http://code.google.com/p/googleappengine/issues/detail?id=2097), the
 write-behind task doesn't work on the development server, so it always
 defaults to write-through (which is a nice test of the watchdog
 mechanism). The write-behind task works fine on the production
 servers.

 On Mon, Nov 2, 2009 at 3:12 PM, Vince Bonfanti vbonfa...@gmail.com
 wrote:
  You might be interested in my CachingDatastoreService class:
 
 
 http://code.google.com/p/gaevfs/source/browse/trunk/src/com/newatlanta/appengine/datastore/CachingDatastoreService.java
 
  It has the following features:
 
   - Implements the com.google.appengine.api.datastore.DatastoreService,
  so it's a plug-in replacement for the standard implementation.
   - Automatically caches entities in memcache for datastore reads and
 writes.
   - Has a write-behind option (the default) that queues all datastore
  writes as background tasks (except for transactions, which are always
  write-through directly to the datastore).
   - A watchdog task makes sure the write-behind task is always available.
   - If the write-behind task isn't available, defaults to write-through
  to insure no loss of data.
   - Supports configurable expiration of memcache entities (the default
  is no expiration).
 
  In order to use the CachingDatastoreService, first configure the
  write-behind task in web.xml:
 
 servlet
 servlet-nameCachingDatastoreService/servlet-name
 
  
 servlet-classcom.newatlanta.appengine.datastore.CachingDatastoreService/servlet-class
 /servlet
 servlet-mapping
 servlet-nameCachingDatastoreService/servlet-name
 url-pattern/_ah/queue/write-behind-task/url-pattern
 /servlet-mapping
 
  Then configure the write-behind-task queue in queue.xml (use whatever
  rate you want):
 
 queue
 namewrite-behind-task/name
 rate5/s/rate
 /queue
 
  Then replace the following code:
 
 DatastoreService ds = DatastoreServiceFactory().getDatastoreService();
 
  with this code, and then use the DatastoreService methods as you normally
 would:
 
 DatastoreService ds = new CachingDatastoreService();
 
  The default CachingDatastoreService constructor enables the
  CacheOptions.WRITE_BEHIND option and sets the expiration to null (no
  expiration). There are additional constructors that allow you to
  specify CacheOptions.WRITE_THROUGH and/or specify a memcache
  expiration value.
 
  Vince
 
  On Mon, Nov 2, 2009 at 2:21 PM, Stakka henrik.lindqv...@gmail.com
 wrote:
 
  One feature I see useful for a layer atop the Low-Level API is
  asynchronization. Since you'll never know how much time a Low-Level
  API call will take it should automatically create Tasks for them,
  writes atleast.
 
 
  On Oct 22, 10:37 am, Nacho Coloma icol...@gmail.com wrote:
  Hi all,
 
  We have been developing a persistence framework for the AppEngine
  Datastore based on the raw DatastoreService API. For our (simple)
  persistence case, both JDO and JPA were a bit overkill as we were
  spending a significant amount of time jumping through hoops to make
  our application roll, but at the same time the Datastore API was a too
  low-level solution to be usable.
 
  So we reinvented our wheel. In two days.
 
  SimpleDS is a light wrapper around the DatastoreService APIs that
  provide a simple interface for java persistent classes. It does not
  include fancy stuff or any super features, it's just the
  DatastoreService ported to a world where Java entities can be
  persisted directly (using a subset of JPA annotations).  This is _not_
  a JPA/JDO replacement, and will never be. But we have been using it
  for some weeks and are quite happy with it.
 
  Any kind of feedback from the AppEngine  community would be welcome.
  Before calling the typical but we already have JPA/JDO! argument,
  please notice the following:
 
  * There are lots of considerations in a relational database that do
  not apply to AppEngine. This allows a specific solution to be
  simplified big time. Just see the depth of your typical stack trace to
  understand what I am talking about.
  * Solutions can be designed for specific cases that are common
  practice in AppEngine but do not apply to a relational database. See,
  for example, saving entities with a parent instance.
  * Transactions also behave a bit differently, where a one size fits
  all approach would probably not be the best solution.
 
  To better ilustrate with an example, these are some typical tasks
  performed with SimpleDS:
 
  Retrieve instance:
  FooBar bar = entityManager.get(key);
 
  Transform from Google Datastore Entity to java and viceversa:
  Entity entity = entityManager.datastoreToJava(bar);
 
  Save generating a  primary key, with a parent 

[appengine-java] Re: Data Store Indexes

2009-11-02 Thread Pion

Thanks Jason.

I tried the following:

 SELECT __key__ FROM MDsIri

Also,

 SELECT * FROM MDsIri

No more error. But it returns No results.

The Data Viewer shows that I have many entities.

http://code.google.com/appengine/docs/python/datastore/gqlreference.html
shows the following syntax:
SELECT [* | __key__] FROM kind
   [WHERE condition [AND condition ...]]
   [ORDER BY property [ASC | DESC] [, property [ASC |
DESC] ...]]
   [LIMIT [offset,]count]
   [OFFSET offset]


Why didn't I get any result?

On Nov 2, 4:15 pm, Jason (Google) apija...@google.com wrote:
 Yes, that is the correct doc for the Java indexes.

 Regarding your GQL query, the name of the kind is not the full name of the
 class (including the package) but the simple name. So try using MDsIri
 instead of com.col.server. MDsIri. You should be able to see any entities
 you saved in the data viewer and the valid kind names are provided in the
 drop down.

 - Jason

 On Fri, Oct 30, 2009 at 12:05 PM, Pion onlee2...@gmail.com wrote:

  I found this
 http://code.google.com/appengine/docs/java/datastore/queriesandindexe...
  with the following example:
  ?xml version=1.0 encoding=utf-8?
  datastore-indexes
    xmlns=http://appengine.google.com/ns/datastore-indexes/1.0;
   autoGenerate=true
     datastore-index kind=Person ancestor=false
         property name=lastName direction=asc /
         property name=height direction=desc /
     /datastore-index
  /datastore-indexes

  But I still cannot solve my query error.

  On Oct 30, 9:34 am, Pion onlee2...@gmail.com wrote:
   I just deployedmy app to the GAE for the first time.

   I went to the Admin Console - DataStore - Indexes which says, You
   have not created indexes for this application. Some types of queries
   require an index to be built. You can manage your indexes in an
   index.yaml file. Learn more abouthttp://
  code.google.com/appengine/kb/general.html#indexes
   .

  http://code.google.com/appengine/kb/general.html#indexeslinkstohttp://
  code.google.com/appengine/docs/python/datastore/queriesandinde
   It seems to be Python specific.

   What's the corresponding one on Java? It seems to be on war\WEB-INF
   \appengine-generated\datastore-indexes.xml. Please correct me if I am
   wrong. My datastore-indexes.xml is empty.

   ?xml version=1.0 encoding=utf-8?
   datastore-indexes  autoGenerate=true

   /datastore-indexes

   Also, I didi the following:

   o Go to the Admin Console - DataStore - Data Viewer. It displays my
   low-level datastore contents.
   o Click the Query (using GQL). It displays SELECT * FROM
   com.col.server.MDsIri automatically by default.
   o Click Run Query button
   o It says, Invalid GQL query string.

   I suspect because I do not have any indexes yet.

   What are the syntax to populate datastore-indexes.xml so I can do the
   above query.

   Thanks in advance for your help.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Google App Engine for Java group.
To post to this group, send email to google-appengine-java@googlegroups.com
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en
-~--~~~~--~~--~--~---



[appengine-java] Is it possible to set up a URL say example.com to one of the applications/ services I hosted on my domain.

2009-11-02 Thread VSSS

Hi All,

I want to set up a URL say www.example.com or example.com to one of
the services I hosted on my domain.
Is it possible to do URL forwarding for naked domains? I was able to
perform URL forwarding for other URL's such as site1.example.com. But,
is it possible to do it for www.example.com or example.com.

If yes, could you point me to some resources.

Thanks,
Shyam
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Google App Engine for Java group.
To post to this group, send email to google-appengine-java@googlegroups.com
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en
-~--~~~~--~~--~--~---



[appengine-java] Re: double your pleasure, double your fun

2009-11-02 Thread Rusty Wright

I figured out my problem.  At least I think I did.

In my @Before annotated setup() method, instead of using the original 
platformPc variable to verify what was persisted, I need to fetch its persisted 
golem and use that.  In the code below I have a bunch of log.debugs that are 
showing the sizes of things; below that are assertions.  I changed my assertion 
for the failing test to use the persisted platformPc as follows:

final Platform persistedPlatformPc = this.platformDao.findByName(pc);

Assert.assertEquals(waitlistEntry list size,
3, persistedPlatformPc.getWaitlistEntries().size());

This seems a little strange to me because I could swear that with Hibernate the 
original object was updated.  But maybe I'm misremembering that.


Rusty Wright wrote:
 with Wrigley's Doublemint gum.  In my case we're halving it at minimum.
 
 I added mappedBy to my @Persistent annotations and now things are 
 getting into the Set twice.  Very strange.  I can't figure out what I'm 
 doing wrong.
 
 In the following setup() I'm adding 3 WaitlistEntry objects but the Set 
 ends with 6.  The number of persisted WaitlistEntry objects is correctly 3.
 
 Here are the relevant (I hope) bits of the usual suspects and a pretty 
 printed version of the dump of waitlistEntries that shows the duplicates.
 
 The remaining sane parts of my brain thank you for your help.
 
 
 
 @PersistenceCapable(identityType = IdentityType.APPLICATION, detachable 
 = true)
 public class Platform implements Serializable, ComparablePlatform {
 
@PrimaryKey
@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
private Key id;
 
@Persistent
private String name;
 
@Persistent
private Short ordinal;
 
@Persistent
private Facility facility;
 
// mappedBy causes entries to be added twice
@Element(dependent = true)
@Persistent(defaultFetchGroup = true, mappedBy = platform)
private SetHost hosts = new HashSetHost(0);
 
// mappedBy causes entries to be added twice
@Element(dependent = true)
@Persistent(defaultFetchGroup = true, mappedBy = platform)
private SetWaitlistEntry waitlistEntries = new 
 HashSetWaitlistEntry(0);
 
 
 
 @PersistenceCapable(identityType = IdentityType.APPLICATION, detachable 
 = true)
 public class WaitlistEntry implements Serializable, 
 ComparableWaitlistEntry {
 
@PrimaryKey
@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
private Key id;
 
@Persistent
private Key userKey;
 
@Persistent
private Date entryTime;
 
@Persistent
private Platform platform;
 
 
 test
 
@Before
public void setup() throws Exception {
Assert.assertEquals(facilities entity count,
0, this.testUtils.entityCounter(Facility.class));
 
final Facility facility = new Facility(Abc Facility, 
 this.facilityName, false);
 
final Platform platformPc = new Platform(pc);
final Platform platformMac = new Platform(mac);
 
Assert.assertEquals(waitlistEntry list size,
0, platformPc.getWaitlistEntries().size());
 
final User user1 = new User(this.userName, Long.toString(111L));
final User user2 = new User(this.userName + 1, 
 Long.toString(222L));
final User user3 = new User(this.userName + 2, 
 Long.toString(333L));
 
platformPc.addWaitlistEntry(new 
 WaitlistEntry(this.userDao.makePersistent(user1)));
platformPc.addWaitlistEntry(new 
 WaitlistEntry(this.userDao.makePersistent(user2)));
platformPc.addWaitlistEntry(new 
 WaitlistEntry(this.userDao.makePersistent(user3)));
 
facility.addPlatform(platformPc);
facility.addPlatform(platformMac);
 
final Facility persistedFacility = 
 this.facilityDao.makePersistent(facility);
 
this.log.debug(waitlistEntries: {}, 
 platformPc.getWaitlistEntries());
 
this.log.debug(facilities entity count: {},
this.testUtils.entityCounter(Facility.class));
this.log.debug(user entity count: {},
this.testUtils.entityCounter(User.class));
this.log.debug(platform list size: {},
persistedFacility.getPlatforms().size());
this.log.debug(platform entity count: {},
this.testUtils.entityCounter(Platform.class));
this.log.debug(waitlistEntry list size: {},
platformPc.getWaitlistEntries().size());
this.log.debug(waitlistEntry entity count: {},
this.testUtils.entityCounter(WaitlistEntry.class));
 
 
 dao
 
public E makePersistent(final E entity) {
final E persisted = getPersistenceManager().makePersistent(entity);
 
return (getPersistenceManager().detachCopy(persisted));
}
 
 

[appengine-java] Issue with com.google.appengine.api.datastore.Text?

2009-11-02 Thread Tito George

Enviornment: Local
I have a Text field in one Persistent capable object,
@Persistent
private com.google.appengine.api.datastore.Text event_Description;

I am sure that i am not setting null into this field.
But while operating on queried object event_Description.getValue() is
throwing  NullPointerException. I am quering like this.

public static MapLong, Event getEvents(AppUser appUser){
PersistenceManager pm = 
PMF.getInstance().getPersistenceManager();
Query query = pm.newQuery(Event.class);
query.setFilter(email == pEmail);
query.declareParameters(String pEmail);
ListEvent result = null;
MapLong, Event eventsMap = null;
try {
result = (ListEvent) 
query.execute(appUser.getEmail());
eventsMap = new HashMapLong, Event();
for(Event e: result){
  //LINE TO REPLACE
eventsMap.put(e.getEvent_ID(), e);
}
} finally {
pm.close();
query.closeAll();
}
return eventsMap;
}

Its works fine if I replace above commented line(//LINE TO REPLACE)
with
String str = e.getEvent_Description();
or
sop(e.getEvent_Description());
or
e.getEvent_Description();

Any Comments???
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Google App Engine for Java group.
To post to this group, send email to google-appengine-java@googlegroups.com
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en
-~--~~~~--~~--~--~---



[appengine-java] Re: Error while uploading app to GAE

2009-11-02 Thread Rusty Wright

I don't know if this would be the problem but your dtd says 2.3 and 2_3 while 
the web-app tag says version=2.5.

Mine looks like this:

?xml version=1.0 encoding=ISO-8859-1?

web-app
id=WebApp_ID
version=2.5
xmlns=http://java.sun.com/xml/ns/javaee;
xmlns:web=http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd;
xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;
xsi:schemaLocation=
http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd;

display-namesample008-gae/display-name

listener
listener-class
org.springframework.web.context.ContextLoaderListener
/listener-class
/listener

blah / blah / blah /


Vik wrote:
 Hie
 
 Today all of a sudden when i tried to deploy my app to GAE throws errors:
 An internal error occurred during: Deploying SakshumWebProduction to 
 Google.
 Received IOException parsing the input stream for 
 D:/eclipse/vskumar/workspace/SakshumWebProduction/war\WEB-INF/web.xml
 
 The contents of web.xml are just fine. here it is:
 ?xml version=1.0 encoding=utf-8?
 !DOCTYPE web-app PUBLIC
 -//Sun Microsystems, Inc.//DTD Web Application 2.3//EN
 http://java.sun.com/dtd/web-app_2_3.dtd;
 
 web-app xmlns=http://java.sun.com/xml/ns/javaee; version=2.5
 servlet
 servlet-namesakshumweb/servlet-name
 servlet-classvik.sakshum.sakshumweb.SakshumWebServlet/servlet-class
 /servlet
 servlet-mapping
 servlet-namesakshumweb/servlet-name
 url-pattern/sakshumweb/ui/page/url-pattern
 /servlet-mapping
 welcome-file-list
 welcome-fileindex.html/welcome-file
 /welcome-file-list
 /web-app
 
 Thankx and Regards
 
 Vik
 Founder
 www.sakshum.com http://www.sakshum.com
 www.sakshum.blogspot.com http://www.sakshum.blogspot.com
 
  

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Google App Engine for Java group.
To post to this group, send email to google-appengine-java@googlegroups.com
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en
-~--~~~~--~~--~--~---



[appengine-java] Re: Issue with com.google.appengine.api.datastore.Text?

2009-11-02 Thread Rusty Wright

What happens if you change @Persistent to @Persistent(defaultFetchGroup = 
true)
?

Tito George wrote:
 Enviornment: Local
 I have a Text field in one Persistent capable object,
 @Persistent
 private com.google.appengine.api.datastore.Text event_Description;
 
 I am sure that i am not setting null into this field.
 But while operating on queried object event_Description.getValue() is
 throwing  NullPointerException. I am quering like this.
 
 public static MapLong, Event getEvents(AppUser appUser){
   PersistenceManager pm = 
 PMF.getInstance().getPersistenceManager();
   Query query = pm.newQuery(Event.class);
   query.setFilter(email == pEmail);
   query.declareParameters(String pEmail);
   ListEvent result = null;
   MapLong, Event eventsMap = null;
   try {
   result = (ListEvent) 
 query.execute(appUser.getEmail());
   eventsMap = new HashMapLong, Event();
   for(Event e: result){
 //LINE TO REPLACE
   eventsMap.put(e.getEvent_ID(), e);
   }
   } finally {
   pm.close();
   query.closeAll();
   }
   return eventsMap;
   }
 
 Its works fine if I replace above commented line(//LINE TO REPLACE)
 with
 String str = e.getEvent_Description();
 or
 sop(e.getEvent_Description());
 or
 e.getEvent_Description();
 
 Any Comments???
  

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Google App Engine for Java group.
To post to this group, send email to google-appengine-java@googlegroups.com
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en
-~--~~~~--~~--~--~---