Author: shawkins
Date: 2010-04-01 20:46:43 -0400 (Thu, 01 Apr 2010)
New Revision: 2020
Added:
trunk/engine/src/main/java/com/metamatrix/dqp/service/SessionServiceException.java
Removed:
trunk/engine/src/main/java/com/metamatrix/api/
trunk/engine/src/main/java/com/metamatrix/query/analysis/QueryAnnotation.java
trunk/engine/src/main/java/com/metamatrix/query/processor/program/ProgramUtil.java
Modified:
trunk/client/src/main/java/org/teiid/adminapi/Admin.java
trunk/client/src/main/java/org/teiid/client/ResultsMessage.java
trunk/client/src/main/java/org/teiid/client/plan/Annotation.java
trunk/client/src/main/java/org/teiid/jdbc/StatementImpl.java
trunk/engine/src/main/java/com/metamatrix/common/buffer/impl/BufferManagerImpl.java
trunk/engine/src/main/java/com/metamatrix/common/log/LogManager.java
trunk/engine/src/main/java/com/metamatrix/dqp/service/SessionService.java
trunk/engine/src/main/java/com/metamatrix/query/analysis/AnalysisRecord.java
trunk/engine/src/main/java/com/metamatrix/query/optimizer/relational/RelationalPlanner.java
trunk/engine/src/main/java/com/metamatrix/query/processor/proc/AssignmentInstruction.java
trunk/engine/src/main/java/com/metamatrix/query/processor/proc/CreateCursorResultSetInstruction.java
trunk/engine/src/main/java/com/metamatrix/query/processor/proc/ErrorInstruction.java
trunk/engine/src/main/java/com/metamatrix/query/processor/proc/ExecDynamicSqlInstruction.java
trunk/engine/src/main/java/com/metamatrix/query/processor/proc/IfInstruction.java
trunk/engine/src/main/java/com/metamatrix/query/processor/proc/LoopInstruction.java
trunk/engine/src/main/java/com/metamatrix/query/processor/proc/ProcedurePlan.java
trunk/engine/src/main/java/com/metamatrix/query/processor/proc/WhileInstruction.java
trunk/engine/src/main/java/com/metamatrix/query/processor/program/Program.java
trunk/engine/src/main/java/com/metamatrix/query/processor/program/ProgramInstruction.java
trunk/engine/src/main/java/com/metamatrix/query/processor/relational/RelationalNodeStatistics.java
trunk/engine/src/main/java/org/teiid/dqp/internal/process/DQPCore.java
trunk/engine/src/main/java/org/teiid/dqp/internal/process/RequestWorkItem.java
trunk/engine/src/test/java/com/metamatrix/query/analysis/TestAnalysisRecord.java
trunk/engine/src/test/java/com/metamatrix/query/optimizer/relational/TestMaterialization.java
trunk/engine/src/test/java/com/metamatrix/query/processor/FakeProcessorPlan.java
trunk/engine/src/test/java/com/metamatrix/query/processor/xml/TestXMLProcessor.java
trunk/jboss-integration/src/main/java/org/teiid/jboss/deployers/RuntimeEngineDeployer.java
trunk/runtime/src/main/java/org/teiid/services/SessionServiceImpl.java
trunk/runtime/src/main/java/org/teiid/transport/LogonImpl.java
Log:
TEIID-1026 consolidating to a single annotation class, adding logging to ping and
dqp/admin
Modified: trunk/client/src/main/java/org/teiid/adminapi/Admin.java
===================================================================
--- trunk/client/src/main/java/org/teiid/adminapi/Admin.java 2010-04-01 22:46:50 UTC (rev
2019)
+++ trunk/client/src/main/java/org/teiid/adminapi/Admin.java 2010-04-02 00:46:43 UTC (rev
2020)
@@ -30,7 +30,7 @@
public interface Admin {
- public enum Cache {CODE_TABLE_CACHE,PREPARED_PLAN_CACHE, QUERY_SERVICE_RESULT_SET_CACHE,
CONNECTOR_RESULT_SET_CACHE};
+ public enum Cache {CODE_TABLE_CACHE,PREPARED_PLAN_CACHE,
QUERY_SERVICE_RESULT_SET_CACHE};
/**
* Assign a {@link ConnectorBinding} to a {@link VDB}'s Model
Modified: trunk/client/src/main/java/org/teiid/client/ResultsMessage.java
===================================================================
--- trunk/client/src/main/java/org/teiid/client/ResultsMessage.java 2010-04-01 22:46:50
UTC (rev 2019)
+++ trunk/client/src/main/java/org/teiid/client/ResultsMessage.java 2010-04-02 00:46:43
UTC (rev 2020)
@@ -31,6 +31,8 @@
import java.util.List;
import java.util.Map;
+import org.teiid.client.plan.Annotation;
+
import com.metamatrix.api.exception.ExceptionHolder;
import com.metamatrix.api.exception.MetaMatrixException;
import com.metamatrix.core.util.ExternalizeUtil;
@@ -75,7 +77,7 @@
* Collection of Object[] where each Object[] holds annotation information
* that can be used to create an Annotation implementation in JDBC.
*/
- private Collection annotations;
+ private Collection<Annotation> annotations;
private boolean isUpdateResult;
@@ -266,7 +268,7 @@
parameters = ExternalizeUtil.readList(in);
debugLog = (String)in.readObject();
- annotations = (Collection)in.readObject();
+ annotations = ExternalizeUtil.readList(in, Annotation.class);
isUpdateResult = in.readBoolean();
}
@@ -300,14 +302,14 @@
ExternalizeUtil.writeList(out, parameters);
out.writeObject(debugLog);
- out.writeObject(annotations);
+ ExternalizeUtil.writeCollection(out, annotations);
out.writeBoolean(isUpdateResult);
}
/**
* @return
*/
- public Collection getAnnotations() {
+ public Collection<Annotation> getAnnotations() {
return annotations;
}
@@ -321,7 +323,7 @@
/**
* @param collection
*/
- public void setAnnotations(Collection collection) {
+ public void setAnnotations(Collection<Annotation> collection) {
annotations = collection;
}
Modified: trunk/client/src/main/java/org/teiid/client/plan/Annotation.java
===================================================================
--- trunk/client/src/main/java/org/teiid/client/plan/Annotation.java 2010-04-01 22:46:50
UTC (rev 2019)
+++ trunk/client/src/main/java/org/teiid/client/plan/Annotation.java 2010-04-02 00:46:43
UTC (rev 2020)
@@ -22,42 +22,52 @@
package org.teiid.client.plan;
+import java.io.Serializable;
/**
+ * Annotation describing a decision made during query execution.
*/
-public class Annotation {
-
+public class Annotation implements Serializable {
+
+ private static final long serialVersionUID = 7389738177788185542L;
+ public static final String MATERIALIZED_VIEW = "Materialized View";
//$NON-NLS-1$
+ public static final String HINTS = "Hints"; //$NON-NLS-1$
+
+ public enum Priority {
+ LOW,
+ MEDIUM,
+ HIGH
+ }
+
private String category;
- private String description;
+ private String annotation;
private String resolution;
- private int severity;
-
- public Annotation(String[] serverAnnotation) {
- category = serverAnnotation[0];
- description = serverAnnotation[1];
- resolution = serverAnnotation[2];
-
- severity = Integer.parseInt(serverAnnotation[3]);
+ private Priority priority = Priority.LOW;
+
+ public Annotation(String category, String annotation, String resolution, Priority
priority) {
+ this.category = category;
+ this.annotation = annotation;
+ this.resolution = resolution;
+ this.priority = priority;
}
-
+
public String getCategory() {
- return category;
+ return this.category;
}
-
+
public String getAnnotation() {
- return description;
+ return this.annotation;
}
-
+
public String getResolution() {
- return resolution;
+ return this.resolution;
}
-
- public int getSeverity() {
- return severity;
+
+ public Priority getPriority() {
+ return this.priority;
}
public String toString() {
- return description;
+ return "QueryAnnotation<" + getCategory() + ", " +
getAnnotation() + ">"; //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$
}
-
}
Modified: trunk/client/src/main/java/org/teiid/jdbc/StatementImpl.java
===================================================================
--- trunk/client/src/main/java/org/teiid/jdbc/StatementImpl.java 2010-04-01 22:46:50 UTC
(rev 2019)
+++ trunk/client/src/main/java/org/teiid/jdbc/StatementImpl.java 2010-04-02 00:46:43 UTC
(rev 2020)
@@ -112,7 +112,7 @@
private String debugLog;
// the last query annotations
- private List<Annotation> annotations;
+ private Collection<Annotation> annotations;
// resultSet object produced by execute methods on the statement.
protected ResultSetImpl resultSet;
@@ -887,10 +887,6 @@
this.debugLog = debugLog;
}
- void setAnnotations(List<Annotation> annotations) {
- this.annotations = annotations;
- }
-
/**
* Get Query plan description.
* If the Statement has a resultSet, we get the plan description from the result set
@@ -954,17 +950,7 @@
protected void setAnalysisInfo(ResultsMessage resultsMsg) {
this.debugLog = resultsMsg.getDebugLog();
this.currentPlanDescription = resultsMsg.getPlanDescription();
- Collection serverAnnotations = resultsMsg.getAnnotations();
- if(serverAnnotations != null) {
- List<Annotation> annotations = new
ArrayList<Annotation>(serverAnnotations.size());
- Iterator annIter = serverAnnotations.iterator();
- while(annIter.hasNext()) {
- String[] serverAnnotation = (String[]) annIter.next();
- Annotation annotation = new Annotation(serverAnnotation);
- annotations.add(annotation);
- }
- this.annotations = annotations;
- }
+ this.annotations = resultsMsg.getAnnotations();
}
Calendar getDefaultCalendar() {
Modified:
trunk/engine/src/main/java/com/metamatrix/common/buffer/impl/BufferManagerImpl.java
===================================================================
---
trunk/engine/src/main/java/com/metamatrix/common/buffer/impl/BufferManagerImpl.java 2010-04-01
22:46:50 UTC (rev 2019)
+++
trunk/engine/src/main/java/com/metamatrix/common/buffer/impl/BufferManagerImpl.java 2010-04-02
00:46:43 UTC (rev 2020)
@@ -51,7 +51,6 @@
import com.metamatrix.common.buffer.TupleBatch;
import com.metamatrix.common.buffer.TupleBuffer;
import com.metamatrix.common.buffer.BatchManager.ManagedBatch;
-import com.metamatrix.common.buffer.FileStore.FileStoreOutputStream;
import com.metamatrix.common.log.LogManager;
import com.metamatrix.common.types.DataTypeManager;
import com.metamatrix.common.types.InputStreamFactory;
Modified: trunk/engine/src/main/java/com/metamatrix/common/log/LogManager.java
===================================================================
--- trunk/engine/src/main/java/com/metamatrix/common/log/LogManager.java 2010-04-01
22:46:50 UTC (rev 2019)
+++ trunk/engine/src/main/java/com/metamatrix/common/log/LogManager.java 2010-04-02
00:46:43 UTC (rev 2020)
@@ -84,7 +84,58 @@
*/
public final class LogManager {
- static LogConfiguration configuration = new
LogConfigurationImpl(MessageLevel.DETAIL); // either injected or manually set using the
set methods
+ public static class LoggingProxy implements InvocationHandler {
+ private final Object instance;
+ private final String loggingContext;
+ private final int level;
+
+ public LoggingProxy(Object instance, String loggingContext, int level) {
+ this.instance = instance;
+ this.loggingContext = loggingContext;
+ this.level = level;
+ }
+
+ public Object invoke(Object proxy,
+ Method method,
+ Object[] args) throws Throwable {
+ boolean log = LogManager.isMessageToBeRecorded(loggingContext, level);
+ if (log) {
+ StringBuffer message = new StringBuffer();
+ message.append("before "); //$NON-NLS-1$
+ message.append(method.getName());
+ message.append(":"); //$NON-NLS-1$
+ message.append(instance);
+ message.append("("); //$NON-NLS-1$
+ if (args != null) {
+ for (int i = 0; i < args.length; i++) {
+ if (args[i] != null) {
+ message.append(args[i]);
+ } else {
+ message.append("null"); //$NON-NLS-1$
+ }
+ if (i != args.length - 1) {
+ message.append(","); //$NON-NLS-1$
+ }
+ }
+ }
+ message.append(")"); //$NON-NLS-1$
+ LogManager.log(level, loggingContext, message.toString());
+ }
+ try {
+ Object result = method.invoke(instance, args);
+ if (log) {
+ LogManager.log(level, loggingContext,
+ "after " + method.getName()+ " : "+result);
//$NON-NLS-1$ //$NON-NLS-2$
+ }
+ return result;
+ } catch (InvocationTargetException e) {
+ throw e.getTargetException();
+ }
+ }
+ }
+
+
+ static LogConfiguration configuration = new LogConfigurationImpl(MessageLevel.DETAIL);
// either injected or manually set using the set methods
static LogListener logListener = new JavaLogWriter(); // either injected or manually
set using the set methods
@@ -367,45 +418,6 @@
final Object instance,
final Class<?>[] interfaces,
final int level) {
- return Proxy.newProxyInstance(Thread.currentThread().getContextClassLoader(),
interfaces, new InvocationHandler() {
-
- public Object invoke(Object proxy,
- Method method,
- Object[] args) throws Throwable {
- boolean log = LogManager.isMessageToBeRecorded(loggingContext, level);
- if (log) {
- StringBuffer message = new StringBuffer();
- message.append("before "); //$NON-NLS-1$
- message.append(method.getName());
- message.append(":"); //$NON-NLS-1$
- message.append(instance);
- message.append("("); //$NON-NLS-1$
- if (args != null) {
- for (int i = 0; i < args.length; i++) {
- if (args[i] != null) {
- message.append(args[i]);
- } else {
- message.append("null"); //$NON-NLS-1$
- }
- if (i != args.length - 1) {
- message.append(","); //$NON-NLS-1$
- }
- }
- }
- message.append(")"); //$NON-NLS-1$
- LogManager.log(level, loggingContext, message.toString());
- }
- try {
- Object result = method.invoke(instance, args);
- if (log) {
- LogManager.log(level, loggingContext,
- "after " + method.getName()+ " :
"+result); //$NON-NLS-1$ //$NON-NLS-2$
- }
- return result;
- } catch (InvocationTargetException e) {
- throw e.getTargetException();
- }
- }
- });
+ return Proxy.newProxyInstance(Thread.currentThread().getContextClassLoader(),
interfaces, new LoggingProxy(instance, loggingContext, level));
}
}
Modified: trunk/engine/src/main/java/com/metamatrix/dqp/service/SessionService.java
===================================================================
--- trunk/engine/src/main/java/com/metamatrix/dqp/service/SessionService.java 2010-04-01
22:46:50 UTC (rev 2019)
+++ trunk/engine/src/main/java/com/metamatrix/dqp/service/SessionService.java 2010-04-02
00:46:43 UTC (rev 2020)
@@ -32,7 +32,6 @@
import org.teiid.dqp.internal.process.DQPCore;
import org.teiid.security.Credentials;
-import com.metamatrix.api.exception.security.SessionServiceException;
/**
* <p>
Copied: trunk/engine/src/main/java/com/metamatrix/dqp/service/SessionServiceException.java
(from rev 2014,
trunk/engine/src/main/java/com/metamatrix/api/exception/security/SessionServiceException.java)
===================================================================
--- trunk/engine/src/main/java/com/metamatrix/dqp/service/SessionServiceException.java
(rev 0)
+++
trunk/engine/src/main/java/com/metamatrix/dqp/service/SessionServiceException.java 2010-04-02
00:46:43 UTC (rev 2020)
@@ -0,0 +1,81 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+
+package com.metamatrix.dqp.service;
+
+import org.teiid.client.security.MetaMatrixSecurityException;
+
+
+public class SessionServiceException extends MetaMatrixSecurityException {
+ /**
+ * No-Arg Constructor
+ */
+ public SessionServiceException( ) {
+ super( );
+ }
+ /**
+ * Constructs an instance of the exception with the specified detail message. A
detail
+ * message is a String that describes this particular exception.
+ * @param the detail message
+ */
+ public SessionServiceException(String message) {
+ super(message);
+ }
+ /**
+ * Constructs an instance of the exception with no detail message but with a
+ * single exception.
+ * @param e the exception that is encapsulated by this exception
+ */
+ public SessionServiceException(Throwable e) {
+ super(e);
+ }
+ /**
+ * Constructs an instance of the exception with the specified detail message
+ * and a single exception. A detail message is a String that describes this
+ * particular exception.
+ * @param message the detail message
+ * @param e the exception that is encapsulated by this exception
+ */
+ public SessionServiceException( Throwable e, String message ) {
+ super(e, message);
+ }
+ /**
+ * Construct an instance with an error code and message specified.
+ *
+ * @param message The error message
+ * @param code The error code
+ */
+ public SessionServiceException( String code, String message ) {
+ super( code, message );
+ }
+ /**
+ * Construct an instance with a linked exception, and an error code and
+ * message, specified.
+ *
+ * @param e An exception to chain to this exception
+ * @param message The error message
+ * @param code The error code
+ */
+ public SessionServiceException( Throwable e, String code, String message ) {
+ super( e, code, message );
+ }
+}
Modified: trunk/engine/src/main/java/com/metamatrix/query/analysis/AnalysisRecord.java
===================================================================
---
trunk/engine/src/main/java/com/metamatrix/query/analysis/AnalysisRecord.java 2010-04-01
22:46:50 UTC (rev 2019)
+++
trunk/engine/src/main/java/com/metamatrix/query/analysis/AnalysisRecord.java 2010-04-02
00:46:43 UTC (rev 2020)
@@ -25,6 +25,8 @@
import java.io.*;
import java.util.*;
+import org.teiid.client.plan.Annotation;
+
import com.metamatrix.common.log.LogConstants;
import com.metamatrix.common.log.LogManager;
import com.metamatrix.core.log.MessageLevel;
@@ -50,7 +52,7 @@
private Map queryPlan;
// Annotations
- private Collection<QueryAnnotation> annotations;
+ private Collection<Annotation> annotations;
// Debug trace log
private StringWriter stringWriter; // inner
@@ -62,7 +64,7 @@
this.recordDebug = recordDebug |
LogManager.isMessageToBeRecorded(LogConstants.CTX_QUERY_PLANNER, MessageLevel.TRACE);
if(this.recordQueryPlan) {
- this.annotations = new ArrayList<QueryAnnotation>();
+ this.annotations = new ArrayList<Annotation>();
}
if(this.recordDebug) {
@@ -124,7 +126,7 @@
* returns true.
* @param annotation Annotation to add
*/
- public void addAnnotation(QueryAnnotation annotation) {
+ public void addAnnotation(Annotation annotation) {
this.annotations.add(annotation);
}
@@ -132,7 +134,7 @@
* Get annotations.
* @return
*/
- public Collection<QueryAnnotation> getAnnotations() {
+ public Collection<Annotation> getAnnotations() {
return this.annotations;
}
Deleted: trunk/engine/src/main/java/com/metamatrix/query/analysis/QueryAnnotation.java
===================================================================
---
trunk/engine/src/main/java/com/metamatrix/query/analysis/QueryAnnotation.java 2010-04-01
22:46:50 UTC (rev 2019)
+++
trunk/engine/src/main/java/com/metamatrix/query/analysis/QueryAnnotation.java 2010-04-02
00:46:43 UTC (rev 2020)
@@ -1,68 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package com.metamatrix.query.analysis;
-
-/**
- * Annotation describing a decision made during query execution.
- */
-public class QueryAnnotation {
-
- public static final String MATERIALIZED_VIEW = "Materialized View";
//$NON-NLS-1$
- public static final String HINTS = "Hints"; //$NON-NLS-1$
-
- public static final int LOW = 1;
- public static final int MEDIUM = 2;
- public static final int HIGH = 3;
-
- private String category;
- private String annotation;
- private String resolution;
- private int priority = LOW;
-
- public QueryAnnotation(String category, String annotation, String resolution, int
priority) {
- this.category = category;
- this.annotation = annotation;
- this.resolution = resolution;
- this.priority = priority;
- }
-
- public String getCategory() {
- return this.category;
- }
-
- public String getAnnotation() {
- return this.annotation;
- }
-
- public String getResolution() {
- return this.resolution;
- }
-
- public int getPriority() {
- return this.priority;
- }
-
- public String toString() {
- return "QueryAnnotation<" + getCategory() + ", " +
getAnnotation() + ">"; //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$
- }
-}
Modified:
trunk/engine/src/main/java/com/metamatrix/query/optimizer/relational/RelationalPlanner.java
===================================================================
---
trunk/engine/src/main/java/com/metamatrix/query/optimizer/relational/RelationalPlanner.java 2010-04-01
22:46:50 UTC (rev 2019)
+++
trunk/engine/src/main/java/com/metamatrix/query/optimizer/relational/RelationalPlanner.java 2010-04-02
00:46:43 UTC (rev 2020)
@@ -31,6 +31,8 @@
import java.util.Map;
import java.util.Set;
+import org.teiid.client.plan.Annotation;
+import org.teiid.client.plan.Annotation.Priority;
import org.teiid.dqp.internal.process.Request;
import com.metamatrix.api.exception.MetaMatrixComponentException;
@@ -44,7 +46,6 @@
import com.metamatrix.core.id.IDGenerator;
import com.metamatrix.query.QueryPlugin;
import com.metamatrix.query.analysis.AnalysisRecord;
-import com.metamatrix.query.analysis.QueryAnnotation;
import com.metamatrix.query.execution.QueryExecPlugin;
import com.metamatrix.query.mapping.relational.QueryNode;
import com.metamatrix.query.metadata.QueryMetadataInterface;
@@ -263,7 +264,7 @@
if(! appliedHint) {
String msg =
QueryExecPlugin.Util.getString(ErrorMessageKeys.OPTIMIZER_0010, groupName);
if (this.analysisRecord.recordAnnotations()) {
- this.analysisRecord.addAnnotation(new
QueryAnnotation(QueryAnnotation.HINTS, msg, "ignoring hint",
QueryAnnotation.MEDIUM)); //$NON-NLS-1$
+ this.analysisRecord.addAnnotation(new Annotation(Annotation.HINTS, msg,
"ignoring hint", Priority.MEDIUM)); //$NON-NLS-1$
}
}
}
@@ -941,10 +942,10 @@
String matTableName, String msg) {
if ( analysis.recordAnnotations() ) {
Object[] params = new Object[] {virtualGroup, matTableName};
- QueryAnnotation annotation = new
QueryAnnotation(QueryAnnotation.MATERIALIZED_VIEW,
+ Annotation annotation = new Annotation(Annotation.MATERIALIZED_VIEW,
QueryPlugin.Util.getString(msg,
params),
null,
- QueryAnnotation.LOW);
+ Priority.LOW);
analysis.addAnnotation(annotation);
}
}
Modified:
trunk/engine/src/main/java/com/metamatrix/query/processor/proc/AssignmentInstruction.java
===================================================================
---
trunk/engine/src/main/java/com/metamatrix/query/processor/proc/AssignmentInstruction.java 2010-04-01
22:46:50 UTC (rev 2019)
+++
trunk/engine/src/main/java/com/metamatrix/query/processor/proc/AssignmentInstruction.java 2010-04-02
00:46:43 UTC (rev 2020)
@@ -47,7 +47,7 @@
/**
* @see com.metamatrix.query.processor.program.ProgramInstruction#clone()
*/
- public Object clone() {
+ public AssignmentInstruction clone() {
AssignmentInstruction clone = new AssignmentInstruction();
this.cloneState(clone);
return clone;
Modified:
trunk/engine/src/main/java/com/metamatrix/query/processor/proc/CreateCursorResultSetInstruction.java
===================================================================
---
trunk/engine/src/main/java/com/metamatrix/query/processor/proc/CreateCursorResultSetInstruction.java 2010-04-01
22:46:50 UTC (rev 2019)
+++
trunk/engine/src/main/java/com/metamatrix/query/processor/proc/CreateCursorResultSetInstruction.java 2010-04-02
00:46:43 UTC (rev 2020)
@@ -71,7 +71,7 @@
/**
* Returns a deep clone
*/
- public Object clone(){
+ public CreateCursorResultSetInstruction clone(){
ProcessorPlan clonedPlan = this.plan.clone();
return new CreateCursorResultSetInstruction(this.rsName, clonedPlan);
}
Modified:
trunk/engine/src/main/java/com/metamatrix/query/processor/proc/ErrorInstruction.java
===================================================================
---
trunk/engine/src/main/java/com/metamatrix/query/processor/proc/ErrorInstruction.java 2010-04-01
22:46:50 UTC (rev 2019)
+++
trunk/engine/src/main/java/com/metamatrix/query/processor/proc/ErrorInstruction.java 2010-04-02
00:46:43 UTC (rev 2020)
@@ -47,7 +47,7 @@
/**
* @see com.metamatrix.query.processor.program.ProgramInstruction#clone()
*/
- public Object clone() {
+ public ErrorInstruction clone() {
ErrorInstruction clone = new ErrorInstruction();
this.cloneState(clone);
return clone;
Modified:
trunk/engine/src/main/java/com/metamatrix/query/processor/proc/ExecDynamicSqlInstruction.java
===================================================================
---
trunk/engine/src/main/java/com/metamatrix/query/processor/proc/ExecDynamicSqlInstruction.java 2010-04-01
22:46:50 UTC (rev 2019)
+++
trunk/engine/src/main/java/com/metamatrix/query/processor/proc/ExecDynamicSqlInstruction.java 2010-04-02
00:46:43 UTC (rev 2020)
@@ -322,7 +322,7 @@
/**
* Returns a deep clone
*/
- public Object clone() {
+ public ExecDynamicSqlInstruction clone() {
ExecDynamicSqlInstruction clone = new ExecDynamicSqlInstruction(
parentProcCommand, dynamicCommand, metadata, idGenerator, capFinder);
return clone;
Modified:
trunk/engine/src/main/java/com/metamatrix/query/processor/proc/IfInstruction.java
===================================================================
---
trunk/engine/src/main/java/com/metamatrix/query/processor/proc/IfInstruction.java 2010-04-01
22:46:50 UTC (rev 2019)
+++
trunk/engine/src/main/java/com/metamatrix/query/processor/proc/IfInstruction.java 2010-04-02
00:46:43 UTC (rev 2020)
@@ -115,7 +115,7 @@
/**
* Returns a deep clone
*/
- public Object clone(){
+ public IfInstruction clone(){
Program cloneIf = (Program) this.ifProgram.clone();
Program cloneElse = null;
if(elseProgram != null) {
Modified:
trunk/engine/src/main/java/com/metamatrix/query/processor/proc/LoopInstruction.java
===================================================================
---
trunk/engine/src/main/java/com/metamatrix/query/processor/proc/LoopInstruction.java 2010-04-01
22:46:50 UTC (rev 2019)
+++
trunk/engine/src/main/java/com/metamatrix/query/processor/proc/LoopInstruction.java 2010-04-02
00:46:43 UTC (rev 2020)
@@ -73,7 +73,7 @@
/**
* Returns a deep clone
*/
- public Object clone(){
+ public LoopInstruction clone(){
ProcessorPlan clonedPlan = this.plan.clone();
return new LoopInstruction((Program)this.loopProgram.clone(), this.rsName,
clonedPlan);
}
Modified:
trunk/engine/src/main/java/com/metamatrix/query/processor/proc/ProcedurePlan.java
===================================================================
---
trunk/engine/src/main/java/com/metamatrix/query/processor/proc/ProcedurePlan.java 2010-04-01
22:46:50 UTC (rev 2019)
+++
trunk/engine/src/main/java/com/metamatrix/query/processor/proc/ProcedurePlan.java 2010-04-02
00:46:43 UTC (rev 2020)
@@ -54,7 +54,6 @@
import com.metamatrix.query.processor.TempTableDataManager;
import com.metamatrix.query.processor.program.Program;
import com.metamatrix.query.processor.program.ProgramInstruction;
-import com.metamatrix.query.processor.program.ProgramUtil;
import com.metamatrix.query.processor.relational.SubqueryAwareEvaluator;
import com.metamatrix.query.sql.ProcedureReservedWords;
import com.metamatrix.query.sql.lang.Criteria;
@@ -320,7 +319,7 @@
}
public String toString() {
- return "ProcedurePlan:\n" +
ProgramUtil.programToString(this.originalProgram); //$NON-NLS-1$
+ return "ProcedurePlan:\n" + this.originalProgram; //$NON-NLS-1$
}
public ProcessorPlan clone(){
Modified:
trunk/engine/src/main/java/com/metamatrix/query/processor/proc/WhileInstruction.java
===================================================================
---
trunk/engine/src/main/java/com/metamatrix/query/processor/proc/WhileInstruction.java 2010-04-01
22:46:50 UTC (rev 2019)
+++
trunk/engine/src/main/java/com/metamatrix/query/processor/proc/WhileInstruction.java 2010-04-02
00:46:43 UTC (rev 2020)
@@ -58,7 +58,7 @@
/**
* Returns a deep clone
*/
- public Object clone(){
+ public WhileInstruction clone(){
return new WhileInstruction((Program)this.whileProgram.clone(), this.condition);
}
Modified: trunk/engine/src/main/java/com/metamatrix/query/processor/program/Program.java
===================================================================
---
trunk/engine/src/main/java/com/metamatrix/query/processor/program/Program.java 2010-04-01
22:46:50 UTC (rev 2019)
+++
trunk/engine/src/main/java/com/metamatrix/query/processor/program/Program.java 2010-04-02
00:46:43 UTC (rev 2020)
@@ -22,10 +22,15 @@
package com.metamatrix.query.processor.program;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
import com.metamatrix.query.processor.Describable;
-import com.metamatrix.query.processor.ProcessorPlan;
+import com.metamatrix.query.processor.proc.IfInstruction;
+import com.metamatrix.query.processor.proc.WhileInstruction;
/**
* A program is a sequence of {@link ProgramInstruction ProgramInstruction}. Certain
@@ -34,7 +39,7 @@
*/
public class Program implements Cloneable, Describable {
- private List programInstructions;
+ private List<ProgramInstruction> programInstructions;
private int counter = 0;
/**
@@ -109,10 +114,6 @@
}
}
- public String toString(){
- return ("PROGRAM size " + getProcessorInstructions().size() + ",
counter " + this.counter); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
/**
* Produces a deep clone.
*/
@@ -121,10 +122,9 @@
program.counter = this.counter;
if (this.programInstructions != null){
- ArrayList clonedInstructions = new
ArrayList(this.programInstructions.size());
- Iterator i = this.programInstructions.iterator();
- while (i.hasNext()){
- clonedInstructions.add( ((ProgramInstruction)i.next()).clone() );
+ ArrayList<ProgramInstruction> clonedInstructions = new
ArrayList<ProgramInstruction>(this.programInstructions.size());
+ for (ProgramInstruction pi : this.programInstructions) {
+ clonedInstructions.add( pi.clone() );
}
program.programInstructions = clonedInstructions;
}
@@ -149,26 +149,6 @@
return props;
}
- /**
- * Finds all nested plans and returns them.
- * @return List of ProcessorPlan
- * @since 4.2
- */
- public List<ProcessorPlan> getChildPlans() {
- List<ProcessorPlan> plans = new ArrayList<ProcessorPlan>();
- if (programInstructions != null) {
- for(int i=0; i<programInstructions.size(); i++) {
- ProgramInstruction inst = (ProgramInstruction)
programInstructions.get(i);
- Collection<ProcessorPlan> instPlans = inst.getChildPlans();
- if(instPlans != null) {
- plans.addAll(instPlans);
- }
- }
- }
- return plans;
- }
-
-
//=========================================================================
//UTILITY
//=========================================================================
@@ -182,17 +162,68 @@
private ProgramInstruction getInstructionAtIndex(int instructionIndex){
if (programInstructions != null){
if (instructionIndex < getProcessorInstructions().size()){
- return
(ProgramInstruction)getProcessorInstructions().get(instructionIndex);
+ return getProcessorInstructions().get(instructionIndex);
}
}
return null;
}
- public List getProcessorInstructions(){
+ public List<ProgramInstruction> getProcessorInstructions(){
if (programInstructions == null){
- programInstructions = new ArrayList();
+ programInstructions = new ArrayList<ProgramInstruction>();
}
return programInstructions;
}
+
+ public String toString() {
+ StringBuilder str = new StringBuilder();
+
+ programToString(str);
+
+ return "PROGRAM counter " + this.counter + " " +
str.toString(); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ /**
+ * This method calls itself recursively if either a While or If instruction is
encountered.
+ * The sub program(s) from those kinds of instructions are passed, recursively, into
this
+ * method.
+ */
+ private final int programToString(StringBuilder str) {
+
+ int instructionIndex = 0;
+ ProgramInstruction inst = getInstructionAt(instructionIndex);
+
+ while(inst != null) {
+
+ printLine(counter++, inst.toString(), str);
+
+ if(counter > 1000) {
+ printLine(counter, "[OUTPUT TRUNCATED...]", str); //$NON-NLS-1$
+ break;
+ }
+
+ instructionIndex++;
+ inst = getInstructionAt(instructionIndex);
+
+ }
+
+ return counter;
+ }
+
+
+ private static final void printLine(int counter, String line, StringBuilder buffer)
{
+ // Pad counter with spaces
+ String counterStr = "" + counter + ": "; //$NON-NLS-1$
//$NON-NLS-2$
+ if(counter < 10) {
+ counterStr += " "; //$NON-NLS-1$
+ }
+ if(counterStr.length() == 1) {
+ counterStr += " "; //$NON-NLS-1$
+ } else if(counterStr.length() == 2) {
+ counterStr += " "; //$NON-NLS-1$
+ }
+
+ buffer.append(counterStr + line + "\n"); //$NON-NLS-1$
+ }
+
}
Modified:
trunk/engine/src/main/java/com/metamatrix/query/processor/program/ProgramInstruction.java
===================================================================
---
trunk/engine/src/main/java/com/metamatrix/query/processor/program/ProgramInstruction.java 2010-04-01
22:46:50 UTC (rev 2019)
+++
trunk/engine/src/main/java/com/metamatrix/query/processor/program/ProgramInstruction.java 2010-04-02
00:46:43 UTC (rev 2020)
@@ -73,9 +73,9 @@
* override with custom safe or deep cloning.
* @return shallow clone
*/
- public Object clone() {
+ public ProgramInstruction clone() {
try {
- return super.clone();
+ return (ProgramInstruction)super.clone();
} catch (CloneNotSupportedException e) {
//should never get here, since
//this Class does support clone
Deleted:
trunk/engine/src/main/java/com/metamatrix/query/processor/program/ProgramUtil.java
===================================================================
---
trunk/engine/src/main/java/com/metamatrix/query/processor/program/ProgramUtil.java 2010-04-01
22:46:50 UTC (rev 2019)
+++
trunk/engine/src/main/java/com/metamatrix/query/processor/program/ProgramUtil.java 2010-04-02
00:46:43 UTC (rev 2020)
@@ -1,100 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package com.metamatrix.query.processor.program;
-
-/**
- * Utility to print out a {@link Program Program}.
- */
-public final class ProgramUtil {
-
- private ProgramUtil() {
- }
-
- public static final String programToString(Program program) {
-
- StringBuffer str = new StringBuffer();
-
- int counter = 1;
- int tabs = 0;
-
- programToString(program, counter, tabs, str);
-
- return str.toString();
- }
-
- /**
- * This method calls itself recursively if either a While or If instruction is
encountered.
- * The sub program(s) from those kinds of instructions are passed, recursively, into
this
- * method.
- */
- private static final int programToString(Program program, int counter, int tabs,
StringBuffer str) {
-
- int instructionIndex = 0;
- ProgramInstruction inst = program.getInstructionAt(instructionIndex);
-// Program subprogram = null;
-
- while(inst != null) {
-
- printLine(counter++, tabs, inst.toString(), str);
-
- if(counter > 1000) {
- printLine(counter, tabs, "[OUTPUT TRUNCATED...]", str); //$NON-NLS-1$
- break;
- }
-
- instructionIndex++;
- inst = program.getInstructionAt(instructionIndex);
-
- }
-
- return counter;
- }
-
-
- private static final void printLine(int counter, int tabs, String line, StringBuffer
buffer) {
- // Pad counter with spaces
- String counterStr = "" + counter + ": "; //$NON-NLS-1$
//$NON-NLS-2$
- if(counter < 10) {
- counterStr += " "; //$NON-NLS-1$
- }
- if(counterStr.length() == 1) {
- counterStr += " "; //$NON-NLS-1$
- } else if(counterStr.length() == 2) {
- counterStr += " "; //$NON-NLS-1$
- }
-
- buffer.append(counterStr + getTab(tabs) + line + "\n"); //$NON-NLS-1$
- }
-
- private static final String getTab(int tabs) {
- if(tabs == 0) {
- return ""; //$NON-NLS-1$
- }
- StringBuffer str = new StringBuffer();
- for(int i=0; i<tabs; i++) {
- str.append(" "); //$NON-NLS-1$
- }
- return str.toString();
- }
-
-}
Modified:
trunk/engine/src/main/java/com/metamatrix/query/processor/relational/RelationalNodeStatistics.java
===================================================================
---
trunk/engine/src/main/java/com/metamatrix/query/processor/relational/RelationalNodeStatistics.java 2010-04-01
22:46:50 UTC (rev 2019)
+++
trunk/engine/src/main/java/com/metamatrix/query/processor/relational/RelationalNodeStatistics.java 2010-04-02
00:46:43 UTC (rev 2020)
@@ -22,32 +22,21 @@
package com.metamatrix.query.processor.relational;
-import java.sql.Timestamp;
import java.util.ArrayList;
-import java.util.HashMap;
import java.util.List;
-import java.util.Map;
import com.metamatrix.common.buffer.TupleBatch;
-import com.metamatrix.query.processor.Describable;
/**
* @since 4.2
*/
-public class RelationalNodeStatistics implements Describable {
+public class RelationalNodeStatistics {
// Statistics
- static final String NODE_OUTPUT_ROWS = "nodeOutputRows"; //$NON-NLS-1$
- static final String NODE_PROCESS_TIME = "nodeProcessingTime";
//$NON-NLS-1$
- static final String NODE_CUMULATIVE_PROCESS_TIME =
"nodeCumulativeProcessingTime"; //$NON-NLS-1$
- static final String NODE_CUMULATIVE_NEXTBATCH_PROCESS_TIME =
"nodeCumulativeNextBatchProcessingTime"; //$NON-NLS-1$
- static final String NODE_NEXT_BATCH_CALLS = "nodeNextBatchCalls";
//$NON-NLS-1$
- static final String NODE_BLOCKS = "nodeBlocks"; //$NON-NLS-1$
static final int BATCHCOMPLETE_STOP = 0;
static final int BLOCKEDEXCEPTION_STOP = 1;
- private Map statisticsProperties;
private List statisticsList;
private boolean setNodeStartTime;
@@ -58,10 +47,6 @@
private long nodeStartTime;
private long nodeEndTime;
- // Start and End timestamps for the node
- private Timestamp nodeStartTimestamp;
- private Timestamp nodeEndTimestamp;
-
// Start and End system time for each batch
private long batchStartTime;
private long batchEndTime;
@@ -82,7 +67,6 @@
private int nodeBlocks;
public RelationalNodeStatistics() {
- this.statisticsProperties = new HashMap();
this.statisticsList = new ArrayList();
this.setNodeStartTime = false;
}
@@ -110,15 +94,12 @@
this.nodeBlocks++;
break;
}
- //this.reset();
}
public void collectNodeStats(RelationalNode[] relationalNodes, String className) {
// set nodeEndTime to the time gathered at the end of the last batch
this.nodeEndTime = this.batchEndTime;
this.nodeCumulativeProcessingTime = this.nodeEndTime - this.nodeStartTime;
- this.nodeEndTimestamp = new Timestamp(this.nodeEndTime);
- this.nodeStartTimestamp = new Timestamp(this.nodeStartTime);
if(relationalNodes[0] != null) {
long maxUnionChildCumulativeProcessingTime = 0;
for (int i = 0; i < relationalNodes.length; i++) {
@@ -135,19 +116,6 @@
}
}
- public void setDescriptionProperties() {
- this.statisticsProperties.put(NODE_OUTPUT_ROWS, new
Integer(this.nodeOutputRows));
- this.statisticsProperties.put(NODE_PROCESS_TIME, new
Long(this.nodeProcessingTime));
- this.statisticsProperties.put(NODE_CUMULATIVE_PROCESS_TIME, new
Long(this.nodeCumulativeProcessingTime));
- this.statisticsProperties.put(NODE_CUMULATIVE_NEXTBATCH_PROCESS_TIME, new
Long(this.nodeCumulativeNextBatchProcessingTime));
- this.statisticsProperties.put(NODE_NEXT_BATCH_CALLS, new
Integer(this.nodeNextBatchCalls));
- this.statisticsProperties.put(NODE_BLOCKS, new Integer(this.nodeBlocks));
- }
-
- public Map getDescriptionProperties() {
- return this.statisticsProperties;
- }
-
public void setStatisticsList() {
this.statisticsList.clear();
this.statisticsList.add("Node Output Rows: " + this.nodeOutputRows);
//$NON-NLS-1$
@@ -162,11 +130,6 @@
return this.statisticsList;
}
- public void reset() {
- this.batchStartTime = 0;
- this.batchEndTime = 0;
- }
-
/**
* @return Returns the nodeBlocks.
* @since 4.2
Modified: trunk/engine/src/main/java/org/teiid/dqp/internal/process/DQPCore.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/dqp/internal/process/DQPCore.java 2010-04-01
22:46:50 UTC (rev 2019)
+++ trunk/engine/src/main/java/org/teiid/dqp/internal/process/DQPCore.java 2010-04-02
00:46:43 UTC (rev 2020)
@@ -516,7 +516,6 @@
ArrayList<String> caches = new ArrayList<String>();
caches.add(Admin.Cache.CODE_TABLE_CACHE.toString());
caches.add(Admin.Cache.PREPARED_PLAN_CACHE.toString());
- caches.add(Admin.Cache.CONNECTOR_RESULT_SET_CACHE.toString());
caches.add(Admin.Cache.QUERY_SERVICE_RESULT_SET_CACHE.toString());
return caches;
}
@@ -530,11 +529,9 @@
case PREPARED_PLAN_CACHE:
clearPlanCache();
break;
- case CONNECTOR_RESULT_SET_CACHE:
+ case QUERY_SERVICE_RESULT_SET_CACHE:
clearResultSetCache();
break;
- case QUERY_SERVICE_RESULT_SET_CACHE:
- break;
}
}
Modified: trunk/engine/src/main/java/org/teiid/dqp/internal/process/RequestWorkItem.java
===================================================================
---
trunk/engine/src/main/java/org/teiid/dqp/internal/process/RequestWorkItem.java 2010-04-01
22:46:50 UTC (rev 2019)
+++
trunk/engine/src/main/java/org/teiid/dqp/internal/process/RequestWorkItem.java 2010-04-02
00:46:43 UTC (rev 2020)
@@ -36,6 +36,7 @@
import org.teiid.client.SourceWarning;
import org.teiid.client.lob.LobChunk;
import org.teiid.client.metadata.ParameterInfo;
+import org.teiid.client.plan.Annotation;
import org.teiid.client.util.ResultsReceiver;
import org.teiid.client.xa.XATransactionException;
import org.teiid.connector.api.DataNotAvailableException;
@@ -60,7 +61,6 @@
import com.metamatrix.dqp.service.TransactionService;
import com.metamatrix.dqp.service.TransactionContext.Scope;
import com.metamatrix.query.analysis.AnalysisRecord;
-import com.metamatrix.query.analysis.QueryAnnotation;
import com.metamatrix.query.execution.QueryExecPlugin;
import com.metamatrix.query.processor.BatchCollector;
import com.metamatrix.query.processor.QueryProcessor;
@@ -501,24 +501,7 @@
if(analysisRecord != null) {
response.setPlanDescription(analysisRecord.getQueryPlan());
response.setDebugLog(analysisRecord.getDebugLog());
-
- // Convert annotations to JDBC expected format - String[4]
- Collection anns = analysisRecord.getAnnotations();
- Collection converted = null;
- if(anns != null) {
- converted = new ArrayList(anns.size());
- Iterator annIter = anns.iterator();
- while(annIter.hasNext()) {
- QueryAnnotation ann = (QueryAnnotation) annIter.next();
- String[] jdbcAnn = new String[4];
- jdbcAnn[0] = ann.getCategory();
- jdbcAnn[1] = ann.getAnnotation();
- jdbcAnn[2] = ann.getResolution();
- jdbcAnn[3] = "" + ann.getPriority(); //$NON-NLS-1$
- converted.add(jdbcAnn);
- }
- response.setAnnotations(converted);
- }
+ response.setAnnotations(analysisRecord.getAnnotations());
}
}
Modified:
trunk/engine/src/test/java/com/metamatrix/query/analysis/TestAnalysisRecord.java
===================================================================
---
trunk/engine/src/test/java/com/metamatrix/query/analysis/TestAnalysisRecord.java 2010-04-01
22:46:50 UTC (rev 2019)
+++
trunk/engine/src/test/java/com/metamatrix/query/analysis/TestAnalysisRecord.java 2010-04-02
00:46:43 UTC (rev 2020)
@@ -24,6 +24,9 @@
import java.util.*;
+import org.teiid.client.plan.Annotation;
+import org.teiid.client.plan.Annotation.Priority;
+
import com.metamatrix.core.util.StringUtil;
import junit.framework.TestCase;
@@ -54,13 +57,13 @@
AnalysisRecord rec = new AnalysisRecord(true, false);
assertTrue(rec.recordAnnotations());
- QueryAnnotation ann1 = new QueryAnnotation("cat", "ann",
"res", QueryAnnotation.MEDIUM); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- QueryAnnotation ann2 = new QueryAnnotation("cat2", "ann2",
"res2", QueryAnnotation.HIGH); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ Annotation ann1 = new Annotation("cat", "ann",
"res", Priority.MEDIUM); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ Annotation ann2 = new Annotation("cat2", "ann2",
"res2", Priority.HIGH); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
rec.addAnnotation(ann1);
rec.addAnnotation(ann2);
- Collection<QueryAnnotation> annotations = rec.getAnnotations();
+ Collection<Annotation> annotations = rec.getAnnotations();
assertEquals(2, annotations.size());
assertTrue(annotations.contains(ann1));
assertTrue(annotations.contains(ann2));
Modified:
trunk/engine/src/test/java/com/metamatrix/query/optimizer/relational/TestMaterialization.java
===================================================================
---
trunk/engine/src/test/java/com/metamatrix/query/optimizer/relational/TestMaterialization.java 2010-04-01
22:46:50 UTC (rev 2019)
+++
trunk/engine/src/test/java/com/metamatrix/query/optimizer/relational/TestMaterialization.java 2010-04-02
00:46:43 UTC (rev 2020)
@@ -29,9 +29,9 @@
import org.junit.Ignore;
import org.junit.Test;
+import org.teiid.client.plan.Annotation;
import com.metamatrix.query.analysis.AnalysisRecord;
-import com.metamatrix.query.analysis.QueryAnnotation;
import com.metamatrix.query.metadata.QueryMetadataInterface;
import com.metamatrix.query.optimizer.TestOptimizer;
import com.metamatrix.query.sql.lang.Command;
@@ -49,10 +49,10 @@
TestOptimizer.helpPlanCommand(command, metadata, getGenericFinder(), analysis,
new String[] {"SELECT g_0.e1 FROM MatTable.MatTable AS g_0"},
ComparisonMode.EXACT_COMMAND_STRING); //$NON-NLS-1$
- Collection<QueryAnnotation> annotations = analysis.getAnnotations();
+ Collection<Annotation> annotations = analysis.getAnnotations();
assertNotNull("Expected annotations but got none", annotations);
//$NON-NLS-1$
assertTrue("Expected one annotation", annotations.size() == 1);
//$NON-NLS-1$
- assertEquals("Expected catagory mat view",
annotations.iterator().next().getCategory(), QueryAnnotation.MATERIALIZED_VIEW);
//$NON-NLS-1$
+ assertEquals("Expected catagory mat view",
annotations.iterator().next().getCategory(), Annotation.MATERIALIZED_VIEW); //$NON-NLS-1$
}
@Ignore("we no longer auto detect this case, if we need this logic it will have
to be added to the rewriter since it changes select into to an insert")
@@ -66,10 +66,10 @@
TestOptimizer.helpPlanCommand(command, metadata, getGenericFinder(), analysis,
new String[] {"SELECT g_0.x FROM MatSrc.MatSrc AS g_0"},
ComparisonMode.EXACT_COMMAND_STRING); //$NON-NLS-1$
- Collection<QueryAnnotation> annotations = analysis.getAnnotations();
+ Collection<Annotation> annotations = analysis.getAnnotations();
assertNotNull("Expected annotations but got none", annotations);
//$NON-NLS-1$
assertTrue("Expected one annotation", annotations.size() == 1);
//$NON-NLS-1$
- assertEquals("Expected catagory mat view",
annotations.iterator().next().getCategory(), QueryAnnotation.MATERIALIZED_VIEW);
//$NON-NLS-1$
+ assertEquals("Expected catagory mat view",
annotations.iterator().next().getCategory(), Annotation.MATERIALIZED_VIEW); //$NON-NLS-1$
}
@Test public void testMaterializedTransformationNoCache() throws Exception {
@@ -82,10 +82,10 @@
TestOptimizer.helpPlanCommand(command, metadata, getGenericFinder(), analysis,
new String[] {"SELECT g_0.x FROM MatSrc.MatSrc AS g_0"},
ComparisonMode.EXACT_COMMAND_STRING); //$NON-NLS-1$
- Collection<QueryAnnotation> annotations = analysis.getAnnotations();
+ Collection<Annotation> annotations = analysis.getAnnotations();
assertNotNull("Expected annotations but got none", annotations);
//$NON-NLS-1$
assertTrue("Expected one annotation", annotations.size() == 1);
//$NON-NLS-1$
- assertEquals("Expected catagory mat view",
annotations.iterator().next().getCategory(), QueryAnnotation.MATERIALIZED_VIEW);
//$NON-NLS-1$
+ assertEquals("Expected catagory mat view",
annotations.iterator().next().getCategory(), Annotation.MATERIALIZED_VIEW); //$NON-NLS-1$
}
//related to defect 14423
@@ -99,10 +99,10 @@
TestOptimizer.helpPlanCommand(command, metadata, getGenericFinder(), analysis,
new String[] {"SELECT g_0.x FROM MatSrc.MatSrc AS g_0"},
ComparisonMode.EXACT_COMMAND_STRING); //$NON-NLS-1$
- Collection<QueryAnnotation> annotations = analysis.getAnnotations();
+ Collection<Annotation> annotations = analysis.getAnnotations();
assertNotNull("Expected annotations but got none", annotations);
//$NON-NLS-1$
assertTrue("Expected one annotation", annotations.size() == 1);
//$NON-NLS-1$
- assertEquals("Expected catagory mat view",
annotations.iterator().next().getCategory(), QueryAnnotation.MATERIALIZED_VIEW);
//$NON-NLS-1$
+ assertEquals("Expected catagory mat view",
annotations.iterator().next().getCategory(), Annotation.MATERIALIZED_VIEW); //$NON-NLS-1$
}
@Test public void testNoCacheInTransformation() throws Exception {
Modified:
trunk/engine/src/test/java/com/metamatrix/query/processor/FakeProcessorPlan.java
===================================================================
---
trunk/engine/src/test/java/com/metamatrix/query/processor/FakeProcessorPlan.java 2010-04-01
22:46:50 UTC (rev 2019)
+++
trunk/engine/src/test/java/com/metamatrix/query/processor/FakeProcessorPlan.java 2010-04-02
00:46:43 UTC (rev 2020)
@@ -25,7 +25,6 @@
import static org.junit.Assert.*;
import java.util.Arrays;
-import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
Modified:
trunk/engine/src/test/java/com/metamatrix/query/processor/xml/TestXMLProcessor.java
===================================================================
---
trunk/engine/src/test/java/com/metamatrix/query/processor/xml/TestXMLProcessor.java 2010-04-01
22:46:50 UTC (rev 2019)
+++
trunk/engine/src/test/java/com/metamatrix/query/processor/xml/TestXMLProcessor.java 2010-04-02
00:46:43 UTC (rev 2020)
@@ -34,8 +34,6 @@
import java.util.Map;
import java.util.StringTokenizer;
-import javax.xml.transform.OutputKeys;
-
import org.junit.Test;
import org.teiid.client.metadata.ParameterInfo;
Modified:
trunk/jboss-integration/src/main/java/org/teiid/jboss/deployers/RuntimeEngineDeployer.java
===================================================================
---
trunk/jboss-integration/src/main/java/org/teiid/jboss/deployers/RuntimeEngineDeployer.java 2010-04-01
22:46:50 UTC (rev 2019)
+++
trunk/jboss-integration/src/main/java/org/teiid/jboss/deployers/RuntimeEngineDeployer.java 2010-04-02
00:46:43 UTC (rev 2020)
@@ -22,7 +22,6 @@
package org.teiid.jboss.deployers;
import java.io.Serializable;
-import java.lang.reflect.InvocationHandler;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;
@@ -70,13 +69,13 @@
import com.metamatrix.api.exception.ComponentNotFoundException;
import com.metamatrix.api.exception.MetaMatrixComponentException;
-import com.metamatrix.api.exception.security.SessionServiceException;
import com.metamatrix.common.log.LogConstants;
import com.metamatrix.common.log.LogManager;
import com.metamatrix.core.MetaMatrixRuntimeException;
import com.metamatrix.core.log.MessageLevel;
import com.metamatrix.dqp.service.BufferService;
import com.metamatrix.dqp.service.SessionService;
+import com.metamatrix.dqp.service.SessionServiceException;
import com.metamatrix.dqp.service.TransactionService;
@ManagementObject(isRuntime=true,
componentType=@ManagementComponent(type="teiid",subtype="dqp"),
properties=ManagementProperties.EXPLICIT)
@@ -119,8 +118,8 @@
createClientServices();
this.csr.registerClientService(ILogon.class, logon, LogConstants.CTX_SECURITY);
- this.csr.registerClientService(DQP.class, proxyService(DQP.class, this.dqpCore),
LogConstants.CTX_DQP);
- this.csr.registerClientService(Admin.class, proxyService(Admin.class, admin),
LogConstants.CTX_ADMIN_API);
+ this.csr.registerClientService(DQP.class, proxyService(DQP.class, this.dqpCore,
LogConstants.CTX_DQP), LogConstants.CTX_DQP);
+ this.csr.registerClientService(Admin.class, proxyService(Admin.class, admin,
LogConstants.CTX_ADMIN_API), LogConstants.CTX_ADMIN_API);
if (this.jdbcSocketConfiguration.isEnabled()) {
this.jdbcSocket = new SocketListener(this.jdbcSocketConfiguration, csr,
this.dqpCore.getBufferManager());
@@ -174,21 +173,21 @@
/**
* Creates an proxy to validate the incoming session
*/
- private <T> T proxyService(final Class<T> iface, final T instance) {
+ private <T> T proxyService(final Class<T> iface, final T instance, String
context) {
- return iface.cast(Proxy.newProxyInstance(this.getClass().getClassLoader(), new Class[]
{iface}, new InvocationHandler() {
+ return iface.cast(Proxy.newProxyInstance(this.getClass().getClassLoader(), new Class[]
{iface}, new LogManager.LoggingProxy(instance, context, MessageLevel.TRACE) {
- public Object invoke(Object arg0, Method arg1, Object[] arg2) throws Throwable {
+ public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
Throwable exception = null;
try {
sessionService.validateSession(DQPWorkContext.getWorkContext().getSessionId());
- return arg1.invoke(instance, arg2);
+ return super.invoke(proxy, method, args);
} catch (InvocationTargetException e) {
exception = e.getTargetException();
} catch(Throwable t){
exception = t;
}
- throw ExceptionUtil.convertException(arg1, exception);
+ throw ExceptionUtil.convertException(method, exception);
}
}));
}
Modified: trunk/runtime/src/main/java/org/teiid/services/SessionServiceImpl.java
===================================================================
--- trunk/runtime/src/main/java/org/teiid/services/SessionServiceImpl.java 2010-04-01
22:46:50 UTC (rev 2019)
+++ trunk/runtime/src/main/java/org/teiid/services/SessionServiceImpl.java 2010-04-02
00:46:43 UTC (rev 2020)
@@ -54,11 +54,11 @@
import org.teiid.security.Credentials;
import org.teiid.security.SecurityHelper;
-import com.metamatrix.api.exception.security.SessionServiceException;
import com.metamatrix.common.log.LogConstants;
import com.metamatrix.common.log.LogManager;
import com.metamatrix.core.util.ArgCheck;
import com.metamatrix.dqp.service.SessionService;
+import com.metamatrix.dqp.service.SessionServiceException;
/**
* This class serves as the primary implementation of the Session Service.
@@ -299,7 +299,7 @@
public void setSecurityDomains(String domainNameOrder) {
if (domainNameOrder != null && domainNameOrder.trim().length()>0) {
- LogManager.logDetail(LogConstants.CTX_SECURITY, "Security Enabled:
true"); //$NON-NLS-1$
+ LogManager.logInfo(LogConstants.CTX_SECURITY, "Security Enabled:
true"); //$NON-NLS-1$
String[] domainNames = domainNameOrder.split(","); //$NON-NLS-1$
for (String domainName : domainNames) {
@@ -310,7 +310,7 @@
public void setAdminSecurityDomain(String domain) {
this.adminSecurityDomains.add(domain);
- LogManager.logDetail(LogConstants.CTX_SECURITY, "Admin Security Enabled:
true"); //$NON-NLS-1$
+ LogManager.logInfo(LogConstants.CTX_SECURITY, "Admin Security Enabled:
true"); //$NON-NLS-1$
}
public void start() {
Modified: trunk/runtime/src/main/java/org/teiid/transport/LogonImpl.java
===================================================================
--- trunk/runtime/src/main/java/org/teiid/transport/LogonImpl.java 2010-04-01 22:46:50 UTC
(rev 2019)
+++ trunk/runtime/src/main/java/org/teiid/transport/LogonImpl.java 2010-04-02 00:46:43 UTC
(rev 2020)
@@ -39,9 +39,11 @@
import com.metamatrix.api.exception.ComponentNotFoundException;
import com.metamatrix.api.exception.MetaMatrixComponentException;
-import com.metamatrix.api.exception.security.SessionServiceException;
+import com.metamatrix.common.log.LogConstants;
+import com.metamatrix.common.log.LogManager;
import com.metamatrix.core.CoreConstants;
import com.metamatrix.dqp.service.SessionService;
+import com.metamatrix.dqp.service.SessionServiceException;
public class LogonImpl implements ILogon {
@@ -102,6 +104,7 @@
if (id != -1) {
this.service.pingServer(id);
}
+ LogManager.logTrace(LogConstants.CTX_SECURITY, "Ping", id); //$NON-NLS-1$
return ResultsFuture.NULL_FUTURE;
}