Download Enterprise JavaBeans (EJB) for JBuilder

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
Innovator 11 classiX
Enterprise JavaBeans
(EJB) for JBuilder
Connect
Alexander Borschet
www.mid.de
Connect Enterprise JavaBeans (EJB) for JBuilder
Modeling and Generating Enterprise JavaBeans (EJB) for JBuilder
What is the Purpose of
Connection to JBuilder?
The Innovator connection models and generates Enterprise JavaBeans
(EJB) for Borland JBuilder.
What are Enterprise
JavaBeans?
Enterprise JavaBeans (EJB) is a specification published by Sun Microsystems for modeling classes for a component-based distributed
architecture of business applications, among other things. You can find
more information about the specifications under http://java.sun.com.
EJB supports Entity Beans and Session Beans. Entity Beans are persistent
and have primary keys. Instances can be identified and searched for using
the primary key. If several attributes are involved in a primary key, then they
are combined in an independent primary key class. Session beans are, in
contrast, not persistent. They are assigned to a client process and are
destroyed when the client process is ended.
A Bean is not directly communicated within distributed applications. Instead,
the home interface of a bean provides the methods for creating and
searching instances. A bean's technical methods respond via a remote
interface.
EJB uses Message Driven Beans for processing messages.
Browser
Client
Web Container
J2EE
Stateless Session Bean
Stateful Session Bean
Message Driven Bean
Bean Managed Entity Bean
Container Managed Entity Bean
EJB Container
Database
Database
Database
Database
EJB Container in J2EE and Innovator Context
In this paper, EJB embedding occurs using the general software process of
EJB applications for JBuilder favored by MID; embedding can also, however, be carried out in other ways.
What is JBuilder?
Borland JBuilder is a cross-platform environment for developing powerful
enterprise Java applications. JBuilder accelerates EJB, Web, Web Services, XML, mobile and database application development.
http://www.borland.com/jbuilder/
What is BES?
Borland Enterprise Server is the standard runtime environment for all
business applications for J2EE, CORBA and Web Services platforms.
http://www.borland.com/bes/
2
Connect Enterprise JavaBeans (EJB) for JBuilder
Enterprise JavaBean
(EJB) Applications
EJB applications normally use business data which is stored in relational
databases. Regardless of whether a new database is to be set up or a long
standing one accessed, data management that prevents redundancies and
consistency of business data should be ensured. This can only be achieved
using a suitable database model which focuses on the normalized form
structure of the data. It is virtually impossible to obtain such a database
model from a pure bean class model.
A conceptual and physical data model must therefore be created, which will
be used as a basis for the class model of all persistent Entity Beans.
Innovator Data supports the modeling of a conceptual and physical data
model, based on general recognized entity relationship modeling (ERM)
standards. At the same time, an extended structured entity relationship
model (SERM) method (proposed by Prof. Dr. Sinz) is made available,
which prevents the problem of cyclical existence dependencies of entities
and illustrates existence dependencies.
In connection with the generative and associative transformations between
a relational and an object-oriented model (ER-OO-mapping), Innovator
provides the opportunity to model redundancy-preventative data management for persistent Entity Bean objects right from the start. This is of particular importance if the new application is to be installed on a pre-existing
database model. This means that a wizard cannot be used to make a bean
class persistent. Instead, targeted transformation needs to be applied. This
is the only way to ensure that the application works on and with a
consistent database which is free of redundancies.
While the data model serves as the basis for persistency, the bean class
model focuses on the distribution of functionalities and their re-usability in
component architecture. The way in which a bean class is made persistent
is left up to the Bean Container. It is here where object-relational transformation is used. It specifies the rules for the transformation of beans in
database tables and anchors them in a container.
If both bean class models and database models are created in Innovator,
then this modeling information is extracted and exported to the correct
directory structure in the form of Java classes, embedded in package
structures, together with the default EJB deployment descriptor and a BESspecific deployment descriptor. This information is now available in
Innovator perspectives, as well as other JBuilder perspectives in JBuilder.
How are EJBs Supported? Innovator supports EJBs within object-oriented modeling with the help of the
UML for Java language using the component Innovator Object classiX.
Innovator Object supports the modeling and generating of EJBs in line with
the specifications in version 2.x with the Java EJB 2.x for Borland
add-on (extra costs incurred).
The declaration of classes, attributes and methods are added to the specific
stereotypes and EJB element properties, which are evaluated during
modeling and generating.
Only the bean classes are to be modeled. The derived classes (e.g.
remote/home interface and primary key class) are created using so-called
engineering actions or adapted to the bean class modeling. What’s more,
the respective EJB methods (ejBCreate, ejbActivate, ejbPassivate,
etc.) are created in the classes.
The following bean classes are supported:
„ Container Managed Entity Bean
„ Bean Managed Entity Bean
„ Stateless Session Bean
„ Stateful Session Bean
„ Message Driven Session Bean
3
Connect Enterprise JavaBeans (EJB) for JBuilder
Innovator expands the Java declaration for classes, attributes and methods
using additional element properties (referred to as “tagged values” in UML)
and stereotypes. The values of these element properties determine which
role a class, an attribute or a method has within the framework of the EJB
specification.
Two new class diagrams are already provided for EJB extension. A class
diagram with the «Java EJB Definition Class Diagram» stereotype contains
one bean class and its remote/home interfaces, as well as its primary key
class (where applicable). Commands are provided in this diagram for
creating EJB classes, attributes and methods.
The class diagram with the «Java EJB Relationship Class Diagram»
stereotype only contains bean classes. It does not, however, contain their
respective interface classes. This diagram creates the relationships
between EJBs. Commands are provided in this diagram for creating
relationships between EJB classes.
The available Java Apply EJB 2.0 Pattern engineering action
assumes that the modifications made in the model will only be applied to
the Entity Beans, Session Beans or Message Driven Beans. These
modifications are then automatically propagated in the assigned home
interface or remote interface or in the assigned primary key class. If they do
not already exist, then they are created.
You can create Container Managed Entity Beans using an ER-OO-mapping
variant based on a data model (which you created before with the Innovator
Data component) using the engineering action Create EJBs from
Database Model.
The engineering action configures the connection to the data model and
creates the Container Managed Entity Beans according to the data model’s
tables, which have been created since the last generator run. Alongside the
Entity Beans, the action also creates their attributes and relationships. It
does not, however, create the home/remote interfaces of these bean
classes.
Each EJB class or interface concerns a normal Java class with the «class»
or «interface» stereotype. Generating Java code, forward, reverse or roundtrip engineering treat these classes like other Java classes.
How to Proceed with
Modeling and Generating
EJBs
According to the software development process used here, the basis of
modeling and generating of Enterprise Java Beans (EJB) for JBuilder
provides, on the one hand, a UML model (obligatory with platform-specific
packages for design and implementation (as a result of Java profile) and the
specific EJB for JBuilder using an appropriate add-on) and, on the other
hand, essentially provides an ER model which can be created using
standard generation in a UML model.
To model and generate Enterprise JavaBeans (EJB) for JBuilder, please
follow the next steps:
„ Create an ER data model (e.g. reverse engineering from a pre-existing
database)
„ Based on the UML model, configure the connection to the data model
and generate the persistent Container Managed Entity Beans (CMP)
from this data model
„ Create the bean classes in the UML class diagrams (non-persistent
Session Beans and Message Driven Beans for communication)
„ Model relationships between beans in the UML class diagram
„ Create local and remote references
„ Model the beans’ attributes and methods
„ Execute Java Apply EJB 2.x Pattern forward engineering action
to create and maintain the missing elements (e.g. home/remote
interface) according to EJB specification.
4
Connect Enterprise JavaBeans (EJB) for JBuilder
„
„
„
„
„
Mapping to Data Model
Copy the JBuilder project directory structure into Innovator packages.
Determine create defaults for forward and reverse engineering
Create source code using relevant engineering actions
Create EJB deployment descriptor with Java Generate EJB 2.x DD
for Borland engineering action
Create value object for efficient data exchange between Entity Beans
and their clients
As the CMP beans are generated from the data model in Innovator,
complete information about the illustrations can be found in JBuilder. As
well as model/table definitions, mapping and relations are also fully created.
Innovator_11.3_Connect_EJB_JBuilder_en_100630.doc
Copyright © 2010 MID GmbH
For questions, please contact our hotline
Tel.: +49 (0)911 / 9 68 36 -22, E-mail: [email protected].
You can also find this document along with others in the exclusive log-in
download area for Innovator customer service under
http://www.mid.de/support/produktinformationen/.
Your MID team
MID GmbH, Eibacher Hauptstr. 141, 90451 Nuremberg, Germany
Tel.: +49 (0)911 / 9 68 36 -0, Fax: +49 (0)911 / 9 68 36 -10
E-mail: [email protected], Internet: http://www.mid.de
5