teiid SVN: r1247 - trunk/build/kit-runtime/deploy.
by teiid-commits@lists.jboss.org
Author: rareddy
Date: 2009-08-17 11:46:53 -0400 (Mon, 17 Aug 2009)
New Revision: 1247
Modified:
trunk/build/kit-runtime/deploy/log4j.xml
Log:
TEIID-769: the log4J XML, does not like the categories and appender XML fragments to be out of order than specified in its DTD. Re-arranging them.
Modified: trunk/build/kit-runtime/deploy/log4j.xml
===================================================================
--- trunk/build/kit-runtime/deploy/log4j.xml 2009-08-16 12:32:29 UTC (rev 1246)
+++ trunk/build/kit-runtime/deploy/log4j.xml 2009-08-17 15:46:53 UTC (rev 1247)
@@ -25,7 +25,40 @@
</layout>
</appender>
-->
-
+
+ <!-- un-comment to enable COMMAND log
+ <appender name="COMMAND" class="org.apache.log4j.RollingFileAppender">
+ <param name="File" value="log/command.log"/>
+ <param name="MaxFileSize" value="1000KB"/>
+ <param name="MaxBackupIndex" value="25"/>
+ <layout class="org.apache.log4j.PatternLayout">
+ <param name="ConversionPattern" value="%d %p [%t] %c - %m%n"/>
+ </layout>
+ </appender>
+ -->
+
+ <!-- Un-comment to enable AUDIT log
+ <appender name="AUDIT" class="org.apache.log4j.RollingFileAppender">
+ <param name="File" value="log/audit.log"/>
+ <param name="MaxFileSize" value="1000KB"/>
+ <param name="MaxBackupIndex" value="25"/>
+ <layout class="org.apache.log4j.PatternLayout">
+ <param name="ConversionPattern" value="%d %p [%t] %c - %m%n"/>
+ </layout>
+ </appender>
+ -->
+
+ <!-- Un-comment to enable Process Info log
+ <appender name="PROCESS_INFO" class="org.apache.log4j.RollingFileAppender">
+ <param name="File" value="log/process_info.log"/>
+ <param name="MaxFileSize" value="1000KB"/>
+ <param name="MaxBackupIndex" value="25"/>
+ <layout class="org.apache.log4j.PatternLayout">
+ <param name="ConversionPattern" value="%d %p [%t] %c - %m%n"/>
+ </layout>
+ </appender>
+ -->
+
<!-- ================ -->
<!-- categories -->
<!-- ================ -->
@@ -44,50 +77,23 @@
<category name="org.teiid">
<priority value="WARN" />
- </category>
+ </category>
<!-- un-comment to enable COMMAND log
- <appender name="COMMAND" class="org.apache.log4j.RollingFileAppender">
- <param name="File" value="log/command.log"/>
- <param name="MaxFileSize" value="1000KB"/>
- <param name="MaxBackupIndex" value="25"/>
- <layout class="org.apache.log4j.PatternLayout">
- <param name="ConversionPattern" value="%d %p [%t] %c - %m%n"/>
- </layout>
- </appender>
-
<category name="org.teiid.COMMAND_LOG">
<priority value="INFO"/>
<appender-ref ref="COMMAND"/>
</category>
-->
- <!-- Un-comment to enable AUDIT log
- <appender name="AUDIT" class="org.apache.log4j.RollingFileAppender">
- <param name="File" value="log/audit.log"/>
- <param name="MaxFileSize" value="1000KB"/>
- <param name="MaxBackupIndex" value="25"/>
- <layout class="org.apache.log4j.PatternLayout">
- <param name="ConversionPattern" value="%d %p [%t] %c - %m%n"/>
- </layout>
- </appender>
-
+ <!-- Un-comment to enable AUDIT log
<category name="org.teiid.AUDIT_LOG">
<priority value="INFO"/>
<appender-ref ref="AUDIT"/>
</category>
-->
-
- <!-- Un-comment to enable Process Info log
- <appender name="PROCESS_INFO" class="org.apache.log4j.RollingFileAppender">
- <param name="File" value="log/process_info.log"/>
- <param name="MaxFileSize" value="1000KB"/>
- <param name="MaxBackupIndex" value="25"/>
- <layout class="org.apache.log4j.PatternLayout">
- <param name="ConversionPattern" value="%d %p [%t] %c - %m%n"/>
- </layout>
- </appender>
+ <!-- Un-comment to enable Process Info log
<category name="org.teiid.PROCESS_INFO_LOG">
<priority value="INFO"/>
<appender-ref ref="PROCESS_INFO"/>
14 years, 11 months
teiid SVN: r1246 - trunk/runtime/src/main/java/com/metamatrix/jdbc.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2009-08-16 08:32:29 -0400 (Sun, 16 Aug 2009)
New Revision: 1246
Modified:
trunk/runtime/src/main/java/com/metamatrix/jdbc/EmbeddedConnectionFactoryImpl.java
Log:
TEIID-785 TEIID-509 adding back the notion of a process info log and addressing embedded usage concerns
Modified: trunk/runtime/src/main/java/com/metamatrix/jdbc/EmbeddedConnectionFactoryImpl.java
===================================================================
--- trunk/runtime/src/main/java/com/metamatrix/jdbc/EmbeddedConnectionFactoryImpl.java 2009-08-15 03:35:55 UTC (rev 1245)
+++ trunk/runtime/src/main/java/com/metamatrix/jdbc/EmbeddedConnectionFactoryImpl.java 2009-08-16 12:32:29 UTC (rev 1246)
@@ -112,10 +112,11 @@
* @since 4.3
*/
public void initialize(Properties props) throws MetaMatrixCoreException {
- URL bootstrapURL = URLHelper.buildURL(props.getProperty(DQPEmbeddedProperties.BOOTURL));
+ URL bootstrapURL = null;
String processName = props.getProperty(DQPEmbeddedProperties.PROCESSNAME, "embedded"); //$NON-NLS-1$
try {
+ bootstrapURL = URLHelper.buildURL(props.getProperty(DQPEmbeddedProperties.BOOTURL));
// Create a temporary workspace directory
String teiidHome = props.getProperty(DQPEmbeddedProperties.TEIID_HOME);
this.workspaceDirectory = createWorkspace(teiidHome, props.getProperty(DQPEmbeddedProperties.DQP_WORKDIR, "work"), processName); //$NON-NLS-1$
14 years, 11 months
teiid SVN: r1245 - in trunk/engine/src: main/java/com/metamatrix/query/processor/relational and 6 other directories.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2009-08-14 23:35:55 -0400 (Fri, 14 Aug 2009)
New Revision: 1245
Added:
trunk/engine/src/main/java/com/metamatrix/query/processor/relational/InsertPlanExecutionNode.java
Modified:
trunk/engine/src/main/java/com/metamatrix/query/optimizer/relational/PlanToProcessConverter.java
trunk/engine/src/main/java/com/metamatrix/query/optimizer/relational/RelationalPlanner.java
trunk/engine/src/main/java/com/metamatrix/query/processor/relational/DependentProcedureCriteriaProcessor.java
trunk/engine/src/main/java/com/metamatrix/query/processor/relational/PlanExecutionNode.java
trunk/engine/src/main/java/com/metamatrix/query/processor/relational/RelationalNode.java
trunk/engine/src/main/java/com/metamatrix/query/validator/ValidationVisitor.java
trunk/engine/src/main/java/org/teiid/dqp/internal/process/Request.java
trunk/engine/src/main/java/org/teiid/dqp/internal/process/multisource/MultiSourcePlanToProcessConverter.java
trunk/engine/src/test/java/com/metamatrix/query/processor/FakeDataManager.java
trunk/engine/src/test/java/com/metamatrix/query/processor/TestInsertProcessing.java
trunk/engine/src/test/java/com/metamatrix/query/validator/TestValidator.java
trunk/engine/src/test/java/org/teiid/dqp/internal/process/multisource/TestMultiSourcePlanToProcessConverter.java
Log:
TEIID-500 adding support for insert into a virtual table with a query expression. this implementation should be simplified to use make insert planning rather than select into as the dominant abstraction.
Modified: trunk/engine/src/main/java/com/metamatrix/query/optimizer/relational/PlanToProcessConverter.java
===================================================================
--- trunk/engine/src/main/java/com/metamatrix/query/optimizer/relational/PlanToProcessConverter.java 2009-08-15 03:23:38 UTC (rev 1244)
+++ trunk/engine/src/main/java/com/metamatrix/query/optimizer/relational/PlanToProcessConverter.java 2009-08-15 03:35:55 UTC (rev 1245)
@@ -22,6 +22,7 @@
package com.metamatrix.query.optimizer.relational;
+import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
@@ -29,6 +30,8 @@
import com.metamatrix.api.exception.MetaMatrixComponentException;
import com.metamatrix.api.exception.query.QueryMetadataException;
import com.metamatrix.api.exception.query.QueryPlannerException;
+import com.metamatrix.api.exception.query.QueryResolverException;
+import com.metamatrix.api.exception.query.QueryValidatorException;
import com.metamatrix.core.id.IDGenerator;
import com.metamatrix.core.id.IntegerID;
import com.metamatrix.core.id.IntegerIDFactory;
@@ -37,6 +40,7 @@
import com.metamatrix.query.execution.QueryExecPlugin;
import com.metamatrix.query.metadata.QueryMetadataInterface;
import com.metamatrix.query.metadata.TempMetadataID;
+import com.metamatrix.query.optimizer.QueryOptimizer;
import com.metamatrix.query.optimizer.capabilities.CapabilitiesFinder;
import com.metamatrix.query.optimizer.capabilities.SourceCapabilities;
import com.metamatrix.query.optimizer.capabilities.SourceCapabilities.Capability;
@@ -49,6 +53,7 @@
import com.metamatrix.query.processor.relational.DependentProcedureAccessNode;
import com.metamatrix.query.processor.relational.DependentProcedureExecutionNode;
import com.metamatrix.query.processor.relational.GroupingNode;
+import com.metamatrix.query.processor.relational.InsertPlanExecutionNode;
import com.metamatrix.query.processor.relational.JoinNode;
import com.metamatrix.query.processor.relational.LimitNode;
import com.metamatrix.query.processor.relational.MergeJoinStrategy;
@@ -66,18 +71,24 @@
import com.metamatrix.query.processor.relational.JoinNode.JoinStrategyType;
import com.metamatrix.query.processor.relational.MergeJoinStrategy.SortOption;
import com.metamatrix.query.processor.relational.SortUtility.Mode;
+import com.metamatrix.query.resolver.QueryResolver;
import com.metamatrix.query.resolver.util.ResolverUtil;
+import com.metamatrix.query.rewriter.QueryRewriter;
import com.metamatrix.query.sql.lang.Command;
import com.metamatrix.query.sql.lang.Criteria;
+import com.metamatrix.query.sql.lang.Insert;
import com.metamatrix.query.sql.lang.JoinType;
import com.metamatrix.query.sql.lang.Query;
import com.metamatrix.query.sql.lang.StoredProcedure;
import com.metamatrix.query.sql.lang.SetQuery.Operation;
+import com.metamatrix.query.sql.symbol.ElementSymbol;
import com.metamatrix.query.sql.symbol.Expression;
import com.metamatrix.query.sql.symbol.GroupSymbol;
+import com.metamatrix.query.sql.symbol.Reference;
import com.metamatrix.query.sql.util.SymbolMap;
import com.metamatrix.query.sql.visitor.EvaluatableVisitor;
import com.metamatrix.query.sql.visitor.GroupCollectorVisitor;
+import com.metamatrix.query.util.CommandContext;
import com.metamatrix.query.util.ErrorMessageKeys;
public class PlanToProcessConverter {
@@ -85,12 +96,14 @@
private IDGenerator idGenerator;
private AnalysisRecord analysisRecord;
private CapabilitiesFinder capFinder;
+ private CommandContext context;
- public PlanToProcessConverter(QueryMetadataInterface metadata, IDGenerator idGenerator, AnalysisRecord analysisRecord, CapabilitiesFinder capFinder) {
+ public PlanToProcessConverter(QueryMetadataInterface metadata, IDGenerator idGenerator, AnalysisRecord analysisRecord, CapabilitiesFinder capFinder, CommandContext context) {
this.metadata = metadata;
this.idGenerator = idGenerator;
this.analysisRecord = analysisRecord;
this.capFinder = capFinder;
+ this.context = context;
}
public RelationalPlan convert(PlanNode planNode)
@@ -155,32 +168,52 @@
case NodeConstants.Types.PROJECT:
GroupSymbol intoGroup = (GroupSymbol) node.getProperty(NodeConstants.Info.INTO_GROUP);
if(intoGroup != null) {
- ProjectIntoNode pinode = new ProjectIntoNode(getID());
- pinode.setIntoGroup(intoGroup);
try {
// Figure out what elements should be inserted based on what is being projected
// from child node
- List allIntoElements = ResolverUtil.resolveElementsInGroup(intoGroup, metadata);
+ List<ElementSymbol> allIntoElements = ResolverUtil.resolveElementsInGroup(intoGroup, metadata);
- pinode.setIntoElements(allIntoElements);
-
+
Object groupID = intoGroup.getMetadataID();
Object modelID = metadata.getModelID(groupID);
String modelName = metadata.getFullName(modelID);
- pinode.setModelName(modelName);
- if (!metadata.isVirtualGroup(groupID) && !metadata.isTemporaryTable(groupID)) {
- SourceCapabilities caps = capFinder.findCapabilities(modelName);
- pinode.setDoBatching(caps.supportsCapability(Capability.BATCHED_UPDATES));
- pinode.setDoBulkInsert(caps.supportsCapability(Capability.BULK_UPDATE));
- } else if (metadata.isTemporaryTable(groupID)) {
- pinode.setDoBulkInsert(true);
+ if (metadata.isVirtualGroup(groupID)) {
+ List<Reference> references = new ArrayList<Reference>(allIntoElements.size());
+ for (int i = 0; i < allIntoElements.size(); i++) {
+ Reference ref = new Reference(i);
+ ref.setType(allIntoElements.get(i).getType());
+ references.add(ref);
+ }
+ Insert insert = new Insert(intoGroup, allIntoElements, references);
+ QueryResolver.resolveCommand(insert, metadata, analysisRecord);
+ QueryRewriter.rewrite(insert, null, metadata, context);
+ ProcessorPlan plan = QueryOptimizer.optimizePlan(insert, metadata, idGenerator, capFinder, analysisRecord, context);
+ InsertPlanExecutionNode ipen = new InsertPlanExecutionNode(getID());
+ ipen.setProcessorPlan(plan);
+ ipen.setReferences(references);
+ processNode = ipen;
+ } else {
+ ProjectIntoNode pinode = new ProjectIntoNode(getID());
+ pinode.setIntoGroup(intoGroup);
+ pinode.setIntoElements(allIntoElements);
+ pinode.setModelName(modelName);
+ processNode = pinode;
+ if (!metadata.isTemporaryTable(groupID)) {
+ SourceCapabilities caps = capFinder.findCapabilities(modelName);
+ pinode.setDoBatching(caps.supportsCapability(Capability.BATCHED_UPDATES));
+ pinode.setDoBulkInsert(caps.supportsCapability(Capability.BULK_UPDATE));
+ } else {
+ pinode.setDoBulkInsert(true);
+ }
}
} catch(QueryMetadataException e) {
throw new MetaMatrixComponentException(e);
+ } catch(QueryResolverException e) {
+ throw new MetaMatrixComponentException(e);
+ } catch(QueryValidatorException e) {
+ throw new MetaMatrixComponentException(e);
}
- processNode = pinode;
-
} else {
List symbols = (List) node.getProperty(NodeConstants.Info.PROJECT_COLS);
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 2009-08-15 03:23:38 UTC (rev 1244)
+++ trunk/engine/src/main/java/com/metamatrix/query/optimizer/relational/RelationalPlanner.java 2009-08-15 03:35:55 UTC (rev 1245)
@@ -147,7 +147,7 @@
planToProcessConverter = context.getPlanToProcessConverter();
}
if (planToProcessConverter == null) {
- planToProcessConverter = new PlanToProcessConverter(metadata, idGenerator, analysisRecord, capFinder);
+ planToProcessConverter = new PlanToProcessConverter(metadata, idGenerator, analysisRecord, capFinder, context);
}
RelationalPlan result = planToProcessConverter.convert(plan);
Modified: trunk/engine/src/main/java/com/metamatrix/query/processor/relational/DependentProcedureCriteriaProcessor.java
===================================================================
--- trunk/engine/src/main/java/com/metamatrix/query/processor/relational/DependentProcedureCriteriaProcessor.java 2009-08-15 03:23:38 UTC (rev 1244)
+++ trunk/engine/src/main/java/com/metamatrix/query/processor/relational/DependentProcedureCriteriaProcessor.java 2009-08-15 03:35:55 UTC (rev 1245)
@@ -55,10 +55,6 @@
this.inputReferences = references;
}
- /**
- * @throws TupleSourceNotFoundException
- * @see com.metamatrix.query.processor.relational.PlanExecutionNode#prepareNextCommand()
- */
protected boolean prepareNextCommand(VariableContext context) throws BlockedException,
MetaMatrixComponentException, MetaMatrixProcessingException {
Added: trunk/engine/src/main/java/com/metamatrix/query/processor/relational/InsertPlanExecutionNode.java
===================================================================
--- trunk/engine/src/main/java/com/metamatrix/query/processor/relational/InsertPlanExecutionNode.java (rev 0)
+++ trunk/engine/src/main/java/com/metamatrix/query/processor/relational/InsertPlanExecutionNode.java 2009-08-15 03:35:55 UTC (rev 1245)
@@ -0,0 +1,115 @@
+/*
+ * 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.relational;
+
+import java.util.Arrays;
+import java.util.List;
+
+import org.teiid.dqp.internal.process.PreparedStatementRequest;
+
+import com.metamatrix.api.exception.MetaMatrixComponentException;
+import com.metamatrix.api.exception.MetaMatrixProcessingException;
+import com.metamatrix.common.buffer.BlockedException;
+import com.metamatrix.common.buffer.TupleBatch;
+import com.metamatrix.query.sql.symbol.Reference;
+
+public class InsertPlanExecutionNode extends PlanExecutionNode {
+
+ private List<Reference> references;
+
+ private int batchRow = 1;
+ private int insertCount = 0;
+ private TupleBatch currentBatch;
+
+ public InsertPlanExecutionNode(int nodeID) {
+ super(nodeID);
+ }
+
+ public void setReferences(List<Reference> references) {
+ this.references = references;
+ }
+
+ @Override
+ protected void addBatchRow(List row) {
+ this.insertCount += ((Integer)row.get(0)).intValue();
+ }
+
+ @Override
+ protected TupleBatch pullBatch() {
+ if (isLastBatch()) {
+ super.addBatchRow(Arrays.asList(insertCount));
+ }
+ return super.pullBatch();
+ }
+
+ @Override
+ protected boolean hasNextCommand() {
+ return !this.currentBatch.getTerminationFlag() || batchRow <= this.currentBatch.getEndRow();
+ }
+
+ @Override
+ protected boolean openPlanImmediately() {
+ return false;
+ }
+
+ @Override
+ protected boolean prepareNextCommand() throws BlockedException,
+ MetaMatrixComponentException, MetaMatrixProcessingException {
+ if (this.currentBatch == null) {
+ this.currentBatch = this.getChildren()[0].nextBatch();
+ }
+ if (!hasNextCommand()) {
+ return false;
+ }
+ //assign the reference values.
+ PreparedStatementRequest.resolveParameterValues(this.references, this.currentBatch.getTuple(this.batchRow), getProcessorPlan().getContext());
+ this.batchRow++;
+ return true;
+ }
+
+ public Object clone(){
+ InsertPlanExecutionNode clonedNode = new InsertPlanExecutionNode(super.getID());
+ copy(this, clonedNode);
+ return clonedNode;
+ }
+
+ protected void copy(InsertPlanExecutionNode source, InsertPlanExecutionNode target) {
+ target.references = source.references;
+ super.copy(source, target);
+ }
+
+ @Override
+ public void close() throws MetaMatrixComponentException {
+ super.close();
+ this.currentBatch = null;
+ }
+
+ @Override
+ public void reset() {
+ super.reset();
+ this.currentBatch = null;
+ this.batchRow = 1;
+ this.insertCount = 0;
+ }
+
+}
Property changes on: trunk/engine/src/main/java/com/metamatrix/query/processor/relational/InsertPlanExecutionNode.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/engine/src/main/java/com/metamatrix/query/processor/relational/PlanExecutionNode.java
===================================================================
--- trunk/engine/src/main/java/com/metamatrix/query/processor/relational/PlanExecutionNode.java 2009-08-15 03:23:38 UTC (rev 1244)
+++ trunk/engine/src/main/java/com/metamatrix/query/processor/relational/PlanExecutionNode.java 2009-08-15 03:35:55 UTC (rev 1245)
@@ -63,19 +63,23 @@
public void open()
throws MetaMatrixComponentException, MetaMatrixProcessingException {
-
+ super.open();
// Initialize plan for execution
CommandContext subContext = (CommandContext) getContext().clone();
subContext.pushVariableContext(new VariableContext());
plan.initialize(subContext, getDataManager(), this.getBufferManager());
- if (prepareNextCommand()) {
+ if (openPlanImmediately() && prepareNextCommand()) {
needsProcessing = true;
plan.open();
isOpen = true;
}
}
+ protected boolean openPlanImmediately() {
+ return true;
+ }
+
public TupleBatch nextBatchDirect()
throws BlockedException, MetaMatrixComponentException, MetaMatrixProcessingException {
@@ -104,18 +108,20 @@
}
TupleBatch batch = plan.nextBatch();
- boolean lastBatch = batch.getTerminationFlag();
- if(lastBatch) {
- if (!hasNextCommand()) {
- terminateBatches();
- } else {
- lastBatch = false;
- resetPlan();
- }
+ for (List tuple : batch.getAllTuples()) {
+ addBatchRow(tuple);
+ }
+
+ if(batch.getTerminationFlag()) {
+ if (hasNextCommand()) {
+ resetPlan();
+ } else {
+ terminateBatches();
+ }
}
- batch.setTerminationFlag(lastBatch);
- return batch;
+
+ return pullBatch();
}
protected boolean prepareNextCommand() throws BlockedException,
Modified: trunk/engine/src/main/java/com/metamatrix/query/processor/relational/RelationalNode.java
===================================================================
--- trunk/engine/src/main/java/com/metamatrix/query/processor/relational/RelationalNode.java 2009-08-15 03:23:38 UTC (rev 1244)
+++ trunk/engine/src/main/java/com/metamatrix/query/processor/relational/RelationalNode.java 2009-08-15 03:35:55 UTC (rev 1245)
@@ -89,6 +89,10 @@
this.nodeID = nodeID;
}
+ public boolean isLastBatch() {
+ return lastBatch;
+ }
+
public void setContext(CommandContext context) {
this.context = context;
}
@@ -247,14 +251,13 @@
public TupleBatch nextBatch() throws BlockedException, MetaMatrixComponentException, MetaMatrixProcessingException {
boolean recordStats = this.context != null && (this.context.getCollectNodeStatistics() || this.context.getProcessDebug());
- //start timer for this batch
- if(recordStats && this.context.getCollectNodeStatistics()) {
- this.nodeStatistics.startBatchTimer();
- }
-
TupleBatch batch = null;
try {
while (true) {
+ //start timer for this batch
+ if(recordStats && this.context.getCollectNodeStatistics()) {
+ this.nodeStatistics.startBatchTimer();
+ }
batch = nextBatchDirect();
if (recordStats) {
if(this.context.getCollectNodeStatistics()) {
@@ -271,7 +274,7 @@
//24663: only return non-zero batches.
//there have been several instances in the code that have not correctly accounted for non-terminal zero length batches
//this processing style however against the spirit of batch processing (but was already utilized by Sort and Grouping nodes)
- if (batch.getSize() != 0 || batch.getTerminationFlag()) {
+ if (batch.getRowCount() != 0 || batch.getTerminationFlag()) {
break;
}
}
Modified: trunk/engine/src/main/java/com/metamatrix/query/validator/ValidationVisitor.java
===================================================================
--- trunk/engine/src/main/java/com/metamatrix/query/validator/ValidationVisitor.java 2009-08-15 03:23:38 UTC (rev 1244)
+++ trunk/engine/src/main/java/com/metamatrix/query/validator/ValidationVisitor.java 2009-08-15 03:35:55 UTC (rev 1245)
@@ -119,7 +119,7 @@
@Override
public void validate(Object value) throws QueryValidatorException {
if (((Integer)value).intValue() < 0) {
- throw new QueryValidatorException(QueryPlugin.Util.getString(msgKey)); //$NON-NLS-1$
+ throw new QueryValidatorException(QueryPlugin.Util.getString(msgKey));
}
}
}
@@ -162,7 +162,7 @@
public void visit(Delete obj) {
validateNoXMLUpdates(obj);
validateHasProjectedSymbols(obj);
- validateGroupUpdatable(obj);
+ validateGroupSupportsUpdate(obj.getGroup());
if (obj.getGroup().isTempTable()) {
handleValidationError(QueryPlugin.Util.getString("ValidationVisitor.update_temp", obj.getGroup()), obj.getGroup()); //$NON-NLS-1$
}
@@ -201,7 +201,7 @@
public void visit(Insert obj) {
validateNoXMLUpdates(obj);
validateHasProjectedSymbols(obj);
- validateGroupUpdatable(obj);
+ validateGroupSupportsUpdate(obj.getGroup());
validateInsert(obj);
}
@@ -269,28 +269,15 @@
public void visit(Update obj) {
validateNoXMLUpdates(obj);
validateHasProjectedSymbols(obj);
- validateGroupUpdatable(obj);
+ validateGroupSupportsUpdate(obj.getGroup());
validateUpdate(obj);
}
public void visit(Into obj) {
GroupSymbol target = obj.getGroup();
- validateInsertGroup(obj, target);
+ validateGroupSupportsUpdate(target);
}
- private void validateInsertGroup(LanguageObject obj,
- GroupSymbol target) {
- try {
- if(!target.isTempGroupSymbol() && getMetadata().isVirtualGroup(target.getMetadataID())) {
- handleValidationError(QueryPlugin.Util.getString(ErrorMessageKeys.VALIDATOR_0070),obj);
- } else {
- validateGroupSupportsUpdate(target);
- }
- } catch (MetaMatrixComponentException e) {
- handleException(e, obj);
- }
- }
-
public void visit(Function obj) {
if(FunctionLibrary.LOOKUP.equalsIgnoreCase(obj.getName())) {
try {
@@ -658,25 +645,20 @@
handleValidationError(QueryPlugin.Util.getString(ErrorMessageKeys.VALIDATOR_0032), obj);
}
if(obj.getLimit() != null) {
- handleValidationError(QueryPlugin.Util.getString("ValidationVisitor.limit_not_valid_for_xml"), obj);
+ handleValidationError(QueryPlugin.Util.getString("ValidationVisitor.limit_not_valid_for_xml"), obj); //$NON-NLS-1$
}
}
- protected void validateGroupSupportsUpdate(GroupSymbol groupSymbol) throws QueryMetadataException, MetaMatrixComponentException {
- if(! getMetadata().groupSupports(groupSymbol.getMetadataID(), SupportConstants.Group.UPDATE)) {
- handleValidationError(QueryPlugin.Util.getString(ErrorMessageKeys.VALIDATOR_0033, SQLStringVisitor.getSQLString(groupSymbol)), groupSymbol);
- }
+ protected void validateGroupSupportsUpdate(GroupSymbol groupSymbol) {
+ try {
+ if(! getMetadata().groupSupports(groupSymbol.getMetadataID(), SupportConstants.Group.UPDATE)) {
+ handleValidationError(QueryPlugin.Util.getString(ErrorMessageKeys.VALIDATOR_0033, SQLStringVisitor.getSQLString(groupSymbol)), groupSymbol);
+ }
+ } catch (MetaMatrixComponentException e) {
+ handleException(e, groupSymbol);
+ }
}
- protected void validateGroupUpdatable(Command obj) {
- try {
- Collection groups = GroupCollectorVisitor.getGroups(obj, true);
- validateGroupSupportsUpdate((GroupSymbol) groups.iterator().next());
- } catch(MetaMatrixComponentException e) {
- handleException(e, obj);
- }
- }
-
protected void validateSetQuery(SetQuery query) {
// Walk through sub queries - validate each one separately and
// also check the columns of each for comparability
@@ -764,11 +746,6 @@
}
}
- if ( obj.getQueryExpression() != null) {
- validateInsertGroup(obj, obj.getGroup());
- return;
- }
-
//check to see if the elements support nulls in metadata,
// if any of the value present in the insert are null
while(valIter.hasNext() && varIter.hasNext()) {
Modified: trunk/engine/src/main/java/org/teiid/dqp/internal/process/Request.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/dqp/internal/process/Request.java 2009-08-15 03:23:38 UTC (rev 1244)
+++ trunk/engine/src/main/java/org/teiid/dqp/internal/process/Request.java 2009-08-15 03:35:55 UTC (rev 1245)
@@ -281,7 +281,7 @@
if (multiSourceModels != null) {
MultiSourcePlanToProcessConverter modifier = new MultiSourcePlanToProcessConverter(
metadata, idGenerator, analysisRecord, capabilitiesFinder,
- multiSourceModels, vdbName, vdbService, vdbVersion);
+ multiSourceModels, vdbName, vdbService, vdbVersion, context);
context.setPlanToProcessConverter(modifier);
}
Modified: trunk/engine/src/main/java/org/teiid/dqp/internal/process/multisource/MultiSourcePlanToProcessConverter.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/dqp/internal/process/multisource/MultiSourcePlanToProcessConverter.java 2009-08-15 03:23:38 UTC (rev 1244)
+++ trunk/engine/src/main/java/org/teiid/dqp/internal/process/multisource/MultiSourcePlanToProcessConverter.java 2009-08-15 03:35:55 UTC (rev 1245)
@@ -46,6 +46,7 @@
import com.metamatrix.query.rewriter.QueryRewriter;
import com.metamatrix.query.sql.lang.Command;
import com.metamatrix.query.sql.navigator.DeepPreOrderNavigator;
+import com.metamatrix.query.util.CommandContext;
public class MultiSourcePlanToProcessConverter extends PlanToProcessConverter {
@@ -57,8 +58,8 @@
public MultiSourcePlanToProcessConverter(QueryMetadataInterface metadata,
IDGenerator idGenerator, AnalysisRecord analysisRecord,
CapabilitiesFinder capFinder, Set<String> multiSourceModels,
- String vdbName, VDBService vdbService, String vdbVersion) {
- super(metadata, idGenerator, analysisRecord, capFinder);
+ String vdbName, VDBService vdbService, String vdbVersion, CommandContext context) {
+ super(metadata, idGenerator, analysisRecord, capFinder, context);
this.multiSourceModels = multiSourceModels;
this.vdbName = vdbName;
this.vdbService = vdbService;
Modified: trunk/engine/src/test/java/com/metamatrix/query/processor/FakeDataManager.java
===================================================================
--- trunk/engine/src/test/java/com/metamatrix/query/processor/FakeDataManager.java 2009-08-15 03:23:38 UTC (rev 1244)
+++ trunk/engine/src/test/java/com/metamatrix/query/processor/FakeDataManager.java 2009-08-15 03:35:55 UTC (rev 1245)
@@ -23,6 +23,7 @@
package com.metamatrix.query.processor;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
@@ -38,7 +39,9 @@
import com.metamatrix.query.sql.lang.BatchedUpdateCommand;
import com.metamatrix.query.sql.lang.Command;
import com.metamatrix.query.sql.lang.CommandContainer;
+import com.metamatrix.query.sql.lang.Delete;
import com.metamatrix.query.sql.lang.From;
+import com.metamatrix.query.sql.lang.Insert;
import com.metamatrix.query.sql.lang.ProcedureContainer;
import com.metamatrix.query.sql.lang.Query;
import com.metamatrix.query.sql.lang.SetQuery;
@@ -146,7 +149,7 @@
* either came from a BatchedUpdateCommand or a signle
* command from an Update command.
*/
- List<TranslatableProcedureContainer> updateCommands = new ArrayList<TranslatableProcedureContainer>();
+ List<Command> updateCommands = new ArrayList<Command>();
// Apply query criteria to tuples
if(command instanceof Query){
@@ -177,48 +180,51 @@
tuples = new List[filteredTuples.size()];
filteredTuples.toArray(tuples);
}
- } else if ( command instanceof TranslatableProcedureContainer ) {
+ } else if ( command instanceof Insert || command instanceof Update || command instanceof Delete) {
// add single update command to a list to be executed
- updateCommands.add((TranslatableProcedureContainer)command);
+ updateCommands.add(command);
} else if ( command instanceof BatchedUpdateCommand ) {
- if ( ((CommandContainer) command).getContainedCommands() != null && ((CommandContainer) command).getContainedCommands().size() > 0 )
+ if ( ((CommandContainer) command).getContainedCommands() != null && ((CommandContainer) command).getContainedCommands().size() > 0 ) {
// add all update commands to a list to be executed
- for ( int i = 0; i < ((CommandContainer) command).getContainedCommands().size(); i++ )
- if ( ((CommandContainer) command).getContainedCommands().get(i) instanceof TranslatableProcedureContainer ) {
- updateCommands.add(((TranslatableProcedureContainer) ((CommandContainer) command).getContainedCommands().get(i)));
- }
+ updateCommands.addAll(((CommandContainer) command).getContainedCommands());
+ }
}
// if we had update commands added to the list, execute them now
if ( updateCommands.size() > 0 ) {
List<List<Integer>> filteredTuples = new ArrayList<List<Integer>>();
for ( int c = 0; c < updateCommands.size(); c++ ) {
- TranslatableProcedureContainer update = updateCommands.get(c);
- if ( update.getCriteria() != null ) {
- // Build lookupMap from BOTH all the elements and the projected symbols - both may be needed here
- Map<Object, Integer> lookupMap = new HashMap<Object, Integer>();
- for(int i=0; i<elements.size(); i++) {
- Object element = elements.get(i);
- mapElementToIndex(lookupMap, element, new Integer(i), group);
- }
- for(int i=0; i<projectedSymbols.size(); i++) {
- Object element = projectedSymbols.get(i);
- mapElementToIndex(lookupMap, element, new Integer(columnMap[i]), group);
- }
-
- int updated = 0;
- for(int i=0; i<tuples.length; i++) {
- try {
- if(new Evaluator(lookupMap, null, null).evaluate(update.getCriteria(), tuples[i])) {
- updated++;
- }
- } catch(CriteriaEvaluationException e) {
- throw new MetaMatrixComponentException(e, e.getMessage());
- }
- }
- List<Integer> updateTuple = new ArrayList<Integer>(1);
- updateTuple.add( new Integer(updated) );
- filteredTuples.add(updateTuple);
+ Command cmd = updateCommands.get(c);
+ if (cmd instanceof TranslatableProcedureContainer) {
+ TranslatableProcedureContainer update = (TranslatableProcedureContainer)cmd;
+ if ( update.getCriteria() != null ) {
+ // Build lookupMap from BOTH all the elements and the projected symbols - both may be needed here
+ Map<Object, Integer> lookupMap = new HashMap<Object, Integer>();
+ for(int i=0; i<elements.size(); i++) {
+ Object element = elements.get(i);
+ mapElementToIndex(lookupMap, element, new Integer(i), group);
+ }
+ for(int i=0; i<projectedSymbols.size(); i++) {
+ Object element = projectedSymbols.get(i);
+ mapElementToIndex(lookupMap, element, new Integer(columnMap[i]), group);
+ }
+
+ int updated = 0;
+ for(int i=0; i<tuples.length; i++) {
+ try {
+ if(new Evaluator(lookupMap, null, null).evaluate(update.getCriteria(), tuples[i])) {
+ updated++;
+ }
+ } catch(CriteriaEvaluationException e) {
+ throw new MetaMatrixComponentException(e, e.getMessage());
+ }
+ }
+ List<Integer> updateTuple = new ArrayList<Integer>(1);
+ updateTuple.add( new Integer(updated) );
+ filteredTuples.add(updateTuple);
+ }
+ } else {
+ filteredTuples.add(Arrays.asList(1)); //TODO: check for bulk
}
}
tuples = new List[filteredTuples.size()];
Modified: trunk/engine/src/test/java/com/metamatrix/query/processor/TestInsertProcessing.java
===================================================================
--- trunk/engine/src/test/java/com/metamatrix/query/processor/TestInsertProcessing.java 2009-08-15 03:23:38 UTC (rev 1244)
+++ trunk/engine/src/test/java/com/metamatrix/query/processor/TestInsertProcessing.java 2009-08-15 03:35:55 UTC (rev 1245)
@@ -183,14 +183,6 @@
};
helpProcess(plan, dataManager, expected);
-
- Insert insert = (Insert)dataManager.getCommandHistory().iterator().next();
- //List lst = (List)insert.getParameterValues().get(0);
- //Object value0 = lst.get(0);
- //Object value1 = lst.get(1);
-
- //assertEquals(DataTypeManager.DefaultDataClasses.BIG_INTEGER, value0.getClass());
- //assertEquals(DataTypeManager.DefaultDataClasses.FLOAT, value1.getClass());
}
@@ -393,5 +385,22 @@
assertEquals( "INSERT INTO pm1.g2 (pm1.g2.e1, pm1.g2.e2, pm1.g2.e3, pm1.g2.e4) VALUES ('2', 2, TRUE, 2.0)", bu.getUpdateCommands().get(1).toString() ); //$NON-NLS-1$
}
}
+
+ @Test public void testInsertIntoVirtualWithQueryExpression() {
+ String sql = "insert into vm1.g1 (e1, e2, e3, e4) select * from pm1.g1"; //$NON-NLS-1$
+
+ List[] expected = new List[] {
+ Arrays.asList(6),
+ };
+
+ FakeDataManager dataManager = new FakeDataManager();
+ sampleData1(dataManager);
+
+ // Plan query
+ ProcessorPlan plan = helpGetPlan(sql, FakeMetadataFactory.example1Cached());
+ // Run query
+ helpProcess(plan, dataManager, expected);
+ }
+
}
Modified: trunk/engine/src/test/java/com/metamatrix/query/validator/TestValidator.java
===================================================================
--- trunk/engine/src/test/java/com/metamatrix/query/validator/TestValidator.java 2009-08-15 03:23:38 UTC (rev 1244)
+++ trunk/engine/src/test/java/com/metamatrix/query/validator/TestValidator.java 2009-08-15 03:35:55 UTC (rev 1245)
@@ -1631,8 +1631,8 @@
FakeMetadataObject.Props.UPDATE_PROCEDURE);
}
- public void testInvalidSelectIntoVirtualGroup() {
- helpValidate("SELECT e1, e2, e3, e4 INTO vm1.g1 FROM pm1.g2", new String[] {"vm1.g1"}, FakeMetadataFactory.example1Cached()); //$NON-NLS-1$ //$NON-NLS-2$
+ public void testSelectIntoVirtualGroup() {
+ helpValidate("SELECT e1, e2, e3, e4 INTO vm1.g1 FROM pm1.g2", new String[] {}, FakeMetadataFactory.example1Cached()); //$NON-NLS-1$
String procedure = "CREATE PROCEDURE "; //$NON-NLS-1$
procedure = procedure + "BEGIN\n"; //$NON-NLS-1$
@@ -1642,7 +1642,7 @@
String userQuery = "UPDATE vm1.g3 SET x='x' where y = 1"; //$NON-NLS-1$
- helpFailProcedure(procedure, userQuery,
+ helpValidateProcedure(procedure, userQuery,
FakeMetadataObject.Props.UPDATE_PROCEDURE);
}
@@ -1945,18 +1945,11 @@
helpValidate("update #temp set e1 = 1", new String[] {"#temp"}, metadata); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testSelectIntoVirtual() throws Exception {
- QueryMetadataInterface metadata = FakeMetadataFactory.example1Cached();
- Command command = helpResolve("select * into vm1.g1 from pm1.g1", metadata); //$NON-NLS-1$
- ValidatorReport report = Validator.validate(command, metadata);
- assertEquals("The target table for a SELECT INTO or an INSERT with a query expression can only be a physical table or a temporary table.", report.toString()); //$NON-NLS-1$
- }
-
public void testInsertIntoVirtualWithQuery() throws Exception {
QueryMetadataInterface metadata = FakeMetadataFactory.example1Cached();
Command command = helpResolve("insert into vm1.g1 select 1, 2, true, 3", metadata); //$NON-NLS-1$
ValidatorReport report = Validator.validate(command, metadata);
- assertEquals("The target table for a SELECT INTO or an INSERT with a query expression can only be a physical table or a temporary table.", report.toString()); //$NON-NLS-1$
+ assertTrue(report.getItems().isEmpty());
}
public void testDynamicIntoDeclaredTemp() throws Exception {
Modified: trunk/engine/src/test/java/org/teiid/dqp/internal/process/multisource/TestMultiSourcePlanToProcessConverter.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/dqp/internal/process/multisource/TestMultiSourcePlanToProcessConverter.java 2009-08-15 03:23:38 UTC (rev 1244)
+++ trunk/engine/src/test/java/org/teiid/dqp/internal/process/multisource/TestMultiSourcePlanToProcessConverter.java 2009-08-15 03:35:55 UTC (rev 1245)
@@ -123,7 +123,7 @@
Properties props = new Properties();
CommandContext context = new CommandContext("0", "test", "user", null, vdbName, vdbVersion, props, false, false); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- context.setPlanToProcessConverter(new MultiSourcePlanToProcessConverter(metadata, idGenerator, analysis, finder, multiSourceModels, vdbName, vdbService, vdbVersion));
+ context.setPlanToProcessConverter(new MultiSourcePlanToProcessConverter(metadata, idGenerator, analysis, finder, multiSourceModels, vdbName, vdbService, vdbVersion, context));
ProcessorPlan plan = QueryOptimizer.optimizePlan(command, wrapper, idGenerator, finder, analysis, context);
14 years, 11 months
teiid SVN: r1244 - in trunk: client/src/main/java/com/metamatrix/common/comm/api and 9 other directories.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2009-08-14 23:23:38 -0400 (Fri, 14 Aug 2009)
New Revision: 1244
Modified:
trunk/build/kit-runtime/deploy/log4j.xml
trunk/client-jdbc/src/main/java/org/teiid/jdbc/EmbeddedProfile.java
trunk/client/src/main/java/com/metamatrix/common/comm/api/ServerConnectionFactory.java
trunk/client/src/main/java/com/metamatrix/common/comm/platform/socket/client/SocketServerConnectionFactory.java
trunk/engine/src/main/java/com/metamatrix/dqp/util/LogConstants.java
trunk/runtime/src/main/java/com/metamatrix/dqp/embedded/services/EmbeddedConfigurationService.java
trunk/runtime/src/main/java/com/metamatrix/jdbc/EmbeddedConnectionFactoryImpl.java
trunk/runtime/src/main/java/com/metamatrix/jdbc/EmbeddedGuiceModule.java
trunk/runtime/src/main/java/com/metamatrix/jdbc/Log4JUtil.java
trunk/runtime/src/main/java/com/metamatrix/jdbc/LogListernerProvider.java
trunk/runtime/src/main/java/org/teiid/Server.java
trunk/runtime/src/main/java/org/teiid/transport/SocketTransport.java
trunk/runtime/src/test/java/com/metamatrix/dqp/embedded/TestEmbeddedConfigSource.java
trunk/runtime/src/test/java/org/teiid/transport/TestCommSockets.java
Log:
TEIID-785 TEIID-509 adding back the notion of a process info log and addressing embedded usage concerns
Modified: trunk/build/kit-runtime/deploy/log4j.xml
===================================================================
--- trunk/build/kit-runtime/deploy/log4j.xml 2009-08-13 22:41:24 UTC (rev 1243)
+++ trunk/build/kit-runtime/deploy/log4j.xml 2009-08-15 03:23:38 UTC (rev 1244)
@@ -7,7 +7,7 @@
</appender>
<appender name="FILE" class="org.apache.log4j.RollingFileAppender">
- <param name="File" value="${dqp.log4jFile}"/>
+ <param name="File" value="log/teiid.log"/>
<param name="MaxFileSize" value="1000KB"/>
<param name="MaxBackupIndex" value="25"/>
@@ -48,7 +48,7 @@
<!-- un-comment to enable COMMAND log
<appender name="COMMAND" class="org.apache.log4j.RollingFileAppender">
- <param name="File" value="log/command.log"/>
+ <param name="File" value="log/command.log"/>
<param name="MaxFileSize" value="1000KB"/>
<param name="MaxBackupIndex" value="25"/>
<layout class="org.apache.log4j.PatternLayout">
@@ -64,7 +64,7 @@
<!-- Un-comment to enable AUDIT log
<appender name="AUDIT" class="org.apache.log4j.RollingFileAppender">
- <param name="File" value="log/audit.log"/>
+ <param name="File" value="log/audit.log"/>
<param name="MaxFileSize" value="1000KB"/>
<param name="MaxBackupIndex" value="25"/>
<layout class="org.apache.log4j.PatternLayout">
@@ -77,7 +77,23 @@
<appender-ref ref="AUDIT"/>
</category>
-->
+
+ <!-- Un-comment to enable Process Info log
+ <appender name="PROCESS_INFO" class="org.apache.log4j.RollingFileAppender">
+ <param name="File" value="log/process_info.log"/>
+ <param name="MaxFileSize" value="1000KB"/>
+ <param name="MaxBackupIndex" value="25"/>
+ <layout class="org.apache.log4j.PatternLayout">
+ <param name="ConversionPattern" value="%d %p [%t] %c - %m%n"/>
+ </layout>
+ </appender>
+ <category name="org.teiid.PROCESS_INFO_LOG">
+ <priority value="INFO"/>
+ <appender-ref ref="PROCESS_INFO"/>
+ </category>
+ -->
+
<root>
<appender-ref ref="ASYNC"/>
</root>
Modified: trunk/client/src/main/java/com/metamatrix/common/comm/api/ServerConnectionFactory.java
===================================================================
--- trunk/client/src/main/java/com/metamatrix/common/comm/api/ServerConnectionFactory.java 2009-08-13 22:41:24 UTC (rev 1243)
+++ trunk/client/src/main/java/com/metamatrix/common/comm/api/ServerConnectionFactory.java 2009-08-15 03:23:38 UTC (rev 1244)
@@ -26,9 +26,12 @@
import com.metamatrix.common.comm.exception.CommunicationException;
import com.metamatrix.common.comm.exception.ConnectionException;
+import com.metamatrix.core.MetaMatrixCoreException;
public interface ServerConnectionFactory {
+ void initialize(Properties info) throws MetaMatrixCoreException;
+
/**
* Establish a connection to the server.
* @param connProps The properties used by the transport to find a connection. These
Modified: trunk/client/src/main/java/com/metamatrix/common/comm/platform/socket/client/SocketServerConnectionFactory.java
===================================================================
--- trunk/client/src/main/java/com/metamatrix/common/comm/platform/socket/client/SocketServerConnectionFactory.java 2009-08-13 22:41:24 UTC (rev 1243)
+++ trunk/client/src/main/java/com/metamatrix/common/comm/platform/socket/client/SocketServerConnectionFactory.java 2009-08-15 03:23:38 UTC (rev 1244)
@@ -170,7 +170,7 @@
}
}
}
- INSTANCE.init(props);
+ INSTANCE.initialize(props);
}
return INSTANCE;
}
@@ -178,11 +178,12 @@
public SocketServerConnectionFactory() {
}
-
- public void init(final Properties props) {
- PropertiesUtils.setBeanProperties(this, props, "org.teiid.sockets"); //$NON-NLS-1$
+
+ @Override
+ public void initialize(Properties info) {
+ PropertiesUtils.setBeanProperties(this, info, "org.teiid.sockets"); //$NON-NLS-1$
this.pingTimer = new Timer("SocketPing", true); //$NON-NLS-1$
- this.channelFactory = new OioOjbectChannelFactory(props);
+ this.channelFactory = new OioOjbectChannelFactory(info);
}
public SocketServerInstance getServerInstance(HostInfo info, boolean ssl) throws CommunicationException, IOException {
Modified: trunk/client-jdbc/src/main/java/org/teiid/jdbc/EmbeddedProfile.java
===================================================================
--- trunk/client-jdbc/src/main/java/org/teiid/jdbc/EmbeddedProfile.java 2009-08-13 22:41:24 UTC (rev 1243)
+++ trunk/client-jdbc/src/main/java/org/teiid/jdbc/EmbeddedProfile.java 2009-08-15 03:23:38 UTC (rev 1244)
@@ -55,6 +55,8 @@
import com.metamatrix.common.protocol.MetaMatrixURLStreamHandlerFactory;
import com.metamatrix.common.protocol.URLHelper;
import com.metamatrix.common.util.PropertiesUtils;
+import com.metamatrix.core.MetaMatrixCoreException;
+import com.metamatrix.core.util.ReflectionHelper;
import com.metamatrix.dqp.embedded.DQPEmbeddedProperties;
import com.metamatrix.jdbc.BaseDataSource;
import com.metamatrix.jdbc.JDBCPlugin;
@@ -141,9 +143,9 @@
}
// now create the connection
- EmbeddedTransport transport = getDQPTransport(dqpURL, info);
+ EmbeddedTransport transport = getDQPTransport(dqpURL);
- MMConnection conn = transport.createConnection(dqpURL, info);
+ MMConnection conn = transport.createConnection(info);
return conn;
}
@@ -156,13 +158,13 @@
* @throws SQLException
* @since 4.4
*/
- private synchronized static EmbeddedTransport getDQPTransport(URL dqpURL, Properties info) throws SQLException {
+ private synchronized static EmbeddedTransport getDQPTransport(URL dqpURL) throws SQLException {
EmbeddedTransport transport = currentTransport;
if (transport == null || !currentTransport.getURL().equals(dqpURL)) {
// shutdown any previous instance; we do encourage single instance in a given VM
shutdown();
try {
- transport = new EmbeddedTransport(dqpURL, info);
+ transport = new EmbeddedTransport(dqpURL);
} catch (SQLException e) {
logger.log(Level.SEVERE, "Could not start the embedded engine", e); //$NON-NLS-1$
throw e;
@@ -290,21 +292,18 @@
private ServerConnectionFactory connectionFactory;
private ClassLoader classLoader;
private URL url;
- Properties props;
- public EmbeddedTransport(URL dqpURL, Properties info) throws SQLException {
-
+ public EmbeddedTransport(URL dqpURL) throws SQLException {
this.url = dqpURL;
//Load the properties from dqp.properties file
- this.props = loadDQPProperties(dqpURL);
- this.props.putAll(info);
+ Properties props = loadDQPProperties(dqpURL);
- this.props = PropertiesUtils.resolveNestedProperties(this.props);
+ props = PropertiesUtils.resolveNestedProperties(props);
// a non-delegating class loader will be created from where all third party dependent jars can be loaded
ArrayList<URL> runtimeClasspathList = new ArrayList<URL>();
- String libLocation = this.props.getProperty(DQPEmbeddedProperties.DQP_LIBDIR, "./lib/"); //$NON-NLS-1$
+ String libLocation = props.getProperty(DQPEmbeddedProperties.DQP_LIBDIR, "./lib/"); //$NON-NLS-1$
if (!libLocation.endsWith("/")) { //$NON-NLS-1$
libLocation = libLocation + "/"; //$NON-NLS-1$
}
@@ -315,7 +314,7 @@
runtimeClasspathList.addAll(libClassPath(dqpURL, libLocation, MMURLConnection.DATE));
try {
- String configLocation = this.props.getProperty(DQPEmbeddedProperties.DQP_DEPLOYDIR, "./deploy/"); //$NON-NLS-1$
+ String configLocation = props.getProperty(DQPEmbeddedProperties.DQP_DEPLOYDIR, "./deploy/"); //$NON-NLS-1$
if (!configLocation.endsWith("/")) { //$NON-NLS-1$
configLocation = configLocation + "/"; //$NON-NLS-1$
}
@@ -331,15 +330,23 @@
String logMsg = getResourceMessage("EmbeddedDriver.use_classpath"); //$NON-NLS-1$
logger.log(Level.FINER, logMsg + " " + Arrays.toString(dqpClassPath)); //$NON-NLS-1$
+ props.setProperty(DQPEmbeddedProperties.BOOTURL, url.toExternalForm());
+ props.setProperty(DQPEmbeddedProperties.TEIID_HOME, getHomeDirectory(props));
// Now using this class loader create the connection factory to the dqp.
ClassLoader current = Thread.currentThread().getContextClassLoader();
try {
Thread.currentThread().setContextClassLoader(this.classLoader);
String className = "com.metamatrix.jdbc.EmbeddedConnectionFactoryImpl"; //$NON-NLS-1$
- Class<?> clazz = this.classLoader.loadClass(className);
- this.connectionFactory = (ServerConnectionFactory)clazz.newInstance();
- } catch (Exception e) {
- throw MMSQLException.create(e, "Could not load the embedded server, please ensure that your classpath is set correctly."); //$NON-NLS-1$
+ try {
+ this.connectionFactory = (ServerConnectionFactory)ReflectionHelper.create(className, null, this.classLoader);
+ } catch (MetaMatrixCoreException e) {
+ throw MMSQLException.create(e, "Could not load the embedded server, please ensure that your classpath is set correctly."); //$NON-NLS-1$
+ }
+ try {
+ this.connectionFactory.initialize(props);
+ } catch (MetaMatrixCoreException e) {
+ throw MMSQLException.create(e);
+ }
} finally {
Thread.currentThread().setContextClassLoader(current);
}
@@ -416,14 +423,12 @@
* @param info
* @return Connection
*/
- MMConnection createConnection(URL url, Properties info) throws SQLException {
+ MMConnection createConnection(Properties info) throws SQLException {
ClassLoader current = null;
try {
current = Thread.currentThread().getContextClassLoader();
Thread.currentThread().setContextClassLoader(classLoader);
try {
- info.setProperty(DQPEmbeddedProperties.BOOTURL, url.toExternalForm());
- info.setProperty(DQPEmbeddedProperties.TEIID_HOME, getHomeDirectory(url));
ServerConnection conn = connectionFactory.createConnection(info);
return new MMConnection(conn, info, url.toExternalForm());
} catch (CommunicationException e) {
@@ -436,15 +441,9 @@
}
}
- String getHomeDirectory(URL url) throws SQLException {
+ String getHomeDirectory(Properties props) throws SQLException {
try {
- // check the system wide
- String teiidHome = System.getProperty(DQPEmbeddedProperties.TEIID_HOME);
-
- // then check the deploy.properties
- if (teiidHome == null) {
- teiidHome = this.props.getProperty(DQPEmbeddedProperties.TEIID_HOME);
- }
+ String teiidHome = props.getProperty(DQPEmbeddedProperties.TEIID_HOME);
if (teiidHome == null) {
if (EmbeddedProfile.getDefaultConnectionURL().equals(url.toString())) {
Modified: trunk/engine/src/main/java/com/metamatrix/dqp/util/LogConstants.java
===================================================================
--- trunk/engine/src/main/java/com/metamatrix/dqp/util/LogConstants.java 2009-08-13 22:41:24 UTC (rev 1243)
+++ trunk/engine/src/main/java/com/metamatrix/dqp/util/LogConstants.java 2009-08-15 03:23:38 UTC (rev 1244)
@@ -32,6 +32,7 @@
public static final String CTX_EXTENSION_SOURCE = "EXTENSION_MODULE"; //$NON-NLS-1$
public static final String CTX_COMMANDLOGGING = "COMMAND_LOG"; //$NON-NLS-1$
public static final String CTX_AUDITLOGGING = "AUDIT_LOG"; //$NON-NLS-1$
+ public static final String CTX_PROCESS_INFO_LOG = "PROCESS_INFO_LOG"; //$NON-NLS-1$
public static final String CTX_ADMIN_API = "ADMIN_API"; //$NON-NLS-1$
public static final String CTX_QUERY_SERVICE = "QUERY_SERVICE"; //$NON-NLS-1$
}
Modified: trunk/runtime/src/main/java/com/metamatrix/dqp/embedded/services/EmbeddedConfigurationService.java
===================================================================
--- trunk/runtime/src/main/java/com/metamatrix/dqp/embedded/services/EmbeddedConfigurationService.java 2009-08-13 22:41:24 UTC (rev 1243)
+++ trunk/runtime/src/main/java/com/metamatrix/dqp/embedded/services/EmbeddedConfigurationService.java 2009-08-15 03:23:38 UTC (rev 1244)
@@ -53,7 +53,6 @@
import com.metamatrix.common.config.model.BasicConnectorBinding;
import com.metamatrix.common.log.LogManager;
import com.metamatrix.common.protocol.URLHelper;
-import com.metamatrix.common.util.PropertiesUtils;
import com.metamatrix.common.vdb.api.ModelInfo;
import com.metamatrix.common.vdb.api.VDBArchive;
import com.metamatrix.common.vdb.api.VDBDefn;
Modified: trunk/runtime/src/main/java/com/metamatrix/jdbc/EmbeddedConnectionFactoryImpl.java
===================================================================
--- trunk/runtime/src/main/java/com/metamatrix/jdbc/EmbeddedConnectionFactoryImpl.java 2009-08-13 22:41:24 UTC (rev 1243)
+++ trunk/runtime/src/main/java/com/metamatrix/jdbc/EmbeddedConnectionFactoryImpl.java 2009-08-15 03:23:38 UTC (rev 1244)
@@ -22,7 +22,7 @@
package com.metamatrix.jdbc;
-import static org.teiid.dqp.internal.process.Util.convertStats;
+import static org.teiid.dqp.internal.process.Util.*;
import java.io.File;
import java.io.IOException;
@@ -31,6 +31,7 @@
import java.lang.reflect.Proxy;
import java.net.InetAddress;
import java.net.URL;
+import java.net.UnknownHostException;
import java.util.Date;
import java.util.Properties;
@@ -58,7 +59,9 @@
import com.metamatrix.common.protocol.URLHelper;
import com.metamatrix.common.queue.WorkerPoolStats;
import com.metamatrix.common.util.JMXUtil;
+import com.metamatrix.common.util.NetUtils;
import com.metamatrix.common.util.PropertiesUtils;
+import com.metamatrix.core.MetaMatrixCoreException;
import com.metamatrix.core.MetaMatrixRuntimeException;
import com.metamatrix.core.util.MixinProxy;
import com.metamatrix.dqp.ResourceFinder;
@@ -89,21 +92,15 @@
private Thread shutdownThread;
private ClientServiceRegistry clientServices;
private String workspaceDirectory;
- private boolean init = false;
private SocketTransport socketTransport;
private JMXUtil jmxServer;
private boolean restart = false;
+ private InetAddress address;
@Override
public ServerConnection createConnection(Properties connectionProperties) throws CommunicationException, ConnectionException {
- try {
- initialize(connectionProperties);
- return new LocalServerConnection(connectionProperties, this.clientServices);
- } catch (ApplicationInitializationException e) {
- throw new ConnectionException(e, e.getMessage());
- }
+ return new LocalServerConnection(connectionProperties, this.clientServices);
}
-
/**
* When the DQP is restarted using the admin API, it only shuts it down, it gets
@@ -114,26 +111,13 @@
* @throws ApplicationInitializationException
* @since 4.3
*/
- public synchronized void initialize(Properties info) throws ApplicationInitializationException {
- if (this.init) {
- return;
- }
+ public void initialize(Properties props) throws MetaMatrixCoreException {
+ URL bootstrapURL = URLHelper.buildURL(props.getProperty(DQPEmbeddedProperties.BOOTURL));
+ String processName = props.getProperty(DQPEmbeddedProperties.PROCESSNAME, "embedded"); //$NON-NLS-1$
- URL bootstrapURL = null;
- Properties props = new Properties(System.getProperties());
- String processName = "embedded"; //$NON-NLS-1$
-
try {
- bootstrapURL = URLHelper.buildURL(info.getProperty(DQPEmbeddedProperties.BOOTURL));
- props.putAll(PropertiesUtils.loadFromURL(bootstrapURL));
- props.putAll(info);
- props = PropertiesUtils.resolveNestedProperties(props);
-
- processName = props.getProperty(DQPEmbeddedProperties.PROCESSNAME, processName);
- props.setProperty(DQPEmbeddedProperties.PROCESSNAME, processName);
-
// Create a temporary workspace directory
- String teiidHome = info.getProperty(DQPEmbeddedProperties.TEIID_HOME);
+ String teiidHome = props.getProperty(DQPEmbeddedProperties.TEIID_HOME);
this.workspaceDirectory = createWorkspace(teiidHome, props.getProperty(DQPEmbeddedProperties.DQP_WORKDIR, "work"), processName); //$NON-NLS-1$
props.setProperty(DQPEmbeddedProperties.DQP_WORKDIR, this.workspaceDirectory);
@@ -158,8 +142,9 @@
}
this.jmxServer = new JMXUtil(processName);
-
- EmbeddedGuiceModule config = new EmbeddedGuiceModule(bootstrapURL, props, this.jmxServer);
+ address = resolveHostAddress(props.getProperty(DQPEmbeddedProperties.BIND_ADDRESS));
+
+ EmbeddedGuiceModule config = new EmbeddedGuiceModule(bootstrapURL, props, this.jmxServer, address);
Injector injector = Guice.createInjector(config);
ResourceFinder.setInjector(injector);
config.setInjector(injector);
@@ -182,16 +167,30 @@
boolean enableSocketTransport = PropertiesUtils.getBooleanProperty(props, DQPEmbeddedProperties.ENABLE_SOCKETS, false);
if (enableSocketTransport) {
this.socketTransport = new SocketTransport(props, this.clientServices, (SessionServiceInterface)findService(DQPServiceNames.SESSION_SERVICE));
- this.socketTransport.start();
+ this.socketTransport.start(address);
}
this.shutdownThread = new ShutdownWork();
Runtime.getRuntime().addShutdownHook(this.shutdownThread);
this.starttime = System.currentTimeMillis();
- this.init = true;
DQPEmbeddedPlugin.logInfo("DQPEmbeddedManager.start_dqp", new Object[] {new Date(System.currentTimeMillis()).toString()}); //$NON-NLS-1$
}
+
+ public InetAddress getAddress() {
+ return address;
+ }
+
+ private InetAddress resolveHostAddress(String bindAddress) {
+ try {
+ if (bindAddress == null) {
+ return NetUtils.getInstance().getInetAddress();
+ }
+ return NetUtils.resolveHostByName(bindAddress);
+ } catch (UnknownHostException e) {
+ throw new MetaMatrixRuntimeException("Failed to resolve the bind address"); //$NON-NLS-1$
+ }
+ }
private ClientServiceRegistry createClientServices(ConfigurationService configService) {
ClientServiceRegistry services = new ClientServiceRegistry();
@@ -339,8 +338,6 @@
// shutdown the cache.
ResourceFinder.getCacheFactory().destroy();
- this.init = false;
-
this.restart = restart;
}
Modified: trunk/runtime/src/main/java/com/metamatrix/jdbc/EmbeddedGuiceModule.java
===================================================================
--- trunk/runtime/src/main/java/com/metamatrix/jdbc/EmbeddedGuiceModule.java 2009-08-13 22:41:24 UTC (rev 1243)
+++ trunk/runtime/src/main/java/com/metamatrix/jdbc/EmbeddedGuiceModule.java 2009-08-15 03:23:38 UTC (rev 1244)
@@ -24,7 +24,6 @@
import java.net.InetAddress;
import java.net.URL;
-import java.net.UnknownHostException;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
@@ -46,7 +45,6 @@
import com.metamatrix.common.log.LogConfiguration;
import com.metamatrix.common.log.LogManager;
import com.metamatrix.common.util.JMXUtil;
-import com.metamatrix.common.util.NetUtils;
import com.metamatrix.common.util.PropertiesUtils;
import com.metamatrix.core.MetaMatrixRuntimeException;
import com.metamatrix.core.log.LogListener;
@@ -70,12 +68,14 @@
private Properties props;
private URL bootstrapURL;
private JMXUtil jmx;
+ private InetAddress bindAddress;
Injector injector;
- public EmbeddedGuiceModule(URL bootstrapURL, Properties props, JMXUtil jmxUtil) {
+ public EmbeddedGuiceModule(URL bootstrapURL, Properties props, JMXUtil jmxUtil, InetAddress bindAddress) {
this.bootstrapURL = bootstrapURL;
this.props = props;
this.jmx = jmxUtil;
+ this.bindAddress = bindAddress;
}
@Override
@@ -87,9 +87,7 @@
bind(Properties.class).annotatedWith(Names.named("DQPProperties")).toInstance(this.props); //$NON-NLS-1$
bind(JMXUtil.class).annotatedWith(Names.named("jmx")).toInstance(this.jmx); //$NON-NLS-1$
- InetAddress address = resolveHostAddress(props.getProperty(DQPEmbeddedProperties.BIND_ADDRESS));
- bind(InetAddress.class).annotatedWith(Names.named(DQPEmbeddedProperties.HOST_ADDRESS)).toInstance(address);
- this.props.put(DQPEmbeddedProperties.HOST_ADDRESS, address);
+ bind(InetAddress.class).annotatedWith(Names.named(DQPEmbeddedProperties.HOST_ADDRESS)).toInstance(bindAddress);
bind(Cache.class).toProvider(CacheProvider.class).in(Scopes.SINGLETON);
bind(CacheFactory.class).to(JBossCacheFactory.class).in(Scopes.SINGLETON);
@@ -103,18 +101,7 @@
// this needs to be removed.
binder().requestStaticInjection(LogManager.class);
}
-
- private InetAddress resolveHostAddress(String bindAddress) {
- try {
- if (bindAddress == null) {
- return NetUtils.getInstance().getInetAddress();
- }
- return NetUtils.resolveHostByName(bindAddress);
- } catch (UnknownHostException e) {
- throw new MetaMatrixRuntimeException("Failed to resolve the bind address"); //$NON-NLS-1$
- }
- }
-
+
private void configureServices() {
Map<String, Class<? extends ApplicationService>> defaults = getDefaultServiceClasses();
for(int i=0; i<DQPServiceNames.ALL_SERVICES.length; i++) {
Modified: trunk/runtime/src/main/java/com/metamatrix/jdbc/Log4JUtil.java
===================================================================
--- trunk/runtime/src/main/java/com/metamatrix/jdbc/Log4JUtil.java 2009-08-13 22:41:24 UTC (rev 1243)
+++ trunk/runtime/src/main/java/com/metamatrix/jdbc/Log4JUtil.java 2009-08-15 03:23:38 UTC (rev 1244)
@@ -106,6 +106,7 @@
contexts.add(ROOT_CONTEXT+com.metamatrix.dqp.util.LogConstants.CTX_COMMANDLOGGING);
contexts.add(ROOT_CONTEXT+com.metamatrix.dqp.util.LogConstants.CTX_AUDITLOGGING);
contexts.add(ROOT_CONTEXT+com.metamatrix.dqp.util.LogConstants.CTX_QUERY_SERVICE);
+ contexts.add(ROOT_CONTEXT+com.metamatrix.dqp.util.LogConstants.CTX_PROCESS_INFO_LOG);
contexts.add(ROOT_CONTEXT+com.metamatrix.common.util.LogConstants.CTX_CONFIG);
contexts.add(ROOT_CONTEXT+com.metamatrix.common.util.LogConstants.CTX_COMMUNICATION);
Modified: trunk/runtime/src/main/java/com/metamatrix/jdbc/LogListernerProvider.java
===================================================================
--- trunk/runtime/src/main/java/com/metamatrix/jdbc/LogListernerProvider.java 2009-08-13 22:41:24 UTC (rev 1243)
+++ trunk/runtime/src/main/java/com/metamatrix/jdbc/LogListernerProvider.java 2009-08-15 03:23:38 UTC (rev 1244)
@@ -22,7 +22,6 @@
package com.metamatrix.jdbc;
-import java.io.File;
import java.util.Properties;
import org.apache.log4j.Logger;
@@ -32,7 +31,6 @@
import com.google.inject.Singleton;
import com.google.inject.name.Named;
import com.metamatrix.core.log.LogListener;
-import com.metamatrix.dqp.embedded.DQPEmbeddedProperties;
@Singleton
class LogListernerProvider implements Provider<LogListener> {
@@ -42,11 +40,6 @@
@Override
public LogListener get() {
- String logDirectory = this.props.getProperty(DQPEmbeddedProperties.DQP_LOGDIR);
- String processName = this.props.getProperty(DQPEmbeddedProperties.PROCESSNAME);
-
- File logFile = new File(logDirectory, "teiid_"+processName+".log"); //$NON-NLS-1$ //$NON-NLS-2$
- System.setProperty("dqp.log4jFile", logFile.getAbsolutePath()); //$NON-NLS-1$ // hack
return new Log4jListener();
}
Modified: trunk/runtime/src/main/java/org/teiid/Server.java
===================================================================
--- trunk/runtime/src/main/java/org/teiid/Server.java 2009-08-13 22:41:24 UTC (rev 1243)
+++ trunk/runtime/src/main/java/org/teiid/Server.java 2009-08-15 03:23:38 UTC (rev 1244)
@@ -27,13 +27,26 @@
import java.io.IOException;
import java.io.RandomAccessFile;
import java.nio.channels.FileChannel;
+import java.util.Iterator;
import java.util.Properties;
+import java.util.jar.Attributes;
+import java.util.jar.Manifest;
-import com.metamatrix.common.application.exception.ApplicationInitializationException;
+import com.metamatrix.common.config.api.ExtensionModule;
+import com.metamatrix.common.log.LogManager;
+import com.metamatrix.common.util.ApplicationInfo;
+import com.metamatrix.common.util.PropertiesUtils;
import com.metamatrix.common.util.JMXUtil.FailedToRegisterException;
+import com.metamatrix.core.MetaMatrixCoreException;
import com.metamatrix.core.MetaMatrixRuntimeException;
+import com.metamatrix.core.log.MessageLevel;
+import com.metamatrix.core.util.FileUtils;
+import com.metamatrix.core.util.ZipFileUtil;
import com.metamatrix.dqp.embedded.DQPEmbeddedPlugin;
import com.metamatrix.dqp.embedded.DQPEmbeddedProperties;
+import com.metamatrix.dqp.embedded.services.EmbeddedConfigurationService;
+import com.metamatrix.dqp.service.DQPServiceNames;
+import com.metamatrix.dqp.util.LogConstants;
import com.metamatrix.jdbc.EmbeddedConnectionFactoryImpl;
public class Server extends EmbeddedConnectionFactoryImpl implements ServerMBean {
@@ -50,11 +63,11 @@
initialize(this.props);
getJMXServer().register(TYPE, NAME, this);
-
- } catch (ApplicationInitializationException e) {
- throw new MetaMatrixRuntimeException(e);
+
} catch (FailedToRegisterException e) {
throw new MetaMatrixRuntimeException(e.getCause());
+ } catch (MetaMatrixCoreException e) {
+ throw new MetaMatrixRuntimeException(e);
}
}
@@ -85,7 +98,6 @@
}
return true;
}
-
private static Properties loadConfiguration(String configFile) {
File f = new File (configFile);
@@ -97,13 +109,14 @@
Properties props = null;
try {
FileReader bootProperties = new FileReader(f);
- props = new Properties();
+ props = new Properties(System.getProperties());
props.load(bootProperties);
// enable socket communication by default.
props.setProperty(DQPEmbeddedProperties.ENABLE_SOCKETS, Boolean.TRUE.toString());
props.setProperty(DQPEmbeddedProperties.BOOTURL, f.getCanonicalPath());
props.setProperty(DQPEmbeddedProperties.TEIID_HOME, System.getProperty(DQPEmbeddedProperties.TEIID_HOME,f.getParentFile().getCanonicalPath()));
+ props = PropertiesUtils.resolveNestedProperties(props);
} catch (IOException e) {
System.out.println("Failed to load bootstrap properties file."); //$NON-NLS-1$
e.printStackTrace();
@@ -173,6 +186,10 @@
System.out.println("Teiid Server started on port = "+ port + " in "+time/1000+" Secs"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ if (LogManager.isMessageToBeRecorded(LogConstants.CTX_PROCESS_INFO_LOG, MessageLevel.INFO)) {
+ s.logProcessInfo();
+ }
+
// wait.
while(s.isAlive()) {
try {
@@ -192,4 +209,79 @@
System.exit(10);
}
}
+
+ public void logProcessInfo() {
+ ApplicationInfo info = ApplicationInfo.getInstance();
+ StringBuffer sb = new StringBuffer("Process Information"); //$NON-NLS-1$
+
+ sb.append('\n');
+ sb.append(" Process Name: " + props.getProperty(DQPEmbeddedProperties.PROCESSNAME) ); //$NON-NLS-1$
+ sb.append('\n');
+ sb.append(" Hostname: " + getAddress().getCanonicalHostName() ); //$NON-NLS-1$
+ sb.append('\n');
+ sb.append(" Version: ").append(ApplicationInfo.getInstance().getReleaseNumber()); //$NON-NLS-1$
+ sb.append('\n');
+ sb.append(" Build Date: ").append(ApplicationInfo.getInstance().getBuildDate()); //$NON-NLS-1$
+
+ sb.append("\n---- System Properties ----\n"); //$NON-NLS-1$
+ sb.append(PropertiesUtils.prettyPrint(System.getProperties()));
+
+ sb.append("\n---- Deploy Properties ----\n"); //$NON-NLS-1$
+ sb.append(PropertiesUtils.prettyPrint(props));
+
+ sb.append("\n# of Processors: " + java.lang.Runtime.getRuntime().availableProcessors());//$NON-NLS-1$
+ sb.append("\nMax Avail memory: " + java.lang.Runtime.getRuntime().maxMemory());//$NON-NLS-1$
+ sb.append("\nFree memory: " + java.lang.Runtime.getRuntime().freeMemory());//$NON-NLS-1$
+
+ sb.append(info.getClasspathInfo());
+
+ sb.append("\n\n---- Extension Jars Manifest Info ----\n"); //$NON-NLS-1$
+
+ logManifestInfoForExtensionModules(sb);
+
+ LogManager.logInfo(LogConstants.CTX_PROCESS_INFO_LOG, sb.toString());
+ }
+
+ private void logManifestInfoForExtensionModules(StringBuffer sb) {
+ try {
+ EmbeddedConfigurationService ecs = (EmbeddedConfigurationService)getDQP().getEnvironment().findService(DQPServiceNames.CONFIGURATION_SERVICE);
+ for (ExtensionModule module : ecs.getExtensionModules()) {
+ sb.append("\n == Jar: " + module.getName() + " ===== " ); //$NON-NLS-1$ //$NON-NLS-2$
+
+ File tempArchive = File.createTempFile("teiid", ".jar"); //$NON-NLS-1$ //$NON-NLS-2$
+ tempArchive.deleteOnExit();
+ FileUtils.write(module.getFileContents(), tempArchive);
+
+ Manifest m = ZipFileUtil.getManifest(tempArchive);
+ tempArchive.delete();
+ if (m != null) {
+ // only print the manifest info for MetaMatrix related jars that have
+ // the product information section
+ Attributes manifestAttributes = m.getMainAttributes();
+ if(manifestAttributes == null || manifestAttributes.isEmpty()){
+ continue;
+
+ }
+
+ for (Iterator ita = manifestAttributes.keySet().iterator(); ita.hasNext();) {
+ Object n = ita.next();
+ Object v = manifestAttributes.get(n);
+
+ sb.append("\n");//$NON-NLS-1$
+ sb.append(" ");//$NON-NLS-1$
+ sb.append(n.toString());
+ sb.append(": "); //$NON-NLS-1$
+ sb.append(v.toString());
+
+ }
+ sb.append("\n");//$NON-NLS-1$
+
+ }
+ }
+ } catch(Exception e) {
+ sb.append("**** Error: Unable to list manifest - msg: " + e.getMessage());//$NON-NLS-1$
+ }
+
+ }
+
}
Modified: trunk/runtime/src/main/java/org/teiid/transport/SocketTransport.java
===================================================================
--- trunk/runtime/src/main/java/org/teiid/transport/SocketTransport.java 2009-08-13 22:41:24 UTC (rev 1243)
+++ trunk/runtime/src/main/java/org/teiid/transport/SocketTransport.java 2009-08-15 03:23:38 UTC (rev 1244)
@@ -27,6 +27,7 @@
import java.security.GeneralSecurityException;
import java.util.Properties;
+import com.google.inject.name.Named;
import com.metamatrix.common.comm.ClientServiceRegistry;
import com.metamatrix.common.log.LogManager;
import com.metamatrix.common.queue.WorkerPoolStats;
@@ -61,12 +62,12 @@
this.sessionSerice = sessionService;
}
- public void start() {
+ public void start((a)Named(DQPEmbeddedProperties.HOST_ADDRESS) InetAddress hostAddress) {
int socketPort = PropertiesUtils.getIntProperty(this.props, DQPEmbeddedProperties.SERVER_PORT, DEFAULT_SERVER_PORT);
int maxThreads = PropertiesUtils.getIntProperty(this.props, DQPEmbeddedProperties.MAX_THREADS, DEFAULT_MAX_THREADS);
int inputBufferSize = PropertiesUtils.getIntProperty(this.props, DQPEmbeddedProperties.INPUT_BUFFER_SIZE, DEFAULT_INPUT_BUFFER_SIZE);
int outputBufferSize = PropertiesUtils.getIntProperty(this.props, DQPEmbeddedProperties.OUTPUT_BUFFER_SIZE, DEFAULT_OUTPUT_BUFFER_SIZE);
- String bindAddress = ((InetAddress)props.get(DQPEmbeddedProperties.HOST_ADDRESS)).getHostAddress();
+ String bindAddress = hostAddress.getHostAddress();
try {
SSLConfiguration helper = new SSLConfiguration();
Modified: trunk/runtime/src/test/java/com/metamatrix/dqp/embedded/TestEmbeddedConfigSource.java
===================================================================
--- trunk/runtime/src/test/java/com/metamatrix/dqp/embedded/TestEmbeddedConfigSource.java 2009-08-13 22:41:24 UTC (rev 1243)
+++ trunk/runtime/src/test/java/com/metamatrix/dqp/embedded/TestEmbeddedConfigSource.java 2009-08-15 03:23:38 UTC (rev 1244)
@@ -22,6 +22,7 @@
package com.metamatrix.dqp.embedded;
+import java.net.InetAddress;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.Properties;
@@ -54,7 +55,7 @@
URL url = buildDQPUrl(UnitTestUtil.getTestDataPath() + "/bqt/fakebqt.properties"); //$NON-NLS-1$
p.load(url.openStream());
- EmbeddedGuiceModule source = new EmbeddedGuiceModule(url, p, new JMXUtil("test")); //$NON-NLS-1$
+ EmbeddedGuiceModule source = new EmbeddedGuiceModule(url, p, new JMXUtil("test"), InetAddress.getLocalHost() ); //$NON-NLS-1$
Injector injector = Guice.createInjector(source);
source.setInjector(injector);
Modified: trunk/runtime/src/test/java/org/teiid/transport/TestCommSockets.java
===================================================================
--- trunk/runtime/src/test/java/org/teiid/transport/TestCommSockets.java 2009-08-13 22:41:24 UTC (rev 1243)
+++ trunk/runtime/src/test/java/org/teiid/transport/TestCommSockets.java 2009-08-15 03:23:38 UTC (rev 1244)
@@ -164,7 +164,7 @@
p.setProperty(MMURL.CONNECTION.DISCOVERY_STRATEGY, UrlServerDiscovery.class.getName());
if (sscf == null) {
sscf = new SocketServerConnectionFactory();
- sscf.init(socketConfig);
+ sscf.initialize(socketConfig);
}
return sscf.createConnection(p);
}
14 years, 11 months
teiid SVN: r1243 - in trunk: common-internal/src/main/java/com/metamatrix/platform/security/api and 3 other directories.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2009-08-13 18:41:24 -0400 (Thu, 13 Aug 2009)
New Revision: 1243
Modified:
trunk/client/src/main/java/com/metamatrix/dqp/embedded/DQPEmbeddedProperties.java
trunk/common-internal/src/main/java/com/metamatrix/platform/security/api/AuthorizationPolicyFactory.java
trunk/engine/src/main/java/com/metamatrix/query/processor/xml/XMLPlan.java
trunk/engine/src/main/java/com/metamatrix/query/processor/xquery/XQueryPlan.java
trunk/runtime/src/main/java/com/metamatrix/dqp/embedded/services/EmbeddedBufferService.java
Log:
TEIID-767 removing extra tuplesource creation calls
Modified: trunk/client/src/main/java/com/metamatrix/dqp/embedded/DQPEmbeddedProperties.java
===================================================================
--- trunk/client/src/main/java/com/metamatrix/dqp/embedded/DQPEmbeddedProperties.java 2009-08-13 19:08:38 UTC (rev 1242)
+++ trunk/client/src/main/java/com/metamatrix/dqp/embedded/DQPEmbeddedProperties.java 2009-08-13 22:41:24 UTC (rev 1243)
@@ -68,7 +68,7 @@
/**
* Determines amount of memory to use in-memory before buffering to
* disk. This property is not used if DQP_BUFFER_USEDISK = true. The
- * value is in megabytes. Default value is 32.
+ * value is in megabytes. Default value is 64.
*/
public static final String DQP_BUFFER_MEMORY = BUFFER_PREFIX + ".memory"; //$NON-NLS-1$
Modified: trunk/common-internal/src/main/java/com/metamatrix/platform/security/api/AuthorizationPolicyFactory.java
===================================================================
--- trunk/common-internal/src/main/java/com/metamatrix/platform/security/api/AuthorizationPolicyFactory.java 2009-08-13 19:08:38 UTC (rev 1242)
+++ trunk/common-internal/src/main/java/com/metamatrix/platform/security/api/AuthorizationPolicyFactory.java 2009-08-13 22:41:24 UTC (rev 1243)
@@ -49,7 +49,6 @@
import com.metamatrix.common.log.LogManager;
import com.metamatrix.common.util.LogConstants;
-import com.metamatrix.platform.security.util.RolePermissionFactory;
/**
* The class build the Policies from the xml file or converts the policies to xml file for importing and exporting of the policy
Modified: trunk/engine/src/main/java/com/metamatrix/query/processor/xml/XMLPlan.java
===================================================================
--- trunk/engine/src/main/java/com/metamatrix/query/processor/xml/XMLPlan.java 2009-08-13 19:08:38 UTC (rev 1242)
+++ trunk/engine/src/main/java/com/metamatrix/query/processor/xml/XMLPlan.java 2009-08-13 22:41:24 UTC (rev 1243)
@@ -66,7 +66,6 @@
import com.metamatrix.common.buffer.BufferManager;
import com.metamatrix.common.buffer.TupleBatch;
import com.metamatrix.common.buffer.TupleSourceID;
-import com.metamatrix.common.buffer.TupleSourceNotFoundException;
import com.metamatrix.common.buffer.BufferManager.TupleSourceStatus;
import com.metamatrix.common.lob.LobChunk;
import com.metamatrix.common.log.LogManager;
@@ -107,11 +106,6 @@
private int nextBatchCount = 1;
- // this is tuple source id for the main batch of results, where multiple
- // xml documents are stored. This is different from the individual tuple source
- // id that each XML document is stored. This would be parent tuple source.
- TupleSourceID resultsTupleSourceId = null;
-
// is document in progress currently?
boolean docInProgress = false;
TupleSourceID docInProgressTupleSourceId = null;
@@ -175,9 +169,6 @@
}
public void open() throws MetaMatrixComponentException {
- if (this.resultsTupleSourceId == null) {
- this.resultsTupleSourceId = XMLUtil.createXMLTupleSource(bufferMgr, getContext().getConnectionID());
- }
}
/**
@@ -194,7 +185,6 @@
if (rows == null){
TupleBatch batch = new TupleBatch(nextBatchCount++, Collections.EMPTY_LIST);
batch.setTerminationFlag(true);
- addBatchToBufferManager(batch);
return batch;
}
@@ -205,23 +195,10 @@
TupleBatch batch = new TupleBatch(nextBatchCount++, listOfRows);
// when true; multiple doc return fails.
batch.setTerminationFlag(false);
- addBatchToBufferManager(batch);
return batch;
}
}
-
- void addBatchToBufferManager(TupleBatch batch) throws MetaMatrixComponentException {
- try {
- this.bufferMgr.addTupleBatch(this.resultsTupleSourceId, batch);
- if (batch.getTerminationFlag()) {
- this.bufferMgr.setStatus(this.resultsTupleSourceId, TupleSourceStatus.FULL);
- }
- } catch (TupleSourceNotFoundException e) {
- throw new MetaMatrixComponentException(e);
- }
- }
-
/**
* <p>Process the XML, using the stack of Programs supplied by the
* ProcessorEnvironment. With each pass through the loop, the
@@ -614,14 +591,6 @@
* @see com.metamatrix.query.processor.ProcessorPlan#close()
*/
public void close() throws MetaMatrixComponentException {
- if (this.resultsTupleSourceId != null) {
- try {
- this.bufferMgr.removeTupleSource(this.resultsTupleSourceId);
- } catch (TupleSourceNotFoundException e) {
- // ignore and go on, may be removed already.
- }
- this.resultsTupleSourceId = null;
- }
}
public String toString() {
Modified: trunk/engine/src/main/java/com/metamatrix/query/processor/xquery/XQueryPlan.java
===================================================================
--- trunk/engine/src/main/java/com/metamatrix/query/processor/xquery/XQueryPlan.java 2009-08-13 19:08:38 UTC (rev 1242)
+++ trunk/engine/src/main/java/com/metamatrix/query/processor/xquery/XQueryPlan.java 2009-08-13 22:41:24 UTC (rev 1243)
@@ -38,7 +38,6 @@
import com.metamatrix.common.buffer.TupleBatch;
import com.metamatrix.common.buffer.TupleSourceID;
import com.metamatrix.common.buffer.TupleSourceNotFoundException;
-import com.metamatrix.common.buffer.BufferManager.TupleSourceStatus;
import com.metamatrix.common.types.DataTypeManager;
import com.metamatrix.common.types.Streamable;
import com.metamatrix.common.types.XMLType;
@@ -64,7 +63,6 @@
private ProcessorDataManager dataManager;
private int chunkSize = Streamable.STREAMING_BATCH_SIZE_IN_BYTES;
- private TupleSourceID resultsTupleSourceId;
/**
* Constructor
@@ -113,10 +111,6 @@
* @see com.metamatrix.query.processor.ProcessorPlan#open()
*/
public void open() throws MetaMatrixComponentException {
- // no plans to open, processing is done in Xquery engine
- if (this.resultsTupleSourceId == null) {
- this.resultsTupleSourceId = XMLUtil.createXMLTupleSource(bufferMgr, getContext().getConnectionID());
- }
}
/**
@@ -175,10 +169,6 @@
rows.add(row);
TupleBatch batch = new TupleBatch(1, rows);
batch.setTerminationFlag(true);
-
- // add the top to buffer and return the batch.
- this.bufferMgr.addTupleBatch(this.resultsTupleSourceId, batch);
- this.bufferMgr.setStatus(this.resultsTupleSourceId, TupleSourceStatus.FULL);
return batch;
} catch (TupleSourceNotFoundException e) {
throw new MetaMatrixComponentException(e);
@@ -190,14 +180,6 @@
* @see com.metamatrix.query.processor.ProcessorPlan#close()
*/
public void close() throws MetaMatrixComponentException {
- if (this.resultsTupleSourceId != null) {
- try {
- this.bufferMgr.removeTupleSource(this.resultsTupleSourceId);
- } catch (TupleSourceNotFoundException e) {
- // ignore and go on, may be removed already.
- }
- this.resultsTupleSourceId = null;
- }
}
/**
Modified: trunk/runtime/src/main/java/com/metamatrix/dqp/embedded/services/EmbeddedBufferService.java
===================================================================
--- trunk/runtime/src/main/java/com/metamatrix/dqp/embedded/services/EmbeddedBufferService.java 2009-08-13 19:08:38 UTC (rev 1242)
+++ trunk/runtime/src/main/java/com/metamatrix/dqp/embedded/services/EmbeddedBufferService.java 2009-08-13 22:41:24 UTC (rev 1243)
@@ -51,7 +51,7 @@
public class EmbeddedBufferService extends EmbeddedBaseDQPService implements BufferService {
// Constants
- private static final String DEFAULT_MANAGEMENT_INTERVAL = "0"; //$NON-NLS-1$
+ private static final String DEFAULT_MANAGEMENT_INTERVAL = "500"; //$NON-NLS-1$
private static final String DEFAULT_LOG_STATS_INTERVAL = DEFAULT_MANAGEMENT_INTERVAL;
private static final String DEFAULT_SESSION_USE_PERCENTAGE = "100"; //$NON-NLS-1$
private static final String DEFAULT_MAX_OPEN_FILES = "10"; //$NON-NLS-1$
14 years, 11 months