Download (EJB) container - Distributed Object Computing

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

Clusterpoint wikipedia , lookup

Object-relational impedance mismatch wikipedia , lookup

Transcript
JBOSS Enterprise Server
Dimple Kaul & Nilabja Roy
Vanderbilt University,
Nashville,TN-37235
[email protected]
1
JBOSS Enterprise Middleware (JEMS)
• Pure Java based Application Server
• Open source implementation
• Based on J2EE specifications
• Scalability with clustering
• Superior Performance
• Inbuilt AOP facility
• File based configuration
• Security control
• Name Spacing (JNDI) for client access
2
Distributed Architecture of J2EE
3
Distributed Architecture
• Uses Java RMI to access remote components
• The platform uses IIOP to turn local method
invocations into remote method invocations.
• RMIC is used to create stubs and skeletons
– Stubs : Used at client side and are local representation of the
Distant Object. Parameters are marshallised and are serialized
in order to be send to the skeleton
– Skeleton: Used at server side. Here data is de-serialized and
unmarshallises. It call the distant method and return the value
the calling object.
4
J2EE Components
• Application clients and web clients are components
that run on the client.
• Java Servlet and Java Server Pages (JSP )
technology components are web components that
run on the server.
• Enterprise JavaBeans (EJB) components
(enterprise beans) are business components that
run on the server
J2EE components are written in the Java programming language and are
compiled in the same way as any program in the language. The difference
between components and "standard" Java classes is that components are
assembled into a J2EE application, are verified to be well formed and in
compliance with the J2EE specification, and are deployed to production,
where they are run and managed by the J2EE server.
5
Web and Business Components
6
J2EE Application clients
• Web Client:
– Dynamic web pages (HTML, XML etc)
• Using web component and web browser
– Web browser
– Also called “Thin client” ( Heavy weight operations are
uploaded to EJB on J2EE server)
– Applets (executes in JVM installed in web browser)
• Application Client
–
–
–
–
–
Runs on client m/c
Rich user interface than provided by markup language
Swing API’s
Direct access of client to Enterprise beans
Or can establish HTTP connection to connect to servlets
Clients are executed in their containers and have full access to
J2EE platform services like JNDI, JMS etc.
7
Web Component
• Provide response to request via HTTP.
• Web components is implemented by combination
of Java code, one or more JSP pages running with
servlet.
• Two types of web components are:
– Servlets Component: are Java programming language
classes that dynamically process requests and construct
responses
– JSP Component: are text-based documents that execute
as servlets but allow a more natural approach to
creating static content
• Provides flexibility in how these components can
be deployed in new or existing Web application.
8
Java Servlets
• Servlets have access to the entire family of Java
APIs, including the JDBC to access enterprise
databases.
• Servlets can also access a library of HTTP-specific
calls and receive all the benefits of the mature
Java language, including portability, performance
and reusability.
9
JSP – Java Server Pages
• Java Server Pages technology uses XML-like tags
and scripts written in the Java programming
language to encapsulate the logic that generates
the content for the page.
• Any and all formatting (HTML or XML) tags are
passed directly back to the response page.
• By separating the page logic from its design and
display and supporting a reusable componentbased design, JSP technology makes it faster and
easier than ever to build web-based applications.
10
Enterprise Java Beans Component
Enables rapid and simplified development of
distributed, transactional, secure and portable
Java applications. Enterprise Java bean
components are designed specifically with
business logic in mind
• Session beans
• Entity beans
• Message-driven beans
11
EJB – Session Beans
•
•
It handles only transient conversation
Session beans perform work for a client
application
–
For example, a session bean could charge a credit
card for a specific transaction.
• Stateful – A stateful bean maintains a conversational state
with a client. The client perceives that it is only talking to
one bean, and that bean maintains information between
calls
• Stateless – A stateless bean maintains no client
information between method calls – the container can
substitute beans as necessary between method calls
12
EJB – Entity Beans
• Classes that map to individual entities references
a row in database table, providing an object
representation of that database object
– For example, an entity bean could represent a customer,
and changing the values in that entity bean would cause
updates to that database row
• Entity beans provide an abstraction layer so that
working with the entity is not specific to the
storage mechanism for that entity.
• Persistent data stored ( stores data in database,
so in case client terminates or servers shuts
down, this bean ensures data is saved)
13
Entity Beans - Persistence
• Container Managed Persistence (CMP)
– The EJB container automatically persists the EJB objects,
usually to a relational database where each type of
object is represented as a table, and each instance of
the object is a row in that table
• Bean Managed Persistence (BMP)
– The EJB container calls bean methods when it is
appropriate for the bean to load, save or update data,
enforcing transactions without transaction code written
by the bean developer
14
EJB – Message Beans
• Message beans are classes that receive
asynchronous notification from a Java Message
Service server
• Enables client to access business logic contained
in EJ beans components in an Asynchronous
manner.
• Uses features of Session bean and Java Message
Service message listener
15
J2EE Containers
Containers are the interface between a component and
the low-level platform-specific functionality that supports
the component.
The container also manages non configurable services
–
–
–
–
–
–
Enterprise bean
servlet life cycles
database connection
resource pooling
data persistence
access to the J2EE platform APIs
•Enterprise JavaBeans (EJB) container
– Manages the execution of enterprise beans for J2EE applications.
Enterprise beans and their container run on the J2EE server.
•Web container
– Manages the execution of JSP page and servlet components for
J2EE applications. Web components and their container run on
16
the J2EE server.
J2EE Containers (contd..)
• Application client container
– Manages the execution of application client components.
Application clients and their container run on the client.
• Applet container
– Manages the execution of applets. Consists of a web
browser and Java Plug-in running on the client together.
17
Platform and Container Services
• Java Naming and Directory Interface (JNDI)
– Allows symbolic access to EIS resources and components
within a naming environment.
- J2EE application can store and
retrieve any type of named Java
object.
- Naming and directory service
- JNDI provides a common interface
to a variety of existing naming
services: DNS, LDAP, Active
Directory, RMI registry, COS
registry, NIS, and file systems.
- It is divided logically into a client
API that is used to access naming
services, and a service provider
interface (SPI)
18
Platform and Container Services (contd..)
• Java Database Connectivity (JDBC)
– Provides cross-DBMS connectivity to a wide range of
SQL databases
• Java Transactions Service (JTS)
– Handles transactional issues as multi-user access and
failure/recovery.
– Requirements specified at the time of assembly
• Java Message Service (JMS)
– The Java Message Service (JMS) API is a messaging
standard that allows application components based on
the J2EE to create, send, receive, and read messages. It
enables distributed communication that is loosely
coupled, reliable, and asynchronous
19
Platform and Container Services (contd..)
• Java Authentication and Authorization Service
(JAAS)
– ensures that components and resources are accessed by
only those authorized for access
– authentication and confidentiality, among other services,
for users.
– Authentication: of users, to reliably and securely
determine who is currently executing Java code,
regardless of whether the code is running as an
application, an applet, a bean, or a servlet
– Authorization: of users to ensure they have the access
control rights (permissions) required to do the actions
performed.
20
Platform and Container Services (contd..)
• Deployment Service
– Customize component behavior at deployment without
changing source code of component
21
EJB Interface
• Home interface
– The enterprise bean’s home interface defines the
methods to create and remove instances of beans.
• Component interface
– An EJB object is accessible via the enterprise bean’s
component interface. The component interface
defines the business methods callable by the client.
22
Web Services
•
•
•
According to the W3C a Web service is a software
system designed to support interoperable machine-tomachine interaction over a network.
A modular, well-defined, encapsulated function used for
loosely coupled integration between applications or
systems
Based on XML, transported in two forms:
–
–
•
•
•
Synchronous (RPC)
Asynchronous (messaging)
Both over Simple Object Access Protocol (SOAP)
Specified in Web Services Description Language (WSDL)
Sometimes advertised and discovered in a service
registry – Universal Description, Discovery and
Integration (UDDI)
23
Web Service Architecture
Communication
• Communication via existing Internet Protocols and XML
• Simple Object Access Protocol (SOAP)
SOAP
24
Simple Object Access Protocol (SOAP)
• SOAP is a protocol for exchanging XML-based messages
over a computer network, normally using HTTP. SOAP forms
the foundation layer of the web services stack, providing a
basic messaging framework that more abstract layers can
build on.
• A SOAP message is contained in an envelope. Within this
envelope are two additional sections: the header and the
body of the message. SOAP messages use XML
namespaces.
• Example
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Header>
</soap:Header>
<soap:Body>
<getProductDetails xmlns="http://warehouse.example.com/ws">
<productID>827635122</productID>
</getProductDetails>
</soap:Body>
</soap:Envelope>
25
Web Service Description Language (WSDL)
• Standardized XML format for describing network
services
• Name of the service
• Location of the service
• Way to communicate with service
• Describes a Web Service
• What it does
• How to communicate with it
• Where to find it
– WSDL service descriptions can be stored in
registries or published on the web (or both).
26
WSDL – An Example
<definitions>
Definition of data types
<types> <!-- XML Schema --> </types>
<message name=“getQuoteRequest” />
Definition of messages
<message name=“getQuoteResponse” />
<portType name=“StockQuoteServiceInterface”>
Definition of port type
<operation name=“getQuote”>
<input message=“getQuoteRequest” />
Definition of the bindings
<output message=“getQuoteResponse” />
</operation>
</portType>
<binding name=“StockQuoteServiceBinding” type=“StockQuoteServiceInterface”>
<soap:binding transport=“http://schemas.xmlsoap.org/soap/http” />
…
Definition of the service
</binding>
<service name=“StockQuoteService”>
<port name=“StockQuoteServicePort” binding=“StockQuoteServiceBinding”>
<soap:address location=“http://www.acme.com/services/stockquote” />
</port>
</service>
</definitions>
27
Use of Web Services
• Facilitates:
–
–
–
–
Marketing efforts
E-Commerce
Personalization
Direct services to
end users



Publishing of business functions by
means of API
Web pages for humans (B2C)
Web services for program to program
(B2B)
• Strategies:
Bank
Logistics Company
Internet
Supplier
Purchase
Order
28
Buyer
Get Quote Reservation
– Focus now on
partnerships
– Integration
– Direct
communication
– Automating
processes across
organizational
boundaries
E-Retailer
Traditional RPC vs Web Services
Traditional RPC
• Within enterprise
• Tied to a set of
programming
languages
• Procedural
• Usually bound to a
particular transport
• Tightly-coupled
• Firewall-unfriendly
• Efficient processing
Web Services
• Between enterprises
• Program language
independent
• Message-driven
• Easily bound to
different transports
• Loosely-coupled
• Firewall-friendly
• Relatively not
efficient processing
31
Universal Description, Discovery and
Integration (UDDI)
• A Web based distributed directory that enables
businesses to list themselves on the internet and
discover each other, similar to a traditional phone
book's yellow and white pages.
• It is an industry-wide effort to bring a common
standard for business-to-business(B2B)
integration. It defines a set of standard interfaces
for accessing a database of web services.
32
Web Services Technologies
Points to description
UDDI
Registry
WSDL
Describes
Service
Finds
Service
Service
Consumer
SOAP
Communicates with
XML Messages
33
Web
Service
How UDDI Works
1.
SW companies, standards
bodies, and programmers
populate the registry with
descriptions of different types
of services
2.
UDDI Business Registry
Businesses
populate
the registry
with
descriptions of
the services
they support
4.
Marketplaces, search
engines, and business
apps query the registry to
discover services at other
companies
Business
Registrations
3.
Assigns a unique identifier to each business
registration
34
5.
Business uses this
data to facilitate
easier integration
with each other over
the Web
Packaging
35
Packaging
• The components are packed into modules
– EAR (Enterprise ARchive)
• Enterprise JavaBeans
• Deployment Descriptors
– WAR (Web ARchive)
•
•
•
•
•
Servlets
JSPs
HTML Scripts
Images
Deployment Descriptor
– JAR (Java Archive)
• Client side Java Classes
• Deployment descriptor
36
Deployment Descriptors
• A deployment descriptor is an XML document
with an .xml extension that describes the
deployment settings of an application, a module,
or a component
• These are declarative, it can be changed without
the need to modify the source code
• J2EE server reads these descriptor files at run
time and acts upon the application, module &
component accordingly
• A J2EE module consists of one or more J2EE
components for the same container type and one
component deployment descriptor of that type.
–
–
–
–
EAR - application.xml
WAR - web.xml
EJB's - ejb-jar.xml
JBOSS specific descriptor is Jboss.xml
37
Understanding Directory Structure
Enterprise Archive contents (.ear)
Web Archive contents (.war)
38
AOP Applications
• If you're not familiar with AOP...
– It allows you to attach logic to various parts of your program
(for example, attach some logging logic every time a getter
is called – any getter)
– The program and the attached logic (the “advice”) are
stored separately
– Can separate business logic from service logic
– Code you're looking at no longer reflects everything that
might happen in the system
• JBoss supports AOP features, alone or in
combination with J2EE applications
• JBoss includes predefined aspects for transactions,
security, notification, etc.
• Can precompile applications to incorporate the
advice, or enable runtime handling of AOP
39
IDEs & Modeling tools
•
•
•
•
•
IDEs – Eclipse
IDEs – NetBeans
Modeling – ArgoUML
Modeling – EclipseUML
40
Comparison between CCM & JBOSS
Enterprise Java Beans and CCM are very similar
because both of them
– Uses accepted design patterns
– Facilitates their usage by enabling a large amounts of
code to be generated.
– Allows system services to be implemented by the
container provider rather than the application developer
– Hosted by generic application component server
• One can say CCM has been developed on top of
EJB model. It is developed with EJB interoperability
in mind
• CCM can be called “EJB for all languages”
41
JBOSS Disadvantages
• Configuration is cumbersome
– Limited help via comments in config files
– Too many config files, settings spread out
– Limited web management interface
• Uses too many network ports
• Configuration inappropriate by default
– Super-verbose logging (also hard to tune well)
42
Learning more…
• Enterprise JavaBeans – 3rd Edition
– Richard Monson-Haefel
– O’Reilly © 2001
• JBoss documentation
– http://www.jboss.org/online-manual/HTML/index.html
• J2EE Tutorial - http://java.sun.com/j2ee/
• J2EE Developers Guide -
http://java.sun.com/j2ee/sdk_1.2.1/techdocs/guides/ejb/html/De
vGuideTOC.html
43