Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Apache Beehive BEA User's Group Oct 2004

1,027 views

Published on

An overview of the Apache Beehive project

Published in: Technology
  • Be the first to comment

  • Be the first to like this

Apache Beehive BEA User's Group Oct 2004

  1. 1. Apache Beehive Project Technical Overview Scott Ryan, Denver BEA User ’ s Group Rich Feit , Beehive committer, BEA Systems October 7, 2004
  2. 2. Agenda <ul><ul><li>Introduction and Overview </li></ul></ul><ul><ul><li>Technology Requirements </li></ul></ul><ul><ul><li>XML Beans </li></ul></ul><ul><ul><li>Web Services </li></ul></ul><ul><ul><li>NetUI </li></ul></ul><ul><ul><li>Controls </li></ul></ul><ul><ul><li>WebLogic Workshop Demo </li></ul></ul><ul><ul><li>Pollinate Demo </li></ul></ul><ul><ul><li>Getting Involved </li></ul></ul>
  3. 3. Introduction and Overview
  4. 4. Beehive Goals <ul><ul><li>Beehive is an open-source software project designed to deliver a cross-container, ease-of-use programming model and application framework for J2EE- and SOA-based applications. </li></ul></ul><ul><ul><li>Deliver a comprehensive, easy-to-use framework for building dynamic J2EE and SOA applications. </li></ul></ul><ul><ul><ul><li>Based on over 3 years of experience “ making it easy ” with WebLogic Workshop </li></ul></ul></ul><ul><ul><ul><li>Designed with tool-ability in mind from the outset </li></ul></ul></ul><ul><ul><li>Provide ultimate investment protection and transparency through open source and portability </li></ul></ul><ul><ul><li>Strengthen the Java market by providing world-class ease-of-use to all Java developers </li></ul></ul>
  5. 5. Beehive Components <ul><ul><li>XMLBeans –Java-XML binding tool through which you can access the full power of XML in a Java-friendly way. </li></ul></ul><ul><ul><li>Java Controls - JavaBean-based component model for resource access </li></ul></ul><ul><ul><li>Java Web Services - Annotations for rapid Web Service development </li></ul></ul><ul><ul><li>Java Page Flows - Struts-based MVC framework for Web application design </li></ul></ul>
  6. 6. How Beehive Fits <ul><ul><li>Beehive Application Framework </li></ul></ul><ul><ul><ul><li>A runtime component providing a higher-level programming abstraction for J2EE and SOA-based applications </li></ul></ul></ul><ul><ul><ul><li>Meta-data driven programming model and framework based on JSR-175 (Java Metadata) </li></ul></ul></ul>WebLogic Application Server Web Services Java Web Services Unified Interconnection Model Controls XMLBeans XML Schema/ Java <xml> Java PageFlows Visual Struts Editing Beehive Application Framework Pollinate Eclipse Plug-ins User Interface Components Tomcat Application Server Third-party Application Servers WebLogic Workshop
  7. 7. Beehive in WebLogic
  8. 8. Technology Requirements
  9. 9. Technology Requirements <ul><ul><li>JAVA 1.5 beta3-b63 or later </li></ul></ul><ul><ul><ul><li>http://java.sun.com/j2se/1.5.0/download.jsp </li></ul></ul></ul><ul><ul><li>JSR 175 </li></ul></ul><ul><ul><li>JSR 173 </li></ul></ul><ul><ul><li>Tomcat 5.x (Servlet 2.4 / JSP 2.0) </li></ul></ul><ul><ul><li>Ant 1.6.2 </li></ul></ul><ul><ul><li>Eclipse 3.0.1M1 </li></ul></ul><ul><ul><li>Log4j 1.2.8 </li></ul></ul><ul><ul><li>XMLBeans 2.0 </li></ul></ul><ul><ul><li>Velocity </li></ul></ul><ul><ul><li>Test Infrastructure </li></ul></ul><ul><ul><ul><li>JUnit, JAXP, Crimson, HttpUnit, regexp </li></ul></ul></ul>
  10. 10. XML Beans
  11. 11. XMLBeans: a Beehive Building Block <ul><ul><li>XMLBeans provide a familiar, JavaBean-based view of XML data </li></ul></ul><ul><ul><ul><li>Without losing access to the original, native XML structure </li></ul></ul></ul><ul><ul><ul><li>Beans are bound to the XML document…not imported/exported </li></ul></ul></ul><ul><ul><li>XML Schema used to compile strongly-typed Java interfaces and classes </li></ul></ul><ul><ul><ul><li>XMLBeans supports all XML schema definitions </li></ul></ul></ul><ul><ul><ul><li>Full XML Infoset fidelity </li></ul></ul></ul><ul><ul><ul><li>Reflect into the XML schema itself through an XML Schema Object model </li></ul></ul></ul><ul><ul><li>XMLBeans access to XML is fast and rich: </li></ul></ul><ul><ul><ul><li>Strong-typed getters and setters </li></ul></ul></ul><ul><ul><ul><li>XQuery transformations </li></ul></ul></ul><ul><ul><ul><li>Loosely-typed via cursors </li></ul></ul></ul><ul><ul><li>Separate Apache Project but is bundled in Beehive distribution </li></ul></ul>XMLBeans make XML a first-class citizen in Java
  12. 12. XMLBean Usage XML Schema Address.xsd Generated Classes Address AddressDocument // create and populate a document AddressDocument doc = AddressDocument.Factory.newInstance(); Address ad = doc.addNewAddress(); ad.setType(&quot;office&quot;); ad.setName(&quot;Eric Cartman&quot;); ad.setAddress1(&quot;101 Main&quot;); ad.setCity(&quot;Boulder&quot;); ad.setState(&quot;CO&quot;);
  13. 13. Web Services
  14. 14. Java Web Services <ul><ul><li>JSR-181 defines annotations to enable easier Web service programming. Example: @WebService public class StockQuoteService { </li></ul></ul><ul><li>@WebMethod public float getLastTradePrice(String tickerSymbol) { } </li></ul><ul><li>} </li></ul><ul><ul><li>Abstracts SOAP marshalling, Java-to-XML binding, WSDL file creation, underlying bean deployment, and much more </li></ul></ul><ul><ul><li>Two development models: </li></ul></ul><ul><ul><ul><li>Start with Java: expose class as Web Service using metadata </li></ul></ul></ul><ul><ul><ul><li>Start with WSDL: tool produces classes </li></ul></ul></ul><ul><ul><ul><li>Metadata allows for alterations/customization </li></ul></ul></ul>
  15. 15. NetUI
  16. 16. Controls
  17. 17. Overview <ul><ul><li>Provides a standard architecture for developing resource access frameworks. </li></ul></ul><ul><ul><li>Designed to simplify code necessary to access J2EE resources </li></ul></ul><ul><ul><li>Designed with tool-ability and IDE integration in mind. </li></ul></ul><ul><ul><li>Based on the Java Bean component model. </li></ul></ul><ul><ul><li>Aimed at reducing the J2EE learning curve. </li></ul></ul>
  18. 18. Overview <ul><ul><li>Flexible configuration model </li></ul></ul><ul><ul><li>Extensibility by interface to extend existing controls with additional functionality </li></ul></ul><ul><ul><li>Adaptable containment from J2EE to servlet to standalone containment. </li></ul></ul><ul><ul><li>Resource Management with a defined lifecycle. </li></ul></ul><ul><ul><li>Supports composition model. </li></ul></ul><ul><ul><li>Well defined packaging model. </li></ul></ul>
  19. 19. Configuration <ul><ul><li>Programmatic Java Bean Property Access. </li></ul></ul><ul><ul><ul><li>myTimerBean.setTimeOut( “ 3 Seconds ” ); </li></ul></ul></ul><ul><ul><li>Externally configured property value via Deployment Descriptor </li></ul></ul><ul><ul><ul><li><timer:timer xmlns:timer= “ http://openuri.org/com/myco/TimerControl ” > </li></ul></ul></ul><ul><ul><ul><ul><li><timer:timeOut>3 Seconds</timer:timeOut> </li></ul></ul></ul></ul><ul><ul><ul><ul><li></timer:timer> </li></ul></ul></ul></ul><ul><ul><li>JSR-175 Metadata property definition </li></ul></ul><ul><ul><ul><ul><li>@Timer(timeout= “ 3 Seconds ” ) </li></ul></ul></ul></ul><ul><ul><ul><ul><li>Public TimerControlBean myTimeBean; </li></ul></ul></ul></ul>
  20. 20. Extensibility by Interface <ul><li>Public interface CustomerDatabase extends ControlExtension, DatabaseControl </li></ul><ul><li>{ </li></ul><ul><li>@sql statement= “ INSERT INTO CUSTOMERDB(ID,NAME) VALUES({id},{name}) ” </li></ul><ul><li>int newCustomer(int id, String name) throws SQLException; </li></ul><ul><li>@sql statement= “ SELECT * FROM CUSTOMERDB WHERE ID = {id} ” </li></ul><ul><li>Customer findCustomer(int id); </li></ul><ul><li>} </li></ul><ul><ul><li>Defined by the author of the control. </li></ul></ul>
  21. 21. Adaptable Containment <ul><ul><li>Services are contextual </li></ul></ul><ul><ul><ul><li>Allows support within multiple runtime contexts (J2EE, Servlet, Java Native, etc.) </li></ul></ul></ul><ul><ul><ul><li>Must support resource access from within any context </li></ul></ul></ul><ul><ul><ul><li>Implementation of services might vary depending on container (i.e. security service) </li></ul></ul></ul><ul><ul><li>Based on JavaBeans Runtime Containment and Services Protocol </li></ul></ul>
  22. 22. Resource Management <ul><ul><li>Well defined lifecycle </li></ul></ul><ul><ul><ul><li>onAcquire </li></ul></ul></ul><ul><ul><ul><ul><li>Fired upon first client access </li></ul></ul></ul></ul><ul><ul><ul><li>onRelease </li></ul></ul></ul><ul><ul><ul><ul><li>Fired if acquire was fired at the end of the resource scope. </li></ul></ul></ul></ul><ul><ul><ul><li>Resource Scope is defined by the bounding container </li></ul></ul></ul><ul><ul><ul><ul><li>Web Container – HTTP Request </li></ul></ul></ul></ul><ul><ul><ul><ul><li>EJB Container – Method invocation or User Transaction </li></ul></ul></ul></ul>
  23. 23. Programmatic Client Model TimerControlBean myTimerBean = (TimerControlBean)ControlBean.instantiate(classloader, “ com.myco.timerControlBean ” ); myTimerBean.setTimeout( “ 3 seconds ” ); myTimeBean.addTimerControlEventListener ( // anonymous event handler class new TimerControlEventListener() { public void onTimeout(long time) { // timer event handling code } } );
  24. 24. Declarative Client Model <ul><li>@Timer(timeout= “ 3 seconds ” )TimerControlBean myTimerBean; </li></ul><ul><li>public void myTimerBean_onTimeout(long time) </li></ul><ul><li>{ </li></ul><ul><ul><li>// timer event handling code </li></ul></ul><ul><ul><li>} </li></ul></ul>
  25. 25. Java Control Architecture
  26. 26. Control Parts
  27. 27. CODE TIME <ul><ul><li>Sample Database Control that is extensible </li></ul></ul><ul><ul><li>DatabaseControl.java </li></ul></ul><ul><ul><ul><li>Interface </li></ul></ul></ul><ul><ul><li>DatabaseControlImpl.jcs </li></ul></ul><ul><ul><ul><li>Base Implementation </li></ul></ul></ul><ul><ul><li>TestDbControl.jcx </li></ul></ul><ul><ul><ul><li>Extension Implementation </li></ul></ul></ul><ul><ul><li>DriveDatabaseControl.java </li></ul></ul><ul><ul><ul><li>Test class </li></ul></ul></ul>
  28. 28. Page Flow Programming Model <ul><ul><li>Controls are service abstractions </li></ul></ul><ul><ul><ul><li>A ‘ façade ’ layer for accessing data and services </li></ul></ul></ul><ul><ul><li>Actions are the core of the code in a web application </li></ul></ul><ul><ul><ul><li>Do flow control for routing to UI based on state </li></ul></ul></ul><ul><ul><ul><li>Invoke control methods to access the business tier </li></ul></ul></ul><ul><ul><ul><li>Break a webapp into manageable pieces </li></ul></ul></ul><ul><ul><ul><li>Send data to / consume data from pages </li></ul></ul></ul><ul><ul><li>Pages are ‘ dumb ’ </li></ul></ul><ul><ul><ul><li>But not simple! </li></ul></ul></ul><ul><ul><ul><li>They contain only UI related code / JSP tags </li></ul></ul></ul><ul><ul><ul><li>Preferably no Java code </li></ul></ul></ul>
  29. 29. Authoring Model <ul><ul><li>JPF Files </li></ul></ul><ul><ul><ul><li>Metadata driven Java </li></ul></ul></ul><ul><ul><ul><li>Processed by Sun ’ s APT to produce </li></ul></ul></ul><ul><ul><ul><ul><li>struts-config.xml </li></ul></ul></ul></ul><ul><ul><ul><ul><li>validator-rules.xml </li></ul></ul></ul></ul><ul><ul><ul><ul><li>Java class file </li></ul></ul></ul></ul><ul><ul><li>JSP Files </li></ul></ul><ul><ul><ul><li>Actions expose data to JSPs </li></ul></ul></ul><ul><ul><ul><li>NetUI tag libraries render UI </li></ul></ul></ul><ul><ul><li>Shared Flows </li></ul></ul><ul><ul><ul><li>Used throughout a web application to handle actions / exceptions across Page Flows </li></ul></ul></ul>
  30. 30. A Page Flow Action @Jpf.Action(forwards={ @Jpf.Forward(name=&quot;success&quot;, path=&quot;viewOrder.jsp&quot;, actionOutputs = { @Jpf.ActionOutput(name = &quot;order&quot;, type = org.apache.beehive.samples.petstore.model.Order.class, required = true) }) } ) protected Forward viewOrder(CheckoutForm form) { _sharedFlow.ensureLogin(); _order=form.getOrder(); Forward f=new Forward(&quot;success&quot;); Boolean isCheckOut=new Boolean(form.isCheckOut()); f.addActionOutput(&quot;order&quot;, _order); return f; }
  31. 31. Programming Model Details <ul><ul><li>Single threaded actions </li></ul></ul><ul><ul><li>State management </li></ul></ul><ul><ul><ul><li>Request <= Page Flow <= Shared Flow <= Session </li></ul></ul></ul><ul><ul><li>Declarative validation </li></ul></ul><ul><ul><li>Simple actions </li></ul></ul><ul><ul><ul><li>Navigation based entirely on metadata </li></ul></ul></ul><ul><ul><li>Action Output / Page Input </li></ul></ul><ul><ul><ul><li>Data flow contracts enforced between actions and pages </li></ul></ul></ul><ul><ul><li>Singleton Page Flows </li></ul></ul><ul><ul><li>Optimizations to prevent session serialization in cluster </li></ul></ul>
  32. 32. Integrating all of Beehive <ul><ul><li>Control composition </li></ul></ul><ul><ul><ul><li>WSM </li></ul></ul></ul><ul><ul><ul><ul><li>Controls can be used as part of WS implementations </li></ul></ul></ul></ul><ul><ul><ul><ul><li>Web service controls expose web services for use in JPFs </li></ul></ul></ul></ul><ul><ul><ul><ul><ul><li>Don ’ t worry about marshalling, expose JavaBeans </li></ul></ul></ul></ul></ul><ul><ul><ul><li>Controls </li></ul></ul></ul><ul><ul><ul><ul><li>Abstract J2EE resources in supported containers </li></ul></ul></ul></ul><ul><ul><li>Page Flow </li></ul></ul><ul><ul><ul><li>Consumes all of the above allowing web application developers to code to controls </li></ul></ul></ul><ul><ul><ul><li>One abstraction for all back-end services </li></ul></ul></ul>
  33. 33. The Page Flow Compiler <ul><ul><li>[TODO: picture] </li></ul></ul>
  34. 34. Beehive/NetUI JSP Tags <ul><ul><li>Integrated with a JSP 2.0 container </li></ul></ul><ul><ul><ul><li>Uses the JSP 2.0 EL on almost all JSP tag attributes </li></ul></ul></ul><ul><ul><li>Render HTML or XHTML </li></ul></ul><ul><ul><ul><li>Configurable with a webapp-level setting </li></ul></ul></ul><ul><ul><li>New Data Grid </li></ul></ul><ul><ul><ul><li>Paging / sorting / filtering </li></ul></ul></ul><ul><ul><ul><li>Extensibility model for building new column types, pagers, etc </li></ul></ul></ul><ul><ul><li>Rich Tree component </li></ul></ul><ul><ul><li>Open SDK for building / extending tags </li></ul></ul>
  35. 35. The Test Recorder <ul><ul><li>Test infrastructure open sourced in Apache as part of NetUI </li></ul></ul><ul><ul><ul><li>Based on JUnit </li></ul></ul></ul><ul><ul><li>How it works </li></ul></ul><ul><ul><ul><li>“ Records ” user interactions with a webapp </li></ul></ul></ul><ul><ul><ul><ul><li>Output is an XML “ record ” file </li></ul></ul></ul></ul><ul><ul><ul><li>Executes a test by “ playing back ” a recorded session </li></ul></ul></ul><ul><ul><ul><ul><li>POSTs recorded request parameters </li></ul></ul></ul></ul><ul><ul><ul><ul><li>Captures output during “ playback ” </li></ul></ul></ul></ul><ul><ul><ul><ul><li>Diff ’ s the “ record ” and “ playback ” files to determine pass / fail </li></ul></ul></ul></ul><ul><ul><li>NetUI BVTs have about 420 of these </li></ul></ul><ul><ul><li>Contributes significantly to stability of NetUI </li></ul></ul>
  36. 36. Creating a Beehive Webapp <ul><ul><li>Controls / NetUI enabled webapp </li></ul></ul><ul><ul><ul><li>Page Flow JARs </li></ul></ul></ul><ul><ul><ul><ul><li>Struts / NetUI / XMLBeans / Log4J / JSTL </li></ul></ul></ul></ul><ul><ul><ul><li>NetUI TLDs </li></ul></ul></ul><ul><ul><ul><li>Controls JAR </li></ul></ul></ul><ul><ul><li>Building a Beehive webapp </li></ul></ul><ul><ul><ul><li>Compile XSDs into XMLBeans </li></ul></ul></ul><ul><ul><ul><li>Codegen Controls / Page Flows to .java files </li></ul></ul></ul><ul><ul><ul><li>Comple Java sources to WEB-INF/classes </li></ul></ul></ul><ul><ul><li>Fully transparent </li></ul></ul><ul><ul><li>Build files provided with Beehive distribution </li></ul></ul>
  37. 37. Beehive Petstore Demo DEMO
  38. 38. The Webapp <ul><ul><li>Size </li></ul></ul><ul><ul><ul><li>7 JPFs / 21 JSPs </li></ul></ul></ul><ul><ul><ul><li>Various .tag files </li></ul></ul></ul><ul><ul><li>Highlights </li></ul></ul><ul><ul><ul><li>Uses Beehive Controls </li></ul></ul></ul><ul><ul><ul><ul><li>The JPFs code to a single API </li></ul></ul></ul></ul><ul><ul><ul><ul><li>Implementation is backed by a naïve in-memory database </li></ul></ul></ul></ul><ul><ul><ul><ul><li>Can be swapped out with other control implementations </li></ul></ul></ul></ul><ul><ul><ul><ul><ul><li>Database </li></ul></ul></ul></ul></ul><ul><ul><ul><ul><ul><li>WebServices </li></ul></ul></ul></ul></ul><ul><ul><ul><ul><ul><li>Stay tuned for ApacheCon! </li></ul></ul></ul></ul></ul><ul><ul><ul><li>Fully internationalized </li></ul></ul></ul><ul><ul><ul><li>Zero code in the JSPs </li></ul></ul></ul><ul><ul><ul><li>Built with site templates </li></ul></ul></ul><ul><ul><li>Not done yet! </li></ul></ul>
  39. 39. WebLogic Workshop Demo DEMO
  40. 40. Pollinate Demo DEMO
  41. 41. Getting Involved
  42. 42. Resources <ul><ul><li>Beehive : http://incubator.apache.org/beehive/ </li></ul></ul><ul><ul><li>Beehive : http://incubator.apache.org/beehive/mailinglists.html </li></ul></ul><ul><ul><li>Beehive : http://wiki.apache.org/beehive </li></ul></ul><ul><ul><li>Beehive : http://dev2dev.bea.com/technologies/beehive </li></ul></ul><ul><ul><li>XML Beans : http://xmlbeans.apache.org </li></ul></ul><ul><ul><li>Pollinate : http://www.eclipse.org/pollinate/ </li></ul></ul><ul><ul><li>Pollinate : https://dev.eclipse.org/mailman/listinfo/pollinate-dev </li></ul></ul><ul><ul><li>BEA : http://dev2dev.com </li></ul></ul><ul><ul><li>Instantiations : http://www.instantiations.com/ </li></ul></ul><ul><ul><li>Genuitec : http://www.myeclipseide.com/ </li></ul></ul><ul><ul><li>Soaring Eagle LLC : http://www.soaringeagleco.com </li></ul></ul>

×