Transparent Middleware ™ Transparent Middleware, AO and EJB3.0 Marc Fleury, PhD. Founder and CEO JBoss, inc. The Professional Open Source™ Company Agenda • Middleware as a collection of aspects, custom middleware • New Aspects • EJB 3.0 • JBoss: professional open source The Professional Open Source™ Company Tangled code vs Untangled code • AO identifies aspects and gives programmers weaving semantics • Example of untangling: A GUI with color syntax highlighting aspects in source is AO It untangles code IN YOUR HEAD • Example tangled code: EJB 2.0: programmers use interfaces and code abstract getters and setters. Intrusive programming model • Example untangled code: EJB 3.0: programmers use POJOS and annotations. Persistence by annotations, remoteness by annotations etc AS TRANSPARENT AS IT CAN BE (POJO BASED) The Professional Open Source™ Company Transparent middleware • Impact of AO on middleware Middleware offers services and aspects to programmers How complex is it to apply an aspect to an objects • SIMPLIFICATION of programming models Today middleware is mostly tangled specs A component writer in EJB KNOWS about way to much system level issues POJO based is the best we can do The Professional Open Source™ Company Clustered Remote webservice Cache Persistent data Cached model configuration Secure access Transacted Acid sessions Monitor Model time Monitor data time (dynamic insertion) Application layer Aspect layer Service layer Remote Invokers Microkernel layer Clustering Security Transaction ACID Cache JBoss Microkernel (JMX) The Monitoring Persistence Professional Open Source™ Company Metadata and Metatags • Aspect Configuration • Explicit through Xdoclet tags (later JSR-175) • Implicit through XML (deployable at runtime) /** * * @@transaction(“RequiresNew”) */ public void somePOJOmethod() { … } <class-metadata group=“transaction” class=“com.acme.POJO”> <method name=“get.*”> <trans-attribute>RequiresNew</transattribute> </method> </class-metadata> The Professional Open Source™ Company JBoss 4: Aspects a la carte • Middleware, by nature, is cross-cutting • Middleware implemented as Aspects allow for: Smooth, fluid, iterative development Clean separation between System Architect and Application Developer Less upfront design decisions • JBoss 4 is Aspect-Oriented Middleware • Architectural decisions can be made later on in the development process • AOP makes iterative development more fluid The Professional Open Source™ Company JBoss 4:Dynamic AO • Dynamic AOP Transactional, ACID, Objects. Our Transactional Cache Replicated Objects. Our Distributed Cache Optimized HTTP Session Replication Remoting – choose at runtime, SOAP, RMI, Sockets, IIOP Clustered Remoting – invocation failover • Use of Dynamic AO in JBossCache POJO inserted into cache Can become Transactional • Can become Replicated • Depends on Cache Configuration Goal to have transparent ACID properties Transparent Replication No application coding for inserted Objects Uses AOP Dynamic API Requires “prepare” step via <advisable> • ALMOST COMPLETE TRANSPARENCY • The Professional Open Source™ Company Interaction With Cache tree = new TreeCacheAop(); config = new PropertyConfigurator(); // configure tree cache. config.configure(tree, "META-INF/replSync-service.xml"); Use Pojos as Pojos joe = new Person(); joe.setName("Joe Black"); joe.setAge(31); addr = new Address(); addr.setCity("Sunnyvale"); addr.setStreet("123 Albert Ave"); addr.setZip(94086); joe.setAddress(addr); The Professional Open Source™ Company Interaction With Cache • Joe’s state is automatically transactional and replicated • State replicated, synchronized at transaction commit/rollback tree.start(); // kick start tree cache tree.putObject("/aop/joe", joe); // add aop sanctioned object tx.begin(); joe.setAge(41); joe.getAddress().setZip(95124); tx.commit(); The Professional Open Source™ Company JBossRemoting • Goals Use POJOs not APIs No extending of UnicastRemote No precompilation (rmic) Protocol independent Protocol isolation Designed after dotNetRemoting • Features SOAP, Fact Socket, or RMI protocols available Clustering: failover, loadbalancing The Professional Open Source™ Company Remoting/Clustered Remoting • Declare POJO remoted at runtime • Hooks into JBoss Remoting project (Jeff Haynie, Tom Elrod) • URI based protocols (soap, socket, rmi) // Server POJO remote = new POJO("hello"); Dispatcher.singleton.registerTarget(“objName", remote); // Client POJO proxy = (POJO)Remoting.createRemoteProxy(“objName", POJO.class, “soap://localhost:8080"); The Professional Open Source™ Company Clustered Remoting • Invocation failover with any protocol • Invocation loadbalancing with any protocol • Leverages existing JBoss Clustering POJO pojo = new POJO("hello"); POJO proxy = (POJO)ClusteredRemoting.registerClusteredObject( “objName", pojo, "DefaultPartition", new RoundRobin(), “socket://localhost:5150"); The Professional Open Source™ Company New Aspects: IoC, Observer • IoC is an aspect Setting of references can be intercepted Hook up of singleton, per VM Per call, per lifecycle Work done by Bill Burke in CVS • Observer/Observable is an aspect Strong limitation of current J2EE. No observable pattern Message or pooling based designs. Need for JavaBeans “fireChange” Template code was aspectized by Adrian Brock in CVS • Etc etc Tight collaboration with academia on identification of new aspects for middleware. Fast time to market in JBoss The Professional Open Source™ Company EJB 3.0: SIMPLIFICATION SIMPLIFICATION SIMPLIFICATION • Simple annotations Systematic use of annotations to simplify programming Eliminate need for XML deployment descriptors Generation of interfaces if needed • Simple defaults Systematic use of defaults Configuration on exception only • Simple dependencies Annotations IoC, utility classes • Simple POJO programming model No more homes, factory pattern No more abstract getter/setter • Sessions can be remote, Entities are always local The Professional Open Source™ Company EJB3.0: TRANSPARENT PROGRAMMING • Simple CMP • Simple and Powerful QL: • Testing behavior outside of a container Work in progress • Implement only the callbacks you want Simple testing • from EJBQL to HQL back to EJBQL again Support for group-by, explicit inner and outer join, projections, bulk update and delete, dynamic queries, SQL queries Close to HQL, SQL focus, ORDBMS focus unlike JDO Simple callbacks • POJO persistence Entities are always local, use of new() POJO Model Inheritance and polymorphism No CMR Sessions as application transaction, revolution for MVC designs Detach-reattach? We recommend local and collocated designs YOU ASKED FOR IT, YOU GOT IT The Professional Open Source™ Company EJB3 (simplified EJB) @Entity(table=“AUCTION”) public class Auction { @PK(column=“AUCTION_ID”, generator=“sequence”) private Long id; @Attribute private String description; @OneToMany(inverse=“auction” order-by=“DATETIME” cascade=ALL) private List<Bid> bids = new ArrayList(); @ManyToOne(fk=“SELLER_ID”) private User seller; //Getters and setters …… The Professional Open Source™ Company EJB3 (simplified EJB) …… @Attribute(formula=“SELECT MAX(B.AMOUNT) FROM BID B “ + “WHERE B.AUCTION_ID = AUCTION_ID”) private BigDecimal maxBidAmount; public BigDecimal getMaxBidAmount() { return maxBidAmount; } …… The Professional Open Source™ Company EJB3 (simplified EJB) …… public Bid bid(BidDecimal amount) { if ( !amount.greaterThan(maxBidAmount) ) return null; Bid bid = new Bid(amount, new Date(), this); bids.add(bid); return bid; } } The Professional Open Source™ Company EJB3 (simplified EJB) @Stateful(entityContext=INSTANCE, transaction=REQUIRES_NEW) public class BidForAuctionBean implements BidForAuction { @Inject EntityManager entityManager; private Auction auction; public Auction getAuction(Long id) { auction = (Auction) entityManager.get(“Auction”, id); return auction; } @Remove public void bidForAuction(BigDecimal amount) { return auction.bid(amount); } } The Professional Open Source™ Company Deployment descriptors No xml in 3.0 The Professional Open Source™ Company EJB3.0: new architectures Peer to peer grids WEB WEB WEB WEB EJB EJB EJB EJB CACHE CACHE CACHE CACHE ORM DB The Professional Open Source™ Company Enterprise JBoss inc evolution New Projects Developer Tactical Production Support Developer Support JBoss inc Professional Open Source Consulting Documentation Training JBoss Group Small Consultancy 10/00 6/01 1/02 9/02 9/03 The 1/04 Professional Open Source™ Company What is JBoss? • JBoss federates open source projects under the JBoss Professional Open Source ™ model • JBoss Inc. employs the lead developers of JBoss Application Server: J2EE based Tomcat Hibernate JBossCache/JGroups: Nukes, ? workflow, rules, new clients, connectors? • JBoss inc, the new safe choice 24/7 Support Indemnification Certification – J2EE, JASP The Professional Open Source™ Company JBoss Group Customers “JBoss Group’s people are super-smart and could help us at the technical level we needed without us having to work our way through levels of support staff. Compared with our old vendor, we get great support for relatively low cost.” Jerry Shifrin, senior engineer, network management group, MCI (formerly WorldCom) The Professional Open Source™ Company CUSTOMERS The Professional Open Source™ Company JBoss numbers • A large community 40,000 documentation sets sold 500 contributors over time, 20 core (JBoss Inc) • INNOVATION INNOVATION INNOVATION • A standard in the market: #1 in development More than 4M downloads in last two years alone • A standard in the market: #1 in OEM • Analyst private communication A Standard for System Integrators #2 in growth CRN survey puts JBoss certified consultant at #2 in fastest growing certification with large systems integrators • A standard in the market: # 3 in production BZResearch survey. 13% in 2002, 27% in 2003, largest growth of all servers JDJ survey: 70% of users go to Deployment. The Professional Open Source™ Company J2EE Update • JBoss has licensed the TCK for J2EE 1.4 • Work in progress • Founders Program Partners who are helping JBoss with the Certification effort include • Borland • Iona • Intel • SchlumbergerSema • Unisys • WebMethods • Sonic The Professional Open Source™ Company Professional Open Source • Revenue from Services Back Office model with EXPERTS (5% utilization) Focus on quality of service as sole source of income • Attract & Retain Top Developers Paid Open Source Development, boost to projects Support is “developer to developers” • Commercial Quality Code Control over the quality of source, dedicated resources • JBoss Group, the best support for JBoss Direct and unique chain of control in open source: Support → Bug Fix → Next Version • Expand Services offering Include support for Tomcat, hibernate and JavaGroup (JGroups) The Professional Open Source™ Company JBoss Production Support • Staffed with the lead developers of JBoss Inc. Projects Enables quick problem resolution from EXPERTS No navigating through levels of escalation • Prices range from $8,000 - $250,000 Price determined by Service Level Agreement Number of named projects • NO PER CPU COSTS Eliminate procurement headaches Eliminate tracking of licenses Eliminate vendor audits Eliminate architecture decision based on cost of CPU licenses The Professional Open Source™ Company JBoss Authorized Service Partner (JASP) Expand Partnerships & Channel ISV and OEM Systems Integrators Systems Vendors • Partner does 1st / 2nd line JBoss does expert 3rd line Leverage installed base of JBoss Leverage existing partner channels to increase service coverage Provide high level support with 1st line presence and 3rd line expertise. The Professional Open Source™ Company JBoss the projects • JBoss AS Full J2EE support, EJB, JMX, JMS, JCA, JAAS • Hibernate O/R Mapping solution. • Tomcat JSP/Servlet/Web server. • JBossIDE Eclipse integration, tag driven development. Debugging. • JBossCache Distributed data. • JGroups Reliable multicast and cluster communication • Nukes JBoss portal and CMS. • JBossAOP Aspect-Oriented Programming with JBoss 4.0. • Javassist Simple bytecode manipulation library The Professional Open Source™ Company Market Demand & JBoss Product Evolution Enterprise • • • • O/R Mapping Portal Byte Code Manipulation … Tactical Aspects, J2EE 1.4 Clustering, Tomcat, Web Services Developer Microkernel, JMX, J2EE API’s Application Server EJB 1.0 2.0 3.0 4.0 3.2 The JBoss Version Professional Open Source™ Company JMX Architecture (2/4) • Microkernel design Independent cycling and loading • Hot Deployment of services and applications Service MBean Service MBean Service MBean Unified ClassLoaders, total Class visibility/cyclability Server JVM Service Archives (SARs) for easy configuration and net deployment MBean Server The Professional Open Source™ Company Deployers: Bringing in the Services Microkernel DeploymentScanner MainDeployer Transaction Service SARDeployer EARDeployer Message Service EJBDeployer Security Service Naming Service WARDeployer EJB Containers Data Sources *.xAR The Professional Open Source™ Company Microkernel benefits for SOA architecture • Microkernel approach ideal for ISV and OEM Easily remove the services you don’t need Tight footprint and modular codebase and hot deploy/remove/redeploy JBoss is a TRUE Service Oriented Architecture (SOA) WAR 1 Application A EAR 2 JAR 1 RAR 3 JAR 3 RAR 3 Microkernel DeploymentScanner MainDeployer SARDeployer EARDeployer Microkernel Transaction Service DeploymentScanner Security Service MainDeployer Naming Service SARDeployer EARDeployer EJBDeployer Data Sources WARDeployer Custom SAR *.xAR Application B Transaction Service Message Service Security Service Naming Service EJB Containers Data Sources *.xAR Custom SAR The Professional Open Source™ Company Deployers: Working from the Network Machine 1 Machine 2 Microkernel Microkernel DeploymentScanner DeploymentScanner Load Services MainDeployer MainDeployer HTTP Scan HTTP Scan Deployment Packages Web Server Administrator The Professional Open Source™ Company Deployers: Working from the Network • Microkernels and netboot enable new grid control Domain of applicability: Robot control, Storage area networks, Next generation routers Mars Lander syndrome hardware ships with software • Burn kernel in flash ram Deploy applications from centralized repository Remote load at a later time It changes the way robot/router grids are built, deployed and Machine 3 managed. Microkernel Microkernel Machine 2 Microkernel DeploymentScanner MainDeployer DeploymentScanner Machine 1 Machine 4 DeploymentScanner MainDeployer Machine 5 Microkernel MainDeployer DeploymentScanner Microkernel MainDeployer Machine 6 Microkernel DeploymentScanner DeploymentScanner MainDeployer Web Server Administrator Deployment Packages MainDeployer The Professional Open Source™ Company JBoss 3.x Series EJB • EJB 2.0 No compiler approach (speed of development) Server JVM Externalized stack of interceptors (AOP) Full CMP 2.0 engine migrating to Hibernate backend EJB Container MBean Integration with Tomcat in memory Advanced Security Port 1234 Client JVM Typed Interface Invocation 011101010101 Client RemoteInvoker Port 4321 JMX Microkernel RemoteInvoker EJB Container MBean Service MBean Client Proxy The Professional Open Source™ Company An EJB Container • An EJB container is the sum of Transaction Manager Data Source Interceptors Plugins per container Microkernel CMP Engine The Connection Cache Cache Lock Transaction Security Bean Lock Synchronization MBeans in the server Professional Open Source™ Company Client Authentication Overview ClientSide Client performs a login to establish principal and credentials Subsequent Bean method invocations include principal and credential with method info JBossServer JaasSecurityManager validates client principal and credentials by executing the JAAS LoginModule stack associated with the security domain name The Professional Open Source™ Company Security overview • The JBossSX framework includes a number of bundled login modules Suitable for integration with standard security infrastructure store protocols such as LDAP and JDBC Also includes standard base class implementations that help enforce the expected LoginModule to Subject usage pattern to help integrate your own authentication protocol. • The JBossSX framework includes an implementation of SRP that consists of the following elements: An implementation of the SRP-3 handshake protocol A client side JAAS LoginModule A JMX MBean. It also establishes an authentication cache that is bound into the JBoss server JNDI namespace. A server side JAAS LoginModule implementation that uses the authentication cache managed by the SRP JMX The Professional Open Source™ Company Web services in JBoss Overview: JBoss.net • Specifies how JBoss server components are exposed as Web service Stateless Session Beans Web components POJO as servlet The Professional Open Source™ Company JBoss Hibernate Hibernate IS EJB 3.0 CMP CMP is an API and XML mappings Hibernate is the actual persistence engine Hibernate caches are being integrated with JBossCache Full distributed data with OR backend on one node The Professional Open Source™ Company Hibernate Part of JBoss full-time Gavin King and Christian Bauer on board Persistence for POJOs (JavaBeans) • Flexible and intuitive mapping • Support for fine-grained object models • Powerful, high performance queries • Dual-Layer Caching Architecture (HDLCA) • Support for detached objects (no DTOs) • Transparent Persistence • Automatic dirty checking • Transitive Persistence • Smart fetching and caching • Smooth migration to EJB3.0 • Consulting and support available as part of JBoss inc The Professional Open Source™ Company Tomcat 5.0.x improvements • Tomcat’s Remy Maucherat is on JBoss inc staff • Performance optimizations and reduced garbage collection • Optional standalone deployer (validation and precompilation of webapps) • Scalability and reliability enhancements • Complete server monitoring using JMX • Improved Taglibs handling, including advanced pooling and tag plugins • Embedding of Tomcat using JMX • Enhanced Security Manager support (now allows very restrictive policies) • Expanded documentation • Consulting and support available as part of JBoss inc The Professional Open Source™ Company Tomcat standalone or Tomcat inside JBoss ? • Better JBoss deployer Hot deployment Deployment of nested archives (EARs, SARs) Redeployment Automatic undeployment • Advanced clustering • Integrated J2EE stack within one VM Deployment descriptor Optimized local calls Integrated security • AOP in JBoss 4.0 available in Tomcat components and webapps • Easy to use classloader • Nukes The Professional Open Source™ Company JBoss IDE • JBoss IDE is based on Eclipse. Series of plugins for Eclipse • The debugging and monitoring of JBoss servers and the control of their life cycle (start/stop). • A very comfortable and sophisticated support for XDoclet Support completion and generation Support for AOP (completion and generation). • An easy way to configure and deploy the packaging layout of archives (packed or exploded) The Professional Open Source™ Company What Is JBossCache? • What is JBossCache? A transactional replicated cache for JBoss with and without AOP (aspect-oriented programming) • A cache for frequently accessed elements Stateful Session Beans, HTTPSession Caches are used in a number of places in JBoss • This one provides a central cache service (MBean interface) • All access goes through the cache Write-through (lazy or eager) Reads only access the cache (very fast on cache hits) Items not in the cache are loaded (e.g. from database) Bounded size; old items are removed by eviction policy • Local (=non-replicated) and replicated caches Replicated caches are the interesting part The Professional Open Source™ Company Feature • Transactions All modifications done within TX, replication at TX commit. No replication on rollback • Locking Access to nodes serialized by locks Lock acquisition timeouts used for deadlock prevention • Replication local: in-VM, no replication repl-async: replication done on separate thread repl-sync: replication done on user's thread, wait for all acks • All combinations supported From local/no-tx/no-locking to repl/tx/locking Ex: repl-async/no-locking/TX The Professional Open Source™ Company Nukes on JBoss ™ • Nukes on JBoss is a port of PHP postnukes Scalability problems with Zend engine Full port to EJB/J2EE. Leverage the vast library of nukes modules • Most of PN modules are ported • Core : offers the core functionalities to other modules Security, lifecycle management, parameterization User : enables user management • Html : stores files, filesystem is abstracted, stored in DB • Sections : edit/publish articles • FORUMS!!!! • The Professional Open Source™ Company CMS: ease of update for nontechies The Professional Open Source™ Company Nukes components The Professional Open Source™ Company JBoss Q&A • Website: www.jboss.org and www.jboss.com • Email: marc.fleury@jboss.com • THANK YOU! • And remember we love you The Professional Open Source™ Company