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

📄 uddiproxy.java

📁 可以实现UDDI
💻 JAVA
📖 第 1 页 / 共 5 页
字号:
/*
 * The source code contained herein is licensed under the IBM Public License
 * Version 1.0, which has been approved by the Open Source Initiative.
 * Copyright (C) 2001, International Business Machines Corporation
 * Copyright (C) 2001, Hewlett-Packard Company
 * All Rights Reserved.
 *
 */
package org.uddi4j.client;

import java.io.IOException;
import java.io.InputStream;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.Arrays;
import java.util.Properties;
import java.util.Vector;

import org.uddi4j.UDDIElement;
import org.uddi4j.UDDIException;
import org.uddi4j.datatype.Name;
import org.uddi4j.datatype.assertion.PublisherAssertion;
import org.uddi4j.request.AddPublisherAssertions;
import org.uddi4j.request.DeleteBinding;
import org.uddi4j.request.DeleteBusiness;
import org.uddi4j.request.DeletePublisherAssertions;
import org.uddi4j.request.DeleteService;
import org.uddi4j.request.DeleteTModel;
import org.uddi4j.request.DiscardAuthToken;
import org.uddi4j.request.FindBinding;
import org.uddi4j.request.FindBusiness;
import org.uddi4j.request.FindRelatedBusinesses;
import org.uddi4j.request.FindService;
import org.uddi4j.request.FindTModel;
import org.uddi4j.request.GetAssertionStatusReport;
import org.uddi4j.request.GetAuthToken;
import org.uddi4j.request.GetBindingDetail;
import org.uddi4j.request.GetBusinessDetail;
import org.uddi4j.request.GetBusinessDetailExt;
import org.uddi4j.request.GetPublisherAssertions;
import org.uddi4j.request.GetRegisteredInfo;
import org.uddi4j.request.GetServiceDetail;
import org.uddi4j.request.GetTModelDetail;
import org.uddi4j.request.SaveBinding;
import org.uddi4j.request.SaveBusiness;
import org.uddi4j.request.SaveService;
import org.uddi4j.request.SaveTModel;
import org.uddi4j.request.SetPublisherAssertions;
import org.uddi4j.request.ValidateValues;
import org.uddi4j.response.AssertionStatusReport;
import org.uddi4j.response.AuthToken;
import org.uddi4j.response.BindingDetail;
import org.uddi4j.response.BusinessDetail;
import org.uddi4j.response.BusinessDetailExt;
import org.uddi4j.response.BusinessList;
import org.uddi4j.response.CompletionStatus;
import org.uddi4j.response.DispositionReport;
import org.uddi4j.response.PublisherAssertions;
import org.uddi4j.response.RegisteredInfo;
import org.uddi4j.response.RelatedBusinessesList;
import org.uddi4j.response.ServiceDetail;
import org.uddi4j.response.ServiceList;
import org.uddi4j.response.TModelDetail;
import org.uddi4j.response.TModelList;
import org.uddi4j.transport.TransportException;
import org.uddi4j.transport.TransportFactory;
import org.uddi4j.util.AuthInfo;
import org.uddi4j.util.CategoryBag;
import org.uddi4j.util.DiscoveryURLs;
import org.uddi4j.util.FindQualifiers;
import org.uddi4j.util.IdentifierBag;
import org.uddi4j.util.KeyedReference;
import org.uddi4j.util.TModelBag;
import org.uddi4j.util.UploadRegister;
import org.w3c.dom.Element;

/**
 * Represents a UDDI server and the actions that can be
 * invoked against it.<P>
 *
 * The API is described in the UDDI API specification
 * available from <A HREF="http://www.uddi.org">
 * http://www.uddi.org </A>.
 *
 * The UDDI API specification is required to understand
 * and utilize this API. This class attempts to closely
 * pattern the API document.<P>
 * 
 * @author David Melgar (dmelgar@us.ibm.com)
 * @author Ravi Trivedi (ravi_trivedi@hp.com)
 * @author Vivek Chopra (vivek@soaprpc.com)
 * @author Ozzy (ozzy@hursley.ibm.com)
 */
public class UDDIProxy
{
    // Variables
    protected URL inquiryURL = null;
    protected URL publishURL = null;
    TransportFactory transportFactory = null;
    Properties config = null;
    private Properties cachedUddi4jPropertiesFile;

    public static final String INQUIRY_URL_PROPERTY = "org.uddi4j.inquiryURL";
    public static final String PUBLISH_URL_PROPERTY = "org.uddi4j.publishURL";
    public static final String LOGGING_PROPERTY = "org.uddi4j.logEnabled";
    public static final String HTTP_BASIC_AUTH_USERNAME_PROPERTY = "http.basicAuthUserName";
    public static final String HTTP_BASIC_AUTH_PASSWORD_PROPERTY = "http.basicAuthPassword";
    public static final String HTTP_PROXY_HOST_PROPERTY = "http.proxyHost";
    public static final String HTTP_PROXY_PORT_PROPERTY = "http.proxyPort";
    public static final String HTTP_PROXY_USERNAME_PROPERTY = "http.proxyUserName";
    public static final String HTTP_PROXY_PASSWORD_PROPERTY = "http.proxyPassword";
    //The transport class name property is also a field of the TransportFactory but we include it here for completeness.
    public final static String TRANSPORT_CLASSNAME_PROPERTY = TransportFactory.PROPERTY_NAME;

    private static final String[] propertyNames = { INQUIRY_URL_PROPERTY, PUBLISH_URL_PROPERTY, LOGGING_PROPERTY, HTTP_BASIC_AUTH_USERNAME_PROPERTY,
            HTTP_BASIC_AUTH_PASSWORD_PROPERTY, HTTP_PROXY_HOST_PROPERTY, HTTP_PROXY_PORT_PROPERTY, HTTP_PROXY_USERNAME_PROPERTY, HTTP_PROXY_PASSWORD_PROPERTY,
            TRANSPORT_CLASSNAME_PROPERTY };

    /**
     * Default constructor.
     */
    public UDDIProxy()
    {
        try
        {
            //generate the complete set of properties to use.
            //We pass in an empty Properties object because the user did not specify
            //any properties.
            setConfiguration(new Properties());
        }
        catch (MalformedURLException e)
        {
            //Do nothing.  This will never happen because the properties object we passed in
            //does not contain values for the inqiury or publish URLs.
        }
    }

    /**
     * Construct a UDDIProxy object.
     *
     * @param inquiryURL URL to be used for inquiry requests.
     * @param publishURL URL to be used for publish requests.
     */
    public UDDIProxy(URL inquiryURL, URL publishURL)
    {
        Properties props = new Properties();
        if (inquiryURL != null)
        {
            props.setProperty(INQUIRY_URL_PROPERTY, inquiryURL.toString());
        }
        if (publishURL != null)
        {
            props.setProperty(PUBLISH_URL_PROPERTY, publishURL.toString());
        }
        try
        {
            //generate the complete set of properties to use
            setConfiguration(props);
        }
        catch (MalformedURLException e)
        {
            //Do nothing.  This will never happen because the the url Strings must be well-formed
            //URLs because they were created from the URL objects.          
        }
    }

    /**
     * Construct a UDDIProxy object
     * 
     * @param p      Properties object which contains configuration information for
     *               UDDI4J. This properties object overrides settings normally retrieved
     *               from system properties, which in turn override those in the
     * 				uddi4j.properties file.
     *               <P>
     *               This object may also specify properties affecting UDDIProxy.
     *               Current settings affected by this properties object include:
     *               <DL>
     *               <DT>org.uddi4j.TransportClassName
     *               <DD>Specifies the name of the SOAP transport support class.
     *               Options include, org.uddi4j.transport.ApacheSOAPTransport,
     *               org.uddi4j.transport.ApacheAxisTransport,
     *               org.uddi4j.transport.HPSOAPTransport.
     *               <DT>org.uddi4j.inquiryURL
     *               <DD>The URL to be used by UDDIProxy for inquiry requests.
     *               setInquiryURL method overrides.
     *               <DT>org.uddi4j.publishURL
     *               <DD>The URL to be used by UDDIProxy for publish requests.
     *               setPublishURL methods override.
     *               <DT>org.uddi4j.logEnabled
     *               <DD>Set this property to true to enable logging to System.err. 
     *               </DL>
     * @exception java.net.MalformedURLException In case the publish or
     *            inquiry URLs are malformed.
     */
    public UDDIProxy(Properties p) throws MalformedURLException
    {
        setConfiguration(p);
    }

    /**
     * Set the configuration properties
     * 
     * @param props Properties object containing configuration information. See
     * {@link #UDDIProxy(Properties)} for configuration details.
     * @exception java.net.MalformedURLException In case the publish or
     *            inquiry URLs are malformed.
     */
    public void setConfiguration(Properties props) throws MalformedURLException
    {

        //For each uddi4j property individually, the order of precedence (highest first) of property values is:
        //1. Properties object passed to this method.
        //2. System properties
        //3. uddi4j.properties file
        //4. default properties (the only default property is the transport class which is ApacheSoapTransport)

        //We create the properties object to be used by starting with the default properties and
        //overriding these in increasing order of precedence to create the set of properties to be used.

        //Note that we are using a new properties object, not the one passed in, because
        //we don't want to modify the one passed in because, for example, it might
        //be the System properties object.
        this.config = new Properties();
        config.setProperty(TransportFactory.PROPERTY_NAME, TransportFactory.DEFAULT_TRANSPORT_NAME); //the only required default property

        //Now load uddi4j.properties file (if not already cached) - this takes precendence over the defaults
        Exception exception = null;
        try
        {
            if (cachedUddi4jPropertiesFile == null)
            {
                //We have not loaded the uddi4j.properties file yet.  Load it now.
                cachedUddi4jPropertiesFile = new Properties();
                InputStream inputStream = this.getClass().getClassLoader().getResourceAsStream("uddi4j.properties");
                if (inputStream != null)
                {
                    //uddi4j.properties file found
                    cachedUddi4jPropertiesFile.load(inputStream);
                }
                //else uddi4j.properties file could not be found.
                //Just leave the cachedUddi4jPropertiesFile object empty.
            }

            //override the default props with any contained in the uddi4j.properties file
            //The config Properties object is modified as a result.
            overrideProperties(config, cachedUddi4jPropertiesFile);
        }
        catch (IOException e)
        {
            //We found the uddi4j.properties file but couldn't read it for some reason.
            //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;
        }
        catch (IllegalArgumentException e)
        {

⌨️ 快捷键说明

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