Re: [appengine-java] Re: Is it possible to have collections of embedded objects?

2010-04-08 Thread Yasuo Higa
Hi John,

 If you want to be able to query on the embedded instances then you will need
 to use one of the datastore specific persistence interfaces: ObjectDatastore
 from Twig and Objectify support this... not sure if others support embedded
 collections.

Slim3 supports embedded collections as follows:

@Attribute(lob = true)
private ListEmbeddedChild Children;

See 
http://sites.google.com/site/slim3appengine/slim3-datastore/defining-data-classes/serializable-objects

Yasuo Higa

-- 
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-j...@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.



Re: [appengine-java] Re: Is it possible to have collections of embedded objects?

2010-04-08 Thread John Patterson


On 8 Apr 2010, at 13:51, Yasuo Higa wrote


Slim3 supports embedded collections as follows:

@Attribute(lob = true)
private ListEmbeddedChild Children;

See 
http://sites.google.com/site/slim3appengine/slim3-datastore/defining-data-classes/serializable-objects


Serializing is a bit different to embedding instances because the Blob  
is opaque and not able to be queried.  If you use @Embed in Twig or  
Objectify you can query for all Container instances by filtering on an  
embedded property.


e.g. Find all Bands with Albums that have sold over a million copies

class Band
{
@Embed ListAlbum albums
}

class Album
{
String name;
int sold.
}

datastore.find()
.type(Band.class)
.addFilter(albums.sold, GREATER_THAN, 100)
.returnResultsNow();

--
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-j...@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.



Re: [appengine-java] Re: Is it possible to have collections of embedded objects?

2010-04-08 Thread Yasuo Higa
Hi John, thanks for your clarification.

Current Slim3 does not support embedding instances like Twig/Objectify.

Yasuo Higa

 Serializing is a bit different to embedding instances because the Blob is
 opaque and not able to be queried.  If you use @Embed in Twig or Objectify
 you can query for all Container instances by filtering on an embedded
 property.

 e.g. Find all Bands with Albums that have sold over a million copies

 class Band
 {
       �...@embed ListAlbum albums
 }

 class Album
 {
        String name;
        int sold.
 }

 datastore.find()
        .type(Band.class)
        .addFilter(albums.sold, GREATER_THAN, 100)
        .returnResultsNow();

-- 
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-j...@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 to ensure object synchronization when using the datastore

2010-04-08 Thread mscwd01
Hey,

How do you ensure, once you have queried an object from the datastore,
that another call to that object cannot be made?
I basically have a bunch of objects with counters which get
incremented during each call to that object.

What I need to ensure is the object doesn't get called by two threads,
each of which increment the counter by 1 and persist the object back
to the datastore, only for the counter to be incremented by 1 and not
by 2.

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-j...@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 convert a user defined String key to a unique Long?

2010-04-08 Thread mscwd01
Hey,

As the title of this post suggests, is it possible to get a unique
Long id from a user defined String key?

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-j...@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 message after updating AppEngine in my project

2010-04-08 Thread dmitrygusev
The same here, I have several non-jar files in WEB-INF/lib (*.txt,
*.cmd) and see GAE fails to open them as ZIP.
Why would it try to open non-jar files as zip? Isn't this a bug?
This doesn't break development, but I get shocked when saw this first
time.
And now this really annoying starting up the app and see those stack
traces.

On 31 мар, 06:02, Rahul rahul.jun...@gmail.com wrote:
 Ikai,

 It doesn't break anything and neither does it stops from deploying but
 it just looks ugly and we might miss the real error if any during the
 deployment.

 Thanks,
 Rahul

 On Mar 30, 8:43 pm, Ikai L (Google) ika...@google.com wrote:

  Geo, what is the issue? Does it actually break anything? We'll investigate
  on our part, but if it doesn't actually prevent you from writing code
  there's absolutely no reason to downgrade.

  On Tue, Mar 30, 2010 at 2:19 PM, Geo gaki...@gmail.com wrote:
   Thanks Ikai, for looking into the root cause.  I am confronting this
   issue, and I am relatively new to the GAE  Eclipse plugin.  One of the
   post before said that they were able to solve the issue by switching
   back to 1.3.1, since I got this update using the eclipse software
   manager,

   how do I switch back now?

   Thanks,

   Geo

   On Mar 30, 12:31 pm, Ikai L (Google) ika...@google.com wrote:
I'll have to try to reproduce this. In the meantime, use svn export:

   http://svnbook.red-bean.com/en/1.0/re10.html

http://svnbook.red-bean.com/en/1.0/re10.htmlIf it turns out the
   .metadata
directory IS causing problems, we'll investigate what's causing this and
either issue a fix or possibly document a better workaround.

On Tue, Mar 30, 2010 at 12:09 AM, Spanishgringo freeman...@gmail.com
   wrote:

 Same problem for me as well. :(  Back to 1.3.1 until someone can share
 a fix...

 On Mar 30, 12:28 am, julianc julian.coom...@googlemail.com wrote:
  Similar problem here. Upgraded to 1.3.2 error, switched back to
  1.3.1 ... everything fine again.

  Mar 29, 2010 11:24:44 PM
  com.google.appengine.tools.info.LocalVersionFactory getVersion
  INFO: Could not find API version from 
  ../project/war/WEB-INF/lib/.svn
  java.util.zip.ZipException: error in opening zip file
          at java.util.zip.ZipFile.open(Native Method)
          at java.util.zip.ZipFile.init(ZipFile.java:114)
          at java.util.jar.JarFile.init(JarFile.java:133)
          at java.util.jar.JarFile.init(JarFile.java:97)
          at

   com.google.appengine.tools.util.ApiVersionFinder.findApiVersion(ApiVersionF
 inder.java:
  37)
          at

   com.google.appengine.tools.info.LocalVersionFactory.getVersion(LocalVersion
 Factory.java:
  65)
          at

   com.google.appengine.tools.info.UpdateCheck.getLocalVersion(UpdateCheck.jav
 a:
  112)
          at

   com.google.appengine.tools.info.UpdateCheck.checkForUpdates(UpdateCheck.jav
 a:
  91)
          at

   com.google.appengine.tools.info.UpdateCheck.doNagScreen(UpdateCheck.java:
  164)
          at

   com.google.appengine.tools.info.UpdateCheck.maybePrintNagScreen(UpdateCheck
 .java:
  132)
          at com.google.appengine.tools.development.DevAppServerMain
  $StartAction.apply(DevAppServerMain.java:150)
          at com.google.appengine.tools.util.Parser
  $ParseResult.applyArgs(Parser.java:48)
          at

   com.google.appengine.tools.development.DevAppServerMain.init(DevAppServer
 Main.java:
  113)
          at

   com.google.appengine.tools.development.DevAppServerMain.main(DevAppServerMa
 in.java:
  89)
  Mar 29, 2010 11:24:44 PM
   com.google.apphosting.utils.jetty.JettyLogger
  info
  INFO: Logging to JettyLogger(null) via
  com.google.apphosting.utils.jetty.JettyLogger
  Mar 29, 2010 11:24:44 PM
  com.google.apphosting.utils.config.AppEngineWebXmlReader
  readAppEngineWebXml
  INFO: Successfully processed 
  ../project/war/WEB-INF/appengine-web.xml
  Mar 29, 2010 11:24:44 PM
  com.google.apphosting.utils.config.AbstractConfigXmlReader
  readConfigXml

  On Mar 29, 7:04 pm, Ikai L (Google) ika...@google.com wrote:

   Not sure why this should be happening as the deploy script should
   be
   ignoring this, but is it possible for you to do an svn export to
 another
   directory prior to a deploy?

 --
 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-j...@googlegroups.com.
 To unsubscribe from this group, send email to
 google-appengine-java+unsubscr...@googlegroups.comgoogle-appengine-java%2bunsubscr...@googlegroups.com
   google-appengine-java%2bunsubscr...@googlegroups.comgoogle-appengine-java%252bunsubscr...@googlegroups.com

 .
 For more options, visit this group at

Re: [appengine-java] How to ensure object synchronization when using the datastore

2010-04-08 Thread John Patterson
You will need to read and update the object in a transaction which  
will throw an exception on commit if another thread updates the same  
entity.  You can then refresh the object and try again.  Also look  
into memcache which has an atomic counter increment method that is  
much faster than reading and writing to the datastore.  The downside  
is that the counts could be reset so you may need to periodically  
store them in the datastore.


On 8 Apr 2010, at 16:17, mscwd01 wrote:


Hey,

How do you ensure, once you have queried an object from the datastore,
that another call to that object cannot be made?
I basically have a bunch of objects with counters which get
incremented during each call to that object.

What I need to ensure is the object doesn't get called by two threads,
each of which increment the counter by 1 and persist the object back
to the datastore, only for the counter to be incremented by 1 and not
by 2.

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 
.




--
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-j...@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: How to ensure object synchronization when using the datastore

2010-04-08 Thread mscwd01
Thanks John. So basically the process should be:

- Query for the object inside a transaction
- Update the object counter
- Commit

- If commit fails - re-query the datastore for the same object?

Is it possible to just catch the exception and try committing the
object again or will I have to query the datastore for the object
again?

Also will it work when you query for a parent object and then update
the counter of a child object?

Thanks again.

On Apr 8, 10:33 am, John Patterson jdpatter...@gmail.com wrote:
 You will need to read and update the object in a transaction which  
 will throw an exception on commit if another thread updates the same  
 entity.  You can then refresh the object and try again.  Also look  
 into memcache which has an atomic counter increment method that is  
 much faster than reading and writing to the datastore.  The downside  
 is that the counts could be reset so you may need to periodically  
 store them in the datastore.

 On 8 Apr 2010, at 16:17, mscwd01 wrote:



  Hey,

  How do you ensure, once you have queried an object from the datastore,
  that another call to that object cannot be made?
  I basically have a bunch of objects with counters which get
  incremented during each call to that object.

  What I need to ensure is the object doesn't get called by two threads,
  each of which increment the counter by 1 and persist the object back
  to the datastore, only for the counter to be incremented by 1 and not
  by 2.

  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 
  athttp://groups.google.com/group/google-appengine-java?hl=en
  .

-- 
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-j...@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: ANN: Firefox add-on for tracking GAE estimated cost

2010-04-08 Thread Thomas
Does the X-AppEngine-Estimated-CPM-US-Dollars header appears only if
the application is using Google Account authentication scheme? I have
login as the administrator (developer of the web app), but have never
seen this response header.

-- 
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-j...@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: Adding Task-Queue Tasks in Batch?

2010-04-08 Thread Keith
I think the five limit still applies. If you want to run more than
five you
could run five tasks and structure them to enqueue further tasks once
they run.

On Apr 8, 4:41 am, Seth Ladd sethl...@gmail.com wrote:
 Thanks!

 If under a transaction, are tasks added via batch still constrained to
 5 per txn?

 On Apr 6, 11:53 am, Keith dunelmt...@googlemail.com wrote:



  Fromhttp://code.google.com/appengine/docs/java/javadoc/com/google/appengi...

  add(java.lang.IterableTaskOptions taskOptions)
            Submits tasks to this queue.

  On Apr 6, 9:54 am, Seth Ladd sethl...@gmail.com wrote: Aloha,

   The docs for the Java implementation of the Task Queue mentions this:

   maximum number of tasks that can be added in a batch - 100

   However, I can't find any reference to adding tasks in a batch.  What
   does the above mean, and where can I find more information about it?
   I'd like to be able to add many tasks in a batch, if that's
   possible.

   I am aware of the 5 tasks per transaction limit.

   Thanks!
   Seth

-- 
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-j...@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] Query returns unchanged data

2010-04-08 Thread danblack
Hello.
I'm using JPA for the App Engine datastore.
And I've got some problems.

I've got an entity Container than contains entities Item(s).
Here is my actions.
I start transaction then update entity then flush updates to database.
Then I get all entities of class Item(s) for a container which
contains my updated Item.
But the list of retrieved items contains Item that does not have my
changes.
What is wrong with my code???


I've modelled this problem. (see code)

@Entity
public class Container implements Serializable {

   private static final long serialVersionUID = 1L;

   @Id
   @GeneratedValue(strategy = GenerationType.IDENTITY)
   private Key key;

   @OneToMany(mappedBy = container, fetch = FetchType.LAZY)
   private ListItem items = new ArrayListItem();

   public void setKey(Key key) {
   this.key = key;
   }

   public Key getKey() {
   return key;
   }

   public void setItems(ListItem items) {
   this.items = items;
   }

   public ListItem getItems() {
   return items;
   }

}

@Entity
public class Item implements Serializable {

   private static final long serialVersionUID = 1L;

   @Id
   @GeneratedValue(strategy = GenerationType.IDENTITY)
   private Key key;

   @ManyToOne(fetch = FetchType.LAZY)
   private Container container;

   @Column
   private String value;

   public void setKey(Key key) {
   this.key = key;
   }

   public Key getKey() {
   return key;
   }

   public void setContainer(Container container) {
   this.container = container;
   }

   public Container getContainer() {
   return container;
   }

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

   public String getValue() {
   return value;
   }

   @Override
   public String toString() {
   return Item [key= + key + , value= + value + ];
   }
}

@Service(TestLocalService)
public class LocalService {

   protected final Log logger = LogFactory.getLog(getClass());


   public Key createContainer() {
   em.getTransaction().begin();
   Container container = new Container();
   em.persist(container);
   em.flush();
   logger.fatal(new container + container.getKey());
   em.getTransaction().commit();
   return container.getKey();
   }

   public Key generateItems(Key containerKey) {
   em.getTransaction().begin();
   Container container = em.find(Container.class,
containerKey);
   Key key = null;
   for (int i = 0; i  5; i++) {
   Item item = new Item();
   item.setContainer(container);
   item.setValue(Integer.toString(i));
   em.persist(item);
   em.flush();
   key = item.getKey();
   logger.fatal(new item + item);
   }
   em.getTransaction().commit();
   return key;
   }

   public void changeItems(Key containerKey, Key itemKey) {
   em.getTransaction().begin();
   Container container = em.find(Container.class,
containerKey);
   Item changedItem = em.find(Item.class, itemKey);
   changedItem.setValue(xxx); //
---
PROBLEM HERE
   em.flush();
   logger.fatal(changed item:  + changedItem);
   for (Item item : container.getItems()) {
   logger.fatal(list item:  + item); //
--- PROBLEM HERE (Item contains a
stale value of the field value)
   }
   em.getTransaction().commit();
   }

   public static void testListSync(LocalService service) {
   // MAIN TEST
   Key containerKey = service.createContainer();
   Key itemKey = service.generateItems(containerKey);
   service.changeItems(containerKey, itemKey);
   }
}


EXECUTION LOG

### CALL createContainer
datastore_v3.BeginTransaction
datastore_v3.Put
datastore_v3.Commit

## LOG createContainer
SEVERE: new containerContainer(684)

### CALL generateItems
datastore_v3.BeginTransaction
datastore_v3.Get
datastore_v3.Put
datastore_v3.Put
datastore_v3.Put
datastore_v3.Put
datastore_v3.Put
datastore_v3.Commit

### LOG generateItems
SEVERE: new itemItem [key=Container(684)/Item(685), value=0]
SEVERE: new itemItem [key=Container(684)/Item(686), value=1]
SEVERE: new itemItem [key=Container(684)/Item(687), value=2]
SEVERE: new itemItem [key=Container(684)/Item(688), value=3]
SEVERE: new itemItem [key=Container(684)/Item(689), value=4]

### CALL changeItems
datastore_v3.BeginTransaction
datastore_v3.Get
datastore_v3.Get

[appengine-java] Re: ANN: Firefox add-on for tracking GAE estimated cost

2010-04-08 Thread radomir
Yes, as far as I'm aware, the header is available only with Google
Account authentication.

Even when your application uses custom authentication, I guess you
could try providing an extra (hidden) login page for you (developer)
that will authenticate your session and allow you to collect cost
headers.


On Apr 8, 11:54 am, Thomas mylee...@gmail.com wrote:
 Does the X-AppEngine-Estimated-CPM-US-Dollars header appears only if
 the application is using Google Account authentication scheme? I have
 login as the administrator (developer of the web app), but have never
 seen this response header.

-- 
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-j...@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 app's ELResolver class

2010-04-08 Thread alesj
I tried all sorts of things -- implementing my own child-first
classloader,
then passing it around as Thread.getContextClassLoader,
creating my listeners and servlets with it, but w/o success.

The issue is, that JSF is already installed/deployed as part of custom
Jetty/GAE initialization,
hence my wrapped FacesServlet wasn't able to find proper factories --
 breaking at initialization.
Not wanting to go deeper into JSF, I stopped there.

Even if we by-passed this factory lookup, my guess is we would
encounter other EL related problems,
as I would suspect that GAE's EL classes would sometimes leak into our
code -- CCE.

On Apr 7, 8:21 pm, Joel Weight digitalj...@gmail.com wrote:
 I ran into this a few months ago when first getting jsf 2 going.
  Unfortunately I didn't find a resolution and wound up on the old EL
 version, so if you figure something out, please let us know.

 Thanks,
 Joel

 On Wed, Apr 7, 2010 at 5:10 AM, alesj ales.jus...@gmail.com wrote:
  While this finds the right jar

  URL url = cl.getResource(META-INF/maven/javax.el/el-api/
  pom.properties);
  String info = url.toExternalForm();
   System.out.println(info =  + info);
   // jar:file:/foobar/projects/foobar/trunk/server/target/
  foobar-server-0.0.1-SNAPSHOT/WEB-INF/lib/el-api-2.2.jar!/META-INF/
  maven/javax.el/el-api/pom.properties

  So we know the resources are there.

  --
  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-j...@googlegroups.com.
  To unsubscribe from this group, send email to
  google-appengine-java+unsubscr...@googlegroups.comgoogle-appengine-java%2bunsubscr...@googlegroups.com
  .
  For more options, visit this group at
 http://groups.google.com/group/google-appengine-java?hl=en.

-- 
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-j...@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] Object Manager has been closed on 2 synchronous requests

2010-04-08 Thread Arny
Hi,

I'm getting an JDO/Nucleus exception when running 2 synchronous
requests on different ids of an object:
org.datanucleus.exceptions.NucleusUserException: Object Manager has
been closed

---
This is how my getById looks like:

PersistenceManager pm = getPM();
Stream stream = null;
try {
Stream tmp = pm.getObjectById(Stream.class, id);
stream = pm.detachCopy(tmp);
} finally {
pm.close(); // here the exception occurs
}
return stream;

---

It works fine on single request, but fails on 2 or more.
anyone know how to get around this?

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-j...@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.



Re: [appengine-java] Re: having trouble implementing gwt in existing gae app

2010-04-08 Thread Raphael André Bauer
On Thu, Apr 8, 2010 at 3:56 AM, zackmac zack.macom...@gmail.com wrote:
 Anybody have any thoughts on what I could be missing?

 On Apr 5, 9:24 pm, zackmac zack.macom...@gmail.com wrote:
 I'm using Eclipse 3.4.1, GAE 1.3.1 and trying to use GWT 2.0.3.  I've
 been working on my GAE app some time and that's working well - just
 want to spice up the front-end a little.  I added a new GWT module,
 entry point class and HTML page from File - New and then copied the
 appropriate js head include in my existing index.jsp page, but I'm
 still getting Missing required argument 'module[s]'
 Google Web Toolkit 2.0.3.  When running the app, I right-click on my
 project and then go to Debug As and choose Java Application.  Then I


this is most likely wrong. there must be something like run as web
application (did you install the google plugin correctly?).

plus. this is a gwt question - most likely you will never get an answer here.
try the GWT mailing instead. they will help.


ra

 found the com.google.gwt.dev.DevMode app to run and then I get the
 Missing required argument 'module[s]' error.

 --
 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-j...@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.



-- 
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-j...@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.



Re: [appengine-java] Object Manager has been closed on 2 synchronous requests

2010-04-08 Thread bimbo jones
hi,

you should only close the persistence manager when your done.
This error occurs because you try to close it a second time.
Once you do the pm.close() all the data will be updated

2010/4/8 Arny arny...@googlemail.com

 Hi,

 I'm getting an JDO/Nucleus exception when running 2 synchronous
 requests on different ids of an object:
 org.datanucleus.exceptions.NucleusUserException: Object Manager has
 been closed

 ---
 This is how my getById looks like:

PersistenceManager pm = getPM();
Stream stream = null;
try {
Stream tmp = pm.getObjectById(Stream.class, id);
stream = pm.detachCopy(tmp);
} finally {
pm.close(); // here the exception occurs
}
return stream;

 ---

 It works fine on single request, but fails on 2 or more.
 anyone know how to get around this?

 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-j...@googlegroups.com.
 To unsubscribe from this group, send email to
 google-appengine-java+unsubscr...@googlegroups.comgoogle-appengine-java%2bunsubscr...@googlegroups.com
 .
 For more options, visit this group at
 http://groups.google.com/group/google-appengine-java?hl=en.



-- 
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-j...@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 Manager has been closed on 2 synchronous requests

2010-04-08 Thread Arny
Hmm, does it really matter even when using detached objects?
And aren't the persistence managers created individually on each
request?
I didn't know they are shared over many requests?

What's the best way to update about 20 objects synchronously using 20
asynch urlfetches?
It needs to be urlfetches, because the 20 objects are getting updates
from an urlfetch again.

Simple model:
- call 20 urls with individual ids
- each url gets an objects and gets its updates from another url

Any good solution for that?
Thanks

On Apr 8, 3:13 pm, bimbo jones bimbojone...@gmail.com wrote:
 hi,

 you should only close the persistence manager when your done.
 This error occurs because you try to close it a second time.
 Once you do the pm.close() all the data will be updated

 2010/4/8 Arny arny...@googlemail.com

  Hi,

  I'm getting an JDO/Nucleus exception when running 2 synchronous
  requests on different ids of an object:
  org.datanucleus.exceptions.NucleusUserException: Object Manager has
  been closed

  ---
  This is how my getById looks like:

                 PersistenceManager pm = getPM();
                 Stream stream = null;
                 try {
                         Stream tmp = pm.getObjectById(Stream.class, id);
                         stream = pm.detachCopy(tmp);
                 } finally {
                         pm.close(); // here the exception occurs
                 }
                 return stream;

  ---

  It works fine on single request, but fails on 2 or more.
  anyone know how to get around this?

  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-j...@googlegroups.com.
  To unsubscribe from this group, send email to
  google-appengine-java+unsubscr...@googlegroups.comgoogle-appengine-java%2bunsubscr...@googlegroups.com
  .
  For more options, visit this group at
 http://groups.google.com/group/google-appengine-java?hl=en.



-- 
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-j...@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 Manager has been closed on 2 synchronous requests

2010-04-08 Thread Arny
I could find my mistake.
Sorry for taking your time.

Thanks anyway!

On Apr 8, 3:24 pm, Arny arny...@googlemail.com wrote:
 Hmm, does it really matter even when using detached objects?
 And aren't the persistence managers created individually on each
 request?
 I didn't know they are shared over many requests?

 What's the best way to update about 20 objects synchronously using 20
 asynch urlfetches?
 It needs to be urlfetches, because the 20 objects are getting updates
 from an urlfetch again.

 Simple model:
 - call 20 urls with individual ids
 - each url gets an objects and gets its updates from another url

 Any good solution for that?
 Thanks

 On Apr 8, 3:13 pm, bimbo jones bimbojone...@gmail.com wrote:

  hi,

  you should only close the persistence manager when your done.
  This error occurs because you try to close it a second time.
  Once you do the pm.close() all the data will be updated

  2010/4/8 Arny arny...@googlemail.com

   Hi,

   I'm getting an JDO/Nucleus exception when running 2 synchronous
   requests on different ids of an object:
   org.datanucleus.exceptions.NucleusUserException: Object Manager has
   been closed

   ---
   This is how my getById looks like:

                  PersistenceManager pm = getPM();
                  Stream stream = null;
                  try {
                          Stream tmp = pm.getObjectById(Stream.class, id);
                          stream = pm.detachCopy(tmp);
                  } finally {
                          pm.close(); // here the exception occurs
                  }
                  return stream;

   ---

   It works fine on single request, but fails on 2 or more.
   anyone know how to get around this?

   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-j...@googlegroups.com.
   To unsubscribe from this group, send email to
   google-appengine-java+unsubscr...@googlegroups.comgoogle-appengine-java%2bunsubscr...@googlegroups.com
   .
   For more options, visit this group at
  http://groups.google.com/group/google-appengine-java?hl=en.



-- 
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-j...@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] Filter on float value in JDO query

2010-04-08 Thread Bert
Hi,

I'm trying to execute following query, which should return 3 values
but returns 0.
I think it's because pointsEarned is a float, but I don't know how to
solve it.

Query query = pm.newQuery(Answer.class);
query.setFilter(pointsEarned  0);
ListAnswer answers = (ListAnswer) query.execute();

There are 3 Answer entities in the datastore with pointsEarned = -1.0

Is there anyway to query like this  on a float field?

Regards

-- 
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-j...@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] Safe Harbor DPA compliant incremental backups of datastore

2010-04-08 Thread sampablokuper
I would welcome suggestions regarding ways of performing Safe Harbor
and Data Protection Act compliant incremental backups of an app's
datastore. Any ideas?

-- 
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-j...@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] JPA: How to use a String as Primary Key?

2010-04-08 Thread stsch77
I have tried to follow the documentation at

http://code.google.com/intl/de-DE/appengine/docs/java/datastore/creatinggettinganddeletingdata.html

but no matter what I try, I always get an error/an exception of
different kinds.

Already the simplest attempt comes up with an error. That's what i
have:

- - - - -

public class Person {

@Id
private String id;

- - - - -

...
person.setId(stsch);
EntityManager.persist(person);
...

- - - - -

==

java.lang.IllegalArgumentException: Cannot parse: stsch===
at
com.google.appengine.api.datastore.KeyFactory.stringToKey(KeyFactory.java:
192)
at
org.datanucleus.store.appengine.DatastoreRelationFieldManager.checkForParentSwitch(DatastoreRelationFieldManager.java:
201)
at
org.datanucleus.store.appengine.DatastoreFKListStoreSpecialization.updateElementFk(DatastoreFKListStoreSpecialization.java:
94)
at
org.datanucleus.store.mapped.scostore.FKListStore.updateElementFk(FKListStore.java:
254)
...
Caused by:
com.google.appengine.repackaged.com.google.common.util.Base64DecoderException:
invalid padding byte '=' at byte offset 5
at
com.google.appengine.repackaged.com.google.common.util.Base64.decode(Base64.java:
529)
at
com.google.appengine.repackaged.com.google.common.util.Base64.decodeWebSafe(Base64.java:
493)
at
com.google.appengine.api.datastore.KeyFactory.stringToKey(KeyFactory.java:
190)


What is necessary to use a String as Primary Key?

-- 
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-j...@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.



Re: [appengine-java] Is it possible to convert a user defined String key to a unique Long?

2010-04-08 Thread Ikai L (Google)
You could probably change the characters to integer values and concatenate
these, but you are going to get some BIG numbers.

Better solution still is probably to use KeyFactory to generate a unique
Key. What is it you are trying to do?

On Thu, Apr 8, 2010 at 2:19 AM, mscwd01 mscw...@gmail.com wrote:

 Hey,

 As the title of this post suggests, is it possible to get a unique
 Long id from a user defined String key?

 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-j...@googlegroups.com.
 To unsubscribe from this group, send email to
 google-appengine-java+unsubscr...@googlegroups.comgoogle-appengine-java%2bunsubscr...@googlegroups.com
 .
 For more options, visit this group at
 http://groups.google.com/group/google-appengine-java?hl=en.




-- 
Ikai Lan
Developer Programs Engineer, Google App Engine
http://googleappengine.blogspot.com | http://twitter.com/app_engine

-- 
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-j...@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.



Re: [appengine-java] Re: How to ensure object synchronization when using the datastore

2010-04-08 Thread Ikai L (Google)
Here's a blog post Max Ross wrote about optimistic locking using built in
features of JDO/JPA

On Thu, Apr 8, 2010 at 2:42 AM, mscwd01 mscw...@gmail.com wrote:

 Thanks John. So basically the process should be:

 - Query for the object inside a transaction
 - Update the object counter
 - Commit

 - If commit fails - re-query the datastore for the same object?

 Is it possible to just catch the exception and try committing the
 object again or will I have to query the datastore for the object
 again?

 Also will it work when you query for a parent object and then update
 the counter of a child object?

 Thanks again.

 On Apr 8, 10:33 am, John Patterson jdpatter...@gmail.com wrote:
  You will need to read and update the object in a transaction which
  will throw an exception on commit if another thread updates the same
  entity.  You can then refresh the object and try again.  Also look
  into memcache which has an atomic counter increment method that is
  much faster than reading and writing to the datastore.  The downside
  is that the counts could be reset so you may need to periodically
  store them in the datastore.
 
  On 8 Apr 2010, at 16:17, mscwd01 wrote:
 
 
 
   Hey,
 
   How do you ensure, once you have queried an object from the datastore,
   that another call to that object cannot be made?
   I basically have a bunch of objects with counters which get
   incremented during each call to that object.
 
   What I need to ensure is the object doesn't get called by two threads,
   each of which increment the counter by 1 and persist the object back
   to the datastore, only for the counter to be incremented by 1 and not
   by 2.
 
   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.comgoogle-appengine-java%2bunsubscr...@googlegroups.com
   .
   For more options, visit this group athttp://
 groups.google.com/group/google-appengine-java?hl=en
   .

 --
 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-j...@googlegroups.com.
 To unsubscribe from this group, send email to
 google-appengine-java+unsubscr...@googlegroups.comgoogle-appengine-java%2bunsubscr...@googlegroups.com
 .
 For more options, visit this group at
 http://groups.google.com/group/google-appengine-java?hl=en.




-- 
Ikai Lan
Developer Programs Engineer, Google App Engine
http://googleappengine.blogspot.com | http://twitter.com/app_engine

-- 
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-j...@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.



Re: [appengine-java] Re: How to ensure object synchronization when using the datastore

2010-04-08 Thread Ikai L (Google)
Oops. Link is here:

http://gae-java-persistence.blogspot.com/2009/10/optimistic-locking-with-version.html

On Thu, Apr 8, 2010 at 10:00 AM, Ikai L (Google) ika...@google.com wrote:

 Here's a blog post Max Ross wrote about optimistic locking using built in
 features of JDO/JPA


 On Thu, Apr 8, 2010 at 2:42 AM, mscwd01 mscw...@gmail.com wrote:

 Thanks John. So basically the process should be:

 - Query for the object inside a transaction
 - Update the object counter
 - Commit

 - If commit fails - re-query the datastore for the same object?

 Is it possible to just catch the exception and try committing the
 object again or will I have to query the datastore for the object
 again?

 Also will it work when you query for a parent object and then update
 the counter of a child object?

 Thanks again.

 On Apr 8, 10:33 am, John Patterson jdpatter...@gmail.com wrote:
  You will need to read and update the object in a transaction which
  will throw an exception on commit if another thread updates the same
  entity.  You can then refresh the object and try again.  Also look
  into memcache which has an atomic counter increment method that is
  much faster than reading and writing to the datastore.  The downside
  is that the counts could be reset so you may need to periodically
  store them in the datastore.
 
  On 8 Apr 2010, at 16:17, mscwd01 wrote:
 
 
 
   Hey,
 
   How do you ensure, once you have queried an object from the datastore,
   that another call to that object cannot be made?
   I basically have a bunch of objects with counters which get
   incremented during each call to that object.
 
   What I need to ensure is the object doesn't get called by two threads,
   each of which increment the counter by 1 and persist the object back
   to the datastore, only for the counter to be incremented by 1 and not
   by 2.
 
   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.comgoogle-appengine-java%2bunsubscr...@googlegroups.com
   .
   For more options, visit this group athttp://
 groups.google.com/group/google-appengine-java?hl=en
   .

 --
 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-j...@googlegroups.com.
 To unsubscribe from this group, send email to
 google-appengine-java+unsubscr...@googlegroups.comgoogle-appengine-java%2bunsubscr...@googlegroups.com
 .
 For more options, visit this group at
 http://groups.google.com/group/google-appengine-java?hl=en.




 --
 Ikai Lan
 Developer Programs Engineer, Google App Engine
 http://googleappengine.blogspot.com | http://twitter.com/app_engine




-- 
Ikai Lan
Developer Programs Engineer, Google App Engine
http://googleappengine.blogspot.com | http://twitter.com/app_engine

-- 
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-j...@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.



Re: [appengine-java] JPA: How to use a String as Primary Key?

2010-04-08 Thread Ikai L (Google)
Check out this set of Javadocs:
http://code.google.com/appengine/docs/java/javadoc/com/google/appengine/api/datastore/KeyFactory.Builder.html

Key yourKey = KeyFactory.stringToKey(yourStringHere);

On Thu, Apr 8, 2010 at 3:26 AM, stsch77 stsc...@mailinator.com wrote:

 I have tried to follow the documentation at


 http://code.google.com/intl/de-DE/appengine/docs/java/datastore/creatinggettinganddeletingdata.html

 but no matter what I try, I always get an error/an exception of
 different kinds.

 Already the simplest attempt comes up with an error. That's what i
 have:

 - - - - -

 public class Person {

@Id
private String id;

 - - - - -

 ...
 person.setId(stsch);
 EntityManager.persist(person);
 ...

 - - - - -

 ==

 java.lang.IllegalArgumentException: Cannot parse: stsch===
at
 com.google.appengine.api.datastore.KeyFactory.stringToKey(KeyFactory.java:
 192)
at

 org.datanucleus.store.appengine.DatastoreRelationFieldManager.checkForParentSwitch(DatastoreRelationFieldManager.java:
 201)
at

 org.datanucleus.store.appengine.DatastoreFKListStoreSpecialization.updateElementFk(DatastoreFKListStoreSpecialization.java:
 94)
at

 org.datanucleus.store.mapped.scostore.FKListStore.updateElementFk(FKListStore.java:
 254)
 ...
 Caused by:

 com.google.appengine.repackaged.com.google.common.util.Base64DecoderException:
 invalid padding byte '=' at byte offset 5
at

 com.google.appengine.repackaged.com.google.common.util.Base64.decode(Base64.java:
 529)
at

 com.google.appengine.repackaged.com.google.common.util.Base64.decodeWebSafe(Base64.java:
 493)
at
 com.google.appengine.api.datastore.KeyFactory.stringToKey(KeyFactory.java:
 190)


 What is necessary to use a String as Primary Key?

 --
 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-j...@googlegroups.com.
 To unsubscribe from this group, send email to
 google-appengine-java+unsubscr...@googlegroups.comgoogle-appengine-java%2bunsubscr...@googlegroups.com
 .
 For more options, visit this group at
 http://groups.google.com/group/google-appengine-java?hl=en.




-- 
Ikai Lan
Developer Programs Engineer, Google App Engine
http://googleappengine.blogspot.com | http://twitter.com/app_engine

-- 
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-j...@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: Java Mail Service

2010-04-08 Thread KarthikR
Hi

I am not sure why the low-level API isn't working (or why the low-
level api is using a high amount of CPU).

As to your original question, can you take a look at
http://code.google.com/p/googleappengine/issues/detail?id=1631

Also from http://code.google.com/appengine/docs/java/mail/usingjavamail.html
:
 The low-level API includes a convenience method for sending mail to all of 
 the application's administrators.
 To do this in JavaMail, use admins (with no at-symbol or domain) as a 
 recipient

Looks like regaular JavaMail should work with
msg.addRecipient(Message.RecipientType.CC, new InternetAddress
(admins));
...

Regards,
Karthik

On Apr 7, 5:56 am, moissinac jcmoissi...@gmail.com wrote:
 A trace on the code shows me that the line in the previous code             
 ms.sendToAdmins(msg);

 fails

 So, my hypothesis is that a prerequisite is not fulfilled
 In the code, I use the Low Level API, which doesn't need a specific
 configuration (I believe it)
 In the log, I see
 2585cpu_ms
 with a warning saying 'This request used a high amount of CPU and may
 soon exceed is quota'
 I don't see where my code use a such amount of CPU

 On 7 avr, 13:26, moissinac jcmoissi...@gmail.com wrote:



  Tried the following code
                  MailService ms = MailServiceFactory.getMailService();
                  MailService.Message msg = new MailService.Message();
              msg.setSubject(Tu as réussi cette étape);
              ms.sendToAdmins(msg);

  without more result.

  The code is executed in the development server (without sending email
  as specified by the documentation)
  And do nothing visible in the GAE server.

  On 2 avr, 18:12, KarthikR soumya.karth...@gmail.com wrote:

   Hi

   The java API javadoc 
   athttp://code.google.com/appengine/docs/java/javadoc/com/google/appengi...
   provides send() and sendToAdmins() methods, Can you try using
   sendToAdmins() ?

   Regards,
   KarthikR

   On Apr 1, 7:17 am, moissinac jcmoissi...@gmail.com wrote:

Hello

I have servlet with a code copied from the documentation for sending
an email with the mail service
Each time I call the service, I see the trace in the quota count like
this:
Mail
Mail API Calls  0%      0%      5 of 7000       Okay
Recipients Emailed      0%      0%      5 of 2000       Okay
Admins Emailed  0%      0%      0 of 5000       Okay
...
The count for Mail API Calls and Recipients Emailed is incremented
each time

My code send an email from the admin of my domain to the admin of my
admin, but the item Admins Emailed  is never incremented

The admin of my domain (me) never receive an email by that mean.
If I send an email with gmail to the same address, it receive the
email.

Advice? help?
Thank you inadvance- Hide quoted text -

 - Show quoted text -

-- 
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-j...@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: List of sub entities does not obay list order

2010-04-08 Thread Gunnar

Hi,
Can anybody help solve my problem?
Gunnar

Here is the testcode:

package appengine.test;

import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.PrintStream;
import java.util.ArrayList;
import java.util.List;

import javax.jdo.JDOHelper;
import javax.jdo.ObjectState;
import javax.jdo.PersistenceManager;
import javax.jdo.Query;
import javax.jdo.Transaction;
import javax.jdo.spi.PersistenceCapable;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

@SuppressWarnings(serial)
public class ListordertestServlet extends HttpServlet {

StringBuilder sb = new StringBuilder();

public void doGet(HttpServletRequest req, HttpServletResponse resp)
throws IOException {
sb = new StringBuilder();
resp.setContentType(text/plain);
deleteAll();
MyEntity entity = persist();
entity = add(entity, one);
query();
entity = add(entity, two);
query();
entity = add(entity, three);
query();
entity = reorder(entity);
query();
resp.getWriter().println(sb.toString());
}

private MyEntity persist() {
MyEntity entity = new MyEntity();
// MyEntity detached = null;
ArrayListSubEntity subEntities = new ArrayListSubEntity();
entity.setMyList(subEntities);
PersistenceManager pm = PMF.get().getPersistenceManager();
Transaction tx = pm.currentTransaction();
pm.setDetachAllOnCommit(true);
try {
tx.begin();
pm.makePersistent(entity);
tx.commit();
// detached = pm.detachCopy(entity);
sb.append(persisted entity:  + entity.getId() + \n);
// sb.append(detached object:  + detached + \n);
} catch (Exception e) {
printStackTrace(e);
} finally {
if (tx.isActive())
tx.rollback();
pm.close();
}
// return detached;
return entity;
}

private MyEntity add(MyEntity entity, String name) {
// MyEntity detached = null;
sb.append(before add  + entity.toString() + \n);
PersistenceManager pm = PMF.get().getPersistenceManager();
Transaction tx = pm.currentTransaction();
pm.setDetachAllOnCommit(true);
try {
tx.begin();
final SubEntity subEntity = new SubEntity(name);
entity.getMyList().add(0,subEntity);
entity = pm.makePersistent(entity);
tx.commit();
// detached = pm.detachCopy(entity);
// pm.detachCopy(entity);
sb.append(added sub-entity  + name + \n);
// sb.append(detached object:  + detached + \n);
sb.append(after add:  + entity + \n);
} catch (Exception e) {
printStackTrace(e);
} finally {
if (tx.isActive())
tx.rollback();
pm.close();
}
// return detached;
return entity;
}

private MyEntity reorder(MyEntity entity) {
// MyEntity detached = null;
sb.append(before reorder  + entity.toString() + \n);
PersistenceManager pm = PMF.get().getPersistenceManager();
Transaction tx = pm.currentTransaction();
pm.setDetachAllOnCommit(true);
try {
tx.begin();
ArrayListSubEntity myList = entity.getMyList();
SubEntity first = myList.remove(0);
myList.add(first);
entity = pm.makePersistent(entity);
tx.commit();
// detached = pm.detachCopy(entity);
// sb.append(detached object:  + detached + \n);
sb.append(reordered object:  + entity + \n);
} catch (Exception e) {
printStackTrace(e);
} finally {
if (tx.isActive())
tx.rollback();
pm.close();
}
// return detached;
return entity;
}

@SuppressWarnings(unchecked)

Re: [appengine-java] Re: Adding Task-Queue Tasks in Batch?

2010-04-08 Thread Seth Ladd
Exactly what I am doing now, thanks. :)

On Thursday, April 8, 2010, Keith dunelmt...@googlemail.com wrote:
 I think the five limit still applies. If you want to run more than
 five you
 could run five tasks and structure them to enqueue further tasks once
 they run.

 On Apr 8, 4:41 am, Seth Ladd sethl...@gmail.com wrote:
 Thanks!

 If under a transaction, are tasks added via batch still constrained to
 5 per txn?

 On Apr 6, 11:53 am, Keith dunelmt...@googlemail.com wrote:



  Fromhttp://code.google.com/appengine/docs/java/javadoc/com/google/appengi...

  add(java.lang.IterableTaskOptions taskOptions)
            Submits tasks to this queue.

  On Apr 6, 9:54 am, Seth Ladd sethl...@gmail.com wrote: Aloha,

   The docs for the Java implementation of the Task Queue mentions this:

   maximum number of tasks that can be added in a batch - 100

   However, I can't find any reference to adding tasks in a batch.  What
   does the above mean, and where can I find more information about it?
   I'd like to be able to add many tasks in a batch, if that's
   possible.

   I am aware of the 5 tasks per transaction limit.

   Thanks!
   Seth

 --
 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-j...@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.



-- 
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-j...@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: AppstatsServlet not working in 1.3.2, redirects to /stats

2010-04-08 Thread pjesi
I found the solution to this. The correct URL is /appstats/stats

On Apr 7, 6:41 pm, Viðar Svansson vidarsv...@gmail.com wrote:
 Hi,

 I am trying out the now profiling stats in appengine using
 AppstatsServlet and AppstatsFilter. The filter seems to work just fine
 but the servlets mapped at /appstats/* just redirects to /stats. If I
 try to map it to /stats then it gets stuck in an infinite redirection
 loop. Also, what does an admin mean in this context? Is it an admin in
 the Google Apps domain or the App Engine admin (developer)?

 Thanks,
 Viðar

-- 
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-j...@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: Safe Harbor DPA compliant incremental backups of datastore

2010-04-08 Thread sampablokuper
Is this the kind of thing the Data Liberation Front[1] might be
interested in helping with?

Thanks.

[1] http://www.dataliberation.org/google/app

-- 
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-j...@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: Eclipse plugin - prevent auto-copy of jars

2010-04-08 Thread Krishna
Thanks Scott, Miguel.

For now I am deploying manually and that seems to work.

Miguel - thanks for the link to the FAQ. I overlooked the eclipse
plugin googlecode website which, retrospectively thinking, should have
been the most logical place to look for an answer :-).

Krishna

On Apr 5, 5:36 pm, Miguel Méndez mmen...@google.com wrote:
 By default the eclipse plugin will copy the default set of SDK jars that
 most applications will need into YOUR_WAR_DIRECTORY/WEB-INF/lib under the
 assumption that you will want to launch and deploy from it directly.  If you
 want tighter control, you can navigate to the project properties and select
 Google  Web Application and uncheck the Launch and deploy from this
 directory.  This will treat the directory as input only (won't copy any
 jars into YOUR_WAR_DIRECTORY/WEB-INF/lib), but you will need to provide a
 staging war directory for launching and debugging.

 The feature was intended to facilitate integration with Eclipse J2EE
 projects and Maven -- perhaps it will be useful in this case.  The
 FAQshttp://code.google.com/eclipse/docs/faq.htmlgo into more detail.

 On Sun, Apr 4, 2010 at 2:35 PM, Scott Hernandez 
 scotthernan...@gmail.comwrote:





  There was  recent discussion about dependencies (valid for Objectify or any
  datastore based impl.)  but the eclipse plugin question has not been
  answered well.

 http://groups.google.com/group/objectify-appengine/browse_thread/thre...

  I suspect that if you enable the plugin, it will always copy the files into
  your lib dir :(

  You can disable it and use ant/command-line to deploy, as a last ditch
  option.

  On Sun, Apr 4, 2010 at 11:25 AM, Krishna shrikrishna.sh...@gmail.comwrote:

  Hi,

  I'm using Objectify for persistence and I'd really like to remove all
  jdo /  jpa related jars from my lib directory but eclipse keeps
  transferring them back. I also tried modifying the contents of the
  com.google.appengine.eclipse.core file under the .setting directory
  but I guess eclipse overwrites my changes on startup and then copies
  over the jars anyway. I've seen discussions where people have used the
  appcfg tool to manually deploy instead of doing so from within eclipse
  but I'm hoping a better solution  exists.

  This blogpost
 http://www.answercow.com/2010/03/google-app-engine-cold-start-guide-f...
  claims that startup times reduce by ~400ms by removing these jars and
  I really love speedups especially when they are free :-).

  Perhaps someone from Google can comment on whether removing these jars
  will actually speedup apps even if the app does not directly use
  them.

  Also, I am not sure which jars need to be retained for sure and I'd
  really appreciate it if someone could could give me a pointer
  regarding this. I am pretty new to Java so apologies if this is a
  naive question.

  Thanks so much,

  Krishna

  --
  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-j...@googlegroups.com.
  To unsubscribe from this group, send email to
  google-appengine-java+unsubscr...@googlegroups.comgoogle-appengine-java%2B
   unsubscr...@googlegroups.com
  .
  For more options, visit this group at
 http://groups.google.com/group/google-appengine-java?hl=en.

   --
  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-j...@googlegroups.com.
  To unsubscribe from this group, send email to
  google-appengine-java+unsubscr...@googlegroups.comgoogle-appengine-java%2B 
  unsubscr...@googlegroups.com
  .
  For more options, visit this group at
 http://groups.google.com/group/google-appengine-java?hl=en.

 --
 Miguel

-- 
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-j...@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: Is it possible to convert a user defined String key to a unique Long?

2010-04-08 Thread mscwd01
I have objects which represent users, the key to each object is their
email address encoded as a String. Having the email address as the key
works well so i'd like to keep it that way rather than having an auto
incrementing Long key.

However, for reasons I wont go into here, I need a way of identifying
user objects via a meaningless number rather than an personal email
address.

I assumed the datastore may hold a unique auto incrementing number for
each object regardless of the key type used and if so I was wondering
how one may access it?

Thanks

On Apr 8, 5:59 pm, Ikai L (Google) ika...@google.com wrote:
 You could probably change the characters to integer values and concatenate
 these, but you are going to get some BIG numbers.

 Better solution still is probably to use KeyFactory to generate a unique
 Key. What is it you are trying to do?





 On Thu, Apr 8, 2010 at 2:19 AM, mscwd01 mscw...@gmail.com wrote:
  Hey,

  As the title of this post suggests, is it possible to get a unique
  Long id from a user defined String key?

  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-j...@googlegroups.com.
  To unsubscribe from this group, send email to
  google-appengine-java+unsubscr...@googlegroups.comgoogle-appengine-java%2B 
  unsubscr...@googlegroups.com
  .
  For more options, visit this group at
 http://groups.google.com/group/google-appengine-java?hl=en.

 --
 Ikai Lan
 Developer Programs Engineer, Google App 
 Enginehttp://googleappengine.blogspot.com|http://twitter.com/app_engine

-- 
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-j...@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: How to ensure object synchronization when using the datastore

2010-04-08 Thread mscwd01
Thanks Ikai, that link was very helpful.

On Apr 8, 6:01 pm, Ikai L (Google) ika...@google.com wrote:
 Oops. Link is here:

 http://gae-java-persistence.blogspot.com/2009/10/optimistic-locking-w...

 On Thu, Apr 8, 2010 at 10:00 AM, Ikai L (Google) ika...@google.com wrote:





  Here's a blog post Max Ross wrote about optimistic locking using built in
  features of JDO/JPA

  On Thu, Apr 8, 2010 at 2:42 AM, mscwd01 mscw...@gmail.com wrote:

  Thanks John. So basically the process should be:

  - Query for the object inside a transaction
  - Update the object counter
  - Commit

  - If commit fails - re-query the datastore for the same object?

  Is it possible to just catch the exception and try committing the
  object again or will I have to query the datastore for the object
  again?

  Also will it work when you query for a parent object and then update
  the counter of a child object?

  Thanks again.

  On Apr 8, 10:33 am, John Patterson jdpatter...@gmail.com wrote:
   You will need to read and update the object in a transaction which
   will throw an exception on commit if another thread updates the same
   entity.  You can then refresh the object and try again.  Also look
   into memcache which has an atomic counter increment method that is
   much faster than reading and writing to the datastore.  The downside
   is that the counts could be reset so you may need to periodically
   store them in the datastore.

   On 8 Apr 2010, at 16:17, mscwd01 wrote:

Hey,

How do you ensure, once you have queried an object from the datastore,
that another call to that object cannot be made?
I basically have a bunch of objects with counters which get
incremented during each call to that object.

What I need to ensure is the object doesn't get called by two threads,
each of which increment the counter by 1 and persist the object back
to the datastore, only for the counter to be incremented by 1 and not
by 2.

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.comgoogle-appengine-java%2B
   unsubscr...@googlegroups.com
.
For more options, visit this group athttp://
  groups.google.com/group/google-appengine-java?hl=en
.

  --
  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-j...@googlegroups.com.
  To unsubscribe from this group, send email to
  google-appengine-java+unsubscr...@googlegroups.comgoogle-appengine-java%2B
   unsubscr...@googlegroups.com
  .
  For more options, visit this group at
 http://groups.google.com/group/google-appengine-java?hl=en.

  --
  Ikai Lan
  Developer Programs Engineer, Google App Engine
 http://googleappengine.blogspot.com|http://twitter.com/app_engine

 --
 Ikai Lan
 Developer Programs Engineer, Google App 
 Enginehttp://googleappengine.blogspot.com|http://twitter.com/app_engine

-- 
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-j...@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] DataStore query without transaction - Spring 2.5 + JPA

2010-04-08 Thread Nexus
I need to use query that fetches objects from multiple entity groups
(which means I can't use transactions). Here's the method:
@Override
public CollectionItem findInactiveItems(Date endDate) {
inactiveItems =
em.createNamedQuery(findInactiveItems).setParameter(endDate,
endDate).getResultList();
if(null == inactiveItems) inactiveItems = new ArrayListItem();
inactiveItems.size();
return inactiveItems;
}
However, calling getResultList() causes the following error:
Caused by: org.datanucleus.exceptions.NucleusUserException: Object
Manager has been closed
at
org.datanucleus.ObjectManagerImpl.assertIsOpen(ObjectManagerImpl.java:
3876)
at
org.datanucleus.ObjectManagerImpl.getTransaction(ObjectManagerImpl.java:
596)
at
org.datanucleus.jpa.EntityTransactionImpl.isActive(EntityTransactionImpl.java:
61)
at org.datanucleus.jpa.JPAQuery.getResultList(JPAQuery.java:158)

I found here on groups the same error posted with suggestions that
using OpenEntityManagerInViewFilter should keep entity manager
throughout the request. Unforfunately, I can't get this filter working
because it tries to create a new entity manager factory while gae
allows to create only one of those.
Here is part of my web.xml
servlet
servlet-namecontext/servlet-name
servlet-class
org.springframework.web.context.ContextLoaderServlet
/servlet-class
load-on-startup1/load-on-startup
/servlet

filter
filter-nameOpenEntityManagerInViewFilter/filter-name
filter-
classorg.springframework.orm.jpa.support.OpenEntityManagerInViewFilter/
filter-class
init-param
param-nameentityManagerFactory/param-name
param-valueentityManagerFactory/param-value
/init-param
/filter

filter-mapping
filter-nameOpenEntityManagerInViewFilter/filter-name
url-pattern*.html/url-pattern
/filter-mapping


And part of applicationContext.xml:

bean id=entityManagerFactory name=entityManagerFactory
class=org.springframework.orm.jpa.LocalEntityManagerFactoryBean
scope=singleton
property name=persistenceUnitName 
value=transactions-optional /

/bean

bean id=transactionManager
class=org.springframework.orm.jpa.JpaTransactionManager
scope=singleton
property name=entityManagerFactory 
ref=entityManagerFactory /
/bean

And here is the error caused by filter:
org.springframework.web.servlet.FrameworkServlet initServletBean:
Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error
creating bean with name 'entityManagerFactory' defined in
ServletContext resource [/WEB-INF/allewidok-servlet.xml]: Invocation
of init method failed; nested exception is
javax.persistence.PersistenceException: Provider error. Provider:
org.datanucleus.store.appengine.jpa.DatastorePersistenceProvider
(...)
Caused by: java.lang.IllegalStateException: Application code attempted
to create a EntityManagerFactory named transactions-optional, but one
with this name already exists!  Instances of EntityManagerFactory are
extremely slow to create and it is usually not necessary to create one
with a given name more than once.  Instead, create a singleton and
share it throughout your code.  If you really do need to create a
duplicate EntityManagerFactory (such as for a unittest suite), set the
appengine.orm.disable.duplicate.emf.exception system property to avoid
this error.
at
org.datanucleus.store.appengine.jpa.DatastoreEntityManagerFactory.checkForRepeatedAllocation(DatastoreEntityManagerFactory.java:
136)
at
org.datanucleus.store.appengine.jpa.DatastoreEntityManagerFactory.init(DatastoreEntityManagerFactory.java:
64)
at
org.datanucleus.store.appengine.jpa.DatastorePersistenceProvider.createEntityManagerFactory(DatastorePersistenceProvider.java:
35)
at javax.persistence.Persistence.createFactory(Persistence.java:172)



So, has anybody actually used OpenEntityManagerInViewFilter on GAE?

-- 
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-j...@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] response.getOutputStream().write(byte[]) causes java.security.AccessControlException on GAE ?

2010-04-08 Thread Daisy
Hi,

I have groovy script that read an image from a Blob field, and write
it to the response.  It runs well on my local environment, but causes
java.security.AccessControlException  on the google app engine.

Any idea why it happened and how to fix it?

The script (image.groovy) looks like this:
import com.google.appengine.api.datastore.*
import com.google.appengine.api.images.*

def k = KeyFactory.stringToKey( params.key )
def img = datastore.get(k).content.getBytes();

if ( img ){

def width = params.width;
def height = params.height;
if ( width  height ){
Image oldImage = ImagesServiceFactory.makeImage(img);
Transform resize =
ImagesServiceFactory.makeResize(width.toInteger(),
height.toInteger());
Image newImage = images.applyTransform(resize,
oldImage);
img = newImage.getImageData();
}

response.getOutputStream().write(img)
}else{

println failed to find img

}

And the error:
04-07 08:44PM 14.540  GroovyServlet Error: script: '/image.groovy':
Script processing failed.access denied (java.lang.Runti
04-07 08:44PM 14.540  java.security.AccessControlException: access
denied (java.lang.RuntimePermission getClassLoader)
04-07 08:44PM 14.540  at
com.google.appengine.runtime.Request.process-7950a73f1237deb5(Request.java)
04-07 08:44PM 14.540  at
org.codehaus.groovy.reflection.ClassLoaderForClassArtifacts.init(ClassLoaderForClassArtifacts.jav
04-07 08:44PM 14.540  at
org.codehaus.groovy.runtime.callsite.CallSiteClassLoader.init(CallSiteClassLoader.java:
40)
04-07 08:44PM 14.541  at org.codehaus.groovy.reflection.CachedClass
$5$1.run(CachedClass.java:144)
04-07 08:44PM 14.541  at org.codehaus.groovy.reflection.CachedClass
$5$1.run(CachedClass.java:142)
04-07 08:44PM 14.541  at
java.security.AccessController.doPrivileged(AccessController.java:34)
04-07 08:44PM 14.541  at org.codehaus.groovy.reflection.CachedClass
$5.initValue(CachedClass.java:141)
04-07 08:44PM 14.541  at org.codehaus.groovy.reflection.CachedClass
$5.initValue(CachedClass.java:139)
04-07 08:44PM 14.541  at
org.codehaus.groovy.util.LazyReference.getLocked(LazyReference.java:
33)
04-07 08:44PM 14.541  at
org.codehaus.groovy.util.LazyReference.get(LazyReference.java:20)
04-07 08:44PM 14.541  at
org.codehaus.groovy.reflection.CachedClass.getCallSiteLoader(CachedClass.java:
464)
04-07 08:44PM 14.541  at
org.codehaus.groovy.runtime.callsite.CallSiteGenerator.compilePojoMethod(CallSiteGenerator.java:
222
04-07 08:44PM 14.541  at
org.codehaus.groovy.reflection.CachedMethod.createPojoMetaMethodSite(CachedMethod.java:
244)
04-07 08:44PM 14.541  at
org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite.createCachedMethodSite(PojoMetaMethodSite.j
04-07 08:44PM 14.541  at
org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite.createPojoMetaMethodSite(PojoMetaMethodSite
04-07 08:44PM 14.541  at
groovy.lang.MetaClassImpl.createPojoCallSite(MetaClassImpl.java:2987)
04-07 08:44PM 14.541  at
org.codehaus.groovy.runtime.callsite.CallSiteArray.createPojoSite(CallSiteArray.java:
114)
04-07 08:44PM 14.541  at
org.codehaus.groovy.runtime.callsite.CallSiteArray.createCallSite(CallSiteArray.java:
148)
04-07 08:44PM 14.541  at
org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:
40)
04-07 08:44PM 14.541  at
org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:
117)
04-07 08:44PM 14.541  at
org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:
125)
04-07 08:44PM 14.541  at image.run(image.groovy:18)
04-07 08:44PM 14.541  at
groovy.util.GroovyScriptEngine.run(GroovyScriptEngine.java:464)
04-07 08:44PM 14.541  at groovy.servlet.GroovyServlet
$1.call(GroovyServlet.java:120)
04-07 08:44PM 14.541  at
org.codehaus.groovy.runtime.GroovyCategorySupport
$ThreadCategoryInfo.use(GroovyCategorySupport.java
04-07 08:44PM 14.542  at
org.codehaus.groovy.runtime.GroovyCategorySupport
$ThreadCategoryInfo.access$200(GroovyCategorySuppo
04-07 08:44PM 14.542  at
org.codehaus.groovy.runtime.GroovyCategorySupport.use(GroovyCategorySupport.java:
201)
04-07 08:44PM 14.542  at
groovy.servlet.GroovyServlet.service(GroovyServlet.java:129)
04-07 08:44PM 14.542  at groovyx.gaelyk.GaelykServlet.super
$5$service(GaelykServlet.groovy)
04-07 08:44PM 14.542  at
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
04-07 08:44PM 14.542  at
sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
04-07 08:44PM 14.542  at
sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
04-07 08:44PM 14.542  at java.lang.reflect.Method.invoke(Method.java:
43)
04-07 08:44PM 14.542  at
org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:
88)
04-07 08:44PM 14.542  at
groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:233)
04-07 08:44PM 14.542  at
groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1058)
04-07 08:44PM 14.542  at

[appengine-java] Re: Delay between Load Request and Filter Init

2010-04-08 Thread Jake
Ok, now this is getting silly :)

My application gets a page request that contains some images.  My
application has some specialized logic that mounts images with
different states on a custom URL that is stored in the applications
memory - that URL is returned in the HTML.  The web browser then,
obviously, requests the image at the custom URL.  Unfortunately, in
the 3 seconds between the request for the page and the request for the
image, the application restarted and lost the custom URL.

Thoughts?  Is there no way to ensure that the application stays alive
during a complete page request?  Now that I think about it, I guess
there's nothing that differentiates a complete set of page requests
from a single image request - either of which can be a loading
request.

To date, this has happened at least 3-4 times - I just didn't see it
as a problem until an image was requested.  I'm the only traffic for
the time being.

Thanks!

Jake



On Apr 7, 2:52 pm, Jake jbrooko...@cast.org wrote:
 Hello,

 I'm currently using the Wicket Framework which is simply a
 javax.servlet.Filter.  I have a quick little logging statement in the
 init() method of the filter which, I believe, is the absolute first
 thing that should run on a loading request.

 I've been working hard to minimize the startup time for my
 application, but now I've discovered a delay between the initial GET
 request and the log statement in the init() function that is anywhere
 between 2 seconds and 15 seconds.  I suppose I can live with the 2
 seconds, but 15 seconds is pushing it :)

 04-07 11:41AM 41.583

 75.150.73.225 - - [07/Apr/2010:11:42:14 -0700] GET / HTTP/1.1 500 0
 - Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.2.3)
 Gecko/20100401 Firefox/3.6.3,gzip(gfe) jacob-brookover.appspot.com

 D 04-07 11:41AM 53.341

 org.cast.google.TestFilter init: Initializing Filter

 I've been fuddling around with a lot of things, so I'm far from a
 standard implementation at this point.  I'm hoping someone can tell
 me what I can do to remove such a delay.

 Thanks!

 Jake

-- 
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-j...@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.



Re: [appengine-java] Delay between Load Request and Filter Init

2010-04-08 Thread John Patterson


On 8 Apr 2010, at 01:52, Jake wrote:


Hello,

I'm currently using the Wicket Framework which is simply a
javax.servlet.Filter.  I have a quick little logging statement in the
init() method of the filter which, I believe, is the absolute first
thing that should run on a loading request.


Hi Jake, do you have a lot of dependancies in your WEB-INF/lib  
folder?  I am not sure how much time is required per MB but perhaps  
you could experiment with shrinking your jars into a single combined  
dependancy.


Some tools to look into that might help in this regard:

http://www.yworks.com/en/products_yguard_about.
http://proguard.sourceforge.net/
http://pmd.sourceforge.net/


I've been meaning to experiment with these myself.  It would be crazy  
to *not* use frameworks and external libraries if the jar size problem  
can be solved another way.


Also, I think I remember there are some settings in Wicket to make it  
not scan for i18n resource files when it starts up.


If you are using Guice with Wicket you can save a few seconds by using  
the non-AOP version that does not enhance classes.


John

--
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-j...@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: Trying a clean compile gives The parameter is incorrect

2010-04-08 Thread dreamy
As you said,  when  Enhance classes is little ,there is OK,  but when
Enhance classes  has many many(ex: 200 classes) ,the same problem is
appear.

how to do with it?

-- 
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-j...@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 google plugin for eclipse

2010-04-08 Thread joradom
I created a web application project, without web toolkit sdk (just gae
sdk), thx for the thread, I'll try it.

On 6 abr, 19:00, Ikai L (Google) ika...@google.com wrote:
 What kind of project have you created? This looks like the issue filed here:

 http://code.google.com/p/googleappengine/issues/detail?id=2306

 http://code.google.com/p/googleappengine/issues/detail?id=2306You'll have
 to provide more detail, though. How are you creating the project?



 On Tue, Apr 6, 2010 at 5:31 AM, joradom jora...@gmail.com wrote:
  The plugin doesn't allow me to create a new Servlet, when calling the
  create servlet wizard the project field appears greyed and empty.

  I can create a class, or any file, but of course, much more things to
  write are needed.

  just curious to know if it's a normal behaviour or some bug?

  I'm using Ubuntu karmic and eclipse  ganimedes for java EE, with
  latests google  plugin and sdks (just made a fresh install 3 days
  ago.)

  thx

  --
  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-j...@googlegroups.com.
  To unsubscribe from this group, send email to
  google-appengine-java+unsubscr...@googlegroups.comgoogle-appengine-java%2bunsubscr...@googlegroups.com
  .
  For more options, visit this group at
 http://groups.google.com/group/google-appengine-java?hl=en.

 --
 Ikai Lan
 Developer Programs Engineer, Google App 
 Enginehttp://googleappengine.blogspot.com|http://twitter.com/app_engine

-- 
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-j...@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.