Leveraging OO Features of IDS within the Java OO Framework of WebSphere Michael Chaney Technical...
-
Upload
barrie-mitchell -
Category
Documents
-
view
212 -
download
0
Transcript of Leveraging OO Features of IDS within the Java OO Framework of WebSphere Michael Chaney Technical...
Leveraging OO Leveraging OO Features of IDS Features of IDS
within the within the Java OO Framework of Java OO Framework of
WebSphere WebSphere
Michael Chaney
Technical Director
ChainLink Networking Solutions, Inc.
Object Oriented DesignObject Oriented Design
Advantages– Code re-use– Simplified application design– Lower cost of ownership
Disadvantages– Initial development requires higher expertise– More upfront development effort required
IDS AdvantagesIDS Advantages
Storage of arbitrarily complex data– Inheritance (OO)– Polymorphism (OO)
User defined typesUser defined functions
– C, Java, SQL
Functional indexes
Web Object ExampleWeb 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
Web Object InheritanceWeb Object Inheritance
g if_ t
jp eg _ t
t i f f_ t
im ag e_ t
h tm l_ t
p la in_ t
xm l_ t
te x t_ t
f la sh _ t
m sw o rd _ t
p d f_ t
a pp lica tio n_ t
w e b_ ob jec t_ t
SQL ExampleSQL Example
Functional indexcreate index i_web_content_type on web_content
( content_type(object) );
Convert PDF document to HTMLselect object::html_t from web_content
where content_type(object)='application/pdf';
Java Object AccessJava 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}
Java Object ImplementationJava 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}
WebSphere Native Object DisplayWebSphere 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); }}
}
Questions?Questions?
Contact: Michael Chaney
Technical Director
ChainLink Networking Solutions, Inc.