logo       

RE: Serialize a SvgDocument to database?: msg#00038

Subject: RE: Serialize a SvgDocument to database?
We are doing the same thing. This can normally be done by exposing the
database through a port so that url references can be used.  Unfortunately,
this was not an option for us for security reasons (even though the pc was
only connected to another custom device via a crossover cabele - but the
customer is always right)

Anyhow, we have to create a custom loader.  Here is the code

package com.obsi.madars.db;

import java.io.InterruptedIOException;
import java.io.Reader;

//Third party implementations
import org.apache.batik.bridge.DocumentLoader;
import org.apache.batik.swing.svg.SVGDocumentLoader;

import com.obsi.madars.common.MadarsConstants;
import java.util.logging.*;

//Third party interface
import org.w3c.dom.svg.SVGDocument;

public class MadarsSvgDocumentLoader extends SVGDocumentLoader{
    protected DbItemReference dbItemReference;
    protected Reader reader;

        /**
         * default constructor
         *
         * @param pDbItemReference
         * @param pLoader
         */
    public MadarsSvgDocumentLoader(DbItemReference pDbItemReference,
                                   Reader pReader,
                                   DocumentLoader pLoader){
        super(null,pLoader);
        dbItemReference = pDbItemReference;
        reader = pReader;
    }

    /**
     * Runs this loader to obtain a document from a db connection.
     */
    public void run() {
        Logger _logger = Logger.getLogger(MadarsConstants.LOG_ROOT);
        try {
            fireStartedEvent();
            SVGDocument svgDocument =
                (SVGDocument)((DbDocumentLoader)loader)
                .loadDocument(dbItemReference, reader);

            if(svgDocument == null)
                fireCancelledEvent();
            
            fireCompletedEvent(svgDocument);

        } catch (InterruptedIOException e) {
            _logger.logp(Level.WARNING,
                         "com.obsi.madars.db.MadarsSvgDocumentLoader",
                         "run",e.toString());
            fireCancelledEvent();
        } catch (Exception e) {
            _logger.logp(Level.WARNING,
                         "com.obsi.madars.db.MadarsSvgDocumentLoader",
                         "run",e.toString());
            fireFailedEvent();
        }
    }//run()
}//class

-----Original Message-----
From: Timo Haberkern [mailto:thaberkern@xxxxxxxxxxxxxxxx]
Sent: Monday, September 16, 2002 8:17 AM
To: batik-users@xxxxxxxxxxxxxx
Subject: Serialize a SvgDocument to database?


Hello together,

i want to serialize a SVGDocument to a database (in a blob field). 
Anyone here whoe can tell me how i can save and load that through JDBC?

-- 
best regards

Timo Haberkern

EMEDIA OFFICE GmbH
Wingertstr. 4
74850 Schefflenz-Kl.

http://www.emedia-office.com
thaberkern@xxxxxxxxxxxxxxxx

Tel.: 06293/921121
Fax:  06293/921129



---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xxxxxxxxxxxxxx
For additional commands, e-mail: batik-users-help@xxxxxxxxxxxxxx


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Recently Viewed:
boot-loaders.gr...    php.pear.genera...    debugging.valgr...    kde.redhat.user...    text.xml.xsl.ge...    culture.languag...    hardware.microc...    java.servicemix...    redhat.release....    web.zope.plone....    user-groups.lin...    opendarwin.webk...    video.mjpeg.use...    sysutils.bcfg2....    encryption.gpg....    lx-office.devel...    xfree86.forum/2...    mail.mutt.devel...    acpi.devel/2003...    qnx.openqnx.dev...    network.irc.irs...    freebsd.devel.m...   
Home | blog view | USPTO Patent Archive | advertise | OSDir is an inevitable website. super tiny logo

Free Magazines

Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe

Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe

The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business.
subscribe

Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe

Total Telecom Total Telecom is "The Economist of the communications industry".
subscribe