Package org.apache.savan.configuration

Examples of org.apache.savan.configuration.Protocol


     *
     * @param element
     * @throws SavanException
     */
    private void processProtocol(OMElement element) throws SavanException {
        Protocol protocol = null;
        OMElement nameElement = null;
        String name = null;
        OMElement utilFactoryNameElement = null;
        String utilFactoryName = null;
        Object utilFactory = null;
        OMElement mappingRulesElement = null;
        OMElement defaultSubscriberElement = null;
        String defaultSubscriber = null;
        OMElement defaultFilterElement = null;
        String defaultFilter = null;

        protocol = new Protocol();
        nameElement = element.getFirstChildWithName(new QName(NAME));

        if (nameElement == null) {
            throw new SavanException("Protocol must have a 'Name' subelement");
        }

        name = nameElement.getText();
        protocol.setName(name);
        utilFactoryNameElement = element.getFirstChildWithName(new QName(UTIL_FACTORY));

        if (utilFactoryNameElement == null) {
            throw new SavanException("Protocol must have a 'UtilFactory' subelement");
        }

        utilFactoryName = utilFactoryNameElement.getText();
        utilFactory = getObject(utilFactoryName);

        if (!(utilFactory instanceof UtilFactory)) {
            throw new SavanException("UtilFactory element" + utilFactoryName
                    + "is not a subtype of the UtilFactory class");
        }

        protocol.setUtilFactory((UtilFactory) utilFactory);
        mappingRulesElement = element.getFirstChildWithName(new QName(MAPPING_RULES));

        if (mappingRulesElement == null) {
            throw new SavanException("Protocol must have a 'mappingRules' sub-element");
        }

        processMappingRules(mappingRulesElement, protocol);
        defaultSubscriberElement = element.getFirstChildWithName(new QName(DEFAULT_SUBSCRIBER));

        if (defaultSubscriberElement == null) {
            throw new SavanException("Protocols must have a 'defaultSubscriber' sub-element");
        }

        defaultSubscriber = defaultSubscriberElement.getText();
        protocol.setDefaultSubscriber(defaultSubscriber);
        defaultFilterElement = element.getFirstChildWithName(new QName(DEFAULT_FILTER));

        if (defaultFilterElement == null) {
            throw new SavanException("Protocols must have a 'defaultFilter' sub-element");
        }

        defaultFilter = defaultFilterElement.getText();
        protocol.setDefaultFilter(defaultFilter);
        protocolMap.put(protocol.getName(), protocol);
    }
View Full Code Here

TOP

Related Classes of org.apache.savan.configuration.Protocol

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.