01: /*
02: * Copyright Aduna (http://www.aduna-software.com/) (c) 1997-2007.
03: *
04: * Licensed under the Aduna BSD-style license.
05: */
06: package org.openrdf.rio.helpers;
07:
08: import org.openrdf.model.Statement;
09: import org.openrdf.rio.RDFHandler;
10: import org.openrdf.rio.RDFHandlerException;
11:
12: /**
13: * Convenience base class for RDF handlers that wrap another RDF handler. This
14: * class provides default methods that forward method calls to the wrapped RDF
15: * handler.
16: *
17: * @author Arjohn Kampman
18: */
19: public class RDFHandlerWrapper implements RDFHandler {
20:
21: /*-----------*
22: * Variables *
23: *-----------*/
24:
25: /**
26: * The wrapped RDF handler.
27: */
28: private RDFHandler rdfHandler;
29:
30: /*--------------*
31: * Constructors *
32: *--------------*/
33:
34: /**
35: * Creates a new RDFHandlerWrapper that wraps the supplied RDF handler.
36: *
37: * @param rdfHandler
38: * The wrapped RDF handler for this <tt>RDFHandlerWrapper</tt>,
39: * must not be <tt>null</tt>.
40: */
41: public RDFHandlerWrapper(RDFHandler rdfHandler) {
42: assert rdfHandler != null;
43: this .rdfHandler = rdfHandler;
44: }
45:
46: /*---------*
47: * Methods *
48: *---------*/
49:
50: public void startRDF() throws RDFHandlerException {
51: rdfHandler.startRDF();
52: }
53:
54: public void endRDF() throws RDFHandlerException {
55: rdfHandler.endRDF();
56: }
57:
58: public void handleNamespace(String prefix, String uri)
59: throws RDFHandlerException {
60: rdfHandler.handleNamespace(prefix, uri);
61: }
62:
63: public void handleStatement(Statement st)
64: throws RDFHandlerException {
65: rdfHandler.handleStatement(st);
66: }
67:
68: public void handleComment(String comment)
69: throws RDFHandlerException {
70: rdfHandler.handleComment(comment);
71: }
72: }
|