Sunteți pe pagina 1din 29

!

2LL Cvervlew
!ava 2 laLform
- The }ava Euitions:
- The }ava Platfoim, Stanuaiu Euition(}SE)
- The }ava Platfoim, Enteipiise Euition(}EE)
- The }ava Platfoim, Nicio Euition(}NE)
!ava 2 SLandard LdlLlon
- This is the most commonly useu of }ava platfoims, consisting
of a iun-time enviionment anu a set of APIs foi builuing a
wiue vaiiety of applications.
- Foims the basis of }NE anu }EE.
- 0sually iefeiieu to as the }ava Bevelopment Kit (}BK).
!ava 2 Mlcro LdlLlon
- }NE (}ava Platfoim, Nicio Euition) is a technology that
allows piogiammeis to use the }ava piogiamming language
anu ielateu tools to uevelop piogiams foi
mobile wiieless infoimation uevices such as cellulai phones
anu peisonal uigital assistants (PBAs).
- }NE consists of piogiamming specifications anu a
special viitual machine, the K viitual Nachine, that allows a
}NE-encoueu piogiam to iun in the mobile uevice.
!ava 2 LnLerprlse LdlLlon
- Wbat is )EEJ)ava EE?
A platfoim foi implementing enteipiise
applications in a uistiibuteu enviionment using
}ava"
The }ava Platfoim, Enteipiise Euition (}EE)
uefines the stanuaiu foi ueveloping, ueploying anu
managing multi-tiei web baseu, seivei- centiic,
anu component-baseu enteipiise applications"
LnLerprlse AppllcaLlon
- An Enteipiise means a business oiganization.
- An Enterprise Application is a Softwaie that
peifoims business functions such as accounting,
customei infoimation management, sales anu so
on.
- Aims to impiove the oiganizations peifoimance.
LnLerprlse ArchlLecLure
- Enteipiise aichitectuie helps in unueistanuing
the stiuctuie of an enteipiise application.
- It can be uiviueu into logical layeis:
- The usei inteiface (Piesentation layei)
- Piocessing (Business layei)
- Bata Stoiage anu Access (Bata access layei)
LnLerprlse ArchlLecLure 1ypes
- Single-Tiei Aichitectuie
- Two-Tiei Aichitectuie
- Thiee-Tiei Aichitectuie
- n-Tiei Aichitectuie
Slngle1ler ArchlLecLure
1wo1ler ArchlLecLure
(CllenLServer)
Database Database
1
st
Tier 2nd Tier
Presentation
Logic
Business Logic
Data Access
Layer
1st
Layer
Data
Layer
1hree1ler ArchlLecLure
ser !nterface ser !nterface
Application Logic Application Logic
Database Database
XNL Documents XNL Documents
. . .
n1ler ArchlLecLure
Browser Application Client
Database Database
XNL Documents XNL Documents
!S8 rocess
- }ava Community Piocess (}CP) foi uevelopment of
specifications (since 99)
- Initiation (appioveu by executive committee)
- Eaily uiaft (foi ieview by the public uomain)
- Public uiaft (iefeience implementation, compatibility
toolkit)
- Naintenance (uocument upuates)
- }ava Specification Request (}SR)
- Pioposeu anu final specifications foi }ava platfoim
- Review appioval piocess
!ava LL 3 laLform
- Next veision of }EE platfoim
- Latest veisions of }ava technology
- Enteipiise }avaBeans (E}B) . (}SR-)
- }ava Seivei Faces (}SF) . (}SR-)
- Seivlet .
- }ava Seivei Pages (}SP) .
- }ava API foi Web Seivices (}AX-WS) . (}SR-)
- Web Seivices Netauata (}SR-8)
- }ava Aichitectuie foi XNL Binuing (}AXB) . (}SR-)
- }ava Peisistence . (}SR-)
- Common Annotations . (}SR-)
- Stieaming API foi XNL (StAX) . (}SR-)
!ava LL 3 laLform
!ava LL ComponenLs
- }ava EE applications aie maue up of components.
- A }ava EE component is a self-containeu functional
softwaie unit that is assembleu into a }ava EE
application with its ielateu classes anu files anu that
communicates with othei components.
. Application Clients anu Applets (Client)
. Web Components (Seivei)
. Business Components (Seivei)
!ava LL ConLalners
- ontainers aie the inteiface between a component anu
the low-level platfoim-specific functionality that
suppoits the component.
- Befoie execution of a web, enteipiise bean, oi
application client component, it must be assembleu into
a }ava EE mouule anu ueployeu into its containei
. Enteipiise }avaBeans (E}B) containei
. Web containei
. Application client containei
. Applet containei
!ava LL ConLalners
!ava LL AppllcaLlon Assembly and ueploymenL
- A }ava EE application is packageu into one oi moie
stanuaiu units foi ueployment to any }ava EE
platfoim-compliant system. Each unit contains:
- A functional component oi components (such as an
enteipiise bean, }SP page, seivlet, oi applet)
- An optional ueployment uesciiptoi that uesciibes its
content
ackaglng AppllcaLlons
- A }ava EE application is ueliveieu in an Enteipiise
Aichive (EAR) file, a stanuaiu }ava Aichive (}AR)
file with an .eai extension.
# File Structure
!ava LL module
- Foui types :
- E}B mouules,
- contains class files foi enteipiise beans anu an E}B ueployment uesciiptoi.
- packageu as }AR files with a .jai extension.
- Web mouules,
- contains seivlet class files, }SP files, suppoiting class files, uIF anu BTNL files,
anu a web application ueployment uesciiptoi.
- packageu as }AR files with a .wai (Web ARchive) extension.
- Application client mouules,
- contain class files anu an application client ueployment uesciiptoi.
- packageu as }AR files with a .jai extension.
- Resouice auaptei mouules,
- contains all }ava inteifaces, classes, native libiaiies, anu othei uocumentation,
along with the iesouice auaptei ueployment uesciiptoi.
- packageu as }AR files with an .iai (iesouice auaptei aichive) extension.
INDI (Iava Nam|ng and D|rectory Interface )
- The }NBI is an API that suppoits accessing naming anu
uiiectoiy seivices in }ava piogiams.
- The puipose of a naming seivice is to associate names
with objects anu pioviue a way to access objects baseu on
theii names.
- with a uiiectoiy seivice, you can access the attiibutes of
objects anu seaich foi objects baseu on theii attiibutes.
You can use }NBI to access uiiectoiy seivices like LBAP
anu Novell Biiectoiy Seivices (NBS) uiiectoiies.
INDI
ConLexL lnlLlalConLexL Class
- A naming seivice associates names with objects. An
association between a name anu an object is calleu a Tinding,
anu a set of such binuings is calleu a context.
- }NBI iepiesents a context in a naming system using the
javax.naming.Context inteiface.
- The javax.naming.InitialContext class implements the Context
inteiface anu seives as oui entiy point to a naming system.
INDI
ooklng up Cb[ecLs ln a ConLexL
- Retiieving an object by name fiom a naming system oi
uiiectoiy is calleu looking up the object. This is the job of
the lookup() methou of Context.
- You can use }NBI to look up anu ietiieve an E}B component
fiom an application seivei oi a iemote object fiom a
iemote RNI iegistiy.
}EE . Resouice Lookup
Context c =newInitialContext();
0bject obj = c.lookup(name);
uependency ln[ecLlon
- Containei injects" iesouices
- BataSouice, E}B ief, web seivice ief, peisistence units
- In the application,
- Fielus, methous; public, piivate, oi piotecteu
- In containei-manageu classes
- E}Bs, seivlets, }SF manageu beans, web seivice enupoints,
hanuleis, inteiceptois, app clients
- Avoius the neeu to use }NBI
uependency ln[ecLlon
package com.example;
@Stateless @Local(MyEJBInterface.class)
public class MyEJB ,
@Resource(name = employeeDatabase)
private DataSource myDS;
...
}
- Beclaies a iesouice nameu employeeBatabase
- injects it into the myBS fielu
- no ueployment uesciiptoi entiy neeueu!
uependency ln[ecLlon
- Annotations useu foi Bepenuency Injection
- javax.annotation.Resouice
- javax.ejb.E}B
- javax.xml.ws.WebSeiviceRef
- javax.peisistence.PeisistenceContext
- javax.peisistence.Peisistence0nit
AnnoLaLlons
- a }ava annotation is a way of auuing metauata
about classes, vaiiables, anu methous to }ava
souice coue anu also in complieu class files.
- Annotations aie specifieu in the piogiam souice by
using the symbol
AnnoLaLlons ln !ava LL 3
- Bow aie they useu in }ava EE.
- To map }ava classes to uatabases
- To map }ava classes to XNL
- To uefine E}Bs anu theii attiibutes
- To uefine Web Seivices
- To uefine secuiity attiibutes
- To specify exteinal uepenuencies