teiid SVN: r2915 - in trunk/engine/src: test/java/org/teiid/query/processor and 1 other directory.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2011-02-17 12:32:44 -0500 (Thu, 17 Feb 2011)
New Revision: 2915
Modified:
trunk/engine/src/main/java/org/teiid/query/processor/relational/TextTableNode.java
trunk/engine/src/test/java/org/teiid/query/processor/TestTextTable.java
Log:
TEIID-1475 added checks to ensure that we do pull the file into memory on invalid input
Modified: trunk/engine/src/main/java/org/teiid/query/processor/relational/TextTableNode.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/processor/relational/TextTableNode.java 2011-02-17 15:12:44 UTC (rev 2914)
+++ trunk/engine/src/main/java/org/teiid/query/processor/relational/TextTableNode.java 2011-02-17 17:32:44 UTC (rev 2915)
@@ -51,8 +51,7 @@
/**
* Handles text file processing.
*
- * TODO: unix style escape handling \t \n, etc.
- * TODO: parse using something more memory safe than strings
+ * TODO: unix style escape handling \t \n, etc. - see also the unescape function
* TODO: allow for escaping with fixed parsing
* TODO: allow for fixed parsing without new lines
* TODO: allow for a configurable line terminator
@@ -75,6 +74,9 @@
private int textLine = 0;
private Map<String, Integer> nameIndexes;
private String systemId;
+
+ private boolean cr;
+ private boolean eof;
public TextTableNode(int nodeID) {
super(nodeID);
@@ -110,6 +112,7 @@
noQuote = table.isEscape();
quote = table.getQuote();
}
+ lineWidth = table.getColumns().size() * DataTypeManager.MAX_STRING_LENGTH;
}
Map elementMap = createLookupMap(table.getProjectedSymbols());
this.projectionIndexes = getProjectionIndexes(elementMap, getElements());
@@ -133,6 +136,8 @@
}
this.nameIndexes = null;
this.textLine = 0;
+ this.cr = false;
+ this.eof = false;
}
public void setTable(TextTable table) {
@@ -161,7 +166,7 @@
}
while (!isBatchFull()) {
- String line = readLine();
+ String line = readLine(lineWidth, table.isFixedWidth());
if (line == null) {
terminateBatches();
@@ -194,22 +199,63 @@
return pullBatch();
}
- private String readLine() throws TeiidProcessingException {
- while (true) {
- try {
- String line = reader.readLine();
- if (line != null) {
- textLine++;
- if (line.length() == 0) {
- continue;
+ private String readLine(int maxLength, boolean exact) throws TeiidProcessingException {
+ if (eof) {
+ return null;
+ }
+ StringBuilder sb = new StringBuilder(exact ? maxLength : (maxLength >> 4));
+ try {
+ while (true) {
+ char c = readChar();
+ if (c == '\n') {
+ if (sb.length() == 0) {
+ if (eof) {
+ return null;
+ }
+ continue; //skip empty lines
}
- }
- return line;
- } catch (IOException e) {
- throw new TeiidProcessingException(e);
+ if (exact && sb.length() < lineWidth) {
+ throw new TeiidProcessingException(QueryPlugin.Util.getString("TextTableNode.invalid_width", sb.length(), lineWidth, textLine, systemId)); //$NON-NLS-1$
+ }
+ return sb.toString();
+ }
+ sb.append(c);
+ if (sb.length() > maxLength) {
+ if (exact) {
+ //we're not forcing them to fully specify the line, so just drop the rest
+ //TODO: there should be a max read length
+ while ((c = readChar()) != '\n') {
+
+ }
+ return sb.toString();
+ }
+ throw new TeiidProcessingException(QueryPlugin.Util.getString("TextTableNode.line_too_long", textLine+1, systemId, maxLength)); //$NON-NLS-1$
+ }
}
+ } catch (IOException e) {
+ throw new TeiidProcessingException(e);
}
}
+
+ private char readChar() throws IOException {
+ int c = reader.read();
+ if (cr) {
+ if (c == '\n') {
+ c = reader.read();
+ }
+ cr = false;
+ }
+ switch (c) {
+ case '\r':
+ cr = true;
+ case -1:
+ eof = true;
+ case '\n':
+ textLine++;
+ return '\n';
+ }
+ return (char)c;
+ }
private void initReader() throws ExpressionEvaluationException,
BlockedException, TeiidComponentException, TeiidProcessingException {
@@ -245,7 +291,8 @@
}
while (textLine < skip) {
boolean isHeader = textLine == header;
- String line = readLine();
+ //if we don't need a header, then we could just scan, but for now we'll enforce a max length
+ String line = readLine(Math.min(lineWidth, DataTypeManager.MAX_STRING_LENGTH), false);
if (line == null) { //just return an empty batch
reset();
return;
@@ -289,9 +336,13 @@
while (true) {
if (line == null) {
if (escaped) {
- builder.append('\n'); //allow for escaped new lines
+ //allow for escaped new lines
+ if (cr) {
+ builder.append('\r');
+ }
+ builder.append('\n');
escaped = false;
- line = readLine();
+ line = readLine(lineWidth, false);
continue;
}
if (!qualified) {
@@ -299,7 +350,7 @@
addValue(result, wasQualified, builder.toString());
return result;
}
- line = readLine();
+ line = readLine(lineWidth, false);
if (line == null) {
throw new TeiidProcessingException(QueryPlugin.Util.getString("TextTableNode.unclosed", systemId)); //$NON-NLS-1$
}
@@ -368,11 +419,7 @@
result.add(val);
}
- private List<String> parseFixedWidth(String line)
- throws TeiidProcessingException {
- if (line.length() < lineWidth) {
- throw new TeiidProcessingException(QueryPlugin.Util.getString("TextTableNode.invalid_width", line.length(), lineWidth, textLine, systemId)); //$NON-NLS-1$
- }
+ private List<String> parseFixedWidth(String line) {
ArrayList<String> result = new ArrayList<String>();
int beginIndex = 0;
for (TextColumn col : table.getColumns()) {
Modified: trunk/engine/src/test/java/org/teiid/query/processor/TestTextTable.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/processor/TestTextTable.java 2011-02-17 15:12:44 UTC (rev 2914)
+++ trunk/engine/src/test/java/org/teiid/query/processor/TestTextTable.java 2011-02-17 17:32:44 UTC (rev 2915)
@@ -22,14 +22,15 @@
package org.teiid.query.processor;
-import static org.teiid.query.optimizer.TestOptimizer.getTypicalCapabilities;
-import static org.teiid.query.optimizer.TestOptimizer.helpPlan;
+import static org.teiid.query.optimizer.TestOptimizer.*;
import static org.teiid.query.processor.TestProcessor.*;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
+import javax.sql.rowset.serial.SerialClob;
+
import org.junit.Test;
import org.teiid.core.TeiidProcessingException;
import org.teiid.core.types.ClobImpl;
@@ -62,7 +63,7 @@
}
@Test public void testTextTableFixed() throws Exception {
- String sql = "select count(*) from texttable(? COLUMNS compkey string width 77, CDM_ID string width 14, CURRENCY string width 9, \"START\" string width 31, MATURITY string width 38, AMOUNT double width 13, RECORDSOURCE string width 13, SUMMIT_ID string width 25, RATE double width 21, SPREAD double width 9, DESK string width 13) x"; //$NON-NLS-1$
+ String sql = "select count(*) from texttable(? COLUMNS compkey string width 78, CDM_ID string width 14, CURRENCY string width 9, \"START\" string width 31, MATURITY string width 38, AMOUNT double width 13, RECORDSOURCE string width 13, SUMMIT_ID string width 25, RATE double width 21, SPREAD double width 9, DESK string width 13) x"; //$NON-NLS-1$
List[] expected = new List[] {
Arrays.asList(52),
@@ -255,5 +256,15 @@
helpProcess(plan, hdm, expected);
}
+
+ @Test(expected=TeiidProcessingException.class) public void testTextTableInvalidData() throws Exception {
+ String sql = "select count(*) from texttable(? COLUMNS PARTNAME string) x"; //$NON-NLS-1$
+
+ FakeDataManager dataManager = new FakeDataManager();
+ sampleData1(dataManager);
+
+ char[] data = new char[5000];
+ processPreparedStatement(sql, null, dataManager, new DefaultCapabilitiesFinder(), FakeMetadataFactory.example1Cached(), Arrays.asList(new ClobType(new SerialClob(data))));
+ }
}
14 years, 10 months
teiid SVN: r2914 - in trunk/engine/src/main: javacc/org/teiid/query/parser and 1 other directory.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2011-02-17 10:12:44 -0500 (Thu, 17 Feb 2011)
New Revision: 2914
Modified:
trunk/engine/src/main/java/org/teiid/query/parser/QueryParser.java
trunk/engine/src/main/javacc/org/teiid/query/parser/SQLParser.jj
Log:
TEIIDDES-806 adding a parsing hook for all designer commands
Modified: trunk/engine/src/main/java/org/teiid/query/parser/QueryParser.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/parser/QueryParser.java 2011-02-16 21:32:50 UTC (rev 2913)
+++ trunk/engine/src/main/java/org/teiid/query/parser/QueryParser.java 2011-02-17 15:12:44 UTC (rev 2914)
@@ -114,14 +114,26 @@
* @throws QueryParserException if parsing fails
* @throws IllegalArgumentException if sql is null
*/
- public Command parseCommand(String sql, ParseInfo parseInfo) throws QueryParserException {
+ public Command parseCommand(String sql, ParseInfo parseInfo) throws QueryParserException {
+ return parseCommand(sql, parseInfo, false);
+ }
+
+ public Command parseDesignerCommand(String sql) throws QueryParserException {
+ return parseCommand(sql, new ParseInfo(), true);
+ }
+
+ public Command parseCommand(String sql, ParseInfo parseInfo, boolean designerCommands) throws QueryParserException {
if(sql == null || sql.length() == 0) {
throw new QueryParserException(QueryPlugin.Util.getString("QueryParser.emptysql")); //$NON-NLS-1$
}
Command result = null;
try{
- result = getSqlParser(sql).command(parseInfo);
+ if (designerCommands) {
+ result = getSqlParser(sql).designerCommand(parseInfo);
+ } else {
+ result = getSqlParser(sql).command(parseInfo);
+ }
result.setCacheHint(SQLParserUtil.getQueryCacheOption(sql));
} catch(ParseException pe) {
if(sql.startsWith(XML_OPEN_BRACKET) || sql.startsWith(XQUERY_DECLARE)) {
Modified: trunk/engine/src/main/javacc/org/teiid/query/parser/SQLParser.jj
===================================================================
--- trunk/engine/src/main/javacc/org/teiid/query/parser/SQLParser.jj 2011-02-16 21:32:50 UTC (rev 2913)
+++ trunk/engine/src/main/javacc/org/teiid/query/parser/SQLParser.jj 2011-02-17 15:12:44 UTC (rev 2914)
@@ -454,6 +454,21 @@
}
}
+Command designerCommand(ParseInfo info) :
+{
+ Command command = null;
+}
+{
+ (LOOKAHEAD(2) command = updateProcedure(info) |
+ command = userCommand(info)
+ )
+ [<SEMICOLON>]
+ <EOF>
+ {
+ return command;
+ }
+}
+
Command updateProcedure(ParseInfo info) :
{
Command command = null;
14 years, 10 months
teiid SVN: r2913 - trunk/api/src/main/java/org/teiid/language.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2011-02-16 16:32:50 -0500 (Wed, 16 Feb 2011)
New Revision: 2913
Modified:
trunk/api/src/main/java/org/teiid/language/SQLConstants.java
Log:
TEIIDDES-868 exposing reserved and non reserved words for use by designer
Modified: trunk/api/src/main/java/org/teiid/language/SQLConstants.java
===================================================================
--- trunk/api/src/main/java/org/teiid/language/SQLConstants.java 2011-02-16 16:28:02 UTC (rev 2912)
+++ trunk/api/src/main/java/org/teiid/language/SQLConstants.java 2011-02-16 21:32:50 UTC (rev 2913)
@@ -23,8 +23,9 @@
package org.teiid.language;
import java.lang.reflect.Field;
+import java.util.Collections;
+import java.util.HashSet;
import java.util.Set;
-import java.util.HashSet;
/**
* SQL Constants for Teiid.
@@ -400,23 +401,42 @@
/**
* Set of CAPITALIZED reserved words for checking whether a string is a reserved word.
*/
- private static final Set<String> RESERVED_WORDS = new HashSet<String>();
+ private static final Set<String> RESERVED_WORDS = extractFieldNames(SQLConstants.Reserved.class);
+ private static final Set<String> NON_RESERVED_WORDS = extractFieldNames(SQLConstants.NonReserved.class);
- // Initialize RESERVED_WORDS set - This is a poor man's enum. To much legacy code expects the constants to be Strings.
- static {
- Field[] fields = SQLConstants.Reserved.class.getDeclaredFields();
+ /**
+ * @throws AssertionError
+ */
+ private static Set<String> extractFieldNames(Class<?> clazz) throws AssertionError {
+ HashSet<String> result = new HashSet<String>();
+ Field[] fields = clazz.getDeclaredFields();
for (Field field : fields) {
if (field.getType() == String.class) {
try {
- if (!RESERVED_WORDS.add((String)field.get(null))) {
+ if (!result.add((String)field.get(null))) {
throw new AssertionError("Duplicate value for " + field.getName()); //$NON-NLS-1$
}
} catch (Exception e) {
}
}
}
- }
-
+ return Collections.unmodifiableSet(result);
+ }
+
+ /**
+ * @return nonReservedWords
+ */
+ public static Set<String> getNonReservedWords() {
+ return NON_RESERVED_WORDS;
+ }
+
+ /**
+ * @return reservedWords
+ */
+ public static Set<String> getReservedWords() {
+ return RESERVED_WORDS;
+ }
+
/** Can't construct */
private SQLConstants() {}
14 years, 10 months
teiid SVN: r2912 - in trunk/console/src: main/resources/META-INF and 3 other directories.
by teiid-commits@lists.jboss.org
Author: tejones
Date: 2011-02-16 11:28:02 -0500 (Wed, 16 Feb 2011)
New Revision: 2912
Added:
trunk/console/src/test/java/org/teiid/rhq/plugin/
trunk/console/src/test/java/org/teiid/rhq/plugin/util/
trunk/console/src/test/java/org/teiid/rhq/plugin/util/TestDeploymentUtils.java
Modified:
trunk/console/src/main/java/org/teiid/rhq/plugin/util/DeploymentUtils.java
trunk/console/src/main/resources/META-INF/rhq-plugin.xml
Log:
TEIID-1437: Added dynamic VDB deployment capability
Modified: trunk/console/src/main/java/org/teiid/rhq/plugin/util/DeploymentUtils.java
===================================================================
--- trunk/console/src/main/java/org/teiid/rhq/plugin/util/DeploymentUtils.java 2011-02-16 03:45:00 UTC (rev 2911)
+++ trunk/console/src/main/java/org/teiid/rhq/plugin/util/DeploymentUtils.java 2011-02-16 16:28:02 UTC (rev 2912)
@@ -46,9 +46,16 @@
int lastPeriod = archiveFileName.lastIndexOf("."); //$NON-NLS-1$
String extension = (lastPeriod != -1) ? archiveFileName.substring(lastPeriod + 1) : null;
// Use File.equals() to compare the extensions so case-sensitivity is correct for this platform.
- return (extension != null && new File(extension).equals(new File(expectedExtension)));
+ return (extension != null && new File(extension).equals(new File(expectedExtension))) || isDynamicVDB(archiveFileName);
}
+ private static boolean isDynamicVDB(String archiveFileName) {
+ String dynamicFile = "-vdb.xml"; //$NON-NLS-1$
+ if (archiveFileName.length()<8) return false;
+ String fileEnding = archiveFileName.substring(archiveFileName.length()-8);
+ return (new File(dynamicFile).equals(new File(fileEnding)));
+ }
+
/**
* Deploys (i.e. distributes then starts) the specified archive file.
*
Modified: trunk/console/src/main/resources/META-INF/rhq-plugin.xml
===================================================================
--- trunk/console/src/main/resources/META-INF/rhq-plugin.xml 2011-02-16 03:45:00 UTC (rev 2911)
+++ trunk/console/src/main/resources/META-INF/rhq-plugin.xml 2011-02-16 16:28:02 UTC (rev 2912)
@@ -558,7 +558,7 @@
displayType="summary" category="availability" property="errorCount"
description="Whether or not errors exist for this VDB" />
- <content name="vdb" displayName="VDB Archive" category="deployable"
+ <content name="vdb" displayName="VDB File" category="deployable"
isCreationType="true">
</content>
Added: trunk/console/src/test/java/org/teiid/rhq/plugin/util/TestDeploymentUtils.java
===================================================================
--- trunk/console/src/test/java/org/teiid/rhq/plugin/util/TestDeploymentUtils.java (rev 0)
+++ trunk/console/src/test/java/org/teiid/rhq/plugin/util/TestDeploymentUtils.java 2011-02-16 16:28:02 UTC (rev 2912)
@@ -0,0 +1,44 @@
+package org.teiid.rhq.plugin.util;
+/*
+ * 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.
+ */
+
+
+import junit.framework.TestCase;
+
+import org.teiid.rhq.plugin.util.DeploymentUtils;
+
+/**
+ * A set of utility methods for deploying applications.
+ *
+ */
+public class TestDeploymentUtils extends TestCase {
+
+ public void testHasCorrectExtension() {
+ assertTrue(DeploymentUtils.hasCorrectExtension("test-vdb.xml", null));
+ assertFalse(DeploymentUtils.hasCorrectExtension("test-vdb.pdf", null));
+ assertFalse(DeploymentUtils.hasCorrectExtension("b.xml", null));
+ assertTrue(DeploymentUtils.hasCorrectExtension("my.vdb", null));
+ assertFalse(DeploymentUtils.hasCorrectExtension("My.VDB", null));
+ assertFalse(DeploymentUtils.hasCorrectExtension("a.vdbx", null));
+ }
+
+}
Property changes on: trunk/console/src/test/java/org/teiid/rhq/plugin/util/TestDeploymentUtils.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
14 years, 10 months
teiid SVN: r2911 - in trunk/connectors/translator-jdbc/src: test/java/org/teiid/translator/jdbc/mysql and 1 other directory.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2011-02-15 22:45:00 -0500 (Tue, 15 Feb 2011)
New Revision: 2911
Modified:
trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/mysql/MySQLExecutionFactory.java
trunk/connectors/translator-jdbc/src/test/java/org/teiid/translator/jdbc/mysql/TestMySQLTranslator.java
Log:
TEIID-1466 fixing mysql cast to timestamp
Modified: trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/mysql/MySQLExecutionFactory.java
===================================================================
--- trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/mysql/MySQLExecutionFactory.java 2011-02-15 19:38:49 UTC (rev 2910)
+++ trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/mysql/MySQLExecutionFactory.java 2011-02-16 03:45:00 UTC (rev 2911)
@@ -81,7 +81,7 @@
convertModifier.addTypeMapping("char", FunctionModifier.STRING); //$NON-NLS-1$
convertModifier.addTypeMapping("date", FunctionModifier.DATE); //$NON-NLS-1$
convertModifier.addTypeMapping("time", FunctionModifier.TIME); //$NON-NLS-1$
- convertModifier.addTypeMapping("timestamp", FunctionModifier.TIMESTAMP); //$NON-NLS-1$
+ convertModifier.addTypeMapping("datetime", FunctionModifier.TIMESTAMP); //$NON-NLS-1$
convertModifier.addConvert(FunctionModifier.STRING, FunctionModifier.DATE, new ConvertModifier.FormatModifier("DATE")); //$NON-NLS-1$
convertModifier.addConvert(FunctionModifier.STRING, FunctionModifier.TIME, new ConvertModifier.FormatModifier("TIME")); //$NON-NLS-1$
convertModifier.addConvert(FunctionModifier.STRING, FunctionModifier.TIMESTAMP, new ConvertModifier.FormatModifier("TIMESTAMP")); //$NON-NLS-1$
Modified: trunk/connectors/translator-jdbc/src/test/java/org/teiid/translator/jdbc/mysql/TestMySQLTranslator.java
===================================================================
--- trunk/connectors/translator-jdbc/src/test/java/org/teiid/translator/jdbc/mysql/TestMySQLTranslator.java 2011-02-15 19:38:49 UTC (rev 2910)
+++ trunk/connectors/translator-jdbc/src/test/java/org/teiid/translator/jdbc/mysql/TestMySQLTranslator.java 2011-02-16 03:45:00 UTC (rev 2911)
@@ -313,6 +313,16 @@
output, TRANSLATOR);
}
+ @Test public void testDateToTimestamp() throws Exception {
+ String input = "select convert(smalla.datevalue, timestamp) from bqt1.smalla"; //$NON-NLS-1$
+ String output = "SELECT cast(SmallA.DateValue AS datetime) FROM SmallA"; //$NON-NLS-1$
+
+ TranslationHelper.helpTestVisitor(TranslationHelper.BQT_VDB,
+ input,
+ output, TRANSLATOR);
+ }
+
+
@Test public void testPad() throws Exception {
String input = "select lpad(smalla.stringkey, 18), rpad(smalla.stringkey, 12) from bqt1.smalla"; //$NON-NLS-1$
String output = "SELECT lpad(SmallA.StringKey, 18, ' '), rpad(SmallA.StringKey, 12, ' ') FROM SmallA"; //$NON-NLS-1$
14 years, 10 months
teiid SVN: r2910 - in trunk/console/src/main: java/org/teiid/rhq/plugin and 1 other directories.
by teiid-commits@lists.jboss.org
Author: tejones
Date: 2011-02-15 14:38:49 -0500 (Tue, 15 Feb 2011)
New Revision: 2910
Modified:
trunk/console/src/main/java/org/teiid/rhq/admin/DQPManagementView.java
trunk/console/src/main/java/org/teiid/rhq/plugin/PlatformComponent.java
trunk/console/src/main/resources/META-INF/rhq-plugin.xml
Log:
TEIID-1469: Changed session id (and transaction id) from Long to String
Modified: trunk/console/src/main/java/org/teiid/rhq/admin/DQPManagementView.java
===================================================================
--- trunk/console/src/main/java/org/teiid/rhq/admin/DQPManagementView.java 2011-02-15 19:05:40 UTC (rev 2909)
+++ trunk/console/src/main/java/org/teiid/rhq/admin/DQPManagementView.java 2011-02-15 19:38:49 UTC (rev 2910)
@@ -212,7 +212,7 @@
getTransactionCollectionValue(transactionMetaValue,transactionsCollection);
operationResult.setContent(createReportResultList(fieldNameList, resultObject.iterator()));
} else if (operationName.equals(Platform.Operations.KILL_TRANSACTION)) {
- Long sessionID = (Long) valueMap.get(Operation.Value.TRANSACTION_ID);
+ String sessionID = (String) valueMap.get(Operation.Value.TRANSACTION_ID);
MetaValue[] args = new MetaValue[] { SimpleValueSupport.wrap(sessionID) };
try {
executeManagedOperation(connection, getRuntimeEngineDeployer(connection, mc), Platform.Operations.KILL_TRANSACTION, args);
@@ -221,7 +221,7 @@
LOG.error(msg, e);
}
} else if (operationName.equals(Platform.Operations.KILL_SESSION)) {
- Long sessionID = (Long) valueMap.get(Operation.Value.SESSION_ID);
+ String sessionID = (String) valueMap.get(Operation.Value.SESSION_ID);
MetaValue[] args = new MetaValue[] { SimpleValueSupport.wrap(sessionID) };
try {
executeManagedOperation(connection, getRuntimeEngineDeployer(connection, mc), Platform.Operations.KILL_SESSION, args);
@@ -231,7 +231,7 @@
}
} else if (operationName.equals(Platform.Operations.KILL_REQUEST)) {
Long requestID = (Long) valueMap.get(Operation.Value.REQUEST_ID);
- Long sessionID = (Long) valueMap.get(Operation.Value.SESSION_ID);
+ String sessionID = (String) valueMap.get(Operation.Value.SESSION_ID);
MetaValue[] args = new MetaValue[] {
SimpleValueSupport.wrap(requestID),
SimpleValueSupport.wrap(sessionID) };
@@ -886,8 +886,8 @@
TransactionMetadata transaction = new TransactionMetadata();
transaction.setAssociatedSession((String) ProfileServiceUtil.stringValue(compositeValue.get(ASSOCIATED_SESSION)));
transaction.setCreatedTime((Long) ProfileServiceUtil.longValue(compositeValue.get(CREATED_TIME)));
- transaction.setScope((String) (String) ProfileServiceUtil.stringValue(compositeValue.get(SCOPE)));
- transaction.setId((String) (String) ProfileServiceUtil.stringValue(compositeValue.get("id"))); //$NON-NLS-1$
+ transaction.setScope((String) ProfileServiceUtil.stringValue(compositeValue.get(SCOPE)));
+ transaction.setId((String) ProfileServiceUtil.stringValue(compositeValue.get("id"))); //$NON-NLS-1$
return transaction;
}
throw new IllegalStateException("Unable to unwrap TransactionMetadata " + metaValue); //$NON-NLS-1$
Modified: trunk/console/src/main/java/org/teiid/rhq/plugin/PlatformComponent.java
===================================================================
--- trunk/console/src/main/java/org/teiid/rhq/plugin/PlatformComponent.java 2011-02-15 19:05:40 UTC (rev 2909)
+++ trunk/console/src/main/java/org/teiid/rhq/plugin/PlatformComponent.java 2011-02-15 19:38:49 UTC (rev 2910)
@@ -96,11 +96,11 @@
// Parameter logic for System Operations
if (name.equals(Platform.Operations.KILL_REQUEST)) {
valueMap.put(Operation.Value.REQUEST_ID, configuration.getSimple(Operation.Value.REQUEST_ID).getLongValue());
- valueMap.put(Operation.Value.SESSION_ID, configuration.getSimple(Operation.Value.SESSION_ID).getLongValue());
+ valueMap.put(Operation.Value.SESSION_ID, configuration.getSimple(Operation.Value.SESSION_ID).getStringValue());
} else if (name.equals(Platform.Operations.KILL_REQUEST)) {
- valueMap.put(Operation.Value.TRANSACTION_ID, configuration.getSimple(Operation.Value.TRANSACTION_ID).getLongValue());
+ valueMap.put(Operation.Value.TRANSACTION_ID, configuration.getSimple(Operation.Value.TRANSACTION_ID).getStringValue());
} else if (name.equals(Platform.Operations.KILL_SESSION)) {
- valueMap.put(Operation.Value.SESSION_ID, configuration.getSimple(Operation.Value.SESSION_ID).getLongValue());
+ valueMap.put(Operation.Value.SESSION_ID, configuration.getSimple(Operation.Value.SESSION_ID).getStringValue());
} else if (name.equals(Platform.Operations.DEPLOY_VDB_BY_URL)) {
valueMap.put(Operation.Value.VDB_URL, configuration.getSimple(Operation.Value.VDB_URL).getStringValue());
valueMap.put(Operation.Value.VDB_DEPLOY_NAME, configuration.getSimple(Operation.Value.VDB_DEPLOY_NAME).getStringValue());
Modified: trunk/console/src/main/resources/META-INF/rhq-plugin.xml
===================================================================
--- trunk/console/src/main/resources/META-INF/rhq-plugin.xml 2011-02-15 19:05:40 UTC (rev 2909)
+++ trunk/console/src/main/resources/META-INF/rhq-plugin.xml 2011-02-15 19:38:49 UTC (rev 2910)
@@ -171,7 +171,7 @@
description="Terminate a specified session">
<parameters>
<c:simple-property displayName="SessionID" name="sessionID"
- type="long" required="true" description="The ID of the session to terminate" />
+ type="string" required="true" description="The ID of the session to terminate" />
</parameters>
</operation>
@@ -213,7 +213,7 @@
description="Terminate the processing of a query and its source queries">
<parameters>
<c:simple-property displayName="Session ID" name="sessionID"
- type="long" required="true"
+ type="string" required="true"
description="The ID of the session that the request to cancel is associated with" />
<c:simple-property displayName="Request ID" name="requestID"
type="long" required="true" description="The ID of the request to cancel" />
@@ -247,7 +247,7 @@
description="Terminate a specified transaction">
<parameters>
<c:simple-property displayName="Transaction ID"
- name="transactionID" type="long" required="true"
+ name="transactionID" type="string" required="true"
description="The ID of the transaction to terminate" />
</parameters>
</operation>
14 years, 10 months
teiid SVN: r2909 - in branches/7.1.x/console/src/main: java/org/teiid/rhq/plugin and 1 other directories.
by teiid-commits@lists.jboss.org
Author: tejones
Date: 2011-02-15 14:05:40 -0500 (Tue, 15 Feb 2011)
New Revision: 2909
Modified:
branches/7.1.x/console/src/main/java/org/teiid/rhq/admin/DQPManagementView.java
branches/7.1.x/console/src/main/java/org/teiid/rhq/plugin/PlatformComponent.java
branches/7.1.x/console/src/main/resources/META-INF/rhq-plugin.xml
Log:
TEIID-1469: Committed to wrong branch. Reverting to previous version.
Modified: branches/7.1.x/console/src/main/java/org/teiid/rhq/admin/DQPManagementView.java
===================================================================
--- branches/7.1.x/console/src/main/java/org/teiid/rhq/admin/DQPManagementView.java 2011-02-15 17:57:45 UTC (rev 2908)
+++ branches/7.1.x/console/src/main/java/org/teiid/rhq/admin/DQPManagementView.java 2011-02-15 19:05:40 UTC (rev 2909)
@@ -212,7 +212,7 @@
getTransactionCollectionValue(transactionMetaValue,transactionsCollection);
operationResult.setContent(createReportResultList(fieldNameList, resultObject.iterator()));
} else if (operationName.equals(Platform.Operations.KILL_TRANSACTION)) {
- String sessionID = (String) valueMap.get(Operation.Value.TRANSACTION_ID);
+ Long sessionID = (Long) valueMap.get(Operation.Value.TRANSACTION_ID);
MetaValue[] args = new MetaValue[] { SimpleValueSupport.wrap(sessionID) };
try {
executeManagedOperation(connection, getRuntimeEngineDeployer(connection, mc), Platform.Operations.KILL_TRANSACTION, args);
@@ -221,7 +221,7 @@
LOG.error(msg, e);
}
} else if (operationName.equals(Platform.Operations.KILL_SESSION)) {
- String sessionID = (String) valueMap.get(Operation.Value.SESSION_ID);
+ Long sessionID = (Long) valueMap.get(Operation.Value.SESSION_ID);
MetaValue[] args = new MetaValue[] { SimpleValueSupport.wrap(sessionID) };
try {
executeManagedOperation(connection, getRuntimeEngineDeployer(connection, mc), Platform.Operations.KILL_SESSION, args);
@@ -231,7 +231,7 @@
}
} else if (operationName.equals(Platform.Operations.KILL_REQUEST)) {
Long requestID = (Long) valueMap.get(Operation.Value.REQUEST_ID);
- String sessionID = (String) valueMap.get(Operation.Value.SESSION_ID);
+ Long sessionID = (Long) valueMap.get(Operation.Value.SESSION_ID);
MetaValue[] args = new MetaValue[] {
SimpleValueSupport.wrap(requestID),
SimpleValueSupport.wrap(sessionID) };
@@ -886,8 +886,8 @@
TransactionMetadata transaction = new TransactionMetadata();
transaction.setAssociatedSession((String) ProfileServiceUtil.stringValue(compositeValue.get(ASSOCIATED_SESSION)));
transaction.setCreatedTime((Long) ProfileServiceUtil.longValue(compositeValue.get(CREATED_TIME)));
- transaction.setScope((String) ProfileServiceUtil.stringValue(compositeValue.get(SCOPE)));
- transaction.setId((String) ProfileServiceUtil.stringValue(compositeValue.get("id"))); //$NON-NLS-1$
+ transaction.setScope((String) (String) ProfileServiceUtil.stringValue(compositeValue.get(SCOPE)));
+ transaction.setId((String) (String) ProfileServiceUtil.stringValue(compositeValue.get("id"))); //$NON-NLS-1$
return transaction;
}
throw new IllegalStateException("Unable to unwrap TransactionMetadata " + metaValue); //$NON-NLS-1$
Modified: branches/7.1.x/console/src/main/java/org/teiid/rhq/plugin/PlatformComponent.java
===================================================================
--- branches/7.1.x/console/src/main/java/org/teiid/rhq/plugin/PlatformComponent.java 2011-02-15 17:57:45 UTC (rev 2908)
+++ branches/7.1.x/console/src/main/java/org/teiid/rhq/plugin/PlatformComponent.java 2011-02-15 19:05:40 UTC (rev 2909)
@@ -96,11 +96,11 @@
// Parameter logic for System Operations
if (name.equals(Platform.Operations.KILL_REQUEST)) {
valueMap.put(Operation.Value.REQUEST_ID, configuration.getSimple(Operation.Value.REQUEST_ID).getLongValue());
- valueMap.put(Operation.Value.SESSION_ID, configuration.getSimple(Operation.Value.SESSION_ID).getStringValue());
+ valueMap.put(Operation.Value.SESSION_ID, configuration.getSimple(Operation.Value.SESSION_ID).getLongValue());
} else if (name.equals(Platform.Operations.KILL_REQUEST)) {
- valueMap.put(Operation.Value.TRANSACTION_ID, configuration.getSimple(Operation.Value.TRANSACTION_ID).getStringValue());
+ valueMap.put(Operation.Value.TRANSACTION_ID, configuration.getSimple(Operation.Value.TRANSACTION_ID).getLongValue());
} else if (name.equals(Platform.Operations.KILL_SESSION)) {
- valueMap.put(Operation.Value.SESSION_ID, configuration.getSimple(Operation.Value.SESSION_ID).getStringValue());
+ valueMap.put(Operation.Value.SESSION_ID, configuration.getSimple(Operation.Value.SESSION_ID).getLongValue());
} else if (name.equals(Platform.Operations.DEPLOY_VDB_BY_URL)) {
valueMap.put(Operation.Value.VDB_URL, configuration.getSimple(Operation.Value.VDB_URL).getStringValue());
valueMap.put(Operation.Value.VDB_DEPLOY_NAME, configuration.getSimple(Operation.Value.VDB_DEPLOY_NAME).getStringValue());
Modified: branches/7.1.x/console/src/main/resources/META-INF/rhq-plugin.xml
===================================================================
--- branches/7.1.x/console/src/main/resources/META-INF/rhq-plugin.xml 2011-02-15 17:57:45 UTC (rev 2908)
+++ branches/7.1.x/console/src/main/resources/META-INF/rhq-plugin.xml 2011-02-15 19:05:40 UTC (rev 2909)
@@ -171,7 +171,7 @@
description="Terminate a specified session">
<parameters>
<c:simple-property displayName="SessionID" name="sessionID"
- type="string" required="true" description="The ID of the session to terminate" />
+ type="long" required="true" description="The ID of the session to terminate" />
</parameters>
</operation>
@@ -213,7 +213,7 @@
description="Terminate the processing of a query and its source queries">
<parameters>
<c:simple-property displayName="Session ID" name="sessionID"
- type="string" required="true"
+ type="long" required="true"
description="The ID of the session that the request to cancel is associated with" />
<c:simple-property displayName="Request ID" name="requestID"
type="long" required="true" description="The ID of the request to cancel" />
@@ -247,7 +247,7 @@
description="Terminate a specified transaction">
<parameters>
<c:simple-property displayName="Transaction ID"
- name="transactionID" type="string" required="true"
+ name="transactionID" type="long" required="true"
description="The ID of the transaction to terminate" />
</parameters>
</operation>
14 years, 10 months
teiid SVN: r2908 - in branches/7.1.x/console/src/main: java/org/teiid/rhq/plugin and 1 other directories.
by teiid-commits@lists.jboss.org
Author: tejones
Date: 2011-02-15 12:57:45 -0500 (Tue, 15 Feb 2011)
New Revision: 2908
Modified:
branches/7.1.x/console/src/main/java/org/teiid/rhq/admin/DQPManagementView.java
branches/7.1.x/console/src/main/java/org/teiid/rhq/plugin/PlatformComponent.java
branches/7.1.x/console/src/main/resources/META-INF/rhq-plugin.xml
Log:
TEIID-1469: Changed session id (and transaction id) from Long to String
Modified: branches/7.1.x/console/src/main/java/org/teiid/rhq/admin/DQPManagementView.java
===================================================================
--- branches/7.1.x/console/src/main/java/org/teiid/rhq/admin/DQPManagementView.java 2011-02-15 03:12:21 UTC (rev 2907)
+++ branches/7.1.x/console/src/main/java/org/teiid/rhq/admin/DQPManagementView.java 2011-02-15 17:57:45 UTC (rev 2908)
@@ -212,7 +212,7 @@
getTransactionCollectionValue(transactionMetaValue,transactionsCollection);
operationResult.setContent(createReportResultList(fieldNameList, resultObject.iterator()));
} else if (operationName.equals(Platform.Operations.KILL_TRANSACTION)) {
- Long sessionID = (Long) valueMap.get(Operation.Value.TRANSACTION_ID);
+ String sessionID = (String) valueMap.get(Operation.Value.TRANSACTION_ID);
MetaValue[] args = new MetaValue[] { SimpleValueSupport.wrap(sessionID) };
try {
executeManagedOperation(connection, getRuntimeEngineDeployer(connection, mc), Platform.Operations.KILL_TRANSACTION, args);
@@ -221,7 +221,7 @@
LOG.error(msg, e);
}
} else if (operationName.equals(Platform.Operations.KILL_SESSION)) {
- Long sessionID = (Long) valueMap.get(Operation.Value.SESSION_ID);
+ String sessionID = (String) valueMap.get(Operation.Value.SESSION_ID);
MetaValue[] args = new MetaValue[] { SimpleValueSupport.wrap(sessionID) };
try {
executeManagedOperation(connection, getRuntimeEngineDeployer(connection, mc), Platform.Operations.KILL_SESSION, args);
@@ -231,7 +231,7 @@
}
} else if (operationName.equals(Platform.Operations.KILL_REQUEST)) {
Long requestID = (Long) valueMap.get(Operation.Value.REQUEST_ID);
- Long sessionID = (Long) valueMap.get(Operation.Value.SESSION_ID);
+ String sessionID = (String) valueMap.get(Operation.Value.SESSION_ID);
MetaValue[] args = new MetaValue[] {
SimpleValueSupport.wrap(requestID),
SimpleValueSupport.wrap(sessionID) };
@@ -886,8 +886,8 @@
TransactionMetadata transaction = new TransactionMetadata();
transaction.setAssociatedSession((String) ProfileServiceUtil.stringValue(compositeValue.get(ASSOCIATED_SESSION)));
transaction.setCreatedTime((Long) ProfileServiceUtil.longValue(compositeValue.get(CREATED_TIME)));
- transaction.setScope((String) (String) ProfileServiceUtil.stringValue(compositeValue.get(SCOPE)));
- transaction.setId((String) (String) ProfileServiceUtil.stringValue(compositeValue.get("id"))); //$NON-NLS-1$
+ transaction.setScope((String) ProfileServiceUtil.stringValue(compositeValue.get(SCOPE)));
+ transaction.setId((String) ProfileServiceUtil.stringValue(compositeValue.get("id"))); //$NON-NLS-1$
return transaction;
}
throw new IllegalStateException("Unable to unwrap TransactionMetadata " + metaValue); //$NON-NLS-1$
Modified: branches/7.1.x/console/src/main/java/org/teiid/rhq/plugin/PlatformComponent.java
===================================================================
--- branches/7.1.x/console/src/main/java/org/teiid/rhq/plugin/PlatformComponent.java 2011-02-15 03:12:21 UTC (rev 2907)
+++ branches/7.1.x/console/src/main/java/org/teiid/rhq/plugin/PlatformComponent.java 2011-02-15 17:57:45 UTC (rev 2908)
@@ -96,11 +96,11 @@
// Parameter logic for System Operations
if (name.equals(Platform.Operations.KILL_REQUEST)) {
valueMap.put(Operation.Value.REQUEST_ID, configuration.getSimple(Operation.Value.REQUEST_ID).getLongValue());
- valueMap.put(Operation.Value.SESSION_ID, configuration.getSimple(Operation.Value.SESSION_ID).getLongValue());
+ valueMap.put(Operation.Value.SESSION_ID, configuration.getSimple(Operation.Value.SESSION_ID).getStringValue());
} else if (name.equals(Platform.Operations.KILL_REQUEST)) {
- valueMap.put(Operation.Value.TRANSACTION_ID, configuration.getSimple(Operation.Value.TRANSACTION_ID).getLongValue());
+ valueMap.put(Operation.Value.TRANSACTION_ID, configuration.getSimple(Operation.Value.TRANSACTION_ID).getStringValue());
} else if (name.equals(Platform.Operations.KILL_SESSION)) {
- valueMap.put(Operation.Value.SESSION_ID, configuration.getSimple(Operation.Value.SESSION_ID).getLongValue());
+ valueMap.put(Operation.Value.SESSION_ID, configuration.getSimple(Operation.Value.SESSION_ID).getStringValue());
} else if (name.equals(Platform.Operations.DEPLOY_VDB_BY_URL)) {
valueMap.put(Operation.Value.VDB_URL, configuration.getSimple(Operation.Value.VDB_URL).getStringValue());
valueMap.put(Operation.Value.VDB_DEPLOY_NAME, configuration.getSimple(Operation.Value.VDB_DEPLOY_NAME).getStringValue());
Modified: branches/7.1.x/console/src/main/resources/META-INF/rhq-plugin.xml
===================================================================
--- branches/7.1.x/console/src/main/resources/META-INF/rhq-plugin.xml 2011-02-15 03:12:21 UTC (rev 2907)
+++ branches/7.1.x/console/src/main/resources/META-INF/rhq-plugin.xml 2011-02-15 17:57:45 UTC (rev 2908)
@@ -171,7 +171,7 @@
description="Terminate a specified session">
<parameters>
<c:simple-property displayName="SessionID" name="sessionID"
- type="long" required="true" description="The ID of the session to terminate" />
+ type="string" required="true" description="The ID of the session to terminate" />
</parameters>
</operation>
@@ -213,7 +213,7 @@
description="Terminate the processing of a query and its source queries">
<parameters>
<c:simple-property displayName="Session ID" name="sessionID"
- type="long" required="true"
+ type="string" required="true"
description="The ID of the session that the request to cancel is associated with" />
<c:simple-property displayName="Request ID" name="requestID"
type="long" required="true" description="The ID of the request to cancel" />
@@ -247,7 +247,7 @@
description="Terminate a specified transaction">
<parameters>
<c:simple-property displayName="Transaction ID"
- name="transactionID" type="long" required="true"
+ name="transactionID" type="string" required="true"
description="The ID of the transaction to terminate" />
</parameters>
</operation>
14 years, 10 months
teiid SVN: r2907 - in trunk: engine/src/main/java/org/teiid/query/function/source and 1 other directories.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2011-02-14 22:12:21 -0500 (Mon, 14 Feb 2011)
New Revision: 2907
Modified:
trunk/documentation/reference/src/main/docbook/en-US/content/scalar_functions.xml
trunk/engine/src/main/java/org/teiid/query/function/source/XMLSystemFunctions.java
trunk/engine/src/test/java/org/teiid/query/function/source/TestXMLSystemFunctions.java
Log:
TEIID-1306 adding xsi:nil for null handling
Modified: trunk/documentation/reference/src/main/docbook/en-US/content/scalar_functions.xml
===================================================================
--- trunk/documentation/reference/src/main/docbook/en-US/content/scalar_functions.xml 2011-02-14 20:34:03 UTC (rev 2906)
+++ trunk/documentation/reference/src/main/docbook/en-US/content/scalar_functions.xml 2011-02-15 03:12:21 UTC (rev 2907)
@@ -1948,6 +1948,9 @@
<listitem>
<para>Unless an array value is the root, it will not be enclosed in an additional element.</para>
</listitem>
+ <listitem>
+ <para>Null values will be represented by an empty element with the attribute xsi:nil="true"</para>
+ </listitem>
</itemizedlist>
</para>
<example>
Modified: trunk/engine/src/main/java/org/teiid/query/function/source/XMLSystemFunctions.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/function/source/XMLSystemFunctions.java 2011-02-14 20:34:03 UTC (rev 2906)
+++ trunk/engine/src/main/java/org/teiid/query/function/source/XMLSystemFunctions.java 2011-02-15 03:12:21 UTC (rev 2907)
@@ -171,12 +171,15 @@
if (inArray.peek()) {
start();
}
- if (value != null) {
- try {
+ try {
+ if (value != null) {
streamWriter.writeCharacters(value.toString());
- } catch (XMLStreamException e) {
- throw new IOException(e);
+ } else {
+ streamWriter.writeNamespace("xsi", XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI); //$NON-NLS-1$
+ streamWriter.writeAttribute("xsi", XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI, "nil", "true"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
+ } catch (XMLStreamException e) {
+ throw new IOException(e);
}
if (inArray.peek()) {
end();
Modified: trunk/engine/src/test/java/org/teiid/query/function/source/TestXMLSystemFunctions.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/function/source/TestXMLSystemFunctions.java 2011-02-14 20:34:03 UTC (rev 2906)
+++ trunk/engine/src/test/java/org/teiid/query/function/source/TestXMLSystemFunctions.java 2011-02-15 03:12:21 UTC (rev 2907)
@@ -218,6 +218,12 @@
helpTestJson(json, "Person", expected);
}
+ @Test public void testJsonToXml2() throws Exception {
+ String json = "{ \"firstName\": null }";
+ String expected = "<?xml version=\"1.0\" ?><Person><firstName xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:nil=\"true\"></firstName></Person>";
+ helpTestJson(json, "Person", expected);
+ }
+
@BeforeClass static public void setUpOnce() {
TimeZone.setDefault(TimeZone.getTimeZone("GMT-6:00"));
}
14 years, 10 months