Add/Edit Entities in google app engine java local datastore - java

Following are related to GAE/J local development setup:
How do i add/edit entities in local datastore (preferably using some UI)? _ah/admin allows only to view entities.
In the local JUnit test cases, how to access the same datastore data that my local web application writes to? I wrote my Test Cases in accordance with http://code.google.com/appengine/docs/java/tools/localunittesting.html but the test cases don't access the same data that the web application uses.
How to save local datastore data between clean-build (right now local_db.bin is written in the target directory which gets cleaned every now and then)
Stack being used :
Google AppEngine for Java - (gae sdk
1.4/ java sdk 6),
Netbeans-6.9.1,
Maven-2 (maven-gae-plugin 0.7.3)

You can't currently edit entities in the Java local datastore viewer. It's in the todo list, though.
Your unit tests shouldn't rely on the contents of the datastore: unit tests are intended to be self-contained.
You can't do this, either, unless you make a backup of local_db.bin part of your build process. Again, you should ideally design your app with easy reloading of data in mind.

Now you can save/load entities using a command line client

Related

Local Java application to interact with Google Datastore

I am currently attempting to create an automated data export from an existing Google Datastore "Kind" to output to a json file.
I'm having trouble finding a suitable example that allows me to simply pull specific entities from the Datastore and push them out into an output file.
All the examples and documentation I've found assume I am creating an app-engine project to interface with the Datastore. The program I need to create would have to be local to sit on a server and query the Datastore to pull down the data.
Is my approach possible? Any advice on how to achieve this would be appreciated.
Yes, it is possible.
But you'll have to use one of the generic Cloud Datastore Client Libraries, not the GAE-specific one(s). You'll still need a GAE app, but you don't have to run your code in it, see Dependency on App Engine application.
You could also use one of the REST/RPC/GQL APIs, see APIs & Reference.
Some of the referenced docs contain examples as well.

How to manage shared bootstrap data accross multiple projects

I have 3 web-projects that use the same database and same models. These systems require partly the same bootstrap data in the database in order to run properly. All Systems share library code that will read the data from database and update it according to the bootstrap data in the code (add new, remove unused, update changed). Every application will perform this when they start and most of the time nothing needs to be done since the data is already correct. This data is also used by some of the integration tests.
The problem is that when some of the common data needs to be changed, then all 3 applications needs to be re-deployed with the new bootstrap data because otherwise they will bootstrap with the old data in case they are restarted (server reboots for example).
I'm looking for the best way to manage shared bootstrap data for multiple projects.
You could create a plugin that contains a service that does what you need and include the plugin in all projects. Then simply call the plugin service within each bootstrap.

Couchbase Cluster and Bucket management

I am developing a server-side app using Java and couchbase. I am trying to understand the pros and cons of handling the cluster and bucket management from the java code over using the couchbase admin web console.
For instance, should I handle create/ remove buckets, indexing, and update buckets in my java code?
The reason I want to handle as many as couchbase administration functions is my app is expected to run on-prem not a cloud services. I want to avoid that our customers need to learn how to administrate couchbase.
The main reason to use the management APIs programmatically, rather than using the admin console, is exactly as you say: when you need to handle initializing and maintaining yourself, especially if the application needs to be deployed elsewhere. Generally speaking, you'll want to have some sort of database initializer or manager module in your code, which handles bootstrapping the correct buckets and indexes if they don't exist.
If all you need to do is handle preparing the DB environment one time for your application, you can also use the command line utilities that come with Couchbase, or send calls to the REST API. A small deployment script would probably be easier than writing code to do the same thing.

How to add mysql database into project setup.?

i have a java project with mysql database
i am using advance installer to create a setup file...
i can embed jre to run the software(Without installing java in the system).
like wise,i want to embed the mysql database (system doesn't contains mysql )...
.There is any software to embed mysql database in my project setup...
MySQL is very difficult to embed correctly and there are a number of failure states that might occur if it is not shut down using the proper procedure. SQLite is a much better engine for this sort of thing and is used by a number of applications as a persistent backing store. While not as powerful as MySQL, it is much more resilient. It also has the advantage of not requiring a separate process.
SQLite's storage method is to persist things into a file that can be copied, moved, or backed-up without any issues. MySQL involves many such files, some of which are in an inconsistent state unless the correct FLUSH is called.
The best you can do with MySQL is bundle it, not embed it, but then you'll be responsible for setting it up on the host system, configuring it correctly, running the appropriate maintenance procedures, and providing some kind of back-up facility for the database itself.

Tool for managing multiple Java web container instances?

I'm looking for a Java Web Container (like jetty and tomcat) or a tool in which I can create/remove server instances through a management console.
The problem is that my organization needs to create different instances of a test server for quality control testing (against different database configurations). Currently, I'm having to manually copy a Tomcat "catalina_base" template directory and make any changes needed for the test being run. It would be nice to have a unified interface where I could click a button to create a new instance (and click another to remove it).
Edit 1
Must be able to run on Windows Server 2003.
Edit 2
I'm getting a lot of answers that have to do with build, so I'm going to add some extra information about the application. The application is a standard Java EE web application that is built using an ANT script. We use a container managed JNDI DataSource for connecting to the database. Our procedures, which are hold overs from 20+ years ago, have dictated that every new database change needs to be in a new schema.
So say a customer reports that our application is displaying a calculation wrong - the first thing we do is create a new database schema, then we run the create script for all of the database objects, and lastly copy the data from production for testing to that new schema. When we've fixed the bug (either application side or database side), our quality control person, needs the fixed application and the schema within the DataSource changed to that of the new "test environment". When they've completed their testing, we stage the code to be included in the next scheduled release.
The catch is, this process is multiplied by a number of developers and a number of concurrent bugs fixed and features added. Currently, there are over 20+ Tomcat instances managing different versions of the application and database objects. I'm constantly having to create new Tomcat instances and remove old ones, as features are added and quality control has completed.
it sounds like what you really need is a build a deployment tool like Continuum
You can do so with jetty.You can create your own Java Class with the specified configuration as an embedded server and run it from the prompt or through some web interface.
you can check this out
http://docs.codehaus.org/display/JETTY/Embedding+Jetty
Have you thought about a configuration management tool like Chef?
It sounds like you should just update your application's build script to be able to accept different parameters for things like "use test1.properties for database settings" or "use prod2.properties", and then deploy that rebuilt application.

Categories

Resources