Re: [appengine-java] How to query objects with criterias defined in child entities
This is a good segue into something I've been contemplating: Does anyone actually use the Relation Index Entity pattern? How does it perform? I don't mean how do queries perform - obviously those would be fast. But how expensive in both latency and price is it to write an entity with effectively 5,000 indexed fields? You're not just "tacking an entry on to the end" of the recipient list - you put() an entity whole and so GAE must update (or at least check) every single value against the index. You couldn't use the RIE pattern for Twitter. People follow and unfollow other people all the time. What are you going to do when someone follows you, walk through every one of your existing tweets and rewrite the index? I think not. You couldn't use the RIE pattern for the Original Poster's purpose because there is relationship data involved. You need a full-blown relationship entity (ie UserSkill). The RIE pattern seems pretty useless in the real world because it assumes a large number of fairly static recipients. Maybe not useless, but looking at the real world, I have a hard time finding a good purpose for it. Anyone got a suggestion? My hypothesis: Slatkins' talk is interesting but actually of little practical value. Jeff On Tue, Mar 9, 2010 at 8:21 PM, John Patterson wrote: > > On 10 Mar 2010, at 10:53, Max wrote: > >> Rusty Wright suggested a list of user keys to be stored in skill >> entity. But that means only 5000 users can have the same skill. > > If you use the "Relation Index Entity" pattern as described in Bret Slatkins > talk you can store 5000 users per index entity and an unlimited number of > index entities. This will actually give you much better query performance > too because you will not need to load the list of 5000 Keys every time you > read your main entity. > > The new release of Twig has direct support for RIE's and can actually let > you query for multiple skills *in parallel* then merge the results and > return the parents : > > http://code.google.com/p/twig-persist/wiki/Using#Relation_Index_Entities > > > -- > 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] How to query objects with criterias defined in child entities
For the sake of comparison, see below for the Twig equivalent On 10 Mar 2010, at 11:18, Jeff Schnitzer wrote: class UserSkill { @Id Long id; @Parent Key user; String skill; // could also be Key skill if you model Skill entities int ability; } class UserSkill { @Parent User user; String skill int ability; } Note that no key is required and user is referenced directly so your model has no dependency on the low-level datastore List> userKeys = new ArrayList>(); for (Key key: ofy.query(UserSkill.class).filter("skill", "java").filter("ability >", 5).fetchKeys()) userKeys.add(key.getParent()); Collection users = ofy.get(userKeys).values(); Iterator users = datastore.find() .type(UserSkill.class) .addFilter("skill", EQUAL, "java") .addFilter("ability", GREATER_THAN, 5) .returnParentsNow(); This is how easy it is to use Relation Index Entities with the new release of Twig Note that Twig is the only datastore interface that can do OR queries - find "java" OR ".net" Users sorted by ability like this: Iterator users = datastore.find() .type(UserSkill.class) .addSort("ability") .addFilter("ability", GREATER_THAN, 5) .addChildQuery() .addFilter("skill", EQUAL, "java") .addChildQuery() .addFilter("skill", EQUAL, ".net") .returnParentsNow(); Behind the scenes two queries are run *in parallel* asynchronously and then merged together into a single Iterator. Notice also that the two queries both inherit the common filter and sort on "ability". Find out more http://code.google.com/p/twig-persist/ 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.
Re: [appengine-java] How to query objects with criterias defined in child entities
On 10 Mar 2010, at 10:53, Max wrote: Rusty Wright suggested a list of user keys to be stored in skill entity. But that means only 5000 users can have the same skill. If you use the "Relation Index Entity" pattern as described in Bret Slatkins talk you can store 5000 users per index entity and an unlimited number of index entities. This will actually give you much better query performance too because you will not need to load the list of 5000 Keys every time you read your main entity. The new release of Twig has direct support for RIE's and can actually let you query for multiple skills *in parallel* then merge the results and return the parents : http://code.google.com/p/twig-persist/wiki/Using#Relation_Index_Entities -- 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] How to query objects with criterias defined in child entities
Create a UserSkill entity with a parent key of User. Do a keysOnly query for UserSkill objects that match your criteria, then get the parent keys out of the UserSkill key, then do a batch get on the parent keys. The Objectify code: class UserSkill { @Id Long id; @Parent Key user; String skill; // could also be Key skill if you model Skill entities int ability; } List> userKeys = new ArrayList>(); for (Key key: ofy.query(UserSkill.class).filter("skill", "java").filter("ability >", 5).fetchKeys()) userKeys.add(key.getParent()); Collection users = ofy.get(userKeys).values(); Jeff On Tue, Mar 9, 2010 at 7:53 PM, Max wrote: > I start a new thread to recall this issue because the origin one can > not be replied any more. > > http://groups.google.com/group/google-appengine-java/browse_thread/thread/4998ef3a9f2a0016/ec718da641a58ea7?lnk=gst&q=+how+to+query+objects+with+criterias+defined+in+child+entities#ec718da641a58ea7 > > Rusty Wright suggested a list of user keys to be stored in skill > entity. But that means only 5000 users can have the same skill. > > http://groups.google.com/group/google-appengine-java/browse_thread/thread/cf7ee19917c897b6/d91c7cd836d0ea2c#d91c7cd836d0ea2c > > Any other suggestions on this kind of problem? > > Many thanks, > Max > > -- > 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] How to query objects with criterias defined in child entities
I start a new thread to recall this issue because the origin one can not be replied any more. http://groups.google.com/group/google-appengine-java/browse_thread/thread/4998ef3a9f2a0016/ec718da641a58ea7?lnk=gst&q=+how+to+query+objects+with+criterias+defined+in+child+entities#ec718da641a58ea7 Rusty Wright suggested a list of user keys to be stored in skill entity. But that means only 5000 users can have the same skill. http://groups.google.com/group/google-appengine-java/browse_thread/thread/cf7ee19917c897b6/d91c7cd836d0ea2c#d91c7cd836d0ea2c Any other suggestions on this kind of problem? Many thanks, Max -- 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] Slim3: Global Transaction support, Fast spin-up and HOT reloading
Hi Jeff, >> Slim3 locks an entity group when getting, putting and deleting entities >> so that nobody updates the entity group. So it never happens >> that the first two entity group transactions commit and the third fails. > > What do you do when there is a lock conflict? > > ThreadA locks Resource1 > ThreadB locks Resource2 > ThreadA tries to lock Resource2... what happens? When ThreadA tries to lock Resource2, ThreadA will encounter a ConcurrentModificationException, and the other locks that ThreadA has (the lock for Resource1) will be released automatically. > What happens when a datastore error prevents > the lock from being deleted? > If the transaction is not committed for same reasons, the locks will be released 30 seconds later. 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] Slim3: Global Transaction support, Fast spin-up and HOT reloading
On Tue, Mar 9, 2010 at 7:07 PM, Yasuo Higa wrote: > Slim3 locks an entity group when getting, putting and deleting entities > so that nobody updates the entity group. So it never happens > that the first two entity group transactions commit and the third fails. What do you do when there is a lock conflict? ThreadA locks Resource1 ThreadB locks Resource2 ThreadA tries to lock Resource2... what happens? Immediate rollback with all locks released? What happens when a datastore error prevents the lock from being deleted? Neat stuff, btw. Jeff -- 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] Slim3: Global Transaction support, Fast spin-up and HOT reloading
Hi Scott, > > It seems that in the code it writes out a task in a queue to close the > commits, possibly. I'm pretty sure transactions should not be > implemented using queues, for any reason. The complexity of storing > temporary lock/tx objects in the datastore, time spent during that > transaction, and then pushing them through with a task (maybe much > later) seems like a dangerous plan. > As you know, "Eventually Consistent" is a very important concept for scaling applications. To enable "Eventually Consistent", Transactional Task Queue is a key item. See "BASE: An Acid Alternative": http://queue.acm.org/detail.cfm?id=1394128 > Supporting multi-entity-group transactions needs to be implemented at > the datastore and not in a wrapper like that, IMO. There is no way to > rollback any committed transactions from any other entity-group, and > there are many other issues as well ... there is too much application > specific behavior that can't be assumed. > If you start committing a global transaction, you cannot cancel it as well as com.google.appengine.api.datastore.Transaction. If you do not commit a global transaction, you can cancel it freely. > > What happens if you have 3 transactions (1 transaction over 3 entity > groups) and the first two entity group transactions commit and the > third fails during commit? Is there a way to roll the first two back? > Slim3 locks an entity group when getting, putting and deleting entities so that nobody updates the entity group. So it never happens that the first two entity group transactions commit and the third fails. > What happens if your user expect transactions to work like a database > where you have transaction isolation with gets/queries and updated the > value of the same entity multiple times from repeated gets? (think of > multiple "get, incr. object property, put" where the object only gets > incremented by the last amount, not the sum of the increments) > Unlike with most databases, queries and gets inside a datastore transaction do not see the results of previous writes inside that transaction. Specifically, if an entity is modified or deleted within a transaction, a query or get will return the original version of the entity as of the beginning of the transaction, or nothing if the entity did not exist then. http://code.google.com/appengine/docs/java/datastore/transactions.html#Isolation_and_Consistency > Where does the user get an error if the transaction fails later when > the task runs from the queue? (sure, that is application specific, but > dangerous all the same as the current models don't allow for implicit > non-synchronous operations). > As described the above, if the task runs, the global transaction never fails. Thanks, 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] Slim3: Global Transaction support, Fast spin-up and HOT reloading
Hi Ikai, > > One question, though: do you have any unit testing examples? E.g. how > would I mock out the datastore or write a Controller test? > Slim3 supports Test-Driven Development. You can find more information here: http://sites.google.com/site/slim3appengine/getting-started/creating-controller-and-test It's a part of Getting Started. http://sites.google.com/site/slim3appengine/getting-started Tests of slim3demo are here: http://code.google.com/p/slim3/source/browse#svn/trunk/slim3demo/test/slim3/demo Slim3 provides the following testing framework: http://code.google.com/p/slim3/source/browse#svn/trunk/slim3/src/main/java/org/slim3/tester Thanks, 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.
[appengine-java] Parallel Asynchronous Datastore Commands with Twig 1.0
Hi Everyone, I am happy to announce the release of Twig 1.0 featuring Parallel Asynchronous Commands, a fluent command interface and tons of performance enhancing features to really make your applications fly and reduce development time. Twig is an alternative to the standard persistence interfaces JDO and JPA, specifically designed to make the most of the underlying datastore's unique features. Twig is the only datastore interface that allows you to execute queries and store data in parallel without blocking. If you run 10 queries in a request your app could now run up to 10 times faster! // execute a query but don't wait for the results Future> futureBands = datastore.find().type(Band.class).returnResultsLater(); // do some other processing or store data while the first command runs Key key = datastore .store ().instances(myLittlePonies).withParent(bigDaddyPony).returnKeyNow(); // now block until the first command is finished Iterator bands = futureBands.get(); Twig is the only interface to support direct unowned relationships so your code is not dependent on low-level datastore classes. It is the only interface to support OR queries by merging together multiple queries, sorting them and filtering out duplicates at the lowest level for performance. No need to register persistent classes - most objects can be stored with _no_ configuration. Twig is built for speed so it has no start- up overhead and provides many unique performance optimisation features. Stop wasting time wrestling with JDO! Details, documents and downloads at http://code.google.com/p/twig-persist/ Or read on for a summary of what else Twig can do... == Persist any Java object graph with no dependencies on the datastore == With Twig you store plain Java objects with direct references to each other - just like real Java. class MusicFestival { Date when; List bands; // Unique to Twig } class Band { @Key String name; // key is optional and can be almost any type int performanceFee; } // create a complex object graph - example taken from the unit tests MusicFestival festival = ... // create an implementation - usually done in a factory or Guice Provider ObjectDatastore datastore = new AnnotationObjectDatastore(); // store the entire object graph of referenced instances Key key = datastore.store(festival); // find all instances of a type Iterator bands = datastore.find(Band.class); Band nostalgia = datastore.load(Band.class, "Nostalgia 77"); // load by key // delete all bands - time to go home datastore.deleteAll(Band.class); == Fluent Interface API == Using Twig's fluent interface makes code easier to read and more difficult to make mistakes. http://martinfowler.com/bliki/FluentInterface.html // store all bands with their record label as parent - notice it knows we will return "keys" Map keys = datastore.store().instances(bands).withParent(label).returnKeysNow(); // find all bands exploited by EMI - we want results now Iterator exploited = datastore.find() .type(Band.class) .addFilter("albums.sold", GREATER_THAN, 1000) .withAncestor(emi) .startFom(15) .returnResultsNow(); You can only ever use options that are valid depending on the other options you have set. Read on to see how "returnResultsLater()" can make your applications faster. == Polymorphism and Inheritance == RockBand extends Band { HairStyle hair; } festival.bands.add(ledZeppelin); datastore.update(festival); You can store any subtype of Band == Embedded Collections == Say we want to display a list of a bands albums when we display the bands profile page. By embedding the collection of albums in the same entity as the band details we can save a lot of load operations. class Band { @Key String name; int performanceFee; @Embed Set albums; // albums are embedded in the same entity } This also means we can query for bands on an albums properties which take multiple queries in JDO and JPA. To find all bands with platinum albums is easy and fast: Iterator popularBands = datastore.find() .type(Band.class) .addFilter("albums.sold", GREATER_THAN, 100) .returnResultsNow(); == Relationships managed directly == No more messing about with Keys and extracting parent keys and creating child keys. class Album { @Key String name; @Child Li
Re: [appengine-java] Slim3: Global Transaction support, Fast spin-up and HOT reloading
There is some interesting stuff in the release, but I've browsed the Global Transaction stuff and I'm a little scared. (http://sites.google.com/site/slim3appengine/slim3-datastore/transactions/global-transaction) It seems that in the code it writes out a task in a queue to close the commits, possibly. I'm pretty sure transactions should not be implemented using queues, for any reason. The complexity of storing temporary lock/tx objects in the datastore, time spent during that transaction, and then pushing them through with a task (maybe much later) seems like a dangerous plan. Supporting multi-entity-group transactions needs to be implemented at the datastore and not in a wrapper like that, IMO. There is no way to rollback any committed transactions from any other entity-group, and there are many other issues as well ... there is too much application specific behavior that can't be assumed. I can think of many reason this is a bad idea, and only very few where this implementation will work well. What happens if you have 3 transactions (1 transaction over 3 entity groups) and the first two entity group transactions commit and the third fails during commit? Is there a way to roll the first two back? What happens if your user expect transactions to work like a database where you have transaction isolation with gets/queries and updated the value of the same entity multiple times from repeated gets? (think of multiple "get, incr. object property, put" where the object only gets incremented by the last amount, not the sum of the increments) Where does the user get an error if the transaction fails later when the task runs from the queue? (sure, that is application specific, but dangerous all the same as the current models don't allow for implicit non-synchronous operations). These seem to be issues with any kind of custom transaction framework on top of appengine, not just specific to the slim3 framework. -Scott On Tue, Mar 9, 2010 at 1:22 PM, nicolas melendez wrote: > cute framework > NM > > On Tue, Mar 9, 2010 at 4:17 PM, Ikai L (Google) wrote: >> >> Hi Yasuo, >> >> Wow, this look neat! I'll go ahead and add this to open source projects. >> >> One question, though: do you have any unit testing examples? E.g. how >> would I mock out the datastore or write a Controller test? >> >> On Tue, Mar 9, 2010 at 12:42 AM, Yasuo Higa wrote: >> > Hi all, >> > >> > We are pleased to announce the release of Slim3 RC1. >> > >> > Slim3 is a full-stack MVC framework optimized for Google App >> > Engine/Java. >> > Our main concept is "Simple" and "Less Is More". "Less is more" means >> > simplicity and clarity lead to good design. >> > >> > The main features of Slim3 are as follows: >> > >> > * Global Transactions >> > * Faster than JDO/JPA >> > * Fast spin-up >> > * HOT reloading >> > * Type safe query >> > >> > You can find more information about Slim3 here: >> > http://slim3.org >> > >> > Thanks, >> > >> > 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. >> > >> > >> >> >> >> -- >> 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. >> > > -- > 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] Slim3: Global Transaction support, Fast spin-up and HOT reloading
cute framework NM On Tue, Mar 9, 2010 at 4:17 PM, Ikai L (Google) wrote: > Hi Yasuo, > > Wow, this look neat! I'll go ahead and add this to open source projects. > > One question, though: do you have any unit testing examples? E.g. how > would I mock out the datastore or write a Controller test? > > On Tue, Mar 9, 2010 at 12:42 AM, Yasuo Higa wrote: > > Hi all, > > > > We are pleased to announce the release of Slim3 RC1. > > > > Slim3 is a full-stack MVC framework optimized for Google App Engine/Java. > > Our main concept is "Simple" and "Less Is More". "Less is more" means > > simplicity and clarity lead to good design. > > > > The main features of Slim3 are as follows: > > > > * Global Transactions > > * Faster than JDO/JPA > > * Fast spin-up > > * HOT reloading > > * Type safe query > > > > You can find more information about Slim3 here: > > http://slim3.org > > > > Thanks, > > > > 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. > > > > > > > > -- > 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. > > -- 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] Jersey + Guice
http://wp.me/PnkVx-2Z A mini tutorial on "JAX-RS Jersey + Guice + Objectify + Simple XML + Jackson on Google App Engine Java" -- 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: Unit testing Servlets
Great news! I'll incorporate this into the article. On Tue, Mar 9, 2010 at 4:12 AM, legendlink wrote: > Hi Ikai L, > > I have tried simple HttpUnit test and it works. I just followed the > HttpUnit (ServletUnit) example in the link below. > > http://httpunit.sourceforge.net/doc/servletunit-intro.html > > I included the JUnit library + HttpUnit library in eclipse. and run > without errors. But I implemented it just like the sample. > > Hope this helps! > > On Mar 6, 4:02 am, "Ikai L (Google)" wrote: >> I'm researching this right now for an article I plan on writing, but >> it's not one of my highest priorities. I've heard HTTPUnit works (I >> have also heard it doesn't work). Lastly, and I know this works for >> sure but it is ugly, you could use raw JUnit with the test in the same >> package (parallel directory structure), but there are many limitations >> of this approach. >> >> HTTPUnit:http://httpunit.sourceforge.net/ >> >> Can you let the group know what you find? >> >> >> >> On Thu, Mar 4, 2010 at 8:24 PM, legendlink wrote: >> > by the way, the error is ExceptionInInitializerError >> > at >> > org.apache.cactus.server.runner.ServletTestRunner.run(ServletTestRunner.java: >> > 297) >> > ... >> > caused by: java.security.accesscontrolexception: access denied >> > (java.io.filepermission dir\junit.properties read) >> >> > i guess it is impossible to use cactus since it can only access web- >> > inf files? >> > if cactus is not possible, is there any other alternatives to test >> > servlets? >> >> > On Mar 5, 12:08 pm, legendlink wrote: >> >> hi, >> >> its really nice that there is local unit testing of datastore and >> >> other google implemented apis. i've been able to test it without >> >> problems. >> >> >> but i also wanted to test my servlets. i tried using cactus and >> >> included libraries of cactus in my project. and added the required >> >> web.xml servlet mappings for cactus to work in my project's web.xml >> >> i run the google dev server without problem but when i access the >> >> cactus test url it throws error.. >> >> >> has anyone tried cactus on google 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 >> > athttp://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. > > -- 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] Extending GAE's Jetty config
No, at the moment we specifically disable jetty-web.xml for security purposes. Feel free to file a feature request in our issue tracker asking us to re-enable it. On Tue, Mar 9, 2010 at 9:52 AM, alesj wrote: > Does GAE use JettyWebXmlConfiguration to allow for WebAppContext > custom configuration - via jetty-web.xml? > I see that class in appengine-local-runtime.jar, but is it part of > Jetty' default Configuration instances? > My guess would be no, as putting invalid jetty-web.xml in WEB-INF > doesn't output any exception. > > This would be useful to allow for different extensions; e.g. custom > injection support -- jsr299/CDI. > > -Ales > > -- > 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] Slim3: Global Transaction support, Fast spin-up and HOT reloading
Hi Yasuo, Wow, this look neat! I'll go ahead and add this to open source projects. One question, though: do you have any unit testing examples? E.g. how would I mock out the datastore or write a Controller test? On Tue, Mar 9, 2010 at 12:42 AM, Yasuo Higa wrote: > Hi all, > > We are pleased to announce the release of Slim3 RC1. > > Slim3 is a full-stack MVC framework optimized for Google App Engine/Java. > Our main concept is "Simple" and "Less Is More". "Less is more" means > simplicity and clarity lead to good design. > > The main features of Slim3 are as follows: > > * Global Transactions > * Faster than JDO/JPA > * Fast spin-up > * HOT reloading > * Type safe query > > You can find more information about Slim3 here: > http://slim3.org > > Thanks, > > 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. > > -- 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: maven-datanucleus-plugin using JDO when JPA specified?
To elaborate, here's the Exception with --debug turned on: [DEBUG] Trace org.apache.maven.BuildFailureException: Compilation failure error: Exception thrown while constructing Processor object: javax/jdo/ PersistenceManagerFactory at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java: 580) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java: 5 00) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java: 479) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.ja va:331) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java: 292) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java: 142) at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java: 336) at org.apache.maven.DefaultMaven.execute(DefaultMaven.java: 129) at org.apache.maven.cli.MavenCli.main(MavenCli.java:301) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java: 39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java: 25) at java.lang.reflect.Method.invoke(Method.java:597) at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315) at org.codehaus.classworlds.Launcher.launch(Launcher.java:255) at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430) at org.codehaus.classworlds.Launcher.main(Launcher.java:375) Caused by: org.apache.maven.plugin.CompilationFailureException: Compilation failure error: Exception thrown while constructing Processor object: javax/jdo/ PersistenceManagerFactory at org.apache.maven.plugin.AbstractCompilerMojo.execute(AbstractCompilerMojo.java: 516) at org.apache.maven.plugin.CompilerMojo.execute(CompilerMojo.java:114) at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java: 453) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java: 559) ... 16 more Any ideas, anyone? On Mar 8, 11:55 am, tkinsella wrote: > Pardon me, I didn't realize 2.0 was not supported. However, using the > latest 1.x version results in the same error for me. > > Here's my new build plugins config: > > > org.datanucleus > maven-datanucleus-plugin > 1.1.4 > > ${basedir}/log4j.properties log4jConfiguration> > true > my_persistence_unit_name persistenceUnitName> > ASM > JPA > > > > process-classes > > enhance > > > > > > I have the following in repositories and pluginRepositories, > respectively: > > > DataNucleus_Repos2 > DataNucleus Repository > http://www.datanucleus.org/downloads/maven2 > > > ... > > DataNucleus_2 > http://www.datanucleus.org/downloads/maven2 > > > And running mvn install, again, produces the following output: > > 8-Mar-2010 11:44:21 AM org.datanucleus.enhancer.DataNucleusEnhancer > > INFO: DataNucleus Enhancer : Using ClassEnhancer "ASM" for API "JDO" > [INFO] > > [ERROR] BUILD FAILURE > [INFO] > > [INFO] Compilation failure > error: Exception thrown while constructing Processor object: javax/jdo/ > PersistenceManagerFactory > > I guess the root of my question is: how do I get past this problem? > Thanks for the responses so far, and thanks in advance for any further > advice! > > Troy > > On Mar 8, 7:32 am, datanucleus wrote: > > > How can you use v2.0 of the DN maven2 plugin when GAE/J only supports > > v1.x ? -- 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] Stripes + FreeMarker throwing exception on GAE
My application uses Stripes and Freemarker. I am already using the freemarker jar version build to gae. Application is working fine in the test GAE Server in my local but when I deploy it I start to get the error bellow. Can anyone help me? 03-09 07:13AM 43.981 /Login.action 500 6043ms 7525cpu_ms 0kb Mozilla/ 5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/532.5 (KHTML, like Gecko) Chrome/4.0.249.89 Safari/532.5,gzip(gfe) 201.58.206.222 - - [09/Mar/2010:07:13:50 -0800] "GET /Login.action HTTP/1.1" 500 0 - "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/532.5 (KHTML, like Gecko) Chrome/4.0.249.89 Safari/ 532.5,gzip(gfe)" "cycling-training.appspot.com" W 03-09 07:13AM 49.961 Nested in net.sourceforge.stripes.exception.StripesServletException: Unhandled exception in exception handler.: java.lang.VerifyError: (class: freemarker/ext/jsp/ FreeMarkerJspApplicationContext, method: signature: ()V) Incompatible argument to function at com.google.appengine.runtime.Request.process-95a1f5578f21927c(Request.java) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:109) at freemarker.ext.jsp.FreeMarkerJspFactory21.class$ (FreeMarkerJspFactory21.java:13) at freemarker.ext.jsp.FreeMarkerJspFactory21.(FreeMarkerJspFactory21.java: 12) at freemarker.ext.jsp.FreeMarkerPageContext21.(FreeMarkerPageContext21.java: 30) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:109) at freemarker.ext.jsp.PageContextFactory.getPageContextImpl(PageContextFactory.java: 21) at freemarker.ext.jsp.PageContextFactory.(PageContextFactory.java: 15) at freemarker.ext.jsp.TagTransformModel.getWriter(TagTransformModel.java: 99) at freemarker.core.Environment.visit(Environment.java:286) at freemarker.core.UnifiedCall.accept(UnifiedCall.java:130) at freemarker.core.Environment.visit(Environment.java:210) at freemarker.core.MixedContent.accept(MixedContent.java:92) at freemarker.core.Environment.visit(Environment.java:210) at freemarker.core.Environment.process(Environment.java:190) at freemarker.template.Template.process(Template.java:256) at freemarker.ext.servlet.FreemarkerServlet.process(FreemarkerServlet.java: 452) at freemarker.ext.servlet.FreemarkerServlet.doGet(FreemarkerServlet.java: 391) 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 net.sourceforge.stripes.controller.StripesFilter.doFilter(StripesFilter.java: 247) 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 org.mortbay.jetty.servlet.Dispatcher.forward(Dispatcher.java:268) at org.mortbay.jetty.servlet.Dispatcher.forward(Dispatcher.java:126) at net.sourceforge.stripes.action.ForwardResolution.execute(ForwardResolution.java: 110) at net.sourceforge.stripes.controller.DispatcherHelper $7.intercept(DispatcherHelper.java:508) at net.sourceforge.stripes.controller.ExecutionContext.proceed(ExecutionContext.java: 158) at net.sourceforge.stripes.controller.HttpCacheInterceptor.intercept(HttpCacheInterceptor.java: 99) at net.sourceforge.stripes.controller.ExecutionContext.proceed(ExecutionContext.java: 155) at net.sourceforge.stripes.controller.BeforeAfterMethodInterceptor.intercept(BeforeAfterMethodInterceptor.java: 113) at net.sourceforge.stripes.controller.ExecutionContext.proceed(ExecutionContext.java: 155) at net.sourceforge.stripes.controller.ExecutionContext.wrap(ExecutionContext.java: 74) at net.sourceforge.stripes.controller.DispatcherHelper.executeResolution(DispatcherHelper.java: 502) at net.sourceforge.stripes.controller.DispatcherServlet.executeResolution(DispatcherServlet.java: 286) at net.sourceforge.stripes.controller.DispatcherServlet.service(DispatcherServlet.java: 170) 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 net.sourceforge.stripes.controller.StripesFilter.doFilter(S
[appengine-java] Extending GAE's Jetty config
Does GAE use JettyWebXmlConfiguration to allow for WebAppContext custom configuration - via jetty-web.xml? I see that class in appengine-local-runtime.jar, but is it part of Jetty' default Configuration instances? My guess would be no, as putting invalid jetty-web.xml in WEB-INF doesn't output any exception. This would be useful to allow for different extensions; e.g. custom injection support -- jsr299/CDI. -Ales -- 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] Unable to upload app: Error posting to URL:
I am getting the following error when trying to upload my app to app engine. What does the 302 Redirected mean? I am behind a proxy could this be part of the problem? Error Tue Mar 09 11:12:47 EST 2010 Unable to upload app: Error posting to URL: http://appengine.google.com/api/appversion/create?app_id=black3live&version=1&302 Redirected See the deployment console for more details com.google.appengine.tools.admin.AdminException: Unable to upload app: Error posting to URL: http://appengine.google.com/api/appversion/create?app_id=black3live&version=1&; 302 Redirected at com.google.appengine.tools.admin.AppAdminImpl.update(AppAdminImpl.java: 59) 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) Caused by: java.io.IOException: Error posting to URL: http://appengine.google.com/api/appversion/create?app_id=black3live&version=1&; 302 Redirected at com.google.appengine.tools.admin.ServerConnection.send(ServerConnection.java: 143) at com.google.appengine.tools.admin.ServerConnection.post(ServerConnection.java: 81) at com.google.appengine.tools.admin.AppVersionUpload.send(AppVersionUpload.java: 415) at com.google.appengine.tools.admin.AppVersionUpload.beginTransaction(AppVersionUpload.java: 229) at com.google.appengine.tools.admin.AppVersionUpload.doUpload(AppVersionUpload.java: 98) at com.google.appengine.tools.admin.AppAdminImpl.update(AppAdminImpl.java: 53) -- 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] Problem updating nested child-objects with JDO
According to: http://code.google.com/intl/de-DE/appengine/docs/java/datastore/creatinggettinganddeletingdata.html#Keys => "If the app creates a new object and gives it the same string ID as another object of the same kind (and the same entity group parent), saving the new object overwrites the other object in the datastore." I would like to do exactly the same to update an existing entity by calling makePersistent() and assigning an existent id/key! The update works fine except for nested objects! The nested objects are appended (added) to the old ones instead of being replacing them? I don't know if this is the intended behaviour or if this is a bug? I expect overwriting to have the same effect as inserting a new entity! This thread discusses exactly the same issue: http://stackoverflow.com/questions/1482570/updating-nested-objects-with-jdo-on-google-app-engine But it seems they have not reached a conclusion yet! Another idea: How about achieving an update by first deleting the old entity and persisting the new one in the same transaction? Does this work? I tried this but it resulted in deleting the entity completely?! I don't know why (even though I tried flushing directly after calling deleting & calling makePersistent() after flushing)! -- 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: problem while deploying app engine
Try this thread about setting up eclipse to handle a proxy: http://www.google.com/url?sa=D&q=http://groups.google.com/group/google-appengine-java/browse_thread/thread/83baef734bc82d7a/&usg=AFQjCNG4ECLL89uyiz16HQyCh7dNx9Rr7w On Feb 16, 7:18 am, vengatesh wrote: > Hi, > > I just started using GWT and I am trying todeploymy firstapponapp > engine.. > > I am getting the following error while doing "DeploytoAppEngine"... > > Unable to updateapp: Connection timed out: connect > com.google.appengine.tools.admin.AdminException: Unable to updateapp: > Connection timed out: connect > at > com.google.appengine.tools.admin.AppAdminImpl.update(AppAdminImpl.java: > 62) > 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) > Caused by: java.net.ConnectException: Connection timed out: connect > at java.net.PlainSocketImpl.socketConnect(Native Method) > at java.net.PlainSocketImpl.doConnect(Unknown Source) > at java.net.PlainSocketImpl.connectToAddress(Unknown Source) > at java.net.PlainSocketImpl.connect(Unknown Source) > at java.net.SocksSocketImpl.connect(Unknown Source) > at java.net.Socket.connect(Unknown Source) > at com.sun.net.ssl.internal.ssl.SSLSocketImpl.connect(Unknown Source) > at com.sun.net.ssl.internal.ssl.BaseSSLSocketImpl.connect(Unknown > Source) > at sun.net.NetworkClient.doConnect(Unknown Source) > at sun.net.www.http.HttpClient.openServer(UnknownSource) > at sun.net.www.http.HttpClient.openServer(UnknownSource) > at sun.net.www.protocol.https.HttpsClient.(Unknown Source) > at sun.net.www.protocol.https.HttpsClient.New(UnknownSource) > at > sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.getNewHttpClien... > Source) > at sun.net.www.protocol.http.HttpURLConnection.plainConnect(Unknown > Source) > at > sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(Unknown > Source) > at > sun.net.www.protocol.http.HttpURLConnection.getOutputStream(Unknown > Source) > at > sun.net.www.protocol.https.HttpsURLConnectionImpl.getOutputStream(Unknown > Source) > at > com.google.appengine.tools.admin.ServerConnection.connect(ServerConnection.java: > 338) > at > com.google.appengine.tools.admin.ServerConnection.send(ServerConnection.java: > 133) > at > com.google.appengine.tools.admin.ServerConnection.post(ServerConnection.java: > 82) > at > com.google.appengine.tools.admin.AppVersionUpload.send(AppVersionUpload.java: > 532) > at > com.google.appengine.tools.admin.AppVersionUpload.beginTransaction(AppVersionUpload.java: > 349) > at > com.google.appengine.tools.admin.AppVersionUpload.doUpload(AppVersionUpload.java: > 111) > at > com.google.appengine.tools.admin.AppAdminImpl.update(AppAdminImpl.java: > 56) > ... 4 more > > any help would be highly appreciated.. > > 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] Issue with updating owned one to many relationship
Hi, Though it is a guess System.out.println("--Update--"); //parent = read(parentId); //You comment here parent.getChildren().add(new Child("childId2")); I think that it can register two children by this method. Please try. thanks. >Hi, >I am having problem with updating an owned one-to-many relationship. > >It seems to me that the relationship is not updated when add a child >during update. The same during create is working fine. >Here is a sample code about which I am talking about, > >Parent class: >@PersistenceCapable(detachable="true") >public class Parent { > >@PrimaryKey >@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY) > private Key key; > > @Persistent > private String parentId; > > @Persistent > List children; > > public Parent(String parentId, List children) { > this.parentId = parentId; > this.children = children; > } > > // ... > >} > >Child Class: >@PersistenceCapable(detachable="true") >public class Child { > > @PrimaryKey >@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY) > private Key key; > > @Persistent > private String childId; > > public Child(String childId) { > super(); > this.childId = childId; > } > > // ... >} > >Test Class: > String parentId = "parentId3"; > > List children = new ArrayList(); > children.add(new Child("childId1")); > Parent parent = new Parent(parentId, children); > > System.out.println("--Create--"); > persist(parent); // There is only one child now - childId1 > > System.out.println("--Update--"); > parent = read(parentId); > parent.getChildren().add(new Child("childId2")); // There are >two >children - childId1, childId2 > persist(parent); > > System.out.println("--Verify--"); > read(parentId); // ERROR: There is only one child - childId1 > >In the third step when I try to verify the existence of two children, >I am getting only one!. >Note: I am explicitly detaching the object in both read and persist >methods. > >Any help regarding this will be much appreciated. I can zip the >complete code and send if needed. > >Thanks, >Anoop > >-- >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: elegant way of implementing sequence generator
You could also go with the sharded counter strategy. The more shards you have, the less the chance that you'll have a collision, and you'd use @Version for optimistic locking on each shard. On Mar 9, 7:18 am, legendlink wrote: > Thanks for the reply. > > If memcache is used, how do I implement it so that the counter would > always be updated and not be deleted? > > On Mar 6, 4:35 am, "Ikai L (Google)" wrote: > > > Have you looked into Memcache's INCR? > > >http://code.google.com/appengine/docs/java/javadoc/com/google/appengi..., > > long) > > > This'll do it atomically, but you run the risk of it being volatile, > > so you'll have to account for that in your client code. > > > On Tue, Mar 2, 2010 at 11:40 PM, legendlink wrote: > > > hi, i wanted to have a sequence generator that increments by x value > > > everytime it generates a value. if i would create the sequence > > > generator by using the datastore, it is likely that data contention > > > would occurr if there is high access times. > > > > i have looked into the sample code of max ross in the google code > > > repository (SequenceExamplesJDO.java) and think this is limited to > > > increment by 1 only and not increment by x value. > > > > if sharding technique is used, my concern is that i might not get the > > > right sequence. > > > > what is the best/elegant way of doing sequence generator that > > > increments x 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-j...@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. > > > -- > > 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.
Re: [appengine-java] Problem with using Apache HttpClient
Hi. Though I do not understand the content of processing in detail. If it is possible to substitute it I recommend the use of [com.google.appengine.api.urlfetch]. Please try. thanks. >Hi Group, > >I have a problem. I want to make a HTTP Post request using Apache >HttpClient. In the development environment everything works fine. But >in the production environment I get the following exception: > >Uncaught exception from servlet >java.lang.NoClassDefFoundError: javax.net.ssl.HttpsURLConnection is a >restricted class. Please see the Google App Engine developer's guide >for more details. > at javax.net.ssl.HttpsURLConnection.(HttpsURLConnection.java) > at >org.apache.http.conn.ssl.SSLSocketFactory.(SSLSocketFactory.java: >255) > at >org.apache.http.conn.ssl.SSLSocketFactory.(SSLSocketFactory.java: >166) > at >org.apache.http.impl.client.DefaultHttpClient.createClientConnectionManager >(DefaultHttpClient.java: >219) > at >org.apache.http.impl.client.AbstractHttpClient.getConnectionManager >(AbstractHttpClient.java: >312) > at >org.apache.http.impl.client.DefaultHttpClient.createHttpContext >(DefaultHttpClient.java: >254) > at >org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient. >java: >618) > at >org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient. >java: >576) > at >org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient. >java: >554) > >The problem is, that I'm not trying to use SSL. It is a very normal >HTTP request (in fact I try uploading a photo to Flickr). Does anyone >know how to get rid of this problem? > >Thank you, >Moritz > >-- >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: elegant way of implementing sequence generator
Thanks for the reply. If memcache is used, how do I implement it so that the counter would always be updated and not be deleted? On Mar 6, 4:35 am, "Ikai L (Google)" wrote: > Have you looked into Memcache's INCR? > > http://code.google.com/appengine/docs/java/javadoc/com/google/appengi..., > long) > > This'll do it atomically, but you run the risk of it being volatile, > so you'll have to account for that in your client code. > > > > On Tue, Mar 2, 2010 at 11:40 PM, legendlink wrote: > > hi, i wanted to have a sequence generator that increments by x value > > everytime it generates a value. if i would create the sequence > > generator by using the datastore, it is likely that data contention > > would occurr if there is high access times. > > > i have looked into the sample code of max ross in the google code > > repository (SequenceExamplesJDO.java) and think this is limited to > > increment by 1 only and not increment by x value. > > > if sharding technique is used, my concern is that i might not get the > > right sequence. > > > what is the best/elegant way of doing sequence generator that > > increments x 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-j...@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. > > -- > 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: Unit testing Servlets
Hi Ikai L, I have tried simple HttpUnit test and it works. I just followed the HttpUnit (ServletUnit) example in the link below. http://httpunit.sourceforge.net/doc/servletunit-intro.html I included the JUnit library + HttpUnit library in eclipse. and run without errors. But I implemented it just like the sample. Hope this helps! On Mar 6, 4:02 am, "Ikai L (Google)" wrote: > I'm researching this right now for an article I plan on writing, but > it's not one of my highest priorities. I've heard HTTPUnit works (I > have also heard it doesn't work). Lastly, and I know this works for > sure but it is ugly, you could use raw JUnit with the test in the same > package (parallel directory structure), but there are many limitations > of this approach. > > HTTPUnit:http://httpunit.sourceforge.net/ > > Can you let the group know what you find? > > > > On Thu, Mar 4, 2010 at 8:24 PM, legendlink wrote: > > by the way, the error is ExceptionInInitializerError > > at > > org.apache.cactus.server.runner.ServletTestRunner.run(ServletTestRunner.java: > > 297) > > ... > > caused by: java.security.accesscontrolexception: access denied > > (java.io.filepermission dir\junit.properties read) > > > i guess it is impossible to use cactus since it can only access web- > > inf files? > > if cactus is not possible, is there any other alternatives to test > > servlets? > > > On Mar 5, 12:08 pm, legendlink wrote: > >> hi, > >> its really nice that there is local unit testing of datastore and > >> other google implemented apis. i've been able to test it without > >> problems. > > >> but i also wanted to test my servlets. i tried using cactus and > >> included libraries of cactus in my project. and added the required > >> web.xml servlet mappings for cactus to work in my project's web.xml > >> i run the google dev server without problem but when i access the > >> cactus test url it throws error.. > > >> has anyone tried cactus on google 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 > > athttp://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: Failing to properly detach children in owned one-to-many relationship
Finally fixed after a tip from DataNucleus over on stackoverflow... pm.getFetchPlan().setGroup("decks"); pm.getFetchPlan().setGroup("cards"); should actually be pm.getFetchPlan().addGroup("decks"); pm.getFetchPlan().addGroup("cards"); The setgroup methods overwrite whatever groups are already there, and the addgroup methods just add them. Lesson learned the hard way. On Mar 9, 12:07 am, tempy wrote: > All sorts of permutations have still failed to do this for me. From > searching this group and stackoverflow, I'm starting to wonder if many > people actually use JDO attach/detach in any significant way. > Anyone?? > > On Mar 8, 12:29 am, tempy wrote: > > > > > I am trying to load the full object graph for User, which contains a > > collection of decks, which then contains a collection of cards, as > > such: > > > User: > > @PersistenceCapable(detachable = "true") > > @Inheritance(strategy = InheritanceStrategy.SUBCLASS_TABLE) > > @FetchGroup(name = "decks", members = { @Persistent(name = > > "_Decks") }) > > public abstract class User { > > @PrimaryKey > > @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY) > > protected Key _ID; > > @Persistent > > protected String _UniqueIdentifier; > > @Persistent(mappedBy = "_Owner") > > @Element(dependent = "true") > > protected Set _Decks; > > protected User() > > { > > } > > > } > > > Each Deck has a collection of Cards, as such: > > @PersistenceCapable(detachable = "true") > > @FetchGroup(name = "cards", members = { @Persistent(name = > > "_Cards") }) > > public class Deck { > > @PrimaryKey > > @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY) > > private Key _ID; > > @Persistent > > String _Name; > > @Persistent(mappedBy = "_Parent") > > @Element(dependent = "true") > > private Set _Cards = new HashSet(); > > @Persistent > > private Set _Tags = new HashSet(); > > @Persistent > > private User _Owner; > > > } > > > And finally, each card: > > @PersistenceCapable > > public class Card { > > @PrimaryKey > > @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY) > > private Key _ID; > > �...@persistent > > private Text _Question; > > @Persistent > > private Text _Answer; > > @Persistent > > private Deck _Parent; > > > } > > > I am trying to retrieve and then detach the entire object graph. I > > can see in the debugger that it loads fine, but then when I get to > > detaching, I can't make anything beyond the User object load. (No > > Decks, no Cards). At first I tried without a transaction to simply > > "touch" all the fields on the attached object before detaching, but > > that didn't help. Then I tried adding everything to the default fetch > > group, but that just generated warnings about GAE not supporting > > joins. I tried setting the fetch plan's max fetch depth to -1, but > > that didn't do it. Finally, I tried using FetchGroups as you can see > > above, and then retrieving with the following code: > > > PersistenceManager pm = _pmf.getPersistenceManager(); > > pm.setDetachAllOnCommit(true); > > > pm.getFetchPlan().setGroup("decks"); > > pm.getFetchPlan().setGroup("cards"); > > > Transaction tx = pm.currentTransaction(); > > > Query query = null; > > try { > > tx.begin(); > > > query = pm.newQuery(GoogleAccountsUser.class); > > //Subclass of User > > query.setFilter("_UniqueIdentifier == TheUser"); > > query.declareParameters("String TheUser"); > > > List results = (List)query.execute(ID); > > //ID = Supplied > > parameter > > > //TODO: Test for more than one result and throw > > if(results.size() == 0) > > { > > tx.commit(); > > return null; > > } > > else > > { > > User usr = (User)results.get(0); > > > //usr = pm.detachCopy(usr); > > tx.commit(); > > return usr; > > } > > > } finally { > > query.closeAll(); > > if (tx.isActive()) > > { > > tx.rollback(); > > } > > pm.close(); > > } > > > This also doesn't work, and I'm running out of ideas. I'm new to GAE/ > > JDO, so go easy please. =) > > > Thanks, > > Mike -- You received this message because you are subscribed to the Google Groups "Google App Engine for Java" group
[appengine-java] Re: JDO Level2 Cache setup for dummies
DataNucleus knows nothing about your environment ... local or GAE/J. It simply knows to call javax.cache API to store and retrieve objects. The rest is down to Googles infrastructure. Look in the log ... it tells you when objects are L2 cached and when retrieved from the L2 cache, and compare the log with what you have locally. -- 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: JDO Level2 Cache setup for dummies
Hi, With the cache enabled I get a huge performance gain. In total it looks close to my handmade cache. And it is so easy to put in place... The First request takes some time but subsequent are really quick. The problem is that it only works only on localhost. When I deploy my application I get a deadline error. A regular request takes 13sec (I retrieve about 300 entities and return a list, each entity contains about 4 fields). If I do the same with the jdo cache I get to the limit of 30 seconds and my process gets killed. So the cache takes a huge overhead (in contrary to my homemade solution). Could I be missing some configuration? Right now I put this: and the jar. No annotations, nothing else. Thank you for any advice. Toby On Mar 8, 1:11 pm, datanucleus wrote: > > Do I understand right, that this L2 cache is doing exactly the same? > > Indeed, part of the JDO1/JDO2 and JPA2 specs. > > > Why is it not disabled by default (are there draw backs)? > > It *is* disabled by default in DataNucleus 1.x. It is enabled by > default in DataNucleus 2.x (which GAE/J doesn't support still). -- 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] Slim3: Global Transaction support, Fast spin-up and HOT reloading
Hi all, We are pleased to announce the release of Slim3 RC1. Slim3 is a full-stack MVC framework optimized for Google App Engine/Java. Our main concept is "Simple" and "Less Is More". "Less is more" means simplicity and clarity lead to good design. The main features of Slim3 are as follows: * Global Transactions * Faster than JDO/JPA * Fast spin-up * HOT reloading * Type safe query You can find more information about Slim3 here: http://slim3.org Thanks, 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.