1 / 83

E141 CocoBase, EA Server and PowerDesigner - Abstracting the Database Layer

E141 CocoBase, EA Server and PowerDesigner - Abstracting the Database Layer. Ward Mullins CTO THOUGHT Inc. Developing with CocoBase. The strengths of CocoBase ™ Enterprise O/R are its market leadership and features such as: JAVA Object  Relational (RDBMS) mapping tool.

alyn
Download Presentation

E141 CocoBase, EA Server and PowerDesigner - Abstracting the Database Layer

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. E141CocoBase, EA Server and PowerDesigner - Abstracting the Database Layer • Ward Mullins • CTO • THOUGHT Inc.

  2. Developing with CocoBase • The strengths of CocoBase ™ Enterprise O/R are its market leadership and features such as: • JAVA Object  Relational (RDBMS) mapping tool. • J2EE Object (EJB, JSP, Session)  Relational (RDBMS) mapping tool • IDE Integrations (JBuilder, Forte, VAJ) • UML/Modeling Integrations via XMI (PowerDesigner, Rose, etc.) • Ease of use and performance • Ease of maintenance and high reusability • Sybase Resells CocoBase www.thoughtinc.com

  3. Why is O/R Mapping used? • Before we examine the CocoBase product, we’ll take a look at object/relational mapping concepts in a generic fashion. Enterprise O/R mapping is a particular set of requirements, and we must first understand those requirements to understand the value of CocoBase and how this fits with Power Designer and EA Server. www.thoughtinc.com

  4. Why is Persistence needed? • In many enterprise level applications, there is a need for permanently storing of information related to a given business situation. • An Internet purchasing transaction is a good example of such a situation: • New customers will log onto a website • Register their name, address, telephone number, credit card number and other vital information & place orders. • This information is likely to be saved or “persisted” to a database through some data-mapping layer. This is often directly coded in the application through JDBC/SQL embedded within the application. www.thoughtinc.com

  5. Where CocoBase Fits www.thoughtinc.com

  6. Mapping for the Object to Relational World • Map from the Object World to Relational • Persisting an object from the object world adds one or more rows to tables in the relational world (db) • Map from Relational World to Object World • Performing a database search in Relational world, finds a number of rows. These rows of data are used to create instances of an object in the Object world. • Manage Relationships between objects • This is often called Lifecycle or Object Model Management. www.thoughtinc.com

  7. Where CocoBase Fits • THOUGHT Inc’s focus is on Java, and includes special integrations for Enterprise JavaBeans (EJBs), as well as an out of the box Session Bean ported to EAServer. • CocoBase can also provide standalone or direct object persistence of standard java classes with Session beans, JSPs, Applets or Applications. • CocoBase maps can be created from UML/XMI and be reused by different java code across multiple applications and programming models, reducing new development efforts. www.thoughtinc.com

  8. EJB Transactions and the Data • EJB is a specification, based on the Java programming language, for developing enterprise level applications and among it’s many benefits are built-in transaction and distributed components capabilities. • For transaction management, this means that if a fault occurs while a transaction (such as a banking account update) is in progress, the entire transaction will be rolled back to a known valid state. • CocoBase integrates with and relies on the Transaction support of EA Server to manage & coordinate transactions. www.thoughtinc.com

  9. EJB Transactions and the Data • For distributed component management, an EJB application can communicate with both remote clients and databases. • This means that a merchant business running an EJB server in Argentina can have a database server running in Finland and a client application serving a customer base running in Bangladesh. • While this scenario may currently be unlikely for every company, it demonstrates the power and potential of EJB and the Java programming language. www.thoughtinc.com

  10. EJB Transactions and the Data • Because the EJB architectural specifications are maintained by Sun Microsystem’s Java Division. Both EJB and Java are supported by many major corporations • BEA • Sun One AS • IBM • Sybase, etc. • …and is used by an even larger set of corporations • EJB has gained huge momentum in the enterprise development arena with IT. 55% of all Corporate Development will be in Java in 2002 www.thoughtinc.com

  11. Types of EJBs • Now, let’s look at how EJBs actually work on the surface. • There are two general types of persistent EJBs referred to as either Session Beans or Entity Beans (BMP and CMP). • The main difference between them is that Session Beans generally represent a process and are used to manage that process, and Entity Beans represent specific persistable, database-oriented entities (conceptually - a row of data). • Session beans however can directly access persistent data using the CocoBase generic session beans included with the distribution for Distributed Transparent Persistence and generally higher performance persistence than Entity Beans can provide. www.thoughtinc.com

  12. How the Components Interact – an example in action • A shopping cart application used for an online store may then have a ShoppingCart session bean managing the Customer and Order entity beans. • The Customer entity bean represents a customer and the Order entity bean represents that customer’s order. • THOUGHT Inc. ships a complex shopping cart example that demonstrates EJB, Session, and JSP with EA Server. • THOUGHT Inc. also ships an integrated Session Bean for EA Server Server that implements complex distributed Transparent persistence with lazy loading for EA Server. www.thoughtinc.com

  13. How the Components Interact www.thoughtinc.com

  14. How the Components Interact www.thoughtinc.com

  15. How the Components Interact • Here, we get to another distinction between session beans and entity beans in that while both session and entity beans can retrieve data from a database, traditionally only entity beans persist data to the database. Note that this is not a restriction as much as a common practice. • Session beans can directly access persistent data, and with an O/R mapping tool actually provide an easier programming model and better complex data persistence than Entity Beans provide. www.thoughtinc.com

  16. How the Components Interact • Therefore, while the ShoppingCart session bean manages the current shopping cart session by delegating specific tasks to the subordinate entity beans - Order and Customer, only the Order and Customer entity beans actually persist the data resulting from the current shopping session. • This data may include, for example, the quantity and types of items ordered and whether or not the customer has a new address. www.thoughtinc.com

  17. Data into the Component • Now, lets look at how the data gets into the database in more detail. • An EJB executing a purchasing transaction will eventually need to make a permanent record of the results if the company hosting the transaction is to be profitable. • In order to make a permanent record of the transaction, the EJB will have to “write” its data to some database. www.thoughtinc.com

  18. EJB Components • In the following slide, data attributes from a simplified EJB component representing a customer account are written to a set of database tables (real world EJBs actually have several parts comprising the component). www.thoughtinc.com

  19. EJB Components www.thoughtinc.com

  20. EJB Components • Each table contains a set of columns, each corresponding to at 1 one attribute in the component. • The EJB for example, contains a String attribute resAddress, which corresponds to a VARCHAR attribute res_address in the Customer table. • In order to make this match, some mapping scheme must exist to pair the object attribute with the table entry. www.thoughtinc.com

  21. Using the Database and the Map • Writing or persisting data to a database through a map creates a permanent copy of the result set of some transaction or process that has occurred in the application. • This data can then be retrieved for further processing or for future reference at some later date. www.thoughtinc.com

  22. Starting with UML • CocoBase can start with the database tables, java classes or a UML tool like Power Designer. • The created model is exported as an XMI file using the UML/XMI exporters that ship with UML tools. • The XMI file is imported into CocoBase. • This creates the maps & navigation and inheritance model representations. • Database tables can be created as well if the customer wants. www.thoughtinc.com

  23. Dynamic Mapping Using CocoBase • Dynamic Mapping Using CocoBase • Dynamic mapping means the object (ie the map) can be changed on the fly without recompile or regeneration of code. • With Dynamic Mapping, a map can be shared across many object models • Servlet , JSP, Session, CORBA or RMI client, applet, EJB object, or Java Class • …these can all share the same map which is dynamically loaded from the CocoBase repository at runtime. • They can even share the same mapping definition and even the same object cache simultaneously! www.thoughtinc.com

  24. Dynamic Mapping Using CocoBase • As an example, a company’s IT section could write separate EJB components for the Sales and Accounting divisions and these two EJBs could share the same database map because they access the same data, even though the business rules associated with each EJB are entirely different. • The Sales organization could then report their quarterly sales figures to the database through their EJB application component. • These figures could then be retrieved by the Accounting division using their EJB application component, and used to publish the company’s quarterly earnings. www.thoughtinc.com

  25. Dynamic Mapping Using CocoBase www.thoughtinc.com

  26. Dynamic Mapping Using CocoBase • The CocoBase toolset (CocoAdmin) can also generate the basic, non-proprietary Java code elements for the object model for the developer – all in standard java form. • If the developer is creating an EJB, all of the EJB components can be generated as source code using CocoAdmin, command line tools or API. • This includes the Home and Remote interfaces and the Primary Key and Bean implementation classes. www.thoughtinc.com

  27. Dynamic Mapping Using CocoBase • If the developer wants to… • Performance tune or port an application • Optimize or change a database table structure (e.g. such that data is retrieved from a join of tables instead of just a single table) • Or redo the relationships in Power Designer and implement in CocoBase • …the CocoBase mapping structure will allow changing a single mapping definition that can ripple through the entire enterprise and multiple applications in seconds. www.thoughtinc.com

  28. Dynamic Mapping Using CocoBase • That change will be reflected across all the objects which use that map. www.thoughtinc.com

  29. Dynamic Mapping Using CocoBase • This becomes a huge benefit in real enterprise application development where many objects will share a common mapping definition, as opposed to a quick prototype where a given mapping definition will correspond to a single or a few object definitions. • The ODMG (Object Data Management Group)/JDO and built-in CMP models and the embedded SQL (traditional BMP) model tend to break down in the Internet and enterprise space because they are too rigidly coded, too tightly bound, too inflexible, and they don’t offer any way to enhance the functionality of the application or of the mapping behavior without significant effort. www.thoughtinc.com

  30. Dynamic Mapping Using CocoBase www.thoughtinc.com

  31. Dynamic Mapping Using CocoBase • Another advantage of the dynamic model is that it allows for easy implementation of custom caching, custom routing, and other custom behaviors such as calling stored procedures or audit operations on the fly! • For example, if an example application was written against an RDBMS system and the developer finds that for their particular application that their version of the RDMBS and their platform doesn’t perform fast enough, they can drop an in-memory cache database system into their applications on the fly, without changing any of the object definitions – NO RE-CODING! www.thoughtinc.com

  32. Dynamic Mapping Using CocoBase www.thoughtinc.com

  33. CocoBase Plug-In • That plug-in will divert a query to the cache first, then use the map against the database if the data is not found in the cache. • Furthermore, CocoBase allows this type of caching to be supported across distributed object models and different server vendors. www.thoughtinc.com

  34. CocoBase Plug-In • With the CocoBase plug-in system the developer is leveraging the mapping functionality, and enhancing it with this additional capability – and without having to change the application logic or object model. • The mapping layer sits between the application and the database and is dynamic. Therefore it allows the developer to dynamically insert new behaviors through the callback plugin system. www.thoughtinc.com

  35. JDBC Specific Code • If the developer was implementing an application using the JDBC driver model where database specific code is embedded directly in their object, they would have to manually add or change every driver hook in every object to take advantage of a newly available data caching system. • They would then have to re-compile and re-deploy every object that requires this new functionality. • CocoBase allows database and SQL specific calls to be inserted in the map and picked up at runtime. www.thoughtinc.com

  36. Produce J2EE and J2SE Quickly • Using a dynamic model, the developer can also produce an application that is faster, more scalable and more extensible than a static model approach. • Most people think that a static model, because there’s no mapping layer, will perform more efficiently than our dynamic model – but the reality is that Dynamic Mapping is usually as fast or faster than hand coded applications because of the optimizations which can be performed at runtime. www.thoughtinc.com

  37. Dynamic Mapping Improves Performance • CocoBase’s mapping layer is so highly optimized and the enhancements that we have implemented are so sophisticated that applications written using the CocoBase mapping layer tend to run faster than hand written applications with a manually implemented, static database mapping system. • In some cases, up to 4000% (Yes! 40X) faster! • This is with plug-in caching enabled. • System performance gain without caching is up to 400% over hand written applications. www.thoughtinc.com

  38. CocoBase is Transparent • All of these benefits are achieved without requiring object inheritance from some special class or implementing some proprietary interface. • CocoBase Enterprise provides the most widely accepted standard in the industry for O/R mapping without requiring custom or proprietary changes to Java Classes. www.thoughtinc.com

  39. CocoBase is Transparent • If this technology is coupled with database gateways and or the CocoBase plug-in extensions, the developer can even update data in multiple databases simultaneously from a single bean! • This is just one example of the flexibility afforded the developer or user using CocoBase and it’s runtime extensions. • This kind of enhancement would be prohibitively expensive to implement using the other mapping approaches. www.thoughtinc.com

  40. The Cost of CocoBase to hand coded BMP and CMP www.thoughtinc.com

  41. The Cost of CocoBase to hand coded BMP and CMP www.thoughtinc.com

  42. The Cost of CocoBase to hand coded BMP and CMP www.thoughtinc.com

  43. CocoBase Functionality • Dynamically Maps to all JDBC compliant databases • Create, Edit and Delete Maps • Single or many tables per map supported • Supports Stored Procedures even for EJBs • Automatic extensible Java code generation • Export Map repository as XML for runtime or backup • Import existing Java classes to create table and Map • Generate maps and beans from existing tables • User can customize CocoBase via properties files • Separate and powerful navigation to manage enterprise graphs of objects locally or distributed www.thoughtinc.com

  44. CocoBase Functionality • Automatic code generation • Code generated is based on editable templates • Templates defined by CocoBase (THOUGHT Inc.) and by users and or partners • Templates provided with the system for • Default Java Object • Transparent Persistence • EJB file set of CMP/BMP Entity Beans, Session Beans and JSPs for EA Server and other app server platforms. www.thoughtinc.com

  45. CocoBase Functionality • Import Java Classes • Creates new database tables reflecting attributes • Generation of maps is aided by Java reflection • Relationships are somewhat auto-detected and auto-mapped to relational tables with current release, but UML provides the better solution for this task. • Reflection can auto detect public attributes or private attributes with public get/set methods • Supports ‘primitive’, but ‘Object’ types typically required for ‘null’ column support www.thoughtinc.com

  46. How CocoBase Works • CocoBase Mapping is based on a repository • Map from object attributes to columns in many different tables supported • RDB or XML Repository (The map tables for CocoAdmin) • Objects are dynamically bound to the DB with Map • Mappings can be changed without having to recompile code or re-deploy beans www.thoughtinc.com

  47. How CocoBase Works • Admin Tool is used for • Defining and editing mapping information • Generating EJB’s or java classes related to a given map • Generating SQL-Scripts to create a table based on a given bean or Java Class(import) • Generating XML - Repositories for runtime • Can also do admin from command line or API • Small Overhead for Runtime • + / - 5% performance hit over hand coded JDBC. • Usually a 30% gain or more in EJB application performance over hand coded JDBC www.thoughtinc.com

  48. Application Servers and CocoBase • CocoBase uses the JDBC Connection Pool from application server • CocoBase doesn’t commit any Transactions in EA Server. • Transaction handling is done by the App Server container entirely • CocoBase can generate EJB (CMP & BMP) Entity Beans, Session Beans, and JSP’s from a Map • Everything that CocoBase generates is template based and therefore customizable • Relationships supported with EJB through Map one to one, one to many, many to many, bean to bean, bean to non-bean www.thoughtinc.com

  49. Application Servers and CocoBase • CocoBase generates the following for EJB Entity Beans • Remote Interface, Home Interface, Bean Implementation, PK Class Implementation, and Descriptors • Properties file for environment info (JDBC Connection) • Manifest file • Make file, batch & shell to compile, to process the descriptor and to jar all the necessary elements into the jar file for the deployment into App Server. • CMP or BMP Bean with XML descriptor ready to deploy • Do not have to (re) generate all the files when map changes occur. www.thoughtinc.com

  50. Application Servers and CocoBase • CocoBase CMP Installer for BMP based CMP • Generate CMP with CocoBase or use Third Party Tool • Once the generic CMP bean is generated from the template or from 3rd party tools, use the CMP installer • Read in the XML descriptor from CocoBase Bean or put in information by hand for the database and pick the Application server • CMP Installer checks the bean and subclasses it • Bean is tied to a map • Finders are created • Generate the code, check it over and deploy when ready • Pluggable CMP support available with Dependent Objects for almost 30 different server/versions. www.thoughtinc.com

More Related