Bài giảng Lập trình mạng 2 - Title - Nguyễn Xuân Vinh

Tóm tắt Bài giảng Lập trình mạng 2 - Title - Nguyễn Xuân Vinh: ...ise Edition ( J2EE ) J2EE Technologies * Enterprise Java Beans (EJB) * Remote Method Invocation (RMI) * Java Naming and Directory Interface (JNDI) * Java Database Connectivity (JDBC) * Java Transaction API (JTA) and Java Transaction Service (JTS) * Java Messaging Service (JMS) (cont)Java 2 Platform .../EJB 2.0/Session 2/28 of 25Stages in Developing Business SolutionsGrouping of resuable modulesby vendorsRunning of these EJB components on multi-tier applicationsCombining the components into a workflowDeploying the whole system over multiple systems across the network Application Servers are provid... the client the container performs a variety of tasks.Server Tasks Database connection poolingACCP 2005/EJB 2.0/Session 2/38 of 25Enterprise BeansThe Enterprise Java Bean is a server-side component that is employed on a distributed multi-tier environment. Enterprise BeanSession BeanEntity BeanStatef...

ppt50 trang | Chia sẻ: havih72 | Lượt xem: 228 | Lượt tải: 0download
Nội dung tài liệu Bài giảng Lập trình mạng 2 - Title - Nguyễn Xuân Vinh, để tải tài liệu về máy bạn click vào nút DOWNLOAD ở trên
TITLEPresenter: Nguyễn Xuân VinhInformation Technology FacultyNong Lam UniversitySession 1Introduction to EnterpriseJava BeansSession ObjectivesDiscuss Component ArchitectureDescribe Distributed Object ArchitectureDiscuss RMIExplain RMI-IIOPDiscuss the Java Naming and Directory Interface Component ArchitectureComponents are building blocks of an application Provides a set of services or functions, such that it can easily interact with other applications or components Consists mainly of Web components, business logic components, and service components. Web components consist mainly of JSP and Servlets, the business logic component consists of EJB and the services component primarily consists of JavaMail, JNDI, JMS, JTS, JDBC, and RMI-IIOP. Evolution of Enterprise JavaBeans EJB was developed so that it would: * Specialize in handling the business logic of an application * Be robust * Be secure so that it cannot be tampered.EJB Component has been designed to encapsulate business logic. Distributed Object ArchitectureRunning HTML and Java ScriptRMI ArchitectureRMI Application consists of * Server * ClientRMI defines two types of objects * Stubs * SkeletonsMarshalling - process of converting data or objects into a byte-stream .Unmarshalling - reverse process of converting the byte-stream back to the original data or objects. RMI Layered ArchitectureTransport LayerObject ARemote Reference LayerObject A StubTransport LayerObject BRemote Reference LayerObject B SkeletonClientServerREMOTEREGISTRYRMI LayersStub and the Skeleton Layer The stub forwards the request from the client to the remote reference layer and then to the skeleton through transport layer.Remote Reference Layer Responsible for unicast point-to-point method invocation.Transport Layer Uses TCP/IP for communication.The Transport LayerTransport LayerClient Transport LayerServerTCP ProtocolUDP ProtocolSocketsRemote RegistryRemote RegistryRegistersDatabase of ObjectsSERVERRMI over IIOP ClientClientClientServerServerServerRMI(Java only)RMI(Java only)RMI-IIOP(Java)RMI-IIOP(Java)CORBA(Any Language)CORBA(Any Language)JRMPJRMPIIOPIIOPJava Naming and Directory InterfaceJava Naming and Directory Interface provides the naming and directory functionality to Java applications.Provides a standard interface to locate the components, users,networks, and services placed across the network.Bridges the gap between directory services and makes it possible for the developer to write portable naming and directory services The JNDI ArchitectureClientJNDILDAP Service ProviderNDS Service ProviderRMI Application Service Provider InterfaceCORBA Application Naming Concepts in JNDICompoundCompositeAtomicThe three types of names in JNDISteps in JNDI ProgrammingLooking up the Component/ObjectCreating the Initial ContextImporting the JNDI classesCatching the Naming ExceptionRunning the programCompiling the ProgramInitial Context Factory and the Directory ContextInitial Context Factory is the point where all naming and directory operations are first performed. When the initial context is acquired, all information pertaining to this must be provided to JNDI. The directory context or directory object is another type of context. It is used to define methods for inspecting and modifying attributes associated with a directory object. Initial Context Factory and the Directory ContextInitial Context FactoryContextInitial ContextContextNaming SystemBindingJava 2 Platform Enterprise Edition ( J2EE ) J2EE Technologies * Enterprise Java Beans (EJB) * Remote Method Invocation (RMI) * Java Naming and Directory Interface (JNDI) * Java Database Connectivity (JDBC) * Java Transaction API (JTA) and Java Transaction Service (JTS) * Java Messaging Service (JMS) (cont)Java 2 Platform Enterprise Edition (J2EE)J2EE Technologies * Java Servlets and Java Server Pages (JSP) * Java IDL * Java Mail * Connectors * Extensible Markup Language (XML) New Features in EJB 2.0Container-Managed Persistence Container-Managed Relationships Message-Driven Beans Local Interface Additional Methods on the Home-Interface New Query Language (EJB QL) SummaryThe multi-tier application model focuses on three important areas: * Programming business logic * Relying on backend services * Providing user interaction using client-side applicationsA software component is an individual unit of composition with no persistent state. A software component can be deployed independently, and is subject to composition by third parties.Summary - 2A component in EJB is an object that is deployed on any EJB server.In a distributed application, processing is distributed across multiple networked computers.The J2EE Platform collects all the Enterprise APIs to form a total development platform that distributes object architectures.Summary - 3The RMI API has mainly 5 packages * java.rmi * java.rmi.registry * java.rmi.server * java.rmi.activation * java.rmi.dgc JNDI is used by Enterprise JavaBeans to perform a look-up to distribute objects in a network.The point where all naming and directory operations are first performed is called the Initial Context Factory.Architectural Overview of EJBSession 2ACCP 2005/EJB 2.0/Session 2/26 of 25Session ObjectivesExplain the stages in Business DevelopmentRecognize the parties involved in the deployment of Enterprise JavaBeansDefine Enterprise JavaBeansExplain the classification of Enterprise JavaBeansDiscuss the two types of session beans and entity beansExplain the responsibility of the EJB Server and ContainerACCP 2005/EJB 2.0/Session 2/27 of 25Review of Session 1In session 1, we did the following: Discussed Component ArchitectureDescribed Distributed Object ArchitectureDiscussed RMIExplained RMI-IIOPDiscussed the Java Naming and Directory Interface ACCP 2005/EJB 2.0/Session 2/28 of 25Stages in Developing Business SolutionsGrouping of resuable modulesby vendorsRunning of these EJB components on multi-tier applicationsCombining the components into a workflowDeploying the whole system over multiple systems across the network Application Servers are provided by middleware vendors. These servers are needed to run the components ACCP 2005/EJB 2.0/Session 2/29 of 25Parties Involved in EJB DeploymentBean ProviderParties in EJBDeploymentContainer ProviderThe DeployerServer ProviderApplication AssemblerSystem AdministratorProvides reusable componentsProvides low-level execution environmentSupplies Application server logicPuts together components and applicationsDeploys prewritten componentsMonitors functioningEJBCont/ServerACCP 2005/EJB 2.0/Session 2/30 of 25Logical EJB Architecture ClientHomeInterfaceRemote InterfaceEJBServerHome ObjectEJB ObjectJDBCDatabaseACCP 2005/EJB 2.0/Session 2/31 of 25The EJB ContainerTHE SERVERTHE EJB CONTAINERTHE CLIENTOutside WorldThe container which resides insides the server acts as a BUFFER between the the beans and the outside world.Connects clients to the BeansManaging Life-cycle of a BeanACCP 2005/EJB 2.0/Session 2/32 of 25The EJB ServerServerContainer 1Container 2ClientProcess and Thread ManagementResponsibilitiesSystem Resource ManagementDatabase ConnectionACCP 2005/EJB 2.0/Session 2/33 of 25The Application Assembler and EJB DeployerAssembled applicationEJB DeployerOperational EnvironmentsApplication AssemblerServer SideClient SideACCP 2005/EJB 2.0/Session 2/34 of 25Services provided by the Container and ServerContainer/ServerTransaction supportSupport for management of multiple instancesPersistence supportSecurity SupportACCP 2005/EJB 2.0/Session 2/35 of 25Security SupportEJBThe Access Control List Functionality 1Functionality 2Functionality 3The ACL comprises the list of persons who are allowed to access particular sections of functionality.ACCP 2005/EJB 2.0/Session 2/36 of 25Persistent SupportPersistence can be defined as saving the state of an object to a constant storage.The state of the object is maintainedin this constant storageACCP 2005/EJB 2.0/Session 2/37 of 25Support for Management of Multiple InstancesInstancePassivationInstance poolingIn order to perform timely servicing to the client the container performs a variety of tasks.Server Tasks Database connection poolingACCP 2005/EJB 2.0/Session 2/38 of 25Enterprise BeansThe Enterprise Java Bean is a server-side component that is employed on a distributed multi-tier environment. Enterprise BeanSession BeanEntity BeanStateful BeanStateless BeanBMPCMPMessage Driven BeansACCP 2005/EJB 2.0/Session 2/39 of 25Features of an EJB ContainerResource Managementand Life Cycle Management of a BeanFeaturesState Management TransactionsSecurityPersistenceRemote Accessibility and location transparencyACCP 2005/EJB 2.0/Session 2/40 of 25Resource Management and Life Cycle of a beanManagement of resources enhances the scalability of a multi-tier architecture.The container provides resource- management services for resources such as:ThreadsSocket ConnectionsDatabase ConnectionsACCP 2005/EJB 2.0/Session 2/41 of 25State ManagementFills up Applicationin a sitePage 1 Submits the formApplicationin a sitePage 2 User takes timeas he reads the contents in the pageClientContainer is used for another process while user takes time to readACCP 2005/EJB 2.0/Session 2/42 of 25TransactionsOperation2Operation1Operation3Executed as one unit of workMultiple usersuse the same dataACCP 2005/EJB 2.0/Session 2/43 of 25Transactions-Two phase commit protocolTransaction CoordinatorDatabase 1Database 3Database 2Prepare PhasePrepare messageCommit PhaseCommit/Rollback Transaction RequestAll databases issue commit requestCommit/Rollback Transaction RequestRecords results of transactionACCP 2005/EJB 2.0/Session 2/44 of 25Remote Accessibility BeanBeanBeanDeployed across multiple tiersBeanBeanBeanNetworked after deploymentNot-NetworkedACCP 2005/EJB 2.0/Session 2/45 of 25Location Transparency Component  Component Clients do not know where the components are, and whether these components are local or remoteACCP 2005/EJB 2.0/Session 2/46 of 25Specialized ContainersIntegration to mainframe systemsStateful recoveryDistributed transactionsDatabase persistence services that are complexIntegrated XML servicesDynamic redeployment of components in a system that is runningACCP 2005/EJB 2.0/Session 2/47 of 25Summary - 1Four stages are followed while developing business solutions: * Vendor grouping of product into modules * Running of the EJB component on multi-tier applications * Combining the component into a workflow, and integrating 	the business logic * Deploying and distributing the system over multiple systems 	across the network.Six parties involved while deploying Enterprise JavaBeans: * The Bean provider * The Container provider * The Server provider * The Application Assembler * The Deployer * The System AdministratorACCP 2005/EJB 2.0/Session 2/48 of 25Summary - 2Logical three-tier architecture of EJB: The ClientThe EJB ServerThe DatabaseThe EJB Container resides inside the EJB server. The container acts as a buffer between the bean and the outside world.The main responsibilities of the container are: * Connecting clients to the beans * Managing the life cycle of the beanThe server provides the container with network connectivity.ACCP 2005/EJB 2.0/Session 2/49 of 25Summary - 3The server and the container provide following services to the developer * Transaction support * Security support * Persistence support * Support for management of multiple instances .An Enterprise Java Bean can be classified into: * Session Beans * Entity Beans * Message-Driven BeansHỎI ĐÁP

File đính kèm:

  • pptbai_giang_lap_trinh_mang_2_title_nguyen_xuan_vinh.ppt
Ebook liên quan