1 / 24

Component based distributed systems

Component based distributed systems. Component technologies under Java. Traditional object-oriented languages (Smalltalk, C++, but also Java) enable re-use only in limited mode (dependent on specifics of superior classes etc.)

shew
Download Presentation

Component based distributed systems

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. Component based distributed systems

  2. Component technologies under Java • Traditional object-oriented languages (Smalltalk, C++, but also Java) enable re-use only in limited mode (dependent on specifics of superior classes etc.) • Therefore: advanced encapsulation techniques on the basis of components: • Interface (s) • explicit management of system-tied properties (for instance, corresponding to transactions and security) • Events (optional) • Concrete approaches under Java: • JavaBeans (Client) • Enterprise JavaBeans (Server) • Alternative: .NET-Components

  3. Properties of JavaBeans • Introspection: inspection of the Bean-structure via Tools (via BeanInfo-Class respectively Patterns) • Customization: adaptability of appearance and behavior • Events: interaction between Beans • Properties: attributes of Beans • Persistence: persistent saving and re-use of Beans • More powerful than conventional class approach

  4. JavaBeans: component model Introspection: information about Bean (for instance, Icon, Methods, Events, Description) for graphic tools for definition of Properties JavaBean Components Event classes and EventListener-classes for Java Event Model Public Methods of the Object • Constituents of • the local status (Attributes): • property (get/set) • indexed Property • bound property • constrained property JAR Archive - Classes as bytecode (also Events, Listener) - optional resources (data, media objects)

  5. Development support • Beans Development Kit (BDK) in co-operation with JDK • Integration in other tools like for instance, IBM Websphere Studio, BEA Weblogic Workshop • Graphical processing of Beans, Windows with List of the installed Beans, Beanbook, Editors • Integration of ActiveX-Controls in JavaBeans (and vice versa) possible, however with limitations, for instance, corresponding to security model

  6. Development support: example

  7. Enterprise JavaBeans • Server component model • Non-visual components, distribution • Container as Runtime-Environment (system resources, services) • Composition of components via Tools • Supporting of transactional applications • Mapping of component interactions on protocols like CORBA IIOP / RMI / SOAP

  8. Usage scenario Distributed transactions • Goal: transfer of processing logic to the server; • implicit transactions Client 1 Java RMI Transactionmonitor/DBMS EJB EJB EJB Container Client 2 EJB-Server

  9. EJB-Container EJB-Container Transaction mgmtState Mgmt Security EJBObject <methods> methods create(), finderXXX() EnterpriseBean ejbCreate Client • Management of life cycle of Enterprise Bean • Providing of a Factory-interface for creation of new EJB-instances (HomeInterface) • Generating of EJBObject-interface for remote use of Bean-Methods (RemoteInterface) • Additionally: LocalInterface for efficient Comm. within a Container, Realization via Application Server and Transaction monitors (for instance, BEA Weblogic, IBM WebSphere etc.) EJBFactory ejbLookup lookup(), destroy () ejbDestroy Developed by Bean Provider Supported by EJBContainer

  10. EJB: Session Beans and Entity Beans • Session Beans: non-persistent; control of dialogues with Business-Objects of the application; interface to the Client(frequently one Session Bean per Client); Variants: Stateless Session Bean / Stateful Session Bean • Entity Beans: persistent; represent Business-Objects with interface to data level; unique primary key with Mapping to data base; integration in transactions Session Bean (for instance, Customer Support) Entity Bean (for instance, Account) Client EJB-Container

  11. Enterprise JavaBeans Message-driven beans Session Beans Entity Beans Multicast-Communication (1:n) Stateless Session Beans Stateful Session Beans Container Managed Persistence Bean Managed Persistence Durable data, own persistence decision of the appl. Stateless Service, for instance, Search engine Processing with internal state, for instance, shopping Durable data, automatic Per- sistence mechan.

  12. Persistence Persistent storage of contents of Entity Beans Container Managed Persistence Bean Managed Persistence • Bean itself provides storage, for instance, via JDBC • Precise knowledge about life cycle necessary • Container generates a transaction to keep the data base consistent • Container saves Bean Attribute, Realization for instance via EJB QL (Query Language) • Bean is informed about state of data by Container • Simple to use, as a rule preferable Possible alternatives: JDO (Java Data Objects): Mapping of complex data objects between Database and Container

  13. Installation of Enterprise JavaBeans • Delivering as JAR-files • Constituents: • Bean-Components • Deployment Descriptor ( (static) settings of security properties, transaction properties, environment properties, persistence properties) • Home Interface (for instance, create, destroy etc.) • Remote Interface (call interface) • Instantiation via EJB-Factory • Recording of properties of the installed EJBs in Directory Service via JNDI

  14. Deployment Descriptor: example <ejb-jar> <enterprise-beans> <session> <ejb-name>bank</ejb-name> <home>BankHome</home> <remote>BankRemote</remote> <ejb-class>BankBean</ejb-class> <transaction-type>Container</transaction-type> <session-type>Stateful</session-type> <resource-ref> ... </resource-ref> </session> </enterprise-beans> <assembly-descriptor> ......... </assembly-descriptor> </ejb-jar>

  15. Interface-Definitions: example • import javax.ejb.*; • import java.rmi.RemoteException; • public interface BankHome extends EJBHome { • public BankSession create() throws CreateException, RemoteException; • } • import javax.ejb.*; • import java.rmi.RemoteException; • public interface BankSession extends EJBObject { • public void transferRequest(AccountIdentification accountident, float amount, TransferOrder transOrder) throws RemoteException, TransferException; • }

  16. Implementation: example • import java.rmi.*; • import javax.ejb.*; • public class BankSession implements SessionBean { • public void ejbCreate()throws RemoteException,CreateException{ } • public void transferRequest(AccountIdentification accountIdent, float amount, TransferOrder transOrder) throws RemoteException,TransferException { • Account accountFrom = AccountHome.findAccountByNumber(accountIdent.accountNumber); //hold account • accountFrom.checkAccount(accountIdent.pin, accountIdent.name); //proof access rights • try { BankHome.findBankByBLZ(transOrder.bankSortingCodeNumber); } catch(FinderException) { • throw new TransferException(„Bank not found“); • } • Account accountTo = AccountHome.findAccountByNumber(transOrder.accountNumber); • accountFrom.debit(amount); • accountTo.credit(amount); • } • public void ejbActivate()throws RemoteException { } • public void ejbPassivate()throws RemoteException { } • public void ejbRemove()throws RemoteException { } • public void setSessionContext(SessionContext sessionContext) throws RemoteException { • this.sessionContext = sessionContext; • } • }

  17. Localization • Home Interface implemented by Home Object • Home Object registered by Name Service • Client sends query to Name Service • Client obtains Reference • Client calls Home Object • Forwarding to Bean • Create Bean Instance • Assign Reference to EJB Object • Call business logic methods

  18. Transaction management • Requirements: Distributed Transactions with 2-Phase-Commit must be supported by the basic infrastructure (EJB-Server) • Use of Java Transaction Service (JTS), i.e. Java Binding of CORBA OTS (Object Transaction Service) • Different transaction modes (for instance, optional, compulsory or implicit transactions)

  19. Transaction control • TX_NOT_SUPPORTED: Bean cannot be used inside of transactions (temporary suspension of a transaction) • TX_SUPPORTS: Using of the Bean in transaction context possible • TX_REQUIRED: Transaction possible; implicit starting of a new transaction (if there are no active transactions) • TX_REQUIRES_NEW: Transaction compulsory, new transaction started during method call of the Bean (temporary suspension of a existing transaction) • TX_MANDATORY: Transaction compulsory, must already exist before (otherwise exception notification)

  20. Security aspects • Implicit mechanisms which are controlled via so called Security Descriptor Objects, relatively simply; • Example: • <!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 1.2//EN“ "http://java.sun.com/j2ee/dtds/ejb_1_2.dtd"> • <ejb-jar> • ... • <assembly-descriptor> • <security-role> <role-name>Administrator</role-name> </security-role> • <method-permission> • <role-name>Administrator</role-name> • <method> • <ejb-name>BankBean</ejb-name> <method-name>*</method-name> • </method> • </method-permission> • </assembly-descriptor> • </ejb-jar>

  21. Security aspects: general overview • Authentication (user name/ password) • Authorization (role-based, configurable but no Instance- based access control) • Basis: JAAS (Java Authentication and Authorization Service) • Integrity and confidentiality via encryption using SSL and TSL • Administration of security services via proprietary decisions inside the Application Server

  22. Java Messaging Service (JMS) • Standard based Messaging-Programming interface • Mapping on products like MQ Series • Support of communication models: • Point-to-Point • Publish/Subscribe (also several receivers - Multicast) • Part of Java Enterprise Edition • Integrable with JTS (Java Transaction Service), JNDI (Java Naming and Directory Interface) and EJB (Enterprise Java Beans) • Trusted, heterogenic Program-to-Program-communication • Asynchronous with optional confirmations • Atomic delivery of messages and persistent storage possible

  23. JMS: Example • Sender („Supplier“) • Queue bankQueue = (Queue) naming.lookup(“Bank“); • QueueSender sender = session.createSender(bankQueue); • TextMessage statusMessage = session.createTextMessage(“Statusabfrage“); • sender.send(statusMessage); • Receiver („Consumer“) • Queue bankQueue = (Queue) naming.lookup(“Bank“); • QueueReceiver receiver = session.createReceiver(bankQueue); • TextMessage statusMessage = (TextMessage) receiver.receive(); • ... • statusMessage.acknowledge(); // optional confirmation to sender

  24. Integration concept BusinessApplication Client Enterprise JavaBeans TransactionMonitor Database JMAPI JNDI JTS JIDL JMS JDBC JDO IIOP / RMI, SOAP, further protocols • JMAPI - Java Management API • JNDI - Java Naming & Directory Services • JTS - Java Transactional Services • JIDL - Java IDL • JMS - Java Messaging Service • JDBC - Java Database Connectivity • JDO – Java Data Objects Java as integration technology, however extensive infrastructure services necessary

More Related