package com.openrdf.utils.url.properties;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

import org.apache.log4j.Logger;

/**
 * Utils URL Properties 单子类: 用来实例化跳转地址。
 * 
 * @description 本程序用于来自谢先斌毕业论文，如有使用请联系作 者，注明出处。
 * @URL 代码地址：http://github.com/openRDF/rdf_fronts
 * @rdf com.openrdf.utils.url.properties
 * @dateTime 2014-5-2
 * @author XieXianbin
 * @email a.b@hotmail.com
 * 
 */
public class URLPropertiesUtils {

	final static Logger log = Logger.getLogger(URLPropertiesUtils.class);
	// URL地址属性
	private static Properties URLProperties = null; 
	// CAS
	public static String RDF_CAS_HREF="RDF_CAS_HREF";
	// 后台
	public static String RDF_BACKEND_HREF="RDF_BACKEND_HREF";
	// 前台
	public static String RDF_FRONTS_HREF="RDF_FRONTS_HREF";
	
	// 获取URL地址 
	public static String getPropertiesUrl(String URLKey){
		return getURLProperties().getProperty(URLKey);
	}
	
	// 单子类 实例化
	public static Properties getURLProperties(){
		if(URLProperties == null){
			// 系统发布路径
			String systemPath = URLPropertiesUtils.class.getClassLoader().getParent().toString();
			// 网址配置文件位置
			String proFilePath = systemPath + "WEB-INF/classes/url.properties"; 
			InputStream inputStream = null;
			try {
				inputStream = new FileInputStream(proFilePath);
				URLProperties.load(inputStream);
			} catch (FileNotFoundException e) {
//				e.printStackTrace();
				log.error("Could NOT Found config.properties File in the Project dir.");
			} catch (IOException e) {
//				e.printStackTrace();
				log.error("When read config.properties Occor an IOException: " + e + ".");
			}finally{
				if(inputStream != null){
					try {
						// 关闭文件流 
						inputStream.close();
					} catch (IOException e) {
//						e.printStackTrace();
						log.error("When Close cinputStream Occor an IOException: " + e + ".");
					}
				}
			}
		}
		return URLProperties;
	}
}

@@ -700,32 +700,38 @@
 %0A%09public static 
+final 
 String RDF_CAS_H
@@ -766,32 +766,38 @@
 %0A%09public static 
+final 
 String RDF_BACKE
@@ -844,24 +844,30 @@
 blic static 
+final 
 String RDF_F
@@ -1203,25 +1203,29 @@
 .get
-Parent().toString
+Resource(%22/%22).getPath
 ();%0D
@@ -1283,24 +1283,8 @@
  + %22
-WEB-INF/classes/
 url.
@@ -1298,16 +1298,44 @@
 ies%22; %0D%0A
+%09%09%09log.debug(proFilePath);%0D%0A
 %09%09%09Input
@@ -1421,24 +1421,63 @@
 FilePath);%0D%0A
+%09%09%09%09URLProperties = new Properties();%0D%0A
 %09%09%09%09URLPrope

add url properties