Hitachi Vantara Pentaho Community Forums
Results 1 to 5 of 5

Thread: Re: [Mondrian] Eigenbase perforce change 14566 for review

  1. #1
    Julian Hyde Guest

    Default Re: [Mondrian] Eigenbase perforce change 14566 for review

    Michele,

    Congratulations on your first check in.

    However, it had 17 checkFile exceptions. Can you fix today please.

    Julian

    On Aug 25, 2011, at 12:44 AM, Michele Rossi wrote:

    > http://p4web.eigenbase.org/@md=d&c=6PU@/14566?ac=10
    >
    > Change 14566 by mrossi@michele_mondrian on 2011/08/25 00:43:32
    >
    > MONDRIAN: fixes to xmla servlet
    >
    > Affected files ...
    >
    > ... //open/mondrian/src/main/mondrian/xmla/XmlaHandler.java#80 edit
    > ... //open/mondrian/src/main/mondrian/xmla/impl/DefaultXmlaServlet.java#33 edit
    > ... //open/mondrian/src/main/mondrian/xmla/impl/Olap4jXmlaServlet.java#4 edit
    >
    > Differences ...
    >
    > ==== //open/mondrian/src/main/mondrian/xmla/XmlaHandler.java#80 (ktext) ====
    >
    > 2c2
    > < // $Id: //open/mondrian/src/main/mondrian/xmla/XmlaHandler.java#79 $
    > ---
    >> // $Id: //open/mondrian/src/main/mondrian/xmla/XmlaHandler.java#80 $

    > 27a28,29
    >> import java.lang.reflect.InvocationTargetException;
    >> import java.lang.reflect.UndeclaredThrowableException;

    > 41c43
    > < * @version $Id: //open/mondrian/src/main/mondrian/xmla/XmlaHandler.java#79 $
    > ---
    >> * @version $Id: //open/mondrian/src/main/mondrian/xmla/XmlaHandler.java#80 $

    > 75a78,102
    >> } catch (UndeclaredThrowableException ute) {
    >> //
    >> // Note: this is necessary because we use a dynamic proxy for the
    >> // connection.
    >> // I could not catch and un-wrap the Undeclared Throwable within
    >> // the proxy.
    >> // The exception comes out here and I couldn't find any better
    >> // ways to deal with it.
    >> //
    >> // The undeclared throwable contains an Invocation Target Exception
    >> // which in turns contains the real exception thrown by the "unwrap"
    >> // method, for example OlapException.
    >> //
    >>
    >> Throwable cause = ute.getCause();
    >> if (cause instanceof InvocationTargetException) {
    >> cause = cause.getCause();
    >> }
    >>
    >> // this maintains the original behaviour: don't catch exceptions
    >> // that are not subclasses of SQLException
    >>
    >> if (! (cause instanceof SQLException)) {
    >> throw ute;
    >> }

    >
    > ==== //open/mondrian/src/main/mondrian/xmla/impl/DefaultXmlaServlet.java#33 (ktext) ====
    >
    > 2c2
    > < // $Id: //open/mondrian/src/main/mondrian/xmla/impl/DefaultXmlaServlet.java#32 $
    > ---
    >> // $Id: //open/mondrian/src/main/mondrian/xmla/impl/DefaultXmlaServlet.java#33 $

    > 12c12,18
    > < import java.io.*;
    > ---
    >> import java.io.ByteArrayInputStream;
    >> import java.io.ByteArrayOutputStream;
    >> import java.io.IOException;
    >> import java.io.InputStream;
    >> import java.io.OutputStream;
    >> import java.io.StringWriter;
    >> import java.io.UnsupportedEncodingException;

    > 14,15c20,24
    > < import java.nio.channels.*;
    > < import java.util.*;
    > ---
    >> import java.nio.channels.Channels;
    >> import java.nio.channels.ReadableByteChannel;
    >> import java.nio.channels.WritableByteChannel;
    >> import java.util.HashMap;
    >> import java.util.Map;

    > 17,19c26,32
    > < import javax.servlet.*;
    > < import javax.servlet.http.*;
    > < import javax.xml.parsers.*;
    > ---
    >> import javax.servlet.ServletConfig;
    >> import javax.servlet.ServletException;
    >> import javax.servlet.http.HttpServletRequest;
    >> import javax.servlet.http.HttpServletResponse;
    >> import javax.xml.parsers.DocumentBuilder;
    >> import javax.xml.parsers.DocumentBuilderFactory;
    >> import javax.xml.parsers.ParserConfigurationException;

    > 21d33
    > < import mondrian.xmla.*;
    > 22a35,42
    >> import mondrian.xmla.SaxWriter;
    >> import mondrian.xmla.XmlaConstants;
    >> import mondrian.xmla.XmlaException;
    >> import mondrian.xmla.XmlaRequest;
    >> import mondrian.xmla.XmlaRequestCallback;
    >> import mondrian.xmla.XmlaResponse;
    >> import mondrian.xmla.XmlaServlet;
    >> import mondrian.xmla.XmlaUtil;

    > 25,26c45,51
    > < import org.w3c.dom.*;
    > < import org.xml.sax.*;
    > ---
    >> import org.w3c.dom.Attr;
    >> import org.w3c.dom.Document;
    >> import org.w3c.dom.Element;
    >> import org.w3c.dom.Node;
    >> import org.w3c.dom.NodeList;
    >> import org.xml.sax.InputSource;
    >> import org.xml.sax.SAXException;

    > 32c57
    > < * @version $Id: //open/mondrian/src/main/mondrian/xmla/impl/DefaultXmlaServlet.java#32 $
    > ---
    >> * @version $Id: //open/mondrian/src/main/mondrian/xmla/impl/DefaultXmlaServlet.java#33 $

    > 45,52d69
    > < /**
    > < * Simba O2X for some reason attempts to create many new xmla sessions
    > < * during the same user interactions. We can mitigate that by creating a
    > < * session id which is a direct hash function of the credentials supplied
    > < * and the remote host IP.
    > < */
    > < private static final String REUSE_SESSION_IDS = "reuseSessionIds";
    > <
    > 56d72
    > < private boolean reuseSessionIds = false;
    > 61,63d76
    > < *
    > < * <p>NOTE: There is no mechanism to remove entries from this map,
    > < * so it will get larger if the server is up for a long time.</p>
    > 74,76d86
    > < this.reuseSessionIds =
    > < Boolean.parseBoolean(
    > < servletConfig.getInitParameter(REUSE_SESSION_IDS));
    > 79c89
    > < protected DocumentBuilderFactory getDocumentBuilderFactory() {
    > ---
    >> protected static DocumentBuilderFactory getDocumentBuilderFactory() {

    > 239a250
    >>

    > 277a289
    >>

    > 281d292
    > < context.put(CONTEXT_XMLA_PASSWORD, passwordStr);
    > 283,285c294,296
    > < // [MROSSI] TODO we'd need to inject the HttpServletRequest
    > < // into this method context.put("remote_host",
    > < // request.getRemoteHost());
    > ---
    >>
    >> context.put(CONTEXT_XMLA_PASSWORD, passwordStr);
    >>

    > 287c298
    > < LOGGER.error(
    > ---
    >> LOGGER.warn(

    > 319d329
    > < // generate SessionId
    > 328,330c338,347
    > < // extract the SessionId attrs value and put into
    > < // context
    > < sessionIdStr = getSessionId(e, context);
    > ---
    >> sessionIdStr = getSessionIdFromRequest(e, context);
    >>
    >> SessionInfo sessionInfo = getSessionInfo(sessionIdStr);
    >>
    >> if (sessionInfo != null) {
    >> context.put(CONTEXT_XMLA_USERNAME, sessionInfo.user);
    >> context.put(
    >> CONTEXT_XMLA_PASSWORD,
    >> sessionInfo.password);
    >> }

    > 338,349c355
    > < // extract the SessionId attrs value and put into
    > < // context
    > < sessionIdStr = getSessionId(e, context);
    > <
    > < SessionInfo sessionInfo =
    > < getSessionInfo(sessionIdStr);
    > < if (sessionInfo != null) {
    > < context.put(CONTEXT_XMLA_USERNAME, sessionInfo.user);
    > < context.put(
    > < CONTEXT_XMLA_PASSWORD, sessionInfo.password);
    > < }
    > < context.put(CONTEXT_XMLA_SESSION_ID, sessionIdStr);
    > ---
    >> sessionIdStr = getSessionIdFromRequest(e, context);

    > 354,355d359
    > < // remove session info
    > < removeSessionInfo(sessionIdStr);
    > 392a397
    >>

    > 419,423d423
    > < private void removeSessionInfo(String sessionIdStr) {
    > < synchronized (sessionInfos) {
    > < sessionInfos.remove(sessionIdStr);
    > < }
    > < }
    > 425a426
    >>

    > 432,469c433,438
    > < /*
    > < * Fallback to the default session ID generation algorithm.
    > < */
    > < if (reuseSessionIds) {
    > < // This is how we use the same session id (key to retrieve a
    > < // connection) for requests with the same username coming from
    > < // the same remote host. The password can't be part of the
    > < // string because if you use Simba and you don't tick "save
    > < // password" in the login dialog then Simba only sends the
    > < // password with the first session that it opens - after which
    > < // it sends something like the following:
    > < //
    > < // <Header>
    > < // <Security xmlns="http://schemas.xmlsoap.org/ws/2002/04/secext">
    > < // <UsernameToken>
    > < // <Username>michele</Username>
    > < // <Password Type="PasswordText"/>
    > < // </UsernameToken>
    > < // </Security>
    > < // <BeginSession
    > < // xmlns="urn:schemas-microsoft-com:xml-analysis"
    > < // mustUnderstand="1"/>
    > < // </Header>
    > < //
    > < // Note the Password element with no value in it.
    > < String sessionString =
    > < "session_"
    > < + context.get(CONTEXT_XMLA_USERNAME)
    > < + "_"
    > < + "_"
    > < + context.get("remote_host");
    > < return Long.toString(sessionString.hashCode(), 35);
    > < } else {
    > < // Generate a semi-random new session ID.
    > < return Long.toString(
    > < -17L * System.nanoTime() + 11L * System.currentTimeMillis(),
    > < 35);
    > < }
    > ---
    >>
    >>
    >> // Generate a pseudo-random new session ID.
    >> return Long.toString(17L * System.nanoTime()
    >> +
    >> 3L * System.currentTimeMillis(), 35);

    > 472c441,443
    > < protected String getSessionId(Element e, Map<String, Object> context)
    > ---
    >>
    >> private static String getSessionIdFromRequest(Element e,
    >> Map<String, Object> context)

    > 485,486c456,458
    > < String value = attr.getValue();
    > < if (value == null) {
    > ---
    >>
    >> String sessionId = attr.getValue();
    >> if (sessionId == null) {

    > 494c466
    > < return value;
    > ---
    >> return sessionId;

    > 845c817,822
    > < SessionInfo sessionInfo;
    > ---
    >> if (sessionId == null) {
    >> return null;
    >> }
    >>
    >> SessionInfo sessionInfo = null;
    >>

    > 848a826
    >>

    > 851,852c829,831
    > < "No login credentials for found for session [" + sessionId
    > < + "]");
    > ---
    >> "No login credentials for found for session ["
    >> +
    >> sessionId + "]");

    > 855,856c834,837
    > < "Found existing credentials for session id ["
    > < + sessionId + "], username=[" + sessionInfo.user + "]");
    > ---
    >> "Found credentials for session id ["
    >> + sessionId
    >> + "], username=[" + sessionInfo.user
    >> + "] in servlet cache");

    > 876c857
    > < new SessionInfo(sessionId, username, password);
    > ---
    >> new SessionInfo(username, password);

    > 882c863
    > < sessionInfo = new SessionInfo(sessionId, username, password);
    > ---
    >> sessionInfo = new SessionInfo(username, password);

    > 888c869,871
    > <
    > ---
    >> /**
    >> * Holds authentication credentials of a XMLA session.
    >> */

    > 890d872
    > < final String id;
    > 894,895c876,877
    > < public SessionInfo(String id, String user, String password) {
    > < this.id = id;
    > ---
    >> public SessionInfo(String user, String password)
    >> {

    > 901d882
    > <
    >
    > ==== //open/mondrian/src/main/mondrian/xmla/impl/Olap4jXmlaServlet.java#4 (ktext) ====
    >
    > 2c2
    > < // $Id: //open/mondrian/src/main/mondrian/xmla/impl/Olap4jXmlaServlet.java#3 $
    > ---
    >> // $Id: //open/mondrian/src/main/mondrian/xmla/impl/Olap4jXmlaServlet.java#4 $

    > 28a29
    >> import java.lang.reflect.UndeclaredThrowableException;

    > 36c37
    > < * @version $Id: //open/mondrian/src/main/mondrian/xmla/impl/Olap4jXmlaServlet.java#3 $
    > ---
    >> * @version $Id: //open/mondrian/src/main/mondrian/xmla/impl/Olap4jXmlaServlet.java#4 $

    > 415a417
    >>

    > 422,423c424,427
    > < if (OlapConnection.class.isAssignableFrom(
    > < method.getClass()))
    > ---
    >> if ("unwrap".equals(method.getName())
    >> ||
    >> OlapConnection.class.isAssignableFrom(
    >> method.getDeclaringClass()))

    >


    _______________________________________________
    Mondrian mailing list
    Mondrian (AT) pentaho (DOT) org
    http://lists.pentaho.org/mailman/listinfo/mondrian

  2. #2
    Julian Hyde Guest

    Default [Mondrian] Mondrian-4 test run

    I'm pleased to have gotten the test suite to complete on the lagunitas (mondrian-4) branch for the first time. Tests were run against MySQL on JDK 1.6. The results are attached (bzipped XML file), but to summarize:

    Total tests: 3041
    Errors: 973
    Failed: 680
    Passed: 1388

    Are these good results? I'm a glass-half-full kind of guy, so I think so. This is how things usually look in the middle of a big refactoring.

    On that proverbial journey of a thousand miles... it helps to know how far you are from your destination, even if it seems like a long way. At least you can make sure you are getting closer every day.

    Next step is to choose some of the most common errors and fix them. Hopefully we can get to 2000 passes out of 3000 fairly shortly.

    Julian



    _______________________________________________
    Mondrian mailing list
    Mondrian (AT) pentaho (DOT) org
    http://lists.pentaho.org/mailman/listinfo/mondrian

  3. #3
    Michele Rossi Guest

    Default Re: [Mondrian] Eigenbase perforce change 14566 for review

    Hi,
    I fixed all the exceptions raised by Perforce when attempting to check in
    and I assumed they were the same checks made by the checkFile script.
    Wrong assumption sorry.

    Ok I will run checkFile tomorrow as soon as I get back to work (it's 22:15
    here now).

    thanks,
    Michele

    On 25 August 2011 21:29, Julian Hyde <jhyde (AT) pentaho (DOT) com> wrote:

    > Michele,
    >
    > Congratulations on your first check in.
    >
    > However, it had 17 checkFile exceptions. Can you fix today please.
    >
    > Julian
    >
    > On Aug 25, 2011, at 12:44 AM, Michele Rossi wrote:
    >
    > > http://p4web.eigenbase.org/@md=d&c=6PU@/14566?ac=10
    > >
    > > Change 14566 by mrossi@michele_mondrian on 2011/08/25 00:43:32
    > >
    > > MONDRIAN: fixes to xmla servlet
    > >
    > > Affected files ...
    > >
    > > ... //open/mondrian/src/main/mondrian/xmla/XmlaHandler.java#80 edit
    > > ...

    > //open/mondrian/src/main/mondrian/xmla/impl/DefaultXmlaServlet.java#33 edit
    > > ... //open/mondrian/src/main/mondrian/xmla/impl/Olap4jXmlaServlet.java#4

    > edit
    > >
    > > Differences ...
    > >
    > > ==== //open/mondrian/src/main/mondrian/xmla/XmlaHandler.java#80 (ktext)

    > ====
    > >
    > > 2c2
    > > < // $Id: //open/mondrian/src/main/mondrian/xmla/XmlaHandler.java#79 $
    > > ---
    > >> // $Id: //open/mondrian/src/main/mondrian/xmla/XmlaHandler.java#80 $

    > > 27a28,29
    > >> import java.lang.reflect.InvocationTargetException;
    > >> import java.lang.reflect.UndeclaredThrowableException;

    > > 41c43
    > > < * @version $Id:

    > //open/mondrian/src/main/mondrian/xmla/XmlaHandler.java#79 $
    > > ---
    > >> * @version $Id:

    > //open/mondrian/src/main/mondrian/xmla/XmlaHandler.java#80 $
    > > 75a78,102
    > >> } catch (UndeclaredThrowableException ute) {
    > >> //
    > >> // Note: this is necessary because we use a dynamic proxy for

    > the
    > >> // connection.
    > >> // I could not catch and un-wrap the Undeclared Throwable

    > within
    > >> // the proxy.
    > >> // The exception comes out here and I couldn't find any

    > better
    > >> // ways to deal with it.
    > >> //
    > >> // The undeclared throwable contains an Invocation Target

    > Exception
    > >> // which in turns contains the real exception thrown by the

    > "unwrap"
    > >> // method, for example OlapException.
    > >> //
    > >>
    > >> Throwable cause = ute.getCause();
    > >> if (cause instanceof InvocationTargetException) {
    > >> cause = cause.getCause();
    > >> }
    > >>
    > >> // this maintains the original behaviour: don't catch

    > exceptions
    > >> // that are not subclasses of SQLException
    > >>
    > >> if (! (cause instanceof SQLException)) {
    > >> throw ute;
    > >> }

    > >
    > > ====

    > //open/mondrian/src/main/mondrian/xmla/impl/DefaultXmlaServlet.java#33
    > (ktext) ====
    > >
    > > 2c2
    > > < // $Id:

    > //open/mondrian/src/main/mondrian/xmla/impl/DefaultXmlaServlet.java#32 $
    > > ---
    > >> // $Id:

    > //open/mondrian/src/main/mondrian/xmla/impl/DefaultXmlaServlet.java#33 $
    > > 12c12,18
    > > < import java.io.*;
    > > ---
    > >> import java.io.ByteArrayInputStream;
    > >> import java.io.ByteArrayOutputStream;
    > >> import java.io.IOException;
    > >> import java.io.InputStream;
    > >> import java.io.OutputStream;
    > >> import java.io.StringWriter;
    > >> import java.io.UnsupportedEncodingException;

    > > 14,15c20,24
    > > < import java.nio.channels.*;
    > > < import java.util.*;
    > > ---
    > >> import java.nio.channels.Channels;
    > >> import java.nio.channels.ReadableByteChannel;
    > >> import java.nio.channels.WritableByteChannel;
    > >> import java.util.HashMap;
    > >> import java.util.Map;

    > > 17,19c26,32
    > > < import javax.servlet.*;
    > > < import javax.servlet.http.*;
    > > < import javax.xml.parsers.*;
    > > ---
    > >> import javax.servlet.ServletConfig;
    > >> import javax.servlet.ServletException;
    > >> import javax.servlet.http.HttpServletRequest;
    > >> import javax.servlet.http.HttpServletResponse;
    > >> import javax.xml.parsers.DocumentBuilder;
    > >> import javax.xml.parsers.DocumentBuilderFactory;
    > >> import javax.xml.parsers.ParserConfigurationException;

    > > 21d33
    > > < import mondrian.xmla.*;
    > > 22a35,42
    > >> import mondrian.xmla.SaxWriter;
    > >> import mondrian.xmla.XmlaConstants;
    > >> import mondrian.xmla.XmlaException;
    > >> import mondrian.xmla.XmlaRequest;
    > >> import mondrian.xmla.XmlaRequestCallback;
    > >> import mondrian.xmla.XmlaResponse;
    > >> import mondrian.xmla.XmlaServlet;
    > >> import mondrian.xmla.XmlaUtil;

    > > 25,26c45,51
    > > < import org.w3c.dom.*;
    > > < import org.xml.sax.*;
    > > ---
    > >> import org.w3c.dom.Attr;
    > >> import org.w3c.dom.Document;
    > >> import org.w3c.dom.Element;
    > >> import org.w3c.dom.Node;
    > >> import org.w3c.dom.NodeList;
    > >> import org.xml.sax.InputSource;
    > >> import org.xml.sax.SAXException;

    > > 32c57
    > > < * @version $Id:

    > //open/mondrian/src/main/mondrian/xmla/impl/DefaultXmlaServlet.java#32 $
    > > ---
    > >> * @version $Id:

    > //open/mondrian/src/main/mondrian/xmla/impl/DefaultXmlaServlet.java#33 $
    > > 45,52d69
    > > < /**
    > > < * Simba O2X for some reason attempts to create many new xmla

    > sessions
    > > < * during the same user interactions. We can mitigate that by

    > creating a
    > > < * session id which is a direct hash function of the credentials

    > supplied
    > > < * and the remote host IP.
    > > < */
    > > < private static final String REUSE_SESSION_IDS = "reuseSessionIds";
    > > <
    > > 56d72
    > > < private boolean reuseSessionIds = false;
    > > 61,63d76
    > > < *
    > > < * <p>NOTE: There is no mechanism to remove entries from this map,
    > > < * so it will get larger if the server is up for a long time.</p>
    > > 74,76d86
    > > < this.reuseSessionIds =
    > > < Boolean.parseBoolean(
    > > < servletConfig.getInitParameter(REUSE_SESSION_IDS));
    > > 79c89
    > > < protected DocumentBuilderFactory getDocumentBuilderFactory() {
    > > ---
    > >> protected static DocumentBuilderFactory getDocumentBuilderFactory() {

    > > 239a250
    > >>

    > > 277a289
    > >>

    > > 281d292
    > > < context.put(CONTEXT_XMLA_PASSWORD,

    > passwordStr);
    > > 283,285c294,296
    > > < // [MROSSI] TODO we'd need to inject the

    > HttpServletRequest
    > > < // into this method context.put("remote_host",
    > > < // request.getRemoteHost());
    > > ---
    > >>
    > >> context.put(CONTEXT_XMLA_PASSWORD, passwordStr);
    > >>

    > > 287c298
    > > < LOGGER.error(
    > > ---
    > >> LOGGER.warn(

    > > 319d329
    > > < // generate SessionId
    > > 328,330c338,347
    > > < // extract the SessionId attrs value and put into
    > > < // context
    > > < sessionIdStr = getSessionId(e, context);
    > > ---
    > >> sessionIdStr = getSessionIdFromRequest(e, context);
    > >>
    > >> SessionInfo sessionInfo =

    > getSessionInfo(sessionIdStr);
    > >>
    > >> if (sessionInfo != null) {
    > >> context.put(CONTEXT_XMLA_USERNAME,

    > sessionInfo.user);
    > >> context.put(
    > >> CONTEXT_XMLA_PASSWORD,
    > >> sessionInfo.password);
    > >> }

    > > 338,349c355
    > > < // extract the SessionId attrs value and put into
    > > < // context
    > > < sessionIdStr = getSessionId(e, context);
    > > <
    > > < SessionInfo sessionInfo =
    > > < getSessionInfo(sessionIdStr);
    > > < if (sessionInfo != null) {
    > > < context.put(CONTEXT_XMLA_USERNAME,

    > sessionInfo.user);
    > > < context.put(
    > > < CONTEXT_XMLA_PASSWORD,

    > sessionInfo.password);
    > > < }
    > > < context.put(CONTEXT_XMLA_SESSION_ID, sessionIdStr);
    > > ---
    > >> sessionIdStr = getSessionIdFromRequest(e, context);

    > > 354,355d359
    > > < // remove session info
    > > < removeSessionInfo(sessionIdStr);
    > > 392a397
    > >>

    > > 419,423d423
    > > < private void removeSessionInfo(String sessionIdStr) {
    > > < synchronized (sessionInfos) {
    > > < sessionInfos.remove(sessionIdStr);
    > > < }
    > > < }
    > > 425a426
    > >>

    > > 432,469c433,438
    > > < /*
    > > < * Fallback to the default session ID generation algorithm.
    > > < */
    > > < if (reuseSessionIds) {
    > > < // This is how we use the same session id (key to retrieve

    > a
    > > < // connection) for requests with the same username coming

    > from
    > > < // the same remote host. The password can't be part of the
    > > < // string because if you use Simba and you don't tick "save
    > > < // password" in the login dialog then Simba only sends the
    > > < // password with the first session that it opens - after

    > which
    > > < // it sends something like the following:
    > > < //
    > > < // <Header>
    > > < // <Security xmlns="

    > http://schemas.xmlsoap.org/ws/2002/04/secext">
    > > < // <UsernameToken>
    > > < // <Username>michele</Username>
    > > < // <Password Type="PasswordText"/>
    > > < // </UsernameToken>
    > > < // </Security>
    > > < // <BeginSession
    > > < // xmlns="urn:schemas-microsoft-com:xml-analysis"
    > > < // mustUnderstand="1"/>
    > > < // </Header>
    > > < //
    > > < // Note the Password element with no value in it.
    > > < String sessionString =
    > > < "session_"
    > > < + context.get(CONTEXT_XMLA_USERNAME)
    > > < + "_"
    > > < + "_"
    > > < + context.get("remote_host");
    > > < return Long.toString(sessionString.hashCode(), 35);
    > > < } else {
    > > < // Generate a semi-random new session ID.
    > > < return Long.toString(
    > > < -17L * System.nanoTime() + 11L *

    > System.currentTimeMillis(),
    > > < 35);
    > > < }
    > > ---
    > >>
    > >>
    > >> // Generate a pseudo-random new session ID.
    > >> return Long.toString(17L * System.nanoTime()
    > >> +
    > >> 3L * System.currentTimeMillis(), 35);

    > > 472c441,443
    > > < protected String getSessionId(Element e, Map<String, Object>

    > context)
    > > ---
    > >>
    > >> private static String getSessionIdFromRequest(Element e,
    > >> Map<String, Object> context)

    > > 485,486c456,458
    > > < String value = attr.getValue();
    > > < if (value == null) {
    > > ---
    > >>
    > >> String sessionId = attr.getValue();
    > >> if (sessionId == null) {

    > > 494c466
    > > < return value;
    > > ---
    > >> return sessionId;

    > > 845c817,822
    > > < SessionInfo sessionInfo;
    > > ---
    > >> if (sessionId == null) {
    > >> return null;
    > >> }
    > >>
    > >> SessionInfo sessionInfo = null;
    > >>

    > > 848a826
    > >>

    > > 851,852c829,831
    > > < "No login credentials for found for session [" +

    > sessionId
    > > < + "]");
    > > ---
    > >> "No login credentials for found for session ["
    > >> +
    > >> sessionId + "]");

    > > 855,856c834,837
    > > < "Found existing credentials for session id ["
    > > < + sessionId + "], username=[" + sessionInfo.user +

    > "]");
    > > ---
    > >> "Found credentials for session id ["
    > >> + sessionId
    > >> + "], username=[" + sessionInfo.user
    > >> + "] in servlet cache");

    > > 876c857
    > > < new SessionInfo(sessionId, username, password);
    > > ---
    > >> new SessionInfo(username, password);

    > > 882c863
    > > < sessionInfo = new SessionInfo(sessionId, username,

    > password);
    > > ---
    > >> sessionInfo = new SessionInfo(username, password);

    > > 888c869,871
    > > <
    > > ---
    > >> /**
    > >> * Holds authentication credentials of a XMLA session.
    > >> */

    > > 890d872
    > > < final String id;
    > > 894,895c876,877
    > > < public SessionInfo(String id, String user, String password) {
    > > < this.id = id;
    > > ---
    > >> public SessionInfo(String user, String password)
    > >> {

    > > 901d882
    > > <
    > >
    > > ==== //open/mondrian/src/main/mondrian/xmla/impl/Olap4jXmlaServlet.java#4

    > (ktext) ====
    > >
    > > 2c2
    > > < // $Id:

    > //open/mondrian/src/main/mondrian/xmla/impl/Olap4jXmlaServlet.java#3 $
    > > ---
    > >> // $Id:

    > //open/mondrian/src/main/mondrian/xmla/impl/Olap4jXmlaServlet.java#4 $
    > > 28a29
    > >> import java.lang.reflect.UndeclaredThrowableException;

    > > 36c37
    > > < * @version $Id:

    > //open/mondrian/src/main/mondrian/xmla/impl/Olap4jXmlaServlet.java#3 $
    > > ---
    > >> * @version $Id:

    > //open/mondrian/src/main/mondrian/xmla/impl/Olap4jXmlaServlet.java#4 $
    > > 415a417
    > >>

    > > 422,423c424,427
    > > < if (OlapConnection.class.isAssignableFrom(
    > > < method.getClass()))
    > > ---
    > >> if ("unwrap".equals(method.getName())
    > >> ||
    > >> OlapConnection.class.isAssignableFrom(
    > >> method.getDeclaringClass()))

    > >

    >
    >


    _______________________________________________
    Mondrian mailing list
    Mondrian (AT) pentaho (DOT) org
    http://lists.pentaho.org/mailman/listinfo/mondrian

  4. #4
    Michele Rossi Guest

    Default Re: [Mondrian] Eigenbase perforce change 14566 for review

    hi Julian,
    I've fixed all the code formatting exceptions flagged by checkFile.sh.

    I had to slightly fix checkFile.sh as it was not working in cygwin due to
    wrong end of line characters.
    I did that using a tool called textpad - "save as", "file format", "UNIX".

    Also the comments on checkFile.sh say that it's the same script used by
    Perforce on check-ins.
    That's probably no longer true as Perforce allowed my changes in while
    checkFile flagged many exceptions.
    Perhaps the trigger on the Perforce server needs updating?

    It's been fairly time consuming to comply the code formatting rules using
    Eclipse.
    With these restrictions changing a large amount of code would be a very
    daunting perspective.

    I think it's pretty safe to say that Eclipse is the most widespread Java IDE
    and that it's probably worth trying to create an eclipse formatting file to
    help with this task.

    Where can I see your formatting rules in a human readable format?



    thanks,
    Michele


    On 25 August 2011 22:15, Michele Rossi <michele.rossi (AT) gmail (DOT) com> wrote:

    > Hi,
    > I fixed all the exceptions raised by Perforce when attempting to check in
    > and I assumed they were the same checks made by the checkFile script.
    > Wrong assumption sorry.
    >
    > Ok I will run checkFile tomorrow as soon as I get back to work (it's 22:15
    > here now).
    >
    > thanks,
    > Michele
    >
    >
    > On 25 August 2011 21:29, Julian Hyde <jhyde (AT) pentaho (DOT) com> wrote:
    >
    >> Michele,
    >>
    >> Congratulations on your first check in.
    >>
    >> However, it had 17 checkFile exceptions. Can you fix today please.
    >>
    >> Julian
    >>
    >> On Aug 25, 2011, at 12:44 AM, Michele Rossi wrote:
    >>
    >> > http://p4web.eigenbase.org/@md=d&c=6PU@/14566?ac=10
    >> >
    >> > Change 14566 by mrossi@michele_mondrian on 2011/08/25 00:43:32
    >> >
    >> > MONDRIAN: fixes to xmla servlet
    >> >
    >> > Affected files ...
    >> >
    >> > ... //open/mondrian/src/main/mondrian/xmla/XmlaHandler.java#80 edit
    >> > ...

    >> //open/mondrian/src/main/mondrian/xmla/impl/DefaultXmlaServlet.java#33 edit
    >> > ... //open/mondrian/src/main/mondrian/xmla/impl/Olap4jXmlaServlet.java#4

    >> edit
    >> >
    >> > Differences ...
    >> >
    >> > ==== //open/mondrian/src/main/mondrian/xmla/XmlaHandler.java#80 (ktext)

    >> ====
    >> >
    >> > 2c2
    >> > < // $Id: //open/mondrian/src/main/mondrian/xmla/XmlaHandler.java#79 $
    >> > ---
    >> >> // $Id: //open/mondrian/src/main/mondrian/xmla/XmlaHandler.java#80 $
    >> > 27a28,29
    >> >> import java.lang.reflect.InvocationTargetException;
    >> >> import java.lang.reflect.UndeclaredThrowableException;
    >> > 41c43
    >> > < * @version $Id:

    >> //open/mondrian/src/main/mondrian/xmla/XmlaHandler.java#79 $
    >> > ---
    >> >> * @version $Id:

    >> //open/mondrian/src/main/mondrian/xmla/XmlaHandler.java#80 $
    >> > 75a78,102
    >> >> } catch (UndeclaredThrowableException ute) {
    >> >> //
    >> >> // Note: this is necessary because we use a dynamic proxy

    >> for the
    >> >> // connection.
    >> >> // I could not catch and un-wrap the Undeclared Throwable

    >> within
    >> >> // the proxy.
    >> >> // The exception comes out here and I couldn't find any

    >> better
    >> >> // ways to deal with it.
    >> >> //
    >> >> // The undeclared throwable contains an Invocation Target

    >> Exception
    >> >> // which in turns contains the real exception thrown by the

    >> "unwrap"
    >> >> // method, for example OlapException.
    >> >> //
    >> >>
    >> >> Throwable cause = ute.getCause();
    >> >> if (cause instanceof InvocationTargetException) {
    >> >> cause = cause.getCause();
    >> >> }
    >> >>
    >> >> // this maintains the original behaviour: don't catch

    >> exceptions
    >> >> // that are not subclasses of SQLException
    >> >>
    >> >> if (! (cause instanceof SQLException)) {
    >> >> throw ute;
    >> >> }
    >> >
    >> > ====

    >> //open/mondrian/src/main/mondrian/xmla/impl/DefaultXmlaServlet.java#33
    >> (ktext) ====
    >> >
    >> > 2c2
    >> > < // $Id:

    >> //open/mondrian/src/main/mondrian/xmla/impl/DefaultXmlaServlet.java#32 $
    >> > ---
    >> >> // $Id:

    >> //open/mondrian/src/main/mondrian/xmla/impl/DefaultXmlaServlet.java#33 $
    >> > 12c12,18
    >> > < import java.io.*;
    >> > ---
    >> >> import java.io.ByteArrayInputStream;
    >> >> import java.io.ByteArrayOutputStream;
    >> >> import java.io.IOException;
    >> >> import java.io.InputStream;
    >> >> import java.io.OutputStream;
    >> >> import java.io.StringWriter;
    >> >> import java.io.UnsupportedEncodingException;
    >> > 14,15c20,24
    >> > < import java.nio.channels.*;
    >> > < import java.util.*;
    >> > ---
    >> >> import java.nio.channels.Channels;
    >> >> import java.nio.channels.ReadableByteChannel;
    >> >> import java.nio.channels.WritableByteChannel;
    >> >> import java.util.HashMap;
    >> >> import java.util.Map;
    >> > 17,19c26,32
    >> > < import javax.servlet.*;
    >> > < import javax.servlet.http.*;
    >> > < import javax.xml.parsers.*;
    >> > ---
    >> >> import javax.servlet.ServletConfig;
    >> >> import javax.servlet.ServletException;
    >> >> import javax.servlet.http.HttpServletRequest;
    >> >> import javax.servlet.http.HttpServletResponse;
    >> >> import javax.xml.parsers.DocumentBuilder;
    >> >> import javax.xml.parsers.DocumentBuilderFactory;
    >> >> import javax.xml.parsers.ParserConfigurationException;
    >> > 21d33
    >> > < import mondrian.xmla.*;
    >> > 22a35,42
    >> >> import mondrian.xmla.SaxWriter;
    >> >> import mondrian.xmla.XmlaConstants;
    >> >> import mondrian.xmla.XmlaException;
    >> >> import mondrian.xmla.XmlaRequest;
    >> >> import mondrian.xmla.XmlaRequestCallback;
    >> >> import mondrian.xmla.XmlaResponse;
    >> >> import mondrian.xmla.XmlaServlet;
    >> >> import mondrian.xmla.XmlaUtil;
    >> > 25,26c45,51
    >> > < import org.w3c.dom.*;
    >> > < import org.xml.sax.*;
    >> > ---
    >> >> import org.w3c.dom.Attr;
    >> >> import org.w3c.dom.Document;
    >> >> import org.w3c.dom.Element;
    >> >> import org.w3c.dom.Node;
    >> >> import org.w3c.dom.NodeList;
    >> >> import org.xml.sax.InputSource;
    >> >> import org.xml.sax.SAXException;
    >> > 32c57
    >> > < * @version $Id:

    >> //open/mondrian/src/main/mondrian/xmla/impl/DefaultXmlaServlet.java#32 $
    >> > ---
    >> >> * @version $Id:

    >> //open/mondrian/src/main/mondrian/xmla/impl/DefaultXmlaServlet.java#33 $
    >> > 45,52d69
    >> > < /**
    >> > < * Simba O2X for some reason attempts to create many new xmla

    >> sessions
    >> > < * during the same user interactions. We can mitigate that by

    >> creating a
    >> > < * session id which is a direct hash function of the credentials

    >> supplied
    >> > < * and the remote host IP.
    >> > < */
    >> > < private static final String REUSE_SESSION_IDS = "reuseSessionIds";
    >> > <
    >> > 56d72
    >> > < private boolean reuseSessionIds = false;
    >> > 61,63d76
    >> > < *
    >> > < * <p>NOTE: There is no mechanism to remove entries from this map,
    >> > < * so it will get larger if the server is up for a long time.</p>
    >> > 74,76d86
    >> > < this.reuseSessionIds =
    >> > < Boolean.parseBoolean(
    >> > < servletConfig.getInitParameter(REUSE_SESSION_IDS));
    >> > 79c89
    >> > < protected DocumentBuilderFactory getDocumentBuilderFactory() {
    >> > ---
    >> >> protected static DocumentBuilderFactory getDocumentBuilderFactory()

    >> {
    >> > 239a250
    >> >>
    >> > 277a289
    >> >>
    >> > 281d292
    >> > < context.put(CONTEXT_XMLA_PASSWORD,

    >> passwordStr);
    >> > 283,285c294,296
    >> > < // [MROSSI] TODO we'd need to inject the

    >> HttpServletRequest
    >> > < // into this method context.put("remote_host",
    >> > < // request.getRemoteHost());
    >> > ---
    >> >>
    >> >> context.put(CONTEXT_XMLA_PASSWORD, passwordStr);
    >> >>
    >> > 287c298
    >> > < LOGGER.error(
    >> > ---
    >> >> LOGGER.warn(
    >> > 319d329
    >> > < // generate SessionId
    >> > 328,330c338,347
    >> > < // extract the SessionId attrs value and put into
    >> > < // context
    >> > < sessionIdStr = getSessionId(e, context);
    >> > ---
    >> >> sessionIdStr = getSessionIdFromRequest(e, context);
    >> >>
    >> >> SessionInfo sessionInfo =

    >> getSessionInfo(sessionIdStr);
    >> >>
    >> >> if (sessionInfo != null) {
    >> >> context.put(CONTEXT_XMLA_USERNAME,

    >> sessionInfo.user);
    >> >> context.put(
    >> >> CONTEXT_XMLA_PASSWORD,
    >> >> sessionInfo.password);
    >> >> }
    >> > 338,349c355
    >> > < // extract the SessionId attrs value and put into
    >> > < // context
    >> > < sessionIdStr = getSessionId(e, context);
    >> > <
    >> > < SessionInfo sessionInfo =
    >> > < getSessionInfo(sessionIdStr);
    >> > < if (sessionInfo != null) {
    >> > < context.put(CONTEXT_XMLA_USERNAME,

    >> sessionInfo.user);
    >> > < context.put(
    >> > < CONTEXT_XMLA_PASSWORD,

    >> sessionInfo.password);
    >> > < }
    >> > < context.put(CONTEXT_XMLA_SESSION_ID,

    >> sessionIdStr);
    >> > ---
    >> >> sessionIdStr = getSessionIdFromRequest(e, context);
    >> > 354,355d359
    >> > < // remove session info
    >> > < removeSessionInfo(sessionIdStr);
    >> > 392a397
    >> >>
    >> > 419,423d423
    >> > < private void removeSessionInfo(String sessionIdStr) {
    >> > < synchronized (sessionInfos) {
    >> > < sessionInfos.remove(sessionIdStr);
    >> > < }
    >> > < }
    >> > 425a426
    >> >>
    >> > 432,469c433,438
    >> > < /*
    >> > < * Fallback to the default session ID generation algorithm.
    >> > < */
    >> > < if (reuseSessionIds) {
    >> > < // This is how we use the same session id (key to retrieve

    >> a
    >> > < // connection) for requests with the same username coming

    >> from
    >> > < // the same remote host. The password can't be part of the
    >> > < // string because if you use Simba and you don't tick

    >> "save
    >> > < // password" in the login dialog then Simba only sends the
    >> > < // password with the first session that it opens - after

    >> which
    >> > < // it sends something like the following:
    >> > < //
    >> > < // <Header>
    >> > < // <Security xmlns="

    >> http://schemas.xmlsoap.org/ws/2002/04/secext">
    >> > < // <UsernameToken>
    >> > < // <Username>michele</Username>
    >> > < // <Password Type="PasswordText"/>
    >> > < // </UsernameToken>
    >> > < // </Security>
    >> > < // <BeginSession
    >> > < // xmlns="urn:schemas-microsoft-com:xml-analysis"
    >> > < // mustUnderstand="1"/>
    >> > < // </Header>
    >> > < //
    >> > < // Note the Password element with no value in it.
    >> > < String sessionString =
    >> > < "session_"
    >> > < + context.get(CONTEXT_XMLA_USERNAME)
    >> > < + "_"
    >> > < + "_"
    >> > < + context.get("remote_host");
    >> > < return Long.toString(sessionString.hashCode(), 35);
    >> > < } else {
    >> > < // Generate a semi-random new session ID.
    >> > < return Long.toString(
    >> > < -17L * System.nanoTime() + 11L *

    >> System.currentTimeMillis(),
    >> > < 35);
    >> > < }
    >> > ---
    >> >>
    >> >>
    >> >> // Generate a pseudo-random new session ID.
    >> >> return Long.toString(17L * System.nanoTime()
    >> >> +
    >> >> 3L * System.currentTimeMillis(), 35);
    >> > 472c441,443
    >> > < protected String getSessionId(Element e, Map<String, Object>

    >> context)
    >> > ---
    >> >>
    >> >> private static String getSessionIdFromRequest(Element e,
    >> >> Map<String, Object> context)
    >> > 485,486c456,458
    >> > < String value = attr.getValue();
    >> > < if (value == null) {
    >> > ---
    >> >>
    >> >> String sessionId = attr.getValue();
    >> >> if (sessionId == null) {
    >> > 494c466
    >> > < return value;
    >> > ---
    >> >> return sessionId;
    >> > 845c817,822
    >> > < SessionInfo sessionInfo;
    >> > ---
    >> >> if (sessionId == null) {
    >> >> return null;
    >> >> }
    >> >>
    >> >> SessionInfo sessionInfo = null;
    >> >>
    >> > 848a826
    >> >>
    >> > 851,852c829,831
    >> > < "No login credentials for found for session [" +

    >> sessionId
    >> > < + "]");
    >> > ---
    >> >> "No login credentials for found for session ["
    >> >> +
    >> >> sessionId + "]");
    >> > 855,856c834,837
    >> > < "Found existing credentials for session id ["
    >> > < + sessionId + "], username=[" + sessionInfo.user +

    >> "]");
    >> > ---
    >> >> "Found credentials for session id ["
    >> >> + sessionId
    >> >> + "], username=[" + sessionInfo.user
    >> >> + "] in servlet cache");
    >> > 876c857
    >> > < new SessionInfo(sessionId, username,

    >> password);
    >> > ---
    >> >> new SessionInfo(username, password);
    >> > 882c863
    >> > < sessionInfo = new SessionInfo(sessionId, username,

    >> password);
    >> > ---
    >> >> sessionInfo = new SessionInfo(username, password);
    >> > 888c869,871
    >> > <
    >> > ---
    >> >> /**
    >> >> * Holds authentication credentials of a XMLA session.
    >> >> */
    >> > 890d872
    >> > < final String id;
    >> > 894,895c876,877
    >> > < public SessionInfo(String id, String user, String password) {
    >> > < this.id = id;
    >> > ---
    >> >> public SessionInfo(String user, String password)
    >> >> {
    >> > 901d882
    >> > <
    >> >
    >> > ====

    >> //open/mondrian/src/main/mondrian/xmla/impl/Olap4jXmlaServlet.java#4 (ktext)
    >> ====
    >> >
    >> > 2c2
    >> > < // $Id:

    >> //open/mondrian/src/main/mondrian/xmla/impl/Olap4jXmlaServlet.java#3 $
    >> > ---
    >> >> // $Id:

    >> //open/mondrian/src/main/mondrian/xmla/impl/Olap4jXmlaServlet.java#4 $
    >> > 28a29
    >> >> import java.lang.reflect.UndeclaredThrowableException;
    >> > 36c37
    >> > < * @version $Id:

    >> //open/mondrian/src/main/mondrian/xmla/impl/Olap4jXmlaServlet.java#3 $
    >> > ---
    >> >> * @version $Id:

    >> //open/mondrian/src/main/mondrian/xmla/impl/Olap4jXmlaServlet.java#4 $
    >> > 415a417
    >> >>
    >> > 422,423c424,427
    >> > < if (OlapConnection.class.isAssignableFrom(
    >> > < method.getClass()))
    >> > ---
    >> >> if ("unwrap".equals(method.getName())
    >> >> ||
    >> >> OlapConnection.class.isAssignableFrom(
    >> >> method.getDeclaringClass()))
    >> >

    >>
    >>

    >


    _______________________________________________
    Mondrian mailing list
    Mondrian (AT) pentaho (DOT) org
    http://lists.pentaho.org/mailman/listinfo/mondrian

  5. #5
    Luc Boudreau Guest

    Default Re: [Mondrian] Eigenbase perforce change 14566 for review

    Michele,

    I am a fervent user of Eclipse myself, so I can relate to your feelings. If
    you are feeling up to the task of creating an Eclipse profile for our coding
    standards, I might give you a hand. I understand our coding standards are
    quite strict, but trust us on that one, it helps a lot in the long run.
    Mondrian is a pretty big project, and I'd hate to have to browse daily
    through that much code if it was all written in a different style. Besides,
    we never modify that much code in a single swoop, and before you know it,
    you'll know all the rules by heart.

    As for the 'unseen formatting errors', make sure that you run the checkFile
    utility with the --strict flag. I usually run:

    ../bin/checkfile.sh --strict --under ./

    Thanks for fixing the end of line issue. It's been bugging me for years but
    I've always fixed it locally without ever checking it in. Have you tested
    your changes on linux / mac as well? Just wondering...

    Luc

    PS. If you want to see the formatting rules in a 'human readable format',
    well, the code itself is the best place I guess...



    On Fri, Aug 26, 2011 at 3:04 AM, Michele Rossi <michele.rossi (AT) gmail (DOT) com>wrote:

    > hi Julian,
    > I've fixed all the code formatting exceptions flagged by checkFile.sh.
    >
    > I had to slightly fix checkFile.sh as it was not working in cygwin due to
    > wrong end of line characters.
    > I did that using a tool called textpad - "save as", "file format", "UNIX".
    >
    > Also the comments on checkFile.sh say that it's the same script used by
    > Perforce on check-ins.
    > That's probably no longer true as Perforce allowed my changes in while
    > checkFile flagged many exceptions.
    > Perhaps the trigger on the Perforce server needs updating?
    >
    > It's been fairly time consuming to comply the code formatting rules using
    > Eclipse.
    > With these restrictions changing a large amount of code would be a very
    > daunting perspective.
    >
    > I think it's pretty safe to say that Eclipse is the most widespread Java
    > IDE and that it's probably worth trying to create an eclipse formatting file
    > to help with this task.
    >
    > Where can I see your formatting rules in a human readable format?
    >
    >
    >
    > thanks,
    > Michele
    >
    >
    >
    > On 25 August 2011 22:15, Michele Rossi <michele.rossi (AT) gmail (DOT) com> wrote:
    >
    >> Hi,
    >> I fixed all the exceptions raised by Perforce when attempting to check in
    >> and I assumed they were the same checks made by the checkFile script.
    >> Wrong assumption sorry.
    >>
    >> Ok I will run checkFile tomorrow as soon as I get back to work (it's 22:15
    >> here now).
    >>
    >> thanks,
    >> Michele
    >>
    >>
    >> On 25 August 2011 21:29, Julian Hyde <jhyde (AT) pentaho (DOT) com> wrote:
    >>
    >>> Michele,
    >>>
    >>> Congratulations on your first check in.
    >>>
    >>> However, it had 17 checkFile exceptions. Can you fix today please.
    >>>
    >>> Julian
    >>>
    >>> On Aug 25, 2011, at 12:44 AM, Michele Rossi wrote:
    >>>
    >>> > http://p4web.eigenbase.org/@md=d&c=6PU@/14566?ac=10
    >>> >
    >>> > Change 14566 by mrossi@michele_mondrian on 2011/08/25 00:43:32
    >>> >
    >>> > MONDRIAN: fixes to xmla servlet
    >>> >
    >>> > Affected files ...
    >>> >
    >>> > ... //open/mondrian/src/main/mondrian/xmla/XmlaHandler.java#80 edit
    >>> > ...
    >>> //open/mondrian/src/main/mondrian/xmla/impl/DefaultXmlaServlet.java#33 edit
    >>> > ...
    >>> //open/mondrian/src/main/mondrian/xmla/impl/Olap4jXmlaServlet.java#4 edit
    >>> >
    >>> > Differences ...
    >>> >
    >>> > ==== //open/mondrian/src/main/mondrian/xmla/XmlaHandler.java#80 (ktext)
    >>> ====
    >>> >
    >>> > 2c2
    >>> > < // $Id: //open/mondrian/src/main/mondrian/xmla/XmlaHandler.java#79 $
    >>> > ---
    >>> >> // $Id: //open/mondrian/src/main/mondrian/xmla/XmlaHandler.java#80 $
    >>> > 27a28,29
    >>> >> import java.lang.reflect.InvocationTargetException;
    >>> >> import java.lang.reflect.UndeclaredThrowableException;
    >>> > 41c43
    >>> > < * @version $Id:
    >>> //open/mondrian/src/main/mondrian/xmla/XmlaHandler.java#79 $
    >>> > ---
    >>> >> * @version $Id:
    >>> //open/mondrian/src/main/mondrian/xmla/XmlaHandler.java#80 $
    >>> > 75a78,102
    >>> >> } catch (UndeclaredThrowableException ute) {
    >>> >> //
    >>> >> // Note: this is necessary because we use a dynamic proxy
    >>> for the
    >>> >> // connection.
    >>> >> // I could not catch and un-wrap the Undeclared Throwable
    >>> within
    >>> >> // the proxy.
    >>> >> // The exception comes out here and I couldn't find any
    >>> better
    >>> >> // ways to deal with it.
    >>> >> //
    >>> >> // The undeclared throwable contains an Invocation Target
    >>> Exception
    >>> >> // which in turns contains the real exception thrown by the
    >>> "unwrap"
    >>> >> // method, for example OlapException.
    >>> >> //
    >>> >>
    >>> >> Throwable cause = ute.getCause();
    >>> >> if (cause instanceof InvocationTargetException) {
    >>> >> cause = cause.getCause();
    >>> >> }
    >>> >>
    >>> >> // this maintains the original behaviour: don't catch
    >>> exceptions
    >>> >> // that are not subclasses of SQLException
    >>> >>
    >>> >> if (! (cause instanceof SQLException)) {
    >>> >> throw ute;
    >>> >> }
    >>> >
    >>> > ====
    >>> //open/mondrian/src/main/mondrian/xmla/impl/DefaultXmlaServlet.java#33
    >>> (ktext) ====
    >>> >
    >>> > 2c2
    >>> > < // $Id:
    >>> //open/mondrian/src/main/mondrian/xmla/impl/DefaultXmlaServlet.java#32 $
    >>> > ---
    >>> >> // $Id:
    >>> //open/mondrian/src/main/mondrian/xmla/impl/DefaultXmlaServlet.java#33 $
    >>> > 12c12,18
    >>> > < import java.io.*;
    >>> > ---
    >>> >> import java.io.ByteArrayInputStream;
    >>> >> import java.io.ByteArrayOutputStream;
    >>> >> import java.io.IOException;
    >>> >> import java.io.InputStream;
    >>> >> import java.io.OutputStream;
    >>> >> import java.io.StringWriter;
    >>> >> import java.io.UnsupportedEncodingException;
    >>> > 14,15c20,24
    >>> > < import java.nio.channels.*;
    >>> > < import java.util.*;
    >>> > ---
    >>> >> import java.nio.channels.Channels;
    >>> >> import java.nio.channels.ReadableByteChannel;
    >>> >> import java.nio.channels.WritableByteChannel;
    >>> >> import java.util.HashMap;
    >>> >> import java.util.Map;
    >>> > 17,19c26,32
    >>> > < import javax.servlet.*;
    >>> > < import javax.servlet.http.*;
    >>> > < import javax.xml.parsers.*;
    >>> > ---
    >>> >> import javax.servlet.ServletConfig;
    >>> >> import javax.servlet.ServletException;
    >>> >> import javax.servlet.http.HttpServletRequest;
    >>> >> import javax.servlet.http.HttpServletResponse;
    >>> >> import javax.xml.parsers.DocumentBuilder;
    >>> >> import javax.xml.parsers.DocumentBuilderFactory;
    >>> >> import javax.xml.parsers.ParserConfigurationException;
    >>> > 21d33
    >>> > < import mondrian.xmla.*;
    >>> > 22a35,42
    >>> >> import mondrian.xmla.SaxWriter;
    >>> >> import mondrian.xmla.XmlaConstants;
    >>> >> import mondrian.xmla.XmlaException;
    >>> >> import mondrian.xmla.XmlaRequest;
    >>> >> import mondrian.xmla.XmlaRequestCallback;
    >>> >> import mondrian.xmla.XmlaResponse;
    >>> >> import mondrian.xmla.XmlaServlet;
    >>> >> import mondrian.xmla.XmlaUtil;
    >>> > 25,26c45,51
    >>> > < import org.w3c.dom.*;
    >>> > < import org.xml.sax.*;
    >>> > ---
    >>> >> import org.w3c.dom.Attr;
    >>> >> import org.w3c.dom.Document;
    >>> >> import org.w3c.dom.Element;
    >>> >> import org.w3c.dom.Node;
    >>> >> import org.w3c.dom.NodeList;
    >>> >> import org.xml.sax.InputSource;
    >>> >> import org.xml.sax.SAXException;
    >>> > 32c57
    >>> > < * @version $Id:
    >>> //open/mondrian/src/main/mondrian/xmla/impl/DefaultXmlaServlet.java#32 $
    >>> > ---
    >>> >> * @version $Id:
    >>> //open/mondrian/src/main/mondrian/xmla/impl/DefaultXmlaServlet.java#33 $
    >>> > 45,52d69
    >>> > < /**
    >>> > < * Simba O2X for some reason attempts to create many new xmla
    >>> sessions
    >>> > < * during the same user interactions. We can mitigate that by
    >>> creating a
    >>> > < * session id which is a direct hash function of the credentials
    >>> supplied
    >>> > < * and the remote host IP.
    >>> > < */
    >>> > < private static final String REUSE_SESSION_IDS =
    >>> "reuseSessionIds";
    >>> > <
    >>> > 56d72
    >>> > < private boolean reuseSessionIds = false;
    >>> > 61,63d76
    >>> > < *
    >>> > < * <p>NOTE: There is no mechanism to remove entries from this
    >>> map,
    >>> > < * so it will get larger if the server is up for a long time.</p>
    >>> > 74,76d86
    >>> > < this.reuseSessionIds =
    >>> > < Boolean.parseBoolean(
    >>> > < servletConfig.getInitParameter(REUSE_SESSION_IDS));
    >>> > 79c89
    >>> > < protected DocumentBuilderFactory getDocumentBuilderFactory() {
    >>> > ---
    >>> >> protected static DocumentBuilderFactory getDocumentBuilderFactory()
    >>> {
    >>> > 239a250
    >>> >>
    >>> > 277a289
    >>> >>
    >>> > 281d292
    >>> > < context.put(CONTEXT_XMLA_PASSWORD,
    >>> passwordStr);
    >>> > 283,285c294,296
    >>> > < // [MROSSI] TODO we'd need to inject the
    >>> HttpServletRequest
    >>> > < // into this method context.put("remote_host",
    >>> > < // request.getRemoteHost());
    >>> > ---
    >>> >>
    >>> >> context.put(CONTEXT_XMLA_PASSWORD, passwordStr);
    >>> >>
    >>> > 287c298
    >>> > < LOGGER.error(
    >>> > ---
    >>> >> LOGGER.warn(
    >>> > 319d329
    >>> > < // generate SessionId
    >>> > 328,330c338,347
    >>> > < // extract the SessionId attrs value and put into
    >>> > < // context
    >>> > < sessionIdStr = getSessionId(e, context);
    >>> > ---
    >>> >> sessionIdStr = getSessionIdFromRequest(e, context);
    >>> >>
    >>> >> SessionInfo sessionInfo =
    >>> getSessionInfo(sessionIdStr);
    >>> >>
    >>> >> if (sessionInfo != null) {
    >>> >> context.put(CONTEXT_XMLA_USERNAME,
    >>> sessionInfo.user);
    >>> >> context.put(
    >>> >> CONTEXT_XMLA_PASSWORD,
    >>> >> sessionInfo.password);
    >>> >> }
    >>> > 338,349c355
    >>> > < // extract the SessionId attrs value and put into
    >>> > < // context
    >>> > < sessionIdStr = getSessionId(e, context);
    >>> > <
    >>> > < SessionInfo sessionInfo =
    >>> > < getSessionInfo(sessionIdStr);
    >>> > < if (sessionInfo != null) {
    >>> > < context.put(CONTEXT_XMLA_USERNAME,
    >>> sessionInfo.user);
    >>> > < context.put(
    >>> > < CONTEXT_XMLA_PASSWORD,
    >>> sessionInfo.password);
    >>> > < }
    >>> > < context.put(CONTEXT_XMLA_SESSION_ID,
    >>> sessionIdStr);
    >>> > ---
    >>> >> sessionIdStr = getSessionIdFromRequest(e, context);
    >>> > 354,355d359
    >>> > < // remove session info
    >>> > < removeSessionInfo(sessionIdStr);
    >>> > 392a397
    >>> >>
    >>> > 419,423d423
    >>> > < private void removeSessionInfo(String sessionIdStr) {
    >>> > < synchronized (sessionInfos) {
    >>> > < sessionInfos.remove(sessionIdStr);
    >>> > < }
    >>> > < }
    >>> > 425a426
    >>> >>
    >>> > 432,469c433,438
    >>> > < /*
    >>> > < * Fallback to the default session ID generation algorithm.
    >>> > < */
    >>> > < if (reuseSessionIds) {
    >>> > < // This is how we use the same session id (key to
    >>> retrieve a
    >>> > < // connection) for requests with the same username coming
    >>> from
    >>> > < // the same remote host. The password can't be part of
    >>> the
    >>> > < // string because if you use Simba and you don't tick
    >>> "save
    >>> > < // password" in the login dialog then Simba only sends
    >>> the
    >>> > < // password with the first session that it opens - after
    >>> which
    >>> > < // it sends something like the following:
    >>> > < //
    >>> > < // <Header>
    >>> > < // <Security xmlns="
    >>> http://schemas.xmlsoap.org/ws/2002/04/secext">
    >>> > < // <UsernameToken>
    >>> > < // <Username>michele</Username>
    >>> > < // <Password Type="PasswordText"/>
    >>> > < // </UsernameToken>
    >>> > < // </Security>
    >>> > < // <BeginSession
    >>> > < // xmlns="urn:schemas-microsoft-com:xml-analysis"
    >>> > < // mustUnderstand="1"/>
    >>> > < // </Header>
    >>> > < //
    >>> > < // Note the Password element with no value in it.
    >>> > < String sessionString =
    >>> > < "session_"
    >>> > < + context.get(CONTEXT_XMLA_USERNAME)
    >>> > < + "_"
    >>> > < + "_"
    >>> > < + context.get("remote_host");
    >>> > < return Long.toString(sessionString.hashCode(), 35);
    >>> > < } else {
    >>> > < // Generate a semi-random new session ID.
    >>> > < return Long.toString(
    >>> > < -17L * System.nanoTime() + 11L *
    >>> System.currentTimeMillis(),
    >>> > < 35);
    >>> > < }
    >>> > ---
    >>> >>
    >>> >>
    >>> >> // Generate a pseudo-random new session ID.
    >>> >> return Long.toString(17L * System.nanoTime()
    >>> >> +
    >>> >> 3L * System.currentTimeMillis(), 35);
    >>> > 472c441,443
    >>> > < protected String getSessionId(Element e, Map<String, Object>
    >>> context)
    >>> > ---
    >>> >>
    >>> >> private static String getSessionIdFromRequest(Element e,
    >>> >> Map<String, Object> context)
    >>> > 485,486c456,458
    >>> > < String value = attr.getValue();
    >>> > < if (value == null) {
    >>> > ---
    >>> >>
    >>> >> String sessionId = attr.getValue();
    >>> >> if (sessionId == null) {
    >>> > 494c466
    >>> > < return value;
    >>> > ---
    >>> >> return sessionId;
    >>> > 845c817,822
    >>> > < SessionInfo sessionInfo;
    >>> > ---
    >>> >> if (sessionId == null) {
    >>> >> return null;
    >>> >> }
    >>> >>
    >>> >> SessionInfo sessionInfo = null;
    >>> >>
    >>> > 848a826
    >>> >>
    >>> > 851,852c829,831
    >>> > < "No login credentials for found for session [" +
    >>> sessionId
    >>> > < + "]");
    >>> > ---
    >>> >> "No login credentials for found for session ["
    >>> >> +
    >>> >> sessionId + "]");
    >>> > 855,856c834,837
    >>> > < "Found existing credentials for session id ["
    >>> > < + sessionId + "], username=[" + sessionInfo.user +
    >>> "]");
    >>> > ---
    >>> >> "Found credentials for session id ["
    >>> >> + sessionId
    >>> >> + "], username=[" + sessionInfo.user
    >>> >> + "] in servlet cache");
    >>> > 876c857
    >>> > < new SessionInfo(sessionId, username,
    >>> password);
    >>> > ---
    >>> >> new SessionInfo(username, password);
    >>> > 882c863
    >>> > < sessionInfo = new SessionInfo(sessionId, username,
    >>> password);
    >>> > ---
    >>> >> sessionInfo = new SessionInfo(username, password);
    >>> > 888c869,871
    >>> > <
    >>> > ---
    >>> >> /**
    >>> >> * Holds authentication credentials of a XMLA session.
    >>> >> */
    >>> > 890d872
    >>> > < final String id;
    >>> > 894,895c876,877
    >>> > < public SessionInfo(String id, String user, String password) {
    >>> > < this.id = id;
    >>> > ---
    >>> >> public SessionInfo(String user, String password)
    >>> >> {
    >>> > 901d882
    >>> > <
    >>> >
    >>> > ====
    >>> //open/mondrian/src/main/mondrian/xmla/impl/Olap4jXmlaServlet.java#4 (ktext)
    >>> ====
    >>> >
    >>> > 2c2
    >>> > < // $Id:
    >>> //open/mondrian/src/main/mondrian/xmla/impl/Olap4jXmlaServlet.java#3 $
    >>> > ---
    >>> >> // $Id:
    >>> //open/mondrian/src/main/mondrian/xmla/impl/Olap4jXmlaServlet.java#4 $
    >>> > 28a29
    >>> >> import java.lang.reflect.UndeclaredThrowableException;
    >>> > 36c37
    >>> > < * @version $Id:
    >>> //open/mondrian/src/main/mondrian/xmla/impl/Olap4jXmlaServlet.java#3 $
    >>> > ---
    >>> >> * @version $Id:
    >>> //open/mondrian/src/main/mondrian/xmla/impl/Olap4jXmlaServlet.java#4 $
    >>> > 415a417
    >>> >>
    >>> > 422,423c424,427
    >>> > < if (OlapConnection.class.isAssignableFrom(
    >>> > < method.getClass()))
    >>> > ---
    >>> >> if ("unwrap".equals(method.getName())
    >>> >> ||
    >>> >> OlapConnection.class.isAssignableFrom(
    >>> >> method.getDeclaringClass()))
    >>> >
    >>>
    >>>

    >>

    >
    > _______________________________________________
    > Mondrian mailing list
    > Mondrian (AT) pentaho (DOT) org
    > http://lists.pentaho.org/mailman/listinfo/mondrian
    >
    >


    _______________________________________________
    Mondrian mailing list
    Mondrian (AT) pentaho (DOT) org
    http://lists.pentaho.org/mailman/listinfo/mondrian

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Privacy Policy | Legal Notices | Safe Harbor Privacy Policy

Copyright © 2005 - 2019 Hitachi Vantara Corporation. All Rights Reserved.