package wenrgise.ejb.common.utility; import com.tcs.wenrgise.util.common.FWXMLUtility; import java.util.logging.Logger; import javax.servlet.ServletException; import org.apache.struts.action.ActionServlet; import org.apache.struts.action.PlugIn; import org.apache.struts.config.ModuleConfig; import wenrgise.common.xml.vo.EnrgiseApp; import wenrgise.common.xml.vo.EnrgiseForms; import wenrgise.common.xml.vo.LOVClass; public class EnrgisePlugIn implements PlugIn { static final Logger log = Logger.getLogger("wenrgise.ejb.common.utility.EnrgisePlugIn"); private String formPathName = "/WEB-INF/EnrgiseConfig.xml"; private String pathName = "/WEB-INF/EnrgiseLOV.xml"; private String appPath = "/WEB-INF/EnrgiseApp.xml"; private String reportPathName = "/WEB-INF/EnrgiseReport.xml"; private String wflImplPathName = "/WEB-INF/WflDocParameters.xml"; public void init(ActionServlet servlet, ModuleConfig config) throws ServletException { try { System.out.println("I am in enrgise plugIn for HRMS--->"); String appPathTest = calculatePath(servlet, this.appPath); String configPathTest = calculatePath(servlet, this.formPathName); String lovPathTest = calculatePath(servlet, this.pathName); EnrgiseForms oEnrgiseForms = (EnrgiseForms)FWXMLUtility.xmlToObject("wenrgise.common.xml.vo.EnrgiseForms", configPathTest); EnrgiseManager.getInstance().init(oEnrgiseForms); LOVClass oLOVClass = (LOVClass)FWXMLUtility.xmlToObject("wenrgise.common.xml.vo.LOVClass", lovPathTest); LOVManager.getInstance().init(oLOVClass); EnrgiseApp oEnrgiseApp = (EnrgiseApp)FWXMLUtility.xmlToObject("wenrgise.common.xml.vo.EnrgiseApp", appPathTest); EnrgiseManager.getInstance().setEnrApp(oEnrgiseApp); } catch (Exception oEx) { log.severe(oEx.getMessage()); } } public void destroy() {} private String calculatePath(ActionServlet servlet, String sPath) { return servlet.getServletContext().getRealPath(sPath); } public String getFormPathName() { return this.formPathName; } public void setFormPathName(String newFormPathName) { this.formPathName = newFormPathName; } }