001: /*
002: * Licensed to the Apache Software Foundation (ASF) under one
003: * or more contributor license agreements. See the NOTICE file
004: * distributed with this work for additional information
005: * regarding copyright ownership. The ASF licenses this file
006: * to you under the Apache License, Version 2.0 (the
007: * "License"); you may not use this file except in compliance
008: * with the License. You may obtain a copy of the License at
009: *
010: * http://www.apache.org/licenses/LICENSE-2.0
011: *
012: * Unless required by applicable law or agreed to in writing,
013: * software distributed under the License is distributed on an
014: * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
015: * KIND, either express or implied. See the License for the
016: * specific language governing permissions and limitations
017: * under the License.
018: */
019:
020: package org.apache.axis2.deployment;
021:
022: import org.apache.axiom.om.OMAttribute;
023: import org.apache.axiom.om.OMElement;
024: import org.apache.axis2.AxisFault;
025: import org.apache.axis2.builder.ApplicationXMLBuilder;
026: import org.apache.axis2.builder.Builder;
027: import org.apache.axis2.builder.MIMEBuilder;
028: import org.apache.axis2.builder.MTOMBuilder;
029: import org.apache.axis2.builder.SOAPBuilder;
030: import org.apache.axis2.builder.XFormURLEncodedBuilder;
031: import org.apache.axis2.dataretrieval.DRConstants;
032: import org.apache.axis2.deployment.util.PhasesInfo;
033: import org.apache.axis2.deployment.util.Utils;
034: import org.apache.axis2.description.HandlerDescription;
035: import org.apache.axis2.description.ModuleConfiguration;
036: import org.apache.axis2.description.ParameterInclude;
037: import org.apache.axis2.description.PolicyInclude;
038: import org.apache.axis2.description.TransportInDescription;
039: import org.apache.axis2.description.TransportOutDescription;
040: import org.apache.axis2.engine.AxisConfiguration;
041: import org.apache.axis2.engine.AxisObserver;
042: import org.apache.axis2.engine.MessageReceiver;
043: import org.apache.axis2.engine.Phase;
044: import org.apache.axis2.i18n.Messages;
045: import org.apache.axis2.phaseresolver.PhaseException;
046: import org.apache.axis2.transport.MessageFormatter;
047: import org.apache.axis2.transport.TransportListener;
048: import org.apache.axis2.transport.TransportSender;
049: import org.apache.axis2.util.Loader;
050: import org.apache.axis2.util.TargetResolver;
051: import org.apache.commons.logging.Log;
052: import org.apache.commons.logging.LogFactory;
053:
054: import javax.xml.namespace.QName;
055: import javax.xml.stream.XMLStreamException;
056: import java.io.InputStream;
057: import java.security.PrivilegedActionException;
058: import java.security.PrivilegedExceptionAction;
059: import java.util.ArrayList;
060: import java.util.HashMap;
061: import java.util.Iterator;
062: import java.util.List;
063:
064: public class AxisConfigBuilder extends DescriptionBuilder {
065:
066: protected static final Log log = LogFactory
067: .getLog(AxisConfigBuilder.class);
068: private DeploymentEngine deploymentEngine;
069:
070: public AxisConfigBuilder(InputStream serviceInputStream,
071: AxisConfiguration axisConfiguration,
072: DeploymentEngine deploymentEngine) {
073: super (serviceInputStream, axisConfiguration);
074: this .deploymentEngine = deploymentEngine;
075: }
076:
077: public void populateConfig() throws DeploymentException {
078: try {
079: OMElement config_element = buildOM();
080:
081: if (!TAG_AXISCONFIG.equals(config_element.getLocalName())) {
082: throw new DeploymentException(Messages.getMessage(
083: "badelementfound", TAG_AXISCONFIG,
084: config_element.getLocalName()));
085: }
086: // processing Parameters
087: // Processing service level parameters
088: Iterator itr = config_element
089: .getChildrenWithName(new QName(TAG_PARAMETER));
090:
091: processParameters(itr, axisConfig, axisConfig);
092:
093: // process MessageReceiver
094: OMElement messageReceiver = config_element
095: .getFirstChildWithName(new QName(
096: TAG_MESSAGE_RECEIVERS));
097: if (messageReceiver != null) {
098: HashMap mrs = processMessageReceivers(messageReceiver);
099: Iterator keys = mrs.keySet().iterator();
100: while (keys.hasNext()) {
101: String key = (String) keys.next();
102: axisConfig.addMessageReceiver(key,
103: (MessageReceiver) mrs.get(key));
104: }
105: }
106: // Process Module refs
107: Iterator moduleitr = config_element
108: .getChildrenWithName(new QName(
109: DeploymentConstants.TAG_MODULE));
110:
111: processModuleRefs(moduleitr, axisConfig);
112:
113: // Processing Transport Senders
114: Iterator trs_senders = config_element
115: .getChildrenWithName(new QName(TAG_TRANSPORT_SENDER));
116:
117: processTransportSenders(trs_senders);
118:
119: // Processing Transport Receivers
120: Iterator trs_Reivers = config_element
121: .getChildrenWithName(new QName(
122: TAG_TRANSPORT_RECEIVER));
123:
124: processTransportReceivers(trs_Reivers);
125:
126: // Process TargetResolvers
127: OMElement targetResolvers = config_element
128: .getFirstChildWithName(new QName(
129: TAG_TARGET_RESOLVERS));
130: processTargetResolvers(axisConfig, targetResolvers);
131:
132: // Process Observers
133: Iterator obs_ittr = config_element
134: .getChildrenWithName(new QName(TAG_LISTENER));
135:
136: processObservers(obs_ittr);
137:
138: // Processing Phase orders
139: Iterator phaseorders = config_element
140: .getChildrenWithName(new QName(TAG_PHASE_ORDER));
141:
142: processPhaseOrders(phaseorders);
143:
144: Iterator moduleConfigs = config_element
145: .getChildrenWithName(new QName(TAG_MODULE_CONFIG));
146:
147: processModuleConfig(moduleConfigs, axisConfig, axisConfig);
148:
149: // processing <wsp:Policy> .. </..> elements
150: Iterator policyElements = config_element
151: .getChildrenWithName(new QName(POLICY_NS_URI,
152: TAG_POLICY));
153:
154: if (policyElements != null && policyElements.hasNext()) {
155: processPolicyElements(PolicyInclude.AXIS_POLICY,
156: policyElements, axisConfig.getPolicyInclude());
157: }
158:
159: // processing <wsp:PolicyReference> .. </..> elements
160: Iterator policyRefElements = config_element
161: .getChildrenWithName(new QName(POLICY_NS_URI,
162: TAG_POLICY_REF));
163:
164: if (policyRefElements != null
165: && policyRefElements.hasNext()) {
166: processPolicyRefElements(PolicyInclude.AXIS_POLICY,
167: policyElements, axisConfig.getPolicyInclude());
168: }
169:
170: //to process default module versions
171: OMElement defaultModuleVerionElement = config_element
172: .getFirstChildWithName(new QName(
173: TAG_DEFAULT_MODULE_VERSION));
174: if (defaultModuleVerionElement != null) {
175: processDefaultModuleVersions(defaultModuleVerionElement);
176: }
177:
178: OMElement clusterElement = config_element
179: .getFirstChildWithName(new QName(TAG_CLUSTER));
180: if (clusterElement != null) {
181: ClusterBuilder clusterBuilder = new ClusterBuilder(
182: axisConfig);
183: clusterBuilder.buildCluster(clusterElement);
184: }
185:
186: /*
187: * Add Axis2 default builders if they are not overidden by the config
188: */
189: axisConfig.addMessageBuilder("multipart/related",
190: new MIMEBuilder());
191: axisConfig.addMessageBuilder("application/soap+xml",
192: new SOAPBuilder());
193: axisConfig.addMessageBuilder("text/xml", new SOAPBuilder());
194: axisConfig.addMessageBuilder("application/xop+xml",
195: new MTOMBuilder());
196: axisConfig.addMessageBuilder("application/xml",
197: new ApplicationXMLBuilder());
198: axisConfig.addMessageBuilder(
199: "application/x-www-form-urlencoded",
200: new XFormURLEncodedBuilder());
201: // process MessageBuilders
202: OMElement messageBuildersElement = config_element
203: .getFirstChildWithName(new QName(
204: TAG_MESSAGE_BUILDERS));
205: if (messageBuildersElement != null) {
206: HashMap builderSelector = processMessageBuilders(messageBuildersElement);
207: Iterator keys = builderSelector.keySet().iterator();
208: while (keys.hasNext()) {
209: String key = (String) keys.next();
210: axisConfig.addMessageBuilder(key,
211: (Builder) builderSelector.get(key));
212: }
213: }
214:
215: //process dataLocator configuration
216: OMElement dataLocatorElement = config_element
217: .getFirstChildWithName(new QName(
218: DRConstants.DATA_LOCATOR_ELEMENT));
219:
220: if (dataLocatorElement != null) {
221: processDataLocatorConfig(dataLocatorElement);
222: }
223:
224: // process MessageFormatters
225: OMElement messageFormattersElement = config_element
226: .getFirstChildWithName(new QName(
227: TAG_MESSAGE_FORMATTERS));
228: if (messageFormattersElement != null) {
229: HashMap messageFormatters = processMessageFormatters(messageFormattersElement);
230: Iterator keys = messageFormatters.keySet().iterator();
231: while (keys.hasNext()) {
232: String key = (String) keys.next();
233: axisConfig.addMessageFormatter(key,
234: (MessageFormatter) messageFormatters
235: .get(key));
236: }
237: }
238: //Processing deployers.
239: Iterator deployerItr = config_element
240: .getChildrenWithName(new QName(DEPLOYER));
241: if (deployerItr != null) {
242: processDeployers(deployerItr);
243: }
244: } catch (XMLStreamException e) {
245: throw new DeploymentException(e);
246: }
247: }
248:
249: private void processTargetResolvers(AxisConfiguration axisConfig,
250: OMElement targetResolvers) {
251: if (targetResolvers != null) {
252: Iterator iterator = targetResolvers
253: .getChildrenWithName(new QName(TAG_TARGET_RESOLVER));
254: while (iterator.hasNext()) {
255: OMElement targetResolver = (OMElement) iterator.next();
256: OMAttribute classNameAttribute = targetResolver
257: .getAttribute(new QName(TAG_CLASS_NAME));
258: String className = classNameAttribute
259: .getAttributeValue();
260: try {
261: Class classInstance = Loader.loadClass(className);
262: TargetResolver tr = (TargetResolver) classInstance
263: .newInstance();
264: axisConfig.addTargetResolver(tr);
265: } catch (Exception e) {
266: if (log.isTraceEnabled()) {
267: log
268: .trace("processTargetResolvers: Exception thrown initialising TargetResolver: "
269: + e.getMessage());
270: }
271: }
272: }
273: }
274: }
275:
276: private void processDeployers(Iterator deployerItr) {
277: HashMap directoryToExtensionMappingMap = new HashMap();
278: HashMap extensionToDeployerMappingMap = new HashMap();
279: while (deployerItr.hasNext()) {
280: OMElement element = (OMElement) deployerItr.next();
281: String directory = element.getAttributeValue(new QName(
282: DIRECTORY));
283: if (directory == null) {
284: log.error("Deployer missing 'directory' attribute : "
285: + element.toString());
286: }
287:
288: String extension = element.getAttributeValue(new QName(
289: EXTENSION));
290: if (extension == null) {
291: log.error("Deployer missing 'extension' attribute : "
292: + element.toString());
293: return;
294: }
295:
296: // A leading dot is redundant, so strip it. So we allow either ".foo" or "foo", either
297: // of which will result in extension="foo"
298: if (extension.charAt(0) == '.')
299: extension = extension.substring(1);
300:
301: String deployerClassName = element
302: .getAttributeValue(new QName(TAG_CLASS_NAME));
303: Deployer deployer;
304: try {
305: Class deployerClass = Loader
306: .loadClass(deployerClassName);
307: deployer = (Deployer) deployerClass.newInstance();
308: } catch (Exception e) {
309: log.error(e.getMessage(), e);
310: return;
311: }
312: deployer.setDirectory(directory);
313: deployer.setExtension(extension);
314: if (directory != null) {
315: ArrayList extensionList = (ArrayList) directoryToExtensionMappingMap
316: .get(directory);
317: if (extensionList == null) {
318: extensionList = new ArrayList();
319: }
320: extensionList.add(extension);
321: directoryToExtensionMappingMap.put(directory,
322: extensionList);
323: }
324: extensionToDeployerMappingMap.put(extension, deployer);
325: }
326: if (deploymentEngine != null) {
327: deploymentEngine
328: .setDirectoryToExtensionMappingMap(directoryToExtensionMappingMap);
329: deploymentEngine
330: .setExtensionToDeployerMappingMap(extensionToDeployerMappingMap);
331: }
332: }
333:
334: protected void processModuleConfig(Iterator moduleConfigs,
335: ParameterInclude parent, AxisConfiguration config)
336: throws DeploymentException {
337: while (moduleConfigs.hasNext()) {
338: OMElement moduleConfig = (OMElement) moduleConfigs.next();
339: OMAttribute moduleName_att = moduleConfig
340: .getAttribute(new QName(ATTRIBUTE_NAME));
341:
342: if (moduleName_att == null) {
343: throw new DeploymentException(
344: Messages
345: .getMessage(DeploymentErrorMsgs.INVALID_MODULE_CONFIG));
346: } else {
347: String module = moduleName_att.getAttributeValue();
348: ModuleConfiguration moduleConfiguration = new ModuleConfiguration(
349: module, parent);
350: Iterator parameters = moduleConfig
351: .getChildrenWithName(new QName(TAG_PARAMETER));
352:
353: processParameters(parameters, moduleConfiguration,
354: parent);
355: config.addModuleConfig(moduleConfiguration);
356: }
357: }
358: }
359:
360: /**
361: * Update the list of modules that is required to be engaged globally.
362: */
363: protected void processModuleRefs(Iterator moduleRefs,
364: AxisConfiguration config) {
365: while (moduleRefs.hasNext()) {
366: OMElement moduleref = (OMElement) moduleRefs.next();
367: OMAttribute moduleRefAttribute = moduleref
368: .getAttribute(new QName(TAG_REFERENCE));
369: String refName = moduleRefAttribute.getAttributeValue();
370: axisConfig.addGlobalModuleRef(refName);
371: }
372: }
373:
374: /**
375: * Processes AxisObservers.
376: *
377: * @param oservers
378: */
379: private void processObservers(Iterator oservers) {
380: while (oservers.hasNext()) {
381: try {
382: OMElement observerelement = (OMElement) oservers.next();
383: AxisObserver observer;
384: OMAttribute trsClas = observerelement
385: .getAttribute(new QName(TAG_CLASS_NAME));
386: if (trsClas == null) {
387: log
388: .info(Messages
389: .getMessage(DeploymentErrorMsgs.OBSERVER_ERROR));
390: return;
391: }
392: final String clasName = trsClas.getAttributeValue();
393:
394: Class observerclass;
395: try {
396: observerclass = (Class) org.apache.axis2.java.security.AccessController
397: .doPrivileged(new PrivilegedExceptionAction() {
398: public Object run()
399: throws ClassNotFoundException {
400: return Loader.loadClass(clasName);
401: }
402: });
403: } catch (PrivilegedActionException e) {
404: throw (ClassNotFoundException) e.getException();
405: }
406: observer = (AxisObserver) observerclass.newInstance();
407: // processing Parameters
408: // Processing service level parameters
409: Iterator itr = observerelement
410: .getChildrenWithName(new QName(TAG_PARAMETER));
411: processParameters(itr, observer, axisConfig);
412: // initialization
413: try {
414: observer.init(axisConfig);
415: } catch (Throwable e) {
416: //Observer init may throw runtime exception , but we can stil
417: // start Axis2
418: log.info(e.getMessage());
419: }
420: axisConfig.addObservers(observer);
421: } catch (Exception e) {
422: log.info(e.getMessage());
423: }
424: }
425: }
426:
427: private ArrayList processPhaseList(OMElement phaseOrders)
428: throws DeploymentException {
429: ArrayList phaselist = new ArrayList();
430: Iterator phases = phaseOrders.getChildrenWithName(new QName(
431: TAG_PHASE));
432:
433: while (phases.hasNext()) {
434: OMElement phaseelement = (OMElement) phases.next();
435: String phaseName = phaseelement.getAttribute(
436: new QName(ATTRIBUTE_NAME)).getAttributeValue();
437: String phaseClass = phaseelement
438: .getAttributeValue(new QName(TAG_CLASS_NAME));
439: Phase phase;
440:
441: try {
442: phase = getPhase(phaseClass);
443: } catch (Exception e) {
444: throw new DeploymentException(Messages.getMessage(
445: "phaseclassnotfound", phaseClass, e
446: .getMessage()));
447: }
448:
449: phase.setName(phaseName);
450:
451: Iterator handlers = phaseelement
452: .getChildrenWithName(new QName(TAG_HANDLER));
453:
454: while (handlers.hasNext()) {
455: OMElement omElement = (OMElement) handlers.next();
456: HandlerDescription handler = processHandler(omElement,
457: axisConfig, phaseName);
458:
459: handler.getRules().setPhaseName(phaseName);
460: Utils.loadHandler(axisConfig.getSystemClassLoader(),
461: handler);
462:
463: try {
464: phase.addHandler(handler);
465: } catch (PhaseException e) {
466: throw new DeploymentException(e);
467: }
468: }
469:
470: phaselist.add(phase);
471: }
472:
473: return phaselist;
474: }
475:
476: /**
477: * Processes all the phase orders which are defined in axis2.xml.
478: *
479: * @param phaserders
480: */
481: private void processPhaseOrders(Iterator phaserders)
482: throws DeploymentException {
483: PhasesInfo info = axisConfig.getPhasesInfo();
484:
485: while (phaserders.hasNext()) {
486: OMElement phaseOrders = (OMElement) phaserders.next();
487: String flowType = phaseOrders.getAttribute(
488: new QName(TAG_TYPE)).getAttributeValue();
489:
490: if (TAG_FLOW_IN.equals(flowType)) {
491: info.setINPhases(processPhaseList(phaseOrders));
492: } else if (TAG_FLOW_IN_FAULT.equals(flowType)) {
493: info.setIN_FaultPhases(processPhaseList(phaseOrders));
494: } else if (TAG_FLOW_OUT.equals(flowType)) {
495: info.setOUTPhases(processPhaseList(phaseOrders));
496: } else if (TAG_FLOW_OUT_FAULT.equals(flowType)) {
497: info.setOUT_FaultPhases(processPhaseList(phaseOrders));
498: }
499: }
500: }
501:
502: private void processDefaultModuleVersions(OMElement defaultVersions)
503: throws DeploymentException {
504: Iterator moduleVersions = defaultVersions
505: .getChildrenWithName(new QName(TAG_MODULE));
506: while (moduleVersions.hasNext()) {
507: OMElement omElement = (OMElement) moduleVersions.next();
508: String name = omElement.getAttributeValue(new QName(
509: ATTRIBUTE_NAME));
510: if (name == null) {
511: throw new DeploymentException(Messages
512: .getMessage("modulenamecannotbenull"));
513: }
514: String version = omElement.getAttributeValue(new QName(
515: ATTRIBUTE_DEFAULT_VERSION));
516: if (version == null) {
517: throw new DeploymentException(Messages
518: .getMessage("moduleversioncannotbenull"));
519: }
520: axisConfig.addDefaultModuleVersion(name, version);
521: }
522: }
523:
524: private void processTransportReceivers(Iterator trs_senders)
525: throws DeploymentException {
526: while (trs_senders.hasNext()) {
527: TransportInDescription transportIN;
528: OMElement transport = (OMElement) trs_senders.next();
529: // getting transport Name
530: OMAttribute trsName = transport.getAttribute(new QName(
531: ATTRIBUTE_NAME));
532: if (trsName != null) {
533: String name = trsName.getAttributeValue();
534: transportIN = new TransportInDescription(name);
535: // transport impl class
536: OMAttribute trsClas = transport.getAttribute(new QName(
537: TAG_CLASS_NAME));
538: if (trsClas != null) {
539: try {
540: String clasName = trsClas.getAttributeValue();
541: Class receiverClass;
542: receiverClass = Loader.loadClass(clasName);
543:
544: TransportListener receiver = (TransportListener) receiverClass
545: .newInstance();
546: transportIN.setReceiver(receiver);
547: } catch (NoClassDefFoundError e) {
548: if (deploymentEngine != null) {
549: throw new DeploymentException(e);
550: } else {
551: // Called from createDefaultConfigurationContext in ConfigurationContextFactory
552: // Please don't throw an exception.
553: log.debug(Messages.getMessage(
554: "classnotfound", trsClas
555: .getAttributeValue()));
556: }
557: } catch (ClassNotFoundException e) {
558: throw new DeploymentException(e);
559: } catch (IllegalAccessException e) {
560: throw new DeploymentException(e);
561: } catch (InstantiationException e) {
562: throw new DeploymentException(e);
563: }
564: }
565: try {
566: Iterator itr = transport
567: .getChildrenWithName(new QName(
568: TAG_PARAMETER));
569: processParameters(itr, transportIN, axisConfig);
570: // adding to axis2 config
571: axisConfig.addTransportIn(transportIN);
572: } catch (AxisFault axisFault) {
573: throw new DeploymentException(axisFault);
574: }
575: }
576: }
577: }
578:
579: private void processTransportSenders(Iterator trs_senders)
580: throws DeploymentException {
581: while (trs_senders.hasNext()) {
582: TransportOutDescription transportout;
583: OMElement transport = (OMElement) trs_senders.next();
584:
585: // getting transport Name
586: OMAttribute trsName = transport.getAttribute(new QName(
587: ATTRIBUTE_NAME));
588:
589: if (trsName != null) {
590: String name = trsName.getAttributeValue();
591:
592: transportout = new TransportOutDescription(name);
593:
594: // transport impl class
595: OMAttribute trsClas = transport.getAttribute(new QName(
596: TAG_CLASS_NAME));
597:
598: if (trsClas == null) {
599: throw new DeploymentException(Messages.getMessage(
600: DeploymentErrorMsgs.TRANSPORT_SENDER_ERROR,
601: name));
602: }
603:
604: String clasName = trsClas.getAttributeValue();
605: Class sender;
606:
607: try {
608: sender = Loader.loadClass(clasName);
609:
610: TransportSender transportSender = (TransportSender) sender
611: .newInstance();
612:
613: transportout.setSender(transportSender);
614:
615: // process Parameters
616: // processing Parameters
617: // Processing service level parameters
618: Iterator itr = transport
619: .getChildrenWithName(new QName(
620: TAG_PARAMETER));
621:
622: processParameters(itr, transportout, axisConfig);
623: // adding to axis2 config
624: axisConfig.addTransportOut(transportout);
625: } catch (NoClassDefFoundError e) {
626: if (deploymentEngine != null) {
627: log.debug(Messages.getMessage(
628: "errorinloadingts", clasName), e);
629: throw new DeploymentException(e);
630: } else {
631: // Called from createDefaultConfigurationContext in ConfigurationContextFactory
632: // Please don't throw an exception.
633: log.debug(Messages.getMessage("classnotfound",
634: trsClas.getAttributeValue()));
635: }
636: } catch (ClassNotFoundException e) {
637: log.debug(Messages.getMessage("errorinloadingts",
638: clasName), e);
639: throw new DeploymentException(e);
640: } catch (IllegalAccessException e) {
641: log.debug(Messages.getMessage("errorinloadingts",
642: clasName), e);
643: throw new DeploymentException(e);
644: } catch (InstantiationException e) {
645: log.debug(Messages.getMessage("errorinloadingts",
646: clasName), e);
647: throw new DeploymentException(e);
648: } catch (AxisFault axisFault) {
649: log.debug(Messages.getMessage("errorinloadingts",
650: clasName), axisFault);
651: throw new DeploymentException(axisFault);
652: }
653: }
654: }
655: }
656:
657: /*
658: * process data locator configuration for data retrieval.
659: */
660: private void processDataLocatorConfig(OMElement dataLocatorElement) {
661: OMAttribute serviceOverallDataLocatorclass = dataLocatorElement
662: .getAttribute(new QName(DRConstants.CLASS_ATTRIBUTE));
663: if (serviceOverallDataLocatorclass != null) {
664: String className = serviceOverallDataLocatorclass
665: .getAttributeValue();
666: axisConfig.addDataLocatorClassNames(
667: DRConstants.GLOBAL_LEVEL, className);
668: }
669: Iterator iterator = dataLocatorElement
670: .getChildrenWithName(new QName(
671: DRConstants.DIALECT_LOCATOR_ELEMENT));
672:
673: while (iterator.hasNext()) {
674: OMElement locatorElement = (OMElement) iterator.next();
675: OMAttribute dialect = locatorElement
676: .getAttribute(new QName(
677: DRConstants.DIALECT_ATTRIBUTE));
678: OMAttribute dialectclass = locatorElement
679: .getAttribute(new QName(DRConstants.CLASS_ATTRIBUTE));
680: axisConfig.addDataLocatorClassNames(dialect
681: .getAttributeValue(), dialectclass
682: .getAttributeValue());
683:
684: }
685: }
686:
687: protected HashMap processMessageFormatters(
688: OMElement messageFormattersElement)
689: throws DeploymentException {
690: try {
691: return super
692: .processMessageFormatters(messageFormattersElement);
693: } catch (NoClassDefFoundError e) {
694: if (deploymentEngine != null) {
695: throw new DeploymentException(e);
696: } else {
697: // Called from createDefaultConfigurationContext in ConfigurationContextFactory
698: // Please don't throw an exception.
699: return new HashMap();
700: }
701: }
702: }
703:
704: protected HashMap processMessageBuilders(
705: OMElement messageBuildersElement)
706: throws DeploymentException {
707: try {
708: return super .processMessageBuilders(messageBuildersElement);
709: } catch (NoClassDefFoundError e) {
710: if (deploymentEngine != null) {
711: throw new DeploymentException(e);
712: } else {
713: // Called from createDefaultConfigurationContext in ConfigurationContextFactory
714: // Please don't throw an exception.
715: return new HashMap();
716: }
717: }
718: }
719:
720: private Phase getPhase(String className)
721: throws ClassNotFoundException, IllegalAccessException,
722: InstantiationException {
723: if (className == null) {
724: return new Phase();
725: }
726: Class phaseClass = Loader.loadClass(axisConfig
727: .getSystemClassLoader(), className);
728: return (Phase) phaseClass.newInstance();
729: }
730: }
|