440 likes | 615 Views
BEA and Open Source. Leading Java Innovation . Martin Percival EMEA Technical Evangelist BEA Systems. Looking Back: WebLogic 8.1 Release Themes. Challenge. WebLogic 8.1 Solution. 1. Too many moving parts, different interfaces, and redundant services. Integrated platform.
E N D
BEA and Open Source. Leading Java Innovation Martin PercivalEMEA Technical Evangelist BEA Systems
Looking Back:WebLogic 8.1 Release Themes Challenge WebLogic 8.1 Solution 1. Too many moving parts, different interfaces, and redundant services Integrated platform 2. J2EE development is tedious and complex Workshop IDE with runtime framework Control based service model 3. Hard to build a service-oriented architecture
BEA, OSS and Standards • Standards critical to technology adoption and market creation • API standards for investment protection, protocol standards for interoperability • OSS compliments BEA’s standards strategy by promoting innovation • Innovate then standardize vs standardize then innovate • Successful projects are architected for participation • OSS is a standardizing market force through portability with no single vendor lock-in • BEA - an active OSS community member • Patronage of OSS projects to provide BEA support and leadership for emerging technologies • Join existing efforts (Eclipse, AspectJ) • Open source BEA innovations (Beehive, XMLBeans)
Looking Forward:WebLogic 9.0 Release Themes Challenge WebLogic 9.0 Solution 1. Leverage the strength of a growing Java tooling community, continue to innovate and differentiate to provide value for BEA customers Eclipse Strategy 2. Innovate to provide greater ease-of-use while maintaining investment protection Apache Beehive, XMLBeans - OSS to compliment standards strategy.
BEA’s Eclipse Strategy • Rebuild the central tooling product for all WebLogic products on top of the Eclipse Platform • Provide plug-in compatibility • Offer additional commercial plug-ins in package • Give back patches and many new plug-ins to Eclipse • Strategic Developer: dedicate BEA developers, testers, program managers, architects to making Eclipse stronger/smarter • BEA has a vested interest in seeing Eclipse succeed • Help design best possible Eclipse platform APIs for commercial value • Contributing to example plug-ins to lower shared development costs • Similar to other open source projects
Initial Scope of BEA’s Participation • ~16 people @ 100% + ~7 people @ 50% supporting: • Web Tools Platform (offering leadership and full-time devs) • AspectJ (from merger with AspectWerkz) • Language Development Tools (to be proposed) • Pollinate (continue to support) • Participation on councils and Board
Beehive’s Ease of Use Mission • Deliver a comprehensive, easy-to-use framework for building dynamic J2EE and SOA applications. • Based on over 3 years of experience “making it easy” with WebLogic Workshop • Designed with tool-ability in mind from the outset • Provide ultimate investment protection and transparency through open source and portability • Strengthen the Java market by providing world-class ease-of-use to all Java developers
Controls Java Web Services Java PageFlows UnifiedInterconnection Model Web Services Visual Struts Editing Beehive in the OSS community Eclipse Pollinate IDE Apache Beehive XMLBeans Geronimo Tomcat JOnAS
<xml> Beehive in WebLogic Beehive within the BEA WebLogic Platform: Workshop IDE WebLogic Portal WebLogic Liquid Data WebLogic Integration WebLogic Platform Application Framework Apache Apache Beehive Controls Java Web Services Java PageFlows XMLBeans UnifiedInterconnection Model Web Services Visual Struts Editing XML Schema/ Java binding WebLogic Application Server Open Source BEA Value Add
XMLBeans • XML-Java binding tool allowing access to the full power of XML in a Java-friendly way • XML Schema used to compile strongly-typed Java interfaces and classes • Access to XML instance data • Access to full XML Infoset • Reflect into the XML schema itself through an XML Schema Object model • Provides full XML Schema support • Provides full XML Infoset fidelity • XMLBeans is in a separate Apache project but will be packaged with the Beehive distribution
XmlBeans: Better Data Transfer Objects <xs:complexType name="MoneyType"> <xs:sequence> <xs:element name="Value"> <xs:simpleType> <xs:restriction base="xs:decimal"> <xs:pattern value="(\\d){1,15}(\\.(\\d){2})?"/> </xs:restriction> </xs:simpleType> </xs:element> <xs:element name="Currency"> <xs:simpleType> <xs:restriction base="xs:string"> <xs:enumeration value="USD"/> <xs:enumeration value="EUR"/> <xs:enumeration value="GBP"/> <xs:enumeration value="AUS"/> <xs:enumeration value="YEN"/> </xs:restriction> </xs:simpleType> </xs:element> </xs:sequence> </xs:complexType> XMLBean Interface public interface MoneyType { public void setCurrency( MoneyType.Currency.Enum enum); public void setValue(BigDecimal num) } JSP with NetUI <netui:label value="{pageFlow.price.value}”/> <netui:label value="{pageFlow.price.currency}"/> XML Schema
Beehive Simplifies Web Development Simple things should be simple. Complex things should be possible. POJO+ Metadata NetUI Page Flows Java Web Services Java Controls @Jpf.Controller @Control @WebService
Problem 1: Resource Access • Diversity of resource access mechanisms and APIs • Enterprise access has too many! • JDBC, EJB, JMS, JAX-RPC, JCA, … • Results in two key problems • Developer learning curve • Each requires custom tooling • Current solutions • Custom facades • Resource-specific ease of use models
Solution: Controls • Beehive Controls enable a unified, simple model for resource access • Façade • All resources appear as JavaBeans • Unified • One client model (JavaBeans) • Consistent configuration model (Properties) • One tooling model (Introspection) • Simple • Declarative authoring model • Inversion of Control • Extensibility model
Controls • Beehive Controls == JavaBeans • Properties / Methods / Events • Well-defined usage model • bean.doSomething(param1, param2); • <jsp:useBean> • Controls run inside of a “control container” • Provides contextual services • For instance • Page Flow / JWS / Controls • EJB Container (WebLogic, Geronimo, etc.) • Servlet-tier via a simple ServletFilter • JUnit • Write your own
Control Details • Control contexts • Access to properties and container’s available services • Lifecycle • Integration with the container • Resource Management • Obtain when necessary • Hold for an appropriate scope • Release • Lifetime based on contract between Controls and their container • Event support • Model for control authors to tell clients that something happened • Metadata-driven pub/sub
Control Details • Composition • Nest controls inside of controls • “Application Controls” may be composed of “System Controls” • Threading handled by @Threading • Single and multi-threaded models • Interceptor support • Configuration models • J2SE 5.0 Annotations • JavaBean setters • External configuration • XML • Properties
Configuring a Control • Via metadata • @Timer(timeout=“3 seconds”) • public TimerControlBean timerBean; • Externally • <dataSourceJndiName>prodDatabase</dataSourceJndiName> • Programmatically • _customerDB.setDataSourceJndiName(“prodDatabase”);
Controls Architecture C L I E N T ControlBean Class Control Public Interface Control Implementation Class Operations R E S O U R C E Resource Proxy Actions/Data Events Property Values Property Accessors Event Registration Property Values J2SE 5.0 Metadata and/or External Configuration
Instantiating a Control • Managed by a control container @Control private CustomerDatabase _customerDB; • Programmatic CustomerDatabaseBean _customerDB = java.beans.Beans.instantiate(cLdr,“org.acme.CustomerDatabaseBean”) • Programmatic with properties PropertyMap props=new PropertyMap(DatabaseControl.Connection.class) props.setProperty(“dataSourceJndiName”, “prodDatabase”); CustomerDatabaseBean _customerDB = java.beans.Beans.instantiate (cLdr,“org.acme.CustomerDatabaseBean”,props);
Controls Example HelloControl.java @ControlInterface public interface HelloControl { String sayHello(String name); } HelloControlImpl.jcs @ControlImplementation public class HelloControlImpl implements HelloControl { public String sayHello(String name) { return “Hello, ” + name; } }
Database Control Example @ControlExtension @DatabaseControl(jndiDataSourceName=“derbyDB”) public interface AccountDatabase extends DatabaseControl { @SQL(statement=“select * from account”) Account[] getAccounts(); @SQL(statement= “select * from account where accountid = {id}” Account getAccount(int id); }
Uniform Resource Access @Control public CreditService _creditSvc; @Control public CustomerDB _customerDB; @Control public InvoiceMessaging _invoiceMQ; public void processOrder(int customerId, Order o) { Customer c = _customerDB.getCustomer(customerId ); if (c == null) throw new NoSuchCustomerException(); if (!_creditSvc.hasCredit(c.getCreditCard(), o.amount())) throw new InsufficientCreditException(); _invoiceMQ.sendInvoice(c, o); }
Problem 2: Hard to build Web Services • Difficult programming model • WSDL • Service endpoint/implementation • Deployment descriptors linking these artifacts • Inconsistent across application containers • Development • Deployment
Solution: Web Services Metadata • Web Service Metadata (WSM) • JSR 181 • Write a service implementation bean • Use annotations to generate remaining artifacts • Runs on various containers • Tool friendly • Builds on existing specifications • J2EE 1.4 • JAX-RPC 1.1 • JSR 109 - not required, but possible • J2SE 5.0
Java Web Services • JSR-181 defines annotations to enable easier Web service programming. Example: @WebService public class StockQuoteService { @WebMethod public float getLastTradePrice(String tickerSymbol) { } } • Two main development models: • Start with Java: expose class as Web Service using metadata • Start with WSDL: tool produces classes • Metadata allows for alterations/customization
Web Service Metadata Details • Full control over WSDL mapping • @WebService(serviceName|operationName|action) • @WebMethod(operationName|action) • @WebParam(name|targetNamespace|mode|header) • @WebResult(name|targetNamespace) • Handler chains • @HandlerChain • @SOAPMessageHandlers • Full support of the J2EE security model
.class files for Service and related types J2EE Deployment Descriptors WSDL File How it works Java Web Service (JWS) Source File J2SE 1.5 Compiler .class file containing annotations Syntax and Type Checking JSR-181 Processor Semantic Checking Deployment Artifact Generation J2EE 1.4 Deployment Unit (.ear or .war)
Web Services Example @WebService(targetNamespace=“http://www.acme.org”) public class AccountService { @Control private DatabaseControl _accountDB; @WebMethod public Account lookupAccount(String accountId) { return _accountDB.getAccount(accountId); } }
Problem 3: Building MVC Web UI • Building web applications is hard • Myriad of MVC web frameworks • Struts, Spring MVC, WebWork, custom-built solutions • Myriad of UI frameworks • Struts HTML / Nesting, JSF, DisplayTag, Velocity • No consistent treatment of data • HttpSession and HttpServletRequest don’t cut it
Solution: Java Page Flows • Beehive Page Flows enables an easily authored yet rich programming model that considers data • Consistency • Centralization • A simple authoring model, easy to find code / configuration • Encapsulation • Modularize / reuse pieces of a webapp • Ease-of-use layer on top of Struts, but intentionally not completely separated from Struts
NetUI • Page Flow is an MVC programming framework • Built atop Struts • A Page Flow • Directory containing a Page Flow Controller and JSPs • “Owns” its JSPs • URL addressable • is a Struts module • Artifacts • .jpf == Java Page Flow • .jpfs == Java Shared Flow • .jsfb == Java Server Faces Backing file
Simplest Page Flow package basic; @Jpf.Controller( simpleActions={ @Jpf.SimpleAction (name="begin", path="index.jsp") } ) public class BasicController extends PageFlowController {} Addressable with: http://localhost:8080/basic/BasicController.jpf
Programming Model Features • Encapsulation • Hitting a page or action == “entering” the page flow • Navigating to another page flow == “leaving” the current one • Statefulness • Instances stored in user session • Instances released when a user “leaves” • Page Flow acts as a resource scope • Request <= Page Flow <= Session • Nested flows • Save the current flow and its state for later • Similar to a method invocation: call and return
Programming Model Features • A Page Flow is thread safe • Two actions in the same Page Flow will not run concurrently • Form Beans • Any JavaBean can be used as a form bean • Can be “page flow scoped” • Declarative validation through annotations • Shared Flow • Fallback location for shared / unhandled actions • login, home, search • Contains state shared among flows
Build Process Based on Sun’s Annotation Processing Tool - APT
User Interface • Rendering UI • Integrated with JSP 2.0 and JSF • Tag libraries for (X)HTML / data / templates • Handling data • Action output / page input • Ensure that JSPs get the data they need • Any JavaBean can be used as a form bean • Supports binding to resource bundles • Rendering data sets • Rich tree • Rich data grid
NetUI Example @Jpf.Controller public class AccountPageFlow extends PageFlowController { @Control private AccountWebService _accountWS; @Jpf.Action(forwards= {@Jpf.Forward(name=“success”, path=“index.jsp”} ) public Forward viewAccounts() { Account[] accounts = _accountWS.getAccounts(); Forward f = new Forward(“success”); f.addActionOutput(“accounts”, accounts); return f;} }
NetUI Example <netui-data:declarePageInput name=“account” type=“org.openuri.Account”/> <netui-data:repeater dataSource=“pageInput.account”> … <netui:span value=“${container.item.name}”/> … <netui:span value=“${container.item.zipCode}”/> … </netui-data:repeater>
Account Web Service Account Page Flow Account Service Control Account JSP Account Database Control All Together Now Remote Server Local Server
Project Structure • Apache Beehive • Core runtime pieces • Controls • NetUI • WSM • Supported containers • Tomcat, Axis, JOnAS, Geronimo • ControlHaus.org • System controls • JDBC / Web Service / EJB / JMS • Pure J2EE implementations • Extendable by 3rd parties
Resources • Apache Beehive project page • Geared toward Beehive users • Beehive wiki • Geared toward Beehive developers • Beehive tutorials • Mailing lists • beehive-dev@incubator.apache.org • beehive-user@incubator.apache.org • ControlHaus • And…
London - 11/12 October Royal Lancaster HotelParis - 13/14 OctoberCoeur La DefensePrague - 18/19 OctoberHilton Prague