[appengine-java] Re: Which one is best for development...Spring Framework or Servlet Jsp....

2011-04-19 Thread Starman
I'm using a combination of Spring, Objectify and Spring Security. App
spins up in 20 secs. Could be a lot faster if I was not using
classpath scanning. But with always up and correct warmup request
config, anything under 30 secs will do just fine.

What you want is to get sub 10 secs startup in dev mode so that your
unit tests start up fast.

On Apr 19, 4:24 pm, lorenoolive...@gmail.com
lorenoolive...@gmail.com wrote:
 What is a good/acceptable application load time? The load time of my
 application in run mode in the development environment gives me a good
 confidence of the real application load time on production environment?

 Loreno

 On Tue, Apr 19, 2011 at 5:18 PM, Marcel Overdijk
 marceloverd...@gmail.comwrote:



  No check out docs about Warmup requests:

 http://code.google.com/appengine/docs/java/config/appconfig.html#Warm...

  On Apr 19, 1:18 pm, Nischal nischalshett...@gmail.com wrote:
   You mean you have reserved instances? IMO you would still need to take
  care
   of your load time as new instances are spun off when your traffic
  increases
   and if your load time is too much then it would lead to errors while
   spinning up new instances.

  --
  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: Deleting orphan blobs in blobstore

2011-03-19 Thread Starman
BlobInfoFactory.queryBlobInfos().

Iterate on the BlobInfo returned and try to find the blobkey
references in your entity store. If you can't, it is safe to delete
that blob.

If the blobkey reference field in your entities is not indexed, you'll
have to do a full scan of your datastore entities. I don't know how
many you have but, if you deleted 7000, I will assume you have many
thousands entities to scan. You'll probably need to use the task api
(or the mapreduce library, see 
http://ikaisays.com/2010/07/09/using-the-java-mapper-framework-for-app-engine/)
to get around the 30 seconds limit.



On Mar 19, 1:14 am, Gaurav ano...@gmail.com wrote:
 Hi,

 I deleted a large number of objects from the datastore that I din't
 required (around 7000 of them).
 Each of those objects had a blob associated with it, referenced by a
 String (blob key).
 As you might have guessed by now, I forgot to delete those blobs.

 Now I don't have any reference to them, but I want to delete them.
 I can't seem to find a way to do that.

 Any help will be appreciated.

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

2010-12-09 Thread Starman
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)
         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
  

[appengine-java] Re: blobstore - map returned empty

2010-11-20 Thread Starman
What I do is remove the prot:ip:port prefix if the ip is 0.0.0.0
before I store the url. In dev, a relative path is OK. In prod, I
store exactly what is returned.

R.

On Oct 31, 5:45 am, pac parvez.chau...@gmail.com wrote:
 I have gone through your sample code few times, could not find what I
 am missing.
 What I tried now - is created a dialog with simple file upload field
 (rest functionality nearly copy pasted), now that seems to be working.
 May be I will come back to other code and see what causing it.
 Though another thing which I came across is that some time
 ImageService ( String imageURL =
 imagesService.getServingUrl(blobKey); ) returns serving url with ip
 address i.e. instead
 /_ah/img/iS_QaJQHwq-tmmA4_5i6kw

 it returns

 http://0.0.0.0:/_ah/img/iS_QaJQHwq-tmmA4_5i6kw

 In such case image does not get display as incorrect local ip address
 i.e.http://127.0.0.1:

 On Oct 28, 1:19 am, Ikai Lan (Google) ikai.l+gro...@google.com
 wrote:







  That looks right to me. Strange ... can you compare your code against this
  project? It's some sample code I whipped up a while ago. Here's the GWT
  upload widget:

 http://github.com/ikai/gwt-gae-image-gallery/blob/master/src/com/ikai...

  Here's the servlet that handles uploads:

 http://github.com/ikai/gwt-gae-image-gallery/blob/master/src/com/ikai...

  I've seen this happen before when the name isn't set correctly. Can you look
  into the generated source using a tool like Firebug to see if the form is
  being generated correctly?

  --
  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 27, 2010 at 3:51 PM, pac parvez.chau...@gmail.com wrote:
   Hi Ikai,

   Upload page is a composite, in which I have a decorator panel which
   contains another composite which has FormPanel (Upload field)

   As for servlet code:

          public void doPost(HttpServletRequest req, HttpServletResponse res)
                          throws ServletException, IOException
          {
                  String userIdStr =
   req.getParameter(IAppConstants.PARAM_UserId);

                  MapString, BlobKey blobs =
   blobstoreService.getUploadedBlobs(req);

                   BlobKey blobKey = blobs.get(IAppConstants.PARAM_MyFile);
                  .
                  .
                  .

   blobs returned  is empty and so blobKey is null.

   IAppConstants.PARAM_MyFile is name of upload field at client side
   i.e.

   uploadField.setName(IAppConstants.PARAM_MyFile);

   In servlet if I do

                  String myFile =
   req.getParameter(IAppConstants.PARAM_MyFile);
   then myFile is also null.

   Upload form at client does have

    uploadForm.setEncoding(FormPanel.ENCODING_MULTIPART);
                                  
   uploadForm.setMethod(FormPanel.METHOD_POST);

   Any suggestions?
   Thanks.

   On Oct 27, 7:28 pm, Ikai Lan (Google) 
   ikai.l+gro...@google.comikai.l%2bgro...@google.com

   wrote:
What does your upload page look like? Can you post the full servlet?

--
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 Tue, Oct 26, 2010 at 4:12 PM, pac parvez.chau...@gmail.com wrote:
 I am trying to use  BlobstoreService locally.
 But map is returned empty by following line in servlet:
 MapString, BlobKey blobs = blobstoreService.getUploadedBlobs(req);

 I was following post from  http://ikaisays.com/(alsousing gwt as
 front end)  but I guess I might have missed something, any thoughts?
 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%2B
  unsubscr...@googlegroups.com
   google-appengine-java%2bunsubscr...@googlegroups.comgoogle-appengine-java
%252bunsubscr...@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.comgoogle-appengine-java%2B
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 

[appengine-java] Re: Auto generating datastore-indexes.xml during unit tests

2010-11-20 Thread Starman
In that case, your ds files must be written somewhere else when you
run unit tests.

On Nov 19, 9:28 pm, Jerry jerry.morri...@gmail.com wrote:
 Thanks for the hypotheses!

 I do have
    datastore-indexes autoGenerate=true
 in war/WEB-INF/datastore-indexes.xml.

 I tried not tearing down the helper. Still, the test doesn't touch
 either of the files
   WEB-INF/appengine-generated/datastore-indexes-auto.xml
   war/WEB-INF/appengine-generated/datastore-indexes-auto.xml

 Any more ideas?

 Code excerpts:

 public class DatastoreIndexText {
   private final LocalServiceTestHelper helper =
 fileBasedDatastoreTestHelper();
   private PersistenceManager pm;

   @Before
   public void setUp() throws Exception {
     helper.setUp();
     pm = PMF.get().getPersistenceManager();
     ...
   }

   @After
   public void tearDown() throws Exception {
     try {
       deleteScheme(schemeId);
     } finally {
       pm.close();
       // helper.tearDown();
     }
   }

   private static LocalServiceTestHelper fileBasedDatastoreTestHelper()
 {
     File location = new File(war/WEB-INF/appengine-generated/
 local_db.bin);

     // TODO: Read these elements from the File(war/WEB-INF/appengine-
 web.xml).
     String appId = ...
     String appVersionId = 1;

     LocalDatastoreServiceTestConfig dsConfig = new
 LocalDatastoreServiceTestConfig()
         .setBackingStoreLocation(location.getAbsolutePath())
         .setNoStorage(false);
     System.out.println(dsConfig.getBackingStoreLocation());

     return new LocalServiceTestHelper(
             new LocalUserServiceTestConfig(),
             dsConfig)
         .setEnvIsAdmin(false)
         .setEnvIsLoggedIn(true)
         .setEnvEmail(AUTHOR_EMAIL)
         .setEnvAuthDomain(AUTH_DOMAIN)
         .setEnvAppId(appId)
         .setEnvVersionId(appVersionId);
   }

 On Nov 19, 12:58 am, Cyrille Vincey crll...@gmail.com wrote:



  Check your war  WEB-INF datastore-indexes.xml
  (NOT the war  WEB-INF  appengine-generated  datastore-indexes-auto.xml)

  You might read: datastore-indexes autoGenerate=false
  Try to replace with : datastore-indexes autoGenerate=true

  On 19/11/10 01:39, Jerry jerry.morri...@gmail.com wrote:

  Great tip but it's not working. Running the test updates the mod date
  of local_db.bin but not datastore-indexes-auto.xml.

  I'm also configuring a LocalUserServiceTestConfig for a logged in
  user, but that doesn't seem to affect it.

  Is another setup step needed?

  I'd like a unit test to trigger all auto-index because my app has many
  possible combinations of query filters.

  Thanks!

  On Nov 11, 11:24 am, Starman r...@arrova.ca wrote:
   Something like the following will setup the datastore helper and
   create the datastore-indexes-auto.xml:

               LocalDatastoreServiceTestConfig dsConfig = new
   LocalDatastoreServiceTestConfig();
               File location = new File(war/WEB-INF/appengine-generated/
   local_db.bin);

   dsConfig.setBackingStoreLocation(location.getAbsolutePath());

               // And it seems that for the local ds service to be able
   to load the local_db.bin file, the local
               // environment must match the app id and version as stored
   in the file.

               String xml;
               try {
                   xml = FileUtils.readFileToString(new File(war/WEB-INF/
   appengine-web.xml));
               }
               catch (IOException e) {
                   throw new RuntimeException(e);
               }
               String application = StringUtils.substringBetween(xml,
   application, /application);
               String version = StringUtils.substringBetween(xml,
   version, /version);

               // Default behavior is to keep everything in RAM. Tell the
   local services to use the file system

               dsConfig.setNoStorage(false);

               // Create the local services.

               gaeDatastoreHelper = new LocalServiceTestHelper(dsConfig);
               gaeDatastoreHelper.setEnvAppId(application);
               gaeDatastoreHelper.setEnvVersionId(version);

               // Calling setUp() will start the local ds service and
   load the local_db.bin file.

               gaeDatastoreHelper.setUp();

   This way, you can even write tests against a previously generated
   local_db.bin if you want.

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

[appengine-java] Re: ImageService from dev server

2010-11-18 Thread Starman
Just remove the protocol:ip:port prefix before you store the serving
url.

On Nov 18, 3:03 pm, andrew aute...@gmail.com wrote:
 I am having issues getting a url for an image to be served from the
 ImageService when running locally on the dev server.

 The code (which works fine when deployed) is this:

                 ImagesService imagesService =
 ImagesServiceFactory.getImagesService();
                 String imageLocation = imagesService.getServingUrl(blobKey);

 When running on the dev server locally (with a server URL ofhttp://127.0.0.1)
 the ImageService returns a URL of:

 http://0.0.0.0:80/_ah/img/{key}

 I also see that in the local dashboard there is no blobviewer.

 Should I take this to mean that there is no image serving of blobs
 when running on the dev server?

 If so, it makes debugging more painful...

 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: Auto generating datastore-indexes.xml during unit tests

2010-11-18 Thread Starman

Humm... I get a nice appengine-indexes-auto.xml after my runs. Ah yes,
don t call tear down on the helper... I don t exactly remember but,
this was clearing the local_db.bin file and maybe the indexes auto
also.

R.

On Nov 18, 7:39 pm, Jerry jerry.morri...@gmail.com wrote:
 Great tip but it's not working. Running the test updates the mod date
 of local_db.bin but not datastore-indexes-auto.xml.

 I'm also configuring a LocalUserServiceTestConfig for a logged in
 user, but that doesn't seem to affect it.

 Is another setup step needed?

 I'd like a unit test to trigger all auto-index because my app has many
 possible combinations of query filters.

 Thanks!

 On Nov 11, 11:24 am, Starman r...@arrova.ca wrote:



  Something like the following will setup the datastore helper and
  create the datastore-indexes-auto.xml:

              LocalDatastoreServiceTestConfig dsConfig = new
  LocalDatastoreServiceTestConfig();
              File location = new File(war/WEB-INF/appengine-generated/
  local_db.bin);

  dsConfig.setBackingStoreLocation(location.getAbsolutePath());

              // And it seems that for the local ds service to be able
  to load the local_db.bin file, the local
              // environment must match the app id and version as stored
  in the file.

              String xml;
              try {
                  xml = FileUtils.readFileToString(new File(war/WEB-INF/
  appengine-web.xml));
              }
              catch (IOException e) {
                  throw new RuntimeException(e);
              }
              String application = StringUtils.substringBetween(xml,
  application, /application);
              String version = StringUtils.substringBetween(xml,
  version, /version);

              // Default behavior is to keep everything in RAM. Tell the
  local services to use the file system

              dsConfig.setNoStorage(false);

              // Create the local services.

              gaeDatastoreHelper = new LocalServiceTestHelper(dsConfig);
              gaeDatastoreHelper.setEnvAppId(application);
              gaeDatastoreHelper.setEnvVersionId(version);

              // Calling setUp() will start the local ds service and
  load the local_db.bin file.

              gaeDatastoreHelper.setUp();

  This way, you can even write tests against a previously generated
  local_db.bin if you want.

-- 
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: Does that datastore mains sort order for list properties?

2010-11-15 Thread Starman

From my reading and experience, the type of collection type used will
determine if order is preserved. To maintain the ordering, a system
field is added to the values. This may impact the CUD operations
performance.

I don't need to keep the order in my current app so I am using Set for
my property list, which does not involve any overhead.

R.

On Nov 15, 10:11 am, Maxim Veksler ma...@vekslers.org wrote:
 It does, thank you very much.

 On Mon, Nov 15, 2010 at 4:47 PM, Didier Durand durand.did...@gmail.comwrote:



  Hi,

  Even though an array is not a Collection per say, it seems that
  because of

 http://code.google.com/appengine/docs/java/javadoc/com/google/appengi...
  ,
  you have to be careful with the order of items in an array as it says

  All Collections are prone to losing their sort order and their
  original types as they are stored in the datastore. For example, a
  TreeSet may be returned as a List from getProperty(java.lang.String),
  with an arbitrary re-ordering of elements. 

  Hope it helps
  didier

  On Nov 15, 3:21 pm, Maxim Veksler ma...@vekslers.org wrote:
   Hello,

   We are using the low level API, it unclear from the documentation if the
   sort order is maintained in list properties?

   So for example, if I serialize int[] intArray = { 1, 2, 3}, can I always
   expect to receive back {1 , 2, 3} or is it possible that the order will
  be
   randomized?

   Thank you,
   Maxim.

  --
  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: Auto generating datastore-indexes.xml during unit tests

2010-11-11 Thread Starman
Something like the following will setup the datastore helper and
create the datastore-indexes-auto.xml:


LocalDatastoreServiceTestConfig dsConfig = new
LocalDatastoreServiceTestConfig();
File location = new File(war/WEB-INF/appengine-generated/
local_db.bin);
 
dsConfig.setBackingStoreLocation(location.getAbsolutePath());

// And it seems that for the local ds service to be able
to load the local_db.bin file, the local
// environment must match the app id and version as stored
in the file.

String xml;
try {
xml = FileUtils.readFileToString(new File(war/WEB-INF/
appengine-web.xml));
}
catch (IOException e) {
throw new RuntimeException(e);
}
String application = StringUtils.substringBetween(xml,
application, /application);
String version = StringUtils.substringBetween(xml,
version, /version);

// Default behavior is to keep everything in RAM. Tell the
local services to use the file system

dsConfig.setNoStorage(false);

// Create the local services.

gaeDatastoreHelper = new LocalServiceTestHelper(dsConfig);
gaeDatastoreHelper.setEnvAppId(application);
gaeDatastoreHelper.setEnvVersionId(version);

// Calling setUp() will start the local ds service and
load the local_db.bin file.

gaeDatastoreHelper.setUp();


This way, you can even write tests against a previously generated
local_db.bin if you want.

-- 
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: Initializing DataStore with minimal required values

2010-11-10 Thread Starman
I created a datastore manipulation service that can execute, using the
task queue service, pieces of code found in 'plugins'. I have plugins
for the initial sourcing and some others to create test and demo
data.

I favor this approach over the bulk uploader as you need to also
prepare for the task of upgrading the datamodel and source data of a
live app. So, I deploy new app versions with new plugins and remove
some from the app code when their job is done.

A good usecase would be adding a field to all entities of a given
type, with this field value determine from some other piece of related
data.

R.

On Nov 9, 11:39 pm, Didier Durand durand.did...@gmail.com wrote:
 Hi,

 you can either use bulkloader 
 (seehttp://ikaisays.com/2010/06/10/using-the-bulkloader-with-java-app-eng...)
 or just write the code needed to store your date in the datastore (i.e
 to create the appropriate entities with their values)
 regards
 didier

 On Nov 9, 8:40 pm, Blaise Gervais gervai...@gmail.com wrote:



  Helo everyone,

  I wonder about how to initialize the datastore (in Dev mode and on GAE)
  with some required values. How can I insert entities required for my
  app like the root user or the menu structure, or anything other ?

  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: DTO object

2010-11-08 Thread Starman
Remap these complex types onto native Java types while copying your
entities onto your dtos... or are you sending your entities to the
client directly?

Usually, you will not want to send the entities to the client as it
exposes your data model directly. You should create your service layer
so as to be friendly to other clients besides your own. Create a
remoting API that is a bit more abstract than your entities so as to
be easily exposed through a REST API for instance.

When I copy my entities onto my dtos, some entity fields don't even
make it into the dto. Others only have getters in the dto because they
are read-only to the client. Those that do get into the dto get
converted to native Java types. For instance, Text gets converted to
String. Key gets encoded to a url friendly string. If I have Set
fields on the entities to manager my relations (property lists), I
remap those to ArrayList... First, don't serialize interfaces to GWT
client, you'll get Javascript bloat. Then, Hashmap is costly to
serialize because String.hashCode() is not the same on in Java and in
Javascript. Hence, all the items need to be re-inserted into a client
side map. Of course, in Web mode, performance is good enough... but in
development mode, your data transfers will become really slow for
somewhat big transfers.

-- 
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: GAE or EC2

2010-11-08 Thread Starman
Having worked for a SaaS company with 500K users and +500M items in
its database, the cost of just managing your infrastructure are
enormous.

Recently, I have been working on two unrelated projects, but both of
pretty similar sizes. One on AWS, the other on GAE.

AWS is rented virtualized servers with good SaaS support (elastic load
balancing, etc). But nothing, I mean nothing beats a good PaaS offer
like GAE if:

1) you can fit your business domain into a schemaless, (almost) join-
less, really really hard to use with transactions datastore like Big
Table and
2) can deal with the current cold startups (if using Java) and the 30
seconds thread limit (but the Task Queue API pretty much solves that).

More so if you're a startup where money is tight. If you can just work
on features, press a button, refresh you browser and there it is, for
millions to use with automatic, unlimited scaling... that's priceless.
But beware, all is not easy on GAE and many pitfalls await. You need
to know what you are doing and be carefull.

Good luck with the startup!

-- 
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: Two apps hitting the same datastore

2010-11-07 Thread Starman
As you know, you can deploy many versions of an app for the same app
id. There is nothing that says it has to be the same app. Just deploy
another app that does your weekly updates using another version
string. Each version, even though it may not be the default one, gets
its own url. You just need to trigger it one a week thereafter.

On Nov 7, 5:23 pm, Eyal twoworldsf...@gmail.com wrote:
 Hi all,

 I need to have two separate applications hitting the same datastore.
 One updates it daily, and the other (app engine and GWT) reading from
 it on a regular basis. How is this done? Is there a way in the API to
 specify a specific datastore?

 Thanks,
 Eyal

-- 
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: Spring MVC on GAE: Slow Load Time

2010-10-07 Thread Starman
I have a Spring app with a pretty full stack currently being developed
on gae. I quickly hit the 30 seconds limit at startup, hence the app
would no longer even boot. I removed jpa in favor of Objectify,
removed all the transaction management as I don't use entity groups,
removed some features that were doing classpath scanning and other
byte code injection, used as much lazy initializtion as possible. I
got my startup time back to 20 seconds. Until I can pay to keep a jvm
up, this is unnacceptable.

I haven't profile Spring Security yet, which is still the biggest
bottleneck. But even with more optimization work, I will be lucky to
get a 10 seconds startup.

We'll see where this all goes.

-- 
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] Query on list properties not working within unit tests using mock LocalServiceTestHelper datastore.

2010-08-17 Thread Starman
Hello all and thank you for reading this.

I am using JPA. I have implemented free text search using list
properties (SetString).

Using the same datastore content (local_db.bin), my free text search
is working fine when I run the app, but returns nothing if I run the
query in unit tests.

I am using LocalServiceTestHelper to mock the datastore in unit tests.

All the other CRUD operations, including search queries on non-list
properties, work fine in unit tests.

I am using Spring (usual config on GAE). Hence, my app is pretty much
the same either running in the dev environment or in unit tests.

Anyone has experienced this before? Anyone doing successful list
properties queries in unit tests with LocalServiceTestHelper.

Below is some additional information.

Some leads I will be investigating: lazy loading of list properties
and automatic index generation.

Here is my entity definition (some fields and methods removed)

@Entity
@MappedSuperclass
public abstract class BaseEntity {
private static final long serialVersionUID = 1L;
private Key id;

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
public Key getId() {
return id;
}
}


@Entity
@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
public class NodeEntity extends BaseEntity {
...
private SetString ftsKeywords;

@Basic(fetch = FetchType.LAZY)
public SetString getFtsKeywords() {
return ftsKeywords;
}
}


I have also seen this error (or is it?) in the logs.


14:46:49,910 DEBUG [DataNucleus.Transaction] - Running enlist
operation on resource:
org.datanucleus.store.appengine.emulatedxaresou...@213e13, error code
TMNOFLAGS and transaction: [DataNucleus Transaction, ID=Xid=???,
enlisted resources=[]]

Thank you again for the 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.