• Save
Ajs 1 b
Upcoming SlideShare
Loading in...5
×
 

Ajs 1 b

on

  • 1,594 views

 

Statistics

Views

Total Views
1,594
Views on SlideShare
1,563
Embed Views
31

Actions

Likes
0
Downloads
0
Comments
0

1 Embed 31

http://niitcourseslides.blogspot.in 31

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

Ajs 1 b Ajs 1 b Presentation Transcript

  • Legacy Connectivity and ProtocolsPre-assessment Questions 1. Which statement depicts the role of an architect in the post-construction phase? a) Focuses on the requirements of the developer b) Reviews the construction-level designs to analyze the problems and requests changes c) Enables a client to migrate the project rollout to the new system EJB home object d) Expands the details of the design and refines the design to converge on the final design ©NIIT Architecting J2EE Solutions Lesson 1B / Slide 1 of 43
  • Legacy Connectivity and ProtocolsPre-assessment Questions 1. Consider the statements: Statement A: Layering is an architectural pattern that breaks up a complicated system into some modules. Statement B: Layers are divided based on the functional responsibilities of the modules. Identify the correct option. b) Statement A is true and statement B is false c) Statement A is false and statement B is true d) Both, statements A and B, are true e) Both, statements A and B, are false ©NIIT Architecting J2EE Solutions Lesson 1B / Slide 2 of 43
  • Legacy Connectivity and ProtocolsPre-assessment Questions 1. Consider the statements: Statement A: Vertical scalability is achieved by adding new servers to the existing system. Statement B: Horizontal scalability is achieved by adding memory to the existing server or by adding more CPUs to the server. Identify the correct option. a) Statement A is true and statement B is false b) Statement A is false and statement B is true c) Both, statements A and B, are true d) Both, statements A and B, are false ©NIIT Architecting J2EE Solutions Lesson 1B / Slide 3 of 43
  • Legacy Connectivity and ProtocolsPre-assessment Questions 1. Which J2EE client component makes application deployment a simple process? a) Application Client b) HTML Page c) Applet d) Java WebStart 2. Which option is identified as a business component? a) EJB b) JSP c) Servlet d) Applet ©NIIT Architecting J2EE Solutions Lesson 1B / Slide 4 of 43
  • Legacy Connectivity and ProtocolsSolutions to Pre-assessment Questions 1. c. Enables a client to migrate the project rollout to the new system 2. c. Both, statements A and B, are true 3. d. Both, statements A and B, are false 4. d. Java WebStart 5. a. EJB ©NIIT Architecting J2EE Solutions Lesson 1B / Slide 5 of 43
  • Legacy Connectivity and ProtocolsObjectives In this lesson you will learn to: • Identify the types of legacy integration • Examine the various approaches to legacy integration • Implement legacy connectivity using JNI and JCA • Identify the features of Different Protocols ©NIIT Architecting J2EE Solutions Lesson 1B / Slide 6 of 43
  • Legacy Connectivity and ProtocolsLegacy Integration • Legacy integration is referred to as the integration of J2EE components with a legacy system. • Legacy integration allows interconnectivity between different platforms and programming languages. • Synchronous Integration: • Involves circular communication between a J2EE application and the Enterprise Information System (EIS). • Provides synchronous communication between a J2EE application and the EIS, which consists of the request/response interaction model. ©NIIT Architecting J2EE Solutions Lesson 1B / Slide 7 of 43
  • Legacy Connectivity and ProtocolsLegacy Integration (Contd.) • Asynchronous Integration • Involves message-based communication between a J2EE application and EIS. • A message in asynchronous communication carries information used within a single business process of an enterprise or across the business processes of multiple enterprises. • The two types of asynchronous communication are: • Queue-based communication: Involves a message queue that does not depend on application, which is sending and receiving messages. Queue-based communication is also known as point-to-point messaging. • Publish-subscribe Messaging : Involves a message board, where an application publishes messages on a specific topic. Subscriber applications can subscribe to a specific topic and receive all the published messages on that topic. ©NIIT Architecting J2EE Solutions Lesson 1B / Slide 8 of 43
  • Legacy Connectivity and ProtocolsApproaches to Legacy Integration • Different approaches to perform legacy integration are: • Data level integration • Integrates a J2EE application with the backend data stores that are used in an integrated application. • Includes access to newly developed data stores produced by a legacy system, for the specific purpose of data access. • Can be push-based or pull-based. • Application Interface Integration • Uses the integration frameworks and application programming interfaces (APIs) of integrated applications to integrate two applications. • Is preferable to other approaches, such as data level integration, because it is transparent to the integrated application and preserves data integrity of the application. ©NIIT Architecting J2EE Solutions Lesson 1B / Slide 9 of 43
  • Legacy Connectivity and ProtocolsApproaches to Legacy Integration(Contd.) • Different approaches to perform legacy integration are (Contd.): • Method Level Integration • Shares business logic as a collection of methods or operations that the integrated application can invoke. • Is useful when each integrated application provides a similar set of API or functional methods. • User Interface Level Integration • Accesses the existing applications through the user interfaces of the applications. • Is suitable when you do not have direct access to a database or when the business logic is embedded in the user interface. ©NIIT Architecting J2EE Solutions Lesson 1B / Slide 10 of 43
  • Legacy Connectivity and ProtocolsLegacy Connectivity • Legacy connectivity means connecting a J2EE component with an already existing application or a library that may have been written in languages other than Java. • Some techniques or architectures that provide connectivity to the legacy applications are: • Java native interface • J2EE connector architecture • Web services ©NIIT Architecting J2EE Solutions Lesson 1B / Slide 11 of 43
  • Legacy Connectivity and ProtocolsLegacy Connectivity (Contd.) • Using Java Native Interface • Used to write the custom code that enables you to integrate new business logic with a legacy system. • Programmers use JNI to write Java native methods to handle the situations when an application cannot be written entirely in Java. • Enables Java to call native methods and also allows the native methods to create and manipulate the Java objects. • A native method can also update the Java objects that are passed to it or that are created by it. ©NIIT Architecting J2EE Solutions Lesson 1B / Slide 12 of 43
  • Legacy Connectivity and ProtocolsLegacy Connectivity (Contd.) • Using Java Native Interface (Contd.) • Legacy program using JNI ©NIIT Architecting J2EE Solutions Lesson 1B / Slide 13 of 43
  • Legacy Connectivity and ProtocolsLegacy Connectivity (Contd.) • Using Java Native Interface (Contd.) • The steps involved in writing native methods for java programs are: • Write the Java code: Write a Java code to create a class that declares the native method and includes a main method to call the native method. • Compile the Java code: Compile the created Java code using javac command. • Create the .h file: You use the javah command with the native interface flag -jni to generate a header file for the native method. • Write the native method implementation: Write the C or C++ code to implement the native method. The name of the native function consists of the prefix Java_, the package name, the class name, and the name of the native method. The underscore (_) is used as the separator between each component name. ©NIIT Architecting J2EE Solutions Lesson 1B / Slide 14 of 43
  • Legacy Connectivity and ProtocolsLegacy Connectivity (Contd.) • Using Java Native Interface (Contd.) • The steps involved in writing native methods for java programs are (Contd.): The syntax of the native method declaration is: JNIEXPORT void JNICALL Java_PackageName_ClassName_NativeMethodName(JNIEnv *, jobject) 3. Create a shared library: Create a shared library file or a dynamic link library (DLL) file by compiling the header file and the implementation (C or C++) file. The command to create the DLL file is: CL -FeTemp.dll –LD msg.c You need to specify the name of the DLL file and the native language file. 4. Run the program: You can now execute the java program to perform the desired task. ©NIIT Architecting J2EE Solutions Lesson 1B / Slide 15 of 43
  • Legacy Connectivity and ProtocolsLegacy Connectivity (Contd.) • Using Java Native Interface (Contd.) • The advantage of JNI is: • It is faster than the other legacy integration approaches. • The disadvantages of JNI are: • It cannot connect to all legacy system. • The existing system needs to run in process. • It is platform-specific. • If you want to run the code on multiple platforms, it is difficult to test and maintain the code. ©NIIT Architecting J2EE Solutions Lesson 1B / Slide 16 of 43
  • Legacy Connectivity and ProtocolsLegacy Connectivity (Contd.) • Using J2EE Connector Architecture • J2EE Connector Architecture: • Defines a standard architecture for connecting a J2EE application server to EIS. • Provides a Java solution to the connectivity problem between the existing EISs and the various application servers. • Enables Java to call native methods and also allows the native methods to create and manipulate the Java objects. • Enables a vendor to provide a standard resource adapter for its EIS. ©NIIT Architecting J2EE Solutions Lesson 1B / Slide 17 of 43
  • Legacy Connectivity and ProtocolsLegacy Connectivity (Contd.) • Using J2EE Connector Architecture (Contd.) • The following figure shows the JCA architecture: ©NIIT Architecting J2EE Solutions Lesson 1B / Slide 18 of 43
  • Legacy Connectivity and ProtocolsLegacy Connectivity (Contd.) • Using J2EE Connector Architecture (Contd.) • Types of contracts in JCA are: • System level contracts: Exist between a J2EE application server and a resource adapter. • Application level contracts: Exist between an application server and a J2EE application. ©NIIT Architecting J2EE Solutions Lesson 1B / Slide 19 of 43
  • Legacy Connectivity and ProtocolsLegacy Connectivity (Contd.) • Using J2EE Connector Architecture (Contd.) • Three types of system contracts are: • Connection Management: Describes the agreement a J2EE container with the resource adapter regarding establishing, pooling, and closing down connections. • Transaction Management: Controls transactions in two different ways by creating distributed transactions and local transactions. • Security: Enables the application server to connect to an EIS system via resource adapter using security properties. ©NIIT Architecting J2EE Solutions Lesson 1B / Slide 20 of 43
  • Legacy Connectivity and ProtocolsLegacy Connectivity (Contd.) • Using J2EE Connector Architecture (Contd.) • The JCA also defines a CCI for EIS access. • CCI: • Defines a client API that is a standard for application components. • Enables the application components and Enterprise Application Integration (EAI) frameworks to perform interactions across heterogeneous EISs using a common client API. • EAI is the process of creating an integrated framework for linking different legacy systems, applications, and data sources across an enterprise. ©NIIT Architecting J2EE Solutions Lesson 1B / Slide 21 of 43
  • Legacy Connectivity and ProtocolsLegacy Connectivity (Contd.) • Using J2EE Connector Architecture (Contd.) • The steps for using the CCI API and a connector resource to access a database are: • Create a connector module that specifies the resource adapter file. • Create a connection pool that uses the connector module. • Create a JNDI context for a session, where the username and password required to access a database are specified. • Use the lookup() method to locate the ConnectionFactory for the resource adapter. • Use the getConnection() ConnectionFactory method to open a connection to the database. • Perform the required operation on the database. • Close the connection to the database. ©NIIT Architecting J2EE Solutions Lesson 1B / Slide 22 of 43
  • Legacy Connectivity and ProtocolsLegacy Connectivity (Contd.) • Using Web Services • Web Services: • Provide a distributed computing environment for using the business services of applications. • Use standard XML protocols and formats, which makes the Web Services platform independent, language independent, and vendor independent. • Provide an approach to integrate to existing systems. • Provide standard ways to access middle-tier and back-end services, such as database management systems and transaction monitors. ©NIIT Architecting J2EE Solutions Lesson 1B / Slide 23 of 43
  • Legacy Connectivity and ProtocolsLegacy Connectivity (Contd.) • Using Web Services (Contd.) • The advantage of Web services is that any system that is Internet- enabled can use Web services without a separate communications infrastructure, such as Common Object Request Broker Architecture (CORBA) or Java Message Service (JMS). • The disadvantage of Web services is that the XML parsing overhead may decrease the performance of the system. • The Web service APIs, such as Java API for XML-based RPC (JAX-RPC), Java API for XML Registries (JAXR), and SOAP (Simple Object Access Protocol) with Attachments API for Java (SAAJ) provides a standard Java API for connecting applications and legacy systems. ©NIIT Architecting J2EE Solutions Lesson 1B / Slide 24 of 43
  • Legacy Connectivity and ProtocolsLegacy Connectivity (Contd.) • Using Web Services (Contd.) • The JAX APIs can be divided into two categories: • Document-oriented: Deals with XML documents processing. • Procedure-oriented: Deals with procedures. Web services use the procedure-oriented APIs for connecting to legacy systems. • The procedure-oriented APIs are: • JAX-RPC: Sends SOAP method calls to remote sites over the Internet and receives the response. • SAAJ: Provides messaging in Java applications using resource factories similar to the Java Messaging Service (JMS). Sends SOAP messages over the Internet in a standard way. • JAXR: Provides a standard way to access business registries and share information. ©NIIT Architecting J2EE Solutions Lesson 1B / Slide 25 of 43
  • Legacy Connectivity and ProtocolsDemonstration-Implementing Legacy Integration Using JNI • Problem Statement • Homelike Hospital Ltd. research laboratories situated at US is conducting certain experiments on creating a vaccine. For this they require that the temperature be mentioned in Celsius. They are doing a sampling on a base of 15,000 persons per day but the sample data received till now has the temperature recorded in Fahrenheit. The Smart Software Developers have earlier developed a program for converting temperature from Fahrenheit to Celsius but that program was created using ‘C’, for Homelike Hospital Ltd. The software that is being used by Homelike Hospital Ltd at present is Java. Smart Software Developers have been assigned the responsibility of reusing that code in the current setup. ©NIIT Architecting J2EE Solutions Lesson 1B / Slide 26 of 43
  • Legacy Connectivity and ProtocolsDemonstration-Implementing Legacy Integration Using JNI (Contd.) • Solution • To solve the preceding problem, perform the following tasks: 1. Write the Java code. 2. Compile the Java code. 3. Create the .h file. 4. Write the native method implementation. 5. Create a shared library. 6. Run the program. ©NIIT Architecting J2EE Solutions Lesson 1B / Slide 27 of 43
  • Legacy Connectivity and ProtocolsDemonstration-Implementing Legacy Integration Using Resource Adapter • Problem Statement • ABC Corp. deals in computer hardware products and stores business information in EIS (PointBase Database). With the increase in its client base, the management of ABC Corp. has decided to implement J2EE, for providing the information of product to its clients over the Internet. The company has decided to use SQL Server 2000 to store the application data. The management also wants that earlier information of their products stored in the PointBase database, should also be accessible through the J2EE application. The management wants that the integration with the PointBase database should be done using JCA resource adapters to ensure that any future change or upgradation of its database will have minimum effect on the application. ©NIIT Architecting J2EE Solutions Lesson 1B / Slide 28 of 43
  • Legacy Connectivity and ProtocolsDemonstration-Implementing Legacy Integration Using Resource Adapter (Contd.) • Solution • To solve the preceding problem, perform the following tasks: 1. Create JCA administered object. 2. Create a J2EE Web client. 3. Run the Application. ©NIIT Architecting J2EE Solutions Lesson 1B / Slide 29 of 43
  • Legacy Connectivity and ProtocolsOverview of Protocols • You need the protocols over which you can connect to some legacy systems. • Some of the protocols are Hypertext Transfer Protocol (HTTP), HTTP over secure socket layer (HTTPS), Internet Inter-ORB Protocol (IIOP), and Java Remote Method Protocol (JRMP). • HTTP and HTTPS are primarily intended as Web page transport, IIOP and JRMP are transports for CORBA and RMI respectively. • You can use IIOP as an alternative transport for RMI and it is the preferred transport for RMI in an EJB system. ©NIIT Architecting J2EE Solutions Lesson 1B / Slide 30 of 43
  • Legacy Connectivity and ProtocolsOverview of Protocols (Contd.) • HTTP • HyperText Transfer Protocol (HTTP): • Is based on the request/response model. • Specifies how messages are transmitted and formatted. • Defines the actions, Web servers and browsers in response to various requests from client. • Is a connectionless and stateless protocol. • A stateless protocol means that the information from an earlier request or response is not available to subsequent responses. • You can add some state between two requests to associate the content of the two requests. • You can add state by using cookies, URL rewriting, and HTTPS. ©NIIT Architecting J2EE Solutions Lesson 1B / Slide 31 of 43
  • Legacy Connectivity and ProtocolsOverview of Protocols (Contd.) • HTTP (Contd.) • Some of the request formats used by HTTP are: • GET: Carries only a URL into the server and the server should response with the data for the URL. The URL for a GET request is reflected in the address bar of most browsers. • POST: Sends information along with the URL when the client sends a request to the server. • HEAD: Obtains some information about a Web page without loading the page. The HEAD method is used to determine whether a Web page has changed from the last cached page. ©NIIT Architecting J2EE Solutions Lesson 1B / Slide 32 of 43
  • Legacy Connectivity and ProtocolsOverview of Protocols (Contd.) • HTTP (Contd.) • Advantages of HTTP are: • It possesses simple request and response mechanism. • It is allowed through firewalls. • HTTP supports transmission of arbitrary data. • Disadvantages of HTTP are: • HTTP is non-transactional protocol. • It is insecure and inefficient, as it requires too many TCP connections. ©NIIT Architecting J2EE Solutions Lesson 1B / Slide 33 of 43
  • Legacy Connectivity and ProtocolsOverview of Protocols (Contd.) • HTTPS • HTTP over Secure Socket Layer (SSL) transmits data securely over a network. • HTTP over SSL (HTTPS) is a combination of HTTP over a Secure Socket Layer (SSL) transport. • HTTPS is a connection-based Web protocol that encrypts and decrypts user page requests and also the pages returned by the Web servers. • SSL provides encryption, authentication, and a session for maintaining state. • SSL uses a private key to encrypt data transferred over the SSL connection. The level of encryption and authentication depends on the capability of the client and the server. ©NIIT Architecting J2EE Solutions Lesson 1B / Slide 34 of 43
  • Legacy Connectivity and ProtocolsOverview of Protocols (Contd.) • HTTPS (Contd.) • Advantages of HTTPS are: • It is a secure protocol. • It is allowed through firewalls. • It is widely supported and deployed protocol. • Disadvantages of HTTPS are: • It can process only 10% of the traffic HTTP can process. • Administration overheads are high in case you are using HTTPS. ©NIIT Architecting J2EE Solutions Lesson 1B / Slide 35 of 43
  • Legacy Connectivity and ProtocolsOverview of Protocols (Contd.) • IIOP • Internet Inter-ORB Protocol (IIOP) enables distributed programs written in different programming languages to communicate over the Internet. • IIOP is developed by the Object Management Group (OMG) to implement CORBA connectivity over a network. • J2EE uses IIOP in two ways: • By using the Java Interface Definition Language (Java IDL) APIs. • By running Remote Method Invocation (RMI) over IIOP. ©NIIT Architecting J2EE Solutions Lesson 1B / Slide 36 of 43
  • Legacy Connectivity and ProtocolsOverview of Protocols (Contd.) • IIOP (Contd.) • The following figure shows the IIOP over the Internet: ©NIIT Architecting J2EE Solutions Lesson 1B / Slide 37 of 43
  • Legacy Connectivity and ProtocolsOverview of Protocols (Contd.) • IIOP (Contd.) • Advantages of IIOP are: • It supports interoperability. For example, Java clients can call C++ servers and C client can call Java server. • It is used in legacy integration. • It is designed for remote object invocation. • IIOP provides built-in support for security and transactions. • Disadvantages of IIOP are: • Firewalls cannot be configured with an IIOP port. • All method invocations are remote, as a result performance is not good. • IIOP supports only remote references. ©NIIT Architecting J2EE Solutions Lesson 1B / Slide 38 of 43
  • Legacy Connectivity and ProtocolsOverview of Protocols (Contd.) • JRMP • Java Remote Method Protocol (JRMP) is a proprietary wire-level protocol for communication using Java Remote Method Invocation (RMI) technology. • JRMP can: • Invoke methods and pass arguments, return values, and exceptions over the network. • Handle objects and JRMP does not restrict argument and return types to data values. • JRMP is used to send method invocations and parameters and to return values and exceptions from one JVM to another. ©NIIT Architecting J2EE Solutions Lesson 1B / Slide 39 of 43
  • Legacy Connectivity and ProtocolsOverview of Protocols (Contd.) • JRMP(Contd.) • JRMP Messages ©NIIT Architecting J2EE Solutions Lesson 1B / Slide 40 of 43
  • Legacy Connectivity and ProtocolsOverview of Protocols (Contd.) • JRMP(Contd.) • Advantages of JRMP are: • It supports parameter passing by reference or by value. • It supports distributed garbage collection. • It provides single multiplexed connection. • Disadvantages of JRMP are: • Servers are bound to arbitrary ports. • HTTP tunneling is limited. • Performance is low because all method invocations are remote. ©NIIT Architecting J2EE Solutions Lesson 1B / Slide 41 of 43
  • Legacy Connectivity and ProtocolsSummary In this lesson, you learned: • The legacy integration is of two types, synchronous and asynchronous. • Synchronous integration involves synchronous communication between a J2EE application and an Enterprise Information System (EIS). • The synchronous communication between a J2EE application and an EIS consists of the request/response interaction model. • Asynchronous integration involves message-based communication between a J2EE application and EIS. • Two types of asynchronous communication are queue-based communication and publish-subscribe messaging. • There are different approaches to perform legacy integration, such as data level integration, application interface level integration, method level integration, and user interface level integration. • Data level integration integrates the backend data stores, which are used in the integrated application. ©NIIT Architecting J2EE Solutions Lesson 1B / Slide 42 of 43
  • Legacy Connectivity and ProtocolsSummary(Contd.) • Application interface level integration uses the integration frameworks and application programming interfaces (APIs) of integrated applications to integrate two applications. • Method level integration shares business logic as a collection of methods or operations that the integrated application can invoke. • User interface level integration accesses existing applications through their user interfaces. • Java Native Interface (JNI) is used to write custom code that integrates new business logic with a legacy system. • J2EE Connector Architecture (JCA) defines a standard architecture for connecting a J2EE application server to EIS. • The Web service APIs, such as JAX-RPC, JAXR, and SAAJ provides a standard Java API for connecting applications and legacy systems • Various protocols are required to connect over legacy systems. The protocols are HTTP, HTTPS, IIOP, and JRMP. ©NIIT Architecting J2EE Solutions Lesson 1B / Slide 43 of 43