[appengine-java] Re: How to completely erase the datastore of an app
Hi Max, I've got a similar servlet too... I was guessing if there was a built-in method in GAE API. I would like also to delete and rebuild my indexes, but I cannot find the way... Do you know any strategy to cope with index management? Thank you Bye CRI On Dec 30, 8:18 pm, Max <6738...@gmail.com> wrote: > Hi CRI, > > I ran into this as well, however, the Datastore viewer only allows someone to > view a certain number of entries at a time. If you're app has thousands of > saved entities, it can be time consuming to delete them all. I created a few > simple tasks to do this for me. I make these both POSTs and only invoke them > manually from my computer using RESTClient. > > NOTE: I'm using objectify. > The first one loops through each class type and calls a servlet to delete > each of that type: > > Class[] clazzes = {Operator.class, > DDMessage.class, Event.class, > DailyStatus.class, DocumentGroup.class, Document.class, > StatusCapture.class}; > > for (Class clazz : clazzes) { > > Queue queue = > QueueFactory.getQueue("trashcan"); > queue.add(withUrl("/deletealloftype") > .param("kind", > clazz.getName()) > .method(POST)); > } > > This servlet deletes each item one after another until it hits the deadline, > and then it puts itself back in the task queue. > > try { > DAO dao = new DAO(); > > Class clazz = > Class.forName(request.getParameter("kind")); > > Query query = dao.ofy().query(clazz); > > QueryResultIterator iterator = > query.iterator(); > while (iterator.hasNext()) { > Object o = iterator.next(); > Objectify ofy = dao.fact().beginTransaction(); > ofy.delete(o); > ofy.getTxn().commit(); > } > > } catch (DeadlineExceededException dee) { > Queue queue = QueueFactory.getQueue("trashcan"); > queue.add(withUrl("/deletealloftype") > .param("kind", > request.getParameter("kind")) > .method(POST)); > } > > Hope this helps, > MG > > On Dec 29, 2010, at 11:00 AM, Didier Durand wrote: > > > > > > > > > Hi, > > > You can very easily empty your datastore using the Datastore viewer of > > the admin console: you can select and delete all entities from the > > viewer screen. > > > regards > > > didier > > > On Dec 29, 4:52 pm, cghersi wrote: > >> Hi, > > >> I've got an app on GAE with 4 versions, up to now. > > >> Until the 4th version I had an entity with an ancestor, so its keys > >> were of the type (EntityID-AncestorID). > >> In the 5th version I changed my design and now this entity hasn't got > >> ancestor any more. Its keys are now simple long values. > > >> On my development server all is OK, given that my local datastore has > >> been correctly updated. > >> But with the online app I'm not able to remove the unused indexes and > >> to create entities with the new long key. > > >> How may I completely erase my datastore online in order to rebuild it > >> from scratch? > > >> Thank you very much!!! > >> Bye > >> CRI > > > -- > > 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. -- 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: Entity relationship designing - best practice
I have the same question but this is leading to much bigger relationship model. As students, they may not have many exams, but I am working on an app for financial institute so a banking client has more than 100,000,000 transactions for different account. Therefore, should I group all transactions into the same entity group of one account or should I still leave it separate and let an account object contain 100,000,000 keys? Thanks in advance WillSpecht wrote: > http://www.google.com/events/io/2009/sessions/BuildingScalableComplexApps.html > > this is a pretty good discussion on building apps that have lots of > child objects. I also think you are prematurely optimizing. How many > exams is a user going to have? 100, 200? This is still a tiny number > and if you went with RB's method or the one in the link I posted, you > have to run a separate query each time, which has its own costs. I > think either way is fine until you start having users that have > thousands of exams. > > On Dec 21, 3:05 am, Richard Berger wrote: > > Har_Shan: > > > > I have been thinking about this topic also (but sadly, am not much of > > an expert). I am using Objectify as a layer on top of the Datastore. > > Their website has a lot of good information on structuring data in the > > Datastore - > > seehttp://code.google.com/p/objectify-appengine/wiki/Concepts?tm=6 > > ). > > > > There is also a good post on the various ways of handling 1 to many > > relationships using Objectify. What appeared to be something that > > would work in your situation (which is like my situation) is what I > > think of as the "database approach". What I mean by that is, if you > > had a 1 to many relationship, how would you model that in a database? > > Specifically if 1 User can have Many Exams, you would have... > > > > User table > > * userId > > * Other user fields > > > > Exam table > > * examId > > * userId > > * Other exam fields > > > > So, turning this into GWT/Objectify, it would be > > > > public class User { > > @Id private Long id; > > // Other user fields > > > > } > > > > public class Exam{ > > @Id private Long id; > > private Key userKey; > > // Other exam fields > > > > } > > > > The way to find all the exams for a particular user (represented by > > "this") is: > > Objectify ofy = ObjectifyService.begin(); > > Key userKey = new Key(User.class, this.id); > > List result = ofy.query(Exam.class).filter("userKey", > > userKey).list(); > > > > This is explained (much better than I could do) > > at:http://code.google.com/p/objectify-appengine/wiki/IntroductionToObjec... > > > > This may not solve all (or any) of your use cases, but it has worked > > for me in my admittedly very limited usage. > > Also check > > out:http://groups.google.com/group/objectify-appengine/browse_frm/thread/... > > > > Enjoy, > > RB > > > > On Dec 19, 12:17 am, Matej wrote: > > > > > I am not expert in dataStore this is just what I would do: > > > Add new entity with fields: > > > ID OrderID UserID ExamID PageID QuestionID AnswerID > > > > > Yes it is a lot of redundant data, but simple. > > > When user starts new Exam, all data are created with AnswerID set to > > > general answer unAnswer. After that you just update AnswerID. > > > > > What are obstacle in design like this? > > > > > Best, M -- 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] App calling another secured App
Hi, I am trying to build 2 apps. App 1 is calling App 2 through URL Fetch but App 2's URL is secured so when APP 1 is fetching something from APP 2, it requires authentication, both apps belong to the same gmail account though. How do I do that? Do I use URL Fetch with GET and submit login to APP 2? Any idea? Thanks, Andy -- 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: Entity relationship designing - best practice
Thanks all for comments. It really helped. I settled in this relationship which seems solve all problems, atleast as of now. Entity Group (EG) #1 User - User related CRUD can be done EG#2 Exam -Exam related CRUD can be done EG#3 PageIndex - Contains all (keys of) Pages under Exam, in order. Page CR and D, (re)ordering of Pages can be done simply & maintaining data integrity. Page - Page CRUD can be done. Deletion will just happen in PageIndex first and then here. Can also done in transaction if needed as we are in same EG QuestionIndex - Contains all (keys of) Questions under a Page in order. Question (re)ordering can be done. Note Question can be reordered within a Page or from 1 page to another and can be done as all QuestionIndex are in same EG. Also Question CR, D can be done. EG#4 Question- Actual Question CRUD. Like Page, deletion of Question will happen in QuestionIndex (yes only its key) and lated propagated to actual entity here. Its ok if deletion of key of Question happens in QuestionIndex passes and it fails when actual Question is deleted, as we can try again later and the single source of truth would be QuestionIndex Answer - Answer CRUD Hope this also helps someone. I would be happy if someone points out flaws in my modeling. Andy, Am not clear about yr question. May be if you could show what are the relevant entities and what exactly should be the relationship btw them, i can share my 2 cents. -- 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] Eclipse Plugin: JDO JavaDocs aren't attached
Hi folks, For example, after "Open Declaration" on PersistenceManager class, Eclipse says sources aren't attached. I thought they aren't included in plugin, but recently found that ~/.eclipse/plugins/com.google.appengine.eclipse.sdkbundle.1.4.0_1.4.0.v201012021500/appengine-java-sdk-1.4.0/src/orm/jdo2-api-2.3-SNAPSHOT-src.zip has the sources. Seems other archives there are attached, it would be great to have this one attached by default. -- 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: persistent and scalable global atomic counter: not possible with GAE?
OK, so here is our solution: http://bit.ly/ec3Yyw The main idea: we are combining Datastore sharding counters with atomic counters in Memcache to implement sequences. Our Sequence class has one (overloaded) static method: long Sequence.next(String sSequenceName). The method itself performs three simple steps: Step 1. Increment both the datastore counter (sharding) and the memcache counter (atomic), if the latter is present. If it is, return its new value. This step is scalable. Step 2. If the memcache counter is not present, “serially” synchronize it with the datastore counter. This step can be viewed as an analog of lock(Sequence); synchronize counters; unlock(Sequence); Step 3. Repeat step 1. Our resulting sequence is "growing" and unique because: 1. The value of the DB counter is always equal to, or larger, than the value of the memcache counter, because the DB (sharding) counter is always incremented before the memcache counter. 2. We return only atomic increments of the memcache counter. 3. When the memcache counter is initialized, it is set to a value that is greater than any possible previous memcache value. Full source code is available here: http://bit.ly/ec3Yyw Any feedback? MG -- 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: JDO JavaDocs aren't attached
Even worse, attachments are erased on Eclipse restarts. -- 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] App calling another secured App
Perhaps you can use a shared keyed encryption method to secure the communications between your two apps. Trying to use the browser based authentication methods for app to app communications forces you to manage sessions etc. which allows for attacks like man-in-the-middle and session stealing. If you control both ends of the handshake, a shared secret is simple to implement and easiest to maintain. On Fri, Dec 31, 2010 at 7:18 AM, Andy wrote: > Hi, > > I am trying to build 2 apps. App 1 is calling App 2 through URL Fetch but > App 2's URL is secured so when APP 1 is fetching something from APP 2, it > requires authentication, both apps belong to the same gmail account though. > How do I do that? Do I use URL Fetch with GET and submit login to APP 2? > Any idea? > > Thanks, > > Andy > > -- > 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. > -- -- A. Stevko === "If everything seems under control, you're just not going fast enough." M. Andretti -- 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.