@SuppressWarnings("unchecked")
    private <T> T getSOAPStub(Class<T> type) throws ServiceException,
            IOException {

        if (type == org.fcrepo.server.access.FedoraAPIAMTOM.class) {
            org.fcrepo.client.mtom.APIAStubFactory.SOCKET_TIMEOUT_SECONDS = SOCKET_TIMEOUT_SECONDS;

            URL url = m_accessMTOMEndpoint.getURL();

            String protocol = url.getProtocol();
            String host = url.getHost();
            int port = url.getPort();
            if (port == -1) {
                port = url.getDefaultPort();
            }

            return (T) org.fcrepo.client.mtom.APIAStubFactory
                    .getStub(protocol, host, port, m_user, m_pass);

        } else if (type == FedoraAPIMMTOM.class) {
            org.fcrepo.client.mtom.APIMStubFactory.SOCKET_TIMEOUT_SECONDS = SOCKET_TIMEOUT_SECONDS;

            URL url = m_managementMTOMEndpoint.getURL();

            String protocol = url.getProtocol();
            String host = url.getHost();
            int port = url.getPort();
            if (port == -1) {
                port = url.getDefaultPort();
            }

            return (T) org.fcrepo.client.mtom.APIMStubFactory
                    .getStub(protocol, host, port, m_user, m_pass);

        } else if (type == FedoraAPIM.class) {
            org.fcrepo.client.APIMStubFactory.SOCKET_TIMEOUT_SECONDS = SOCKET_TIMEOUT_SECONDS;

            URL url = m_managementEndpoint.getURL();

            String protocol = url.getProtocol();
            String host = url.getHost();
            int port = url.getPort();
            if (port == -1) {
                port = url.getDefaultPort();
            }

            return (T) org.fcrepo.client.APIMStubFactory
                    .getStub(protocol, host, port, m_user, m_pass);

        } else if (type == FedoraAPIA.class) {
            org.fcrepo.client.APIAStubFactory.SOCKET_TIMEOUT_SECONDS = SOCKET_TIMEOUT_SECONDS;

            URL url = m_accessEndpoint.getURL();

            String protocol = url.getProtocol();
            String host = url.getHost();
            int port = url.getPort();
            if (port == -1) {
                port = url.getDefaultPort();
            }

            return (T) org.fcrepo.client.APIAStubFactory
                    .getStub(protocol, host, port, m_user, m_pass);

        } else {
            throw new IllegalArgumentException("Unrecognized api class: "
                    + type.getName());
        }
    }
@ SuppressWarnings ( "unchecked" ) private < T > T getSOAPStub ( Class < T > type ) throws ServiceException , IOException { if ( type == org . fcrepo . server . access . FedoraAPIAMTOM . class ) { org . fcrepo . client . mtom . APIAStubFactory . SOCKET_TIMEOUT_SECONDS = SOCKET_TIMEOUT_SECONDS ; URL url = m_accessMTOMEndpoint . getURL ( ) ; String protocol = url . getProtocol ( ) ; String host = url . getHost ( ) ; int port = url . getPort ( ) ; if ( port == - 1 ) { port = url . getDefaultPort ( ) ; } return ( T ) org . fcrepo . client . mtom . APIAStubFactory . getStub ( protocol , host , port , m_user , m_pass ) ; } else if ( type == FedoraAPIMMTOM . class ) { org . fcrepo . client . mtom . APIMStubFactory . SOCKET_TIMEOUT_SECONDS = SOCKET_TIMEOUT_SECONDS ; URL url = m_managementMTOMEndpoint . getURL ( ) ; String protocol = url . getProtocol ( ) ; String host = url . getHost ( ) ; int port = url . getPort ( ) ; if ( port == - 1 ) { port = url . getDefaultPort ( ) ; } return ( T ) org . fcrepo . client . mtom . APIMStubFactory . getStub ( protocol , host , port , m_user , m_pass ) ; } else if ( type == FedoraAPIM . class ) { org . fcrepo . client . APIMStubFactory . SOCKET_TIMEOUT_SECONDS = SOCKET_TIMEOUT_SECONDS ; URL url = m_managementEndpoint . getURL ( ) ; String protocol = url . getProtocol ( ) ; String host = url . getHost ( ) ; int port = url . getPort ( ) ; if ( port == - 1 ) { port = url . getDefaultPort ( ) ; } return ( T ) org . fcrepo . client . APIMStubFactory . getStub ( protocol , host , port , m_user , m_pass ) ; } else if ( type == FedoraAPIA . class ) { org . fcrepo . client . APIAStubFactory . SOCKET_TIMEOUT_SECONDS = SOCKET_TIMEOUT_SECONDS ; URL url = m_accessEndpoint . getURL ( ) ; String protocol = url . getProtocol ( ) ; String host = url . getHost ( ) ; int port = url . getPort ( ) ; if ( port == - 1 ) { port = url . getDefaultPort ( ) ; } return ( T ) org . fcrepo . client . APIAStubFactory . getStub ( protocol , host , port , m_user , m_pass ) ; } else { throw new IllegalArgumentException ( "Unrecognized api class: " + type . getName ( ) ) ; } }
Get the appropriate API-A/M stub, given a SOAPEndpoint.
@param <T>