TAILIEUCHUNG - Oracle XSQL- P29
Oracle XSQL- P29Welcome to the exciting world of eXtended Structured Query Language (XSQL) development! What’s so exciting? Efficiency and ease of use. XSQL isn’t some razzle-dazzle technology to wow your users. It also isn’t the latest X standard du jour that no one can stop talking about until you ask, “But what does it do for me today?” The problem with all of the great stuff out there is that no one technology does it all. | 540 Chapter 19 XSQL Datagram Client Figure Architecture for the AWT custom serializer. At this point you know what your serializer should accept as input so you can go ahead and start coding it. Here is the requisite class information and the serialize method import import import import import import import import import import import import Serializers 541 import import import public class JpegGraphSerializer implements XSQLDocumentSerializer float scale 1 Takes an XML document that behaves the previously defined schema and outputs a JPEG image created using AWT public void serialize Document doc XSQLPageRequest env String mimeType image jpeg try XMLElement rootElem XMLElement Get the top level information scale getScale rootElem int width getWidth rootElem int height getHeight rootElem Node colorNode . image background Color bgcolor getColor XMLElement colorNode Create an image and get the graphics used to draw with BufferedImage img new BufferedImage width height Graphics2D g Set up the Image bgcolor Rectangle2D allRect new 0 0 width height allRect Draw the bars based on the input XML doc NodeList elems bar drawBars g elems Write the data mimeType Outputstream out JPEGImageEncoder encoder out img catch Exception e 542 Chapter 19 text html Printwriter out An error has occurred .
đang nạp các trang xem trước