Ant Input and Passwords

Ant input task does not has a feature which will allow not to echo what user inputs, a necessity in case you are prompting for a password. As per the ant input task documentation

A regular complaint about this task is that it echoes characters to the console, this is a critical security defect, we must fix it immediately, etc, etc. We know it leaves something to be desired, but the problem is Java, not Ant. There is nothing we can do to stop the console echoing.

Click to continue reading “Ant Input and Passwords”


Killing Java Process from Ant in Windows

I wanted to write a ant script for one of the environment, which would perform following tasks in order which will be repeated
1. Take Latest Code
2. Compile
3. Create WAR
4. Undeploy currently installed WAR from tomcat
5. Stop the tomcat
6. Copy the WAR to tomcat webapps folder
7. Start the tomcat

Click to continue reading “Killing Java Process from Ant in Windows”


iBATIS and Hibernate Features

Recently evaluated Hibernate and iBATIS, there were some good points listed at this thread which I have summarized below with some of my thoughts –

  1. iBATIS maps Java Objects to the results of SQL Queries, where as Hibernate maps Java Objects directly to database tables.
  2. iBATIS is a “Sql Mapping” implementation of ORM, whereas Hibernate is traditional Object-Relational Mapping.
  3. Hibernate automatically generates all the SQL for you and the cache invalidation can be more fine grained. iBATIS is more flexible. You have control over exactly how the SQL queries are written.
  4. Use Hibernate if you have mostly standard queries(CRUD, Find by Criteria, etc.) and if you are designing your object model first, then a relational model to support the object model.If you are working with a legacy system or a schema designed by a DBA, iBATIS often makes a better choice.
  5. All of the SQL statements used by iBATIS can be stored in XML files outside of Java code, so DBA can easily review them.
  6. Also compared to Hibernate, iBATIS is more flexible, has a shorter learning curve, but can take more time to develop and maintain, since you have to write all your queries and if your object model changes you have to go through all your queries and make sure to make all the necessary changes to reflect the changes in your object model.
  7. The performance of Hibernate while working with large data sets[complex joins] is not optimal.
  8. Hibernate is great when you control the data model, and you let Hibernate do most of the work in the persisting of objects.
  9. Unless your existing model is lightweight, adding Hibernate to it is possible, just usually not trivial.
  10. Once Hibernate is setup and SQL tuned, productivity gains are very big.
  11. iBATIS, will need good DBA or good SQL Developers for SQL tune-ups.
  12. iBATIS can be fine-grained optimization for eg. I have a table, this table has a few or dozens of fields, I need to update one of a field, iBATIS is very simple to implement a sql UPDATE using WHERE but with Hibernate, default will update all fields. Though with Hibernate you can control to update only updated fields but that you will have to configure.
  13. Similar with select queries where I can choose few columns instead of *, with Hibernate you will get object with all columns. Same applies when I want to update a row in table, with Hibernate I will have to first load that object and then save, two sqls whereas with iBATIS, it would be a single update sql. These are considerations for a interactive database where improving performances is important.
  14. iBATIS, SQL maps allow SQL to be fully customized for a specific database. However, these maps do not provide an abstraction from the specific features of the target database.


Sun opens Java

Sun Microsystems Inc. of Santa Clara, Calif., has released the source code to its widely used Java programming language.The company will post the source code to various pieces of Java over the nextfew months, according to Sun CEO Jonathan Schwartz, who announced the releasetoday. Available immediately, on the site, is the code for the JavaPlatform Standard Edition-which has over 6 million lines of code-and the JavaPlatform Micro Edition for embedded systems.
Today this project contains two significant components of the JDK:

The remainder of the open-source JDK will be available in the first halfof 2007. At that time this project will host the source code for thecomplete JDK except for a few components that Sun does not have the right topublish in source form under the GPL; pre-built binaries will be provided forthose components.



Google Web Toolkit

Google Web Toolkit (GWT) is a Java development framework that lets
you escape the matrix of technologies that make writing AJAX
applications so difficult and error prone. With GWT, you can develop
and debug AJAX applications in the Java language using the Java
development tools of your choice. When you deploy your application to
production, the GWT compiler to translates your Java application to
browser-compliant JavaScript and HTML.

Here’s the GWT development cycle:

  1. Use your favorite Java IDE to write and
    debug an application in the Java language, using as many (or as few)
    GWT libraries as you find useful.
  2. Use GWT’s
    Java-to-JavaScript compiler to distill your application into a set of
    JavaScript and HTML files that you can serve with any web server.
  3. Confirm that your application works in each browser that you want to support, which usually takes no additional work.



DWR – Direct Web Remoting

DWR reduces development time and the likelihood of errors by
providing commonly used functions and removing almost all of the
repetitive code normally associated with highly interactive web sites.

DWR is freely available as open source software.
It is straightforward to implement with extensive libraries, examples
and tutorials. Incorporating it into existing sites is simple as it
readily integrates with the most commonly used Java frameworks.



JAG – Java Application Generator

JAG is an application that creates complete, working J2EE applications. It is intended to alleviate much of the repetitive work involved in creating such applications, while providing a means of quality assurance that the applications created will be of consistent quality.

One of the strengths of JAG is that it delivers a complete working
project – it’s more than just another code generator! The projects
generated by JAG have the following features:

  • A full, professional quality project infrastructure: The generated applications build with Apache Ant
    and have a flexible, well-organised directory structure.
  • By choosing from JAG’s extendable framework of ‘application
    templates’, you have control to select the most appropriate application
  • Best-of-breed J2EE architecture: The various application
    architectures are derived from a real-world appreciation of industry
    best practices.
    The latest application template offers:

    • A strict enforcement of presentation-layer
      separation using interfaces to enable the greatest flexibility in
      deployment scenarios
    • EJB and Hibernate features such as relations.
    • J2EE ‘BluePrint’ patterns such as Session Façade, Service Locator, Business Delegate, Fast Lane Reader and Value Objects.
    • A pluggable service tier: ServiceLocator or Spring Framework.
    • A pluggable business/persistence tier: EJB2/3 or Hibernate 2/3
  • A presentation layer (web application) that takes advantage of the latest features of Struts,
    such as declarative client- and server-side user input validations, and clean, modular JSPs using Struts and the display tag library.
  • Extensive use of Java 5 Annotations or XDoclet
    in the generated application means that the complexity of the
    code base is vastly reduced, increasing maintainability. Through the
    use of XDoclet tags in the generated Java code, many of the
    JAG-generated classes
    serve as a basis for further automatic code generation at build-time!

Applications generated by JAG are intended as a solid first step in a
project’s development phase. Using the generated application as a base,
development can be undertaken such as coding business logic into the
session beans, customising the web application, etc.