📄 fbframeconfig.java
字号:
package com.primeton.eos.fbframe.config;
import java.io.*;
import java.net.URL;
import java.util.*;
import com.primeton.tp.common.xml.*;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import com.primeton.tp.common.xml.XmlUtil;
import com.primeton.tp.core.prservice.common.Constants;
/**
* @author PengYuanlin
* @version 1.0
* @date 2007-2-5
* @class_displayName FbFrameConfig
* 读取、修改fbframe的配置信息
*/
public class FbFrameConfig {
private static FbFrameConfig ffinstance;
private static final String source = "com/primeton/eos/fbframe/config/fbframe.properties";
private Properties pros ;
private Properties eos_webdriver_pros;
public FbFrameConfig(){
this.pros = null;
}
public static FbFrameConfig getInstance(){
if( ffinstance == null ){
ffinstance = new FbFrameConfig();
ffinstance.init();
}
return ffinstance;
}
public HashMap getAccessableJspWithNoLogin(){
HashMap AccessableJspWithNoLogin = new HashMap();
AccessableJspWithNoLogin.put(this.eos_webdriver_pros.getProperty("welcome_file"),"true");
AccessableJspWithNoLogin.put(this.pros.getProperty("noPermissionPage"),"true");
AccessableJspWithNoLogin.put("/fbrole/main/login.jsp","true");
AccessableJspWithNoLogin.put("/fbrole/main/RichClientNoPermission.jsp","true");
AccessableJspWithNoLogin.put("/fbrole/main/noResource.jsp","true");
AccessableJspWithNoLogin.put("/fbrole/main/noDiractiveAccess.jsp","true");
return AccessableJspWithNoLogin;
}
/**
* 初始化FBFrameConfig对象
*
*/
private void init(){
pros = new Properties();
try{
InputStream is = Thread.currentThread().getContextClassLoader().getResourceAsStream(FbFrameConfig.source);
pros.load(is);
is.close();
}catch(Exception ioe){
System.out.println("");
System.out.println("");
System.out.println("/**********************************************");
System.out.println("/*");
System.out.println("/* 没有发现 com/primeton/eos/fbframe/config/fbframe.properties 文件,系统将使用缺省设置 !");
System.out.println("/* passwordCryptImpl = com.primeton.eos.fbframe.fbrole.crypt.impl.EOSDefaultPasswordCryptImpl");
System.out.println("/* noPermissionPage = /fbrole/main/noPermission.jsp");
System.out.println("/*");
System.out.println("/**********************************************");
System.out.println("");
System.out.println("");
}
//初始化 加密 类
String PasswordCryptImpl = null;
try{
PasswordCryptImpl = this.pros.getProperty("passwordCryptImpl");
}catch(Exception e){
PasswordCryptImpl = null;
}
if( PasswordCryptImpl == null || PasswordCryptImpl.length() == 0){
PasswordCryptImpl = "com.primeton.eos.fbframe.fbrole.crypt.impl.EOSDefaultPasswordCryptImpl";
}
this.pros.setProperty("passwordCryptImpl",PasswordCryptImpl);
//初始化noPermission页面
String noPermissionPage = null;
try{
noPermissionPage = this.pros.getProperty("noPermissionPage");
}catch(Exception e){
noPermissionPage = null;
}
if( noPermissionPage == null || noPermissionPage.length() == 0){
noPermissionPage = "/fbrole/main/noPermission.jsp";
}
this.pros.setProperty("noPermissionPage",noPermissionPage);
}
/*
* 从EOS Server的controler的配置文件WEB-INF/web.xml中取得Constants.POSTFIX_ACTION_PARAM
* 和Constants.INIT_PORTAL_MODE 。
*/
public void init(String webxmlfile){
String portalMode = null;
String postfix = null;
String welcome_file = "/internet/login.jsp";
eos_webdriver_pros = new Properties();
try{
Document doc = null;
PrimetonDocumentFactory pdf = new PrimetonDocumentFactoryImpl();
doc = pdf.parseFile(webxmlfile);
welcome_file = XmlUtil.getNodeValue(doc,"web-app/welcome-file-list/welcome-file");
if( welcome_file == null ){
welcome_file = "/fbrole/main/login.jsp";
}else if(!welcome_file.startsWith("/")){
welcome_file = "/" + welcome_file;
}
NodeList nl = XmlUtil.findNodes(doc, "web-app/servlet/init-param/param-name");
String paramName = "";
Node curNode = null;
for (int i = 0; i < nl.getLength(); i++){
curNode = nl.item(i);
paramName = XmlUtil.getNodeValue(curNode);
if( paramName !=null && paramName.equalsIgnoreCase(Constants.INIT_PORTAL_MODE) ){
Node parent = curNode.getParentNode();
portalMode = XmlUtil.getNodeValue(parent,"init-param/param-value");
//设置portalMode的值(包括默认值)
if( portalMode == null || (!portalMode.equals("false")) )
{
portalMode = "true";
}
//决定下一步怎么走
if( postfix == null )
continue;
else
break;
}
if( paramName !=null && paramName.equalsIgnoreCase(Constants.POSTFIX_ACTION_PARAM) ){
Node parent = curNode.getParentNode();
postfix = XmlUtil.getNodeValue(parent,"init-param/param-value");
//设置展现逻辑的后缀值(包括默认值)
if( postfix == null || postfix.length() == 0 )
{
postfix = Constants.POSTFIX_ACTION;
}
//决定下一步怎么走
if( portalMode == null )
continue;
else
break;
}
}
if (portalMode == null)
portalMode = "true";
if (postfix == null)
postfix = ".do";
this.eos_webdriver_pros.setProperty("portalMode",portalMode);
this.eos_webdriver_pros.setProperty("prActionPostfix",postfix);
this.eos_webdriver_pros.setProperty("welcome_file",welcome_file);
}catch (Exception xe){
this.eos_webdriver_pros.setProperty("portalMode", "true");
this.eos_webdriver_pros.setProperty("prActionPostfix", ".do");
this.eos_webdriver_pros.setProperty("welcome_file",welcome_file);
xe.printStackTrace();
}
}
public String getNoPermissionPage(){
return this.pros.getProperty("noPermissionPage");
}
public void setNoPermissionPage(String value)throws Exception{
if( value == null || value.length() == 0 )
value="/fbrole/main/noPermission.jsp";
this.pros.setProperty("noPermissionPage",value);
}
public String getPasswordCryptImpl(){
return this.pros.getProperty("passwordCryptImpl");
}
public void setPasswordCryptImpl(String value)throws Exception{
if( value == null || value.length() == 0 )
value="com.primeton.eos.fbframe.fbrole.crypt.impl.EOSDefaultPasswordCryptImpl";
this.pros.setProperty("passwordCryptImpl",value);
}
public String getLDAPAuthImpl(){
String LDAPAuthImp = null;
try{
LDAPAuthImp = this.pros.getProperty("LDAPAuthImpl");
}catch(Exception e){
LDAPAuthImp = null;
}
return LDAPAuthImp;
}
public void setLDAPAuthImpl(String value)throws Exception{
this.pros.setProperty("LDAPAuthImpl",value);
}
public String getPrActionPostfix(){
return this.eos_webdriver_pros.getProperty("prActionPostfix");
}
public String getPortalMode(){
return this.eos_webdriver_pros.getProperty("portalMode");
}
public String getWelcomeFile(){
return this.eos_webdriver_pros.getProperty("welcome_file");
}
public void store()throws Exception{
URL u = Thread.currentThread().getContextClassLoader().getResource(FbFrameConfig.source);
FileOutputStream op = new FileOutputStream(u.getFile());
pros.store(op,"fbframe configration");
op.close();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -