Saturday, November 22, 2014

Introduction to Java Beans and What is EJB ?


What is Java Beans ?

  • A Java Bean is a reusable software component (actually, a Java class) that can be manipulated visually in a builder tool
  • Java Beans are just ordinary Java classes that follow certain conventions - you don't need special tools to create them
  • It is useful to have some tools to help assemble and configure a Bean-based application
  • Examples of "builder tools":
    • BeanBox (part of Sun's basic Beans Development Kit (BDK) - available free from java.sun.com)
    • Sun Java Workshop
    • IBM VisualAge for Java
    • Symantec Visual Cafe
    • Borland JBuilder 

    There are two primary conventions that must be followed in creating Java Bean classes:
    • each "property" of the Java Bean class is implemented by defining two public functions (a "get" function and a "set" function)
    • the "operations" of the Java Bean class are the other public functions defined in the class 


    How to Create a Java Bean ?

    • Design an ordinary Java class: decide what properties and public operations it will support
    • Make sure that each property has a "get" and "set" operation in the public interface of the Java Bean class
    • If the class is a "visual Bean" ( Means Made in GUI Interface in BDK ), then it should probably be a derived class of one of the AWT classes (probably Component or Container)
    • A Java Bean may also use some other helper classes
    • You can bundle the ".class" files for the main Java Bean class and all of the helper classes into a "Java Archive" file (JAR file) 

    What is EJB (Enterprise Java Beans) ?

    • EJB stands for Enterprise Java Beans. EJB is an essential part of a J2EE platform. J2EE platform have component based architecture to provide multi-tiered, distributed and highly transactional features to enterprise level applications.
    • EJB provides an architecture to develop and deploy component based enterprise applications considering robustness, high scalability and high performance.
    •  An EJB application can be deployed on any of the application server compliant with J2EE 1.3 standard specification. 

    What are The Benefits Using EJB ?

    • Simplified development of large scale enterprise level application.
    • Application Server/ EJB container provides most of the system level services like transaction handling, logging, load balancing, persistence mechanism, exception handling and so on. Developer has to focus only on business logic of the application.
    • EJB container manages life cycle of ejb instances thus developer needs not to worry about when to create/delete ejb objects.


 How to Download BDK (Beans Development Kit) ? 

 The BDK is delivered separately from the JDK. You can download the BDK (outside of the tutorial) freely from the JavaBeans web site.This site contains instructions for installing the BDK on your system. Here is a general description of the BDK files and directories:
  • README.html contains an entry point to the BDK documentation
  • LICENSE.html contains the BDK license agreement
  • GNUmakefile and Makefile are Unix and Windows makefiles (.gmk and .mk suffixes) for building the demos and the BeanBox, and for running the BeanBox
  • beans/apis contains
    • a java directory containing JavaBeans source files
    • a sun directory containing property editor source files
  • beans/beanbox contains
    • makefiles for building the BeanBox
    • scripts for running the BeanBox
    • a classes directory containing the BeanBox class files
    • a lib directory containing a BeanBox support jar file used by MakeApplet's produced code
    • sun and sunw directories containing BeanBox source (.java) files
    • a tmp directory containing automatically generated event adapter source and class files, .ser files, and applet files automatically generated by MakeApplet
  • beans/demos contains
    • makefiles for building the demo Beans
    • an HTML directory containing an applet wrapper demonstration that must be run in appletviewer, HotJava, or JDK1.1-compliant browsers
    • a sunw directory containing
      • a wrapper directory containing a Bean applet wrapper
      • a demos directory containing demo source file
  • beans/doc contains
    • demos documentation
    • a javadoc directory containing JavaBeans and JavaBeans-related class and interface documentation
    • miscellaneous documentation
  • beans/jars contains jar files for demo Beans


For Further Reading,
JAVA

0 comments:

Post a Comment