/*
* Copyright (c) 2011, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* 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 org.wso2.carbon.humantask;
import org.apache.axis2.context.ConfigurationContext;
import org.apache.axis2.deployment.DeploymentEngine;
import org.apache.axis2.engine.AxisConfiguration;
import org.wso2.carbon.humantask.integration.AxisHumanTaskDeployer;
import org.wso2.carbon.humantask.internal.HumanTaskServiceComponent;
import org.wso2.carbon.humantask.store.HumanTaskStore;
import org.wso2.carbon.utils.Axis2ConfigurationContextObserver;
import org.wso2.carbon.utils.multitenancy.MultitenantUtils;
public class Axis2ConfigurationContextObserverImpl implements Axis2ConfigurationContextObserver {
private HumanTaskServer htServer;
public Axis2ConfigurationContextObserverImpl() {
htServer = HumanTaskServiceComponent.getHumanTaskServer();
}
public void creatingConfigurationContext(int i) {
}
public void createdConfigurationContext(ConfigurationContext configurationContext) {
Integer tenantId = MultitenantUtils.getTenantId(configurationContext);
AxisConfiguration axisConfig = configurationContext.getAxisConfiguration();
DeploymentEngine deploymentEngine = (DeploymentEngine) axisConfig.getConfigurator();
HumanTaskStore taskStoreForTenant =
htServer.getHumanTaskStoreManager().createHumanTaskStoreForTenant(tenantId, axisConfig);
deploymentEngine.addDeployer(new AxisHumanTaskDeployer(taskStoreForTenant), "humantask", "htar");
}
public void terminatingConfigurationContext(ConfigurationContext configurationContext) {
}
public void terminatedConfigurationContext(ConfigurationContext configurationContext) {
}
}