Skip to content

Commit

Permalink
Mainly code formatting.
Browse files Browse the repository at this point in the history
Fix how ConnectionTest.testXmlaCatalogParameter unwraps statements.
Clean up DoubleSubmissionTestProxy by factoring out base class DelegatingTestProxy.


git-svn-id: https://olap4j.svn.sourceforge.net/svnroot/olap4j/trunk@135 c6a108a4-781c-0410-a6c6-c2d559e19af0
  • Loading branch information
julianhyde committed Nov 12, 2008
1 parent 9c590aa commit f35e504
Show file tree
Hide file tree
Showing 24 changed files with 276 additions and 187 deletions.
2 changes: 0 additions & 2 deletions src/org/olap4j/driver/xmla/XmlaOlap4jConnection.java
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,6 @@ abstract class XmlaOlap4jConnection implements OlapConnection {
* while creating the cache.
*/
private void initSoapCache(Map<String, String> map) throws OlapException {

// Test if a SOAP cache class was defined
if (map.containsKey(XmlaOlap4jDriver.Property.Cache.name()
.toUpperCase()))
Expand Down Expand Up @@ -1368,7 +1367,6 @@ static abstract class HandlerImpl<T extends Named> implements Handler<T> {
public void sortList(List<T> list) {
// do nothing - assume XMLA returned list in correct order
}

}

static class Context {
Expand Down
4 changes: 0 additions & 4 deletions src/org/olap4j/driver/xmla/XmlaOlap4jCube.java
Original file line number Diff line number Diff line change
Expand Up @@ -434,10 +434,6 @@ public XmlaOlap4jMember lookupMemberByUniqueName(
}
}

/* (non-Javadoc)
* @see org.olap4j.driver.xmla.MetadataReader
* #lookupMembersByUniqueName(java.util.List, java.util.Map)
*/
public void lookupMembersByUniqueName(
List<String> memberUniqueNames,
Map<String, XmlaOlap4jMember> memberMap) throws OlapException
Expand Down
4 changes: 0 additions & 4 deletions src/org/olap4j/driver/xmla/XmlaOlap4jDriver.java
Original file line number Diff line number Diff line change
Expand Up @@ -149,11 +149,7 @@ private static void register() throws SQLException {
DriverManager.registerDriver(new XmlaOlap4jDriver());
}

/* (non-Javadoc)
* @see java.sql.Driver#connect(java.lang.String, java.util.Properties)
*/
public Connection connect(String url, Properties info) throws SQLException {

// Checks if this driver handles this connection, exit otherwise.
if (!XmlaOlap4jConnection.acceptsURL(url)) {
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ abstract class XmlaOlap4jPreparedStatement
this.cellSetMetaData = cellSetMetaData1.cloneFor(this);
cellSet.close();
statement.close();

} catch (SQLException e) {
throw OlapExceptionHelper.createException(
"Error while preparing statement '" + mdx + "'",
Expand Down
73 changes: 37 additions & 36 deletions src/org/olap4j/driver/xmla/XmlaOlap4jUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ abstract class XmlaOlap4jUtil {
static Document parse(byte[] in)
throws SAXException, IOException
{

InputSource source = new InputSource(new ByteArrayInputStream(in));

DOMParser parser = getParser(null, null, false);
Expand Down Expand Up @@ -110,16 +109,15 @@ static DOMParser getParser(
}

/**
* See if the DOMParser after parsing a Document has any errors and,
* if so, throw a RuntimeException exception containing the errors.
*
* Checks whether the DOMParser after parsing a Document has any errors and,
* if so, throws a RuntimeException exception containing the errors.
*/
static void checkForParseError(DOMParser parser, Throwable t) {
final ErrorHandler errorHandler = parser.getErrorHandler();

if (errorHandler instanceof SAXErrorHandler) {
final SAXErrorHandler saxEH = (SAXErrorHandler) errorHandler;
final List<SAXErrorHandler.ErrorInfo> errors = saxEH.getErrors();
final List<ErrorInfo> errors = saxEH.getErrors();

if (errors != null && errors.size() > 0) {
String errorStr = SAXErrorHandler.formatErrorInfos(saxEH);
Expand Down Expand Up @@ -162,14 +160,14 @@ static String prettyPrint(Element element) {
}

private static void prettyPrintLoop(
NodeList nodes,
StringBuilder string,
String indentation)
{
for (int index = 0; index < nodes.getLength(); index++) {
prettyPrintLoop(nodes.item(index), string, indentation);
}
NodeList nodes,
StringBuilder string,
String indentation)
{
for (int index = 0; index < nodes.getLength(); index++) {
prettyPrintLoop(nodes.item(index), string, indentation);
}
}

private static void prettyPrintLoop(
Node node,
Expand All @@ -181,9 +179,7 @@ private static void prettyPrintLoop(
}

int type = node.getNodeType();

switch (type) {

case Node.DOCUMENT_NODE:
string.append("\n");
prettyPrintLoop(node.getChildNodes(), string, indentation + "\t");
Expand All @@ -194,18 +190,19 @@ private static void prettyPrintLoop(
string.append("<");
string.append(node.getNodeName());

int length = (node.getAttributes() != null) ?
node.getAttributes().getLength() : 0;
Attr attributes[] = new Attr[length];
for (int loopIndex = 0; loopIndex < length; loopIndex++) {
attributes[loopIndex] =
(Attr)node.getAttributes().item(loopIndex);
Attr[] attributes;
if (node.getAttributes() != null) {
int length = node.getAttributes().getLength();
attributes = new Attr[length];
for (int loopIndex = 0; loopIndex < length; loopIndex++) {
attributes[loopIndex] =
(Attr)node.getAttributes().item(loopIndex);
}
} else {
attributes = new Attr[0];
}

for (int loopIndex = 0; loopIndex < attributes.length;
loopIndex++)
{
Attr attribute = attributes[loopIndex];
for (Attr attribute : attributes) {
string.append(" ");
string.append(attribute.getNodeName());
string.append("=\"");
Expand All @@ -226,7 +223,8 @@ private static void prettyPrintLoop(

case Node.TEXT_NODE:
string.append(indentation);
string.append(node.getNodeValue().trim() + "\n");
string.append(node.getNodeValue().trim());
string.append("\n");
break;

case Node.PROCESSING_INSTRUCTION_NODE:
Expand All @@ -249,7 +247,6 @@ private static void prettyPrintLoop(
}
}


static Element findChild(Element element, String ns, String tag) {
final NodeList childNodes = element.getChildNodes();
for (int i = 0; i < childNodes.getLength(); i++) {
Expand Down Expand Up @@ -329,7 +326,7 @@ static List<Element> findChildren(Element element, String ns, String tag) {
}

/**
* Convert a Node to a String.
* Converts a Node to a String.
*
* @param node XML node
* @param prettyPrint Whether to print with nice indentation
Expand Down Expand Up @@ -461,14 +458,7 @@ public static String formatErrorInfo(ErrorInfo ei) {
buf.append(ei.exception.getMessage());
return buf.toString();
}
public static class ErrorInfo {
public SAXParseException exception;
public short severity;
ErrorInfo(short severity, SAXParseException exception) {
this.severity = severity;
this.exception = exception;
}
}

private List<ErrorInfo> errors;
public SAXErrorHandler() {
}
Expand All @@ -485,7 +475,8 @@ public void error(SAXParseException exception) throws SAXException {
addError(new ErrorInfo(SEVERITY_ERROR, exception));
}
public void fatalError(SAXParseException exception)
throws SAXException {
throws SAXException
{
addError(new ErrorInfo(SEVERITY_FATAL_ERROR, exception));
}
protected void addError(ErrorInfo ei) {
Expand All @@ -501,6 +492,16 @@ public String getFirstError() {
: "";
}
}

static class ErrorInfo {
final SAXParseException exception;
final short severity;

ErrorInfo(short severity, SAXParseException exception) {
this.severity = severity;
this.exception = exception;
}
}
}

// End XmlaOlap4jUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,6 @@ public void put(final URL url, final byte[] request,
* evicting an entry based on the selected eviction mode.
*/
private void cleanExpired(boolean makeRoom) {

String toBeEvicted = null;

if (evictionMode == MODE.FIFO || evictionMode == MODE.LIFO) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,6 @@ private static synchronized void initCaches() {
if (caches == null) {
caches = new ConcurrentHashMap<String, XmlaOlap4jConcurrentMemoryCache>();
}

}

// implement XmlaOlap4jCache
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,12 +101,10 @@ protected void saveCookies(URLConnection urlConn) {
this.cookieManager.storeCookies(urlConn);
}

/* (non-Javadoc)
* @see org.olap4j.driver.xmla.XmlaOlap4jDriver.Proxy#setCache(
* java.lang.String, java.util.Properties)
*/
@SuppressWarnings("unchecked")
public void setCache(Map<String,String> config, Map<String,String> properties)
public void setCache(
Map<String,String> config,
Map<String,String> properties)
throws OlapException
{
try {
Expand Down
4 changes: 0 additions & 4 deletions src/org/olap4j/driver/xmla/proxy/XmlaOlap4jCookieManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ public XmlaOlap4jCookieManager() {
* @throws java.io.IOException Thrown if <i>conn</i> is not open.
*/
public void storeCookies(URLConnection conn) {

// Determines the domain from where these cookies are being sent
String domain = getDomainFromHost(conn.getURL().getHost());

Expand Down Expand Up @@ -125,7 +124,6 @@ public void storeCookies(URLConnection conn) {
if (this.debug == true) {
System.out.println("Saving cookie : " + name + "=" + value);
}

}

while (st.hasMoreTokens()) {
Expand Down Expand Up @@ -159,7 +157,6 @@ public void storeCookies(URLConnection conn) {
* @throws java.io.IOException Thrown if <i>conn</i> has already been opened.
*/
public void setCookies(URLConnection conn) {

// Determines the domain and path to retrieve the appropriate cookies
URL url = conn.getURL();
String domain = getDomainFromHost(url.getHost());
Expand Down Expand Up @@ -233,7 +230,6 @@ private boolean comparePaths(String cookiePath, String targetPath) {
} else {
return false;
}

}

/**
Expand Down
6 changes: 3 additions & 3 deletions src/org/olap4j/mdx/MdxUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,9 @@ static String mdxEncodeString(String st) {
char c = st.charAt(i);
if ((c == ']') &&
((i + 1) < st.length()) &&
(st.charAt(i + 1) != '.')) {

retString.append(']'); //escaping character
(st.charAt(i + 1) != '.'))
{
retString.append(']'); // escaping character
}
retString.append(c);
}
Expand Down
1 change: 0 additions & 1 deletion src/org/olap4j/transform/AxisTransform.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ protected AxisTransform(Axis axis) {
}

public SelectNode apply(SelectNode sn) {

// do a deep copy of the existing query SelectNode before
// modifying it:
SelectNode newSelectNode = sn.deepCopy();
Expand Down
24 changes: 12 additions & 12 deletions src/org/olap4j/transform/DrillDownOnPositionTransform.java
Original file line number Diff line number Diff line change
Expand Up @@ -75,24 +75,24 @@ public class DrillDownOnPositionTransform extends AxisTransform {
* @param cellSet
*/
public DrillDownOnPositionTransform(
// ParseTreeNode query,
Axis axis,
int positionOrdinalInAxis,
int memberOrdinalInPosition,
CellSet cellSet) {

Axis axis,
int positionOrdinalInAxis,
int memberOrdinalInPosition,
CellSet cellSet)
{
super(axis);
// this.positionOrdinalInAxis = positionOrdinalInAxis;
// this.memberOrdinalInPosition = memberOrdinalInPosition;
// this.cellSet = cellSet;

positionToDrill =
TransformUtil.getPositionFromCellSet(axis, positionOrdinalInAxis,
cellSet);
memberToDrill = TransformUtil.getMemberFromCellSet(axis,
positionOrdinalInAxis, memberOrdinalInPosition, cellSet);
pathToMember = TransformUtil.getPathToMember(positionToDrill,
memberOrdinalInPosition);
TransformUtil.getPositionFromCellSet(
axis, positionOrdinalInAxis, cellSet);
memberToDrill = TransformUtil.getMemberFromCellSet(
axis, positionOrdinalInAxis, memberOrdinalInPosition, cellSet);
pathToMember = TransformUtil.getPathToMember(
positionToDrill,
memberOrdinalInPosition);
}

public String getName() {
Expand Down
10 changes: 5 additions & 5 deletions src/org/olap4j/transform/DrillReplaceTransform.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,11 @@ public class DrillReplaceTransform extends AxisTransform {
* transformed
*/
public DrillReplaceTransform(
Axis axis,
int positionOrdinalInAxis,
int memberOrdinalInPosition,
CellSet cellSet) {

Axis axis,
int positionOrdinalInAxis,
int memberOrdinalInPosition,
CellSet cellSet)
{
super(axis);

// this.positionOrdinalInAxis = positionOrdinalInAxis;
Expand Down
3 changes: 0 additions & 3 deletions src/org/olap4j/transform/Quax.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
* @since Aug 7, 2008
*/
public class Quax {

private final CellSetAxis cellSetAxis;

private TreeNode<Member> memberTree;
Expand All @@ -42,9 +41,7 @@ public Quax(CellSetAxis cellSetAxis) {
for (Position p : cellSetAxis.getPositions()) {
p.getMembers();
}

}

}

// End Quax.java
10 changes: 5 additions & 5 deletions src/org/olap4j/transform/RollUpLevelTransform.java
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,11 @@ public class RollUpLevelTransform extends AxisTransform {
* @param cellSet
*/
public RollUpLevelTransform(
Axis axis,
int positionOrdinalInAxis,
int memberOrdinalInPosition,
CellSet cellSet) {

Axis axis,
int positionOrdinalInAxis,
int memberOrdinalInPosition,
CellSet cellSet)
{
super(axis);

// this.positionOrdinalInAxis = positionOrdinalInAxis;
Expand Down
1 change: 0 additions & 1 deletion src/org/olap4j/type/HierarchyType.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ public HierarchyType(
}
buf.append(">");
this.digest = buf.toString();

}

// not part of public olap4j API
Expand Down
Loading

0 comments on commit f35e504

Please sign in to comment.