01: // Copyright 2006, 2007 The Apache Software Foundation
02: //
03: // Licensed under the Apache License, Version 2.0 (the "License");
04: // you may not use this file except in compliance with the License.
05: // You may obtain a copy of the License at
06: //
07: // http://www.apache.org/licenses/LICENSE-2.0
08: //
09: // Unless required by applicable law or agreed to in writing, software
10: // distributed under the License is distributed on an "AS IS" BASIS,
11: // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12: // See the License for the specific language governing permissions and
13: // limitations under the License.
14:
15: package org.apache.tapestry.ioc.services;
16:
17: import org.apache.tapestry.ioc.annotations.Value;
18:
19: /**
20: * Used to manage <em>symbols</em>, configuration properties whose value is evaluated at runtime.
21: * Symbols use the Ant syntax: <code>${foo.bar.baz}</code> where <code>foo.bar.baz</code> is the
22: * name of the symbol. The symbol may appear inside annotation, such as {@link Value}. Values for
23: * symbols are provided by {@link SymbolProvider}.
24: */
25: public interface SymbolSource {
26: /**
27: * Expands the value for a particular symbol. This may involve recursive expansion, if the
28: * immediate value for the symbol itself contains symbols.
29: *
30: * @param symbolName
31: * @return the expanded string
32: * @throws RuntimeException
33: * if the symbol name can not be expanded (no {@link SymbolProvider} can provide its
34: * value), or if an expansion is directly or indirectly recursive
35: */
36: String valueForSymbol(String symbolName);
37:
38: /**
39: * Given an input string that <em>may</em> contain symbols, returns the string with any and
40: * all symbols fully expanded.
41: *
42: * @param input
43: * @return expanded input
44: */
45: String expandSymbols(String input);
46: }
|