1 / 20

INTRO TO BUSINESS COMPONENTS FOR JAVA (BC4J)

INTRO TO BUSINESS COMPONENTS FOR JAVA (BC4J). Matt Fierst Computer Resource Team mjfierst@crtinc.com OracleWorld 2003 - Session 36321. Why Should I Care?. Efficiency Productivity Maintainability. Topics. What is BC4J? Why use BC4J? BC4J Architecture and Components

rusk
Télécharger la présentation

INTRO TO BUSINESS COMPONENTS FOR JAVA (BC4J)

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. INTRO TO BUSINESS COMPONENTS FOR JAVA (BC4J) Matt Fierst Computer Resource Team mjfierst@crtinc.com OracleWorld 2003 - Session 36321 1

  2. Why Should I Care? • Efficiency • Productivity • Maintainability 2

  3. Topics • What is BC4J? • Why use BC4J? • BC4J Architecture and Components • Demo - BC4J in action 3

  4. What is BC4J? • It is a bridge from the Relational world (database) to the Object world (Java) Java Application BC4J Database 4

  5. What is BC4J? “Business Components for Java is JDeveloper’s programming framework for building multi-tier database applications from reusable business components.” 5

  6. What is JDeveloper? • Oracle’s Java and XML development suite • Language-sensitive editors • Java Compiler • UML modeling tool • Tools, frameworks, and utilities to help write your code • Built-in web server and OC4J server to help test your code • Debuggers and profilers to help perfect your code • Wizards and utilities to help bundle and deploy your code 6

  7. What is a Business Component? • Code that implements functionality associated with an application object • Java and XML • May interact with a database • May implement business rules • Encapsulates your business logic • Therefore, your presentation layer is much “cleaner” • Reusable • Flexible deployment • Deploy to client (e.g., application, applet) • Deploy to middle tier or database (e.g., servlet, JSP, Web Service, EJB, CORBA) 7

  8. BC4J is Part of JDeveloper • “Programming Framework” • Wizards and tools for defining, customizing and testing components • Class library and custom JSP tags for developing your applications • Use any front end you wish • JSP, Struts, etc • Swing • XML • Deploy on any J2EE server 8

  9. Why Use BC4J? • I could just as well do it all myself! • JDBC to connect to the database • java.sql.* or SQLJ to interact with the database • Besides, Java itself promotes encapsulation, reusability, etc. • True, but why re-invent the wheel? 9

  10. Why use BC4J? (cont.) • Wizards let you declaratively define your business components • Specify the data you want (table, column) • BC4J generates the “plumbing” to interact with that table • You can focus on implementing your application-specifics 10

  11. Why use BC4J? (cont.) • Tools help you use the components • oracle.jbo: library of classes to directly interact with them • Custom tag library to use in your JSPs • Tags tied to Java classes • Include the tag in your JSP, class methods are automatically invoked • BC4J can also generate a JSP app for you • This is NOT magic, though! • Quite simplistic • However, it could be a great starting point 11

  12. Why use BC4J? (cont.) • Gives you the option to better divide development responsibility • Java-savvy developers can focus on components • Web-savvy developers can focus on presentation layer • Easier to learn the custom tags than to learn Java • BC4J handles all the database connection details for you • Built-in connection pooling 12

  13. Why use BC4J? (cont.) • The downside: setting up these components takes time - planning and building • Depending on the application, and how it evolves, this could be time well spent • Isolation of business logic improves maintainability • Of the business logic • Of the presentation layer • Of the back-end database • The bottom line: Is BC4J right for EVERY application? • No • But, it’s a great tool to have in your toolbox! 13

  14. BC4J Architecture Application BC4J AM Database 14

  15. BC4J Architecture (cont.) • Types of Components: • Application Module (AM) • Container for organizing and deploying other components • Provides run-time context for defining and executing transactions • Takes care of database connections • Takes care of Master-Detail coordination • Takes care of row locking 15

  16. BC4J Architecture (cont.) Application VO VO VO VO BC4J AM EO EO EO EO EO Database 16

  17. BC4J Architecture (cont.) • Entity Object (EO) • Provides a wrapper for database structures • Create an EO for each table, view, or stored procedure • EOs contain Attributes, corresponding to columns or procedure parameters • View Object (VO) • Your application’s interface to the BC4J layer • Hide the complexity of the database from the application • Uses SQL query to specify filtered subsets of data from one or more EO • VO Attributes correspond to EO Attributes • Provide cached, navigable, modifiable result sets • Provide runtime dynamic linking, sorting, and filtering 17

  18. BC4J Architecture (cont.) • Association • Relationships between EOs • Automatically created based on Foreign Keys • Manually created based on common Attributes • View Link • Relationships between VOs • Enforce Master-Detail filtering • Domain • User-defined data types for EO and VO Attributes • Define in a central location: • Validation rules • Default values • Error messages 18

  19. DEMO • Our JSP application: • Uses the “scott” schema • Displays employee/department data • We want to build a page to list “worker bees” • Those employees who are not managers • First, we’ll try a JDBC approach • Then we’ll try two BC4J approaches • Create the components, manually write a JSP • Have JDeveloper generate a JSP application for us • For instructions for this demo, and code snippets, download paper - Session 36321 19

  20. To Learn More • JDeveloper on-line help is a great place to start • JDeveloper samples • c:\jdev\BC4J\samples • OTN - sample code • http://otn.oracle.com/sample-code/products/jdev/content.html 20

More Related