xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jon Burgin <jbur...@onboard-software.com>
Subject RE: Serialize a SvgDocument to database?
Date Mon, 16 Sep 2002 13:32:19 GMT
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@emedia-office.de]
Sent: Monday, September 16, 2002 8:17 AM
To: batik-users@xml.apache.org
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@emedia-office.de

Tel.: 06293/921121
Fax:  06293/921129



---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-users-help@xml.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-users-help@xml.apache.org


Mime
View raw message