1 / 43

Integration with CORBA

Integration with CORBA. Liang Tian. April 23, 2001. Outline. J2EE and CORBA. Integration. Servlet and CORBA Objects. JSP and CORBA Objects. EJB and CORBA Objects. Summary. J2EE and CORBA. J2EE and CORBA architectures both can provide developing environment for distributed applications.

ziazan
Download Presentation

Integration with CORBA

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Integration with CORBA Liang Tian April 23, 2001

  2. Outline J2EE and CORBA Integration Servlet and CORBA Objects JSP and CORBA Objects EJB and CORBA Objects Summary

  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. 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. 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. 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. WroxQuotes CORBA Object Demo Set Initial Object Reference Port

  8. WroxQuotes CORBA Object Demo Server Running

  9. WroxQuotes CORBA Object Demo Client Output

  10. Integration Servlet JSP WroxQuotes CORBA Object EJB Web Container CORBA Server EJB Container

  11. Integration 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. Servlets and CORBA Objects CORBA Object HTML Form Servlet

  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. Servlets and CORBA Objects Initializing ORB ……. 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); ……. Servlet.java

  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. 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. Servlets and CORBA Objects Constructing Resulting HTML Page …… if (quotes != null) { out.println("<td align=\"center\">" + quotes[i].symb + "</td>"); out.println("<td>" + quotes[i].volume + "</td>"); out.println("<td>" + quotes[i].bid + "</td>"); out.println("<td>" + quotes[i].ask + "</td>"); } …… Servlet.java

  18. Servlets and CORBA Objects HTML Form …… <form method=GET action="servlet/WroxQuotesServlet"> <br/> <h3>WroxStocks Quote Service</h3> <p>Symbol(s): <input type="TEXT" name="Symbols" size=30> <p><p>Enter stock symbol or multiple symbols delimited by spaces <p><input type="SUBMIT" name="SUBMIT" value="Get"> <input type="RESET" name="RESET" value="Reset"> </form> …… Form.html

  19. Servlets and CORBA Objects Demo web.xml, application.xml, server.xml, default-web-site.xml java -jar orion.jar tnameserv -ORBInitialPort 1100 java -cp %CLASSPATH% WroxQuotesServer -ORBInitialPort 1100 http://localhost/WroxQuotes/

  20. Servlets and CORBA Objects Demo

  21. Servlets and CORBA Objects Demo

  22. JSP and CORBA Objects JavaBean CORBA Object HTML Form JSP

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

  24. JSP and CORBA Objects Resulting Page <%@ page import="WroxStocks.WroxQuotesPackage.Quote" errorPage="WroxQuotesError.jsp"%> <jsp:useBean id="WroxQuotesBean" scope="application" class="WroxQuotesBean" > <% String port = application.getInitParameter("ORBInitialPort" ); String host = application.getInitParameter("ORBInitialHost" ); WroxQuotesBean.init(port, host ); %> </jsp:useBean> <% String symbols = request.getParameter( "Symbols" );%> Quotes.jsp

  25. JSP and CORBA Objects Resulting Page …… <td align="center"> <%= quotes[i].symb %> </td> <td> <%= quotes[i].volume %> </td> <td> <%= quotes[i].bid %> </td> <td> <%= quotes[i].ask %> </td> <td align="center">04/23/2001 20:59:00</td> …… Quotes.jsp

  26. JSP and CORBA Objects HTML Form …… <form method=GET action="WroxQuotes.jsp"> <br/> <h3>WroxStocks Quote Service</h3> <p>Symbol(s): <input type="TEXT" name="Symbols" size=30> <p><p>Enter stock symbol or multiple symbols delimited by spaces <p><input type="SUBMIT" name="SUBMIT" value="Get"> <input type="RESET" name="RESET" value="Reset"> </form> …… Form.html

  27. JSP and CORBA Objects Demo web.xml, application.xml, server.xml, default-web-site.xml java -jar orion.jar tnameserv -ORBInitialPort 1100 java -cp %CLASSPATH% WroxQuotesServer -ORBInitialPort 1100 http://localhost/WroxQuotes/

  28. JSP and CORBA Objects Demo

  29. JSP and CORBA Objects Demo

  30. EJB and CORBA Objects CORBA Object Client Application EJB

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

  32. EJB and CORBA Objects Home Interface 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; } QuotesHome.java

  33. EJB and CORBA Objects Initializing ORB Accessing Naming Services Locating the Object Invoking the Method on Object QuotesEJB.java

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

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

  36. EJB and CORBA Objects Constructing Result …… 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); …… QuotesEJB.java

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

  38. EJB and CORBA Objects Demo

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

  40. Summary “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. Summary J2EE and CORBA Integration Servlet and CORBA Objects JSP and CORBA Objects EJB and CORBA Objects Summary

  42. Reference [1] Professional Java Server Programming. J2EE Edition. Chapter 29. Wrox Press. 2000. [2] Source Code of Professional Java Server Programming. J2EE Edition. Chapter 29. Wrox Press. 2000. Available at http://www.wrox.com

  43. Integration with CORBA Liang Tian April 23, 2001

More Related