420 likes | 769 Views
Introduction to ADF in JDeveloper 10 g — Is it Oracle Forms Developer Yet?. Peter Koletzke Technical Director & Principal Instructor. Moi. Vous. Forms development 1-2 years? 3-9 years? More than 9 years? Java development 1-2 years? 3-9 years? More than 9 years? JDeveloper
E N D
Introduction to ADF in JDeveloper 10g — Is it Oracle Forms Developer Yet? Peter Koletzke Technical Director & Principal Instructor
Vous • Forms development • 1-2 years? • 3-9 years? • More than 9 years? • Java development • 1-2 years? • 3-9 years? • More than 9 years? • JDeveloper • 1-3 years? • More than 3 years?
On the Positive Side… If we do not find anything pleasant, at least we shall find something new.—Voltaire (1694-1778), Candide Si nous ne trouvons pas des choses agréables, nous trouverons du moins des choses nouvelles.
Agenda • What is a framework? • What is ADF? • Is it Forms? Rumor: There is a really good book about JDeveloper 10g coming out soon.
Java 2 Platform, Enterprise Edition J2EE Problem 1 - Design • J2EE offers design flexibility • Multiple architectures (various tiers) • Multiple languages • Multiple data layers • Choosing the technology combination is difficult • EJBs or BC4J (ADF BC)? • Struts or MVC controller? • JSP pages or UIX or Java Swing? • Database code or web services?
J2EE Problem 2 - Development • J2EE code is primarily 3GL • Lots of lines of code, repeats for each app • Notepad and vi are limited development environments • Need help creating code • Generate the standard stuff • Hand code the app-specific stuff • Need to reuse proven methods • Code libraries that handle the internals
J2EE Problem 3 – Deployment • J2EE deployment is complex • Java applications have many files • Not less than a thousand • Need to install application files in the right places on the server • Need to configure the server • Lots of required files • web.xml, server.xml, J2EE config files • Need to connect the layers • Requires more than simple client todatabase server connection
The Solutions • Problem 1 (many design options) • Ask your J2EE expert • Read success stories • Use frameworks – they provide a specific path • Problem 2 (lots of repetitive, required code) • Java tools (like JDeveloper) • Frameworks in the tools • Problem 3 (deployment complexity) • Java tools help • Ask your J2EE expert • Not as important as with problem 1 Tools can’t help here, yet.
What is a Framework? • An extension of good reusable code strategies • Solve a problem once, use the code again in multiple projects • The code must be generically written but still functional • Provides a key service • For example, Struts framework provides control of page flow in a web application • Think “API” • Application Programming Interface • Code libraries you can use for extra functions
Benefits of a Framework • Promises increased productivity through code reuse • Prebuilt code supplies functionality you would have to build yourself • For example, connection layer to the database through JDBC • You write less 3GL code • Simplifies complexity of a high-level architecture • Complexity is hidden in the prebuilt code • Handles infrastructure and communication between layers • You just hook into it • Provides structure to the myriad number of technology combinations • The path to a particular goal is predefined
Components of a Framework • Code libraries • Provide the basic functionality • App-specific customizations usually appear in XML files • Extendable • Write your own code to supplement or replace the basic functionality • Documented method • You cannot be productive unless you know how to use the libraries • Tools • Optional but useful part • Without tools, you’re on your own with the framework code
An Example • ADF Business Components (ADF BC) • Formerly BC4J • Java code layer that connects application to the database • Contains base libraries that provide the connection capabilities • You can extend the libraries to replace or supplement the functions (Java files) • You define XML files that supply application-specific customization • For example, the definition of a table • JDeveloper contains ADF BC editors • Edit the XML files • Create Java files
Table COUNTRIES ADF BC Libraries ADF BC Code JDBC EntityImpl.java ViewObjectImpl.java Application Specific Files CountriesImpl.java public class CountriesImpl extends EntityImpl { public static final int COUNTRYID = 0; public static final int COUNTRYNAME = 1; public static final int REGIONID = 2; public static final int LOCATIONS = 3; public CountriesImpl() { } public String getCountryId() { return (String)getAttributeInternal(COUNTRYID); } public void setCountryId(String value) { setAttributeInternal(COUNTRYID, value); } public String getCountryName() { return (String)getAttributeInternal(COUNTRYNAME); } public void setCountryName(String value) { setAttributeInternal(COUNTRYNAME, value); } Countries.xml <?xml version='1.0' encoding='windows-1252' ?> <!DOCTYPE Entity SYSTEM "jbo_03_01.dtd"> <Entity Name="Countries" DBObjectType="table" DBObjectName="COUNTRIES" AliasName="Countries" BindingStyle="Oracle" UseGlueCode="false" RowClass="location.model.CountriesImpl" > <DesignTime> <Attr Name="_isCodegen" Value="true" /> <Attr Name="_version" Value="9.0.5.16.0" /> <Attr Name="_codeGenFlag2" Value="Access" /> <AttrArray Name="_publishEvents"> </AttrArray> </DesignTime> <Attribute Name="CountryId" IsNotNull="true" Precision="2" ColumnName="COUNTRY_ID" Type="java.lang.String" ColumnType="CHAR" SQLType="CHAR" TableName="COUNTRIES" PrimaryKey="true" RetrievedOnUpdate="true" RetrievedOnInsert="true" > <DesignTime> <Attr Name="_DisplaySize" Value="2" /> </DesignTime> </Attribute> CountriesView.xml <?xml version='1.0' encoding='windows-1252' ?> <!DOCTYPE Entity SYSTEM "jbo_03_01.dtd"> <ViewObject Name="CountriesView" SelectList="Countries.COUNTRY_ID, Countries.COUNTRY_NAME, Countries.REGION_ID" FromList="COUNTRIES Countries" BindingStyle="Oracle" CustomQuery="false" ComponentClass="location.model.CountriesViewImpl" MsgBundleClass="oracle.jbo.common.JboResourceBundle" UseGlueCode="false" > <DesignTime> <Attr Name="_version" Value="9.0.5.16.0" /> <Attr Name="_codeGenFlag2" Value="Access|Coll" /> <Attr Name="_isExpertMode" Value="false" /> </DesignTime> <EntityUsage Name="Countries" Entity="location.model.Countries" > CountriesViewImpl.java public class CountriesViewImpl extends ViewObjectImpl { public CountriesViewImpl() { } public void executeQuery() { super.executeQuery(); } public void setWhereClause(String whereClause) { super.setWhereClause(whereClause); } }
Challenges of Frameworks • Learning the method • Tools help • Without tools, you spend more time developing • Using the “out-of-the-box” functionality • If you can live with this, you will save lots of time • If you customize, you might spend more time than you would spend if you build your own • Use the normal framework definitions to build app-specific code (often XML files) • Getting assistance • Vendor support, online user forums, books
Agenda • What is a framework? • What is ADF? • Is it Forms?
Aiming High Your scheme must be the framework of the universe;all other schemes will soon be ruins.—Henry David Thoreau (1817–1862), A Week on the Concord and Merrimack Rivers
Sounds Like a Job for a Tool! • JDeveloper 10g • J2EE IDE • Code organizer • Code generator • Application DevelopmentFramework • Available only inJDeveloper 10g
Oracle Application Development Framework (ADF) • Attempt to meet the J2EE challenges • Feature available only in JDeveloper 10g • A wrapper for other frameworks • ADF BC (formerly BC4J) • ADF UIX (formerly UIX) • ADF JClient (formerly JClient) • Struts (non-Oracle, Jakarta Project open source) • An architecture • Implies a method and a tool • Based on MVC
Model Controller View Model-View-Controller (MVC) • SmallTalk strategy for application components • Now a J2EE design pattern • The MVC separation in layers allows you to plug in different front-end clients • Provides ability to separate layers for development • E.g., Can develop and test the model layer separately ADF splits the Model layer in two. Code to access data What happens when user interacts with UI; page flow User interface code
Java Local Client Web Client ADF Architecture View Swing model Swing event handlers Swing visual aspect ADF UIX JSP ADF JClient Controller Struts Model ADF Bindings ADF Data Controls Business Services Java Classes EJB Session Beans ADF Business Components Web Services
Business Services Java Classes EJB Session Beans ADF Business Components Web Services • Code layer for accessing data sources such as a database • Responsibilities: • Persistence • Data storage after the program ends • Object-relational (OR) mapping • Translating database objects to object-oriented structures • Use this layer to code business logic • The J2EE Business Tier
Business Services Technologies • Enterprise JavaBeans (EJBs) • Standard, popular, pure Java, J2EE code layer • Uses a runtime container process • Web services • Functions and resources written by a web provider • Can be incorporated into your application as remote calls • ADF Business Components • Formerly BC4J • Full framework for accessing Oracle databases • Easy to develop, powerful, has data caching • Java classes • Plain Old Java Objects (POJOs) supply data • TopLink in JDev used for OR mapping
Model ADF Bindings ADF Data Controls • This is the main innovation of ADF! • Connects Business Services to the View layer • Java local clients (heavy client) • Delivers data from Business Services to the View layer • View layer then updates the display • Web clients (light client) • Receives instructions from the Controller layer as requests for data retrieval and updates • Requests update of View layer
Model Layer – ADF Data Controls • Common code layer for multiple business services • Appears as list of components available for a specific business service • Component list changes based on selected data element • Selecting a component automatically binds it
Model Layer – ADF Bindings • Declares which data is connected to a user interface component • For example, LocationId text item is bound by code to the LOCATIONS.LOCATION_ID column • Works with the data controls to supply data model link from view components to business services • Data Control Palette in JDeveloper automatically binds the controls • You can also code this manually
Controller Struts • For web clients only • Defines what page is displayed next • Can apply conditional logic • Can interact with data to prepare next page • “Model 2” JSP (code logic not page links) • In JDev 10g (9.0.5), Struts is the default controller • Jakarta Project open source effort • Defines pages and actions that display the pages
View Java Local Client Web Client Swing model Swing event handlers Swing visual aspect ADF UIX JSP • User interface technologies • Java local client • Java runtime on the client • Part of J2SE (standard edition) • Uses JClient framework to communicate with model layer • Swing contains its own MVC components (Swing Model, event handlers for Controller, and visual aspects for View) • Web client • JavaServer Pages (JSP) technology • J2EE standard, light-client, tag-based interface • ADF UIX • Oracle-specific, XML-based interface used by E-Business Suite applications ADF JClient
ADF Does Not Help You Decide • No single, predefined technology path • ADF supports many technologies • “Productivity with Choice” • Similar in that way to Designer supporting various life cycle models • Traditional waterfall, RAD, Start-in-the-middle • Still need to make the design choices • However, some choices are better supported • For example, Struts is the default Controller
Other ADF Components • Code libraries • Mostly those of the individual frameworks (BC4J, Struts, JSP tags, JClient) • Common ADF runtime libraries • For data binding and model support • Documentation (online Help), OTN forums • Tools • JDeveloper utilities and work areas • Development method • Very loose set of steps • Uses JDeveloper tools to bind data
The Development Method • Create application workspace • Create Business Services and Model layers • Create View and Controller layers • Test and debug • Use the same tools for development regardless of technology choices Demo
Agenda • What is a framework? • What is ADF? • Is it Forms?
Nothing Like a Good Drill Man is a tool-using animal. ...Without tools he is nothing, with tools he is all.—Thomas Carlyle (1751–1881), Sartor Resartus
What’s Good About Forms? • Nothing better for highly-responsive UIs • Best thing around for rapid data entry • GUI controls are unmatched in pure HTML web applications • Java applications (with Swing controls) deployed on the Web have similar controls • Nothing better for RAD • Really fast prototypes • You don’t need to learn Javato do Forms • Still used by Oracle Applications It’s betterif youknow Java.
What’s Bad About Forms? • It’s a 4GL and has limitations • Legacy technology • Proprietary; not industry standard • Needs Oracle AS to deploy • “Functionally stable” (IBM term?) • Oracle is focusing on J2EE • Development tools • Application server • Database
What’s Good About JDeveloper and ADF? • Oracle is focusing on J2EE • JDeveloper is a J2EE tool • Supports any style of J2EE code • Heavy client; light client • Makes J2EE design, development, and deployment easier • No need to think much about “plumbing” • Supports different development styles • You can write 3GL code • You can use declarative tools
What’s Bad About JDeveloper and ADF? • It manages 3GL code • 3GL code is hard to create • It is not a RAD tool • You need to know Java • Big learning curve • Object-oriented thinking • J2EE has challenges • Not JDeveloper’s fault • You need to think about frameworks • It supports all paths • It provides no clear path
Is ADF Forms Yet? • ADF is really just a wrapper around proven (older) frameworks • ADF BC, ADF UIX, JClient, Struts • Would be an “Emperor’s New Clothes” except… • Data controls and bindings • Very nice innovation • This does speed up development • Oracle submitted to Java Community Process (JCP) as Java Specification Request (JSR) 227
So, Is ADF Forms Yet? • It can help shops that have mostly J2EE experts • J2EE experts will be more productive • They need to learn the ADF process • It can also help shops who have “traditional” non-J2EE Oracle developers • Forms and PL/SQL developers will be productive with the declarative tools • With training, they can write Java extensions • Much of the complexity is hidden • They need a J2EE expert to guide them and code the internal, complex stuff
Please Tell Me! • Can you achieve the productivity of Forms using ADF? • ADF is as close to RAD as any current J2EE tool • It is state-of-the-art plus • Good innovations • Very developer-friendly • Costlier than alternative J2EE tools • In other words, “Not yet” • Stay tuned for 10.1.3
Summary • Frameworks help development • Forms is a framework • One way to develop and deploy • Not so easy for J2EE applications • ADF is a framework and it also helps • A big step in the right direction • Provides support once you determine the path • Room for growth • More declarative tools • More recommended paths • Combining technologies is the remaining challenge
Designer Handbook Developer Advanced Forms & Reports JDeveloper 3 Handbook Available in Sept ORACLE JDeveloper 10g Handbook ORACLE9i JDeveloper Handbook Also co-authoredwith Avrom Roy-Faderman • Books co-authored with Dr. Paul Dorsey • Personal web site: • http://ourworld.compuserve.com/ homepages/Peter_Koletzke http://www.quovera.com • Founded in 1995 as Millennia Vision Corporation • Profitable for 7+ years without outside funding • Consultants each have 10+ years industry experience • Strong High-Tech industry background • 200+ clients/300+ projects • JDeveloper Partner • More technical white papers and presentations on the web site