📄 managelogs_engine.java
字号:
//// ____.// __/\ ______| |__/\. _______// __ .____| | \ | +----+ \// _______| /--| | | - \ _ | : - \_________// \\______: :---| : : | : | \________>// |__\---\_____________:______: :____|____:_____\// /_____|//// . . . i n j a h i a w e t r u s t . . .////// ManageLogs_Engine// MJ 27.02.20001//// getInstance()// authoriseRender()// renderLink()// needsJahiaData()// handleActions()//package org.jahia.engines.audit;import java.util.*; // HashMapimport javax.servlet.http.*; // HttpSessionimport org.jahia.exceptions.*; // JahiaExceptionimport org.jahia.utils.*; // JahiaConsoleimport org.jahia.data.*; // JahiaData, ConnectionTypesimport org.jahia.params.*; // ParamBeanimport org.jahia.registries.*; // ServicesRegistryimport org.jahia.engines.*; // JahiaEngine interfaceimport org.jahia.exceptions.JahiaSessionExpirationException;public class ManageLogs_Engine implements JahiaEngine { private static final String TEMPLATE_JSP = "/jsp/jahia/engines/audit/sendlogs.jsp"; private static ManageLogs_Engine theObject = null; private String engineName = "audit"; private EngineToolBox toolBox; /*** * constructor * */ private ManageLogs_Engine() { // JahiaConsole.println( "Engine", // "***** Starting ManageLogs Engine *****" ); toolBox = EngineToolBox.getInstance(); } // end constructor /*** * returns a single instance of the object * */ public static synchronized ManageLogs_Engine getInstance() { if (theObject == null) { theObject = new ManageLogs_Engine(); } return theObject; } // end getInstance /*** * authoriseRender * */ public boolean authoriseRender( ParamBean jParams ) { return toolBox.authoriseRender( jParams ); } // end authoriseRender /*** * renderLink * no params allowed */ public String renderLink( ParamBean jParams, Object theObj ) throws JahiaException { return jParams.composeEngineUrl( engineName ); } // end renderLink /*** * needsJahiaData * */ public boolean needsJahiaData( ParamBean jParams ) { return false; } // end needsJahiaData /*** * handles the engine actions * * @param jParams a ParamBean object * @param jData a JahiaData object (not mandatory) * */ public void handleActions (ParamBean jParams, JahiaData jData) throws JahiaException, JahiaSessionExpirationException { // initalizes the hashmap HashMap engineMap = initEngineMap( jParams ); // displays the screen toolBox.displayScreen( jParams, engineMap ); } // end handleActions /*** * inits the engine map * * @param jParams a ParamBean object * (with request and response) * @return a HashMap object containing all the basic values * needed by an engine * */ private HashMap initEngineMap( ParamBean jParams ) throws JahiaException, JahiaSessionExpirationException { HashMap engineMap = new HashMap(); // gets session values //HttpSession theSession = jParams.getRequest().getSession( true ); HttpSession theSession = jParams.getSession (); engineMap = (HashMap) theSession.getAttribute( "jahia_session_engineMap" ); /////////////////////////////////////////////////////////////////////////////////////// // FIXME -Fulco- // // This is a quick hack, engineMap should not be null if the session didn't // expired. Maybe there are other cases where the engineMap can be null, I didn't // checked them at all. /////////////////////////////////////////////////////////////////////////////////////// if (engineMap == null) { throw new JahiaSessionExpirationException (); } engineMap.put( "jParams", jParams ); engineMap.put( "renderType", new Integer(JahiaEngine.RENDERTYPE_FORWARD) ); engineMap.put( "engineName", engineName ); engineMap.put( "engineOutputFile", TEMPLATE_JSP ); theSession.setAttribute( "jahia_session_engineMap", engineMap ); // sets engineMap for JSPs jParams.getRequest().setAttribute( "org.jahia.engines.EngineHashMap", engineMap ); return engineMap; } // end initEngineMap} // end ManageLogs_Engine
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -