Transparent Middleware Transparent Middleware AO and EJB 3
Transparent Middleware ™ Transparent Middleware, AO and EJB 3. 0 Marc Fleury, Ph. D. 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(“Requires. New”) */ public void some. POJOmethod() { … } <class-metadata group=“transaction” class=“com. acme. POJO”> <method name=“get. *”> <trans-attribute>Requires. New</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 JBoss. Cache ü 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 Tree. Cache. Aop(); config = new Property. Configurator(); // configure tree cache. Use Pojos as Pojos configure(tree, "META-INF/repl. Sync-service. xml"); joe = new Person(); joe. set. Name("Joe Black"); joe. set. Age(31); addr = new Address(); addr. set. City("Sunnyvale"); addr. set. Street("123 Albert Ave"); addr. set. Zip(94086); joe. set. Address(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. put. Object("/aop/joe", joe); // add aop sanctioned object tx. begin(); joe. set. Age(41); joe. get. Address(). set. Zip(95124); tx. commit(); The Professional Open Source™ Company
JBoss. Remoting • Goals ü ü ü Use POJOs not APIs No extending of Unicast. Remote No precompilation (rmic) Protocol independent Protocol isolation Designed after dot. Net. Remoting • 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. register. Target(“obj. Name", remote); // Client POJO proxy = (POJO)Remoting. create. Remote. Proxy(“obj. Name", POJO. cl ass, “soap: //l ocalhost: 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)Clustered. Remoting. register. Clustered. Object( “obj. Name", pojo, "Default. Partition", new Round. Robin(), “socket: //localhost: 5150"); The Professional Open Source™ Company
New Aspects: Io. C, Observer • Io. C 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 J 2 EE. No observable pattern Message or pooling based designs. Need for Java. Beans “fire. Change” 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 • 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 Io. C, 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
EJB 3. 0: TRANSPARENT PROGRAMMING • • Simple CMP ü ü Simple and Powerful QL: ü ü • • POJO persistence Entities are always local, use of new() POJO Model Inheritance and polymorphism No CMR ü 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 ü Implement only the callbacks you want Simple testing ü Testing behavior outside of a container Work in progress ü ü 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
EJB 3 (simplified EJB) @Entity(table=“AUCTION”) public class Auction { @PK(column=“AUCTION_ID”, generator=“sequence”) private Long id; @Attribute private String description; @One. To. Many(inverse=“auction” order-by=“DATETIME” cascade=ALL) private List<Bid> bids = new Array. List(); @Many. To. One(fk=“SELLER_ID”) private User seller; //Getters and setters …… The Professional Open Source™ Company
EJB 3 (simplified EJB) …… @Attribute(formula=“SELECT MAX(B. AMOUNT) FROM BID B “ + “WHERE B. AUCTION_ID = AUCTION_ID”) private Big. Decimal max. Bid. Amount; public Big. Decimal get. Max. Bid. Amount() { return max. Bid. Amount; } …… The Professional Open Source™ Company
EJB 3 (simplified EJB) …… public Bid bid(Bid. Decimal amount) { if ( !amount. greater. Than(max. Bid. Amount) ) return null; Bid bid = new Bid(amount, new Date(), this); bids. add(bid); return bid; } } The Professional Open Source™ Company
EJB 3 (simplified EJB) @Stateful(entity. Context=INSTANCE, transaction=REQUIRES_NEW) public class Bid. For. Auction. Bean implements Bid. For. Auction { @Inject Entity. Manager entity. Manager; private Auction auction; public Auction get. Auction(Long id) { auction = (Auction) entity. Manager. get(“Auction”, id); return auction; } @Remove public void bid. For. Auction(Big. Decimal amount) { return auction. bid(amount); } } The Professional Open Source™ Company
Deployment descriptors No xml in 3. 0 The Professional Open Source™ Company
EJB 3. 0: new architectures Peer to peer grids WEB WEB EJB EJB 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/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: J 2 EE based ü Tomcat ü Hibernate ü JBoss. Cache/JGroups: ü Nukes, ü ? workflow, rules, new clients, connectors? • JBoss inc, the new safe choice ü 24/7 Support ü Indemnification ü Certification – J 2 EE, 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 World. Com) 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 • A standard in the market: #1 in development ü More than 4 M 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
J 2 EE Update • JBoss has licensed the TCK for J 2 EE 1. 4 • Work in progress • Founders Program ü Partners who are helping JBoss with the Certification effort include • Borland • Iona • Intel • Schlumberger. Sema • Unisys • Web. Methods • 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 Java. Group (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 1 st / 2 nd line JBoss does expert 3 rd line ü Leverage installed base of JBoss ü Leverage existing partner channels to increase service coverage ü Provide high level support with 1 st line presence and 3 rd line expertise. The Professional Open Source™ Company
JBoss the projects • JBoss AS Full J 2 EE support, EJB, JMX, JMS, JCA, JAAS • Hibernate O/R Mapping solution. • Tomcat JSP/Servlet/Web server. • JBoss. IDE Eclipse integration, tag driven development. Debugging. • JBoss. Cache Distributed data. • JGroups Reliable multicast and cluster communication • Nukes JBoss portal and CMS. • JBoss. AOP 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, J 2 EE 1. 4 Clustering, Tomcat, Web Services Developer Microkernel, JMX, J 2 EE 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 Server ü Unified Class. Loaders, total Class visibility/cyclability JVM ü Service Archives (SARs) for easy configuration and net deployment MBean Server The Professional Open Source™ Company
Deployers: Bringing in the Services Microkernel Deployment. Scanner Main. Deployer SARDeployer EARDeployer Transaction Service Message Service EJBDeployer Security Service Naming Service WARDeployer EJB Containers Data Sources *. x. AR 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 JAR 1 RAR 3 JAR 3 RAR 3 Microkernel Deployment. Scanner Main. Deployer SARDeployer EARDeployer Microkernel Transaction Service Security Service Deployment. Scanner Main. Deployer Naming Service Transaction Service SARDeployer EARDeployer Message Service EJBDeployer Data Sources WARDeployer Custom SAR *. x. AR Application B EAR 2 Security Service Naming Service EJB Containers Data Sources *. x. AR Custom SAR The Professional Open Source™ Company
Deployers: Working from the Network Machine 1 Machine 2 Microkernel Deployment. Scanner Load Services Main. Deployer HTTP Scan Web Server Administrator HTTP Scan Deployment Packages 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 Machine 2 Microkernel Deployment. Scanner Main. Deployer Deployment. Scanner Machine 1 Machine 4 Deployment. Scanner Main. Deployer Machine 5 Microkernel Main. Deployer Deployment. Scanner Microkernel Main. Deployer Machine 6 Microkernel Deployment. Scanner Main. Deployer Web Server Administrator Deployment Packages Main. Deployer 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 01110101 Client Remote. Invoker Port 4321 Client Proxy The JMX Microkernel Remote. Invoker EJB Container MBean Service MBean Professional Open Source™ Company
An EJB Container • An EJB container is the sum of Transaction Manager Data Source ü Interceptors ü Plugins per container Microkernel The Connection Synchronization CMP Engine Cache Lock Transaction Security Bean Lock Cache ü MBeans in the server Professional Open Source™ Company
Client Authentication Overview Client. Side Client performs a login to establish principal and credentials Subsequent Bean method invocations include principal and credential with method info JBoss. Server Jaas. Security. Manager validates client principal and credentials by executing the JAAS Login. Module stack associated with the security domain name The Professional Open Source™ Company
Security overview • The JBoss. SX 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 Login. Module to Subject usage pattern to help integrate your own authentication protocol. • The JBoss. SX framework includes an implementation of SRP that consists of the following elements: ü An implementation of the SRP-3 handshake protocol ü A client side JAAS Login. Module ü A JMX MBean. It also establishes an authentication cache that is bound into the JBoss server JNDI namespace. ü A server side JAAS Login. Module 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 IS EJB 3. 0 CMP is an API and XML mappings Hibernate is the actual persistence engine Hibernate caches are being integrated with JBoss. Cache 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 (Java. Beans) • 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 EJB 3. 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 J 2 EE 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 JBoss. Cache? • What is JBoss. Cache? ü 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/J 2 EE. ü 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
- Slides: 54