1 / 10

Utilizing Object-Oriented Features in WebSphere's Java Framework

This technical exploration by Michael Chaney, Technical Director at ChainLink Networking Solutions, highlights the advantages and challenges of leveraging Object-Oriented (OO) features within the Java framework of WebSphere. It discusses benefits such as code reusability, simplified application design, and reduced ownership costs, while also addressing disadvantages like the need for higher initial expertise and upfront development effort. Practical examples include storing complex data types and implementing user-defined functions in SQL, demonstrating the power and flexibility of OO design.

mimir
Télécharger la présentation

Utilizing Object-Oriented Features in WebSphere's Java Framework

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. Leveraging OO Features of IDS within the Java OO Framework of WebSphere Michael Chaney Technical Director ChainLink Networking Solutions, Inc.

  2. Object Oriented Design • Advantages • Code re-use • Simplified application design • Lower cost of ownership • Disadvantages • Initial development requires higher expertise • More upfront development effort required

  3. IDS Advantages • Storage of arbitrarily complex data • Inheritance (OO) • Polymorphism (OO) • User defined types • User defined functions • C, Java, SQL • Functional indexes

  4. Web Object Example • All web content stored in single table create table web_content ( id integer primary key, object web_object_t ); • Objects stored within user defined web_object_t base type

  5. Web Object Inheritance

  6. SQL Example • Functional index create index i_web_content_type on web_content ( content_type(object) ); • Convert PDF document to HTML select object::html_t from web_content where content_type(object)='application/pdf';

  7. Java Object Access ... java.util.Map map = conn.getTypeMap(); map.put(“web_object_t", Class.forName(“WebObject")); … map.put("pdf_t", Class.forName("PdfObject")); conn.setTypeMap(map); ... ResultSet rs=statement.executeQuery("select * from web_content ;”); while (rs.next()){ WebObject wbObj=(WebObject)rs.getObject(“object”); out.write(wbObj.embed()); // embed into HTML page }

  8. Java Object Implementation public class WebObject implements SQLData { private String sql_type=“web_object_t”;  String getSQLTypeName() { return sql_type; }           void readSQL(SQLInput stream, String typeName) { ... }            void writeSQL(SQLOutput stream) { ... } ... /// implementation details ... public String getContentType() { … } // object mime type public String embed() { … } // embedded display within HTML public InputStream getData() { … } // Get native object date bytes }

  9. WebSphere Native Object Display public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // ... ServletOutputStream out= response.getOutputStream(); ResultSet rs=stmt.executeQuery( "select object from web_content where id=" + request.getParameter("id") ); if (rs.next()){ WebObject wbObj=(WebObject)rs.getObject("object"); response.setContentType( wbObj.getContentType() ); InputStream data=wbObj.getData(); int c=data.read(); while (c>=0 ){ out.write(c); } } }

  10. Questions? Contact: Michael Chaney Technical Director ChainLink Networking Solutions, Inc. mikec@chainlink.com

More Related