use of org.apache.ofbiz.base.container.ContainerConfig.Configuration in project ofbiz-framework by apache.
the class EntityDataLoadContainer method init.
@Override
public void init(List<StartupCommand> ofbizCommands, String name, String configFile) throws ContainerException {
this.name = name;
// get the data-load properties passed by the user in the command line
Map<String, String> loadDataProps = ofbizCommands.stream().filter(command -> command.getName().equals(StartupCommandUtil.StartupOption.LOAD_DATA.getName())).map(command -> command.getProperties()).findFirst().get();
/* disable job scheduler, JMS listener and startup services
* FIXME: This is not thread-safe. */
ServiceDispatcher.enableJM(false);
ServiceDispatcher.enableJMS(false);
ServiceDispatcher.enableSvcs(false);
Configuration configuration = ContainerConfig.getConfiguration(name, configFile);
Property delegatorNameProp = configuration.getProperty("delegator-name");
String overrideDelegator = loadDataProps.get(DELEGATOR_NAME);
if ("all-tenants".equals(overrideDelegator)) {
// load data for all tenants
for (GenericValue tenant : getTenantList(delegatorNameProp)) {
String tenantDelegator = delegatorNameProp.value + "#" + tenant.getString("tenantId");
loadDataForDelegator(loadDataProps, configuration, delegatorNameProp, tenantDelegator);
}
} else {
// load data for a single delegator
loadDataForDelegator(loadDataProps, configuration, delegatorNameProp, overrideDelegator);
}
}
use of org.apache.ofbiz.base.container.ContainerConfig.Configuration in project ofbiz-framework by apache.
the class CatalinaContainer method init.
@Override
public void init(List<StartupCommand> ofbizCommands, String name, String configFile) throws ContainerException {
this.name = name;
ContainerConfig.Configuration configuration = ContainerConfig.getConfiguration(name, configFile);
Property engineConfig = retrieveTomcatEngineConfig(configuration);
// tomcat setup
tomcat = prepareTomcatServer(configuration, engineConfig);
Engine engine = prepareTomcatEngine(tomcat, engineConfig);
Host host = prepareHost(tomcat, null);
// add realm and valve for Tomcat SSO
if (EntityUtilProperties.propertyValueEquals("security", "security.login.tomcat.sso", "true")) {
boolean useEncryption = EntityUtilProperties.propertyValueEquals("security", "password.encrypt", "true");
OFBizRealm ofBizRealm = new OFBizRealm();
if (useEncryption) {
ofBizRealm.setCredentialHandler(new HashedCredentialHandler());
} else {
ofBizRealm.setCredentialHandler(new SimpleCredentialHandler());
}
host.setRealm(ofBizRealm);
((StandardHost) host).addValve(new SingleSignOn());
}
// clustering, valves and connectors setup
Property clusterProps = prepareTomcatClustering(host, engineConfig);
prepareTomcatEngineValves(engineConfig).forEach(valve -> ((StandardEngine) engine).addValve(valve));
prepareTomcatConnectors(configuration).forEach(connector -> tomcat.getService().addConnector(connector));
loadWebapps(tomcat, configuration, clusterProps);
}
Aggregations