init
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
package com.eactive.eai.rms.common.spring;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
|
||||
import com.eactive.eai.rms.onl.common.service.AgentUtilService;
|
||||
|
||||
public class BaseController {
|
||||
|
||||
protected final Logger logger = Logger.getLogger(getClass());
|
||||
|
||||
/** The agentUtil service. */
|
||||
@Autowired
|
||||
@Qualifier("onlAgentUtilService")
|
||||
public AgentUtilService agentUtilService;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
package com.eactive.eai.rms.common.spring;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.springframework.beans.BeansException;
|
||||
import org.springframework.beans.factory.config.BeanFactoryPostProcessor;
|
||||
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
|
||||
|
||||
import com.eactive.eai.rms.common.datasource.DataSourceType;
|
||||
import com.eactive.eai.rms.common.datasource.DataSourceTypeManager;
|
||||
|
||||
public class CustomBeanFactoryPostProcessor implements BeanFactoryPostProcessor {
|
||||
|
||||
/**
|
||||
* Logger for this class
|
||||
*/
|
||||
final Logger logger = Logger.getLogger(CustomBeanFactoryPostProcessor.class);
|
||||
|
||||
public void postProcessBeanFactory(ConfigurableListableBeanFactory factory)
|
||||
throws BeansException {
|
||||
|
||||
List<DataSourceType> dataSourceTypes = new ArrayList<DataSourceType>();
|
||||
|
||||
Map maps = factory.getBeansOfType(DataSourceType.class);
|
||||
Iterator iter = maps.keySet().iterator();
|
||||
while (iter.hasNext()) {
|
||||
String key = (String) iter.next();
|
||||
|
||||
DataSourceType obj = (DataSourceType) factory.getBean(key);
|
||||
if (logger.isDebugEnabled()){
|
||||
logger.debug("dataSourceType key="+key + ", value="+ obj );
|
||||
}
|
||||
dataSourceTypes.add(obj);
|
||||
}
|
||||
|
||||
DataSourceTypeManager.setDataSourceTypes(dataSourceTypes);
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package com.eactive.eai.rms.common.spring;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
import org.springframework.context.MessageSource;
|
||||
import org.springframework.context.support.MessageSourceAccessor;
|
||||
|
||||
public class LocaleMessage extends MessageSourceAccessor {
|
||||
public LocaleMessage(MessageSource messageSource) {
|
||||
super(messageSource);
|
||||
}
|
||||
|
||||
public LocaleMessage(MessageSource messageSource, Locale defaultLocale) {
|
||||
super(messageSource, defaultLocale);
|
||||
}
|
||||
|
||||
public String getString(String key) {
|
||||
return super.getMessage(key, "No Element Found");
|
||||
}
|
||||
|
||||
public String getString(String key, String... args) {
|
||||
return super.getMessage(key, args, "No Element Found");
|
||||
}
|
||||
|
||||
public String getDefaultString(String key, String defaultString) {
|
||||
return super.getMessage(key, defaultString);
|
||||
}
|
||||
|
||||
public String getDefaultString(String key, String defaultString, String... args) {
|
||||
return super.getMessage(key, args, defaultString);
|
||||
}
|
||||
|
||||
public Locale getLocale() {
|
||||
return super.getDefaultLocale();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,265 @@
|
||||
package com.eactive.eai.rms.common.spring;//package com.eactive.eai.rms.common.spring;
|
||||
//
|
||||
//import java.util.HashMap;
|
||||
//import java.util.Iterator;
|
||||
//import java.util.List;
|
||||
//import java.util.Map;
|
||||
//
|
||||
//import javax.servlet.http.HttpServletRequest;
|
||||
//import javax.servlet.http.HttpServletResponse;
|
||||
//import javax.servlet.http.HttpSession;
|
||||
//
|
||||
//import org.springframework.validation.BindException;
|
||||
//import org.springframework.web.servlet.ModelAndView;
|
||||
//import org.springframework.web.servlet.mvc.SimpleFormController;
|
||||
//
|
||||
//import com.eactive.eai.rms.onl.common.service.EaiServerInfoService;
|
||||
//import com.eactive.eai.rms.onl.common.vo.BaseForm;
|
||||
//
|
||||
///**
|
||||
// * <pre>
|
||||
// * 1. ��� :
|
||||
// * 2. ó�� ���� :
|
||||
// * -
|
||||
// * 3. ���ǻ��� :
|
||||
// * </pre>
|
||||
// * @author : �ڱ⼷
|
||||
// * @version : $Revision: 1.8 $
|
||||
// * @since : rts 1.0
|
||||
// */
|
||||
//public abstract class OnlineFormController
|
||||
// extends SimpleFormController {
|
||||
//
|
||||
//
|
||||
// /**
|
||||
// *
|
||||
// */
|
||||
// public OnlineFormController() {
|
||||
// super();
|
||||
// setValidateOnBinding(false);
|
||||
// setUseExpiresHeader(false);
|
||||
// setUseCacheControlHeader(false);
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * <pre>
|
||||
// * 1. ��� :
|
||||
// * 2. ó�� ���� :
|
||||
// * -
|
||||
// * 3. ���ǻ��� :
|
||||
// * </pre>
|
||||
// * @author : �ڱ⼷
|
||||
// * @version : $Revision: 1.8 $
|
||||
// * @since : rts 1.0
|
||||
// * @return
|
||||
// * @throws Exception
|
||||
// */
|
||||
// protected Map createModel(HttpServletRequest request)
|
||||
// throws Exception {
|
||||
// Map model = new HashMap();
|
||||
// return createModel(request, model);
|
||||
// }
|
||||
//
|
||||
// protected Map createModel(HttpServletRequest request, Map model)
|
||||
// throws Exception {
|
||||
// // selectedInstNm�� Ŭ���̾�Ʈ�� ������ ������ �̸��̴�.
|
||||
// String selectedServerIp = request.getParameter("eaiSvrIp");
|
||||
//
|
||||
// EaiServerInfoService service = (EaiServerInfoService) this.getApplicationContext().getBean("eaiServerInfoService");
|
||||
// List serverList = service.getEaiServerIpList();
|
||||
// List hostList = service.getHostServerIpList();
|
||||
// setEaiSvrInstInfo(selectedServerIp, model, serverList);
|
||||
//
|
||||
// setHostInfo(selectedServerIp, model, hostList);
|
||||
//
|
||||
// // XXX : ���Ǵ� ���� ��� �ּ�ó���Ѵ�.
|
||||
// // ���� ��뿡 ������ ���°��� Ȯ�εǸ� �����Ѵ�.
|
||||
// // model.put("rtsContext", getBean("monitoringContext"));
|
||||
//
|
||||
// HttpSession session = request.getSession();
|
||||
// String serviceKey = (String)session.getAttribute("TABLE_OWNER");
|
||||
//
|
||||
// model.put("tableOwner", serviceKey);
|
||||
//
|
||||
// return model;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * <pre>
|
||||
// * 1. ��� :
|
||||
// * 2. ó�� ���� :
|
||||
// * -
|
||||
// * 3. ���ǻ��� :
|
||||
// * </pre>
|
||||
// * @author : �ڱ⼷
|
||||
// * @version : $Revision: 1.8 $
|
||||
// * @since : rts 1.0
|
||||
// * @param selectedHostIp
|
||||
// * @param map
|
||||
// * @param hostList
|
||||
// */
|
||||
// private void setHostInfo(String selectedHostIp, Map map, List hostList)
|
||||
// throws Exception {
|
||||
// if (null != selectedHostIp) {
|
||||
//
|
||||
// // null�� �ƴ� ��� Ŭ���̾�Ʈ�� �������� ���� �����Ƿ� �ش� ��������
|
||||
// // Host������ selectedHost or host1�� �ִ´�
|
||||
// // ���� �ҽ����� ȣȯ���� ���� host1�� ���� ���� ���� ������
|
||||
// // �����δ� selectedHost���� ���� �Ѵ�.
|
||||
// for (Iterator it = hostList.iterator(); it.hasNext();) {
|
||||
// Map server = (Map) it.next();
|
||||
// String eaiSevrIp = (String) server.get("EAISVRIP");
|
||||
// if (eaiSevrIp != null && eaiSevrIp.equals(selectedHostIp)) {
|
||||
// // ���� ���� �Ѵ�.
|
||||
// map.put("host1", server);
|
||||
// map.put("selectedHost", server);
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// } else {
|
||||
// map.put("host1", hostList.get(0));
|
||||
// map.put("selectedHost", hostList.get(0));
|
||||
// }
|
||||
// map.put("hostList", hostList);
|
||||
// map.put("hostSize", new Integer(hostList.size()));
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * <pre>
|
||||
// * 1. ��� :
|
||||
// * 2. ó�� ���� :
|
||||
// * -
|
||||
// * 3. ���ǻ��� :
|
||||
// * </pre>
|
||||
// * @author : �ڱ⼷
|
||||
// * @version : $Revision: 1.8 $
|
||||
// * @since : rts 1.0
|
||||
// * @param selectedServerIp
|
||||
// * @param map
|
||||
// * @param serverList
|
||||
// */
|
||||
// private void setEaiSvrInstInfo(String selectedServerIp, Map map,
|
||||
// List serverList)
|
||||
// throws Exception {
|
||||
// if (null != selectedServerIp) {
|
||||
// // null�� �ƴ� ��� Ŭ���̾�Ʈ�� �������� ���� �����Ƿ� �ش� ��������
|
||||
// // ������ eaiSvrInst or server1�� �ִ´�
|
||||
// // ���� �ҽ����� ȣȯ���� ���� server1�� ���� ���� ���� ������
|
||||
// // �����δ� eaiSvrInst���� ���� �Ѵ�.
|
||||
//
|
||||
// for (Iterator it = serverList.iterator(); it.hasNext();) {
|
||||
// Map server = (Map) it.next();
|
||||
// String eaiSevrIp = (String) server.get("EAISVRIP");
|
||||
// if (eaiSevrIp != null && eaiSevrIp.equals(selectedServerIp)) {
|
||||
// // ���� ���� �Ѵ�.
|
||||
// map.put("server1", server);
|
||||
// map.put("selectedInst", server);
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// } else {
|
||||
// map.put("server1", serverList.get(0));
|
||||
// map.put("selectedInst", serverList.get(0));
|
||||
// }
|
||||
// map.put("serverList", serverList);
|
||||
// map.put("serverSize", new Integer(serverList.size()));
|
||||
// }
|
||||
//
|
||||
// protected Object getBean(String name) {
|
||||
// return getWebApplicationContext().getBean(name);
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * <pre>
|
||||
// * 1. ��� :
|
||||
// * 2. ó�� ���� :
|
||||
// * -
|
||||
// * 3. ���ǻ��� :
|
||||
// * </pre>
|
||||
// * @author : �ڱ⼷
|
||||
// * @version : $Revision: 1.8 $
|
||||
// * @since : rts 1.0
|
||||
// * @param form
|
||||
// * @param model
|
||||
// * @return
|
||||
// * @deprecated ������� ����.. -0-
|
||||
// */
|
||||
// protected ModelAndView findDefaultModelAndView(BaseForm form, Map model) {
|
||||
// if (form.hasTransaction()) {
|
||||
// return new ModelAndView(form.getTransaction(), "model", model);
|
||||
// } else {
|
||||
// return new ModelAndView(this.getFormView(), "model", model);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * <pre>
|
||||
// * 1. ��� :
|
||||
// * 2. ó�� ���� :
|
||||
// * -
|
||||
// * 3. ���ǻ��� : Overriden
|
||||
// * </pre>
|
||||
// * @author : �ڱ⼷
|
||||
// * @version : $Revision: 1.8 $
|
||||
// * @since : rts 1.0
|
||||
// * @see org.springframework.web.servlet.mvc.SimpleFormController#(
|
||||
// * javax.servlet.http.HttpServletRequest,
|
||||
// * javax.servlet.http.HttpServletResponse,
|
||||
// * java.lang.Object, org.springframework.validation.BindException)
|
||||
// * @param request
|
||||
// * @param response
|
||||
// * @param form
|
||||
// * @param bindException
|
||||
// * @return
|
||||
// * @throws Exception
|
||||
// */
|
||||
// protected abstract ModelAndView onSubmit(HttpServletRequest request,
|
||||
// HttpServletResponse response, Object form,
|
||||
// BindException bindException)
|
||||
// throws Exception;
|
||||
//
|
||||
// protected ModelAndView showForm(HttpServletRequest request,
|
||||
// HttpServletResponse response, BindException errors, Map controlModel)
|
||||
// throws Exception {
|
||||
// return super.showForm(request, response, errors, controlModel);
|
||||
// }
|
||||
//
|
||||
// protected ModelAndView showForm(HttpServletRequest request,
|
||||
// HttpServletResponse response, BindException errors)
|
||||
// throws Exception {
|
||||
// return super.showForm(request, response, errors);
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * This implementation calls <code>showForm</code> in case of errors,
|
||||
// * and delegates to <code>onSubmit</code>'s full version else.
|
||||
// * <p>This can only be overridden to check for an action that should be executed
|
||||
// * without respect to binding errors, like a cancel action. To just handle successful
|
||||
// * submissions without binding errors, override one of the <code>onSubmit</code>
|
||||
// * methods or <code>doSubmitAction</code>.
|
||||
// * @see #showForm(HttpServletRequest, HttpServletResponse, BindException)
|
||||
// * @see #onSubmit(HttpServletRequest, HttpServletResponse, Object, BindException)
|
||||
// * @see #onSubmit(Object, BindException)
|
||||
// * @see #onSubmit(Object)
|
||||
// * @see #doSubmitAction(Object)
|
||||
// */
|
||||
// protected ModelAndView processFormSubmission(HttpServletRequest request,
|
||||
// HttpServletResponse response, Object command, BindException errors)
|
||||
// throws Exception {
|
||||
//
|
||||
// if (errors.hasErrors() || isFormChangeRequest(request)) {
|
||||
// if (logger.isDebugEnabled()) {
|
||||
// logger.debug("Data binding errors: " + errors.getErrorCount());
|
||||
// }
|
||||
// return onSubmit(request, response, command, errors);
|
||||
// } else {
|
||||
// logger.debug("No errors -> processing submit");
|
||||
// return onSubmit(request, response, command, errors);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// protected boolean isFormSubmission(HttpServletRequest request) {
|
||||
// return true;
|
||||
// }
|
||||
//
|
||||
//}
|
||||
Reference in New Issue
Block a user