Friday, March 30, 2012

My ZK + Jetty Project

Here are some notes for my own development:

Installation

Download ZK CE Version (LGPL)
http://www.zkoss.org/download/zk

Install ZK Studio (Eclipse Plugin)
http://www.zkoss.org/documentation/zkstudio

  • Note that by default ZK Studio comes with the ZK EE Version (60 days Trial). You may change the build setting to the CE version later on.


Install Jetty (I prefer Jetty over Tomcat)
http://download.eclipse.org/jetty/

  • I am using version 8 in my project.


Jetty WTP Plugin
http://wiki.eclipse.org/Jetty_WTP_Plugin/Jetty_WTP_Install

  • You will need this in order to have the "Server Adapter" for Jetty version 7/8 configured in Eclipse.
  • Preferences > Servers > Runtime Environments > Add...


Create Server Console

  • Open the Servers window. Right click > New > Server
  • To associate a project with the server (auto-deploy/synchronized), right click the server and choose [Add and Remove].




** 1. WTP Plugin has some bugs that it does not add all Jetty's JAR file to classpath. You may encounter ClassNotFoundException during the server start. You can manually add them back by double-click the server and choose [open launch configuration]. Then [Add External JARs] to the classpath.

Typically, it misses out these two jars:

  • javax.annotation
  • org.objectweb.asm





Dependency Management - Apache Ivy

  • It is pretty easy to get start with Ivy. In eclipse, you can install the IvyDE plugin from the marketplace. Then create your own ivy.xml to specifiy the necessary dependencies.
  • If you want to change the default Ivy setting, create ivysettings.xml and specify the properties to be changed according to the online reference.
  • Both files can be put in the root directory of your eclipse project, and you can point to their locations in the IvyDE setting.
  • You may want to have all dependencies (*.jar) to be exported to the WAR at your final deployment. Simply add this entry to your deployment setting.




Development

Basic Concepts
  • Component is a visual element in ZUL, such as <button>, <label>...etc. This POJO represents the View of MVC pattern.
  • Composer is interface that control the component, and so it is the Controller of MVC pattern.













Friday, March 16, 2012

GAE Logging

By default GAE's admin console supports fine control of the Java Logging Framework (JDK Logging). The configuration format can be learnt from the ${JDK_HOME}/lib/logging.properties file.

http://code.google.com/intl/en/appengine/docs/java/runtime.html#Logging

http://docs.oracle.com/javase/1.4.2/docs/api/java/util/logging/LogManager.html

Wednesday, March 14, 2012

GAE in Action


Some Concerns in using GAE as your Backend
  1. No sockets. The API does not allow Java sockets. You may use URLFetch API instead.
  2. No relational database, not even deploying a sqlite db as resource file due to the read-only restriction of resource file in GAE. (This is not true now as Google is rolling out Cloud SQL API which support MySQL-like relational database.)
  3. HTTP response/request data size limits : 10MB each

Facebook JavaScript SDK
http://developers.facebook.com/docs/reference/javascript/

The Unofficial Google App Engine Price Change FAQ
http://blorn.com/post/10013293300/the-unofficial-google-app-engine-price-change-faq

Scheduled Tasks With Cron for Java
http://code.google.com/intl/en/appengine/docs/java/config/cron.html