Presentation is loading. Please wait.

Presentation is loading. Please wait.

Integration with CORBA Page 1 Integration with CORBA Liang Tian April 23, 2001.

Similar presentations


Presentation on theme: "Integration with CORBA Page 1 Integration with CORBA Liang Tian April 23, 2001."— Presentation transcript:

1 Integration with CORBA Page 1 Integration with CORBA Liang Tian April 23, 2001

2 Integration with CORBA Page 2Outline J2EE and CORBA Integration JSP and CORBA Objects EJB and CORBA Objects Summary Servlet and CORBA Objects

3 Integration with CORBA Page 3 J2EE and CORBA J2EE and CORBA architectures both can provide developing environment for distributed applications. Each of the two architectures can provide multi-platform support, which makes application running in heterogeneous environment possible and easier. The implementation language is different.

4 Integration with CORBA Page 4 J2EE and CORBA J2EE: entirely in Java. Application components benefit from “Write Once, Run Anywhere” model. Difficult in using the existing third-party non-Java code and making components running in non-Java client environments.

5 Integration with CORBA Page 5 J2EE and CORBA CORBA: any one of supported programming languages. APIs written in different languages. Difficult in moving non-Java CORBA components from one platform to another. Flexible in implementation language and portability is not very good.

6 Integration with CORBA Page 6 J2EE and CORBA Integration of J2EE and CORBA architectures. Share the benefits and reduce the limitations. J2EE and CORBA can work together very well. Our objective is to show how objects in CORBA architecture can be accessed from various J2EE application components.

7 Integration with CORBA Page 7 Set Initial Object Reference Port WroxQuotes CORBA Object Demo

8 Integration with CORBA Page 8 Server Running WroxQuotes CORBA Object Demo

9 Integration with CORBA Page 9 WroxQuotes CORBA Object Demo Client Output

10 Integration with CORBA Page 10Integration Web Container EJB Container Servlet JSP EJB CORBA Server WroxQuotes CORBA Object

11 Integration with CORBA Page 11Integration Creating a Java Servlet that retrieves quotes information from WroxQuotes CORBA Object. Constructing a JavaServer Page that retrieves quotes information from WroxQuotes CORBA Object. Constructing Enterprise JavaBean that “wrap” CORBA Object and provide information to client.

12 Integration with CORBA Page 12 Servlets and CORBA Objects HTML Form Servlet CORBAObject

13 Integration with CORBA Page 13 Servlets and CORBA Objects Initializing ORB Accessing Naming Services Locating the Object Invoking the Method on Object Constructing resulting HTML Page Servlet.java

14 Integration with CORBA Page 14 ……. String port = getServletContext().getInitParameter("ORBInitialPort" ); String host = getServletContext().getInitParameter("ORBInitialHost" ); Properties orbProps = new Properties(); orbProps.put("org.omg.CORBA.ORBInitialPort", port); orbProps.put("org.omg.CORBA.ORBInitialHost", host); orb = org.omg.CORBA.ORB.init(args, orbProps); ……. Servlets and CORBA Objects Initializing ORB Servlet.java

15 Integration with CORBA Page 15 Servlets and CORBA Objects Accessing Naming Services & Locating the Object org.omg.CORBA.Object contextObj = orb.resolve_initial_references("NameService"); NamingContext rootContext = NamingContextHelper.narrow (contextObj); NameComponent name = new NameComponent("WroxQuotes", ""); NameComponent namePath[] = { name }; org.omg.CORBA.Object obj = rootContext.resolve(namePath); quoteObj = WroxStocks.WroxQuotesHelper.narrow(obj); Servlet.java

16 Integration with CORBA Page 16 Servlets and CORBA Objects Invoking the Method on CORBA Object …… String symbolList = request.getParameter("Symbols"); String symbols[ ] = parseSymbolList(symbolList); try { if (quoteObj != null) { quotes = quoteObj.getQuoteList(symbols); } response.setContentType("text/html"); …… Servlet.java

17 Integration with CORBA Page 17 …… if (quotes != null) { out.println(" " + quotes[i].symb + " "); out.println(" " + quotes[i].volume + " "); out.println(" " + quotes[i].bid + " "); out.println(" " + quotes[i].ask + " "); } …… Servlets and CORBA Objects Constructing Resulting HTML Page Servlet.java

18 Integration with CORBA Page 18 …… WroxStocks Quote Service Symbol(s): Enter stock symbol or multiple symbols delimited by spaces …… Servlets and CORBA Objects HTML Form Form.html

19 Integration with CORBA Page 19 java -jar orion.jar tnameserv -ORBInitialPort 1100 java -cp %CLASSPATH% WroxQuotesServer -ORBInitialPort 1100 Servlets and CORBA Objects Demo web.xml, application.xml, server.xml, default-web-site.xml

20 Integration with CORBA Page 20 Servlets and CORBA Objects Demo

21 Integration with CORBA Page 21 Servlets and CORBA Objects Demo

22 Integration with CORBA Page 22 HTML Form JSP JavaBeanCORBAObject JSP and CORBA Objects JSP and CORBA Objects

23 Integration with CORBA Page 23 Initializing ORB Accessing Naming Services Locating the Object Invoking the Method on Object Bean.java JSP and CORBA Objects JSP and CORBA Objects

24 Integration with CORBA Page 24 JSP and CORBA Objects JSP and CORBA Objects Resulting Page Quotes.jsp page import="WroxStocks.WroxQuotesPackage.Quote" errorPage="WroxQuotesError.jsp"%> <% String port = application.getInitParameter("ORBInitialPort" ); String host = application.getInitParameter("ORBInitialHost" ); WroxQuotesBean.init(port, host ); %>

25 Integration with CORBA Page 25 JSP and CORBA Objects JSP and CORBA Objects Resulting Page Quotes.jsp …… 04/23/ :59:00 ……

26 Integration with CORBA Page 26 JSP and CORBA Objects JSP and CORBA Objects HTML Form Form.html …… WroxStocks Quote Service Symbol(s): Enter stock symbol or multiple symbols delimited by spaces ……

27 Integration with CORBA Page 27 java -jar orion.jar tnameserv -ORBInitialPort 1100 java -cp %CLASSPATH% WroxQuotesServer -ORBInitialPort 1100 web.xml, application.xml, server.xml, default-web-site.xml JSP and CORBA Objects Demo JSP and CORBA Objects Demo

28 Integration with CORBA Page 28 JSP and CORBA Objects Demo JSP and CORBA Objects Demo

29 Integration with CORBA Page 29 JSP and CORBA Objects Demo JSP and CORBA Objects Demo

30 Integration with CORBA Page 30 EJB and CORBA Objects EJB and CORBA ObjectsClientApplication EJB CORBAObject

31 Integration with CORBA Page 31 EJB and CORBA Objects EJB and CORBA Objects …… public interface WroxQuotes extends EJBObject { public StockQuote getQuote(String symbol) throws UnknownSymbolException, RemoteException; public StockQuote[] getQuoteList(String[] symbols) throws UnknownSymbolException, RemoteException; } …… Remote Interface Quotes.java

32 Integration with CORBA Page 32 import javax.ejb.EJBHome; import javax.ejb.CreateException; import java.io.Serializable; import java.rmi.RemoteException; public interface WroxQuotesHome extends EJBHome { WroxQuotes create() throws RemoteException, CreateException; } EJB and CORBA Objects EJB and CORBA Objects Home Interface QuotesHome.java

33 Integration with CORBA Page 33 EJB and CORBA Objects EJB and CORBA ObjectsQuotesEJB.java Initializing ORB Accessing Naming Services Locating the Object Invoking the Method on Object

34 Integration with CORBA Page 34 EJB and CORBA Objects EJB and CORBA ObjectsQuotesEJB.java Initializing ORB Accessing Naming Services Locating the Object public class WroxQuotesEJB implements SessionBean { WroxQuotesBean quotesBean; public WroxQuotesEJB() { …… quotesBean = new WroxQuotesBean(); quotesBean.init("1100", "localhost"); } ……

35 Integration with CORBA Page 35 Invoking the Method on CORBA Object EJB and CORBA Objects EJB and CORBA ObjectsQuotesEJB.java …… q = quotesBean.getQuotes(symbolList); result.symbol = q[0].symb; result.volume = q[0].volume; result.bid = q[0].bid; result.ask = q[0].ask; ……

36 Integration with CORBA Page 36 Constructing Result EJB and CORBA Objects EJB and CORBA ObjectsQuotesEJB.java …… for (int i = 0; i < q.length; i++) { result[i] = new StockQuote(); …… result[i].symbol = q[i].symb; result[i].volume = q[i].volume; result[i].bid = q[i].bid; result[i].ask = q[i].ask; …… cal.set(q[i].asOf.year, q[i].asOf.month, q[i].asOf.day, q[i].asOf.hour, q[i].asOf.minute, q[i].asOf.second); ……

37 Integration with CORBA Page 37 EJB and CORBA Objects Demo EJB and CORBA Objects Demo java -jar orion.jar tnameserv -ORBInitialPort 1100 java -cp %CLASSPATH% WroxQuotesServer -ORBInitialPort 1100 java -cp %CLASSPATH% WroxQuotesClient

38 Integration with CORBA Page 38 EJB and CORBA Objects Demo EJB and CORBA Objects Demo

39 Integration with CORBA Page 39Summary Initialize ORB Connect & Access Naming Services Obtain Object Reference & Locating the Object Invoke the Method on Remote Object Basic Steps

40 Integration with CORBA Page 40Summary “With the integration of J2EE and CORBA, we can easily build n-tier applications where Java and non-Java clients objects can seamlessly interact.” “By combining the benefits of Java and CORBA, our n- tier application can now be both accessible to new clients and able to accommodate new distributed objects without considering their implementation languages.” -- Professional Java Server Programming. J2EE Edition. p.1423

41 Integration with CORBA Page 41 J2EE and CORBA Integration JSP and CORBA Objects EJB and CORBA Objects Summary Servlet and CORBA Objects Summary

42 Integration with CORBA Page 42Reference [1] Professional Java Server Programming. J2EE Edition. Chapter 29. Wrox Press [2] Source Code of Professional Java Server Programming. J2EE Edition. Chapter 29. Wrox Press Available at

43 Integration with CORBA Page 43 Integration with CORBA Liang Tian April 23, 2001


Download ppt "Integration with CORBA Page 1 Integration with CORBA Liang Tian April 23, 2001."

Similar presentations


Ads by Google