Using Java in the Oracle Frameworks

Lance Reedy Java Architect

Release 11i Workshops
Dallas, TX • Santa Clara, CA Cincinnati, OH • Denver, CO • Atlanta, GA Detroit, MI • Las Vegas, NV www.solutionbeacon.com

Are you an OAUG Member?
Global Users. Global Solutions.
u u u u u Member Benefits include: Advocacy opportunities to influence Oracle on product enhancements, usability, new features, Oracle support, pricing and quality Knowledge that showcases the latest trends and techniques used by industry leaders through our national and regional events and our publications, such as OAUG Insight magazine Communication with other OAUG members worldwide through participation in OAUG committees, leadership positions, interaction with Oracle Corporation's user initiatives, frequent member surveys, and Oracle management briefings Education through the hundreds of career-enhancing presentations in our conference paper database archive, as well as discounts to conferences and Oracle education Networking with Oracle customers, industry experts, third-party software firms, and other Oracle Applications specialists through our Member Database and Online Vendor Directory
2

© 2007 Solution Beacon, LLC. All Rights Reserved.

Agenda

uExplore the use of Java technologies in
l OAF l ADF l OC4J

- (($SSOLFDWLRQ6HUYHU

6HUYOHW - 6(

uWrap-up

© 2007 Solution Beacon, LLC. All Rights Reserved.

3

Relevant History uThe move from native clients to web clients
l With the rise of the web browser, the vast majority of “code” can reside on the server, and only the user interface can exist on the client

uThe development of the Java 2 platform
l A common language that can run on most flavors of UNIX as well as Win32

uThe development of new device platforms able to run web browsers
l Cell phone, PDA, bar code scanners, …
© 2007 Solution Beacon, LLC. All Rights Reserved.

4

Early Standards uServer side languages included
l CGI-BIN programming – first generation l Servlets – first generation of Java l JSP – second generation, complementary to Servlets

uHTML and JavaScript on the client

© 2007 Solution Beacon, LLC. All Rights Reserved.

5

Java Editions uJava 2 Standard Edition (J2SE)
l What we typically think of as Java on a server

uJava Plug-in
l The J2SE environment that is designed specifically to run inside a web browser l Not feature limited, but very ability limited

uJava 2 Enterprise Edition (J2EE)
l Designed to be a cross platform application server l Sun provides the API specifications, and a reference implementation of them
© 2007 Solution Beacon, LLC. All Rights Reserved.

6

Java Editions…cont’d uJDK
l Java developers Kit – specifically the core Java language (J2SE) developers kit

uJ2EE SDK
l The API libraries, compiler, and documentation needed to write a J2EE application l Includes the reference application server

© 2007 Solution Beacon, LLC. All Rights Reserved.

7

Adding Java
u As a language Java has the flexibility of running on both sides of the client / server model u Uses different programming models for each platform

© 2007 Solution Beacon, LLC. All Rights Reserved.

8

JInitiator – New Client uIs Oracle’s licensed JVM uUsed on client platform to provide a consistent environment uExecutes within the client’s web browser to run things like Forms based modules in E-Business Suite 11i

© 2007 Solution Beacon, LLC. All Rights Reserved.

9

What is OAF uBased on early web standards and technologies uAn attempt to introduce abstraction into application design
l Separation of components into layers l Connections only between adjoining layers

uBy separating the display from the business logic change becomes easier uMechanism for personalization, design pattern for extension
© 2007 Solution Beacon, LLC. All Rights Reserved.

10

Abstraction uThe idea of breaking an algorithm into discrete layers, each of which is opaque uCommon in Object Oriented programming uSimplifies code while complicating solutions?!

© 2007 Solution Beacon, LLC. All Rights Reserved.

11

HTML User Interface uTags and properties used can become too complex and interdependent to manage easily uDependent upon the browser’s interpretation of the HTML language < bo dy > < p> Ex am p le t able< / p> < t able cellsp acin g= 1 •c < capt ion > T ab le 1< / cap t ion > < t r> < t d> Hom er < / t d> < t d> cell2< / t d> < / tr> < / t ab le> < / bo d y>
12

© 2007 Solution Beacon, LLC. All Rights Reserved.

JSP uA way to create HTML with programmatic content. uEmbeds Java doe (scriptlets) into HTML < body> < p> A table drawn via a JSP page. < / p> < p> < table cellspacing= 1 •c < caption> Table 1< / caption> < tr> < td> < % = visitor.getName() % > < / td> < td> cell2< / td> < / tr> < / table> < / body>
13

© 2007 Solution Beacon, LLC. All Rights Reserved.

Servlet uJava code that produces HTML as it’s output uDistributed as compiled Class files

pu b lic class _t est 1 •c { pu blic v oid _jspServ ice( •c { respon se.set Con t en t T y p e•c __ojsp_s_ou t .w rit e( •g b od y> • •) ; < c h __ojsp_s_ou t .w rit e( v isit or .g et n am e( ) ) ;
14

© 2007 Solution Beacon, LLC. All Rights Reserved.

MVC Design Pattern
The Model contains the business logic for the application and the data that it acts on.

The View creates the UI that is presented to the end user.

The Controller provides application workflow and coordinates what the user sees.
© 2007 Solution Beacon, LLC. All Rights Reserved.

15

MVC Technologies •Each component uses programming concepts and models best suited for it’s demands JavaBeans, EJB

JavaServer Pages
© 2007 Solution Beacon, LLC. All Rights Reserved.

Servlet(s)
16

MVC Declarative Programming
Model

Controller

View

© 2007 Solution Beacon, LLC. All Rights Reserved.

17

Model Details uA Java class (commonly a JavaBean) is used to represent a business entity that the application acts on

© 2007 Solution Beacon, LLC. All Rights Reserved.

18

Controller Details uA XML config file is used to control behavior of the application uA group of Java Classes implement the controller’s API

Controller

© 2007 Solution Beacon, LLC. All Rights Reserved.

19

MVC Declarative Programming uCustom tags are used in the JSP page to reference data presented by, or sent to, the Model.

View

© 2007 Solution Beacon, LLC. All Rights Reserved.

20

Personalizations uChanges to page layout or content visibility uCan be done by administrators or by end users uThe personalizations are applied between the HTML page being generated and it being sent to the client uPersonalizations are stored via data, not code changes

© 2007 Solution Beacon, LLC. All Rights Reserved.

21

OAF Page Rendering uA hierarchy of operations, many of which are driven purely by data

© 2007 Solution Beacon, LLC. All Rights Reserved.

22

What is ADF uThe next generation after OAF uBuilds on OAF, adds
l More dynamic page refreshing l Data Binding l Ability to build content for limited devices l JavaServer Faces

uMoves further into the J2EE architecture

© 2007 Solution Beacon, LLC. All Rights Reserved.

23

Standards Used by ADF uMVC uJSP, Servlets uJavaBeans uEnterprise JavaBeans uJavaServer Faces

© 2007 Solution Beacon, LLC. All Rights Reserved.

24

Oracle Technologies Used uADF Faces
l UIX widgets

uTopLink
l Data persistence

uOC4J
l J2EE application server

© 2007 Solution Beacon, LLC. All Rights Reserved.

25

JavaBeans and EJB

uJavaBeans conform to particular coding rules
l Beans have data fields, each field must be accessed via a Get or a Set method l They can be loaded dynamically

uThey are used to store data that needs to be used programmatically

© 2007 Solution Beacon, LLC. All Rights Reserved.

26

Enterprise JavaBeans uEJB expands the idea of the basic JavaBean
l Persistence in a database l Remote access

uJava carries the C/UNIX idea of Remote Procedure Call forward in the form of Remote Method Invocation
l An EJB container must facilitate the use RMI to allow remote client’s to access Enterprise JavaBeans

© 2007 Solution Beacon, LLC. All Rights Reserved.

27

Java / SQL uA query mechanism must exist to allow objects to be retrieved from the DB as needed uDatatypes must be mapped between languages:
l String vs varchar l Address vs a table

© 2007 Solution Beacon, LLC. All Rights Reserved.

28

Object Persistence uThe desire in a J2EE environment is to prevent application code from interacting directly with the DB uThis is achieved by allowing the J2EE container to access to common DB services

- (($SS6HUYHU %XVLQHVV/RJLF 7RS/LQN 4XHULHV &DFKH

9LHZ %XVLQHVV'DWD - (('%6HUYLFHV &RQQHFWLRQ3RRO 7UDQVDFWLRQ0JU 3HUVLVWHQFH

'DWDEDVH 64/

© 2007 Solution Beacon, LLC. All Rights Reserved.

29

EJB 3.0 Persistence
u Based on annotation u Uses a tool to generate the code’s skeleton and annotations u Uses other tools at compile and runtime to turn the annotations into actual code

© 2007 Solution Beacon, LLC. All Rights Reserved.

30

TopLink versus EJB 3.0 uTopLink is an established Oracle standard uEJB 3.0’s Java Persistence API is an emerging industry wide standard…
l … Java Persistence API was added in latest J2EE spec l Can be used outside of EJB, by J2SE apps l Based on ideas submitted by various J2EE vendors including Oracle

© 2007 Solution Beacon, LLC. All Rights Reserved.

31

JSF and ADF Faces

uJavaServer faces simplifies the design of HTML UI
l By providing tags to represent common data elements l By providing components which can help to validate data as it’s being entered

uADF brings tags representing common Oracle UI elements
32

© 2007 Solution Beacon, LLC. All Rights Reserved.

ADF Faces – Declarative UI uExtends the JSP concept to expose Oracle’s own UIX widgets uReplaces even simple HTML tags with abstract elements
© 2007 Solution Beacon, LLC. All Rights Reserved.

33

OC4J – J2EE Server uJ2EE defines a specification for the applications server uDefines clear interfaces and mechanisms for interacting with other infrastructure, such as Identity Management (LDAP) uIndividual vendors then select portions of the spec that they will implement uFocuses on server side technologies

© 2007 Solution Beacon, LLC. All Rights Reserved.

34

J2EE Technologies uA rich suite of APIs built on a common core

© 2007 Solution Beacon, LLC. All Rights Reserved.

35

Development in J2EE uJava is rich with OpenSource solutions
l J2EE app servers: JBoss, Tomcat, GlassFish l Developer tools: Eclipse, NetBeans l Frameworks: Struts, Tapestry, Turbine l Persistence: Hibernate, OJB

uSome of these are sold as commercial applications with vendor support and consulting uNone of the developers tools offer tight integration into proprietary application servers uFew of them offer a complete development solution
36

© 2007 Solution Beacon, LLC. All Rights Reserved.

JDeveloper uOracle’s full featured developer’s toolkit uVery feature rich for plain Java, J2EE, and Oracle specific development uSupports design, coding, testing, packaging, and deployment

© 2007 Solution Beacon, LLC. All Rights Reserved.

37

© 2007 Solution Beacon, LLC. All Rights Reserved.

38

J2EE Application Deployment uJ2EE applications are composed of a number of components
l Classes, Servlets l HTML, JSP, and images l XML configuration files

uLogical groups of Classes become Jar files uAll content is organized into a specific directory structure uResults are combined into a special Jar file
39

© 2007 Solution Beacon, LLC. All Rights Reserved.

Packed Contents / /META-INF application.war

application.xml the actual application!

© 2007 Solution Beacon, LLC. All Rights Reserved.

40

War File Contents / /META-INF /css (custom) /images (custom) /html (custom) /WEB-INF /WEB-INF/classes /WEB-INF/lib

style sheets static images static HTML pages web.xml, struts.xml individual Class files Jar files of Classes
41

© 2007 Solution Beacon, LLC. All Rights Reserved.

The Future uDriven by industry standards
l Release of the Java EE 5 spec drives the use of EJB l J2EE is driving towards web services and SOA

uFusion makes the move to a SOA based environment
l Same Java syntax, new programming models l Event driven processing l Focus on business modeling and processes l Distributed applications communicating via Enterprise Service Bus and Web Services

© 2007 Solution Beacon, LLC. All Rights Reserved.

42

Past Environment uComponents used in OAF

© 2007 Solution Beacon, LLC. All Rights Reserved.

43

Present Environment uComponents used in ADF

© 2007 Solution Beacon, LLC. All Rights Reserved.

44

Future State uComponents needed for SOA and web services

© 2007 Solution Beacon, LLC. All Rights Reserved.

45

J2EE in the Architecture

© 2007 Solution Beacon, LLC. All Rights Reserved.

46

Questions and Answers
T < e m h a n k y o u ! e ( s ) >

P r e s e n t e r ( s ) a il@

N a m

s o lu t io n b e a c o n . c o m

w w w . s o l u t io n b e a c o n . c o m

R e a l S o lu t io n s

f o r

t h e

R e a l W

o r ld .

â

Visit Our Booth #339 to Register for a World Class Weekend Trip!
© 2007 Solution Beacon, LLC. All Rights Reserved.

47

G o t O r a cle ? Get the Book! I nst allin g, Upgr ading and M aint ainin g Or acle E- Business Suit e Applicat io ns 11.5.10 + I t •f available in t he OUAG s Book st or e or online! Sign u p f or t he Solut ion Beacon New slet t er w w w .solut ionbeacon.com

Release 11i Workshops
Dallas, TX • Santa Clara, CA Cincinnati, OH • Denver, CO • Atlanta, GA Detroit, MI • Las Vegas, NV www.solutionbeacon.com