01: /*
02: * This file or a portion of this file is licensed under the terms of
03: * the Globus Toolkit Public License, found in file GTPL, or at
04: * http://www.globus.org/toolkit/download/license.html. This notice must
05: * appear in redistributions of this file, with or without modification.
06: *
07: * Redistributions of this Software, with or without modification, must
08: * reproduce the GTPL in: (1) the Software, or (2) the Documentation or
09: * some other similar material which is provided with the Software (if
10: * any).
11: *
12: * Copyright 1999-2004 University of Chicago and The University of
13: * Southern California. All rights reserved.
14: */
15: package org.griphyn.vdl.parser;
16:
17: import org.griphyn.vdl.classes.*;
18: import org.griphyn.vdl.util.*;
19: import org.xml.sax.*;
20: import java.util.List;
21: import java.util.ArrayList;
22:
23: /**
24: * This class adds a given Definition from the parser's callback into
25: * the fresh in-memory storage. It is a streamlined version of the more
26: * versatile {@link MemoryStorage} handler. End-users should not use
27: * this class, hence it is not public.
28: *
29: * @author Jens-S. Vöckler
30: * @author Yong Zhao
31: * @version $Revision: 50 $
32: */
33: public class NoHassleHandler implements DefinitionHandler {
34: /**
35: * This is a reference to the already established in-memory storage.
36: */
37: private Definitions m_memory;
38:
39: /**
40: * The c'tor initializes the references to modify the in-memory database
41: * of definitions.
42: *
43: * @param definitions is a reference to the in-memory database.
44: */
45: public NoHassleHandler(Definitions definitions) {
46: if ((this .m_memory = definitions) == null)
47: throw new NullPointerException();
48: }
49:
50: /**
51: * This method adds the given Definition to whatever storage is
52: * implemented underneath. It is assumed that a database will be
53: * read from file, and that there are no duplicates. Each new
54: * definition will be added right away, skipping any safety net checks!
55: *
56: * @param d is the Definition that is ready to be stored.
57: * @return true, if new version was stored and database modified
58: */
59: public boolean store(Definition d) {
60: // definition does not exist
61: this .m_memory.addDefinition(d);
62: return true;
63: }
64: }
|