Download Constructing Software For Service Oriented Architecture

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts
no text concepts found
Transcript
JAVA Components
Seminar of “Component Based Software Engineering” course
By : Z.Varamini
University of Science and Technology of Mazandaran,Babol
January 7,2010
Outline
 Introduction to Java
 From Java to Java 2
 Java 2 platforms
 Java Components

Applet,JavaBeans,Enterprise JavaBeans
JAVA Components
2/22
JAVA
 Released in alpha-form in 1995 by Sun
 Originality:Concepts of Applets
 Java become common used by 1996
JAVA Components
3/22
Java 2
 Introduced in late 1998
 Relegates applets to a marginal side role
 Introduced the notion of platform editions
JAVA Components
4/22
Java 2 Platforms
 J2SE:Java 2 Platform , Standard Edition
 Use for Standard Programming
 J2EE:Java 2 Platform ,Enterprise Edition
 Released end 1999
 The Flagship platform edition
 The most Successful
 Programming for Enterprise Systems
 J2ME:Java 2 Platform , Micro Edition
 Use for small and embeded device
 It was Successful in the mobile phone sector
JAVA Components
5/22
Java-Components
 Java component model :
o Applet
o JavaBeans
o Enterprise JavaBeans
o Servlets
o Application client components
JAVA Components
J2SE
J2EE
6/22
Applet-Policy
 Applet ,Is a software component that runs in the
context of another program, for example a web
browser
 With Goal of adding Animation to Web Pages
 Sun's Hot Java browser,the first browser that supports
Applet
 Netscape and Microsoft Internet Explorer,Then
supports Applet when included a Java virtual machine
JAVA Components
7/22
Problems In Netscape
and IE
 They didn't keep up with more modern versions of Java
o
To overcome this problem, Sun released a tool called
the "Java Plug-in"
o it seamlessly plugs in to both Netscape and
Internet Explorer and allows both browsers to
execute Java applets by using an external Java
runtime environment that Sun supplies
JAVA Components
8/22
Life Cycle of an Applet
 Four Method Controls An Applet
Browser,Load its page
Init()
Start()
User returns to
the page
user moves off the
page
Stop()
Browser shuts down
normally
destroy()
JAVA Components
9/22
JavaBeans- What is ?
 JavaBeans are reusable software
components for Java that can be manipulated visually
in a builder tool.
 Practically, they are classes written in the Java
programming language conforming to a particular
convention.
 They are used to encapsulate many objects into a
single object (the bean)
 A JavaBean is a Java Object that is serializable, has
a nullaryconstructor, and allows access to properties
using getter and setter methods.
JAVA Components
10/22
JavaBeans- Solution to ..
 Enables Software developers to design
and create reusable pieces of software
that easily integrate
o
o
o
with each other
with applications
with development tools
JAVA Components
11/22
JavaBeans – Main aspects
 Events
 Properties
 Introspection
 Customization
 Persistence
JAVA Components
12/22
Enterprise JavaBeanse (EJB)
 Provide a framework for component that may be
“plugged in” to a server
 Enterprise JavaBeans is totally different of
JavaBeans,Except that it uses some similar
concepts
JAVA Components
13/22
EJB Vs JavaBean
 Components built in the JavaBeans
specification are intraprocess components that stays in
one address space and are typically used for Graphical
User Interface (GUI) as visual widgets like buttons,
tables, HTML viewers, etc
 Components built in the EJB specification are
interprocess components that stays in multiple
address spaces as distributed object.
 EJBs are not GUI components rather they sit behind the
GUI's and perform all the hardcore business logic. GUIs
like thick Clients, web-based Clients and web services
are some of the Clients that can make connection to
14/22
JAVA Components
EJBs
Enterprise JavaBeanse-Goals
 Easy for developers to creat applications
 Standard way for client/server applications
 Compatible with and uses other java APIS
 EJB can interoperate with non-java apps
 EJB is Compatible with CORBA
JAVA Components
15/22
What constitutes an EJB?
 EJB Object
Client never invokes the method on an actual
bean instance. All invocations go through the
EJB Object
 Remote Interface
This interface duplicates all the methods that
the corresponding bean class exposes
JAVA Components
16/22
What constitutes an EJB?(cont.)
 Home Object
How do clients acquire references to EJB
objects?
The client asks for the EJB object fron the
EJB Object factory
 Home Interface
How does a Home object know how you
would like to intialize your EJB object?
This info is provided to the container
through Home interface
JAVA Components
17/22
What constitutes an EJB?(cont.)
 Local Interfaces
Creating the beans through the home interface and then calling
the beans though the remote interface is very slow.
Local Interfaces makes beans' call faster
 Deployment Descriptor
You state your middleware needs in the deployment descriptor.
This file is an XML based file
 EJB-jar files
EJB-JAR files are essentially zip files that contain Java classes
and other files needed for deployment. You can generate these
files by hand or with tools, such as Apache Ant.
JAVA Components
18/22
What Specify in Deployment Descriptor ?
• Bean management and lifecycle
requirements
• Transaction requirements
• Security requirements, including access
control entries
JAVA Components
19/22
Enterprise JavaBeans Component
EJB Server
Client
EJB Container
Home
Home
EJB Home
stub
EJB Home
Remot
or Local
Remot
or Local
EJB Object
stub
EJB Object
EJB
Bean
JAVA Components
20/22
Disadvantages of EJB
 They have a large and complicated Specification
 EJBs take longer to develop, and when things go wrong, they
can be more difficult to debug, because there can be a
possibility that the bug may not be in your code but in the
application server/container itself.
 No sooner have you deployed your EJB application, you see a
new specification with newer features, rendering your
application obsolete before it gets online. This situation,
however, is unavoidable.
JAVA Components
21/22
Reference
 Clemens Szyperski, Dominik Gruntz and Stephan
Murer, "Component Software - Beyond ObjectOriented Programming",Second Edition, AddisonWesley/ACM Press, 2002 (589 pages), ISBN 0-20174572-0en.wikipedia
 Cay S. Horstmann, Gary Cornell,” Core Java™ 2
Volume I - Fundamentals”, Seventh Edition, Prentice
Hall PTR, August 17 ,2004(784 pages) ISBN 0-13148202-5
JAVA Components
22/22