Wednesday, May 7, 2008
Middlegen is an open source code generation framework that provides a general-purpose database-driven engine using various tools such as JDBC, Velocity, Ant and XDoclet.
Create a working directory where you install and store all related files. In this tutorial we'll use C:\Java as working directory. If you want to store it somewhere else, then you'll have to replace every occurrence of "C:\Java" throughout the tutorial by the desired directory.
What is Ant?
Apache Ant is a Java-based build tool.Currently, the only way to start Middlegen is from Ant. The middlegen.jar file contains an Ant task you should use to run Middlegen.
Download and install Ant
1.Surf to the Ant download page.
2.Pick the Ant binary (For this tutorial apache-ant-1.6.2 is used)
3.Unzip Ant binary to C:\Java
4.Rename apache-ant-1.6.2 to ant (C:\Java\ant)
5.Install Ant on Windows
Assume Ant is installed in c:\Java\ant\. The following sets up the environment:
6.Run ant in command prompt
Type ant, you should get a msg 'build.xml does not exist!' This means you are ready to use ANT now.
What is the relationship to Hibernate?
The Middlegen design includes a plug-in architecture which facilitates particular aspects of a target system. Existing plugins include, simple java classes, EJB, JDO and now (close to) complete support for Hibernate. The hibernate plugin focuses on the generation of the mapping configuration files. Hibernates' excellent native hbm2java tool can be used to generated the domain classes.
Download and install Middlegen-Hibernate plugin
1.Surf to Middlegen-Hibernate plugin download page
3 Unzip to C:\Java Now it is C:\Java\Middlegen-Hibernate-r5
4.Using command prompt change directory to C:\Java\Middlegen-Hibernate-r5 and type ant
5.A gui opens to show tables in hsqldb
6.Click Generate to generate metadata-mapping files
Middlegen-Hibernate plugin directory structure
The Middlegen-Hibernate plugin consists of the following directory layout:
+--- build // contains the generated source
| +--- gen-src // contains the built mapping-metadata files
+--- lib // contains necessary dependencies
+--- config // contains database mapping
| +--- database // contains various database mapping xml files
+---- middlegen-lib // contains Middlegen-Hibernate plugin jars
| +--- sql // contains SQL scripts
|--- build.xml // Ant build file
|--- build.properties // defines build properties
Configuring Middlegen-Hibernate plugin
1.On iSeries build a test Schema HMP.
2.Place jt400.jar in lib.
3.Build database mapping file as db2_as400.xml
4.Build SQL script file as airline-db2_as400.sql
5.1 Replace db2_as400.xml in doctype declaration
5.2 Remove catalog
6.Rename build.properties.sample to build.properties
7.Uncomment database.script.file and replace
Running Middlegen-Hibernate plugin
1.Open command prompt as C:\Java\Middlegen-Hibernate-r5 and type ant create-table
2.A message SQL statements executed successfully is shown.
3.Now type ant.
2.A gui is shown listing tables.
3.Click Generate to generate metadata-mapping.
4.Mapped-metadata files are generated under C:\Java\Middlegen-Hibernate-r5\build\gen-src.
DB2 UDB for AS/400 05.04.0000 V5R4m0
Hibernate Core hibernate-2.1.7c
Hibernate Extension hibernate-extensions-2.1.3
Play with Middlegen
Friday, May 2, 2008
Hibernate version : 3.2.6 GA
Implementation-Version: JTOpen 3.3
properties naming=system;libraries=QTEMP ASDB ASDBA SFG
libraries=QTEMP ASDB ASDBA SFG;translate binary=true;prompt=false;user=GUEST;
Note : properties are separated by ';'.
A list of supporting dialect
Play with iseries........!
Friday, April 25, 2008
Google Web Toolkit
ThinWire® is an LGPL open source, free for commercial use, development framework that allows you to easily build applications for the web that have responsive, expressive & interactive user interfaces without the complexity of the alternatives. While virtually any web application can be built with ThinWire®, when it comes to enterprise applications, the framework excels with its highly interactive and rich user interface components. Use ThinWire® to handle the view-layer of your Java EE (J2EE) application and you'll be able to provide an unparalleled user experience, while at the same time completing your project faster than ever.
Direct Web Remoting
DWR is Easy Ajax for Java
Open Source J2EE/Web Frameworks
Spring Framework, the leading full-stack Java/JEE application framework. Led and sustained by SpringSource, Spring delivers significant benefits for many projects, increasing development productivity and runtime performance while improving test coverage and application quality.
AppFuse is an open source project and application that uses open source tools built on the Java platform to help you develop Web applications quickly and efficiently. It was originally developed to eliminate the ramp-up time found when building new web applications for customers. At its core, AppFuse is a project skeleton, similar to the one that's created by your IDE when you click through a wizard to create a new web project.
Apache Struts is a free open-source framework for creating Java web applications.
Web applications differ from conventional websites in that web applications can create a dynamic response. Many websites deliver only static pages. A web application can interact with databases and business logic engines to customize a response.
Web applications based on JavaServer Pages sometimes commingle database code, page design code, and control flow code. In practice, we find that unless these concerns are separated, larger applications become difficult to maintain.
One way to separate concerns in a software application is to use a Model-View-Controller (MVC) architecture. The Model represents the business or database code, the View represents the page design code, and the Controller represents the navigational code. The Struts framework is designed to help developers create web applications that utilize a MVC architecture.
The framework provides three key components:
* A "request" handler provided by the application developer that is mapped to a standard URI.
* A "response" handler that transfers control to another resource which completes the response.
* A tag library that helps developers create interactive form-based applications with server pages.
The framework's architecture and tags are buzzword compliant. Struts works well with conventional REST applications and with nouveau technologies like SOAP and AJAX.
JavaServer Faces technology simplifies building user interfaces for JavaServer applications. Developers of various skill levels can quickly build web applications by: assembling reusable UI components in a page; connecting these components to an application data source; and wiring client-generated events to server-side event handlers.
Tapestry divides a web application into a set of pages, each constructed from components. This provides a consistent structure, allowing the Tapestry framework to assume responsibility for key concerns such as URL construction and dispatch, persistent state storage on the client or on the server, user input validation, localization/internationalization, and exception reporting. Developing Tapestry applications involves creating HTML templates using plain HTML, and combining the templates with small amounts of Java code using (optional) XML descriptor files. In Tapestry, you create your application in terms of objects, and the methods and properties of those objects -- and specifically not in terms of URLs and query parameters. Tapestry brings true object oriented development to Java web applications.
Open Source Persistence Frameworks
Apache Cayenne is an open source persistence framework licensed under the Apache License, providing object-relational mapping (ORM) and remoting services.With a wealth of unique and powerful features, Cayenne can address a wide range of persistence needs. Cayenne seamlessly binds one or more database schemas directly to Java objects, managing atomic commit and rollbacks, SQL generation, joins, sequences, and more. With Cayenne's Remote Object Persistence, those Java objects can even be persisted out to clients via Web Services. Or, with native XML serialization, objects can be even further persisted to non-Java clients - such as an Ajax-capable browser.
The iBATIS framework will help to significantly reduce the amount of Java code that is normally needed to access a relational database. This framework maps JavaBeans to SQL statements using a very simple XML descriptor.
Every iBATIS implementation includes these basic components...
The iBATIS Data Mapper provides a very simple and flexible means of moving data between your Java and .NET objects and a relationaldatabase. Use the full power of real SQL without a single line of JDBC or ADO.NET code!
iBATIS Data Access Objects is an abstraction layer that hides the details of your persistence solution and provides a common API to therest of your application.
PetStore is a fully functional web application based on iBATIS open source persistence layer products, including theSQL Maps and Data Access Objects frameworks.
Hibernate is a powerful, ultra-high performance object/relational persistence and query service for Java. Hibernate lets you develop persistent objects following common Java idiom - including association, inheritance, polymorphism, composition and the Java collections framework. Extremely fine-grained, richly typed object models are possible. The Hibernate Query Language, designed as a "minimal" object-oriented extension to SQL, provides an elegant bridge between the object and relational worlds.
Wednesday, April 9, 2008
PHP Version 5.2.5
Tomcat Version 5.5.25
Let's assume that your current Tomcat install can be found in c:\Tomcat5\
Download PHP and PECL
PHP is a widely-used general-purpose scripting language that is especially suited for Web development and can be embedded into HTML.
1. Surf to http://www.php.net/downloads.php and download the current version of PHP for Windows machine.
2. Download the corresponding PECL modules.
1. Create a c:\Tomcat5\php\ directory and unzip the PHP zip file in it.
2. Rename php.ini-dist, in c:\Tomcat5\php\, to php.ini
3. Extract php5servlet.dll from the PECL zip file to c:\Tomcat5\php\
4. Create a directory under c:\Tomcat5\webapps\; in our case: phptest
5. In c:\Tomcat5\webapps\phptest\, create a subdirectory: WEB-INF
6. In c:\Tomcat5\webapps\phptest\WEB-INF\,
create web.xml with the following content:
7. Rename php5servlet.dll to php5srvlt.dll.
8. Copy c:\Tomcat5\php\ php5srvlt.dll and c:\Tomcat5\php\php5ts.dll to c:\windows\system32\
9. Create a test page in c:\Tomcat5\webapps\phptest\test.php with this contents:
10. (For Tomcat 4.x copy phpsrvlt.jar c:\Tomcat4\php to c:\Tomcat4\lib)
Run PHP in Tomcat
Start Tomcat and go to http://localhost:8080/phptest/test.php