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

📄 globalproperties.java

📁 OpenWeb-UDDI是UDDI V2标准的实现
💻 JAVA
字号:
package org.huihoo.openweb.uddiserver.util;

import java.util.Properties;
import java.net.URL;
import java.io.IOException;



/**
 *  GlobalProperties.java
 * 
 *  
 *  @author <a href="mailto:powertyrael@163.net">Darth Vader</a> and <a href="mailto:13975192956@hnmcc.com">Spring</a>  create at 20:45:56 on 2003-5-6
 *  
 *  @version 1.0 alpha
 */
public class GlobalProperties
{
    static String url;
    static String className;
    static String user;
    static String password;
    static String operatorName;
	static String authorisedName;
    static boolean isUpdated=false;
	static ClassLoader cl;

	public static void setClassLoader( ClassLoader loader)
	{
		cl = loader;
	}

    public static void readProperties()
        throws IOException
    {
		URL url1 = cl.getResource("conf/eduuddi.config");
		Properties props = new Properties();
		if(url1==null)
			throw new IOException("eduuddi.config not found");
		props.load(url1.openStream());
		className = props.getProperty("Class");
		url = props.getProperty("URL");
		user = 	props.getProperty("user");
		password =props.getProperty("passwd");
		operatorName = props.getProperty("operator");
		authorisedName = props.getProperty("authorisedName");
		isUpdated=true;
    }

    public static void reReadFromFile()
    {
        isUpdated=false;
    }

    public static String getURL()
        throws IOException
    {
        if( isUpdated) {
            return url;
        }
        readProperties();
        return url;
    }

    public static String getClassName()
        throws IOException
    {
        if( isUpdated) {
            return className;
        }
        readProperties();
        return className;
    }

    public static String getUser()
        throws IOException
    {
        if( isUpdated) {
            return user;
        }
        readProperties();
        return user;
    }

    public static String getPassword()
        throws IOException
    {
        if( isUpdated) {
            return password;
        }
        readProperties();
        return password;
    }

    public static String getOperatorName()
        throws IOException
    {
        if( isUpdated) {
            return operatorName;
        }
        readProperties();
        return operatorName;
    }

    public static String getAuthorisedName()
        throws IOException
    {
        if( isUpdated) {
            return authorisedName;
        }
        readProperties();
        return authorisedName;
    }
}

⌨️ 快捷键说明

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