⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 typemappingregistryimpl.java

📁 Java有关XML编程需要用到axis 的源代码 把里面bin下的包导入相应的Java工程 进行使用
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
//        namespaceURI = "";        if (mapping == null ||             !(mapping instanceof TypeMappingDelegate)) {            throw new IllegalArgumentException(                    Messages.getMessage("badTypeMapping"));        }         if (namespaceURI == null) {            throw new java.lang.IllegalArgumentException(                    Messages.getMessage("nullNamespaceURI"));        }        TypeMappingDelegate del = (TypeMappingDelegate)mapping;        TypeMappingDelegate old = (TypeMappingDelegate)mapTM.get(namespaceURI);        if (old == null) {            del.setNext(defaultDelTM);        } else {            del.setNext(old);        }        mapTM.put(namespaceURI, del);        return old; // Needs works    }        /**     * The method register adds a default TypeMapping instance.  If a specific     * TypeMapping is not found, the default TypeMapping is used.       *     * @param mapping - TypeMapping for specific type namespaces     *     * java.lang.IllegalArgumentException -      * if an invalid type mapping is specified or the delegate is already set     */    public void registerDefault(javax.xml.rpc.encoding.TypeMapping mapping) {        if (mapping == null ||            !(mapping instanceof TypeMappingDelegate)) {            throw new IllegalArgumentException(                    Messages.getMessage("badTypeMapping"));        }        /* Don't allow this call after the delegate() method since         * the TMR's TypeMappings will be using the default type mapping         * of the secondary TMR.         */        if (defaultDelTM.getNext() != null) {            throw new IllegalArgumentException(                    Messages.getMessage("defaultTypeMappingSet"));        }        defaultDelTM = (TypeMappingDelegate)mapping;    }    /**     * Set up the default type mapping (and the SOAP encoding type mappings)     * as per the passed "version" option.     *     * @param version     */    public void doRegisterFromVersion(String version) {        if (version == null || version.equals("1.0") || version.equals("1.2")) {            TypeMappingImpl.dotnet_soapenc_bugfix = false;            // Do nothing, just register SOAPENC mapping        } else if (version.equals("1.1")) {            TypeMappingImpl.dotnet_soapenc_bugfix = true;            // Do nothing, no SOAPENC mapping            return;        } else if (version.equals("1.3")) {            // Reset the default TM to the JAXRPC version, then register SOAPENC            defaultDelTM = new TypeMappingDelegate(                    DefaultJAXRPC11TypeMappingImpl.getSingleton());        } else {            throw new RuntimeException(                    Messages.getMessage("j2wBadTypeMapping00"));        }        registerSOAPENCDefault(                new TypeMappingDelegate(DefaultSOAPEncodingTypeMappingImpl.                                        getSingleton()));    }    /**     * Force registration of the given mapping as the SOAPENC default mapping     * @param mapping     */    private void registerSOAPENCDefault(TypeMappingDelegate mapping) {        // This get a bit ugly as we do not want to just overwrite        // an existing type mapping for SOAP encodings.  This happens        // when {client,server}-config.wsdd defines a type mapping for        // instance.        if (!mapTM.containsKey(Constants.URI_SOAP11_ENC)) {            mapTM.put(Constants.URI_SOAP11_ENC, mapping);        } else {            // We have to make sure the default type mapping is            // at the end of the chain.            // This is important if the default is switched to            // the JAX_RPC 1.1 default type mapping!            TypeMappingDelegate del =                    (TypeMappingDelegate) mapTM.get(Constants.URI_SOAP11_ENC);            while (del.getNext() != null && ! (del.delegate instanceof DefaultTypeMappingImpl)) {                del = del.getNext();            }            del.setNext(defaultDelTM);        }        if (!mapTM.containsKey(Constants.URI_SOAP12_ENC)) {            mapTM.put(Constants.URI_SOAP12_ENC, mapping);        } else {            // We have to make sure the default type mapping is            // at the end of the chain.            // This is important if the default is switched to            // the JAX_RPC 1.1 default type mapping!            TypeMappingDelegate del =                    (TypeMappingDelegate) mapTM.get(Constants.URI_SOAP12_ENC);            while (del.getNext() != null && ! (del.delegate instanceof DefaultTypeMappingImpl)) {                del = del.getNext();            }            del.setNext(defaultDelTM);        }                // Just do this unconditionally in case we used mapping.        // This is important if the default is switched to        // the JAX_RPC 1.1 default type mapping!        mapping.setNext(defaultDelTM);    }    /**     * Gets the TypeMapping for the namespace.  If not found, the default     * TypeMapping is returned.     *     * @param namespaceURI - The namespace URI of a Web Service     * @return The registered TypeMapping      * (which may be the default TypeMapping) or null.     */    public javax.xml.rpc.encoding.TypeMapping         getTypeMapping(String namespaceURI) {//        namespaceURI = "";        TypeMapping del = (TypeMappingDelegate) mapTM.get(namespaceURI);        if (del == null) {            del = (TypeMapping)getDefaultTypeMapping();        }        return del;    }    /**     * Obtain a type mapping for the given encodingStyle.  If no specific     * mapping exists for this encodingStyle, we will create and register     * one before returning it.     *      * @param encodingStyle     * @return a registered TypeMapping for the given encodingStyle     */     public TypeMapping getOrMakeTypeMapping(String encodingStyle) {        TypeMappingDelegate del = (TypeMappingDelegate) mapTM.get(encodingStyle);        if (del == null || del.delegate instanceof DefaultTypeMappingImpl) {            del = (TypeMappingDelegate)createTypeMapping();            del.setSupportedEncodings(new String[] {encodingStyle});            register(encodingStyle, del);        }        return del;    }    /**     * Unregisters the TypeMapping for the namespace.     *     * @param namespaceURI - The namespace URI     * @return The registered TypeMapping .     */    public javax.xml.rpc.encoding.TypeMapping         unregisterTypeMapping(String namespaceURI) {        return (TypeMappingDelegate)mapTM.remove(namespaceURI);    }    /**     * Removes the TypeMapping for the namespace.     *     * @param mapping The type mapping to remove     * @return true if found and removed     */    public boolean removeTypeMapping(                                  javax.xml.rpc.encoding.TypeMapping mapping) {        String[] ns = getRegisteredEncodingStyleURIs();        boolean rc = false;        for (int i=0; i < ns.length; i++) {            if (getTypeMapping(ns[i]) == mapping) {                rc = true;                unregisterTypeMapping(ns[i]);            }        }        return rc;    }    /**     * Creates a new empty TypeMapping object for the specified     * encoding style or XML schema namespace.     *     * @return An empty generic TypeMapping object     */    public javax.xml.rpc.encoding.TypeMapping createTypeMapping() {        TypeMappingImpl impl = new TypeMappingImpl();        TypeMappingDelegate del = new TypeMappingDelegate(impl);        del.setNext(defaultDelTM);        return del;    }            /**     * Gets a list of namespace URIs registered with this TypeMappingRegistry.     *     * @return String[] containing names of all registered namespace URIs     */    public String[] getRegisteredEncodingStyleURIs() {        java.util.Set s = mapTM.keySet();         if (s != null) {             String[] rc = new String[s.size()];            int i = 0;            java.util.Iterator it = s.iterator();            while(it.hasNext()) {                rc[i++] = (String) it.next();            }            return rc;        }        return null;    }     /**     * Removes all TypeMappings and namespaceURIs from this TypeMappingRegistry.     */    public void clear() {        mapTM.clear();    }    /**     * Return the default TypeMapping     * @return TypeMapping or null     **/    public javax.xml.rpc.encoding.TypeMapping getDefaultTypeMapping() {        return defaultDelTM;    }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -