1 13 24 package org.jahia.engines.audit; 25 26 import java.util.HashMap ; 27 28 import javax.servlet.http.HttpSession ; 29 30 import org.jahia.data.JahiaData; 31 import org.jahia.engines.EngineToolBox; 32 import org.jahia.engines.JahiaEngine; 33 import org.jahia.exceptions.JahiaException; 34 import org.jahia.exceptions.JahiaSessionExpirationException; 35 import org.jahia.params.ParamBean; 36 37 public class ManageLogs_Engine { 38 39 40 public static final String ENGINE_NAME = "audit"; 41 42 43 private static final String TEMPLATE_JSP = "/jsp/jahia/engines/audit/sendlogs.jsp"; 44 45 private static ManageLogs_Engine instance = null; 46 private EngineToolBox toolBox; 47 48 49 private static final org.apache.log4j.Logger logger = 50 org.apache.log4j.Logger.getLogger (ManageLogs_Engine.class); 51 52 55 private ManageLogs_Engine () { 56 logger.debug ( 57 "***** Starting " + ManageLogs_Engine.class.getName () + " engine *****"); 58 toolBox = EngineToolBox.getInstance (); 59 } 60 61 62 65 public static synchronized ManageLogs_Engine getInstance () { 66 if (instance == null) { 67 instance = new ManageLogs_Engine (); 68 } 69 return instance; 70 } 71 72 73 76 public boolean authoriseRender (ParamBean jParams) { 77 return toolBox.authoriseRender (jParams); 78 } 79 80 81 84 public String renderLink (ParamBean jParams, Object theObj) 85 throws JahiaException { 86 return jParams.composeEngineUrl (ENGINE_NAME); 87 } 88 89 90 93 public boolean needsJahiaData (ParamBean jParams) { 94 return false; 95 } 96 97 98 104 public void handleActions (ParamBean jParams, int mode, HashMap engineMap, JahiaData jData) 105 throws JahiaException, 106 JahiaSessionExpirationException { 107 110 switch (mode) { 111 case (JahiaEngine.LOAD_MODE): 112 break; 113 case (JahiaEngine.UPDATE_MODE): 114 break; 115 case (JahiaEngine.SAVE_MODE): 116 break; 117 } 118 119 122 } 123 124 129 public final String getName () { 130 return ENGINE_NAME; 131 } 132 133 134 141 private HashMap initEngineMap (ParamBean jParams) 142 throws JahiaException, 143 JahiaSessionExpirationException { 144 145 HttpSession theSession = jParams.getSession (); 148 149 HashMap engineMap = (HashMap ) theSession.getAttribute ("jahia_session_engineMap"); 150 151 if (engineMap == null) { 159 throw new JahiaSessionExpirationException (); 160 } 161 162 engineMap.put (JahiaEngine.RENDER_TYPE_PARAM, new Integer (JahiaEngine.RENDERTYPE_FORWARD)); 163 engineMap.put (JahiaEngine.ENGINE_NAME_PARAM, ENGINE_NAME); 164 169 theSession.setAttribute ("jahia_session_engineMap", engineMap); 170 171 172 jParams.getRequest ().setAttribute ("org.jahia.engines.EngineHashMap", engineMap); 174 175 return engineMap; 176 } 177 178 179 } 180 | Popular Tags |