Java EE: The Basics
Join the DZone community and get the full member experience.Join For Free
wanted to go through some of the basic tenets, the technical terminology related to java ee. for many people, java ee/j2ee still mean servlets, jsps or maybe struts at best. no offence or pun intended!
this is not a java ee 'bible' by any means. i am not capable enough of writing such a thing! so let us line up the 'keywords' related to java ee and then look at them one by one
- java ee
- java ee apis (specifications)
- multitiered applications
let's try to elaborate on the above mentioned points.
ok. so what is java ee?
'ee' stands for enterprise edition. that essentially makes java ee - java enterprise edition. if i had to summarize java ee in a couple of sentences, it would go something like this
"java ee is a platform which defines 'standard specifications/apis' which are then implemented by vendors and used for development of enterprise (distributed, 'multi-tired', robust) 'applications'. these applications are composed of modules or 'components' which use java ee 'containers' as their run-time infrastructure."
what is this 'standardized platform' based upon? what does it constitute?
- the platform revolves around 'standard' specifications or apis .
- think of these as contracts defined by a standard body e.g. enterprise java beans (ejb), java persistence api (jpa), java message service (jms) etc.
- these contracts/specifications/apis are implemented by different vendors e.g. glassfish, oracle weblogic, apache tomee etc
alright. what about containers?
- containers can be visualized as 'virtual/logical partitions' .
- each container supports a subset of the apis/specifications defined by the java ee platform
- they provide run-time 'services' to the 'applications' which they host
the java ee specification lists 4 types of containers
- ejb container
- web container
- application client container
- applet container
java ee containers
i am not going to dwell into details of these containers in this post.
- well, 'services' are nothing but a result of the vendor implementations of the standard 'specifications' (mentioned above). examples of specifications are - jersey for jax-rs (restful services), tyrus (web sockets), eclipselink (jpa), weld (cdi) etc.
- the 'container' is the interface between the deployed application ('service' consumer) and the application server.
here is a list of 'services' which are rendered by the 'container' to the underlying 'components' (this is not an exhaustive list)
- persistence - offered by the java persistence api (jpa) which drives object relational mapping (orm) and an abstraction for the database operations.
- messaging - the java message service (jms) provides asynchronous messaging between disparate parts of your applications.
- contexts & dependency injection - cdi provides loosely coupled and type safe injection of resources.
- web services - jaxrs and jaxws provide support for rest and soap style services respectively
- transaction - provided by the java transaction api (jta) implementation
what is a typical java ee 'application'? what does it comprise of?
applications are composed of different ' components ' which in turn are supported by their corresponding ' container '
supported 'component' types are:
- enterprise applications - make use of the specifications like ejb, jms, jpa etc and are executed within an ejb container
- web applications - they leverage the servlet api, jsp, jsf etc and are supported by a web container
- application client - executed in client side. they need an application client container which has a set of supported libraries and executes in a java se environment.
- applets - these are gui applications which execute in a web browser.
how are java ee applications structured?
as far as java ee 'application' architecture is concerned, they generally tend follow the n-tier model consisting of client tier, server tier and of course the database (back end) tier
- client tier - consists of web browsers or gui (swing, java fx) based clients. web browsers tend to talk to the 'web components' on the server tier while the gui clients interact directly with the 'business' layer within the server tier
- server tier - this tier comprises of the dynamic web components (jsp, jsf, servlets) and the business layer driven by ejbs, jms, jpa, jta specifications.
- database tier - contains 'enterprise information systems' backed by databases or even legacy data repositories.
generic 3-tier java ee application architecture
java ee - bare bones, basics.... as quickly and briefly as i possibly could. that's all for now! :-)
stay tuned for more java ee content, specifically around the latest and greatest version of the java ee platform --> java ee 7
you may want to check out this introductory post about java ee 7 to begin with.
Opinions expressed by DZone contributors are their own.