Академический Документы
Профессиональный Документы
Культура Документы
Abstract
Several server component models exist today and more are being added to the list. This includes Java 2 Enterprise Edition server component models, BEA's WLE CORBA Components, OMG's CORBA Component Model and Microsoft's COM+. All these models require containers to fulfill some common goals. This includes managing lifecycle, state, transaction and security of component in addition to providing it infrastructure services. While the component models define architecture for components and contracts between component and its container, it is left to vendors to define the architecture of containers. As containers of these component models share functional requirements, we could define architecture for a container of a generic server component model. We have put together elements of this architecture in the form of a white-box framework called Java Container Framework (JCF). We believe it essential to have such a framework when a product supports multiple component models.
1 Introduction
1.1 Evolution of Enterprise Application Architecture - need for Server Component Model
Enterprise scale application architecture has evolved from centralized to fat clientdatabase server to thin-client multi-tier architecture. The force behind this evolution is strong requirements for scalability, reliability, availability, manageability, flexibility and reusability demanded by these applications. In multi-tier thin-client architecture, business logic resides on severs and is shared by multiple clients. A combination of application server, middleware, database servers, networks and hardware provides reliability, scalability and availability to such applications. Application servers provide load-balancing, clustering, resource pooling, transaction management, persistence, security, administration and management among other things to applications. Server A Java Container Framework for Server Component Models 01/03/00
2 component architecture frees business-logic-savvy application developers from worrying about this infrastructure by giving that responsibility to Application Servers. Application developers only write components embodying business logic and rely on servers to provide necessary runtime environment. Enterprise applications come to life with deployment of components into application server.
1.2 Purpose
1.2.1 Why Container Framework?
We realized a need for a framework while implementing containers for Enterprise JavaBeans (EJB), Web Components (Java Servlets & JavaServer Pages (JSP)) and WLE CORBA Components (in Java) in BEA's WebLogic product. It appears developers of any product supporting Java 2 Enterprise Edition (J2EE) platform, OMG's CORBA Component Model or both will face the same situation as containers of these component models share a lot of functionality. Container framework seems to be a judicious approach to take.
1.3 Definitions
Framework A framework is a reusable design expressed as a set of abstract classes and the way their instances collaborate. It is a reusable design for all or part of a software system [9]. Application Server An application server provides an execution environment to host applications. It manages and recycles scarce system resources, such as processes, threads, memory, database connections, and network sessions on behalf of the applications. Some application servers also provide high availability, reliability and scalability by offering load balancing, fault-tolerance, clustering and administration. A typical application server provides access to infrastructure services, such as messaging, naming, directory,
01/03/00
3 transactions, persistence and security. An application server can potentially host multiple containers. The application server might not be confined to a single address space, process, virtual or physical machine. Component Components are pre-developed pieces of application code that can be assembled into working application systems. Usually, components are offered in two flavors: extensible and non-extensible. The behavior of extensible components can be extended by inheritance. By changing their properties (also called description or meta-data), nonextensible components are configured. Container Container provides execution environment for a component or a set of components of a component model. Containers inherit their environment from application server. While application servers can be considered containers hosting applications, a container provides a tailored execution environment specific to the component model it hosts. There may be more than one container, each hosting a different component model in an application server. Component Model A component model defines the basic architecture of a component, specifying the structure of its interfaces and the mechanisms by which it interacts with its container and with other components. The component model provides guidelines to create and implement components that can work together to form a larger application.
Application Server
Components
01/03/00
4 This first section gives introduction to enterprise application architecture, a brief about its evolution and reasons behind emergence of server component models. It describes the purpose of designing a Java container framework and gives reasons behind its name. It also defines some important terms used throughout the paper. In section two a brief introduction of component models in discussion is given. It gives a summary of behavior of components, functionality offered by container and packaging and deployment information in each component model. In the third section we derive functional requirements for a generic container. These requirements do not necessarily satisfy one component model but might be a common set for all containers considered. Then we will try to define architecture by providing abstractions satisfying the requirements. Lastly, we will put these abstractions together in the form of Java Container Framework. In the end, we list advantages and disadvantages of the approach and give conclusion.
2 Component models
This section describes in brief component models considered while defining the architecture of Java Container Framework. It includes Java 2 Enterprise Edition (J2EE) Server component models [1], BEA's CORBA component model in WebLogic Enterprise Server (WLE) [8] and OMG's CORBA Component Model (CCM) [7]. Please refer to relevant specification for more details.
01/03/00
5 Session beans are of two types: stateless and stateful. Stateless session beans are like services. These beans do not keep any state for the client. Stateful session beans keep conversational state for the client. EJB Container manages state for such beans. Entity beans are identified with primary key. Entity bean survives server crashes and exists as long as data exists. It is a shared object. Such a bean can manage its own state or can rely on EJB Container to manage its state in database. EJB Container always manages entity bean's transactions. EJB Container manages transaction, security, lifecycle and state of enterprise beans. It also provides programmatic access of transaction service, naming service, security environment and database connections through well-defined contracts. The container ensures serialization of requests for the beans. EJB Deployment Descriptor (in XML) contains declarative information about various classes of the bean, expected transaction, state and security management as well as environment needed to run the bean. It is a contract between various well-defined roles in EJB Component model to convey the requirements of the beans. Enterprise JavaBeans are packaged in ejb-jar file. The ejb-jar file includes enterprise bean classes, their remote and home interfaces and Deployment Descriptor.
01/03/00
6 Servlet Deployment Descriptor (in XML) is a contract between different well-defined roles in Web component model. It conveys the elements and configuration information of a web application. Servlets are packaged inside a WebARchieve (WAR) file along with other classes, JavaServer Pages, HTML documents, image files and other resources required to create a web application. A JavaServer Page (JSP) separates the user interface from content generation enabling web designers to change the overall page layout without altering the underlying dynamic content. A JSP page is a text-based document that describes how to process a request to create a response. The description inter-mixes template data with some dynamic actions and leverages on the Java Platform. A JSP is executed in a JSP container, which is installed on a Web server, or on a Web enabled application server. The JSP container delivers requests from a client to a JSP page and responses from the JSP page to the client. The semantic model underlying JSP pages is that of a servlet: a JSP page describes how to create a response object from a request object for a given protocol, possibly creating and/or using in the process some other objects. A JSP is packaged into a WAR file. It can be packaged in a source form or compiled into a Servlet, which is then packaged into a WAR with a deployment descriptor such that it looks as the original JSP to any client.
01/03/00
7 WLE CORBA Container (a.k.a. TP Framework) is built on an ORB and uses Portable Object Adapter (POA). It manages transaction and activation of WLE CORBA components. It also provides programmatic access to CORBA transaction, notification and security service to components in addition to access to factory finder and database connectivity services. The WLE container does not manage state for components. WLE Server Descriptor (in XML) contains meta-data of CORBA components including implementation classes and policies for transaction and activation. Java CORBA components are packaged in a JavaARchive (JAR) file.
01/03/00
8 its various files. The CORBA Component Descriptor is one of the elements of Software Package descriptor. The component descriptor describes the structure of a component with respect to supported interfaces, inherited components, and uses and provides ports. A component package may be deployed alone, as is, or it may be included in a component assembly package and deployed as part of the assembly along with the other components of the assembly.
01/03/00
3.1.4 Security
The container provides security environment to components. This may be in the form of users, groups or other security information. A component can rely on the container to do authorization for client requests or can do this on its own programmatically by using interfaces provided by the container. Containers may also provide secure environment for components by enforcing Java security protection domains.
3.1.5 Deployment
Component architectures require component level installment for applications. This is usually termed as component deployment. Components can be deployed in two ways: statically at application server startup or dynamically during runtime. In addition to providing a deployment framework, container should enforce component isolation and handle requests to different active versions of the components appropriately.
01/03/00
10
3.2 Architecture
In this section, we will discuss about the architecture of the Java Container Framework. Based on the requirements in section 3.1, we will define abstractions for elements of the container framework and describe their behavior.
Component models define meta-data for components. This is usually defined in a class called descriptor. Descriptor defines a contract between a component provider and deployer. It contains information about remote and other necessary interfaces and implementation classes of the component, names with which components are advertised to the outside world, information about execution environment expected from the container including activation, state, transaction and security policies to be enforced etc. It is also a good place to provide details about 3rd party tool (e.g. for state management) integration to the container. Based on the component, meta-data can be divided into the following classes:
3.2.2.1.1 Component Descriptor
This class contains meta-data of the component applicable at component scope. For example, it can contain information about state management and activation semantics expected by the component from the container. Component descriptors can but may not
01/03/00
11 necessarily be deployment descriptors. Component descriptors are tuned to provide meta-data at runtime. Component descriptors can contain one or more method descriptors.
3.2.2.1.2 Method Descriptor
This class contains meta-data applicable at (remote) method scope of the component. For an example, it may contain information about security and transaction management expected from the container when certain method on certain remote interface of the component is invoked. 3.2.2.2 Component Registry
Component registry is a place where all the deployed components are registered in the container. Registry entry maps a unique component key (e.g. a fully qualified remote interface) with its descriptor. Registry keeps meta-data for all the deployed components in the container. Registry can be local to a container or can be shared by all containers. It can be local to a process or can be shared by multiple processes. When a request for a component arrives in a container, the registry is accessed to retrieve target component's descriptor. 3.2.2.3 Component Request
A component request embodies invocation context. In addition to including meta-data of the invoked method, invocation context also includes identity of target component and contexts for transaction and security. The request can also contain target component's descriptor. These request objects are created in protocol adapter. 3.2.2.4 Component Factory
Some component models define Component Factory (Home) interfaces for the components. These factories are used to create and find components. Factories are either implemented by containers or are code generated by deployment tools. Container uses factory to manage lifecycle of components. 3.2.2.5 Component Handler
A component model offers one or more types or categories of components. These components may display different behavior in terms of lifecycle, activation, transaction, state and security management. A component handler implements container's contract towards satisfying component's behavior. Usually, it is a good idea to define behavior of component handler based on the activation semantics of the component. Handler takes a
01/03/00
12 component request as input and invokes it on the target component instance. In doing so, it controls activation, passivation and optionally state and transaction management and performs authorization with the help of information in component descriptor. It can also take necessary precautions to fulfill the component's serialization requirements. To accomplish these functions, component handlers access necessary infrastructure services through runtime, obtain resources from pools and collaborate with other elements of the container framework. In addition, component handlers provide hooks at various welldefined points (e.g. before, after method invocation) in controlled flow of the request where interceptors can be invoked. 3.2.2.6 Interceptor
In cases when components rely on their container to manage transaction and authorization, the container has to intercept requests on components to demarcate transactions and perform security checks. Method level interceptor design pattern appropriately fits to the requirements here. Component handlers invoke interceptors for a request being processed based on pre-defined conditions in component descriptor. Apart from this, interceptors can also be used for integration of container with any 3rd party tool used for state management. Good thing about interceptor pattern is that it provides decoupling and introduces a HotSpot [9] in the framework.
01/03/00
13
3.2.5 Cache
Containers can cache active components to improve response time and optimize resource utilization. Eviction of components might be done at method end, transaction end, process end, or when resources become scarce. Eviction or passivation policies are either governed by behavior of components (by declarative activation policies) or are enforced by an implementation of the container. Cache can be part of component activation framework or state management adapter.
3.2.6 Runtime
Every container has a runtime class. Runtime provides an interface to the container with infrastructure services like transaction, naming, database connectivity and security. Runtime is accessible everywhere in the container and usually works as a single point of access to obtain interfaces of infrastructure services and other elements of container. It can also be registered with the application server as a single point of access for container. When the container is instantiated, the runtime is created first. Runtime is a singleton in a container.
3.2.8 Deployment
Deployment is a process of installing application components into application server. 3.2.8.1 Deployer
Deployer is an interface between management interface of a container and the container runtime environment. The task of this element is to deploy components from a package. The deployment process includes parsing deployment descriptor, loading required classes, creating and initializing necessary objects, setting environment for the component in container, registering component to component registry and advertising its existence to outside world by registering it to the naming service. Deployer can also make sure that components are isolated in terms of versions and security. Deployer similarly provides functions to undeploy or redeploy components.
01/03/00
14
Infrastructure Services Component Handlers Runtime State Mgt. Adapters Admin. & Mgt. Interface Deployer
01/03/00
15
Figure 3. Two container instances 3. Forms a solid base for the product. Efforts put behind well-designed framework in balance with the reality of software development always pays-off.
4.2 Disadvantages
1. If the abstractions of the framework are not designed properly (keeping future in sight), duplication of effort, code and behavior is inevitable. This weakens the whole purpose of designing a white-box framework. 2. Complexity increases as more derivatives are added.
01/03/00
16 3. Framework implementation is expensive in terms of time and labor. Initial work on designing infrastructure of the framework does not produce end product as expected by management. Special skills are required for white-box framework development and maintenance.
5 Conclusion
All server side component model specifications define behavior of components, rules to implement components, responsibility of different roles, packaging requirements and contracts between component and its container [ref 1.3 Component Model]. It is left to vendors to decide on the design of container. On one hand it is good not to include this in specification as it gives vendors liberty to implement a container in the most suitable way available. On the other hand it introduces a great deal of confusion on vendors' part by introducing duplication of efforts, design and code for different containers in the same product. For example, evolving J2EE platform specification [ref 1] describes in brief about different containers and their functionality, but it does not define any framework to implement these even though J2EE containers share a lot of functionality. This is not helpful to J2EE product providers. The same argument applies to CCM specification. In this paper, we have deliberately avoided defining APIs and concentrated only on the abstractions of container framework. We believe standard bodies like JavaSoft should formalize a Java Container Framework API in J2EE. OMG should do the same for CORBA Components.
6 Acknowledgements 7 References
1. Java 2 Platform Enterprise Edition, v 1.2, Public Release 2 (http://java.sun.com/j2ee). 2. Enterprise JavaBeans Specification, v 1.1 Public Release 2 (http://java.sun.com/products/ejb/newspec.html) 3. Enterprise JavaBeans Technology, Server Component Model for Java Platform, by Ann Thomas (http://java.sun.com/products/ejb/white_paper.html) for Sun Microsystems, Inc. 4. Java Servlet Specification, v2.2 Public Release 2 (http://jsp.java.sun.com/products/servlet) 5. JavaServer Pages Specification v1.1 Public Release 2 (http://jsp.java.sun.com/products/jsp) A Java Container Framework for Server Component Models 01/03/00
17 6. Design Patterns: Elements of Reusable Object-Oriented Software, by Gamma et. al., Addison-Wesley Pub Co. 7. CORBA Components, Volume 1, Object Management Group, (http://www.omg.org/cgi-bin/doc?orbos/99-07-01) 8. Making Component-based Systems Scale with BEA WebLogic Enterprise, BEA Systems Inc. (http://www.beasys.com/products/weblogic/enterprise/paper_components.html) 9. Evolving Frameworks, A Pattern Language for Developing Object-Oriented Frameworks, by Roberts D., Johnson R., University of Illinois (http://stwww.cs.uiuc.edu/~droberts/evolve.html).
01/03/00