I have written a relatively simple Java App Engine application which I would like to be able to port to another cloud provider.
I am using the JDO datastore API so I think my data handling should be portable to other backends as listed here: http://www.datanucleus.org/products/accessplatform/index.html
I would ideally like to deploy my application onto EC2 with minimal code changes. What is my best approach?
Note: I am aware of the http://code.google.com/p/appscale/ project but I want to avoid using this as it doesn't look like they are updating very often.
AppScale remains your best option to avoid rewriting any code. They do keep up to date with official App Engine - for instance, they just released preliminary support for Go. Even if they weren't so assiduous at keeping up to date, though, this would only be relevant if some feature you required wasn't yet supported - and it sounds like your needs are fairly basic.
JDO should be trivial, there might be some Google specific configuration here and there but generally it should be easy. The storage model Google promotes is not bad for RDBMS either, but you might need to fine tune your model depending on the backend you end up with.
If you're not using the low-level Google APIs, you should be pretty much there.
I managed to get my application working on EC2 using the following components.
Tomcat 7
Datanucelus
HBase
I had to manually create a table in HBase for each of my data classes but was able to configure Datanucleus to auto create the columns.
I also had to change my primary key value generation strategy from identity to increment as per this table of supported features.
http://www.datanucleus.org/products/accessplatform_3_0/datastore_features.html
Related
My company has a product that we sell as a solution to mediocre firms, they are ok with using java but they have different opinions on db due to licensing and other technical/resource issues.
I was wondering if there is a way i can create the app in such a way that during installation we configure the database (select weather mysql/oracle and input/generate connection strings, allocate driver, e.t.c.) and it works similarly as the other db. I have heard about hibernate being able to generate table but havent ever worked on it before.
I need an opinion and if possible reference to a guide. thank you in advanced. sorry for a stupid question, i only know basics of java, haven't yet worked on ORM or any other framework.
Yes,
The JPA (java persistance API) allows you to do what you're looking for. You will be needing a JPA provider (such as hibernate, Apache OpenJPA or eclipse link among others).
You will be able to automatically create the schema of your database according to the objects you need to map into it.
Here are few links to get started:
https://docs.oracle.com/javaee/6/tutorial/doc/bnbpz.html
https://www.tutorialspoint.com/jpa/
http://www.oracle.com/webfolder/technetwork/tutorials/obe/java/SettingUpJPA/SettingUpJPA.htm
Many JPA ressources will point to java ee ressources and tutorials, since it is heavily used with java entreprise edition, but the API itself can be used with the standard java platform.
I'm going to develop a map server with my own logic and entities. It will have postgres database, user management, specific layers with certain types, WFS, WMS, etc.
I'm going to use springframework and GeoServer as the GeoServer is an open source project. My question is whether I develop it or use it as a separated server? How about the user management problem? How can I integrate my own project security with the geoserver?
Typically you develop a front end that's completely separate and have GeoServer offer the OGC services to it and other clients. In case you need to customize it, GeoServer has a fully pluggable architecture, e.g., you can build a version of it that has more or less modules than the standard one, your own security subsystem, your own custom data sources, and so on, a lot can be either configured or replaced, so I'd suggest you look into those options.
Mind one detail, GeoServer is GPL'd, so any code you develop that depends on GeoServer API will similarly be GPL'd. If instead you develop something that's only based on GeoTools (e.g., a custom data store) that part can be closed source.
I'm creating a java desktop application using swing which requires some database persistance for which I'm planning to use Hibernate. I'm pretty new to desktop application development so I wanted to know if and how the database can be created on the client computer when installed.
Is there a script to be run or maybe a hibernate configuration which initiates database creation?
A sample tutorial or example illustrating this will be ideal (although I was not able to find one).
Thanks in advance for any help provided.
Hibernate is not an database server itself, it is a object-relational mapping framework so you need a either embedded or stanalone database server. Java DB that comes with the JDK will be sufficent for desktop applications.
http://hamidseta.blogspot.in/2008/05/install-mysql-server-50-silently.html
In your package installer scripts perform the steps of silent MySql installation. In the BAT file put the code you find in the above link before triggering your Java application installer.
As per free licensing terms, one should not package MySql bundle for free, just check about the licensing if you bother.
I think it would be better if you can start with javaDB or SQLite.
They are perferred embedded database technologies for desktop java applications.
You can download the jar for sqlite-jdbc from here.
Take a look at few tutorials on JDBC
If you making swing applications, make sure you learn to use swing worker well. It will
be important to perform background processing.
Hibernate is Framework used as middle layer in project which interact between database and Business layer logic.
Hibernate features
J2EE integration
Object/Relational mapping
Automatic primary key generation
Object-oriented query language
So my suggestion is to go with MySQL because
Handles large databases. We use MySQL Server with databases that contain 50 million records. We also know of users who use MySQL Server with 60,000 tables and about 5,000,000,000 rows.
A very fast thread-based memory allocation system.
Very fast joins using an optimized one-sweep multi-join.
The server can provide error messages to clients in many languages.
This is only few features but you go to official site for more detail. And most important it's open source.
And the post help to install and configure on client system.
I made a GAE-Project with JPA2 for db access. I store some Strings which are more than 500 Characters, so I use com.google.appengine.api.datastore.Text.
I got an interface Script.java which defines the value as String, and an ScriptImpl.java which has internally a Text member, and converts for getting and setting.
Because one requirement of the project is, that it is still able tu run on an simple tomcat with a database behind. So it must be possible to run inside and outside the google environment.
Is there some realistic way to implement my application so I can switch to a normal tomcat environment (e.g. via a spring configuration to use different beans...).
What else do I have to pay attention to to make this work in both environments and how do I take care of the parts that are seamed thight to GAE?
Update: So far I found the following critic issues: Google User Service & Login Process, Text Class in Domain Models, Wicket-GAE-Initializer (since I use Wicket)
GAE has it's own proprietary API. If you wrote application using this API then if you want to move off of the GAE you have two options:
Rewrite your code, obviously.
Use a API wrapper that implements GAE API but runs on other platforms. An example of such wrappers are AppScale and CapeDwarf. AppScale is older and probably more mature and supports both Java and Python. Also it supports more platforms (private servers + clouds). OTOH, CapeDwarf is targeted at JBossAS7, so it's probably better fit if you use that server (or OpenShift cloud). Also I guess you can expect better support from a mature open-source leader such as RedHat.
While in theory it might be possible to wrap GAE functionality and then delegate it to either app engine or your "normal" environment it's probably a lot of effort.
Possibly another approach would be easier. Are you aware of CapeDwarf?
JBoss CapeDwarf
Deploy and run your Java App Engine applications on your own private
JBoss Application Server (AS7) cluster or on RedHat’s OpenShift cloud.
JBoss CapeDwarf is an implementation of the Google App Engine API,
which allows applications to be deployed on JBoss Application Servers
without modification. Behind the scenes, CapeDwarf uses existing JBoss
APIs such as Infinispan, JGroups, PicketLink, HornetQ and others.
If it really needs to be "simple tomcat with a database" then more information or constraints will be helpful to know.
I have to come up with a basic CRUD app. as fast as possible (and by "fast" I mean like 3 days).
I considered going with Django, but I don't have a lot of experience with Python/Django, and also I have a complete set of EntityBeans that I need do CRUD on. So I thought reusing them would be better.
The resulting CRUD app. should be similar to the Django admin page (but the Django admin page per-se won't work though).
Is there some framework with which I can start with EntityBeans and get a quick, Django admin like skeleton?
If you don't want to change a technology stack you're working on and still have an Django-like administration interface, there is a Java alternative - LightAdmin all-in-one library.
After declaring Maven dependency & enabling administration panel in your web.xml, you will have a complete CRUD with some additional features, like filtering, scopes, security, etc.
The only code related to data administration in your codebase would be DSL configurations for UI customization.
The only thing is that LightAdmin could be used only for JPA domain model entities administration for now.
I would recommend the playframework as it is easy to learn and quick to get up and running. They have a CRUD administration module you can use to generate CRUD framework based on your Entity model. Also check out their tutorial page.
You must try AppFuse or Spring Roo.
http://appfuse.org/display/APF/Demos+and+Videos (+online demo)
http://spring.io/
Spring Roo gives you a CRUD application up in 10 minutes. Unlike other frameworks this really is practically usable.
I have downloaded the Roo shell for the first time and without reading any documentation I managed to get an application up and running within minutes.
Naked Objects, if you're look at a prototype. Although it does have a "viewer" for Wicket apart from the HTML viewer, I would recommend using the framework primarily for fleshing out the functionality of your domain.
You might also want to check the Scimpi viewer, although I must admit that I havent worked with it.
A demo application using the HTML viewer is hosted online, and is accessible for having a quick look at the functionality. A tutorial demo is also hosted online.
Give Grails about 2 hours, and if you don't have a CRUD app after that you're doing something wrong.
I've used CodeCharge Studio by Yes Software for several years, and am able to build a CRUD app in less than 10 minutes (assuming database already exists). CodeCharge has a bit of a learning curve if you want to go beyond the interfaces created by the wizards, yet I think my development time has increased by a factor of at least 30 from writing my own code.
I use it at work to create PHP applications that hit MSSQL, and other projects that hit MySQL. Works like a charm for both.
http://www.yessoftware.com/index2.php
I am not a "pythonista" so this may be absolute rubbish but could Django running on Java be the answer for you?
Jython is an implementation of python for the JVM and can run Django.
http://docs.djangoproject.com/en/dev/howto/jython/
Yes Java has many such framework for both web and desktop but .net has very few..
I recently used RocketFramework , which was to my expectation.. So just thought to post it here so that anybody interested have the link :-)
You can create a Quick Crude App in minutes using HTML5, i found www.quickcrud.com that allows you to generate the HTML5 on line and also it's possible to generate Android Apk also in minutes!