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

📄 uddiproxy.java

📁 可以实现UDDI
💻 JAVA
📖 第 1 页 / 共 5 页
字号:
            //The input stream contained a malformed unicode escape sequence.
            //Do not throw the exception but instead log it to System.err.
            //We will log it at the *end* of this method, when we will know if logging is enabled.     
            exception = e;
        }

        //The next set of properties in increasing order of preference is the System properties.
        //System properties take precedence over the uddi4j.properties file, for
        //compatibility with earlier releases.  E.g. if a user is using System properties to
        //specify uddi4j properties, the presence of a properties file when they upgrade to
        //UDDI4J 2.0.4 may cause the behaviour to change if this properties file took precedence
        //over the system properties.  This is obviously is undesirable.

        //override the config properties with any uddi4j properties found in the System properties.
        overrideProperties(config, System.getProperties());

        //finally override the properties with any uddi4j properties found in the Properties object passed to this method,
        //as these take precedence over all other sources of properties.
        overrideProperties(config, props);

        //Set the inquiry and publish URLs from the properties, if present.
        //don't pass null URL strings into the URL constructors or we will get a MalformedURLException
        if (config.getProperty(INQUIRY_URL_PROPERTY) != null)
        {
            setInquiryURL(config.getProperty(INQUIRY_URL_PROPERTY));
        }
        else
        {
            //no inquiryURL config property was present.  If the inquiryURL was previously set,
            //make sure we keep the config properties and the URLs consistent.
            if (inquiryURL != null)
            {
                config.setProperty(INQUIRY_URL_PROPERTY, inquiryURL.toString());
            }
        }

        if (config.getProperty(PUBLISH_URL_PROPERTY) != null)
        {
            setPublishURL(config.getProperty(PUBLISH_URL_PROPERTY));
        }
        else
        {
            //no publishURL config property was present.  If the publishURL was previously set,
            //make sure we keep the config properties and the URLs consistent.
            if (publishURL != null)
            {
                config.setProperty(PUBLISH_URL_PROPERTY, publishURL.toString());
            }
        }

        //Finally create the transport factory instance based on the config properties we have built up. 
        transportFactory = TransportFactory.newInstance(config);

        if (logEnabled())
        {
            if (exception != null)
            {
                System.err.println("Ignoring exception that occurred while reading the uddi4j.properties file: " + exception);
            }
            //We don't want to print out the passwords, so if logging is enabled then clone a copy of the config properties
            //to print, and overwrite the passwords with stars.  If users really need to print the passwords in order
            //to debug then they can do that in their own client code.

            Properties configCopyToPrint = (Properties) config.clone();

            String[] passwordProperties = { HTTP_BASIC_AUTH_PASSWORD_PROPERTY, HTTP_PROXY_PASSWORD_PROPERTY };
            for (int i = 0; i < passwordProperties.length; i++)
            {
                if (configCopyToPrint.getProperty(passwordProperties[i]) != null)
                {
                    configCopyToPrint.setProperty(passwordProperties[i], "********");
                }
            }

            System.err.println("Configuration properties set: " + configCopyToPrint);            
        }
    }

    /**
     * Urility method to override the basic properties with any uddi4j properties contained in the overriding properties.
     * overriding will remain unchanged.  basic will be altered if overriding contains
     * any uddi4j properties. 
     */
    private void overrideProperties(Properties basic, Properties overriding)
    {
        if (basic != null && overriding != null)
        {
            for (int i = 0; i < propertyNames.length; i++)
            {
                if (overriding.getProperty(propertyNames[i]) != null)
                {
                    basic.setProperty(propertyNames[i], overriding.getProperty(propertyNames[i]));
                }
            }
        }
    }

    public boolean logEnabled()
    {
        //config will never be null
        return Boolean.valueOf(config.getProperty(LOGGING_PROPERTY)).booleanValue();
    }

    /**
     * Get the configuration properties currently in use
     * @return The configuration properties
     */
    public Properties getConfiguration()
    {
        return config;
    }

    /**
     * Set the URL to be used for inquiry requests.
     *
     * @param url Inquiry URL string
     * @exception java.net.MalformedURLException In case the Inquiry URL is
     * malformed.
     */
    public void setInquiryURL(String url) throws java.net.MalformedURLException
    {
        setInquiryURL(new URL(url));
    }

    /**
     * Set the URL to be used for inquiry requests.
     *
     * @param url Inquiry URL
     */
    public void setInquiryURL(URL url)
    {
        this.inquiryURL = url;
        //Keep the config up to date.
        if (inquiryURL != null)
        {
            config.setProperty(INQUIRY_URL_PROPERTY, url.toString());
        }
        else
        {
            config.remove(INQUIRY_URL_PROPERTY);
        }
        //refresh the transport factory
        transportFactory = TransportFactory.newInstance(config);

    }

    /**
     * Set the URL to be used for publish requests. If
     * HTTPS is specified as the procotol, it must be added
     * as a supported protocol. For Sun's SSL support, this can be done
     * with the following code fragment:
     * <PRE>
     *    System.setProperty("java.protocol.handler.pkgs",
     *                       "com.sun.net.ssl.internal.www.protocol");
     *    java.security.Security.addProvider(new com.sun.net.ssl.internal.ssl.Provider());
     * </PRE>
     *
     * @param url
     * @exception java.net.MalformedURLException
     *                   Thrown if HTTPS is not registered as a valid URL protocol.
     */
    public void setPublishURL(String url) throws java.net.MalformedURLException
    {
        setPublishURL(new URL(url));
    }

    /**
     * Set the URL to be used for publish requests.
     *
     * @param url Publish URL
     */
    public void setPublishURL(URL url)
    {
        this.publishURL = url;
        //Keep the config up to date.
        if (publishURL != null)
        {
            config.setProperty(PUBLISH_URL_PROPERTY, url.toString());
        }
        else
        {
            config.remove(PUBLISH_URL_PROPERTY);
        }
        //refresh the transport factory
        transportFactory = TransportFactory.newInstance(config);
    }

    /**
     * The find_binding method returns a bindingDetail message that contains
     * a bindingTemplates structure with zero or more bindingTemplate structures
     * matching the criteria specified in the argument list.
     *
     * @param findQualifiers
     *                   This collection of findQualifier elements can be used to alter the default
     *                   behavior of search functionality.
     * @param serviceKey Used to specify a particular instance of a businessService element
     *                   in the registered data.  Only bindings in the specific businessService
     *                   data identified by the serviceKey passed will be searched.
     * @param tModelBag  This is a list of tModel uuid_key values that represent the technical
     *                   fingerprint to locate in a bindingTemplate structure contained within
     *                   the businessService instance specified by the serviceKey value.  If more
     *                   than one tModel key is specified in this structure, only bindingTemplate
     *                   information that exactly matches all of the tModel keys specified will
     *                   be returned (logical AND).  The order of the keys in the tModelBag is
     *                   not relevant.  All tModelKey values begin with a uuid URN qualifier
     *                   (e.g. "uuid:" followed by a known tModel UUID value.
     * @param maxRows    This optional integer value allows the requesting program to limit
     *                   the number of results returned.
     * @return This function returns a bindingDetail message on success.  In the event that no matches were
     * located for the specified criteria, the bindingDetail structure returned in the response the will be
     * empty (e.g. contain no bindingTemplate data.)
     *         In the even of a large number of matches, an Operator Site may truncate the result set.  If
     * this occurs, the response message will contain the truncated attribute with the value of this attribute
     * set to true.
     *         Searching using tModelBag will also return any bindingTemplate information that matches due to
     * hostingRedirector references.  The resolved bindingTemplate structure will be returned, even if that
     * bindingTemplate is owned by a different businessService structure.
     * @exception UDDIException
     * @exception TransportException
     */
    public BindingDetail find_binding(FindQualifiers findQualifiers, String serviceKey, TModelBag tModelBag, int maxRows) throws UDDIException,
            TransportException
    {
        FindBinding request = new FindBinding();
        request.setFindQualifiers(findQualifiers);
        request.setServiceKey(serviceKey);
        request.setTModelBag(tModelBag);
        if (maxRows > 0)
            request.setMaxRows(maxRows);
        return new BindingDetail(send(request, true));
    }

    /**
     * Find business matching specified criteria.
     *
     * @param name    Partial business name to match. Leftmost match.
     * @param findQualifiers
     *                Optional findQualifiers. null indicates no find
     *                qualifiers.
     * @param maxRows Maximum number of results. 0 indicates no maximum.
     * @return This function returns a businessList on success.  In the event that no
     *         matches were located for the specified criteria, a businessList
     *         structure with zero businessInfo structures is returned.
     * @exception UDDIException
     *                   Contains a DispositionReport that indicates the
     *                   error number.
     * @exception TransportException
     *                   Thrown if non-UDDI related communication errors occur.
     * @deprecated This method has been deprecated. Use
     * {@link #find_business(Vector, DiscoveryURLs, IdentifierBag, CategoryBag, TModelBag,
     *                       FindQualifiers, int)} instead
     *
     */
    public BusinessList find_business(String name, FindQualifiers findQualifiers, int maxRows) throws UDDIException, TransportException
    {
        Vector names = new Vector();

⌨️ 快捷键说明

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