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.interfaces;
034:
035: import com.flexive.shared.configuration.DivisionData;
036: import com.flexive.shared.exceptions.*;
037:
038: import javax.ejb.Remote;
039: import javax.management.InstanceAlreadyExistsException;
040: import javax.management.MBeanRegistrationException;
041: import javax.management.NotCompliantMBeanException;
042: import javax.management.ObjectName;
043: import java.util.List;
044:
045: /**
046: * Global configuration interface. Stores parameters valid for all divisions
047: * and the division configuration itself.
048: *
049: * @author Daniel Lichtenberger (daniel.lichtenberger@flexive.com), UCS - unique computing solutions gmbh (http://www.ucs.at)
050: */
051: @Remote
052: public interface GlobalConfigurationEngine extends
053: GenericConfigurationEngine {
054: /**
055: * JMX management method.
056: * @throws Exception if an error occured
057: */
058: void create() throws Exception;
059:
060: /**
061: * JMX management method.
062: * @throws Exception if an error occured
063: */
064: void destroy() throws Exception;
065:
066: /**
067: * Return the root user name.
068: * @return the root login name.
069: * @throws FxApplicationException TODO
070: * @throws FxLoadException if a database error occured
071: * @throws FxNotFoundException if the root login is not set in the configuration
072: */
073: String getRootLogin() throws FxApplicationException;
074:
075: /**
076: * Set the root user name.
077: * @param value the new root user name
078: * @throws FxApplicationException TODO
079: * @throws FxUpdateException if the user name could not be updated
080: * @throws FxNoAccessException if the calling user is not permitted to change to root long
081: */
082: void setRootLogin(String value) throws FxApplicationException;
083:
084: /**
085: * Get the SHA1-hashed root password.
086: * @return the SHA1-hashed root password.
087: * @throws FxApplicationException TODO
088: * @throws FxLoadException if the parameter could not be loaded successfully
089: * @throws FxNotFoundException if the root login is not set
090: */
091: String getRootPassword() throws FxApplicationException;
092:
093: /**
094: * Return true if the given plain-text password matches the stored
095: * (and hashed) password.
096: *
097: * @param userPassword the password to be checked
098: * @return true if the given plain-text password matches the stored
099: * (and hashed) password.
100: * @throws FxApplicationException TODO
101: * @throws FxLoadException if the root password could not be loaded
102: * @throws FxNotFoundException if the root password is not set in the global configuration
103: */
104: boolean isMatchingRootPassword(String userPassword)
105: throws FxApplicationException;
106:
107: /**
108: * Set the root password.
109: * @param value the root password in plain-text.
110: * @throws FxApplicationException TODO
111: * @throws FxUpdateException if the password could not be updated
112: * @throws FxNoAccessException if the calling user is not permitted to change the password
113: */
114: void setRootPassword(String value) throws FxApplicationException;
115:
116: /**
117: * Returns the configuration data for a given division ID.
118: *
119: * @param division the division ID.
120: * @return the configuration data for a given division ID.
121: * @throws FxApplicationException TODO
122: * @throws FxLoadException if an error occured reading the division configuration
123: * @throws FxNotFoundException if the division was not found
124: */
125: DivisionData getDivisionData(int division)
126: throws FxApplicationException;
127:
128: /**
129: * Returns the first matching division for the given server name,
130: * or -1 if no division was found.
131: *
132: * @param serverName the server name to be matched
133: * @return the ID of the first division that matches
134: * @throws FxApplicationException TODO
135: * @throws FxLoadException if an error occured reading the division configuration
136: */
137: int getDivisionId(String serverName) throws FxApplicationException;
138:
139: /**
140: * Return all configured division IDs.
141: * @return all configured division IDs
142: * @throws FxApplicationException TODO
143: * @throws FxLoadException if an error occured reading the division configuration
144: */
145: int[] getDivisionIds() throws FxApplicationException;
146:
147: /**
148: * Return the division data for all configured divisions.
149: * @return division data for all configured divisions.
150: * @throws FxApplicationException TODO
151: * @throws FxLoadException if an error occured reading the division configuration
152: */
153: DivisionData[] getDivisions() throws FxApplicationException;
154:
155: /**
156: * Clear the division cache.
157: */
158: void clearDivisionCache();
159:
160: void registerCacheMBean(ObjectName name)
161: throws MBeanRegistrationException,
162: NotCompliantMBeanException, InstanceAlreadyExistsException;
163:
164: /**
165: * Tests the database connection for the given dataSource JNDI name and returns a
166: * {@link DivisionData} object with the current database vendor and version values.
167: *
168: * @param divisionId the division ID
169: * @param dataSource the datasource JNDI path
170: * @param domainRegEx the regular expression used for matching domains
171: * @return the {@link DivisionData} object with database information
172: */
173: DivisionData createDivisionData(int divisionId, String dataSource,
174: String domainRegEx);
175:
176: /**
177: * Replaces the existing division configuration.
178: *
179: * @param divisions the new division data
180: * @throws FxApplicationException if the divisions could not be updated.
181: */
182: void saveDivisions(List<? extends DivisionData> divisions)
183: throws FxApplicationException;
184: }
|