Package de.netseeker.ejoe.ext.wsif

Source Code of de.netseeker.ejoe.ext.wsif.WSIFDynamicProvider_EJOE

/*********************************************************************
* WSIFDynamicProvider_EJOE.java
* created on 13.07.2006 by netseeker
* $Source$
* $Date$
* $Revision$
*
* ====================================================================
*
*  Copyright 2006 netseeker aka Michael Manske
*
*  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.
* ====================================================================
*
* This file is part of the EJOE framework.
* For more information on the author, please see
* <http://www.manskes.de/>.
*
*********************************************************************/

package de.netseeker.ejoe.ext.wsif;

import java.util.Iterator;
import java.util.List;

import javax.wsdl.Binding;
import javax.wsdl.Definition;
import javax.wsdl.Port;
import javax.wsdl.Service;

import org.apache.wsif.WSIFException;
import org.apache.wsif.WSIFPort;
import org.apache.wsif.logging.Trc;
import org.apache.wsif.providers.WSIFDynamicTypeMap;
import org.apache.wsif.spi.WSIFProvider;

import de.netseeker.ejoe.ext.wsif.wsdl.EJOEBinding;

/**
* WSIF dynamic provider for EJOE To set it manuelly in your WSIF client code use:
*
* <pre>
* // create a service factory
* WSIFServiceFactory factory = WSIFServiceFactory.newInstance();
*
* WSIFServiceImpl.setDynamicWSIFProvider( &quot;http://schemas.xmlsoap.org/wsdl/ejoe/&quot;, new WSIFDynamicProvider_EJOE() );
*
* WSIFServiceImpl.addExtensionRegistry( new EJOEExtensionsRegistry() );
* </pre>
*
* @author netseeker
* @since 0.3.9.1
*/
public class WSIFDynamicProvider_EJOE implements WSIFProvider
{
    private static final String[] supportedBindingNamespaceURIs = { "http://schemas.xmlsoap.org/wsdl/ejoe/" };

    private static final String[] supportedAddressNamespaceURIs = { "http://schemas.xmlsoap.org/wsdl/ejoe/" };

    public WSIFDynamicProvider_EJOE()
    {
        Trc.entry( this );
        Trc.exit();
    }

    /**
     * Check if WSDL port has EJOE binding and if successful try to create EJOE port instance.
     */
    public WSIFPort createDynamicWSIFPort( Definition def, Service service, Port port, WSIFDynamicTypeMap typeMap )
            throws WSIFException
    {
        Trc.entry( this, def, service, port, typeMap );

        // check that Port binding has EJOE binding extensibility element
        Binding binding = port.getBinding();
        List exs = binding.getExtensibilityElements();
        for ( Iterator i = exs.iterator(); i.hasNext(); )
        {
            Object o = i.next();
            if ( o instanceof EJOEBinding )
            {
                // if so try to create Java dynamic port instance
                WSIFPort wp = new WSIFPort_EJOE( def, port, typeMap );
                Trc.exit( wp );
                return wp;
            }
        }

        // otherwise return null (so other providers can be checked)
        Trc.exit();
        return null;
    }

    /**
     * Returns the WSDL namespace URIs of any bindings this provider supports.
     *
     * @return an array of all binding namespaces supported by this provider
     */
    public String[] getBindingNamespaceURIs()
    {
        Trc.entry( this );
        Trc.exit( supportedBindingNamespaceURIs );
        return supportedBindingNamespaceURIs;
    }

    /**
     * Returns the WSDL namespace URIs of any port addresses this provider supports.
     *
     * @return an array of all address namespaces supported by this provider
     */
    public String[] getAddressNamespaceURIs()
    {
        Trc.entry( this );
        Trc.exit( supportedAddressNamespaceURIs );
        return supportedAddressNamespaceURIs;
    }
}
TOP

Related Classes of de.netseeker.ejoe.ext.wsif.WSIFDynamicProvider_EJOE

TOP
Copyright © 2018 www.massapi.com. 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.