Download Leveraging OO features in IDS within the Java OO framework

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the work of artificial intelligence, which forms the content of this project

Document related concepts
no text concepts found
Transcript
Leveraging OO
Features of IDS
within the
Java OO Framework of
WebSphere
Michael Chaney
Technical Director
ChainLink Networking Solutions, Inc.
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
IDS Advantages

Storage of arbitrarily complex data
– Inheritance (OO)
– Polymorphism (OO)

User defined types
 User defined functions
– C, Java, SQL

Functional indexes
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
Web Object Inheritance
web_object_t
image_t
text_t
application_t
gif_t
html_t
flash_t
jpeg_t
plain_t
msword_t
tiff_t
xml_t
pdf_t
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';
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
}
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
}
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); }
}
}
Questions?
Contact: Michael Chaney
Technical Director
ChainLink Networking Solutions, Inc.
[email protected]
Related documents