01: /*
02: * Copyright Aduna (http://www.aduna-software.com/) (c) 1997-2006.
03: *
04: * Licensed under the Aduna BSD-style license.
05: */
06: package org.openrdf.query.resultio;
07:
08: import org.openrdf.query.TupleQueryResultHandler;
09: import org.openrdf.query.resultio.TupleQueryResultParser;
10:
11: import org.openrdf.model.ValueFactory;
12: import org.openrdf.model.impl.ValueFactoryImpl;
13:
14: /**
15: * Base class for {@link TupleQueryResultParser}s offering common functionality for
16: * query result parsers.
17: */
18: public abstract class TupleQueryResultParserBase implements
19: TupleQueryResultParser {
20:
21: /*-----------*
22: * Variables *
23: *-----------*/
24:
25: /**
26: * The ValueFactory to use for creating RDF model objects.
27: */
28: protected ValueFactory valueFactory;
29:
30: /**
31: * The TupleQueryResultHandler that will handle the parsed query results.
32: */
33: protected TupleQueryResultHandler handler;
34:
35: /*--------------*
36: * Constructors *
37: *--------------*/
38:
39: /**
40: * Creates a new parser base that, by default, will use an instance of
41: * {@link ValueFactoryImpl} to create Value objects.
42: */
43: public TupleQueryResultParserBase() {
44: this (new ValueFactoryImpl());
45: }
46:
47: /**
48: * Creates a new parser base that will use the supplied ValueFactory to
49: * create Value objects.
50: */
51: public TupleQueryResultParserBase(ValueFactory valueFactory) {
52: setValueFactory(valueFactory);
53: }
54:
55: /*---------*
56: * Methods *
57: *---------*/
58:
59: public void setValueFactory(ValueFactory valueFactory) {
60: this .valueFactory = valueFactory;
61: }
62:
63: public void setTupleQueryResultHandler(
64: TupleQueryResultHandler handler) {
65: this.handler = handler;
66: }
67: }
|