I am using subtable inheritance strategy to design my data store using JDO for my application hosted in google app engine. There are three types of users that can logs into my app.
these are the classes that I designed for this purpose 1) User(Abstract)
2)UserType1 extends User 3) UserType2 extends User 4) UserType3 extends User. Now the problem is every time I want to find an user based on the userId I have to check each entity kind separatly. It will become more problem when the user types increases. Please help how to design the model classes in this scenario.
Thanks
you're looking for JDO2's superclass-table inheritance technique. it works similar to the python app engine PolyModel class.
unfortunately, app engine doesn't support superclass-table right now. instead, consider consolidating all of the different class's fields into a single User class with a type enum.
Related
I may sound noob while asking this.
I want to build a mechanism where, when a value of property of Google Datastore's entity changes, the corresponding user(email is present in some another property value for same entity) should be notified of the change. Does Google Datastore support this kind of mechanism, which is similar to Redis PubSub?
Any ideas how to integrate Google PubSub or webhooks with Google Datastore?
Also how to determine that the user is currently active i.e. how to check if the user has my gae application open in his browser?
Google Datastore doesn't have such mechanism. The only way is to send notification from your app, when your code updates datastore.
Totally possible. If you are using the NDB datastore and Python, for example, you would define in your model a _post_put_hook function. Every time an entity of this model changes, your code will be called. Your code can then look up the user and send them an email (or take whatever other necessary action).
Here is the relevant Python documentation for Model Hooks:
https://cloud.google.com/appengine/docs/python/ndb/entities#hooks
I hope that answers your question.
I have an iOS app that currently stores and pulls its data in/from SharePoint lists via a web service. I want to have the option in settings for the app to also use another database or cloud database i.e. parse.com
I don't want to have to put if statements all throughout my code to test whether the app is set up to use either of the repositories.
What's the best way in an iOS app to architect it to use multiple repositories/databases to store and retrieve the data used in the app?
Build a data manager class that handles the logic. I would go so far as to create one for each service you are attaching to. They can all inherit from a single base class and share the local cache code (which I am assuming is Core Data based on your tags). Then on launch you can instantiate the one you want to use.
I would NOT use a Singleton as suggested. Better to use Dependency Injection and be able to tear down and build up a new data manager if you switch between services while your application is running. Using a singleton would be a poor design decision.
If you localize all of your network code into a single class (something I was speaking about last year as a Network Controller) you can then easily switch between services by keeping your interfaces the same.
I am in process of designing a SaaS application over PaaS (Google App Engine).
My SaaS will have two user interfaces:
Web Based
Mobile App based
Web based would be feature-rich whereas Mobile app would have essential and/or frequently used features.
Mobile app would invoke RESTful services to perform business logic.
This SaaS would target mainly individuals using Mobile Apps; however, there could a use-case wherein these individuals could form a group and operate as a company.
So with that in mind, I am considering two entities: Account (Tenant) and User.
I am considering having many-to-many relationship between these two entities as one user could be part of multiple Accounts (unlikely but can’t be ruled out) and of course, one account can have multiple users.
I would like to know the best practices for authentication under such scenario:
Should I use Google's provided Authentication or should I implement my own authentication? (I am still exploring OAuth and Google's authentication offering.)
I think, for web-based interface, username/password over SSL would suffice. But, not sure, can this be applied to mobile app?
Can I avoid a situation wherein I have to store credentials in mobile app?
Thanks in advance for any help you can provide on this.
A
Having just completed my first project using Google App Engine, I can say that I ran into alot of the questions that you have. I'll try to explain my approach to each point and also approach it from your perspective as well.
Authentication - Generally using Google's auth would be the easiest route, but you would still have to implement a custom adaptation in order to work with the "company"/"group" concept. Implement in the datastore/whatever database you prefer to use an entity called "Groups" which have a list of google users... this way users can belong to many groups.. then you just search by property (user) to get all groups they belong to. I implemented my own authentication system for unrelated reasons.
Google App Engine comes with SSL/HTTPS support for its own domains. You can add in your own custom domain with SSL support as well. You can use SSL through native apps or mobile web apps additionally. I simply used the native support that came with it.
Yes and no. You will always have to store the credentials somewhere. Maybe it wont be in your apps code/directly connected to your app (Google auth would be an example). But somewhere, on your phone, the credentials WILL reside. They may be encrypted/obfuscated, but they will be there. So either have your user enter them in everytime, or save them/use the ones provided by the phone. For myself, .NET provided a nice way of storing credentials in a secure fashion (non-plain-text) for each user's machine.
I'm building a Google App Engine server alongside an Android client using the Google plugin for Eclipse. I have an unexpected problem when using the automated tool to generate the Android client library for calling the server APIs.
I have 3 model classes on the server-side: User, UserLocation, DeviceInfo.
User has a OneToOne relationship with UserLocation, and a OneToOne relationship with DeviceInfo (both of these relationships are owned by User).
I'm using JPA annotations to model these relationships in the server model classes.
After implementing the model classes, I then use the plugin to "Generate cloud endpoint client library", which automatically adds libraries to my Android client enabling me to perform CRUD operations on the model classes.
This all works great, except that the plugin generates multiple User, UserLocation, and DeviceInfo classes, one for each of the three endpoints. The problem manifests when I try to add a User object to a DeviceInfo object, because the DeviceInfo object expects a different User class than the one I'm trying to add.
I hope that makes sense.
How can I associate a User object with a DeviceInfo object?
I am a fan of the extensibility of the CMSes. You can upload some code (usually PHP), authorize it from the CMS admin panel and it's running.
I wonder if it is possible in Google App Engine. I haven't checked the extensibility of existing CMSes for Google App Engine, but if there is any of them that supports plugins I would like to know how they did it, and whether they are JS plugins only, or if they support Python/Java plugins too.
Nick Johnson from Google wrote an entire blog post series on how to write a blog system for app engine. If it doesn't do what you want, I am sure that you can extend it but normally a blogging system is sufficient for a CMS for most people.
I don't have a public example to point to (sorry), but I can confirm that it is possible to create Python plugins for an App Engine project. I completed a project a few months ago that does something like this. The crux of the thing comes down to a single line of python:
exec plugincode in someDict
Above 'plugincode' is a string containing some python code to execute, and someDict is a dictionary of globals to execute it in. This is arguably cleaner than using eval(). In our case the globals dictionary contained an instance of an object that the plugincode used to communicate with the system. I can't think of any major limitations with this (or similar) approaches. e.g. plugincode could declare a class, and register an instance of that class as a callback handler etc etc.
In our case we stored the plugin code in the Data Store, and loaded it at appropriate times (e.g. when an instance of the app is started).
Actually I see no conceptual problem with supporting plugins in App Engine application. For example on Java you may fetch plugin jar to memory from data store or memcache (on application initialization phase), and then use custom class loader to load plugin classes as needed). Actually you even may load classes from request data and evaluate them on the fly if needed (how we do it in AppWrench Java console).
Regards,
Pavel.