org.apache.openejb.config.BeanProperties Maven / Gradle / Ivy
The newest version!
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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 org.apache.openejb.config;
import org.apache.openejb.OpenEJBException;
import org.apache.openejb.jee.EnterpriseBean;
import org.apache.openejb.jee.oejb3.EjbDeployment;
import org.apache.openejb.jee.oejb3.OpenejbJar;
import org.apache.openejb.loader.SystemInstance;
import org.apache.openejb.util.LogCategory;
import org.apache.openejb.util.Logger;
import org.apache.openejb.util.SuperProperties;
import java.util.HashMap;
import java.util.Map;
import java.util.Properties;
/**
* @version $Rev$ $Date$
*/
public class BeanProperties implements DynamicDeployer {
private static final Logger log = Logger.getInstance(LogCategory.OPENEJB_STARTUP_CONFIG, ModuleProperties.class);
private final Map additionalProperties = new HashMap();
private final Properties globalProperties = new Properties();
@Override
public AppModule deploy(final AppModule appModule) throws OpenEJBException {
final Properties base = new Properties();
base.putAll(SystemInstance.get().getProperties());
base.putAll(appModule.getProperties());
for (final EjbModule module : appModule.getEjbModules()) {
final Properties overrides = new SuperProperties().caseInsensitive(true);
overrides.putAll(base);
overrides.putAll(module.getProperties());
if (module.getOpenejbJar() == null) {
module.setOpenejbJar(new OpenejbJar());
}
final OpenejbJar openejbJar = module.getOpenejbJar();
final Map deploymentMap = openejbJar.getDeploymentsByEjbName();
for (final EnterpriseBean bean : module.getEjbJar().getEnterpriseBeans()) {
final SuperProperties properties = new SuperProperties().caseInsensitive(true);
properties.putAll(globalProperties);
final String additionalKey = bean.getEjbName();
if (additionalProperties.containsKey(additionalKey)) {
for (final Map.Entry
© 2015 - 2025 Weber Informatics LLC | Privacy Policy