plan
play

Plan 1. Application Servers 2. Servlets, JSP, JDBC 3. J2EE: Vue - PowerPoint PPT Presentation

Plan 1. Application Servers 2. Servlets, JSP, JDBC 3. J2EE: Vue densemble 4. Distributed Programming 5. Enterprise JavaBeans 6. Enterprise JavaBeans: Special Topics 7. Prise de recul critique Department of Informatics 5. Enterprise JavaBeans


  1. Plan 1. Application Servers 2. Servlets, JSP, JDBC 3. J2EE: Vue d’ensemble 4. Distributed Programming 5. Enterprise JavaBeans 6. Enterprise JavaBeans: Special Topics 7. Prise de recul critique Department of Informatics

  2. 5. Enterprise JavaBeans Enterprise JavaBeans 1. Definitions 2. Global View 3. Entity Beans 4. Session Beans 5. Message Beans 6. Implementation Department of Informatics

  3. 5. Enterprise JavaBeans 5.1 Definitions Composants: Motivation Programmation usuelle Programmation constructive � � (ou par composants) "programming in the small" "programming in the large" � � Le programmeur prend tout Le programmeur réutilise des � � en charge (construction des modules logiciels existants différents modules, interconnexions,…) Grandes compétences Focalise l'expertise sur les � � techniques problèmes du domaine Structure de l'application peu Description de la structure à � � visible (tout est dans le code) l'aide d'un langage déclaratif Department of Informatics

  4. 5. Enterprise JavaBeans 5.1 Definitions Composants: Définition Définition usuelle � module logiciel autonome pouvant � être installé sur différentes plates- formes qui exporte différents attributs, � propriétés ou méthodes qui peut être configuré � capable de s’auto-décrire � (introspection) Intérêt : être des briques de base � configurables pour permettre la construction d’une application par composition Department of Informatics

  5. 5. Enterprise JavaBeans 5.1 Definitions Rôle des conteneurs � Encapsulation d’un composant (techniquement par délégation) � prise en charge (masque) des services systèmes (nommage, sécurité, transaction, persistance, ...) � prise en charge partielle des "connecteurs" (composants ayant des relations avec d'autres composants) Department of Informatics

  6. 5. Enterprise JavaBeans 5.1 Definitions Les modèles de composants: de l'installation à l'introspection Installer les composants � Packaging et déploiement dans un conteneur � Créer une instance � par des fabriques ("home") � configuration des valeurs initiales � Retrouver les composants � services de nommage ou maisons ("home") � Utiliser � invocation synchrone et événements � Introspection � découvrir leurs APIs (fonctionnelle) � découvrir les connecteurs (structurelle) � Department of Informatics

  7. 5. Enterprise JavaBeans 5.1 Definitions Enterprise JavaBeans � Définition de Sun Microsystems: L'architecture des Enterprise JavaBeans (EJB) est une architecture de composants pour le développement et le déploiement d'applications d'entreprise distribuées basées sur des composants. Les applications écrites en utilisant l'architecture des EJB sont évolutives, transactionnelles et sûres. Ces applications peuvent être écrites une fois, puis déployées sur toute plate-forme serveur qui supporte la spécification des EJB. � Autre définition plus courte: Les EJB sont un modèle de composants côté serveur, basés sur les technologies à objets distribués, standard pour les CTM. Department of Informatics

  8. 5. Enterprise JavaBeans 5.1 Definitions Enterprise Java Beans: Components and Containers An Enterprise Java Bean (EJB) is a component that provides � reusable business logic functionality and/or a representation of a persistent business entity An EJB Container executes an EJB due to a client request. � Provides the plumbing necessary to execute the EJB including � • non-business logic related functionality such as transactions, security, concurrency, remote access, etc. • life cycle functions, e.g., creating, destroying, etc. Client uses an interface to access the Bean indirectly � A deployment descriptor describes the structure of the Bean and � how to execute the Bean as part of an application Department of Informatics

  9. 5. Enterprise JavaBeans 5.1 Definitions J2EE and EJB � How does J2EE relate to Enterprise JavaBeans technology? Enterprise JavaBeans (EJB) technology is the basis of J2EE. EJB technology provides the scalable architecture for executing business logic in a distributed computing environment. J2EE makes the life of an enterprise developer easier by combining the EJB component architecture with other enterprise technologies to solutions on the Java platform for seamless development and deployment of server side applications. Department of Informatics

  10. 5. Enterprise JavaBeans 5.2 Global View EJB Contrats Fournir un modèle de � développement uniforme pour les applications qui utilisent les composants EB Contrat coté client � • fournir une vue uniforme du bean au client. En particulier cette vue est indépendante de la plate-forme de déploiement Contrat coté conteneur � • permettre la portabilité des beans sur différents serveurs EJB Contrat coté “ packaging” (ejb- � jar/ear file) • fournir un format de fichier standard pour “packager” les beans. Ce format doit être supporter par tous les outils liés aux EJB Department of Informatics

  11. 5. Enterprise JavaBeans 5.2 Global View EJB: Le contrat côté client � Localiser le bean utilisation de JNDI � � Utiliser le bean utilisation de l’interface standard fournie par l’EB � • Home Interface – méthodes liées à la gestion du bean : create , remove , finder , ... • Remote Interface (méthodes de l’application) � Le container implémente le mécanisme de délégation permettant de “faire suivre” l’appel au bean � Le client ne communique pas directement avec le bean mais avec le container Department of Informatics

  12. 5. Enterprise JavaBeans 5.2 Global View EJB: Le contrat "conteneur" � L’EJB conteneur permet � gestion du cycle de vie, gestion de l’état, sécurité, transaction distribuée, concurrence, extensibilité � ces services appellent des méthodes fournies par le bean (callback methods) � Les conteneurs gèrent 3 types de beans � Entity beans � Session beans � Message driven beans Department of Informatics

  13. 5. Enterprise JavaBeans 5.2 Global View Cycle de vie d'un bean � Le conteneur gère le cycle de vie d’un bean � Il fournit � administration du bean ("Home implementation") • permet aux clients de créer, détruire et rechercher un objet EJB • appelle les opérations correspondantes fournies par le bean (callbacks) � gestion de l’état • Activation: le bean est chargé en mémoire • Passivation (Désactivation ): le conteneur peut sauvegarder l’état du bean Department of Informatics

  14. 5. Enterprise JavaBeans 5.2 Global View Architecture Client Container Method invocation Method Delegation Client Interface TX support Bean Instance Security Persistence . . . Department of Informatics

  15. 5. Enterprise JavaBeans 5.2 Global View Structure d'un EJB Department of Informatics

  16. 5. Enterprise JavaBeans 5.2 Global View Création d'un EJB Objet Department of Informatics

  17. 5. Enterprise JavaBeans 5.2 Global View Interaction avec un EJB Department of Informatics

  18. 5. Enterprise JavaBeans 5.2 Global View EJB Object / Proxy d'EJB � Client never directly access Bean instance � Client finds home interface via JNDI � Client uses home interface to obtain a reference to the Bean’s component interface. Department of Informatics

  19. 5. Enterprise JavaBeans 5.2 Global View Gestion des ressources "Pool" d'instances � Le serveur EJB maintient un pool d'instance de bean Department of Informatics

  20. 5. Enterprise JavaBeans 5.2 Global View Types of Beans � Entity Beans � Persistent data focus � Session Beans: � Client and application logic focus � Message Driven Beans � Asynchronous message processing Department of Informatics

  21. 5. Enterprise JavaBeans 5.2 Global View Classes and Interfaces Remote Interface 1. Remote Home Interface 2. Local Interface 3. Local Home Interface 4. Bean Class 5. Primary Key 6. See: http://java.sun.com/j2ee/sdk_1.3/techdocs/api/ Department of Informatics

  22. 5. Enterprise JavaBeans 5.2 Global View Remote Interface «interface» java.rmi.Remote � Define the bean's business methods that can be accessed from applications outside the EJB «interface» container. javax.ejb.EJBObject «interface» RemoteInterface Department of Informatics

  23. 5. Enterprise JavaBeans 5.2 Global View Remote Home Interface «interface» java.rmi.Remote � Defines the bean's life-cycle methods that can be accessed from applications outside the EJB container: «interface» javax.ejb.EJBHome � Creating beans � Removing beans � Finding beans «interface» RemoteHomeInterface Department of Informatics

  24. 5. Enterprise JavaBeans 5.2 Global View Local Interface � Defines the bean's business methods that can be used by «interface» javax.ejb.EJBLocalObject other bean co-located in the same EJB container (same address space) � Allow beans to interact «interface» LocalInterface without the overhead of a distributed object protocol, which improves performance. Department of Informatics

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend