Tuesday, September 15, 2009

WHAT'S NEW IN JAVA

JAVAFX

What is JavaFx

JavaFX is a software platform for creating and delivering rich Internet applications that can run across wide variety of connected devices. The current release (JavaFX 1.2, June 2009) enables building applications for desktop, browser and mobile phones. TV set-top boxes, gaming consoles, Blu-ray players and other platforms are planned

Over View

JavaFX is an expressive client platform for creating and delivering rich Internet experiences across all screens of your life. It combines the best capabilities of the Java platform with comprehensive, immersive media functionality into an intuitive and comprehensive, one-stop development environment.

Features


* Provides a unified development and deployment model for building rich client applications

* Enables you to easily integrate audio and video, graphics, rich text, and Web services

* Allows creative developers to program in a visual context

* Provides tools to build and deliver rich Internet applications for desktop, mobile, TV, and other consumer platforms

* Enables unprecedented collaboration between designers and developers

* Allows designers and Java developers to easily leverage the best of today's advanced enterprise software and rich Internet applications

Technology

JavaFX provides a productive development environment for web developers, mashup authors, and Java developers to quickly and easily build the next generation of rich internet applications (RIAs). With JavaFX, designers and developers can collaborate on building high-impact RIAs. Designers gain a broad set of tools to complete the designer/developer workflow, and developers have a simple, declarative scripting language with the right set of tools.

Latest Version

Java fx1.2 SDK
Current Release
1. The Java FX SDK: Java FX compiler and runtime tools. Graphics, media web services, and rich text libraries

2. Net Beans IDE for JavaFX: Net Beans with drag-and-drop palette to add objects with transformations, effects and animations plus set of samples and best practices. For Eclipse users there is a community-supported plugin hosted on Project Kenai

3. Tools and plug-in for creative tools (a.k.a. Production Suite): Plugins for Adobe Photoshop and Adobe Illustrator that can export graphics assets to JavaFX Script code, tools to convert SVG graphics into JavaFX Script code and preview assets converted to JavaFX from other tools.

Technical highlights

Common profile. JavaFX is based on the concept of a Common profile that is intended to span across all devices supported by JavaFX. This approach makes it possible for developers to use a common programming model while building an application targeted for both desktop and mobile devices and to share much of the code, graphics assets and content between desktop and mobile versions. To address the need for tuning applications for the needs of specific class of devices, the JavaFX 1.1 platform includes APIs that are desktop or mobile-specific. For example JavaFX Desktop profile includes Swing and advanced visual effects.
Drag-to-Install. From the point of view of the end user Drag-to-Install allows them to drag a JavaFX widget or application residing in a website within the browser window and drop it onto their desktop. The application will not lose its state or context even after the browser is closed. An application can also be re-launched by clicking on a shortcut that gets automatically created on the user's desktop. This behavior is enabled out-of-the-box by the Java applet mechanism and is leveraged by JavaFX from the underlying Java layer. Sun touts Drag-to-Install as opening up of a new distribution model and allowing developers to break away from the browser.
Integrating graphics created with third-party tools. JavaFX includes a set of plug-ins for Adobe Photoshop and Illustrator that enable advanced graphics to be integrated directly into JavaFX applications. The plug-ins generate JavaFX Script code that preserves layers and structure of the graphics. Developers can then easily add animation or effects to the static graphics imported. There is also an SVG graphics converter tool (a.k.a. Media Factory) that allows for importing graphics and previewing assets after the conversion to JavaFX format.

JavaFX 1.1

JavaFX for mobile development was finally made available as part of the JavaFX 1.1 release announced officially on February 12 2009.

JavaFX 1.2

JavaFX 1.2 was released at JavaOne on June 2, 2009. This release introduced [3]:
* Full support for Linux and Solaris,
* Built-in controls and layouts,
* Skinnable CSS controls,
* Built-in chart widgets,
* JavaFX I/O management, masking differences between desktop and mobile devices,
* Speed improvements.


By - Ravi

Please find more topics under JASe Archive!!!


PRODUCT AND TECHNOLOGY RELEASES

IBM Real Time Application Execution Optimizer for Java

IBM Real Time Application Execution Optimizer for Java helps to optimize and verify a compiled Java application, preparing the application for deployment in specific environments. It is a command line tool that can operate on any compiled Java application, whether standard edition, micro-edition, or real-time.
The tool provides the following functions:

•Escape analysis of objects per method invocation
•Control flow analysis that splits an application into archives according to thread accessibility
•Control flow analysis that detects potental occurrences of real-time java runtime errors MemoryAccessError, IllegalAssignmentError, IllegalThreadStateException
•Control flow analysis that determines entry points into an application
•Addition of stackmaps to Java class files
•Verification of Java class files
•Auto-generation of classes that will load and initialize all other classes within the same archive
•Specialized packaging of Java applications into deployable archives by packaging all referenced classes from a dual class path
•Removal of unwanted attributes from Java class files
Working Principle

IBM Real Time Application Execution Optimizer for Java has many features. It loads the classes and resources of an application, analyzes or modifies them, then it writes them to disk along with any requested analysis files.
While loading the application, all classes needed for deployment of the application are identified and loaded. Also identified are all unresolved references. An unresolved reference is a class, method or field that cannot be found. Each class is checked for all possible class loading, resolution, and verification errors. This can be helpful to verify classes that are not produced by standard compilers and to ensure no application components are missing.
The tool separates application classes into the following categories:

• NoHeapRealtimeThread (NHRT) accessible
• RealtimeThread accessible
• Regular thread accessible
• Inaccessible: classes not accessible to any thread.

Once separated, the tool will package these class groups into separate archives for specialized deployment when the classes are written to disk. It will package resources into an additional archive.
While analyzing the control flow of the application, the tool identifies all entry points into the application, which are the classes, methods or fields that can be accessed from outside the application. For example, it will detect methods that can be invoked in application classes from external classes because they override external methods.
It verifies the integrity of real-time Java memory usage in the application, by detecting the potential run-time errors MemoryAccessError, IllegalAssignmentError and IllegalThreadStateException which are common errors that are difficult to eliminate when developing real-time Java.
Escape analysis is used by the tool to determine the persistent memory characteristics of allocated objects within the application on a per-invocation basis. For each method, an escape analysis determines whether the objects created by invocations of the method can persist. This helps identify memory requirements for the heap, for scopes, and for other memory areas in use.
While writing classes, to disk, the tool can remove unwanted class file attributes (such as attributes needed only for debugging), and adds stackmaps to classes. This can assist with run-time memory consumption constraints.
The tool can add to each written archive an auto-loader class that will load and initialize all other classes within the same archive, in order to trigger early class initialization for an application.


By - Sankarasivan


Java Server Faces

Java Server Faces technology is a framework for building user interfaces for web applications.

Java Server Faces technology includes:

Java APIs to represent UI components, manage state, handle events, and validate input. The API has support for internationalization and accessibility.

Two JSP custom tag libraries for expressing user interface (UI) components within a JSP page, and for wiring components to server-side objects. Page authors can easily add UI components to their pages.

Java Server Faces technology is based on the Model View Controller (MVC) architecture for separating logic from presentation, so if you have been practicing this, you'll feel at home with JSF.
A JSF application is just like any other Java technology-based web application; it runs in a Java Servlet container, and contains:

JavaBeans components (or model objects) containing application-specific functionality and data

Event listeners -- JSP pages
Server-side helper classes
A custom tag library for rendering UI components
A custom tag library for representing event handlers and validators
UI components represented as stateful objects on the server
Validators, event handlers, and navigation handlers.
Application configuration resource file for configuring application resources


How to Create a Java Server Faces (JSF) Development Environment w Apache Tomcat + Suns JDK



By - Feizal

Please find more topics under JASe Archive!!!

TIPS AND TRICKS

Comparing Constant Strings with String Variables

To avoid problems, you should never compare a string variable with a string constant, because string variables may have a null value, in which case your code will throw a NullPointerException. Here's an example:

String strName = null;
strName = getName(); //some call which retrives name from DB
if(strName.equals("Ritesh Patel")) {
// some processing.
}
The preceding example might raise an exception if the result of the getName() call returns null. Instead, to be safe, always make the comparison the other way around—by comparing the string constant with the string variable:

String strName = null;
strName = getName();
if("Ritesh Patel".equals(strName)) {
// some processing.
}
Following this rule will help you avoid unnecessary NullPointerExceptions and abnormal program termination.

By - Bavanandan

List of J2EE Patterns Catalog

Below is the list of available J2EE Patterns and their description

Business Delegate
Reduce coupling between Web and Enterprise JavaBeans TM tiers

Composite Entity
Model a network of related business entities

Composite View
Separately manage layout and content of multiple composed views

Data Access Object (DAO)
Abstract and encapsulate data access mechanisms

Fast Lane Reader
Improve read performance of tabular data

Front Controller
Centralize application request processing

Intercepting Filter
Pre- and post-process application requests

Model-View-Controller
Decouple data representation, application behavior, and presentation

Service Locator
Simplify client access to enterprise business services

Session Facade
Coordinate operations between multiple business objects in a workflow

Transfer Object
Transfer business data between tiers

Value List Handler
Efficiently iterate a virtual list

View Helper
Simplify access to model state and data access logic


By - Feizal

Java Design Patterns

Abstract: “Pattern” as the name suggests, means series of events occurring in a definite order. The patterns can be found in Java and J2ee technologies also. Many a times, we find that there is a particular way of tackling a problem. This way is easy and has been used many times successfully by a number of people earlier also. This method becomes a pattern.

Creational Patterns

There are five types of Creational Patterns.

1. Factory Pattern
2. Abstract Factory Pattern
3. Builder Pattern
4. Prototype Pattern
5. Singleton Pattern

Structural Patterns

Structural Patterns describe how objects and classes can be combined to form larger structures. The difference between class patterns and object patterns is that class patterns describe abstraction with the help of inheritance and how it can be used to provide more useful program interface. Object patterns, on other hand, describe how objects can be associated and composed to form larger, more complex structures.
There are seven structural patterns described. They are as follows:
Patterns.
1. Adapter Pattern
2. Bridge Pattern
3. Composite Pattern
4. Decorator Pattern
5. Facade Pattern
6. Flyweight Pattern
7. Proxy Pattern
Behavioral Patterns

Behavioral patterns are those which are concerned with interactions between the objects. The interactions between the objects should be such that they are talking to each other and still are loosely coupled. The loose coupling is the key to n-tier architectures. In this, the implementation and the client should be loosely coupled in order to avoid hard-coding and dependencies.
The behavioral patterns are:

1. Chain of Resposibility Pattern
2. Command Pattern
3. Interpreter Pattern
4. Iterator Pattern
5. Mediator Pattern
6. Momento Pattern
7. Observer Pattern
8. State Pattern
9. Strategy Pattern
10. Template Pattern
11. Visitor Pattern

By - Amaresh

Please find more topics under JASe Archive!!!