teiid SVN: r1979 - in trunk: client/src/main/java/com/metamatrix/dqp/client and 10 other directories.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2010-03-19 14:04:06 -0400 (Fri, 19 Mar 2010)
New Revision: 1979
Added:
trunk/engine/src/main/java/org/teiid/adminapi/
trunk/engine/src/main/java/org/teiid/adminapi/impl/
trunk/engine/src/main/java/org/teiid/adminapi/impl/DQPManagement.java
trunk/engine/src/test/java/org/teiid/adminapi/
trunk/engine/src/test/java/org/teiid/adminapi/impl/
Removed:
trunk/client/src/main/java/com/metamatrix/dqp/client/DQPManagement.java
trunk/client/src/main/java/org/teiid/adminapi/impl/
trunk/client/src/test/java/org/teiid/adminapi/impl/
Modified:
trunk/client/pom.xml
trunk/console/src/main/java/org/teiid/rhq/admin/DQPManagementView.java
trunk/jboss-integration/src/main/java/org/teiid/jboss/deployers/RuntimeEngineDeployer.java
trunk/metadata/pom.xml
Log:
moving adminapi impl to the client
Modified: trunk/client/pom.xml
===================================================================
--- trunk/client/pom.xml 2010-03-19 17:32:08 UTC (rev 1978)
+++ trunk/client/pom.xml 2010-03-19 18:04:06 UTC (rev 1979)
@@ -22,10 +22,5 @@
<artifactId>teiid-common-core</artifactId>
<type>test-jar</type>
</dependency>
- <dependency>
- <groupId>org.jboss.man</groupId>
- <artifactId>jboss-managed</artifactId>
- <scope>provided</scope>
- </dependency>
</dependencies>
</project>
\ No newline at end of file
Deleted: trunk/client/src/main/java/com/metamatrix/dqp/client/DQPManagement.java
===================================================================
--- trunk/client/src/main/java/com/metamatrix/dqp/client/DQPManagement.java 2010-03-19 17:32:08 UTC (rev 1978)
+++ trunk/client/src/main/java/com/metamatrix/dqp/client/DQPManagement.java 2010-03-19 18:04:06 UTC (rev 1979)
@@ -1,45 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-package com.metamatrix.dqp.client;
-
-import java.util.Collection;
-import java.util.List;
-
-import org.teiid.adminapi.AdminException;
-import org.teiid.adminapi.impl.RequestMetadata;
-import org.teiid.adminapi.impl.SessionMetadata;
-import org.teiid.adminapi.impl.WorkerPoolStatisticsMetadata;
-
-
-public interface DQPManagement {
- List<RequestMetadata> getRequestsForSession(long sessionId) ;
- List<RequestMetadata> getRequests();
- WorkerPoolStatisticsMetadata getWorkManagerStatistics(String identifier);
- void terminateSession(long terminateeId);
- boolean cancelRequest(long sessionId, long requestId) throws AdminException;
- Collection<String> getCacheTypes();
- void clearCache(String cacheType);
- Collection<SessionMetadata> getActiveSessions() throws AdminException;
- int getActiveSessionsCount() throws AdminException;
- Collection<org.teiid.adminapi.Transaction> getTransactions();
- void terminateTransaction(String xid) throws AdminException ;
-}
Modified: trunk/console/src/main/java/org/teiid/rhq/admin/DQPManagementView.java
===================================================================
--- trunk/console/src/main/java/org/teiid/rhq/admin/DQPManagementView.java 2010-03-19 17:32:08 UTC (rev 1978)
+++ trunk/console/src/main/java/org/teiid/rhq/admin/DQPManagementView.java 2010-03-19 18:04:06 UTC (rev 1979)
@@ -19,10 +19,8 @@
import org.jboss.metatype.api.values.CollectionValueSupport;
import org.jboss.metatype.api.values.MetaValue;
import org.jboss.metatype.api.values.MetaValueFactory;
-import org.teiid.adminapi.impl.RequestMetadata;
-import org.teiid.adminapi.impl.RequestMetadataMapper;
-import org.teiid.adminapi.impl.SessionMetadata;
-import org.teiid.adminapi.impl.SessionMetadataMapper;
+import org.teiid.adminapi.Request;
+import org.teiid.adminapi.Session;
import org.teiid.rhq.comm.ExecutedResult;
import org.teiid.rhq.plugin.util.PluginConstants;
import org.teiid.rhq.plugin.util.ProfileServiceUtil;
@@ -76,7 +74,7 @@
.equals(PluginConstants.ComponentType.Platform.Metrics.LONG_RUNNING_QUERIES)) {
Integer longRunningQueryLimit = (Integer) valueMap
.get(PluginConstants.Operation.Value.LONG_RUNNING_QUERY_LIMIT);
- Collection<RequestMetadata> longRunningQueries = getLongRunningQueries(longRunningQueryLimit);
+ Collection<Request> longRunningQueries = getLongRunningQueries(longRunningQueryLimit);
resultObject = new Double(longRunningQueries.size());
}
}
@@ -106,7 +104,7 @@
.equals(PluginConstants.ComponentType.VDB.Metrics.LONG_RUNNING_QUERIES)) {
Integer longRunningQueryLimit = (Integer) valueMap
.get(PluginConstants.Operation.Value.LONG_RUNNING_QUERY_LIMIT);
- Collection<RequestMetadata> longRunningQueries = getLongRunningQueries(longRunningQueryLimit);
+ Collection<Request> longRunningQueries = getLongRunningQueries(longRunningQueryLimit);
resultObject = new Double(longRunningQueries.size());
}
}
@@ -136,8 +134,8 @@
private void executePlatformOperation(ExecutedResult operationResult,
final String operationName, final Map<String, Object> valueMap) {
- Collection<RequestMetadata> resultObject = new ArrayList<RequestMetadata>();
- Collection<SessionMetadata> activeSessionsCollection = new ArrayList<SessionMetadata>();
+ Collection<Request> resultObject = new ArrayList<Request>();
+ Collection<Session> activeSessionsCollection = new ArrayList<Session>();
if (operationName.equals(Platform.Operations.GET_LONGRUNNINGQUERIES)) {
Integer longRunningValue = (Integer) valueMap
@@ -185,8 +183,8 @@
private void executeVdbOperation(ExecutedResult operationResult,
final String operationName, final Map<String, Object> valueMap) {
- Collection<RequestMetadata> resultObject = new ArrayList<RequestMetadata>();
- Collection<SessionMetadata> activeSessionsCollection = new ArrayList<SessionMetadata>();
+ Collection<Request> resultObject = new ArrayList<Request>();
+ Collection<Session> activeSessionsCollection = new ArrayList<Session>();
if (operationName.equals(VDB.Operations.GET_PROPERTIES)) {
List<String> fieldNameList = operationResult.getFieldNameList();
@@ -347,7 +345,7 @@
Integer count = new Integer(0);
MetaValue requests = null;
- Collection<RequestMetadata> requestsCollection = new ArrayList<RequestMetadata>();
+ Collection<Request> requestsCollection = new ArrayList<Request>();
requests = getRequests();
@@ -362,17 +360,17 @@
private Integer getSessionCount() {
- Collection<SessionMetadata> activeSessionsCollection = new ArrayList<SessionMetadata>();
+ Collection<Session> activeSessionsCollection = new ArrayList<Session>();
MetaValue sessionMetaValue = getSessions();
getSessionCollectionValue(sessionMetaValue, activeSessionsCollection);
return activeSessionsCollection.size();
}
- protected Collection<RequestMetadata> getLongRunningQueries(
+ protected Collection<Request> getLongRunningQueries(
int longRunningValue) {
MetaValue requestsCollection = null;
- Collection<RequestMetadata> list = new ArrayList<RequestMetadata>();
+ Collection<Request> list = new ArrayList<Request>();
double longRunningQueryTimeDouble = new Double(longRunningValue);
@@ -380,9 +378,9 @@
getRequestCollectionValue(requestsCollection, list);
- Iterator<RequestMetadata> requestsIter = list.iterator();
+ Iterator<Request> requestsIter = list.iterator();
while (requestsIter.hasNext()) {
- RequestMetadata request = requestsIter.next();
+ Request request = requestsIter.next();
long startTime = request.getStartTime();
// Get msec from each, and subtract.
long runningTime = Calendar.getInstance().getTimeInMillis()
@@ -397,16 +395,14 @@
}
public static <T> void getRequestCollectionValue(MetaValue pValue,
- Collection<RequestMetadata> list) {
+ Collection<Request> list) {
MetaType metaType = pValue.getMetaType();
if (metaType.isCollection()) {
for (MetaValue value : ((CollectionValueSupport) pValue)
.getElements()) {
if (value.getMetaType().isComposite()) {
- RequestMetadataMapper requestMapper = new RequestMetadataMapper();
- RequestMetadata requestMetaData = requestMapper
- .unwrapMetaValue(value);
- list.add(requestMetaData);
+ Request Request = (Request)MetaValueFactory.getInstance().unwrap(value);
+ list.add(Request);
} else {
throw new IllegalStateException(pValue
+ " is not a Composite type");
@@ -416,16 +412,14 @@
}
public static <T> void getSessionCollectionValue(MetaValue pValue,
- Collection<SessionMetadata> list) {
+ Collection<Session> list) {
MetaType metaType = pValue.getMetaType();
if (metaType.isCollection()) {
for (MetaValue value : ((CollectionValueSupport) pValue)
.getElements()) {
if (value.getMetaType().isComposite()) {
- SessionMetadataMapper sessionMapper = new SessionMetadataMapper();
- SessionMetadata sessionMetaData = sessionMapper
- .unwrapMetaValue(value);
- list.add(sessionMetaData);
+ Session Session = (Session)MetaValueFactory.getInstance().unwrap(value);
+ list.add(Session);
} else {
throw new IllegalStateException(pValue
+ " is not a Composite type");
Copied: trunk/engine/src/main/java/org/teiid/adminapi/impl (from rev 1976, trunk/client/src/main/java/org/teiid/adminapi/impl)
Copied: trunk/engine/src/main/java/org/teiid/adminapi/impl/DQPManagement.java (from rev 1976, trunk/client/src/main/java/com/metamatrix/dqp/client/DQPManagement.java)
===================================================================
--- trunk/engine/src/main/java/org/teiid/adminapi/impl/DQPManagement.java (rev 0)
+++ trunk/engine/src/main/java/org/teiid/adminapi/impl/DQPManagement.java 2010-03-19 18:04:06 UTC (rev 1979)
@@ -0,0 +1,42 @@
+/*
+ * 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 java.util.Collection;
+import java.util.List;
+
+import org.teiid.adminapi.AdminException;
+
+
+public interface DQPManagement {
+ List<RequestMetadata> getRequestsForSession(long sessionId) ;
+ List<RequestMetadata> getRequests();
+ WorkerPoolStatisticsMetadata getWorkManagerStatistics(String identifier);
+ void terminateSession(long terminateeId);
+ boolean cancelRequest(long sessionId, long requestId) throws AdminException;
+ Collection<String> getCacheTypes();
+ void clearCache(String cacheType);
+ Collection<SessionMetadata> getActiveSessions() throws AdminException;
+ int getActiveSessionsCount() throws AdminException;
+ Collection<org.teiid.adminapi.Transaction> getTransactions();
+ void terminateTransaction(String xid) throws AdminException ;
+}
Copied: trunk/engine/src/test/java/org/teiid/adminapi/impl (from rev 1976, trunk/client/src/test/java/org/teiid/adminapi/impl)
Modified: trunk/jboss-integration/src/main/java/org/teiid/jboss/deployers/RuntimeEngineDeployer.java
===================================================================
--- trunk/jboss-integration/src/main/java/org/teiid/jboss/deployers/RuntimeEngineDeployer.java 2010-03-19 17:32:08 UTC (rev 1978)
+++ trunk/jboss-integration/src/main/java/org/teiid/jboss/deployers/RuntimeEngineDeployer.java 2010-03-19 18:04:06 UTC (rev 1979)
@@ -45,6 +45,7 @@
import org.teiid.adminapi.Admin;
import org.teiid.adminapi.AdminComponentException;
import org.teiid.adminapi.AdminException;
+import org.teiid.adminapi.impl.DQPManagement;
import org.teiid.adminapi.impl.RequestMetadata;
import org.teiid.adminapi.impl.SessionMetadata;
import org.teiid.adminapi.impl.WorkerPoolStatisticsMetadata;
@@ -73,7 +74,6 @@
import com.metamatrix.core.MetaMatrixRuntimeException;
import com.metamatrix.core.log.MessageLevel;
import com.metamatrix.dqp.client.DQP;
-import com.metamatrix.dqp.client.DQPManagement;
import com.metamatrix.dqp.service.BufferService;
import com.metamatrix.dqp.service.SessionService;
import com.metamatrix.dqp.service.TransactionService;
Modified: trunk/metadata/pom.xml
===================================================================
--- trunk/metadata/pom.xml 2010-03-19 17:32:08 UTC (rev 1978)
+++ trunk/metadata/pom.xml 2010-03-19 18:04:06 UTC (rev 1979)
@@ -52,17 +52,18 @@
<artifactId>connector-api</artifactId>
<scope>provided</scope>
</dependency>
+
<dependency>
<groupId>org.jboss</groupId>
<artifactId>jboss-vfs</artifactId>
<scope>provided</scope>
- </dependency>
-
- <dependency>
- <groupId>org.jboss.man</groupId>
- <artifactId>jboss-managed</artifactId>
- <scope>test</scope>
- </dependency>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.man</groupId>
+ <artifactId>jboss-managed</artifactId>
+ </dependency>
+
</dependencies>
</project>
\ No newline at end of file
14 years, 10 months
teiid SVN: r1978 - trunk/client-jdbc/src/main/java/org/teiid/jdbc.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2010-03-19 13:32:08 -0400 (Fri, 19 Mar 2010)
New Revision: 1978
Removed:
trunk/client-jdbc/src/main/java/org/teiid/jdbc/AnnotationImpl.java
trunk/client-jdbc/src/main/java/org/teiid/jdbc/BatchFetcher.java
trunk/client-jdbc/src/main/java/org/teiid/jdbc/PlanNodeImpl.java
Log:
TEIID-1020 TEIID-918 moved the plan api under jdbc.plan. also fixed vdb resources to start with /
Deleted: trunk/client-jdbc/src/main/java/org/teiid/jdbc/AnnotationImpl.java
===================================================================
--- trunk/client-jdbc/src/main/java/org/teiid/jdbc/AnnotationImpl.java 2010-03-19 16:17:09 UTC (rev 1977)
+++ trunk/client-jdbc/src/main/java/org/teiid/jdbc/AnnotationImpl.java 2010-03-19 17:32:08 UTC (rev 1978)
@@ -1,64 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package org.teiid.jdbc;
-
-import org.teiid.plan.api.Annotation;
-
-/**
- */
-public class AnnotationImpl implements Annotation {
-
- private String category;
- private String description;
- private String resolution;
- private int severity;
-
- AnnotationImpl(String[] serverAnnotation) {
- category = serverAnnotation[0];
- description = serverAnnotation[1];
- resolution = serverAnnotation[2];
-
- severity = Integer.parseInt(serverAnnotation[3]);
- }
-
- public String getCategory() {
- return category;
- }
-
- public String getAnnotation() {
- return description;
- }
-
- public String getResolution() {
- return resolution;
- }
-
- public int getSeverity() {
- return severity;
- }
-
- public String toString() {
- return description;
- }
-
-}
Deleted: trunk/client-jdbc/src/main/java/org/teiid/jdbc/BatchFetcher.java
===================================================================
--- trunk/client-jdbc/src/main/java/org/teiid/jdbc/BatchFetcher.java 2010-03-19 16:17:09 UTC (rev 1977)
+++ trunk/client-jdbc/src/main/java/org/teiid/jdbc/BatchFetcher.java 2010-03-19 17:32:08 UTC (rev 1978)
@@ -1,35 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package org.teiid.jdbc;
-
-import java.sql.SQLException;
-
-import org.teiid.jdbc.BatchResults.Batch;
-
-
-/**
- * @since 4.3
- */
-public interface BatchFetcher {
- Batch requestBatch(int beginRow) throws SQLException;
-}
Deleted: trunk/client-jdbc/src/main/java/org/teiid/jdbc/PlanNodeImpl.java
===================================================================
--- trunk/client-jdbc/src/main/java/org/teiid/jdbc/PlanNodeImpl.java 2010-03-19 16:17:09 UTC (rev 1977)
+++ trunk/client-jdbc/src/main/java/org/teiid/jdbc/PlanNodeImpl.java 2010-03-19 17:32:08 UTC (rev 1978)
@@ -1,100 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package org.teiid.jdbc;
-
-import java.util.*;
-
-import org.teiid.plan.api.PlanNode;
-
-
-/**
- * Implements the plan node
- */
-class PlanNodeImpl implements PlanNode {
-
- private Map props;
- private PlanNode parent;
- private List children = new ArrayList();
-
- /**
- *
- */
- PlanNodeImpl(Map props) {
- this.props = props;
- }
-
- void setParent(PlanNode parent) {
- this.parent = parent;
- }
-
- public PlanNode getParent() {
- return this.parent;
- }
-
- void addChild(PlanNode child) {
- children.add(child);
- }
-
- public List getChildren() {
- return this.children;
- }
-
- public Map getProperties() {
- return this.props;
- }
-
- private static final String PROP_CHILDREN = "children"; //$NON-NLS-1$
-
- static PlanNode constructFromMap(Map properties) {
- // Construct node without child property
- Map copy = new HashMap(properties);
- List childMaps = (List) copy.remove(PROP_CHILDREN);
-
- // Convert any subplans to PlanNodes as well
- Iterator keyIter = copy.keySet().iterator();
- while(keyIter.hasNext()) {
- Object key = keyIter.next();
- Object value = copy.get(key);
- if(value instanceof Map) {
- copy.put(key, constructFromMap((Map)value));
- }
- }
-
- // Construct this node
- PlanNodeImpl node = new PlanNodeImpl(copy);
-
- // Then construct children and connect
- if(childMaps != null) {
- for(int i=0; i<childMaps.size(); i++) {
- Map childMap = (Map) childMaps.get(i);
- PlanNodeImpl child = (PlanNodeImpl) constructFromMap(childMap);
- child.setParent(node);
- node.addChild(child);
- }
- }
-
- // And return
- return node;
- }
-
-}
14 years, 10 months
teiid SVN: r1977 - in trunk: client/src/main/java/com/metamatrix/dqp/message and 24 other directories.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2010-03-19 12:17:09 -0400 (Fri, 19 Mar 2010)
New Revision: 1977
Added:
trunk/client-jdbc/src/main/java/org/teiid/jdbc/ExecutionProperties.java
trunk/client-jdbc/src/main/java/org/teiid/jdbc/TeiidStatement.java
trunk/client-jdbc/src/main/java/org/teiid/jdbc/plan/
trunk/client-jdbc/src/test/java/org/teiid/jdbc/TestMMJDBCURL.java
trunk/client-jdbc/src/test/java/org/teiid/jdbc/plan/
trunk/client-jdbc/src/test/java/org/teiid/jdbc/plan/TestTextOutputVisitor.java
trunk/client-jdbc/src/test/java/org/teiid/jdbc/plan/TestXMLOutputVisitor.java
trunk/test-integration/common/src/test/resources/test-schema.xsd
Removed:
trunk/client-jdbc/src/main/java/org/teiid/jdbc/api/
trunk/client-jdbc/src/main/java/org/teiid/jdbc/plan/ExecutionProperties.java
trunk/client-jdbc/src/main/java/org/teiid/jdbc/plan/QueryPlanDisplayHelper.java
trunk/client-jdbc/src/test/java/com/metamatrix/jdbc/
trunk/client-jdbc/src/test/java/org/teiid/jdbc/api/FakeDisplayHelper.java
trunk/client-jdbc/src/test/java/org/teiid/jdbc/api/FakePlanNode.java
trunk/client-jdbc/src/test/java/org/teiid/jdbc/api/TestQueryPlanDisplayHelper.java
trunk/client-jdbc/src/test/java/org/teiid/jdbc/api/TestTextOutputVisitor.java
trunk/client-jdbc/src/test/java/org/teiid/jdbc/api/TestXMLOutputVisitor.java
trunk/client-jdbc/src/test/java/org/teiid/jdbc/util/TestMMJDBCURL.java
trunk/client/src/main/java/org/teiid/plan/api/
trunk/client/src/test/java/com/metamatrix/admin/api/
trunk/documentation/connector-developer-guide/src/main/docbook/en-US/content/connector-development-kit.xml
Modified:
trunk/client-jdbc/src/main/java/org/teiid/jdbc/BaseDataSource.java
trunk/client-jdbc/src/main/java/org/teiid/jdbc/BatchResults.java
trunk/client-jdbc/src/main/java/org/teiid/jdbc/ConnectionImpl.java
trunk/client-jdbc/src/main/java/org/teiid/jdbc/JDBCURL.java
trunk/client-jdbc/src/main/java/org/teiid/jdbc/PreparedStatementImpl.java
trunk/client-jdbc/src/main/java/org/teiid/jdbc/ResultSetImpl.java
trunk/client-jdbc/src/main/java/org/teiid/jdbc/StatementImpl.java
trunk/client-jdbc/src/main/java/org/teiid/jdbc/plan/Annotation.java
trunk/client-jdbc/src/main/java/org/teiid/jdbc/plan/DefaultDisplayHelper.java
trunk/client-jdbc/src/main/java/org/teiid/jdbc/plan/DisplayHelper.java
trunk/client-jdbc/src/main/java/org/teiid/jdbc/plan/PlanNode.java
trunk/client-jdbc/src/main/java/org/teiid/jdbc/plan/PlanVisitor.java
trunk/client-jdbc/src/main/java/org/teiid/jdbc/plan/TextOutputVisitor.java
trunk/client-jdbc/src/main/java/org/teiid/jdbc/plan/XMLOutputVisitor.java
trunk/client-jdbc/src/test/java/org/teiid/jdbc/TestBatchResults.java
trunk/client-jdbc/src/test/java/org/teiid/jdbc/TestEmbeddedProfile.java
trunk/client-jdbc/src/test/java/org/teiid/jdbc/TestMMDriver.java
trunk/client-jdbc/src/test/java/org/teiid/jdbc/TestSocketProfile.java
trunk/client-jdbc/src/test/java/org/teiid/jdbc/TestTeiidDataSource.java
trunk/client/src/main/java/com/metamatrix/dqp/message/RequestMessage.java
trunk/client/src/test/java/com/metamatrix/dqp/message/TestRequestMessage.java
trunk/common-core/src/main/java/com/metamatrix/common/types/SQLXMLImpl.java
trunk/documentation/connector-developer-guide/src/main/docbook/en-US/connector_developer_guide.xml
trunk/documentation/reference/src/main/docbook/en-US/content/federated_planning.xml
trunk/documentation/reference/src/main/docbook/en-US/content/grammar.xml
trunk/engine/src/main/java/org/teiid/dqp/internal/process/AbstractWorkItem.java
trunk/engine/src/main/java/org/teiid/dqp/internal/process/Request.java
trunk/engine/src/main/java/org/teiid/metadata/TransformationMetadata.java
trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestDQPCore.java
trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestWorkItemState.java
trunk/metadata/src/main/java/org/teiid/metadata/index/IndexMetadataFactory.java
trunk/metadata/src/test/java/org/teiid/metadata/index/VDBMetadataFactory.java
trunk/pom.xml
trunk/runtime/src/main/java/org/teiid/deployers/VDBDeployer.java
trunk/runtime/src/main/java/org/teiid/deployers/VDBParserDeployer.java
trunk/test-integration/common/src/test/java/org/teiid/dqp/internal/process/TestXMLTypeTranslations.java
trunk/test-integration/db/src/main/java/org/teiid/test/framework/ConfigPropertyNames.java
trunk/test-integration/db/src/main/java/org/teiid/test/framework/query/AbstractQueryTransactionTest.java
Log:
TEIID-1020 TEIID-918 moved the plan api under jdbc.plan. also fixed vdb resources to start with /
Modified: trunk/client/src/main/java/com/metamatrix/dqp/message/RequestMessage.java
===================================================================
--- trunk/client/src/main/java/com/metamatrix/dqp/message/RequestMessage.java 2010-03-19 01:45:14 UTC (rev 1976)
+++ trunk/client/src/main/java/com/metamatrix/dqp/message/RequestMessage.java 2010-03-19 16:17:09 UTC (rev 1977)
@@ -31,8 +31,6 @@
import java.util.Collections;
import java.util.List;
-import org.teiid.plan.api.ExecutionProperties;
-
import com.metamatrix.api.exception.MetaMatrixProcessingException;
import com.metamatrix.common.comm.CommonCommPlugin;
import com.metamatrix.core.util.ExternalizeUtil;
@@ -44,6 +42,19 @@
public static final int DEFAULT_FETCH_SIZE = 2048;
+ /** Transaction auto wrap constant - never wrap a command execution in a transaction */
+ public static final String TXN_WRAP_OFF = "OFF"; //$NON-NLS-1$
+
+ /** Transaction auto wrap constant - always wrap commands in a transaction. */
+ public static final String TXN_WRAP_ON = "ON"; //$NON-NLS-1$
+
+ /**
+ * Transaction auto wrap constant - checks if a command
+ * requires a transaction and will be automatically wrap it.
+ */
+ public static final String TXN_WRAP_DETECT = "DETECT"; //$NON-NLS-1$
+
+
public enum StatementType {
PREPARED, CALLABLE, STATEMENT
}
@@ -189,7 +200,7 @@
*/
public String getTxnAutoWrapMode() {
if (txnAutoWrapMode == null) {
- return ExecutionProperties.TXN_WRAP_DETECT;
+ return TXN_WRAP_DETECT;
}
return txnAutoWrapMode;
}
@@ -202,9 +213,9 @@
public void setTxnAutoWrapMode(String txnAutoWrapMode) throws MetaMatrixProcessingException {
if (txnAutoWrapMode != null) {
txnAutoWrapMode = txnAutoWrapMode.toUpperCase();
- if (!(txnAutoWrapMode.equals(ExecutionProperties.TXN_WRAP_OFF)
- || txnAutoWrapMode.equals(ExecutionProperties.TXN_WRAP_ON)
- || txnAutoWrapMode.equals(ExecutionProperties.TXN_WRAP_DETECT))) {
+ if (!(txnAutoWrapMode.equals(TXN_WRAP_OFF)
+ || txnAutoWrapMode.equals(TXN_WRAP_ON)
+ || txnAutoWrapMode.equals(TXN_WRAP_DETECT))) {
throw new MetaMatrixProcessingException(CommonCommPlugin.Util.getString("RequestMessage.invalid_txnAutoWrap", txnAutoWrapMode)); //$NON-NLS-1$
}
}
Modified: trunk/client/src/test/java/com/metamatrix/dqp/message/TestRequestMessage.java
===================================================================
--- trunk/client/src/test/java/com/metamatrix/dqp/message/TestRequestMessage.java 2010-03-19 01:45:14 UTC (rev 1976)
+++ trunk/client/src/test/java/com/metamatrix/dqp/message/TestRequestMessage.java 2010-03-19 16:17:09 UTC (rev 1977)
@@ -25,8 +25,6 @@
import java.util.ArrayList;
import java.util.List;
-import org.teiid.plan.api.ExecutionProperties;
-
import junit.framework.TestCase;
import com.metamatrix.api.exception.MetaMatrixProcessingException;
@@ -58,7 +56,7 @@
message.setStyleSheet("myStyleSheet"); //$NON-NLS-1$
message.setExecutionPayload("myExecutionPayload"); //$NON-NLS-1$
try {
- message.setTxnAutoWrapMode(ExecutionProperties.TXN_WRAP_ON);
+ message.setTxnAutoWrapMode(RequestMessage.TXN_WRAP_ON);
} catch (MetaMatrixProcessingException e) {
throw new RuntimeException(e);
}
@@ -85,7 +83,7 @@
assertFalse(copy.isPreparedStatement());
assertEquals("myStyleSheet", copy.getStyleSheet()); //$NON-NLS-1$
assertEquals("myExecutionPayload", copy.getExecutionPayload()); //$NON-NLS-1$
- assertEquals(ExecutionProperties.TXN_WRAP_ON, copy.getTxnAutoWrapMode()); //$NON-NLS-1$
+ assertEquals(RequestMessage.TXN_WRAP_ON, copy.getTxnAutoWrapMode());
assertTrue(copy.getValidationMode());
assertEquals("xMLFormat", copy.getXMLFormat()); //$NON-NLS-1$
assertTrue(copy.getShowPlan());
Modified: trunk/client-jdbc/src/main/java/org/teiid/jdbc/BaseDataSource.java
===================================================================
--- trunk/client-jdbc/src/main/java/org/teiid/jdbc/BaseDataSource.java 2010-03-19 01:45:14 UTC (rev 1976)
+++ trunk/client-jdbc/src/main/java/org/teiid/jdbc/BaseDataSource.java 2010-03-19 16:17:09 UTC (rev 1977)
@@ -32,8 +32,8 @@
import javax.sql.XAConnection;
import javax.sql.XADataSource;
-import org.teiid.plan.api.ExecutionProperties;
+
import com.metamatrix.common.api.MMURL;
import com.metamatrix.dqp.message.RequestMessage;
Modified: trunk/client-jdbc/src/main/java/org/teiid/jdbc/BatchResults.java
===================================================================
--- trunk/client-jdbc/src/main/java/org/teiid/jdbc/BatchResults.java 2010-03-19 01:45:14 UTC (rev 1976)
+++ trunk/client-jdbc/src/main/java/org/teiid/jdbc/BatchResults.java 2010-03-19 16:17:09 UTC (rev 1977)
@@ -32,6 +32,10 @@
* @since 4.3
*/
public class BatchResults {
+
+ public interface BatchFetcher {
+ Batch requestBatch(int beginRow) throws SQLException;
+ }
static class Batch{
private List[] batch;
Modified: trunk/client-jdbc/src/main/java/org/teiid/jdbc/ConnectionImpl.java
===================================================================
--- trunk/client-jdbc/src/main/java/org/teiid/jdbc/ConnectionImpl.java 2010-03-19 01:45:14 UTC (rev 1976)
+++ trunk/client-jdbc/src/main/java/org/teiid/jdbc/ConnectionImpl.java 2010-03-19 16:17:09 UTC (rev 1977)
@@ -57,8 +57,8 @@
import javax.transaction.xa.Xid;
-import org.teiid.plan.api.ExecutionProperties;
+
import com.metamatrix.common.api.MMURL;
import com.metamatrix.common.comm.api.ServerConnection;
import com.metamatrix.common.comm.exception.CommunicationException;
Added: trunk/client-jdbc/src/main/java/org/teiid/jdbc/ExecutionProperties.java
===================================================================
--- trunk/client-jdbc/src/main/java/org/teiid/jdbc/ExecutionProperties.java (rev 0)
+++ trunk/client-jdbc/src/main/java/org/teiid/jdbc/ExecutionProperties.java 2010-03-19 16:17:09 UTC (rev 1977)
@@ -0,0 +1,102 @@
+/*
+ * 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 com.metamatrix.dqp.message.RequestMessage;
+
+/**
+ * MetaMatrix-specific execution properties. These execution properties can
+ * be set via the {@link com.metamatrix.jdbc.api.Statement#setExecutionProperty(String, String)}
+ * method. They affect the subsequent execution of all commands on that Statement
+ * instance.
+ */
+public interface ExecutionProperties {
+
+ /** Execution property name for XML format */
+ public static final String PROP_XML_FORMAT = "XMLFormat"; //$NON-NLS-1$
+
+ /** Execution property name for XML validation */
+ public static final String PROP_XML_VALIDATION = "XMLValidation"; //$NON-NLS-1$
+
+ /** Execution property name for transaction auto wrap mode */
+ public static final String PROP_TXN_AUTO_WRAP = "autoCommitTxn"; //$NON-NLS-1$
+
+ /** Execution property name for partial results mode */
+ public static final String PROP_PARTIAL_RESULTS_MODE = "partialResultsMode"; //$NON-NLS-1$
+
+ /** XML results format: XML results displayed as a formatted tree */
+ public static final String XML_TREE_FORMAT = "Tree"; //$NON-NLS-1$
+
+ /** XML results format: XML results displayed in compact form */
+ public static final String XML_COMPACT_FORMAT = "Compact"; //$NON-NLS-1$
+
+ /** Transaction auto wrap constant - never wrap a command execution in a transaction */
+ public static final String TXN_WRAP_OFF = RequestMessage.TXN_WRAP_OFF;
+
+ /** Transaction auto wrap constant - always wrap commands in a transaction. */
+ public static final String TXN_WRAP_ON = RequestMessage.TXN_WRAP_ON;
+
+ /**
+ * Transaction auto wrap constant - checks if a command
+ * requires a transaction and will be automatically wrap it.
+ */
+ public static final String TXN_WRAP_DETECT = RequestMessage.TXN_WRAP_DETECT;
+
+ /**
+ * Whether to use result set cache if it is available
+ * @since 4.2
+ */
+ public static final String RESULT_SET_CACHE_MODE = "resultSetCacheMode"; //$NON-NLS-1$
+
+ /**
+ * Default fetch size to use on Statements if the fetch size is not explicitly set.
+ * The default is 500.
+ * @since 4.2
+ */
+ public static final String PROP_FETCH_SIZE = "fetchSize"; //$NON-NLS-1$
+
+ /**
+ * If true, will ignore autocommit for local transactions.
+ * @since 5.5.2
+ */
+ public static final String DISABLE_LOCAL_TRANSACTIONS = "disableLocalTxn"; //$NON-NLS-1$
+
+ /**
+ * Overrides the handling of double quoted identifiers to allow them to be strings.
+ * @since 4.3
+ */
+ public static final String ANSI_QUOTED_IDENTIFIERS = "ansiQuotedIdentifiers"; //$NON-NLS-1$
+
+ /**
+ * Additional options/hints for executing the command
+ * @since 4.3
+ */
+ public static final String PROP_SQL_OPTIONS = "sqlOptions"; //$NON-NLS-1$
+
+ /**
+ * Passed as an option to PROP_SQL_OPTIONS
+ */
+ public static final String SQL_OPTION_SHOWPLAN = "SHOWPLAN"; //$NON-NLS-1$
+
+}
+
\ No newline at end of file
Modified: trunk/client-jdbc/src/main/java/org/teiid/jdbc/JDBCURL.java
===================================================================
--- trunk/client-jdbc/src/main/java/org/teiid/jdbc/JDBCURL.java 2010-03-19 01:45:14 UTC (rev 1976)
+++ trunk/client-jdbc/src/main/java/org/teiid/jdbc/JDBCURL.java 2010-03-19 16:17:09 UTC (rev 1977)
@@ -29,9 +29,9 @@
import java.util.Map;
import java.util.Properties;
-import org.teiid.plan.api.ExecutionProperties;
+
import com.metamatrix.common.api.MMURL;
Modified: trunk/client-jdbc/src/main/java/org/teiid/jdbc/PreparedStatementImpl.java
===================================================================
--- trunk/client-jdbc/src/main/java/org/teiid/jdbc/PreparedStatementImpl.java 2010-03-19 01:45:14 UTC (rev 1976)
+++ trunk/client-jdbc/src/main/java/org/teiid/jdbc/PreparedStatementImpl.java 2010-03-19 16:17:09 UTC (rev 1977)
@@ -51,8 +51,8 @@
import javax.sql.rowset.serial.SerialBlob;
import javax.sql.rowset.serial.SerialClob;
-import org.teiid.plan.api.ExecutionProperties;
+
import com.metamatrix.api.exception.MetaMatrixComponentException;
import com.metamatrix.api.exception.MetaMatrixProcessingException;
import com.metamatrix.common.types.MMJDBCSQLTypeInfo;
Modified: trunk/client-jdbc/src/main/java/org/teiid/jdbc/ResultSetImpl.java
===================================================================
--- trunk/client-jdbc/src/main/java/org/teiid/jdbc/ResultSetImpl.java 2010-03-19 01:45:14 UTC (rev 1976)
+++ trunk/client-jdbc/src/main/java/org/teiid/jdbc/ResultSetImpl.java 2010-03-19 16:17:09 UTC (rev 1977)
@@ -52,6 +52,7 @@
import java.util.logging.Logger;
import org.teiid.jdbc.BatchResults.Batch;
+import org.teiid.jdbc.BatchResults.BatchFetcher;
import com.metamatrix.api.exception.MetaMatrixComponentException;
import com.metamatrix.api.exception.MetaMatrixProcessingException;
Modified: trunk/client-jdbc/src/main/java/org/teiid/jdbc/StatementImpl.java
===================================================================
--- trunk/client-jdbc/src/main/java/org/teiid/jdbc/StatementImpl.java 2010-03-19 01:45:14 UTC (rev 1976)
+++ trunk/client-jdbc/src/main/java/org/teiid/jdbc/StatementImpl.java 2010-03-19 16:17:09 UTC (rev 1977)
@@ -47,10 +47,10 @@
import java.util.regex.Matcher;
import java.util.regex.Pattern;
-import org.teiid.jdbc.api.Statement;
-import org.teiid.plan.api.Annotation;
-import org.teiid.plan.api.ExecutionProperties;
-import org.teiid.plan.api.PlanNode;
+import org.teiid.jdbc.plan.Annotation;
+import org.teiid.jdbc.plan.Annotation;
+import org.teiid.jdbc.plan.PlanNode;
+import org.teiid.jdbc.plan.PlanNode;
import com.metamatrix.api.exception.MetaMatrixComponentException;
import com.metamatrix.api.exception.MetaMatrixException;
@@ -63,7 +63,7 @@
import com.metamatrix.dqp.message.ResultsMessage;
import com.metamatrix.dqp.message.RequestMessage.ResultsMode;
-public class StatementImpl extends WrapperImpl implements Statement {
+public class StatementImpl extends WrapperImpl implements TeiidStatement {
private static Logger logger = Logger.getLogger("org.teiid.jdbc"); //$NON-NLS-1$
// State constants
@@ -114,7 +114,7 @@
private String debugLog;
// the last query annotations
- private List annotations;
+ private List<Annotation> annotations;
// resultSet object produced by execute methods on the statement.
protected ResultSetImpl resultSet;
@@ -889,7 +889,7 @@
this.debugLog = debugLog;
}
- void setAnnotations(List annotations) {
+ void setAnnotations(List<Annotation> annotations) {
this.annotations = annotations;
}
@@ -909,9 +909,9 @@
}
if(planDescription != null) {
this.currentPlanDescription = planDescription;
- return PlanNodeImpl.constructFromMap(this.currentPlanDescription);
+ return PlanNode.constructFromMap(this.currentPlanDescription);
}else if(this.currentPlanDescription != null) {
- return PlanNodeImpl.constructFromMap(this.currentPlanDescription);
+ return PlanNode.constructFromMap(this.currentPlanDescription);
}
return null;
}
@@ -928,7 +928,7 @@
* Get annotations
* @return Query planner annotations - Collection of Annotation
*/
- public Collection getAnnotations() {
+ public Collection<Annotation> getAnnotations() {
return this.annotations;
}
@@ -958,11 +958,11 @@
this.currentPlanDescription = resultsMsg.getPlanDescription();
Collection serverAnnotations = resultsMsg.getAnnotations();
if(serverAnnotations != null) {
- List annotations = new ArrayList(serverAnnotations.size());
+ List<Annotation> annotations = new ArrayList<Annotation>(serverAnnotations.size());
Iterator annIter = serverAnnotations.iterator();
while(annIter.hasNext()) {
String[] serverAnnotation = (String[]) annIter.next();
- Annotation annotation = new AnnotationImpl(serverAnnotation);
+ Annotation annotation = new Annotation(serverAnnotation);
annotations.add(annotation);
}
this.annotations = annotations;
Copied: trunk/client-jdbc/src/main/java/org/teiid/jdbc/TeiidStatement.java (from rev 1973, trunk/client-jdbc/src/main/java/org/teiid/jdbc/api/Statement.java)
===================================================================
--- trunk/client-jdbc/src/main/java/org/teiid/jdbc/TeiidStatement.java (rev 0)
+++ trunk/client-jdbc/src/main/java/org/teiid/jdbc/TeiidStatement.java 2010-03-19 16:17:09 UTC (rev 1977)
@@ -0,0 +1,115 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+
+package org.teiid.jdbc;
+
+import java.io.IOException;
+import java.io.Reader;
+import java.io.Serializable;
+import java.util.Collection;
+
+import org.teiid.jdbc.plan.Annotation;
+import org.teiid.jdbc.plan.PlanNode;
+
+
+
+/**
+ * This interface provides methods in
+ * addition to the standard JDBC methods.
+ */
+public interface TeiidStatement extends java.sql.Statement {
+
+ /**
+ * Get the execution property value.
+ * @param name Execution property name
+ * @return Execution property value or null if not set
+ */
+ String getExecutionProperty(String name);
+
+ /**
+ * Set the execution property value.
+ * @param name Execution property name
+ * @param value Execution property value
+ */
+ void setExecutionProperty(String name, String value);
+
+ /**
+ * Obtain the query plan object representation from the last
+ * command executed on this Statement, if a query plan was
+ * requested in the command. If no plan was requested, this
+ * method will return null.
+ * @return PlanNode representing the root of the query plan
+ */
+ PlanNode getPlanDescription();
+
+ /**
+ * Obtain the query planner debug log from the last command
+ * executed on this Statement, if it was requested with
+ * OPTION DEBUG. If no debug output was requested, this
+ * method will return null.
+ * @return Debug log or null if no log exists
+ */
+ String getDebugLog();
+
+ /**
+ * Get collection of annotations from the query planner from
+ * the last command executed on the Statement
+ * @return Collection of {@link Annotation}s, may return null
+ */
+ Collection<Annotation> getAnnotations();
+
+ /**
+ * Attach a stylesheet to be applied on the server for XML queries
+ * executed with this Statement.
+ * @param reader Reader for reading a stylesheet in XML
+ * @throws IOException If an error occurs reading the stylesheet
+ * @deprecated
+ */
+ void attachStylesheet(Reader reader) throws IOException;
+
+ /**
+ * Clear any previously attached stylesheet for this Statement object.
+ * @deprecated
+ */
+ void clearStylesheet();
+
+ /**
+ * Get ID for last execution which can be used for matching up executions
+ * on the client side with executions in the server logs.
+ * @return String identifier for the last execution
+ */
+ String getRequestIdentifier();
+
+ /**
+ * Set the per-statement security payload. This optional payload will
+ * accompany each request to the data source(s) so that the connector
+ * will have access to it.
+ *
+ * <p>To remove an existing payload from a statement, call this method
+ * with a <code>null</code> argument.</p>
+ *
+ * @param payload The payload that is to accompany requests executed
+ * from this statement.
+ * @since 4.2
+ */
+ void setPayload(Serializable payload);
+}
Property changes on: trunk/client-jdbc/src/main/java/org/teiid/jdbc/TeiidStatement.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied: trunk/client-jdbc/src/main/java/org/teiid/jdbc/plan (from rev 1973, trunk/client/src/main/java/org/teiid/plan/api)
Modified: trunk/client-jdbc/src/main/java/org/teiid/jdbc/plan/Annotation.java
===================================================================
--- trunk/client/src/main/java/org/teiid/plan/api/Annotation.java 2010-03-18 16:18:20 UTC (rev 1973)
+++ trunk/client-jdbc/src/main/java/org/teiid/jdbc/plan/Annotation.java 2010-03-19 16:17:09 UTC (rev 1977)
@@ -20,41 +20,44 @@
* 02110-1301 USA.
*/
-package org.teiid.plan.api;
+package org.teiid.jdbc.plan;
+
/**
- * Annotation from query engine, collected during execution.
*/
-public interface Annotation {
+public class Annotation {
- public static final int LOW = 1;
- public static final int MEDIUM = 2;
- public static final int HIGH = 3;
+ private String category;
+ private String description;
+ private String resolution;
+ private int severity;
- /**
- * Get category of this annotation.
- * @return Category
- */
- public String getCategory();
+ public Annotation(String[] serverAnnotation) {
+ category = serverAnnotation[0];
+ description = serverAnnotation[1];
+ resolution = serverAnnotation[2];
+
+ severity = Integer.parseInt(serverAnnotation[3]);
+ }
+
+ public String getCategory() {
+ return category;
+ }
+
+ public String getAnnotation() {
+ return description;
+ }
+
+ public String getResolution() {
+ return resolution;
+ }
+
+ public int getSeverity() {
+ return severity;
+ }
- /**
- * Get annotation description.
- * @return Annotation description
- */
- public String getAnnotation();
-
- /**
- * Get resolution for annotation. May be null if no resolution is suggested.
- * @return Resolution, or null
- */
- public String getResolution();
-
- /**
- * Get severity of this annotation
- * @return Severity level
- * @see #LOW
- * @see #MEDIUM
- * @see #HIGH
- */
- public int getSeverity();
+ public String toString() {
+ return description;
+ }
+
}
Modified: trunk/client-jdbc/src/main/java/org/teiid/jdbc/plan/DefaultDisplayHelper.java
===================================================================
--- trunk/client/src/main/java/org/teiid/plan/api/DefaultDisplayHelper.java 2010-03-18 16:18:20 UTC (rev 1973)
+++ trunk/client-jdbc/src/main/java/org/teiid/jdbc/plan/DefaultDisplayHelper.java 2010-03-19 16:17:09 UTC (rev 1977)
@@ -20,7 +20,7 @@
* 02110-1301 USA.
*/
-package org.teiid.plan.api;
+package org.teiid.jdbc.plan;
import java.util.ArrayList;
import java.util.List;
@@ -31,47 +31,28 @@
*/
public class DefaultDisplayHelper implements DisplayHelper {
- private static final String OUTPUT_COLS = "outputCols"; //$NON-NLS-1$
- private static final String TYPE = "type"; //$NON-NLS-1$
-
-
- /*
- * @see com.metamatrix.jdbc.api.DisplayHelper#getName(com.metamatrix.jdbc.api.PlanNode)
- */
public String getName(PlanNode node) {
- return (String) node.getProperties().get(TYPE);
+ return (String)node.getProperties().get(PlanNode.TYPE);
}
- /*
- * @see com.metamatrix.jdbc.api.DisplayHelper#getDescription(com.metamatrix.jdbc.api.PlanNode)
- */
public String getDescription(PlanNode node) {
return ""; //$NON-NLS-1$
}
- /*
- * @see com.metamatrix.jdbc.api.DisplayHelper#getOrderedProperties(com.metamatrix.jdbc.api.PlanNode)
- */
- public List getOrderedProperties(PlanNode node) {
- List props = new ArrayList(node.getProperties().keySet());
- props.remove(TYPE);
- if(props.contains(OUTPUT_COLS)) {
- props.remove(OUTPUT_COLS);
- props.add(0, OUTPUT_COLS);
+ public List<String> getOrderedProperties(PlanNode node) {
+ List<String> props = new ArrayList<String>(node.getProperties().keySet());
+ props.remove(PlanNode.TYPE);
+ if(props.contains(PlanNode.OUTPUT_COLS)) {
+ props.remove(PlanNode.OUTPUT_COLS);
+ props.add(0, PlanNode.OUTPUT_COLS);
}
return props;
}
- /*
- * @see com.metamatrix.jdbc.api.DisplayHelper#getPropertyName(java.lang.String)
- */
public String getPropertyName(String property) {
return property;
}
- /*
- * @see com.metamatrix.jdbc.api.DisplayHelper#setMaxDescriptionLength(int)
- */
public void setMaxDescriptionLength(int length) {
}
Modified: trunk/client-jdbc/src/main/java/org/teiid/jdbc/plan/DisplayHelper.java
===================================================================
--- trunk/client/src/main/java/org/teiid/plan/api/DisplayHelper.java 2010-03-18 16:18:20 UTC (rev 1973)
+++ trunk/client-jdbc/src/main/java/org/teiid/jdbc/plan/DisplayHelper.java 2010-03-19 16:17:09 UTC (rev 1977)
@@ -20,7 +20,7 @@
* 02110-1301 USA.
*/
-package org.teiid.plan.api;
+package org.teiid.jdbc.plan;
import java.util.List;
@@ -56,7 +56,7 @@
* @param node The node
* @return List of property names
*/
- List getOrderedProperties(PlanNode node);
+ List<String> getOrderedProperties(PlanNode node);
/**
* Get display name for a particular property name.
Deleted: trunk/client-jdbc/src/main/java/org/teiid/jdbc/plan/ExecutionProperties.java
===================================================================
--- trunk/client/src/main/java/org/teiid/plan/api/ExecutionProperties.java 2010-03-18 16:18:20 UTC (rev 1973)
+++ trunk/client-jdbc/src/main/java/org/teiid/jdbc/plan/ExecutionProperties.java 2010-03-19 16:17:09 UTC (rev 1977)
@@ -1,100 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package org.teiid.plan.api;
-
-/**
- * MetaMatrix-specific execution properties. These execution properties can
- * be set via the {@link com.metamatrix.jdbc.api.Statement#setExecutionProperty(String, String)}
- * method. They affect the subsequent execution of all commands on that Statement
- * instance.
- */
-public interface ExecutionProperties {
-
- /** Execution property name for XML format */
- public static final String PROP_XML_FORMAT = "XMLFormat"; //$NON-NLS-1$
-
- /** Execution property name for XML validation */
- public static final String PROP_XML_VALIDATION = "XMLValidation"; //$NON-NLS-1$
-
- /** Execution property name for transaction auto wrap mode */
- public static final String PROP_TXN_AUTO_WRAP = "autoCommitTxn"; //$NON-NLS-1$
-
- /** Execution property name for partial results mode */
- public static final String PROP_PARTIAL_RESULTS_MODE = "partialResultsMode"; //$NON-NLS-1$
-
- /** XML results format: XML results displayed as a formatted tree */
- public static final String XML_TREE_FORMAT = "Tree"; //$NON-NLS-1$
-
- /** XML results format: XML results displayed in compact form */
- public static final String XML_COMPACT_FORMAT = "Compact"; //$NON-NLS-1$
-
- /** Transaction auto wrap constant - never wrap a command execution in a transaction */
- public static final String TXN_WRAP_OFF = "OFF"; //$NON-NLS-1$
-
- /** Transaction auto wrap constant - always wrap commands in a transaction. */
- public static final String TXN_WRAP_ON = "ON"; //$NON-NLS-1$
-
- /**
- * Transaction auto wrap constant - checks if a command
- * requires a transaction and will be automatically wrap it.
- */
- public static final String TXN_WRAP_DETECT = "DETECT"; //$NON-NLS-1$
-
- /**
- * Whether to use result set cache if it is available
- * @since 4.2
- */
- public static final String RESULT_SET_CACHE_MODE = "resultSetCacheMode"; //$NON-NLS-1$
-
- /**
- * Default fetch size to use on Statements if the fetch size is not explicitly set.
- * The default is 500.
- * @since 4.2
- */
- public static final String PROP_FETCH_SIZE = "fetchSize"; //$NON-NLS-1$
-
- /**
- * If true, will ignore autocommit for local transactions.
- * @since 5.5.2
- */
- public static final String DISABLE_LOCAL_TRANSACTIONS = "disableLocalTxn"; //$NON-NLS-1$
-
- /**
- * Overrides the handling of double quoted identifiers to allow them to be strings.
- * @since 4.3
- */
- public static final String ANSI_QUOTED_IDENTIFIERS = "ansiQuotedIdentifiers"; //$NON-NLS-1$
-
- /**
- * Additional options/hints for executing the command
- * @since 4.3
- */
- public static final String PROP_SQL_OPTIONS = "sqlOptions"; //$NON-NLS-1$
-
- /**
- * Passed as an option to PROP_SQL_OPTIONS
- */
- public static final String SQL_OPTION_SHOWPLAN = "SHOWPLAN"; //$NON-NLS-1$
-
-}
-
\ No newline at end of file
Modified: trunk/client-jdbc/src/main/java/org/teiid/jdbc/plan/PlanNode.java
===================================================================
--- trunk/client/src/main/java/org/teiid/plan/api/PlanNode.java 2010-03-18 16:18:20 UTC (rev 1973)
+++ trunk/client-jdbc/src/main/java/org/teiid/jdbc/plan/PlanNode.java 2010-03-19 16:17:09 UTC (rev 1977)
@@ -20,37 +20,75 @@
* 02110-1301 USA.
*/
-package org.teiid.plan.api;
+package org.teiid.jdbc.plan;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
-/**
- * Represents one node in a query plan tree. Every node has a list of child nodes
- * and a Map of property name to property value. Property names are always strings
- * and property values should always be Java primitive types such as String, Integer,
- * Boolean, and Lists of those types. In some cases, a property value may itself also be
- * a PlanNode.
- */
-public interface PlanNode {
+public class PlanNode {
- /**
- * Get the parent node for this node.
- * @return Parent node or null if this node is the root
- */
- PlanNode getParent();
+ //TODO: consolidate these constants with Describable
+ public static final String OUTPUT_COLS = "outputCols"; //$NON-NLS-1$
+ public static final String TYPE = "type"; //$NON-NLS-1$
+ static final String PROP_CHILDREN = "children"; //$NON-NLS-1$
+
+ private Map<String, Object> props;
+ private PlanNode parent;
+ private List<PlanNode> children = new ArrayList<PlanNode>();
+
+ PlanNode(Map<String, Object> props) {
+ this.props = props;
+ }
- /**
- * Get the children of this component, which are always of type PlanNode.
- * @return List of PlanNode
- */
- List getChildren();
+ void setParent(PlanNode parent) {
+ this.parent = parent;
+ }
+
+ public PlanNode getParent() {
+ return this.parent;
+ }
+
+ void addChild(PlanNode child) {
+ children.add(child);
+ }
+
+ public List<PlanNode> getChildren() {
+ return this.children;
+ }
+
+ public Map<String, Object> getProperties() {
+ return this.props;
+ }
- /**
- * Get the properties for this component. Property names are always String.
- * Property values are typically String, Integer, Boolean, a List of one of
- * those primitive types, or another PlanNode in rare cases.
- */
- Map getProperties();
-
+ public static PlanNode constructFromMap(Map properties) {
+ // Construct node without child property
+ Map copy = new HashMap(properties);
+ List childMaps = (List) copy.remove(PROP_CHILDREN);
+
+ // Convert any subplans to PlanNodes as well
+ Iterator keyIter = copy.keySet().iterator();
+ while(keyIter.hasNext()) {
+ Object key = keyIter.next();
+ Object value = copy.get(key);
+ if(value instanceof Map) {
+ copy.put(key, constructFromMap((Map)value));
+ }
+ }
+
+ // Construct this node
+ PlanNode node = new PlanNode(copy);
+
+ // Then construct children and connect
+ if(childMaps != null) {
+ for(int i=0; i<childMaps.size(); i++) {
+ Map childMap = (Map) childMaps.get(i);
+ PlanNode child = constructFromMap(childMap);
+ child.setParent(node);
+ node.addChild(child);
+ }
+ }
+
+ // And return
+ return node;
+ }
+
}
Modified: trunk/client-jdbc/src/main/java/org/teiid/jdbc/plan/PlanVisitor.java
===================================================================
--- trunk/client/src/main/java/org/teiid/plan/api/PlanVisitor.java 2010-03-18 16:18:20 UTC (rev 1973)
+++ trunk/client-jdbc/src/main/java/org/teiid/jdbc/plan/PlanVisitor.java 2010-03-19 16:17:09 UTC (rev 1977)
@@ -20,7 +20,7 @@
* 02110-1301 USA.
*/
-package org.teiid.plan.api;
+package org.teiid.jdbc.plan;
import java.util.Collection;
import java.util.LinkedList;
@@ -50,12 +50,12 @@
* @param rootNode The rootNode of the tree
*/
public void visit(PlanNode rootNode) {
- LinkedList nodeStack = new LinkedList();
+ LinkedList<PlanNode> nodeStack = new LinkedList<PlanNode>();
nodeStack.add(rootNode);
while(! nodeStack.isEmpty()) {
// Obtain next node
- PlanNode node = (PlanNode) nodeStack.removeFirst();
+ PlanNode node = nodeStack.removeFirst();
// Visit node
visitNode(node);
Deleted: trunk/client-jdbc/src/main/java/org/teiid/jdbc/plan/QueryPlanDisplayHelper.java
===================================================================
--- trunk/client/src/main/java/org/teiid/plan/api/QueryPlanDisplayHelper.java 2010-03-18 16:18:20 UTC (rev 1973)
+++ trunk/client-jdbc/src/main/java/org/teiid/jdbc/plan/QueryPlanDisplayHelper.java 2010-03-19 16:17:09 UTC (rev 1977)
@@ -1,517 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package org.teiid.plan.api;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.TreeMap;
-
-
-
-/**
- *
- */
-public class QueryPlanDisplayHelper implements DisplayHelper {
-
- //Maps containing display values by type
- private Map nodeNameMap = new TreeMap();
- private Map childTypeMap = new TreeMap();
- private Map descriptionMap = new TreeMap();
- private Map propertyOrderMap = new TreeMap();
- private Map propertyNameMap = new TreeMap();
-
- /**
- * Default constructor
- */
- public QueryPlanDisplayHelper() {
- init();
- }
-
- /**
- *
- */
- private void init() {
- /*
- * Node Name Mappings - to change node name for display
- */
- nodeNameMap.put("Child Relational Plan", "Relational Plan"); //$NON-NLS-1$ //$NON-NLS-2$
- nodeNameMap.put("Child XML Plan", "XML Plan"); //$NON-NLS-1$ //$NON-NLS-2$
- nodeNameMap.put("COMMENT", "ADD COMMENT"); //$NON-NLS-1$ //$NON-NLS-2$
-
- childTypeMap.put("Relational Plan", "Child Relational Plan"); //$NON-NLS-1$ //$NON-NLS-2$
- childTypeMap.put("XML Plan", "Child XML Plan"); //$NON-NLS-1$ //$NON-NLS-2$
-
- /*
- * Description Mapping logic
- */
- descriptionMap.put("Join", "${joinType} ON ${joinCriteria}"); //$NON-NLS-1$ //$NON-NLS-2$
- descriptionMap.put("Project", "${selectCols}"); //$NON-NLS-1$ //$NON-NLS-2$
- descriptionMap.put("Select", "${criteria}"); //$NON-NLS-1$ //$NON-NLS-2$
- descriptionMap.put("Access", "${sql}"); //$NON-NLS-1$ //$NON-NLS-2$
- descriptionMap.put("EXECUTE SQL", "${sql}"); //$NON-NLS-1$ //$NON-NLS-2$
- descriptionMap.put("LOOP", "${joinType} ON ${joinCriteria}"); //$NON-NLS-1$ //$NON-NLS-2$
- descriptionMap.put("Join", "${joinType} ON ${joinCriteria}"); //$NON-NLS-1$ //$NON-NLS-2$
- descriptionMap.put("Limit", "${rowLimit}"); //$NON-NLS-1$ //$NON-NLS-2$
- descriptionMap.put("Offset", "${rowOffset}"); //$NON-NLS-1$ //$NON-NLS-2$
-
- /*
- * Property Order logic
- */
-
- putPropertySortOrder("default", new String[] { "outputCols"}); //$NON-NLS-1$ //$NON-NLS-2$
- putPropertySortOrder("Access", new String[] { "outputCols", "sql", "modelName"}); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- putPropertySortOrder("Group", new String[] { "outputCols", "groupCols"}); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- putPropertySortOrder("Join", new String[] { "outputCols", "joinType", "joinCriteria"}); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- putPropertySortOrder("Merge Join", new String[] { "outputCols", "joinType", "joinCriteria"}); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- putPropertySortOrder("Plan Execution", new String[] { "outputCols", "execPlan"}); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- putPropertySortOrder("Project Into", new String[] { "outputCols", "intoGrp", "selectCols"}); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- putPropertySortOrder("Project", new String[] { "outputCols", "selectCols"}); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- putPropertySortOrder("Dependent Project", new String[] { "outputCols", "selectCols"}); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- putPropertySortOrder("Select", new String[] { "outputCols", "criteria"}); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- putPropertySortOrder("Dependent Select", new String[] { "outputCols", "criteria"}); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- putPropertySortOrder("Sort", new String[] { "outputCols", "sortCols", "removeDups"}); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- putPropertySortOrder("Limit", new String[] { "outputCols", "rowLimit"}); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- putPropertySortOrder("Offset", new String[] { "outputCols", "rowOffset"}); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-
- putPropertySortOrder("ABORT", new String[] { "message" }); //$NON-NLS-1$ //$NON-NLS-2$
- putPropertySortOrder("ADD COMMENT", new String[] { "message" }); //$NON-NLS-1$ //$NON-NLS-2$
- putPropertySortOrder("ADD ELEMENT", new String[] { "tag", "optional", "dataCol", "namespace", "namespaceDeclarations", "default" }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$
- putPropertySortOrder("ADD ATTRIBUTE", new String[] { "tag", "dataCol", "namespace", "default" }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
- putPropertySortOrder("CACHE", new String[] { }); //$NON-NLS-1$
- putPropertySortOrder("UNCACHE", new String[] { }); //$NON-NLS-1$
- putPropertySortOrder("CLOSE RESULTSET", new String[] { "resultSet" }); //$NON-NLS-1$ //$NON-NLS-2$
- putPropertySortOrder("END DOCUMENT", new String[] { }); //$NON-NLS-1$
- putPropertySortOrder("EXECUTE SQL", new String[] { "resultSet", "sql", "isStaging", "inMemory", "group", "program" }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$
- putPropertySortOrder("CHOICE", new String[] { "conditions", "programs", "defaultProgram" }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- putPropertySortOrder("START DOCUMENT", new String[] { "encoding", "formatted" }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- putPropertySortOrder("NEXT ROW", new String[] { "resultSet" }); //$NON-NLS-1$ //$NON-NLS-2$
- putPropertySortOrder("DOCUMENT UP", new String[] { }); //$NON-NLS-1$
- putPropertySortOrder("DOCUMENT DOWN", new String[] { }); //$NON-NLS-1$
- putPropertySortOrder("NO OP", new String[] { }); //$NON-NLS-1$
- putPropertySortOrder("ASSIGN REFERENCE", new String[] { "expression" }); //$NON-NLS-1$ //$NON-NLS-2$
- putPropertySortOrder("LOOP", new String[] { "resultSet", "program" }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-
- putPropertySortOrder("ASSIGNMENT", new String[] { "variable", "expression", "program" }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- putPropertySortOrder("BREAK", new String[] { }); //$NON-NLS-1$
- putPropertySortOrder("CONTINUE", new String[] { }); //$NON-NLS-1$
- putPropertySortOrder("CREATE CURSOR", new String[] { "resultSet", "sql" }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- putPropertySortOrder("DECLARE VARIABLE", new String[] { "variable"}); //$NON-NLS-1$ //$NON-NLS-2$
- putPropertySortOrder("IF", new String[] { "criteria", "then", "else" }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- putPropertySortOrder("RAISE ERROR", new String[] { "message" }); //$NON-NLS-1$ //$NON-NLS-2$
- putPropertySortOrder("WHILE", new String[] { "criteria", "program" }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-
- /*
- * Property Name logic
- */
- propertyNameMap.put("outputCols", "Output Columns"); //$NON-NLS-1$ //$NON-NLS-2$
- propertyNameMap.put("criteria", "Criteria"); //$NON-NLS-1$ //$NON-NLS-2$
- propertyNameMap.put("selectCols", "Select Columns"); //$NON-NLS-1$ //$NON-NLS-2$
- propertyNameMap.put("groupCols", "Grouping Columns"); //$NON-NLS-1$ //$NON-NLS-2$
- propertyNameMap.put("sql", "Source Query"); //$NON-NLS-1$ //$NON-NLS-2$
- propertyNameMap.put("modelName", "Model Name"); //$NON-NLS-1$ //$NON-NLS-2$
- propertyNameMap.put("joinType", "Join Type"); //$NON-NLS-1$ //$NON-NLS-2$
- propertyNameMap.put("joinCriteria", "Join Criteria"); //$NON-NLS-1$ //$NON-NLS-2$
- propertyNameMap.put("joinStrategy", "Join Strategy"); //$NON-NLS-1$ //$NON-NLS-2$
- propertyNameMap.put("execPlan", "Execution Plan"); //$NON-NLS-1$ //$NON-NLS-2$
- propertyNameMap.put("intoGrp", "Select Into Group"); //$NON-NLS-1$ //$NON-NLS-2$
- propertyNameMap.put("sortCols", "Sort Columns"); //$NON-NLS-1$ //$NON-NLS-2$
- propertyNameMap.put("removeDups", "Remove Duplicates"); //$NON-NLS-1$ //$NON-NLS-2$
- propertyNameMap.put("message", "Message"); //$NON-NLS-1$ //$NON-NLS-2$
- propertyNameMap.put("tag", "XML Node Name"); //$NON-NLS-1$ //$NON-NLS-2$
- propertyNameMap.put("namespace", "Namespace"); //$NON-NLS-1$ //$NON-NLS-2$
- propertyNameMap.put("dataCol", "Data Column"); //$NON-NLS-1$ //$NON-NLS-2$
- propertyNameMap.put("namespaceDeclarations", "Namespace Declarations"); //$NON-NLS-1$ //$NON-NLS-2$
- propertyNameMap.put("optional", "Optional Flag"); //$NON-NLS-1$ //$NON-NLS-2$
- propertyNameMap.put("default", "Default Value"); //$NON-NLS-1$ //$NON-NLS-2$
- propertyNameMap.put("program", "Sub Program"); //$NON-NLS-1$ //$NON-NLS-2$
- propertyNameMap.put("recurseDir", "Recursion Direction"); //$NON-NLS-1$ //$NON-NLS-2$
- propertyNameMap.put("resultSet", "Result Set"); //$NON-NLS-1$ //$NON-NLS-2$
- propertyNameMap.put("bindings", "Bindings"); //$NON-NLS-1$ //$NON-NLS-2$
- propertyNameMap.put("isStaging", "Is Staging Flag"); //$NON-NLS-1$ //$NON-NLS-2$
- propertyNameMap.put("inMemory", "Source In Memory Flag"); //$NON-NLS-1$ //$NON-NLS-2$
- propertyNameMap.put("conditions", "Conditions"); //$NON-NLS-1$ //$NON-NLS-2$
- propertyNameMap.put("programs", "Sub Programs"); //$NON-NLS-1$ //$NON-NLS-2$
- propertyNameMap.put("defaultProgram", "Default Programs"); //$NON-NLS-1$ //$NON-NLS-2$
- propertyNameMap.put("encoding", "Encoding"); //$NON-NLS-1$ //$NON-NLS-2$
- propertyNameMap.put("formatted", "Formatting Flag"); //$NON-NLS-1$ //$NON-NLS-2$
- propertyNameMap.put("expression", "Expression"); //$NON-NLS-1$ //$NON-NLS-2$
- propertyNameMap.put("variable", "Variable"); //$NON-NLS-1$ //$NON-NLS-2$
- propertyNameMap.put("group", "Group"); //$NON-NLS-1$ //$NON-NLS-2$
- propertyNameMap.put("then", "Then"); //$NON-NLS-1$ //$NON-NLS-2$
- propertyNameMap.put("else", "Else"); //$NON-NLS-1$ //$NON-NLS-2$
- propertyNameMap.put("nodeStatistics", "Statistics"); //$NON-NLS-1$ //$NON-NLS-2$
- propertyNameMap.put("nodeCostEstimates", "Cost Estimates"); //$NON-NLS-1$ //$NON-NLS-2$
- propertyNameMap.put("rowLimit", "Row Limit"); //$NON-NLS-1$ //$NON-NLS-2$
- propertyNameMap.put("rowOffset", "Row Offset"); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * Put property sort order for a particular type in the workOrderMap
- * @param type The node type
- * @param propOrder Sorted list of property names
- * @since 5.0
- */
- private void putPropertySortOrder(String type, String[] propOrder) {
- NodeProperty[] nodeProps = new NodeProperty[propOrder.length];
- for(int i=0; i<propOrder.length; i++) {
- nodeProps[i] = new NodeProperty(new Integer(i), type, propOrder[i]);
- }
- propertyOrderMap.put(type, nodeProps);
- }
-
- /**
- *
- */
- public String getName(PlanNode node)
- {
- String name = (String) node.getProperties().get("type"); //$NON-NLS-1$
-
- /*
- * here we check to see if the type was null. If it was null, no need to look for a null key in the tree map.
- */
- if (name != null) {
- if(nodeNameMap.containsKey(name)) {
- name = (String)nodeNameMap.get(name);
- }
- } else {
- name = "Node"; //$NON-NLS-1$
- }
-
- name+=getDescription(node);
-
- return name;
- }
-
- /**
- *
- */
- public String getDescription(PlanNode node)
- {
- Map nodeProps = node.getProperties();
- String description = ""; //$NON-NLS-1$
-
- // String nodeName="";
- String type = (String)nodeProps.get("type"); //$NON-NLS-1$
- if (type != null) {
- description = (String)nodeProps.get("desc"); //$NON-NLS-1$
-
- if (description == null || description.equals("")) //$NON-NLS-1$
- {
- description = (String)descriptionMap.get(type);
- }
- }
-
- if (description == null || description.trim().length() == 0) {
- description = ""; //$NON-NLS-1$
- } else {
- description = replaceProperties(description.trim(), nodeProps).trim();
- if (description.length() > 0 ) {
- description = " [" + description + "]"; //$NON-NLS-1$ //$NON-NLS-2$
- }
- }
-
- return description;
- }
-
- private String replaceProperties(String descriptionExpression, Map nodeProps) {
- int startIndex = descriptionExpression.indexOf('$');
- if (startIndex < 0) {
- return descriptionExpression;
- }
- int endIndex = descriptionExpression.indexOf('}');
- if (endIndex < 0) {
- return descriptionExpression;
- }
- String propertyName = descriptionExpression.substring(startIndex+2, endIndex).trim();
- Object descriptionObject = nodeProps.get(propertyName);
- String replacement = ""; //$NON-NLS-1$
- if (descriptionObject != null) {
- if (descriptionObject instanceof Collection) {
- replacement = stringifyCollection((Collection)descriptionObject);
- } else {
- replacement = descriptionObject.toString();
- }
- }
- descriptionExpression = descriptionExpression.substring(0, startIndex)
- + replacement
- + ((endIndex < descriptionExpression.length() - 1)
- ? descriptionExpression.substring(endIndex + 1)
- : ""); //$NON-NLS-1$
- return replaceProperties(descriptionExpression, nodeProps);
- }
-
- private String stringifyCollection(Collection collection) {
- Iterator iterator = collection.iterator();
- if (iterator.hasNext()) {
- StringBuffer buffer = new StringBuffer(iterator.next().toString());
- while(iterator.hasNext()) {
- buffer.append(", ").append(iterator.next().toString()); //$NON-NLS-1$
- }
- return buffer.toString();
- }
- return ""; //$NON-NLS-1$
- }
-
- /**
- *
- */
- public String getType(PlanNode node)
- {
- Map nodeProps = node.getProperties();
- String type = (String) nodeProps.get("type"); //$NON-NLS-1$
- if (type==null)
- {
- type=""; //$NON-NLS-1$
- }
- if (node.getParent() != null) {
- if (childTypeMap.get(type) != null) {
- return (String)childTypeMap.get(type);
- }
- }
- return type;
- }
-
- /**
- *
- */
- public Map getOrderedPropertiesMap(PlanNode node)
- {
- /* This methods returns a Map of Maps that represents the passed node's
- * properties in sorted order. The key for the main map is an Integer
- * value representing the sequence no. It's value is a Map that uses property
- * name/type for its key and the properties description for its value.
- */
-
- //Create key array for this node's properties
- Object[] nodeTypeKeySetArray=node.getProperties().keySet().toArray();
-
- //Set the map variable for this nope's properties.
- Map nodeProperties = node.getProperties();
-
- //Set the type variable for this node
- String nodeType=(String)node.getProperties().get("type"); //$NON-NLS-1$
-
- //Create key array for the master properties ordered map
- Object[] orderedPropArray = propertyOrderMap.keySet().toArray();
-
- //Create an iterator for the master map
- Iterator orderedPropIterator = propertyOrderMap.values().iterator();
-
- Map propertiesOrdered=new TreeMap();
- //Map propertiesMap=new HashMap();
- NodeProperty[] nodeProps=null;
-
- int count = 0;
-
- if (nodeType != null) {
- // Loop through master map, find the current nodes ordered set, and add
- // to our Map of Maps.
- for (int i = 0; i < orderedPropArray.length; i++) {
- String orderedPropKey = (String)orderedPropArray[i];
- nodeProps = (NodeProperty[])orderedPropIterator.next();
- if (!(nodeType.equalsIgnoreCase(orderedPropKey))) {
- continue;
- }// Else we found our nodes ordered set
-
- for (int j = 0; j < nodeProps.length; j++) {
- String nodeProp = nodeProps[j].getValue();
-
- if (nodeProperties.get(nodeProp) == null) {
- // We don't have an instance of this property for
- // this node so just go to the next one.
- } else {
- Map prop = new HashMap();
- prop.put(nodeProp, nodeProperties.get(nodeProp));
- propertiesOrdered.put(new Integer(j), prop);
- count = j;
-
- }
- }
- }
-
- if (propertiesOrdered.size() < node.getProperties().size()) {
- // We need to append missing properties to the ordered properties map.
- // This would happen when the node has properties that aren't listed
- // in the master ordered properties map.
- ArrayList addKeys = new ArrayList();
- for (int i = 0; i < node.getProperties().size(); i++) {
- Iterator propIter = null;
- propIter = propertiesOrdered.values().iterator();
- boolean containsKey = false;
- for (int k = 0; k < propertiesOrdered.size(); k++) {
- Map propEntry = (Map)propIter.next();
- if (propEntry.containsKey(nodeTypeKeySetArray[i])) {
- //The property has already been added
- containsKey = true;
- break;
- }
- }
- if (!containsKey) {
- addKeys.add(nodeTypeKeySetArray[i]);
- }
- }
-
- for (int i = 0; i < addKeys.size(); i++) {
- count++;
- Map prop = new HashMap();
- prop.put(addKeys.get(i), node.getProperties().get(addKeys.get(i)));
- propertiesOrdered.put(new Integer(count), prop);
- }
- }
- }
-
- return propertiesOrdered;
- }
-
- /**
- * This methods returns a List of sorted property names.
- */
- public List getOrderedProperties(PlanNode node)
- {
- Map orderPropMap = getOrderedPropertiesMap(node);
- Iterator mapIter = orderPropMap.keySet().iterator();
- List orderPropList=new ArrayList();
-
- while (mapIter.hasNext())
- {
- Object key = mapIter.next();
- Map valueMap = (Map) orderPropMap.get(key);
- String propName = (String) valueMap.keySet().iterator().next();
- if(!propName.equals("type") && !propName.equals("desc")) { //$NON-NLS-1$ //$NON-NLS-2$
- orderPropList.add(propName);
- }
- }
-
- return orderPropList;
- }
-
- /**
- *
- */
- public void setMaxDescriptionLength(int maxLength)
- {
- //does nothing
- }
-
- /**
- *
- */
- public String getProperty(String property)
- {
- String propertyDisplay=(String)propertyNameMap.get(property);
-
- if (propertyDisplay==null)
- {
- propertyDisplay=property;
- }
- return propertyDisplay;
- }
-
- /**
- *
- */
- public String getPropertyName(String property)
- {
- String propertyDisplay=(String)propertyNameMap.get(property);
-
- if (propertyDisplay==null)
- {
- propertyDisplay=property;
- }
- return propertyDisplay;
- }
-
-
- /* Node property inner class used for storing properties
- * to sort for the PropertyOrderMap
- */
- private class NodeProperty
- {
- Integer seqNo = null;
- String name = ""; //$NON-NLS-1$
- String value = ""; //$NON-NLS-1$
-
- public NodeProperty(Integer seqNo,
- String name,
- String value)
- {
- this.seqNo = seqNo;
- this.name = name;
- this.value = value;
- }
- /**
- * @return
- */
- public String getName()
- {
- return name;
- }
-
- /**
- * @return
- */
- public Integer getSeqNo()
- {
- return seqNo;
- }
-
- /**
- * @return
- */
- public String getValue()
- {
- return value;
- }
-
- /**
- * @param string
- */
- public void setName(String string)
- {
- name = string;
- }
-
- /**
- * @param integer
- */
- public void setSeqNo(Integer integer)
- {
- seqNo = integer;
- }
-
- /**
- * @param string
- */
- public void setValue(String string)
- {
- value = string;
- }
-
- }
-
- /* End of Node property inner class */
-}
Modified: trunk/client-jdbc/src/main/java/org/teiid/jdbc/plan/TextOutputVisitor.java
===================================================================
--- trunk/client/src/main/java/org/teiid/plan/api/TextOutputVisitor.java 2010-03-18 16:18:20 UTC (rev 1973)
+++ trunk/client-jdbc/src/main/java/org/teiid/jdbc/plan/TextOutputVisitor.java 2010-03-19 16:17:09 UTC (rev 1977)
@@ -20,7 +20,7 @@
* 02110-1301 USA.
*/
-package org.teiid.plan.api;
+package org.teiid.jdbc.plan;
import java.util.Collection;
import java.util.HashMap;
Modified: trunk/client-jdbc/src/main/java/org/teiid/jdbc/plan/XMLOutputVisitor.java
===================================================================
--- trunk/client/src/main/java/org/teiid/plan/api/XMLOutputVisitor.java 2010-03-18 16:18:20 UTC (rev 1973)
+++ trunk/client-jdbc/src/main/java/org/teiid/jdbc/plan/XMLOutputVisitor.java 2010-03-19 16:17:09 UTC (rev 1977)
@@ -20,7 +20,7 @@
* 02110-1301 USA.
*/
-package org.teiid.plan.api;
+package org.teiid.jdbc.plan;
import java.util.Collection;
import java.util.HashMap;
Modified: trunk/client-jdbc/src/test/java/org/teiid/jdbc/TestBatchResults.java
===================================================================
--- trunk/client-jdbc/src/test/java/org/teiid/jdbc/TestBatchResults.java 2010-03-19 01:45:14 UTC (rev 1976)
+++ trunk/client-jdbc/src/test/java/org/teiid/jdbc/TestBatchResults.java 2010-03-19 16:17:09 UTC (rev 1977)
@@ -29,9 +29,8 @@
import java.util.List;
import org.junit.Test;
-import org.teiid.jdbc.BatchFetcher;
-import org.teiid.jdbc.BatchResults;
import org.teiid.jdbc.BatchResults.Batch;
+import org.teiid.jdbc.BatchResults.BatchFetcher;
/**
Modified: trunk/client-jdbc/src/test/java/org/teiid/jdbc/TestEmbeddedProfile.java
===================================================================
--- trunk/client-jdbc/src/test/java/org/teiid/jdbc/TestEmbeddedProfile.java 2010-03-19 01:45:14 UTC (rev 1976)
+++ trunk/client-jdbc/src/test/java/org/teiid/jdbc/TestEmbeddedProfile.java 2010-03-19 16:17:09 UTC (rev 1977)
@@ -28,7 +28,6 @@
import java.util.Properties;
import org.junit.Test;
-import org.teiid.plan.api.ExecutionProperties;
Modified: trunk/client-jdbc/src/test/java/org/teiid/jdbc/TestMMDriver.java
===================================================================
--- trunk/client-jdbc/src/test/java/org/teiid/jdbc/TestMMDriver.java 2010-03-19 01:45:14 UTC (rev 1976)
+++ trunk/client-jdbc/src/test/java/org/teiid/jdbc/TestMMDriver.java 2010-03-19 16:17:09 UTC (rev 1977)
@@ -25,8 +25,8 @@
import java.sql.DriverPropertyInfo;
import java.util.Properties;
-import org.teiid.plan.api.ExecutionProperties;
+
import junit.framework.TestCase;
import com.metamatrix.common.api.MMURL;
Copied: trunk/client-jdbc/src/test/java/org/teiid/jdbc/TestMMJDBCURL.java (from rev 1976, trunk/client-jdbc/src/test/java/org/teiid/jdbc/util/TestMMJDBCURL.java)
===================================================================
--- trunk/client-jdbc/src/test/java/org/teiid/jdbc/TestMMJDBCURL.java (rev 0)
+++ trunk/client-jdbc/src/test/java/org/teiid/jdbc/TestMMJDBCURL.java 2010-03-19 16:17:09 UTC (rev 1977)
@@ -0,0 +1,342 @@
+/*
+ * 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 java.net.URLEncoder;
+import java.util.Properties;
+
+import org.teiid.jdbc.BaseDataSource;
+import org.teiid.jdbc.ExecutionProperties;
+import org.teiid.jdbc.JDBCURL;
+
+import junit.framework.TestCase;
+
+import com.metamatrix.common.api.MMURL;
+
+
+/**
+ * @since 4.3
+ */
+public class TestMMJDBCURL extends TestCase {
+
+ // Need to allow embedded spaces and ='s within optional properties
+ public final void testCredentials() throws Exception {
+ String credentials = URLEncoder.encode("defaultToLogon,(system=BQT1 SQL Server 2000 Simple Cap,user=xyz,password=xyz)", "UTF-8"); //$NON-NLS-1$ //$NON-NLS-2$
+ JDBCURL url = new JDBCURL("jdbc:metamatrix:QT_sqls2kds@mm://slwxp136:43100;credentials="+credentials); //$NON-NLS-1$
+ Properties p = url.getProperties();
+ assertEquals("defaultToLogon,(system=BQT1 SQL Server 2000 Simple Cap,user=xyz,password=xyz)", p.getProperty("credentials")); //$NON-NLS-1$//$NON-NLS-2$
+ }
+
+ public void testJDBCURLWithProperties() {
+ String URL = "jdbc:metamatrix:bqt@mm://localhost:12345;version=1;user=xyz;password=***;logLevel=1;configFile=testdata/bqt/dqp_stmt_e2e.xmi;disableLocalTxn=true;autoFailover=false"; //$NON-NLS-1$
+
+ Properties expectedProperties = new Properties();
+ expectedProperties.setProperty("version", "1"); //$NON-NLS-1$ //$NON-NLS-2$
+ expectedProperties.setProperty("user", "xyz"); //$NON-NLS-1$ //$NON-NLS-2$
+ expectedProperties.setProperty("password", "***"); //$NON-NLS-1$ //$NON-NLS-2$
+ expectedProperties.setProperty("logLevel", "1"); //$NON-NLS-1$ //$NON-NLS-2$
+ expectedProperties.setProperty("configFile", "testdata/bqt/dqp_stmt_e2e.xmi"); //$NON-NLS-1$ //$NON-NLS-2$
+ expectedProperties.setProperty(ExecutionProperties.DISABLE_LOCAL_TRANSACTIONS, "true"); //$NON-NLS-1$
+ expectedProperties.setProperty(MMURL.CONNECTION.AUTO_FAILOVER, "false"); //$NON-NLS-1$
+ JDBCURL url = new JDBCURL(URL);
+ assertEquals("bqt", url.getVDBName()); //$NON-NLS-1$
+ assertEquals("mm://localhost:12345", url.getConnectionURL()); //$NON-NLS-1$
+ assertEquals(expectedProperties, url.getProperties());
+ }
+
+ public void testJDBCURLWithoutProperties() {
+ String URL = "jdbc:metamatrix:bqt@mm://localhost:12345"; //$NON-NLS-1$
+
+ JDBCURL url = new JDBCURL(URL);
+ assertEquals("bqt", url.getVDBName()); //$NON-NLS-1$
+ assertEquals("mm://localhost:12345", url.getConnectionURL()); //$NON-NLS-1$
+ assertEquals(new Properties(), url.getProperties());
+ }
+
+ public void testCaseConversion() {
+ // Different case ------------------------------------HERE -v ----------------and HERE -v
+ String URL = "jdbc:metamatrix:bqt@mm://localhost:12345;VERSION=1;user=xyz;password=***;configFile=testdata/bqt/dqp_stmt_e2e.xmi"; //$NON-NLS-1$
+
+ Properties expectedProperties = new Properties();
+ expectedProperties.setProperty("version", "1"); //$NON-NLS-1$ //$NON-NLS-2$
+ expectedProperties.setProperty("user", "xyz"); //$NON-NLS-1$ //$NON-NLS-2$
+ expectedProperties.setProperty("password", "***"); //$NON-NLS-1$ //$NON-NLS-2$
+ expectedProperties.setProperty("configFile", "testdata/bqt/dqp_stmt_e2e.xmi"); //$NON-NLS-1$ //$NON-NLS-2$
+ JDBCURL url = new JDBCURL(URL);
+ assertEquals("bqt", url.getVDBName()); //$NON-NLS-1$
+ assertEquals("mm://localhost:12345", url.getConnectionURL()); //$NON-NLS-1$
+ assertEquals(expectedProperties, url.getProperties());
+ }
+
+ public void testWithExtraSemicolons() {
+ String URL = "jdbc:metamatrix:bqt@mm://localhost:12345;version=1;user=xyz;password=***;logLevel=1;;;configFile=testdata/bqt/dqp_stmt_e2e.xmi;;"; //$NON-NLS-1$
+
+ Properties expectedProperties = new Properties();
+ expectedProperties.setProperty("version", "1"); //$NON-NLS-1$ //$NON-NLS-2$
+ expectedProperties.setProperty("user", "xyz"); //$NON-NLS-1$ //$NON-NLS-2$
+ expectedProperties.setProperty("password", "***"); //$NON-NLS-1$ //$NON-NLS-2$
+ expectedProperties.setProperty("logLevel", "1"); //$NON-NLS-1$ //$NON-NLS-2$
+ expectedProperties.setProperty("configFile", "testdata/bqt/dqp_stmt_e2e.xmi"); //$NON-NLS-1$ //$NON-NLS-2$
+ JDBCURL url = new JDBCURL(URL);
+ assertEquals("bqt", url.getVDBName()); //$NON-NLS-1$
+ assertEquals("mm://localhost:12345", url.getConnectionURL()); //$NON-NLS-1$
+ assertEquals(expectedProperties, url.getProperties());
+ }
+
+ public void testWithWhitespace() {
+ String URL = "jdbc:metamatrix:bqt@mm://localhost:12345; version =1;user= xyz ;password=***; logLevel = 1 ; configFile=testdata/bqt/dqp_stmt_e2e.xmi ;"; //$NON-NLS-1$
+
+ Properties expectedProperties = new Properties();
+ expectedProperties.setProperty("version", "1"); //$NON-NLS-1$ //$NON-NLS-2$
+ expectedProperties.setProperty("user", "xyz"); //$NON-NLS-1$ //$NON-NLS-2$
+ expectedProperties.setProperty("password", "***"); //$NON-NLS-1$ //$NON-NLS-2$
+ expectedProperties.setProperty("logLevel", "1"); //$NON-NLS-1$ //$NON-NLS-2$
+ expectedProperties.setProperty("configFile", "testdata/bqt/dqp_stmt_e2e.xmi"); //$NON-NLS-1$ //$NON-NLS-2$
+ JDBCURL url = new JDBCURL(URL);
+ assertEquals("bqt", url.getVDBName()); //$NON-NLS-1$
+ assertEquals("mm://localhost:12345", url.getConnectionURL()); //$NON-NLS-1$
+ assertEquals(expectedProperties, url.getProperties());
+ }
+
+ public void testNoPropertyValue() {
+ String URL = "jdbc:metamatrix:bqt@mm://localhost:12345;version=1;user=xyz;password=***;logLevel=;configFile="; //$NON-NLS-1$
+
+ Properties expectedProperties = new Properties();
+ expectedProperties.setProperty("version", "1"); //$NON-NLS-1$ //$NON-NLS-2$
+ expectedProperties.setProperty("user", "xyz"); //$NON-NLS-1$ //$NON-NLS-2$
+ expectedProperties.setProperty("password", "***"); //$NON-NLS-1$ //$NON-NLS-2$
+ expectedProperties.setProperty("logLevel", ""); //$NON-NLS-1$ //$NON-NLS-2$
+ expectedProperties.setProperty("configFile", ""); //$NON-NLS-1$ //$NON-NLS-2$
+ JDBCURL url = new JDBCURL(URL);
+ assertEquals("bqt", url.getVDBName()); //$NON-NLS-1$
+ assertEquals("mm://localhost:12345", url.getConnectionURL()); //$NON-NLS-1$
+ assertEquals(expectedProperties, url.getProperties());
+ }
+
+ public void testInvalidProtocol() {
+ String URL = "jdbc:monkeymatrix:bqt@mm://localhost:12345;version=1;user=xyz;password=***;logLevel=1"; //$NON-NLS-1$
+ try {
+ new JDBCURL(URL);
+ fail("Illegal argument should have failed."); //$NON-NLS-1$
+ } catch (IllegalArgumentException e) {
+ // expected
+ }
+ }
+
+ public void testNoVDBName() {
+ String URL = "jdbc:metamatrix:@mm://localhost:12345;version=1;user=xyz;password=***;logLevel=1"; //$NON-NLS-1$
+ try {
+ new JDBCURL(URL);
+ fail("Illegal argument should have failed."); //$NON-NLS-1$
+ } catch (IllegalArgumentException e) {
+ // expected
+ }
+ }
+
+ public void testNoAtSignInURL() {
+ String URL = "jdbc:metamatrix:bqt!mm://localhost:12345;version=1;user=xyz;password=***;logLevel=1"; //$NON-NLS-1$
+ try {
+ new JDBCURL(URL);
+ // No @ sign is llowed as part of embedded driver now,
+ // but this form of URL rejected in the acceptURL
+ //fail("Illegal argument should have failed.");
+ } catch (IllegalArgumentException e) {
+ // expected
+ }
+ }
+
+ public void testMoreThanOneAtSign() {
+ String URL = "jdbc:metamatrix:bqt@mm://localhost:12345;version=1;user=xy@;password=***;logLevel=1"; //$NON-NLS-1$
+ try {
+ // this allowed as customer properties can have @ in their properties
+ new JDBCURL(URL);
+ } catch (IllegalArgumentException e) {
+ // expected
+ }
+ }
+
+ public void testNoEqualsInProperty() {
+ String URL = "jdbc:metamatrix:bqt@mm://localhost:12345;version=1;user=xyz;password***;logLevel=1"; //$NON-NLS-1$
+ try {
+ new JDBCURL(URL);
+ fail("Illegal argument should have failed."); //$NON-NLS-1$
+ } catch (IllegalArgumentException e) {
+ // expected
+ }
+ }
+
+ public void testMoreThanOneEqualsInProperty() {
+ String URL = "jdbc:metamatrix:bqt@mm://localhost:12345;version=1;user=xyz;password==***;logLevel=1"; //$NON-NLS-1$
+ try {
+ new JDBCURL(URL);
+ fail("Illegal argument should have failed."); //$NON-NLS-1$
+ } catch (IllegalArgumentException e) {
+ // expected
+ }
+ URL = "jdbc:metamatrix:bqt@mm://localhost:12345;version=1;user=xyz;password=***=;logLevel=1"; //$NON-NLS-1$
+ try {
+ new JDBCURL(URL);
+ fail("Illegal argument should have failed."); //$NON-NLS-1$
+ } catch (IllegalArgumentException e) {
+ // expected
+ }
+ URL = "jdbc:metamatrix:bqt@mm://localhost:12345;version=1;user=xyz;=password=***;logLevel=1"; //$NON-NLS-1$
+ try {
+ new JDBCURL(URL);
+ fail("Illegal argument should have failed."); //$NON-NLS-1$
+ } catch (IllegalArgumentException e) {
+ // expected
+ }
+ }
+
+ public void testNoKeyInProperty() {
+ String URL = "jdbc:metamatrix:bqt@mm://localhost:12345;version=1;user=xyz;=***;logLevel=1"; //$NON-NLS-1$
+ try {
+ new JDBCURL(URL);
+ fail("Illegal argument should have failed."); //$NON-NLS-1$
+ } catch (IllegalArgumentException e) {
+ // expected
+ }
+ }
+
+ public void testConstructor() {
+ JDBCURL url = new JDBCURL("myVDB", "mm://myhost:12345",null); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals("jdbc:teiid:myVDB@mm://myhost:12345", url.getJDBCURL()); //$NON-NLS-1$
+
+ Properties props = new Properties();
+ props.setProperty(BaseDataSource.USER_NAME, "myuser"); //$NON-NLS-1$
+ props.setProperty(BaseDataSource.PASSWORD, "mypassword"); //$NON-NLS-1$
+ props.put("ClieNTtOKeN", new Integer(1)); //$NON-NLS-1$
+ url = new JDBCURL("myVDB", "mm://myhost:12345", props); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals("jdbc:teiid:myVDB@mm://myhost:12345;user=myuser;password=mypassword", url.getJDBCURL()); //$NON-NLS-1$
+ }
+
+ public void testConstructor_Exception() {
+ try {
+ new JDBCURL(null, "myhost", null); //$NON-NLS-1$
+ fail("Should have failed."); //$NON-NLS-1$
+ } catch (Exception e) {
+
+ }
+ try {
+ new JDBCURL(" ", "myhost", null); //$NON-NLS-1$ //$NON-NLS-2$
+ fail("Should have failed."); //$NON-NLS-1$
+ } catch (Exception e) {
+
+ }
+
+ try {
+ // in embedded situation there is no connection url
+ new JDBCURL("myVDB", " ", null); //$NON-NLS-1$ //$NON-NLS-2$
+ } catch (Exception e) {
+
+ }
+ }
+
+ public void testNormalize() {
+ Properties props = new Properties();
+ props.setProperty("UsEr", "myuser"); //$NON-NLS-1$ //$NON-NLS-2$
+ props.setProperty("pAssWOrD", "mypassword"); //$NON-NLS-1$ //$NON-NLS-2$
+ props.put("ClieNTtOKeN", new Integer(1)); //$NON-NLS-1$
+ JDBCURL.normalizeProperties(props);
+ assertEquals("myuser", props.getProperty(BaseDataSource.USER_NAME)); //$NON-NLS-1$
+ assertEquals("mypassword", props.getProperty(BaseDataSource.PASSWORD)); //$NON-NLS-1$
+ }
+
+ public final void testEncodedPropertyProperties() throws Exception {
+ String password = "=@#^&*()+!%$^%@#_-)_~{}||\\`':;,./<>?password has = & %"; //$NON-NLS-1$
+ Properties props = new Properties();
+ props.setProperty("UsEr", "foo"); //$NON-NLS-1$ //$NON-NLS-2$
+ props.setProperty("PASswoRd", password); //$NON-NLS-1$
+ JDBCURL.normalizeProperties(props);
+
+ assertEquals(password, props.getProperty("password")); //$NON-NLS-1$
+ assertEquals("foo", props.getProperty("user")); //$NON-NLS-1$//$NON-NLS-2$
+ }
+
+ public final void testEncodedPropertyInURL() throws Exception {
+ String password = "=@#^&*()+!%$^%@#_-)_~{}||\\`':;,./<>?password has = & %"; //$NON-NLS-1$
+ String encPassword = URLEncoder.encode(password, "UTF-8"); //$NON-NLS-1$
+ JDBCURL url = new JDBCURL("jdbc:metamatrix:QT_sqls2kds@mm://slwxp136:43100;PASswoRd="+encPassword); //$NON-NLS-1$
+ Properties p = url.getProperties();
+ assertEquals(password, p.getProperty("password")); //$NON-NLS-1$
+ }
+
+
+ public void testGetServerURL_NoProperties() {
+ String result = new JDBCURL("jdbc:metamatrix:designtimecatalog@mm://slwxp172:44401;user=ddifranco;password=mm").getConnectionURL(); //$NON-NLS-1$
+ assertEquals("mm://slwxp172:44401", result); //$NON-NLS-1$
+ }
+
+ public void testGetServerURL_Properties() {
+ String result = new JDBCURL("jdbc:metamatrix:designtimecatalog@mm://slwxp172:44401;user=ddifranco;password=mm").getConnectionURL(); //$NON-NLS-1$
+ assertEquals("mm://slwxp172:44401", result); //$NON-NLS-1$
+ }
+
+ /**
+ * Test getServerURL with a valid URL and password that contains at least
+ * one ASCII character in the range of 32 to 126 excluding the ; and = sign.
+ *
+ * @since 5.0.2
+ */
+ public void testGetServerURL_PasswordProperties() throws Exception {
+ String result = null;
+ String srcURL = "jdbc:metamatrix:designtimecatalog@mm://slwxp172:44401;user=ddifranco;password="; //$NON-NLS-1$
+ String password = null;
+ String tgtURL = "mm://slwxp172:44401"; //$NON-NLS-1$
+
+
+ for ( char ch = 32; ch <= 126; ch++ ) {
+ //exclude URL reserved characters
+ if ( ch != ';' && ch != '=' && ch != '%') {
+ password = ch+"mm"; //$NON-NLS-1$
+ result = new JDBCURL(srcURL+URLEncoder.encode(password, "UTF-8")).getConnectionURL(); //$NON-NLS-1$
+ assertEquals("Failed to obtain correct ServerURL when using password "+password,tgtURL, result); //$NON-NLS-1$
+ }
+ }
+
+ }
+
+ public void testGetServerURL_2Servers() {
+ String result = new JDBCURL("jdbc:metamatrix:designtimecatalog@mm://slwxp172:44401,slabc123:12345;user=ddifranco;password=mm").getConnectionURL(); //$NON-NLS-1$
+ assertEquals("mm://slwxp172:44401,slabc123:12345", result); //$NON-NLS-1$
+ }
+
+ public void testBuildEmbeedURL() {
+ JDBCURL url = new JDBCURL("vdb", "/home/foo/deploy.properties", new Properties()); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals("jdbc:teiid:vdb@/home/foo/deploy.properties", url.getJDBCURL()); //$NON-NLS-1$
+
+ Properties p = new Properties();
+ p.setProperty("user", "test"); //$NON-NLS-1$ //$NON-NLS-2$
+ p.setProperty("password", "pass"); //$NON-NLS-1$ //$NON-NLS-2$
+ p.setProperty("autoFailover", "true"); //$NON-NLS-1$ //$NON-NLS-2$
+ p.setProperty("any", "thing"); //$NON-NLS-1$ //$NON-NLS-2$
+
+ url = new JDBCURL("vdb", "/home/foo/deploy.properties", p); //$NON-NLS-1$ //$NON-NLS-2$
+ assertTrue(url.getJDBCURL().startsWith("jdbc:teiid:vdb@/home/foo/deploy.properties;user=test;")); //$NON-NLS-1$
+ assertTrue(url.getJDBCURL().indexOf("any=thing")!=-1); //$NON-NLS-1$
+ assertTrue(url.getJDBCURL().indexOf("password=pass")!=-1); //$NON-NLS-1$
+ assertTrue(url.getJDBCURL().indexOf("autoFailover=true")!=-1); //$NON-NLS-1$
+
+ }
+}
Modified: trunk/client-jdbc/src/test/java/org/teiid/jdbc/TestSocketProfile.java
===================================================================
--- trunk/client-jdbc/src/test/java/org/teiid/jdbc/TestSocketProfile.java 2010-03-19 01:45:14 UTC (rev 1976)
+++ trunk/client-jdbc/src/test/java/org/teiid/jdbc/TestSocketProfile.java 2010-03-19 16:17:09 UTC (rev 1977)
@@ -29,7 +29,6 @@
import java.util.Properties;
import org.junit.Test;
-import org.teiid.plan.api.ExecutionProperties;
import com.metamatrix.common.api.MMURL;
Modified: trunk/client-jdbc/src/test/java/org/teiid/jdbc/TestTeiidDataSource.java
===================================================================
--- trunk/client-jdbc/src/test/java/org/teiid/jdbc/TestTeiidDataSource.java 2010-03-19 01:45:14 UTC (rev 1976)
+++ trunk/client-jdbc/src/test/java/org/teiid/jdbc/TestTeiidDataSource.java 2010-03-19 16:17:09 UTC (rev 1977)
@@ -29,7 +29,6 @@
import org.teiid.jdbc.BaseDataSource;
import org.teiid.jdbc.TeiidDataSource;
-import org.teiid.plan.api.ExecutionProperties;
import junit.framework.TestCase;
Deleted: trunk/client-jdbc/src/test/java/org/teiid/jdbc/api/FakeDisplayHelper.java
===================================================================
--- trunk/client-jdbc/src/test/java/org/teiid/jdbc/api/FakeDisplayHelper.java 2010-03-19 01:45:14 UTC (rev 1976)
+++ trunk/client-jdbc/src/test/java/org/teiid/jdbc/api/FakeDisplayHelper.java 2010-03-19 16:17:09 UTC (rev 1977)
@@ -1,88 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package org.teiid.jdbc.api;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.teiid.plan.api.DisplayHelper;
-import org.teiid.plan.api.PlanNode;
-
-
-/**
- */
-public class FakeDisplayHelper implements DisplayHelper {
-
- /**
- *
- */
- public FakeDisplayHelper() {
- super();
- }
-
- /*
- * @see com.metamatrix.jdbc.plan.DisplayHelper#getName(com.metamatrix.jdbc.plan.PlanNode)
- */
- public String getName(PlanNode node) {
- return (String) node.getProperties().get(FakePlanNode.PROP_TYPE);
- }
-
- /*
- * @see com.metamatrix.jdbc.plan.DisplayHelper#getDescription(com.metamatrix.jdbc.plan.PlanNode)
- */
- public String getDescription(PlanNode node) {
- return (String) node.getProperties().get(FakePlanNode.PROP_DESCRIPTION);
- }
-
- /*
- * @see com.metamatrix.jdbc.plan.DisplayHelper#getOrderedProperties(com.metamatrix.jdbc.plan.PlanNode)
- */
- public List getOrderedProperties(PlanNode node) {
- List props = new ArrayList(node.getProperties().keySet());
- props.remove(FakePlanNode.PROP_TYPE);
- props.remove(FakePlanNode.PROP_DESCRIPTION);
- if(props.contains(FakePlanNode.PROP_OUTPUT_COLS)) {
- props.remove(FakePlanNode.PROP_OUTPUT_COLS);
- props.add(0, FakePlanNode.PROP_OUTPUT_COLS);
- }
- return props;
- }
-
- /*
- * @see com.metamatrix.jdbc.plan.DisplayHelper#getPropertyName(java.lang.String)
- */
- public String getPropertyName(String property) {
- if(property.equals(FakePlanNode.PROP_OUTPUT_COLS)) {
- return "Output columns"; //$NON-NLS-1$
- }
- return property;
- }
-
- /*
- * @see com.metamatrix.jdbc.plan.DisplayHelper#setMaxDescriptionLength(int)
- */
- public void setMaxDescriptionLength(int length) {
- // ignore
- }
-
-}
Deleted: trunk/client-jdbc/src/test/java/org/teiid/jdbc/api/FakePlanNode.java
===================================================================
--- trunk/client-jdbc/src/test/java/org/teiid/jdbc/api/FakePlanNode.java 2010-03-19 01:45:14 UTC (rev 1976)
+++ trunk/client-jdbc/src/test/java/org/teiid/jdbc/api/FakePlanNode.java 2010-03-19 16:17:09 UTC (rev 1977)
@@ -1,87 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package org.teiid.jdbc.api;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.teiid.plan.api.PlanNode;
-
-
-/**
- */
-public class FakePlanNode implements PlanNode {
-
- public static final String PROP_TYPE = "type"; //$NON-NLS-1$
- public static final String PROP_DESCRIPTION = "desc"; //$NON-NLS-1$
- public static final String PROP_OUTPUT_COLS = "outputCols"; //$NON-NLS-1$
-
- private PlanNode parent;
- private Map props = new HashMap();
- private List children = new ArrayList();
-
- /**
- *
- */
- public FakePlanNode(String type, String description) {
- super();
- this.props.put(PROP_TYPE, type);
- this.props.put(PROP_DESCRIPTION, description);
- }
-
- public void setParent(PlanNode parent) {
- this.parent = parent;
- }
-
- /*
- * @see com.metamatrix.jdbc.plan.PlanNode#getParent()
- */
- public PlanNode getParent() {
- return this.parent;
- }
-
- public void addChild(PlanNode child) {
- this.children.add(child);
- }
-
- /*
- * @see com.metamatrix.jdbc.plan.PlanNode#getChildren()
- */
- public List getChildren() {
- return this.children;
- }
-
- public void setProperty(String prop, Object value) {
- this.props.put(prop, value);
- }
-
- /*
- * @see com.metamatrix.jdbc.plan.PlanNode#getProperties()
- */
- public Map getProperties() {
- return this.props;
- }
-
-}
Deleted: trunk/client-jdbc/src/test/java/org/teiid/jdbc/api/TestQueryPlanDisplayHelper.java
===================================================================
--- trunk/client-jdbc/src/test/java/org/teiid/jdbc/api/TestQueryPlanDisplayHelper.java 2010-03-19 01:45:14 UTC (rev 1976)
+++ trunk/client-jdbc/src/test/java/org/teiid/jdbc/api/TestQueryPlanDisplayHelper.java 2010-03-19 16:17:09 UTC (rev 1977)
@@ -1,105 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package org.teiid.jdbc.api;
-
-import java.util.Arrays;
-import java.util.Map;
-
-import org.teiid.plan.api.QueryPlanDisplayHelper;
-
-import junit.framework.TestCase;
-
-
-/**
- */
-public class TestQueryPlanDisplayHelper extends TestCase {
-
- public TestQueryPlanDisplayHelper(String name) {
- super(name);
- }
-
- private QueryPlanDisplayHelper loadHelper() throws Exception {
- QueryPlanDisplayHelper helper = new QueryPlanDisplayHelper();
-
- return helper;
- }
-
- public void testGetNameWNullType() throws Exception{
-
- FakePlanNode plan = (FakePlanNode)TestTextOutputVisitor.example2();
-
- Map nodeProps = plan.getProperties();
- /*
- * test with a null plan type. This is a test to combat defect # 18009
- */
- nodeProps.put("type",null); //$NON-NLS-1$
-
- QueryPlanDisplayHelper helper = loadHelper();
-
- String name = helper.getName(plan);
- assertEquals("Node", name); //$NON-NLS-1$
- }
-
-
- public void testGetDescriptionWNullType() throws Exception{
-
- FakePlanNode plan = (FakePlanNode)TestTextOutputVisitor.example2();
-
- Map nodeProps = plan.getProperties();
- /*
- * test with a null plan type. This is a test to combat defect # 18009
- */
- nodeProps.put("type",null); //$NON-NLS-1$
-
- QueryPlanDisplayHelper helper = loadHelper();
-
- String desc = helper.getDescription(plan);
- assertEquals("", desc); //$NON-NLS-1$
- }
-
- public void testGetNameNullDescription() throws Exception {
- QueryPlanDisplayHelper helper = loadHelper();
-
- FakePlanNode node = new FakePlanNode("Access", null); //$NON-NLS-1$
- node.setProperty("sql", "SELECT A, B, C FROM MYTABLE"); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals("Access [SELECT A, B, C FROM MYTABLE]", helper.getName(node)); //$NON-NLS-1$
-
- node = new FakePlanNode("Join", null); //$NON-NLS-1$
- node.setProperty("joinType", "LEFT OUTER JOIN"); //$NON-NLS-1$ //$NON-NLS-2$
- node.setProperty("joinCriteria", Arrays.asList(new String[] {"A.B = B.B"})); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals("Join [LEFT OUTER JOIN ON A.B = B.B]", helper.getName(node)); //$NON-NLS-1$
-
- node = new FakePlanNode("Project", null); //$NON-NLS-1$
- node.setProperty("selectCols", Arrays.asList(new String[] {"a", "b", "c"})); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- assertEquals("Project [a, b, c]", helper.getName(node)); //$NON-NLS-1$
- }
-
- public void testGetName() throws Exception {
- QueryPlanDisplayHelper helper = loadHelper();
-
- FakePlanNode node = new FakePlanNode("Access", "Access Node Description"); //$NON-NLS-1$ //$NON-NLS-2$
- node.setProperty("sql", "SELECT A, B, C FROM MYTABLE"); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals("Access [Access Node Description]", helper.getName(node)); //$NON-NLS-1$
- }
-
-}
Deleted: trunk/client-jdbc/src/test/java/org/teiid/jdbc/api/TestTextOutputVisitor.java
===================================================================
--- trunk/client-jdbc/src/test/java/org/teiid/jdbc/api/TestTextOutputVisitor.java 2010-03-19 01:45:14 UTC (rev 1976)
+++ trunk/client-jdbc/src/test/java/org/teiid/jdbc/api/TestTextOutputVisitor.java 2010-03-19 16:17:09 UTC (rev 1977)
@@ -1,141 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package org.teiid.jdbc.api;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.teiid.plan.api.PlanNode;
-import org.teiid.plan.api.QueryPlanDisplayHelper;
-import org.teiid.plan.api.TextOutputVisitor;
-
-import junit.framework.TestCase;
-
-
-/**
- */
-public class TestTextOutputVisitor extends TestCase {
-
- /**
- * Constructor for TestTextOutputVisitor.
- * @param name
- */
- public TestTextOutputVisitor(String name) {
- super(name);
- }
-
- public static PlanNode example1() {
- FakePlanNode n1 = new FakePlanNode("Relational Plan", ""); //$NON-NLS-1$ //$NON-NLS-2$
- List outputCols = new ArrayList();
- outputCols.add("Name (string)"); //$NON-NLS-1$
- outputCols.add("Year (integer)"); //$NON-NLS-1$
- outputCols.add("Age (integer)"); //$NON-NLS-1$
- n1.setProperty(FakePlanNode.PROP_OUTPUT_COLS, outputCols);
-
- FakePlanNode n2 = new FakePlanNode("Project", "Name, Year, YEAR(CURDATE()) - year AS Age"); //$NON-NLS-1$ //$NON-NLS-2$
- outputCols = new ArrayList();
- outputCols.add("Name (string)"); //$NON-NLS-1$
- outputCols.add("Year (integer)"); //$NON-NLS-1$
- n2.setProperty(FakePlanNode.PROP_OUTPUT_COLS, outputCols);
-
- FakePlanNode n3 = new FakePlanNode("Join", "Item JOIN History"); //$NON-NLS-1$ //$NON-NLS-2$
- outputCols = new ArrayList();
- outputCols.add("Name (string)"); //$NON-NLS-1$
- outputCols.add("Year (integer)"); //$NON-NLS-1$
- n3.setProperty(FakePlanNode.PROP_OUTPUT_COLS, outputCols);
- n3.setProperty("Join Type", "INNER JOIN"); //$NON-NLS-1$ //$NON-NLS-2$
- List crits = new ArrayList();
- crits.add("Item.ID = History.ID"); //$NON-NLS-1$
- n3.setProperty("Criteria", crits); //$NON-NLS-1$
-
- connectNodes(n1,n2);
- connectNodes(n2,n3);
-
- return n1;
- }
-
- public static PlanNode example2() {
- FakePlanNode n = new FakePlanNode("test", ""); //$NON-NLS-1$ //$NON-NLS-2$
- n.setProperty("string", "string"); //$NON-NLS-1$ //$NON-NLS-2$
- n.setProperty("integer", new Integer(0)); //$NON-NLS-1$
- n.setProperty("boolean", Boolean.TRUE); //$NON-NLS-1$
- List list1 = new ArrayList();
- list1.add("item1"); //$NON-NLS-1$
- list1.add("item2"); //$NON-NLS-1$
- list1.add("item3"); //$NON-NLS-1$
- n.setProperty("list<string>", list1); //$NON-NLS-1$
-
- return n;
- }
-
- public static void connectNodes(FakePlanNode parent, FakePlanNode child) {
- parent.addChild(child);
- child.setParent(parent);
- }
-
- public void testTypicalExample() {
- PlanNode plan = example1();
- TextOutputVisitor v = new TextOutputVisitor(new FakeDisplayHelper(), 0);
- v.visit(plan);
- }
-
- public void testCommonTypes() {
- PlanNode plan = example2();
- TextOutputVisitor v = new TextOutputVisitor(new FakeDisplayHelper(), 0);
- v.visit(plan);
- }
-
- public void testNestedNode() {
- PlanNode plan = example2();
- plan.getProperties().put("nested", example1()); //$NON-NLS-1$
- TextOutputVisitor v = new TextOutputVisitor(new FakeDisplayHelper(), 0);
- v.visit(plan);
- }
-
- public void testLimitNode() {
- FakePlanNode node = new FakePlanNode("Limit", ""); //$NON-NLS-1$ //$NON-NLS-2$
- List outputCols = new ArrayList();
- outputCols.add("Name (string)"); //$NON-NLS-1$
- outputCols.add("Year (integer)"); //$NON-NLS-1$
- outputCols.add("Age (integer)"); //$NON-NLS-1$
- node.setProperty(FakePlanNode.PROP_OUTPUT_COLS, outputCols);
- node.setProperty("rowLimit", "100"); //$NON-NLS-1$ //$NON-NLS-2$
- TextOutputVisitor v = new TextOutputVisitor(new QueryPlanDisplayHelper(), 0);
- v.visit(node);
- assertEquals("Limit [100]\n + Output Columns:\n 1: Name (string)\n 2: Year (integer)\n 3: Age (integer)\n + Row Limit: 100\n", v.getText()); //$NON-NLS-1$
- }
-
- public void testOffsetNode() {
- FakePlanNode node = new FakePlanNode("Offset", ""); //$NON-NLS-1$ //$NON-NLS-2$
- List outputCols = new ArrayList();
- outputCols.add("Name (string)"); //$NON-NLS-1$
- outputCols.add("Year (integer)"); //$NON-NLS-1$
- outputCols.add("Age (integer)"); //$NON-NLS-1$
- node.setProperty(FakePlanNode.PROP_OUTPUT_COLS, outputCols);
- node.setProperty("rowOffset", "100"); //$NON-NLS-1$ //$NON-NLS-2$
- TextOutputVisitor v = new TextOutputVisitor(new QueryPlanDisplayHelper(), 0);
- v.visit(node);
- assertEquals("Offset [100]\n + Output Columns:\n 1: Name (string)\n 2: Year (integer)\n 3: Age (integer)\n + Row Offset: 100\n", v.getText()); //$NON-NLS-1$
- }
-
-}
Deleted: trunk/client-jdbc/src/test/java/org/teiid/jdbc/api/TestXMLOutputVisitor.java
===================================================================
--- trunk/client-jdbc/src/test/java/org/teiid/jdbc/api/TestXMLOutputVisitor.java 2010-03-19 01:45:14 UTC (rev 1976)
+++ trunk/client-jdbc/src/test/java/org/teiid/jdbc/api/TestXMLOutputVisitor.java 2010-03-19 16:17:09 UTC (rev 1977)
@@ -1,90 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package org.teiid.jdbc.api;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.teiid.plan.api.PlanNode;
-import org.teiid.plan.api.QueryPlanDisplayHelper;
-import org.teiid.plan.api.XMLOutputVisitor;
-
-import junit.framework.TestCase;
-
-
-/**
- */
-public class TestXMLOutputVisitor extends TestCase {
-
- /**
- * Constructor for TestXMLOutputVisitor.
- * @param name
- */
- public TestXMLOutputVisitor(String name) {
- super(name);
- }
-
- public void testTypicalExample() {
- PlanNode plan = TestTextOutputVisitor.example1();
- XMLOutputVisitor v = new XMLOutputVisitor(new FakeDisplayHelper());
- v.visit(plan);
- }
-
- public void testCommonTypes() {
- PlanNode plan = TestTextOutputVisitor.example2();
- XMLOutputVisitor v = new XMLOutputVisitor(new FakeDisplayHelper());
- v.visit(plan);
- }
-
- public void testNestedNode() {
- PlanNode plan = TestTextOutputVisitor.example2();
- plan.getProperties().put("nested", TestTextOutputVisitor.example1()); //$NON-NLS-1$
- XMLOutputVisitor v = new XMLOutputVisitor(new FakeDisplayHelper());
- v.visit(plan);
- }
-
- public void testLimitNode() {
- FakePlanNode node = new FakePlanNode("Limit", ""); //$NON-NLS-1$ //$NON-NLS-2$
- List outputCols = new ArrayList();
- outputCols.add("Name (string)"); //$NON-NLS-1$
- outputCols.add("Year (integer)"); //$NON-NLS-1$
- outputCols.add("Age (integer)"); //$NON-NLS-1$
- node.setProperty(FakePlanNode.PROP_OUTPUT_COLS, outputCols);
- node.setProperty("rowLimit", "100"); //$NON-NLS-1$ //$NON-NLS-2$
- XMLOutputVisitor v = new XMLOutputVisitor(new QueryPlanDisplayHelper());
- v.visit(node);
- assertEquals("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<node name=\"Limit [100]\">\n <properties>\n <property name=\"Output Columns\">\n <collection>\n <value>Name (string)</value>\n <value>Year (integer)</value>\n <value>Age (integer)</value>\n </collection>\n </property>\n <property name=\"Row Limit\" value=\"100\"/>\n </properties>\n</node>\n", v.getText()); //$NON-NLS-1$
- }
- public void testOffsetNode() {
- FakePlanNode node = new FakePlanNode("Offset", ""); //$NON-NLS-1$ //$NON-NLS-2$
- List outputCols = new ArrayList();
- outputCols.add("Name (string)"); //$NON-NLS-1$
- outputCols.add("Year (integer)"); //$NON-NLS-1$
- outputCols.add("Age (integer)"); //$NON-NLS-1$
- node.setProperty(FakePlanNode.PROP_OUTPUT_COLS, outputCols);
- node.setProperty("rowOffset", "100"); //$NON-NLS-1$ //$NON-NLS-2$
- XMLOutputVisitor v = new XMLOutputVisitor(new QueryPlanDisplayHelper());
- v.visit(node);
- assertEquals("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<node name=\"Offset [100]\">\n <properties>\n <property name=\"Output Columns\">\n <collection>\n <value>Name (string)</value>\n <value>Year (integer)</value>\n <value>Age (integer)</value>\n </collection>\n </property>\n <property name=\"Row Offset\" value=\"100\"/>\n </properties>\n</node>\n", v.getText()); //$NON-NLS-1$
- }
-}
Copied: trunk/client-jdbc/src/test/java/org/teiid/jdbc/plan/TestTextOutputVisitor.java (from rev 1973, trunk/client-jdbc/src/test/java/org/teiid/jdbc/api/TestTextOutputVisitor.java)
===================================================================
--- trunk/client-jdbc/src/test/java/org/teiid/jdbc/plan/TestTextOutputVisitor.java (rev 0)
+++ trunk/client-jdbc/src/test/java/org/teiid/jdbc/plan/TestTextOutputVisitor.java 2010-03-19 16:17:09 UTC (rev 1977)
@@ -0,0 +1,80 @@
+/*
+ * 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.plan;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+
+import junit.framework.TestCase;
+
+
+/**
+ */
+public class TestTextOutputVisitor extends TestCase {
+
+ /**
+ * Constructor for TestTextOutputVisitor.
+ * @param name
+ */
+ public TestTextOutputVisitor(String name) {
+ super(name);
+ }
+
+ public static PlanNode example1() {
+ HashMap<String, Object> map = new HashMap<String, Object>();
+ map.put(PlanNode.TYPE, "x"); //$NON-NLS-1$
+ map.put("test", ""); //$NON-NLS-1$ //$NON-NLS-2$
+ map.put("string", "string"); //$NON-NLS-1$ //$NON-NLS-2$
+ map.put("integer", new Integer(0)); //$NON-NLS-1$
+ map.put("boolean", Boolean.TRUE); //$NON-NLS-1$
+ List list1 = new ArrayList();
+ list1.add("item1"); //$NON-NLS-1$
+ list1.add("item2"); //$NON-NLS-1$
+ list1.add("item3"); //$NON-NLS-1$
+ map.put("list<string>", list1); //$NON-NLS-1$
+
+ HashMap<String, Object> child = new HashMap<String, Object>();
+ child.put(PlanNode.TYPE, "y"); //$NON-NLS-1$
+ List<String> outputCols = new ArrayList<String>();
+ outputCols.add("Name (string)"); //$NON-NLS-1$
+ outputCols.add("Year (integer)"); //$NON-NLS-1$
+ child.put(PlanNode.OUTPUT_COLS, outputCols);
+ child.put("Join Type", "INNER JOIN"); //$NON-NLS-1$ //$NON-NLS-2$
+ List<String> crits = new ArrayList<String>();
+ crits.add("Item.ID = History.ID"); //$NON-NLS-1$
+ child.put("Criteria", crits); //$NON-NLS-1$
+
+ map.put(PlanNode.PROP_CHILDREN, Arrays.asList(child));
+
+ return PlanNode.constructFromMap(map);
+ }
+
+ public void testWithDefaultDisplayHelper() {
+ TextOutputVisitor v = new TextOutputVisitor(new DefaultDisplayHelper(), 0);
+ v.visit(example1());
+ assertEquals("x\n + test: \n + integer: 0\n + string: string\n + list<string>:\n 1: item1\n 2: item2\n 3: item3\n + boolean: true\n y\n + outputCols:\n 1: Name (string)\n 2: Year (integer)\n + Join Type: INNER JOIN\n + Criteria:\n 1: Item.ID = History.ID\n", v.getText()); //$NON-NLS-1$
+ }
+
+}
Copied: trunk/client-jdbc/src/test/java/org/teiid/jdbc/plan/TestXMLOutputVisitor.java (from rev 1973, trunk/client-jdbc/src/test/java/org/teiid/jdbc/api/TestXMLOutputVisitor.java)
===================================================================
--- trunk/client-jdbc/src/test/java/org/teiid/jdbc/plan/TestXMLOutputVisitor.java (rev 0)
+++ trunk/client-jdbc/src/test/java/org/teiid/jdbc/plan/TestXMLOutputVisitor.java 2010-03-19 16:17:09 UTC (rev 1977)
@@ -0,0 +1,42 @@
+/*
+ * 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.plan;
+
+import junit.framework.TestCase;
+
+
+/**
+ */
+public class TestXMLOutputVisitor extends TestCase {
+
+ public TestXMLOutputVisitor(String name) {
+ super(name);
+ }
+
+ public void testWithDefaultDisplayHelper() {
+ XMLOutputVisitor v = new XMLOutputVisitor(new DefaultDisplayHelper());
+ v.visit(TestTextOutputVisitor.example1());
+ assertEquals("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<node name=\"x\">\n <properties>\n <property name=\"test\" value=\"\"/>\n <property name=\"integer\" value=\"0\"/>\n <property name=\"string\" value=\"string\"/>\n <property name=\"list<string>\">\n <collection>\n <value>item1</value>\n <value>item2</value>\n <value>item3</value>\n </collection>\n </property>\n <property name=\"boolean\" value=\"true\"/>\n </properties>\n <node name=\"y\">\n <properties>\n <property name=\"outputCols\">\n <collection>\n <value>Name (string)</value>\n <value>Year (integer)</value>\n </collection>\n </property>\n <property name=\"Join Type\" value=\"INNER JOIN\"/>\n <property name=\"Criteria\">\n <collection>\n <value>Item.ID = History.ID</value>\n </collection>\n </property>\n </properties>\n </node>\n</node>\n", v.getText()); //$NON-!
NLS-1$
+ }
+
+}
Deleted: trunk/client-jdbc/src/test/java/org/teiid/jdbc/util/TestMMJDBCURL.java
===================================================================
--- trunk/client-jdbc/src/test/java/org/teiid/jdbc/util/TestMMJDBCURL.java 2010-03-19 01:45:14 UTC (rev 1976)
+++ trunk/client-jdbc/src/test/java/org/teiid/jdbc/util/TestMMJDBCURL.java 2010-03-19 16:17:09 UTC (rev 1977)
@@ -1,342 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package org.teiid.jdbc.util;
-
-import java.net.URLEncoder;
-import java.util.Properties;
-
-import org.teiid.jdbc.BaseDataSource;
-import org.teiid.jdbc.JDBCURL;
-import org.teiid.plan.api.ExecutionProperties;
-
-import junit.framework.TestCase;
-
-import com.metamatrix.common.api.MMURL;
-
-
-/**
- * @since 4.3
- */
-public class TestMMJDBCURL extends TestCase {
-
- // Need to allow embedded spaces and ='s within optional properties
- public final void testCredentials() throws Exception {
- String credentials = URLEncoder.encode("defaultToLogon,(system=BQT1 SQL Server 2000 Simple Cap,user=xyz,password=xyz)", "UTF-8"); //$NON-NLS-1$ //$NON-NLS-2$
- JDBCURL url = new JDBCURL("jdbc:metamatrix:QT_sqls2kds@mm://slwxp136:43100;credentials="+credentials); //$NON-NLS-1$
- Properties p = url.getProperties();
- assertEquals("defaultToLogon,(system=BQT1 SQL Server 2000 Simple Cap,user=xyz,password=xyz)", p.getProperty("credentials")); //$NON-NLS-1$//$NON-NLS-2$
- }
-
- public void testJDBCURLWithProperties() {
- String URL = "jdbc:metamatrix:bqt@mm://localhost:12345;version=1;user=xyz;password=***;logLevel=1;configFile=testdata/bqt/dqp_stmt_e2e.xmi;disableLocalTxn=true;autoFailover=false"; //$NON-NLS-1$
-
- Properties expectedProperties = new Properties();
- expectedProperties.setProperty("version", "1"); //$NON-NLS-1$ //$NON-NLS-2$
- expectedProperties.setProperty("user", "xyz"); //$NON-NLS-1$ //$NON-NLS-2$
- expectedProperties.setProperty("password", "***"); //$NON-NLS-1$ //$NON-NLS-2$
- expectedProperties.setProperty("logLevel", "1"); //$NON-NLS-1$ //$NON-NLS-2$
- expectedProperties.setProperty("configFile", "testdata/bqt/dqp_stmt_e2e.xmi"); //$NON-NLS-1$ //$NON-NLS-2$
- expectedProperties.setProperty(ExecutionProperties.DISABLE_LOCAL_TRANSACTIONS, "true"); //$NON-NLS-1$
- expectedProperties.setProperty(MMURL.CONNECTION.AUTO_FAILOVER, "false"); //$NON-NLS-1$
- JDBCURL url = new JDBCURL(URL);
- assertEquals("bqt", url.getVDBName()); //$NON-NLS-1$
- assertEquals("mm://localhost:12345", url.getConnectionURL()); //$NON-NLS-1$
- assertEquals(expectedProperties, url.getProperties());
- }
-
- public void testJDBCURLWithoutProperties() {
- String URL = "jdbc:metamatrix:bqt@mm://localhost:12345"; //$NON-NLS-1$
-
- JDBCURL url = new JDBCURL(URL);
- assertEquals("bqt", url.getVDBName()); //$NON-NLS-1$
- assertEquals("mm://localhost:12345", url.getConnectionURL()); //$NON-NLS-1$
- assertEquals(new Properties(), url.getProperties());
- }
-
- public void testCaseConversion() {
- // Different case ------------------------------------HERE -v ----------------and HERE -v
- String URL = "jdbc:metamatrix:bqt@mm://localhost:12345;VERSION=1;user=xyz;password=***;configFile=testdata/bqt/dqp_stmt_e2e.xmi"; //$NON-NLS-1$
-
- Properties expectedProperties = new Properties();
- expectedProperties.setProperty("version", "1"); //$NON-NLS-1$ //$NON-NLS-2$
- expectedProperties.setProperty("user", "xyz"); //$NON-NLS-1$ //$NON-NLS-2$
- expectedProperties.setProperty("password", "***"); //$NON-NLS-1$ //$NON-NLS-2$
- expectedProperties.setProperty("configFile", "testdata/bqt/dqp_stmt_e2e.xmi"); //$NON-NLS-1$ //$NON-NLS-2$
- JDBCURL url = new JDBCURL(URL);
- assertEquals("bqt", url.getVDBName()); //$NON-NLS-1$
- assertEquals("mm://localhost:12345", url.getConnectionURL()); //$NON-NLS-1$
- assertEquals(expectedProperties, url.getProperties());
- }
-
- public void testWithExtraSemicolons() {
- String URL = "jdbc:metamatrix:bqt@mm://localhost:12345;version=1;user=xyz;password=***;logLevel=1;;;configFile=testdata/bqt/dqp_stmt_e2e.xmi;;"; //$NON-NLS-1$
-
- Properties expectedProperties = new Properties();
- expectedProperties.setProperty("version", "1"); //$NON-NLS-1$ //$NON-NLS-2$
- expectedProperties.setProperty("user", "xyz"); //$NON-NLS-1$ //$NON-NLS-2$
- expectedProperties.setProperty("password", "***"); //$NON-NLS-1$ //$NON-NLS-2$
- expectedProperties.setProperty("logLevel", "1"); //$NON-NLS-1$ //$NON-NLS-2$
- expectedProperties.setProperty("configFile", "testdata/bqt/dqp_stmt_e2e.xmi"); //$NON-NLS-1$ //$NON-NLS-2$
- JDBCURL url = new JDBCURL(URL);
- assertEquals("bqt", url.getVDBName()); //$NON-NLS-1$
- assertEquals("mm://localhost:12345", url.getConnectionURL()); //$NON-NLS-1$
- assertEquals(expectedProperties, url.getProperties());
- }
-
- public void testWithWhitespace() {
- String URL = "jdbc:metamatrix:bqt@mm://localhost:12345; version =1;user= xyz ;password=***; logLevel = 1 ; configFile=testdata/bqt/dqp_stmt_e2e.xmi ;"; //$NON-NLS-1$
-
- Properties expectedProperties = new Properties();
- expectedProperties.setProperty("version", "1"); //$NON-NLS-1$ //$NON-NLS-2$
- expectedProperties.setProperty("user", "xyz"); //$NON-NLS-1$ //$NON-NLS-2$
- expectedProperties.setProperty("password", "***"); //$NON-NLS-1$ //$NON-NLS-2$
- expectedProperties.setProperty("logLevel", "1"); //$NON-NLS-1$ //$NON-NLS-2$
- expectedProperties.setProperty("configFile", "testdata/bqt/dqp_stmt_e2e.xmi"); //$NON-NLS-1$ //$NON-NLS-2$
- JDBCURL url = new JDBCURL(URL);
- assertEquals("bqt", url.getVDBName()); //$NON-NLS-1$
- assertEquals("mm://localhost:12345", url.getConnectionURL()); //$NON-NLS-1$
- assertEquals(expectedProperties, url.getProperties());
- }
-
- public void testNoPropertyValue() {
- String URL = "jdbc:metamatrix:bqt@mm://localhost:12345;version=1;user=xyz;password=***;logLevel=;configFile="; //$NON-NLS-1$
-
- Properties expectedProperties = new Properties();
- expectedProperties.setProperty("version", "1"); //$NON-NLS-1$ //$NON-NLS-2$
- expectedProperties.setProperty("user", "xyz"); //$NON-NLS-1$ //$NON-NLS-2$
- expectedProperties.setProperty("password", "***"); //$NON-NLS-1$ //$NON-NLS-2$
- expectedProperties.setProperty("logLevel", ""); //$NON-NLS-1$ //$NON-NLS-2$
- expectedProperties.setProperty("configFile", ""); //$NON-NLS-1$ //$NON-NLS-2$
- JDBCURL url = new JDBCURL(URL);
- assertEquals("bqt", url.getVDBName()); //$NON-NLS-1$
- assertEquals("mm://localhost:12345", url.getConnectionURL()); //$NON-NLS-1$
- assertEquals(expectedProperties, url.getProperties());
- }
-
- public void testInvalidProtocol() {
- String URL = "jdbc:monkeymatrix:bqt@mm://localhost:12345;version=1;user=xyz;password=***;logLevel=1"; //$NON-NLS-1$
- try {
- new JDBCURL(URL);
- fail("Illegal argument should have failed."); //$NON-NLS-1$
- } catch (IllegalArgumentException e) {
- // expected
- }
- }
-
- public void testNoVDBName() {
- String URL = "jdbc:metamatrix:@mm://localhost:12345;version=1;user=xyz;password=***;logLevel=1"; //$NON-NLS-1$
- try {
- new JDBCURL(URL);
- fail("Illegal argument should have failed."); //$NON-NLS-1$
- } catch (IllegalArgumentException e) {
- // expected
- }
- }
-
- public void testNoAtSignInURL() {
- String URL = "jdbc:metamatrix:bqt!mm://localhost:12345;version=1;user=xyz;password=***;logLevel=1"; //$NON-NLS-1$
- try {
- new JDBCURL(URL);
- // No @ sign is llowed as part of embedded driver now,
- // but this form of URL rejected in the acceptURL
- //fail("Illegal argument should have failed.");
- } catch (IllegalArgumentException e) {
- // expected
- }
- }
-
- public void testMoreThanOneAtSign() {
- String URL = "jdbc:metamatrix:bqt@mm://localhost:12345;version=1;user=xy@;password=***;logLevel=1"; //$NON-NLS-1$
- try {
- // this allowed as customer properties can have @ in their properties
- new JDBCURL(URL);
- } catch (IllegalArgumentException e) {
- // expected
- }
- }
-
- public void testNoEqualsInProperty() {
- String URL = "jdbc:metamatrix:bqt@mm://localhost:12345;version=1;user=xyz;password***;logLevel=1"; //$NON-NLS-1$
- try {
- new JDBCURL(URL);
- fail("Illegal argument should have failed."); //$NON-NLS-1$
- } catch (IllegalArgumentException e) {
- // expected
- }
- }
-
- public void testMoreThanOneEqualsInProperty() {
- String URL = "jdbc:metamatrix:bqt@mm://localhost:12345;version=1;user=xyz;password==***;logLevel=1"; //$NON-NLS-1$
- try {
- new JDBCURL(URL);
- fail("Illegal argument should have failed."); //$NON-NLS-1$
- } catch (IllegalArgumentException e) {
- // expected
- }
- URL = "jdbc:metamatrix:bqt@mm://localhost:12345;version=1;user=xyz;password=***=;logLevel=1"; //$NON-NLS-1$
- try {
- new JDBCURL(URL);
- fail("Illegal argument should have failed."); //$NON-NLS-1$
- } catch (IllegalArgumentException e) {
- // expected
- }
- URL = "jdbc:metamatrix:bqt@mm://localhost:12345;version=1;user=xyz;=password=***;logLevel=1"; //$NON-NLS-1$
- try {
- new JDBCURL(URL);
- fail("Illegal argument should have failed."); //$NON-NLS-1$
- } catch (IllegalArgumentException e) {
- // expected
- }
- }
-
- public void testNoKeyInProperty() {
- String URL = "jdbc:metamatrix:bqt@mm://localhost:12345;version=1;user=xyz;=***;logLevel=1"; //$NON-NLS-1$
- try {
- new JDBCURL(URL);
- fail("Illegal argument should have failed."); //$NON-NLS-1$
- } catch (IllegalArgumentException e) {
- // expected
- }
- }
-
- public void testConstructor() {
- JDBCURL url = new JDBCURL("myVDB", "mm://myhost:12345",null); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals("jdbc:teiid:myVDB@mm://myhost:12345", url.getJDBCURL()); //$NON-NLS-1$
-
- Properties props = new Properties();
- props.setProperty(BaseDataSource.USER_NAME, "myuser"); //$NON-NLS-1$
- props.setProperty(BaseDataSource.PASSWORD, "mypassword"); //$NON-NLS-1$
- props.put("ClieNTtOKeN", new Integer(1)); //$NON-NLS-1$
- url = new JDBCURL("myVDB", "mm://myhost:12345", props); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals("jdbc:teiid:myVDB@mm://myhost:12345;user=myuser;password=mypassword", url.getJDBCURL()); //$NON-NLS-1$
- }
-
- public void testConstructor_Exception() {
- try {
- new JDBCURL(null, "myhost", null); //$NON-NLS-1$
- fail("Should have failed."); //$NON-NLS-1$
- } catch (Exception e) {
-
- }
- try {
- new JDBCURL(" ", "myhost", null); //$NON-NLS-1$ //$NON-NLS-2$
- fail("Should have failed."); //$NON-NLS-1$
- } catch (Exception e) {
-
- }
-
- try {
- // in embedded situation there is no connection url
- new JDBCURL("myVDB", " ", null); //$NON-NLS-1$ //$NON-NLS-2$
- } catch (Exception e) {
-
- }
- }
-
- public void testNormalize() {
- Properties props = new Properties();
- props.setProperty("UsEr", "myuser"); //$NON-NLS-1$ //$NON-NLS-2$
- props.setProperty("pAssWOrD", "mypassword"); //$NON-NLS-1$ //$NON-NLS-2$
- props.put("ClieNTtOKeN", new Integer(1)); //$NON-NLS-1$
- JDBCURL.normalizeProperties(props);
- assertEquals("myuser", props.getProperty(BaseDataSource.USER_NAME)); //$NON-NLS-1$
- assertEquals("mypassword", props.getProperty(BaseDataSource.PASSWORD)); //$NON-NLS-1$
- }
-
- public final void testEncodedPropertyProperties() throws Exception {
- String password = "=@#^&*()+!%$^%@#_-)_~{}||\\`':;,./<>?password has = & %"; //$NON-NLS-1$
- Properties props = new Properties();
- props.setProperty("UsEr", "foo"); //$NON-NLS-1$ //$NON-NLS-2$
- props.setProperty("PASswoRd", password); //$NON-NLS-1$
- JDBCURL.normalizeProperties(props);
-
- assertEquals(password, props.getProperty("password")); //$NON-NLS-1$
- assertEquals("foo", props.getProperty("user")); //$NON-NLS-1$//$NON-NLS-2$
- }
-
- public final void testEncodedPropertyInURL() throws Exception {
- String password = "=@#^&*()+!%$^%@#_-)_~{}||\\`':;,./<>?password has = & %"; //$NON-NLS-1$
- String encPassword = URLEncoder.encode(password, "UTF-8"); //$NON-NLS-1$
- JDBCURL url = new JDBCURL("jdbc:metamatrix:QT_sqls2kds@mm://slwxp136:43100;PASswoRd="+encPassword); //$NON-NLS-1$
- Properties p = url.getProperties();
- assertEquals(password, p.getProperty("password")); //$NON-NLS-1$
- }
-
-
- public void testGetServerURL_NoProperties() {
- String result = new JDBCURL("jdbc:metamatrix:designtimecatalog@mm://slwxp172:44401;user=ddifranco;password=mm").getConnectionURL(); //$NON-NLS-1$
- assertEquals("mm://slwxp172:44401", result); //$NON-NLS-1$
- }
-
- public void testGetServerURL_Properties() {
- String result = new JDBCURL("jdbc:metamatrix:designtimecatalog@mm://slwxp172:44401;user=ddifranco;password=mm").getConnectionURL(); //$NON-NLS-1$
- assertEquals("mm://slwxp172:44401", result); //$NON-NLS-1$
- }
-
- /**
- * Test getServerURL with a valid URL and password that contains at least
- * one ASCII character in the range of 32 to 126 excluding the ; and = sign.
- *
- * @since 5.0.2
- */
- public void testGetServerURL_PasswordProperties() throws Exception {
- String result = null;
- String srcURL = "jdbc:metamatrix:designtimecatalog@mm://slwxp172:44401;user=ddifranco;password="; //$NON-NLS-1$
- String password = null;
- String tgtURL = "mm://slwxp172:44401"; //$NON-NLS-1$
-
-
- for ( char ch = 32; ch <= 126; ch++ ) {
- //exclude URL reserved characters
- if ( ch != ';' && ch != '=' && ch != '%') {
- password = ch+"mm"; //$NON-NLS-1$
- result = new JDBCURL(srcURL+URLEncoder.encode(password, "UTF-8")).getConnectionURL(); //$NON-NLS-1$
- assertEquals("Failed to obtain correct ServerURL when using password "+password,tgtURL, result); //$NON-NLS-1$
- }
- }
-
- }
-
- public void testGetServerURL_2Servers() {
- String result = new JDBCURL("jdbc:metamatrix:designtimecatalog@mm://slwxp172:44401,slabc123:12345;user=ddifranco;password=mm").getConnectionURL(); //$NON-NLS-1$
- assertEquals("mm://slwxp172:44401,slabc123:12345", result); //$NON-NLS-1$
- }
-
- public void testBuildEmbeedURL() {
- JDBCURL url = new JDBCURL("vdb", "/home/foo/deploy.properties", new Properties()); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals("jdbc:teiid:vdb@/home/foo/deploy.properties", url.getJDBCURL()); //$NON-NLS-1$
-
- Properties p = new Properties();
- p.setProperty("user", "test"); //$NON-NLS-1$ //$NON-NLS-2$
- p.setProperty("password", "pass"); //$NON-NLS-1$ //$NON-NLS-2$
- p.setProperty("autoFailover", "true"); //$NON-NLS-1$ //$NON-NLS-2$
- p.setProperty("any", "thing"); //$NON-NLS-1$ //$NON-NLS-2$
-
- url = new JDBCURL("vdb", "/home/foo/deploy.properties", p); //$NON-NLS-1$ //$NON-NLS-2$
- assertTrue(url.getJDBCURL().startsWith("jdbc:teiid:vdb@/home/foo/deploy.properties;user=test;")); //$NON-NLS-1$
- assertTrue(url.getJDBCURL().indexOf("any=thing")!=-1); //$NON-NLS-1$
- assertTrue(url.getJDBCURL().indexOf("password=pass")!=-1); //$NON-NLS-1$
- assertTrue(url.getJDBCURL().indexOf("autoFailover=true")!=-1); //$NON-NLS-1$
-
- }
-}
Modified: trunk/common-core/src/main/java/com/metamatrix/common/types/SQLXMLImpl.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/types/SQLXMLImpl.java 2010-03-19 01:45:14 UTC (rev 1976)
+++ trunk/common-core/src/main/java/com/metamatrix/common/types/SQLXMLImpl.java 2010-03-19 16:17:09 UTC (rev 1977)
@@ -49,6 +49,10 @@
private InputStreamFactory streamFactory;
+ /**
+ * Constructs a SQLXML from bytes that are already encoded in {@link Streamable#ENCODING}
+ * @param bytes
+ */
public SQLXMLImpl(final byte[] bytes) {
setStreamFactory(bytes);
}
@@ -74,16 +78,17 @@
this.streamFactory = factory;
}
- public <T extends Source> T getSource(Class<T> sourceClass) throws SQLException {
+ @SuppressWarnings("unchecked")
+ public <T extends Source> T getSource(Class<T> sourceClass) throws SQLException {
if (sourceClass == null || sourceClass == StreamSource.class) {
return (T)new StreamSource(getBinaryStream());
}
- throw new SQLException("Unsupported source type " + sourceClass);
+ throw new SQLException("Unsupported source type " + sourceClass); //$NON-NLS-1$
}
public Reader getCharacterStream() throws SQLException {
if (this.streamFactory == null) {
- throw new SQLException("SQLXML already freed");
+ throw new SQLException("SQLXML already freed"); //$NON-NLS-1$
}
try {
return new InputStreamReader(this.streamFactory.getInputStream(), this.streamFactory.getEncoding());
@@ -96,7 +101,7 @@
public InputStream getBinaryStream() throws SQLException {
if (this.streamFactory == null) {
- throw new SQLException("SQLXML already freed");
+ throw new SQLException("SQLXML already freed"); //$NON-NLS-1$
}
try {
return this.streamFactory.getInputStream();
@@ -109,7 +114,7 @@
public String getString() throws SQLException {
try {
- return new String(ObjectConverterUtil.convertToByteArray(getBinaryStream()), Streamable.ENCODING);
+ return new String(ObjectConverterUtil.convertToByteArray(getBinaryStream()), this.streamFactory.getEncoding());
} catch (IOException e) {
SQLException ex = new SQLException(e.getMessage());
ex.initCause(e);
Modified: trunk/documentation/connector-developer-guide/src/main/docbook/en-US/connector_developer_guide.xml
===================================================================
--- trunk/documentation/connector-developer-guide/src/main/docbook/en-US/connector_developer_guide.xml 2010-03-19 01:45:14 UTC (rev 1976)
+++ trunk/documentation/connector-developer-guide/src/main/docbook/en-US/connector_developer_guide.xml 2010-03-19 16:17:09 UTC (rev 1977)
@@ -48,7 +48,6 @@
<xi:include href="content/introduction.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
<xi:include href="content/connector-api.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
<xi:include href="content/command-language.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
- <xi:include href="content/connector-development-kit.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
<xi:include href="content/connector-deployment.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
<xi:include href="content/connection-pooling.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
<xi:include href="content/lob-support.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
Deleted: trunk/documentation/connector-developer-guide/src/main/docbook/en-US/content/connector-development-kit.xml
===================================================================
--- trunk/documentation/connector-developer-guide/src/main/docbook/en-US/content/connector-development-kit.xml 2010-03-19 01:45:14 UTC (rev 1976)
+++ trunk/documentation/connector-developer-guide/src/main/docbook/en-US/content/connector-development-kit.xml 2010-03-19 16:17:09 UTC (rev 1977)
@@ -1,871 +0,0 @@
-<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
-<!ENTITY % CustomDTD SYSTEM "../../../../../../docbook/custom.dtd">
-%CustomDTD;
-]>
-<chapter id="connector_development_kit">
- <title>Using the Connector Development Kit</title>
- <sect1>
- <title>Overview</title>
- <para>The Connector Developer Kit (CDK) is a set of programmatic and
- command line utilities
- for testing connectors. The programmatic components of the CDK are
- useful for unit testing
- your connector and the command line utilities is useful for integration
- testing and regression
- testing (due to scripting abilities).</para>
- <para>This chapter covers usage of both aspects of the CDK. For more
- detailed information
- about the CDK programmatic utilities also consult the <ulink url="&javaDocUrl;">Teiid JavaDocs</ulink>.</para>
- </sect1>
- <sect1>
- <title>Programmatic Utilities</title>
- <para>All components provided by the CDK are in the package
- com.metamatrix.cdk.api. </para>
- <sect2>
- <title>Language Translation</title>
- <para>
- Commands are sent to the Connector API in terms of the language
- interfaces
- discussed in the
- <link linkend="command_language">Command Language</link>
- chapter. Typically, a connector must write logic to read and
- sometimes manipulate these objects. The CDK language translation
- utilities can be used to
- write unit tests for translation code or command execution.
- </para>
- <para>The utilities are provided in the class TranslationUtility.
- This class has the
- following methods:</para>
-
- <table frame='all'>
- <title>Language Translation</title>
- <tgroup cols='2' align='left' colsep='1' rowsep='1'>
- <colspec colname='c1' colwidth="1*" />
- <colspec colname='c2' colwidth="2*" />
- <thead>
- <row>
- <entry>
- <para>Method Name</para>
- </entry>
- <entry>
- <para>Description</para>
- </entry>
- </row>
- </thead>
- <tbody>
- <row>
- <entry>
- <para>TranslationUtility(String vdbFile)</para>
- </entry>
- <entry>
- <para>Constructor – takes the path to a file which is a valid
- metadata
- archive created by the Teiid Designer. These files have the suffix
- “.vdb”.
- </para>
- </entry>
- </row>
- <row>
- <entry>
- <para>createRuntimeMetadata()</para>
- </entry>
- <entry>
- <para>Creates an instance of RuntimeMetadata that can be used to
- test code
- that uses runtime metadata when translating or executing commands.
- </para>
- </entry>
- </row>
- <row>
- <entry>
- <para>parseCommand(String sql)</para>
- </entry>
- <entry>
- <para>Take a single-source command and return an ICommand that
- can be used to
- test translation or execution of commands.</para>
- </entry>
- </row>
- </tbody>
- </tgroup>
- </table>
- </sect2>
-
- <sect2>
- <title>Command Execution</title>
- <para>The primary purpose of a Connector is to execute commands
- against an information
- source. The query execution utilities allow you to test the execution of
- commands
- programmatically. This utility does not run the Teiid query engine or the connector
- manager although does simulate what happens when those components
- use a Connector to execute
- a command.</para>
- <para>The command execution utilities are provided in the class
- ConnectorHost. This class
- has the following methods:</para>
-
- <table frame='all'>
- <title>Command Execution</title>
- <tgroup cols='2' align='left' colsep='1' rowsep='1'>
- <colspec colname='c1' colwidth="1*" />
- <colspec colname='c2' colwidth="1.25*" />
- <thead>
- <row>
- <entry>
- <para>Method Name</para>
- </entry>
- <entry>
- <para>Description</para>
- </entry>
- </row>
- </thead>
- <tbody>
- <row>
- <entry>
- <para>ConnectorHost</para>
- </entry>
- <entry>
- <para>Constructor – takes a Connector instance, a set of
- connector
- property values, and the path to a VDB archive file</para>
- </entry>
- </row>
- <row>
- <entry>
- <para>setBatchSize</para>
- </entry>
- <entry>
- <para>Sets the batch size to use when executing commands.</para>
- </entry>
- </row>
- <row>
- <entry>
- <para>setExecutionContext</para>
- </entry>
- <entry>
- <para>Sets the security context values currently being used to
- execute commands.
- This method may be called multiple times during the use of a single
- instance of
- ConnectorHost to change the current context.</para>
- </entry>
- </row>
- <row>
- <entry>
- <para>getConnectorEnvironmentProperties</para>
- </entry>
- <entry>
- <para>Helper method to retrieve the properties passed to the
- ConnectorHost
- constructor.</para>
- </entry>
- </row>
- <row>
- <entry>
- <para>executeCommand</para>
- </entry>
- <entry>
- <para>Execute a command and return the results using this
- connector.</para>
- </entry>
- </row>
- <row>
- <entry>
- <para>executeBatchedUpdates</para>
- </entry>
- <entry>
- <para>Execute a set of commands as a batched update.</para>
- </entry>
- </row>
- <row>
- <entry>
- <para>getCommand</para>
- </entry>
- <entry>
- <para>Use the host metadata to get the ICommand for a SQL
- string.</para>
- </entry>
- </row>
- </tbody>
- </tgroup>
- </table>
- <para />
- <para>Here is some example code showing how to use ConnectorHost to
- test a connector:
- </para>
- <programlisting><![CDATA[
-// Prepare state for testing
-MyConnector connector = new MyConnector();
-Properties props = new Properties();
-props.setProperty(“user”, “myuser”);
-props.setProperty(“password”, “mypassword”);
-String vdbFile = “c:/mymetadata.vdb”;
-
-// Create host
-ConnectorHost host = new ConnectorHost(connector, props, vdbFile);
-
-// Execute query
-List results = host.executeCommand(“SELECT col FROM group WHERE col = 5”);
-
-// Compare actual results to expected results
-// . . .
- ]]></programlisting>
- <para>The executeCommand() method will return results as a List of
- rows. Each row is
- itself a List of objects in column order. So, each row should have the
- same number of items
- corresponding to the columns in the SELECT clause of the query. In the case of
- an INSERT,
- UPDATE, or DELETE, a single “row” will be returned with a single column
- that contains the
- update count.</para>
- </sect2>
-
- </sect1>
-
- <sect1>
- <title>Connector Environment</title>
- <para>Many parts of the Connector API require use of the Connector
- Environment. The
- EnvironmentUtility can be used to obtain and control a Connector Environment instance.
- </para>
-
- <table frame='all'>
- <title>Command Execution</title>
- <tgroup cols='2' align='left' colsep='1' rowsep='1'>
- <colspec colname='c1' colwidth="1*" />
- <colspec colname='c2' colwidth="2*" />
- <thead>
- <row>
- <entry>
- <para>Method Name</para>
- </entry>
- <entry>
- <para>Description</para>
- </entry>
- </row>
- </thead>
- <tbody>
- <row>
- <entry>
- <para>createExecutionContext</para>
- </entry>
- <entry>
- <para>Creates a ExecutionContext instance.</para>
- </entry>
- </row>
- <row>
- <entry>
- <para>createStdoutLogger</para>
- </entry>
- <entry>
- <para>Creates an instance of ConnectorLogger that prints log
- messages to
- system.out( )</para>
- </entry>
- </row>
- <row>
- <entry>
- <para>createEnvironment</para>
- </entry>
- <entry>
- <para>Creates an instance of connectorEnvironment for use in your
- testing
- environment.</para>
- </entry>
- </row>
- <row>
- <entry>
- <para>createExecutionContext</para>
- </entry>
- <entry>
- <para>Creates an ExecutionContext instance.</para>
- </entry>
- </row>
- </tbody>
- </tgroup>
- </table>
- <para />
- <para>In addition, some implementations of ConnectorLogger are
- provided which can be used as
- needed to build a custom logger for testing. BaseLogger is a base logger
- class that can be
- extended to create your own ConnectorLogger implementation. SysLogger is a
- utility
- implementation that logs to System.out.</para>
- </sect1>
-
- <sect1>
- <title>Command Line Tester</title>
- <sect2>
- <title>Using the Command Line Tester</title>
- <para>The command line tester is available in the mmtools kit along
- with the other
- Teiid products in the tools directory. The tester can be executed in
- interactive mode by running </para>
-
- <programlisting><![CDATA[
- <unzipped folder>S\cdk\cdk.bat
- ]]></programlisting>
- <para>Typing “help” in the command line tester provides a list of all
- available options. These options are listed here with some
- additional detail:</para>
-
- <table frame='all'>
- <title>Connector Lifecycle</title>
- <tgroup cols='3' align='left' colsep='1' rowsep='1'>
- <colspec colname='c1' colwidth="1*" />
- <colspec colname='c2' colwidth="1*" />
- <colspec colname='c3' colwidth="2*" />
-
- <thead>
- <row>
- <entry>
- <para>Option</para>
- </entry>
- <entry>
- <para>Arguments</para>
- </entry>
- <entry>
- <para>Description</para>
- </entry>
- </row>
- </thead>
- <tbody>
- <row>
- <entry>
- <para>Load Archive</para>
- </entry>
- <entry>
- <para>ArchiveFileName</para>
- </entry>
- <entry>
- <para>Load the Connector archive file, which loads the Connector
- type definition
- file and all the extension modules into the CDK shell.</para>
- </entry>
- </row>
- <row>
- <entry>
- <para>Load</para>
- </entry>
- <entry>
- <para>ConnectorClass vdbFile</para>
- </entry>
- <entry>
- <para>Load a connector by specifying the connector class name
- and the VDB metadata archive file</para>
- </entry>
- </row>
- <row>
- <entry>
- <para>LoadFromScript</para>
- </entry>
- <entry>
- <para>ScriptFile</para>
- </entry>
- <entry>
- <para>Load a connector from a script</para>
- </entry>
- </row>
- <row>
- <entry>
- <para>LoadProperties</para>
- </entry>
- <entry>
- <para>PropertyFile</para>
- </entry>
- <entry>
- <para>Load a set of properties for your connector from a file
- </para>
- </entry>
- </row>
- <row>
- <entry>
- <para>SetProperty</para>
- </entry>
- <entry>
- <para>PropertyName PropertyValue</para>
- </entry>
- <entry>
- <para>Set the value of a property</para>
- </entry>
- </row>
- <row>
- <entry>
- <para>GetProperties</para>
- </entry>
- <entry>
- <para />
- </entry>
- <entry>
- <para>List all properties currently set on the connector</para>
- </entry>
- </row>
- <row>
- <entry>
- <para>Start</para>
- </entry>
- <entry>
- <para />
- </entry>
- <entry>
- <para>Start the connector</para>
- </entry>
- </row>
- <row>
- <entry>
- <para>Stop</para>
- </entry>
- <entry>
- <para />
- </entry>
- <entry>
- <para>Stop the connector</para>
- </entry>
- </row>
- </tbody>
- </tgroup>
- </table>
-
- <table frame='all'>
- <title>Command Execution</title>
- <tgroup cols='3' align='left' colsep='1' rowsep='1'>
- <colspec colname='c1' colwidth="1*" />
- <colspec colname='c2' colwidth="1*" />
- <colspec colname='c3' colwidth="2*" />
-
- <thead>
- <row>
- <entry>
- <para>Option</para>
- </entry>
- <entry>
- <para>Arguments</para>
- </entry>
- <entry>
- <para>Description</para>
- </entry>
- </row>
- </thead>
- <tbody>
- <row>
- <entry>
- <para>Select</para>
- </entry>
- <entry>
- <para>Sql</para>
- </entry>
- <entry>
- <para>Run a SELECT statement. This option takes multi-line
- input terminated with “;”</para>
- </entry>
- </row>
- <row>
- <entry>
- <para>Insert</para>
- </entry>
- <entry>
- <para>Sql</para>
- </entry>
- <entry>
- <para>Execute an INSERT statement. This option takes multi-line
- input terminated with a “;”.</para>
- </entry>
- </row>
- <row>
- <entry>
- <para>Update</para>
- </entry>
- <entry>
- <para>Sql</para>
- </entry>
- <entry>
- <para>Execute an UPDATE statement. This option takes multi-line
- input terminated with “;”</para>
- </entry>
- </row>
- <row>
- <entry>
- <para>Delete</para>
- </entry>
- <entry>
- <para>Sql</para>
- </entry>
- <entry>
- <para>Execute a DELETE statement. This option takes multi-line
- input terminated with a “;”.</para>
- </entry>
- </row>
- <row>
- <entry>
- <para>SetBatchSize</para>
- </entry>
- <entry>
- <para>BatchSize</para>
- </entry>
- <entry>
- <para>Set the batch size used when retrieving results</para>
- </entry>
- </row>
- <row>
- <entry>
- <para>SetExecutionContext</para>
- </entry>
- <entry>
- <para>VDBName VDBVersion UserName</para>
- </entry>
- <entry>
- <para>Set the properties of the current security context</para>
- </entry>
- </row>
- <row>
- <entry>
- <para>SetPrintStackOnError</para>
- </entry>
- <entry>
- <para>PrintStackOnError</para>
- </entry>
- <entry>
- <para>Set whether to print the stack trace when an error is
- received</para>
- </entry>
- </row>
- </tbody>
- </tgroup>
- </table>
-
- <table frame='all'>
- <title>Scripting</title>
- <tgroup cols='3' align='left' colsep='1' rowsep='1'>
- <colspec colname='c1' colwidth="1*" />
- <colspec colname='c2' colwidth="1*" />
- <colspec colname='c3' colwidth="2*" />
-
- <thead>
- <row>
- <entry>
- <para>Option</para>
- </entry>
- <entry>
- <para>Arguments</para>
- </entry>
- <entry>
- <para>Description</para>
- </entry>
- </row>
- </thead>
- <tbody>
- <row>
- <entry>
- <para>SetScriptFile</para>
- </entry>
- <entry>
- <para>ScriptFile</para>
- </entry>
- <entry>
- <para>Set the script file to use</para>
- </entry>
- </row>
- <row>
- <entry>
- <para>Run</para>
- </entry>
- <entry>
- <para>ScriptName</para>
- </entry>
- <entry>
- <para>Run a script with the file name</para>
- </entry>
- </row>
- <row>
- <entry>
- <para>Runall</para>
- </entry>
- <entry>
- <para />
- </entry>
- <entry>
- <para>Run all scripts loaded by loadFromScript</para>
- </entry>
- </row>
- <row>
- <entry>
- <para>RunScript</para>
- </entry>
- <entry>
- <para>ScriptFile</para>
- <para>ScriptNameWithinFile</para>
- </entry>
- <entry>
- <para>Run a particular script in a script file</para>
- </entry>
- </row>
- <row>
- <entry>
- <para>SetFailOnError</para>
- </entry>
- <entry>
- <para>FailOnError</para>
- </entry>
- <entry>
- <para>Set whether to fail a script when an error is encountered
- or continue on</para>
- </entry>
- </row>
- <row>
- <entry>
- <para>Result</para>
- </entry>
- <entry>
- <para>ExpectedResults</para>
- </entry>
- <entry>
- <para>Compares actual results from the previous command with the
- expected
- results. This command is only available when using the command line
- tester in script
- mode.</para>
- </entry>
- </row>
- </tbody>
- </tgroup>
- </table>
-
- <table frame='all'>
- <title>Miscellaneous</title>
- <tgroup cols='3' align='left' colsep='1' rowsep='1'>
- <colspec colname='c1' colwidth="1*" />
- <colspec colname='c2' colwidth="1*" />
- <colspec colname='c3' colwidth="2*" />
-
- <thead>
- <row>
- <entry>
- <para>Option</para>
- </entry>
- <entry>
- <para>Arguments</para>
- </entry>
- <entry>
- <para>Description</para>
- </entry>
- </row>
- </thead>
- <tbody>
- <row>
- <entry>
- <para>CreateArchive</para>
- </entry>
- <entry>
- <para>ArchiveFileName</para>
- <para>CDKFileName</para>
- <para>ExtensionModuleDir</para>
- </entry>
- <entry>
- <para>Creates a connector archive file based on the properties
- supplied.</para>
- </entry>
- </row>
- <row>
- <entry>
- <para>CreateTemplate</para>
- </entry>
- <entry>
- <para>TemplateFile</para>
- </entry>
- <entry>
- <para>Create a template connector type file at the given file
- name.</para>
- </entry>
- </row>
- <row>
- <entry>
- <para>Help</para>
- </entry>
- <entry>
- <para />
- </entry>
- <entry>
- <para>List all options</para>
- </entry>
- </row>
- <row>
- <entry>
- <para>Quit</para>
- </entry>
- <entry>
- <para />
- </entry>
- <entry>
- <para>Quit the command line tester</para>
- </entry>
- </row>
- </tbody>
- </tgroup>
- </table>
- </sect2>
-
- <sect2>
- <title>Loading Your Connector</title>
- <para>Preparing your connector to execute commands consists of the
- following steps:</para>
- <orderedlist>
- <listitem>
- <para>Add your connector code to the CDK classpath. The cdk.bat
- script looks for this code
- in the CONNECTORPATH environment variable. This variable can be set
- with the DOS shell
- command “SET CONNECTORPATH=c:\path\to\connector.jar”. Alternately, you
- can modify the value
- of the CONNECTORPATH environment variable in the cdk.bat file.
- </para>
- </listitem>
- <listitem>
- <para>Start the command line tester. You can start the tester by
- executing the cdk.bat
- file in the cdk directory of the Teiid Tools installation. </para>
- </listitem>
- <listitem>
- <para>Load your connector class and the associated runtime
- metadata. You can load your
- connector by using the “load” command and specifying the fully-qualified
- class name of your
- Connector implementation and the path to a VDB file. The VDB runtime
- metadata archive
- should contain the metadata you want to use while testing.</para>
- </listitem>
- <listitem>
- <para>Set any properties required by your connector. This can be
- accomplished with the
- setProperty command for individual properties or the loadProperties command
- to load a set of
- properties from either a properties file or a connector binding file. You
- can use the
- “getProperties” command to view the current property settings.</para>
- </listitem>
- <listitem>
- <para>Start the connector. Use the “start” command in the
- command-line tester to start your connector. </para>
- </listitem>
- </orderedlist>
-
- <para>Following is an example transcript of how this process might
- look in a DOS command window. User input is in bold.</para>
-
- <programlisting><![CDATA[
-D:\teiid\cdk> set CONNECTORPATH=D:\myconn\myconn.jar
-D:\teiid\cdk> cdk.bat
-========================== ENV SETTINGS ==========================
-TEIID_ROOT = D:\teiid
-CONNECTORPATH = D:\myconn\myconn.jar
-CLASSPATH = ;D:\teiid\cdk\metamatrix-cdk.jar;D:\myconn\myconn.jar;
-==================================================================
-
-java -Xmx256m com.metamatrix.cdk.ConnectorShell
-Starting
-Started
->load com.metamatrix.myconn.MyConnector d:\myconn\myconn.vdb
->setproperty user joe
->start
->
- ]]></programlisting>
-
- </sect2>
-
- <sect2>
- <title>Executing Commands</title>
- <para>Commands can be executed against your connector using the
- SELECT, INSERT, UPDATE, and DELETE commands. Procedure execution is
- not currently supported via the command line tester. Commands may
- span multiple lines and should be terminated with a “;”. </para>
- <para>When a command is executed, the results are printed to the
- console. Following is an example session executing a SELECT command
- with the command line tester. User input is in bold.</para>
- <programlisting><![CDATA[
->SELECT Name, Value FROM MyModel.MyGroup WHERE Name = ‘xyz’;
-String Integer
-xyz 5
-xyz 10
->
- ]]></programlisting>
-
- <para />
- </sect2>
-
- <sect2>
- <title>Scripting</title>
- <para>One of the most useful capabilities of the command-line tester
- is the ability to capture
- a sequence of commands in a script and automate the execution of the
- script. This allows for
- the rapid creation of regression and acceptance tests. </para>
- <para>A script file may contain multiple scripts, where each script
- is grouped together with { }
- and a name. Following is an example of a script file. This script
- file also uses the special
- script-only command RESULTS that will compare the results of the last execution
- with the
- specified expected results.</para>
- <programlisting><![CDATA[
-test {
- load com.metamatrix.myconn.MyConnector d:\myconn\myconn.vdb
- setproperty user joe
- start
-
- SELECT Name, Value FROM MyModel.MyGroup WHERE Name = ‘xyz’;
- results [
- String Integer
- xyz 5
- xyz 10
- ]
-}
- ]]></programlisting>
-
- <para />
- <para>To execute this file, run the command line tester in scripting
- mode and specify the script
- file and the script within the file:</para>
-
- <programlisting><![CDATA[
-D:\teiid\cdk>cdk runscript d:\myconn\my.script test
-========================== ENV SETTINGS ==========================
-TEIID_ROOT = D:\teiid
-CONNECTORPATH = D:\myconn\myconn.jar
-CLASSPATH = ;D:\teiid\cdk\metamatrix-cdk.jar;D:\myconn\myconn.jar;
-==================================================================
-
-java -Xmx256m -Dmetamatrix.config.none -Dmetamatrix.log=4 com.metamatrix.cdk.ConnectorShell runscript my.script
-Starting
-Started
->Executing: load com.metamatrix.myconn.MyConnector d:\myconn\myconn.vdb
->Executing: setproperty user joe
->Executing: start
->Executing: select Name, Value from MyModel.MyGroup where Name = ‘xyz’;
-String Integer
-xyz 5
-xyz 15
-
->Test /teiid/cdk/yahoo.script.test failed. CompareResults Error: Value mismatch at row 2 and column 2: expected = 10, actual = 15
-
->Finished
-D:\teiid\cdk>
- ]]></programlisting>
-
- <para />
- <para>The script run above illustrates the output when the test
- result fails due to differences
- between expected and actual results. In this case the value was expected
- to be 10 in the script
- but was actually 15. The setFailOnError command can be used to fail
- the execution of the entire
- script if an error occurs. </para>
- <para>Scripts can also be run in interactive mode by using the
- setScriptFile and run
- commands. This can be useful to record portions of your interactive testing
- to avoid re-typing
- later.</para>
- </sect2>
- </sect1>
-</chapter>
\ No newline at end of file
Modified: trunk/documentation/reference/src/main/docbook/en-US/content/federated_planning.xml
===================================================================
--- trunk/documentation/reference/src/main/docbook/en-US/content/federated_planning.xml 2010-03-19 01:45:14 UTC (rev 1976)
+++ trunk/documentation/reference/src/main/docbook/en-US/content/federated_planning.xml 2010-03-19 16:17:09 UTC (rev 1977)
@@ -304,15 +304,14 @@
results mode may be overridden on a per-query basis by setting
the execution property on the Statement. To set this property,
cast to the Teiid Statement JDBC API extension interface
- <classname>com.metamatrix.jdbc.api.Statement
+ <classname>org.teiid.jdbc.TeiidStatement
</classname>
</para>
<example>
<title>Example - Setting Partial Results Mode</title>
<programlisting>Statement statement = ...obtain statement from Connection...
-com.metamatrix.jdbc.api.Statement mmStatement =
- (com.metamatrix.jdbc.api.Statement) statement;
+TeiidStatement mmStatement = statement.unWrap(TeiidStatement.class);
mmStatement.setExecutionProperty(
ExecutionProperties.PROP_PARTIAL_RESULTS_MODE, "true");</programlisting>
@@ -348,7 +347,7 @@
warnings can be obtained from the Statement.getWarnings()
method. This method returns a SQLWarning object but in the
case of "partial results" warnings, this will be an object of
- type com.metamatrix.jdbc.api.PartialResultsWarning. This class
+ type org.teiid.jdbc.PartialResultsWarning. This class
can be used to obtain a list of all the failed connectors by
name and to obtain the specific exception thrown by each
connector.</para>
@@ -399,13 +398,13 @@
<para>
With the above options, the query plan is available from the
Statement object by casting to the
- <classname>com.metamatrix.jdbc.api.Statement
+ <classname>org.teiid.jdbc.TeiidStatement
</classname>
interface.
</para>
<example>
<title>Retrieving a Query Plan</title>
- <programlisting>com.metamatrix.jdbc.api.Statement mmstatement = (com.metamatrix.jdbc.api.Statement)statement;
+ <programlisting>TeiidStatement mmstatement = statement.unWrap(TeiidStatement.class);
String sql = "select ...";
mmstatement.setExecutionProperty(ExecutionProperties.PROP_SQL_OPTIONS, ExecutionProperties.SQL_OPTION_SHOWPLAN);
Modified: trunk/documentation/reference/src/main/docbook/en-US/content/grammar.xml
===================================================================
--- trunk/documentation/reference/src/main/docbook/en-US/content/grammar.xml 2010-03-19 01:45:14 UTC (rev 1976)
+++ trunk/documentation/reference/src/main/docbook/en-US/content/grammar.xml 2010-03-19 16:17:09 UTC (rev 1977)
@@ -2,772 +2,742 @@
<!DOCTYPE appendix PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
<appendix id="grammar">
<title>BNF for SQL Grammar</title>
- <sect1 remap="h2">
- <title>TOKENS</title>
- <informaltable frame="none">
- <tgroup cols="1">
- <colspec colname="c1" colwidth="100*"/>
- <!-- Token -->
- <tbody>
- <row>
- <entry><para>
+<sect1>
+<title>TOKENS</title>
+<informaltable frame="none">
+<tgroup cols="1">
+<colspec colname="c1" colwidth="100*"/>
+<tbody>
+<row><entry><para>
<DEFAULT> SKIP : {
-" "
-| "\t"
-| "\n"
-| "\r"
+" "
+| "\t"
+| "\n"
+| "\r"
}
- </para></entry>
- </row>
- <!-- Token -->
- <row>
- <entry><para>
+</para></entry></row>
+<row><entry><para>
<DEFAULT> MORE : {
-"/*" : IN_MULTI_LINE_COMMENT
+"/*" : IN_MULTI_LINE_COMMENT
}
- </para></entry>
- </row>
- <!-- Token -->
- <row>
- <entry><para>
+</para></entry></row>
+<row><entry><para>
<IN_MULTI_LINE_COMMENT> SPECIAL : {
-<MULTI_LINE_COMMENT: "*/"> : DEFAULT
+<MULTI_LINE_COMMENT: "*/"> : DEFAULT
}
- </para></entry>
- </row>
- <!-- Token -->
- <row>
- <entry><para>
+</para></entry></row>
+<row><entry><para>
<IN_MULTI_LINE_COMMENT> MORE : {
<~[]>
}
- </para></entry>
- </row>
- <!-- Token -->
- <row>
- <entry><para>
+</para></entry></row>
+<row><entry><para>
<DEFAULT> TOKEN : {
-<STRING: "string">
-| <BOOLEAN: "boolean">
-| <BYTE: "byte">
-| <SHORT: "short">
-| <CHAR: "char">
-| <INTEGER: "integer">
-| <LONG: "long">
-| <BIGINTEGER: "biginteger">
-| <FLOAT: "float">
-| <DOUBLE: "double">
-| <BIGDECIMAL: "bigdecimal">
-| <DATE: "date">
-| <TIME: "time">
-| <TIMESTAMP: "timestamp">
-| <OBJECT: "object">
-| <BLOB: "blob">
-| <CLOB: "clob">
-| <XML: "xml">
+<STRING: "string">
+| <VARCHAR: "varchar">
+| <BOOLEAN: "boolean">
+| <BYTE: "byte">
+| <TINYINT: "tinyint">
+| <SHORT: "short">
+| <SMALLINT: "smallint">
+| <CHAR: "char">
+| <INTEGER: "integer">
+| <LONG: "long">
+| <BIGINT: "bigint">
+| <BIGINTEGER: "biginteger">
+| <FLOAT: "float">
+| <REAL: "real">
+| <DOUBLE: "double">
+| <BIGDECIMAL: "bigdecimal">
+| <DECIMAL: "decimal">
+| <DATE: "date">
+| <TIME: "time">
+| <TIMESTAMP: "timestamp">
+| <OBJECT: "object">
+| <BLOB: "blob">
+| <CLOB: "clob">
+| <XML: "xml">
}
- </para></entry>
- </row>
- <!-- Token -->
- <row>
- <entry><para>
+</para></entry></row>
+<row><entry><para>
<DEFAULT> TOKEN : {
-<CAST: "cast">
-| <CONVERT: "convert">
-| <TIMESTAMPADD: "timestampadd">
-| <TIMESTAMPDIFF: "timestampdiff">
-| <COUNT: "count">
-| <SUM: "sum">
-| <AVG: "avg">
-| <MIN: "min">
-| <MAX: "max">
+<CAST: "cast">
+| <CONVERT: "convert">
+| <TIMESTAMPADD: "timestampadd">
+| <TIMESTAMPDIFF: "timestampdiff">
+| <COUNT: "count">
+| <SUM: "sum">
+| <AVG: "avg">
+| <MIN: "min">
+| <MAX: "max">
}
- </para></entry>
- </row>
- <!-- Token -->
- <row>
- <entry><para>
+</para></entry></row>
+<row><entry><para>
<DEFAULT> TOKEN : {
-<ALL: "all">
-| <AND: "and">
-| <ANY: "any">
-| <AS: "as">
-| <ASC: "asc">
-| <BEGIN: "begin">
-| <BETWEEN: "between">
-| <BREAK: "break">
-| <BY: "by">
-| <CASE: "case">
-| <CONTINUE: "continue">
-| <CREATE: "create">
-| <CRITERIA: "criteria">
-| <CROSS: "cross">
-| <DEBUG: "debug">
-| <DECLARE: "declare">
-| <DELETE: "delete">
-| <DESC: "desc">
-| <DISTINCT: "distinct">
-| <DROP: "drop">
-| <ELSE: "else">
-| <END: "end">
-| <ERROR: "error">
-| <ESCAPE: "escape">
-| <EXCEPT: "except">
-| <EXEC: "exec">
-| <EXECUTE: "execute">
-| <EXISTS: "exists">
-| <FALSE: "false">
-| <FN: "fn">
-| <FOR: "for">
-| <FROM: "from">
-| <FULL: "full">
-| <GROUP: "group">
-| <HAS: "has">
-| <HAVING: "having">
-| <IF: "if">
-| <IN: "in">
-| <INNER: "inner">
-| <INSERT: "insert">
-| <INTERSECT: "intersect">
-| <INTO: "into">
-| <IS: "is">
-| <JOIN: "join">
-| <LEFT: "left">
-| <LIKE: "like">
-| <LIMIT: "limit">
-| <LOCAL: "local">
-| <LOOP: "loop">
-| <MAKEDEP: "makedep">
-| <MAKENOTDEP: "makenotdep">
-| <NOCACHE: "nocache">
-| <NOT: "not">
-| <NULL: "null">
-| <ON: "on">
-| <OJ: "oj">
-| <OPTION: "option">
-| <OR: "or">
-| <ORDER: "order">
-| <OUTER: "outer">
-| <PLANONLY: "planonly">
-| <PROCEDURE: "procedure">
-| <RIGHT: "right">
-| <SELECT: "select">
-| <SET: "set">
-| <SHOWPLAN: "showplan">
-| <SOME: "some">
-| <TABLE: "table">
-| <TEMPORARY: "temporary">
-| <THEN: "then">
-| <TRANSLATE: "translate">
-| <TRUE: "true">
-| <UNION: "union">
-| <UNKNOWN: "unknown">
-| <UPDATE: "update">
-| <USING: "using">
-| <VALUES: "values">
-| <VIRTUAL: "virtual">
-| <WHEN: "when">
-| <WHERE: "where">
-| <WITH: "with">
-| <WHILE: "while">
+<ADD: "add">
+| <ALL: "all">
+| <ALTER: "alter">
+| <AND: "and">
+| <ANY: "any">
+| <ARRAY: "array">
+| <AS: "as">
+| <ASC: "asc">
+| <ATOMIC: "atomic">
+| <AUTORIZATION: "authorization">
+| <BEGIN: "begin">
+| <BETWEEN: "between">
+| <BINARY: "binary">
+| <BOTH: "both">
+| <BREAK: "break">
+| <BY: "by">
+| <CALL: "call">
+| <CALLED: "called">
+| <CASCADED: "cascaded">
+| <CASE: "case">
+| <CHARACTER: "character">
+| <CHECK: "check">
+| <CLOSE: "close">
+| <COLLATE: "collate">
+| <COLUMN: "column">
+| <COMMIT: "commit">
+| <CONNECT: "connect">
+| <CONSTRAINT: "constraint">
+| <CONTINUE: "continue">
+| <CORRESPONDING: "corresponding">
+| <CURRENT_DATE: "current_date">
+| <CURRENT_TIME: "current_time">
+| <CURRENT_TIMESTAMP: "current_timestamp">
+| <CURRENT_USER: "current_user">
+| <CREATE: "create">
+| <CRITERIA: "criteria">
+| <CROSS: "cross">
+| <CURSOR: "cursor">
+| <DAY: "day">
+| <DEALLOCATE: "deallocate">
+| <DEFAULT_KEYWORD: "default">
+| <DEBUG: "debug">
+| <DECLARE: "declare">
+| <DELETE: "delete">
+| <DESC: "desc">
+| <DESCRIBE: "describe">
+| <DETERMINISTIC: "deterministic">
+| <DISCONNECT: "disconnect">
+| <DISTINCT: "distinct">
+| <DROP: "drop">
+| <ELSE: "else">
+| <END: "end">
+| <ERROR: "error">
+| <ESCAPE: "escape">
+| <EXCEPT: "except">
+| <EXEC: "exec">
+| <EXECUTE: "execute">
+| <EXTERNAL: "external">
+| <EXISTS: "exists">
+| <FALSE: "false">
+| <FETCH: "fetch">
+| <FILTER: "filter">
+| <FN: "fn">
+| <FOR: "for">
+| <FORIEGN: "foriegn">
+| <FROM: "from">
+| <FULL: "full">
+| <FUNCTION: "function">
+| <GET: "get">
+| <GLOBAL: "global">
+| <GRANT: "grant">
+| <GROUP: "group">
+| <HAS: "has">
+| <HAVING: "having">
+| <HOLD: "hold">
+| <HOUR: "hour">
+| <IF: "if">
+| <IDENTITY: "identity">
+| <IMMEDIATE: "immediate">
+| <IN: "in">
+| <INDICATOR: "indicator">
+| <INNER: "inner">
+| <INPUT: "input">
+| <INOUT: "inout">
+| <INSENSITIVE: "insensitive">
+| <INSERT: "insert">
+| <INTERSECT: "intersect">
+| <INTERVAL: "interval">
+| <INTO: "into">
+| <IS: "is">
+| <ISOLATION: "isolation">
+| <JOIN: "join">
+| <LEFT: "left">
+| <LANGUAGE: "language">
+| <LARGE: "large">
+| <LEADING: "leading">
+| <LIKE: "like">
+| <LIMIT: "limit">
+| <LOCAL: "local">
+| <LOOP: "loop">
+| <MAKEDEP: "makedep">
+| <MAKENOTDEP: "makenotdep">
+| <MATCH: "match">
+| <MERGE: "merge">
+| <METHOD: "method">
+| <MINUTE: "minute">
+| <MODIFIES: "modifies">
+| <MODULE: "module">
+| <MONTH: "month">
+| <NATURAL: "natural">
+| <NEW: "new">
+| <NOCACHE: "nocache">
+| <NO: "no">
+| <NONE: "none">
+| <NOT: "not">
+| <NULL: "null">
+| <OF: "of">
+| <OLD: "old">
+| <ON: "on">
+| <ONLY: "only">
+| <OJ: "oj">
+| <OPEN: "open">
+| <OPTION: "option">
+| <OR: "or">
+| <ORDER: "order">
+| <OUTER: "outer">
+| <OUTPUT: "output">
+| <OVER: "over">
+| <OVERLAPS: "OVERLAPS">
+| <PARAMETER: "parameter">
+| <PARTITION: "partition">
+| <PLANONLY: "planonly">
+| <PRECISION: "precision">
+| <PREPARE: "prepare">
+| <PRIMARY: "primary">
+| <PROCEDURE: "procedure">
+| <RANGE: "range">
+| <READS: "reads">
+| <RECURSIVE: "recursive">
+| <REFERENCES: "REFERENCES">
+| <REFERENCING: "REFERENCING">
+| <RETURN: "return">
+| <RETURNS: "returns">
+| <REVOKE: "REVOKE">
+| <RIGHT: "right">
+| <ROLLBACK: "ROLLBACK">
+| <ROLLUP: "ROLLUP">
+| <ROW: "row">
+| <ROWS: "rows">
+| <SAVEPOINT: "savepoint">
+| <SCROLL: "scroll">
+| <SEARCH: "search">
+| <SECOND: "second">
+| <SELECT: "select">
+| <SENSITIVE: "sensitive">
+| <SESSION_USER: "session_user">
+| <SET: "set">
+| <SHOWPLAN: "showplan">
+| <SIMILAR: "similar">
+| <SPECIFIC: "specific">
+| <SOME: "some">
+| <SQL: "sql">
+| <SQLEXCEPTION: "sqlexception">
+| <SQLSTATE: "sqlstate">
+| <SQLWARNING: "sqlwarning">
+| <START: "start">
+| <STATIC: "static">
+| <SYSTEM: "system">
+| <SYSTEM_USER: "system_user">
+| <TABLE: "table">
+| <TEMPORARY: "temporary">
+| <THEN: "then">
+| <TIMEZONE_HOUR: "timezone_hour">
+| <TIMEZONE_MINUTE: "timezone_minute">
+| <TO: "to">
+| <TRAILING: "trailing">
+| <TRANSLATE: "translate">
+| <TRIGGER: "trigger">
+| <TRUE: "true">
+| <UNION: "union">
+| <UNIQUE: "unique">
+| <UNKNOWN: "unknown">
+| <USER: "user">
+| <UPDATE: "update">
+| <USING: "using">
+| <VALUE: "value">
+| <VALUES: "values">
+| <VIRTUAL: "virtual">
+| <WHEN: "when">
+| <WHENEVER: "whenever">
+| <WHERE: "where">
+| <WITH: "with">
+| <WHILE: "while">
+| <WINDOW: "window">
+| <WITHIN: "within">
+| <WITHOUT: "without">
+| <YEAR: "year">
}
- </para></entry>
- </row>
- <!-- Token -->
- <row>
- <entry><para>
+</para></entry></row>
+<row><entry><para>
<DEFAULT> TOKEN : {
-<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">
+<XMLAGG: "xmlagg">
+| <XMLATTRIBUTES: "xmlattributes">
+| <XMLBINARY: "xmlbinary">
+| <XMLCONCAT: "xmlconcat">
+| <XMLCOMMENT: "xmlcomment">
+| <XMLELEMENT: "xmlelement">
+| <XMLFOREST: "xmlforest">
+| <XMLNAMESPACES: "xmlnamespaces">
+| <XMLPARSE: "xmlparse">
+| <XMLPI: "xmlpi">
+| <XMLROOT: "xmlroot">
+| <XMLSERIALIZE: "xmlserialize">
}
- </para></entry>
- </row>
- <!-- Token -->
- <row>
- <entry><para>
+</para></entry></row>
+<row><entry><para>
<DEFAULT> TOKEN : {
+<DATALINK: "datalink">
+| <DLNEWCOPY: "dlnewcopy">
+| <DLPREVIOUSCOPY: "dlpreviouscopy">
+| <DLURLCOMPLETE: "dlurlcomplete">
+| <DLURLCOMPLETEWRITE: "dlurlcompletewrite">
+| <DLURLCOMPLETEONLY: "dlurlcompleteonly">
+| <DLURLPATH: "dlurlpath">
+| <DLURLPATHWRITE: "dlurlpathwrite">
+| <DLURLPATHONLY: "dlurlpathonly">
+| <DLURLSCHEME: "dlurlscheme">
+| <DLURLSERVER: "dlurlserver">
+| <DLVALUE: "dlvalue">
+| <IMPORT: "import">
+}
+
+</para></entry></row>
+<row><entry><para>
+<DEFAULT> TOKEN : {
+<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">
+}
+
+</para></entry></row>
+<row><entry><para>
+<DEFAULT> TOKEN : {
<ALL_IN_GROUP: <ID> <PERIOD> <STAR>>
| <ID: <QUOTED_ID> (<PERIOD> <QUOTED_ID>)*>
-| <#QUOTED_ID: <ID_PART> | "\"" ("\"\"" | ~["\""])+ "\"">
-| <#ID_PART: ("@" | "#" | <LETTER>) (<LETTER> | "_" | <DIGIT>)*>
-| <DATETYPE: "{" "d">
-| <TIMETYPE: "{" "t">
-| <TIMESTAMPTYPE: "{" "ts">
-| <BOOLEANTYPE: "{" "b">
+| <#QUOTED_ID: <ID_PART> | "\"" ("\"\"" | ~["\""])+ "\"">
+| <#ID_PART: ("@" | "#" | <LETTER>) (<LETTER> | "_" | <DIGIT>)*>
+| <DATETYPE: "{" "d">
+| <TIMETYPE: "{" "t">
+| <TIMESTAMPTYPE: "{" "ts">
+| <BOOLEANTYPE: "{" "b">
| <INTEGERVAL: (<MINUS>)? (<DIGIT>)+>
-| <FLOATVAL: (<MINUS>)? (<DIGIT>)* <PERIOD> (<DIGIT>)+ (["e","E"] (["+","-"])? (<DIGIT>)+)?>
-| <STRINGVAL: ("N")? "\'" ("\'\'" | ~["\'"])* "\'">
-| <#LETTER: ["a"-"z","A"-"Z"] | ["\u0153"-"\ufffd"]>
-| <#DIGIT: ["0"-"9"]>
+| <FLOATVAL: (<MINUS>)? (<DIGIT>)* <PERIOD> (<DIGIT>)+ (["e","E"] (["+","-"])? (<DIGIT>)+)?>
+| <STRINGVAL: ("N")? "\'" ("\'\'" | ~["\'"])* "\'">
+| <#LETTER: ["a"-"z","A"-"Z"] | ["\u0153"-"\ufffd"]>
+| <#DIGIT: ["0"-"9"]>
}
- </para></entry>
- </row>
- <!-- Token -->
- <row>
- <entry><para>
+</para></entry></row>
+<row><entry><para>
<DEFAULT> TOKEN : {
-<COMMA: ",">
-| <PERIOD: ".">
-| <LPAREN: "(">
-| <RPAREN: ")">
-| <LBRACE: "{">
-| <RBRACE: "}">
-| <EQ: "=">
-| <NE: "<>">
-| <NE2: "!=">
-| <LT: "<">
-| <LE: "<=">
-| <GT: ">">
-| <GE: ">=">
-| <STAR: "*">
-| <SLASH: "/">
-| <PLUS: "+">
-| <MINUS: "-">
-| <QMARK: "?">
-| <DOLLAR: "$">
-| <SEMICOLON: ";">
-| <CONCAT_OP: "||">
+<COMMA: ",">
+| <PERIOD: ".">
+| <LPAREN: "(">
+| <RPAREN: ")">
+| <LBRACE: "{">
+| <RBRACE: "}">
+| <EQ: "=">
+| <NE: "<>">
+| <NE2: "!=">
+| <LT: "<">
+| <LE: "<=">
+| <GT: ">">
+| <GE: ">=">
+| <STAR: "*">
+| <SLASH: "/">
+| <PLUS: "+">
+| <MINUS: "-">
+| <QMARK: "?">
+| <DOLLAR: "$">
+| <SEMICOLON: ";">
+| <CONCAT_OP: "||">
}
- </para></entry>
- </row>
- </tbody>
- </tgroup>
- </informaltable>
- </sect1>
- <sect1 remap="h2">
- <title>NON-TERMINALS</title>
- <informaltable frame="none">
- <tgroup cols="3">
- <colspec colname="c1" colwidth="33*"/>
- <colspec colname="c2" colwidth="5*"/>
- <colspec colname="c3" colwidth="62*"/>
- <tbody>
- <row>
- <entry align="right" valign="top"><para><anchor id="SQLParser.html-prod1" xreflabel="stringVal"/>stringVal</para></entry>
- <entry align="center" valign="top"><para>::=</para></entry>
- <entry align="left" valign="top"><para>( <STRINGVAL> )</para></entry>
- </row>
- <row>
- <entry align="right" valign="top"><para><anchor id="SQLParser.html-prod2" xreflabel="id"/>id</para></entry>
- <entry align="center" valign="top"><para>::=</para></entry>
- <entry align="left" valign="top"><para>( <ID> )</para></entry>
- </row>
-
- <row>
- <entry align="right" valign="top"><para><anchor id="SQLParser.html-prod3" xreflabel="command"/>command</para></entry>
- <entry align="center" valign="top"><para>::=</para></entry>
- <entry align="left" valign="top"><para>( ( <link linkend="SQLParser.html-prod4">createUpdateProcedure</link> ) | <link linkend="SQLParser.html-prod5">userCommand</link> | <link linkend="SQLParser.html-prod6">callableStatement</link> ) ( <SEMICOLON> )? <EOF></para></entry>
- </row>
- <row>
- <entry align="right" valign="top"><para><anchor id="SQLParser.html-prod5" xreflabel="userCommand"/>userCommand</para></entry>
- <entry align="center" valign="top"><para>::=</para></entry>
- <entry align="left" valign="top"><para>( <link linkend="SQLParser.html-prod7">queryExpression</link> | <link linkend="SQLParser.html-prod8">storedProcedure</link> | <link linkend="SQLParser.html-prod9">insert</link> | <link linkend="SQLParser.html-prod10">update</link> | <link linkend="SQLParser.html-prod11">delete</link> | <link linkend="SQLParser.html-prod12">dropTable</link> | <link linkend="SQLParser.html-prod13">createTempTable</link> )</para></entry>
- </row>
-
- <row>
- <entry align="right" valign="top"><para><anchor id="SQLParser.html-prod12" xreflabel="dropTable"/>dropTable</para></entry>
- <entry align="center" valign="top"><para>::=</para></entry>
- <entry align="left" valign="top"><para><DROP> <TABLE> <link linkend="SQLParser.html-prod2">id</link></para></entry>
- </row>
-
- <row>
- <entry align="right" valign="top"><para><anchor id="SQLParser.html-prod13" xreflabel="createTempTable"/>createTempTable</para></entry>
- <entry align="center" valign="top"><para>::=</para></entry>
- <entry align="left" valign="top"><para><CREATE> <LOCAL> <TEMPORARY> <TABLE> <link linkend="SQLParser.html-prod2">id</link> <LPAREN> <link linkend="SQLParser.html-prod14">createElementsWithTypes</link> <RPAREN></para></entry>
- </row>
-
- <row>
- <entry align="right" valign="top"><para><anchor id="SQLParser.html-prod15" xreflabel="errorStatement"/>errorStatement</para></entry>
- <entry align="center" valign="top"><para>::=</para></entry>
- <entry align="left" valign="top"><para><ERROR> <link linkend="SQLParser.html-prod16">expression</link></para></entry>
- </row>
-
- <row>
- <entry align="right" valign="top"><para><anchor id="SQLParser.html-prod17" xreflabel="statement"/>statement</para></entry>
- <entry align="center" valign="top"><para>::=</para></entry>
- <entry align="left" valign="top"><para>( <link linkend="SQLParser.html-prod18">ifStatement</link> | <link linkend="SQLParser.html-prod19">loopStatement</link> | <link linkend="SQLParser.html-prod20">whileStatement</link> | <link linkend="SQLParser.html-prod21">delimitedStatement</link> )</para></entry>
- </row>
- <row>
- <entry align="right" valign="top"><para><anchor id="SQLParser.html-prod21" xreflabel="delimitedStatement"/>delimitedStatement</para></entry>
- <entry align="center" valign="top"><para>::=</para></entry>
- <entry align="left" valign="top"><para>( <link linkend="SQLParser.html-prod22">sqlStatement</link> | <link linkend="SQLParser.html-prod15">errorStatement</link> | <link linkend="SQLParser.html-prod23">assignStatement</link> | <link linkend="SQLParser.html-prod24">declareStatement</link> | <link linkend="SQLParser.html-prod25">continueStatement</link> | <link linkend="SQLParser.html-prod26">breakStatement</link> ) <SEMICOLON></para></entry>
- </row>
-
- <row>
- <entry align="right" valign="top"><para><anchor id="SQLParser.html-prod27" xreflabel="block"/>block</para></entry>
- <entry align="center" valign="top"><para>::=</para></entry>
- <entry align="left" valign="top"><para>( <link linkend="SQLParser.html-prod17">statement</link> | ( <BEGIN> ( <link linkend="SQLParser.html-prod17">statement</link> )* <END> ) )</para></entry>
- </row>
-
- <row>
- <entry align="right" valign="top"><para><anchor id="SQLParser.html-prod26" xreflabel="breakStatement"/>breakStatement</para></entry>
- <entry align="center" valign="top"><para>::=</para></entry>
- <entry align="left" valign="top"><para><BREAK></para></entry>
- </row>
-
- <row>
- <entry align="right" valign="top"><para><anchor id="SQLParser.html-prod25" xreflabel="continueStatement"/>continueStatement</para></entry>
- <entry align="center" valign="top"><para>::=</para></entry>
- <entry align="left" valign="top"><para><CONTINUE></para></entry>
- </row>
-
- <row>
- <entry align="right" valign="top"><para><anchor id="SQLParser.html-prod20" xreflabel="whileStatement"/>whileStatement</para></entry>
- <entry align="center" valign="top"><para>::=</para></entry>
- <entry align="left" valign="top"><para><WHILE> <LPAREN> <link linkend="SQLParser.html-prod28">criteria</link> <RPAREN> <link linkend="SQLParser.html-prod27">block</link></para></entry>
- </row>
-
- <row>
- <entry align="right" valign="top"><para><anchor id="SQLParser.html-prod19" xreflabel="loopStatement"/>loopStatement</para></entry>
- <entry align="center" valign="top"><para>::=</para></entry>
- <entry align="left" valign="top"><para><LOOP> <ON> <LPAREN> <link linkend="SQLParser.html-prod7">queryExpression</link> <RPAREN> <AS> <link linkend="SQLParser.html-prod2">id</link><link linkend="SQLParser.html-prod27">block</link></para></entry>
- </row>
-
- <row>
- <entry align="right" valign="top"><para><anchor id="SQLParser.html-prod18" xreflabel="ifStatement"/>ifStatement</para></entry>
- <entry align="center" valign="top"><para>::=</para></entry>
- <entry align="left" valign="top"><para><IF> <LPAREN> <link linkend="SQLParser.html-prod28">criteria</link> <RPAREN> <link linkend="SQLParser.html-prod27">block</link> ( <ELSE> <link linkend="SQLParser.html-prod27">block</link> )?</para></entry>
- </row>
-
- <row>
- <entry align="right" valign="top"><para><anchor id="SQLParser.html-prod29" xreflabel="criteriaSelector"/>criteriaSelector</para></entry>
- <entry align="center" valign="top"><para>::=</para></entry>
- <entry align="left" valign="top"><para>( ( <EQ> | <NE> | <NE2> | <LE> | <GE> | <LT> | <GT> | <IN> | <LIKE> | ( <IS> <NULL> ) | <BETWEEN> ) )? <CRITERIA> ( <ON> <LPAREN> <link linkend="SQLParser.html-prod2">id</link> ( <COMMA> <link linkend="SQLParser.html-prod2">id</link> )* <RPAREN> )?</para></entry>
- </row>
-
- <row>
- <entry align="right" valign="top"><para><anchor id="SQLParser.html-prod30" xreflabel="hasCriteria"/>hasCriteria</para></entry>
- <entry align="center" valign="top"><para>::=</para></entry>
- <entry align="left" valign="top"><para><HAS> <link linkend="SQLParser.html-prod29">criteriaSelector</link></para></entry>
- </row>
-
- <row>
- <entry align="right" valign="top"><para><anchor id="SQLParser.html-prod24" xreflabel="declareStatement"/>declareStatement</para></entry>
- <entry align="center" valign="top"><para>::=</para></entry>
- <entry align="left" valign="top"><para><DECLARE> <link linkend="SQLParser.html-prod31">dataType</link><link linkend="SQLParser.html-prod2">id</link> ( <EQ> <link linkend="SQLParser.html-prod32">assignStatementOperand</link> )?</para></entry>
- </row>
-
- <row>
- <entry align="right" valign="top"><para><anchor id="SQLParser.html-prod23" xreflabel="assignStatement"/>assignStatement</para></entry>
- <entry align="center" valign="top"><para>::=</para></entry>
- <entry align="left" valign="top"><para><link linkend="SQLParser.html-prod2">id</link> <EQ> <link linkend="SQLParser.html-prod32">assignStatementOperand</link></para></entry>
- </row>
-
- <row>
- <entry align="right" valign="top"><para><anchor id="SQLParser.html-prod32" xreflabel="assignStatementOperand"/>assignStatementOperand</para></entry>
- <entry align="center" valign="top"><para>::=</para></entry>
- <entry align="left" valign="top"><para>( ( <link linkend="SQLParser.html-prod9">insert</link> ) | <link linkend="SQLParser.html-prod10">update</link> | <link linkend="SQLParser.html-prod11">delete</link> | <link linkend="SQLParser.html-prod8">storedProcedure</link> | ( <link linkend="SQLParser.html-prod16">expression</link> ) | <link linkend="SQLParser.html-prod7">queryExpression</link> )</para></entry>
- </row>
-
- <row>
- <entry align="right" valign="top"><para><anchor id="SQLParser.html-prod22" xreflabel="sqlStatement"/>sqlStatement</para></entry>
- <entry align="center" valign="top"><para>::=</para></entry>
- <entry align="left" valign="top"><para>( ( <link linkend="SQLParser.html-prod33">dynamicCommand</link> ) | <link linkend="SQLParser.html-prod5">userCommand</link> )</para></entry>
- </row>
- <row>
- <entry align="right" valign="top"><para><anchor id="SQLParser.html-prod34" xreflabel="translateCriteria"/>translateCriteria</para></entry>
- <entry align="center" valign="top"><para>::=</para></entry>
- <entry align="left" valign="top"><para><TRANSLATE> <link linkend="SQLParser.html-prod29">criteriaSelector</link> ( <WITH> <LPAREN> <link linkend="SQLParser.html-prod2">id</link> <EQ> <link linkend="SQLParser.html-prod16">expression</link> ( <COMMA> <link linkend="SQLParser.html-prod2">id</link> <EQ> <link linkend="SQLParser.html-prod16">expression</link> )* <RPAREN> )?</para></entry>
- </row>
-
- <row>
- <entry align="right" valign="top"><para><anchor id="SQLParser.html-prod4" xreflabel="createUpdateProcedure"/>createUpdateProcedure</para></entry>
- <entry align="center" valign="top"><para>::=</para></entry>
- <entry align="left" valign="top"><para><CREATE> ( <VIRTUAL> )? ( <UPDATE> )? <PROCEDURE> <link linkend="SQLParser.html-prod27">block</link></para></entry>
- </row>
-
- <row>
- <entry align="right" valign="top"><para><anchor id="SQLParser.html-prod33" xreflabel="dynamicCommand"/>dynamicCommand</para></entry>
- <entry align="center" valign="top"><para>::=</para></entry>
- <entry align="left" valign="top"><para>( <EXECUTE> | <EXEC> ) <STRING> <link linkend="SQLParser.html-prod16">expression</link> ( <AS> <link linkend="SQLParser.html-prod14">createElementsWithTypes</link> ( <INTO> <link linkend="SQLParser.html-prod2">id</link> )? )? ( <USING> <link linkend="SQLParser.html-prod35">setClauseList</link> )? ( <UPDATE> ( ( <INTEGERVAL> ) | ( <STAR> ) ) )?</para></entry>
- </row>
- <row>
- <entry align="right" valign="top"><para><anchor id="SQLParser.html-prod35" xreflabel="setClauseList"/>setClauseList</para></entry>
- <entry align="center" valign="top"><para>::=</para></entry>
- <entry align="left" valign="top"><para><link linkend="SQLParser.html-prod2">id</link> <EQ> ( <COMMA> <link linkend="SQLParser.html-prod2">id</link> <EQ> )*</para></entry>
- </row>
-
- <row>
- <entry align="right" valign="top"><para><anchor id="SQLParser.html-prod14" xreflabel="createElementsWithTypes"/>createElementsWithTypes</para></entry>
- <entry align="center" valign="top"><para>::=</para></entry>
- <entry align="left" valign="top"><para><link linkend="SQLParser.html-prod2">id</link><link linkend="SQLParser.html-prod31">dataType</link> ( <COMMA> <link linkend="SQLParser.html-prod2">id</link><link linkend="SQLParser.html-prod31">dataType</link> )*</para></entry>
- </row>
- <row>
- <entry align="right" valign="top"><para><anchor id="SQLParser.html-prod6" xreflabel="callableStatement"/>callableStatement</para></entry>
- <entry align="center" valign="top"><para>::=</para></entry>
- <entry align="left" valign="top"><para><LBRACE> ( <QMARK> <EQ> )? <ID> <link linkend="SQLParser.html-prod2">id</link> ( <LPAREN> ( <link linkend="SQLParser.html-prod36">executeUnnamedParams</link> ) <RPAREN> )? <RBRACE> ( <link linkend="SQLParser.html-prod37">option</link> )?</para></entry>
- </row>
-
- <row>
- <entry align="right" valign="top"><para><anchor id="SQLParser.html-prod8" xreflabel="storedProcedure"/>storedProcedure</para></entry>
- <entry align="center" valign="top"><para>::=</para></entry>
- <entry align="left" valign="top"><para>( ( <EXEC> | <EXECUTE> ) <link linkend="SQLParser.html-prod2">id</link> <LPAREN> ( <link linkend="SQLParser.html-prod38">executeNamedParams</link> | <link linkend="SQLParser.html-prod36">executeUnnamedParams</link> ) <RPAREN> ) ( <link linkend="SQLParser.html-prod37">option</link> )?</para></entry>
- </row>
-
- <row>
- <entry align="right" valign="top"><para><anchor id="SQLParser.html-prod36" xreflabel="executeUnnamedParams"/>executeUnnamedParams</para></entry>
- <entry align="center" valign="top"><para>::=</para></entry>
- <entry align="left" valign="top"><para>( <link linkend="SQLParser.html-prod16">expression</link> ( <COMMA> <link linkend="SQLParser.html-prod16">expression</link> )* )?</para></entry>
- </row>
-
- <row>
- <entry align="right" valign="top"><para><anchor id="SQLParser.html-prod38" xreflabel="executeNamedParams"/>executeNamedParams</para></entry>
- <entry align="center" valign="top"><para>::=</para></entry>
- <entry align="left" valign="top"><para>( <link linkend="SQLParser.html-prod2">id</link> <EQ> <link linkend="SQLParser.html-prod16">expression</link> ( <COMMA> <link linkend="SQLParser.html-prod2">id</link> <EQ> <link linkend="SQLParser.html-prod16">expression</link> )* )</para></entry>
- </row>
-
- <row>
- <entry align="right" valign="top"><para><anchor id="SQLParser.html-prod9" xreflabel="insert"/>insert</para></entry>
- <entry align="center" valign="top"><para>::=</para></entry>
- <entry align="left" valign="top"><para><INSERT> <INTO> <link linkend="SQLParser.html-prod2">id</link> ( <LPAREN> <link linkend="SQLParser.html-prod2">id</link> ( <COMMA> <link linkend="SQLParser.html-prod2">id</link> )* <RPAREN> )? ( ( <VALUES> <link linkend="SQLParser.html-prod39">rowValues</link> ) | ( <link linkend="SQLParser.html-prod7">queryExpression</link> ) ) ( <link linkend="SQLParser.html-prod37">option</link> )?</para></entry>
- </row>
-
- <row>
- <entry align="right" valign="top"><para><anchor id="SQLParser.html-prod39" xreflabel="rowValues"/>rowValues</para></entry>
- <entry align="center" valign="top"><para>::=</para></entry>
- <entry align="left" valign="top"><para><LPAREN> <link linkend="SQLParser.html-prod16">expression</link> ( <COMMA> <link linkend="SQLParser.html-prod16">expression</link> )* <RPAREN></para></entry>
- </row>
-
- <row>
- <entry align="right" valign="top"><para><anchor id="SQLParser.html-prod10" xreflabel="update"/>update</para></entry>
- <entry align="center" valign="top"><para>::=</para></entry>
- <entry align="left" valign="top"><para><UPDATE> <link linkend="SQLParser.html-prod2">id</link> <SET> <link linkend="SQLParser.html-prod35">setClauseList</link> ( <link linkend="SQLParser.html-prod40">where</link> )? ( <link linkend="SQLParser.html-prod37">option</link> )?</para></entry>
- </row>
-
- <row>
- <entry align="right" valign="top"><para><anchor id="SQLParser.html-prod11" xreflabel="delete"/>delete</para></entry>
- <entry align="center" valign="top"><para>::=</para></entry>
- <entry align="left" valign="top"><para><DELETE> <FROM> <link linkend="SQLParser.html-prod2">id</link> ( <link linkend="SQLParser.html-prod40">where</link> )? ( <link linkend="SQLParser.html-prod37">option</link> )?</para></entry>
- </row>
-
- <row>
- <entry align="right" valign="top"><para><anchor id="SQLParser.html-prod7" xreflabel="queryExpression"/>queryExpression</para></entry>
- <entry align="center" valign="top"><para>::=</para></entry>
- <entry align="left" valign="top"><para><link linkend="SQLParser.html-prod41">queryExpressionBody</link></para></entry>
- </row>
- <row>
- <entry align="right" valign="top"><para><anchor id="SQLParser.html-prod41" xreflabel="queryExpressionBody"/>queryExpressionBody</para></entry>
- <entry align="center" valign="top"><para>::=</para></entry>
- <entry align="left" valign="top"><para><link linkend="SQLParser.html-prod42">queryTerm</link> ( ( <UNION> | <EXCEPT> ) ( <ALL> | <DISTINCT> )? <link linkend="SQLParser.html-prod42">queryTerm</link> )* ( <link linkend="SQLParser.html-prod43">orderby</link> )? ( <link linkend="SQLParser.html-prod44">limit</link> )? ( <link linkend="SQLParser.html-prod37">option</link> )?</para></entry>
- </row>
- <row>
- <entry align="right" valign="top"><para><anchor id="SQLParser.html-prod42" xreflabel="queryTerm"/>queryTerm</para></entry>
- <entry align="center" valign="top"><para>::=</para></entry>
- <entry align="left" valign="top"><para><link linkend="SQLParser.html-prod45">queryPrimary</link> ( <INTERSECT> ( <ALL> | <DISTINCT> )? <link linkend="SQLParser.html-prod45">queryPrimary</link> )*</para></entry>
- </row>
- <row>
- <entry align="right" valign="top"><para><anchor id="SQLParser.html-prod45" xreflabel="queryPrimary"/>queryPrimary</para></entry>
- <entry align="center" valign="top"><para>::=</para></entry>
- <entry align="left" valign="top"><para>( <link linkend="SQLParser.html-prod46">query</link> | ( <LPAREN> <link linkend="SQLParser.html-prod41">queryExpressionBody</link> <RPAREN> ) )</para></entry>
- </row>
-
- <row>
- <entry align="right" valign="top"><para><anchor id="SQLParser.html-prod46" xreflabel="query"/>query</para></entry>
- <entry align="center" valign="top"><para>::=</para></entry>
- <entry align="left" valign="top"><para><link linkend="SQLParser.html-prod47">select</link> ( <link linkend="SQLParser.html-prod48">into</link> )? ( <link linkend="SQLParser.html-prod49">from</link> ( <link linkend="SQLParser.html-prod40">where</link> )? ( <link linkend="SQLParser.html-prod50">groupBy</link> )? ( <link linkend="SQLParser.html-prod51">having</link> )? )?</para></entry>
- </row>
- <row>
- <entry align="right" valign="top"><para><anchor id="SQLParser.html-prod48" xreflabel="into"/>into</para></entry>
- <entry align="center" valign="top"><para>::=</para></entry>
- <entry align="left" valign="top"><para><INTO> ( <link linkend="SQLParser.html-prod2">id</link> )</para></entry>
- </row>
-
- <row>
- <entry align="right" valign="top"><para><anchor id="SQLParser.html-prod47" xreflabel="select"/>select</para></entry>
- <entry align="center" valign="top"><para>::=</para></entry>
- <entry align="left" valign="top"><para><SELECT> ( <ALL> | ( <DISTINCT> ) )? ( <STAR> | ( <link linkend="SQLParser.html-prod52">selectSymbol</link> ( <COMMA> <link linkend="SQLParser.html-prod52">selectSymbol</link> )* ) )</para></entry>
- </row>
- <row>
- <entry align="right" valign="top"><para><anchor id="SQLParser.html-prod52" xreflabel="selectSymbol"/>selectSymbol</para></entry>
- <entry align="center" valign="top"><para>::=</para></entry>
- <entry align="left" valign="top"><para>( ( <ALL_IN_GROUP> ) | ( <link linkend="SQLParser.html-prod16">expression</link> ) ( ( <AS> )? ( <link linkend="SQLParser.html-prod2">id</link> ) )? )</para></entry>
- </row>
- <row>
- <entry align="right" valign="top"><para><anchor id="SQLParser.html-prod53" xreflabel="aggregateSymbol"/>aggregateSymbol</para></entry>
- <entry align="center" valign="top"><para>::=</para></entry>
- <entry align="left" valign="top"><para>( ( <COUNT> <LPAREN> <STAR> <RPAREN> ) | ( ( <COUNT> | <SUM> | <AVG> | <MIN> | <MAX> ) <LPAREN> ( <DISTINCT> )? <link linkend="SQLParser.html-prod16">expression</link> <RPAREN> ) )</para></entry>
- </row>
-
- <row>
- <entry align="right" valign="top"><para><anchor id="SQLParser.html-prod49" xreflabel="from"/>from</para></entry>
- <entry align="center" valign="top"><para>::=</para></entry>
- <entry align="left" valign="top"><para><FROM> ( <link linkend="SQLParser.html-prod54">tableReference</link> ( <COMMA> <link linkend="SQLParser.html-prod54">tableReference</link> )* )</para></entry>
- </row>
-
- <row>
- <entry align="right" valign="top"><para><anchor id="SQLParser.html-prod54" xreflabel="tableReference"/>tableReference</para></entry>
- <entry align="center" valign="top"><para>::=</para></entry>
- <entry align="left" valign="top"><para>( ( <LBRACE> <OJ> <link linkend="SQLParser.html-prod55">tableReferenceUnescaped</link> <RBRACE> ) | <link linkend="SQLParser.html-prod55">tableReferenceUnescaped</link> )</para></entry>
- </row>
- <row>
- <entry align="right" valign="top"><para><anchor id="SQLParser.html-prod55" xreflabel="tableReferenceUnescaped"/>tableReferenceUnescaped</para></entry>
- <entry align="center" valign="top"><para>::=</para></entry>
- <entry align="left" valign="top"><para>( <link linkend="SQLParser.html-prod56">joinedTable</link> | <link linkend="SQLParser.html-prod57">tablePrimary</link> )</para></entry>
- </row>
- <row>
- <entry align="right" valign="top"><para><anchor id="SQLParser.html-prod56" xreflabel="joinedTable"/>joinedTable</para></entry>
- <entry align="center" valign="top"><para>::=</para></entry>
- <entry align="left" valign="top"><para><link linkend="SQLParser.html-prod57">tablePrimary</link> ( ( <link linkend="SQLParser.html-prod58">crossJoin</link> | <link linkend="SQLParser.html-prod59">qualifiedJoin</link> ) )+</para></entry>
- </row>
- <row>
- <entry align="right" valign="top"><para><anchor id="SQLParser.html-prod58" xreflabel="crossJoin"/>crossJoin</para></entry>
- <entry align="center" valign="top"><para>::=</para></entry>
- <entry align="left" valign="top"><para>( ( <CROSS> | <UNION> ) <JOIN> <link linkend="SQLParser.html-prod57">tablePrimary</link> )</para></entry>
- </row>
- <row>
- <entry align="right" valign="top"><para><anchor id="SQLParser.html-prod59" xreflabel="qualifiedJoin"/>qualifiedJoin</para></entry>
- <entry align="center" valign="top"><para>::=</para></entry>
- <entry align="left" valign="top"><para>( ( ( <RIGHT> ( <OUTER> )? ) | ( <LEFT> ( <OUTER> )? ) | ( <FULL> ( <OUTER> )? ) | <INNER> )? <JOIN> <link linkend="SQLParser.html-prod54">tableReference</link> <ON> <link linkend="SQLParser.html-prod28">criteria</link> )</para></entry>
- </row>
- <row>
- <entry align="right" valign="top"><para><anchor id="SQLParser.html-prod57" xreflabel="tablePrimary"/>tablePrimary</para></entry>
- <entry align="center" valign="top"><para>::=</para></entry>
- <entry align="left" valign="top"><para>( <link linkend="SQLParser.html-prod60">unaryFromClause</link> | <link linkend="SQLParser.html-prod61">subqueryFromClause</link> | ( <LPAREN> <link linkend="SQLParser.html-prod56">joinedTable</link> <RPAREN> ) ) ( ( <MAKEDEP> ) | ( <MAKENOTDEP> ) )?</para></entry>
- </row>
-
- <row>
- <entry align="right" valign="top"><para><anchor id="SQLParser.html-prod61" xreflabel="subqueryFromClause"/>subqueryFromClause</para></entry>
- <entry align="center" valign="top"><para>::=</para></entry>
- <entry align="left" valign="top"><para><LPAREN> ( <link linkend="SQLParser.html-prod7">queryExpression</link> | <link linkend="SQLParser.html-prod8">storedProcedure</link> ) <RPAREN> ( <AS> )? <link linkend="SQLParser.html-prod2">id</link></para></entry>
- </row>
-
- <row>
- <entry align="right" valign="top"><para><anchor id="SQLParser.html-prod60" xreflabel="unaryFromClause"/>unaryFromClause</para></entry>
- <entry align="center" valign="top"><para>::=</para></entry>
- <entry align="left" valign="top"><para>( <ID> ( ( <AS> )? <link linkend="SQLParser.html-prod2">id</link> )? )</para></entry>
- </row>
-
- <row>
- <entry align="right" valign="top"><para><anchor id="SQLParser.html-prod40" xreflabel="where"/>where</para></entry>
- <entry align="center" valign="top"><para>::=</para></entry>
- <entry align="left" valign="top"><para><WHERE> <link linkend="SQLParser.html-prod28">criteria</link></para></entry>
- </row>
-
- <row>
- <entry align="right" valign="top"><para><anchor id="SQLParser.html-prod28" xreflabel="criteria"/>criteria</para></entry>
- <entry align="center" valign="top"><para>::=</para></entry>
- <entry align="left" valign="top"><para><link linkend="SQLParser.html-prod62">compoundCritOr</link></para></entry>
- </row>
-
- <row>
- <entry align="right" valign="top"><para><anchor id="SQLParser.html-prod62" xreflabel="compoundCritOr"/>compoundCritOr</para></entry>
- <entry align="center" valign="top"><para>::=</para></entry>
- <entry align="left" valign="top"><para><link linkend="SQLParser.html-prod63">compoundCritAnd</link> ( <OR> <link linkend="SQLParser.html-prod63">compoundCritAnd</link> )*</para></entry>
- </row>
-
- <row>
- <entry align="right" valign="top"><para><anchor id="SQLParser.html-prod63" xreflabel="compoundCritAnd"/>compoundCritAnd</para></entry>
- <entry align="center" valign="top"><para>::=</para></entry>
- <entry align="left" valign="top"><para><link linkend="SQLParser.html-prod64">notCrit</link> ( <AND> <link linkend="SQLParser.html-prod64">notCrit</link> )*</para></entry>
- </row>
-
- <row>
- <entry align="right" valign="top"><para><anchor id="SQLParser.html-prod64" xreflabel="notCrit"/>notCrit</para></entry>
- <entry align="center" valign="top"><para>::=</para></entry>
- <entry align="left" valign="top"><para>( <NOT> )? <link linkend="SQLParser.html-prod65">primary</link></para></entry>
- </row>
-
- <row>
- <entry align="right" valign="top"><para><anchor id="SQLParser.html-prod65" xreflabel="primary"/>primary</para></entry>
- <entry align="center" valign="top"><para>::=</para></entry>
- <entry align="left" valign="top"><para>( <link linkend="SQLParser.html-prod66">predicate</link> | ( <LPAREN> <link linkend="SQLParser.html-prod28">criteria</link> <RPAREN> ) )</para></entry>
- </row>
-
- <row>
- <entry align="right" valign="top"><para><anchor id="SQLParser.html-prod66" xreflabel="predicate"/>predicate</para></entry>
- <entry align="center" valign="top"><para>::=</para></entry>
- <entry align="left" valign="top"><para>( <link linkend="SQLParser.html-prod67">subqueryCompareCriteria</link> | <link linkend="SQLParser.html-prod68">compareCrit</link> | <link linkend="SQLParser.html-prod69">matchCrit</link> | <link linkend="SQLParser.html-prod70">betweenCrit</link> | <link linkend="SQLParser.html-prod71">setCrit</link> | <link linkend="SQLParser.html-prod72">existsCriteria</link> | <link linkend="SQLParser.html-prod30">hasCriteria</link> | <link linkend="SQLParser.html-prod34">translateCriteria</link> | <link linkend="SQLParser.html-prod73">isNullCrit</link> )</para></entry>
- </row>
-
- <row>
- <entry align="right" valign="top"><para><anchor id="SQLParser.html-prod68" xreflabel="compareCrit"/>compareCrit</para></entry>
- <entry align="center" valign="top"><para>::=</para></entry>
- <entry align="left" valign="top"><para><link linkend="SQLParser.html-prod16">expression</link> ( <EQ> | <NE> | <NE2> | <LT> | <LE> | <GT> | <GE> ) <link linkend="SQLParser.html-prod16">expression</link></para></entry>
- </row>
- <row>
- <entry align="right" valign="top"><para><anchor id="SQLParser.html-prod74" xreflabel="subquery"/>subquery</para></entry>
- <entry align="center" valign="top"><para>::=</para></entry>
- <entry align="left" valign="top"><para><LPAREN> ( <link linkend="SQLParser.html-prod7">queryExpression</link> | <link linkend="SQLParser.html-prod8">storedProcedure</link> ) <RPAREN></para></entry>
- </row>
-
- <row>
- <entry align="right" valign="top"><para><anchor id="SQLParser.html-prod67" xreflabel="subqueryCompareCriteria"/>subqueryCompareCriteria</para></entry>
- <entry align="center" valign="top"><para>::=</para></entry>
- <entry align="left" valign="top"><para><link linkend="SQLParser.html-prod16">expression</link> ( <EQ> | <NE> | <NE2> | <LT> | <LE> | <GT> | <GE> ) ( <ANY> | <SOME> | <ALL> ) <link linkend="SQLParser.html-prod74">subquery</link></para></entry>
- </row>
-
- <row>
- <entry align="right" valign="top"><para><anchor id="SQLParser.html-prod69" xreflabel="matchCrit"/>matchCrit</para></entry>
- <entry align="center" valign="top"><para>::=</para></entry>
- <entry align="left" valign="top"><para>( <link linkend="SQLParser.html-prod16">expression</link> ( <NOT> )? <LIKE> <link linkend="SQLParser.html-prod16">expression</link> ( <link linkend="SQLParser.html-prod75">escapeChar</link> | ( <LBRACE> <link linkend="SQLParser.html-prod75">escapeChar</link> <RBRACE> ) )? )</para></entry>
- </row>
- <row>
- <entry align="right" valign="top"><para><anchor id="SQLParser.html-prod75" xreflabel="escapeChar"/>escapeChar</para></entry>
- <entry align="center" valign="top"><para>::=</para></entry>
- <entry align="left" valign="top"><para><ESCAPE> <link linkend="SQLParser.html-prod1">stringVal</link></para></entry>
- </row>
-
- <row>
- <entry align="right" valign="top"><para><anchor id="SQLParser.html-prod70" xreflabel="betweenCrit"/>betweenCrit</para></entry>
- <entry align="center" valign="top"><para>::=</para></entry>
- <entry align="left" valign="top"><para><link linkend="SQLParser.html-prod16">expression</link> ( <NOT> )? <BETWEEN> <link linkend="SQLParser.html-prod16">expression</link> <AND> <link linkend="SQLParser.html-prod16">expression</link></para></entry>
- </row>
-
- <row>
- <entry align="right" valign="top"><para><anchor id="SQLParser.html-prod73" xreflabel="isNullCrit"/>isNullCrit</para></entry>
- <entry align="center" valign="top"><para>::=</para></entry>
- <entry align="left" valign="top"><para><link linkend="SQLParser.html-prod16">expression</link> <IS> ( <NOT> )? <NULL></para></entry>
- </row>
-
- <row>
- <entry align="right" valign="top"><para><anchor id="SQLParser.html-prod71" xreflabel="setCrit"/>setCrit</para></entry>
- <entry align="center" valign="top"><para>::=</para></entry>
- <entry align="left" valign="top"><para><link linkend="SQLParser.html-prod16">expression</link> ( <NOT> )? <IN> ( ( <link linkend="SQLParser.html-prod74">subquery</link> ) | ( <LPAREN> <link linkend="SQLParser.html-prod16">expression</link> ( <COMMA> <link linkend="SQLParser.html-prod16">expression</link> )* <RPAREN> ) )</para></entry>
- </row>
-
- <row>
- <entry align="right" valign="top"><para><anchor id="SQLParser.html-prod72" xreflabel="existsCriteria"/>existsCriteria</para></entry>
- <entry align="center" valign="top"><para>::=</para></entry>
- <entry align="left" valign="top"><para><EXISTS> <link linkend="SQLParser.html-prod74">subquery</link></para></entry>
- </row>
-
- <row>
- <entry align="right" valign="top"><para><anchor id="SQLParser.html-prod50" xreflabel="groupBy"/>groupBy</para></entry>
- <entry align="center" valign="top"><para>::=</para></entry>
- <entry align="left" valign="top"><para><GROUP> <BY> ( <link linkend="SQLParser.html-prod76">groupByItem</link> ( <COMMA> <link linkend="SQLParser.html-prod76">groupByItem</link> )* )</para></entry>
- </row>
-
- <row>
- <entry align="right" valign="top"><para><anchor id="SQLParser.html-prod76" xreflabel="groupByItem"/>groupByItem</para></entry>
- <entry align="center" valign="top"><para>::=</para></entry>
- <entry align="left" valign="top"><para><link linkend="SQLParser.html-prod16">expression</link></para></entry>
- </row>
-
- <row>
- <entry align="right" valign="top"><para><anchor id="SQLParser.html-prod51" xreflabel="having"/>having</para></entry>
- <entry align="center" valign="top"><para>::=</para></entry>
- <entry align="left" valign="top"><para><HAVING> <link linkend="SQLParser.html-prod28">criteria</link></para></entry>
- </row>
-
- <row>
- <entry align="right" valign="top"><para><anchor id="SQLParser.html-prod43" xreflabel="orderby"/>orderby</para></entry>
- <entry align="center" valign="top"><para>::=</para></entry>
- <entry align="left" valign="top"><para><ORDER> <BY> <link linkend="SQLParser.html-prod77">sortKey</link> ( <ASC> | <DESC> )? ( <COMMA> <link linkend="SQLParser.html-prod77">sortKey</link> ( <ASC> | <DESC> )? )*</para></entry>
- </row>
- <row>
- <entry align="right" valign="top"><para><anchor id="SQLParser.html-prod77" xreflabel="sortKey"/>sortKey</para></entry>
- <entry align="center" valign="top"><para>::=</para></entry>
- <entry align="left" valign="top"><para><link linkend="SQLParser.html-prod16">expression</link></para></entry>
- </row>
-
- <row>
- <entry align="right" valign="top"><para><anchor id="SQLParser.html-prod44" xreflabel="limit"/>limit</para></entry>
- <entry align="center" valign="top"><para>::=</para></entry>
- <entry align="left" valign="top"><para><LIMIT> ( <INTEGERVAL> | <QMARK> ) ( <COMMA> ( <INTEGERVAL> | <QMARK> ) )?</para></entry>
- </row>
-
- <row>
- <entry align="right" valign="top"><para><anchor id="SQLParser.html-prod37" xreflabel="option"/>option</para></entry>
- <entry align="center" valign="top"><para>::=</para></entry>
- <entry align="left" valign="top"><para><OPTION> ( <SHOWPLAN> | <PLANONLY> | <DEBUG> | <MAKEDEP> <link linkend="SQLParser.html-prod2">id</link> ( <COMMA> <link linkend="SQLParser.html-prod2">id</link> )* | <MAKENOTDEP> <link linkend="SQLParser.html-prod2">id</link> ( <COMMA> <link linkend="SQLParser.html-prod2">id</link> )* | <NOCACHE> ( <link linkend="SQLParser.html-prod2">id</link> ( <COMMA> <link linkend="SQLParser.html-prod2">id</link> )* )? )*</para></entry>
- </row>
-
- <row>
- <entry align="right" valign="top"><para><anchor id="SQLParser.html-prod16" xreflabel="expression"/>expression</para></entry>
- <entry align="center" valign="top"><para>::=</para></entry>
- <entry align="left" valign="top"><para><link linkend="SQLParser.html-prod78">concatExpression</link></para></entry>
- </row>
-
- <row>
- <entry align="right" valign="top"><para><anchor id="SQLParser.html-prod78" xreflabel="concatExpression"/>concatExpression</para></entry>
- <entry align="center" valign="top"><para>::=</para></entry>
- <entry align="left" valign="top"><para>( <link linkend="SQLParser.html-prod79">plusExpression</link> ( <CONCAT_OP> <link linkend="SQLParser.html-prod79">plusExpression</link> )* )</para></entry>
- </row>
-
- <row>
- <entry align="right" valign="top"><para><anchor id="SQLParser.html-prod79" xreflabel="plusExpression"/>plusExpression</para></entry>
- <entry align="center" valign="top"><para>::=</para></entry>
- <entry align="left" valign="top"><para>( <link linkend="SQLParser.html-prod80">timesExpression</link> ( <link linkend="SQLParser.html-prod81">plusOperator</link><link linkend="SQLParser.html-prod80">timesExpression</link> )* )</para></entry>
- </row>
-
- <row>
- <entry align="right" valign="top"><para><anchor id="SQLParser.html-prod81" xreflabel="plusOperator"/>plusOperator</para></entry>
- <entry align="center" valign="top"><para>::=</para></entry>
- <entry align="left" valign="top"><para>( <PLUS> | <MINUS> )</para></entry>
- </row>
-
- <row>
- <entry align="right" valign="top"><para><anchor id="SQLParser.html-prod80" xreflabel="timesExpression"/>timesExpression</para></entry>
- <entry align="center" valign="top"><para>::=</para></entry>
- <entry align="left" valign="top"><para>( <link linkend="SQLParser.html-prod82">basicExpression</link> ( <link linkend="SQLParser.html-prod83">timesOperator</link><link linkend="SQLParser.html-prod82">basicExpression</link> )* )</para></entry>
- </row>
-
- <row>
- <entry align="right" valign="top"><para><anchor id="SQLParser.html-prod83" xreflabel="timesOperator"/>timesOperator</para></entry>
- <entry align="center" valign="top"><para>::=</para></entry>
- <entry align="left" valign="top"><para>( <STAR> | <SLASH> )</para></entry>
- </row>
-
- <row>
- <entry align="right" valign="top"><para><anchor id="SQLParser.html-prod82" xreflabel="basicExpression"/>basicExpression</para></entry>
- <entry align="center" valign="top"><para>::=</para></entry>
- <entry align="left" valign="top"><para>( <QMARK> | <link linkend="SQLParser.html-prod84">literal</link> | ( <LBRACE> <FN> <link linkend="SQLParser.html-prod85">function</link> <RBRACE> ) | ( <link linkend="SQLParser.html-prod53">aggregateSymbol</link> ) | ( <link linkend="SQLParser.html-prod85">function</link> ) | ( <ID> ) | ( <LPAREN> <link linkend="SQLParser.html-prod16">expression</link> <RPAREN> ) | <link linkend="SQLParser.html-prod74">subquery</link> | <link linkend="SQLParser.html-prod86">caseExpression</link> | <link linkend="SQLParser.html-prod87">searchedCaseExpression</link> )</para></entry>
- </row>
-
- <row>
- <entry align="right" valign="top"><para><anchor id="SQLParser.html-prod86" xreflabel="caseExpression"/>caseExpression</para></entry>
- <entry align="center" valign="top"><para>::=</para></entry>
- <entry align="left" valign="top"><para><CASE> <link linkend="SQLParser.html-prod16">expression</link> ( <WHEN> <link linkend="SQLParser.html-prod16">expression</link> <THEN> <link linkend="SQLParser.html-prod16">expression</link> )+ ( <ELSE> <link linkend="SQLParser.html-prod16">expression</link> )? <END></para></entry>
- </row>
-
- <row>
- <entry align="right" valign="top"><para><anchor id="SQLParser.html-prod87" xreflabel="searchedCaseExpression"/>searchedCaseExpression</para></entry>
- <entry align="center" valign="top"><para>::=</para></entry>
- <entry align="left" valign="top"><para><CASE> ( <WHEN> <link linkend="SQLParser.html-prod28">criteria</link> <THEN> <link linkend="SQLParser.html-prod16">expression</link> )+ ( <ELSE> <link linkend="SQLParser.html-prod16">expression</link> )? <END></para></entry>
- </row>
-
- <row>
- <entry align="right" valign="top"><para><anchor id="SQLParser.html-prod85" xreflabel="function"/>function</para></entry>
- <entry align="center" valign="top"><para>::=</para></entry>
- <entry align="left" valign="top"><para>( ( <CONVERT> <LPAREN> <link linkend="SQLParser.html-prod16">expression</link> <COMMA> <link linkend="SQLParser.html-prod31">dataType</link> <RPAREN> ) | ( <CAST> <LPAREN> <link linkend="SQLParser.html-prod16">expression</link> <AS> <link linkend="SQLParser.html-prod31">dataType</link> <RPAREN> ) | ( ( <TIMESTAMPADD> | <TIMESTAMPDIFF> ) <LPAREN> <link linkend="SQLParser.html-prod88">intervalType</link> <COMMA> <link linkend="SQLParser.html-prod16">expression</link> <COMMA> <link linkend="SQLParser.html-prod16">expression</link> <RPAREN> ) | ( ( <LEFT> | <RIGHT> | <CHAR> ) <LPAREN> ( <link linkend="SQLParser.html-prod16">expression</link> ( <COMMA> <link linkend="SQLParser.html-prod16">expression</link> )* )? <RPAREN> ) | ( ( <INSERT> ) <LPAREN> ( <link linkend="SQLParser.html-prod16">expression!
</link> ( <COMMA> <link linkend="SQLParser.html-prod16">expression</link> )* )? <RPAREN> ) | ( ( <TRANSLATE> ) <LPAREN> ( <link linkend="SQLParser.html-prod16">expression</link> ( <COMMA> <link linkend="SQLParser.html-prod16">expression</link> )* )? <RPAREN> ) | ( <link linkend="SQLParser.html-prod2">id</link> <LPAREN> ( <link linkend="SQLParser.html-prod16">expression</link> ( <COMMA> <link linkend="SQLParser.html-prod16">expression</link> )* )? <RPAREN> ) )</para></entry>
- </row>
-
- <row>
- <entry align="right" valign="top"><para><anchor id="SQLParser.html-prod31" xreflabel="dataType"/>dataType</para></entry>
- <entry align="center" valign="top"><para>::=</para></entry>
- <entry align="left" valign="top"><para>( <STRING> | <BOOLEAN> | <BYTE> | <SHORT> | <CHAR> | <INTEGER> | <LONG> | <BIGINTEGER> | <FLOAT> | <DOUBLE> | <BIGDECIMAL> | <DATE> | <TIME> | <TIMESTAMP> | <OBJECT> | <BLOB> | <CLOB> | <XML> )</para></entry>
- </row>
-
- <row>
- <entry align="right" valign="top"><para><anchor id="SQLParser.html-prod88" xreflabel="intervalType"/>intervalType</para></entry>
- <entry align="center" valign="top"><para>::=</para></entry>
- <entry align="left" valign="top"><para>( <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> )</para></entry>
- </row>
-
- <row>
- <entry align="right" valign="top"><para><anchor id="SQLParser.html-prod84" xreflabel="literal"/>literal</para></entry>
- <entry align="center" valign="top"><para>::=</para></entry>
- <entry align="left" valign="top"><para>( <link linkend="SQLParser.html-prod1">stringVal</link> | <INTEGERVAL> | <FLOATVAL> | <FALSE> | <TRUE> | <UNKNOWN> | <NULL> | ( ( <BOOLEANTYPE> | <TIMESTAMPTYPE> | <DATETYPE> | <TIMETYPE> ) <link linkend="SQLParser.html-prod1">stringVal</link> <RBRACE> ) )</para></entry>
- </row>
- </tbody>
- </tgroup>
- </informaltable>
- </sect1>
+</para></entry></row>
+</tbody>
+</tgroup>
+</informaltable>
+</sect1>
+<sect1>
+<title>NON-TERMINALS</title>
+<informaltable frame="none">
+<tgroup cols="2">
+<colspec colname="c1" colwidth=".33*"/>
+<colspec colname="c2" colwidth="*"/>
+<tbody>
+<row>
+<entry align="right" valign="top"><para><anchor id="prod1" xreflabel="stringVal"/>stringVal</para></entry>
+<entry align="left" valign="top"><para>::=
+( <STRINGVAL> )</para></entry></row>
+<row>
+<entry align="right" valign="top"><para><anchor id="prod2" xreflabel="id"/>id</para></entry>
+<entry align="left" valign="top"><para>::=
+( <ID> )</para></entry></row>
+<row>
+<entry align="right" valign="top"><para><anchor id="prod3" xreflabel="command"/>command</para></entry>
+<entry align="left" valign="top"><para>::=
+( ( <link linkend="prod4">createUpdateProcedure</link> ) | <link linkend="prod5">userCommand</link> | <link linkend="prod6">callableStatement</link> ) ( <SEMICOLON> )? <EOF></para></entry></row>
+<row>
+<entry align="right" valign="top"><para><anchor id="prod5" xreflabel="userCommand"/>userCommand</para></entry>
+<entry align="left" valign="top"><para>::=
+( <link linkend="prod7">queryExpression</link> | <link linkend="prod8">storedProcedure</link> | <link linkend="prod9">insert</link> | <link linkend="prod10">update</link> | <link linkend="prod11">delete</link> | <link linkend="prod12">dropTable</link> | <link linkend="prod13">createTempTable</link> )</para></entry></row>
+<row>
+<entry align="right" valign="top"><para><anchor id="prod12" xreflabel="dropTable"/>dropTable</para></entry>
+<entry align="left" valign="top"><para>::=
+<DROP> <TABLE> <link linkend="prod2">id</link></para></entry></row>
+<row>
+<entry align="right" valign="top"><para><anchor id="prod13" xreflabel="createTempTable"/>createTempTable</para></entry>
+<entry align="left" valign="top"><para>::=
+<CREATE> <LOCAL> <TEMPORARY> <TABLE> <link linkend="prod2">id</link> <LPAREN> <link linkend="prod14">createElementsWithTypes</link> <RPAREN></para></entry></row>
+<row>
+<entry align="right" valign="top"><para><anchor id="prod15" xreflabel="errorStatement"/>errorStatement</para></entry>
+<entry align="left" valign="top"><para>::=
+<ERROR> <link linkend="prod16">expression</link></para></entry></row>
+<row>
+<entry align="right" valign="top"><para><anchor id="prod17" xreflabel="statement"/>statement</para></entry>
+<entry align="left" valign="top"><para>::=
+( <link linkend="prod18">ifStatement</link> | <link linkend="prod19">loopStatement</link> | <link linkend="prod20">whileStatement</link> | <link linkend="prod21">delimitedStatement</link> )</para></entry></row>
+<row>
+<entry align="right" valign="top"><para><anchor id="prod21" xreflabel="delimitedStatement"/>delimitedStatement</para></entry>
+<entry align="left" valign="top"><para>::=
+( <link linkend="prod22">sqlStatement</link> | <link linkend="prod15">errorStatement</link> | <link linkend="prod23">assignStatement</link> | <link linkend="prod24">declareStatement</link> | <link linkend="prod25">continueStatement</link> | <link linkend="prod26">breakStatement</link> ) <SEMICOLON></para></entry></row>
+<row>
+<entry align="right" valign="top"><para><anchor id="prod27" xreflabel="block"/>block</para></entry>
+<entry align="left" valign="top"><para>::=
+( <link linkend="prod17">statement</link> | ( <BEGIN> ( <link linkend="prod17">statement</link> )* <END> ) )</para></entry></row>
+<row>
+<entry align="right" valign="top"><para><anchor id="prod26" xreflabel="breakStatement"/>breakStatement</para></entry>
+<entry align="left" valign="top"><para>::=
+<BREAK></para></entry></row>
+<row>
+<entry align="right" valign="top"><para><anchor id="prod25" xreflabel="continueStatement"/>continueStatement</para></entry>
+<entry align="left" valign="top"><para>::=
+<CONTINUE></para></entry></row>
+<row>
+<entry align="right" valign="top"><para><anchor id="prod20" xreflabel="whileStatement"/>whileStatement</para></entry>
+<entry align="left" valign="top"><para>::=
+<WHILE> <LPAREN> <link linkend="prod28">criteria</link> <RPAREN> <link linkend="prod27">block</link></para></entry></row>
+<row>
+<entry align="right" valign="top"><para><anchor id="prod19" xreflabel="loopStatement"/>loopStatement</para></entry>
+<entry align="left" valign="top"><para>::=
+<LOOP> <ON> <LPAREN> <link linkend="prod7">queryExpression</link> <RPAREN> <AS> <link linkend="prod2">id</link> <link linkend="prod27">block</link></para></entry></row>
+<row>
+<entry align="right" valign="top"><para><anchor id="prod18" xreflabel="ifStatement"/>ifStatement</para></entry>
+<entry align="left" valign="top"><para>::=
+<IF> <LPAREN> <link linkend="prod28">criteria</link> <RPAREN> <link linkend="prod27">block</link> ( <ELSE> <link linkend="prod27">block</link> )?</para></entry></row>
+<row>
+<entry align="right" valign="top"><para><anchor id="prod29" xreflabel="criteriaSelector"/>criteriaSelector</para></entry>
+<entry align="left" valign="top"><para>::=
+( ( <EQ> | <NE> | <NE2> | <LE> | <GE> | <LT> | <GT> | <IN> | <LIKE> | ( <IS> <NULL> ) | <BETWEEN> ) )? <CRITERIA> ( <ON> <LPAREN> <link linkend="prod2">id</link> ( <COMMA> <link linkend="prod2">id</link> )* <RPAREN> )?</para></entry></row>
+<row>
+<entry align="right" valign="top"><para><anchor id="prod30" xreflabel="hasCriteria"/>hasCriteria</para></entry>
+<entry align="left" valign="top"><para>::=
+<HAS> <link linkend="prod29">criteriaSelector</link></para></entry></row>
+<row>
+<entry align="right" valign="top"><para><anchor id="prod24" xreflabel="declareStatement"/>declareStatement</para></entry>
+<entry align="left" valign="top"><para>::=
+<DECLARE> <link linkend="prod31">dataType</link> <link linkend="prod2">id</link> ( <EQ> <link linkend="prod32">assignStatementOperand</link> )?</para></entry></row>
+<row>
+<entry align="right" valign="top"><para><anchor id="prod23" xreflabel="assignStatement"/>assignStatement</para></entry>
+<entry align="left" valign="top"><para>::=
+<link linkend="prod2">id</link> <EQ> <link linkend="prod32">assignStatementOperand</link></para></entry></row>
+<row>
+<entry align="right" valign="top"><para><anchor id="prod32" xreflabel="assignStatementOperand"/>assignStatementOperand</para></entry>
+<entry align="left" valign="top"><para>::=
+( ( <link linkend="prod9">insert</link> ) | <link linkend="prod10">update</link> | <link linkend="prod11">delete</link> | <link linkend="prod8">storedProcedure</link> | ( <link linkend="prod16">expression</link> ) | <link linkend="prod7">queryExpression</link> )</para></entry></row>
+<row>
+<entry align="right" valign="top"><para><anchor id="prod22" xreflabel="sqlStatement"/>sqlStatement</para></entry>
+<entry align="left" valign="top"><para>::=
+( ( <link linkend="prod33">dynamicCommand</link> ) | <link linkend="prod5">userCommand</link> )</para></entry></row>
+<row>
+<entry align="right" valign="top"><para><anchor id="prod34" xreflabel="translateCriteria"/>translateCriteria</para></entry>
+<entry align="left" valign="top"><para>::=
+<TRANSLATE> <link linkend="prod29">criteriaSelector</link> ( <WITH> <LPAREN> <link linkend="prod2">id</link> <EQ> <link linkend="prod16">expression</link> ( <COMMA> <link linkend="prod2">id</link> <EQ> <link linkend="prod16">expression</link> )* <RPAREN> )?</para></entry></row>
+<row>
+<entry align="right" valign="top"><para><anchor id="prod4" xreflabel="createUpdateProcedure"/>createUpdateProcedure</para></entry>
+<entry align="left" valign="top"><para>::=
+<CREATE> ( <VIRTUAL> )? ( <UPDATE> )? <PROCEDURE> <link linkend="prod27">block</link></para></entry></row>
+<row>
+<entry align="right" valign="top"><para><anchor id="prod33" xreflabel="dynamicCommand"/>dynamicCommand</para></entry>
+<entry align="left" valign="top"><para>::=
+( <EXECUTE> | <EXEC> ) <STRING> <link linkend="prod16">expression</link> ( <AS> <link linkend="prod14">createElementsWithTypes</link> ( <INTO> <link linkend="prod2">id</link> )? )? ( <USING> <link linkend="prod35">setClauseList</link> )? ( <UPDATE> ( ( <INTEGERVAL> ) | ( <STAR> ) ) )?</para></entry></row>
+<row>
+<entry align="right" valign="top"><para><anchor id="prod35" xreflabel="setClauseList"/>setClauseList</para></entry>
+<entry align="left" valign="top"><para>::=
+<link linkend="prod2">id</link> <EQ> ( <COMMA> <link linkend="prod2">id</link> <EQ> )*</para></entry></row>
+<row>
+<entry align="right" valign="top"><para><anchor id="prod14" xreflabel="createElementsWithTypes"/>createElementsWithTypes</para></entry>
+<entry align="left" valign="top"><para>::=
+<link linkend="prod2">id</link> <link linkend="prod31">dataType</link> ( <COMMA> <link linkend="prod2">id</link> <link linkend="prod31">dataType</link> )*</para></entry></row>
+<row>
+<entry align="right" valign="top"><para><anchor id="prod6" xreflabel="callableStatement"/>callableStatement</para></entry>
+<entry align="left" valign="top"><para>::=
+<LBRACE> ( <QMARK> <EQ> )? <CALL> <link linkend="prod2">id</link> ( <LPAREN> ( <link linkend="prod36">executeUnnamedParams</link> ) <RPAREN> )? <RBRACE> ( <link linkend="prod37">option</link> )?</para></entry></row>
+<row>
+<entry align="right" valign="top"><para><anchor id="prod8" xreflabel="storedProcedure"/>storedProcedure</para></entry>
+<entry align="left" valign="top"><para>::=
+( ( ( <EXEC> ) | ( <EXECUTE> ) | ( <CALL> ) ) <link linkend="prod2">id</link> <LPAREN> ( <link linkend="prod38">executeNamedParams</link> | <link linkend="prod36">executeUnnamedParams</link> ) <RPAREN> ) ( <link linkend="prod37">option</link> )?</para></entry></row>
+<row>
+<entry align="right" valign="top"><para><anchor id="prod36" xreflabel="executeUnnamedParams"/>executeUnnamedParams</para></entry>
+<entry align="left" valign="top"><para>::=
+( <link linkend="prod16">expression</link> ( <COMMA> <link linkend="prod16">expression</link> )* )?</para></entry></row>
+<row>
+<entry align="right" valign="top"><para><anchor id="prod38" xreflabel="executeNamedParams"/>executeNamedParams</para></entry>
+<entry align="left" valign="top"><para>::=
+( <link linkend="prod2">id</link> <EQ> <link linkend="prod16">expression</link> ( <COMMA> <link linkend="prod2">id</link> <EQ> <link linkend="prod16">expression</link> )* )</para></entry></row>
+<row>
+<entry align="right" valign="top"><para><anchor id="prod9" xreflabel="insert"/>insert</para></entry>
+<entry align="left" valign="top"><para>::=
+<INSERT> <INTO> <link linkend="prod2">id</link> ( <LPAREN> <link linkend="prod2">id</link> ( <COMMA> <link linkend="prod2">id</link> )* <RPAREN> )? ( ( <VALUES> <link linkend="prod39">rowValues</link> ) | ( <link linkend="prod7">queryExpression</link> ) ) ( <link linkend="prod37">option</link> )?</para></entry></row>
+<row>
+<entry align="right" valign="top"><para><anchor id="prod39" xreflabel="rowValues"/>rowValues</para></entry>
+<entry align="left" valign="top"><para>::=
+<LPAREN> <link linkend="prod16">expression</link> ( <COMMA> <link linkend="prod16">expression</link> )* <RPAREN></para></entry></row>
+<row>
+<entry align="right" valign="top"><para><anchor id="prod10" xreflabel="update"/>update</para></entry>
+<entry align="left" valign="top"><para>::=
+<UPDATE> <link linkend="prod2">id</link> <SET> <link linkend="prod35">setClauseList</link> ( <link linkend="prod40">where</link> )? ( <link linkend="prod37">option</link> )?</para></entry></row>
+<row>
+<entry align="right" valign="top"><para><anchor id="prod11" xreflabel="delete"/>delete</para></entry>
+<entry align="left" valign="top"><para>::=
+<DELETE> <FROM> <link linkend="prod2">id</link> ( <link linkend="prod40">where</link> )? ( <link linkend="prod37">option</link> )?</para></entry></row>
+<row>
+<entry align="right" valign="top"><para><anchor id="prod7" xreflabel="queryExpression"/>queryExpression</para></entry>
+<entry align="left" valign="top"><para>::=
+<link linkend="prod41">queryExpressionBody</link></para></entry></row>
+<row>
+<entry align="right" valign="top"><para><anchor id="prod41" xreflabel="queryExpressionBody"/>queryExpressionBody</para></entry>
+<entry align="left" valign="top"><para>::=
+<link linkend="prod42">queryTerm</link> ( ( <UNION> | <EXCEPT> ) ( <ALL> | <DISTINCT> )? <link linkend="prod42">queryTerm</link> )* ( <link linkend="prod43">orderby</link> )? ( <link linkend="prod44">limit</link> )? ( <link linkend="prod37">option</link> )?</para></entry></row>
+<row>
+<entry align="right" valign="top"><para><anchor id="prod42" xreflabel="queryTerm"/>queryTerm</para></entry>
+<entry align="left" valign="top"><para>::=
+<link linkend="prod45">queryPrimary</link> ( <INTERSECT> ( <ALL> | <DISTINCT> )? <link linkend="prod45">queryPrimary</link> )*</para></entry></row>
+<row>
+<entry align="right" valign="top"><para><anchor id="prod45" xreflabel="queryPrimary"/>queryPrimary</para></entry>
+<entry align="left" valign="top"><para>::=
+( <link linkend="prod46">query</link> | ( <LPAREN> <link linkend="prod41">queryExpressionBody</link> <RPAREN> ) )</para></entry></row>
+<row>
+<entry align="right" valign="top"><para><anchor id="prod46" xreflabel="query"/>query</para></entry>
+<entry align="left" valign="top"><para>::=
+<link linkend="prod47">select</link> ( <link linkend="prod48">into</link> )? ( <link linkend="prod49">from</link> ( <link linkend="prod40">where</link> )? ( <link linkend="prod50">groupBy</link> )? ( <link linkend="prod51">having</link> )? )?</para></entry></row>
+<row>
+<entry align="right" valign="top"><para><anchor id="prod48" xreflabel="into"/>into</para></entry>
+<entry align="left" valign="top"><para>::=
+<INTO> ( <link linkend="prod2">id</link> )</para></entry></row>
+<row>
+<entry align="right" valign="top"><para><anchor id="prod47" xreflabel="select"/>select</para></entry>
+<entry align="left" valign="top"><para>::=
+<SELECT> ( <ALL> | ( <DISTINCT> ) )? ( <STAR> | ( <link linkend="prod52">selectSymbol</link> ( <COMMA> <link linkend="prod52">selectSymbol</link> )* ) )</para></entry></row>
+<row>
+<entry align="right" valign="top"><para><anchor id="prod52" xreflabel="selectSymbol"/>selectSymbol</para></entry>
+<entry align="left" valign="top"><para>::=
+( ( <ALL_IN_GROUP> ) | ( <link linkend="prod16">expression</link> ) ( ( <AS> )? ( <link linkend="prod2">id</link> ) )? )</para></entry></row>
+<row>
+<entry align="right" valign="top"><para><anchor id="prod53" xreflabel="aggregateSymbol"/>aggregateSymbol</para></entry>
+<entry align="left" valign="top"><para>::=
+( ( <COUNT> <LPAREN> <STAR> <RPAREN> ) | ( ( <COUNT> | <SUM> | <AVG> | <MIN> | <MAX> ) <LPAREN> ( <DISTINCT> )? <link linkend="prod16">expression</link> <RPAREN> ) )</para></entry></row>
+<row>
+<entry align="right" valign="top"><para><anchor id="prod49" xreflabel="from"/>from</para></entry>
+<entry align="left" valign="top"><para>::=
+<FROM> ( <link linkend="prod54">tableReference</link> ( <COMMA> <link linkend="prod54">tableReference</link> )* )</para></entry></row>
+<row>
+<entry align="right" valign="top"><para><anchor id="prod54" xreflabel="tableReference"/>tableReference</para></entry>
+<entry align="left" valign="top"><para>::=
+( ( <LBRACE> <OJ> <link linkend="prod55">tableReferenceUnescaped</link> <RBRACE> ) | <link linkend="prod55">tableReferenceUnescaped</link> )</para></entry></row>
+<row>
+<entry align="right" valign="top"><para><anchor id="prod55" xreflabel="tableReferenceUnescaped"/>tableReferenceUnescaped</para></entry>
+<entry align="left" valign="top"><para>::=
+( <link linkend="prod56">joinedTable</link> | <link linkend="prod57">tablePrimary</link> )</para></entry></row>
+<row>
+<entry align="right" valign="top"><para><anchor id="prod56" xreflabel="joinedTable"/>joinedTable</para></entry>
+<entry align="left" valign="top"><para>::=
+<link linkend="prod57">tablePrimary</link> ( ( <link linkend="prod58">crossJoin</link> | <link linkend="prod59">qualifiedJoin</link> ) )+</para></entry></row>
+<row>
+<entry align="right" valign="top"><para><anchor id="prod58" xreflabel="crossJoin"/>crossJoin</para></entry>
+<entry align="left" valign="top"><para>::=
+( ( <CROSS> | <UNION> ) <JOIN> <link linkend="prod57">tablePrimary</link> )</para></entry></row>
+<row>
+<entry align="right" valign="top"><para><anchor id="prod59" xreflabel="qualifiedJoin"/>qualifiedJoin</para></entry>
+<entry align="left" valign="top"><para>::=
+( ( ( <RIGHT> ( <OUTER> )? ) | ( <LEFT> ( <OUTER> )? ) | ( <FULL> ( <OUTER> )? ) | <INNER> )? <JOIN> <link linkend="prod54">tableReference</link> <ON> <link linkend="prod28">criteria</link> )</para></entry></row>
+<row>
+<entry align="right" valign="top"><para><anchor id="prod57" xreflabel="tablePrimary"/>tablePrimary</para></entry>
+<entry align="left" valign="top"><para>::=
+( <link linkend="prod60">unaryFromClause</link> | <link linkend="prod61">subqueryFromClause</link> | ( <LPAREN> <link linkend="prod56">joinedTable</link> <RPAREN> ) ) ( ( <MAKEDEP> ) | ( <MAKENOTDEP> ) )?</para></entry></row>
+<row>
+<entry align="right" valign="top"><para><anchor id="prod61" xreflabel="subqueryFromClause"/>subqueryFromClause</para></entry>
+<entry align="left" valign="top"><para>::=
+<LPAREN> ( <link linkend="prod7">queryExpression</link> | <link linkend="prod8">storedProcedure</link> ) <RPAREN> ( <AS> )? <link linkend="prod2">id</link></para></entry></row>
+<row>
+<entry align="right" valign="top"><para><anchor id="prod60" xreflabel="unaryFromClause"/>unaryFromClause</para></entry>
+<entry align="left" valign="top"><para>::=
+( <ID> ( ( <AS> )? <link linkend="prod2">id</link> )? )</para></entry></row>
+<row>
+<entry align="right" valign="top"><para><anchor id="prod40" xreflabel="where"/>where</para></entry>
+<entry align="left" valign="top"><para>::=
+<WHERE> <link linkend="prod28">criteria</link></para></entry></row>
+<row>
+<entry align="right" valign="top"><para><anchor id="prod28" xreflabel="criteria"/>criteria</para></entry>
+<entry align="left" valign="top"><para>::=
+<link linkend="prod62">compoundCritOr</link></para></entry></row>
+<row>
+<entry align="right" valign="top"><para><anchor id="prod62" xreflabel="compoundCritOr"/>compoundCritOr</para></entry>
+<entry align="left" valign="top"><para>::=
+<link linkend="prod63">compoundCritAnd</link> ( <OR> <link linkend="prod63">compoundCritAnd</link> )*</para></entry></row>
+<row>
+<entry align="right" valign="top"><para><anchor id="prod63" xreflabel="compoundCritAnd"/>compoundCritAnd</para></entry>
+<entry align="left" valign="top"><para>::=
+<link linkend="prod64">notCrit</link> ( <AND> <link linkend="prod64">notCrit</link> )*</para></entry></row>
+<row>
+<entry align="right" valign="top"><para><anchor id="prod64" xreflabel="notCrit"/>notCrit</para></entry>
+<entry align="left" valign="top"><para>::=
+( <NOT> )? <link linkend="prod65">primary</link></para></entry></row>
+<row>
+<entry align="right" valign="top"><para><anchor id="prod65" xreflabel="primary"/>primary</para></entry>
+<entry align="left" valign="top"><para>::=
+( <link linkend="prod66">predicate</link> | ( <LPAREN> <link linkend="prod28">criteria</link> <RPAREN> ) )</para></entry></row>
+<row>
+<entry align="right" valign="top"><para><anchor id="prod66" xreflabel="predicate"/>predicate</para></entry>
+<entry align="left" valign="top"><para>::=
+( <link linkend="prod67">subqueryCompareCriteria</link> | <link linkend="prod68">compareCrit</link> | <link linkend="prod69">matchCrit</link> | <link linkend="prod70">betweenCrit</link> | <link linkend="prod71">setCrit</link> | <link linkend="prod72">existsCriteria</link> | <link linkend="prod30">hasCriteria</link> | <link linkend="prod34">translateCriteria</link> | <link linkend="prod73">isNullCrit</link> )</para></entry></row>
+<row>
+<entry align="right" valign="top"><para><anchor id="prod68" xreflabel="compareCrit"/>compareCrit</para></entry>
+<entry align="left" valign="top"><para>::=
+<link linkend="prod16">expression</link> ( <EQ> | <NE> | <NE2> | <LT> | <LE> | <GT> | <GE> ) <link linkend="prod16">expression</link></para></entry></row>
+<row>
+<entry align="right" valign="top"><para><anchor id="prod74" xreflabel="subquery"/>subquery</para></entry>
+<entry align="left" valign="top"><para>::=
+<LPAREN> ( <link linkend="prod7">queryExpression</link> | <link linkend="prod8">storedProcedure</link> ) <RPAREN></para></entry></row>
+<row>
+<entry align="right" valign="top"><para><anchor id="prod67" xreflabel="subqueryCompareCriteria"/>subqueryCompareCriteria</para></entry>
+<entry align="left" valign="top"><para>::=
+<link linkend="prod16">expression</link> ( <EQ> | <NE> | <NE2> | <LT> | <LE> | <GT> | <GE> ) ( <ANY> | <SOME> | <ALL> ) <link linkend="prod74">subquery</link></para></entry></row>
+<row>
+<entry align="right" valign="top"><para><anchor id="prod69" xreflabel="matchCrit"/>matchCrit</para></entry>
+<entry align="left" valign="top"><para>::=
+( <link linkend="prod16">expression</link> ( <NOT> )? <LIKE> <link linkend="prod16">expression</link> ( <link linkend="prod75">escapeChar</link> | ( <LBRACE> <link linkend="prod75">escapeChar</link> <RBRACE> ) )? )</para></entry></row>
+<row>
+<entry align="right" valign="top"><para><anchor id="prod75" xreflabel="escapeChar"/>escapeChar</para></entry>
+<entry align="left" valign="top"><para>::=
+<ESCAPE> <link linkend="prod1">stringVal</link></para></entry></row>
+<row>
+<entry align="right" valign="top"><para><anchor id="prod70" xreflabel="betweenCrit"/>betweenCrit</para></entry>
+<entry align="left" valign="top"><para>::=
+<link linkend="prod16">expression</link> ( <NOT> )? <BETWEEN> <link linkend="prod16">expression</link> <AND> <link linkend="prod16">expression</link></para></entry></row>
+<row>
+<entry align="right" valign="top"><para><anchor id="prod73" xreflabel="isNullCrit"/>isNullCrit</para></entry>
+<entry align="left" valign="top"><para>::=
+<link linkend="prod16">expression</link> <IS> ( <NOT> )? <NULL></para></entry></row>
+<row>
+<entry align="right" valign="top"><para><anchor id="prod71" xreflabel="setCrit"/>setCrit</para></entry>
+<entry align="left" valign="top"><para>::=
+<link linkend="prod16">expression</link> ( <NOT> )? <IN> ( ( <link linkend="prod74">subquery</link> ) | ( <LPAREN> <link linkend="prod16">expression</link> ( <COMMA> <link linkend="prod16">expression</link> )* <RPAREN> ) )</para></entry></row>
+<row>
+<entry align="right" valign="top"><para><anchor id="prod72" xreflabel="existsCriteria"/>existsCriteria</para></entry>
+<entry align="left" valign="top"><para>::=
+<EXISTS> <link linkend="prod74">subquery</link></para></entry></row>
+<row>
+<entry align="right" valign="top"><para><anchor id="prod50" xreflabel="groupBy"/>groupBy</para></entry>
+<entry align="left" valign="top"><para>::=
+<GROUP> <BY> ( <link linkend="prod76">groupByItem</link> ( <COMMA> <link linkend="prod76">groupByItem</link> )* )</para></entry></row>
+<row>
+<entry align="right" valign="top"><para><anchor id="prod76" xreflabel="groupByItem"/>groupByItem</para></entry>
+<entry align="left" valign="top"><para>::=
+<link linkend="prod16">expression</link></para></entry></row>
+<row>
+<entry align="right" valign="top"><para><anchor id="prod51" xreflabel="having"/>having</para></entry>
+<entry align="left" valign="top"><para>::=
+<HAVING> <link linkend="prod28">criteria</link></para></entry></row>
+<row>
+<entry align="right" valign="top"><para><anchor id="prod43" xreflabel="orderby"/>orderby</para></entry>
+<entry align="left" valign="top"><para>::=
+<ORDER> <BY> <link linkend="prod77">sortKey</link> ( <ASC> | <DESC> )? ( <COMMA> <link linkend="prod77">sortKey</link> ( <ASC> | <DESC> )? )*</para></entry></row>
+<row>
+<entry align="right" valign="top"><para><anchor id="prod77" xreflabel="sortKey"/>sortKey</para></entry>
+<entry align="left" valign="top"><para>::=
+<link linkend="prod16">expression</link></para></entry></row>
+<row>
+<entry align="right" valign="top"><para><anchor id="prod44" xreflabel="limit"/>limit</para></entry>
+<entry align="left" valign="top"><para>::=
+<LIMIT> ( <INTEGERVAL> | <QMARK> ) ( <COMMA> ( <INTEGERVAL> | <QMARK> ) )?</para></entry></row>
+<row>
+<entry align="right" valign="top"><para><anchor id="prod37" xreflabel="option"/>option</para></entry>
+<entry align="left" valign="top"><para>::=
+<OPTION> ( <SHOWPLAN> | <PLANONLY> | <DEBUG> | <MAKEDEP> <link linkend="prod2">id</link> ( <COMMA> <link linkend="prod2">id</link> )* | <MAKENOTDEP> <link linkend="prod2">id</link> ( <COMMA> <link linkend="prod2">id</link> )* | <NOCACHE> ( <link linkend="prod2">id</link> ( <COMMA> <link linkend="prod2">id</link> )* )? )*</para></entry></row>
+<row>
+<entry align="right" valign="top"><para><anchor id="prod16" xreflabel="expression"/>expression</para></entry>
+<entry align="left" valign="top"><para>::=
+<link linkend="prod78">concatExpression</link></para></entry></row>
+<row>
+<entry align="right" valign="top"><para><anchor id="prod78" xreflabel="concatExpression"/>concatExpression</para></entry>
+<entry align="left" valign="top"><para>::=
+( <link linkend="prod79">plusExpression</link> ( <CONCAT_OP> <link linkend="prod79">plusExpression</link> )* )</para></entry></row>
+<row>
+<entry align="right" valign="top"><para><anchor id="prod79" xreflabel="plusExpression"/>plusExpression</para></entry>
+<entry align="left" valign="top"><para>::=
+( <link linkend="prod80">timesExpression</link> ( <link linkend="prod81">plusOperator</link> <link linkend="prod80">timesExpression</link> )* )</para></entry></row>
+<row>
+<entry align="right" valign="top"><para><anchor id="prod81" xreflabel="plusOperator"/>plusOperator</para></entry>
+<entry align="left" valign="top"><para>::=
+( <PLUS> | <MINUS> )</para></entry></row>
+<row>
+<entry align="right" valign="top"><para><anchor id="prod80" xreflabel="timesExpression"/>timesExpression</para></entry>
+<entry align="left" valign="top"><para>::=
+( <link linkend="prod82">basicExpression</link> ( <link linkend="prod83">timesOperator</link> <link linkend="prod82">basicExpression</link> )* )</para></entry></row>
+<row>
+<entry align="right" valign="top"><para><anchor id="prod83" xreflabel="timesOperator"/>timesOperator</para></entry>
+<entry align="left" valign="top"><para>::=
+( <STAR> | <SLASH> )</para></entry></row>
+<row>
+<entry align="right" valign="top"><para><anchor id="prod82" xreflabel="basicExpression"/>basicExpression</para></entry>
+<entry align="left" valign="top"><para>::=
+( <QMARK> | <link linkend="prod84">literal</link> | ( <LBRACE> <FN> <link linkend="prod85">function</link> <RBRACE> ) | ( <link linkend="prod53">aggregateSymbol</link> ) | ( <link linkend="prod85">function</link> ) | ( <ID> ) | ( <LPAREN> <link linkend="prod16">expression</link> <RPAREN> ) | <link linkend="prod74">subquery</link> | <link linkend="prod86">caseExpression</link> | <link linkend="prod87">searchedCaseExpression</link> )</para></entry></row>
+<row>
+<entry align="right" valign="top"><para><anchor id="prod86" xreflabel="caseExpression"/>caseExpression</para></entry>
+<entry align="left" valign="top"><para>::=
+<CASE> <link linkend="prod16">expression</link> ( <WHEN> <link linkend="prod16">expression</link> <THEN> <link linkend="prod16">expression</link> )+ ( <ELSE> <link linkend="prod16">expression</link> )? <END></para></entry></row>
+<row>
+<entry align="right" valign="top"><para><anchor id="prod87" xreflabel="searchedCaseExpression"/>searchedCaseExpression</para></entry>
+<entry align="left" valign="top"><para>::=
+<CASE> ( <WHEN> <link linkend="prod28">criteria</link> <THEN> <link linkend="prod16">expression</link> )+ ( <ELSE> <link linkend="prod16">expression</link> )? <END></para></entry></row>
+<row>
+<entry align="right" valign="top"><para><anchor id="prod85" xreflabel="function"/>function</para></entry>
+<entry align="left" valign="top"><para>::=
+( ( <CONVERT> <LPAREN> <link linkend="prod16">expression</link> <COMMA> <link linkend="prod31">dataType</link> <RPAREN> ) | ( <CAST> <LPAREN> <link linkend="prod16">expression</link> <AS> <link linkend="prod31">dataType</link> <RPAREN> ) | ( ( <TIMESTAMPADD> | <TIMESTAMPDIFF> ) <LPAREN> <link linkend="prod88">intervalType</link> <COMMA> <link linkend="prod16">expression</link> <COMMA> <link linkend="prod16">expression</link> <RPAREN> ) | ( ( <LEFT> | <RIGHT> | <CHAR> | <USER> | <YEAR> | <MONTH> | <HOUR> | <MINUTE> | <SECOND> ) <LPAREN> ( <link linkend="prod16">expression</link> ( <COMMA> <link linkend="prod16">expression</link> )* )? <RPAREN> ) | ( ( <INSERT> ) <LPAREN> ( <link linkend="prod16">expression</link> ( <COMMA> <link linkend="prod16">expression</link> )* )? <RPAREN> ) | ( ( <TRANSLAT!
E> ) <LPAREN> ( <link linkend="prod16">expression</link> ( <COMMA> <link linkend="prod16">expression</link> )* )? <RPAREN> ) | ( <link linkend="prod2">id</link> <LPAREN> ( <link linkend="prod16">expression</link> ( <COMMA> <link linkend="prod16">expression</link> )* )? <RPAREN> ) )</para></entry></row>
+<row>
+<entry align="right" valign="top"><para><anchor id="prod31" xreflabel="dataType"/>dataType</para></entry>
+<entry align="left" valign="top"><para>::=
+( <STRING> | <VARCHAR> | <BOOLEAN> | <BYTE> | <TINYINT> | <SHORT> | <SMALLINT> | <CHAR> | <INTEGER> | <LONG> | <BIGINT> | <BIGINTEGER> | <FLOAT> | <REAL> | <DOUBLE> | <BIGDECIMAL> | <DECIMAL> | <DATE> | <TIME> | <TIMESTAMP> | <OBJECT> | <BLOB> | <CLOB> | <XML> )</para></entry></row>
+<row>
+<entry align="right" valign="top"><para><anchor id="prod88" xreflabel="intervalType"/>intervalType</para></entry>
+<entry align="left" valign="top"><para>::=
+( <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> )</para></entry></row>
+<row>
+<entry align="right" valign="top"><para><anchor id="prod84" xreflabel="literal"/>literal</para></entry>
+<entry align="left" valign="top"><para>::=
+( <link linkend="prod1">stringVal</link> | <INTEGERVAL> | <FLOATVAL> | <FALSE> | <TRUE> | <UNKNOWN> | <NULL> | ( ( <BOOLEANTYPE> | <TIMESTAMPTYPE> | <DATETYPE> | <TIMETYPE> ) <link linkend="prod1">stringVal</link> <RBRACE> ) )</para></entry></row>
+</tbody>
+</tgroup>
+</informaltable>
+</sect1>
</appendix>
Modified: trunk/engine/src/main/java/org/teiid/dqp/internal/process/AbstractWorkItem.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/dqp/internal/process/AbstractWorkItem.java 2010-03-19 01:45:14 UTC (rev 1976)
+++ trunk/engine/src/main/java/org/teiid/dqp/internal/process/AbstractWorkItem.java 2010-03-19 16:17:09 UTC (rev 1977)
@@ -43,12 +43,8 @@
private volatile boolean release;
public void run() {
- try {
- startProcessing();
- process();
- } finally {
- endProcessing();
- }
+ startProcessing();
+ process();
}
synchronized ThreadState getThreadState() {
@@ -146,6 +142,7 @@
@Override
public void workCompleted(WorkEvent arg0) {
+ endProcessing();
}
@Override
Modified: trunk/engine/src/main/java/org/teiid/dqp/internal/process/Request.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/dqp/internal/process/Request.java 2010-03-19 01:45:14 UTC (rev 1976)
+++ trunk/engine/src/main/java/org/teiid/dqp/internal/process/Request.java 2010-03-19 16:17:09 UTC (rev 1977)
@@ -33,7 +33,6 @@
import org.teiid.dqp.internal.process.multisource.MultiSourceMetadataWrapper;
import org.teiid.dqp.internal.process.multisource.MultiSourcePlanToProcessConverter;
import org.teiid.dqp.internal.process.validator.AuthorizationValidationVisitor;
-import org.teiid.plan.api.ExecutionProperties;
import com.metamatrix.api.exception.MetaMatrixComponentException;
import com.metamatrix.api.exception.MetaMatrixProcessingException;
@@ -351,9 +350,9 @@
boolean startAutoWrapTxn = false;
- if(ExecutionProperties.TXN_WRAP_ON.equals(requestMsg.getTxnAutoWrapMode())){
+ if(RequestMessage.TXN_WRAP_ON.equals(requestMsg.getTxnAutoWrapMode())){
startAutoWrapTxn = true;
- } else if (ExecutionProperties.TXN_WRAP_DETECT.equals(requestMsg.getTxnAutoWrapMode())){
+ } else if (RequestMessage.TXN_WRAP_DETECT.equals(requestMsg.getTxnAutoWrapMode())){
boolean transactionalRead = requestMsg.getTransactionIsolation() == Connection.TRANSACTION_REPEATABLE_READ
|| requestMsg.getTransactionIsolation() == Connection.TRANSACTION_SERIALIZABLE;
if (!transactionalRead && userCommand instanceof StoredProcedure && ((StoredProcedure)userCommand).getUpdateCount() == 0) {
@@ -467,11 +466,6 @@
LogManager.logInfo(LogConstants.CTX_DQP, debugLog);
}
}
-
- if (analysisRecord.recordQueryPlan()) {
- analysisRecord.setQueryPlan(processPlan.getDescriptionProperties());
- }
-
LogManager.logDetail(LogConstants.CTX_DQP, new Object[] { DQPPlugin.Util.getString("BasicInterceptor.ProcessTree_for__4"), requestId, processPlan }); //$NON-NLS-1$
} catch (QueryMetadataException e) {
Object[] params = new Object[] { requestId};
Modified: trunk/engine/src/main/java/org/teiid/metadata/TransformationMetadata.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/metadata/TransformationMetadata.java 2010-03-19 01:45:14 UTC (rev 1976)
+++ trunk/engine/src/main/java/org/teiid/metadata/TransformationMetadata.java 2010-03-19 16:17:09 UTC (rev 1977)
@@ -86,6 +86,16 @@
* index files for various metadata properties.
*/
public class TransformationMetadata extends BasicQueryMetadata implements Serializable {
+
+ public static class Resource {
+ public Resource(VirtualFile file, boolean visible) {
+ this.file = file;
+ this.visible = visible;
+ }
+ VirtualFile file;
+ boolean visible;
+ }
+
private static final long serialVersionUID = 1058627332954475287L;
/** Delimiter character used when specifying fully qualified entity names */
@@ -98,7 +108,7 @@
private static UnmodifiableProperties EMPTY_PROPS = new UnmodifiableProperties(new Properties());
private final CompositeMetadataStore store;
- private Map<VirtualFile, Boolean> vdbEntries;
+ private Map<String, Resource> vdbEntries;
private FunctionLibrary functionLibrary;
private VDBMetaData vdbMetaData;
@@ -113,14 +123,15 @@
* TransformationMetadata constructor
* @param context Object containing the info needed to lookup metadta.
*/
- public TransformationMetadata(VDBMetaData vdbMetadata, final CompositeMetadataStore store, Map<VirtualFile, Boolean> vdbEntries, Collection <FunctionMethod> udfMethods) {
+ public TransformationMetadata(VDBMetaData vdbMetadata, final CompositeMetadataStore store, Map<String, Resource> vdbEntries, Collection <FunctionMethod> udfMethods) {
ArgCheck.isNotNull(store);
this.vdbMetaData = vdbMetadata;
this.store = store;
if (vdbEntries == null) {
- vdbEntries = Collections.emptyMap();
+ this.vdbEntries = Collections.emptyMap();
+ } else {
+ this.vdbEntries = vdbEntries;
}
- this.vdbEntries = vdbEntries;
if (udfMethods == null) {
udfMethods = Collections.emptyList();
}
@@ -1037,14 +1048,9 @@
if (resourcePath == null) {
return null;
}
- for (final VirtualFile f:this.vdbEntries.keySet()) {
- if (f.getPathName().equals(resourcePath)) {
- Boolean v = this.vdbEntries.get(f);
- if (v.booleanValue()) {
- return f;
- }
- break;
- }
+ Resource r = this.vdbEntries.get(resourcePath);
+ if (r != null && r.visible) {
+ return r.file;
}
return null;
}
@@ -1074,14 +1080,8 @@
* @since 4.3
*/
public String[] getVDBResourcePaths() throws MetaMatrixComponentException, QueryMetadataException {
- ArrayList<String> paths = new ArrayList<String>();
- for (VirtualFile f:this.vdbEntries.keySet()) {
- Boolean v = this.vdbEntries.get(f);
- if (v.booleanValue()) {
- paths.add(f.getPathName());
- }
- }
- return paths.toArray(new String[paths.size()]);
+ ArrayList<String> paths = new ArrayList<String>(this.vdbEntries.keySet());
+ return paths.toArray(new String[paths.size()]);
}
/**
Modified: trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestDQPCore.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestDQPCore.java 2010-03-19 01:45:14 UTC (rev 1976)
+++ trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestDQPCore.java 2010-03-19 16:17:09 UTC (rev 1977)
@@ -35,7 +35,6 @@
import org.mockito.Mockito;
import org.teiid.dqp.internal.datamgr.impl.ConnectorManagerRepository;
import org.teiid.dqp.internal.datamgr.impl.FakeTransactionService;
-import org.teiid.plan.api.ExecutionProperties;
import com.metamatrix.api.exception.query.QueryResolverException;
import com.metamatrix.common.queue.FakeWorkManager;
@@ -43,7 +42,6 @@
import com.metamatrix.dqp.message.ResultsMessage;
import com.metamatrix.dqp.service.AutoGenDataService;
import com.metamatrix.dqp.service.FakeBufferService;
-import com.metamatrix.platform.security.api.SessionToken;
import com.metamatrix.query.unittest.FakeMetadataFactory;
public class TestDQPCore {
@@ -189,7 +187,7 @@
public void helpTestVisibilityFails(String sql) throws Exception {
RequestMessage reqMsg = exampleRequestMessage(sql);
- reqMsg.setTxnAutoWrapMode(ExecutionProperties.TXN_WRAP_OFF);
+ reqMsg.setTxnAutoWrapMode(RequestMessage.TXN_WRAP_OFF);
Future<ResultsMessage> message = core.executeRequest(reqMsg.getExecutionId(), reqMsg);
ResultsMessage results = message.get(5000, TimeUnit.MILLISECONDS);
assertEquals("[QueryValidatorException]Group does not exist: BQT3.SmallA", results.getException().toString()); //$NON-NLS-1$
@@ -216,7 +214,7 @@
DQPWorkContext.getWorkContext().getSession().setSessionId(sessionid);
DQPWorkContext.getWorkContext().getSession().setUserName(userName);
if (txnAutoWrap) {
- reqMsg.setTxnAutoWrapMode(ExecutionProperties.TXN_WRAP_ON);
+ reqMsg.setTxnAutoWrapMode(RequestMessage.TXN_WRAP_ON);
}
Future<ResultsMessage> message = core.executeRequest(reqMsg.getExecutionId(), reqMsg);
Modified: trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestWorkItemState.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestWorkItemState.java 2010-03-19 01:45:14 UTC (rev 1976)
+++ trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestWorkItemState.java 2010-03-19 16:17:09 UTC (rev 1977)
@@ -44,6 +44,12 @@
}
@Override
+ public void run() {
+ super.run();
+ workCompleted(null);
+ }
+
+ @Override
protected boolean isDoneProcessing() {
return isDone;
}
Modified: trunk/metadata/src/main/java/org/teiid/metadata/index/IndexMetadataFactory.java
===================================================================
--- trunk/metadata/src/main/java/org/teiid/metadata/index/IndexMetadataFactory.java 2010-03-19 01:45:14 UTC (rev 1976)
+++ trunk/metadata/src/main/java/org/teiid/metadata/index/IndexMetadataFactory.java 2010-03-19 16:17:09 UTC (rev 1977)
@@ -29,10 +29,13 @@
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
+import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import org.jboss.virtual.VirtualFile;
+import org.teiid.adminapi.impl.ModelMetaData;
+import org.teiid.adminapi.impl.VDBMetaData;
import org.teiid.connector.metadata.runtime.AbstractMetadataRecord;
import org.teiid.connector.metadata.runtime.Column;
import org.teiid.connector.metadata.runtime.ColumnSet;
@@ -47,13 +50,16 @@
import org.teiid.core.index.IEntryResult;
import org.teiid.internal.core.index.Index;
import org.teiid.metadata.TransformationMetadata;
+import org.teiid.metadata.TransformationMetadata.Resource;
import com.metamatrix.api.exception.query.QueryMetadataException;
+import com.metamatrix.core.CoreConstants;
import com.metamatrix.core.MetaMatrixCoreException;
import com.metamatrix.core.MetaMatrixRuntimeException;
import com.metamatrix.core.id.UUID;
import com.metamatrix.core.util.ArgCheck;
import com.metamatrix.core.util.StringUtil;
+import com.metamatrix.core.vdb.VdbConstants;
/**
* Loads MetadataRecords from index files.
@@ -66,7 +72,7 @@
private Map<String, Table> tableCache = new HashMap<String, Table>();
private MetadataStore store;
private HashSet<VirtualFile> indexFiles = new HashSet<VirtualFile>();
- private Map<VirtualFile, Boolean> vdbEntries;
+ private LinkedHashMap<String, Resource> vdbEntries;
public MetadataStore getMetadataStore() throws IOException {
if (this.store == null) {
@@ -94,11 +100,50 @@
this.indexFiles.add(f);
}
- public void addEntriesPlusVisibilities(Map<VirtualFile, Boolean> entries) {
- this.vdbEntries = entries;
+ public void addEntriesPlusVisibilities(VirtualFile root, VDBMetaData vdb) throws IOException {
+ LinkedHashMap<String, Resource> visibilityMap = new LinkedHashMap<String, Resource>();
+ for(VirtualFile f: root.getChildrenRecursively()) {
+ visibilityMap.put("/" + f.getPathName(), new Resource(f, isFileVisible(f.getPathName(), vdb))); //$NON-NLS-1$
+ }
+ this.vdbEntries = visibilityMap;
}
- public Map<VirtualFile, Boolean> getEntriesPlusVisibilities(){
+ private final static boolean isSystemModelWithSystemTableType(String modelName) {
+ return CoreConstants.SYSTEM_MODEL.equalsIgnoreCase(modelName);
+ }
+
+ private boolean isFileVisible(String pathInVDB, VDBMetaData vdb) {
+
+ String modelName = StringUtil.getFirstToken(StringUtil.getLastToken(pathInVDB, "/"), "."); //$NON-NLS-1$ //$NON-NLS-2$
+
+ // If this is any of the Public System Models, like JDBC,ODBC system
+ // models
+ if (isSystemModelWithSystemTableType(modelName)) {
+ return true;
+ }
+
+ ModelMetaData model = vdb.getModel(modelName);
+ if (model != null) {
+ return model.isVisible();
+ }
+
+ String entry = StringUtil.getLastToken(pathInVDB, "/"); //$NON-NLS-1$
+
+ // index files should not be visible
+ if( entry.endsWith(VdbConstants.INDEX_EXT) || entry.endsWith(VdbConstants.SEARCH_INDEX_EXT)) {
+ return false;
+ }
+
+ // deployment file should not be visible
+ if(entry.equalsIgnoreCase(VdbConstants.DEPLOYMENT_FILE)) {
+ return false;
+ }
+
+ // any other file should be visible
+ return true;
+ }
+
+ public LinkedHashMap<String, Resource> getEntriesPlusVisibilities(){
return this.vdbEntries;
}
Modified: trunk/metadata/src/test/java/org/teiid/metadata/index/VDBMetadataFactory.java
===================================================================
--- trunk/metadata/src/test/java/org/teiid/metadata/index/VDBMetadataFactory.java 2010-03-19 01:45:14 UTC (rev 1976)
+++ trunk/metadata/src/test/java/org/teiid/metadata/index/VDBMetadataFactory.java 2010-03-19 16:17:09 UTC (rev 1977)
@@ -28,14 +28,13 @@
import java.net.URL;
import java.util.Arrays;
import java.util.Collection;
-import java.util.HashMap;
import java.util.List;
-import java.util.Map;
import org.jboss.virtual.VFS;
import org.jboss.virtual.VirtualFile;
import org.jboss.virtual.VirtualFileFilter;
import org.jboss.virtual.plugins.context.zip.ZipEntryContext;
+import org.teiid.adminapi.impl.VDBMetaData;
import org.teiid.connector.metadata.runtime.MetadataStore;
import org.teiid.metadata.CompositeMetadataStore;
import org.teiid.metadata.TransformationMetadata;
@@ -66,26 +65,15 @@
try {
VirtualFile vdbFile = getVirtualFile(vdbURL);
- MetadataStore store = getMetadataStore(vdbFile);
+ IndexMetadataFactory imf = getMetadataStore(vdbFile);
+ imf.addEntriesPlusVisibilities(vdbFile, new VDBMetaData());
- List<VirtualFile> files = vdbFile.getChildrenRecursively(new VirtualFileFilter() {
- @Override
- public boolean accepts(VirtualFile file) {
- return !file.getName().endsWith(IndexConstants.NAME_DELIM_CHAR+IndexConstants.INDEX_EXT);
- }
- });
-
- Map<VirtualFile, Boolean> vdbFiles = new HashMap<VirtualFile, Boolean>();
- for (VirtualFile virtualFile : files) {
- vdbFiles.put(virtualFile, Boolean.TRUE);
- }
-
Collection <FunctionMethod> methods = null;
if (udfFile != null) {
methods = FunctionMetadataReader.loadFunctionMethods(udfFile.openStream());
}
- MetadataStore system = getMetadataStore(getVirtualFile(VDBMetadataFactory.class.getResource("/System.vdb"))); //$NON-NLS-1$
- vdbmetadata = new TransformationMetadata(null, new CompositeMetadataStore(Arrays.asList(system, store)), vdbFiles, methods);
+ MetadataStore system = getMetadataStore(getVirtualFile(VDBMetadataFactory.class.getResource("/System.vdb"))).getMetadataStore(); //$NON-NLS-1$
+ vdbmetadata = new TransformationMetadata(null, new CompositeMetadataStore(Arrays.asList(system, imf.getMetadataStore())), imf.getEntriesPlusVisibilities(), methods);
VDB_CACHE.put(vdbURL, vdbmetadata);
return vdbmetadata;
} catch (URISyntaxException e) {
@@ -101,7 +89,7 @@
return vdbFile;
}
- private static MetadataStore getMetadataStore(VirtualFile vdbFile)
+ private static IndexMetadataFactory getMetadataStore(VirtualFile vdbFile)
throws IOException {
List<VirtualFile> children = vdbFile.getChildrenRecursively(new VirtualFileFilter() {
@Override
@@ -115,8 +103,7 @@
imf.addIndexFile(f);
}
- MetadataStore store = imf.getMetadataStore();
- return store;
+ return imf;
}
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2010-03-19 01:45:14 UTC (rev 1976)
+++ trunk/pom.xml 2010-03-19 16:17:09 UTC (rev 1977)
@@ -470,7 +470,6 @@
</dependencies>
</dependencyManagement>
<modules>
- <module>test-integration</module>
<module>common-core</module>
<module>connector-api</module>
<module>client</module>
@@ -484,7 +483,7 @@
<module>cache-jbosscache</module>
<module>hibernate-dialect</module>
<module>jboss-integration</module>
-
+ <module>test-integration</module>
</modules>
<distributionManagement>
<repository>
Modified: trunk/runtime/src/main/java/org/teiid/deployers/VDBDeployer.java
===================================================================
--- trunk/runtime/src/main/java/org/teiid/deployers/VDBDeployer.java 2010-03-19 01:45:14 UTC (rev 1976)
+++ trunk/runtime/src/main/java/org/teiid/deployers/VDBDeployer.java 2010-03-19 16:17:09 UTC (rev 1977)
@@ -25,8 +25,8 @@
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;
+import java.util.LinkedHashMap;
import java.util.List;
-import java.util.Map;
import javax.naming.InitialContext;
import javax.naming.NamingException;
@@ -35,7 +35,6 @@
import org.jboss.deployers.spi.deployer.helpers.AbstractSimpleRealDeployer;
import org.jboss.deployers.structure.spi.DeploymentUnit;
import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
-import org.jboss.virtual.VirtualFile;
import org.teiid.adminapi.Model;
import org.teiid.adminapi.VDB;
import org.teiid.adminapi.impl.ModelMetaData;
@@ -48,6 +47,7 @@
import org.teiid.dqp.internal.datamgr.impl.ConnectorManagerRepository;
import org.teiid.metadata.CompositeMetadataStore;
import org.teiid.metadata.TransformationMetadata;
+import org.teiid.metadata.TransformationMetadata.Resource;
import org.teiid.metadata.index.IndexMetadataFactory;
import org.teiid.runtime.RuntimePlugin;
@@ -107,7 +107,7 @@
IndexMetadataFactory indexFactory = unit.getAttachment(IndexMetadataFactory.class);
UDFMetaData udf = unit.getAttachment(UDFMetaData.class);
if (indexFactory != null) {
- Map<VirtualFile, Boolean> visibilityMap = indexFactory.getEntriesPlusVisibilities();
+ LinkedHashMap<String, Resource> visibilityMap = indexFactory.getEntriesPlusVisibilities();
metadata = buildTransformationMetaData(deployment, visibilityMap, store, udf);
}
else {
@@ -166,7 +166,7 @@
// does this need to be synchronized?
- private TransformationMetadata buildTransformationMetaData(VDBMetaData vdb, Map<VirtualFile, Boolean> visibilityMap, CompositeMetadataStore store, UDFMetaData udf) throws DeploymentException {
+ private TransformationMetadata buildTransformationMetaData(VDBMetaData vdb, LinkedHashMap<String, Resource> visibilityMap, CompositeMetadataStore store, UDFMetaData udf) throws DeploymentException {
// get the system VDB metadata store
MetadataStore systemStore = this.vdbRepository.getMetadataStore(CoreConstants.SYSTEM_VDB, 1);
Modified: trunk/runtime/src/main/java/org/teiid/deployers/VDBParserDeployer.java
===================================================================
--- trunk/runtime/src/main/java/org/teiid/deployers/VDBParserDeployer.java 2010-03-19 01:45:14 UTC (rev 1976)
+++ trunk/runtime/src/main/java/org/teiid/deployers/VDBParserDeployer.java 2010-03-19 16:17:09 UTC (rev 1977)
@@ -23,7 +23,6 @@
import java.io.File;
import java.util.HashMap;
-import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -54,7 +53,6 @@
import com.metamatrix.common.log.LogConstants;
import com.metamatrix.common.log.LogManager;
import com.metamatrix.core.CoreConstants;
-import com.metamatrix.core.util.StringUtil;
import com.metamatrix.core.vdb.VdbConstants;
/**
@@ -134,20 +132,12 @@
vdb.setUrl(unit.getRoot().toURL().toExternalForm());
- // add the entries and determine their visibility
- VirtualFile root = unit.getRoot();
- List<VirtualFile> children = root.getChildrenRecursively();
- Map<VirtualFile, Boolean> visibilityMap = new LinkedHashMap<VirtualFile, Boolean>();
- for(VirtualFile f: children) {
- visibilityMap.put(f, isFileVisible(f.getPathName(), vdb));
- }
-
// build the metadata store
List<Object> indexFiles = metadata.get(IndexMetadataFactory.class);
if (indexFiles != null && !indexFiles.isEmpty()) {
IndexMetadataFactory imf = (IndexMetadataFactory)indexFiles.get(0);
if (imf != null) {
- imf.addEntriesPlusVisibilities(visibilityMap);
+ imf.addEntriesPlusVisibilities(unit.getRoot(), vdb);
unit.addAttachment(IndexMetadataFactory.class, imf);
// add the cached store.
@@ -190,41 +180,6 @@
LogManager.logTrace(LogConstants.CTX_RUNTIME, "VDB "+unit.getRoot().getName()+" has been parsed."); //$NON-NLS-1$ //$NON-NLS-2$
return vdb;
- }
-
- private final static boolean isSystemModelWithSystemTableType(String modelName) {
- return CoreConstants.SYSTEM_MODEL.equalsIgnoreCase(modelName);
- }
-
- private boolean isFileVisible(String pathInVDB, VDBMetaData vdb) {
-
- String modelName = StringUtil.getFirstToken(StringUtil.getLastToken(pathInVDB, "/"), "."); //$NON-NLS-1$ //$NON-NLS-2$
-
- // If this is any of the Public System Models, like JDBC,ODBC system
- // models
- if (isSystemModelWithSystemTableType(modelName)) {
- return true;
- }
-
- ModelMetaData model = vdb.getModel(modelName);
- if (model != null) {
- return model.isVisible();
- }
-
- String entry = StringUtil.getLastToken(pathInVDB, "/"); //$NON-NLS-1$
-
- // index files should not be visible
- if( entry.endsWith(VdbConstants.INDEX_EXT) || entry.endsWith(VdbConstants.SEARCH_INDEX_EXT)) {
- return false;
- }
-
- // deployment file should not be visible
- if(entry.equalsIgnoreCase(VdbConstants.DEPLOYMENT_FILE)) {
- return false;
- }
-
- // any other file should be visible
- return true;
}
public void setObjectSerializer(ObjectSerializer serializer) {
Modified: trunk/test-integration/common/src/test/java/org/teiid/dqp/internal/process/TestXMLTypeTranslations.java
===================================================================
--- trunk/test-integration/common/src/test/java/org/teiid/dqp/internal/process/TestXMLTypeTranslations.java 2010-03-19 01:45:14 UTC (rev 1976)
+++ trunk/test-integration/common/src/test/java/org/teiid/dqp/internal/process/TestXMLTypeTranslations.java 2010-03-19 16:17:09 UTC (rev 1977)
@@ -22,6 +22,7 @@
package org.teiid.dqp.internal.process;
+import java.io.FileInputStream;
import java.math.BigInteger;
import java.util.Arrays;
import java.util.HashSet;
@@ -35,6 +36,7 @@
import org.teiid.metadata.CompositeMetadataStore;
import org.teiid.metadata.TransformationMetadata;
+import com.metamatrix.core.util.ObjectConverterUtil;
import com.metamatrix.core.util.UnitTestUtil;
import com.metamatrix.dqp.message.RequestID;
import com.metamatrix.query.metadata.QueryMetadataInterface;
@@ -108,7 +110,7 @@
DataTierManagerImpl dataMgr = new DataTierManagerImpl(core, null, null, 0, 0, 0);
doProcess(metadata,
sql,
- finder, dataMgr , new List[0], DEBUG);
+ finder, dataMgr , new List[] {Arrays.asList(new String(ObjectConverterUtil.convertToByteArray(new FileInputStream(UnitTestUtil.getTestDataFile("test-schema.xsd")))))}, DEBUG); //$NON-NLS-1$
}
Added: trunk/test-integration/common/src/test/resources/test-schema.xsd
===================================================================
--- trunk/test-integration/common/src/test/resources/test-schema.xsd (rev 0)
+++ trunk/test-integration/common/src/test/resources/test-schema.xsd 2010-03-19 16:17:09 UTC (rev 1977)
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsd:schema targetNamespace="http://www.metamatrix.com/XMLSchema/DataSets/XSDTypes" xmlns:XSDTypesNS="http://www.metamatrix.com/XMLSchema/DataSets/XSDTypes" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+
+ <xsd:annotation>
+ <xsd:documentation xml:lang="en">
+ MetaMatrix Data Set Library Version 1.1.
+ </xsd:documentation>
+ </xsd:annotation>
+
+ <xsd:complexType name="testelements">
+ <xsd:sequence maxOccurs="unbounded" minOccurs="0">
+ <xsd:element name="book" type="XSDTypesNS:testelement"/>
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:complexType name="testelement">
+ <xsd:annotation>
+ <xsd:documentation>
+ Flat representation of a book, consisting of full title, set of authors, publisher,
+ publication date, and edition. ISBN and book type are represented as attributes.
+ Book type is optional. Edition defaults to blank. There can be more than one
+ authors tag.
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:sequence>
+ <xsd:element name="datetime" type="xsd:dateTime"/>
+ <xsd:element name="double" type="xsd:double"/>
+ <xsd:element name="float" type="xsd:float"/>
+ <xsd:element name="gday" type="xsd:gDay"/>
+ <xsd:element name="gmonth" type="xsd:gMonth"/>
+ <xsd:element name="gmonthday" type="xsd:gMonthDay"/>
+ <xsd:element name="gyear" type="xsd:gYear"/>
+ <xsd:element name="gyearmonth" type="xsd:gYearMonth"/>
+ <xsd:element name="string" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:element name="test" type="XSDTypesNS:testelements"/>
+</xsd:schema>
Property changes on: trunk/test-integration/common/src/test/resources/test-schema.xsd
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/test-integration/db/src/main/java/org/teiid/test/framework/ConfigPropertyNames.java
===================================================================
--- trunk/test-integration/db/src/main/java/org/teiid/test/framework/ConfigPropertyNames.java 2010-03-19 01:45:14 UTC (rev 1976)
+++ trunk/test-integration/db/src/main/java/org/teiid/test/framework/ConfigPropertyNames.java 2010-03-19 16:17:09 UTC (rev 1977)
@@ -1,6 +1,6 @@
package org.teiid.test.framework;
-import org.teiid.plan.api.ExecutionProperties;
+import org.teiid.jdbc.ExecutionProperties;
import org.teiid.test.client.TestClientTransaction;
import org.teiid.test.framework.connection.ConnectionStrategy;
import org.teiid.test.framework.datasource.DataSource;
Modified: trunk/test-integration/db/src/main/java/org/teiid/test/framework/query/AbstractQueryTransactionTest.java
===================================================================
--- trunk/test-integration/db/src/main/java/org/teiid/test/framework/query/AbstractQueryTransactionTest.java 2010-03-19 01:45:14 UTC (rev 1976)
+++ trunk/test-integration/db/src/main/java/org/teiid/test/framework/query/AbstractQueryTransactionTest.java 2010-03-19 16:17:09 UTC (rev 1977)
@@ -95,8 +95,8 @@
@Override
protected void assignExecutionProperties(Statement stmt) {
- if (stmt instanceof org.teiid.jdbc.api.Statement) {
- org.teiid.jdbc.api.Statement statement = (org.teiid.jdbc.api.Statement) stmt;
+ if (stmt instanceof org.teiid.jdbc.TeiidStatement) {
+ org.teiid.jdbc.TeiidStatement statement = (org.teiid.jdbc.TeiidStatement) stmt;
Properties executionProperties = this.connStrategy.getEnvironment();
if (executionProperties != null) {
14 years, 10 months
teiid SVN: r1976 - in trunk/documentation/server-extensions-guide/src/main/docbook/en-US: content and 1 other directory.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2010-03-18 21:45:14 -0400 (Thu, 18 Mar 2010)
New Revision: 1976
Removed:
trunk/documentation/server-extensions-guide/src/main/docbook/en-US/content/custom-membership.xml
Modified:
trunk/documentation/server-extensions-guide/src/main/docbook/en-US/content/appendix-a.xml
trunk/documentation/server-extensions-guide/src/main/docbook/en-US/content/introduction.xml
trunk/documentation/server-extensions-guide/src/main/docbook/en-US/content/security.xml
trunk/documentation/server-extensions-guide/src/main/docbook/en-US/server_extensions_guide.xml
Log:
TEIID-877 cleansed the extension doc for 7.0
Modified: trunk/documentation/server-extensions-guide/src/main/docbook/en-US/content/appendix-a.xml
===================================================================
--- trunk/documentation/server-extensions-guide/src/main/docbook/en-US/content/appendix-a.xml 2010-03-19 00:20:58 UTC (rev 1975)
+++ trunk/documentation/server-extensions-guide/src/main/docbook/en-US/content/appendix-a.xml 2010-03-19 01:45:14 UTC (rev 1976)
@@ -1,29 +1,6 @@
<appendix id="advanced_topics">
<title>Advanced Topics</title>
<sect1>
- <title>Authentication Interceptor</title>
- <para>In some circumstances a trusted payload may be applicable to authenticating in several membership
- domains or may be a secondary authentication method for a built-in LDAP membership domain. In these
- situations a custom membership domain (intercepting domain) may be introduced at the beginning of the domain
- list to authenticate into other domains. To achieve this, the SuccessfulAuthenticationToken returned by the
- intercepting domain should contain a fully qualified user name to a target domain. </para>
- <para />
- <para>The interceptor domain may be solely focused on authentication. If it only authenticates into other
- domains, then the interceptor domain may provide dummy implementations of the getGroupNames and
- getGroupNamesforUser methods.</para>
- </sect1>
- <sect1>
- <title>Deployment Considerations</title>
- <para>Membership domains are not individual services that can be independently configured within a
- cluster, rather they are dependent upon Membership Service instances. Each installed membership domain
- instance will be active on each MMProcess with a Membership Service. </para>
- <para />
- <para>NOTE: Since the Membership Service cannot be restarted changes to membership domain configurations
- require bouncing the Teiid Server before taking effect. It follows also that if a custom membership is
- not written to recover gracefully from connectivity or other environmental issues a server restart is
- required to re-initialize the membership domain.</para>
- </sect1>
- <sect1>
<title>Migration From Previous Versions</title>
<para>It is recommended that customers who have utilized the internal JDBC membership domain from releases
prior to MetaMatrix 5.5 migrate those users and groups to an LDAP compliant directory server. Several free
@@ -40,8 +17,6 @@
Apache Directory Server
<ulink url="http://directory.apache.org/">http://directory.apache.org/</ulink>
</para>
- <para>Implementations of the MembershipDomainInterface interface from releases prior to
- MetaMatrix 5.5 will need to be manually migrated to the new MembershipDomain interface. </para>
<para>If there are additional questions or the need for guidance in the migration process, please contact
technical support.</para>
</sect1>
Deleted: trunk/documentation/server-extensions-guide/src/main/docbook/en-US/content/custom-membership.xml
===================================================================
--- trunk/documentation/server-extensions-guide/src/main/docbook/en-US/content/custom-membership.xml 2010-03-19 00:20:58 UTC (rev 1975)
+++ trunk/documentation/server-extensions-guide/src/main/docbook/en-US/content/custom-membership.xml 2010-03-19 01:45:14 UTC (rev 1976)
@@ -1,216 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
-<chapter id="custom_membership">
- <title>Custom Membership Domains</title>
- <sect1>
- <title>Creating a Custom Membership Domain</title>
- <para>The creation of a custom membership domain based upon the MembershipDomain interface allows for easy
- extensibility of the Teiid security system. The API and associate classes are focused solely on
- conveying authentication and group information. At this time other development concerns, such as access to
- the internal logging facilities, are not documented or generally available to custom membership domain
- implementors.</para>
- <para>Within the development IDE of choice the custom membership domain developer should add the
- server-api.jar to project's classpath. From there the MembershipDomain interface and the related classes can
- be extended to create custom membership domain.</para>
- <para>Custom membership domains should be implemented to the specific needs of the external security
- system. For example, in cases where explicit initialization or shutdown is not applicable the
- implementations of these methods may be left empty.</para>
- <para>For membership domains that do require configuration information, the initialization method provides a
- built-in mechanism for provide a specific set of values. Each instance of a custom membership domain defined
- through the Console can have a different properties file to drive its initialization. The lookup of a
- properties file specified through the console will search the classpath, the filesystem, and finally as a URL
- in that order. </para>
- <para>Once the classes that represent the custom membership domain have been implemented they can be made
- available to a server installation by adding their jar file into the <server install root>/lib/patches directory. If the server
- is part of a multi-host cluster, the jar must be added to each host running a Membership Service.</para>
- <para>From there the Console can be used to install and configure the custom membership domain for use in
- the server environment. See the Console Guide for detailed instructions.</para>
- <sect2>
- <title>Membership Domain API</title>
- <para>
- The com.metamatrix.platform.security.membership.spi.MembershipDomain
- interface must be implemented to create a custom membership domain. The implementation class will then be
- installed and configured in server to enable the custom membership domain.
- </para>
- </sect2>
- <sect2>
- <title>File Membership Domain Example</title>
- <para>The following section contains an example of a membership domain that uses simple text files to
- determine user authentication and group membership. The users are listed in a properties file containing
- username=password entries. The group memberships are listed in a properties file containing comma
- groupname=[username[,username]*] entries.</para>
- <programlisting><![CDATA[
-import ...
-
-public class FileMembershipDomain implements MembershipDomain {
- public static final String USERS_FILE = "usersFile";
- public static final String GROUPS_FILE = "groupsFile";
- public static final String CHECK_PASSWORD = "checkPassword";
-
- private boolean checkPasswords;
- private Properties users;
- private HashMap groups = new HashMap();
- private HashMap userGroups = new HashMap();
-
- private Properties loadFile(String fileName) throws ServiceStateException {
- Properties result = new Properties();
-
- //try the classpath
- InputStream is = this.getClass().getResourceAsStream(fileName);
-
- if (is == null) {
- try {
- //try the filesystem
- is = new FileInputStream(fileName);
- } catch (FileNotFoundException err) {
- try {
- //try a url
- is = new URL(fileName).openStream();
- } catch (MalformedURLException err1) {
- throw new ServiceStateException(err, "Could not load file "+fileName+" for FileMembershipDomain");
- } catch (IOException err1) {
- throw new ServiceStateException(err1, "Could not load file "+fileName+" for FileMembershipDomain");
- }
- }
- }
-
- try {
- result.load(is);
- } catch (IOException err) {
- throw new ServiceStateException(err, "Could not load file "+fileName+" for FileMembershipDomain");
- } finally {
- try {
- is.close();
- } catch (IOException err) {
- }
- }
- return result;
- }
-
- public void shutdown() throws ServiceStateException {
- }
-
-.... <covered in the next pages> ...
-
-}
- ]]></programlisting>
-
- <para>The above snippet is shows a class that implements the MembershipDomain interface. In this example no
- meaningful is performed in the shutdown method, so its implementation is left empty. The loadFile method is a
- simple utility method that will be used to load the users and groups files during initialization (shown in the
- next snippet).</para>
-
- <programlisting><![CDATA[
-public void initialize(Properties env) throws ServiceStateException {
- checkPasswords = Boolean.valueOf(env.getProperty(CHECK_PASSWORD, Boolean.TRUE.toString())).booleanValue();
-
- String userFile = env.getProperty(USERS_FILE);
- String groupFile = env.getProperty(GROUPS_FILE);
-
- if (userFile == null) {
- throw new ServiceStateException("Required property " +USERS_FILE+ " was missing.");
- }
-
- users = loadFile(userFile);
-
- if (groupFile == null) {
- throw new ServiceStateException("Required property " +GROUPS_FILE+ " was missing.");
- }
-
- groups.clear();
- groups.putAll(loadFile(groupFile));
- userGroups.clear();
- for (Iterator i = groups.entrySet().iterator(); i.hasNext();) {
- Map.Entry entry = (Map.Entry)i.next();
- String group = (String)entry.getKey();
- String userNames = (String)entry.getValue();
- String[] groupUsers = userNames.split(","); //$NON-NLS-1$
-
- for (int j = 0; j < groupUsers.length; j++) {
- String user = groupUsers[j].trim();
- Set uGroups = (Set)userGroups.get(user);
- if (uGroups == null) {
- uGroups = new HashSet();
- userGroups.put(user, uGroups);
- }
- uGroups.add(group);
- }
- }
-}
- ]]></programlisting>
- <para>The initialize method is written to expect two properties “usersFile” and “groupsFile”. Values for these
- properties should be defined in the properties file specified in the “properties file” connector binding. An
- optional property “checkPasswords” may be specified that will determine if the membership domain should check
- the credentials specified as passwords.</para>
- <programlisting><![CDATA[
-public SuccessfulAuthenticationToken authenticateUser(String username, Credentials credential,Serializable trustedPayload, String applicationName)
- throws UnsupportedCredentialException,InvalidUserException,LogonException,MembershipSourceException {
- if (username == null || credential == null) {
- throw new UnsupportedCredentialException("a username and password must be supplied for this domain");
- }
-
- String password = (String)users.get(username);
-
- if (password == null) {
- throw new InvalidUserException("user " + username + " is invalid");
- }
-
- if (!checkPasswords || password.equals(String.valueOf(credential.getCredentialsAsCharArray()))) {
- return new SuccessfulAuthenticationToken(trustedPayload, username);
- }
-
- throw new LogonException("user " + username + " could not be authenticated");
-}
- ]]></programlisting>
- <para>The authenticateUser method implementation demonstrates several possible outcomes for an authentication
- attempt. If a user name and password (in the form of a Credentials object) are not supplied the domain will
- indicate that it does not support the authentication attempt. In this case for unqualified logons,
- authentication would proceed to the next membership domain.</para>
- <para />
- <para>If a password cannot be found for the user name cannot be found in the users file, then the domain
- reports that the user is not valid for the current domain. As with the previous case, unqualified logons would
- proceed to the next membership domain. </para>
- <para />
- <para>If the domain is not checking passwords or the password value matches the supplied credentials, the
- membership domain returns a SuccessfulAuthenticationToken. This token may contain an augmented value of the
- trustedPayload, however in this example the value that was passed in is returned unchanged.</para>
- <para />
- <para>Finally if authentication was not successful, a LogonException is thrown to indicate the user has
- failed authentication. Authentication failure due to a LogonException will immediately fail the overall user
- authentication even with an unqualified logon.</para>
- <para />
- <para>NOTE: The message text, and any chained exceptions, in an UnsupportedCredentialException,
- InvalidUserException, or LogonException will appear in server log.</para>
-
- <programlisting><![CDATA[
-public Set getGroupNames() throws MembershipSourceException {
- Set resultNames = new HashSet(groups.keySet());
- return resultNames;
-}
-
-public Set getGroupNamesForUser(String username) throws InvalidUserException,
- MembershipSourceException {
- // See if this user is in the domain
- if (!users.containsKey(username)) {
- throw new InvalidUserException("user " + username + " is invalid");
- }
-
- Set usersGroups = (Set)userGroups.get(username);
- if (usersGroups == null) {
- return Collections.EMPTY_SET;
- }
- return usersGroups;
-}
- ]]></programlisting>
-
- <para>The last two methods needed to implement the MembershipDomain interface are shown above. The
- getGroupNames method returns all known group names from the groups file. The getGroupNamesForUser method
- returns all groups for the given user. The mapping from users to groups was established in the initialize
- method.</para>
- <para />
- <para>NOTE: It is important that the return values from all of the MembershipDomain methods are Serializable</para>
- <para>NOTE: The preceding example is case sensitive with respect to user names. The Teiid system does
- not require logons to be case insensitive. That is up to the implementation of the member domain.</para>
- </sect2>
- </sect1>
-</chapter>
\ No newline at end of file
Modified: trunk/documentation/server-extensions-guide/src/main/docbook/en-US/content/introduction.xml
===================================================================
--- trunk/documentation/server-extensions-guide/src/main/docbook/en-US/content/introduction.xml 2010-03-19 00:20:58 UTC (rev 1975)
+++ trunk/documentation/server-extensions-guide/src/main/docbook/en-US/content/introduction.xml 2010-03-19 01:45:14 UTC (rev 1976)
@@ -2,18 +2,14 @@
<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
<chapter id="introduction">
<title>Introduction</title>
- <para>This guide introduces to all the user extensions that are supported by the Teiid server. These
- extensions are provided to let user introduce custom functionality into their deployment of the server.
- All the extensions are provided though implementing Java based API.</para>
-
- <para>The following are the currently available extensions</para>
- <orderedlist>
- <listitem>
- <para><link linkend="custom_security">Teiid Security</link></para>
- </listitem>
- <listitem>
- <para><link linkend="command_logging">Command Logging</link></para>
- </listitem>
- </orderedlist>
+ <para>This guide introduces the extensions supported by Teiid to introduce custom functionality.</para>
+ <orderedlist>
+ <listitem>
+ <para><link linkend="custom_security">Teiid Security</link></para>
+ </listitem>
+ <listitem>
+ <para><link linkend="command_logging">Command Logging</link></para>
+ </listitem>
+ </orderedlist>
</chapter>
\ No newline at end of file
Modified: trunk/documentation/server-extensions-guide/src/main/docbook/en-US/content/security.xml
===================================================================
--- trunk/documentation/server-extensions-guide/src/main/docbook/en-US/content/security.xml 2010-03-19 00:20:58 UTC (rev 1975)
+++ trunk/documentation/server-extensions-guide/src/main/docbook/en-US/content/security.xml 2010-03-19 01:45:14 UTC (rev 1976)
@@ -1,111 +1,93 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
<chapter id="custom_security">
- <title>Teiid Security</title>
- <sect1>
- <title>Teiid Security</title>
- <sect2>
- <title>Introduction</title>
- <para>The Teiid system provides a range of built-in and extensible security features to enable the
- secure access of data. </para>
- <para />
- <para>For more detailed information see the:</para>
- <orderedlist>
- <listitem>
- <para>Console Guide – for instructions on how to set a range of security
- settings, on installing Membership Domains, and on setting up roles.</para>
- </listitem>
- <listitem>
- <para>Connector Developers Guide – for information on how custom connectors can be
- developed with advanced security features.</para>
- </listitem>
- <listitem>
- <para>Web Services Guide – for information on how to secure web service
- access to Teiid</para>
- </listitem>
- <listitem>
- <para>Client Developers Guide – for information on how to authenticate
- through JDBC and ODBC.</para>
- </listitem>
- </orderedlist>
- </sect2>
- <sect2>
- <title>Authentication</title>
- <para>JDBC, ODBC, and web service clients may use simple passwords, a pass-through mechanism called a
- trusted payload, or a combination of that and related information to authenticate a user. </para>
- <para />
- <para>Typically a user name is required, however user names may be considered optional if the
- identity of the user can be discerned from the trusted payload or another mechanism. In any case it is up
- to the installed membership domains to actually determine whether a user can be authenticated.</para>
- <para />
- <para>NOTE: All passwords or security credentials that are passed through the Teiid system will
- either be encrypted or sent of an encrypted transport by default.</para>
- </sect2>
- <sect2>
- <title>Authorization</title>
- <para>Authorization is split into three areas of concern. Admin roles, repository roles, and
- data roles can be managed in the Console to enforce authorization of administrative tasks, the MetaBase
- repository, and enterprise data respectively. A role is simply a collection of permissions and a
- collection of entitled principals. Currently the Teiid security system only allows principals that
- represent groups to be assigned to a role. The set of available groups are determined by the installed
- membership domains.</para>
- </sect2>
- </sect1>
- <sect1>
- <title> Membership Domains</title>
- <para>Membership domains are at the core of Teiid’s security system and bridge the gap between
- Teiid and an external security system. A membership domain provides:</para>
- <itemizedlist>
- <listitem>
- <para>User authentication</para>
- </listitem>
- <listitem>
- <para>A set of groups</para>
- </listitem>
- <listitem>
- <para>The groups to which an authenticated user belongs</para>
- </listitem>
- </itemizedlist>
- <para>Access to membership domains is coordinated through the Membership Service. The Membership
- Service together with the Authorization Service implement the necessary logic to authenticate users,
- determine role membership, and to enforce roles.</para>
- <para>
- There are multiple types of membership domains that allow for connectivity to different security systems.
- A Teiid server environment can be configured with multiple membership domains (there can be multiple
- instances of a given membership domain type). Each membership domain instance must be assigned a unique
- domain name in the Teiid system. The domain name can be used to fully qualify user names to
- authenticate only against that domain. The format for a qualified name is
- <ulink url="mailto:username@domain">username@domainname.</ulink>
- </para>
- <para>If a user name is not fully qualified, then the installed membership domains will be consulted in
- order until a domain successfully or unsuccessfully authenticates the user. If a membership domain reports
- the user does not exist or that the credentials are not recognized, that is not considered an unsuccessful
- authentication and the next membership domain will be consulted.</para>
- <para>If no membership domain can authenticate the user, the logon attempt will fail. For any failed logon
- attempt the message the users sees will always be the same. It will simply indicate the user could not be
- authenticated by any membership domain – it will not reveal any further details which could potentially be
- sensitive information. Details including invalid users, which domains were consulted, etc. will be in the
- server log with appropriate levels of severity.</para>
- <sect2>
- <title>Built-in Membership Domains</title>
- <para>The Teiid System provides LDAP and File membership domain types. </para>
- <para>The LDAP membership domain provides flexible integration with a variety of LDAP servers through JNDI
- (Java Naming and Directory Interface). Enterprise environments with an LDAP compliant directory server
- should attempt to utilize the built-in LDAP membership domain before attempting to create a custom
- solution.</para>
- <para>The File membership domain utilizes a simple set of text files to authenticate users and to define
- their groups. Please note however that the File membership domain is not intended for production use.
- </para>
- <para>Instructions for configuring both of these can be found in the Teiid Console Guide.</para>
- <para>Support will be added for additional membership domains with subsequent releases.</para>
- </sect2>
- <sect2>
- <title>Custom Membership Domains</title>
- <para>In circumstances not covered by a built-in membership domain, a custom membership domain allows the
- Teiid security system to interact seamlessly with other enterprise security providers. </para>
- <para>Java development is required to implement a custom membership domain. The API and a full example
- are covered in the following chapters of this document.</para>
- </sect2>
- </sect1>
-
+ <title>Teiid Security</title>
+ <para>The Teiid system provides a range of built-in and extensible
+ security features to enable the
+ secure access of data. </para>
+ <sect1>
+ <title>Authentication</title>
+ <para>JDBC clients may use simple passwords to authenticate a user.
+ </para>
+ <para>Typically a user name is required, however user names may be
+ considered optional if the
+ identity of the user can be discerned by
+ the password credential alone. In
+ any case it is up
+ to the configured
+ security domain to determine whether a user can be
+ authenticated.
+ </para>
+ </sect1>
+ <sect1>
+ <title>Authorization</title>
+ <para>Authorization covers both administrative activities and
+ data
+ roles. A data role is a collection of permissions (also referred to
+ as entitlements) and a
+ collection of entitled principals or groups.
+ With the deployment of a VDB
+ the deployer can choose which principals
+ and groups have which data roles.</para>
+ </sect1>
+ <sect1>
+ <title>Encryption</title>
+ <para>At a transport level Teiid provides built-in support for JDBC
+ over SSL or just sensitive message encryption when SSL is not in use.
+ </para>
+ <para>
+ Passwords in configuration files however are by default stored in
+ plain text. If you need these values to be encrypted, please see
+ <ulink
+ url="http://community.jboss.org/wiki/maskingpasswordsinjbossasxmlconfiguration">encrypting passwords</ulink>
+ for instructions on encryption facilities provided by the container.
+ </para>
+ </sect1>
+ <sect1>
+ <title>LoginModules</title>
+ <para>
+ LoginModules are an essential part of the JAAS security
+ framework and provide Teiid customizable user authentication and the
+ ability to reuse existing LoginModules defined for JBossAS. See
+ <ulink
+ url="http://docs.jboss.org/jbossas/admindevel326/html/ch8.chapter.html">JBossAS Security</ulink>
+ for general information on configuring security in JBossAS.</para>
+ <para>
+ Teiid can be configured with multiple named application policies
+ that group together relevant LoginModules. Each of these application
+ policy (or domains) names can be used to fully
+ qualify user names to
+ authenticate only against that domain. The format for a qualified
+ name is username@domainname.
+ </para>
+ <para>If a user name is not fully qualified, then the installed
+ domains will be consulted in order until a domain
+ successfully or unsuccessfully authenticates the
+ user.
+ </para>
+ <para>If no domain can authenticate the user, the logon
+ attempt will fail.
+ Details of the failed attempt including invalid users, which
+ domains were consulted, etc. will be in the server log with appropriate
+ levels of severity.</para>
+ <sect2>
+ <title>Built-in LoginModules</title>
+ <para>JBossAS provides several LoginModules for common authentication needs, such as authenticating from text files or LDAP.</para>
+ <para>The UsersRolesLoginModule, which utilizes simple text files
+ to authenticate users and to define
+ their groups. The teiid-jboss-beans.xml configuration file contains an example of how to use UsersRolesLoginModule.
+ Note that this is typically not for production use.
+ </para>
+ <para>See <ulink url="http://community.jboss.org/docs/DOC-11253">LDAP LoginModule configuration</ulink> for utilizing LDAP based authentication.
+ </para>
+ </sect2>
+ <sect2>
+ <title>Custom LoginModules</title>
+ <para>
+ If your authentication needs go beyond the provided LoginModules, please consult the
+ <ulink url="http://java.sun.com/j2se/1.5.0/docs/guide/security/jaas/JAASLMDevGuide.html">JAAS development guide</ulink>.
+ There are also numerous guides available.
+ </para>
+ </sect2>
+ </sect1>
</chapter>
\ No newline at end of file
Modified: trunk/documentation/server-extensions-guide/src/main/docbook/en-US/server_extensions_guide.xml
===================================================================
--- trunk/documentation/server-extensions-guide/src/main/docbook/en-US/server_extensions_guide.xml 2010-03-19 00:20:58 UTC (rev 1975)
+++ trunk/documentation/server-extensions-guide/src/main/docbook/en-US/server_extensions_guide.xml 2010-03-19 01:45:14 UTC (rev 1976)
@@ -48,7 +48,6 @@
<xi:include href="content/introduction.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
<xi:include href="content/logging.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
<xi:include href="content/security.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
- <xi:include href="content/custom-membership.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
<xi:include href="content/appendix-a.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
</book>
14 years, 10 months
teiid SVN: r1975 - in trunk: client/src/main/java/com/metamatrix/platform/security/api and 16 other directories.
by teiid-commits@lists.jboss.org
Author: rareddy
Date: 2010-03-18 20:20:58 -0400 (Thu, 18 Mar 2010)
New Revision: 1975
Added:
trunk/client/src/main/java/org/teiid/adminapi/DataPolicy.java
trunk/client/src/main/java/org/teiid/adminapi/impl/DataPolicyMetadata.java
trunk/client/src/main/java/org/teiid/adminapi/impl/PermissionMap.java
trunk/client/src/test/java/org/teiid/adminapi/impl/TestDataPolicyMetaData.java
Removed:
trunk/client/src/main/java/com/metamatrix/platform/security/api/MetaMatrixPrincipal.java
trunk/client/src/main/java/com/metamatrix/platform/security/api/MetaMatrixPrincipalName.java
trunk/client/src/main/java/org/teiid/adminapi/AdminRoles.java
trunk/client/src/main/java/org/teiid/adminapi/DataRole.java
trunk/client/src/main/java/org/teiid/adminapi/impl/DataRoleMetadata.java
trunk/engine/src/main/java/com/metamatrix/api/exception/security/AuthorizationException.java
trunk/engine/src/main/java/com/metamatrix/api/exception/security/AuthorizationMgmtException.java
trunk/engine/src/main/java/com/metamatrix/dqp/service/AuthorizationService.java
trunk/engine/src/main/java/org/teiid/security/roles/
trunk/engine/src/main/resources/org/teiid/security/roles/
trunk/engine/src/test/java/com/metamatrix/dqp/service/FakeAuthorizationService.java
trunk/runtime/src/main/java/org/teiid/services/AuthorizationServiceImpl.java
trunk/runtime/src/test/java/com/metamatrix/platform/security/api/
Modified:
trunk/build/kit-jboss-container/deploy/teiid/teiid-jboss-beans.xml
trunk/client/src/main/java/org/teiid/adminapi/VDB.java
trunk/client/src/main/java/org/teiid/adminapi/impl/ListOverMap.java
trunk/client/src/main/java/org/teiid/adminapi/impl/VDBMetaData.java
trunk/client/src/main/resources/vdb-deployer.xsd
trunk/client/src/test/java/org/teiid/adminapi/impl/TestVDBMetaData.java
trunk/engine/src/main/java/com/metamatrix/dqp/service/SessionService.java
trunk/engine/src/main/java/org/teiid/dqp/internal/process/DQPConfiguration.java
trunk/engine/src/main/java/org/teiid/dqp/internal/process/DQPCore.java
trunk/engine/src/main/java/org/teiid/dqp/internal/process/DQPWorkContext.java
trunk/engine/src/main/java/org/teiid/dqp/internal/process/Request.java
trunk/engine/src/main/java/org/teiid/dqp/internal/process/validator/AuthorizationValidationVisitor.java
trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestPreparedStatement.java
trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestRequest.java
trunk/engine/src/test/java/org/teiid/dqp/internal/process/validator/TestAuthorizationValidationVisitor.java
trunk/jboss-integration/src/main/java/org/teiid/jboss/deployers/RuntimeEngineDeployer.java
Log:
TEIID-1017: step(2) Associating data policies read from the vdb.xml file into the engine that they can be enforced by the Teiid runtime. This removed the old authorization framework as the complexity may not be required here.
Modified: trunk/build/kit-jboss-container/deploy/teiid/teiid-jboss-beans.xml
===================================================================
--- trunk/build/kit-jboss-container/deploy/teiid/teiid-jboss-beans.xml 2010-03-18 18:26:59 UTC (rev 1974)
+++ trunk/build/kit-jboss-container/deploy/teiid/teiid-jboss-beans.xml 2010-03-19 00:20:58 UTC (rev 1975)
@@ -18,12 +18,6 @@
</bind>
<!-- Teiid Services -->
- <bean name="AuthorizationService" class="org.teiid.services.AuthorizationServiceImpl">
- <property name="VDBRepository"><inject bean="VDBRepository"/></property>
- <!-- Turn on checking the entitlements on resources based on the roles defined in VDB -->
- <property name="useEntitlements" class="java.lang.Boolean">false</property>
- </bean>
-
<bean name="SessionService" class="org.teiid.services.SessionServiceImpl">
<property name="VDBRepository"><inject bean="VDBRepository"/></property>
<property name="securityHelper"><inject bean="SecurityHelper"/></property>
@@ -73,7 +67,6 @@
<property name="workManager"><inject bean="WorkManager"/></property>
<property name="XATerminator"><inject bean="TransactionManager" property="XATerminator"/></property>
<property name="transactionManager"><inject bean="TransactionManager" property="transactionManager"/></property>
- <property name="authorizationService"><inject bean="AuthorizationService"/></property>
<property name="sessionService"><inject bean="SessionService"/></property>
<property name="bufferService"><inject bean="BufferService"/></property>
<property name="connectorManagerRepository"><inject bean="ConnectorManagerRepository"/></property>
@@ -101,6 +94,8 @@
<property name="resultSetCacheMaxEntries">1024</property>
<!-- Enable Resultset Caching -->
<property name="resultSetCacheEnabled">true</property>
+ <!-- Turn on checking the entitlements on resources based on the roles defined in VDB -->
+ <property name="useEntitlements" class="java.lang.Boolean">false</property>
</bean>
<!-- JDBC Socket connection properties (SSL see below) -->
Deleted: trunk/client/src/main/java/com/metamatrix/platform/security/api/MetaMatrixPrincipal.java
===================================================================
--- trunk/client/src/main/java/com/metamatrix/platform/security/api/MetaMatrixPrincipal.java 2010-03-18 18:26:59 UTC (rev 1974)
+++ trunk/client/src/main/java/com/metamatrix/platform/security/api/MetaMatrixPrincipal.java 2010-03-19 00:20:58 UTC (rev 1975)
@@ -1,86 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package com.metamatrix.platform.security.api;
-
-import java.security.Principal;
-import java.util.Set;
-
-/**
- * This interface represents an abstract notion of users, groups or applications
- * within the MetaMatrix Security Framework. MetaMatrixPrincipal is anlogous
- * to java.security.Principal, which it extends from.
- */
-public interface MetaMatrixPrincipal extends Principal, Cloneable {
-
- // JPC 07/07/2005
- // These constants were copied to com.metamtrix.admin.server package
- // (instead of moved - for dependancy reasons) so any changes
- // made here should also be made there.
- // Better yet, these should be moved there and dependanies resolved
- static final int TYPE_USER = 0;
- static final int TYPE_GROUP = 1;
- static final int TYPE_ADMIN = 2;
-
- public static final String TYPE_LABEL_USER = "User"; //$NON-NLS-1$
- public static final String TYPE_LABEL_GROUP = "Group"; //$NON-NLS-1$
- public static final String TYPE_LABEL_ADMIN = "Admin"; //$NON-NLS-1$
-
-
- // User and Group names can be no longer then this
- public static final int NAME_LEN_LIMIT = 1024;
-
- static final String[] TYPE_NAMES = new String[] {TYPE_LABEL_USER, TYPE_LABEL_GROUP, TYPE_LABEL_ADMIN};
-
- /**
- * Get the <code>MetaMatrixPrincipalName</code> for this principal.
- * @see MetaMatrixPrincipaName.
- * @return the <code>MetaMatrixPrincipalName</code> for this principal.
- */
- MetaMatrixPrincipalName getMetaMatrixPrincipalName();
-
- /**
- * Get the type of principal
- * @return the type for this principal
- */
- int getType();
-
- /**
- * Get the String form for the type of principal
- * @return the type for this principal as a String
- */
- String getTypeLabel();
-
- /**
- * Returns the Principal for each group that this principal is a member of.
- */
- Set getGroupNames();
-
- /**
- * Return a cloned instance of this object.
- * @return the object that is the clone of this instance.
- */
- Object clone();
-}
-
-
-
Deleted: trunk/client/src/main/java/com/metamatrix/platform/security/api/MetaMatrixPrincipalName.java
===================================================================
--- trunk/client/src/main/java/com/metamatrix/platform/security/api/MetaMatrixPrincipalName.java 2010-03-18 18:26:59 UTC (rev 1974)
+++ trunk/client/src/main/java/com/metamatrix/platform/security/api/MetaMatrixPrincipalName.java 2010-03-19 00:20:58 UTC (rev 1975)
@@ -1,136 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package com.metamatrix.platform.security.api;
-
-import java.io.Serializable;
-
-public class MetaMatrixPrincipalName implements Serializable {
- private static final long serialVersionUID = 4630832657093482302L;
- private int type;
- private String name;
-
- public MetaMatrixPrincipalName( String name, int type ) {
- if ( name == null || name.trim().length() == 0 ) {
- throw new IllegalArgumentException("illegal name " + name); //$NON-NLS-1$
- }
- if ( name.trim().length() > MetaMatrixPrincipal.NAME_LEN_LIMIT ) {
- throw new IllegalArgumentException("name too long " + name); //$NON-NLS-1$
- }
- if ( type < MetaMatrixPrincipal.TYPE_USER || type > MetaMatrixPrincipal.TYPE_ADMIN ) {
- throw new IllegalArgumentException("invalid type " + type); //$NON-NLS-1$
- }
- this.name = name;
- this.type = type;
- }
-
- protected MetaMatrixPrincipalName( MetaMatrixPrincipalName obj ) {
- if ( obj == null ) {
- throw new IllegalArgumentException("argument cannot be null"); //$NON-NLS-1$
- }
- this.type = obj.getType();
- this.name = obj.getName();
- }
-
- public boolean equals(Object obj){
- if( this == obj ){
- return true;
- }
-
- if(!(obj instanceof MetaMatrixPrincipalName)){
- return false;
- }
- MetaMatrixPrincipalName that = (MetaMatrixPrincipalName) obj;
- return this.type == that.type && this.name.compareTo(that.name) == 0;
- }
-
- /**
- * Compares this object to another. If the specified object is
- * an instance of the MetaMatrixPrincipalName class, then this
- * method compares the contents; otherwise, it throws a
- * ClassCastException (as instances are comparable only to
- * instances of the same
- * class).
- * <p>
- * Note: this method <i>is</i> consistent with
- * <code>equals()</code>, meaning
- * that
- * <code>(compareTo(x, y)==0) == (x.equals(y))</code>.
- * <p>
- * @param obj the object that this instance is to be compared to.
- * @return a negative integer, zero, or a positive integer as this object
- * is less than, equal to, or greater than the specified object, respectively.
- * @throws IllegalArgumentException if the specified object reference is null
- * @throws ClassCastException if the specified object's type prevents it
- * from being compared to this instance.
- */
- public int compareTo(Object obj) {
- MetaMatrixPrincipalName that = (MetaMatrixPrincipalName)obj; // May throw ClassCastException
- int comp = this.name.compareTo(that.name);
- if ( comp == 0 ) {
- comp = this.type - that.type;
- }
- return comp;
- }
-
- /**
- * Get the type of principal
- * @return the type for this principal
- */
- public int getType() {
- return type;
- }
-
- /**
- * Get the String form for the type of principal.
- * @return the type for this principal as a String
- */
- public String getTypeLabel() {
- return MetaMatrixPrincipal.TYPE_NAMES[this.type];
- }
-
- /**
- * Returns the name of this principal.
- * @return the name of this principal (never null)
- */
- public String getName(){
- return name;
- }
-
- public int hashCode(){
- return name.hashCode();
- }
-
- public String toString(){
- StringBuffer sb = new StringBuffer();
- sb.append("[Name=\""); //$NON-NLS-1$
- sb.append(this.getName());
- sb.append("\" - Type=\""); //$NON-NLS-1$
- sb.append( MetaMatrixPrincipal.TYPE_NAMES[this.type] );
- sb.append("\"]"); //$NON-NLS-1$
- return sb.toString();
- }
-
-}
-
-
-
Deleted: trunk/client/src/main/java/org/teiid/adminapi/AdminRoles.java
===================================================================
--- trunk/client/src/main/java/org/teiid/adminapi/AdminRoles.java 2010-03-18 18:26:59 UTC (rev 1974)
+++ trunk/client/src/main/java/org/teiid/adminapi/AdminRoles.java 2010-03-19 00:20:58 UTC (rev 1975)
@@ -1,79 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package org.teiid.adminapi;
-
-import java.util.HashSet;
-import java.util.Set;
-
-/**
- * Static class that lists the roles allowable in the MetaMatrix system.
- *
- * <p>This class can be used to get a list of all allowable administrative role
- * names or the name of one role to assign to a principal.</p>
- * @since 4.3
- */
-public class AdminRoles {
- private static final Set roleSet;
-
- static {
- roleSet = new HashSet();
- roleSet.add(RoleName.ADMIN_SYSTEM);
- roleSet.add(RoleName.ADMIN_PRODUCT);
- roleSet.add(RoleName.ADMIN_READONLY);
- }
-
- /**
- * Get the set of static MetaMatrix administrative roles known to the system.
- * @return the <code>Set</code> of <code>String</code> role names.
- * @since 4.3
- */
- public static Set<String> getAllRoleNames() {
- return roleSet;
- }
-
- /**
- * Determine whether an admin role exists by the given <code>roleName</code>.
- * @param roleName the name for which to validate.
- * @return <code>true</code> iff an admin role exists with the given role name.
- * @since 4.3
- */
- public static boolean containsRole(String roleName) {
- return roleSet.contains(roleName);
- }
-
- /**
- * Static class that defines defines the allowed administrative roles
- * for the MetaMatrix system.
- * @since 4.3
- */
- public static class RoleName {
- /** System admin role name */
- public static final String ADMIN_SYSTEM = "Admin.SystemAdmin"; //$NON-NLS-1$
- /** Product admin role name */
- public static final String ADMIN_PRODUCT = "Admin.ProductAdmin"; //$NON-NLS-1$
- /** Read-only admin role name */
- public static final String ADMIN_READONLY = "Admin.ReadOnlyAdmin"; //$NON-NLS-1$
-
- public static final String ANONYMOUS = "Anonymous"; //$NON-NLS-1$
- }
-}
Copied: trunk/client/src/main/java/org/teiid/adminapi/DataPolicy.java (from rev 1974, trunk/client/src/main/java/org/teiid/adminapi/DataRole.java)
===================================================================
--- trunk/client/src/main/java/org/teiid/adminapi/DataPolicy.java (rev 0)
+++ trunk/client/src/main/java/org/teiid/adminapi/DataPolicy.java 2010-03-19 00:20:58 UTC (rev 1975)
@@ -0,0 +1,86 @@
+/*
+ * 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;
+
+import java.util.List;
+
+public interface DataPolicy {
+
+ public enum PermissionType {CREATE, READ, UPDATE, DELETE};
+
+ /**
+ * Get the Name of the Data Policy
+ * @return
+ */
+ String getName();
+
+ /**
+ * Get the description of the Data Policy
+ * @return
+ */
+ String getDescription();
+
+ /**
+ * Get the List of Permissions for this Data Policy.
+ * @return
+ */
+ List<DataPermission> getPermissions();
+
+ /**
+ * Mapped Container Role names for this Data Policy
+ * @return
+ */
+ List<String> getMappedRoleNames();
+
+
+ interface DataPermission {
+ /**
+ * Get the Resource Name that Data Permission representing
+ * @return
+ */
+ String getResourceName();
+
+ /**
+ * Is "CREATE" allowed?
+ * @return
+ */
+ boolean isAllowCreate();
+
+ /**
+ * Is "SELECT" allowed?
+ * @return
+ */
+ boolean isAllowRead();
+
+ /**
+ * Is "INSERT/UPDATE" allowed?
+ * @return
+ */
+ boolean isAllowUpdate();
+
+ /**
+ * Is "DELETE" allowed?
+ * @return
+ */
+ boolean isAllowDelete();
+ }
+}
Property changes on: trunk/client/src/main/java/org/teiid/adminapi/DataPolicy.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Deleted: trunk/client/src/main/java/org/teiid/adminapi/DataRole.java
===================================================================
--- trunk/client/src/main/java/org/teiid/adminapi/DataRole.java 2010-03-18 18:26:59 UTC (rev 1974)
+++ trunk/client/src/main/java/org/teiid/adminapi/DataRole.java 2010-03-19 00:20:58 UTC (rev 1975)
@@ -1,83 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-package org.teiid.adminapi;
-
-import java.util.List;
-
-public interface DataRole {
- /**
- * Get the Name of the Data Role
- * @return
- */
- String getName();
-
- /**
- * Get the description of the Data Role
- * @return
- */
- String getDescription();
-
- /**
- * Get the List of Permissions for this Data Role.
- * @return
- */
- List<Permission> getPermissions();
-
- /**
- * Mapped Container Role names for this Data Role
- * @return
- */
- List<String> getMappedRoleNames();
-
-
- interface Permission {
- /**
- * Get the Resource Name that Data Role representing
- * @return
- */
- String getResourceName();
-
- /**
- * Is "CREATE" allowed?
- * @return
- */
- boolean isAllowCreate();
-
- /**
- * Is "SELECT" allowed?
- * @return
- */
- boolean isAllowRead();
-
- /**
- * Is "INSERT/UPDATE" allowed?
- * @return
- */
- boolean isAllowUpdate();
-
- /**
- * Is "DELETE" allowed?
- * @return
- */
- boolean isAllowDelete();
- }
-}
Modified: trunk/client/src/main/java/org/teiid/adminapi/VDB.java
===================================================================
--- trunk/client/src/main/java/org/teiid/adminapi/VDB.java 2010-03-18 18:26:59 UTC (rev 1974)
+++ trunk/client/src/main/java/org/teiid/adminapi/VDB.java 2010-03-19 00:20:58 UTC (rev 1975)
@@ -93,5 +93,5 @@
* Get the data roles defined on this VDB
* @return
*/
- public List<DataRole> getDataRoles();
+ public List<DataPolicy> getDataPolicies();
}
Copied: trunk/client/src/main/java/org/teiid/adminapi/impl/DataPolicyMetadata.java (from rev 1974, trunk/client/src/main/java/org/teiid/adminapi/impl/DataRoleMetadata.java)
===================================================================
--- trunk/client/src/main/java/org/teiid/adminapi/impl/DataPolicyMetadata.java (rev 0)
+++ trunk/client/src/main/java/org/teiid/adminapi/impl/DataPolicyMetadata.java 2010-03-19 00:20:58 UTC (rev 1975)
@@ -0,0 +1,326 @@
+/*
+ * 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 java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+
+import org.jboss.managed.api.annotation.ManagementObject;
+import org.jboss.managed.api.annotation.ManagementObjectID;
+import org.jboss.managed.api.annotation.ManagementProperties;
+import org.jboss.managed.api.annotation.ManagementProperty;
+import org.teiid.adminapi.DataPolicy;
+
+
+(a)XmlAccessorType(XmlAccessType.NONE)
+@XmlType(name = "", propOrder = {
+ "description",
+ "permissions",
+ "mappedRoleNames"
+})
+(a)ManagementObject(properties=ManagementProperties.EXPLICIT)
+public class DataPolicyMetadata implements DataPolicy, Serializable {
+ private static final long serialVersionUID = -4119646357275977190L;
+
+ @XmlAttribute(name = "name", required = true)
+ protected String name;
+ @XmlElement(name = "description")
+ protected String description;
+
+ @XmlElement(name = "permission")
+ protected PermissionMap permissions = new PermissionMap(new KeyBuilder<PermissionMetaData>() {
+ private static final long serialVersionUID = -6992984146431492449L;
+ @Override
+ public String getKey(PermissionMetaData entry) {
+ return entry.getResourceName();
+ }
+ });
+
+ @XmlElement(name = "mapped-role-name")
+ protected List<String> mappedRoleNames;
+
+ @Override
+ @ManagementProperty(description="Policy Name")
+ @ManagementObjectID(type="policy")
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String value) {
+ this.name = value;
+ }
+
+ @Override
+ @ManagementProperty(description="Policy Description")
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String value) {
+ this.description = value;
+ }
+
+ @Override
+ @ManagementProperty(description="Permissions in a Data Policy", managed=true)
+ public List<DataPermission> getPermissions() {
+ return new ArrayList<DataPermission>(this.permissions.getMap().values());
+ }
+
+ public void setPermissions(List<DataPermission> permissions) {
+ this.permissions.getMap().clear();
+ for (DataPermission permission:permissions) {
+ this.permissions.add((PermissionMetaData)permission);
+ }
+ }
+
+ public void addPermission(PermissionMetaData... permissions) {
+ for (PermissionMetaData permission:permissions) {
+ this.permissions.add(permission);
+ }
+ }
+
+ @Override
+ @ManagementProperty(description="Mapped Container role names mapped to this policy")
+ public List<String> getMappedRoleNames() {
+ return mappedRoleNames;
+ }
+
+ public void setMappedRoleNames(List<String> names) {
+ this.mappedRoleNames = names;
+ }
+
+ public boolean allows(String resourceName, DataPolicy.PermissionType type) {
+ for(PermissionMetaData permission:this.permissions.getMap().values()) {
+ if (permission.getResourceName().equalsIgnoreCase(resourceName) ) {
+ return permission.allows(type);
+ }
+ }
+
+ for(PermissionMetaData permission:this.permissions.getMap().values()) {
+ if (permission.allows(resourceName, type)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+
+ @XmlAccessorType(XmlAccessType.NONE)
+ @XmlType(name = "", propOrder = {
+ "resourceName",
+ "allowCreate",
+ "allowRead",
+ "allowUpdate",
+ "allowDelete"
+ })
+ @ManagementObject(properties=ManagementProperties.EXPLICIT)
+ public static class PermissionMetaData implements DataPermission{
+
+ private static final String SEPARATOR = "."; //$NON-NLS-1$
+ public static final String RECURSIVE = "*"; //$NON-NLS-1$
+ private static final String ALL_NODES = RECURSIVE;
+ public static final String SEPARATOR_WITH_RECURSIVE = SEPARATOR + RECURSIVE;
+
+ // derived state
+ private String canonicalName; // The resource's canonical name
+ private boolean isRecursive = false; // Is this a recursive resource?
+
+ // XML based fields
+ private String resourceName;
+ @XmlElement(name = "allow-create")
+ protected Boolean allowCreate;
+ @XmlElement(name = "allow-read")
+ protected Boolean allowRead;
+ @XmlElement(name = "allow-update")
+ protected Boolean allowUpdate;
+ @XmlElement(name = "allow-delete")
+ protected Boolean allowDelete;
+
+ @Override
+ @ManagementProperty(description="Resource Name, for which permission defined")
+ @ManagementObjectID(type="permission")
+ @XmlElement(name = "resource-name", required = true)
+ public String getResourceName() {
+ return resourceName;
+ }
+
+ public void setResourceName(String value) {
+ this.resourceName = value;
+ init(this.resourceName);
+ }
+
+ @Override
+ @ManagementProperty(description="Allows Create")
+ public boolean isAllowCreate() {
+ if (allowCreate == null) {
+ return false;
+ }
+ return allowCreate;
+ }
+
+ public void setAllowCreate(Boolean value) {
+ this.allowCreate = value;
+ }
+
+ @Override
+ @ManagementProperty(description="Allows Read")
+ public boolean isAllowRead() {
+ if (allowRead == null) {
+ return false;
+ }
+ return allowRead;
+ }
+
+ public void setAllowRead(Boolean value) {
+ this.allowRead = value;
+ }
+
+ @Override
+ @ManagementProperty(description="Allows Update")
+ public boolean isAllowUpdate() {
+ if (allowUpdate == null) {
+ return false;
+ }
+ return allowUpdate;
+ }
+
+ public void setAllowUpdate(Boolean value) {
+ this.allowUpdate = value;
+ }
+
+ @Override
+ @ManagementProperty(description="Allows Delete")
+ public boolean isAllowDelete() {
+ if (allowDelete == null) {
+ return false;
+ }
+ return allowDelete;
+ }
+
+ public void setAllowDelete(Boolean value) {
+ this.allowDelete = value;
+ }
+
+ public String getType() {
+ StringBuilder sb = new StringBuilder();
+ if (isAllowCreate()) {
+ sb.append("C");//$NON-NLS-1$
+ }
+ if (isAllowRead()) {
+ sb.append("R");//$NON-NLS-1$
+ }
+ if (isAllowUpdate()) {
+ sb.append("U");//$NON-NLS-1$
+ }
+ if (isAllowDelete()) {
+ sb.append("D");//$NON-NLS-1$
+ }
+ return sb.toString();
+ }
+
+ public boolean allows(PermissionType type) {
+ boolean allowedType = false;
+ switch (type) {
+ case CREATE:
+ allowedType = isAllowCreate();
+ break;
+ case READ:
+ allowedType = isAllowRead();
+ break;
+ case UPDATE:
+ allowedType = isAllowUpdate();
+ break;
+ case DELETE:
+ allowedType = isAllowDelete();
+ break;
+ }
+ return allowedType;
+ }
+
+ public boolean allows(String checkResource, PermissionType type) {
+ boolean allowedType = allows(type);
+ boolean allowed = false;
+
+ if (allowedType) {
+ checkResource = checkResource.toLowerCase();
+ if ( isRecursive ) {
+ if ( checkResource.startsWith(this.canonicalName) ) {
+ allowed = true;
+ }
+ } else {
+ allowed = this.canonicalName.equals(checkResource);
+
+ if (!allowed) {
+ // if this resource is a group level permission, then grant permission to any children
+ // for ex: 'foo.x.y' has permission if 'foo.x' is defined
+ int lastSepIndex = checkResource.lastIndexOf(SEPARATOR);
+ if ( lastSepIndex > 0 && checkResource.substring(0, lastSepIndex).equals(this.canonicalName) ) {
+ allowed = true;
+ }
+ }
+ }
+ }
+ return allowed;
+ }
+
+ /**
+ * This method is invoked by the constructors that take a string resource name, and is
+ * to strip out any recursive or wildcard characters and return simple the name of the
+ * node.
+ */
+ private void init( String resourceName ) {
+ // If the resource name is the ALL_NODES resource ...
+ if ( resourceName.equals(ALL_NODES) ) {
+ this.isRecursive = true;
+ this.canonicalName = ""; // resource name should be nothing //$NON-NLS-1$
+ }
+
+ // If the resource name includes the recursive parameter ...
+ if ( resourceName.endsWith(SEPARATOR_WITH_RECURSIVE) ) {
+ isRecursive = true;
+ this.canonicalName = resourceName.substring(0, resourceName.length()-2);
+ } else if (resourceName.endsWith(RECURSIVE) ) {
+ this.isRecursive = true;
+ this.canonicalName = resourceName.substring(0, resourceName.length()-1);
+ } else {
+ this.canonicalName = resourceName;
+ }
+ this.canonicalName = this.canonicalName.toLowerCase();
+ }
+
+ public String toString() {
+ StringBuilder sb = new StringBuilder();
+ sb.append(getResourceName());
+ sb.append("["); //$NON-NLS-1$
+ sb.append(getType());
+ sb.append("]");//$NON-NLS-1$
+ return sb.toString();
+ }
+ }
+}
Property changes on: trunk/client/src/main/java/org/teiid/adminapi/impl/DataPolicyMetadata.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Deleted: trunk/client/src/main/java/org/teiid/adminapi/impl/DataRoleMetadata.java
===================================================================
--- trunk/client/src/main/java/org/teiid/adminapi/impl/DataRoleMetadata.java 2010-03-18 18:26:59 UTC (rev 1974)
+++ trunk/client/src/main/java/org/teiid/adminapi/impl/DataRoleMetadata.java 2010-03-19 00:20:58 UTC (rev 1975)
@@ -1,204 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-package org.teiid.adminapi.impl;
-
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.xml.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlAttribute;
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlType;
-
-import org.jboss.managed.api.annotation.ManagementObject;
-import org.jboss.managed.api.annotation.ManagementObjectID;
-import org.jboss.managed.api.annotation.ManagementProperties;
-import org.jboss.managed.api.annotation.ManagementProperty;
-import org.teiid.adminapi.DataRole;
-
-
-(a)XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "", propOrder = {
- "description",
- "permissions",
- "mappedRoleNames"
-})
-(a)ManagementObject(properties=ManagementProperties.EXPLICIT)
-public class DataRoleMetadata implements DataRole, Serializable {
- private static final long serialVersionUID = -4119646357275977190L;
-
- @XmlAttribute(name = "name", required = true)
- protected String name;
- @XmlElement(name = "description")
- protected String description;
-
- @XmlElement(name = "permission")
- protected ListOverMap<PermissionMetaData> permissions = new ListOverMap<PermissionMetaData>(new KeyBuilder<PermissionMetaData>() {
- @Override
- public String getKey(PermissionMetaData entry) {
- return entry.getResourceName();
- }
- });
-
- @XmlElement(name = "mapped-role-name")
- protected List<String> mappedRoleNames;
-
- @Override
- @ManagementProperty(description="Role Name")
- @ManagementObjectID(type="role")
- public String getName() {
- return name;
- }
-
- public void setName(String value) {
- this.name = value;
- }
-
- @Override
- @ManagementProperty(description="Role Description")
- public String getDescription() {
- return description;
- }
-
- public void setDescription(String value) {
- this.description = value;
- }
-
- @Override
- @ManagementProperty(description="Permissions in a Data Role", managed=true)
- public List<Permission> getPermissions() {
- return new ArrayList<Permission>(this.permissions.getMap().values());
- }
-
- public void setPermissions(List<Permission> permissions) {
- this.permissions.getMap().clear();
- for (Permission permission:permissions) {
- this.permissions.getMap().put(permission.getResourceName(), (PermissionMetaData)permission);
- }
- }
-
- public PermissionMetaData getPermission(String resourceName) {
- return this.permissions.getMap().get(resourceName);
- }
-
- public void addPermission(PermissionMetaData permission) {
- this.permissions.getMap().put(permission.getResourceName(), permission);
- }
-
- @Override
- @ManagementProperty(description="Mapped Container role names mapped to this role")
- public List<String> getMappedRoleNames() {
- return mappedRoleNames;
- }
-
- public void setMappedRoleNames(List<String> names) {
- this.mappedRoleNames = names;
- }
-
-
- @XmlAccessorType(XmlAccessType.FIELD)
- @XmlType(name = "", propOrder = {
- "resourceName",
- "allowCreate",
- "allowRead",
- "allowUpdate",
- "allowDelete"
- })
- @ManagementObject(properties=ManagementProperties.EXPLICIT)
- public static class PermissionMetaData implements Permission{
- @XmlElement(name = "resource-name", required = true)
- protected String resourceName;
- @XmlElement(name = "allow-create")
- protected Boolean allowCreate;
- @XmlElement(name = "allow-read")
- protected Boolean allowRead;
- @XmlElement(name = "allow-update")
- protected Boolean allowUpdate;
- @XmlElement(name = "allow-delete")
- protected Boolean allowDelete;
-
- @Override
- @ManagementProperty(description="Resource Name, for which role defined")
- @ManagementObjectID(type="permission")
- public String getResourceName() {
- return resourceName;
- }
-
- public void setResourceName(String value) {
- this.resourceName = value;
- }
-
- @Override
- @ManagementProperty(description="Allows Create")
- public boolean isAllowCreate() {
- if (allowCreate == null) {
- return false;
- }
- return allowCreate;
- }
-
- public void setAllowCreate(Boolean value) {
- this.allowCreate = value;
- }
-
- @Override
- @ManagementProperty(description="Allows Read")
- public boolean isAllowRead() {
- if (allowRead == null) {
- return false;
- }
- return allowRead;
- }
-
- public void setAllowRead(Boolean value) {
- this.allowRead = value;
- }
-
- @Override
- @ManagementProperty(description="Allows Update")
- public boolean isAllowUpdate() {
- if (allowUpdate == null) {
- return false;
- }
- return allowUpdate;
- }
-
- public void setAllowUpdate(Boolean value) {
- this.allowUpdate = value;
- }
-
- @Override
- @ManagementProperty(description="Allows Delete")
- public boolean isAllowDelete() {
- if (allowDelete == null) {
- return false;
- }
- return allowDelete;
- }
-
- public void setAllowDelete(Boolean value) {
- this.allowDelete = value;
- }
- }
-}
Modified: trunk/client/src/main/java/org/teiid/adminapi/impl/ListOverMap.java
===================================================================
--- trunk/client/src/main/java/org/teiid/adminapi/impl/ListOverMap.java 2010-03-18 18:26:59 UTC (rev 1974)
+++ trunk/client/src/main/java/org/teiid/adminapi/impl/ListOverMap.java 2010-03-19 00:20:58 UTC (rev 1975)
@@ -28,12 +28,12 @@
import java.util.LinkedHashMap;
import java.util.Set;
-final class ListOverMap<E> extends AbstractList<E> implements Serializable {
+class ListOverMap<E> extends AbstractList<E> implements Serializable {
private static final long serialVersionUID = 5171741731121210240L;
- private LinkedHashMap<String, E> map = new LinkedHashMap<String, E>();
- private KeyBuilder<E> builder;
+ protected LinkedHashMap<String, E> map = new LinkedHashMap<String, E>();
+ protected KeyBuilder<E> builder;
public ListOverMap(KeyBuilder<E> builder) {
this.builder = builder;
Added: trunk/client/src/main/java/org/teiid/adminapi/impl/PermissionMap.java
===================================================================
--- trunk/client/src/main/java/org/teiid/adminapi/impl/PermissionMap.java (rev 0)
+++ trunk/client/src/main/java/org/teiid/adminapi/impl/PermissionMap.java 2010-03-19 00:20:58 UTC (rev 1975)
@@ -0,0 +1,58 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright (C) 2008 Red Hat, Inc.
+ * Copyright (C) 2000-2007 MetaMatrix, Inc.
+ * Licensed to Red Hat, Inc. under one or more contributor
+ * license agreements. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * 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.impl.DataPolicyMetadata.PermissionMetaData;
+
+public class PermissionMap extends ListOverMap<PermissionMetaData> {
+
+ private static final long serialVersionUID = -1170556665834875267L;
+
+ public PermissionMap(KeyBuilder<PermissionMetaData> builder) {
+ super(builder);
+ }
+
+ @Override
+ public void add(int index, PermissionMetaData element) {
+ PermissionMetaData previous = this.map.get(builder.getKey(element));
+ if (previous != null) {
+ if (element.allowCreate != null) {
+ previous.setAllowCreate(element.allowCreate);
+ }
+ if (element.allowRead != null) {
+ previous.setAllowRead(element.allowRead);
+ }
+ if (element.allowUpdate != null) {
+ previous.setAllowUpdate(element.allowUpdate);
+ }
+ if (element.allowDelete != null) {
+ previous.setAllowDelete(element.allowDelete);
+ }
+ }
+ else {
+ super.add(index, element);
+ }
+ }
+
+}
Property changes on: trunk/client/src/main/java/org/teiid/adminapi/impl/PermissionMap.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/client/src/main/java/org/teiid/adminapi/impl/VDBMetaData.java
===================================================================
--- trunk/client/src/main/java/org/teiid/adminapi/impl/VDBMetaData.java 2010-03-18 18:26:59 UTC (rev 1974)
+++ trunk/client/src/main/java/org/teiid/adminapi/impl/VDBMetaData.java 2010-03-19 00:20:58 UTC (rev 1975)
@@ -39,7 +39,7 @@
import org.jboss.managed.api.annotation.ManagementObjectID;
import org.jboss.managed.api.annotation.ManagementProperties;
import org.jboss.managed.api.annotation.ManagementProperty;
-import org.teiid.adminapi.DataRole;
+import org.teiid.adminapi.DataPolicy;
import org.teiid.adminapi.Model;
import org.teiid.adminapi.VDB;
import org.teiid.adminapi.impl.ModelMetaData.ValidationError;
@@ -51,7 +51,7 @@
"description",
"JAXBProperties",
"models",
- "roles"
+ "dataPolicies"
})
@XmlRootElement(name = "vdb")
public class VDBMetaData extends AdminObjectImpl implements VDB {
@@ -71,10 +71,10 @@
}
});
- @XmlElement(name = "role", required = true, type = DataRoleMetadata.class)
- protected ListOverMap<DataRoleMetadata> roles = new ListOverMap<DataRoleMetadata>(new KeyBuilder<DataRoleMetadata>() {
+ @XmlElement(name = "data-policy", required = true, type = DataPolicyMetadata.class)
+ protected ListOverMap<DataPolicyMetadata> dataPolicies = new ListOverMap<DataPolicyMetadata>(new KeyBuilder<DataPolicyMetadata>() {
@Override
- public String getKey(DataRoleMetadata entry) {
+ public String getKey(DataPolicyMetadata entry) {
return entry.getName();
}
});
@@ -251,27 +251,27 @@
}
@Override
- @ManagementProperty(description="Data Roles in a VDB", managed=true)
- public List<DataRole> getDataRoles(){
- return new ArrayList<DataRole>(this.roles.getMap().values());
+ @ManagementProperty(description="Data Policies in a VDB", managed=true)
+ public List<DataPolicy> getDataPolicies(){
+ return new ArrayList<DataPolicy>(this.dataPolicies.getMap().values());
}
/**
* This method is required by the Management framework to write the mappings.
- * @param roles
+ * @param policies
*/
- public void setDataRoles(List<DataRole> roles){
- this.roles.getMap().clear();
- for (DataRole role:roles) {
- this.roles.getMap().put(role.getName(), (DataRoleMetadata)role);
+ public void setDataPolicies(List<DataPolicy> policies){
+ this.dataPolicies.getMap().clear();
+ for (DataPolicy policy:policies) {
+ this.dataPolicies.getMap().put(policy.getName(), (DataPolicyMetadata)policy);
}
}
- public void addDataRole(DataRoleMetadata role){
- this.roles.getMap().put(role.getName(), role);
+ public void addDataPolicy(DataPolicyMetadata policy){
+ this.dataPolicies.getMap().put(policy.getName(), policy);
}
- public DataRoleMetadata getDataRole(String roleName) {
- return this.roles.getMap().get(roleName);
+ public DataPolicyMetadata getDataPolicy(String policyName) {
+ return this.dataPolicies.getMap().get(policyName);
}
}
Modified: trunk/client/src/main/resources/vdb-deployer.xsd
===================================================================
--- trunk/client/src/main/resources/vdb-deployer.xsd 2010-03-18 18:26:59 UTC (rev 1974)
+++ trunk/client/src/main/resources/vdb-deployer.xsd 2010-03-19 00:20:58 UTC (rev 1975)
@@ -49,7 +49,7 @@
<xs:attribute name="path" type="xs:string"/>
</xs:complexType>
</xs:element>
- <xs:element name="role" minOccurs="0" maxOccurs="unbounded">
+ <xs:element name="data-policy" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="description" type="xs:string" minOccurs="0"/>
Added: trunk/client/src/test/java/org/teiid/adminapi/impl/TestDataPolicyMetaData.java
===================================================================
--- trunk/client/src/test/java/org/teiid/adminapi/impl/TestDataPolicyMetaData.java (rev 0)
+++ trunk/client/src/test/java/org/teiid/adminapi/impl/TestDataPolicyMetaData.java 2010-03-19 00:20:58 UTC (rev 1975)
@@ -0,0 +1,83 @@
+/*
+ * 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 java.util.Arrays;
+
+import org.junit.Test;
+import org.teiid.adminapi.DataPolicy.PermissionType;
+import org.teiid.adminapi.impl.DataPolicyMetadata.PermissionMetaData;
+import static junit.framework.Assert.*;
+
+public class TestDataPolicyMetaData {
+
+ @Test
+ public void testAllowed() {
+ DataPolicyMetadata policy = new DataPolicyMetadata();
+ policy.setName("readOnly"); //$NON-NLS-1$
+ policy.setDescription("Only has read only permissions"); //$NON-NLS-1$
+ policy.setMappedRoleNames(Arrays.asList("jack", "susan")); //$NON-NLS-1$ //$NON-NLS-2$
+
+
+ PermissionMetaData perm1 = new PermissionMetaData();
+ perm1.setResourceName("schema.catalog.Table1"); //$NON-NLS-1$
+ perm1.setAllowRead(true);
+
+ PermissionMetaData perm2 = new PermissionMetaData();
+ perm2.setResourceName("schema.catalog.Table2"); //$NON-NLS-1$
+ perm2.setAllowRead(false);
+
+ PermissionMetaData perm3 = new PermissionMetaData();
+ perm3.setResourceName("schema.catalog.Table3.*"); //$NON-NLS-1$
+ perm3.setAllowRead(true);
+
+ PermissionMetaData perm4 = new PermissionMetaData();
+ perm4.setResourceName("schema.catalog.Table4*"); //$NON-NLS-1$
+ perm4.setAllowRead(true);
+
+ PermissionMetaData perm5 = new PermissionMetaData();
+ perm5.setResourceName("schema.catalog.Table5.column1"); //$NON-NLS-1$
+ perm5.setAllowRead(true);
+
+ policy.addPermission(perm1, perm2, perm3, perm4, perm5);
+
+
+ assertTrue(policy.allows("schema.catalog.Table1", PermissionType.READ)); //$NON-NLS-1$
+ assertFalse(policy.allows("schema.catalog.Table1", PermissionType.CREATE)); //$NON-NLS-1$
+
+ assertFalse(policy.allows("schema.catalog", PermissionType.READ)); //$NON-NLS-1$
+
+ assertFalse(policy.allows("schema.catalog.Table2.column", PermissionType.READ)); //$NON-NLS-1$
+ assertFalse(policy.allows("schema.catalog.Table2", PermissionType.READ)); //$NON-NLS-1$
+
+ assertTrue(policy.allows("schema.catalog.Table3.column", PermissionType.READ)); //$NON-NLS-1$
+ assertTrue(policy.allows("schema.catalog.Table3", PermissionType.READ)); //$NON-NLS-1$
+
+ assertTrue(policy.allows("schema.catalog.Table4.column", PermissionType.READ)); //$NON-NLS-1$
+ assertTrue(policy.allows("schema.catalog.Table4", PermissionType.READ)); //$NON-NLS-1$
+ assertFalse(policy.allows("schema.catalog.Table4", PermissionType.DELETE)); //$NON-NLS-1$
+
+ assertTrue(policy.allows("schema.catalog.Table5.column1", PermissionType.READ)); //$NON-NLS-1$
+ assertFalse(policy.allows("schema.catalog.Table5.column2", PermissionType.READ)); //$NON-NLS-1$
+ assertFalse(policy.allows("schema.catalog.Table5", PermissionType.READ)); //$NON-NLS-1$
+ }
+}
Property changes on: trunk/client/src/test/java/org/teiid/adminapi/impl/TestDataPolicyMetaData.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/client/src/test/java/org/teiid/adminapi/impl/TestVDBMetaData.java
===================================================================
--- trunk/client/src/test/java/org/teiid/adminapi/impl/TestVDBMetaData.java 2010-03-18 18:26:59 UTC (rev 1974)
+++ trunk/client/src/test/java/org/teiid/adminapi/impl/TestVDBMetaData.java 2010-03-19 00:20:58 UTC (rev 1975)
@@ -36,9 +36,9 @@
import javax.xml.validation.SchemaFactory;
import org.junit.Test;
-import org.teiid.adminapi.DataRole;
+import org.teiid.adminapi.DataPolicy;
import org.teiid.adminapi.Model;
-import org.teiid.adminapi.impl.DataRoleMetadata.PermissionMetaData;
+import org.teiid.adminapi.impl.DataPolicyMetadata.PermissionMetaData;
public class TestVDBMetaData {
@@ -72,7 +72,7 @@
vdb.addModel(modelTwo);
- DataRoleMetadata roleOne = new DataRoleMetadata();
+ DataPolicyMetadata roleOne = new DataPolicyMetadata();
roleOne.setName("roleOne"); //$NON-NLS-1$
roleOne.setDescription("roleOne described"); //$NON-NLS-1$
@@ -89,7 +89,7 @@
roleOne.setMappedRoleNames(Arrays.asList("ROLE1", "ROLE2")); //$NON-NLS-1$ //$NON-NLS-2$
- vdb.addDataRole(roleOne);
+ vdb.addDataPolicy(roleOne);
SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
@@ -136,24 +136,28 @@
assertTrue(vdb.getValidityErrors().contains("There is an error in VDB")); //$NON-NLS-1$
- List<DataRole> roles = vdb.getDataRoles();
+ List<DataPolicy> roles = vdb.getDataPolicies();
assertTrue(roles.size() == 1);
- DataRoleMetadata role = vdb.getDataRole("roleOne"); //$NON-NLS-1$
+ DataPolicyMetadata role = vdb.getDataPolicy("roleOne"); //$NON-NLS-1$
assertEquals("roleOne described", role.getDescription()); //$NON-NLS-1$
assertNotNull(role.getMappedRoleNames());
assertTrue(role.getMappedRoleNames().contains("ROLE1")); //$NON-NLS-1$
assertTrue(role.getMappedRoleNames().contains("ROLE2")); //$NON-NLS-1$
- assertEquals(2, role.getPermissions().size());
- PermissionMetaData p1 = role.getPermission("myTable.T1"); //$NON-NLS-1$
+ List<DataPolicy.DataPermission> permissions = role.getPermissions();
+ assertEquals(2, permissions.size());
- assertTrue(p1.isAllowRead());
- assertFalse(p1.isAllowDelete());
-
- PermissionMetaData p2 = role.getPermission("myTable.T2"); //$NON-NLS-1$
- assertFalse(p2.isAllowRead());
- assertTrue(p2.isAllowDelete());
+ for (DataPolicy.DataPermission p: permissions) {
+ if (p.getResourceName().equalsIgnoreCase("myTable.T1")) { //$NON-NLS-1$
+ assertTrue(p.isAllowRead());
+ assertFalse(p.isAllowDelete());
+ }
+ else {
+ assertFalse(p.isAllowRead());
+ assertTrue(p.isAllowDelete());
+ }
+ }
}
}
Deleted: trunk/engine/src/main/java/com/metamatrix/api/exception/security/AuthorizationException.java
===================================================================
--- trunk/engine/src/main/java/com/metamatrix/api/exception/security/AuthorizationException.java 2010-03-18 18:26:59 UTC (rev 1974)
+++ trunk/engine/src/main/java/com/metamatrix/api/exception/security/AuthorizationException.java 2010-03-19 00:20:58 UTC (rev 1975)
@@ -1,81 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package com.metamatrix.api.exception.security;
-
-import com.metamatrix.admin.api.exception.security.MetaMatrixSecurityException;
-
-public class AuthorizationException extends MetaMatrixSecurityException {
- /**
- * No-Arg Constructor
- */
- public AuthorizationException( ) {
- super( );
- }
- /**
- * Constructs an instance of the exception with the specified detail message. A detail
- * message is a String that describes this particular exception.
- * @param the detail message
- */
- public AuthorizationException(String message) {
- super(message);
- }
- /**
- * Constructs an instance of the exception with no detail message but with a
- * single exception.
- * @param e the exception that is encapsulated by this exception
- */
- public AuthorizationException(Throwable e) {
- super(e);
- }
- /**
- * Constructs an instance of the exception with the specified detail message
- * and a single exception. A detail message is a String that describes this
- * particular exception.
- * @param message the detail message
- * @param e the exception that is encapsulated by this exception
- */
- public AuthorizationException( Throwable e, String message ) {
- super(e, message);
- }
- /**
- * Construct an instance with an error code and message specified.
- *
- * @param message The error message
- * @param code The error code
- */
- public AuthorizationException( String code, String message ) {
- super( code, message );
- }
- /**
- * Construct an instance with a linked exception, and an error code and
- * message, specified.
- *
- * @param e An exception to chain to this exception
- * @param message The error message
- * @param code The error code
- */
- public AuthorizationException( Throwable e, String code, String message ) {
- super(e, code, message );
- }
-}
-
Deleted: trunk/engine/src/main/java/com/metamatrix/api/exception/security/AuthorizationMgmtException.java
===================================================================
--- trunk/engine/src/main/java/com/metamatrix/api/exception/security/AuthorizationMgmtException.java 2010-03-18 18:26:59 UTC (rev 1974)
+++ trunk/engine/src/main/java/com/metamatrix/api/exception/security/AuthorizationMgmtException.java 2010-03-19 00:20:58 UTC (rev 1975)
@@ -1,87 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package com.metamatrix.api.exception.security;
-
-public class AuthorizationMgmtException extends AuthorizationException {
-
- /**
- * No-Arg Constructor
- */
- public AuthorizationMgmtException( ) {
- super( );
- }
- /**
- * Constructs an instance of the exception with the specified detail
- * message. A detail message is a String that describes this particular
- * exception.
- * @param the detail message
- */
- public AuthorizationMgmtException(String message) {
- super(message);
- }
-
- /**
- * Constructs an instance of the exception with no detail message but with a
- * single exception.
- * @param e the exception that is encapsulated by this exception
- */
- public AuthorizationMgmtException(Throwable e) {
- super(e);
- }
-
- /**
- * Constructs an instance of the exception with the specified detail message
- * and a single exception. A detail message is a String that describes this
- * particular exception.
- * @param e the exception that is encapsulated by this exception
- * @param message the detail message
- */
- public AuthorizationMgmtException(Throwable e, String message) {
- super(e,message);
- }
-
- /**
- * Construct an instance with an error code and message specified.
- *
- * @param message The error message
- * @param code The error code
- */
- public AuthorizationMgmtException( String code, String message ) {
- super( code, message );
- }
-
- /**
- * Construct an instance with a linked exception, and an error code and
- * message, specified.
- *
- * @param e An exception to chain to this exception
- * @param message The error message
- * @param code The error code
- */
- public AuthorizationMgmtException( Throwable e, String code, String message ) {
- super( e, code, message );
- }
-
-}
-
-
Deleted: trunk/engine/src/main/java/com/metamatrix/dqp/service/AuthorizationService.java
===================================================================
--- trunk/engine/src/main/java/com/metamatrix/dqp/service/AuthorizationService.java 2010-03-18 18:26:59 UTC (rev 1974)
+++ trunk/engine/src/main/java/com/metamatrix/dqp/service/AuthorizationService.java 2010-03-19 00:20:58 UTC (rev 1975)
@@ -1,94 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package com.metamatrix.dqp.service;
-
-import java.util.Collection;
-
-import org.teiid.security.roles.AuthorizationPolicy;
-import org.teiid.security.roles.AuthorizationRealm;
-
-import com.metamatrix.api.exception.MetaMatrixComponentException;
-import com.metamatrix.api.exception.security.AuthorizationException;
-import com.metamatrix.api.exception.security.AuthorizationMgmtException;
-import com.metamatrix.query.eval.SecurityFunctionEvaluator;
-
-/**
- * This service provides a means to check whether a connection is authorized to access
- * various data resources.
- */
-public interface AuthorizationService extends SecurityFunctionEvaluator {
-
- public static final int ACTION_READ = 0;
- public static final int ACTION_CREATE = 1;
- public static final int ACTION_UPDATE = 2;
- public static final int ACTION_DELETE = 3;
-
- public enum Context {
- QUERY,
- INSERT,
- UPDATE,
- DELETE,
- STORED_PROCEDURE;
- }
-
- public static final String ENTITELEMENTS_ENABLED = "auth.check_entitlements"; //$NON-NLS-1$
- public static final String ADMIN_ROLES_FILE = "auth.adminRolesFile"; //$NON-NLS-1$
-
- /**
- * Determine which of a set of resources a connection does not have permission to
- * perform the specified action.
- * @param action Action connection wishes to perform
- * @param resources Resources the connection wishes to perform the action on, Collection of String
- * @param context Auditing context
- * @return Collection Subset of resources
- * @throws MetaMatrixComponentException If an error occurs in the service while checking resources
- */
- Collection getInaccessibleResources(int action, Collection resources, Context context) throws MetaMatrixComponentException;
-
- /**
- * Determine whether entitlements checking is enabled on the server.
- * @return <code>true</code> iff server-side entitlements checking is enabled.
- */
- boolean checkingEntitlements();
-
- boolean isCallerInRole(String roleName ) throws AuthorizationMgmtException;
-
- /**
- * Returns a <code>Collection</code> of <code>AuthorizationPolicy</code>s
- * that have <code>AuthorizationPermission</code>s in the given <code>AuthorizationRealm</code>.<br>
- * <strong>NOTE:</strong> It is the responsibility of the caller to determine
- * which of the <code>AuthorizationPolicy</code>'s <code>AuthorizationPermission</code>s
- * are actually in the given <code>AuthorizationRealm</code>. The <code>AuthorizationPolicy</code>
- * may span <code>AuthorizationRealm</code>s.
- * @param caller The session token of the principal that is attempting to retrieve the policies.
- * @param realm The realm in which to search for <code>AuthorizationPermission</code>s.
- * @return The collection of <code>AuthorizationPolicy</code>s that have permissions
- * in the given realm - possibly empty but never null.
- * @throws AuthorizationException if administrator does not have the authority to perform the action.
- * @throws AuthorizationMgmtException if an error occurs in the Authorization store.
- */
- Collection<AuthorizationPolicy> getPoliciesInRealm(AuthorizationRealm realm)
- throws AuthorizationException, AuthorizationMgmtException;
-
- void updatePoliciesInRealm(AuthorizationRealm realm, Collection<AuthorizationPolicy> policies) throws AuthorizationMgmtException;
-}
Modified: trunk/engine/src/main/java/com/metamatrix/dqp/service/SessionService.java
===================================================================
--- trunk/engine/src/main/java/com/metamatrix/dqp/service/SessionService.java 2010-03-18 18:26:59 UTC (rev 1974)
+++ trunk/engine/src/main/java/com/metamatrix/dqp/service/SessionService.java 2010-03-19 00:20:58 UTC (rev 1975)
@@ -32,7 +32,6 @@
import org.teiid.security.Credentials;
import com.metamatrix.admin.api.exception.security.InvalidSessionException;
-import com.metamatrix.api.exception.security.AuthorizationException;
import com.metamatrix.api.exception.security.SessionServiceException;
/**
@@ -90,7 +89,6 @@
* @param adminSessionID The session id identifying session of administrator
* @throws InvalidSessionException If terminatedSessionID identifies an invalid
* session
- * @throws AuthorizationException if the caller denoted by <code>adminSessionID</code>
* does not have authority to terminate the <code>terminatedSessionID</code> session
* @throws SessionServiceException
*/
Modified: trunk/engine/src/main/java/org/teiid/dqp/internal/process/DQPConfiguration.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/dqp/internal/process/DQPConfiguration.java 2010-03-18 18:26:59 UTC (rev 1974)
+++ trunk/engine/src/main/java/org/teiid/dqp/internal/process/DQPConfiguration.java 2010-03-19 00:20:58 UTC (rev 1975)
@@ -38,7 +38,7 @@
public static final int DEFAULT_MAX_PROCESS_WORKERS = 16;
- private String processName = "localhost";
+ private String processName = "localhost"; //$NON-NLS-1$
private int maxThreads = DEFAULT_MAX_PROCESS_WORKERS;
private int timeSliceInMilli = DEFAULT_PROCESSOR_TIMESLICE;
private boolean processDebugAllowed;
@@ -50,6 +50,7 @@
private int codeTablesMaxRows = DEFAULT_MAX_CODE_RECORDS;
private boolean resultSetCacheEnabled = true;
private int maxResultSetCacheEntries = DQPConfiguration.DEFAULT_MAX_RESULTSET_CACHE_ENTRIES;
+ private boolean useEntitlements = false;
@ManagementProperty (description="Name of the process that uniquely identifies this process")
public String getProcessName() {
@@ -158,4 +159,17 @@
public void setResultSetCacheEnabled(boolean value) {
this.resultSetCacheEnabled = value;
}
+
+ /**
+ * Determine whether entitlements checking is enabled on the server.
+ * @return <code>true</code> if server-side entitlements checking is enabled.
+ */
+ @ManagementProperty(description="Turn on checking the entitlements on resources based on the roles defined in VDB")
+ public boolean useEntitlements() {
+ return useEntitlements;
+ }
+
+ public void setUseEntitlements(Boolean useEntitlements) {
+ this.useEntitlements = useEntitlements.booleanValue();
+ }
}
Modified: trunk/engine/src/main/java/org/teiid/dqp/internal/process/DQPCore.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/dqp/internal/process/DQPCore.java 2010-03-18 18:26:59 UTC (rev 1974)
+++ trunk/engine/src/main/java/org/teiid/dqp/internal/process/DQPCore.java 2010-03-19 00:20:58 UTC (rev 1975)
@@ -70,7 +70,6 @@
import com.metamatrix.dqp.message.RequestID;
import com.metamatrix.dqp.message.RequestMessage;
import com.metamatrix.dqp.message.ResultsMessage;
-import com.metamatrix.dqp.service.AuthorizationService;
import com.metamatrix.dqp.service.BufferService;
import com.metamatrix.dqp.service.TransactionContext;
import com.metamatrix.dqp.service.TransactionService;
@@ -176,7 +175,6 @@
private SessionAwareCache<PreparedPlan> prepPlanCache;
private SessionAwareCache<CachedResults> rsCache;
private TransactionService transactionService;
- private AuthorizationService authorizationService;
private BufferService bufferService;
private ConnectorManagerRepository connectorManagerRepository;
@@ -189,7 +187,7 @@
private Map<RequestID, RequestWorkItem> requests = new ConcurrentHashMap<RequestID, RequestWorkItem>();
private Map<String, ClientState> clientState = Collections.synchronizedMap(new HashMap<String, ClientState>());
private DQPContextCache contextCache;
-
+ private boolean useEntitlements = false;
/**
* perform a full shutdown and wait for 10 seconds for all threads to finish
*/
@@ -288,9 +286,9 @@
}
ClientState state = this.getClientState(workContext.getConnectionID(), true);
request.initialize(requestMsg, bufferManager,
- dataTierMgr, transactionService, authorizationService, processorDebugAllowed,
+ dataTierMgr, transactionService, processorDebugAllowed,
state.tempTableStoreImpl, workContext,
- chunkSize, connectorManagerRepository);
+ chunkSize, connectorManagerRepository, this.useEntitlements);
ResultsFuture<ResultsMessage> resultsFuture = new ResultsFuture<ResultsMessage>();
RequestWorkItem workItem = new RequestWorkItem(this, requestMsg, request, resultsFuture.getResultsReceiver(), requestID, workContext);
@@ -622,6 +620,7 @@
this.maxCodeTableRecords = config.getCodeTablesMaxRowsPerTable();
this.maxCodeTables = config.getCodeTablesMaxCount();
this.maxCodeRecords = config.getCodeTablesMaxRows();
+ this.useEntitlements = config.useEntitlements();
this.chunkSize = config.getLobChunkSizeInKB() * 1024;
@@ -656,10 +655,6 @@
setContextCache(service.getContextCache());
}
- public void setAuthorizationService(AuthorizationService service) {
- this.authorizationService = service;
- }
-
public void setContextCache(DQPContextCache cache) {
this.contextCache = cache;
}
@@ -805,8 +800,4 @@
public ConnectorManagerRepository getConnectorManagerRepository() {
return this.connectorManagerRepository;
}
-
- public AuthorizationService getAuthorizationService() {
- return this.authorizationService;
- }
}
\ No newline at end of file
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 2010-03-18 18:26:59 UTC (rev 1974)
+++ trunk/engine/src/main/java/org/teiid/dqp/internal/process/DQPWorkContext.java 2010-03-19 00:20:58 UTC (rev 1975)
@@ -23,10 +23,19 @@
package org.teiid.dqp.internal.process;
import java.io.Serializable;
+import java.security.Principal;
+import java.security.acl.Group;
+import java.util.Collections;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
import java.util.concurrent.Callable;
import javax.security.auth.Subject;
+import org.teiid.adminapi.DataPolicy;
import org.teiid.adminapi.impl.SessionMetadata;
import org.teiid.adminapi.impl.VDBMetaData;
import org.teiid.security.SecurityHelper;
@@ -60,6 +69,7 @@
private String clientAddress;
private String clientHostname;
private SecurityHelper securityHelper;
+ private HashMap<String, DataPolicy> policies;
public DQPWorkContext() {
}
@@ -189,4 +199,52 @@
}
}
+ public HashMap<String, DataPolicy> getAllowedDataPolicies() {
+ if (this.policies == null) {
+ this.policies = new HashMap<String, DataPolicy>();
+ Set<String> userRoles = getUserRoles();
+ if (userRoles.isEmpty()) {
+ return this.policies;
+ }
+
+ // get data roles from the VDB
+ List<DataPolicy> policies = getVDB().getDataPolicies();
+
+ for (DataPolicy policy : policies) {
+ if (matchesPrincipal(userRoles, policy)) {
+ this.policies.put(policy.getName(), policy);
+ }
+ }
+ }
+ return this.policies;
+ }
+
+ private boolean matchesPrincipal(Set<String> userRoles, DataPolicy policy) {
+ List<String> roles = policy.getMappedRoleNames();
+ for (String role:roles) {
+ return userRoles.contains(role);
+ }
+ return false;
+ }
+
+ private Set<String> getUserRoles() {
+ Set<String> roles = new HashSet<String>();
+
+ if (getSubject() == null) {
+ return Collections.EMPTY_SET;
+ }
+
+ Set<Principal> principals = getSubject().getPrincipals();
+ for(Principal p: principals) {
+ // this JBoss specific, but no code level dependencies
+ if ((p instanceof Group) && p.getName().equals("Roles")){ //$NON-NLS-1$
+ Group g = (Group)p;
+ Enumeration rolesPrinciples = g.members();
+ while(rolesPrinciples.hasMoreElements()) {
+ roles.add(((Principal)rolesPrinciples.nextElement()).getName());
+ }
+ }
+ }
+ return roles;
+ }
}
Modified: trunk/engine/src/main/java/org/teiid/dqp/internal/process/Request.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/dqp/internal/process/Request.java 2010-03-18 18:26:59 UTC (rev 1974)
+++ trunk/engine/src/main/java/org/teiid/dqp/internal/process/Request.java 2010-03-19 00:20:58 UTC (rev 1975)
@@ -54,11 +54,11 @@
import com.metamatrix.dqp.message.RequestID;
import com.metamatrix.dqp.message.RequestMessage;
import com.metamatrix.dqp.message.RequestMessage.ResultsMode;
-import com.metamatrix.dqp.service.AuthorizationService;
import com.metamatrix.dqp.service.TransactionContext;
import com.metamatrix.dqp.service.TransactionService;
import com.metamatrix.dqp.service.TransactionContext.Scope;
import com.metamatrix.query.analysis.AnalysisRecord;
+import com.metamatrix.query.eval.SecurityFunctionEvaluator;
import com.metamatrix.query.metadata.QueryMetadataInterface;
import com.metamatrix.query.metadata.TempMetadataAdapter;
import com.metamatrix.query.metadata.TempMetadataStore;
@@ -109,7 +109,6 @@
private BufferManager bufferManager;
private ProcessorDataManager processorDataManager;
private TransactionService transactionService;
- private AuthorizationService authService;
private TempTableStore tempTableStore;
protected IDGenerator idGenerator = new IDGenerator();
private boolean procDebugAllowed = false;
@@ -135,17 +134,18 @@
protected Command userCommand;
protected boolean returnsUpdateCount;
+ protected boolean useEntitlements;
void initialize(RequestMessage requestMsg,
BufferManager bufferManager,
ProcessorDataManager processorDataManager,
TransactionService transactionService,
- AuthorizationService authService,
boolean procDebugAllowed,
TempTableStore tempTableStore,
DQPWorkContext workContext,
int chunckSize,
- ConnectorManagerRepository repo) {
+ ConnectorManagerRepository repo,
+ boolean useEntitlements) {
this.requestMsg = requestMsg;
this.vdbName = workContext.getVdbName();
@@ -153,7 +153,6 @@
this.bufferManager = bufferManager;
this.processorDataManager = processorDataManager;
this.transactionService = transactionService;
- this.authService = authService;
this.procDebugAllowed = procDebugAllowed;
this.tempTableStore = tempTableStore;
idGenerator.setDefaultFactory(new IntegerIDFactory());
@@ -161,6 +160,7 @@
this.requestId = workContext.getRequestID(this.requestMsg.getExecutionId());
this.chunkSize = chunckSize;
this.connectorManagerRepo = repo;
+ this.useEntitlements = useEntitlements;
}
void setMetadata(CapabilitiesFinder capabilitiesFinder, QueryMetadataInterface metadata, Set multiSourceModels) {
@@ -253,7 +253,18 @@
context.setPlanToProcessConverter(modifier);
}
- context.setSecurityFunctionEvaluator(this.authService);
+ context.setSecurityFunctionEvaluator(new SecurityFunctionEvaluator() {
+ @Override
+ public boolean hasRole(String roleType, String roleName) throws MetaMatrixComponentException {
+ if (isEntitled() || !useEntitlements) {
+ return true;
+ }
+ if (!DATA_ROLE.equalsIgnoreCase(roleType)) {
+ return false;
+ }
+ return workContext.getAllowedDataPolicies().containsKey(roleName);
+ }
+ });
context.setTempTableStore(tempTableStore);
context.setQueryProcessorFactory(this);
context.setMetadata(this.metadata);
@@ -553,7 +564,15 @@
}
protected void validateAccess(Command command) throws QueryValidatorException, MetaMatrixComponentException {
- AuthorizationValidationVisitor visitor = new AuthorizationValidationVisitor(this.authService, this.workContext.getVDB());
+ AuthorizationValidationVisitor visitor = new AuthorizationValidationVisitor(this.workContext.getVDB(), !isEntitled() && this.useEntitlements, this.workContext.getAllowedDataPolicies(), this.workContext.getUserName());
validateWithVisitor(visitor, this.metadata, command);
}
+
+ protected boolean isEntitled(){
+ if (this.workContext.getSubject() == null) {
+ LogManager.logDetail(com.metamatrix.common.log.LogConstants.CTX_AUTHORIZATION,new Object[]{ "Automatically entitling principal", this.workContext.getUserName()}); //$NON-NLS-1$
+ return true;
+ }
+ return false;
+ }
}
Modified: trunk/engine/src/main/java/org/teiid/dqp/internal/process/validator/AuthorizationValidationVisitor.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/dqp/internal/process/validator/AuthorizationValidationVisitor.java 2010-03-18 18:26:59 UTC (rev 1974)
+++ trunk/engine/src/main/java/org/teiid/dqp/internal/process/validator/AuthorizationValidationVisitor.java 2010-03-19 00:20:58 UTC (rev 1975)
@@ -24,24 +24,29 @@
import java.util.ArrayList;
import java.util.Collection;
+import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
+import java.util.Set;
+import org.teiid.adminapi.DataPolicy;
+import org.teiid.adminapi.impl.DataPolicyMetadata;
import org.teiid.adminapi.impl.ModelMetaData;
import org.teiid.adminapi.impl.VDBMetaData;
import org.teiid.dqp.internal.process.DQPWorkContext;
import org.teiid.dqp.internal.process.multisource.MultiSourceElement;
+import org.teiid.logging.api.AuditMessage;
import com.metamatrix.api.exception.MetaMatrixComponentException;
import com.metamatrix.api.exception.MetaMatrixProcessingException;
import com.metamatrix.api.exception.query.QueryMetadataException;
+import com.metamatrix.common.log.LogManager;
+import com.metamatrix.core.log.MessageLevel;
import com.metamatrix.dqp.DQPPlugin;
-import com.metamatrix.dqp.service.AuthorizationService;
-import com.metamatrix.dqp.service.AuthorizationService.Context;
import com.metamatrix.query.function.FunctionLibrary;
import com.metamatrix.query.metadata.TempMetadataID;
import com.metamatrix.query.resolver.util.ResolverUtil;
@@ -60,13 +65,25 @@
import com.metamatrix.query.validator.AbstractValidationVisitor;
public class AuthorizationValidationVisitor extends AbstractValidationVisitor {
-
- private AuthorizationService authInterface;
+
+ public enum Context {
+ QUERY,
+ INSERT,
+ UPDATE,
+ DELETE,
+ STORED_PROCEDURE;
+ }
+
private VDBMetaData vdb;
+ private HashMap<String, DataPolicy> allowedPolicies;
+ private String userName;
+ private boolean useEntitlements;
- public AuthorizationValidationVisitor(AuthorizationService authInterface, VDBMetaData vdb) {
- this.authInterface = authInterface;
+ public AuthorizationValidationVisitor(VDBMetaData vdb, boolean useEntitlements, HashMap<String, DataPolicy> policies, String user) {
this.vdb = vdb;
+ this.allowedPolicies = policies;
+ this.userName = user;
+ this.useEntitlements = useEntitlements;
}
// ############### Visitor methods for language objects ##################
@@ -84,34 +101,24 @@
}
public void visit(Delete obj) {
- if (this.authInterface != null && this.authInterface.checkingEntitlements()) {
- validateEntitlements(obj);
- }
+ validateEntitlements(obj);
}
public void visit(Insert obj) {
- if (this.authInterface != null && this.authInterface.checkingEntitlements()) {
- validateEntitlements(obj);
- }
+ validateEntitlements(obj);
}
public void visit(Query obj) {
- if (this.authInterface != null && this.authInterface.checkingEntitlements()) {
- validateEntitlements(obj);
- }
+ validateEntitlements(obj);
}
public void visit(Update obj) {
- if (this.authInterface != null && this.authInterface.checkingEntitlements()) {
- validateEntitlements(obj);
- }
+ validateEntitlements(obj);
}
public void visit(StoredProcedure obj) {
this.validateModelVisibility(obj.getModelID(), obj.getGroup());
- if (this.authInterface != null && this.authInterface.checkingEntitlements()) {
- validateEntitlements(obj);
- }
+ validateEntitlements(obj);
}
public void visit(Function obj) {
@@ -119,13 +126,11 @@
try {
ResolverUtil.ResolvedLookup lookup = ResolverUtil.resolveLookup(obj, this.getMetadata());
validateModelVisibility(getMetadata().getModelID(lookup.getGroup().getMetadataID()), lookup.getGroup());
- if (this.authInterface != null && this.authInterface.checkingEntitlements()) {
- List<Symbol> symbols = new LinkedList<Symbol>();
- symbols.add(lookup.getGroup());
- symbols.add(lookup.getKeyElement());
- symbols.add(lookup.getReturnElement());
- validateEntitlements(symbols, AuthorizationService.ACTION_READ, Context.QUERY);
- }
+ List<Symbol> symbols = new LinkedList<Symbol>();
+ symbols.add(lookup.getGroup());
+ symbols.add(lookup.getKeyElement());
+ symbols.add(lookup.getReturnElement());
+ validateEntitlements(symbols, DataPolicy.PermissionType.READ, Context.QUERY);
} catch (MetaMatrixComponentException e) {
handleException(e, obj);
} catch (MetaMatrixProcessingException e) {
@@ -142,7 +147,7 @@
protected void validateEntitlements(Insert obj) {
validateEntitlements(
obj.getVariables(),
- AuthorizationService.ACTION_CREATE,
+ DataPolicy.PermissionType.CREATE,
Context.INSERT);
}
@@ -154,13 +159,13 @@
if (obj.getCriteria() != null) {
validateEntitlements(
ElementCollectorVisitor.getElements(obj.getCriteria(), true),
- AuthorizationService.ACTION_READ,
+ DataPolicy.PermissionType.READ,
Context.UPDATE);
}
// The variables from the changes must be checked for UPDATE entitlement
// validateEntitlements on all the variables used in the update.
- validateEntitlements(obj.getChangeList().getClauseMap().keySet(), AuthorizationService.ACTION_UPDATE, Context.UPDATE);
+ validateEntitlements(obj.getChangeList().getClauseMap().keySet(), DataPolicy.PermissionType.UPDATE, Context.UPDATE);
}
/**
@@ -171,14 +176,14 @@
if (obj.getCriteria() != null) {
validateEntitlements(
ElementCollectorVisitor.getElements(obj.getCriteria(), true),
- AuthorizationService.ACTION_READ,
+ DataPolicy.PermissionType.READ,
Context.DELETE);
}
// Check that all elements of group being deleted have delete permission
HashSet deleteVars = new HashSet();
deleteVars.add(obj.getGroup());
- validateEntitlements(deleteVars, AuthorizationService.ACTION_DELETE, Context.DELETE);
+ validateEntitlements(deleteVars, DataPolicy.PermissionType.DELETE, Context.DELETE);
}
/**
@@ -198,7 +203,7 @@
handleException(err, intoGroup);
}
validateEntitlements(intoElements,
- AuthorizationService.ACTION_CREATE,
+ DataPolicy.PermissionType.CREATE,
Context.INSERT);
}
@@ -212,7 +217,7 @@
return;
}
- validateEntitlements(entitledObjects, AuthorizationService.ACTION_READ, Context.QUERY);
+ validateEntitlements(entitledObjects, DataPolicy.PermissionType.READ, Context.QUERY);
}
/**
@@ -221,15 +226,15 @@
protected void validateEntitlements(StoredProcedure obj) {
List symbols = new ArrayList(1);
symbols.add(obj.getGroup());
- validateEntitlements(symbols, AuthorizationService.ACTION_READ, Context.STORED_PROCEDURE);
+ validateEntitlements(symbols, DataPolicy.PermissionType.READ, Context.STORED_PROCEDURE);
}
- private String getActionLabel(int actionCode) {
+ private String getActionLabel(DataPolicy.PermissionType actionCode) {
switch(actionCode) {
- case AuthorizationService.ACTION_READ: return "Read"; //$NON-NLS-1$
- case AuthorizationService.ACTION_CREATE: return "Create"; //$NON-NLS-1$
- case AuthorizationService.ACTION_UPDATE: return "Update"; //$NON-NLS-1$
- case AuthorizationService.ACTION_DELETE: return "Delete"; //$NON-NLS-1$
+ case READ: return "Read"; //$NON-NLS-1$
+ case CREATE: return "Create"; //$NON-NLS-1$
+ case UPDATE: return "Update"; //$NON-NLS-1$
+ case DELETE: return "Delete"; //$NON-NLS-1$
default: return "UNKNOWN"; //$NON-NLS-1$
}
}
@@ -241,7 +246,7 @@
* @param actionCode The actions to validate for
* @param auditContext The {@link AuthorizationService} to use when resource auditing is done.
*/
- protected void validateEntitlements(Collection symbols, int actionCode, Context auditContext) {
+ protected void validateEntitlements(Collection symbols, DataPolicy.PermissionType actionCode, Context auditContext) {
Map nameToSymbolMap = new HashMap();
Iterator symbolIter = symbols.iterator();
while(symbolIter.hasNext()) {
@@ -271,25 +276,21 @@
}
if (!nameToSymbolMap.isEmpty()) {
- try {
- Collection inaccessibleResources = this.authInterface.getInaccessibleResources(actionCode, nameToSymbolMap.keySet(), auditContext);
- if(inaccessibleResources.size() > 0) {
- List inaccessibleSymbols = new ArrayList(inaccessibleResources.size());
- Iterator nameIter = inaccessibleResources.iterator();
- while(nameIter.hasNext()) {
- String name = (String) nameIter.next();
- inaccessibleSymbols.add(nameToSymbolMap.get(name));
- }
-
- // CASE 2362 - do not include the names of the elements for which the user
- // is not authorized in the exception message
-
- handleValidationError(
- DQPPlugin.Util.getString("ERR.018.005.0095", new Object[]{DQPWorkContext.getWorkContext().getConnectionID(), getActionLabel(actionCode)}), //$NON-NLS-1$
- inaccessibleSymbols);
+ Collection inaccessibleResources = getInaccessibleResources(actionCode, nameToSymbolMap.keySet(), auditContext);
+ if(inaccessibleResources.size() > 0) {
+ List inaccessibleSymbols = new ArrayList(inaccessibleResources.size());
+ Iterator nameIter = inaccessibleResources.iterator();
+ while(nameIter.hasNext()) {
+ String name = (String) nameIter.next();
+ inaccessibleSymbols.add(nameToSymbolMap.get(name));
}
- } catch(MetaMatrixComponentException e) {
- handleException(e);
+
+ // CASE 2362 - do not include the names of the elements for which the user
+ // is not authorized in the exception message
+
+ handleValidationError(
+ DQPPlugin.Util.getString("ERR.018.005.0095", new Object[]{DQPWorkContext.getWorkContext().getConnectionID(), getActionLabel(actionCode)}), //$NON-NLS-1$
+ inaccessibleSymbols);
}
}
@@ -310,4 +311,46 @@
}
}
+
+ /**
+ * Out of resources specified, return the subset for which the specified not have authorization to access.
+ */
+ public Set<String> getInaccessibleResources(DataPolicy.PermissionType action, Set<String> resources, Context context) {
+
+ LogManager.logDetail(com.metamatrix.common.log.LogConstants.CTX_AUTHORIZATION, new Object[]{"getInaccessibleResources(", this.userName, ", ", context, ", ", resources, ")"}); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+
+ if (!this.useEntitlements) {
+ return Collections.EMPTY_SET;
+ }
+
+ // Audit - request
+ AuditMessage msg = new AuditMessage(context.name(), "getInaccessibleResources-request", this.userName, resources.toArray(new String[resources.size()])); //$NON-NLS-1$
+ LogManager.log(MessageLevel.INFO, com.metamatrix.common.log.LogConstants.CTX_AUDITLOGGING, msg);
+
+ HashSet<String> results = new HashSet<String>(resources);
+
+ for(DataPolicy p:this.allowedPolicies.values()) {
+ DataPolicyMetadata policy = (DataPolicyMetadata)p;
+
+ if (results.isEmpty()) {
+ break;
+ }
+
+ Iterator<String> i = results.iterator();
+ while (i.hasNext()) {
+ if (policy.allows(i.next(), action)) {
+ i.remove();
+ }
+ }
+ }
+
+ if (results.isEmpty()) {
+ msg = new AuditMessage(context.name(), "getInaccessibleResources-granted all", this.userName, resources.toArray(new String[resources.size()])); //$NON-NLS-1$
+ LogManager.log(MessageLevel.INFO, com.metamatrix.common.log.LogConstants.CTX_AUDITLOGGING, msg);
+ } else {
+ msg = new AuditMessage(context.name(), "getInaccessibleResources-denied", this.userName, resources.toArray(new String[resources.size()])); //$NON-NLS-1$
+ LogManager.log(MessageLevel.INFO, com.metamatrix.common.log.LogConstants.CTX_AUDITLOGGING, msg);
+ }
+ return results;
+ }
}
Deleted: trunk/engine/src/test/java/com/metamatrix/dqp/service/FakeAuthorizationService.java
===================================================================
--- trunk/engine/src/test/java/com/metamatrix/dqp/service/FakeAuthorizationService.java 2010-03-18 18:26:59 UTC (rev 1974)
+++ trunk/engine/src/test/java/com/metamatrix/dqp/service/FakeAuthorizationService.java 2010-03-19 00:20:58 UTC (rev 1975)
@@ -1,157 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package com.metamatrix.dqp.service;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-
-import org.teiid.security.roles.AuthorizationPolicy;
-import org.teiid.security.roles.AuthorizationRealm;
-
-import com.metamatrix.api.exception.MetaMatrixComponentException;
-import com.metamatrix.api.exception.security.AuthorizationException;
-import com.metamatrix.api.exception.security.AuthorizationMgmtException;
-
-/**
- */
-public class FakeAuthorizationService implements AuthorizationService {
-
- // Inaccessible resources
- private Set knownResources = new HashSet();
- private boolean defaultAllow;
-
- public FakeAuthorizationService(boolean defaultAllow) {
- this.defaultAllow = defaultAllow;
- }
-
- public void addResource(int action, String resource) {
- knownResources.add(new Resource(action, resource));
- }
-
- @Override
- public Collection getInaccessibleResources(int action,
- Collection resources, Context context)
- throws MetaMatrixComponentException {
- List found = new ArrayList();
-
- if (resources.isEmpty()) {
- throw new MetaMatrixComponentException("expected resources"); //$NON-NLS-1$
- }
-
- Iterator rIter = resources.iterator();
- while(rIter.hasNext()) {
- String resourceName = (String) rIter.next();
-
- Resource key = new Resource(action, resourceName);
-
- boolean foundResource = knownResources.contains(key);
- if (!foundResource && !defaultAllow) {
- found.add(resourceName);
- } else if (foundResource && defaultAllow) {
- found.add(resourceName);
- }
- }
-
- return found;
- }
-
- /**
- * Determine whether entitlements checking is enabled on the server.
- *
- * @return <code>true</code> iff server-side entitlements checking is enabled.
- */
- public boolean checkingEntitlements() {
- return true;
- }
-
- private static class Resource {
- public int action;
- public String resource;
-
- public Resource(int action, String resource) {
- this.action = action;
- this.resource = resource;
- }
-
- public String toString() {
- return resource;
- }
-
- /**
- * @see java.lang.Object#hashCode()
- */
- public int hashCode() {
- return resource.hashCode() * action;
- }
-
- /**
- * @see java.lang.Object#equals(java.lang.Object)
- */
- public boolean equals(Object obj) {
- if (obj == this) {
- return true;
- }
-
- if (!(obj instanceof Resource)) {
- return false;
- }
-
- Resource other = (Resource)obj;
-
- return other.action == this.action
- && other.resource.equalsIgnoreCase(this.resource);
- }
- }
-
- /**
- * @see com.metamatrix.dqp.service.AuthorizationService#hasRole(java.lang.String, java.lang.String, java.lang.String)
- */
- public boolean hasRole(String roleType,
- String roleName) throws MetaMatrixComponentException {
- return false;
- }
-
- @Override
- public boolean isCallerInRole(String roleName)
- throws AuthorizationMgmtException {
- return false;
- }
-
- @Override
- public Collection<AuthorizationPolicy> getPoliciesInRealm(
- AuthorizationRealm realm)
- throws AuthorizationException, AuthorizationMgmtException {
- return null;
- }
-
- @Override
- public void updatePoliciesInRealm(AuthorizationRealm realm,
- Collection<AuthorizationPolicy> policies)
- throws AuthorizationMgmtException {
-
- }
-}
Modified: trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestPreparedStatement.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestPreparedStatement.java 2010-03-18 18:26:59 UTC (rev 1974)
+++ trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestPreparedStatement.java 2010-03-19 00:20:58 UTC (rev 1975)
@@ -251,7 +251,7 @@
ConnectorManagerRepository repo = Mockito.mock(ConnectorManagerRepository.class);
Mockito.stub(repo.getConnectorManager(Mockito.anyString())).toReturn(new AutoGenDataService());
- serverRequest.initialize(request, BufferManagerFactory.getStandaloneBufferManager(), null, new FakeTransactionService(), null, DEBUG, null, workContext, 101024,repo);
+ serverRequest.initialize(request, BufferManagerFactory.getStandaloneBufferManager(), null, new FakeTransactionService(), DEBUG, null, workContext, 101024,repo, false);
serverRequest.setMetadata(capFinder, metadata, null);
serverRequest.processRequest();
Modified: trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestRequest.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestRequest.java 2010-03-18 18:26:59 UTC (rev 1974)
+++ trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestRequest.java 2010-03-19 00:20:58 UTC (rev 1975)
@@ -86,7 +86,7 @@
RequestMessage message = new RequestMessage();
DQPWorkContext workContext = FakeMetadataFactory.buildWorkContext(metadata, FakeMetadataFactory.example1VDB());
- request.initialize(message, null, null, null,null,false, null, workContext, 101024, repo);
+ request.initialize(message, null, null,null,false, null, workContext, 101024, repo, false);
request.initMetadata();
request.validateAccess(command);
}
@@ -143,8 +143,8 @@
Mockito.stub(repo.getConnectorManager(Mockito.anyString())).toReturn(new AutoGenDataService());
request.initialize(message, Mockito.mock(BufferManager.class),
- new FakeDataManager(), null, null, false, null, workContext,
- 101024, repo);
+ new FakeDataManager(), null, false, null, workContext,
+ 101024, repo, false);
request.processRequest();
return request;
Modified: trunk/engine/src/test/java/org/teiid/dqp/internal/process/validator/TestAuthorizationValidationVisitor.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/dqp/internal/process/validator/TestAuthorizationValidationVisitor.java 2010-03-18 18:26:59 UTC (rev 1974)
+++ trunk/engine/src/test/java/org/teiid/dqp/internal/process/validator/TestAuthorizationValidationVisitor.java 2010-03-19 00:20:58 UTC (rev 1975)
@@ -23,22 +23,24 @@
package org.teiid.dqp.internal.process.validator;
import java.util.Arrays;
+import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
import junit.framework.TestCase;
-import org.mockito.Mockito;
+import org.teiid.adminapi.DataPolicy;
+import org.teiid.adminapi.DataPolicy.PermissionType;
+import org.teiid.adminapi.impl.DataPolicyMetadata;
import org.teiid.adminapi.impl.VDBMetaData;
+import org.teiid.adminapi.impl.DataPolicyMetadata.PermissionMetaData;
import org.teiid.dqp.internal.process.Request;
import com.metamatrix.api.exception.MetaMatrixComponentException;
import com.metamatrix.api.exception.query.QueryParserException;
import com.metamatrix.api.exception.query.QueryResolverException;
import com.metamatrix.api.exception.query.QueryValidatorException;
-import com.metamatrix.dqp.service.AuthorizationService;
-import com.metamatrix.dqp.service.FakeAuthorizationService;
import com.metamatrix.query.metadata.QueryMetadataInterface;
import com.metamatrix.query.parser.QueryParser;
import com.metamatrix.query.resolver.QueryResolver;
@@ -60,71 +62,108 @@
public TestAuthorizationValidationVisitor(String name) {
super(name);
}
+
+ PermissionMetaData addResource(PermissionType type, boolean flag, String resource) {
+ PermissionMetaData p = new PermissionMetaData();
+ p.setResourceName(resource);
+ switch(type) {
+ case CREATE:
+ p.setAllowCreate(flag);
+ break;
+ case DELETE:
+ p.setAllowDelete(flag);
+ break;
+ case READ:
+ p.setAllowRead(flag);
+ break;
+ case UPDATE:
+ p.setAllowUpdate(flag);
+ break;
+ }
+ return p;
+ }
+ PermissionMetaData addResource(PermissionType type, String resource) {
+ return addResource(type, true, resource);
+ }
- private AuthorizationService exampleAuthSvc1() {
- FakeAuthorizationService svc = new FakeAuthorizationService(false);
+ private DataPolicyMetadata exampleAuthSvc1() {
+ DataPolicyMetadata svc = new DataPolicyMetadata();
+ svc.setName("test"); //$NON-NLS-1$
// pm1.g1
- svc.addResource(AuthorizationService.ACTION_DELETE, "pm1.g1"); //$NON-NLS-1$
+ svc.addPermission(addResource(PermissionType.DELETE, "pm1.g1")); //$NON-NLS-1$
- svc.addResource(AuthorizationService.ACTION_READ, "pm1.g1"); //$NON-NLS-1$
- svc.addResource(AuthorizationService.ACTION_READ, "pm1.g1.e1"); //$NON-NLS-1$
+ svc.addPermission(addResource(DataPolicy.PermissionType.READ, "pm1.g1")); //$NON-NLS-1$
+ svc.addPermission(addResource(DataPolicy.PermissionType.READ, "pm1.g1.e1")); //$NON-NLS-1$
+ svc.addPermission(addResource(DataPolicy.PermissionType.READ, false, "pm1.g1.e2")); //$NON-NLS-1$
- svc.addResource(AuthorizationService.ACTION_CREATE, "pm1.g1"); //$NON-NLS-1$
- svc.addResource(AuthorizationService.ACTION_CREATE, "pm1.g1.e1"); //$NON-NLS-1$
- svc.addResource(AuthorizationService.ACTION_CREATE, "pm1.g1.e2"); //$NON-NLS-1$
- svc.addResource(AuthorizationService.ACTION_CREATE, "pm1.g1.e3"); //$NON-NLS-1$
- svc.addResource(AuthorizationService.ACTION_CREATE, "pm1.g1.e4"); //$NON-NLS-1$
+ svc.addPermission(addResource(DataPolicy.PermissionType.CREATE, "pm1.g1")); //$NON-NLS-1$
+ svc.addPermission(addResource(DataPolicy.PermissionType.CREATE, "pm1.g1.e1")); //$NON-NLS-1$
+ svc.addPermission(addResource(DataPolicy.PermissionType.CREATE, "pm1.g1.e2")); //$NON-NLS-1$
+ svc.addPermission(addResource(DataPolicy.PermissionType.CREATE, "pm1.g1.e3")); //$NON-NLS-1$
+ svc.addPermission(addResource(DataPolicy.PermissionType.CREATE, "pm1.g1.e4")); //$NON-NLS-1$
- svc.addResource(AuthorizationService.ACTION_UPDATE, "pm1.g1"); //$NON-NLS-1$
- svc.addResource(AuthorizationService.ACTION_UPDATE, "pm1.g1.e2"); //$NON-NLS-1$
- svc.addResource(AuthorizationService.ACTION_UPDATE, "pm1.g1.e3"); //$NON-NLS-1$
- svc.addResource(AuthorizationService.ACTION_UPDATE, "pm1.g1.e4"); //$NON-NLS-1$
+ svc.addPermission(addResource(DataPolicy.PermissionType.UPDATE, "pm1.g1")); //$NON-NLS-1$
+ svc.addPermission(addResource(DataPolicy.PermissionType.UPDATE, false, "pm1.g1.e1")); //$NON-NLS-1$
+ svc.addPermission(addResource(DataPolicy.PermissionType.UPDATE, "pm1.g1.e2")); //$NON-NLS-1$
+ svc.addPermission(addResource(DataPolicy.PermissionType.UPDATE, "pm1.g1.e3")); //$NON-NLS-1$
+ svc.addPermission(addResource(DataPolicy.PermissionType.UPDATE, "pm1.g1.e4")); //$NON-NLS-1$
+
// pm1.g2
- svc.addResource(AuthorizationService.ACTION_CREATE, "pm1.g2"); //$NON-NLS-1$
- svc.addResource(AuthorizationService.ACTION_CREATE, "pm1.g2.e2"); //$NON-NLS-1$
- svc.addResource(AuthorizationService.ACTION_CREATE, "pm1.g2.e3"); //$NON-NLS-1$
- svc.addResource(AuthorizationService.ACTION_CREATE, "pm1.g2.e4"); //$NON-NLS-1$
+ svc.addPermission(addResource(DataPolicy.PermissionType.CREATE, "pm1.g2")); //$NON-NLS-1$
+ svc.addPermission(addResource(DataPolicy.PermissionType.CREATE, false, "pm1.g2.e1")); //$NON-NLS-1$
+ svc.addPermission(addResource(DataPolicy.PermissionType.CREATE, "pm1.g2.e2")); //$NON-NLS-1$
+ svc.addPermission(addResource(DataPolicy.PermissionType.CREATE, "pm1.g2.e3")); //$NON-NLS-1$
+ svc.addPermission(addResource(DataPolicy.PermissionType.CREATE, "pm1.g2.e4")); //$NON-NLS-1$
- svc.addResource(AuthorizationService.ACTION_UPDATE, "pm1.g2"); //$NON-NLS-1$
- svc.addResource(AuthorizationService.ACTION_UPDATE, "pm1.g2.e2"); //$NON-NLS-1$
- svc.addResource(AuthorizationService.ACTION_UPDATE, "pm1.g2.e3"); //$NON-NLS-1$
- svc.addResource(AuthorizationService.ACTION_UPDATE, "pm1.g2.e4"); //$NON-NLS-1$
+ svc.addPermission(addResource(DataPolicy.PermissionType.UPDATE, "pm1.g2")); //$NON-NLS-1$
+ svc.addPermission(addResource(DataPolicy.PermissionType.UPDATE, false, "pm1.g2.e1")); //$NON-NLS-1$
+ svc.addPermission(addResource(DataPolicy.PermissionType.UPDATE, "pm1.g2.e2")); //$NON-NLS-1$
+ svc.addPermission(addResource(DataPolicy.PermissionType.UPDATE, "pm1.g2.e3")); //$NON-NLS-1$
+ svc.addPermission(addResource(DataPolicy.PermissionType.UPDATE, "pm1.g2.e4")); //$NON-NLS-1$
// pm1.g4
- svc.addResource(AuthorizationService.ACTION_DELETE, "pm1.g4"); //$NON-NLS-1$
- svc.addResource(AuthorizationService.ACTION_DELETE, "pm1.g4.e1"); //$NON-NLS-1$
- svc.addResource(AuthorizationService.ACTION_DELETE, "pm1.g4.e2"); //$NON-NLS-1$
+ svc.addPermission(addResource(DataPolicy.PermissionType.DELETE, "pm1.g4")); //$NON-NLS-1$
+ svc.addPermission(addResource(DataPolicy.PermissionType.DELETE, "pm1.g4.e1")); //$NON-NLS-1$
+ svc.addPermission(addResource(DataPolicy.PermissionType.DELETE, "pm1.g4.e2")); //$NON-NLS-1$
// pm1.sq2
- svc.addResource(AuthorizationService.ACTION_READ, "pm1.sq1"); //$NON-NLS-1$
+ svc.addPermission(addResource(DataPolicy.PermissionType.READ, "pm1.sq1")); //$NON-NLS-1$
return svc;
}
//allow by default
- private AuthorizationService exampleAuthSvc2() {
- FakeAuthorizationService svc = new FakeAuthorizationService(true);
+ private DataPolicyMetadata exampleAuthSvc2() {
+ DataPolicyMetadata svc = new DataPolicyMetadata();
+ svc.setName("test"); //$NON-NLS-1$
+
+ svc.addPermission(addResource(DataPolicy.PermissionType.CREATE, "pm1.g2")); //$NON-NLS-1$
+ svc.addPermission(addResource(DataPolicy.PermissionType.READ, "pm1.g2")); //$NON-NLS-1$
+ svc.addPermission(addResource(DataPolicy.PermissionType.READ, "pm2.g1")); //$NON-NLS-1$
- // pm2.g2
- svc.addResource(AuthorizationService.ACTION_CREATE, "pm2.g2.e1"); //$NON-NLS-1$
+ // pm2.g2
+ svc.addPermission(addResource(DataPolicy.PermissionType.CREATE, "pm2.g2.e1")); //$NON-NLS-1$
// pm3.g2
- svc.addResource(AuthorizationService.ACTION_CREATE, "pm3.g2.e1"); //$NON-NLS-1$
- svc.addResource(AuthorizationService.ACTION_CREATE, "pm3.g2.e2"); //$NON-NLS-1$
+ svc.addPermission(addResource(DataPolicy.PermissionType.CREATE, "pm3.g2.e1")); //$NON-NLS-1$
+ svc.addPermission(addResource(DataPolicy.PermissionType.CREATE, "pm3.g2.e2")); //$NON-NLS-1$
return svc;
}
- private void helpTest(AuthorizationService svc, String sql, QueryMetadataInterface metadata, String[] expectedInaccesible, VDBMetaData vdb) throws QueryParserException, QueryResolverException, MetaMatrixComponentException {
+ private void helpTest(DataPolicyMetadata policy, String sql, QueryMetadataInterface metadata, String[] expectedInaccesible, VDBMetaData vdb) throws QueryParserException, QueryResolverException, MetaMatrixComponentException {
QueryParser parser = QueryParser.getQueryParser();
Command command = parser.parseCommand(sql);
QueryResolver.resolveCommand(command, metadata);
vdb.addAttchment(QueryMetadataInterface.class, metadata);
- AuthorizationValidationVisitor visitor = new AuthorizationValidationVisitor(svc, vdb);
+ HashMap<String, DataPolicy> policies = new HashMap<String, DataPolicy>();
+ policies.put(policy.getName(), policy);
+
+ AuthorizationValidationVisitor visitor = new AuthorizationValidationVisitor(vdb, true, policies, "test"); //$NON-NLS-1$
ValidatorReport report = Validator.validate(command, metadata, visitor);
if(report.hasItems()) {
ValidatorFailure firstFailure = (ValidatorFailure) report.getItems().iterator().next();
@@ -213,11 +252,11 @@
}
public void testSelectIntoTarget_e1_NotAccessible() throws Exception {
- helpTest(exampleAuthSvc2(), "SELECT e1, e2, e3, e4 INTO pm2.g2 FROM pm2.g1", FakeMetadataFactory.example1Cached(), new String[] {"pm2.g2.e1"}, FakeMetadataFactory.example1VDB()); //$NON-NLS-1$ //$NON-NLS-2$
+ helpTest(exampleAuthSvc2(), "SELECT e1, e2, e3, e4 INTO pm2.g2 FROM pm2.g1", FakeMetadataFactory.example1Cached(), new String[] {"pm2.g2.e2","pm2.g2.e4","pm2.g2.e3"}, FakeMetadataFactory.example1VDB()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
}
public void testSelectIntoTarget_e1e2_NotAccessible() throws Exception {
- helpTest(exampleAuthSvc2(), "SELECT e1, e2, e3, e4 INTO pm3.g2 FROM pm2.g1", FakeMetadataFactory.example1Cached(), new String[] {"pm3.g2.e1", "pm3.g2.e2"},FakeMetadataFactory.example1VDB()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ helpTest(exampleAuthSvc2(), "SELECT e1, e2, e3, e4 INTO pm3.g2 FROM pm2.g1", FakeMetadataFactory.example1Cached(), new String[] {"pm3.g2.e4", "pm3.g2.e3"},FakeMetadataFactory.example1VDB()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
public void testTempTableSelectInto() throws Exception {
@@ -233,7 +272,7 @@
}
public void testXMLAccessible() throws Exception {
- helpTest(exampleAuthSvc2(), "select * from xmltest.doc1", FakeMetadataFactory.example1Cached(), new String[] {}, FakeMetadataFactory.example1VDB()); //$NON-NLS-1$
+ helpTest(exampleAuthSvc2(), "select * from xmltest.doc1", FakeMetadataFactory.example1Cached(), new String[] {"xmltest.doc1"}, FakeMetadataFactory.example1VDB()); //$NON-NLS-1$ //$NON-NLS-2$
}
public void testXMLInAccessible() throws Exception {
@@ -242,10 +281,8 @@
private void helpTestLookupVisibility(boolean visible) throws QueryParserException, QueryValidatorException, MetaMatrixComponentException {
VDBMetaData vdb = FakeMetadataFactory.example1VDB();
- if (!visible) {
- vdb.getModel("pm1").setVisible(false);
- }
- AuthorizationValidationVisitor mvvv = new AuthorizationValidationVisitor(Mockito.mock(AuthorizationService.class), vdb);
+ vdb.getModel("pm1").setVisible(visible); //$NON-NLS-1$
+ AuthorizationValidationVisitor mvvv = new AuthorizationValidationVisitor(vdb, false, new HashMap<String, DataPolicy>(), "test"); //$NON-NLS-1$
String sql = "select lookup('pm1.g1', 'e1', 'e2', 1)"; //$NON-NLS-1$
Command command = QueryParser.getQueryParser().parseCommand(sql);
Request.validateWithVisitor(mvvv, FakeMetadataFactory.example1Cached(), command);
Modified: trunk/jboss-integration/src/main/java/org/teiid/jboss/deployers/RuntimeEngineDeployer.java
===================================================================
--- trunk/jboss-integration/src/main/java/org/teiid/jboss/deployers/RuntimeEngineDeployer.java 2010-03-18 18:26:59 UTC (rev 1974)
+++ trunk/jboss-integration/src/main/java/org/teiid/jboss/deployers/RuntimeEngineDeployer.java 2010-03-19 00:20:58 UTC (rev 1975)
@@ -74,7 +74,6 @@
import com.metamatrix.core.log.MessageLevel;
import com.metamatrix.dqp.client.DQP;
import com.metamatrix.dqp.client.DQPManagement;
-import com.metamatrix.dqp.service.AuthorizationService;
import com.metamatrix.dqp.service.BufferService;
import com.metamatrix.dqp.service.SessionService;
import com.metamatrix.dqp.service.TransactionService;
@@ -216,10 +215,6 @@
this.dqpCore.setWorkManager(mgr);
}
- public void setAuthorizationService(AuthorizationService service) {
- this.dqpCore.setAuthorizationService(service);
- }
-
public void setSessionService(SessionService service) {
this.sessionService = service;
service.setDqp(this.dqpCore);
Deleted: trunk/runtime/src/main/java/org/teiid/services/AuthorizationServiceImpl.java
===================================================================
--- trunk/runtime/src/main/java/org/teiid/services/AuthorizationServiceImpl.java 2010-03-18 18:26:59 UTC (rev 1974)
+++ trunk/runtime/src/main/java/org/teiid/services/AuthorizationServiceImpl.java 2010-03-19 00:20:58 UTC (rev 1975)
@@ -1,465 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package org.teiid.services;
-
-import java.io.Serializable;
-import java.security.Principal;
-import java.security.acl.Group;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Enumeration;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-
-import org.jboss.managed.api.annotation.ManagementComponent;
-import org.jboss.managed.api.annotation.ManagementObject;
-import org.jboss.managed.api.annotation.ManagementProperties;
-import org.jboss.managed.api.annotation.ManagementProperty;
-import org.teiid.adminapi.AdminRoles;
-import org.teiid.adminapi.impl.VDBMetaData;
-import org.teiid.deployers.VDBRepository;
-import org.teiid.dqp.internal.process.DQPWorkContext;
-import org.teiid.logging.api.AuditMessage;
-import org.teiid.runtime.RuntimePlugin;
-import org.teiid.security.roles.AuthorizationActions;
-import org.teiid.security.roles.AuthorizationPermission;
-import org.teiid.security.roles.AuthorizationPoliciesHolder;
-import org.teiid.security.roles.AuthorizationPolicy;
-import org.teiid.security.roles.AuthorizationPolicyFactory;
-import org.teiid.security.roles.AuthorizationRealm;
-import org.teiid.security.roles.BasicAuthorizationPermission;
-import org.teiid.security.roles.BasicAuthorizationPermissionFactory;
-import org.teiid.security.roles.RolePermissionFactory;
-import org.teiid.security.roles.StandardAuthorizationActions;
-
-import com.metamatrix.admin.api.exception.security.InvalidSessionException;
-import com.metamatrix.api.exception.MetaMatrixComponentException;
-import com.metamatrix.api.exception.security.AuthorizationMgmtException;
-import com.metamatrix.common.log.LogManager;
-import com.metamatrix.core.log.MessageLevel;
-import com.metamatrix.core.util.LRUCache;
-import com.metamatrix.dqp.service.AuthorizationService;
-import com.metamatrix.platform.security.api.MetaMatrixPrincipal;
-import com.metamatrix.platform.security.api.MetaMatrixPrincipalName;
-import com.metamatrix.platform.security.api.SessionToken;
-import com.metamatrix.vdb.runtime.VDBKey;
-
-/**
- * The Authorization Service is responsible for handling requests to determine
- * whether a Principal is entitled to perform a given action on a given resource
- * or set of resources.
- * <p>
- * Administration of the Authorization policies; creating/destroying Policies,
- * adding/deleting Principals and Permissions is available to Principals that
- * have the proper administrative role.
- * </p>
- */
-@ManagementObject(componentType=@ManagementComponent(type="teiid",subtype="dqp"), properties=ManagementProperties.EXPLICIT)
-public class AuthorizationServiceImpl implements AuthorizationService, Serializable {
-
- private static final long serialVersionUID = 5399603007837606243L;
-
- /*
- * Configuration state
- */
- private boolean useEntitlements;
-
- protected LRUCache<VDBKey, Collection<AuthorizationPolicy>> policyCache = new LRUCache<VDBKey, Collection<AuthorizationPolicy>>();
-
- // Permission factory is reusable and thread safe
- private static final BasicAuthorizationPermissionFactory PERMISSION_FACTORY = new BasicAuthorizationPermissionFactory();
-
- private Collection<AuthorizationPolicy> adminPolicies = AuthorizationPolicyFactory.buildDefaultAdminPolicies();
-
- private VDBRepository vdbRepository;
-
- @Override
- public Collection getInaccessibleResources(int action, Collection resources, com.metamatrix.dqp.service.AuthorizationService.Context context) throws MetaMatrixComponentException {
- AuthorizationRealm realm = getRealm(DQPWorkContext.getWorkContext());
- AuthorizationActions actions = getActions(action);
- Collection permissions = createPermissions(realm, resources, actions);
- String auditContext = context.toString();
- Collection inaccessableResources = Collections.EMPTY_LIST;
- try {
- inaccessableResources = getInaccessibleResources(auditContext, permissions);
- } catch (AuthorizationMgmtException e) {
- throw new MetaMatrixComponentException(e);
- }
-
- // Convert inaccessable resources from auth permissions to string resource names
- Collection inaccessableResourceNames = Collections.EMPTY_LIST;
- if ( inaccessableResources != null && inaccessableResources.size() > 0 ) {
- inaccessableResourceNames = new ArrayList();
- for ( Iterator permItr = inaccessableResources.iterator(); permItr.hasNext(); ) {
- AuthorizationPermission permission = (AuthorizationPermission) permItr.next();
- inaccessableResourceNames.add(permission.getResourceName());
- }
- }
- return inaccessableResourceNames;
- }
-
- /**
- * Of those resources specified, return the subset for which the specified account
- * does <emph>NOT</emph> have authorization to access.
- * @param caller the session token of the principal that is calling this method
- * @param contextName the name of the context for the caller (@see AuditContext)
- * @param requests the permissions that detail the resources and the desired form of access
- * @return the subset of <code>requests</code> that the account does <i>not</i> have access to
- * @throws InvalidSessionException if the session token for this cache is not valid
- * @throws AuthorizationMgmtException if this service is unable to locate resources required
- * for this operation
- */
- private Collection getInaccessibleResources(String contextName, Collection requests) throws AuthorizationMgmtException {
-
- SessionToken caller = getSession();
-
- LogManager.logDetail(com.metamatrix.common.log.LogConstants.CTX_AUTHORIZATION, new Object[]{"getInaccessibleResources(", caller, ", ", contextName, ", ", requests, ")"}); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
-
- List<String> resources = new ArrayList<String>();
- if (requests != null && ! requests.isEmpty()) {
- Iterator permItr = requests.iterator();
- while ( permItr.hasNext() ) {
- resources.add(((AuthorizationPermission)permItr.next()).getResourceName());
- }
- }
-
- // Audit - request
- AuditMessage msg = new AuditMessage( contextName, "getInaccessibleResources-request", caller.getUsername(), resources.toArray(new String[resources.size()])); //$NON-NLS-1$
- LogManager.log(MessageLevel.INFO, com.metamatrix.common.log.LogConstants.CTX_AUDITLOGGING, msg);
-
- if (isEntitled()){
- return Collections.EMPTY_LIST;
- }
-
- Collection results = new HashSet(requests);
- Collection policies = this.getPoliciesForPrincipal(getRequestedRealm(requests));
-
- Iterator policyIter = policies.iterator();
-
- while (policyIter.hasNext() && !results.isEmpty()) {
- Iterator requestIter = results.iterator();
- AuthorizationPolicy policy = (AuthorizationPolicy) policyIter.next();
- while (requestIter.hasNext()) {
- AuthorizationPermission request = (AuthorizationPermission) requestIter.next();
- if (policy.implies(request)) {
- requestIter.remove();
- continue;
- }
- }
- }
-
- if (results.isEmpty()) {
- msg = new AuditMessage( contextName, "getInaccessibleResources-granted all", caller.getUsername(), resources.toArray(new String[resources.size()])); //$NON-NLS-1$
- LogManager.log(MessageLevel.INFO, com.metamatrix.common.log.LogConstants.CTX_AUDITLOGGING, msg);
- } else {
- msg = new AuditMessage( contextName, "getInaccessibleResources-denied", caller.getUsername(), resources.toArray(new String[resources.size()])); //$NON-NLS-1$
- LogManager.log(MessageLevel.INFO, com.metamatrix.common.log.LogConstants.CTX_AUDITLOGGING, msg);
- }
- return results;
- }
-
- /**
- * Query <code>requests</code> for the <code>AuthorizationRealm</code> in
- * which they belong.
- * @param requests
- * @return The realm in which <i>all</i> the requests in the collection
- * belong.
- * @throws AuthorizationMgmtException if the request <i>do not all</i>
- * belong to the same realm.
- */
- private static AuthorizationRealm getRequestedRealm(final Collection requests)
- throws AuthorizationMgmtException {
- AuthorizationRealm theRealm = null;
- Iterator requestItr = requests.iterator();
- while (requestItr.hasNext()) {
- AuthorizationPermission aPerm = (AuthorizationPermission) requestItr.next();
- AuthorizationRealm aRealm = aPerm.getRealm();
- if ( theRealm != null ) {
- if ( ! theRealm.equals(aRealm) ) {
- throw new AuthorizationMgmtException(RuntimePlugin.Util.getString("AuthorizationServiceImpl.wrong_realms ")); //$NON-NLS-1$
- }
- } else {
- theRealm = aRealm;
- }
- }
- if ( theRealm == null ) {
- throw new AuthorizationMgmtException(RuntimePlugin.Util.getString("AuthorizationServiceImpl.Authorization_Realm_is_null")); //$NON-NLS-1$
- }
- return theRealm;
- }
-
- @Override
- public boolean hasRole(String roleType, String roleName) throws MetaMatrixComponentException {
-
- AuthorizationRealm realm = null;
-
- if (ADMIN_ROLE.equalsIgnoreCase(roleType)) {
- realm = RolePermissionFactory.getRealm();
- } else if (DATA_ROLE.equalsIgnoreCase(roleType)){
- realm = getRealm(DQPWorkContext.getWorkContext());
- } else {
- return false;
- }
-
- try {
- return hasPolicy(realm, roleName);
- } catch (AuthorizationMgmtException err) {
- throw new MetaMatrixComponentException(err);
- }
- }
-
- private boolean matchesPrincipal(Set<MetaMatrixPrincipalName> principals, AuthorizationPolicy policy) {
- for (MetaMatrixPrincipalName principal : principals) {
- if (policy.getPrincipals().contains(principal)) {
- return true;
- }
- }
- return false;
- }
-
- private boolean hasPolicy(AuthorizationRealm realm, String policyName) throws AuthorizationMgmtException {
-
- if (isEntitled()) {
- return true;
- }
-
- Collection<AuthorizationPolicy> policies = getPoliciesForPrincipal(realm);
-
- HashSet applicablePolicies = new HashSet();
- applicablePolicies.add(policyName);
-
- if (realm == RolePermissionFactory.getRealm()) {
- if (AdminRoles.RoleName.ADMIN_PRODUCT.equals(policyName)) {
- applicablePolicies.add(AdminRoles.RoleName.ADMIN_SYSTEM);
- } else if (AdminRoles.RoleName.ADMIN_READONLY.equals(policyName)) {
- applicablePolicies.add(AdminRoles.RoleName.ADMIN_PRODUCT);
- applicablePolicies.add(AdminRoles.RoleName.ADMIN_SYSTEM);
- }
- }
-
- for (AuthorizationPolicy policy:policies) {
- if (applicablePolicies.contains(policy.getAuthorizationPolicyID().getDisplayName())) {
- return true;
- }
- }
- return false;
- }
-
- /**
- * Return a collection of all policies for which this principal has authorization, caching as needed.
- * Policies are returned for the principal and all groups in which the principal has membership.
- * <br><strong>NOTE:</strong> This method only goes to the authorization store when
- * <emph>none</emph> of the given principal's policies are found in the cache.
- * @param user the user account for which access is being checked; may not be null
- * (this is not checked for, however)
- * @return All policies for which the principal is authenticated - may be empty but never null.
- * @throws AuthorizationMgmtException if this service has trouble connecting to services it uses.
- * @throws MetaMatrixComponentException
- */
- private Collection<AuthorizationPolicy> getPoliciesForPrincipal(AuthorizationRealm realm)
- throws AuthorizationMgmtException {
-
- Set<AuthorizationPolicy> result = new HashSet<AuthorizationPolicy>();
- Set<MetaMatrixPrincipalName> userRoles = getUserRoles();
- if (userRoles.isEmpty()) {
- return result;
- }
-
- Collection<AuthorizationPolicy> policies = getPoliciesInRealm(realm);
-
- for (AuthorizationPolicy policy : policies) {
- if (matchesPrincipal(userRoles, policy)) {
- result.add(policy);
- continue;
- }
- }
- return result;
- }
-
-
- private Set<MetaMatrixPrincipalName> getUserRoles() {
- Set<MetaMatrixPrincipalName> roles = new HashSet<MetaMatrixPrincipalName>();
- Set<Principal> principals = DQPWorkContext.getWorkContext().getSubject().getPrincipals();
- for(Principal p: principals) {
- // this JBoss specific, but no code level dependencies
- if ((p instanceof Group) && p.getName().equals("Roles")){
- Group g = (Group)p;
- Enumeration rolesPrinciples = g.members();
- while(rolesPrinciples.hasMoreElements()) {
- roles.add(new MetaMatrixPrincipalName(((Principal)rolesPrinciples.nextElement()).getName(), MetaMatrixPrincipal.TYPE_GROUP));
- }
- }
- }
- return roles;
- }
-
- @Override
- public Collection<AuthorizationPolicy> getPoliciesInRealm(AuthorizationRealm realm) throws AuthorizationMgmtException {
-
- Collection<AuthorizationPolicy> policies = null;
-
- VDBKey key = null;
-
- if (realm.getSubRealmName() != null) {
- // get data roles for the user
- key = new VDBKey(realm.getSuperRealmName(), realm.getSubRealmName());
- synchronized (this.policyCache) {
- policies = this.policyCache.get(key);
- if (policies == null ) {
- policies = getDataPolicies(realm);
- }
- this.policyCache.put(key, policies);
- }
- }
- else {
- // get admin roles
- policies = getAdminPolicies();
- }
- return policies;
- }
-
- private Collection<AuthorizationPolicy> getDataPolicies(AuthorizationRealm realm) {
- Collection<AuthorizationPolicy> policies = null;
- VDBMetaData vdb = this.vdbRepository.getVDB(realm.getSuperRealmName(), Integer.parseInt(realm.getSubRealmName()));
- AuthorizationPoliciesHolder holder = vdb.getAttachment(AuthorizationPoliciesHolder.class);
-
- if (holder == null) {
- policies = Collections.emptyList();
- }
- else {
- policies = holder.getAuthorizationPolicies();
- //AuthorizationPolicyFactory.buildPolicies(vdb.getName(), String.valueOf(vdb.getVersion()), vdb.getDataRoles());
- }
- return policies;
- }
-
- private Collection<AuthorizationPolicy> getAdminPolicies() {
- return adminPolicies;
- }
-
- @Override
- public void updatePoliciesInRealm(AuthorizationRealm realm, Collection<AuthorizationPolicy> policies) throws AuthorizationMgmtException {
-
- if (realm.getSubRealmName() != null) {
- VDBKey key = new VDBKey(realm.getSuperRealmName(), realm.getSubRealmName());
- synchronized (this.policyCache) {
- policies = this.policyCache.get(key);
- if (policies != null) {
- this.policyCache.remove(key);
- }
- VDBMetaData vdb = this.vdbRepository.getVDB(realm.getSuperRealmName(), Integer.parseInt(realm.getSubRealmName()));
- AuthorizationPoliciesHolder holder = new AuthorizationPoliciesHolder();
- holder.setAuthorizationPolicies(policies);
- vdb.addAttchment(AuthorizationPoliciesHolder.class, holder);
- //vdb.setDataRoles(AuthorizationPolicyFactory.exportPolicies(policies));
- this.policyCache.put(key, policies);
- }
- }
- else {
- // there is no admin API way to update the Admin Roles.
- this.adminPolicies = policies;
- }
- }
-
- protected boolean isEntitled(){
- if (DQPWorkContext.getWorkContext().getSubject() == null) {
- LogManager.logDetail(com.metamatrix.common.log.LogConstants.CTX_AUTHORIZATION,new Object[]{ "Automatically entitling principal", DQPWorkContext.getWorkContext().getSessionToken().getUsername()}); //$NON-NLS-1$
- return true;
- }
- return false;
- }
-
- /**
- * Determine whether entitlements checking is enabled on the server.
- *
- * @return <code>true</code> iff server-side entitlements checking is enabled.
- */
- @Override
- @ManagementProperty(description="Turn on checking the entitlements on resources based on the roles defined in VDB", readOnly=true)
- public boolean checkingEntitlements() {
- return useEntitlements;
- }
-
-
- /**
- * Create realm based on token
- * @param token Used to find info about this session
- * @return Realm to use (based on vdb name and version)
- */
- private AuthorizationRealm getRealm(DQPWorkContext context) {
- return new AuthorizationRealm(context.getVdbName(), String.valueOf(context.getVdbVersion()));
- }
-
- private AuthorizationActions getActions(int actionCode) {
- switch(actionCode) {
- case AuthorizationService.ACTION_READ: return StandardAuthorizationActions.DATA_READ;
- case AuthorizationService.ACTION_CREATE: return StandardAuthorizationActions.DATA_CREATE;
- case AuthorizationService.ACTION_UPDATE: return StandardAuthorizationActions.DATA_UPDATE;
- case AuthorizationService.ACTION_DELETE: return StandardAuthorizationActions.DATA_DELETE;
- default: return StandardAuthorizationActions.DATA_READ;
- }
- }
-
- /**
- * Take a list of resources (Strings) and create a list of permissions
- * suitable for sending to the authorization service.
- * @param realm Realm to use
- * @param resources Collection of String, listing resources
- * @param actions Actions to check for
- * @return Collection of BasicAuthorizationPermission
- */
- private Collection createPermissions(AuthorizationRealm realm, Collection resources, AuthorizationActions actions) {
- List permissions = new ArrayList(resources.size());
- Iterator iter = resources.iterator();
- while(iter.hasNext()) {
- String resource = (String) iter.next();
-
- BasicAuthorizationPermission permission =
- (BasicAuthorizationPermission) PERMISSION_FACTORY.create(resource, realm, actions);
-
- permissions.add(permission);
- }
- return permissions;
- }
-
- public void setVDBRepository(VDBRepository repo) {
- this.vdbRepository = repo;
- }
-
- public void setUseEntitlements(Boolean useEntitlements) {
- this.useEntitlements = useEntitlements.booleanValue();
- }
-
- @Override
- public boolean isCallerInRole(String roleName) throws AuthorizationMgmtException {
- LogManager.logTrace(com.metamatrix.common.log.LogConstants.CTX_AUTHORIZATION, new Object[]{"isCallerInRole(", getSession(), roleName, ")"}); //$NON-NLS-1$ //$NON-NLS-2$
- return hasPolicy(RolePermissionFactory.getRealm(), roleName);
- }
-
- SessionToken getSession() {
- return DQPWorkContext.getWorkContext().getSessionToken();
- }
-}
14 years, 10 months