Archive for May, 2008

What is an Application Server ?

Posted in J2EE with tags , on May 23, 2008 by javaforweb

Application Servers provide the underlying core functionality necessary for the development and deployment of business-driven application.

Application Servers can potentially service tens of thousands of concurrent users in real-time. Application Servers are mainly used in Distributed Environment such as Stock Trading System or Banking application.


In Application Server a new layer of functions and services between Web servers and underlying applications and databases is added.

Application Server layer

An Application Server speeds application development and relieves developers of the effort and expense of creating these crucial services on their own


      Load balancing

Fault tolerance

Web Services

Legacy integration

Transaction management





Database connectivity

Resource pooling

Development, testing, and packaging facilities


J2EE based Application Servers


l      BEA WebLogic Java Application Server

l      IBM WebSphere Java Application Server ( WSAD )

l      Oracle 9i Java Application Server

l      Sun ONE Java Application Server (iPlanet)

l      HP Application Server (HP-AS)  (Bluestone)

l      JBoss Application Server

l      GlassFish Application Server for JavaEE 5

l      Enhydra Application Server


J2EE Components


l      Java Servlets & Java Server Pages (JSP)

l      Enterprise Java Beans (EJB)

l      Java Transaction API (JTA)

l      Java Transaction Service (JTS)

l      Java API for XML Parsing (JAXP)

l      Java Messaging Service (JMS)

l      Message Driven Beans (MDB)

l      Remote Method Invocation (RMI)

l      Java Database Connection 2 (JDBC2)

l      Java Connector Architecture (JCA)

l      Java Naming and Directory Interface (JNDI)

l      JavaBeans Activation Framework (JAF)


For Java EE 5 components visit :


An application server exposes business logic to client applications through various protocols, possibly including HTTP.


     For Java tutorials visit


IBM Rational® ROSE Productline and Description

Posted in IBM with tags , , on May 22, 2008 by javaforweb

In this Post i am trying to explore IBM Rational Family of Product with thier potential descriptions. IBM has got a very RICH Family of rational Products that can be used in all the Software Processes. Lets have a look on these tools starting from Rational Rose (A Masterpiece)

IBM Rational® Rose family of products is what put Rational on the map and helped make Unified Modeling Language (UML) a standard. Design software using UML v1.4 with the market leading Rational Rose family of visual modeling design tools.

NOTE :- For UML 2.0 Based Visual Modeling and Design   IBM® Rational® Software Modeler is there !!

Product Edition








IBM® Rational Rose® Data Modeler offers a sophisticated visual modeling environment for  database application development. Accelerate your processes by connecting the database designers to the rest of the development team through a common tool and the Unified Modeling Language™ (UML™) v1.4.

IBM Rational® Rose® Developer for Java™  is a full visual modeling tool based on UML™1.4

Jump-start your Java and J2EE™ 1.4 applications with code generated from visual models. IBM Rational Rose Developer for Java is our classic Universal Modeling Language™ (UML).

IBM® Rational Rose® Developer for UNIX® is a full visual-modeling environment for UNIX and Linux platforms.

It is based on the Unified Modeling Language and includes code-generation support for models that will be implemented in Java, C++ and CORBA.

IBM Rational® Rose® Developer for Visual Studio® .Net is a full visual-modeling environment based on UML™

Jump-start the development process and support round-trip engineering generating Visual C++® or Visual Basic® code from your models.

IBM® Rational® Rose® Enterprise ( All in One Masterpiece ) provides a common modeling language for enabling faster creation of quality software.

Jump-start your Ada, ANSI C++, C++, CORBA, Java™, J2EE™, Visual C++® and Visual Basic® applications with code generated from visual models. Includes Unified Modeling Language™ (UML™) support and is one of the most comprehensive products in the Rational Rose family. Supports Analysis, ANSI C++, Rose J and Visual C++ patterns, Enterprise JavaBeans™ 2.0, and forward and/or reverse engineering for some of the most common Java 1.5 constructs.Integrates with other IBM Rational lifecycle development tools as well as any SCC-compliant version control system, including IBM Rational ClearCase®.Includes a Web Modeling Add-In, which provides visualization, modeling and tools for developing Web applications. It provides UML modeling for database designs, with the ability to represent the integration of data and application requirements through logical and physical designs. Creates XML document type definitions (DTD) for use in your application.

IBM® Rational® Rose® Modeler is your choice if your needs are for UML modeling software.

Maximize your design skills and software architectures with full support of Unified Modeling Language™ (UML™) v1.4 for creation of software applications.Provides a common modeling language and environment for faster creation of quality software. Offers analysis patterns support based on “Design Patterns: Elements of Reusable Object-Oriented Software”. It Integrates with other IBM Rational lifecycle development tools. Can integrate with any SCC-compliant version control system, including IBM Rational ClearCase®.

RATIONAL ROSE for Model Driven Development ( MDD ) , IBM® Rational® Rose® Technical Developer is a robust Model-Driven Development (MDD) solution for system architecture design. Overcome the challenges of complex systems development through a common tool based on the Unified Modeling Language™ (UML™) v1.4. IBM Rational Rose.

There is much more that IBM has got for Rapid and Robust Software Develoment. I’ll try to cover that in my next coming posts. Keep Visiting this Blog!!

For Java Tutorials visit :

Google MAPS and Google Mapplets

Posted in Google, Web 2.0 with tags , , on May 21, 2008 by javaforweb

With the release of Google Mapplets, developers can nowcreate map-based applications (or port their current Google Maps applications)and expose them to every user of Google Maps at

Google handles the hosting and bandwidth of your application and provides a

directory of Mapplets so that users can find your application.


What’s a Mapplet?


Mapplets are small web applications that run within Google Maps. They are a

type of Google Gadget—the framework that allows developers to create small

web applications that can run within iGoogle, Google Maps, Orkut, or any web

page outside Google.Mapplets use the basic concepts and APIs of Google

Gadgets, though they are specifically used within the Google Maps realm.


In its basic form, a Mapplet is an XML file that contains the HTML and

JavaScript that make up your application. Mapplets have two components:


à  A web application that is displayed on the Google Maps site at This application is typically displayed in the lowerleft

corner of the page on


à  JavaScript that lets you control the map on, retrieve

external data, or even store and retrieve user preferences.


After you create your Mapplet, it’s up to you to host the Mapplet XML file

containing your HTML and JavaScript. When a user installs your Mapplet,

Google will grab the Mapplet XML file from your server and display it within an

<iframe> element on (An <iframe> is an HTML element

that is used to embed HTML from another web site in a web page.) In this case,

Google uses an <iframe> element to embed your Mapplet in


Google will cache your Mapplet source and serve it from its own servers at


This is done for a few reasons:


à  To restrict your Mapplet’s JavaScript from doing anything harmful such as

accessing a user’s cookies on


à  To reduce the load on your site from the potential high number of users you’ll



Let’s take a look at a live Mapplet

Google Map Screen


Open your browser to Click the My Maps tab, and you will see a list of

Featured Content along with any maps you have created. Select the one about gasprices,

and you’ll see a Mapplet in action.

Getting Started with Mapplets


Installing the Developer Tools


Using either Firefox, Safari, or Internet Explorer (version 6 or newer), go to, and sign in using your Google account. First

install the three developer modules that Google has created for Mapplet

development: the Mapplet Scratch Pad, the Developer Mapplet, and the API

Reference Mapplet. You can find these Mapplets in the Developer Tools section

of the Google Maps Directory



à  The Mapplet Scratch Pad lets you develop Mapplets right in You’ll be able to cut and paste the following

code sample in the scratch pad and immediately see the application.

à  The Developer Mapplet places a Reload link at the top of each Mapplet that

you have installed. The Reload link automatically reloads the source code for

the Mapplet you are viewing (or developing). Since Google caches Mapplet

source code, you’ll need this for developing and testing Mapplets. Trust me

on this one!

à  The API Reference Mapplet is a simple application that displays all the

possible Mapplets API calls.


Once you have all three developer Mapplets installed, select the Mapplet Scratch



Your page should now look like

 Map Scratch Pad


 Creating Your First Mapplet


For your first Mapplet, you’re not even going to “touch” a map.


Let’s start by creating a simple “shell” Mapplet without any map API calls.

à  Make sure you are at and that you’ve selected

the Mapplet Scratch Pad. You should see the Mapplet Scratch Pad in the

lower-left corner of the page.

à  Cut the XML from below, and paste it into the Mapplet Scratch Pad.

à Click the Preview button in the Mapplet Scratch Pad. Figure shows the

“Hello World” Mapplet that you should see.


“Hello World” Mapplet


<?xml version=”1.0″ encoding=”UTF-8″?>


<ModulePrefs title=”Hello World”

description=”My First Mapplet”

author=”Ashutosh Sharma”




<Content type=”html”><![CDATA[

<h2>Hello From Ashutosh Sharma!!</h2>

<h4>Java Tutorials : Visit

<a href>






Adding a Map


So, the previous example showed the shell of a Google Mapplet/Gadget. Now

let’s do some mapping. In this example, you’ll create a map and add a marker

indicating the location of the Empire State Building. You’ll also center the map

on this point.


1. In the Mapplet Scratch Pad, click the “Go back to editor” button to display

the scratch pad editor.

2. Cut the XML from below, and paste it into the Mapplet Scratch Pad.

3. Click the Preview button in the Mapplet Scratch Pad.


Create a Map and Add a Marker to the Map


<?xml version=”1.0″ encoding=”UTF-8″?>


<ModulePrefs title=”INDIA GATE, DELHI”

description=”Creating a Simple Map and Marker”

author=”Ashutosh Sharma”



<Require feature=”sharedmap”/>


<Content type=”html”><![CDATA[

<h2>India Gate</h2>


// Create a map and center it over the INDIA GATE

var map = new GMap2();

var point = new GLatLng(28.61262650293896, 77.23015954511007);


map.setCenter(point, 17);

// Add a marker right on the INDIA GATE

var marker = new GMarker(point);







 India Gate New Delhi

Java Tutorials by Ashutosh Sharma :


Web 2.0 based Website Links

Posted in Web 2.0 with tags on May 20, 2008 by javaforweb

Winamp Media Player Plugin

It turns Winamp into a web-accessible, sharing, streaming, searching, remote-controlled musical marvel, allowing you to access Winamp over the network using a web browser and control it or stream music to or from it

Ajax New Blog

Ajaxian in Ajax Resources – One of the first blogs in ajax.Daily updates, insightful commentary and coverage of Ajax development around the world.

Social Movie Catalog

Search Engine

Ajax Based Chat Room

Ajchat is a simple ajax chat system where you can add chatrooms to your website.

Search Engine

Online Storage

Allmydata provides online backup, storage, and sharing.

Play and Rate games

Arcaplay is reinventing free online gaming. Say hello to social arcading.

India based Job Search Engine

Jobs in India, Mumbai, Delhi, Bangalore, Chennai, Hyderabad, Pune from the web.

Audio Search Engine

Short audio samples are also available to listen to the individual hits. The results can be accessed online at all times.

Java Tutorials by Ashutosh Sharma

Singletons in Java

Posted in Design Patterns In Java, java with tags on May 19, 2008 by javaforweb

A singleton is an object that cannot be instantiated. At first, that might seem counterintuitive – after all, we need an instance of an object before we can use it. Well yes a singleton can be created, but it can’t be instantiated by developers – meaning that the singleton class has control over how it is created. The restriction on the singleton is that there can be only one instance of a singleton created by the Java Virtual Machine (JVM) – by prevent direct instantiation we can ensure that developers don’t create a second copy.

So why would this be useful? Often in designing a system, we want to control how an object is used, and prevent others (ourselves included) from making copies of it or creating new instances. For example, a central configuration object that stores setup information should have one and one only instance – a global copy accessible from any part of the application, including any threads that are running. Creating a new configuration object and using it would be fairly useless, as other parts of the application might be looking at the old configuration object, and changes to application settings wouldn’t always be acted upon. I’m sure you can think of a other situations where a singleton would be useful – perhaps you’ve even used one before without giving it a name. It’s a common enough design criteria (not used everyday, but you’ll come across it from time to time). The singleton pattern can be applied in any language, but since we’re all Java programmers here (if you’re not, shame!) let’s look at how to implement the pattern using Java.

Preventing direct instantiation

We all know how objects are instantiated right? Maybe not everyone? Let’s go through a quick refresher.

Objects are instantiated by using the new keyword. The new keyword allows you to create a new instance of an object, and to specify parameters to the class’s constructor. You can specify no parameters, in which case the blank constructor (also known as the default constructor) is invoked. Constructors can have access modifiers, like public and private, which allow you to control which classes have access to a constructor. So to prevent direct instantiation, we create a private default constructor, so that other classes can’t create a new instance.

We’ll start with the class definition, for a SingletonObject class. Next, we provide a default constructor that is marked as private. No actual code needs to be written, but you’re free to add some initialization code if you’d like. 

public class SingletonObject
	private SingletonObject()
		// no code req'd

So far so good. But unless we add some further code, there’ll be absolutely no way to use the class. We want to prevent direct instantiation, but we still need to allow a way to get a reference to an instance of the singleton object.

Getting an instance of the singleton

We need to provide an accessor method, that returns an instance of the SingletonObject class but doesn’t allow more than one copy to be accessed. We can manually instantiate an object, but we need to keep a reference to the singleton so that subsequent calls to the accessor method can return the singleton (rather than creating a new one). To do this, provide a public static method called getSingletonObject(), and store a copy of the singleton in a private member variable.

public class SingletonObject
    private SingletonObject()
        // no code req'd

    public static SingletonObject getSingletonObject()
      if (ref == null)
          // it's ok, we can call this constructor
          ref = new SingletonObject();
      return ref;

    private static SingletonObject ref;

So far, so good. When first called, the getSingletonObject() method creates a singleton instance, assigns it to a member variable, and returns the singleton. Subsequent calls will return the same singleton, and all is well with the world.

Preventing thread problems with your singleton

We need to make sure that threads calling the getSingletonObject() method don’t cause problems, so it’s advisable to mark the method as synchronized. This prevents two threads from calling the getSingletonObject() method at the same time. If one thread entered the method just after the other, you could end up calling the SingletonObject constructor twice and returning different values. To change the method, just add the synchronized keyword as follows to the method declaration :-

public static synchronized
	 SingletonObject getSingletonObject()

Are we finished yet?

There, finished. A singleton object that guarantees one instance of the class, and never more than one. Right? Well…. not quite. Where there’s a will, there’s a way – it is still possible to evade all our defensive programming and create more than one instance of the singleton class defined above. Here’s where most articles on singletons fall down, because they forget about cloning. Examine the following code snippet, which clones a singleton object.

public class Clone
	public static void main(String args[])
	  throws Exception
	  // Get a singleton
	  SingletonObject obj = 

	  // Buahahaha. Let's clone the object
	  SingletonObject clone = 
		(SingletonObject) obj.clone();

Okay, we’re cheating a little here. There isn’t a clone() method defined in SingletonObject, but there is in the java.lang.Object class which it is inherited from. By default, the clone() method is marked as protected, but if your SingletonObject extends another class that does support cloning, it is possible to violate the design principles of the singleton.  So, to be absolutely positively 100% certain that a singleton really is a singleton, we must add a clone() method of our own, and throw a CloneNotSupportedException if anyone dares try!

Here’s the final source code for a SingletonObject, which you can use as a template for your own singletons.

public class SingletonObject
  private SingletonObject()
    // no code req'd

  public static SingletonObject getSingletonObject()
    if (ref == null)
        // it's ok, we can call this constructor
        ref = new SingletonObject();		
    return ref;

  public Object clone()
	throws CloneNotSupportedException
    throw new CloneNotSupportedException(); 
    // that'll teach 'em

  private static SingletonObject ref;
Java Tutorials by Ashutosh Sharma, pls visit :

Final Class in Java

Posted in java with tags on May 19, 2008 by javaforweb

In Java, a class organization such as:

        class A {}

        class B extends A {}

results in a superclass (A) and a subclass (B). References to B objects may be assigned to A references, and if an A reference “really” refers to a B, then B’s methods will be called in preference to A’s. All of this is a standard part of the object-oriented programming paradigm offered by Java.

But there is a way to modify this type of organization, by declaring a class to be final. If I say:

        final class A {}

then that means that A cannot be further extended or subclassed.

This feature has a couple of big implications. One is that it allows control over a class, so that no one can subclass the class and possibly introduce anomalous behavior. For example, java.lang.String is a final class. This means, for example, that I can’t subclass String and provide my own length() method that does something very different from returning the string length.

There is also a big performance issue with final classes. If a class is final, then all of its methods are implicitly final as well, that is, the method is guaranteed not be overridden in any subclass. A Java compiler may be able to inline a final method. For example, this program:

        final class A {
                private int type;
                public int getType() {return type;}

        public class test {
                public static void main(String args[])
                        int N = 5000000;
                        int i = N;
                        int t = 0;
                        A aref = new A();
                        while (i-- > 0)
                                t = aref.getType();

runs about twice as fast when the class is declared final.

Of course, much of the time it’s desirable to use the superclass / subclass paradigm to the full, and not worry about wringing out the last bit of speed. But sometimes you have heavily used methods that you’d like to have expanded inline, and a final class is one way of achieving that.

Java Tutorials by Ashutosh Sharma :

pls visit

Web 2.0 based Wesite Links

Posted in Web 2.0 with tags on May 18, 2008 by javaforweb

1000tags                   tag advertising

14dayz                          online time tracker

24sevenoffice     web based crm/erp solutions

3bubbles                    real time chat for blogs

43people                    social meeting people online                online storage

8by1                                  social wishing

9cays                               group mail                                                mobile applications                                             social bookmarking software                                               job search engine                                     royalty free stock photography search                                            web operating system                                              large file transfer                                                 social video sharing                                                        social shopping service                                                   command line search                                      social networking                                     box office ticket selling service for college-based groups                                      designer apparel / merchandise                                     search engine for professionals                                  coming soon!                                       social networking site                                    real estate property value estimates                                  open-source enterprise messaging                                   social file sharing service                                 social local business recommendation service                          social video sharing                                open source backup/recover                             group chatting service                        create web applications                         email newsletter management                         Search business listings directory                     tag-based advertising affiliate network               home photo sharing                         coming soon!            photo sharing site     social products trading service        social events sharing