View Javadoc

1   /**
2    * Copyright 2005-2013 The Kuali Foundation
3    *
4    * Licensed under the Educational Community License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    * http://www.opensource.org/licenses/ecl2.php
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package org.kuali.rice.kew.engine.node.var;
17  
18  /**
19   * Represents a property that can be accessed relative to a specific "scheme".
20   * Property format: <code>[scheme:]locator</code>
21   * <dl>
22   *   <dt>scheme</dt>
23   *   <dd>The "scheme" of the property, which is implemented by a PropertyScheme implementation to
24   *       resolve the locator to an actual value</dd>
25   *   <dt>locator</dt>
26   *   <dd>PropertyScheme-implementation-specific property name or URI</dd>
27   * </dl>
28   * 
29   * @author Kuali Rice Team (rice.collab@kuali.org)
30   */
31  public final class Property {
32      /**
33       * The property scheme (e.g. var:, url:, file:
34       */
35      public String scheme;
36      /**
37       * The property locator; in the case of a variable it is a name; in the case of a url, a url;
38       * in the case of a file, a file path
39       */
40      public String locator;
41  
42      /**
43       * Parses the scheme and locator from a property name/locator string
44       * @param string the property name/locator
45       */
46      public Property(String string) {
47          int i = string.indexOf(':');
48          if (i == -1) {
49              locator = string;
50          } else {
51              if (i > 0) {
52                  scheme = string.substring(0, i);
53              }
54              locator = string.substring(i + 1);
55          }
56      }
57  
58      /**
59       * Initialized the property with specified scheme and locator
60       * @param scheme the scheme
61       * @param locator the locator
62       */
63      public Property(String scheme, String locator) {
64          this.scheme = scheme;
65          this.locator = locator;
66      }
67  
68      public String toString() {
69          return "[Property: scheme=" + scheme + ", locator=" + locator + "]";
70      }
71  }