in modules/kernel/src/org/apache/axis2/deployment/AxisConfigBuilder.java [88:289]
public void populateConfig() throws DeploymentException {
try {
OMElement config_element = buildOM();
if (!TAG_AXISCONFIG.equals(config_element.getLocalName())) {
throw new DeploymentException(Messages.getMessage("badelementfound", TAG_AXISCONFIG,
config_element.getLocalName()));
}
// processing Parameters
// Processing service level parameters
Iterator<OMElement> itr = config_element.getChildrenWithName(new QName(TAG_PARAMETER));
processParameters(itr, axisConfig, axisConfig);
// process MessageReceiver
OMElement messageReceiver =
config_element.getFirstChildWithName(new QName(TAG_MESSAGE_RECEIVERS));
if (messageReceiver != null) {
HashMap mrs = processMessageReceivers(messageReceiver);
Iterator keys = mrs.keySet().iterator();
while (keys.hasNext()) {
String key = (String) keys.next();
axisConfig.addMessageReceiver(key, (MessageReceiver) mrs.get(key));
}
}
// Process Module refs
Iterator<OMElement> moduleitr =
config_element.getChildrenWithName(new QName(DeploymentConstants.TAG_MODULE));
processModuleRefs(moduleitr, axisConfig);
// Processing Transport Senders
Iterator<OMElement> trs_senders =
config_element.getChildrenWithName(new QName(TAG_TRANSPORT_SENDER));
processTransportSenders(trs_senders);
// Processing Transport Receivers
Iterator<OMElement> trs_Reivers =
config_element.getChildrenWithName(new QName(TAG_TRANSPORT_RECEIVER));
processTransportReceivers(trs_Reivers);
// Process TargetResolvers
OMElement targetResolvers =
config_element.getFirstChildWithName(new QName(TAG_TARGET_RESOLVERS));
processTargetResolvers(axisConfig, targetResolvers);
// Process ThreadContextMigrators
OMElement threadContextMigrators =
config_element.getFirstChildWithName(new QName(TAG_THREAD_CONTEXT_MIGRATORS));
processThreadContextMigrators(axisConfig, threadContextMigrators);
// Process Observers
Iterator<OMElement> obs_ittr = config_element.getChildrenWithName(new QName(TAG_LISTENER));
processObservers(obs_ittr);
// Processing Phase orders
Iterator<OMElement> phaseorders = config_element.getChildrenWithName(new QName(TAG_PHASE_ORDER));
processPhaseOrders(phaseorders);
Iterator<OMElement> moduleConfigs =
config_element.getChildrenWithName(new QName(TAG_MODULE_CONFIG));
processModuleConfig(moduleConfigs, axisConfig, axisConfig);
// processing <wsp:Policy> .. </..> elements
Iterator<OMElement> policyElements = PolicyUtil.getPolicyChildren(config_element);
if (policyElements != null && policyElements.hasNext()) {
processPolicyElements(policyElements,
axisConfig.getPolicySubject());
}
// processing <wsp:PolicyReference> .. </..> elements
Iterator<OMElement> policyRefElements = PolicyUtil.getPolicyRefChildren(config_element);
if (policyRefElements != null && policyRefElements.hasNext()) {
processPolicyRefElements(policyElements,
axisConfig.getPolicySubject());
}
//to process default module versions
OMElement defaultModuleVerionElement = config_element.getFirstChildWithName(new QName(
TAG_DEFAULT_MODULE_VERSION));
if (defaultModuleVerionElement != null) {
processDefaultModuleVersions(defaultModuleVerionElement);
}
OMElement clusterElement = config_element
.getFirstChildWithName(new QName(TAG_CLUSTER));
if (clusterElement != null) {
ClusterBuilder clusterBuilder = new ClusterBuilder(axisConfig);
clusterBuilder.buildCluster(clusterElement);
}
//Add jta transaction configuration
OMElement transactionElement = config_element.getFirstChildWithName(new QName(TAG_TRANSACTION));
if (transactionElement != null) {
ParameterInclude transactionParameters = new ParameterIncludeImpl();
Iterator<OMElement> parameters = transactionElement.getChildrenWithName(new QName(TAG_PARAMETER));
processParameters(parameters, transactionParameters, null);
TransactionConfiguration txcfg = null;
OMAttribute txConfigurationClassAttribute =
transactionElement.getAttribute(new QName(TAG_TRANSACTION_CONFIGURATION_CLASS));
if (txConfigurationClassAttribute != null){
String txConfigurationClassName = txConfigurationClassAttribute.getAttributeValue();
try {
Class txConfigurationClass = Class.forName(txConfigurationClassName);
Constructor constructor = txConfigurationClass.getConstructor(new Class[]{ParameterInclude.class});
txcfg = (TransactionConfiguration) constructor.newInstance(new Object[]{transactionParameters});
} catch (Exception e) {
throw new DeploymentException("Can not found or instantiate the class " + txConfigurationClassName, e);
}
} else {
txcfg = new TransactionConfiguration(transactionParameters);
}
OMAttribute timeoutAttribute = transactionElement.getAttribute(new QName(TAG_TIMEOUT));
if(timeoutAttribute != null) {
txcfg.setTransactionTimeout(Integer.parseInt(timeoutAttribute.getAttributeValue()));
}
axisConfig.setTransactionConfig(txcfg);
}
/*
* Add Axis2 default builders if they are not overidden by the config
*/
axisConfig.addMessageBuilder("multipart/related", new MIMEBuilder());
axisConfig.addMessageBuilder("application/soap+xml", new SOAPBuilder());
axisConfig.addMessageBuilder("text/xml", new SOAPBuilder());
axisConfig.addMessageBuilder("application/xop+xml", new MTOMBuilder());
axisConfig.addMessageBuilder("application/xml", new ApplicationXMLBuilder());
axisConfig.addMessageBuilder("application/x-www-form-urlencoded",
new XFormURLEncodedBuilder());
// process MessageBuilders
OMElement messageBuildersElement =
config_element.getFirstChildWithName(new QName(TAG_MESSAGE_BUILDERS));
if (messageBuildersElement != null) {
HashMap builderSelector = processMessageBuilders(messageBuildersElement);
Iterator keys = builderSelector.keySet().iterator();
while (keys.hasNext()) {
String key = (String) keys.next();
axisConfig.addMessageBuilder(key, (Builder) builderSelector.get(key));
}
}
//process dataLocator configuration
OMElement dataLocatorElement =
config_element
.getFirstChildWithName(new QName(DRConstants.DATA_LOCATOR_ELEMENT));
if (dataLocatorElement != null) {
processDataLocatorConfig(dataLocatorElement);
}
// process roleplayer configuration
OMElement rolePlayerElement =
config_element
.getFirstChildWithName(new QName(Constants.SOAP_ROLE_CONFIGURATION_ELEMENT));
if (rolePlayerElement != null) {
processSOAPRoleConfig(axisConfig, rolePlayerElement);
}
// process MessageFormatters
OMElement messageFormattersElement =
config_element.getFirstChildWithName(new QName(TAG_MESSAGE_FORMATTERS));
if (messageFormattersElement != null) {
HashMap messageFormatters = processMessageFormatters(messageFormattersElement);
Iterator keys = messageFormatters.keySet().iterator();
while (keys.hasNext()) {
String key = (String) keys.next();
axisConfig.addMessageFormatter(key,
(MessageFormatter) messageFormatters.get(key));
}
}
//Processing deployers.
Iterator<OMElement> deployerItr = config_element.getChildrenWithName(new QName(DEPLOYER));
if (deployerItr != null) {
processDeployers(deployerItr);
}
//process Attachments Lifecycle manager configuration
OMElement attachmentsLifecycleManagerElement =
config_element
.getFirstChildWithName(new QName(ATTACHMENTS_LIFECYCLE_MANAGER));
if (attachmentsLifecycleManagerElement != null) {
processAttachmentsLifecycleManager(axisConfig, attachmentsLifecycleManagerElement);
}
} catch (XMLStreamException e) {
throw new DeploymentException(e);
}
}