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

📄 propertyutil.java

📁 这是linux下ssl vpn的实现程序
💻 JAVA
字号:
package com.sslexplorer.core;

import com.sslexplorer.boot.PropertyDefinition;
import com.sslexplorer.properties.PropertyChangeEvent;
import com.sslexplorer.properties.PropertyProfile;
import com.sslexplorer.security.SessionInfo;


/**
 * 
 * Utility methods for dealing with properties.
 * 
 * @author Brett Smith <a href="mailto: brett@3sp.com">&lt;brett@3sp.com&gt;</a>
 * @version $Revision: 1.6 $
 */
public class PropertyUtil {
	
	private static PropertyUtil pu;

	
	
	/*
	 * Constructor preventing direct instantiation
	 *
	 */
	private PropertyUtil(){		
	}
	
	/**
     * Set the value for property and fire the appropriate events. An event
     * will only be fired if the value of the property changes.
     * 
	 * @param profileId profile
	 * @param userName user
	 * @param propertyId property
	 * @param newValue new value
	 * @param info session 
	 * @return old value
	 * @throws Exception on any error
	 */
	public String setProperty(int profileId, String userName, String propertyId, String newValue, SessionInfo info) throws Exception {
		
		PropertyDefinition def = CoreServlet.getServlet().getPropertyDatabase().getPropertyDefinition(propertyId);
        PropertyProfile p = null;
		
        try {
            String oldVal = CoreServlet.getServlet().getPropertyDatabase().setProperty(profileId,
                    userName, def.getName(), newValue);
            if (!oldVal.equals(newValue)) {
                p = CoreServlet.getServlet().getPropertyDatabase().getPropertyProfile(profileId);
                CoreServlet.getServlet().fireCoreEvent(
                    new PropertyChangeEvent(pu, CoreEventConstants.PROPERTY_CHANGED, def, info, p, oldVal, newValue, PropertyChangeEvent.STATE_SUCCESSFUL));
            }
            return oldVal;
        } catch (Exception e) {
            CoreServlet.getServlet().fireCoreEvent(
                    new PropertyChangeEvent(this, CoreEventConstants.PROPERTY_CHANGED, def, info, p, null, newValue,PropertyChangeEvent.STATE_UNSUCCESSFUL));
        	throw e;
        }
		
	}

	
	/**
     * Get an instance of the property utilities.
     * 
	 * @return property utilities
	 */
	public static PropertyUtil getPropertyUtil(){
		if (pu == null) {
			pu = new PropertyUtil();
		}
		return pu;
	}

}

⌨️ 快捷键说明

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