001: /*
002: (c) Copyright 2003, 2004, 2005, 2006, 2007, 2008 Hewlett-Packard Development Company, LP
003: [See end of file]
004: $Id: WrappedGraph.java,v 1.16 2008/01/02 12:05:17 andy_seaborne Exp $
005: */
006:
007: package com.hp.hpl.jena.graph.impl;
008:
009: import com.hp.hpl.jena.graph.*;
010: import com.hp.hpl.jena.graph.query.*;
011: import com.hp.hpl.jena.shared.*;
012: import com.hp.hpl.jena.util.iterator.*;
013:
014: /**
015: A wrapper class which simply defers all operations to its base.
016: @author kers
017: */
018: public class WrappedGraph implements GraphWithPerform {
019: protected Graph base;
020: protected Reifier reifier;
021: protected BulkUpdateHandler bud;
022: protected GraphEventManager gem;
023:
024: public WrappedGraph(Graph base) {
025: this .base = base;
026: this .reifier = new WrappedReifier(base.getReifier(), this );
027: }
028:
029: public boolean dependsOn(Graph other) {
030: return base.dependsOn(other);
031: }
032:
033: public QueryHandler queryHandler() {
034: return base.queryHandler();
035: }
036:
037: public TransactionHandler getTransactionHandler() {
038: return base.getTransactionHandler();
039: }
040:
041: public BulkUpdateHandler getBulkUpdateHandler() {
042: if (bud == null)
043: bud = new WrappedBulkUpdateHandler(this , base
044: .getBulkUpdateHandler());
045: return bud;
046: }
047:
048: public GraphStatisticsHandler getStatisticsHandler() {
049: return base.getStatisticsHandler();
050: }
051:
052: public Capabilities getCapabilities() {
053: return base.getCapabilities();
054: }
055:
056: public GraphEventManager getEventManager() {
057: if (gem == null)
058: gem = new SimpleEventManager(this );
059: return gem;
060: }
061:
062: public Reifier getReifier() {
063: return reifier;
064: }
065:
066: public PrefixMapping getPrefixMapping() {
067: return base.getPrefixMapping();
068: }
069:
070: public void add(Triple t) {
071: base.add(t);
072: getEventManager().notifyAddTriple(this , t);
073: }
074:
075: public void delete(Triple t) {
076: base.delete(t);
077: getEventManager().notifyDeleteTriple(this , t);
078: }
079:
080: public ExtendedIterator find(TripleMatch m) {
081: return SimpleEventManager.notifyingRemove(this , base.find(m));
082: }
083:
084: public ExtendedIterator find(Node s, Node p, Node o) {
085: return SimpleEventManager.notifyingRemove(this , base.find(s, p,
086: o));
087: }
088:
089: public boolean isIsomorphicWith(Graph g) {
090: return base.isIsomorphicWith(g);
091: }
092:
093: public boolean contains(Node s, Node p, Node o) {
094: return base.contains(s, p, o);
095: }
096:
097: public boolean contains(Triple t) {
098: return base.contains(t);
099: }
100:
101: public void close() {
102: base.close();
103: }
104:
105: public boolean isClosed() {
106: return base.isClosed();
107: }
108:
109: public boolean isEmpty() {
110: return base.isEmpty();
111: }
112:
113: public int size() {
114: return base.size();
115: }
116:
117: public void performAdd(Triple t) {
118: base.add(t);
119: }
120:
121: public void performDelete(Triple t) {
122: base.delete(t);
123: }
124: }
125:
126: /*
127: (c) Copyright 2003, 2004, 2005, 2006, 2007, 2008 Hewlett-Packard Development Company, LP
128: All rights reserved.
129:
130: Redistribution and use in source and binary forms, with or without
131: modification, are permitted provided that the following conditions
132: are met:
133:
134: 1. Redistributions of source code must retain the above copyright
135: notice, this list of conditions and the following disclaimer.
136:
137: 2. Redistributions in binary form must reproduce the above copyright
138: notice, this list of conditions and the following disclaimer in the
139: documentation and/or other materials provided with the distribution.
140:
141: 3. The name of the author may not be used to endorse or promote products
142: derived from this software without specific prior written permission.
143:
144: THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
145: IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
146: OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
147: IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
148: INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
149: NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
150: DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
151: THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
152: (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
153: THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
154: */
|