teiid SVN: r4272 - trunk/build.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2012-07-26 13:21:06 -0400 (Thu, 26 Jul 2012)
New Revision: 4272
Modified:
trunk/build/pom.xml
Log:
applying a product change forward
Modified: trunk/build/pom.xml
===================================================================
--- trunk/build/pom.xml 2012-07-26 14:43:40 UTC (rev 4271)
+++ trunk/build/pom.xml 2012-07-26 17:21:06 UTC (rev 4272)
@@ -121,7 +121,7 @@
<configuration>
<artifacts>
<artifact>
- <file>target/teiid-${project.version}-client-jdk15.jar</file>
+ <file>target/teiid-${project.version}-jdbc-jdk15.jar</file>
<type>jar</type>
<classifier>client-jdk15</classifier>
</artifact>
12 years, 5 months
teiid SVN: r4271 - in trunk/engine/src: test/java/org/teiid/query/processor and 1 other directory.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2012-07-26 10:43:40 -0400 (Thu, 26 Jul 2012)
New Revision: 4271
Modified:
trunk/engine/src/main/java/org/teiid/query/processor/relational/XMLTableNode.java
trunk/engine/src/test/java/org/teiid/query/processor/TestSQLXMLProcessing.java
Log:
TEIID-2117 adding binary support
Modified: trunk/engine/src/main/java/org/teiid/query/processor/relational/XMLTableNode.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/processor/relational/XMLTableNode.java 2012-07-25 19:39:59 UTC (rev 4270)
+++ trunk/engine/src/main/java/org/teiid/query/processor/relational/XMLTableNode.java 2012-07-26 14:43:40 UTC (rev 4271)
@@ -83,6 +83,8 @@
typeMapping.put(DataTypeManager.DefaultDataClasses.DATE, BuiltInAtomicType.DATE);
typeMapping.put(DataTypeManager.DefaultDataClasses.FLOAT, BuiltInAtomicType.FLOAT);
typeMapping.put(DataTypeManager.DefaultDataClasses.DOUBLE, BuiltInAtomicType.DOUBLE);
+ typeMapping.put(DataTypeManager.DefaultDataClasses.BLOB, BuiltInAtomicType.HEX_BINARY);
+ typeMapping.put(DataTypeManager.DefaultDataClasses.VARBINARY, BuiltInAtomicType.HEX_BINARY);
}
private static TeiidRuntimeException EARLY_TERMINATION = new TeiidRuntimeException();
Modified: trunk/engine/src/test/java/org/teiid/query/processor/TestSQLXMLProcessing.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/processor/TestSQLXMLProcessing.java 2012-07-25 19:39:59 UTC (rev 4270)
+++ trunk/engine/src/test/java/org/teiid/query/processor/TestSQLXMLProcessing.java 2012-07-26 14:43:40 UTC (rev 4271)
@@ -38,6 +38,7 @@
import org.junit.Test;
import org.teiid.api.exception.query.ExpressionEvaluationException;
import org.teiid.core.TeiidProcessingException;
+import org.teiid.core.types.BinaryType;
import org.teiid.core.types.BlobImpl;
import org.teiid.core.types.BlobType;
import org.teiid.core.types.DataTypeManager;
@@ -195,6 +196,17 @@
process(sql, expected);
}
+ @Test public void testXmlTableBinary() throws Exception {
+ String sql = "select * from xmltable('/a/b' passing convert('<a xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"><b xsi:type=\"xs:hexBinary\">0FAB</b><b>1F1C</b></a>', xml) columns val varbinary path '/.') as x"; //$NON-NLS-1$
+
+ List<?>[] expected = new List<?>[] {
+ Arrays.asList(new BinaryType(new byte[] {0xf, (byte)0xab})),
+ Arrays.asList(new BinaryType(new byte[] {0x1F, 0x1C})),
+ };
+
+ process(sql, expected);
+ }
+
@Test(expected=TeiidProcessingException.class) public void testXmlTableAsynchError() throws Exception {
String sql = "select * from xmltable('/a/b' passing convert('<a><b>first</b><b x=\"attr\">second</b></a>', xml) columns x blob path '@x', val string path '/.') as x"; //$NON-NLS-1$
12 years, 5 months
teiid SVN: r4270 - in trunk/admin/src: main/java/org/teiid/adminapi/impl and 2 other directories.
by teiid-commits@lists.jboss.org
Author: rareddy
Date: 2012-07-25 15:39:59 -0400 (Wed, 25 Jul 2012)
New Revision: 4270
Added:
trunk/admin/src/main/java/org/teiid/adminapi/Entry.java
trunk/admin/src/main/java/org/teiid/adminapi/impl/EntryMetaData.java
Modified:
trunk/admin/src/main/java/org/teiid/adminapi/VDB.java
trunk/admin/src/main/java/org/teiid/adminapi/impl/VDBMetaData.java
trunk/admin/src/main/java/org/teiid/adminapi/impl/VDBMetadataMapper.java
trunk/admin/src/main/java/org/teiid/adminapi/impl/VDBMetadataParser.java
trunk/admin/src/test/java/org/teiid/adminapi/impl/TestVDBMetaData.java
trunk/admin/src/test/resources/parser-test-vdb.xml
Log:
TEIID-2114: adding entries concept into Teiid proper to support tooling. There is couple times question of adding additional artifacts with dynamic vdb and allowing it deploy as archive, so it should be helpful.
Added: trunk/admin/src/main/java/org/teiid/adminapi/Entry.java
===================================================================
--- trunk/admin/src/main/java/org/teiid/adminapi/Entry.java (rev 0)
+++ trunk/admin/src/main/java/org/teiid/adminapi/Entry.java 2012-07-25 19:39:59 UTC (rev 4270)
@@ -0,0 +1,36 @@
+/*
+ * 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 org.teiid.adminapi;
+
+public interface Entry extends AdminObject {
+ /**
+ * Get Path to the entry
+ * @return
+ */
+ String getPath();
+
+ /**
+ * Description
+ * @return
+ */
+ String getDescription();
+}
Property changes on: trunk/admin/src/main/java/org/teiid/adminapi/Entry.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified: trunk/admin/src/main/java/org/teiid/adminapi/VDB.java
===================================================================
--- trunk/admin/src/main/java/org/teiid/adminapi/VDB.java 2012-07-25 18:29:23 UTC (rev 4269)
+++ trunk/admin/src/main/java/org/teiid/adminapi/VDB.java 2012-07-25 19:39:59 UTC (rev 4270)
@@ -113,4 +113,10 @@
* @return
*/
public List<? extends VDBImport> getVDBImports();
+
+ /**
+ * Get the list of other resources included in the VDB
+ * @return
+ */
+ public List<? extends Entry> getEntries();
}
Added: trunk/admin/src/main/java/org/teiid/adminapi/impl/EntryMetaData.java
===================================================================
--- trunk/admin/src/main/java/org/teiid/adminapi/impl/EntryMetaData.java (rev 0)
+++ trunk/admin/src/main/java/org/teiid/adminapi/impl/EntryMetaData.java 2012-07-25 19:39:59 UTC (rev 4270)
@@ -0,0 +1,49 @@
+/*
+ * 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 org.teiid.adminapi.impl;
+
+import org.teiid.adminapi.Entry;
+
+public class EntryMetaData extends AdminObjectImpl implements Entry {
+ private static final long serialVersionUID = -3602627159192411780L;
+
+ private String path;
+ private String description;
+
+ @Override
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ @Override
+ public String getPath() {
+ return this.path;
+ }
+
+ public void setPath(String path) {
+ this.path = path;
+ }
+}
Property changes on: trunk/admin/src/main/java/org/teiid/adminapi/impl/EntryMetaData.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified: trunk/admin/src/main/java/org/teiid/adminapi/impl/VDBMetaData.java
===================================================================
--- trunk/admin/src/main/java/org/teiid/adminapi/impl/VDBMetaData.java 2012-07-25 18:29:23 UTC (rev 4269)
+++ trunk/admin/src/main/java/org/teiid/adminapi/impl/VDBMetaData.java 2012-07-25 19:39:59 UTC (rev 4270)
@@ -47,6 +47,8 @@
private LinkedHashMap<String, VDBTranslatorMetaData> translators = new LinkedHashMap<String, VDBTranslatorMetaData>();
private LinkedHashMap<String, DataPolicyMetadata> dataPolicies = new LinkedHashMap<String, DataPolicyMetadata>();
private List<VDBImportMetadata> imports = new ArrayList<VDBImportMetadata>(2);
+ private List<EntryMetaData> entries = new ArrayList<EntryMetaData>(2);
+
private int version = 1;
private String description;
private boolean dynamic = false;
@@ -262,4 +264,13 @@
public void setImportedModels(Set<String> importedModels) {
this.importedModels = importedModels;
}
+
+ @Override
+ public List<EntryMetaData> getEntries() {
+ return this.entries;
+ }
+
+ public void setEntries(List<EntryMetaData> entries) {
+ this.entries = entries;
+ }
}
Modified: trunk/admin/src/main/java/org/teiid/adminapi/impl/VDBMetadataMapper.java
===================================================================
--- trunk/admin/src/main/java/org/teiid/adminapi/impl/VDBMetadataMapper.java 2012-07-25 18:29:23 UTC (rev 4269)
+++ trunk/admin/src/main/java/org/teiid/adminapi/impl/VDBMetadataMapper.java 2012-07-25 19:39:59 UTC (rev 4270)
@@ -52,6 +52,7 @@
private static final String DYNAMIC = "dynamic"; //$NON-NLS-1$
private static final String DATA_POLICIES = "data-policies"; //$NON-NLS-1$
private static final String DESCRIPTION = "description"; //$NON-NLS-1$
+ private static final String ENTRIES = "entries"; //$NON-NLS-1$
public static VDBMetadataMapper INSTANCE = new VDBMetadataMapper();
@@ -87,6 +88,15 @@
}
}
+ // ENTRIES
+ List<EntryMetaData> entries = vdb.getEntries();
+ if (entries != null && !entries.isEmpty()) {
+ ModelNode entryNodes = node.get(ENTRIES);
+ for(EntryMetaData entry:entries) {
+ entryNodes.add(EntryMapper.INSTANCE.wrap(entry, new ModelNode()));
+ }
+ }
+
// MODELS
Map<String, ModelMetaData> models = vdb.getModelMetaDatas();
if (models != null && !models.isEmpty()) {
@@ -164,6 +174,17 @@
}
}
+ // ENTRIES
+ if (node.get(ENTRIES).isDefined()) {
+ List<ModelNode> modelNodes = node.get(ENTRIES).asList();
+ for(ModelNode modelNode:modelNodes) {
+ EntryMetaData entry = EntryMapper.INSTANCE.unwrap(modelNode);
+ if (entry != null) {
+ vdb.getEntries().add(entry);
+ }
+ }
+ }
+
// MODELS
if (node.get(MODELS).isDefined()) {
List<ModelNode> modelNodes = node.get(MODELS).asList();
@@ -679,7 +700,76 @@
}
}
+
/**
+ * Entry Mapper
+ */
+ public static class EntryMapper implements MetadataMapper<EntryMetaData>{
+ private static final String PATH = "path"; //$NON-NLS-1$
+
+ public static EntryMapper INSTANCE = new EntryMapper();
+
+ @Override
+ public ModelNode wrap(EntryMetaData obj, ModelNode node) {
+ if (obj == null) {
+ return null;
+ }
+
+ node.get(PATH).set(obj.getPath());
+ if (obj.getDescription() != null) {
+ node.get(DESCRIPTION).set(obj.getDescription());
+ }
+
+ //PROPERTIES
+ Properties properties = obj.getProperties();
+ if (properties!= null && !properties.isEmpty()) {
+ ModelNode propsNode = node.get(PROPERTIES);
+ for (String key:properties.stringPropertyNames()) {
+ propsNode.add(PropertyMetaDataMapper.INSTANCE.wrap(key, properties.getProperty(key), new ModelNode()));
+ }
+ }
+ return node;
+ }
+
+ public EntryMetaData unwrap(ModelNode node) {
+ if (node == null) {
+ return null;
+ }
+
+ EntryMetaData entry = new EntryMetaData();
+ if (node.has(PATH)) {
+ entry.setPath(node.get(PATH).asString());
+ }
+
+ if (node.has(DESCRIPTION)) {
+ entry.setDescription(node.get(DESCRIPTION).asString());
+ }
+
+ //PROPERTIES
+ if (node.get(PROPERTIES).isDefined()) {
+ List<ModelNode> propNodes = node.get(PROPERTIES).asList();
+ for (ModelNode propNode:propNodes) {
+ String[] prop = PropertyMetaDataMapper.INSTANCE.unwrap(propNode);
+ if (prop != null) {
+ entry.addProperty(prop[0], prop[1]);
+ }
+ }
+ }
+ return entry;
+ }
+
+ public ModelNode describe(ModelNode node) {
+ addAttribute(node, PATH, ModelType.STRING, true);
+
+ ModelNode props = node.get(PROPERTIES);
+ props.get(TYPE).set(ModelType.LIST);
+ props.get(DESCRIPTION).set(AdminPlugin.Util.getString(PROPERTIES+DOT_DESC));
+ PropertyMetaDataMapper.INSTANCE.describe(props.get(VALUE_TYPE));
+ return node;
+ }
+ }
+
+ /**
* DataPolicy Metadata mapper
*/
public static class DataPolicyMetadataMapper implements MetadataMapper<DataPolicyMetadata>{
Modified: trunk/admin/src/main/java/org/teiid/adminapi/impl/VDBMetadataParser.java
===================================================================
--- trunk/admin/src/main/java/org/teiid/adminapi/impl/VDBMetadataParser.java 2012-07-25 18:29:23 UTC (rev 4269)
+++ trunk/admin/src/main/java/org/teiid/adminapi/impl/VDBMetadataParser.java 2012-07-25 19:39:59 UTC (rev 4270)
@@ -132,7 +132,9 @@
ignoreTillEnd(reader);
break;
case ENTRY:
- // this is designer specific.
+ EntryMetaData entry = new EntryMetaData();
+ parseEntry(reader, entry);
+ vdb.getEntries().add(entry);
break;
default:
throw new XMLStreamException(AdminPlugin.Util.gs("unexpected_element5",reader.getName(),
@@ -256,6 +258,26 @@
}
}
}
+
+ private static void parseEntry(XMLStreamReader reader, EntryMetaData entry) throws XMLStreamException {
+ Properties props = getAttributes(reader);
+ entry.setPath(props.getProperty(Element.PATH.getLocalName()));
+ while (reader.hasNext() && (reader.nextTag() != XMLStreamConstants.END_ELEMENT)) {
+ Element element = Element.forName(reader.getLocalName());
+ switch (element) {
+ case DESCRIPTION:
+ entry.setDescription(reader.getElementText());
+ break;
+ case PROPERTY:
+ parseProperty(reader, entry);
+ break;
+ default:
+ throw new XMLStreamException(AdminPlugin.Util.gs("unexpected_element2",reader.getName(),
+ Element.DESCRIPTION.getLocalName(),
+ Element.PROPERTY.getLocalName()));
+ }
+ }
+ }
private static void parseModel(XMLStreamReader reader, ModelMetaData model) throws XMLStreamException {
Properties props = getAttributes(reader);
@@ -428,6 +450,15 @@
// entry
// designer only
+ for (EntryMetaData em:vdb.getEntries()) {
+ writer.writeStartElement(Element.ENTRY.getLocalName());
+ writeAttribute(writer, Element.PATH.getLocalName(), em.getPath());
+ if (em.getDescription() != null) {
+ writeElement(writer, Element.DESCRIPTION, em.getDescription());
+ }
+ writeProperties(writer, em.getProperties());
+ writer.writeEndElement();
+ }
writer.writeEndElement();
writer.writeEndDocument();
Modified: trunk/admin/src/test/java/org/teiid/adminapi/impl/TestVDBMetaData.java
===================================================================
--- trunk/admin/src/test/java/org/teiid/adminapi/impl/TestVDBMetaData.java 2012-07-25 18:29:23 UTC (rev 4269)
+++ trunk/admin/src/test/java/org/teiid/adminapi/impl/TestVDBMetaData.java 2012-07-25 19:39:59 UTC (rev 4270)
@@ -194,6 +194,16 @@
roleOne.setMappedRoleNames(Arrays.asList("ROLE1", "ROLE2")); //$NON-NLS-1$ //$NON-NLS-2$
vdb.addDataPolicy(roleOne);
+
+ EntryMetaData em = new EntryMetaData();
+ em.setPath("/path-one");
+ em.setDescription("entry one");
+ em.addProperty("entryone", "1");
+ vdb.getEntries().add(em);
+
+ EntryMetaData em2 = new EntryMetaData();
+ em2.setPath("/path-two");
+ vdb.getEntries().add(em2);
return vdb;
}
Modified: trunk/admin/src/test/resources/parser-test-vdb.xml
===================================================================
--- trunk/admin/src/test/resources/parser-test-vdb.xml 2012-07-25 18:29:23 UTC (rev 4269)
+++ trunk/admin/src/test/resources/parser-test-vdb.xml 2012-07-25 19:39:59 UTC (rev 4270)
@@ -36,5 +36,10 @@
<mapped-role-name>ROLE1</mapped-role-name>
<mapped-role-name>ROLE2</mapped-role-name>
</data-role>
+ <entry path="/path-one">
+ <description>path one description</description>
+ <property name="entryone" value="1"></property>
+ </entry>
+ <entry path="/path-two"/>
</vdb>
12 years, 5 months
teiid SVN: r4269 - in trunk/engine/src: test/java/org/teiid/query/processor and 1 other directory.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2012-07-25 14:29:23 -0400 (Wed, 25 Jul 2012)
New Revision: 4269
Modified:
trunk/engine/src/main/java/org/teiid/query/processor/relational/XMLTableNode.java
trunk/engine/src/test/java/org/teiid/query/processor/TestSQLXMLProcessing.java
Log:
TEIID-2098 fixing a regression with streaming error handling
Modified: trunk/engine/src/main/java/org/teiid/query/processor/relational/XMLTableNode.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/processor/relational/XMLTableNode.java 2012-07-25 17:31:41 UTC (rev 4268)
+++ trunk/engine/src/main/java/org/teiid/query/processor/relational/XMLTableNode.java 2012-07-25 18:29:23 UTC (rev 4269)
@@ -233,7 +233,7 @@
asynchException = new TeiidRuntimeException(e);
} finally {
synchronized (XMLTableNode.this) {
- if (buffer != null) {
+ if (buffer != null && asynchException == null) {
try {
buffer.close();
} catch (TeiidComponentException e) {
Modified: trunk/engine/src/test/java/org/teiid/query/processor/TestSQLXMLProcessing.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/processor/TestSQLXMLProcessing.java 2012-07-25 17:31:41 UTC (rev 4268)
+++ trunk/engine/src/test/java/org/teiid/query/processor/TestSQLXMLProcessing.java 2012-07-25 18:29:23 UTC (rev 4269)
@@ -37,6 +37,7 @@
import org.junit.BeforeClass;
import org.junit.Test;
import org.teiid.api.exception.query.ExpressionEvaluationException;
+import org.teiid.core.TeiidProcessingException;
import org.teiid.core.types.BlobImpl;
import org.teiid.core.types.BlobType;
import org.teiid.core.types.DataTypeManager;
@@ -194,6 +195,12 @@
process(sql, expected);
}
+ @Test(expected=TeiidProcessingException.class) public void testXmlTableAsynchError() throws Exception {
+ String sql = "select * from xmltable('/a/b' passing convert('<a><b>first</b><b x=\"attr\">second</b></a>', xml) columns x blob path '@x', val string path '/.') as x"; //$NON-NLS-1$
+
+ process(sql, null);
+ }
+
@Test public void testXmlTableDateTime() throws Exception {
String sql = "select * from xmltable('/a' passing convert('<a dt=\"2011-11-17T07:38:49\" dtz=\"2011-11-17T07:38:49Z\" t=\"13:23:14\" d=\"2010-04-05\" />', xml) columns x timestamp path '@dt', x1 timestamp path '@dtz', y date path '@d', z time path '@t') as x"; //$NON-NLS-1$
12 years, 5 months
teiid SVN: r4268 - trunk/build.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2012-07-25 13:31:41 -0400 (Wed, 25 Jul 2012)
New Revision: 4268
Modified:
trunk/build/pom.xml
Log:
applying a product change forward
Modified: trunk/build/pom.xml
===================================================================
--- trunk/build/pom.xml 2012-07-25 13:11:25 UTC (rev 4267)
+++ trunk/build/pom.xml 2012-07-25 17:31:41 UTC (rev 4268)
@@ -108,6 +108,28 @@
</executions>
</plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>build-helper-maven-plugin</artifactId>
+ <version>1.5</version>
+ <executions>
+ <execution>
+ <phase>package</phase>
+ <goals>
+ <goal>attach-artifact</goal>
+ </goals>
+ <configuration>
+ <artifacts>
+ <artifact>
+ <file>target/teiid-${project.version}-client-jdk15.jar</file>
+ <type>jar</type>
+ <classifier>client-jdk15</classifier>
+ </artifact>
+ </artifacts>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
</plugins>
</build>
12 years, 5 months
teiid SVN: r4267 - in trunk/engine/src: main/resources/org/teiid/query and 1 other directories.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2012-07-25 09:11:25 -0400 (Wed, 25 Jul 2012)
New Revision: 4267
Modified:
trunk/engine/src/main/javacc/org/teiid/query/parser/SQLParser.jj
trunk/engine/src/main/resources/org/teiid/query/i18n.properties
trunk/engine/src/test/java/org/teiid/query/parser/TestParser.java
Log:
TEIID-2113 parser change to facilitate better docs
Modified: trunk/engine/src/main/javacc/org/teiid/query/parser/SQLParser.jj
===================================================================
--- trunk/engine/src/main/javacc/org/teiid/query/parser/SQLParser.jj 2012-07-24 21:01:05 UTC (rev 4266)
+++ trunk/engine/src/main/javacc/org/teiid/query/parser/SQLParser.jj 2012-07-25 13:11:25 UTC (rev 4267)
@@ -382,6 +382,77 @@
| <IMPORT: "import">
}
+TOKEN : /* NonReserved words */
+{
+ <INSTEAD: "instead">
+| <ENABLED: "enabled">
+| <DISABLED: "disabled">
+| <VIEW: "view">
+| <KEY: "key">
+| <SERIAL: "serial">
+| <TEXTAGG: "textagg">
+| <COUNT: "count">
+| <ROW_NUMBER: "row_number">
+| <RANK: "rank">
+| <DENSE_RANK: "dense_rank">
+| <SUM: "sum">
+| <AVG: "avg">
+| <MIN: "min">
+| <MAX: "max">
+| <EVERY: "every">
+| <STDDEV_POP: "stddev_pop">
+| <STDDEV_SAMP: "stddev_samp">
+| <VAR_SAMP: "var_samp">
+| <VAR_POP: "var_pop">
+| <DOCUMENT: "document">
+| <CONTENT: "content">
+| <TRIM: "trim">
+| <EMPTY: "empty">
+| <ORDINALITY: "ordinality">
+| <PATH: "path">
+| <FIRST: "first">
+| <LAST: "last">
+| <NEXT: "next">
+| <FN: "fn">
+| <SUBSTRING: "substring">
+| <EXTRACT: "extract">
+| <TO_CHARS: "to_chars">
+| <TO_BYTES: "to_bytes">
+| <TIMESTAMPADD: "timestampadd">
+| <TIMESTAMPDIFF: "timestampdiff">
+| <QUERYSTRING: "querystring">
+| <NAMESPACE: "namespace">
+| <RESULT: "result">
+| <INDEX: "index">
+| <ACCESSPATTERN: "accesspattern">
+| <AUTO_INCREMENT: "auto_increment">
+| <WELLFORMED: "wellformed">
+| <SQL_TSI_FRAC_SECOND: "sql_tsi_frac_second">
+| <SQL_TSI_SECOND: "sql_tsi_second">
+| <SQL_TSI_MINUTE: "sql_tsi_minute">
+| <SQL_TSI_HOUR: "sql_tsi_hour">
+| <SQL_TSI_DAY: "sql_tsi_day">
+| <SQL_TSI_WEEK: "sql_tsi_week">
+| <SQL_TSI_MONTH: "sql_tsi_month">
+| <SQL_TSI_QUARTER: "sql_tsi_quarter">
+| <SQL_TSI_YEAR: "sql_tsi_year">
+| <TEXTTABLE: "texttable">
+| <ARRAYTABLE: "arraytable">
+| <SELECTOR: "selector">
+| <SKIP_KEYWORD: "skip">
+| <WIDTH: "width">
+| <PASSING: "passing">
+| <NAME: "name">
+| <ENCODING: "encoding">
+| <OJ: "oj">
+| <COLUMNS: "columns">
+| <DELIMITER: "delimiter">
+| <QUOTE: "quote">
+| <HEADER: "header">
+| <NULLS: "nulls">
+
+}
+
TOKEN : /* User variables and literals */
{
< ALL_IN_GROUP: <ID> <PERIOD> <STAR> >
@@ -434,7 +505,6 @@
| <CONCAT_OP: "||">
}
-
//----------------------------------------------------
//----------------------------------------------------
@@ -449,14 +519,23 @@
}
}
+Token nonReserved() :
+{
+}
+{
+ (<INSTEAD>|<VIEW>|<ENABLED>|<DISABLED>|<KEY>|<SERIAL>|<TEXTAGG>|<COUNT>|<ROW_NUMBER>|<RANK>|<DENSE_RANK>|<SUM>|<AVG>|<MIN>|<MAX>|<EVERY>|<STDDEV_POP>|<STDDEV_SAMP>|<VAR_SAMP>|<VAR_POP>|<DOCUMENT>|<CONTENT>|<TRIM>|<EMPTY>|<ORDINALITY>|<PATH>|<FIRST>|<LAST>|<NEXT>|<FN>|<SUBSTRING>|<EXTRACT>|<TO_CHARS>|<TO_BYTES>|<TIMESTAMPADD>|<TIMESTAMPDIFF>|<QUERYSTRING>|<NAMESPACE>|<RESULT>|<INDEX>|<ACCESSPATTERN>|<AUTO_INCREMENT>|<WELLFORMED>|<SQL_TSI_FRAC_SECOND>|<SQL_TSI_SECOND>|<SQL_TSI_MINUTE>|<SQL_TSI_HOUR>|<SQL_TSI_DAY>|<SQL_TSI_WEEK>|<SQL_TSI_MONTH>|<SQL_TSI_QUARTER>|<SQL_TSI_YEAR>|<TEXTTABLE>|<ARRAYTABLE>|<SELECTOR>|<SKIP_KEYWORD>|<WIDTH>|<PASSING>|<NAME>|<ENCODING>|<OJ>|<COLUMNS>|<DELIMITER>|<QUOTE>|<HEADER>|<NULLS>)
+ {
+ return getToken(0);
+ }
+}
+
String id() :
{
- Token t = null;
}
{
- (t = <ID>)
+ (<ID>|nonReserved())
{
- return normalizeId(t.image);
+ return normalizeId(getToken(0).image);
}
}
@@ -506,7 +585,7 @@
}
{
- <CREATE> <TRIGGER> <ON> target = id() nonReserved("INSTEAD") <OF>
+ <CREATE> <TRIGGER> <ON> target = id() <INSTEAD> <OF>
(event = <INSERT> | event = <UPDATE> | event = <DELETE>)
<AS> triggerAction = forEachRowTriggerAction(info)
{
@@ -527,12 +606,12 @@
TriggerAction triggerAction = null;
Token comment = null;
Token event = null;
- String enabled = null;
+ Boolean enabled = null;
}
{
<ALTER>
(
- (nonReserved("VIEW") target = id() <AS> { comment = getToken(1).specialToken; } command = queryExpression(info))
+ (<VIEW> target = id() <AS> { comment = getToken(1).specialToken; } command = queryExpression(info))
{
if (comment != null) {
command.setCacheHint(getQueryCacheOption(comment.image));
@@ -553,17 +632,17 @@
alterProc.setDefinition(cup);
return alterProc;
}
- | (<TRIGGER> <ON> target = id() nonReserved("INSTEAD") <OF>
+ | (<TRIGGER> <ON> target = id() <INSTEAD> <OF>
(event = <INSERT> | event = <UPDATE> | event = <DELETE>)
((<AS> triggerAction = forEachRowTriggerAction(info))
- |enabled = nonReserved("ENABLED","DISABLED")))
+ |<ENABLED> {enabled=true;}| <DISABLED> {enabled=false;}))
{
AlterTrigger alterTrigger = new AlterTrigger();
alterTrigger.setTarget(new GroupSymbol(target));
alterTrigger.setDefinition(triggerAction);
alterTrigger.setEvent(Table.TriggerEvent.valueOf(event.image.toUpperCase()));
if (enabled != null) {
- alterTrigger.setEnabled(enabled.equalsIgnoreCase("ENABLED"));
+ alterTrigger.setEnabled(enabled);
}
return alterTrigger;
}
@@ -687,7 +766,7 @@
create.getColumns().add(col);
}
)*
- [<COMMA> <PRIMARY> nonReserved("KEY") <LPAREN>
+ [<COMMA> <PRIMARY> <KEY> <LPAREN>
pkId = id()
{
create.getPrimaryKey().add(new ElementSymbol(validateElementName(pkId)));
@@ -717,7 +796,7 @@
(
type = parseDataType()
|
- nonReserved("SERIAL")
+ <SERIAL>
{
type = new ParsedDataType("INTEGER");
autoIncrement = true;
@@ -944,7 +1023,7 @@
{
variableID = new ElementSymbol(var);
}
- [(nonReserved(":=")|<EQ>)
+ [[<COLON>]<EQ>
value = assignStatementOperand(info)
]
@@ -974,7 +1053,7 @@
{
elementID = new ElementSymbol(var);
}
- (nonReserved(":=")|<EQ>)
+ [<COLON>]<EQ>
value = assignStatementOperand(info)
{
@@ -1037,7 +1116,7 @@
storedProcedure.setParameter(parameter);
storedProcedure.setCalledWithReturn(true);
}
- (nonReserved(":=")|<EQ>)
+ [<COLON>]<EQ>
cmd = storedProcedure(info, storedProcedure)
)
)
@@ -1272,7 +1351,7 @@
<LPAREN>
(
- LOOKAHEAD(<ID> <EQ>)
+ LOOKAHEAD(2)
storedProcedure = executeNamedParams(info, storedProcedure)
|
storedProcedure = executeUnnamedParams(info, storedProcedure, storedProcedure.getParameters().size() + 1)
@@ -1383,7 +1462,7 @@
<INSERT> <INTO>
group = id()
- [LOOKAHEAD(<LPAREN><ID>) columns = columnList(false) {
+ [LOOKAHEAD(<LPAREN> id()) columns = columnList(false) {
insert.setVariables(columns);
}]
@@ -1815,7 +1894,6 @@
Token t = null;
Expression expression = null;
OrderBy orderBy = null;
- Expression condition = null;
}
{
(t=<XMLAGG>|t=<ARRAY_AGG>)
@@ -1823,12 +1901,10 @@
expression = expression(info)
[ orderBy = orderby(info) ]
<RPAREN>
- condition = filterClause(info)
{
String aggName = t.image.toUpperCase();
AggregateSymbol agg = new AggregateSymbol(aggName, false, expression);
agg.setOrderBy(orderBy);
- agg.setCondition(condition);
return agg;
}
}
@@ -1842,11 +1918,10 @@
List<DerivedColumn> expressions = new ArrayList<DerivedColumn>();
OrderBy orderBy = null;
String encoding = null;
- Expression condition = null;
}
{
- nonReserved("TEXTAGG") <LPAREN>
- <FOR> expression = derivedColumn(info)
+ <TEXTAGG> <LPAREN>
+ [<FOR>] expression = derivedColumn(info)
{
expressions.add(expression);
}
@@ -1857,26 +1932,25 @@
}
)*
[
- LOOKAHEAD(<ID>, { "delimiter".equalsIgnoreCase(getToken(1).image) }) <ID>
+ <DELIMITER>
delimiter = charVal(info, "DELMITER")
]
[
- LOOKAHEAD(<ID>, { "quote".equalsIgnoreCase(getToken(1).image) })
- ( <ID> quote = charVal(info, "QUOTE") )
+ <QUOTE>
+ quote = charVal(info, "QUOTE")
]
[
- LOOKAHEAD(<ID>, { "header".equalsIgnoreCase(getToken(1).image) }) <ID>
+ <HEADER>
{ header = true; }
]
[
- LOOKAHEAD(<ID>, { "encoding".equalsIgnoreCase(getToken(1).image) })
- ( <ID> encoding = id() )
+ <ENCODING>
+ encoding = id()
]
[
orderBy = orderby(info)
]
<RPAREN>
- condition = filterClause(info)
{
TextLine tf = new TextLine();
tf.setDelimiter(delimiter);
@@ -1886,64 +1960,66 @@
tf.setEncoding(encoding);
AggregateSymbol agg = new AggregateSymbol("TEXTAGG", false, tf);
agg.setOrderBy(orderBy);
- agg.setCondition(condition);
return agg;
}
}
AggregateSymbol aggregateSymbol(ParseInfo info) :
{
- String func = null;
+ Token func = null;
Token starToken = null;
AggregateSymbol agg = null;
boolean isDistinct = false;
Expression expression = null;
- Expression condition = null;
}
{
(
// COUNT(*)
- (LOOKAHEAD(3) (
- func = nonReserved("COUNT")
+ LOOKAHEAD(3) (func = <COUNT>
<LPAREN>
starToken = <STAR>
- <RPAREN> ) |
- LOOKAHEAD(<ID>, {matchesAny(getToken(1).image, "rank", "dense_rank", "row_number") != null}) (func = nonReserved("row_number", "rank", "dense_rank", "percent_rank", "cume_dist")
- <LPAREN> <RPAREN>) |
+ <RPAREN> )
+ |
// Remaining aggregates
- ( (func = nonReserved("COUNT", "SUM", "AVG", "MIN", "MAX", "EVERY", "STDDEV_POP", "STDDEV_SAMP", "VAR_SAMP", "VAR_POP")
- |
- <ANY> { func = "ANY"; }
- |
- <SOME> { func = "SOME"; }
- )
+ ( (<COUNT> | <SUM> | <AVG> | <MIN> | <MAX> | <EVERY> | <STDDEV_POP> | <STDDEV_SAMP> | <VAR_SAMP> | <VAR_POP> | <SOME> | <ANY>) {func = getToken(0);}
<LPAREN>
[ <DISTINCT> {isDistinct=true;} | <ALL>]
expression = expression(info)
<RPAREN>
- ))
- condition = filterClause(info)
+ )
)
{
- func = func.toUpperCase();
+ String name = func.image.toUpperCase();
if(starToken == null) {
// Aggregate
- agg = new AggregateSymbol(func, isDistinct, expression);
+ agg = new AggregateSymbol(name, isDistinct, expression);
} else {
// COUNT(*)
- agg = new AggregateSymbol(func, false, null);
+ agg = new AggregateSymbol(name, false, null);
}
- agg.setCondition(condition);
return agg;
}
}
+AggregateSymbol analyticAggregateSymbol(ParseInfo info) :
+{
+ Token func = null;
+}
+{
+ (<ROW_NUMBER> | <RANK> | <DENSE_RANK>) {func = getToken(0);}
+ <LPAREN> <RPAREN>
+ {
+ return new AggregateSymbol(func.image.toUpperCase(), false, null);
+ }
+}
+
+
Expression filterClause(ParseInfo info) :
{
Expression condition = null;
}
{
- [ <FILTER> <LPAREN> <WHERE> condition = booleanPrimary(info) <RPAREN> ]
+ <FILTER> <LPAREN> <WHERE> condition = booleanPrimary(info) <RPAREN>
{
return condition;
}
@@ -1998,7 +2074,7 @@
{
(
(
- <LBRACE> nonReserved("OJ")
+ <LBRACE> <OJ>
result=joinedTable(info)
<RBRACE>
)
@@ -2074,9 +2150,9 @@
Token lparen = null;
}
{
- ( LOOKAHEAD(<ID> <LPAREN>, { "texttable".equalsIgnoreCase(getToken(1).image) }) clause = textTable(info)
+ ( LOOKAHEAD(2) clause = textTable(info)
|
- LOOKAHEAD(<ID> <LPAREN>, { "arraytable".equalsIgnoreCase(getToken(1).image) }) clause = arrayTable(info)
+ LOOKAHEAD(2) clause = arrayTable(info)
|
clause = xmlTable(info)
|
@@ -2102,12 +2178,12 @@
XMLSerialize xmlSerialize(ParseInfo info) :
{
Expression expr = null;
- String doc = null;
+ Boolean doc = null;
Token t = null;
}
{
<XMLSERIALIZE> <LPAREN>
- [LOOKAHEAD(<ID>, {matchesAny(getToken(1).image, "document", "content") != null}) doc = nonReserved("DOCUMENT", "CONTENT")]
+ [LOOKAHEAD(1) (<DOCUMENT> {doc = true;}| <CONTENT> {doc = false;})]
expr = expression(info)
[
<AS> (t = <STRING> | t = <VARCHAR> | t = <CLOB>)
@@ -2117,7 +2193,7 @@
XMLSerialize result = new XMLSerialize();
result.setExpression(expr);
if (doc != null) {
- result.setDocument("document".equalsIgnoreCase(doc));
+ result.setDocument(doc);
}
if (t != null) {
result.setTypeString(t.image);
@@ -2126,21 +2202,6 @@
}
}
-String nonReserved(String... expected) :
-{
- Token t = null;
-}
-{
- t = <ID>
- {
- String result = matchesAny(t.image, expected);
- if (result != null) {
- return result;
- }
- throw new ParseException(QueryPlugin.Util.getString("SQLParser.expected_non_reserved", Arrays.toString(expected), t.image));
- }
-}
-
ArrayTable arrayTable(ParseInfo info) :
{
Expression array = null;
@@ -2148,8 +2209,8 @@
String aliasID = null;
}
{
- <ID> <LPAREN> array = expression(info)
- nonReserved("COLUMNS")
+ <ARRAYTABLE> <LPAREN> array = valueExpressionPrimary(info)
+ <COLUMNS>
columns = createElementsWithTypes(info)
<RPAREN>
[<AS>] aliasID=id()
@@ -2177,12 +2238,12 @@
String aliasID = null;
}
{
- <ID> <LPAREN> file = expression(info)
+ <TEXTTABLE> <LPAREN> file = commonValueExpression(info)
[
- LOOKAHEAD(<ID>, { "selector".equalsIgnoreCase(getToken(1).image) }) <ID>
+ <SELECTOR>
selector = stringVal()
]
- nonReserved("COLUMNS")
+ <COLUMNS>
column = textColumn(info)
{
columns.add(column);
@@ -2194,23 +2255,22 @@
}
)*
[
- <NO> <ROW> nonReserved("DELIMITER")
+ <NO> <ROW> <DELIMITER>
{
useRowDelimiter = false;
}
]
[
- LOOKAHEAD(<ID>, { "delimiter".equalsIgnoreCase(getToken(1).image) }) <ID>
+ <DELIMITER>
delimiter = charVal(info, "DELMITER")
]
[
(<ESCAPE> quote = charVal(info, "ESCAPE") ) { escape = true; }
|
- LOOKAHEAD(<ID>, { "quote".equalsIgnoreCase(getToken(1).image) })
- ( <ID> quote = charVal(info, "QUOTE") )
+ (<QUOTE> quote = charVal(info, "QUOTE") )
]
[
- LOOKAHEAD(<ID>, { "header".equalsIgnoreCase(getToken(1).image) }) <ID>
+ <HEADER>
[
header = intVal()
]
@@ -2221,7 +2281,7 @@
}
]
[
- LOOKAHEAD(<ID>, { "skip".equalsIgnoreCase(getToken(1).image) }) <ID>
+ <SKIP_KEYWORD>
skip = intVal()
]
<RPAREN>
@@ -2255,17 +2315,17 @@
name = id()
datatype = dataType()
[
- LOOKAHEAD(<ID>, { "width".equalsIgnoreCase(getToken(1).image) }) <ID>
+ <WIDTH>
width = intVal()
[ LOOKAHEAD(2)
- <NO> nonReserved("TRIM")
+ <NO> <TRIM>
{
noTrim = true;
}
]
]
[
- LOOKAHEAD(<ID>, { "selector".equalsIgnoreCase(getToken(1).image) }) <ID>
+ <SELECTOR>
selector = stringVal()
position = intVal()
]
@@ -2291,7 +2351,7 @@
[ xmlNamespaces = xmlNamespaces(info) <COMMA> ]
xquery = stringVal()
[
- LOOKAHEAD(<ID>, { "passing".equalsIgnoreCase(getToken(1).image) }) <ID>
+ <PASSING>
passing = derivedColumn(info)
{
passingValues.add(passing);
@@ -2316,9 +2376,9 @@
[
(<NULL> { empty = false; }
|
- nonReserved("EMPTY") { empty = true; }
+ <EMPTY> { empty = true; }
)
- <ON> nonReserved("EMPTY")
+ <ON> <EMPTY>
]
<RPAREN>
{
@@ -2346,7 +2406,7 @@
[ xmlNamespaces = xmlNamespaces(info) <COMMA> ]
xquery = stringVal()
[
- LOOKAHEAD(<ID>, { "passing".equalsIgnoreCase(getToken(1).image) }) <ID>
+ <PASSING>
passing = derivedColumn(info)
{
passingValues.add(passing);
@@ -2362,7 +2422,7 @@
]
[
- LOOKAHEAD(<ID>, { "columns".equalsIgnoreCase(getToken(1).image) }) <ID>
+ <COLUMNS>
column = xmlColumn(info)
{
columns.add(column);
@@ -2398,7 +2458,7 @@
name = id()
((
- <FOR> nonReserved("ORDINALITY")
+ <FOR> <ORDINALITY>
{
return new XMLTable.XMLColumn(name);
}
@@ -2408,7 +2468,7 @@
<DEFAULT_KEYWORD> defaultExpr = expression(info)
]
[
- nonReserved("PATH") path = stringVal()
+ <PATH> path = stringVal()
]
{
return new XMLTable.XMLColumn(name, (String)datatype.getValue(), path, defaultExpr);
@@ -2471,20 +2531,21 @@
UnaryFromClause unaryFromClause(ParseInfo info) :
{
GroupSymbol group = null;
- Token groupID = null;
+ String groupID = null;
+ Token groupToken = null;
String aliasID = null;
UnaryFromClause clause = null;
}
{
- (groupID=<ID> [[<AS>] aliasID=id()])
+ (groupID=id() {groupToken = getToken(0);} [[<AS>] aliasID=id()])
{
if(aliasID != null) {
- group = new GroupSymbol(validateAlias(aliasID), normalizeId(groupID.image));
+ group = new GroupSymbol(validateAlias(aliasID), groupID);
} else {
- group = new GroupSymbol(normalizeId(groupID.image));
+ group = new GroupSymbol(groupID);
}
clause = new UnaryFromClause(group);
- setFromClauseOptions(groupID, clause);
+ setFromClauseOptions(groupToken, clause);
return clause;
}
}
@@ -2531,16 +2592,17 @@
*/
Criteria compoundCritOr(ParseInfo info) :
{
- ArrayList logicList = new ArrayList(2);
+ ArrayList logicList = null;
Criteria logicPart = null;
+ Criteria logicPart1 = null;
}
{
- logicPart=compoundCritAnd(info) { logicList.add(logicPart); }
- (<OR> logicPart=compoundCritAnd(info) { logicList.add(logicPart); } )*
+ logicPart=compoundCritAnd(info)
+ (<OR> logicPart1=compoundCritAnd(info) { if (logicList == null) { logicList = new ArrayList(2); logicList.add(logicPart); } logicList.add(logicPart1); } )*
{
- if(logicList.size() == 1) {
- return (Criteria) logicList.get(0);
+ if(logicList == null) {
+ return logicPart;
} else {
return new CompoundCriteria(CompoundCriteria.OR,logicList);
}
@@ -2554,16 +2616,17 @@
*/
Criteria compoundCritAnd(ParseInfo info) :
{
- ArrayList logicList = new ArrayList(2);
+ ArrayList logicList = null;
Criteria logicPart = null;
+ Criteria logicPart1 = null;
}
{
- logicPart=notCrit(info) { logicList.add(logicPart); }
- (<AND> logicPart=notCrit(info) { logicList.add(logicPart); } )*
+ logicPart=notCrit(info)
+ (<AND> logicPart1=notCrit(info) { if (logicList == null) { logicList = new ArrayList(2); logicList.add(logicPart); } logicList.add(logicPart1); } )*
{
- if(logicList.size() == 1) {
- return (Criteria) logicList.get(0);
+ if(logicList == null) {
+ return logicPart;
} else {
return new CompoundCriteria(CompoundCriteria.AND,logicList);
}
@@ -2992,16 +3055,16 @@
{
Expression ex = null;
boolean ascending = true;
- String nullOrdering = null;
+ org.teiid.language.SortSpecification.NullOrdering nullOrdering = null;
}
{
ex=sortKey(info)
[<ASC> | <DESC> {ascending=false;}]
- [nonReserved("NULLS") nullOrdering = nonReserved("FIRST", "LAST")]
+ [<NULLS> (<FIRST> {nullOrdering=org.teiid.language.SortSpecification.NullOrdering.FIRST;} | <LAST> {nullOrdering=org.teiid.language.SortSpecification.NullOrdering.LAST;})]
{
OrderByItem item = new OrderByItem(ex, ascending);
if (nullOrdering != null) {
- item.setNullOrdering(org.teiid.language.SortSpecification.NullOrdering.valueOf(nullOrdering.toUpperCase()));
+ item.setNullOrdering(nullOrdering);
}
return item;
}
@@ -3082,7 +3145,7 @@
Expression limit = null;
}
{
- <FETCH> nonReserved("FIRST", "NEXT") [limit = intParam(info)] (<ROW>|<ROWS>) <ONLY>
+ <FETCH> (<FIRST> | <NEXT>) [limit = intParam(info)] (<ROW>|<ROWS>) <ONLY>
{
if (limit == null) {
return new Constant(1, DataTypeManager.DefaultDataClasses.INTEGER);
@@ -3297,6 +3360,7 @@
Constant literal = null;
QueryCommand subquery = null;
Integer arrayIndex = null;
+ Expression condition = null;
}
{
(
@@ -3309,37 +3373,27 @@
literal=literal()
|
// Escaped function
- ( <LBRACE> nonReserved("FN")
+ ( <LBRACE> <FN>
expression=function(info)
<RBRACE>
)
- |
- LOOKAHEAD(<ID> <LPAREN>, {matchesAny(getToken(1).image, "textagg") != null})
- (expression=textAgg(info) [expression = windowSpecification(expression, info)])
|
// Aggregate function
- LOOKAHEAD(<ID> <LPAREN>, {matchesAny(getToken(1).image, "count", "min", "max", "sum", "avg", "every", "STDDEV_POP", "STDDEV_SAMP", "VAR_SAMP", "VAR_POP") != null})
- (expression=aggregateSymbol(info) [expression = windowSpecification(expression, info)])
+ LOOKAHEAD(2) ((expression=textAgg(info) | expression=aggregateSymbol(info) | expression=orderedAgg(info)) [condition = filterClause(info)] [expression = windowSpecification(expression, info)])
|
- LOOKAHEAD(<ANY>|<SOME>) (expression=aggregateSymbol(info) [expression = windowSpecification(expression, info)])
+ LOOKAHEAD(2) (expression=analyticAggregateSymbol(info) [condition = filterClause(info)] expression = windowSpecification(expression, info))
|
- expression=orderedAgg(info) [expression = windowSpecification(expression, info)]
- |
- LOOKAHEAD(<ID> <LPAREN>, {matchesAny(getToken(1).image, "rank", "dense_rank", "row_number") != null})
- (expression=aggregateSymbol(info) expression = windowSpecification(expression, info))
- |
// Function
LOOKAHEAD(2) (expression=function(info) [expression = windowSpecification(expression, info)])
|
// ElementSymbol
- (symbol=<ID>
- {
+ ((symbol=<ID> {
String symbolImage = symbol.image;
if(isStringLiteral(symbolImage, info)) {
literal = new Constant(normalizeStringLiteral(symbolImage));
symbol = null;
}
- }
+ } | symbol=nonReserved())
(<LSBRACE> arrayIndex = intVal() <RSBRACE>)?
)
|
@@ -3371,6 +3425,9 @@
} else if (subquery != null){
expression = new ScalarSubquery(subquery);
}
+ if (condition != null) {
+ ((AggregateSymbol)expression).setCondition(condition);
+ }
if (arrayIndex != null) {
expression = new Function("array_get", new Expression[] {expression, new Constant(arrayIndex)});
}
@@ -3517,8 +3574,8 @@
<RPAREN>
)
|
- LOOKAHEAD(2, {getToken(1).image.equalsIgnoreCase("SUBSTRING")}) (
- funcName = nonReserved("SUBSTRING")
+ LOOKAHEAD(2) (
+ funcToken = <SUBSTRING>
<LPAREN>
expression = expression(info)
{
@@ -3536,8 +3593,8 @@
<RPAREN>
)
|
- LOOKAHEAD(2, {getToken(1).image.equalsIgnoreCase("EXTRACT")}) (
- nonReserved("EXTRACT")
+ LOOKAHEAD(2) (
+ funcToken = <EXTRACT>
<LPAREN>
(funcToken = <YEAR> |
funcToken = <MONTH> |
@@ -3555,10 +3612,10 @@
<RPAREN>
)
|
- LOOKAHEAD(2, {getToken(1).image.equalsIgnoreCase("TRIM")}) (
- funcName= nonReserved("TRIM")
+ LOOKAHEAD(2) (
+ funcToken = <TRIM>
<LPAREN>
- { funcToken = null; expression = null;}
+ { funcName = funcToken.image; funcToken = null; expression = null;}
[
LOOKAHEAD(2) (((funcToken = <LEADING>|
funcToken = <TRAILING>|
@@ -3593,8 +3650,8 @@
<RPAREN>
)
|
- LOOKAHEAD(<ID>, {matchesAny(getToken(1).image, "to_chars", "to_bytes") != null}) (
- funcName = nonReserved("TO_CHARS", "TO_BYTES")
+ LOOKAHEAD(2) (
+ (funcToken = <TO_CHARS> | funcToken = <TO_BYTES>)
<LPAREN>
expression = expression(info)
{
@@ -3608,8 +3665,8 @@
<RPAREN>
)
|
- LOOKAHEAD(<ID>, {matchesAny(getToken(1).image, "timestampadd", "timestampdiff") != null}) (
- funcName = nonReserved("TIMESTAMPADD", "TIMESTAMPDIFF")
+ LOOKAHEAD(2) (
+ (funcToken = <TIMESTAMPADD> | funcToken = <TIMESTAMPDIFF>)
<LPAREN>
expression = intervalType()
{
@@ -3628,7 +3685,7 @@
<RPAREN>
)
|
- LOOKAHEAD(<ID>, {getToken(1).image.equalsIgnoreCase("querystring")}) expression = queryString(info)
+ LOOKAHEAD(2) expression = queryString(info)
{
return expression;
}
@@ -3660,9 +3717,7 @@
| ( funcToken = <XMLPI>
<LPAREN>
(
- LOOKAHEAD(<ID>, { "name".equalsIgnoreCase(getToken(1).image) }) <ID> expression = idExpression()
- |
- expression = idExpression()
+ [LOOKAHEAD(1) <NAME>] expression = idExpression()
)
{
args.add(expression);
@@ -3694,7 +3749,7 @@
[ args = expressionList(info) ]
[ orderBy = orderby(info) ]
<RPAREN>
- condition = filterClause(info)
+ [condition = filterClause(info)]
))
{
if(funcName == null) {
@@ -3723,14 +3778,14 @@
XMLParse xmlParse(ParseInfo info) :
{
Expression expr = null;
- String doc = null;
+ boolean doc = false;
boolean wellformed = false;
}
{
<XMLPARSE><LPAREN>
- doc = nonReserved("DOCUMENT", "CONTENT")
+ (<DOCUMENT> {doc = true;}| <CONTENT> {doc = false;})
expr = expression(info)
- [nonReserved("WELLFORMED")
+ [<WELLFORMED>
{
wellformed = true;
}
@@ -3738,7 +3793,7 @@
<RPAREN>
{
XMLParse result = new XMLParse();
- result.setDocument("document".equalsIgnoreCase(doc));
+ result.setDocument(doc);
result.setExpression(expr);
result.setWellFormed(wellformed);
return result;
@@ -3752,7 +3807,7 @@
ArrayList<DerivedColumn> args = new ArrayList<DerivedColumn>(2);
}
{
- nonReserved("QUERYSTRING") <LPAREN>
+ <QUERYSTRING> <LPAREN>
path = expression(info)
(<COMMA> arg=derivedColumn(info)
{
@@ -3777,9 +3832,7 @@
{
<XMLELEMENT> <LPAREN>
(
- LOOKAHEAD(<ID>, { "name".equalsIgnoreCase(getToken(1).image) }) <ID> name = id()
- |
- name = id()
+ [LOOKAHEAD(1) <NAME>] name = id()
)
[
LOOKAHEAD(2) <COMMA> xmlNamespaces = xmlNamespaces(info)
@@ -3975,14 +4028,22 @@
*/
Constant intervalType() :
{
- String type = null;
+ Token type = null;
}
{
(
- type = nonReserved("SQL_TSI_FRAC_SECOND", "SQL_TSI_SECOND", "SQL_TSI_MINUTE", "SQL_TSI_HOUR", "SQL_TSI_DAY", "SQL_TSI_WEEK", "SQL_TSI_MONTH", "SQL_TSI_QUARTER", "SQL_TSI_YEAR")
+ type = <SQL_TSI_FRAC_SECOND>
+ |type = <SQL_TSI_SECOND>
+ |type = <SQL_TSI_MINUTE>
+ |type = <SQL_TSI_HOUR>
+ |type = <SQL_TSI_DAY>
+ |type = <SQL_TSI_WEEK>
+ |type = <SQL_TSI_MONTH>
+ |type = <SQL_TSI_QUARTER>
+ |type = <SQL_TSI_YEAR>
)
{
- return new Constant(type);
+ return new Constant(type.image);
}
}
/**
@@ -4101,7 +4162,7 @@
String prefix = null;
}
{
- <SET> nonReserved ("NAMESPACE") uri = stringVal() <AS> prefix = id()
+ <SET> <NAMESPACE> uri = stringVal() <AS> prefix = id()
{
factory.addNamespace(prefix, uri);
}
@@ -4189,7 +4250,7 @@
name = id()
type = parseDataType()
[<NOT> <NULL> {notNull = true;}]
- [nonReserved("RESULT")
+ [<RESULT>
{
if (ppType != ProcedureParameter.Type.Out) {
throw new ParseException(QueryPlugin.Util.getString("SQLParser.param_out", proc.getName(), name));
@@ -4253,7 +4314,7 @@
Token comment = null;
}
{
- <CREATE> (<FOREIGN> <TABLE> | [<VIRTUAL>] nonReserved("VIEW") {view = true;})
+ <CREATE> (<FOREIGN> <TABLE> | [<VIRTUAL>] <VIEW> {view = true;})
tableName = id()
{
try{
@@ -4308,7 +4369,7 @@
KeyRecord key = null;
}
{
- <FOREIGN> nonReserved("KEY")
+ <FOREIGN> <KEY>
columnNames = getColumnNames()
{
for (String col: columnNames) {
@@ -4339,7 +4400,7 @@
KeyRecord key = null;
}
{
- <PRIMARY> nonReserved("KEY")
+ <PRIMARY> <KEY>
{
columnNames = getColumnNames();
for (String col: columnNames) {
@@ -4366,24 +4427,24 @@
KeyRecord keyrecord = null;
Column column = null;
List<String> columnNames = null;
- String type = null;
+ Token type = null;
KeyRecord key = null;
}
{
- ( <UNIQUE> { type = "UNIQUE"; } | type = nonReserved("INDEX","ACCESSPATTERN"))
+ ( type = <UNIQUE> | type = <INDEX> | type = <ACCESSPATTERN>)
{
columnNames = getColumnNames();
for (String col: columnNames) {
column = getColumn(col, table);
}
try{
- if (type.equalsIgnoreCase("INDEX")) {
+ if (type.image.equalsIgnoreCase("INDEX")) {
key = factory.addIndex("INDEX"+table.getIndexes().size(), true, columnNames, table);
}
- if (type.equalsIgnoreCase("UNIQUE")) {
+ if (type.image.equalsIgnoreCase("UNIQUE")) {
key = factory.addIndex("UNIQUE"+table.getUniqueKeys().size(), false, columnNames, table);
}
- if (type.equalsIgnoreCase("ACCESSPATTERN")) {
+ if (type.image.equalsIgnoreCase("ACCESSPATTERN")) {
key = factory.addAccessPattern("AP"+table.getAccessPatterns().size(), columnNames, table);
}
}catch(TranslatorException e){
@@ -4431,7 +4492,7 @@
boolean index = false;
boolean unique = false;
boolean pk = false;
- String word = null;
+ Token word = null;
}
{
element = id()
@@ -4450,11 +4511,11 @@
)
[<NOT> <NULL> { notNull = true; }]
([(<UNIQUE> { unique = true; })
- |(word=nonReserved("INDEX", "AUTO_INCREMENT")
- { if (word.equalsIgnoreCase("INDEX")) index = true;
- else if (word.equalsIgnoreCase("AUTO_INCREMENT")) autoIncrement = true;
+ |((word = <INDEX> | word = <AUTO_INCREMENT>)
+ { if (word.image.equalsIgnoreCase("INDEX")) index = true;
+ else if (word.image.equalsIgnoreCase("AUTO_INCREMENT")) autoIncrement = true;
})+
- |(<PRIMARY> nonReserved("KEY") { pk = true; })
+ |(<PRIMARY> <KEY> { pk = true; })
])
[<DEFAULT_KEYWORD> defalt = stringVal() {column.setDefaultValue(defalt);}]
[optionsClause(column, factory)
Modified: trunk/engine/src/main/resources/org/teiid/query/i18n.properties
===================================================================
--- trunk/engine/src/main/resources/org/teiid/query/i18n.properties 2012-07-24 21:01:05 UTC (rev 4266)
+++ trunk/engine/src/main/resources/org/teiid/query/i18n.properties 2012-07-25 13:11:25 UTC (rev 4267)
@@ -255,7 +255,6 @@
SQLParser.Invalid_id=Invalid metadata ID format: [{0}]
SQLParser.Invalid_alias=Invalid alias format: [{0}]
SQLParser.Invalid_short_name=Invalid simple identifier format: [{0}]
-SQLParser.expected_non_reserved=Expected non-reserved word {0}, but was {1}.
SQLParser.invalid_window=Cannot window a non-aggregate expression {0}.
SQLParser.function_def=Function or foreign procedure {0} cannot define a body.
SQLParser.view_def=Foreign table {0} cannot be defined by a query expression.
Modified: trunk/engine/src/test/java/org/teiid/query/parser/TestParser.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/parser/TestParser.java 2012-07-24 21:01:05 UTC (rev 4266)
+++ trunk/engine/src/test/java/org/teiid/query/parser/TestParser.java 2012-07-25 13:11:25 UTC (rev 4267)
@@ -5064,7 +5064,7 @@
}
@Test public void testTextTableColumns() throws Exception {
- helpException("SELECT * from texttable(foo x string)", "TEIID31100 Parsing error: Expected non-reserved word [COLUMNS], but was x.");
+ helpException("SELECT * from texttable(foo x string)");
}
@Test public void testXMLTable() throws Exception {
12 years, 5 months
teiid SVN: r4266 - in trunk: engine/src/main/java/org/teiid/security and 6 other directories.
by teiid-commits@lists.jboss.org
Author: rareddy
Date: 2012-07-24 17:01:05 -0400 (Tue, 24 Jul 2012)
New Revision: 4266
Added:
trunk/test-integration/common/src/test/java/org/teiid/jdbc/TestPassthroughAuthentication.java
Modified:
trunk/engine/src/main/java/org/teiid/dqp/internal/process/DQPWorkContext.java
trunk/engine/src/main/java/org/teiid/security/SecurityHelper.java
trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestDQPWorkContext.java
trunk/jboss-integration/src/main/java/org/teiid/jboss/JBossSecurityHelper.java
trunk/runtime/src/main/java/org/teiid/runtime/DoNothingSecurityHelper.java
trunk/runtime/src/main/java/org/teiid/services/SessionServiceImpl.java
trunk/runtime/src/main/java/org/teiid/transport/LocalServerConnection.java
Log:
TEIID-2109: correctly propagate the security context that is currently on the thread through in LocalConnection scenarios.
Modified: trunk/engine/src/main/java/org/teiid/dqp/internal/process/DQPWorkContext.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/dqp/internal/process/DQPWorkContext.java 2012-07-24 19:55:03 UTC (rev 4265)
+++ trunk/engine/src/main/java/org/teiid/dqp/internal/process/DQPWorkContext.java 2012-07-24 21:01:05 UTC (rev 4266)
@@ -220,6 +220,10 @@
return session.getSecurityContext();
}
+ public void setSecurityContext(Object securityContext) {
+ session.setSecurityContext(securityContext);
+ }
+
public VDBMetaData getVDB() {
return session.getVdb();
}
Modified: trunk/engine/src/main/java/org/teiid/security/SecurityHelper.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/security/SecurityHelper.java 2012-07-24 19:55:03 UTC (rev 4265)
+++ trunk/engine/src/main/java/org/teiid/security/SecurityHelper.java 2012-07-24 21:01:05 UTC (rev 4266)
@@ -32,11 +32,13 @@
void clearSecurityContext();
- Object getSecurityContext(String securityDomain);
+ Object getSecurityContext();
Object createSecurityContext(String securityDomain, Principal p, Object credentials, Subject subject);
Subject getSubjectInContext(String securityDomain);
boolean sameSubject(String securityDomain, Object context, Subject subject);
+
+ String getSecurityDomain(Object context);
}
Modified: trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestDQPWorkContext.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestDQPWorkContext.java 2012-07-24 19:55:03 UTC (rev 4265)
+++ trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestDQPWorkContext.java 2012-07-24 21:01:05 UTC (rev 4266)
@@ -101,7 +101,7 @@
return null;
}
@Override
- public Object getSecurityContext(String securityDomain) {
+ public Object getSecurityContext() {
return this.mycontext;
}
@Override
@@ -118,6 +118,10 @@
this.mycontext = context;
return old;
}
+ @Override
+ public String getSecurityDomain(Object context) {
+ return null;
+ }
};
Object previousSC = sc.createSecurityContext("test", null, null, null); //$NON-NLS-1$
sc.associateSecurityContext(previousSC);
@@ -135,13 +139,13 @@
Runnable r = new Runnable() {
@Override
public void run() {
- assertEquals(currentSC, sc.getSecurityContext(null));
+ assertEquals(currentSC, sc.getSecurityContext());
}
};
message.runInContext(r);
- assertEquals(previousSC, sc.getSecurityContext(null));
+ assertEquals(previousSC, sc.getSecurityContext());
}
Modified: trunk/jboss-integration/src/main/java/org/teiid/jboss/JBossSecurityHelper.java
===================================================================
--- trunk/jboss-integration/src/main/java/org/teiid/jboss/JBossSecurityHelper.java 2012-07-24 19:55:03 UTC (rev 4265)
+++ trunk/jboss-integration/src/main/java/org/teiid/jboss/JBossSecurityHelper.java 2012-07-24 21:01:05 UTC (rev 4266)
@@ -50,12 +50,8 @@
}
@Override
- public Object getSecurityContext(String securityDomain) {
- SecurityContext sc = SecurityActions.getSecurityContext();
- if (sc != null && sc.getSecurityDomain().equals(securityDomain)) {
- return sc;
- }
- return null;
+ public Object getSecurityContext() {
+ return SecurityActions.getSecurityContext();
}
@Override
@@ -89,5 +85,10 @@
}
return false;
}
+
+ @Override
+ public String getSecurityDomain(Object context) {
+ return ((SecurityContext)context).getSecurityDomain();
+ }
}
Modified: trunk/runtime/src/main/java/org/teiid/runtime/DoNothingSecurityHelper.java
===================================================================
--- trunk/runtime/src/main/java/org/teiid/runtime/DoNothingSecurityHelper.java 2012-07-24 19:55:03 UTC (rev 4265)
+++ trunk/runtime/src/main/java/org/teiid/runtime/DoNothingSecurityHelper.java 2012-07-24 21:01:05 UTC (rev 4266)
@@ -45,7 +45,7 @@
}
@Override
- public Object getSecurityContext(String securityDomain) {
+ public Object getSecurityContext() {
return new Object();
}
@@ -64,4 +64,9 @@
public Object associateSecurityContext(Object context) {
return null;
}
+
+ @Override
+ public String getSecurityDomain(Object context) {
+ return null;
+ }
}
\ No newline at end of file
Modified: trunk/runtime/src/main/java/org/teiid/services/SessionServiceImpl.java
===================================================================
--- trunk/runtime/src/main/java/org/teiid/services/SessionServiceImpl.java 2012-07-24 19:55:03 UTC (rev 4265)
+++ trunk/runtime/src/main/java/org/teiid/services/SessionServiceImpl.java 2012-07-24 21:01:05 UTC (rev 4266)
@@ -198,7 +198,7 @@
for (String domain:getDomainsForUser(domains, userName)) {
Subject existing = this.securityHelper.getSubjectInContext(domain);
if (existing != null) {
- return new TeiidLoginContext(getUserName(existing, userName)+AT+domain, existing, domain, this.securityHelper.getSecurityContext(domain));
+ return new TeiidLoginContext(getUserName(existing, userName)+AT+domain, existing, domain, this.securityHelper.getSecurityContext());
}
}
throw new LoginException(RuntimePlugin.Util.gs(RuntimePlugin.Event.TEIID40087));
Modified: trunk/runtime/src/main/java/org/teiid/transport/LocalServerConnection.java
===================================================================
--- trunk/runtime/src/main/java/org/teiid/transport/LocalServerConnection.java 2012-07-24 19:55:03 UTC (rev 4265)
+++ trunk/runtime/src/main/java/org/teiid/transport/LocalServerConnection.java 2012-07-24 21:01:05 UTC (rev 4266)
@@ -81,6 +81,7 @@
workContext.setSecurityHelper(csr.getSecurityHelper());
workContext.setUseCallingThread(useCallingThread);
+ workContext.setSecurityContext(csr.getSecurityHelper().getSecurityContext());
authenticate();
passthrough = Boolean.valueOf(connectionProperties.getProperty(TeiidURL.CONNECTION.PASSTHROUGH_AUTHENTICATION, "false")); //$NON-NLS-1$
}
Added: trunk/test-integration/common/src/test/java/org/teiid/jdbc/TestPassthroughAuthentication.java
===================================================================
--- trunk/test-integration/common/src/test/java/org/teiid/jdbc/TestPassthroughAuthentication.java (rev 0)
+++ trunk/test-integration/common/src/test/java/org/teiid/jdbc/TestPassthroughAuthentication.java 2012-07-24 21:01:05 UTC (rev 4266)
@@ -0,0 +1,118 @@
+/*
+ * 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 org.teiid.jdbc;
+
+import static org.junit.Assert.*;
+
+import java.security.Principal;
+
+import javax.security.auth.Subject;
+
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.teiid.core.util.UnitTestUtil;
+import org.teiid.runtime.EmbeddedConfiguration;
+import org.teiid.security.SecurityHelper;
+
+@SuppressWarnings("nls")
+public class TestPassthroughAuthentication {
+
+ static FakeServer server = new FakeServer(false);
+ static TestableSecurityHelper securityHelper = new TestableSecurityHelper();
+
+ @AfterClass public static void oneTimeTearDown() {
+ server.stop();
+ }
+
+ @BeforeClass public static void oneTimeSetup() throws Exception {
+ server.setUseCallingThread(true);
+ server.start(new EmbeddedConfiguration() {
+ public SecurityHelper getSecurityHelper() {
+ return securityHelper;
+ }
+ }, false);
+ }
+
+ @Test
+ public void test() throws Exception {
+ try {
+ server.deployVDB("not_there", UnitTestUtil.getTestDataPath() + "/PartsSupplier.vdb");
+ try {
+ server.createConnection("jdbc:teiid:not_there.1;passthroughAuthentication=true");
+ fail();
+ } catch (Exception e) {
+ }
+
+ securityHelper.associateSecurityContext("testSC");
+ try {
+ server.createConnection("jdbc:teiid:not_there.1;passthroughAuthentication=true");
+ } catch (Exception e) {
+ fail();
+ }
+ } finally {
+ server.undeployVDB("not_there");
+ }
+ }
+
+ private static class TestableSecurityHelper implements SecurityHelper {
+ Object ctx;
+ @Override
+ public Object associateSecurityContext(Object context) {
+ return ctx = context;
+ }
+ @Override
+ public void clearSecurityContext() {
+ ctx = null;
+ }
+ @Override
+ public Object getSecurityContext() {
+ return this.ctx;
+ }
+ @Override
+ public Object createSecurityContext(String securityDomain,
+ Principal p, Object credentials, Subject subject) {
+ return securityDomain+"SC";
+ }
+
+ @Override
+ public Subject getSubjectInContext(String securityDomain) {
+ if (securityDomain.equals("teiid-security") && getSecurityContext() != null && getSecurityContext().equals("testSC")) {
+ Subject s = new Subject();
+ return s;
+ }
+ return null;
+ }
+
+ @Override
+ public boolean sameSubject(String securityDomain,
+ Object context, Subject subject) {
+ return false;
+ }
+
+ @Override
+ public String getSecurityDomain(Object context) {
+ return null;
+ }
+
+ };
+}
Property changes on: trunk/test-integration/common/src/test/java/org/teiid/jdbc/TestPassthroughAuthentication.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
12 years, 5 months
teiid SVN: r4265 - in trunk/jboss-integration/src/main: resources/org/teiid/jboss and 1 other directory.
by teiid-commits@lists.jboss.org
Author: rareddy
Date: 2012-07-24 15:55:03 -0400 (Tue, 24 Jul 2012)
New Revision: 4265
Modified:
trunk/jboss-integration/src/main/java/org/teiid/jboss/TeiidOperationHandler.java
trunk/jboss-integration/src/main/resources/org/teiid/jboss/i18n.properties
Log:
TEIID-1923: admin supporting code to aid in console development
Modified: trunk/jboss-integration/src/main/java/org/teiid/jboss/TeiidOperationHandler.java
===================================================================
--- trunk/jboss-integration/src/main/java/org/teiid/jboss/TeiidOperationHandler.java 2012-07-24 18:15:21 UTC (rev 4264)
+++ trunk/jboss-integration/src/main/java/org/teiid/jboss/TeiidOperationHandler.java 2012-07-24 19:55:03 UTC (rev 4265)
@@ -204,16 +204,41 @@
}
@Override
protected void executeOperation(OperationContext context, DQPCore engine, ModelNode operation) throws OperationFailedException{
+ String vdbName = null;
+ int version = -1;
+ boolean filter = false;
+
+ if (operation.hasDefined(OperationsConstants.VDB_VERSION) && operation.hasDefined(OperationsConstants.VDB_NAME)) {
+ vdbName = operation.get(OperationsConstants.VDB_NAME).asString();
+ version = operation.get(OperationsConstants.VDB_VERSION).asInt();
+ filter = true;
+ }
+
ModelNode result = context.getResult();
for (TransportService t: this.transports) {
Collection<SessionMetadata> sessions = t.getActiveSessions();
for (SessionMetadata session:sessions) {
- VDBMetadataMapper.SessionMetadataMapper.INSTANCE.wrap(session, result.add());
+ if (filter) {
+ if (session.getVDBName().equals(vdbName) && session.getVDBVersion() == version) {
+ VDBMetadataMapper.SessionMetadataMapper.INSTANCE.wrap(session, result.add());
+ }
+ }
+ else {
+ VDBMetadataMapper.SessionMetadataMapper.INSTANCE.wrap(session, result.add());
+ }
}
}
}
protected void describeParameters(ModelNode operationNode, ResourceBundle bundle) {
+ operationNode.get(REQUEST_PROPERTIES, OperationsConstants.VDB_NAME, TYPE).set(ModelType.STRING);
+ operationNode.get(REQUEST_PROPERTIES, OperationsConstants.VDB_NAME, REQUIRED).set(false);
+ operationNode.get(REQUEST_PROPERTIES, OperationsConstants.VDB_NAME, DESCRIPTION).set(getParameterDescription(bundle, OperationsConstants.VDB_NAME));
+
+ operationNode.get(REQUEST_PROPERTIES, OperationsConstants.VDB_VERSION, TYPE).set(ModelType.INT);
+ operationNode.get(REQUEST_PROPERTIES, OperationsConstants.VDB_VERSION, REQUIRED).set(false);
+ operationNode.get(REQUEST_PROPERTIES, OperationsConstants.VDB_VERSION, DESCRIPTION).set(getParameterDescription(bundle, OperationsConstants.VDB_VERSION));
+
ModelNode reply = operationNode.get(REPLY_PROPERTIES);
reply.get(TYPE).set(ModelType.LIST);
VDBMetadataMapper.SessionMetadataMapper.INSTANCE.describe(reply.get(VALUE_TYPE));
@@ -523,7 +548,7 @@
@Override
protected void executeOperation(OperationContext context, SessionAwareCache cache, ModelNode operation) throws OperationFailedException {
- if (operation.hasDefined(OperationsConstants.CACHE_TYPE)) {
+ if (!operation.hasDefined(OperationsConstants.CACHE_TYPE)) {
throw new OperationFailedException(new ModelNode().set(IntegrationPlugin.Util.getString(OperationsConstants.CACHE_TYPE+MISSING)));
}
Modified: trunk/jboss-integration/src/main/resources/org/teiid/jboss/i18n.properties
===================================================================
--- trunk/jboss-integration/src/main/resources/org/teiid/jboss/i18n.properties 2012-07-24 18:15:21 UTC (rev 4264)
+++ trunk/jboss-integration/src/main/resources/org/teiid/jboss/i18n.properties 2012-07-24 19:55:03 UTC (rev 4265)
@@ -310,6 +310,8 @@
list-requests.reply=list of requests
list-sessions.describe=List of all the current active sessions in the Teiid subsystem.
+list-sessions.vdb-name.describe=VDB Name
+list-sessions.vdb-version.describe=VDB Version
list-sessions.reply=list of sessions
list-transactions.describe=Active Transactions in the Query Engine
12 years, 5 months
teiid SVN: r4264 - branches/7.7.x/build.
by teiid-commits@lists.jboss.org
Author: van.halbert
Date: 2012-07-24 14:15:21 -0400 (Tue, 24 Jul 2012)
New Revision: 4264
Modified:
branches/7.7.x/build/pom.xml
Log:
This is part of https://bugzilla.redhat.com/show_bug.cgi?id=842422 - fix the pom to attach the client-jdk15 jar to maven repo. But this also fixes a hard coding of the version to in the jar name.
Modified: branches/7.7.x/build/pom.xml
===================================================================
--- branches/7.7.x/build/pom.xml 2012-07-24 15:08:25 UTC (rev 4263)
+++ branches/7.7.x/build/pom.xml 2012-07-24 18:15:21 UTC (rev 4264)
@@ -144,7 +144,7 @@
<configuration>
<artifacts>
<artifact>
- <file>target/teiid-7.7.1-client-jdk15.jar</file>
+ <file>target/teiid-${project.version}-client-jdk15.jar</file>
<type>jar</type>
<classifier>client-jdk15</classifier>
</artifact>
12 years, 5 months
teiid SVN: r4263 - tags/teiid-7.7.1.GA/build.
by teiid-commits@lists.jboss.org
Author: van.halbert
Date: 2012-07-24 11:08:25 -0400 (Tue, 24 Jul 2012)
New Revision: 4263
Modified:
tags/teiid-7.7.1.GA/build/pom.xml
Log:
updating tagged file with maven fix
Modified: tags/teiid-7.7.1.GA/build/pom.xml
===================================================================
--- tags/teiid-7.7.1.GA/build/pom.xml 2012-07-24 14:23:05 UTC (rev 4262)
+++ tags/teiid-7.7.1.GA/build/pom.xml 2012-07-24 15:08:25 UTC (rev 4263)
@@ -129,7 +129,30 @@
</configuration>
</execution>
</executions>
- </plugin>
+ </plugin>
+
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>build-helper-maven-plugin</artifactId>
+ <version>1.5</version>
+ <executions>
+ <execution>
+ <phase>package</phase>
+ <goals>
+ <goal>attach-artifact</goal>
+ </goals>
+ <configuration>
+ <artifacts>
+ <artifact>
+ <file>target/teiid-7.7.1-client-jdk15.jar</file>
+ <type>jar</type>
+ <classifier>client-jdk15</classifier>
+ </artifact>
+ </artifacts>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
</plugins>
</build>
</profile>
12 years, 5 months