001: /*
002:
003: * Copyright 2005-2006 The Kuali Foundation.
004:
005: *
006:
007: *
008:
009: * Licensed under the Educational Community License, Version 1.0 (the "License");
010:
011: * you may not use this file except in compliance with the License.
012:
013: * You may obtain a copy of the License at
014:
015: *
016:
017: * http://www.opensource.org/licenses/ecl1.php
018:
019: *
020:
021: * Unless required by applicable law or agreed to in writing, software
022:
023: * distributed under the License is distributed on an "AS IS" BASIS,
024:
025: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
026:
027: * See the License for the specific language governing permissions and
028:
029: * limitations under the License.
030:
031: */
032:
033: package edu.iu.uis.eden.engine.node.var;
034:
035: /**
036:
037: * Represents a property that can be accessed relative to a specific "scheme".
038:
039: * Property format: <code>[scheme:]locator</code>
040:
041: * <dl>
042:
043: * <dt>scheme</dt>
044:
045: * <dd>The "scheme" of the property, which is implemented by a PropertyScheme implementation to
046:
047: * resolve the locator to an actual value</dd>
048:
049: * <dt>locator</dt>
050:
051: * <dd>PropertyScheme-implementation-specific property name or URI</dd>
052:
053: * </dl>
054:
055: *
056:
057: * @author ahamid
058:
059: */
060:
061: public final class Property {
062:
063: /**
064:
065: * The property scheme (e.g. var:, url:, file:
066:
067: */
068:
069: public String scheme;
070:
071: /**
072:
073: * The property locator; in the case of a variable it is a name; in the case of a url, a url;
074:
075: * in the case of a file, a file path
076:
077: */
078:
079: public String locator;
080:
081: /**
082:
083: * Parses the scheme and locator from a property name/locator string
084:
085: * @param string the property name/locator
086:
087: */
088:
089: public Property(String string) {
090:
091: int i = string.indexOf(':');
092:
093: if (i == -1) {
094:
095: locator = string;
096:
097: } else {
098:
099: if (i > 0) {
100:
101: scheme = string.substring(0, i);
102:
103: }
104:
105: locator = string.substring(i + 1);
106:
107: }
108:
109: }
110:
111: /**
112:
113: * Initialized the property with specified scheme and locator
114:
115: * @param scheme the scheme
116:
117: * @param locator the locator
118:
119: */
120:
121: public Property(String scheme, String locator) {
122:
123: this .scheme = scheme;
124:
125: this .locator = locator;
126:
127: }
128:
129: public String toString() {
130:
131: return "[Property: scheme=" + scheme + ", locator=" + locator
132: + "]";
133:
134: }
135:
136: }
|