Tuesday, January 26, 2010

Java and XML


XML, XML, XML, XML. You can see it on hats and t-shirts, read about it on the cover of every
technical magazine on the planet, and hear it on the radio or the occasional Gregorian chant album. .
. . Well, maybe it hasn't gone quite that far yet, but don't be surprised if it does. XML, the
Extensible Markup Language, has seemed to take over every aspect of technical life, particularly in
the JavaTM community. An application is no longer considered an enterprise-level product if XML
isn't being used somewhere. Legacy systems are being accessed at a rate never before seen, and
companies are saving millions and even billions of dollars on system integration, all because of
three little letters. Java developers wake up with fever sweats wondering how they are going to
absorb yet another technology, and the task seems even more daunting when embarked upon; the
road to XML mastery is lined with acronyms: XML, XSL, XPath, RDF, XML Schema, DTD, PI,
XSLT, XSP, JAXPTM, SAX, DOM, and more. And there isn't a development manager in the world
who doesn't want his or her team learning about XML today!.
Download Here

Getting Started With Java


Java is an object-oriented programming language. Switching to
object-oriented programming (OOP) from other programming paradigms
can be difficult. Java focuses on creating objects (data structures or
behaviors) that can be assessed and manipulated by the program.
Like other programming languages, Java provides support for reading
and writing data to and from different input and output devices. Java uses
processes that increase the efficiency of input/output, facilitate
internationalization, and provide better support for non-UNIX platforms.
Java looks over your program as it runs and automatically deallocates
memory that is no longer required. This means you don’t have to keep
track of memory pointers or manually deallocate memory. This feature
means a program is less likely to crash and that memory can’t be
intentionally misused.
This book is intended to serve programmers who use other languages as a
general introduction to the Java programming language. It introduces the
reader to the major elements of Java programming and provides links and
suggested reading for further exploration. You may order most book titles
from Fatbrain (http://fatbrain.com/). Unlinked titles may be out of print,
but are still useful and generally available. For more extensive lists of
resources, see “Learning more about Java” in the Quick Start.Download here

Dessign Pattern



The term “design patterns” sounds a bit formal to the uninitiated and
can be somewhat off-putting when you first encounter it. But, in fact, design
patterns are just convenient ways of reusing object-oriented code between
projects and between programmers. The idea behind design patterns is
simple-- write down and catalog common interactions between objects that
programmers have frequently found useful.
The field of design patterns goes back at least to the early 1980s. At
that time, Smalltalk was the most common OO language and C++ was still in
its infancy. At that time, structured programming was a commonly-used
phrased and OO programming was not yet as widely supported. The idea of
programming frameworks was popular however, and as frameworks
developed, some of what we now called design patterns began to emerge.
One of the frequently cited frameworks was the Model-View-
Controller framework for Smalltalk [Krasner and Pope, 1988], which divided
the user interface problem into three parts. The parts were referred to as a
data model which contain the computational parts of the program, the view,
which presented the user interface, and the controller, which interacted.Download here

Data Structure & algorithm in Java


This book is about data structures and algorithms as used in computer programming.
Data structures are ways in which data is arranged in your computer's memory (or stored
on disk). Algorithms are the procedures a software program uses to manipulate the data
in these structures.
Almost every computer program, even a simple one, uses data structures and algorithms.
For example, consider a program that prints address labels. The program might use an
array containing the addresses to be printed, and a simple for loop to step through the
array, printing each address.
The array in this example is a data structure, and the for loop, used for sequential
access to the array, executes a simple algorithm. For uncomplicated programs with small
amounts of data, such a simple approach might be all you need. However, for programs
that handle even moderately large amounts of data, or that solve problems that are
slightly out of the ordinary, more sophisticated techniques are necessary. Simply knowing
the syntax of a computer language such as Java or C++ isn't enough.
This book is about what you need to know after you've learned a programming language.
The material we cover here is typically taught in colleges and universities as a second-year
course in computer science, after a student has mastered the fundamentals of
programming.Download here

Hibernate Entity Manager


The EJB3 specification recognizes the interest and the success of the transparent object/relational mapping
paradigm. The EJB3 specification standardizes the basic APIs and the metadata needed for any object/relational
persistence mechanism. Hibernate EntityManager implements the programming interfaces and lifecycle rules
as defined by the EJB3 persistence specification. Together with Hibernate Annotations, this wrapper imple-
ments a complete (and standalone) EJB3 persistence solution on top of the mature Hibernate core. You may use
a combination of all three together, annotations without EJB3 programming interfaces and lifecycle, or even
pure native Hibernate, depending on the business and technical needs of your project. You can at all times fall
back to Hibernate native APIs, or if required, even to native JDBC and SQL.download here

Hibernate Annotations


Hibernate, like all other object/relational mapping tools, requires metadata that governs the transformation of
data from one representation to the other. In Hibernate 2.x mapping metadata is most of the time declared in
XML text files. Alternatively XDoclet can be used utilizing Javadoc source code annotations together with a
compile time preprocessor.
The same kind of annotation support is now available in the standard JDK, although more powerful and with
better tools support. IntelliJ IDEA and Eclipse for example, support auto-completion and syntax highlighting of
JDK 5.0 annotations which are compiled into the bytecode and read at runtime using reflection. No external
XML files are needed.
The EJB3 specification recognizes the interest and the success of the transparent object/relational mapping
paradigm. It standardizes the basic APIs and the metadata needed for any object/relational persistence mechan-
ism. Hibernate EntityManager implements the programming interfaces and lifecycle rules as defined by the
EJB3 persistence specification and together with Hibernate Annotations offers a complete (and standalone)
EJB3 persistence solution on top of the mature Hibernate core. You may use a combination of all three togeth-
er, annotations without EJB3 programming interfaces and lifecycle, or even pure native Hibernate, depending
on the business and technical needs of your project. At all times you cann fall back to Hibernate native APIs, or
if required, even to native JDBC and SQL.
This release of Hibernate Annotations is based on the final release of the EJB 3.0 / JPA specification (aka JSR-
220 [http://jcp.org/en/jsr/detail?id=220]) and supports all its features (including the optional ones). Hibernate
specific features and extensions are also available through unstandardized, Hibernate specific annotations.
While the Hibernate feature coverage is high, some can not yet be expressed via annotations. The eventual goal
is to cover all of them. See the JIRA road map section for more informations.
If you are moving from previous Hibernate Annotations versions, please have a look at Java Persistence migra- tion guide [http://www.hibernate.org/398.html].
download here

Hibernate References Documentation


If you are new to Hibernate and Object/Relational Mapping or even Java, please follow these steps:
1. Read Chapter 1, Quickstart with Tomcat for a 30 minute tutorial, using Tomcat.
2. Read Chapter 2, Architecture to understand the environments where Hibernate can be used.
3. Have a look at the eg/ directory in the Hibernate distribution, it contains a simple standalone application.
Copy your JDBC driver to the lib/ directory and edit etc/hibernate.properties, specifying correct val-
ues for your database. From a command prompt in the distribution directory, type ant eg (using Ant), or
under Windows, type build eg.
4. Use this reference documentation as your primary source of information. Consider reading Hibernate in
Action (http://www.manning.com/bauer) if you need more help with application design or if you prefer a
step-by-step tutorial. Also visit http://caveatemptor.hibernate.org and download the example application
for Hibernate in Action.
5. FAQs are answered on the Hibernate website.
6. Third party demos, examples and tutorials are linked on the Hibernate website.
7. The Community Area on the Hibernate website is a good source for design patterns and various integra-
tion solutions (Tomcat, JBoss, Spring, Struts, EJB, etc.)here.

EJB 3 Developer Guide


Chapter 1 Introduction to EJB 3—A general overview of the Java EE architecture
including EJB container services, the JPA persistence engine, and initial installation
of the GlassFish application server.
Chapter 2 Session Beans—Creation of a session bean and its client and examples of
running it from the application client container. Exploring the program directory
structure. Packaging and deploying a session bean. A look at the stateless and
stateful session beans lifecycle.
Chapter 3 Entities—Exploring EJB 3 entities. How to package and deploy entities
and map an entity to a database table. Metadata defaults and how to override them.
Generating primary keys.
Chapter 4 Object/Relational Mapping—One-to-one, one-to-many and many-to-many
associations. Default object/relational mapping values and how to override them.
Object/relational inheritance mapping and additional annotations.
Chapter 5 JPQL (Java Persistence Query Language)—Looking at different groups of
queries including aggregate functions, queries with relationships, subqueries, queries
with parameters and named queries. JPQL joins and functions are also explained.
Chapter 6 Entity Manager—Looks in detail at the entity manager. Covers both the EJB
3 container-managed and application-managed entity managers.
Chapter 7 Transactions—ACID properties and isolation levels. Container-managed
transactions. Bean-managed transactions.
Chapter 8 Messaging—Looks at the JMS (Java Messaging Service) API. Examples of
queue producer and queue consumers. Topic producer and consumers. Message
driven beans: their activation configuration properties, lifecycles and transactions.
Chapter 9 EJB Timer Service—Examples of single and interval events. Timer interface
methods. Timers and transactions.
Chapter 10 Interceptors—Covers interceptor methods, classes and interceptor
communication as well as default interceptors.
Chapter 11 Implementing EJB 3 Web Services—An overview of web service concepts
and the web service definition language (WSDL). Creating and deploying a Java
application as a web service. Creating and deploying an EJB session bean as a web
service. Creating a web service client.Download here

Java Persistence With Hibernate


You want to start using Hibernate and Java Persistence, and you want to learn it
with a step-by-step example. You want to see both persistence APIs and how you
can benefit from native Hibernate or standardized JPA. This is what you’ll find in
this chapter: a tour through a straightforward “Hello World” application.
However, a good and complete tutorial is already publicly available in the
Hibernate reference documentation, so instead of repeating it here, we show you
more detailed instructions about Hibernate integration and configuration along
the way. If you want to start with a less elaborate tutorial that you can complete in
one hour, our advice is to consider the Hibernate reference documentation. It
takes you from a simple stand-alone Java application with Hibernate through the
most essential mapping concepts and finally demonstrates a Hibernate web appli-
cation deployed on Tomcat.

In this chapter, you’ll learn how to set up a project infrastructure for a plain
Java application that integrates Hibernate, and you’ll see many more details about
how Hibernate can be configured in such an environment. We also discuss config-
uration and integration of Hibernate in a managed environment—that is, an envi-
ronment that provides Java EE services.

As a build tool for the “Hello World” project, we introduce Ant and create
build scripts that can not only compile and run the project, but also utilize the
Hibernate Tools. Depending on your development process, you’ll use the Hiber-
nate toolset to export database schemas automatically or even to reverse-engineer
a complete application from an existing (legacy) database schema.

Like every good engineer, before you start your first real Hibernate project you
should prepare your tools and decide what your development process is going to
look like. And, depending on the process you choose, you may naturally prefer
different tools. Let’s look at this preparation phase and what your options are,
and then start a Hibernate project.
download here