提交 224fcbf4 编写于 作者: 黄勇

【I】优化相关配置属性的名称

上级 6c7c27e0
......@@ -14,7 +14,7 @@ public class ClassHelper {
/**
* 获取基础包名
*/
private static final String basePackage = ConfigHelper.getString("app.base_package");
private static final String basePackage = ConfigHelper.getString("smart.framework.app.base_package");
/**
* 获取 ClassScanner
......
......@@ -9,8 +9,8 @@ public interface FrameworkConstant {
String PLUGIN_PACKAGE = "org.smart4j.plugin";
String JSP_PATH = ConfigHelper.getString("app.jsp_path", "/WEB-INF/jsp/");
String WWW_PATH = ConfigHelper.getString("app.www_path", "/www/");
String HOME_PAGE = ConfigHelper.getString("app.home_page", "/index.html");
int UPLOAD_LIMIT = ConfigHelper.getInt("app.upload_limit", 10);
String JSP_PATH = ConfigHelper.getString("smart.framework.app.jsp_path", "/WEB-INF/jsp/");
String WWW_PATH = ConfigHelper.getString("smart.framework.app.www_path", "/www/");
String HOME_PAGE = ConfigHelper.getString("smart.framework.app.home_page", "/index.html");
int UPLOAD_LIMIT = ConfigHelper.getInt("smart.framework.app.upload_limit", 10);
}
......@@ -32,32 +32,32 @@ public class InstanceFactory {
/**
* ClassScanner
*/
private static final String CLASS_SCANNER = "smart.class_scanner";
private static final String CLASS_SCANNER = "smart.framework.custom.class_scanner";
/**
* DataSourceFactory
*/
private static final String DS_FACTORY = "smart.ds_factory";
private static final String DS_FACTORY = "smart.framework.custom.ds_factory";
/**
* HandlerMapping
*/
private static final String HANDLER_MAPPING = "smart.handler_mapping";
private static final String HANDLER_MAPPING = "smart.framework.custom.handler_mapping";
/**
* HandlerInvoker
*/
private static final String HANDLER_INVOKER = "smart.handler_invoker";
private static final String HANDLER_INVOKER = "smart.framework.custom.handler_invoker";
/**
* HandlerExceptionResolver
*/
private static final String HANDLER_EXCEPTION_RESOLVER = "smart.handler_exception_resolver";
private static final String HANDLER_EXCEPTION_RESOLVER = "smart.framework.custom.handler_exception_resolver";
/**
* ViewResolver
*/
private static final String VIEW_RESOLVER = "smart.view_resolver";
private static final String VIEW_RESOLVER = "smart.framework.custom.view_resolver";
/**
* 获取 ClassScanner
......
......@@ -59,7 +59,7 @@ public class DatabaseHelper {
/**
* 数据库类型
*/
private static final String databaseType = ConfigHelper.getString("jdbc.type");
private static final String databaseType = ConfigHelper.getString("smart.framework.jdbc.type");
/**
* 数据源
......
......@@ -13,10 +13,10 @@ import org.smart4j.framework.util.StringUtil;
*/
public abstract class AbstractDataSourceFactory<T extends DataSource> implements DataSourceFactory {
protected String driver = ConfigHelper.getString("jdbc.driver");
protected String url = ConfigHelper.getString("jdbc.url");
protected String username = ConfigHelper.getString("jdbc.username");
protected String password = ConfigHelper.getString("jdbc.password");
protected final String driver = ConfigHelper.getString("smart.framework.jdbc.driver");
protected final String url = ConfigHelper.getString("smart.framework.jdbc.url");
protected final String username = ConfigHelper.getString("smart.framework.jdbc.username");
protected final String password = ConfigHelper.getString("smart.framework.jdbc.password");
@Override
public final T getDataSource() {
......
......@@ -35,7 +35,7 @@ public class I18NFilter implements Filter {
String systemLanguage = getSystemLanguage((HttpServletRequest) request);
request.setAttribute(I18NConstant.SYSTEM_LANGUAGE, systemLanguage);
// 判断是否重新
boolean reloadable = ConfigHelper.getConfigBoolean("i18n.reloadable");
boolean reloadable = ConfigHelper.getConfigBoolean("smart.plugin.i18n.reloadable");
if (reloadable) {
// 清理 ResourceBundle 缓存
ResourceBundle.clearCache();
......
......@@ -4,27 +4,27 @@ import org.smart4j.framework.core.ConfigHelper;
public interface MailConstant {
boolean IS_DEBUG = ConfigHelper.getConfigBoolean("mail.is_debug");
boolean IS_DEBUG = ConfigHelper.getConfigBoolean("smart.plugin.mail.is_debug");
interface Sender {
String PROTOCOL = ConfigHelper.getString("mail.sender.protocol");
boolean IS_SSL = ConfigHelper.getConfigBoolean("mail.sender.protocol.ssl");
String HOST = ConfigHelper.getString("mail.sender.protocol.host");
int PORT = ConfigHelper.getInt("mail.sender.protocol.port");
String FROM = ConfigHelper.getString("mail.sender.from");
boolean IS_AUTH = ConfigHelper.getConfigBoolean("mail.sender.auth");
String AUTH_USERNAME = ConfigHelper.getString("mail.sender.auth.username");
String AUTH_PASSWORD = ConfigHelper.getString("mail.sender.auth.password");
String PROTOCOL = ConfigHelper.getString("smart.plugin.mail.sender.protocol");
boolean IS_SSL = ConfigHelper.getConfigBoolean("smart.plugin.mail.sender.protocol.ssl");
String HOST = ConfigHelper.getString("smart.plugin.mail.sender.protocol.host");
int PORT = ConfigHelper.getInt("smart.plugin.mail.sender.protocol.port");
String FROM = ConfigHelper.getString("smart.plugin.mail.sender.from");
boolean IS_AUTH = ConfigHelper.getConfigBoolean("smart.plugin.mail.sender.auth");
String AUTH_USERNAME = ConfigHelper.getString("smart.plugin.mail.sender.auth.username");
String AUTH_PASSWORD = ConfigHelper.getString("smart.plugin.mail.sender.auth.password");
}
interface Fetcher {
String PROTOCOL = ConfigHelper.getString("mail.fetcher.protocol");
boolean IS_SSL = ConfigHelper.getConfigBoolean("mail.fetcher.protocol.ssl");
String HOST = ConfigHelper.getString("mail.fetcher.protocol.host");
int PORT = ConfigHelper.getInt("mail.fetcher.protocol.port");
String FOLDER = ConfigHelper.getString("mail.fetcher.folder");
boolean FOLDER_READONLY = ConfigHelper.getConfigBoolean("mail.fetcher.folder.readonly");
String PROTOCOL = ConfigHelper.getString("smart.plugin.mail.fetcher.protocol");
boolean IS_SSL = ConfigHelper.getConfigBoolean("smart.plugin.mail.fetcher.protocol.ssl");
String HOST = ConfigHelper.getString("smart.plugin.mail.fetcher.protocol.host");
int PORT = ConfigHelper.getInt("smart.plugin.mail.fetcher.protocol.port");
String FOLDER = ConfigHelper.getString("smart.plugin.mail.fetcher.folder");
boolean FOLDER_READONLY = ConfigHelper.getConfigBoolean("smart.plugin.mail.fetcher.folder.readonly");
}
}
......@@ -134,7 +134,7 @@ public class DefaultMailFetcher implements MailFetcher {
list.add(MailUtil.decodeAddress(address.toString()));
}
}
return list.toArray(new String[0]);
return list.toArray(new String[list.size()]);
}
private MailInfo createMailInfo(MimeMessage message) throws Exception {
......
......@@ -116,7 +116,7 @@ public abstract class AbstractMailSender implements MailSender {
}
}
protected abstract Email createEmail();
public abstract Email createEmail();
protected abstract void setContent(Email email, String content) throws MalformedURLException, EmailException;
public abstract void setContent(Email email, String content) throws MalformedURLException, EmailException;
}
......@@ -15,12 +15,12 @@ public class HtmlMailSender extends AbstractMailSender {
}
@Override
protected Email createEmail() {
public Email createEmail() {
return new ImageHtmlEmail();
}
@Override
protected void setContent(Email email, String content) throws MalformedURLException, EmailException {
public void setContent(Email email, String content) throws MalformedURLException, EmailException {
ImageHtmlEmail imageHtmlEmail = (ImageHtmlEmail) email;
imageHtmlEmail.setDataSourceResolver(new DataSourceUrlResolver(new URL("http://"), true));
imageHtmlEmail.setHtmlMsg(content);
......
......@@ -13,12 +13,12 @@ public class TextMailSender extends AbstractMailSender {
}
@Override
protected Email createEmail() {
public Email createEmail() {
return new MultiPartEmail();
}
@Override
protected void setContent(Email email, String content) throws MalformedURLException, EmailException {
public void setContent(Email email, String content) throws MalformedURLException, EmailException {
email.setMsg(content);
}
}
......@@ -30,7 +30,7 @@ public class RestHelper {
JacksonJsonProvider jsonProvider = new JacksonJsonProvider();
providerList.add(jsonProvider);
// 添加 Logging Interceptor
boolean log = ConfigHelper.getConfigBoolean("rest.log");
boolean log = ConfigHelper.getConfigBoolean("smart.plugin.rest.log");
if (log) {
LoggingInInterceptor loggingInInterceptor = new LoggingInInterceptor();
inInterceptorList.add(loggingInInterceptor);
......@@ -38,10 +38,10 @@ public class RestHelper {
outInterceptorList.add(loggingOutInterceptor);
}
// 添加 JSONP Interceptor
boolean jsonp = ConfigHelper.getConfigBoolean("rest.jsonp");
boolean jsonp = ConfigHelper.getConfigBoolean("smart.plugin.rest.jsonp");
if (jsonp) {
JsonpInInterceptor jsonpInInterceptor = new JsonpInInterceptor();
String jsonpFunction = ConfigHelper.getString("rest.jsonp.function");
String jsonpFunction = ConfigHelper.getString("smart.plugin.rest.jsonp.function");
jsonpInInterceptor.setCallbackParam(jsonpFunction);
inInterceptorList.add(jsonpInInterceptor);
JsonpPreStreamInterceptor jsonpPreStreamInterceptor = new JsonpPreStreamInterceptor();
......@@ -50,10 +50,10 @@ public class RestHelper {
outInterceptorList.add(jsonpPostStreamInterceptor);
}
// 添加 CORS Provider
boolean cors = ConfigHelper.getConfigBoolean("rest.cors");
boolean cors = ConfigHelper.getConfigBoolean("smart.plugin.rest.cors");
if (cors) {
CrossOriginResourceSharingFilter corsProvider = new CrossOriginResourceSharingFilter();
String corsOrigin = ConfigHelper.getString("rest.cors.origin");
String corsOrigin = ConfigHelper.getString("smart.plugin.rest.cors.origin");
corsProvider.setAllowOrigins(Arrays.asList(StringUtil.splitString(corsOrigin, ",")));
providerList.add(corsProvider);
}
......
......@@ -39,7 +39,7 @@ public class SearchHelper {
private static final Logger logger = LoggerFactory.getLogger(SearchHelper.class);
private static final List<SearchEngine> searchEngineList = new ArrayList<SearchEngine>();
private static final String indexDir = ConfigHelper.getString("search.index_dir");
private static final String indexDir = ConfigHelper.getString("smart.plugin.search.index_dir");
private static final Version luceneVersion = Version.LUCENE_46;
private static final Analyzer luceneAnalyzer = new StandardAnalyzer(luceneVersion);
......
......@@ -17,7 +17,7 @@ public class SoapHelper {
static {
// 添加 Logging Interceptor
boolean log = ConfigHelper.getConfigBoolean("soap.log");
boolean log = ConfigHelper.getConfigBoolean("smart.plugin.soap.log");
if (log) {
LoggingInInterceptor loggingInInterceptor = new LoggingInInterceptor();
inInterceptorList.add(loggingInInterceptor);
......
......@@ -18,10 +18,10 @@ public class XmlRpcHelper {
private static XmlRpcClientConfigImpl config;
static {
String xmlrpcURL = ConfigHelper.getString("xmlrpc.url");
boolean xmlrpcExtensionsEnabled = ConfigHelper.getConfigBoolean("xmlrpc.extensions_enabled", true);
int xmlrpcConnectionTimeout = ConfigHelper.getInt("xmlrpc.connection_timeout", 60 * 1000);
int xmlrpcReplyTimeout = ConfigHelper.getInt("xmlrpc.reply_timeout", 60 * 1000);
String xmlrpcURL = ConfigHelper.getString("smart.plugin.xmlrpc.url");
boolean xmlrpcExtensionsEnabled = ConfigHelper.getConfigBoolean("smart.plugin.xmlrpc.extensions_enabled", true);
int xmlrpcConnectionTimeout = ConfigHelper.getInt("smart.plugin.xmlrpc.connection_timeout", 60 * 1000);
int xmlrpcReplyTimeout = ConfigHelper.getInt("smart.plugin.xmlrpc.reply_timeout", 60 * 1000);
if (StringUtil.isEmpty(xmlrpcURL)) {
throw new RuntimeException("错误:请在 smart.properties 中设置 xmlrpc.url 参数!");
......
......@@ -35,24 +35,24 @@ public class SmartProps {
public static DataSource getDataSource() {
BasicDataSource ds = new BasicDataSource();
ds.setDriverClassName(props.getProperty("jdbc.driver"));
ds.setUrl(props.getProperty("jdbc.url"));
ds.setUsername(props.getProperty("jdbc.username"));
ds.setPassword(props.getProperty("jdbc.password"));
ds.setDriverClassName(props.getProperty("smart.framework.jdbc.driver"));
ds.setUrl(props.getProperty("smart.framework.jdbc.url"));
ds.setUsername(props.getProperty("smart.framework.jdbc.username"));
ds.setPassword(props.getProperty("smart.framework.jdbc.password"));
return ds;
}
public static String getRealms() {
return props.getProperty("security.realms");
return props.getProperty("smart.security.realms");
}
public static SmartSecurity getSmartSecurity() {
String className = props.getProperty("security.custom.class");
String className = props.getProperty("smart.security.custom.class");
Class<?> cls = null;
try {
cls = Class.forName(className);
} catch (ClassNotFoundException e) {
logger.error("无法从 security.custom.class 配置中找到对应的类", e);
logger.error("无法从 smart.security.custom.class 配置中找到对应的类", e);
}
SmartSecurity smartSecurity = null;
if (cls != null) {
......@@ -66,34 +66,34 @@ public class SmartProps {
}
public static String getJdbcAuthcQuery() {
return props.getProperty("security.jdbc.authc_query");
return props.getProperty("smart.security.jdbc.authc_query");
}
public static String getJdbcRolesQuery() {
return props.getProperty("security.jdbc.roles_query");
return props.getProperty("smart.security.jdbc.roles_query");
}
public static String getJdbcPermsQuery() {
return props.getProperty("security.jdbc.perms_query");
return props.getProperty("smart.security.jdbc.perms_query");
}
public static String getAdUrl() {
return props.getProperty("security.ad.url");
return props.getProperty("smart.security.ad.url");
}
public static String getAdSystemUsername() {
return props.getProperty("security.ad.system_username");
return props.getProperty("smart.security.ad.system_username");
}
public static String getAdSystemPassword() {
return props.getProperty("security.ad.system_password");
return props.getProperty("smart.security.ad.system_password");
}
public static String getAdSearchBase() {
return props.getProperty("security.ad.search_base");
return props.getProperty("smart.security.ad.search_base");
}
public static boolean isCache() {
return Boolean.parseBoolean(props.getProperty("security.cache"));
return Boolean.parseBoolean(props.getProperty("smart.security.cache"));
}
}
......@@ -31,22 +31,22 @@ public class SmartProps {
}
public static boolean isSSO() {
return Boolean.parseBoolean(props.getProperty("sso"));
return Boolean.parseBoolean(props.getProperty("smart.sso"));
}
public static String getCasServerUrlPrefix() {
return props.getProperty("sso.cas_url");
return props.getProperty("smart.sso.cas_url");
}
public static String getCasServerLoginUrl() {
return props.getProperty("sso.cas_url") + "/login";
return props.getProperty("smart.sso.cas_url") + "/login";
}
public static String getServerName() {
return props.getProperty("sso.app_url");
return props.getProperty("smart.sso.app_url");
}
public static String getFilterMapping() {
return props.getProperty("sso.filter_mapping");
return props.getProperty("smart.sso.filter_mapping");
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册