01: /*
02: *
03: *
04: * Copyright 1990-2006 Sun Microsystems, Inc. All Rights Reserved.
05: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER
06: *
07: * This program is free software; you can redistribute it and/or
08: * modify it under the terms of the GNU General Public License version
09: * 2 only, as published by the Free Software Foundation.
10: *
11: * This program is distributed in the hope that it will be useful, but
12: * WITHOUT ANY WARRANTY; without even the implied warranty of
13: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14: * General Public License version 2 for more details (a copy is
15: * included at /legal/license.txt).
16: *
17: * You should have received a copy of the GNU General Public License
18: * version 2 along with this work; if not, write to the Free Software
19: * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20: * 02110-1301 USA
21: *
22: * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
23: * Clara, CA 95054 or visit www.sun.com if you need additional
24: * information or have any questions.
25: *
26: */
27:
28: package com.sun.cdc.config;
29:
30: /**
31: * This class serves as an adapter for <code>PropertyProvider</code> interface.
32: * It can be used for those property providers that cannot perform caching and
33: * therefore do not need to implement <code>cacheProperties()</code> method.
34: */
35: public abstract class PropertyProviderAdapter implements
36: PropertyProvider {
37: /**
38: * Returns the current value of the dynamic property corresponding to this
39: * <code>PropertyProvider</code>.
40: *
41: * @param key key for the dynamic property.
42: * @param fromCache indicates whether property value should be taken from
43: * internal cache. It can be ignored if properties caching is not
44: * supported by underlying implementation.
45: * @return the value that will be returned by
46: * <code>System.getProperty()</code> call for the corresponding dynamic
47: * property.
48: */
49: public abstract String getValue(String key, boolean fromCache);
50:
51: /**
52: * Tells underlying implementation to cache values of all the properties
53: * corresponding to this particular class. This call can be ignored if
54: * property caching is not supported.
55: * Always returns <code>false</code> in this adapter.
56: *
57: * @return <code>true</code> on success, <code>false</code> otherwise
58: */
59: public boolean cacheProperties() {
60: return false;
61: }
62: }
|