All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.ow2.easywsdl.extensions.multiple.impl.MultipleExtWriterImpl Maven / Gradle / Ivy

The newest version!
/**
 * Copyright (c) 2008-2012 EBM WebSourcing, 2012-2018 Linagora
 * 
 * This program/library is free software: you can redistribute it and/or modify
 * it under the terms of the New BSD License (3-clause license).
 *
 * This program/library is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE. See the New BSD License (3-clause license)
 * for more details.
 *
 * You should have received a copy of the New BSD License (3-clause license)
 * along with this program/library; If not, see http://directory.fsf.org/wiki/License:BSD_3Clause/
 * for the New BSD License (3-clause license).
 */
 
package org.ow2.easywsdl.extensions.multiple.impl;

import org.ow2.easywsdl.extensions.multiple.api.MultipleExtException;
import org.ow2.easywsdl.extensions.multiple.api.MultipleExtWriter;
import org.ow2.easywsdl.wsdl.WSDLFactory;
import org.ow2.easywsdl.wsdl.api.WSDLException;
import org.ow2.easywsdl.wsdl.api.WSDLWriter;
import org.ow2.easywsdl.wsdl.api.abstractItf.AbsItfDescription;
import org.ow2.easywsdl.wsdl.decorator.DecoratorDescriptionImpl;
import org.w3c.dom.Document;

/**
 * @author Nicolas Boissel-Dallier - EBM WebSourcing
 */
public class MultipleExtWriterImpl implements MultipleExtWriter {

    private WSDLWriter writer = null;

    public MultipleExtWriterImpl() throws MultipleExtException {
        try {
        	WSDLFactory factory = WSDLFactory.newInstance();
            this.writer = factory.newWSDLWriter();
        } catch (final WSDLException e) {
            throw new MultipleExtException(e);
        }
    }

    @SuppressWarnings("unchecked")
    public Document getDocument(final AbsItfDescription wsdlDef) throws MultipleExtException {
        Document res = null;
        try {
            res = this.writer.getDocument(((DecoratorDescriptionImpl) wsdlDef).getFirstDescription());
        } catch (final WSDLException e) {
            throw new MultipleExtException(e);
        }
        return res;
    }

    public boolean getFeature(final String name) throws IllegalArgumentException {
        return this.writer.getFeature(name);
    }

    public void setFeature(final String name, final boolean value) throws IllegalArgumentException {
        this.writer.setFeature(name, value);
    }

    @SuppressWarnings("unchecked")
    public String writeMultipleExtWSDL(final AbsItfDescription wsdlDef) throws MultipleExtException {
        String res = null;
        try {
            res = this.writer.writeWSDL(((DecoratorDescriptionImpl) wsdlDef).getFirstDescription());
        } catch (final WSDLException e) {
            throw new MultipleExtException(e);
        }
        return res;
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy