views:

5810

answers:

4

It seems there is no equivalent of Python App Engine's _ah/admin for the Java implementation of Google App Engine.

Is there a manual way I can browse the datastore? Where are the files to be found on my machine? (I am using the App Engine plugin with Eclipse on OS X).

+5  A: 

I have local datastore on my Windows+Eclipse environment on \war\WEB-INF\appengine-generated\local_db.bin

As far as I understood it uses internal format named "protocol buffers". I don't have external tools to present the file in human-readable format.

I'm using simple "viewer" code like this:

public void doGet(HttpServletRequest req, HttpServletResponse resp) 
    throws IOException 
{

    resp.setContentType("text/plain");

    final DatastoreService datastore = DatastoreServiceFactory.getDatastoreService();
    final Query query = new Query("Table/Entity Name");
    //query.addSort(Entity.KEY_RESERVED_PROPERTY, Query.SortDirection.DESCENDING);

    for (final Entity entity : datastore.prepare(query).asIterable()) {
        resp.getWriter().println(entity.getKey().toString());

        final Map<String, Object> properties = entity.getProperties();
        final String[] propertyNames = properties.keySet().toArray(
            new String[properties.size()]);
        for(final String propertyName : propertyNames) {
            resp.getWriter().println("-> " + propertyName + ": " + entity.getProperty(propertyName));
        }
    }
}
Paul
+4  A: 

There's currently no datastore viewer for the Java SDK - one should be coming in the next SDK release. In the meantime, your best bet is to write your own admin interface with datastore viewing code - or wait for the next SDK release.

Java App Engine now has a local datastore viewer, accessible at http://localhost:8080/%5Fah/admin.

Nick Johnson
This is redundant -- see dfrankow's post above.
Julian
You mean the link to the blog post that was posted several days _after_ I posted this reply? 'outdated' I'll accept, but redundant and voted down is a bit cruel.
Nick Johnson
I agree. Good answer at the time; now outdated.
mcherm
+19  A: 

http://googleappengine.blogspot.com/2009/07/google-app-engine-for-java-sdk-122.html: "At long last, the dev appserver has a data viewer. Start your app locally and point your browser to http://localhost:8080/_ah/admin to check it out."

dfrankow
New admin interface is still not working with kinds/entities created by Native Datastore API. So I still need my "viewer" :)
Paul
http://localhost:8888/_ah/admin worked like a champ for me (note the port changed) - but I will try out the AppWrench just for comparison.
Chad Gorshing
+4  A: 

I am using AppWrench for browsing data store. It is much better then built in data store viewer.

Null Pointer