Search This Blog

Saturday, 14 January 2012

Reflection API

Reflection API:-
- Working with classes and interfaces of java.lang.Reflect.
-  Java lang is default package of java. But its sub packages are not default packages.
c language is set of functions. (.h files).
c++ is set of classes and functions (.h files).
Java is set of classes and interfaces (packages).

- Reflection means mirror image to perform a mirror image operations on a given Java class or interface to gather detail of them like member variables, names, super class names and etc., we use reflection API.

- Reflection API can develop
  1. class Browsers
  2. Debuggers
  3. GUI Builders 
These are part of IDE softwares.

Class Browser:-
- Using Class Browser Software we can gather internal details about given class.
Debugging:-
- Debugging is a process of fixing the problem by tracing flow of execution. while developing this debugger software developers will use Reflection API.
GUI Builder:-
- A GUI Builder is a application which allows the programmer to develop GUI screens based on drag and drop operations.  In this application to show the properties of selected components Reflection API support is required.
- IDE softwares contain Class Browsers, Debuggers and GUI Builders. So Reflection API is very useful to develop IDE softwares in java.
Editors for Java
1. Traditional Editors
    - Notepad, wordpad,ms-dos editor for windows
    - ui , pico ,ed for linux/unix
 2. Third Party Editors/Modern Editors
    - Ecllipse developed by Ecllipse Organization
    - RAD developed by IBM
    - NetBeans developed by Jet Brains + Sun Microsystems
    - JBuilder developed by Borland

- code to get list of interfaces implemented by given class
1. Class c = Class.forName("Test");
2. Class inter[]=c.getInterfaces();
3. for(int i=0; i<inter.length;++i)
{
String iname = inter[i].getName();
System.out.println("\t"+ iname);
}

inter[]
|--------- |
|class obj | 0
|--------- |
|class obj | 1
|--------- |
|class obj | 2
|--------- |
Class Test implements x,y,z
{
// variables
// methods
}
- Reflection API programs can act as mirror devices for a given java class/interface.

Tuesday, 3 January 2012

websphere notes


Websphere

  • Type: Application Server
  • Version: 5.0
  • Vendor: IBM
  • Commercial Software
  • default portno: 9080
  • help: www.IBM.com
  • no need to set any Environment variables after installing websphere software.
  • jar file: J2EE.jar

Procedure to deploy web application in websphere application

1. Generate war file on the staging directory of  web application
   
     E:\>JspApp
              WEB-INF
                        web.xml
              first.jsp
     E:\>JspApp>jar cvf j.war .
    dot represents current directory

    Note:- keeping <!DOCTYPE> at the top of the web.xml is mandatory while deploying       web application in websphere.

2. start websphere server
  
    Start programs IBM websphereApplication Server 5.0 start the server (wait    until the screen disappears).

3. start Admin Console of websphere

    Start programs IBM websphere  Application Server 5.0  Administrative  Console  UserID (only name)  ok.

4. Deploy the web application by selecting war file
    Sando (Admin Console)
             Applications
                         install new Application

    On right side

Local path: E:\JspApp\two.war
Context Root: Sando (mandatory)
 next, next, next,  next,  next  finish.
 save to master configuration  save.

5. keep the deployed web application in Running mode
           
             Applications
                         Enterprise Applications

     On right side

     Tick right mark
    Two.war click on Start tab.

6. Test the web application

   Open browser window http://localhost:9080/Sando/first.jsp