001: /***************************************************************
002: * This file is part of the [fleXive](R) project.
003: *
004: * Copyright (c) 1999-2008
005: * UCS - unique computing solutions gmbh (http://www.ucs.at)
006: * All rights reserved
007: *
008: * The [fleXive](R) project is free software; you can redistribute
009: * it and/or modify it under the terms of the GNU General Public
010: * License as published by the Free Software Foundation;
011: * either version 2 of the License, or (at your option) any
012: * later version.
013: *
014: * The GNU General Public License can be found at
015: * http://www.gnu.org/copyleft/gpl.html.
016: * A copy is found in the textfile GPL.txt and important notices to the
017: * license from the author are found in LICENSE.txt distributed with
018: * these libraries.
019: *
020: * This library is distributed in the hope that it will be useful,
021: * but WITHOUT ANY WARRANTY; without even the implied warranty of
022: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
023: * GNU General Public License for more details.
024: *
025: * For further information about UCS - unique computing solutions gmbh,
026: * please see the company website: http://www.ucs.at
027: *
028: * For further information about [fleXive](R), please see the
029: * project website: http://www.flexive.org
030: *
031: *
032: * This copyright notice MUST APPEAR in all copies of the file!
033: ***************************************************************/package com.flexive.shared.configuration;
034:
035: import java.util.Arrays;
036: import java.util.Collections;
037: import java.util.List;
038:
039: /**
040: * Enumeration holding valid parameter paths. Each parameter path has an associated
041: * scope (e.g. global, divison, user, with/without fallbacks).
042: *
043: * @author Daniel Lichtenberger (daniel.lichtenberger@flexive.com), UCS - unique computing solutions gmbh (http://www.ucs.at)
044: */
045:
046: public enum SystemParameterPaths implements ParameterPath {
047: /** Global configuration root path */
048: GLOBAL_CONFIG("/globalconfig", ParameterScope.GLOBAL),
049: /** Path for storing the datasources per division */
050: GLOBAL_DIVISIONS_DS("/globalconfig/datasources",
051: ParameterScope.GLOBAL),
052: /** Path for storing the domain name matchers per division */
053: GLOBAL_DIVISIONS_DOMAINS("/globalconfig/domains",
054: ParameterScope.GLOBAL),
055: /** Global tree config path */
056: DIVISION_TREE("/division/tree", ParameterScope.DIVISION_ONLY),
057:
058: /** Path for storing division specific stuff */
059: DIVISION_RUNONCE_CONFIG("/division/runonce",
060: ParameterScope.DIVISION_ONLY),
061:
062: /** Path for storing user search queries */
063: USER_QUERIES_CONTENT("/search/content", ParameterScope.USER),
064: /** Search result preferences */
065: USER_RESULT_PREFERENCES("/search/results", ParameterScope.USER),
066:
067: /** unit test entry */
068: TEST_GLOBAL("/test/global", ParameterScope.GLOBAL),
069: /** unit test entry */
070: TEST_DIVISION("/test/division", ParameterScope.DIVISION),
071: /** unit test entry */
072: TEST_DIVISION_ONLY("/test/divisiononly",
073: ParameterScope.DIVISION_ONLY),
074: /** unit test entry */
075: TEST_USER("/test/user", ParameterScope.USER),
076: /** unit test entry */
077: TEST_USER_ONLY("/test/useronly", ParameterScope.USER_ONLY);
078:
079: /** Paths used only for unit testing */
080: private static final SystemParameterPaths[] TESTPATHS = {
081: TEST_GLOBAL, TEST_DIVISION, TEST_DIVISION_ONLY, TEST_USER,
082: TEST_USER_ONLY };
083:
084: private String value;
085: private ParameterScope scope;
086:
087: /**
088: * Constructor.
089: * @param path path value
090: * @param parameterScope parameter scope
091: */
092: private SystemParameterPaths(String path,
093: ParameterScope parameterScope) {
094: this .value = path;
095: this .scope = parameterScope;
096: }
097:
098: /**
099: * Returns the contained configuration path.
100: * @return configuration path
101: */
102: public String getValue() {
103: return value;
104: }
105:
106: /**
107: * Returns the scope of the configuration path
108: * @return the scope of the configuration path
109: */
110: public ParameterScope getScope() {
111: return scope;
112: }
113:
114: /**
115: * Return test path entries used for unit testing.
116: * @return test path entries used for unit testing.
117: */
118: public static List<SystemParameterPaths> getTestPaths() {
119: return Collections.unmodifiableList(Arrays.asList(TESTPATHS));
120: }
121:
122: /** {@inheritDoc} */
123: @Override
124: public String toString() {
125: return this .value + "{" + this .scope + "}";
126: }
127: }
|