La descarga está en progreso. Por favor, espere

La descarga está en progreso. Por favor, espere

Bases de datos en ambiente Internet

Presentaciones similares


Presentación del tema: "Bases de datos en ambiente Internet"— Transcripción de la presentación:

1 Bases de datos en ambiente Internet

2 Objetivos Conocer la arquitectura cliente/servidor
Conocer la arquitectura multitier Conocer la arquitectura Internet con bases de datos Conocer las generalidades de un servidor de aplicaciones Conocer servidores de aplicaciones que se ofrecen en el mercado

3 Características deseables de un sistema de información
Infraestructura modular Infraestructura versátil Facilidad de uso Usuarios aprenden a manipular la herramienta disponible Interoperabilidad Dos o más sistemas o componentes intercambian información de manera sencilla Escalabilidad Facilidad de modificar y adaptar un sistema a las necesidades del problema para el cual fue diseñado Flexibilidad Capacidad de modificar un sistema para solucionar un problema para el cual no fue diseñado inicialmente

4 Arquitectura Cliente/Servidor
Servidor – Base de Datos Cliente: Demanda servicios Servidor: Provee servicios

5 Arquitectura Cliente/Servidor
Servidor – Base de Datos Administración de datos Lógica del negocio, en triggers, procedimientos almacenados, … Interfase de usuario Alguna lógica del negocio

6 Arquitectura Cliente/Servidor
Arquitectura de dos niveles (two tier) Mantenimiento no particionado del código Al hacer cambios hay que volver a comprobar Hay que administrar las máquinas de los clientes Los cambios en aplicaciones hay que volverlos a distribuir a todos los clientes Hay que administrar el rendimiento El hardware debe soportar el software requerido por los aplicativos

7 Arquitectura Cliente/Servidor
Control no centralizado Difícil implementar seguridad Cuellos de botella en los servidores de Bases de datos Se tienen muchas conexiones La lógica del negocio se encuentra en la base de datos (escrita en lenguaje propietario)

8 Arquitectura Cliente/Servidor
Servidor BD Conexiones: c * s

9 Arquitectura Cliente/Servidor
En trabajo en grupo/departamental Se controla el número de clientes y así el número de transacciones Hay que controlar la(s) plataforma(s).

10 Arquitectura Multitier (Distribuida)
Cliente Interfase de usuario Administración de las transacciones Administración de los datos Servidor de Aplicaciones Lógica del negocio Caché Transparencia en la localización de los datos Balance de carga Servidor de Bases de Datos

11 Ventajas de la arquitectura multicapa
Cliente más liviano Menos administración en el cliente Lógica encapsulada Mejor rendimiento Escalabilidad Consistencia, control y seguridad Reusabilidad de componentes existentes Listo para usar la Web

12 Desventajas de la arquitectura multicapa
Hay que cambiar los hábitos de programación Curva de aprendizaje Más tiempo en diseño y tiempo de desarrollo iniciales Más puntos posibles de fallas

13 Arquitectura multicapa
Cliente Servidor de Aplicaciones Servidor BD Conexiones: c + s

14 Arquitectura multicapa
Características Impredecible el número de clientes/transacciones Abre las aplicaciones hacia Internet/extranet

15 Arquitectura multicapa
Principios de la arquitectura Multitier Encapsula o “particiona” la lógica del negocio en objetos. Mueve o “distribuye” los objetos del negocio a una máquina dedicada Da acceso o permite alojar a los objetos en un servidor de aplicaciones El servidor de aplicaciones recibe requerimientos de procesamiento de los clientes. El servidor dirige los requerimientos a los objetos del negocio para su procesamiento

16 Arquitectura multicapa
Ejemplos Lógica de negocio: aprobación de préstamos, autorización de tarjeta de crédito Datos en caché: estados, partes/productos Servicios para recursos especializados: vía hacia un computador servidor tipo mainframe o hacia un servidor de fax, servicios inalámbricos de la vida real

17 Arquitectura multicapa
Razones para pasarse a una arquitectura multicapa Más escalable Mayor reutilización de objetos Listos para desarrollos Web/Inalámbricos

18 Arquitectura multicapa
No todas las aplicaciones necesitan estar distribuidas Especialmente si el número de usuarios es pequeño Si no se piensa en servicios a través de la Web Si no hay código reutilizable entre aplicaciones Si la lógica del negocio no cambia o los cambios son muy esporádicos

19 Arquitectura multicapa
En aplicaciones muy grandes Generalmente están escritas en muchos lenguajes Utilizando diferentes herramientas Con clientes heterogéneos (incluyendo aplicaciones HTML basadas en la Web) Máquinas de los clientes heterogéneas Allí se necesita arquitectura distribuida. En estos casos no se pueden administrar fácilmente las aplicaciones en un ambiente típico de dos niveles

20 CORBA CORBA: Common Object Request Broker Architecture
Arquitectura estándar para objetos distribuidos Desarrollada por OMG (Object Management Group) Establecida en 1989 Incluye más de 800 compañías (IBM, SUN, Oracle, Sybase, ...) No incluye a Microsoft DCOM compite con CORBA Independiente de proveedor Separa la interfase de la implementación

21 CORBA Componentes CORBA típicamente aceptados en los servidores de aplicaciones CORBA-Java Objetos no visuales (NVA, Non-Visual Objects) CORBA C++ / C ActiveX EJB (Enterprise Java Beans)

22 CORBA Java NVO C ORB IIOP ORB (Object Request Broquer)

23 OMG OMG Object Management Group
OMG provee especificaciones y estándares No provee software ni implementaciones Diferentes proveedores implementan las especificaciones Una ventaja de CORBA es que para escribir software que inter-opere con otro software vía un objeto, solamente se necesita conocer la interfase para ese software, no se necesita conocer detalles de la implementación La separación de la interfase y la implementación es lo que hace que CORBA sea independiente del lenguaje

24 CORBA CORBA permite la comunicación desde cualquier lenguaje hacia cualquier otro lenguaje sobre cualquier plataforma Plataformas Soportadas : Independiente de la plataforma Lenguajes/Componentes Soportados : Independiente de lenguaje

25 CORBA CORBA no se debe presentar como si tuviera siempre la mejor solución CORBA provee Mayor flexibilidad Mayor apertura Mayor integración Con diferentes plataformas Con diferentes lenguajes Con diferentes herramientas

26 Interfase vs Implementación
on off Implementación Interfase

27 Interfase vs Implementación
on off Interfase Interfase Remota = Stub (o Proxy)

28 CORBA Lenguaje de definición de la Interfase IDL (Interface Definition Language) module financiero { interface Prestamo { double calcular(in double cantidad, in long meses); }; }; on off

29 CORBA - IIOP Método de Invocación
Objeto Cliente Objeto Implementación 9. Invoca implementación 1. Invoca método Objeto Stub Skeleton 2. Marshals 8. Unmarshals 5. Dirige requerimientos 3. Envía requerimiento 7. Invoca método To marshal a request, the stub turns the request into a format that can be sent over the network. The skeleton unmarshals, or translates from the network format to the original request in the implementation language’s format. For static invocation, the client application needs to have prior knowledge of the object services that it will need, so the IDL specification must be incorporated into the client as well as the server object, using your chosen programming language. You take care of this by using an IDL compiler (supplied by your ORB vendor) to compile the IDL into client-side stub routines and server-side skeleton code. This diagram shows the process of calling a method on a remote object. Because the object is on a different machine, the request cannot simply be sent from one object to another. It must be packaged (marshaled) so it can be sent over the network. Both the sending and receiving machines must agree on a protocol (Internet Inter-ORB Protocol, or IIOP). The request then needs to be unpacked (unmarshaled) and, finally, the method’s implementation can be invoked. The stub object marshals the request and submits it to a client-side ORB. The ORB finds the target ORB on the network and sends the request. IIOP defines a standard for sending ORB requests over some low-level communications protocols. The target ORB receives the request and directs it to the appropriate object. The skeleton unmarshals the request and invokes the implementation object. The implementation object contains the logic that comprises your business rules. ORB ORB 4. Localiza ORB 6. Identifica objeto destino IIOP

30 IIOP IIOP (Internet Inter-ORB Protocol)
IIOP define estándares para el envío de requerimientos ORB sobre protocolos de comunicaciones de bajo nivel

31 CORBA - Stubs Objetos locales proxy Marshal los métodos de invocación
Delega la invocación de métodos al objeto remoto de implementación Provee transparencia de localización Implementa la misma interfase como la deseada del objeto remoto Implementa métodos IDL definidos en el lenguaje de programación del cliente The stub contains all the method signatures of a remote object without the implementation details. The stub also contains the logic to package all method invocations so it can be sent over the network.

32 ORB (Object Request Broker)
Maneja todas las comunicaciones entre objetos en un sistema de objetos distribuidos: 1. Acepta requerimientos de los clientes 2. Localiza y activa los objetos a. Identifica la máquina que ejecuta el objeto servidor b. Pregunta por el ORB de la máquina para una conexión al servidor 3. Enruta el requerimiento y recibe las respuestas Making a request to an ORB is like calling information for a phone number or going to a giant telephone book. The ORB’s job is to look up the location of the requested object and then send your request to that machine.

33 CORBA - Skeleton Implementa el mecanismo por medio del cual el requerimiento que va al servidor puede ser unmarshaled y dirigido al método correcto Pega el objeto de implementación al runtime ORB Unmarshals los argumentos del método Envía métodos a la instancia del objeto implementado También conocido como la clase base de implementación

34 Implementación Define el comportamiento de todas las operaciones y atributos que soporta la interfase Creada usando un lenguaje de programación o un modelo de componentes tales como Java, C, C++, or ActiveX

35 Servidor Programa que contiene la implementación de uno o más tipos de objetos Provee un ambiente para alojar componentes Instancia objetos CORBA Aplica seguridad Maneja: Transacciones Fallas Balanceo de carga server also applies security, handles transactions, handles failover, handles load balancing

36 Arquitectura ambiente Internet

37 Arquitectura ambiente Internet
ActiveX, JavaBeans JavaScript Web Publishing OLTP IIOP, DCOM HTTPS HTML Pages File System Web Data Processing Templates, Scripts SQL RDBMS Page Sever JDBC, ODBC, Native Java Relational Transaction Server Component Web Server Client Application Page Applet

38 Arquitectura distribuida
¿Cuántas instancias de un componente se pueden tener? ¿Cuántas conexiones a bases de datos se pueden tener? ¿Cómo se pueden manejar transacciones entre varios componentes? ¿Quién puede acceder al servidor?

39 Rol del Servidor de Aplicaciones
Manejo eficiente de Instanciación de componentes y ciclo de vida Conexiones a bases de datos Transacciones Seguridad: Server

40 Experiencia Requerida
Desarrolladores - Negocio Lifecycle Threads Transactions Security Desarrolladores - GUI Connections Convenciones componentes Desarrolladores - Sistema

41 Rol del CTS CTS (Component Transaction Server)
Provee un marco para desarrollo de lógica en la capa media, de aplicaciones basadas en componentes distribuidas Provee soporte para: Administración del ciclo de vida de componentes Caché de conexiones Administración de transacciones Seguridad Instructor Notes: Use the next few slides to provide a brief overview of each topic listed on this slide. Do not teach the entire topic. Resist giving the students too much information. As you cover each topic, indicate in which module it is covered or indicate that it is not covered in this course at all. You could add scalability to this list. EAServer supports server availability, load balancing, and failover. These scalability topics, along with security and thread management, are not discussed in this class. EAServer provides an execution environment for your distributed components. It hosts your components while providing services such as the ones listed on this slide as well as service components and shared objects. As you will see in later slides, EAServer also provides the Jaguar Manager, which is a simple administrative interface to EAServer servers that allows you to change runtime properties through a point-and-click interface.

42 Administración del ciclo de vida de componentes
Define como los componentes son: Instanciados Asignados a los clientes Destruidos Provee suporte para instanciar pooling Limiting the number of object instantiations and the amount of time an instance is bound to a client is critical in a WebOLTP environment with hundreds or thousands of simultaneous requests.

43 Caché de conección Pools de componentes de conexiones compartidas preasignadas a servidores remotos de bases de datos JCM Connection Cache Pooling connections and limiting the number of times a physical connection needs to be created and destroyed in an unpredictable load environment are critical for efficient performance. These steps let you control the number of connections to your database.

44 Administración de transacciones
Permite definir semántica transaccional de componentes como parte de la interfase de componentes You can determine how EAServer components handle transactions and what role they play in a transaction.You can change the transaction management without changing the code in your component by making changes to property sheets within Jaguar Manager.

45 Administración de seguridad
Incluida, basada en roles para autenticación y autorización de usuarios Autenticación de usuarios cuando la aplicación cliente crea un stub Lista de control de acceso para cada componente, la cual determina qué usuarios pueden invocar un componente Soportan certificados digitales Soportan SSL (Secure Socket Layer) Potentially, anybody on the Internet could connect to and use your application. Security is more critical in this environment than ever before. EAServer lets you implement a security system or leverage an established security system. Security can be applied at the package, the component or even the method level.

46 Soporte para clientes y componentes
HTML COM PowerBuilder CORBA Java IIOP/TDS MASP SQL EAServer C++ Instructor Note: The goal of this slide is to show EAServer’s openness. EAServer supports the following clients: PowerBuilder Java: JDK 1.22, 1.3 using an EAServer CORBA-compliant ORB or any other CORBA-compliant Java ORB; Enterprise Java Bean (EJB) also supported ActiveX components using the EAServer ActiveX proxy C++ using a EAServer CORBA-compliant ORB or any other CORBA-compliant C++ ORB Methods as stored procedures (MASP); any database-aware language/tool that can execute ASE stored procedures HTML ultrathin client using a Web server extension (such as PowerDynamo) CORBA (a CORBA client is an application written in any language with CORBA mappings EAServer supports the following components: PowerBuilder custom class user objects (CCUOs) Java: Java Development Kit (JDK) 1.1 or higher; EJB specification support (1.0, 1.1, 2.0) ActiveXs (Windows NT only): Partial MTS interface support allows you to easily move components hosted in the Microsoft Transaction Server (MTS) to EAServer C, CORBA C++

47 Soporte J2EE EJB Aplicaciones J2EE Aplicaciones Web J2EE
Caché de Objetos JavaMail Java API para XML Servicios Java de Autenticación y Autorización Instructor Notes: You may want to direct students to the online documentation for EAServer. Have them type in J2EE support is described in more detail in Chapter 1 of the online documentation. Client and Component support is also described in this chapter. EAServer is Sun certified J2EE compliant

48 Ambiente del EAServer C++ Jaguar Server Librería de clases
9000 Repositorio Jaguar Manager Requerimiento IIOP Package Components 7878 Requerimiento TDS 8080 Requerimiento HTTP Librería de clases C++ Instructor Notes: Considering demonstrating the product at this time. Start EAServer (use the JDK 1.2 at this time, since at the time this was written, PowerBuilder needs a patch to work with 1.3) and Jaguar Manager. Navigate the Jaguar Manager. Start the File Viewer display. In Explorer, show the directory structure, the repository, and the jaguar.log files (*this was formerly called srv.log and has been renamed to jaguar.log) Along with other things you may wish to demonstrate, consider showing them the listeners (to show the ports mentioned on this slide) Also, if you have not already done this, consider showing them how to access the online documentation through the HTTP port: The EAServer environment consists of: Server Jaguar Manager (a plug-in for the Java Sybase Central utility) Components Packages (containers for related components) Repository (a collection of readable files containing property information for components) A set of class libraries to support various languages/tools ORB and IDL compilers The Jaguar server accepts IIOP requests because IIOP is a CORBA standard. It accepts TDS requests for backward compatibility with versions 1.x. Finally, the server accepts HTTP requests and can also be used as a page server.

49 Servidor EAServer Provee un ambiente de ejecución por componentes
Maneja requerimientos de clientes Instancia componentes Maneja seguridad, transacciones, caché de conexiones, balance de carga y fallas Definido usando Jaguar Manager In general, the execution-time environment that hosts components is called an EAServer server. You can create many specific servers for different applications. Specifically, EAServer has a default server, named Jaguar. EAServer supports IIOP because it is a CORBA standard. TDS is supported for MASP clients and backward compatibility with 1.x versions of EAServer. HTTP is also supported. EAServer can act as a simple Web server.

50 Arranque del EAServer Instructor Notes:
In the %JAGUAR%\bin folder serverstart.bat will call user_setenv.bat (if it exists). This file should contain any special classpath settings to be used.

51 Conexión al EAServer - Jaguar Manager
Jaguar Manager is a special Java Sybase Central, that manages the components, security. It is an administration tool. For PowerBuilder developers, some of the functionality of Jaguar Manager is now located in the PowerBuilder IDE via the System Tree and property sheets from projects.

52 Jaguar Manager Component lifecycle Instructor Notes:
In EAServer Version 4, all connection caches are automatically installed. This is a difference from Version and earlier where there was a distinction between installed connection caches in a particular server and the connection caches folder. With Jaguar Manager, you can: Configure and manage servers, packages, and components Generate an IDL file in a point-and-click environment Generate stubs and skeletons Define execution-time properties, such as: Component lifecycle Transaction characteristics Threading model Security Perform execution-time monitoring Set up clusters Create and manage connection caches

53 Server Log Instructor Notes: Demonstrate opening the server log. Show them where this is located in Windows explorer. You may want to have your students set up a shortcut on their desktop to bring up the logfile in notepad or wordpad. Note, in EAServer 4, the server log is named jaguar.log (not srv.log)

54 Componentes en el EAServer
La definición de un componente consiste de: Métodos firmados Modelo de componentes Suporte de transacciones Nombres de clases Java o librerías ejecutables que implementan componentes (DLL, …) Instructor Notes: Until this point, the terms “component” and “object” have been interchangeable. For this course, you can keep the definitions loose. The term “object” refers to something you create in PowerBuilder, such as a nonvisual object. The term “component” is used to refer to the implementation deployed to EAServer. For instance, you can create a nonvisual object in the User Object painter. Once you deploy that object to EAServer, refer to it as an EAServer component.

55 Package en el EAServer Grupo de componentes relacionadas
Colección de componentes que trabajan juntas para proveer algún aspecto de la lógica de las aplicaciones Define un “límite de verdad” dentro del cual los componentes se pueden comunicar fácilmente Unidad de distribución, agrupando recursos de aplicaciones para facilitar su distribución y administración

56 Repositorio en el EAServer
El repositorio del EAServer contiene: Información de configuración del servidor de aplicaciones Metadatos para paquetes de aplicaciones, componentes y métodos EAServer utiliza el repositorio para encontrar e invocar componentes Instructor Notes: Go into Explorer and show the students the directory structure for EAServer and the repository. The repository is a set of flat files that you can review with a text editor. Servers in the same instance of EAServer share the same repository files.

57 Librerías de clases / Máquinas virtuales
Jaguar provee un conjunto de Librerías de clases / Máquinas virtuales Librerías de clases / Máquinas virtuales para cada lenguaje / modelo soportado Las Librerías de clases / Máquinas virtuales son: Implementaciones de lenguaje / modelos-específicos de servicios del servidor de aplicaciones Usadas para implementar servicios de componentes C++ C PowerBuilder Do not spend a lot of time of this slide. The main point is that EAServer hosts the PowerBuilder virtual machine (versions prior to 7.0 are not supported). This means that almost all the features in PowerBuilder and PowerScript are available. EAServer 4 supports multiple versions of the PowerBuilder VM.

58 Ciclo de vida de los componentes
Ocioso Asignado al Cliente Método Ejecutado no si Desactivación Instanciación Destrucción Reutilización Activación Automática Grupo Soporte Primitiva

59 Componentes – Estrategias de diseño
Stateful. Persistente. La instancia permanece asignada al cliente entre llamadas a métodos. La instancia puede guardar información del estado. El desarrollador es responsable de iniciar el evento Deactivate. La instancia no puede ser utilizada por otros clientes mientras no sea liberada del cliente asignado. Stateless. No persistente. El evento Deactivate se ejecuta automáticamente después de cada llamada a métodos. Para cada llamada a método no se puede asumir qué instancia será asignada al cliente. El desarrollador es responsable de inicializar la instancia.

60 Stateful vs Stateless Stateful Stateless
La instancia se asigna al cliente por periodos largos. El servidor maneja más instancias. Las instancias son reutilizadas con menos frecuencia. El servidor requiere más recursos limitando la escalabilidad. Stateless La instancia es asignada al cliente por periodos cortos. El servidor maneja menos instancias. Las instancias son reutilizadas con mayor frecuencia. El servidor requiere menos recursos.

61 Administración de conexiones
IIOP Connection Cache Connection Manager Connection Cache Instructor Notes: Pooling connections in an unpredictable load environment such as the Internet is critical. A server that pools connections can present a predictable load environment to a DBMS in an unpredictable load environment. With hundreds or thousands of hits, how else would you manage the database access? Focus on the function and purpose of the connection cache in this context. EAServer lets you establish pools of connections to various databases. When a component needs a connection, it asks the Connection Manager for it. The Connection Manager provides a connection from the pool if one exists, or it establishes a new physical connection if no connections in the pool are available. When a component releases a connection, the Connection Manager returns the connection to the pool but does not disconnect from the database. Administrador de conexiones

62 Connection Cache Pool de conexiones disponibles a una base de datos específica Todas las conexiones en un caché comparten: User ID y password Base de datos Librería de conectividad All connections in a cache share the same user ID, password, database, and connectivity library. However, many WebOLTP applications can assign users to groups and create connection caches around these groups. In these cases, you can greatly benefit from a connection cache.

63 Ventajas de Connection Cache
Da rendimiento Elimina la sobrecarga asociada con el requerimiento y fijación de una conexión Proporciona escalabilidad Permite al servidor de aplicaciones atender cientos de clientes usando sólo unas pocas conexiones a la base de datos Control sobre el número de conexiones a la base de datos Establece un número máximo de conexiones en un ambiente de carga impredecible Instructor Notes: Before you display the slide, ask students for the benefits of a connection cache. Engage them in a class discussion. After the discussion, you can display the benefits on this slide to make sure you didn’t miss any.

64 Conexión a una base de datos
//Instance Variables Protected: Transaction itr_trans Componente //Deactivate event //Release the connection Disconnect using itr_trans; // Activate Event If NOT IsValid(itr_trans) then itr_trans = CREATE transaction END IF Itr_trans.dbms = “ODBC” Itr_trans.DBParm =& “UseContextObject=‘Yes’,CacheName=‘EASDemoDB’” CONNECT USING itr_trans; If itr_trans.sqlcode <> 0 THEN … process error

65 Transacción Secuencia de sentencias SQL que se comportan como una unidad lógica de trabajo Cada sentencia SQL ejecuta una parte del trabajo total Todas las sentencias SQL deben terminar de manera exitosa para que la tarea termine Si cualquier sentencia falla, todas las sentencias anteriores se deshacen Instructor Notes: Make sure students can tell you what a transaction is. Have one or two volunteer to give a description to the class. Example: Assume you wanted to transfer money from your savings account to your checking account. There are two steps in this process: 1) Debit from your savings account. 2) Deposit to your checking account. Because both steps need to succeed, they need to be executed in a transaction. If the debit were successful, but the deposit failed, you would want to roll back or undo the successful debit. Only if all steps succeeded would you want to commit the transaction.

66 Objetivo Cliente Jaguar n_order n_cart n_order_items add( )
placeOrder( )

67 Jerarquía de componentes
¿Qué hay de común en los componentes? Instance variables Instance variables Instance variables n_cart n_order n_order_items Ask the students what comes to mind when they see this slide. The answer should be “ancestor.” Move the common functionality in each component to an ancestor component. The Task Guide provides suggestions on the types of functionality that can be moved to the ancestor. It also describes the procedure to add an ancestor object if one is not already defined. Constructor Activate Deactivate CanBePooled Destructor Constructor Activate Deactivate CanBePooled Destructor Constructor Activate Deactivate CanBePooled Destructor

68 Definiendo el componente ancestro
n_order n_order_items n_cart n_ancestor Extend and Override Descendent Events As Needed Instance variables Constructor Activate Deactivate CanBePooled Destructor Additional discussion: Once the students understand the concept of abstracting functionality to the ancestor, you can take the design to the next level, as suggested in the Task Guide and Lab Workbook. Ask them if they always want to get a connection to the database in the Activate event. Look at the n_cart component. This component never accesses the database. Would you want to get a connection in the ancestor Activate event? Lead the students to the possible solution of creating a function on the ancestor that connects. If a component needs a connection, the descendant can call the ancestor function in the Activate event (or wherever the connection is needed). You could also reset the data store in the Deactivate event to release any data it might be holding. Why return an instance full of data back to the pool? Release the resources as soon as possible.

69 Caso Cliente Jaguar Product getData( )
Ask the students how frequently the product information changes. (Products do not change frequently.) Ask them what is the overhead for each retrieve? (For example, what happens when each client requests the product catalog?) From this diagram, they should be able to tell you each client would need to get a connection, access the database, and hold the same data. This design is not very efficient. Ask the students how they can solve the problem. They should say something about caching the static data and getting the products from the cache, thus eliminating database access. You can then lead into shared components.

70 Objetivo: Caché de datos
Jaguar Client Product getData( ) ServiceProduct What happens if product information needs to be periodically refreshed throughout the day? Ask the students if it would be useful to have a component that would periodically perform an action such as refreshing cached data or calling another component to perform a periodic task. You can now introduce service components as another topic for this module.

71 Ambiente / Arquitectura Web
EAServer Servidor Aplicaciones (PD / ASP) Browser HTTP Datos Corporativos Sitio Web HTML API Servidor Web PB Web Targets Database – Stores Web resources and data. These could be combined in the same physical database. Often they are separated in their own dedicated database. Application server – Extends Web server functionality. PowerDynamo (included in EAServer) is an application server that lets you create dynamic Web pages. Microsoft ASP is another example of a way of creating dynamic Web pages. API – Supports communications between the Web server and application server. EAServer – Hosts components that can process business logic and manage transactions. PowerBuilder Web Targets – Integrated development environment for Web site development. Features include rapid HTML document generation, rapid client-side and server-side script generation, JavaScript debugging, Wizards for creation and deployment, design time controls and property sheets “programming by property”. You can deploy the Web pages you build in PowerBuilder to FTP sites, PowerDynamo databases and Active Server Pages sites.

72 Sitios Web Estáticos HTTP HTML Web Browser Web Server
Instructor Notes. Pass over this solution quickly because it is not strategic to Sybase and most companies need to quickly move beyond this stage. The first challenge for many companies is to “get on the Web.” Companies want an Internet presence even if that presence is limited to a collection of static Web pages. PowerBuilder 8 and later allows the creation of Web Targets. Within the Web Targets, users can create web pages through a WYSIWYG editor. PowerBuilder Web Targets can also import web pages created through other Web Tools such as Microsoft Frontpage and Macromedia DreamWeaver.

73 Sitios Web Dinámicos Servidor HTML HTTP Web Browser Servidor Web
Bases de Datos Instructor Notes: PowerBuilder 8 and later now includes Web Target functionality. Through a core set of tools (wizards, design time controls, property sheets, a web editor that has good coding supports), dynamic websites can easily be created. For publishing dynamic Web pages, PowerDynamo is a fast page server that can access the database and format dynamic content. PowerBuilder gives you a WYSIWYG HTML editor with support for: Coding System Tree drag & drop functionality 4GL Web Pages to ease EAServer component integration Design Time Controls for the Web DataWindow Property Sheets to enable “coding by property” This is a pure Web solution. However, business logic written in PowerDynamo scripts or JavaScript is not easily reused. Transaction management, multithreading, and connection support must be coded. This is a perfect fit for using EAServer components instead. Generally, this is a good solution for applications that are nontransactional, stateless, or nonconversational such as: Database publishing - Review customer profile (for example, frequent flyer mileage), Display product lists and Data collection (for example, Online registration for events, seminars, and so on)

74 Enterprise Application Server
WebOLTP HTML COM PowerBuilder CORBA Java PowerDynamo HTTP IIOP Jaguar CTS Web Server Enterprise Application Server Instructor Notes: Be sure to point out that the features of PowerDynamo and EAServer are complementary; the products work together and do not compete. You use PowerDynamo for server pages and dynamic content, while EAServer manages your business components and transactions. Take the time to touch on some of the characteristics listed in these notes. PowerBuilder 8 Web Targets facilitates creating WebOLTP applications through the System Tree, 4GL Web Pages and Property Sheets. WebOLTP supports high-volume, transactional applications. Many customers are moving existing two-tier applications to the Web. Those applications fit in this category. How does the communication work? For non-HTML clients, the client communicates with Jaguar through IIOP. For HTML clients, the client communicates with the Web server through HTTP. The Web server uses CGI, ISAPI, or NSAPI to communicate with PowerDynamo. PowerDynamo communicates with EAServer through a Java stub, MASP, or ActiveX. EAServer can accept HTTP requests directly. Applets running in a Web page can connect to EAServer directly through IIOP. Characteristics of WebOLTP applications include a) high volume with many connections, b) transactional, c) ability to manipulate result sets, d) a need for secure data encryption, e) ability to maintain state information, f) component-based design, g) support for heterogeneous clients, and h) unpredictable load environment. Examples: Electronic commerce, electronic banking, and high-volume tracking systems.

75 Arquitectura Base de datos 1 6 3 4 2 5
Instructor Notes This is a Build Slide. Spend time on each piece. 1) The web page could be plain HTML – if so, just sent back and displayed. In a more complex case, the web page could contain Javascript, java applets or be a JSP that demands more information such as the result of an EAServer component’s method or a Web DataWindow. 2) In that case, EAServer must get involved to return the component or the database information requested. 3) This step is needed if the component accesses a database or if a Web DataWindow is being rendered. The database is queried and 4) data returned. 5) This information is then returned to the Page Server which formats the data for display. 6) The final data (HTML) is then returned to the user’s browser for display. 1) The client initiates a request for a web page 2) If the web page contains a request for an EAServer component or a Web DataWindow, the information is sent to the Component Server. This is EAServer. 3) EAServer, in turn may need to access the database (if a component has SQL access or the information is needed to populate a Web DataWindow. 4) The Database returns the needed information to the Component Server 5) The Component Server (EAServer) then passes the information to the Page Server which formats the information 6) The formatted information is passed to the user 2 5 Servidor Web / Servidor de páginas Servidor de componentes

76 Llamado de componentes EAServer
<HTML><TITLE>Result.stm</TITLE><BODY><H1>Loan Calculator</H1> <!--script /* Initialize the Java stub */ var loan = java.CreateComponent("finance/n_loan", "iiop://localhost:9000", "jagadmin", ""); /* Invoke the Jaguar component method */ var payment = loan.of_calculate(document.value.amount, document.value.months); /* Process the results of the method call */ document.WriteLn("Your monthly payment is: "+payment); --> </BODY></HTML> Instructor Notes: Focus on the CreateComponent( ) function on this slide. Relate the arguments to this function to what the students have already seen. You may want to point students to the Language tabpage on the System Tree. Drill down to the Server object model and locate the java object in PowerDynamo. Open the methods and locate CreateComponent. Show students that drag & drop programming from this page on the system tree is also possible. Have the students locate the WriteLn method of the document object. With the introduction in PowerBuilder 8 of Web Targets, this manual coding of the CreateComponent is easily done by using either a Wizard or by accessing properties of a 4GL Web Page. Much of the manual coding is now largely unnecessary. The DynaScript to initialize a Java proxy is a simple variable declaration and function call. The CreateComponent( ) function initializes the stub and identifies the EAServer server. If the call is successful, you can then invoke methods on the component. The document.value is DynaScript that lets you get the value from a field on your Web page. For instance, document.value.amount gets the value in the field called “amount”. The document.WriteLn( ) function lets you output dynamic information from your components to your Web page.

77 Enterprise JavaBeans Especificación del lado servidor del modelo de componentes Java Escritas por Sun Microsystems con apoyo de muchas compañías (Sybase, IBM, Oracle, BEA, …) Vendedores implementan la especificación Sybase EAServer EJB by Sun Microsystems Bluestone Software Sapphire/Web Instructor Notes: Point out that EJBs is not a Sybase created technology but a standard for implementing server-side components. It is Java based. Sun Microsystems along with input & feedback from various vendors have defined this standard. Sybase being one of the players. EJBs are portable across application servers supporting EJBs so it is an open standard. It differs from JavaBeans in that it supports distributed computing. JavaBeans is a component model for developing visual and non-visual Java components. It does not provide support for distributed computing. Sun Microsystems’ definition of Enterprise JavaBeans is: The Enterprise JavaBeans architecture is a component architecture for the development and deployment of component-based distributed business applications. Applications written using the Enterprise JavaBeans architecture are scalable, transactional, and multi-user secure. These applications may be written once, and then deployed on any server platform that supports the Enterprise JavaBeans specification. BEA Systems WebLogic Especificación Vendedores Servidores EJB-Compliant

78 EJB y EAServer EJB CORBA
EAServer implementa la arquitectura EJB sobre CORBA EJB provee un estándar para el modelo de componentes Java del lado servidor CORBA provee interoperabilidad con componentes que no son componentes EJB EAServer CORBA EJB Instructor Notes: Point out that Jaguar began supporting EJB 1.0 objects in version 3.5 Support for EJB version 1.1 came about in Jaguar 3.6 In Jaguar version we now have support for PowerBuilder client applications and PowerBuilder components deployed to Jaguar to act as an EJB Client. EAServer (Jaguar) implements the EJB standard over CORBA. Jaguar 3.6 supports Enterprise JavaBeans Version 1.0 and 1.1.

79 Arquitectura EJB EJB Server EJB Client
EJB Container EJB Object Enterprise JavaBean Deployment Descriptor EJB Client EJB Remote Stub EJB Home Interface *Shaded Blue is developer-created Instructor Notes: Use this slide to describe the overall Enterprise JavaBean architecture. The next few slides briefly describe the different pieces that make up a single Enterprise JavaBean component. The goal for students to understand that they need to interface with 2 different interfaces, the home interface and the remote / object interface, from within PowerBuilder to get at a EJB’s capabilities. Unlike distributed PowerBuilder component’s we communicate through the server-side EJB Home and EJB Object for the Enterprise JavaBean, not the Enterprise JavaBean itself. (2nd bullet) Remember an interface defines the public interface for a class. A class that is implementing an interface must define all methods and properties of the interface in order for it to be valid. It is these two classes that we need to generate proxies for in order to have access to them from within a PowerBuilder application or PowerBuilder component. The Enterprise JavaBean is a Java class containing the actual business implementation methods and properties enabling the class to carry out it’s responsibilities. Client components and client applications make request by invoking these business methods. Clients never get a direct reference to the Enterprise JavaBean. They access it through one of it’s two interface classes: EJBHome Class and the EBJ Object Class. These two classes reside on the server along with the Enterprise JavaBean. The EJBHome class and the EJB Object class implement the Java Home Interface and the Remote Interface of the Enterprise JavaBean respectively. These two proxies are known as the EJB Home Stub and EJB Remote Stub. For Java clients they serialized Java classes. The EJB Home Stub and EJB Remote Stub also implement the Java Home Interface and the Remote Interface respectively. At runtime they each work with their respective server-side objects to provide location transparency to the Enterprise JavaBean. The Deployment Descriptor is contains the declarative component properties for the bean along with information about the bean so that the server can implement them at runtime correctly. This is implemented using a Java Class in EJB 1.0 components. An XML file is used in EJB 1.1 components.

80 Servidor EJB Proceso de alto nivel que contiene el EJB container
Puede tener múltiples containers Provee disponibilidad JNDI servicio de nombres y servicio de transacciones Ejemplos de servidores EJB: Servidores de bases de datos Servidores de aplicaciones Servidores de capa media EAServer es un servidor EJB Instructor Notes: An application server can contain one or more containers. Not all containers are EJB containers. For example, Jaguar also supports a Web Container to host servlets, JSPs (Java Server Pages), HTML and XML resources. If students do not know what JNDI is explain it as a standard API for locating various types of resources in a distributed/networked environment that links together various types of directory services such as Novell Netware’s directory services. A container is a standardized runtime environment that provides services for components. There are different containers that can be supported in Application Servers, for example; EJB and Web. JNDI stands for Java Naming and Directory Interface. It is a standard API allowing different types of directory services to be linked together providing the capability to lookup and locate various types of resources in a distributed/networked environment. One such resource is a EJB component.

81 EJB Container Intercepta todas las llamadas a los Bean para dar el servicio requerido por el componente EJB basado en propiedades declarativas (in deployment descriptor) Puede tener uno o muchos Enterprise JavaBeans EAServer es el EJB Container más el EJB Server Servidor Container EJB

82 EJB Cliente Provee la interfase lógica de usuario en la máquina cliente Hace llamadas a componentes remotos EJB en un servidor No se comunica directamente con los componentes EJB Interactúa con objetos del lado servidor: EJB Home EJB Object Instructor Notes: Inform students that these are the pieces that they will need to generate proxies for. For each EJB they will have two proxies, a Home Interface Proxy and Remote Object Interface Proxy. They communicate with corresponding these server-side objects. You never get to talk to the bean directly. By separating concerns this allows the actual EJB to be location transparent. The proxies are the stubs in PowerBuilder.

83 EJB Home Stub Usado por el cliente para crear, encontrar y quitar instancias EJB Retorna referencia del objeto EJB al cliente, como un stub remoto El cliente usa el objeto EJB para acceder a los métodos del Bean EJB Container Remote Stub EJB Object The primary purpose of the EJB Home Stub and EJB Home is to provide lifecycle methods for the Enterprise JavaBean. They work together to create new EJB instances and find existing EJB instances. We use the Home Stub to gain access to the Remote Stub so that we can invoke the Enterprise JavaBean’s business methods. Home Stub EJB Home EJB

84 EJB Remote Stub Provee la interfase al Enterprise JavaBean
Contiene los métodos sin la implementación Llamadas dirigidas al objeto EJB se dirigen al Bean vía el container El cliente interactúa con EJB Remote Object stub como si el Bean fuera local Provides the interface from the EJB Client to the EJB Contains the business methods without the implementations Forwards business requests to the EJB object which is then directed to the actual Enterprise JavaBean via the container. Using the Remote Stub and EJB Object, the EJB Client thinks it has “continuous” connection to the Enterprise JavaBean when in effect is does not. This allows the Enterprise JavaBean to unbind from the EJB Object when it is no longer executing one of it’s business methods so that it can service many clients. The EJB Remote stub interacts with the EJB Object on the EJB Server as if the Bean were local to the workstation.

85 Tipos EJB Sesión Bean: Entidad Bean Administra el flujo de trabajo
Transiente Procesos del negocio (proceso de pagos, reservas, …) Dura una simple sesión Transaccional, pero no recuperable si falla Stateful o stateless Debe manejar persistencia No tiene llave primaria Entidad Bean Representa objeto de datos (filas en una taba de base de datos) Persistente Sustantivo (cliente, producto, empaque, orden, ...) Alrededor de señal Transicional, recuperable en fallas Inherentemente stateful Administrado Bean o container Tiene llave primaria Instructor Notes: Introduce the two types of beans here. After covering the bullets of each ask students for examples of each to test their understanding. I like to use an orchestra as an example business domain. The conductor is an example of the session bean. He/she is responsible for managing the flow of a piece of music in which several different instruments are being used to produce the music for the piece. Each instrument is an example of an Entity bean. Together the instruments are being managed by the conductor.

86 Proceso de Aceso EJB Cliente JNDI Jaguar CTS additem( ) lookup( )
1 Jaguar CTS create( ) 3 Home Stub 4 CartHome 2 CartBean Instructor Notes: Use the text on the following slide as your script, but leave this diagram displayed. Note: The LoanBean instance executes all the methods. When the window is opened, the connection object asks the JNDI for the home object. 2. Jaguar associates a Home object with the client. The Home Interface stub is returned. 3. The client calls create( ) on the Home stub. 4. A Enterprise JavaBean is associated with the Home object. An EJBObject is associated with the Enterprise JavaBean. 5. A stub for the EJBObject is returned. 6. The client invokes business methods on the Remote Interface stub. 7. The request is directed to the Enterprise JavaBean, processed, and the results are returned to the client. additem( ) 6 Remote Stub Cart 5 7

87 Servidores de capa media
Apache Tomcat BEA WebLogic IBM WebSphere Sun ONE Oracle 9i AS Sybase EAS Jrun Macromedia


Descargar ppt "Bases de datos en ambiente Internet"

Presentaciones similares


Anuncios Google