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.router;
16:
17: import java.util.*;
18: import org.griphyn.vdl.dbschema.*;
19:
20: /**
21: * This class maintains each element in the nesting of Definitions.
22: * It turned out that the caching for LFNs etc must also be kept in
23: * the stack instead of globally. In some cases, the caching may be
24: * adverse to the performance, though.
25: *
26: * @author Jens-S. Vöckler
27: * @author Yong Zhao
28: * @version $Revision $
29: */
30: public class StackElement {
31: /**
32: * The database schema intermediary.
33: */
34: private DatabaseSchema m_dbschema;
35:
36: /**
37: * Temporarily saves filename lookups in a local cache.
38: */
39: private Cache m_lfnCache;
40:
41: /**
42: * Temporarily saves TR lookups in a local cache.
43: */
44: private Cache m_TRCache;
45:
46: /**
47: * ctor: Initializes the local caches and the major data element.
48: * @param schema is a database backend manager
49: */
50: public StackElement(DatabaseSchema schema) {
51: this .m_dbschema = schema;
52: if (schema.cachingMakesSense()) {
53: this .m_lfnCache = new Cache(600);
54: this .m_TRCache = new Cache(600);
55: } else {
56: this .m_lfnCache = this .m_TRCache = null;
57: }
58: }
59:
60: /**
61: * Obtains the reference to the database backend manager.
62: *
63: * @return a handle to the database backend manager.
64: */
65: public DatabaseSchema getDatabaseSchema() {
66: return this .m_dbschema;
67: }
68:
69: /**
70: * Obtains the reference to the transient LFN cache.
71: *
72: * @return a handle to the transient LFN cache, or null for no caching.
73: */
74: public Cache getLFNCache() {
75: return this .m_lfnCache;
76: }
77:
78: /**
79: * Obtains the reference to the transient TR cache.
80: *
81: * @return a handle to the transient TR cache, or null for no caching.
82: */
83: public Cache getTRCache() {
84: return this.m_TRCache;
85: }
86: }
|