[Major] Refactored StrolchConfiguration.xml to use environments
Now the agent requires an environment parameter to start, and the configuration of that environment is used to load different sections of the configuration file
This commit is contained in:
parent
bc600eb5cb
commit
f2ce445bed
|
@ -25,6 +25,7 @@ import li.strolch.runtime.observer.ObserverHandler;
|
|||
@SuppressWarnings("nls")
|
||||
public class StrolchConstants {
|
||||
|
||||
public static final String ENV_STROLCH = "ENV_STROLCH";
|
||||
public static final String PERSISTENCE_HANDLER = PersistenceHandler.class.getSimpleName();
|
||||
public static final String OBSERVER_HANDLER = ObserverHandler.class.getSimpleName();
|
||||
public static final String PRIVILEGE_HANDLER = "PrivilegeHandler";
|
||||
|
|
|
@ -0,0 +1,38 @@
|
|||
/*
|
||||
* Copyright 2013 Robert von Burg <eitch@eitchnet.ch>
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package li.strolch.runtime.configuration;
|
||||
|
||||
import java.text.MessageFormat;
|
||||
|
||||
import li.strolch.runtime.StrolchConstants;
|
||||
import ch.eitchnet.utils.helper.StringHelper;
|
||||
|
||||
/**
|
||||
* @author Robert von Burg <eitch@eitchnet.ch>
|
||||
*/
|
||||
public class StrolchSystemProperties {
|
||||
|
||||
public static String getEnvironment() {
|
||||
String environment = System.getProperties().getProperty(StrolchConstants.ENV_STROLCH);
|
||||
if (StringHelper.isEmpty(environment)) {
|
||||
String msg = "The system property {0} is missing!";
|
||||
throw new StrolchConfigurationException(MessageFormat.format(msg, StrolchConstants.ENV_STROLCH));
|
||||
}
|
||||
|
||||
return environment;
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue