@@ -0,0 +1,2182 @@
+/*%0A*%0A* Custom Schema processor which helps to implement dynamic security roles for an Agent dimension%0A*%0A* This software is subject to the terms of the Eclipse Public License v1.0%0A* Agreement, available at the following URL: http://www.eclipse.org/legal/epl-v10.html.%0A* You must accept the terms of that agreement to use this software.%0A*%0A* @author gmartano%0A* @since Jan 2016%0A*%0A*%0A* %0A* Copyright (c) 2016 Arena Cube.  All rights reserved.%0A*/%0Apackage com.arenacube.mondrian.dsp;%0A%0Aimport mondrian.olap.Util;%0Aimport mondrian.spi.*;%0Aimport mondrian.i18n.*;%0A%0Aimport org.pentaho.platform.api.engine.IPentahoSession;%0Aimport org.pentaho.platform.engine.core.system.PentahoSessionHolder;%0A%0Aimport org.apache.log4j.Logger;%0Aimport java.io.InputStream;%0Aimport java.util.regex.PatternSyntaxException; %0A/* used to log to console for first debug purpose */%0Aimport static java.lang.System.out;%0A%0Apublic class DynamicSchemaProcessor extends LocalizingDynamicSchemaProcessor %7B%0A%09private static final Logger LOG = Logger.getLogger(DynamicSchemaProcessor.class);%0A%0A    /** Creates a new instance of class */%0A    public DynamicSchemaProcessor() %7B%0A    %7D%0A%09%0A%09@Override%0A%09public String filter(String schemaUrl, Util.PropertyList connectInfo, InputStream stream)%0A%09%09throws Exception %7B%0A%09%09%09String schema = super.filter(schemaUrl, connectInfo, stream);%0A%09%09%09System.out.println(%22%5BCUSTOM.DSP%5D *********** Started DSP Custom ***********%22);%0A%09%09%09IPentahoSession session = PentahoSessionHolder.getSession();%0A%09%09%09String usercode = (String) session.getAttribute(%22USERNAME%22);%0A%09%09%09try %7B%0A%09%09%09%09System.out.println(%22%5BCUSTOM.DSP%5D Trying to replace '%25USER_NAME%25' with session value: %22+usercode);%0A%09%09%09%09LOG.info(%22Trying to replace '%25USER_NAME%25' with session value: %22+usercode);%0A%09%09%09%09schema = schema.replaceAll(%22%25USER_NAME%25%22, usercode);%0A%09%09%09%7D%0A%09%09%09catch (PatternSyntaxException pse) %7B%0A%09%09%09%09System.out.println(%22%5BCUSTOM.DSP%5D Some error during custom schema processing: %22+usercode);%0A%09%09%09%09LOG.error(%22Some error during custom schema processing. %22 , pse);%0A%09%09%09%09pse.printStackTrace();%0A%09%09%09%7D%0A%09%09LOG.info(%22DSP Ended correctly for %22+usercode);%0A%09%09System.out.println(%22%5BCUSTOM.DSP%5D *********** DSP Ended correctly for %22+usercode+%22 ***********%22);%0A%09%09return schema;%0A%09%7D%0A%7D%0A

Create DynamicSchemaProcessor.java