[appengine-java] Re: Unowned relationships
Hi: Quote from the page: http://code.google.com/appengine/docs/java/datastore/relationships.html#Unowned_Relationships The App Engine implementation of JDO does not yet implement this facility, but don't worry, you can still manage these relationships using Key values in place of instances (or Collections of instances) of your model objects. Hope this helps, even though it's not much Albert Attard Ogden Nash http://www.brainyquote.com/quotes/authors/o/ogden_nash.html - The trouble with a kitten is that when it grows up, it's always a cat. 2009/8/31 funkforce funkfo...@gmail.com Hi Can someone post a full example of working code with unowned relationships? It semas that several pople are havning problems with this on I cant find any solution posted in this group yet. I think that I must use unowned relationships in my code. If I am mistaken please correct me. I have a beverage class that has a packaging class ,a district class and a Set of materials. A beverage can have one type of packaing, one type of district ans several materials. Packaing can belong to several beverages. District can belong to several beverages. Materials can belong to several beverages. Any thoughts? Thnkas FF --~--~-~--~~~---~--~~ 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: Exception while deploying JSP Tag Lib Files
Hi: If you're using Eclipse, please check your installed JDK. Follow this blog for details: http://albertattard.blogspot.com/2009/08/jsp-compile-error-in-eclipse.html http://albertattard.blogspot.com/2009/08/jsp-compile-error-in-eclipse.htmlHope this helps, Albert Attard Ogden Nash http://www.brainyquote.com/quotes/authors/o/ogden_nash.html - The trouble with a kitten is that when it grows up, it's always a cat. 2009/8/30 Klaro klaus.rog...@web.de I'm trying to use Tag Libs that are expressed as JSP file (as explained in JSP Spec V2.1, §8 and §8.5). Those JSP Tag Lib files need to be placed in a subdir of WEB-INF/tags - usually with the file name extension .tag or tagx insetad of .jsp or jspx. Creating using them on the dev system works fine and as expected, but when I deploy them, I get the exception below - no matter how simple the content is. There is a message saying Unable to find a javac compiler and Perhaps JAVA_HOME does not point to the JDK. Since compiling of regular JPS files works fine during deployment this cannot be the real reason (BTW, JAVA_HOME *is* set properly). Any ideas? Fixes needed? Regards, Klaus -- snip snap Creating staging directory Scanning for jsp files. Compiling jsp files. com.google.appengine.tools.admin.JspCompilationException: Failed to compile jsp files. 30.08.2009 22:39:37 org.apache.jasper.JspC processFile INFO: Built File: \test.jsp 30.08.2009 22:39:37 org.apache.jasper.compiler.Compiler generateClass SCHWERWIEGEND: Error compiling file: /E:/Temp/Windows/appcfg35419.tmp/ WEB-INF/classes//org/apache/jsp/tag/web/utils\clearcache_tagx.java [javac] Compiling 1 source file 30.08.2009 22:39:37 org.apache.jasper.compiler.Compiler generateClass SCHWERWIEGEND: Javac exception Unable to find a javac compiler; com.sun.tools.javac.Main is not on the classpath. Perhaps JAVA_HOME does not point to the JDK at org.apache.tools.ant.taskdefs.compilers.CompilerAdapterFactory.getCompiler (CompilerAdapterFactory.java:105) at org.apache.tools.ant.taskdefs.Javac.compile(Javac.java:924) at org.apache.tools.ant.taskdefs.Javac.execute(Javac.java:757) at org.apache.jasper.compiler.Compiler.generateClass(Compiler.java: 382) at org.apache.jasper.compiler.Compiler.compile(Compiler.java:472) at org.apache.jasper.compiler.Compiler.compile(Compiler.java:451) at org.apache.jasper.compiler.Compiler.compile(Compiler.java:439) at org.apache.jasper.JspCompilationContext.compile (JspCompilationContext.java:511) at org.apache.jasper.servlet.JspServletWrapper.loadTagFile (JspServletWrapper.java:201) at org.apache.jasper.compiler.TagFileProcessor.loadTagFile (TagFileProcessor.java:514) at org.apache.jasper.compiler.TagFileProcessor.access$000 (TagFileProcessor.java:47) at org.apache.jasper.compiler.TagFileProcessor $TagFileLoaderVisitor.visit(TagFileProcessor.java:565) at org.apache.jasper.compiler.Node$CustomTag.accept(Node.java:1441) at org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2163) at org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2213) at org.apache.jasper.compiler.Node$Visitor.visit(Node.java:2224) at org.apache.jasper.compiler.Node$JspRoot.accept(Node.java:525) at org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2163) at org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2213) at org.apache.jasper.compiler.Node$Visitor.visit(Node.java:2219) at org.apache.jasper.compiler.Node$Root.accept(Node.java:456) at org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2163) at org.apache.jasper.compiler.TagFileProcessor.loadTagFiles (TagFileProcessor.java:583) at org.apache.jasper.compiler.Compiler.generateJava(Compiler.java: 226) at org.apache.jasper.compiler.Compiler.compile(Compiler.java:470) at org.apache.jasper.JspC.processFile(JspC.java:779) at org.apache.jasper.JspC.execute(JspC.java:908) at com.google.appengine.tools.development.LocalJspC.main (LocalJspC.java:17) [...rest of messages omitted...] - end of stacktrace --- - A few lines further below -- Generated servlet error: extension dir=C:\Programme\Java\JDK 6\jre\lib\ext;C:\Windows\Sun \Java\lib\ext srcDir=E:\Temp\Windows\appcfg35419.tmp\WEB-INF\classes include=org/apache/jsp/tag/web/utils/clearcache_tagx.java Debugging information may be found in E:\Temp\Windows\appengine- deploy35418.log -- appengine-deploy35418.log Unable to upload: com.google.appengine.tools.admin.JspCompilationException: Failed to compile jsp files. at com.google.appengine.tools.admin.Application.compileJsps (Application.java:357) at com.google.appengine.tools.admin.Application.createStagingDirectory (Application.java:237
[appengine-java] Re: Compile and execute at runtime
Just to clarify, the dynamic code (the code compiled by Janino) have an intentional error. Locally I get the line number etc., which is great for the user. I cannot get this information on the app-engine. Sorry for the confusion. Albert Attard Charles de Gaullehttp://www.brainyquote.com/quotes/authors/c/charles_de_gaulle.html - The better I get to know men, the more I find myself loving dogs. 2009/8/28 Albert Attard albertatt...@gmail.com Hey Toby: Thanks for your input. Following is the stack trace for the other problem I was talking about. Locally Janino compiles this without any issues, but it's throwing the following exception when executed on the app-engine. JaninoJavaAssessorHelper compile: THROW java.security.AccessControlException: access denied (java.lang.RuntimePermission accessDeclaredMembers) at java.security.AccessControlContext.checkPermission(Unknown Source) at java.security.AccessController.checkPermission(Unknown Source) at java.lang.SecurityManager.checkPermission(Unknown Source) at java.lang.SecurityManager.checkMemberAccess(Unknown Source) at java.lang.Class.checkMemberAccess(Unknown Source) at java.lang.Class.getDeclaredClasses(Unknown Source) at org.codehaus.janino.ReflectionIClass.getDeclaredIClasses2(ReflectionIClass.java:101) at org.codehaus.janino.IClass.getDeclaredIClasses(IClass.java:252) at org.codehaus.janino.IClass.findMemberType(IClass.java:617) at org.codehaus.janino.IClass.findMemberType(IClass.java:634) at org.codehaus.janino.IClass.findMemberType(IClass.java:604) at org.codehaus.janino.UnitCompiler.findMemberType(UnitCompiler.java:8011) at org.codehaus.janino.UnitCompiler.getType2(UnitCompiler.java:4022) at org.codehaus.janino.UnitCompiler.access$102(UnitCompiler.java:3990) at org.codehaus.janino.UnitCompiler$16.visitReferenceType(UnitCompiler.java:3936) at org.codehaus.janino.Java$ReferenceType.accept(Java.java:1868) at org.codehaus.janino.UnitCompiler.getType(UnitCompiler.java:3969) at org.codehaus.janino.UnitCompiler.access$136(UnitCompiler.java:3927) at org.codehaus.janino.UnitCompiler$31.getParameterTypes(UnitCompiler.java:6674) at org.codehaus.janino.IClass$IMethod.getDescriptor(IClass.java:762) at org.codehaus.janino.IClass.getIMethods(IClass.java:180) at org.codehaus.janino.IClass.getIMethods(IClass.java:169) at org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java:328) at org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java:313) at org.codehaus.janino.UnitCompiler$3.visitPackageMemberClassDeclaration(UnitCompiler.java:286) at org.codehaus.janino.Java$PackageMemberClassDeclaration.accept(Java.java:701) at org.codehaus.janino.UnitCompiler.compile(UnitCompiler.java:292) at org.codehaus.janino.UnitCompiler.compileUnit(UnitCompiler.java:270) at org.codehaus.janino.SimpleCompiler.compileToClassLoader(SimpleCompiler.java:423) at org.codehaus.janino.SimpleCompiler.cook(SimpleCompiler.java:231) at org.codehaus.janino.Cookable.cook(Cookable.java:72) at org.codehaus.janino.Cookable.cook(Cookable.java:64) at org.codehaus.janino.Cookable.cook(Cookable.java:114) at com.albertattard.askme.server.utils.JaninoJavaAssessorHelper.compile(JaninoJavaAssessorHelper.java:30) at com.albertattard.askme.server.BuilderServiceImpl.validateAssessor(BuilderServiceImpl.java:40) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at com.google.apphosting.runtime.security.shared.intercept.java.lang.reflect.Method_$3.run(Method_.java:149) at java.security.AccessController.doPrivileged(Native Method) at com.google.apphosting.runtime.security.shared.intercept.java.lang.reflect.Method_.privilegedInvoke(Method_.java:147) at com.google.apphosting.runtime.security.shared.intercept.java.lang.reflect.Method_.invoke(Method_.java:120) at com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:527) at com.google.gwt.user.server.rpc.RemoteServiceServlet.processCall(RemoteServiceServlet.java:166) at com.google.gwt.user.server.rpc.RemoteServiceServlet.doPost(RemoteServiceServlet.java:86) at javax.servlet.http.HttpServlet.service(HttpServlet.java:713) at javax.servlet.http.HttpServlet.service(HttpServlet.java:806) at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:487) at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1093) at com.google.apphosting.runtime.jetty.SaveSessionFilter.doFilter(SaveSessionFilter.java:35
[appengine-java] Re: Compile and execute at runtime
) at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216) at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181) at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:712) at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:405) at com.google.apphosting.runtime.jetty.AppVersionHandlerMap.handle(AppVersionHandlerMap.java:237) at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:139) at org.mortbay.jetty.Server.handle(Server.java:313) at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:506) at org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:830) at com.google.apphosting.runtime.jetty.RpcRequestParser.parseAvailable(RpcRequestParser.java:76) at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:381) at com.google.apphosting.runtime.jetty.JettyServletEngineAdapter.serviceRequest(JettyServletEngineAdapter.java:139) at com.google.apphosting.runtime.JavaRuntime.handleRequest(JavaRuntime.java:235) at com.google.apphosting.base.RuntimePb$EvaluationRuntime$6.handleBlockingRequest(RuntimePb.java:4823) at com.google.apphosting.base.RuntimePb$EvaluationRuntime$6.handleBlockingRequest(RuntimePb.java:4821) at com.google.net.rpc.impl.BlockingApplicationHandler.handleRequest(BlockingApplicationHandler.java:24) at com.google.net.rpc.impl.RpcUtil.runRpcInApplication(RpcUtil.java:359) at com.google.net.rpc.impl.Server$2.run(Server.java:820) at com.google.tracing.LocalTraceSpanRunnable.run(LocalTraceSpanRunnable.java:56) at com.google.tracing.LocalTraceSpanBuilder.internalContinueSpan(LocalTraceSpanBuilder.java:516) at com.google.net.rpc.impl.Server.startRpc(Server.java:775) at com.google.net.rpc.impl.Server.processRequest(Server.java:348) at com.google.net.rpc.impl.ServerConnection.messageReceived(ServerConnection.java:436) at com.google.net.rpc.impl.RpcConnection.parseMessages(RpcConnection.java:319) at com.google.net.rpc.impl.RpcConnection.dataReceived(RpcConnection.java:290) at com.google.net.async.Connection.handleReadEvent(Connection.java:428) at com.google.net.async.EventDispatcher.processNetworkEvents(EventDispatcher.java:762) at com.google.net.async.EventDispatcher.internalLoop(EventDispatcher.java:207) at com.google.net.async.EventDispatcher.loop(EventDispatcher.java:101) at com.google.net.rpc.RpcService.runUntilServerShutdown(RpcService.java:251) at com.google.apphosting.runtime.JavaRuntime$RpcRunnable.run(JavaRuntime.java:374) at java.lang.Thread.run(Unknown Source) Cheers, Albert Attard Ogden Nash http://www.brainyquote.com/quotes/authors/o/ogden_nash.html - The trouble with a kitten is that when it grows up, it's always a cat. 2009/8/27 Toby Reyelts to...@google.com Logger.throwing logs at Level.FINER. Do you have your logging configured to log at that level (or more fine)? On Thu, Aug 27, 2009 at 2:20 PM, Albert Attard albertatt...@gmail.comwrote: Hey Toby: I'm having some trouble with the logging functionality. I'm logging my exceptions but nothing is showing on the logs. Following a simple class which uses logging. private static final Logger log = Logger.getLogger(MyClass.class.getName()); ... }catch(Exception e) log.throwing(MyClass, MyMethod, e); } Am I missing something? Regards, Albert Attard Pablo Picassohttp://www.brainyquote.com/quotes/authors/p/pablo_picasso.html - Computers are useless. They can only give you answers. 2009/8/26 Toby Reyelts to...@google.com Can you provide the full stacktrace for the exception? On Wed, Aug 26, 2009 at 2:58 PM, Albert Attard albertatt...@gmail.comwrote: Hey Toby: Did as you instructed and worked. Thanks a lot Toby. Let me know should you need anything. I'm glad to help. Another question about Janino: I'm getting the following exception on the live app-engine when the dynamic code (the code that is compiled by janino) has a compilation error: An error occurred: java.security.AccessControlException: access denied (java.lang.RuntimePermissions accessDeclaredMembers) On the local environment, janino returns the line number where the error occurred, which is very helpful for the students. Cheers, Albert Attard Samuel Goldwynhttp://www.brainyquote.com/quotes/authors/s/samuel_goldwyn.html - I'm willing to admit that I may not always be right, but I am never wrong. 2009/8/26 Toby Reyelts to...@google.com Hey Albert, Even though I haven't actually seen the changes that you made, I believe they were unnecessary. (Go out on a limb with me here). I tracked the fault down to an error in our runtime that can be worked around by just recompiling the code. You should be able to confirm this on your end by recompiling Janino
[appengine-java] Re: Compile and execute at runtime
Hey Toby: Did as you instructed and worked. Thanks a lot Toby. Let me know should you need anything. I'm glad to help. Another question about Janino: I'm getting the following exception on the live app-engine when the dynamic code (the code that is compiled by janino) has a compilation error: An error occurred: java.security.AccessControlException: access denied (java.lang.RuntimePermissions accessDeclaredMembers) On the local environment, janino returns the line number where the error occurred, which is very helpful for the students. Cheers, Albert Attard Samuel Goldwynhttp://www.brainyquote.com/quotes/authors/s/samuel_goldwyn.html - I'm willing to admit that I may not always be right, but I am never wrong. 2009/8/26 Toby Reyelts to...@google.com Hey Albert, Even though I haven't actually seen the changes that you made, I believe they were unnecessary. (Go out on a limb with me here). I tracked the fault down to an error in our runtime that can be worked around by just recompiling the code. You should be able to confirm this on your end by recompiling Janino from source *without* any of the changes you made. Please make sure you've set the target version to 1.5 or 1.6. On Wed, Aug 26, 2009 at 4:51 AM, Albert Attard albertatt...@gmail.comwrote: Hey Toby: Janino api include classes that are not supported by the app-engine. All I did is commented out the code that the app-engine didn't like in janino and repackaged it. I did the following: - Downloaded the source for janino: http://www.janino.net/download/janino-2.5.15.zip - I've created a new Google Web Project in Eclipse - I've copied the source into the Google Web Project - Than I've *unsafely* commented out code that was not supported by the Google app-engine - Repackaged the edited code into a new jar and deployed it with my project instead of the original one - The simple proof of concept seams to work As you can see at the simple demo: http://ask-me.appspot.com/ the code seams to work. Hope you manage to complete this question :) Cheers, Albert Attard Stephen Leacockhttp://www.brainyquote.com/quotes/authors/s/stephen_leacock.html - I detest life-insurance agents: they always argue that I shall some day die, which is not so. 2009/8/25 Toby Reyelts to...@google.com Hey Albert, That code should actually work ok, but you've managed to tickle a bug in our runtime. I've filed an issuehttp://code.google.com/p/googleappengine/issues/detail?id=2028for you here. The fix for this probably won't make the next release, but it should come shortly thereafter. On Tue, Aug 25, 2009 at 6:33 AM, Albert Attard albertatt...@gmail.comwrote: Hi Toby: Thanks for you feedback. I've did a small prototype: http://ask-me.appspot.com/ . It's working fine locally, but it's throwing the following exception when executed on the app-engine: javax.servlet.ServletContext log: Exception while dispatching incoming RPC call com.google.gwt.user.server.rpc.UnexpectedException: Service method 'public abstract com.albertattard.askme.client.utils.AssessmentTO com.albertattard.askme.client.AssessorService.assessCode(java.lang.String)' threw an unexpected exception: java.lang.VerifyError: (class: org/codehaus/janino/ByteArrayClassLoader, method: findClass signature: (Ljava/lang/String;)Ljava/lang/Class;) Illegal type in constant pool at com.google.gwt.user.server.rpc.RPC.encodeResponseForFailure(RPC.java:360) at com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:546) at com.google.gwt.user.server.rpc.RemoteServiceServlet.processCall(RemoteServiceServlet.java:166) at com.google.gwt.user.server.rpc.RemoteServiceServlet.doPost(RemoteServiceServlet.java:86) at javax.servlet.http.HttpServlet.service(HttpServlet.java:713) at javax.servlet.http.HttpServlet.service(HttpServlet.java:806) at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:487) at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1093) at com.google.apphosting.runtime.jetty.SaveSessionFilter.doFilter(SaveSessionFilter.java:35) at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1084) at com.google.apphosting.utils.servlet.TransactionCleanupFilter.doFilter(TransactionCleanupFilter.java:43) at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1084) at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:360) at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216) at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181) at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:712) at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:405) at com.google.apphosting.runtime.jetty.AppVersionHandlerMap.handle(AppVersionHandlerMap.java:237
[appengine-java] Re: Compile and execute at runtime
) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at com.google.apphosting.runtime.security.shared.intercept.java.lang.reflect.Method_$3.run(Method_.java:149) at java.security.AccessController.doPrivileged(Native Method) at com.google.apphosting.runtime.security.shared.intercept.java.lang.reflect.Method_.privilegedInvoke(Method_.java:147) at com.google.apphosting.runtime.security.shared.intercept.java.lang.reflect.Method_.invoke(Method_.java:120) at com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:527) ... 43 more The janino ByteArrayClassLoader is not working well (not accepted) on the app-engine :( Any other options? Cheers, Albert Attard Marie von Ebner-Eschenbachhttp://www.brainyquote.com/quotes/authors/m/marie_von_ebnereschenbac.html - Even a stopped clock is right twice a day. 2009/8/14 Toby Reyelts to...@google.com We don't have any near term plans to whitelist javax.tools. Do you think something like janino http://www.janino.net/ might work for you? On Fri, Aug 14, 2009 at 2:50 AM, Albert Attard albertatt...@gmail.comwrote: Hi everyone: Background about the problem: I'm a Java lecturer and would like to create an automated question web application similar to a multiple choice questions and answers but where the students can practice coding instead of simply selecting an answer. Multiple choice questions are very popular in web exams as these are fully automated. You do the test and the system corrects it for you and gives you the results there and then. I would like to go one step further and have the student to supply a code fragment or even a class(es) and have the system automatically correcting it in a similar fashion to the multiple choice questions. Example (in a nutshell): The student is asked to write a method: that given an array of int and two indices of type int (between 0 and the size of the array - 1), this method will swap the elements at the given indices. The student will write the method in the provided text area and submit it. Then the system will include this method into a class, compile it and by using reflection executes it with an array of values (similar to JUnit) to ensure that it is working as expected. During this process the system will be awarding the student marks and will display the final result together with comments as required. Google Appengine I have a prototype and it works great on Tomcat. Yes I know that it is subject to Java code injection but that's not an issue at this stage. This issue can be fixed at a later stage. Unfortunately I cannot implement it on the Google Appengine as most of the required functionality, such as writing to a file or JavaCompiler is disabled . I've managed to compile the classes to database (without writing to the file system) and load classes from database (without reading from the file system), which can integrate well with the provided datastore. Is there a way (or a procedure) of implementing such a system on the Google Appengine? This application will be a free education tool for everyone who would like to use it. Thanks in advance, Albert Attard Ted Turner http://www.brainyquote.com/quotes/authors/t/ted_turner.html - Sports is like a war without the killing. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[google-appengine] Re: Persisting Enum values?
Hi: I'm not sure about this, but my understanding was that JDO didn't support ENUMS, JPA does (but I may be wrong). Cheers, Albert Attard Joan Crawfordhttp://www.brainyquote.com/quotes/authors/j/joan_crawford.html - I, Joan Crawford, I believe in the dollar. Everything I earn, I spend. 2009/8/3 Jeff S (Google) j...@google.com Hi Tom, It should be possible to persist objects that use enums without needing to do your own additional mapping. I talked this over with Max Ross who frequents the Java runtime discussion group ( http://groups.google.com/group/google-appengine-java) and he pointed out an example in the JDO unit tests which uses enums: http://www.google.com/codesearch/p?hl=ensa=Ncd=2ct=rc#79kbA0UmWLw/trunk/tests/org/datanucleus/test/HasEnumJDO.java http://www.google.com/codesearch/p?hl=ensa=Ncd=2ct=rc#79kbA0UmWLw/trunk/tests/org/datanucleus/test/HasEnumJDO.javaThank you, Jeff On Thu, Jul 30, 2009 at 5:09 PM, Tom Ball tball...@gmail.com wrote: We have a simple task object, currently persisted using JDO (using App Engine, of course). We'd like to add a GREEN/YELLOW/RED status enum state. Defining the enum class is easy: public enum Status { NONE(none), GREEN(green), YELLOW(yellow), RED(red); private final String label; Status(String label) { this.label = label; } public String getLabel() { return label; } } We're stumped how to make this class persistent using JDO -- foreign keys for the labels, perhaps? Or do we get it for free, perhaps by JDO storing the enum ordinal? Tom --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Google App Engine group. To post to this group, send email to google-appengine@googlegroups.com To unsubscribe from this group, send email to google-appengine+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en -~--~~~~--~~--~--~---
[google-appengine] Re: Sorting in Memory
Note that the list returned by the datastore is generaly immutable list, thus you need to create another one (mutable) in order to be able to sort it. Having the sorting done programatically (in memorey) gives you the advantage that the client (browser) can sort without having to leave the page. Hope this helps, Albert Attard Ogden Nash http://www.brainyquote.com/quotes/authors/o/ogden_nash.html - The trouble with a kitten is that when it grows up, it's always a cat. 2009/8/4 Nick Johnson (Google) nick.john...@google.com Hi MajorProgramming, Using the sort method on a List, or the sorted() function, if your data is not already in a list. -Nick Johnson On Tue, Aug 4, 2009 at 1:23 AM, MajorProgammingsefira...@gmail.com wrote: What is the most efficient way to sort Datastore results in memory? Thanks, -- Nick Johnson, Developer Programs Engineer, App Engine --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Google App Engine group. To post to this group, send email to google-appengine@googlegroups.com To unsubscribe from this group, send email to google-appengine+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en -~--~~~~--~~--~--~---
[google-appengine] Re: Sorting in Memory
Sorry about that, I'm not good in python :( - in Java the data stores usually returns an immutable list Albert Attard Joan Crawfordhttp://www.brainyquote.com/quotes/authors/j/joan_crawford.html - I, Joan Crawford, I believe in the dollar. Everything I earn, I spend. 2009/8/4 Nick Johnson (Google) nick.john...@google.com That's not the case at all. The list returned by datastore .get() and .fetch() operations is an ordinary Python list. -Nick Johnson On Tue, Aug 4, 2009 at 9:46 AM, Albert Attardalbertatt...@gmail.com wrote: Note that the list returned by the datastore is generaly immutable list, thus you need to create another one (mutable) in order to be able to sort it. Having the sorting done programatically (in memorey) gives you the advantage that the client (browser) can sort without having to leave the page. Hope this helps, Albert Attard Ogden Nash - The trouble with a kitten is that when it grows up, it's always a cat. 2009/8/4 Nick Johnson (Google) nick.john...@google.com Hi MajorProgramming, Using the sort method on a List, or the sorted() function, if your data is not already in a list. -Nick Johnson On Tue, Aug 4, 2009 at 1:23 AM, MajorProgammingsefira...@gmail.com wrote: What is the most efficient way to sort Datastore results in memory? Thanks, -- Nick Johnson, Developer Programs Engineer, App Engine -- Nick Johnson, Developer Programs Engineer, App Engine --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Google App Engine group. To post to this group, send email to google-appengine@googlegroups.com To unsubscribe from this group, send email to google-appengine+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en -~--~~~~--~~--~--~---
[google-appengine] Re: Compilation failure for method with custom object param
Hi: You cannot access server classes from your client. You can access client classes from your server. What you have to do is start using transfer objects. Here's an article: http://java.sun.com/blueprints/corej2eepatterns/Patterns/TransferObject.html Let me know if you need more help. Albert Attard Joan Crawfordhttp://www.brainyquote.com/quotes/authors/j/joan_crawford.html - I, Joan Crawford, I believe in the dollar. Everything I earn, I spend. 2009/8/4 thepopeofantelope markp...@gmail.com I created the following class and want to use it between the client and server. I get this GWT compile error on the Service class: Compiling module com.test.GWTTEst Refreshing module from source Validating newly compiled units Removing units with errors [ERROR] Errors in 'file:/C:/GWTTEst/src/com/test/client/ RecipeServiceAsync.java' [ERROR] Line 7: No source code is available for type com.test.server.Recipe; did you forget to inherit a required module? [ERROR] Errors in 'file:/C:/GWTTEst/src/com/test/client/ RecipeService.java' [ERROR] Line 9: No source code is available for type com.test.server.Recipe; did you forget to inherit a required module? === package com.test.client; import com.google.gwt.user.client.rpc.RemoteService; import com.google.gwt.user.client.rpc.RemoteServiceRelativePath; import com.test.server.Recipe; @RemoteServiceRelativePath(recipe) public interface RecipeService extends RemoteService { public void addStock(Recipe symbol) throws NotLoggedInException; public void removeStock(String symbol) throws NotLoggedInException; public String[] getStocks() throws NotLoggedInException; } == package com.test.server; import java.io.Serializable; import java.util.Date; import javax.jdo.annotations.IdGeneratorStrategy; import javax.jdo.annotations.IdentityType; import javax.jdo.annotations.PersistenceCapable; import javax.jdo.annotations.Persistent; import javax.jdo.annotations.PrimaryKey; import com.google.appengine.api.users.User; import com.google.gwt.user.client.rpc.IsSerializable; @PersistenceCapable(identityType = IdentityType.APPLICATION) public class Recipe implements IsSerializable { @PrimaryKey @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY) private Long id; @Persistent private User user; @Persistent private String name; @Persistent private String category; @Persistent private String cuisine; @Persistent private String occasion; @Persistent private String ingredients; @Persistent private String directions; @Persistent private Date created; public Recipe() { } public Recipe(User user, String symbol) { this(); this.user = user; } public User getUser() { return user; } public void setUser(User user) { this.user = user; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getCuisine() { return cuisine; } public void setCuisine(String cuisine) { this.cuisine = cuisine; } public String getIngredients() { return ingredients; } public void setIngredients(String ingredients) { this.ingredients = ingredients; } public String getDirections() { return directions; } public void setDirections(String directions) { this.directions = directions; } public String getOccasion() { return occasion; } public void setOccasion(String occasion) { this.occasion = occasion; } public String getCategory() { return category; } public void setCategory(String category) { this.category = category; } public Date getCreated() { return created; } } --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Google App Engine group. To post to this group, send email to google-appengine@googlegroups.com To unsubscribe from this group, send email to google-appengine+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en -~--~~~~--~~--~--~---
[google-appengine] Re: Persisting Enum values?
Cheers mate. The documentation I've read otherwise ( http://www.jpox.org/docs/1_2/jdovsjpa.html) but good to know that these are supported. Cheers, Albert Attard Ogden Nash http://www.brainyquote.com/quotes/authors/o/ogden_nash.html - The trouble with a kitten is that when it grows up, it's always a cat. 2009/8/4 datanucleus andy_jeffer...@yahoo.com I'm not sure about this, but my understanding was that JDO didn't support ENUMS, JPA does (but I may be wrong). Try this http://db.apache.org/jdo/field_types.html It's ok to be wrong ;-) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Google App Engine group. To post to this group, send email to google-appengine@googlegroups.com To unsubscribe from this group, send email to google-appengine+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en -~--~~~~--~~--~--~---
[google-appengine] Re: Interact with external server for static private files
Hi: You can write a proxy and this shouldn't be a problem since the data is binary and you don't need to modify the contents. Also, large contents may be fragmented, that is, one video saved on more than one file (Example: file1.rar, file2.rar, ..., fileN.rar). Your application/proxy may be required to handle this and return one file to the user. In that case you can save the links in the data-store and map them with an ID and a sequence number. Then using the proxy, your application will retrieve the data and proxy-it to the user. Hope this helps, Albert Attard Marie von Ebner-Eschenbachhttp://www.brainyquote.com/quotes/authors/m/marie_von_ebnereschenbac.html - Even a stopped clock is right twice a day. 2009/8/3 Holger w...@arcor.de It may seem, but it's not trivial at all. This seems like a pretty trivial thing to do The difficulty depends on how 'safe' the solution should be. I think the logical sequence could be: 1. User asks your appspot for video 2. User is redireced to your video source with an URL get attachment (the URL part behind the question mark) informing your video source: 2a. Information on the video which shall be presented to the user 2b. Information on user authorization - An easy form of authorization proof would be a MD5 hash of a secret string plus date and hour. Your user could extract the url, but this url would work within the current hour only. A safer sequence would be a multi redirection. aa. The user is redireted to your video source with url '/requestA? video= key1= bb. Your video source creates a redirection to your appengine with url '/crypt?key1= key2= cc. Your appengine encrypts key2 with a secret string and redirects the user to your video source with the url '/requestB?key2= key3= Where key1 and key2 are une time use random numbers and key3 is equal key2 encrypted with a secret string. -- Possibly this authorization sequence could need more code than user interaction itself. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Google App Engine group. To post to this group, send email to google-appengine@googlegroups.com To unsubscribe from this group, send email to google-appengine+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en -~--~~~~--~~--~--~---
[google-appengine] Re: Compile and execute code at runtime
Thanks, will forward this query to the Java guys. In the mean time, I'll deploy my prototype on a Tomcat Server Cheers, Albert Attard Joan Crawfordhttp://www.brainyquote.com/quotes/authors/j/joan_crawford.html - I, Joan Crawford, I believe in the dollar. Everything I earn, I spend. 2009/7/27 Nick Johnson (Google) nick.john...@google.com Hi Albert, It's not possible to access the command line compiler from a Java App Engine app. It may be possible to use internal reflection functionality to compile the code, but you'd need to ask someone with more expertise in Java - asking this in the google-appengine-java group will probably get you more useful responses. If the code doesn't have to be in Java, you might want to consider Javascript - there are several embeddable Javascript interpreters for Java, including Rhino, and they would make the application you describe quite straightfoward to write. -Nick Johnson On Fri, Jul 24, 2009 at 3:41 PM, Albert Attard albertatt...@gmail.comwrote: Hi everyone: Background about the problem: I'm a Java lecturer and would like to create an automated question web application similar to an extended version of multiple choice answers by which the students can practice coding. Multiple choice questions are very popular in web exams as these are fully automated. You do the test and the system corrects it for you and gives you the results there and then. I would like to go one step further and have the student to supply a code fragment or even a class (es) and have the system automatically correcting it in a similar fashion to the multiple choice questions. Example (in a nutshell): The student is asked to write a method: that given an array of int and two indices of type int (between 0 and the size of the array - 1), this method will swap the elements at the given indices. The student will write the method in the text area and submit it. Then the system will include this method into a class, compile it and by using reflection execute it with an array of values to ensure that it is working as expected. During this process the system will be awarding the student marks and will display the final result together with comments as required. Google Appengine I have a prototype and it works great on Tomcat. Yes I know that it is subject to Java code injection but that's not an issue at this stage. This issue can be fixed at a later stage. Unfortunately I cannot implement it on the Google Appengine as most of the required functionality, such as writing to a file, is disabled. Is there a way (or a procedure) of implementing such a system on the Google Appengine? This application will be a free education tool for everyone who would like to use it. Thanks in advance, Albert Attard -- Nick Johnson, Developer Programs Engineer, App Engine --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Google App Engine group. To post to this group, send email to google-appengine@googlegroups.com To unsubscribe from this group, send email to google-appengine+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en -~--~~~~--~~--~--~---
[google-appengine] Compile and execute code at runtime
Hi everyone: Background about the problem: I'm a Java lecturer and would like to create an automated question web application similar to an extended version of multiple choice answers by which the students can practice coding. Multiple choice questions are very popular in web exams as these are fully automated. You do the test and the system corrects it for you and gives you the results there and then. I would like to go one step further and have the student to supply a code fragment or even a class (es) and have the system automatically correcting it in a similar fashion to the multiple choice questions. Example (in a nutshell): The student is asked to write a method: that given an array of int and two indices of type int (between 0 and the size of the array - 1), this method will swap the elements at the given indices. The student will write the method in the text area and submit it. Then the system will include this method into a class, compile it and by using reflection execute it with an array of values to ensure that it is working as expected. During this process the system will be awarding the student marks and will display the final result together with comments as required. Google Appengine I have a prototype and it works great on Tomcat. Yes I know that it is subject to Java code injection but that's not an issue at this stage. This issue can be fixed at a later stage. Unfortunately I cannot implement it on the Google Appengine as most of the required functionality, such as writing to a file, is disabled. Is there a way (or a procedure) of implementing such a system on the Google Appengine? This application will be a free education tool for everyone who would like to use it. Thanks in advance, Albert Attard --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Google App Engine group. To post to this group, send email to google-appengine@googlegroups.com To unsubscribe from this group, send email to google-appengine+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en -~--~~~~--~~--~--~---