[appengine-java] JDO: 1-N relationships

2011-06-24 Thread Martin Newstead
I would like some help and advice on how to model my entities using
JDO on GAE. My problem is this, I have a bunch of Users and each User
may create zero or more Tracks. Users may exist without a Track but
Tracks may not exist without a User who created them. Other attributes
on the User and the Track may updated. I would like to be able to
query the Tracks and retrieve some attributes from the User who
created the Track. The attributes from the User may get updated. In
SQL this would be

select u.displayName, t.trackName from User u, Track t, where
t.userId=u.userId

I have some ideas and have tried various things but this isn't a post
on why doesn't something work, more of what is the best practice to
solve this problem.

thanks http://groups.google.com/group/google-appengine-java?hl=en.



[appengine-java] Re: Cannot to read the file under /WEB-INF/classes/

2011-07-17 Thread Martin Newstead
I have a config file in WEB-INF/conf and I pass the location using an
init-param (called propfile) to a servlet. Then in the servlet I use

propFile = getServletConfig().getInitParameter("propfile");
base = getServletContext().getRealPath("") + FS;

where FS is

  protected static final String FS = File.separator;

works with Jetty (GAE/J Dev server), Tomcat, GAE/J.



On Jul 16, 3:00 pm, Love Yao  wrote:
> I want to read the config.xml in my  webRoot /WEB-INF/classes/
> config.xml.
>
> All is OK in localhost.
>
> but when deploying to GAE, it cannot find the xml:
>
> /base/data/home/apps/mainloveplay/4.35187093106408/base/data/home/
> apps/mainloveplay/4.35187093106408/WEB-INF/classes/config.xml (No
> such file or directory)
>
> the code to get path is:
>
> String rootPath =
> ConfigRepository.class.getResource("/").getPath().substring(1);
> Document document = reader.read(new File(rootPath + "config.xml"));
>
> so how can I get my config.xml

-- 
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] Elevations API, polyline encoding, Google App Engine

2011-08-16 Thread Martin Newstead
I hope someone can help me get some ideas on how to debug this
problem. I have build an application that needs to use the Google
Elevations webservice API to get some elevations for some lat/lon
pairs. I am encoding the data using my own Java implementation of the
polyline encoding algorithm. My app works nicely on Linux/Tomcat/
JDK1.6, calls out to the Elevations API and gets good results. I
tested using the Dev_server (1.5.0) and received an error, invalid
character at position 70 of the URL that was sent to the Elevaton API.
What's different about the dev_server ? Different JDK ? different
encoding ? So far I've not had a chance to strip this down to bare
bones and run some small tests on both environments, I am hoping to
get some ideas here on which place to start.

-- 
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] QUOTAs, usage limits

2011-08-16 Thread Martin Newstead
I am building my application to use the Google Elevations Webservice
API which has usage quotas which is apparantly checked by IP of the
caller, 1000 requests perday. what does this mean in the GAE
environment ? will the Elevations webservice always see my app with
the same IP ? Will other apps in GAE also appear to have the same IP
if they called the same service ?

-- 
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: Elevations API, polyline encoding, Google App Engine

2011-08-17 Thread Martin Newstead
I got it fixed thanks. Seems I needed to URLEncode the query params
for GAE/J but not for Tomcat, no bad thing to do this anyway. Not
tested it on proper GAE so far though.

On Aug 16, 10:41 pm, JT  wrote:
> A lot of stuff works outside gaej, just fyi. So don't scratched your head
> too much.
>
> On Aug 16, 2011 4:33 AM, "Martin Newstead"  wrote:> 
> I hope someone can help me get some ideas on how to debug this
> > problem. I have build an application that needs to use the Google
> > Elevations webservice API to get some elevations for some lat/lon
> > pairs. I am encoding the data using my own Java implementation of the
> > polyline encoding algorithm. My app works nicely on Linux/Tomcat/
> > JDK1.6, calls out to the Elevations API and gets good results. I
> > tested using the Dev_server (1.5.0) and received an error, invalid
> > character at position 70 of the URL that was sent to the Elevaton API.
> > What's different about the dev_server ? Different JDK ? different
> > encoding ? So far I've not had a chance to strip this down to bare
> > bones and run some small tests on both environments, I am hoping to
> > get some ideas here on which place to start.
>
> > --
> > 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.
>
>
>
>
>
>
>
>

-- 
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: QUOTAs, usage limits

2011-08-17 Thread Martin Newstead
Thanks, I suspected that would be the case so will work on a solution
that doesn't use Google Elevations API for this.

On Aug 16, 4:28 pm, Simon Knott  wrote:
> It means that you will very likely require a proxy server in the middle.  
>
> GAE doesn't allow you to present a single, static IP address and all
> GAE-hosted applications will be detected as the same IP range - I know for
> Twitter / Facebook there have been a number of developers who have hit
> "their" quota because other applications have been hitting the service from
> the same IP.

-- 
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: Can't get log4j working

2011-10-16 Thread Martin Newstead
make sure your log4j.properties gets copied to your classes directory
when you build the application. You should need to use the system
property to tell the application or web server where the file is so
long as the location is on the classpath which WEB-INF/classes is.

On Oct 15, 8:12 pm, Andrew Ducker  wrote:
> I have the default log4j.properties in the root of my src folder
> (which is then copied to the war/WEB-INF/classes folder
> automatically).
>
> I have this in my appengine-web.xml:
>         
>                 
>                 
>         
>
> If I do this:
> Logger logger = Logger.getRootLogger();
> logger.warn("Testing!");
>
> then I get this:
> log4j:WARN No appenders could be found for logger (root).
> log4j:WARN Please initialize the log4j system properly.
>
> Any suggestions?
>
> Thanks,
>
> Andy

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine for Java" group.
To post to this group, send email to google-appengine-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] Help ! Datanucleus class cast Exception

2011-04-03 Thread Martin Newstead
Firstly apologies if I have posted in the wrong place, I am sure someone 
will kindly tell me where is more appropriate.

I have built a new application, I have already deployed one with identical 
architecture successfully but not encountered this error before. My 
application runs well on Tomcat  accessing a local H2 database but when I 
test again the GAEJ Development server and when I deploy to Google Apps and 
run for real I get the following exception. I have check all my jar files 
for multipe versions etc but can't get to the bottom of this, can someone 
help ? (This trace is from the development server pointing at the same 
location that Tomcat runs from)

java.lang.ClassCastException: 
org.datanucleus.query.expression.ParameterExpression cannot be cast to 
org.datanucleus.query.expression.PrimaryExpression
at 
org.datanucleus.store.appengine.query.DatastoreQuery.getSortProperty(DatastoreQuery.java:793)
at 
org.datanucleus.store.appengine.query.DatastoreQuery.addSorts(DatastoreQuery.java:772)
at 
org.datanucleus.store.appengine.query.DatastoreQuery.performExecute(DatastoreQuery.java:231)
at 
org.datanucleus.store.appengine.query.JDOQLQuery.performExecute(JDOQLQuery.java:89)
at org.datanucleus.store.query.Query.executeQuery(Query.java:1489)
at 
org.datanucleus.store.query.Query.executeWithArray(Query.java:1371)
at org.datanucleus.jdo.JDOQuery.execute(JDOQuery.java:243)
at mseries.routes.model.DataModel.saveTrack(DataModel.java:107)
at 
mseries.routes.servlet.TrackUploadServlet.doGet(TrackUploadServlet.java:74)
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:351)
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)

-- 
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: Help ! Datanucleus class cast Exception

2011-04-03 Thread Martin Newstead
Update:
Digging into the source code for 
 org.datanucleus.store.appengine.query.DatastoreQuery.getSortProperty
allowed me to figure out what was causing the problem. In the follow code, 
the emboldened on is the one that threw the exception, it will be noticed 
that I have ordered by 'keyx' which is my parameter name and NOT the name or 
my attribute in the class JDOTrack, changing it to a proper attribute name 
works as expected. NB This was not a problem with Datanucleus and the rdbms 
persistence manager there.

Query q = pm.newQuery(JDOTrack.class);
q.setFilter("key == keyx ");
q.declareParameters("String keyx");
q.setUnique(true);
   * q.setOrdering("keyx ascending");*
res = (JDOTrack) q.execute(key);

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