[appengine-java] Re: Dissociate app from Google Apps domain?

2011-01-17 Thread l.denardo
Maybe you can do something like that:

*Use openID APIs to log in your user (you can serve all Google Apps
domains with a single app. This is no more tied to a single domain).
See 
http://code.google.com/appengine/docs/java/users/overview.html#Authentication_Options
and http://code.google.com/appengine/articles/openid.html for a guide.

*Keep the old version of the app for your existing customer, tied to
their domain.

All it requires is a double deploy (maybe with some minor tweaks to
keep the openID stuff out of the old customer's version) for your
application.

If you want to migrate your old customer's data to the new app, you
can also see if new tools for massive data migration (see announcement
of high replication datastore) can do the job you need. Some time ago
userIDs were stable across login options (google apps domain / openID)
so it should not be hard to migrate everything.

Regards
Lorenzo

On Jan 14, 11:02 am, Alexander Bertram a...@bedatadriven.com wrote:
 Hi there,

 I'm seeking some divine intervention from the Google AppEngine team to
 help grow one of our apps. The first version was developed for a
 single client and linked to their Google Apps domain. Now as we seek
 to market to other clients, it does not seem possible to unlink the
 app from the original Apps domain. The only solution seems to be to
 create another app and migrate the data. This is possible, but will
 require quite a bit of time because:

 1) The app contains a large number of blobs linked to datastore
 entities, which would have to be downloaded and reuploaded, and all
 the keys migrated
 2) Many of the entities are large ( 200-500k ) and seem to choke up
 the python data migration tools that I've tried.

 We've already replaced the UserService API with the Step2 consumer so
 the big problem now is associating the app with another Google Apps
 domain so we can change from coolapp.theclient.com to coolapp.com

 Migrating the data is possible, but if someone at google could throw a
 switch somewhere, (or if there's another solution), we'd prefer to
 spend the week developing the app rather than migrating data!!

 Best,

 Alex

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



[appengine-java] Re: Cross Browser Issue - Internet Explorer Blank

2011-01-17 Thread l.denardo
Cannot find it on gwt group...
Anyway, if it's blank on IE only it's usually because you have a
coment before your doctype declaration.
IE goes crazy if it finds anything different from blank spaces before
it...switches to quirks mode so any panel for standards mode does not
show at all.

Regards
Lorenzo

On Jan 15, 5:19 pm, Segeboy segun.sob...@gmail.com wrote:
 duh ... thnx

 On Jan 14, 7:03 pm, Didier Durand durand.did...@gmail.com wrote:

  Hi,

  as it based on gwt (saw it in viewing page source code) and as it
  probably is a javascript issue, you've better chance if you ask in the
  GWT forum (and provide a bit more details on how its written)

  regards

  didier

  On Jan 14, 1:31 pm, Segeboy segun.sob...@gmail.com wrote: My app located 
  @ demo.schoolgrep.appspot.com is showing up as a blank
   page on internet explorer (tried version 6 and 8) but loads up fine on
   safari/chrome/firefox. Any ideas as to what the issue might be?

   Thanks

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



[appengine-java] Re: Our experience with App Engine

2011-01-12 Thread l.denardo
Good points!
Having one year of experience with GAE my only hard complaint is the
lack of polymorphism for the Java datastore (JDO queries), and the
lack of strong type checking of datastore Entities (simply working
with a map entity field is a nightmare if you use the low level API).
This forces to re-engineer your data model in clumsy ways, any time
you must model a tree data structure, even worse if your tree nodes
need to contain different data (subclasses of a same base class)...of
course, my app is full of these...

I guess this will be hard to get rid of, since everything seems  to
track back to the way keys are generated (ancestor, appID, etc.), but
I hope some improvements will be available in the future.

For the rest of the options, I completely agree with you.

- JRE whitelisting - yeah, every company we've talked to has mentioned this.
Unfortunately, every developer has different requirements. The
whitelisting
process is a bit more involved, as there are many security issues that
need
to be ironed out. I'd love to see the awt libraries available,
personally.

I hope too, since awt would open up to many PDF generation libraries
and so, which are just impossible to use right now.

Regards
Lorenzo
On Jan 11, 10:09 pm, George Moschovitis george.moschovi...@gmail.com
wrote:
  - JDO - we've changed the documentation to show examples using the
  low-level API and are working more closely with third-party library
  developers. We've realized that there's a passionate community of open
  source developers out there solving their own itch (itches that are likely
  shared by others), and we're working on different ways of making it happen.

 Interesting, haven't noticed the changes in the docs (maybe a 'New!' marker
 would help). It seems that the low level API is in the spotlight now.
 No problem with that, but I 'd love to see improved support for static
 typing (most probably through generics) in the API.

 -g.

-- 
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: GWT+servlet - how to redirect to a different page

2010-12-29 Thread l.denardo
Why don't you simply build the form panel with the specified target in
the constructor?

http://google-web-toolkit.googlecode.com/svn/javadoc/2.1/com/google/gwt/user/client/ui/FormPanel.html#FormPanel%28java.lang.String%29

FormPanel uses a hidden IFrame to manage the cycle of submit/receive
response; if you give a target to the constructor it will follow
standard behavior of replacing the current page after submit.

Regards
Lorenzo

On Dec 28, 2:10 pm, dreamer venugopal.vasire...@gmail.com wrote:
 Instead of server dispatching/forwarding to a new page as in
 traditional web flows,
 I send the page name as response to BROWSER, and used GWT -
 onSubmitComplete
 event to go to new page.
 == HERE CLIENT side code 
 formPanel.addSubmitCompleteHandler(new
 FormPanel.SubmitCompleteHandler() {
               public void onSubmitComplete(SubmitCompleteEvent event) {
                   shownextpage(/page2.html);
               }
             });
 --
 private native void shownextpage(String message) /*-{
         $wnd.alert(message);
         $wnd.location.href=/page2.html;
         }-*/;
 ---

 On Dec 28, 3:10 am, dreamer venugopal.vasire...@gmail.com wrote:

  Hi,

  I have a GWT entry point that submits to servlet , build using
  FormPanel.
  I am trying to build page flow using servlet RequestDispatcher or
  sendRedirect, even though no exception GAE is not forwarding to next
  page.

-- 
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] Task Queue don't work in development server

2010-12-28 Thread l.denardo
Hello, I'm currently unable to use task queues on the development
server.
Both attempts to run mapreduce jobs and to check local admin console
at http://127.0.0.1:/_ah/admin/taskqueue give this error:

org.quartz.SchedulerConfigException: Unable to instantiate class
load helper class: org.quartz.simpl.CascadingClassLoadHelper cannot be
cast to org.quartz.spi.ClassLoadHelper [See nested exception:
java.lang.ClassCastException:
org.quartz.simpl.CascadingClassLoadHelper cannot be cast to
org.quartz.spi.ClassLoadHelper]

Caused by:

java.lang.RuntimeException: org.quartz.SchedulerConfigException:
Unable to instantiate class load helper class:
org.quartz.simpl.CascadingClassLoadHelper cannot be cast to
org.quartz.spi.ClassLoadHelper [See nested exception:
java.lang.ClassCastException:
org.quartz.simpl.CascadingClassLoadHelper cannot be cast to
org.quartz.spi.ClassLoadHelper]
at
com.google.appengine.api.taskqueue.dev.LocalTaskQueue.startScheduler(LocalTaskQueue.java:
433)
at
com.google.appengine.api.taskqueue.dev.LocalTaskQueue.start_(LocalTaskQueue.java:
194)
at com.google.appengine.api.taskqueue.dev.LocalTaskQueue.access
$000(LocalTaskQueue.java:49)
at com.google.appengine.api.taskqueue.dev.LocalTaskQueue
$2.run(LocalTaskQueue.java:161)
at java.security.AccessController.doPrivileged(Native Method)
at
com.google.appengine.api.taskqueue.dev.LocalTaskQueue.start(LocalTaskQueue.java:
158)
at
com.google.appengine.tools.development.ApiProxyLocalImpl.startServices(ApiProxyLocalImpl.java:
466)
at com.google.appengine.tools.development.ApiProxyLocalImpl.access
$600(ApiProxyLocalImpl.java:44)
at com.google.appengine.tools.development.ApiProxyLocalImpl
$1.run(ApiProxyLocalImpl.java:448)
at com.google.appengine.tools.development.ApiProxyLocalImpl
$1.run(ApiProxyLocalImpl.java:446)
at java.security.AccessController.doPrivileged(Native Method)
at
com.google.appengine.tools.development.ApiProxyLocalImpl.getService(ApiProxyLocalImpl.java:
445)
at
com.google.apphosting.utils.servlet.TaskQueueViewerServlet.getLocalTaskQueueService(TaskQueueViewerServlet.java:
111)
at
com.google.apphosting.utils.servlet.TaskQueueViewerServlet.getQueueInfo(TaskQueueViewerServlet.java:
115)
at
com.google.apphosting.utils.servlet.TaskQueueViewerServlet.doGet(TaskQueueViewerServlet.java:
176)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:
511)
at org.mortbay.jetty.servlet.ServletHandler
$CachedChain.doFilter(ServletHandler.java:1166)
at
com.google.appengine.api.blobstore.dev.ServeBlobFilter.doFilter(ServeBlobFilter.java:
58)
at org.mortbay.jetty.servlet.ServletHandler
$CachedChain.doFilter(ServletHandler.java:1157)
at
com.google.apphosting.utils.servlet.TransactionCleanupFilter.doFilter(TransactionCleanupFilter.java:
43)
at org.mortbay.jetty.servlet.ServletHandler
$CachedChain.doFilter(ServletHandler.java:1157)
at
com.google.appengine.tools.development.StaticFileFilter.doFilter(StaticFileFilter.java:
122)
at org.mortbay.jetty.servlet.ServletHandler
$CachedChain.doFilter(ServletHandler.java:1157)
at
org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:
388)
at
org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:
216)
at
org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:
182)
at
org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:
765)
at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:
418)
at
com.google.apphosting.utils.jetty.DevAppEngineWebAppContext.handle(DevAppEngineWebAppContext.java:
70)
at
org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:
152)
at com.google.appengine.tools.development.JettyContainerService
$ApiProxyHandler.handle(JettyContainerService.java:349)
at
org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:
152)
at org.mortbay.jetty.Server.handle(Server.java:326)
at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:
542)
at org.mortbay.jetty.HttpConnection
$RequestHandler.headerComplete(HttpConnection.java:923)
at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:547)
at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:212)
at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
at
org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:
409)
at org.mortbay.thread.QueuedThreadPool
$PoolThread.run(QueuedThreadPool.java:582)
Caused by: org.quartz.SchedulerConfigException: Unable to instantiate
class load helper class: org.quartz.simpl.CascadingClassLoadHelper
cannot be 

[appengine-java] Re: Task Queue don't work in development server

2010-12-28 Thread l.denardo
Solved...just needed some more cleanup in the WEB_INF directory.

Removed appengine-testing.jar, appengine-api-labs.jar, appengine-api-
stubs.jar.
Moved them to test folder, added again to the classpath (maybe Eclipse
did not update build path correctly before...sometimes happens) to
make tests work, and it goes.

This is stated in the test suite documentation, maybe a line in the
development server section could help.

Regards
Lorenzo


On Dec 28, 12:13 pm, l.denardo lorenzo.dena...@gmail.com wrote:
 Hello, I'm currently unable to use task queues on the development
 server.
 Both attempts to run mapreduce jobs and to check local admin console
 athttp://127.0.0.1:/_ah/admin/taskqueuegive this error:

     org.quartz.SchedulerConfigException: Unable to instantiate class
 load helper class: org.quartz.simpl.CascadingClassLoadHelper cannot be
 cast to org.quartz.spi.ClassLoadHelper [See nested exception:
 java.lang.ClassCastException:
 org.quartz.simpl.CascadingClassLoadHelper cannot be cast to
 org.quartz.spi.ClassLoadHelper]

 Caused by:

 java.lang.RuntimeException: org.quartz.SchedulerConfigException:
 Unable to instantiate class load helper class:
 org.quartz.simpl.CascadingClassLoadHelper cannot be cast to
 org.quartz.spi.ClassLoadHelper [See nested exception:
 java.lang.ClassCastException:
 org.quartz.simpl.CascadingClassLoadHelper cannot be cast to
 org.quartz.spi.ClassLoadHelper]
         at
 com.google.appengine.api.taskqueue.dev.LocalTaskQueue.startScheduler(LocalTaskQueue.java:
 433)
         at
 com.google.appengine.api.taskqueue.dev.LocalTaskQueue.start_(LocalTaskQueue.java:
 194)
         at com.google.appengine.api.taskqueue.dev.LocalTaskQueue.access
 $000(LocalTaskQueue.java:49)
         at com.google.appengine.api.taskqueue.dev.LocalTaskQueue
 $2.run(LocalTaskQueue.java:161)
         at java.security.AccessController.doPrivileged(Native Method)
         at
 com.google.appengine.api.taskqueue.dev.LocalTaskQueue.start(LocalTaskQueue.java:
 158)
         at
 com.google.appengine.tools.development.ApiProxyLocalImpl.startServices(ApiProxyLocalImpl.java:
 466)
         at com.google.appengine.tools.development.ApiProxyLocalImpl.access
 $600(ApiProxyLocalImpl.java:44)
         at com.google.appengine.tools.development.ApiProxyLocalImpl
 $1.run(ApiProxyLocalImpl.java:448)
         at com.google.appengine.tools.development.ApiProxyLocalImpl
 $1.run(ApiProxyLocalImpl.java:446)
         at java.security.AccessController.doPrivileged(Native Method)
         at
 com.google.appengine.tools.development.ApiProxyLocalImpl.getService(ApiProxyLocalImpl.java:
 445)
         at
 com.google.apphosting.utils.servlet.TaskQueueViewerServlet.getLocalTaskQueueService(TaskQueueViewerServlet.java:
 111)
         at
 com.google.apphosting.utils.servlet.TaskQueueViewerServlet.getQueueInfo(TaskQueueViewerServlet.java:
 115)
         at
 com.google.apphosting.utils.servlet.TaskQueueViewerServlet.doGet(TaskQueueViewerServlet.java:
 176)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
         at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:
 511)
         at org.mortbay.jetty.servlet.ServletHandler
 $CachedChain.doFilter(ServletHandler.java:1166)
         at
 com.google.appengine.api.blobstore.dev.ServeBlobFilter.doFilter(ServeBlobFilter.java:
 58)
         at org.mortbay.jetty.servlet.ServletHandler
 $CachedChain.doFilter(ServletHandler.java:1157)
         at
 com.google.apphosting.utils.servlet.TransactionCleanupFilter.doFilter(TransactionCleanupFilter.java:
 43)
         at org.mortbay.jetty.servlet.ServletHandler
 $CachedChain.doFilter(ServletHandler.java:1157)
         at
 com.google.appengine.tools.development.StaticFileFilter.doFilter(StaticFileFilter.java:
 122)
         at org.mortbay.jetty.servlet.ServletHandler
 $CachedChain.doFilter(ServletHandler.java:1157)
         at
 org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:
 388)
         at
 org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:
 216)
         at
 org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:
 182)
         at
 org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:
 765)
         at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:
 418)
         at
 com.google.apphosting.utils.jetty.DevAppEngineWebAppContext.handle(DevAppEngineWebAppContext.java:
 70)
         at
 org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:
 152)
         at com.google.appengine.tools.development.JettyContainerService
 $ApiProxyHandler.handle(JettyContainerService.java:349)
         at
 org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:
 152)
         at org.mortbay.jetty.Server.handle(Server.java:326)
         at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:
 542)
         at org.mortbay.jetty.HttpConnection

[appengine-java] Re: Users and UserService: fetch userID without login

2010-12-23 Thread l.denardo
Thanks Ikai, from documentation it seems an ID is not provided.
I'll revert to something like this:

*Retrieve domain's users from the Google Data api
*Store a temporary list of users with associated roles and their email
as an identifier
*When the user logs in, check for a temporary record and set the user
ID to the value provided by the UserService

I'll just have to handle the case of a user changing his email address
between app installation and first login; I think I'll just give
minimum permissions and notify domain administrator to set up proper
permission set for the specific user.

Thanks for your collaboration
Regards
Lorenzo

On Dec 22, 10:19 pm, Ikai Lan (Google) ikai.l+gro...@google.com
wrote:
 Does a domain's user list contain an ID? We can't provide this ID to you
 ahead of time.

 I think for your use case, it's safe to use the email and handle the edge
 case of someone changing their email.

 --
 Ikai Lan
 Developer Programs Engineer, Google App Engine
 Blogger:http://googleappengine.blogspot.com
 Reddit:http://www.reddit.com/r/appengine
 Twitter:http://twitter.com/app_engine

 On Wed, Dec 22, 2010 at 2:27 AM, l.denardo lorenzo.dena...@gmail.comwrote:

  Hello,
  I'm trying to figure out possible solutions for a problem. I'm
  currently using openID to authenticate users, restricting to Google as
  an identity provider (both gmail and Google Apps).

  What I need to do is to obtain reliable user information before a user
  logs in to the application. Use case is simple:
  *I want to make the app installable to a Google Apps domain (say for
  the marketplace).
  *During installation, domain admin logs in to my application, and I
  retrieve domain's user list (tipically using Google Data java client
  library)
  *Domain admin configures roles for my application users (e.g. read
  only or read/write access).

  Obviously, no other user in the domain has logged in.
  When the user logs in for the first time, I will have to apply correct
  roles and permissions, as provided during configuration.

  Best way to do this should be to access the unique userID provided by
  UserService/User classes. According to documentation, this is the only
  stable identifier for a given user.
  So how is it possible to obtain it before the user logs in?
  I tried to use User class constructor User(java.lang.String email,
  java.lang.String authDomain), but this does not populate the ID. Is it
  safe to save the object you obtain from such constructor, store it in
  a temporary list, then compare it to the value returned by
  userService.getCurrentUser() and apply roles accordingly?

  Thanks for any help on this
  Regards
  Lorenzo

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

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



[appengine-java] Re: Understanding gwt-dispatch and Singletons/member variables

2010-12-23 Thread l.denardo
I don't fully understand your problem (maybe a few lines of code will
help).

Anyway:
*Member variables in action handlers are usually created as they
should, empty, for my experience
*Memcache is shared across all application instances, so if you
populate your map using the memcache value and then check for it, your
map will always contain the same items once cache is populated.

i.e. what is expected is something like

private MapString, Serializable cacheMap = new HashMapString,
Serializable();
//map will be empty
cacheMap.put( memcacheServiceInstance.get(key) );
//cacheMap will be populated always with the same value, if provided
key results in a memcache hit

Regards
Lorenzo

On Dec 22, 12:55 pm, Sky skysoftwaredes...@googlemail.com wrote:
 Hi all,

 I use gwt-dispatch in a project and now I have a question concerning
 the gwt-dispatch framework and member variables in ActionHandlers.
 I use guice on server side and bind the ActionHandlers as follow:
 bindHandler(GetXYHandler.class);  - this is per definition no
 singleton!

 In GetXYHandler I have a member variable, which stores the data
 retrieved from Googles MemCacheService:
 private MapString, Serializable cacheMap = new HashMapString,
 Serializable();

 When making a server request in the execute method of GetXYHandler the
 cacheMap is filled with objects, when a cache hit in memcache occurs  -

  the cacheMap member variable is not empty anymore!

 My understanding of member variables (in example cacheMap) is, that
 they should be created new in each serverCall if they are not static.
 In my case the cacheMap should be empty each time when the execute
 method is called.
 In my local tests the behaviour is somewhat different. When I test it
 in debug modus locally (different user calls), the cacheMap stays
 always filled like a static variable. Is this the normal behaviour of
 member variables of Actionhandlers? My understanding would say this is
 very curious, because its not a singleton?
 If this is normal behaviour, no member variables could be used,
 because they would not be synchronized...

 Thanks for your help!

-- 
You received this message because you are subscribed to the Google Groups 
Google App Engine for Java group.
To post to this group, send email to google-appengine-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] Users and UserService: fetch userID without login

2010-12-22 Thread l.denardo
Hello,
I'm trying to figure out possible solutions for a problem. I'm
currently using openID to authenticate users, restricting to Google as
an identity provider (both gmail and Google Apps).

What I need to do is to obtain reliable user information before a user
logs in to the application. Use case is simple:
*I want to make the app installable to a Google Apps domain (say for
the marketplace).
*During installation, domain admin logs in to my application, and I
retrieve domain's user list (tipically using Google Data java client
library)
*Domain admin configures roles for my application users (e.g. read
only or read/write access).

Obviously, no other user in the domain has logged in.
When the user logs in for the first time, I will have to apply correct
roles and permissions, as provided during configuration.

Best way to do this should be to access the unique userID provided by
UserService/User classes. According to documentation, this is the only
stable identifier for a given user.
So how is it possible to obtain it before the user logs in?
I tried to use User class constructor User(java.lang.String email,
java.lang.String authDomain), but this does not populate the ID. Is it
safe to save the object you obtain from such constructor, store it in
a temporary list, then compare it to the value returned by
userService.getCurrentUser() and apply roles accordingly?

Thanks for any help on this
Regards
Lorenzo

-- 
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 switching to 1.4.0 - JSP compilation fails

2010-12-18 Thread l.denardo
Thank you, I'll try it as soon as possible.

I did try to use the jars from a standard J2ee distribution (not
repackaged), but that did not work since some libraries were still
missing.
Thanks for your suggestion, this will be really helpful.

Lorenzo

On Dec 18, 4:12 am, Helder Suzuki heldersuz...@gmail.com wrote:
 Hi Lorenzo,

 I was having this problem too.

 This will fix it in the development environment:

 1) Open appengine-java-sdk-1.4.0.zip
 2) Find el-api.jar, jsp-api.jar, servlet-api.jar and
 repackaged-appengine-jasper-6.0.29.jar
 3) Copy them to war/WEB-INF/lib

 Thanks,
 Helder

-- 
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 switching to 1.4.0 - JSP compilation fails

2010-12-10 Thread l.denardo
Thank you Ikay and Starman.
I'll try to use auto mapping, and verify everything's fine in
production.

I can confirm not-mapped JSP pages work correctly in dev, the mapping
I use is just for the openID login page.
I'll try and see if I can use something different to produce my login
page, but if this is only for the dev server I can bypass this simply
since login page address is different.

I also hit the problem of static files not being filtered (I guess you
are using spring security :-)), I ended up using real JSP since I
customize the host page with email address and logout link from User
service.

Thank you again for your help.
Regards
Lorenzo

On Dec 10, 6:01 am, Starman r...@arrova.ca wrote:
 I was using a servlet mapping to make my url nicer. Instead of
 appid.appspot.com/MyApp.jsp, I had appid.appspot.com/servletname. And
 I was using the jsp-file tag to map the servlet to the jsp file.

 I have commented out the servlet definition and just let the jsp auto
 mapping do its thing. And everything works fine, albeit with uglier
 urls.

 Btw, I'm using a jsp for my GWT host file instead of an html file so
 that I can secure the app host file. Html being statically deployed
 makes it impossible to secure at the servlet layer.

 R.

 On Dec 9, 6:03 pm, Ikai Lan (Google) ikai.l+gro...@google.com
 wrote:

  We're reproduced this. It seems to happen when you map a URL to a JSP, and
  only on the development server.

  --
  Ikai Lan
  Developer Programs Engineer, Google App Engine
  Blogger:http://googleappengine.blogspot.com
  Reddit:http://www.reddit.com/r/appengine
  Twitter:http://twitter.com/app_engine

  On Thu, Dec 9, 2010 at 8:36 AM, l.denardo lorenzo.dena...@gmail.com wrote:
   Hello,
   I'm having trouble switching to 1.4.0 SDK.

   Development server starts regularly, but when I try to load my login
   page (a jsp file) I get the following error:

   [WARN] /_ah/login_required
   org.apache.jasper.JasperException: Unable to compile class for JSP:

   An error occurred at line: 1 in the generated java file
   The type javax.servlet.jsp.PageContext cannot be resolved. It is
   indirectly referenced from required .class files

   An error occurred at line: 1 in the generated java file
   The type javax.servlet.jsp.tagext.TagSupport cannot be resolved. It is
   indirectly referenced from required .class files

   [more similar entries follow]

   An error occurred at line: 1,079 in the generated java file
   javax.servlet.jsp.tagext.JspTag cannot be resolved to a type

   Stacktrace:
          at

   org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:
   92)
          at
   org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:
   330)
          at
   org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:
   439)
          at org.apache.jasper.compiler.Compiler.compile(Compiler.java:349)
          at org.apache.jasper.compiler.Compiler.compile(Compiler.java:327)
          at org.apache.jasper.compiler.Compiler.compile(Compiler.java:314)
          at
   org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:
   592)
          at
   org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:
   317)
          at
   org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:
   313)
          at 
   org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
          at
   com.google.appengine.tools.development.PrivilegedJspServlet.access
   $101(PrivilegedJspServlet.java:23)
          at com.google.appengine.tools.development.PrivilegedJspServlet
   $2.run(PrivilegedJspServlet.java:59)
          at java.security.AccessController.doPrivileged(Native Method)
          at

   com.google.appengine.tools.development.PrivilegedJspServlet.service(PrivilegedJspServlet.java:
   57)
          at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
          at
   org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:
   511)
          at org.mortbay.jetty.servlet.ServletHandler
   $CachedChain.doFilter(ServletHandler.java:1166)
          at

   com.google.appengine.api.blobstore.dev.ServeBlobFilter.doFilter(ServeBlobFilter.java:
   58)
          at org.mortbay.jetty.servlet.ServletHandler
   $CachedChain.doFilter(ServletHandler.java:1157)
          at

   com.google.apphosting.utils.servlet.TransactionCleanupFilter.doFilter(TransactionCleanupFilter.java:
   43)
          at org.mortbay.jetty.servlet.ServletHandler
   $CachedChain.doFilter(ServletHandler.java:1157)
          at

   com.google.appengine.tools.development.StaticFileFilter.doFilter(StaticFileFilter.java:
   122)
          at org.mortbay.jetty.servlet.ServletHandler
   $CachedChain.doFilter(ServletHandler.java:1157)
          at
   org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:
   388)
          at
   org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:
   216

[appengine-java] Re: Problem switching to 1.4.0 - JSP compilation fails

2010-12-10 Thread l.denardo
Thank you for the link.
I tried to deploy a test app and everything works correctly in
production.

I'll live with the bug in the devserver, just go to the emulated login
page by hand.

Thanks
Lorenzo

On Dec 10, 11:41 am, Thomas Meyer meyer...@gmail.com wrote:
 The problem has also been discussed here (the newer 
 entries):http://groups.google.com/group/google-appengine-java/browse_thread/th...

 And there's an issue you can 
 star:http://code.google.com/p/googleappengine/issues/detail?id=4216

 I can also confirm that the problem only exists locally on the
 development server. If you deploy it to the app engine servers the
 mappings will work.

 Best, Thomas

 On Dec 10, 9:10 am, l.denardo lorenzo.dena...@gmail.com wrote:

  Thank you Ikay and Starman.
  I'll try to use auto mapping, and verify everything's fine in
  production.

  I can confirm not-mapped JSP pages work correctly in dev, the mapping
  I use is just for the openID login page.
  I'll try and see if I can use something different to produce my login
  page, but if this is only for the dev server I can bypass this simply
  since login page address is different.

  I also hit the problem of static files not being filtered (I guess you
  are using spring security :-)), I ended up using real JSP since I
  customize the host page with email address and logout link from User
  service.

  Thank you again for your help.
  Regards
  Lorenzo

  On Dec 10, 6:01 am, Starman r...@arrova.ca wrote:

   I was using a servlet mapping to make my url nicer. Instead of
   appid.appspot.com/MyApp.jsp, I had appid.appspot.com/servletname. And
   I was using the jsp-file tag to map the servlet to the jsp file.

   I have commented out the servlet definition and just let the jsp auto
   mapping do its thing. And everything works fine, albeit with uglier
   urls.

   Btw, I'm using a jsp for my GWT host file instead of an html file so
   that I can secure the app host file. Html being statically deployed
   makes it impossible to secure at the servlet layer.

   R.

   On Dec 9, 6:03 pm, Ikai Lan (Google) ikai.l+gro...@google.com
   wrote:

We're reproduced this. It seems to happen when you map a URL to a JSP, 
and
only on the development server.

--
Ikai Lan
Developer Programs Engineer, Google App Engine
Blogger:http://googleappengine.blogspot.com
Reddit:http://www.reddit.com/r/appengine
Twitter:http://twitter.com/app_engine

On Thu, Dec 9, 2010 at 8:36 AM, l.denardo lorenzo.dena...@gmail.com 
wrote:
 Hello,
 I'm having trouble switching to 1.4.0 SDK.

 Development server starts regularly, but when I try to load my login
 page (a jsp file) I get the following error:

 [WARN] /_ah/login_required
 org.apache.jasper.JasperException: Unable to compile class for JSP:

 An error occurred at line: 1 in the generated java file
 The type javax.servlet.jsp.PageContext cannot be resolved. It is
 indirectly referenced from required .class files

 An error occurred at line: 1 in the generated java file
 The type javax.servlet.jsp.tagext.TagSupport cannot be resolved. It is
 indirectly referenced from required .class files

 [more similar entries follow]

 An error occurred at line: 1,079 in the generated java file
 javax.servlet.jsp.tagext.JspTag cannot be resolved to a type

 Stacktrace:
        at

 org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandl
  er.java:
 92)
        at
 org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:
 330)
        at
 org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:
 439)
        at 
 org.apache.jasper.compiler.Compiler.compile(Compiler.java:349)
        at 
 org.apache.jasper.compiler.Compiler.compile(Compiler.java:327)
        at 
 org.apache.jasper.compiler.Compiler.compile(Compiler.java:314)
        at
 org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:
 592)
        at
 org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:
 317)
        at
 org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:
 313)
        at 
 org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
        at
 com.google.appengine.tools.development.PrivilegedJspServlet.access
 $101(PrivilegedJspServlet.java:23)
        at com.google.appengine.tools.development.PrivilegedJspServlet
 $2.run(PrivilegedJspServlet.java:59)
        at java.security.AccessController.doPrivileged(Native Method)
        at

 com.google.appengine.tools.development.PrivilegedJspServlet.service(Privile
  gedJspServlet.java:
 57)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
        at
 org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:
 511

[appengine-java] Problem switching to 1.4.0 - JSP compilation fails

2010-12-09 Thread l.denardo
Hello,
I'm having trouble switching to 1.4.0 SDK.

Development server starts regularly, but when I try to load my login
page (a jsp file) I get the following error:

[WARN] /_ah/login_required
org.apache.jasper.JasperException: Unable to compile class for JSP:

An error occurred at line: 1 in the generated java file
The type javax.servlet.jsp.PageContext cannot be resolved. It is
indirectly referenced from required .class files

An error occurred at line: 1 in the generated java file
The type javax.servlet.jsp.tagext.TagSupport cannot be resolved. It is
indirectly referenced from required .class files

[more similar entries follow]

An error occurred at line: 1,079 in the generated java file
javax.servlet.jsp.tagext.JspTag cannot be resolved to a type

Stacktrace:
at
org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:
92)
at
org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:
330)
at
org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:
439)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:349)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:327)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:314)
at
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:
592)
at
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:
317)
at
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:
313)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
at com.google.appengine.tools.development.PrivilegedJspServlet.access
$101(PrivilegedJspServlet.java:23)
at com.google.appengine.tools.development.PrivilegedJspServlet
$2.run(PrivilegedJspServlet.java:59)
at java.security.AccessController.doPrivileged(Native Method)
at
com.google.appengine.tools.development.PrivilegedJspServlet.service(PrivilegedJspServlet.java:
57)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:
511)
at org.mortbay.jetty.servlet.ServletHandler
$CachedChain.doFilter(ServletHandler.java:1166)
at
com.google.appengine.api.blobstore.dev.ServeBlobFilter.doFilter(ServeBlobFilter.java:
58)
at org.mortbay.jetty.servlet.ServletHandler
$CachedChain.doFilter(ServletHandler.java:1157)
at
com.google.apphosting.utils.servlet.TransactionCleanupFilter.doFilter(TransactionCleanupFilter.java:
43)
at org.mortbay.jetty.servlet.ServletHandler
$CachedChain.doFilter(ServletHandler.java:1157)
at
com.google.appengine.tools.development.StaticFileFilter.doFilter(StaticFileFilter.java:
122)
at org.mortbay.jetty.servlet.ServletHandler
$CachedChain.doFilter(ServletHandler.java:1157)
at
org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:
388)
at
org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:
216)
at
org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:
182)
at
org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:
765)
at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:
418)
at
com.google.apphosting.utils.jetty.DevAppEngineWebAppContext.handle(DevAppEngineWebAppContext.java:
70)
at
org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:
152)
at com.google.appengine.tools.development.JettyContainerService
$ApiProxyHandler.handle(JettyContainerService.java:349)
at
org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:
152)
at org.mortbay.jetty.Server.handle(Server.java:326)
at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:
542)
at org.mortbay.jetty.HttpConnection
$RequestHandler.headerComplete(HttpConnection.java:923)
at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:547)
at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:212)
at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
at
org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:
409)
at org.mortbay.thread.QueuedThreadPool
$PoolThread.run(QueuedThreadPool.java:582)

Looks like the jsp-api.jar in the SDK is getting ignored, but it's
there and is also visible by Eclipse (auto-completion imports
correctly the missing classes if you try to use them from the
editor).
Is anyone facing the same? Do you know if there's any configuration I
have to check to see if everything's fine?

I'm running on Ubuntu, Eclipse Helios, GWT 2.1.0 and of course GAE
1.4.0 (from 1.3.8), Google Plugin for Eclipse v.1.4.0.

Thenk you very much
regards
Lorenzo

-- 
You received this message because you are subscribed to the Google Groups 
Google App Engine for Java group.
To post to this group, send 

[appengine-java] Re: Discussion on will-it-play-in-app-engine

2010-11-09 Thread l.denardo
If possible, I think this post could be added in the ones linked in
the SpringSecurity section:

http://blog.springsource.com/2010/08/02/spring-security-in-google-app-engine/

This is a much more up-to-date tutorial about SpringSecurity on GAE,
first hand from spring source.
Regards

Lorenzo

-- 
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: Convert JDO/JPA POJO to a Datastore Entity

2010-11-02 Thread l.denardo
Generally speaking, what Didier says is entirely true.

Mappings are, for my experience, done as follows
*Entity name is the class name without package extension
*Properties names are field names
*Property kind is mapped according to this page
http://code.google.com/appengine/docs/java/datastore/dataclasses.html#Core_Value_Types

If you want to investigate how your entities are mapped you can use
the Local Testing utilities 
http://code.google.com/appengine/docs/java/tools/localunittesting.html

Just do something like this in a test class:

*Persist the object using JDO
*Obtain the datastore service mock thru the testing tools
*Query the datastore for the kind you just created, then you can
iterate on entity property.

The main disadvantage in guessing the mapping is that you lose type
checks: all entities kinds are of one of the core value types, so
you'll need to explicitly convert it from/to your POJO field types.
This is closely related to what Didier emphasizes.

So I too advise you to investigate it as a testing practice, but do
not rely on it in production.
Regards

Lorenzo

On Nov 2, 10:26 am, Didier Durand durand.did...@gmail.com wrote:
 Hi George,
 What you are looking for is anyway possible: the JDO/JPA entities are
 stored in datastore as Entities eventually. You'll have to figure out
 (i.e reverse engineer) the mapping between the pojo annotations and
 the corresponding ds structures.

 I see 1 big issue: the mapping that you will figure out has no
 guarantee from Google, it can change any time and you may need some
 time to figure out when it changes with risks for the integrity of
 your data.

 I would either work at high or low level on a given piece of data but
 not simultaneously if you can't have guarantees.

 regards
 didier

 On Nov 2, 8:58 am, George  Moschovitis george.moschovi...@gmail.com
 wrote:

  I know about Objectify but I would like to use a standard solution
  like JPA/JDO.
  Even if it is (currently) less efficient than custom solutions.

  -g.

  On Nov 1, 12:32 pm, Didier Durand durand.did...@gmail.com wrote:

   Hi George,

   Not a direct answer to your question, but if you're looking for
   something lighter than JDO/JPA, I would encourage you to have a look
   at Objectify: it's much closer to DS api than JPA/JDO (and much
   simpler and more efficient...) but still provides a good level of
   abstraction for efficient programming.

   Something that could be tried (as Objectify uses some JPA annotation)
   is to remap JPA entities onto Objectify entities but it very much
   depends on your level of sophistication in the use of JPA.

   regards

   didier

   On Oct 31, 10:08 pm, George  Moschovitis

   george.moschovi...@gmail.com wrote:
Is there a way to convert a JDO/JPA POJO to the corresponding
Datastore Entity? I am sure this functionality exists in the JDO/JPA
implementation but is this exposed in a public API? (maybe through a
helper).

This would allow mixing calls to JDO/JPA with calls to the low-level
API for special case optimizations.

regards,
George.

-- 
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: Convert JDO/JPA POJO to a Datastore Entity

2010-11-02 Thread l.denardo
Obviously I mean Entity kind as the first point.

On Nov 2, 3:12 pm, l.denardo lorenzo.dena...@gmail.com wrote:
 Generally speaking, what Didier says is entirely true.

 Mappings are, for my experience, done as follows
 *Entity name is the class name without package extension
 *Properties names are field names
 *Property kind is mapped according to this 
 pagehttp://code.google.com/appengine/docs/java/datastore/dataclasses.html...

 If you want to investigate how your entities are mapped you can use
 the Local Testing 
 utilitieshttp://code.google.com/appengine/docs/java/tools/localunittesting.html

 Just do something like this in a test class:

 *Persist the object using JDO
 *Obtain the datastore service mock thru the testing tools
 *Query the datastore for the kind you just created, then you can
 iterate on entity property.

 The main disadvantage in guessing the mapping is that you lose type
 checks: all entities kinds are of one of the core value types, so
 you'll need to explicitly convert it from/to your POJO field types.
 This is closely related to what Didier emphasizes.

 So I too advise you to investigate it as a testing practice, but do
 not rely on it in production.
 Regards

 Lorenzo

 On Nov 2, 10:26 am, Didier Durand durand.did...@gmail.com wrote:

  Hi George,
  What you are looking for is anyway possible: the JDO/JPA entities are
  stored in datastore as Entities eventually. You'll have to figure out
  (i.e reverse engineer) the mapping between the pojo annotations and
  the corresponding ds structures.

  I see 1 big issue: the mapping that you will figure out has no
  guarantee from Google, it can change any time and you may need some
  time to figure out when it changes with risks for the integrity of
  your data.

  I would either work at high or low level on a given piece of data but
  not simultaneously if you can't have guarantees.

  regards
  didier

  On Nov 2, 8:58 am, George  Moschovitis george.moschovi...@gmail.com
  wrote:

   I know about Objectify but I would like to use a standard solution
   like JPA/JDO.
   Even if it is (currently) less efficient than custom solutions.

   -g.

   On Nov 1, 12:32 pm, Didier Durand durand.did...@gmail.com wrote:

Hi George,

Not a direct answer to your question, but if you're looking for
something lighter than JDO/JPA, I would encourage you to have a look
at Objectify: it's much closer to DS api than JPA/JDO (and much
simpler and more efficient...) but still provides a good level of
abstraction for efficient programming.

Something that could be tried (as Objectify uses some JPA annotation)
is to remap JPA entities onto Objectify entities but it very much
depends on your level of sophistication in the use of JPA.

regards

didier

On Oct 31, 10:08 pm, George  Moschovitis

george.moschovi...@gmail.com wrote:
 Is there a way to convert a JDO/JPA POJO to the corresponding
 Datastore Entity? I am sure this functionality exists in the JDO/JPA
 implementation but is this exposed in a public API? (maybe through a
 helper).

 This would allow mixing calls to JDO/JPA with calls to the low-level
 API for special case optimizations.

 regards,
 George.

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



[appengine-java] Re: How can I keep the data saved in JDO datastore?

2010-10-29 Thread l.denardo
Hello,
live data are persistent until you delete them, so backup is not a
real necessity. AppEngine has replicated servers to handle failures,
and they have proved to work very well (search the groups for post
mortem to see how outages were handled).

The bulk loader can be used to import, export and transform data
between apps, and to localhost.

If you experience live data loss (i.e. you cannot read data from your
previously deployed version) this is probably an app design issue.
I suggest you keep a separate app to test data model changes against
real data between deploying to your business app.

Maybe other users can suggest more tools to handle data
transformation.
regards
Lorenzo

On Oct 29, 1:44 am, qiwawa deng...@gmail.com wrote:
 Thanks Lorenzo. I'd prefer if Google AE can provide a way for us to
 back up the data and restore it back.

 An export/import tool will be the most useful and make me feel better
 that my data is safe.

 Is there a way to back it up?

 Thanks again.

 Q

 On Oct 28, 3:14 am, l.denardo lorenzo.dena...@gmail.com wrote:

  Data are persistent across deploys.
  You only need to keep the same name for the entities and have
  compatible models.
  If you cannot see old data, probably you have done changes to your
  data model. Anyway, you should be able to see your application data
  from the admin console (datastore viewer). This can help you determine
  whether you are having trouble with data persistence or with changes
  in your data model. You should see all your previously existing
  entities.

  If you mean update local data to live servers, so you can use data
  you produced on your local machine to initialize your app, there's a
  tool called bulk loader. I never used it but there's an interesting
  post on Ikai Lan's 
  bloghttp://ikaisays.com/2010/06/10/using-the-bulkloader-with-java-app-eng...

  Regards
  Lorenzo

  On Oct 28, 2:23 am, qiwawa deng...@gmail.com wrote:

   Is this a non-issue at all? Anyone?
   Thank you.

   On Oct 26, 7:37 pm, qiwawa deng...@gmail.com wrote:

I wanted to keep the data when upgrading my app to a new version. How
can I do this?

Each time I upgrade it it looks like my data was lost. There is no way
in admin area that i can back up my data before upgrade.

Thanks.

Q

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



[appengine-java] Re: How can I keep the data saved in JDO datastore?

2010-10-28 Thread l.denardo
Data are persistent across deploys.
You only need to keep the same name for the entities and have
compatible models.
If you cannot see old data, probably you have done changes to your
data model. Anyway, you should be able to see your application data
from the admin console (datastore viewer). This can help you determine
whether you are having trouble with data persistence or with changes
in your data model. You should see all your previously existing
entities.

If you mean update local data to live servers, so you can use data
you produced on your local machine to initialize your app, there's a
tool called bulk loader. I never used it but there's an interesting
post on Ikai Lan's blog
http://ikaisays.com/2010/06/10/using-the-bulkloader-with-java-app-engine/


Regards
Lorenzo

On Oct 28, 2:23 am, qiwawa deng...@gmail.com wrote:
 Is this a non-issue at all? Anyone?
 Thank you.

 On Oct 26, 7:37 pm, qiwawa deng...@gmail.com wrote:

  I wanted to keep the data when upgrading my app to a new version. How
  can I do this?

  Each time I upgrade it it looks like my data was lost. There is no way
  in admin area that i can back up my data before upgrade.

  Thanks.

  Q

-- 
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: OpenID Accounts with same emails and App Engine User class

2010-10-26 Thread l.denardo
Hello,
to compare Users the only safe field is the unique User ID that is
exposed via getUserId() method.

http://code.google.com/appengine/docs/java/users/overview.html#Accessing_Account_Information

Also getFederatedIdentity()  could be a good bet, but documentation
recommends using the identifier.
I only use the email field after the user has been logged in, and
restricting to Google as a provider. This should be safe enough.
I think the only way to group accounts is to use IDs and set up an
external verification like SMS or email confirmation.

Regards
Lorenzo


On Oct 24, 10:04 pm, trustamli mc2...@gmail.com wrote:
 Hi,

 For some reason my application handles OpenID accounts with same
 emails as one user. It means when I try to
 access datastore entities with User field of new user it also gets
 entities of all other users with the same email.

 Is User object same as email? Pythod documentation says: User
 instances are unique and comparable. If two instances are equal, then
 they represent the same user. (but I use Java).

 I think I'm doing something wrong here:

  Query query = pm.newQuery(Subscriber.class, user == userParam);
  query.declareImports(import com.google.appengine.api.users.User);
  query.declareParameters(User userParam);

 �...@suppresswarnings(unchecked)
  ListSubscriber results = (ListSubscriber) query.execute(user);
  if (results.size()!=0)
     Logger.log(User logged in, results.iterator().next().getId());

 ?

 With this problem using OpenID is very unsafe. Anybody can create an
 OpenID account with any email (for example with myOpenID), without
 email verification, and then log in to my application and get data
 related to all Users with this email.

 I believe I'm doing something wrong, so I'll really hope someone will
 open my eyes.

 Thanks,
 Best Regards.

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



[appengine-java] Re: Java while statement bug on GAE server?

2010-10-26 Thread l.denardo
Don't know APIs very well, but anyway it looks like in the while
version you check one link in the condition, then request newLink
again in the method body. At the end of the list you check for the
last element not to be null, then ask for one more (which is out of
list bounds).
You should be missing one page each two anyway...

I guess the do-while version catches this with the tempFeed != null
 tempFeed.getEntries() != null check.

Regards
Lorenzo

On Oct 26, 2:16 pm, doc123 doc.u...@gmail.com wrote:
 Now I am using GDataI for Java and I tried following code to get Google
 document list

 DocumentListFeed tempFeed;

 tempFeed = myService.getFeed(feedUrl, DocumentListFeed.class);

 After I confirmed this code work without problem, I change code as
 following to be able to feed more than one page entry, but this code
 create Null pointer Exception.

 DocumentListFeed tempFeed;

 tempFeed = myService.getFeed(feedUrl, DocumentListFeed.class);

 resultFeed.getEntries().addAll(tempFeed.getEntries());

 while((tempFeed.getNextLink() != null) 
 (tempFeed.getEntries().size()0));

 {

 tempFeed = myService.getFeed(new
 URL(tempFeed.getNextLink().getHref()),DocumentListFeed.class);

 resultFeed.getEntries().addAll(tempFeed.getEntries());

 }

 I confirmed that “tempFeed.getNextLink()” is null. But this is a
 condition to repeat while. I could not understand why this code fail
 and I found suspicious info which related to Java while statement bug
 in a following URL. Is this real bug?

 http://java.decompiler.free.fr/?q=node/263after I get info, I changed
 my code as following and confirmed this code works without error.

 DocumentListFeed tempFeed = this.resultDocListFeed;

 DocumentListFeed resultFeed = new DocumentListFeed();

 boolean okToFeed = true;

 do

 {

 if(tempFeed != null  tempFeed.getEntries() != null)

 {

 if(tempFeed.getNextLink() != null  tempFeed.getEntries().size()0)

 {

 tempFeed = this.docServiceClient.getFeed(new
 URL(tempFeed.getNextLink().getHref()),DocumentListFeed.class);

 resultFeed.getEntries().addAll(tempFeed.getEntries());

 }

 else

 {

 okToFeed = false;

 }
 }

 else

 {

 okToFeed = false;

 }
 }while(okToFeed == true);

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



[appengine-java] Re: Java while statement bug on GAE server?

2010-10-26 Thread l.denardo
Really looks like a bug. Test condition should fail without printing
anything, in fact.
Sorry for my misleading answer, and thanks for sharing this.

Lorenzo

On Oct 26, 5:22 pm, doc123 doc.u...@gmail.com wrote:
 Sorry to use specific sample code. So I tried more basic following code.

 try

 {

 int i =0;

 boolean tempFlag = false;

 while(tempFlag == true);

 {

 i++;

 out.println(tempFlag + i + := + tempFlag);

 tempFlag = false;

 }
 }

 catch(Exception e)

 {

 out.println(Error + e.toString());

 }

 what I got is tempFlag1:=false but out.print is within a
 while(tempFlag == true) bock.

 I think this is bug.

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



[appengine-java] Re: Java while statement bug on GAE server?

2010-10-26 Thread l.denardo
I need a good pair of glasses :-)

On Oct 26, 5:42 pm, Don Schwarz schwa...@google.com wrote:
 Yes, it's a bug in your code:

  while(tempFlag == true);

 Note the semicolon.  Try removing it.

 On Tue, Oct 26, 2010 at 10:22 AM, doc123 doc.u...@gmail.com wrote:
  Sorry to use specific sample code.  So I tried more basic following code.

  try
  {

  int i =0;

  boolean tempFlag = false;

  while(tempFlag == true);

  {

  i++;

  out.println(tempFlag + i + := + tempFlag);

  tempFlag = false;

  }

  }
  catch(Exception e)
  {

  out.println(Error + e.toString());

  }

  what I got is  tempFlag1:=false  but out.print is within a while(tempFlag
  == true) bock.
  I think this is bug.

  --
  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] Problem with JDO and collection persistence

2010-10-22 Thread l.denardo
Hello,
I'm facing a problem with JDO persistence of a collection. I save an
object with a persistent ArrayList of Keys, retrieve the object and
set the collection to a new value. Change is not persisted.

Some code:
@PersistenceCapable
public class ComplexDatastoreCalendar {
@Persistent
private ArrayListKey calendarsToLink;
@Persistent(serialized=true)
private MapKey, Integer linkOrderIndex;
public void setCalendarsToLink(ArrayListKey newKeys, MapKey,
Integer newLinkOrderIndexes){
ArrayListKey toSubstitute = new ArrayListKey();
for (Key key : newKeys){
toSubstitute.add(key);
}
calendarsToLink = new ArrayListKey(toSubstitute);
linkOrderIndex = new HashMapKey, Integer(newLinkOrderIndexes);
}
}

In my handler I create a ComplexDatastoreCalendar with a value for
both fields, close persistenceManager, get a new PM instance and do

 ComplexDatastoreCalendar converted =
pm.getObjectById(ComplexDatastoreCalendar.class, convertedKey);
//get the list of keys in this calendar
ArrayListKey oldKeys = new
ArrayListKey(converted.getCalendarsToLink());
if (oldKeys.isEmpty()){
continue;
}
ArrayListKey newKeys = new ArrayListKey();
MapKey, Integer oldIndexes = 
converted.getLinkOrderIndex();
MapKey, Integer newIndexes = new HashMapKey, 
Integer();
for (Key old : oldKeys){
//retrieve this value from a
map
newKeys.add(oldKeysToNew.get(old));
newIndexes.put(oldKeysToNew.get(old), 
oldIndexes.get(old));
}
converted.setCalendarsToLink(new 
ArrayListKey(newKeys),
newIndexes);
JDOHelper.makeDirty(converted, 
calendarsToLink);
pm.makePersistent(converted);

After this call, I close PM and go.
No change is persisted to field calendarsToLink, even if the field's
value (both content and reference to object) changes, AND the field is
explicitly marked dirty.

DataNucleus log does not seem to help:

Oct 22, 2010 10:46:33 AM
org.datanucleus.store.appengine.DatastorePersistenceHandler get
FINE: Getting entity of kind ComplexDatastoreCalendar with key
ComplexDatastoreCalendar(700)
Oct 22, 2010 10:46:33 AM org.datanucleus.sco.backed.ArrayList init
FINE: Object
it.miriade.planner.server.entities.calendars.complexdatastorecalen...@1dd2910
field calendarsToLink is replaced by a SCO wrapper of type
org.datanucleus.sco.backed.ArrayList [cache-values=true, lazy-
loading=false, queued-operations=false, allow-nulls=false]
Oct 22, 2010 10:46:33 AM org.datanucleus.sco.backed.ArrayList
initialise
FINE: Object
it.miriade.planner.server.entities.calendars.complexdatastorecalen...@1dd2910
field calendarsToLink is having its SCO wrapper initialised with a
container with 2 values
Oct 22, 2010 10:46:33 AM
it.miriade.planner.server.handlers.calendars.ListCalendarsHandler
secureExecute
WARNING: Read oldKeys [DataStoreCalendar(444), DataStoreCalendar(448)]
Oct 22, 2010 10:46:33 AM
it.miriade.planner.server.entities.calendars.ComplexDatastoreCalendar
setCalendarsToLink
WARNING: Reference check: false
Oct 22, 2010 10:46:33 AM org.datanucleus.ObjectManagerImpl
persistObjectInternal
FINE: Making object persistent :
it.miriade.planner.server.entities.calendars.complexdatastorecalen...@1dd2910

Any help about this will be appreciated. I'm using GAE 1.3.7 (cannot
switch to 1.3.8 because I need to test a data transformation, and
1.3.8 loses datastore content).

Thanks to everybody
Lorenzo

-- 
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 with JDO and collection persistence

2010-10-22 Thread l.denardo
Forgot to mention: serialized field is correctly updated and persisted
within the same call.

Regards
Lorenzo

-- 
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 with JDO and collection persistence

2010-10-22 Thread l.denardo
For information, I found where the error lies...

It's in the flow of execution of my handler.

What I omitted is that after object update I used flushed PM,
performed a query, then actually closed PersistenceManager.

Changing flush() to closing persistence manager, then using a new
instance to perform the query, resolved the problem.
Hope this info can help if someone steps into the same issue.

Regards
Lorenzo

On Oct 22, 11:05 am, l.denardo lorenzo.dena...@gmail.com wrote:
 Forgot to mention: serialized field is correctly updated and persisted
 within the same call.

 Regards
 Lorenzo

-- 
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: Automatic logout via Google Login Service ?

2010-10-21 Thread l.denardo
Hello, I don't know if this can work for you...
In our app we authorize users recording email addresses in datastore.
WE use a custom admin page where we add user emails (or entire
domains) to allow users to access our app.
When a user logs in, we check if he's authorized and we serve the
application if he is, otherwise we prompt an error message.

Maybe you can call an immediate redirect to logout url from your
serving page so unauthorized users get immediately logged out.

Notice that this requires you to set up a user authorization mchanism
on your own. There's no option to filter users using regular APIs.
This is a lack I hope will be removed, and maybe one of the
improvements from AppEngine for business (the central management
console seems to go towards this direction).
Furthermore, I guess there's no way to generate User objects from a
user email address. You need to know an auth domain to get the
unique identifier, and that seems something hard to guess especially
if you use openID (I never tested this, so maybe I'm wrong).
Using only the email address to filter users is not the best thing to
do, but it's ok for us.

Hope this can be useful
Regards
Lorenzo

On Oct 21, 6:30 am, Didier Durand durand.did...@gmail.com wrote:
 Hello,

 I implemented UserService with GWT to get the login service of Google
 Accounts. Works fine with the provided login and logout links.

 But, Google Accounts will accept login for all the accounts it knows
 (much much more than my application with a few users only)

 How can I force logout of a user that Google Accounts accepts right
 after the login because my application doesn't know this user ?

 Thanks
 didier

-- 
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: Automatic logout via Google Login Service ?

2010-10-21 Thread l.denardo
An article with a sum up from the GWT team:
http://googlewebtoolkit.blogspot.com/2010/10/using-dynamic-host-page-for-gwt-apps.html

The way we serve our GWT app (embedded in JSP) is very similar, only
we have one more filter.

On Oct 21, 12:33 pm, l.denardo lorenzo.dena...@gmail.com wrote:
 Hello, I don't know if this can work for you...
 In our app we authorize users recording email addresses in datastore.
 WE use a custom admin page where we add user emails (or entire
 domains) to allow users to access our app.
 When a user logs in, we check if he's authorized and we serve the
 application if he is, otherwise we prompt an error message.

 Maybe you can call an immediate redirect to logout url from your
 serving page so unauthorized users get immediately logged out.

 Notice that this requires you to set up a user authorization mchanism
 on your own. There's no option to filter users using regular APIs.
 This is a lack I hope will be removed, and maybe one of the
 improvements from AppEngine for business (the central management
 console seems to go towards this direction).
 Furthermore, I guess there's no way to generate User objects from a
 user email address. You need to know an auth domain to get the
 unique identifier, and that seems something hard to guess especially
 if you use openID (I never tested this, so maybe I'm wrong).
 Using only the email address to filter users is not the best thing to
 do, but it's ok for us.

 Hope this can be useful
 Regards
 Lorenzo

 On Oct 21, 6:30 am, Didier Durand durand.did...@gmail.com wrote:

  Hello,

  I implemented UserService with GWT to get the login service of Google
  Accounts. Works fine with the provided login and logout links.

  But, Google Accounts will accept login for all the accounts it knows
  (much much more than my application with a few users only)

  How can I force logout of a user that Google Accounts accepts right
  after the login because my application doesn't know this user ?

  Thanks
  didier

-- 
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: Automatic logout via Google Login Service ?

2010-10-21 Thread l.denardo
An article with a sum up from the GWT team:
http://googlewebtoolkit.blogspot.com/2010/10/using-dynamic-host-page-for-gwt-apps.html

The way we serve our GWT app (embedded in JSP) is very similar, only
we have one more filter.

On Oct 21, 12:33 pm, l.denardo lorenzo.dena...@gmail.com wrote:
 Hello, I don't know if this can work for you...
 In our app we authorize users recording email addresses in datastore.
 WE use a custom admin page where we add user emails (or entire
 domains) to allow users to access our app.
 When a user logs in, we check if he's authorized and we serve the
 application if he is, otherwise we prompt an error message.

 Maybe you can call an immediate redirect to logout url from your
 serving page so unauthorized users get immediately logged out.

 Notice that this requires you to set up a user authorization mchanism
 on your own. There's no option to filter users using regular APIs.
 This is a lack I hope will be removed, and maybe one of the
 improvements from AppEngine for business (the central management
 console seems to go towards this direction).
 Furthermore, I guess there's no way to generate User objects from a
 user email address. You need to know an auth domain to get the
 unique identifier, and that seems something hard to guess especially
 if you use openID (I never tested this, so maybe I'm wrong).
 Using only the email address to filter users is not the best thing to
 do, but it's ok for us.

 Hope this can be useful
 Regards
 Lorenzo

 On Oct 21, 6:30 am, Didier Durand durand.did...@gmail.com wrote:

  Hello,

  I implemented UserService with GWT to get the login service of Google
  Accounts. Works fine with the provided login and logout links.

  But, Google Accounts will accept login for all the accounts it knows
  (much much more than my application with a few users only)

  How can I force logout of a user that Google Accounts accepts right
  after the login because my application doesn't know this user ?

  Thanks
  didier

-- 
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: AsyncDatastoreService - ready for use?

2010-10-21 Thread l.denardo
Looks like sometimes experimental APIs are published way before
they're ready for production.
Channel API was defined in 1.3.4, before it was even announced :-)
Good sign for me, since it shows good planning from the team, and the
will to anticipate issues well before release time.

Regards
Lorenzo

On Oct 20, 11:58 pm, Ikai Lan (Google) ikai.l+gro...@google.com
wrote:
 Good eyes! No, this isn't ready for use yet. You can't get an instance of
 AsyncDatastoreService. The backend isn't ready for this call. We wanted to
 release this, but there were showstopper bugs that prevented us from
 shipping it. Look for it in an upcoming release.

 --
 Ikai Lan
 Developer Programs Engineer, Google App Engine
 Blogger:http://googleappengine.blogspot.com
 Reddit:http://www.reddit.com/r/appengine
 Twitter:http://twitter.com/app_engine

 On Wed, Oct 20, 2010 at 1:02 PM, timwhunt timwh...@gmail.com wrote:
  Someone pointed out in the Objectify group that there is now an
  AsyncDatastoreService in the docs - see

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

  I don't believe this was mentioned in any release notes, but I think
  it is new (Did I miss it?).

  So is it ready for regular use?

  I don't see any query methods on the service like prepare(Query
  query).  Can a query be done asynchronously?  How?

  I've been looking forward to asynchronous Datastore access, so I'm
  glad to see this!

  -Tim

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

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



[appengine-java] Re: protobuf storage with JDO

2010-10-15 Thread l.denardo
Hello, I think it's not so common.

In my project I use protobufs for objects I want to store as
serialized fields or in bynary form.
That is, I encapsulate protocol buffer building in a wrapper, then
store such wrapper in an annotated field of JDO.

@Persistent(Serialized = true)
private MyProtobufWrapper wrapper;

MyProtobufWrapper uses protocol buffer Builder in its writeObject /
readObject methods and is of course Serializable.

OR

@Persistent
Blob serializedObject;

and use a class MyProtobufAdapter which has two methods byte[]
convertToSerialized(MyObjet o) and MyObject deserialize(byte[] bytes).

I think this is useful if you want to convert data you share with your
client code, or if you hit limitations in datastore modeling that you
can't work around. And obviously if you don't need to index such data
for queries.
Otherwise I'll go with regular datastore fields.

Regards
Lorenzo


On Oct 15, 12:29 am, Guillaume B. guillaume.brus...@gmail.com
wrote:
 Hello,

 I make a basic application that store simple java object using objectify

 I also make a spring service that create and return protobuf object

 as the protobuf object is nearly the same that the object that I store
 in big table
 I wonder if there was a standard way to store protobuf object in the
 datastore

 as objectify and JDO use annotation and that I will not anoted
 generated protobuf object
 perhaps someone as a sample / tutorial of the AddressBook protobuf in
 appengine that store object in the datastore

-- 
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 problem : oid is not instanceof javax.jdo.identity.ObjectIdentity

2010-10-14 Thread l.denardo
I managed to reproduce the issue with a simplified model.
Notice that the same code seemed to pass the test yoesterday...not
today.

I can't attach files so I paste the model here


@PersistenceCapable
class Inner{
@PrimaryKey
@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
Key key;
}


@PersistenceCapable
class Outer{
@PrimaryKey
@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
Key key;

@Persistent
Inner inner;

public Outer(){
inner = new Inner();
}

//  public void setInner(Inner in){
//  inner = in;
//  }
}


@PersistenceCapable
class Container{
@PrimaryKey
@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
Key key;

@Persistent
ArrayListOuter outers;

@Persistent
ArrayListInner inners;

public void addOuters( int n){
outers = new ArrayListOuter();
for (int i = 0; i  n; i++){
outers.add(new Outer());
}
}

public void addInners(int n){
inners = new ArrayListInner();
for (int i = 0; i  n; i++){
inners.add(new Inner());
}
}
}

public class TestJDOException {

private final LocalServiceTestHelper helper =
new LocalServiceTestHelper(new
LocalDatastoreServiceTestConfig());

private static final PersistenceManagerFactory pmf =
JDOHelper.getPersistenceManagerFactory(transactions-optional);

@Before
public void setUp() throws Exception {
helper.setUp();
}

@After
public void tearDown() throws Exception {
helper.tearDown();
}

@Test
public void testAddInners(){
Key key = null;
Container container = new Container();
container.addInners(1);
PersistenceManager pm = pmf.getPersistenceManager();
try{
pm.makePersistent(container);
key = container.key;
}
finally{
pm.close();
}

pm = pmf.getPersistenceManager();
try{
container = pm.getObjectById(Container.class, key);
System.out.println(container.inners);
System.out.println(container.outers);
}
finally{
pm.close();
}
}

@Test
public void testAddOuters(){
Key key = null;
Container container = new Container();
container.addOuters(1);
PersistenceManager pm = pmf.getPersistenceManager();
try{
pm.makePersistent(container);
key = container.key;
}
finally{
pm.close();
}

pm = pmf.getPersistenceManager();
try{
container = pm.getObjectById(Container.class, key);
System.out.println(container.inners);
System.out.println(container.outers);
}
finally{
pm.close();
}
}
}

First test passes, second fails. Every test adding Outers fails as
well.
Thanks to everybody
Lorenzo

-- 
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 problem : oid is not instanceof javax.jdo.identity.ObjectIdentity

2010-10-14 Thread l.denardo
I managed to reproduce the issue with a simplified model.
Notice that the same code seemed to pass the test yoesterday...not
today.

I can't attach files so I paste the model here


@PersistenceCapable
class Inner{
@PrimaryKey
@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
Key key;
}


@PersistenceCapable
class Outer{
@PrimaryKey
@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
Key key;

@Persistent
Inner inner;

public Outer(){
inner = new Inner();
}

//  public void setInner(Inner in){
//  inner = in;
//  }
}


@PersistenceCapable
class Container{
@PrimaryKey
@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
Key key;

@Persistent
ArrayListOuter outers;

@Persistent
ArrayListInner inners;

public void addOuters( int n){
outers = new ArrayListOuter();
for (int i = 0; i  n; i++){
outers.add(new Outer());
}
}

public void addInners(int n){
inners = new ArrayListInner();
for (int i = 0; i  n; i++){
inners.add(new Inner());
}
}
}

public class TestJDOException {

private final LocalServiceTestHelper helper =
new LocalServiceTestHelper(new
LocalDatastoreServiceTestConfig());

private static final PersistenceManagerFactory pmf =
JDOHelper.getPersistenceManagerFactory(transactions-optional);

@Before
public void setUp() throws Exception {
helper.setUp();
}

@After
public void tearDown() throws Exception {
helper.tearDown();
}

@Test
public void testAddInners(){
Key key = null;
Container container = new Container();
container.addInners(1);
PersistenceManager pm = pmf.getPersistenceManager();
try{
pm.makePersistent(container);
key = container.key;
}
finally{
pm.close();
}

pm = pmf.getPersistenceManager();
try{
container = pm.getObjectById(Container.class, key);
System.out.println(container.inners);
System.out.println(container.outers);
}
finally{
pm.close();
}
}

@Test
public void testAddOuters(){
Key key = null;
Container container = new Container();
container.addOuters(1);
PersistenceManager pm = pmf.getPersistenceManager();
try{
pm.makePersistent(container);
key = container.key;
}
finally{
pm.close();
}

pm = pmf.getPersistenceManager();
try{
container = pm.getObjectById(Container.class, key);
System.out.println(container.inners);
System.out.println(container.outers);
}
finally{
pm.close();
}
}
}

First test passes, second fails. Every test adding Outers fails as
well.
Thanks to everybody
Lorenzo

-- 
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 problem : oid is not instanceof javax.jdo.identity.ObjectIdentity

2010-10-14 Thread l.denardo

Looks like the problem is due to a combination of two factors:

*Class Inner has two parents, Outer and Container

AND

*Class Container mantains a list of Inners.

Changing to

@PersistenceCapable
 class Container{
 @PrimaryKey
 @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
 Key key;

 @Persistent
 ArrayListOuter outers;

 @Persistent
 Inner inners;

 public void addOuters( int n){
 outers = new ArrayListOuter();
 for (int i = 0; i  n; i++){
 outers.add(new Outer());
 }
 }

 public void addInners(int n){
 for (int i = 0; i  n; i++){
inner = new Inner();
 }
 }
}

Makes everything work fine.

I have a very similar model which works well in production (it's been
up for nearly one month now).
Hope this helps people facing similar issues. Maybe a short note in
documentation could help.

Regards
Lorenzo

-- 
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] JDO problem : oid is not instanceof javax.jdo.identity.ObjectIdentity

2010-10-13 Thread l.denardo
Hello everybody,
I'm facing a really annoying issue which I stepped into.

My unit tests (JDO) sometimes throw a
ClassCastException: oid is not instanceof
javax.jdo.identity.ObjectIdentity

The most annoying fact is that this is not reproducible in a
predictable way.
The very same JUnit test (using the App Engine testing suite) throws
this error, then stops, then throws it again.

I got this error for a while, tried to set up a simpler data model to
reproduce it, without success (all tests on simplified model passed
without errors).
Then i re-run the failed test, and it completed successfully *without
any code modifications*.

Looks like this behavior is difficult to reproduce and appears to
happen quite randomly:
http://groups.google.com/group/google-appengine-java/browse_thread/thread/042b674e7f7cb8a2

If anyone has advice about the reasons for this behavior, it would be
a great help.
It makes testing a data model unreliable, so I would like to
understand if this is a bug in the test cases or something due to
particular data models, to modify my classes accordingly.

Thanks for your help
Lorenzo

-- 
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 problem : oid is not instanceof javax.jdo.identity.ObjectIdentity

2010-10-13 Thread l.denardo
To make clearer what I mean with not predictable, I post part of a
test method:

[...]
try{
pm.makePersistent(persistent);
saved = persistent.getKey();
}
finally{

pm.close();
}
[...]
If I run the test, it fails.

If I modify *just that* portion of code stating

[...]
try{
pm.makePersistent(persistent);
saved = persistent.getKey();
}
finally{
if (pm.currentTransaction().isActive()){
pm.currentTransaction().rollback();
}
pm.close();
}
[...]

And run the test again (nothing else changes in my JUnit test nor in
data model), it passes.
If i run again the test (no further code modifications) it fails like
the first time.

This may be a problem in my test configurations, I guess.If this can
help, general config for my unit test is

private final LocalServiceTestHelper helper =
new LocalServiceTestHelper(new
LocalDatastoreServiceTestConfig());

private static final PersistenceManagerFactory pmf =
JDOHelper.getPersistenceManagerFactory(transactions-optional);

@Before
public void setUp() throws Exception {
helper.setUp();
}

@After
public void tearDown() throws Exception {
helper.tearDown();
}

Hope this can better identify the issue.

Regards
Lorenzo

On Oct 13, 12:21 pm, l.denardo lorenzo.dena...@gmail.com wrote:
 Hello everybody,
 I'm facing a really annoying issue which I stepped into.

 My unit tests (JDO) sometimes throw a
 ClassCastException: oid is not instanceof
 javax.jdo.identity.ObjectIdentity

 The most annoying fact is that this is not reproducible in a
 predictable way.
 The very same JUnit test (using the App Engine testing suite) throws
 this error, then stops, then throws it again.

 I got this error for a while, tried to set up a simpler data model to
 reproduce it, without success (all tests on simplified model passed
 without errors).
 Then i re-run the failed test, and it completed successfully *without
 any code modifications*.

 Looks like this behavior is difficult to reproduce and appears to
 happen quite 
 randomly:http://groups.google.com/group/google-appengine-java/browse_thread/th...

 If anyone has advice about the reasons for this behavior, it would be
 a great help.
 It makes testing a data model unreliable, so I would like to
 understand if this is a bug in the test cases or something due to
 particular data models, to modify my classes accordingly.

 Thanks for your help
 Lorenzo

-- 
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 problem : oid is not instanceof javax.jdo.identity.ObjectIdentity

2010-10-13 Thread l.denardo
Looks like adding:

@AfterClass
public static void afterClass(){
pmf.close();
}

solves the issue.
Any further clarification is appreciated anyway.

Thanks for your patience.
Lorenzo

-- 
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: Can I start Development server with a location to store data?

2010-09-30 Thread l.denardo
Data saved in the datastore are persistent (as a file) across restarts
of the server.
If you change the appID in your appengine-xml file the datastore does
not show the data you inserted usign the other appid, but they're
still there, and if you restore the appid you'll see them again.

Regards
Lorenzo

On Sep 30, 12:53 pm, Sarath sarath...@yahoo.com wrote:
 I am not doing this for testing. I really want to have my dev server
 to keep data across restarts. The app I am writing has multiple
 properties fetched from database. If I dont have to load those props
 everytime, I can save a lot of time.

 On Sep 29, 11:30 pm, Didier Durand durand.did...@gmail.com wrote:

  Hi,

 http://code.google.com/appengine/docs/java/tools/devserver.html#Using...
  does not seem to give any possibility to put it elsewhere

  Why don't you copy it in and out of the war folder by yourself (for
  example via @Before and @After in JUnit testcases) in order to reach
  the behavior that you wish.

  regards
  didier

  On Sep 29, 7:34 pm, Sarath prosar...@gmail.com wrote:

   Apparently, the Database on devserver is a file under the war folder.
   Can we make this parametrized so I can keep the data persistent on a
   particular location?

-- 
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: EntityGroup restrictions on doing a Query outside of a txn

2010-09-29 Thread l.denardo
Hello,
if you just store keys that should be fine...
Just be sure your methods don't actually try to fetch the objects when
they're called...

Maybe some detail about the code you're executing (parts of model and
update method) can help...
These are errors difficult to diagnose. I step into them occasionally
in my own code and need careful examination of the code to figure them
out.
Generally, doing what you seem to do (query and update other ojects
outside transaction) works, but I can't see what's going wrong with
your code.

Regards
Lorenzo

On Sep 28, 8:52 pm, Yousuf Haider yousuf.r...@gmail.com wrote:
 The Query is already being executed without a transaction. And it is
 definitely being executed outside the subsequently created transaction. That
 is the strange part.

 _yousuf

 On Mon, Sep 27, 2010 at 10:14 PM, Vikas Hazrati vhazr...@gmail.com wrote:
  Somehow with the error message looks like both your queries are still
  happening in the same transaction. Are you sure that the transaction
  boundaries of both the methods are separate? To check this I would
  separate the 2 out into 2 methods each having their own transaction
  start and end or @Transactional if you are using Spring. Then with a
  third method I would invoke the first, work on the results if anything
  to do and then invoke the second and observe if I still get the same
  error.
  You could also try to run the first one without a transaction since it
  is a fetch and if it is suits your application to execute it without
  the tx.

  Regards | Vikas
 www.inphina.com

  On Sep 27, 10:46 am, Yousuf Haider yousuf.r...@gmail.com wrote:
   First off I know that you can't operate on entities in different entity
   groups within the same transaction. My question is around a problem I am
   having where I am querying for certain entities (each in a different
  entity
   group) outside a txn and then I start a txn where I operate on an entity
  in
   a different entity group.

   In my model I have a root entity called User. So each instance of User
  will
   be in a different entity group.

   Here is what I am doing in pseudo-code:

   *Request comes in

   Create EntityManager

   Execute a JPA query using this EntityManager to retrieve the keys for all
   User entities satisfying a particular criteria (say we got UserKey1,
   UserKey2, UserKey3 back)

   Using EntityManager Start a txn
     Retrieve User with id : UserKey4 (notice this is different from the
  ones
   we retrieved above)
     Update this User object.
   Commit txn                          Intermittently
   fails here
   Close EntityManager

   Return response
   *

   Notice here that the initial query is not part of the transaction that is
   subsequently created.* Inside that transaction only a single entity group
  is
   operated upon* (the Entity group for User object UserKey4).

   The first time the request goes in (after a server start) this code
   intermittently fails. Every subsequent request fails pretty consistently.

   The exception occurs at the commit with the infamous: can't operate on
   multiple entity groups exception. The 2 entities listed in the exception
   are the following:
   1. the UserKey4
   2. One of the User objects whose keys were returned in the initial query.

   This is really weird since within the txn I am operating on a single
  entity
   group. If my understanding is correct I should be able to do this.

   The only rational reason why this is happening might be that even
  querying
   for objects outside a txn and any subsequent txn should deal with
  entities
   in the same entity group. Is that the case or am I missing something here
  ?

   I have not been able to find a definite answer to this in the
  documentation
   so thought I'd try the mailing list.

   Thanks
   Yousuf

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

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



[appengine-java] Re: EntityGroup restrictions on doing a Query outside of a txn

2010-09-28 Thread l.denardo
Be sure your update User4 method does not involve operations on the
other user objects.

Sometimes relations between objects are hidden in the model, i.e.
maybe you have something like a key for the other users in User4 (I'm
thinking about a friends list or similar things implemented).
In this case if you perform operations on those entities you may get
the error message.

Regards
Lorenzo

On Sep 27, 7:46 am, Yousuf Haider yousuf.r...@gmail.com wrote:
 First off I know that you can't operate on entities in different entity
 groups within the same transaction. My question is around a problem I am
 having where I am querying for certain entities (each in a different entity
 group) outside a txn and then I start a txn where I operate on an entity in
 a different entity group.

 In my model I have a root entity called User. So each instance of User will
 be in a different entity group.

 Here is what I am doing in pseudo-code:

 *Request comes in

 Create EntityManager

 Execute a JPA query using this EntityManager to retrieve the keys for all
 User entities satisfying a particular criteria (say we got UserKey1,
 UserKey2, UserKey3 back)

 Using EntityManager Start a txn
   Retrieve User with id : UserKey4 (notice this is different from the ones
 we retrieved above)
   Update this User object.
 Commit txn                          Intermittently
 fails here
 Close EntityManager

 Return response
 *

 Notice here that the initial query is not part of the transaction that is
 subsequently created.* Inside that transaction only a single entity group is
 operated upon* (the Entity group for User object UserKey4).

 The first time the request goes in (after a server start) this code
 intermittently fails. Every subsequent request fails pretty consistently.

 The exception occurs at the commit with the infamous: can't operate on
 multiple entity groups exception. The 2 entities listed in the exception
 are the following:
 1. the UserKey4
 2. One of the User objects whose keys were returned in the initial query.

 This is really weird since within the txn I am operating on a single entity
 group. If my understanding is correct I should be able to do this.

 The only rational reason why this is happening might be that even querying
 for objects outside a txn and any subsequent txn should deal with entities
 in the same entity group. Is that the case or am I missing something here ?

 I have not been able to find a definite answer to this in the documentation
 so thought I'd try the mailing list.

 Thanks
 Yousuf

-- 
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: What Does Hosted SQL Entail?

2010-09-27 Thread l.denardo
No SQL is available at the moment.
SQL support is planned in the App Engine for business version, which
you can read about in the docs (planned Q4 2010).

Regards
Lorenzo

On Sep 26, 5:29 am, Stefan stefan8...@gmail.com wrote:
 I'm trying to figure out if a traditional RDBMS will support my
 companies needs better than the given Google Datastore(BigTable).  The
 fact is that I don't know what the available RDBMS is/are and can't
 seem to find any info on what is out there. Do you know what the
 available options are, short of me calling sales? Please advise.

 Stefan

-- 
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: Cache questions

2010-09-21 Thread l.denardo
This is completely wrong.

The fact that memcache can expire at any time has been stated
anywhere, repeatedly.

The correct behavior with expiry times set is what the original poster
wants, i.e. memcache to guarantee expiry after a certain time lapse.
http://code.google.com/appengine/docs/java/memcache/overview.html#How_Cached_Data_Expires

Regards
Lorenzo

On Sep 21, 6:58 am, nischalshetty nischalshett...@gmail.com wrote:
 As far as cache expiry is considered, its a guarantee that the cache
 won't expire before the set expiry date (it might still expire in case
 of failures etc).

 Basically, there's no real guarantee that the cache will expire after
 the time that you have set. It's just that it won't expire before the
 set time.

 -Nischalhttp://justunfollow.com

 On Sep 21, 1:24 am, Navaneeth Krishnan navaneeth.cont...@gmail.com
 wrote:

  I have a couple of questions wrt Memcache.

  1. Where do I find the javadoc for jcache ? The document seems
  woefully out-of-date

  The 
  examples:http://code.google.com/appengine/docs/java/memcache/usingjcache.html

  refer to a package net.sf.jsr107.Cache. However, I find that the
  actual package is net.sf.jsr107cache.Cache.

  Where do I find the javadoc for net.sf.jsr107cache.Cache ?

  2. In my application, I create a cache with the following property:

                 props.put(GCacheFactory.EXPIRATION_DELTA,3600);

  Yet, I find that my cache does not expire after an hour. As a matter
  of fact, it does not seem to expire at all !  Objects put in the cache
  stay forever. Is there something I am missing ?

  Regards,
  Navaneeth

-- 
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] JDO - get object by key without knowing the class

2010-09-07 Thread l.denardo
HEllo everybody,
I'm facing an issue with JDO which is presented elsewhere in the
group, but with no workaround.

I simply need to retrieve an object from JDO using only the key.
That is do something like this

PersistenceManager pm = pmf.getPersistenceManager();
SimpleObject ll = new SimpleObject;
try{
pm.makePersistent(ll);
Key leftKey = ll.getKey();
Object retriveved = pm.getObjectById(leftKey);
}
finally{
pm.close();
}

This does not work. Documentation at
http://code.google.com/appengine/docs/java/datastore/creatinggettinganddeletingdata.html#Getting_an_Object_By_Key
states you must provide a class identifier to retrieve objects using
keys, so call

SimpleObject retriveved = pm.getObjectById(SimpleObject.class,
leftKey);
And that works, indeed.

The point is in the real application. I need to retrieve objects
without knowing the class, then treat them differently according to
their type. Actually I must model something similar to a tree (which
is not possible to do without using key references due to the way keys
are generated). I need to save the keys for left and right child of
the tree, then retrieve the objects and treat inner nodes differently
from leafs.

Are there workarounds to get an object using its key in JDO? Maybe I
should use low-level API to detect the kind of the entity.

Thanks for any advice
Lorenzo

-- 
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 - get object by key without knowing the class

2010-09-07 Thread l.denardo
Obviously the simple way to do it is to build a class reference using
Key.getKind().
Like

Key key = myObject.getKey();
String myPackage = com.example.entities.
Class cl = Class.forName(myPackage + key.getKind());
pm.getObjectById(class, key);

This surely works in development, provided that entities are in a
known package.
But it's definitely horrible.

On Sep 7, 11:48 am, l.denardo lorenzo.dena...@gmail.com wrote:
 HEllo everybody,
 I'm facing an issue with JDO which is presented elsewhere in the
 group, but with no workaround.

 I simply need to retrieve an object from JDO using only the key.
 That is do something like this

 PersistenceManager pm = pmf.getPersistenceManager();
 SimpleObject ll = new SimpleObject;
 try{
         pm.makePersistent(ll);
         Key leftKey = ll.getKey();
         Object retriveved = pm.getObjectById(leftKey);}

 finally{
         pm.close();

 }

 This does not work. Documentation 
 athttp://code.google.com/appengine/docs/java/datastore/creatinggettinga...
 states you must provide a class identifier to retrieve objects using
 keys, so call

 SimpleObject retriveved = pm.getObjectById(SimpleObject.class,
 leftKey);
 And that works, indeed.

 The point is in the real application. I need to retrieve objects
 without knowing the class, then treat them differently according to
 their type. Actually I must model something similar to a tree (which
 is not possible to do without using key references due to the way keys
 are generated). I need to save the keys for left and right child of
 the tree, then retrieve the objects and treat inner nodes differently
 from leafs.

 Are there workarounds to get an object using its key in JDO? Maybe I
 should use low-level API to detect the kind of the entity.

 Thanks for any advice
 Lorenzo

-- 
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: Index over a list property on GAE not working as expected

2010-07-28 Thread l.denardo

 Yes, I would say it is working on your local dev. because you have
 automatic indexes enabled and so is automatically creating the
 necessary index for you but then you are not deploying this

I can tell for sure, using Java, that there's a different behavior for
composite queries in the DevServer.
DevServer simply works without any index at all, returning correct
result sets also without the index.

Indexes for composite queries are not automatically generated, but
results are correct in the dev server. Then queries will return empty
sets in production because of the lack of index.
I think it's also stated somewhere (well hidden) in the documentation.

You have to manually configure the index and upload it to production
to get it working.

This is a confusing behavior, and maybe it's worth filing an issue
(requesting that the devserver fails like in production, maybe).

Regards
Lorenzo


On Jul 28, 1:33 am, Stephen Johnson onepagewo...@gmail.com wrote:
 Hi Miroslav,
 Yes, I would say it is working on your local dev. because you have
 automatic indexes enabled and so is automatically creating the
 necessary index for you but then you are not deploying this
 automatically generated index. It looks like your code splits search
 phrases into individual words and applies an AND in you query filter
 for each word, thus the search for my word becomes the filter:

   searchTerms == 'my'  searchTerms == 'word'

 Thus, this requires a composite index consisting of searchTerms twice.
 If you want to search for my word don't split it apart, just have
 the filter have

   searchTerms == 'my word'

 I believe this should do the trick.
 Stephen

 On Jul 27, 3:06 am, Miroslav Genov mgenov.j...@gmail.com wrote:

    Hello,
  I'm encountering a strange issue with datastore list property indexes
  when I'm trying to use them in a full-text search queries.

  Here are my index definition, my model definitions, my sample code and
  my test code, and the error that I'm getting when my app is deployed on
  GAE.

  Here is my searching index:
  datastore-index kind=DeviceAddressSearchIndex ancestor=false
  source=manual
  property name=searchTerms direction=asc/
  property name=identifier direction=desc/
  /datastore-index

  Here are my model definitions:
  @PersistenceCapable(identityType = IdentityType.APPLICATION)
  public class DeviceAddressEntity {
    �...@primarykey
    �...@persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
     private Key key;

    �...@persistent
     private String identifier;
      
      
    �...@persistent
     private DeviceAddressSearchIndex searchIndex;

  and my search index

  @PersistenceCapable(identityType = IdentityType.APPLICATION)
  public class DeviceAddressSearchIndex {

    �...@primarykey
    �...@persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
     private Key id;

    �...@persistent
     private Integer identifier;

    �...@persistent
     private Date date;

    �...@persistent
     private SetString searchTerms;

    �...@persistent(mappedBy = searchIndex)
     private DeviceAddressEntity address;

  Here is body of my method that is executing the searching query:
    public ListDeviceAddressEntity findAllAddresses(Integer offset,
  Integer pageSize, String searchQuery) {

       String[] terms = {};
       if (!Strings.empty(searchQuery)) {
         String searchTerms = searchQuery.toLowerCase();
         terms = searchTerms.split(\\s);
       }
        com.google.appengine.api.datastore.Query query = new
  com.google.appengine.api.datastore.Query(DeviceAddressSearchIndex.class.get­SimpleName());
       for (String term : terms) {
         query.addFilter(searchTerms,
  com.google.appengine.api.datastore.Query.FilterOperator.EQUAL,term);
       }

       query.setKeysOnly();

       query.addSort(identifier,
  com.google.appengine.api.datastore.Query.SortDirection.DESCENDING);

       SetKey addressKeys = Sets.newHashSet();
       PreparedQuery preparedQuery = datastoreService.prepare(query);
       IterableEntity addressEntities =
  preparedQuery.asIterable(FetchOptions.Builder.withOffset(offset).limit(page­Size));
       for (Entity entity : addressEntities) {
         addressKeys.add(entity.getParent());
       }

       if (addressKeys.size() == 0) {
         return Lists.newArrayList();
       }
       /** we are not using batches, cause mostly this search is for 5-10
  elements max. */
       ListDeviceAddressEntity addresses = new
  ArrayListDeviceAddressEntity(addressKeys.size());
       for (Key key : addressKeys) {
         DeviceAddressEntity address =
  pm.get().getObjectById(DeviceAddressEntity.class,key);
         addresses.add(address);
       }
    }

  Here is my test that is testing how full text search is working
    �...@test
     public void findAddressesUsingTextSearch() {
       final DeviceAddressEntity first = DeviceAddressEntity.with(56,
  NORMALIZED_MAC, my first word, 33, 10, 11, 12, 13, 14);
       final 

[appengine-java] Re: Index over a list property on GAE not working as expected

2010-07-28 Thread l.denardo
Getting back to the original question, since the error appears to be
for the second query and it's only a get (no composite index),
probably it's only a matter of automatic indexing being disabled.

Just as a pointer on text search, there's a post here:
http://googleappengine.blogspot.com/2010/04/making-your-app-searchable-using-self.html

Regards
Lorenzo

On Jul 28, 1:33 am, Stephen Johnson onepagewo...@gmail.com wrote:
 Hi Miroslav,
 Yes, I would say it is working on your local dev. because you have
 automatic indexes enabled and so is automatically creating the
 necessary index for you but then you are not deploying this
 automatically generated index. It looks like your code splits search
 phrases into individual words and applies an AND in you query filter
 for each word, thus the search for my word becomes the filter:

   searchTerms == 'my'  searchTerms == 'word'

 Thus, this requires a composite index consisting of searchTerms twice.
 If you want to search for my word don't split it apart, just have
 the filter have

   searchTerms == 'my word'

 I believe this should do the trick.
 Stephen

 On Jul 27, 3:06 am, Miroslav Genov mgenov.j...@gmail.com wrote:

    Hello,
  I'm encountering a strange issue with datastore list property indexes
  when I'm trying to use them in a full-text search queries.

  Here are my index definition, my model definitions, my sample code and
  my test code, and the error that I'm getting when my app is deployed on
  GAE.

  Here is my searching index:
  datastore-index kind=DeviceAddressSearchIndex ancestor=false
  source=manual
  property name=searchTerms direction=asc/
  property name=identifier direction=desc/
  /datastore-index

  Here are my model definitions:
  @PersistenceCapable(identityType = IdentityType.APPLICATION)
  public class DeviceAddressEntity {
    �...@primarykey
    �...@persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
     private Key key;

    �...@persistent
     private String identifier;
      
      
    �...@persistent
     private DeviceAddressSearchIndex searchIndex;

  and my search index

  @PersistenceCapable(identityType = IdentityType.APPLICATION)
  public class DeviceAddressSearchIndex {

    �...@primarykey
    �...@persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
     private Key id;

    �...@persistent
     private Integer identifier;

    �...@persistent
     private Date date;

    �...@persistent
     private SetString searchTerms;

    �...@persistent(mappedBy = searchIndex)
     private DeviceAddressEntity address;

  Here is body of my method that is executing the searching query:
    public ListDeviceAddressEntity findAllAddresses(Integer offset,
  Integer pageSize, String searchQuery) {

       String[] terms = {};
       if (!Strings.empty(searchQuery)) {
         String searchTerms = searchQuery.toLowerCase();
         terms = searchTerms.split(\\s);
       }
        com.google.appengine.api.datastore.Query query = new
  com.google.appengine.api.datastore.Query(DeviceAddressSearchIndex.class.get­SimpleName());
       for (String term : terms) {
         query.addFilter(searchTerms,
  com.google.appengine.api.datastore.Query.FilterOperator.EQUAL,term);
       }

       query.setKeysOnly();

       query.addSort(identifier,
  com.google.appengine.api.datastore.Query.SortDirection.DESCENDING);

       SetKey addressKeys = Sets.newHashSet();
       PreparedQuery preparedQuery = datastoreService.prepare(query);
       IterableEntity addressEntities =
  preparedQuery.asIterable(FetchOptions.Builder.withOffset(offset).limit(page­Size));
       for (Entity entity : addressEntities) {
         addressKeys.add(entity.getParent());
       }

       if (addressKeys.size() == 0) {
         return Lists.newArrayList();
       }
       /** we are not using batches, cause mostly this search is for 5-10
  elements max. */
       ListDeviceAddressEntity addresses = new
  ArrayListDeviceAddressEntity(addressKeys.size());
       for (Key key : addressKeys) {
         DeviceAddressEntity address =
  pm.get().getObjectById(DeviceAddressEntity.class,key);
         addresses.add(address);
       }
    }

  Here is my test that is testing how full text search is working
    �...@test
     public void findAddressesUsingTextSearch() {
       final DeviceAddressEntity first = DeviceAddressEntity.with(56,
  NORMALIZED_MAC, my first word, 33, 10, 11, 12, 13, 14);
       final DeviceAddressEntity second = DeviceAddressEntity.with(57,
  NORMALIZED_MAC, my second word, 9, 10, 11, 12, 13, 14);
       final DeviceAddressEntity third = DeviceAddressEntity.with(58,
  NORMALIZED_MAC, otherword, 9, 10, 11, 12, 13, 14);

       MonitoringService service =
  injector.getInstance(MonitoringService.class);
       service.saveDeviceAddress(56, first);
       service.saveDeviceAddress(57, second);

       ListDeviceAddressEntity addresses = service.findAllAddresses(0,
  5, my word);

       assertEquals(text search is not working
  

[appengine-java] Re: Index over a list property on GAE not working as expected

2010-07-28 Thread l.denardo
Glad to hear it!
Anyway more information about automatic generation is available here

http://code.google.com/appengine/docs/java/datastore/queriesandindexes.html#Defining_Indexes_With_Configuration

BTW there's the answer to everything in that:

Other forms of queries require their indexes to be specified in
datastore-indexes.xml, including:

* queries with multiple sort orders
* queries with a sort order on keys in descending order [.]

Your query seems to fall into the second case.

I think that in case of errors like the one you found you can simply
add the piece of XML to your datastore-indexes.xml.
Many times you're not so lucky to get the missing index statement, and
your queries simply return empty sets.

Regards
Lorenzo


On Jul 28, 12:37 pm, Miroslav Genov mgenov.j...@gmail.com wrote:
   It seems that the issue is with the sorting order. Now sorting order
 has been removed and works like a charm.

 On 28.7.2010 ?. 13:22 ?., Miroslav Genov wrote:

  First I wanna thank you all for the feedback.

  Now I had looked into guestbook example at
 http://code.google.com/p/guestbook-example-appengine-full-text-search...
  and
  I had modified my code to use the same query generation.

  Here is a snippet of my method that is doing searching job.
 http://pastebin.ca/1909986

  For my badness it seems that the result is same as in my last post.
  When I'm searching for a single word everything is working like a
  charm, but when I type my word datastore  is throwing
  the following exception:
  com.google.appengine.api.datastore.DatastoreNeedIndexException: no matching 
  index found..datastore-index kind=DeviceAddressSearchIndex 
  ancestor=false source=manual
           property name=searchTerms direction=asc/
           property name=searchTerms direction=asc/
           property name=identifier direction=desc/
       /datastore-index

  Any idea how can I enable the automatic indexing ?

  In fact, in other part in our project is using same technique with the
  low level api and is working without any index definitions and etc.
  Here are some snippets how we are doing it:
   private ListEntity getContractSearchIndexes(String query, String
  searchIndex, int offset, int pageSize) {
      timeLogger.start();

      String searchString = query.toLowerCase().trim();
      log.info(Search for:  + searchString);

      String[] terms = searchString.split(\\s);

      DatastoreService dataService =
  DatastoreServiceFactory.getDatastoreService();
      Query searchQuery = new Query(ContractSearchIndex);

      for (String term : terms) {
        searchQuery.addFilter(searchIndex, Query.FilterOperator.EQUAL,
  term);
      }

      ListEntity indexes =
  dataService.prepare(searchQuery).asList(FetchOptions.Builder.withOffset(offset).limit(pageSize));

      timeLogger.resetAndLog(Search time);

      return indexes;
    }

  The following code is working like a charm without any static index
  definitions and etc. The only difference between both indexes is the
  sorting order. In a few minutes I will try to remove it, so I can test
  what will happens without any ordering.

  On 28.7.2010 ?. 12:06 ?., l.denardo wrote:
  Getting back to the original question, since the error appears to be
  for the second query and it's only a get (no composite index),
  probably it's only a matter of automatic indexing being disabled.

  Just as a pointer on text search, there's a post here:
 http://googleappengine.blogspot.com/2010/04/making-your-app-searchabl...

  Regards
  Lorenzo

  On Jul 28, 1:33 am, Stephen Johnsononepagewo...@gmail.com  wrote:
  Hi Miroslav,
  Yes, I would say it is working on your local dev. because you have
  automatic indexes enabled and so is automatically creating the
  necessary index for you but then you are not deploying this
  automatically generated index. It looks like your code splits search
  phrases into individual words and applies an AND in you query filter
  for each word, thus the search for my word becomes the filter:

     searchTerms == 'my'  searchTerms == 'word'

  Thus, this requires a composite index consisting of searchTerms twice.
  If you want to search for my word don't split it apart, just have
  the filter have

     searchTerms == 'my word'

  I believe this should do the trick.
  Stephen

  On Jul 27, 3:06 am, Miroslav Genovmgenov.j...@gmail.com  wrote:

     Hello,
  I'm encountering a strange issue with datastore list property indexes
  when I'm trying to use them in a full-text search queries.
  Here are my index definition, my model definitions, my sample code and
  my test code, and the error that I'm getting when my app is deployed on
  GAE.
  Here is my searching index:
  datastore-index kind=DeviceAddressSearchIndex ancestor=false
  source=manual
  property name=searchTerms direction=asc/
  property name=identifier direction=desc/
  /datastore-index
  Here are my model definitions:
  @PersistenceCapable(identityType = IdentityType.APPLICATION

[appengine-java] Re: Highly Frustrated By Entity Groups / Transactions

2010-07-26 Thread l.denardo
As far as I know there are two possible solutions:

*Review the architecture inserting Elements as a list property of your
domain, something like

@PersistenceCapable
class Domain{
  private ArrayListElement elements;
}

This works correctly and you get the benefit to have a cascasing
delete on elements when you delete the Domain they're part of.
This does not seem to have significant drawbacks, as documentation
says somewhere Elements are fetched from datastore only if you access
the list, and not if you just read the Domain without actually going
thru the list.
Elements are also queriable without reading the actual Domain they're
in.
The only thing this architecture seems to impede is finding the domain
an element belongs to, given the element, without having complex
iterations.

* Check if domain exists outside the transaction.
If your domains are not deleted during an Element insert this should
work.

I've gone the first path for my application and benefits in terms of
code complexity and maintenance have been worth the effort, anyway it
depends on your business logic if that can be right.

Regards
Lorenzo


On Jul 24, 4:04 pm, Bill bill.milli...@gmail.com wrote:
 Hello,

 I'm quite frustrated with entity groups.  They seem to make the
 concept of a transaction largely pointless.

 The specific problem I face at this moment is this.  Since the
 datastore has no concept of foreign key constraints, I need to do
 bounds checking.  Here's the case:

 There exists a Domain type, and an Element type.  An Element requires
 a reference to a pre-existing Domain in order to function, per my
 business rules.  Domains exist independently of Elements, and are
 administered separately.  I would characterize their relationship as
 Element has a reference to a required Domain's primary key rather
 than Element is a child of Domain.

 When creating an Element, I need to check that the reference to the
 assigned Domain is not bogus.  I do this in my service layer, which is
 also where I want to determine transactionality.

 The algorithm goes like this:

 * start transaction.  Per my current architecture I cannot start this
 transaction any later without creating an entirely new non-
 transactional business delegate layer that feels like absolute
 overkill.
 * retrieve Domain by key.  If no such Domain is found, throw an error
 * insert Element
 * commit

 Unfortunately, this causes the dreaded can't operate on multiple
 entity groups in a single transaction exception.  I'm absolutely
 hornswaggled by this, since I'm not operating on the Domain.  I just
 want to check that it exists!  If this were a destructive change I
 were making, I'd kind of -- barely -- see the argument here, but why
 on earth is this a problem?  Am I missing something?

-- 
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: Highly Frustrated By Entity Groups / Transactions

2010-07-26 Thread l.denardo
Well, this is one of the major (maybe THE) drawback in
appengine...apps architecture must be designed for the platform much
more than with other kind of solutions.

Thinking a bit more about the original problem, there's a simple
solution for all: you can simply put your Domain Key in each element,
and mark it as a parent for the element as stated in

http://code.google.com/intl/it/appengine/docs/java/datastore/transactions.html

class Element{

 @Persistent
@Extension(vendorName=datanucleus, key=gae.parent-pk,
value=true)
private Key domainKey;
}

This way all elements are in the same group of a domain, and
transaction should work as long as you don't manipulate elements from
multiple domains in a single transaction.

Sorry for not stating it on first place, but I forgot abuot it

On 26 Lug, 13:28, Bill bill.milli...@gmail.com wrote:
 Hi Lorenzo,

 Certainly, this would work from a technical perspective.  However, it
 is absolutely not right for the problem.  For a variety of reasons,
 Domain and Element need to have a completely unowned relationship.
 I'll explain some of my high-level situation:

 The Domain will be administered by a DomainAdministrator.  This will
 be either me, or someone personally known to me.  For security
 reasons, the DomainAdministrator has *no access* to the Elements that
 belong to the Domain.  The DomainAdministrator will also assign
 authenticated users to what we can, for now, call the
 ElementAdministrator role.

 An ElementAdministrator has access to administer Elements within the
 context of assigned Domains.  There may be thousands of Elements
 within a single Domain.  At no time should all the Elements within a
 Domain ever be selected in a single operation.  There would be no
 point!  Also, the security model I've designed will fragment Elements
 further such that a User who is a member of the Domain will have
 access to only some of the Elements in that Domain.

 In fact, one of the primary reasons I'm building the Element the way I
 am is that Elements will be part of the fine-grained security model
 itself.  If a particular piece of data is selected in the system, I
 need to check the user's profile's security elements against the
 security elements baked into the data.  This would necessitate a
 datastore check, possibly in the middle of a transaction.

 If I have to manually twig the transaction on or off because of entity
 groups, I'm defeating years of conventional wisdom on separation of
 concerns.  I've designed my architecture the way I always have -- I
 want to be able to bring on junior developers who don't have to make
 decisions on low-level things like transactions and security.  To
 separate this concern, I'm using the extremely nice @Transactional
 annotation within spring.  If any service that inherits from my base
 entity service interface is called on its update() method, for
 instance, I want the whole thing to be transactional.  It deeply pains
 me that I could easily build this kind of a separated-concern solution
 ten years ago with clunky hand-built libraries for a Weblogic
 production environment, but I can't do it in 2010 with Google App
 Engine.

 The fundamental problem with the concept of the entity group as a
 restriction on transactional operations is that it mandates a
 hierarchy on all operations.  To be part of the entity group and
 thence any operation in the transaction, it says, there must be a hard-
 and-fast owned relationship between the entities.  This looks very
 nice on paper, but the problem is that if you're modelling the real
 world, real world entities do not have nice hierarchical
 relationships.  For a very nice explanation of why this is a very
 serious problem in solution design, see Christopher Alexander's
 classic A City Is Not A Tree (it's available online for free).

 I've hacked around this for now, with a ten pound sledge hammer and a
 rusty hacksaw.  Using spring interceptors, I've built in an extra-
 transactional check layer around my services, outside the aegis of
 the transactional advisor.  This is highly unsatisfactory because now
 my developers are going to have to keep track of what is, and what
 isn't part of the transaction.  The concern is no longer neatly
 separated.  This is de-evolution.

 I absolutely love what leap forward Google App Engine represents in
 terms of building applications.  OTOH, the restrictions of entity
 groups on transaction is a very real obstacle to building serious
 business applications!

 Thanks,

 - Bill

 On Jul 26, 3:22 am, l.denardo lorenzo.dena...@gmail.com wrote:

  As far as I know there are two possible solutions:

  *Review the architecture inserting Elements as a list property of your
  domain, something like

  @PersistenceCapable
  class Domain{
    private ArrayListElement elements;

  }

  This works correctly and you get the benefit to have a cascasing
  delete on elements when you delete the Domain they're part of.
  This does not seem

[appengine-java] Re: Highly Frustrated By Entity Groups / Transactions

2010-07-26 Thread l.denardo
I think it's not possible to have more than one parent entity.
I'm sure this is not possible using Keys, I don't know if it's the
case for Strings but I think the same applies there.

Adding another parent to the code shown (which should work) results in
an exception using datastore Keys.

I think the only workaround for your problem is doing the check for
the domain key outside transactions, if this does not lead to
consistency issues.

Regards
Lorenzo

On Jul 26, 2:26 pm, Bill bill.milli...@gmail.com wrote:
 * should read, Elements are hierarchical, so that an Element's parent
 is another Element, or else it is a root.

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



[appengine-java] Re: How to close an object before second transaction?

2010-07-22 Thread l.denardo

Be sure also that modifyObject does not make indirectly calls to
datastore.
It was the case in one of my handlers, where the call to modify
checked users authorizations, and those were occasionally read from
datastore when memcache expired.
That resulted in an exception in entity group handling.

Logs are usually useful to detect some of these behaviors.

regards
Lorenzo


On Jul 22, 3:07 am, Ikai L (Google) ika...@google.com wrote:
 Can you start the transaction before you do the fetch? The way you're
 writing it won't result in what you want to do.

 If that still doesn't work, just retrieve a new instance of the
 PersistenceManager. This is cheap so it won't cost you significant
 additional CPU.



 On Mon, Jul 19, 2010 at 5:59 AM, coltsith conla...@gmail.com wrote:
  Here's the psudo-code for one of my methods:

  1. Get PersistenceManager (pm)

  2. pm.fetchObject1

  3. pm.beginTransaction

  4. pm.modifyObject1

  5. pm.commit

  6. pm.fetchObject2

  7. pm.beginTransaction

  8. pm.modifyObject2

  9. pm.commit

  however I get this error can't operate on multiple entity groups in a
  single transaction...

  Do I have to put another line in between step 5 and 7 saying that I'm
  'done' with object1, like to close it?

  Thanks

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

 --
 Ikai Lan
 Developer Programs Engineer, Google App Engine
 Blog:http://googleappengine.blogspot.com
 Twitter:http://twitter.com/app_engine
 Reddit:http://www.reddit.com/r/appengine

-- 
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: Can I query keys only instead of full entities?

2010-07-21 Thread l.denardo
Low level API has a method to do this, in JDO/JPA simply select only
key field in your query.

See

http://gae-java-persistence.blogspot.com/2009/10/keys-only-queries.html

(from Max Ross, GAE team) for details.

Regards
Lorenzo

On Jul 21, 5:21 am, TL twl.e...@gmail.com wrote:
 I want to run a query and receive a few keys, which I will delete
 afterwards. The problem is that queries return the entire entity,
 unnecessary work for the data store and the client (which is also
 reflected as slower page performance and higher bills).
 All I want from the query is the keys.

 In SQL it would be something like
 select t.id from table t where t.column  someValue

 Is there a way to get it using the native API or in another way? I
 imagine that JPA will do the same if the underlying libraries can only
 return full records.

-- 
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: App Engine integration with Google Apps Marketplace

2010-07-19 Thread l.denardo
The link to generate login URL is different for apps accounts

String appsLoginUrl = userService.getOpenIdLoginUrl(redirectTo,
loginDomain,

https://www.google.com/accounts/o8/site-xrds?hd=; +
loginDomain, attributesRequest);

loginDomain is obviously your domain, in your case the URL is
https://www.google.com/accounts/o8/site-xrds?hd=domain1.com;

Regards
Lorenzo

On Jul 15, 11:29 pm, Daniel Pascariu daniel.pasca...@gmail.com
wrote:
 Hi,

 I'm trying to enable SSO for my App Engine app in order to put it on
 the Google Marketplace.
 Let's say that I have my GAE app running atwww.example.com. When I
 publish it to the Google Marketplace, a Google Apps user (say
 us...@domain1.com) will be able to click on a link in the Google menu
 pointing to my site - something like 
 this:http://www.example.com/home?from=googledomain=domain1.com

 Now, acording to this docu (http://code.google.com/appengine/docs/java/
 users/overview.html) I should use the Users API to authenticate the
 user.
 I assume I have to use  userService.createLoginURL method somehow and
 use the domain domain1.com (which is passed as a parameter to my /
 home servlet).

 I have tried something like this:

 SetString attributesRequest = new HashSetString();
 attributesRequest.add(openid.mode=checkid_immediate);
 attributesRequest.add(openid.ns=http://specs.openid.net/auth/2.0;);
 attributesRequest.add(openid.return_to= + thisUrl);
 userService.createLoginURL(thisUrl, domain1.com, 
 https://www.google.com/accounts/o8/id;, attributesRequest);

 The probem is that the login URL which I get works for google accounts
 only (like gmail accounts) - I do not get any Google Apps page where a
 user like us...@domain1.com could login :(

 Does anybody know how I can get this working ? Or am I on the wrong
 track ?

 Many thanks for the help !!
 Daniel

-- 
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: App Engine integration with Google Apps Marketplace

2010-07-19 Thread l.denardo
I don't know if there are any differences, since I never tried the
other way.

I'll try to investigate in the next days, but I think this could be
helpful for things such as https redirect and similar issues.
Maybe a word from GAE team will help (anyway, some blog posts about
OpenID have been announced, so I think we'll be informed soon about
everything).

regards
Lorenzo

On Jul 19, 3:52 pm, Daniel Pascariu daniel.pasca...@gmail.com wrote:
 Hi Lorenzo,

 Thanks for taking the time to help !

 I tried to call userService.createLoginURL with federatedIdentity =
 https://www.google.com/accounts/o8/site-xrds?hd=domain1.com; as you
 suggested and it seems to work :)

 But it also works with federatedIdentity = 'domain1.com !

 The produced URLs are slightly different, but the outcome seems the
 same - I can login to domain1.com using user1 (on google apps).
 I'm wondering if there's any subtle difference between the OpenId
 authentification in the two cases - do you know ?

 Thanks,
 Daniel

 On Jul 19, 9:43 am, l.denardo lorenzo.dena...@gmail.com wrote:

  The link to generate login URL is different for apps accounts

  String appsLoginUrl = userService.getOpenIdLoginUrl(redirectTo,
  loginDomain,
                                                  
  https://www.google.com/accounts/o8/site-xrds?hd=; +
  loginDomain, attributesRequest);

  loginDomain is obviously your domain, in your case the URL is
  https://www.google.com/accounts/o8/site-xrds?hd=domain1.com;

  Regards
  Lorenzo

  On Jul 15, 11:29 pm, Daniel Pascariu daniel.pasca...@gmail.com
  wrote:

   Hi,

   I'm trying to enable SSO for my App Engine app in order to put it on
   the Google Marketplace.
   Let's say that I have my GAE app running atwww.example.com. When I
   publish it to the Google Marketplace, a Google Apps user (say
   us...@domain1.com) will be able to click on a link in the Google menu
   pointing to my site - something like 
   this:http://www.example.com/home?from=googledomain=domain1.com

   Now, acording to this docu (http://code.google.com/appengine/docs/java/
   users/overview.html) I should use the Users API to authenticate the
   user.
   I assume I have to use  userService.createLoginURL method somehow and
   use the domain domain1.com (which is passed as a parameter to my /
   home servlet).

   I have tried something like this:

   SetString attributesRequest = new HashSetString();
   attributesRequest.add(openid.mode=checkid_immediate);
   attributesRequest.add(openid.ns=http://specs.openid.net/auth/2.0;);
   attributesRequest.add(openid.return_to= + thisUrl);
   userService.createLoginURL(thisUrl, domain1.com, 
   https://www.google.com/accounts/o8/id;, attributesRequest);

   The probem is that the login URL which I get works for google accounts
   only (like gmail accounts) - I do not get any Google Apps page where a
   user like us...@domain1.com could login :(

   Does anybody know how I can get this working ? Or am I on the wrong
   track ?

   Many thanks for the help !!
   Daniel

-- 
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: PDF Files

2010-07-16 Thread l.denardo
The patch seems to be incompatible with IText license, as you can read
in comments at

http://sourceforge.net/tracker/?func=detailaid=2810312group_id=15255atid=365255

PDFJet has both a free limited version and a paid one, which adds
functions like tables formatting and pagination.
I used the free version succesfully for simple tasks. It lacks
complexity (like handling layout) but you can use the basic API to
build such advanced features.

Looks like IText can work on GAE also without the patch if you limit
the functionalities you use.
Such limitations make IText very similar to PDFJet with respect to API
flexibility and level of abstraction, since advanced Itext features
are the ones using AWT, so I decided to go directly with PDFJet for my
project.

Regards
Lorenzo

On Jul 15, 5:35 pm, Shyam Visamsetty shyamsunder...@gmail.com wrote:
 See this link for more details.

 http://blog.rubypdf.com/2009/12/17/how-to-run-itext-on-google-app-eng...

 May be we should update the Will it play on App Engine page.

 Thanks,
 Shyam Visamsetty

 On Jul 15, 12:25 am, dovm dovm...@gmail.com wrote:

  Hi,

  Check this onehttp://www.pdfjet.com/java/index.html

  They claim to support Google App Engine

  =Dov

  On Jul 15, 7:57 am, Daniel vedm...@gmail.com wrote:

   But it says that on Will it play in App Engine

   That its incompatible:

   iText
   Version(s): ?
   Status: INCOMPATIBLE

       * iText relies on several classes not in the JRE class whitelist
   including java.awt.Color and java.nio.MappedByteBuffer. A bug has been
   filed 
   athttp://sourceforge.net/tracker/?func=detailatid=365255aid=2810312g

   On Jul 15, 7:51 am, Shyam Visamsetty shyamsunder...@gmail.com wrote:

Chris,

Did you want to generate a PDF File on the GAE?
If yes, you can use the iText library for generating the pdfs on the
app engine. You can have a servlet to download the PDF file you
generated.

Thanks,
Shyam Visamsetty

On Jul 14, 1:36 pm, chrischelmi michelvo...@gmail.com wrote:

 Helle every body,
 I am working on a Google App Engine Project that consists of uploading
 PDF files and displaying it after.
 I use a Blob to store the PDF file
 i want to do a process to download this PDF file by giving the a
 specifics name.
 Is there a way to generaye PDF files with GAE?
 i have a process to display the PDF but i want to download it direcly
 from an URL.

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



[appengine-java] Re: How long is my application state hold on the app engine?

2010-07-15 Thread l.denardo
I can also add that a new deployment does not clear memcache (it was
an issue for me since it was hiding all changes in my upload).
Memcache on the other hand can expire in any moment, so you must be
ready to accept some data loss if you don't want to back it using the
dataastore.

Regards
Lorenzo

On Jul 14, 6:08 pm, Ingo Jaeckel ingo.jaec...@googlemail.com wrote:
 aah alright. thanks Don for the clarification!

 kind regards,
 ingo

 2010/7/14 Don Schwarz schwa...@google.com:

  That is correct.  You can not maintain state within the JVM and expect to
  get any long-term persistence or coherency.

  You should use either memcache (which provides coherency) or the datastore
  (which provides both).

  On Wed, Jul 14, 2010 at 3:38 PM, Ingo Jaeckel ingo.jaec...@googlemail.com
  wrote:

  hello everyone,

  i just had a look into the documentation
 http://code.google.com/intl/de-DE/appengine/docs/java/runtime.html

  App Engine uses multiple web servers to run your application, and
  automatically adjusts the number of servers it is using to handle
  requests reliably. A given request may be routed to any server, and it
  may not be the same server that handled a previous request from the
  same user.

  does this mean that there are n jvms on n servers running my
  application. thus if i want to collect profiling information about my
  server code i will always have to persist it in the db. it would not
  be sufficient just to hold it within the app (thus within the jvm).
  because i will have different application stats across the different
  servers running my application in parallel and independently..

  can anyone confirm this claim?

  kind regards,
  ingo

  2010/7/13 ingo ingo.jaec...@googlemail.com:
   hello everyone,

   i want to collect some performance figures of my app on the server
   side. but i do not want to persist them in the database, i only want
   to collect them by changing the state of some class (i.e. changing
   class members like number of requests, number of method calls, etc). i
   want to read these values on the client side and display them in an
   administration panel (or a profiler-like ui).

   but currently i think the application state is at least lost after
   each new deployment. is this the only time the state is resetted? does
   a jvm holding my application state run all the time between each
   deployment?

   i have the same question regarding static members. i use singletons or
   static variables on server side to make sure they are constructed only
   once whenever their construction is expensive. so i want to make sure
   that the jvm holding the instances is running for a very long time to
   avoid reconstruction of them. however, it feels like the jvm is
   restarted relatively often (due to very low load on my app maybe) and
   thus the singletons are recreated during the jvm startup.

   kind regards,
   ingo

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

-- 
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: Enabling SSL for a Servlet

2010-07-09 Thread l.denardo
Hello Ikai,
as I mentioned elsewhere in the group, access via HTTPS does not
complete properly.

What I get is an error

Secure Connection Failed
An error occurred during a connection to ikai-openid-demo.appspot.com:
80.

SSL received a record that exceeded the maximum permissible length.

(Error code: ssl_error_rx_record_too_long)
*   The page you are trying to view can not be shown because the
authenticity of the received data could not be verified.
*   Please contact the web site owners to inform them of this
problem. Alternatively, use the command found in the help menu to
report this broken site.

This happens on Firefox 3.6.6 on Ubuntu 10.4, and happens at the time
I get redirected to the app after allowing the app to access my Google
Account information.
The same on Chrome with a different message.

Any pointer on this behavior will be very useful to me, since my app
is affected too.
Thank you
Regards
Lorenzo

On Jul 8, 7:05 pm, Ikai L (Google) ika...@google.com wrote:
 You shouldn't have to do anything. Just deploy your application and browse
 to the SSL version. Here's an OpenID demo app I wrote. It's accessible both
 here:

 http://ikai-openid-demo.appspot.com/

 And here:

 https://ikai-openid-demo.appspot.com/

 I didn't do anything at all.



 On Mon, Jul 5, 2010 at 1:39 PM, Paul Toth paul.t...@gmail.com wrote:
  I would like to enable SSL for a servlet residing on the App Engine.

  So, instead of accessing it like so

     http://mystuff.appspot.com

  it is accessed like so

     https://mystuff.appspot.com

  All of the information I've been able to find so far focuses on
  administrative functions rather than deployment of an SSL-enabled
  entity.

  Any assistance would be greatly 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.comgoogle-appengine-java%2bunsubscr...@googlegroups.com
  .
  For more options, visit this group at
 http://groups.google.com/group/google-appengine-java?hl=en.

 --
 Ikai Lan
 Developer Programs Engineer, Google App Engine
 Blog:http://googleappengine.blogspot.com
 Twitter:http://twitter.com/app_engine
 Reddit:http://www.reddit.com/r/appengine

-- 
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 Collection of Serializables

2010-07-07 Thread l.denardo
If you are using a serialized field you must add the serialized=true
clause to your annotation

@Persistent(serialized=true)
MySerializableObject serializable;

Also notice that JDO does not automatically detect if you update only
the inner fields of the object you save, so you must substitute it
with a copy to have it persisted.
See this post for a very good overview and an explanation of the fact
above:

http://groups.google.com/group/google-appengine-java/browse_thread/thread/747ceed8396c0ed8/b311227fbe4d9304?lnk=gstq=serialized+fields+snippets+work#b311227fbe4d9304

Regards
Lorenzo

On Jul 7, 1:33 am, laserjim laser...@gmail.com wrote:
 Hello,

 I'm still trying to persist a list of serializable objects. I would
 expect this to be a standard collection as described 
 here:http://code.google.com/appengine/docs/java/datastore/dataclasses.html...

 FooObject is serializable, but my attempt gave me an exception:
 FooObject is not a supported property type.

 Everything works as expected if I replace my serializable class
 (FooObject) with String.

 How can I persist my list of FooObjects using JDO?

 Thanks!

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



[appengine-java] Re: JDO Collection of Serializables

2010-07-07 Thread l.denardo
Hello,
I guess your problem is the behavior of serialized fields (including
collections of them, as far as I know), which is explained in Max
Ross's post.
Or something related to that.

Anyway, some property fields are marked as updated and hence saved
in the datastore only if you update the reference to the field, and
they're not updated if you just use modifiers to operate on them.
In practice, something like

 ArrayListFoo list = retrieve from datastore
list.add(Foo foo)
close persistence manager

Does not modify the list in the datastore, so if it's saved as an
empty list at creation it remains empty.
Doing

 ArrayListFoo list = retrieve from datastore
 ArrayList copy = new ArrayList(list);
 copy.add(Foo foo)
 list = copy;
close PM

Usually makes everything work, since the original list field is marked
as updated and persisted.
As far as I know this is true both for serialized fields and for many
collections.

Regards
Lorenzo

On Jul 7, 1:28 pm, laserjim laser...@gmail.com wrote:
 Hello Lorenzo,

 Thanks, but perhaps my question wasn't clear.  I'm trying to make a
 list of serialized objects, NOT a serialized list of objects.

 For instance, assuming FooObject implements Serializable...

 @Element(serialized=true)
 ListFooObject foos = new ArrayListFooObject();

 Unfortunately, the list is always empty.  Not quite sure why.

 Thanks!

 On Jul 7, 2:59 am, l.denardo lorenzo.dena...@gmail.com wrote:

  If you are using a serialized field you must add the serialized=true
  clause to your annotation

  @Persistent(serialized=true)
  MySerializableObject serializable;

  Also notice that JDO does not automatically detect if you update only
  the inner fields of the object you save, so you must substitute it
  with a copy to have it persisted.
  See this post for a very good overview and an explanation of the fact
  above:

 http://groups.google.com/group/google-appengine-java/browse_thread/th...

  Regards
  Lorenzo

  On Jul 7, 1:33 am, laserjim laser...@gmail.com wrote:

   Hello,

   I'm still trying to persist a list of serializable objects. I would
   expect this to be a standard collection as described 
   here:http://code.google.com/appengine/docs/java/datastore/dataclasses.html...

   FooObject is serializable, but my attempt gave me an exception:
   FooObject is not a supported property type.

   Everything works as expected if I replace my serializable class
   (FooObject) with String.

   How can I persist my list of FooObjects using JDO?

   Thanks!

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



[appengine-java] Re: Automatic restart of development server in Eclipse

2010-07-05 Thread l.denardo
This is true only for the GWT client side (and not completely, since
Gin modules don't seem to be refreshed correctly).

For server side, JSPs look to be refreshed automatically, but you must
reload the server to have your RPC services updated.
If you use Eclipse there's a reload icon in the Development Mode
tab, just near the one to stop the server (yes, it looks like tab's
refresh...)
Be careful when doing this, since restart adds up space to the process
and it eventually goes out of memory after a couple of reloads (at
least, this happens to me. Should be configurable but I never tried).

Regards
Lorenzo

On Jul 4, 6:40 am, jesbox jesb...@gmail.com wrote:
 Hi!
 I have read that it should be sufficient to save a java source file
 and that the development server would reload the class. Then I could
 reload the page and it would be the latest version I would look at.

 This does not happen to me, I have to stop the development server and
 then run the application again.

 Many thanks for advice on this.

-- 
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: Key command to restart dev server in eclipse?

2010-06-25 Thread l.denardo
Hello,
there's a small reload icon in the development mode tab, next to the
one to stop the server.
Sadly it looks like the one to refresh the tab's content, but it's
not, I realized it was server reload by accident.

A couple of warnings:
-Reloading the server adds memory space to the process, so it goes out
of memory after a couple of reloads and you have no way to stop it but
killing the process (I run on Ubuntu 10.4).
-Reload button sometimes disappears from the UI, but it's an Eclipse
issue (or at least my eclipse :-)), it happens to other buttons too.

Regards
Lorenzo

On Jun 24, 4:44 pm, Mark mar...@gmail.com wrote:
 Hi,

 I'm using eclipse for development. Is there a way we can bind
 restarting the dev server to a key command? I find it takes a bit of
 time to restart manually, especially when using a laptop trackpad!

 Thanks

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



[appengine-java] Re: Administration Console Custom Pages

2010-06-23 Thread l.denardo
I think you're missing the security constraint on the page in web.xml

security-constraint
web-resource-collection
url-pattern/adminboard/url-pattern
/web-resource-collection
auth-constraint
role-nameadmin/role-name
/auth-constraint
/security-constraint

Custom console pages are, for what I understand, nothing more than a
handy way to access your administrator-only pages from the admin
console, instead of manually browsing to them.

Regards
Lorenzo

On Jun 22, 4:05 pm, WillNa kan...@chez.com wrote:
 Hello,

 I'm trying to add an admin page to the admin console, 
 followinghttp://code.google.com/appengine/docs/java/config/appconfig.html#Admi...

 Unfortunatly, whatever I try, nothing more is visible on /_ah/admin

 This is what I added to my appengine-web
 admin-console
         page name=Create a board url=/adminboard /
 /admin-console

 and what I added to web.xml
 servlet
         servlet-nameadminboard/servlet-name
         jsp-file/admin_board.jsp/jsp-file
   /servlet

 servlet-mapping
         servlet-nameadminboard/servlet-name
         url-pattern/adminboard/url-pattern
 /servlet-mapping

 Am I missing something ?!

 Thanks for any hint

 William

-- 
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: Administration Console Custom Pages

2010-06-23 Thread l.denardo
Sorry, I didn't get you were working locally...
They don't appear in the development server, but they should appear
correctly in production.

In the dev server you must access them directly with their URL (admin
access restriction instead is correctly emulated).

regards
Lorenzo

On Jun 23, 4:47 pm, WillNa kan...@chez.com wrote:
 On Jun 23, 10:34 am, l.denardo lorenzo.dena...@gmail.com wrote:

  I think you're missing the security constraint on the page in web.xml

  security-constraint
          web-resource-collection
              url-pattern/adminboard/url-pattern
          /web-resource-collection
          auth-constraint
              role-nameadmin/role-name
          /auth-constraint
      /security-constraint

 sorry, I forgot to tell you I already add these lines on web.xml
 still not working



  Custom console pages are, for what I understand, nothing more than a
  handy way to access your administrator-only pages from the admin
  console, instead of manually browsing to them.

 it's exactly what I want.
 it's a nonsense to have 2 admin page : gae one and mine
 but whatever I do,http://localhost:/_ah/admin/always shows the 4
 standard admin pages

 perhaps it only doesn't work on local ?

 Thanks

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



[appengine-java] Re: Issue with Mail API: mail is saved in users folders

2010-06-15 Thread l.denardo
Thank you very much for your explanation. I'll add a notice to the
users to clarify this behavior.

Thanks again
Lorenzo

On Jun 14, 9:19 pm, Ikai L (Google) ika...@google.com wrote:
 Yes, this is intended. Create a new admin email address and ask users for
 their information. We include this information to balance being able to send
 emails from logged in users, and allowing users to recognize if GAE apps are
 spoofing their emails.

 On Mon, Jun 14, 2010 at 5:12 AM, l.denardo lorenzo.dena...@gmail.comwrote:



  Hello,
  I'm cross posting from general GAE group since it's a major issue and
  related to Java API use.

  I have an application deployed in GAE (Java) using Mail API.
  The app is restricted in access to users from my Google Apps domain.
  To receive feedback from users, I send from client (GWT + gwt
  dispatch) an action containing a subject and message.
  On server side I prepare an email message, set the logged in user as
  the sender and send the message to a mail group. Code follows, User
  management is backed by UserService

             Message msg = new MimeMessage(session);
             String userID = authenticator.getCurrentUserIdentifier();
             msg.setFrom(new
  InternetAddress(authenticator.getUserDetails(userID).getEmail()));
             msg.addRecipient(Message.RecipientType.TO,
                              new
  InternetAddress(x...@.it));
             msg.setSubject(action.getTitle());
             msg.setText(action.getMessage() );
             Transport.send(msg);

  The point is that users can find that email in their sent mail
  folder in Google Mail, even if they didn't actively send the message
  by themselves (they use a GWT developed form, not a mail agent).

  I would like to know if this is an attended behaviour, and if it can
  be turned off in some way: I think it's a bit disappointing for users
  to find mails they did not send in their own folders, since this can
  lead the user to think our app can take control over their personal
  folders, which is in fact not true.

  Java mail documentation in
 http://code.google.com/appengine/docs/java/mail/
  did not help.

  Thanks for clarification
  Regards
  Lorenzo

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

 --
 Ikai Lan
 Developer Programs Engineer, Google App Engine
 Blog:http://googleappengine.blogspot.com
 Twitter:http://twitter.com/app_engine
 Reddit:http://www.reddit.com/r/appengine

-- 
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] Issue with Mail API: mail is saved in users folders

2010-06-14 Thread l.denardo
Hello,
I'm cross posting from general GAE group since it's a major issue and
related to Java API use.

I have an application deployed in GAE (Java) using Mail API.
The app is restricted in access to users from my Google Apps domain.
To receive feedback from users, I send from client (GWT + gwt
dispatch) an action containing a subject and message.
On server side I prepare an email message, set the logged in user as
the sender and send the message to a mail group. Code follows, User
management is backed by UserService

Message msg = new MimeMessage(session);
String userID = authenticator.getCurrentUserIdentifier();
msg.setFrom(new
InternetAddress(authenticator.getUserDetails(userID).getEmail()));
msg.addRecipient(Message.RecipientType.TO,
 new
InternetAddress(x...@.it));
msg.setSubject(action.getTitle());
msg.setText(action.getMessage() );
Transport.send(msg);

The point is that users can find that email in their sent mail
folder in Google Mail, even if they didn't actively send the message
by themselves (they use a GWT developed form, not a mail agent).

I would like to know if this is an attended behaviour, and if it can
be turned off in some way: I think it's a bit disappointing for users
to find mails they did not send in their own folders, since this can
lead the user to think our app can take control over their personal
folders, which is in fact not true.

Java mail documentation in http://code.google.com/appengine/docs/java/mail/
did not help.

Thanks for clarification
Regards
Lorenzo

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



[appengine-java] Re: How active is GAE team in fixing bugs?

2010-06-14 Thread l.denardo
I guess they mean that tracker is used only to collect issues from
users, without being used to schedule and track internal work on
issues collected. This is fairly understandable since any public issue
tracker is exposed to a small amount of what can be minor issues
compared to major issues that can regard entire GAE infrastructure,
resulting in being a bit noisy for main work scheduling.

I think filing issues is useful and can lead to major improvements in
the platform. Starring issues or watching them is more or less
useless, since updates won't be announced in that tracker but in blog,
groups, etc.

Regards
Lorenzo

On Jun 14, 12:36 pm, Marc Guillemot mguille...@yahoo.fr wrote:
 Hi Ikai,

 in other words you just say here that entering bugs (taking the time to
 see if a bug already exists, trying to build the smallest example to
 reproduce the problem, ...) is nearly lost time for GAE users :-(

 Cheers,
 Marc.

 Ikai L (Google) wrote:
  Prettyactive. We don't use that issue tracker, so we occasionally have
  to scrub it. It's all a question of balancing priorities.

  On Wed, Jun 9, 2010 at 12:57 AM, Marc Guillemot mguille...@yahoo.fr
  mailto:mguille...@yahoo.fr wrote:

      Hi,

      I wonder howactiveGAE team is to fix bugs. I see only a very very
      limited activity in the bugs I've reported and in the numerous ones
      I've starred.

      Cheers,
      Marc.
      --
      Blog:http://mguillem.wordpress.com

  --
  Ikai Lan
  Developer Programs Engineer, Google App Engine
  Blog:http://googleappengine.blogspot.com
  Twitter:http://twitter.com/app_engine
  Reddit:http://www.reddit.com/r/appengine

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