[teiid-commits] teiid SVN: r1913 - in trunk/connector-api: src/main/java/org/teiid/connector/api and 7 other directories.
teiid-commits at lists.jboss.org
teiid-commits at lists.jboss.org
Thu Mar 4 15:47:37 EST 2010
Author: shawkins
Date: 2010-03-04 15:47:34 -0500 (Thu, 04 Mar 2010)
New Revision: 1913
Added:
trunk/connector-api/src/main/java/org/teiid/connector/api/ConnectionContext.java
trunk/connector-api/src/main/java/org/teiid/connector/basic/BasicManagedConnection.java
trunk/connector-api/src/main/java/org/teiid/connector/basic/BasicManagedConnectionFactory.java
trunk/connector-api/src/main/java/org/teiid/connector/basic/BasicResourceAdapter.java
trunk/connector-api/src/main/java/org/teiid/connector/basic/ConnectionRequestInfoWrapper.java
trunk/connector-api/src/main/java/org/teiid/connector/basic/DefaultConnectorLogger.java
trunk/connector-api/src/main/java/org/teiid/connector/basic/TypeFacilityImpl.java
trunk/connector-api/src/main/java/org/teiid/connector/basic/WrappedConnection.java
trunk/connector-api/src/main/java/org/teiid/connector/basic/WrappedConnector.java
trunk/connector-api/src/main/java/org/teiid/connector/language/AggregateFunction.java
trunk/connector-api/src/main/java/org/teiid/connector/language/AndOr.java
trunk/connector-api/src/main/java/org/teiid/connector/language/Argument.java
trunk/connector-api/src/main/java/org/teiid/connector/language/BaseInCondition.java
trunk/connector-api/src/main/java/org/teiid/connector/language/BaseLanguageObject.java
trunk/connector-api/src/main/java/org/teiid/connector/language/BatchedUpdates.java
trunk/connector-api/src/main/java/org/teiid/connector/language/Call.java
trunk/connector-api/src/main/java/org/teiid/connector/language/ColumnReference.java
trunk/connector-api/src/main/java/org/teiid/connector/language/Command.java
trunk/connector-api/src/main/java/org/teiid/connector/language/Comparison.java
trunk/connector-api/src/main/java/org/teiid/connector/language/Condition.java
trunk/connector-api/src/main/java/org/teiid/connector/language/Delete.java
trunk/connector-api/src/main/java/org/teiid/connector/language/DerivedColumn.java
trunk/connector-api/src/main/java/org/teiid/connector/language/DerivedTable.java
trunk/connector-api/src/main/java/org/teiid/connector/language/Exists.java
trunk/connector-api/src/main/java/org/teiid/connector/language/Expression.java
trunk/connector-api/src/main/java/org/teiid/connector/language/ExpressionValueSource.java
trunk/connector-api/src/main/java/org/teiid/connector/language/Function.java
trunk/connector-api/src/main/java/org/teiid/connector/language/GroupBy.java
trunk/connector-api/src/main/java/org/teiid/connector/language/In.java
trunk/connector-api/src/main/java/org/teiid/connector/language/Insert.java
trunk/connector-api/src/main/java/org/teiid/connector/language/InsertValueSource.java
trunk/connector-api/src/main/java/org/teiid/connector/language/IsNull.java
trunk/connector-api/src/main/java/org/teiid/connector/language/Join.java
trunk/connector-api/src/main/java/org/teiid/connector/language/LanguageFactory.java
trunk/connector-api/src/main/java/org/teiid/connector/language/LanguageObject.java
trunk/connector-api/src/main/java/org/teiid/connector/language/Like.java
trunk/connector-api/src/main/java/org/teiid/connector/language/Limit.java
trunk/connector-api/src/main/java/org/teiid/connector/language/Literal.java
trunk/connector-api/src/main/java/org/teiid/connector/language/MetadataReference.java
trunk/connector-api/src/main/java/org/teiid/connector/language/NamedTable.java
trunk/connector-api/src/main/java/org/teiid/connector/language/Not.java
trunk/connector-api/src/main/java/org/teiid/connector/language/OrderBy.java
trunk/connector-api/src/main/java/org/teiid/connector/language/Predicate.java
trunk/connector-api/src/main/java/org/teiid/connector/language/QueryExpression.java
trunk/connector-api/src/main/java/org/teiid/connector/language/SQLReservedWords.java
trunk/connector-api/src/main/java/org/teiid/connector/language/ScalarSubquery.java
trunk/connector-api/src/main/java/org/teiid/connector/language/SearchedCase.java
trunk/connector-api/src/main/java/org/teiid/connector/language/SearchedWhenClause.java
trunk/connector-api/src/main/java/org/teiid/connector/language/Select.java
trunk/connector-api/src/main/java/org/teiid/connector/language/SetClause.java
trunk/connector-api/src/main/java/org/teiid/connector/language/SetQuery.java
trunk/connector-api/src/main/java/org/teiid/connector/language/SortSpecification.java
trunk/connector-api/src/main/java/org/teiid/connector/language/SubqueryComparison.java
trunk/connector-api/src/main/java/org/teiid/connector/language/SubqueryContainer.java
trunk/connector-api/src/main/java/org/teiid/connector/language/SubqueryIn.java
trunk/connector-api/src/main/java/org/teiid/connector/language/TableReference.java
trunk/connector-api/src/main/java/org/teiid/connector/language/Update.java
trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/Column.java
trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/ColumnSet.java
trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/Datatype.java
trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/ForeignKey.java
trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/KeyRecord.java
trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/MetadataStore.java
trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/Procedure.java
trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/ProcedureParameter.java
trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/Schema.java
trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/Table.java
trunk/connector-api/src/test/java/org/teiid/connector/TestWrappedConnector.java
Removed:
trunk/connector-api/src/main/java/org/teiid/connector/api/ConnectorIdentity.java
trunk/connector-api/src/main/java/org/teiid/connector/api/ConnectorPropertyNames.java
trunk/connector-api/src/main/java/org/teiid/connector/api/CredentialMap.java
trunk/connector-api/src/main/java/org/teiid/connector/api/MappedUserIdentity.java
trunk/connector-api/src/main/java/org/teiid/connector/api/SingleIdentity.java
trunk/connector-api/src/main/java/org/teiid/connector/language/IAggregate.java
trunk/connector-api/src/main/java/org/teiid/connector/language/IBaseInCriteria.java
trunk/connector-api/src/main/java/org/teiid/connector/language/IBatchedUpdates.java
trunk/connector-api/src/main/java/org/teiid/connector/language/ICommand.java
trunk/connector-api/src/main/java/org/teiid/connector/language/ICompareCriteria.java
trunk/connector-api/src/main/java/org/teiid/connector/language/ICompoundCriteria.java
trunk/connector-api/src/main/java/org/teiid/connector/language/ICriteria.java
trunk/connector-api/src/main/java/org/teiid/connector/language/IDelete.java
trunk/connector-api/src/main/java/org/teiid/connector/language/IElement.java
trunk/connector-api/src/main/java/org/teiid/connector/language/IExistsCriteria.java
trunk/connector-api/src/main/java/org/teiid/connector/language/IExpression.java
trunk/connector-api/src/main/java/org/teiid/connector/language/IFrom.java
trunk/connector-api/src/main/java/org/teiid/connector/language/IFromItem.java
trunk/connector-api/src/main/java/org/teiid/connector/language/IFunction.java
trunk/connector-api/src/main/java/org/teiid/connector/language/IGroup.java
trunk/connector-api/src/main/java/org/teiid/connector/language/IGroupBy.java
trunk/connector-api/src/main/java/org/teiid/connector/language/IInCriteria.java
trunk/connector-api/src/main/java/org/teiid/connector/language/IInlineView.java
trunk/connector-api/src/main/java/org/teiid/connector/language/IInsert.java
trunk/connector-api/src/main/java/org/teiid/connector/language/IInsertExpressionValueSource.java
trunk/connector-api/src/main/java/org/teiid/connector/language/IInsertValueSource.java
trunk/connector-api/src/main/java/org/teiid/connector/language/IIsNullCriteria.java
trunk/connector-api/src/main/java/org/teiid/connector/language/IJoin.java
trunk/connector-api/src/main/java/org/teiid/connector/language/ILanguageFactory.java
trunk/connector-api/src/main/java/org/teiid/connector/language/ILanguageObject.java
trunk/connector-api/src/main/java/org/teiid/connector/language/ILikeCriteria.java
trunk/connector-api/src/main/java/org/teiid/connector/language/ILimit.java
trunk/connector-api/src/main/java/org/teiid/connector/language/ILiteral.java
trunk/connector-api/src/main/java/org/teiid/connector/language/ILogicalCriteria.java
trunk/connector-api/src/main/java/org/teiid/connector/language/IMetadataReference.java
trunk/connector-api/src/main/java/org/teiid/connector/language/INotCriteria.java
trunk/connector-api/src/main/java/org/teiid/connector/language/IOrderBy.java
trunk/connector-api/src/main/java/org/teiid/connector/language/IOrderByItem.java
trunk/connector-api/src/main/java/org/teiid/connector/language/IParameter.java
trunk/connector-api/src/main/java/org/teiid/connector/language/IPredicateCriteria.java
trunk/connector-api/src/main/java/org/teiid/connector/language/IProcedure.java
trunk/connector-api/src/main/java/org/teiid/connector/language/IQuery.java
trunk/connector-api/src/main/java/org/teiid/connector/language/IQueryCommand.java
trunk/connector-api/src/main/java/org/teiid/connector/language/IScalarSubquery.java
trunk/connector-api/src/main/java/org/teiid/connector/language/ISearchedCaseExpression.java
trunk/connector-api/src/main/java/org/teiid/connector/language/ISelect.java
trunk/connector-api/src/main/java/org/teiid/connector/language/ISelectSymbol.java
trunk/connector-api/src/main/java/org/teiid/connector/language/ISetClause.java
trunk/connector-api/src/main/java/org/teiid/connector/language/ISetClauseList.java
trunk/connector-api/src/main/java/org/teiid/connector/language/ISetQuery.java
trunk/connector-api/src/main/java/org/teiid/connector/language/ISubqueryCompareCriteria.java
trunk/connector-api/src/main/java/org/teiid/connector/language/ISubqueryContainer.java
trunk/connector-api/src/main/java/org/teiid/connector/language/ISubqueryInCriteria.java
trunk/connector-api/src/main/java/org/teiid/connector/language/IUpdate.java
trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/Column.java
trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/ColumnSet.java
trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/Datatype.java
trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/Element.java
trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/ForeignKey.java
trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/Group.java
trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/KeyRecord.java
trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/MetadataObject.java
trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/MetadataStore.java
trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/Parameter.java
trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/Procedure.java
trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/ProcedureParameter.java
trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/ProcedureRecordImpl.java
trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/Schema.java
trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/Table.java
trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/TypeModel.java
trunk/connector-api/src/main/java/org/teiid/connector/visitor/util/SQLReservedWords.java
trunk/connector-api/src/main/java/org/teiid/connector/xa/api/
trunk/connector-api/src/test/java/org/teiid/connector/TestCredentialMap.java
Modified:
trunk/connector-api/pom.xml
trunk/connector-api/src/main/java/org/teiid/connector/api/Connection.java
trunk/connector-api/src/main/java/org/teiid/connector/api/Connector.java
trunk/connector-api/src/main/java/org/teiid/connector/api/ConnectorAnnotations.java
trunk/connector-api/src/main/java/org/teiid/connector/api/ConnectorCapabilities.java
trunk/connector-api/src/main/java/org/teiid/connector/api/ConnectorEnvironment.java
trunk/connector-api/src/main/java/org/teiid/connector/api/ConnectorException.java
trunk/connector-api/src/main/java/org/teiid/connector/api/ConnectorLogger.java
trunk/connector-api/src/main/java/org/teiid/connector/api/ExecutionContext.java
trunk/connector-api/src/main/java/org/teiid/connector/api/ProcedureExecution.java
trunk/connector-api/src/main/java/org/teiid/connector/api/ResultSetExecution.java
trunk/connector-api/src/main/java/org/teiid/connector/api/UpdateExecution.java
trunk/connector-api/src/main/java/org/teiid/connector/basic/BasicConnection.java
trunk/connector-api/src/main/java/org/teiid/connector/basic/BasicConnector.java
trunk/connector-api/src/main/java/org/teiid/connector/language/LanguageUtil.java
trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/AbstractMetadataRecord.java
trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/BaseColumn.java
trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/MetadataFactory.java
trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/RuntimeMetadata.java
trunk/connector-api/src/main/java/org/teiid/connector/visitor/framework/AbstractLanguageVisitor.java
trunk/connector-api/src/main/java/org/teiid/connector/visitor/framework/DelegatingHierarchyVisitor.java
trunk/connector-api/src/main/java/org/teiid/connector/visitor/framework/HierarchyVisitor.java
trunk/connector-api/src/main/java/org/teiid/connector/visitor/framework/LanguageObjectVisitor.java
trunk/connector-api/src/main/java/org/teiid/connector/visitor/util/CollectorVisitor.java
trunk/connector-api/src/main/java/org/teiid/connector/visitor/util/SQLStringVisitor.java
Log:
TEIID-833 committing JCA merge
Modified: trunk/connector-api/pom.xml
===================================================================
--- trunk/connector-api/pom.xml 2010-03-04 20:22:20 UTC (rev 1912)
+++ trunk/connector-api/pom.xml 2010-03-04 20:47:34 UTC (rev 1913)
@@ -16,6 +16,7 @@
<dependency>
<groupId>org.jboss.teiid</groupId>
<artifactId>teiid-common-core</artifactId>
+ <scope>provided</scope>
</dependency>
<dependency>
@@ -26,17 +27,11 @@
</dependency>
<dependency>
- <groupId>org.jboss.teiid</groupId>
- <artifactId>teiid-common-internal</artifactId>
- <type>test-jar</type>
- <scope>test</scope>
+ <groupId>javax.resource</groupId>
+ <artifactId>connector-api</artifactId>
+ <scope>provided</scope>
</dependency>
- <dependency>
- <groupId>javax.transaction</groupId>
- <artifactId>jta</artifactId>
- </dependency>
-
</dependencies>
<build>
Modified: trunk/connector-api/src/main/java/org/teiid/connector/api/Connection.java
===================================================================
--- trunk/connector-api/src/main/java/org/teiid/connector/api/Connection.java 2010-03-04 20:22:20 UTC (rev 1912)
+++ trunk/connector-api/src/main/java/org/teiid/connector/api/Connection.java 2010-03-04 20:47:34 UTC (rev 1913)
@@ -22,15 +22,16 @@
package org.teiid.connector.api;
-import org.teiid.connector.language.ICommand;
+import javax.resource.spi.LocalTransaction;
+import javax.transaction.xa.XAResource;
+
+import org.teiid.connector.language.Command;
import org.teiid.connector.metadata.runtime.RuntimeMetadata;
/**
* <p>Represents a connection to this connector. A connection will be obtained
* from the connector for every query that is executed, then closed after the query has completed.
* </p>
- * <p>If pooling is enabled, see {@link PoolAwareConnection} to optionally implement pooling specific behavior.
- * </p>
*/
public interface Connection {
@@ -39,20 +40,20 @@
* queries (and other commands) will be sent to the connector.
* @return Connector capabilities, may return null if the Connector returns globally scoped capabilities {@link Connector#getCapabilities()}
*/
- ConnectorCapabilities getCapabilities();
+ ConnectorCapabilities getCapabilities() throws ConnectorException;
/**
* Create an execution object for the specified command
* @param command the command
* @param executionContext Provides information about the context that this command is
- * executing within, such as the identifiers for the MetaMatrix command being executed
+ * executing within, such as the identifiers for the command being executed
* @param metadata Access to runtime metadata if needed to translate the command
- * @return An execution object that MetaMatrix can use to execute the command
+ * @return An execution object that can use to execute the command
*/
- Execution createExecution(ICommand command, ExecutionContext executionContext, RuntimeMetadata metadata ) throws ConnectorException;
+ Execution createExecution(Command command, ExecutionContext executionContext, RuntimeMetadata metadata ) throws ConnectorException;
/**
- * Release the connection. This will be called when MetaMatrix has completed
+ * Release the connection. This will be called when system has completed
* using the connection for an execution.
*/
void close();
@@ -62,20 +63,17 @@
* @return true if open, false if there is a source error.
*/
boolean isAlive();
+
+ /**
+ * Get the local transaction for the connector.
+ * @return null if local transactions are not supported
+ */
+ LocalTransaction getLocalTransaction() throws ConnectorException;
- /**
- * Called by the pool when an existing connection is leased so that the underlying
- * Connection may have it's identity switched to a different user.
- * @param identity
- * @throws ConnectorException
- */
- void setConnectorIdentity(ConnectorIdentity context)
- throws ConnectorException;
-
/**
- * Called by the pool to indicate that the connection was returned to the pool.
- * The actual close call will be made when the pool wants to purge this connection.
+ * If Connector supports participating in XA Connections, return the XAResurce associated with this connection.
+ * @return null if not supported
*/
- void closeCalled();
+ XAResource getXAResource() throws ConnectorException;
}
Copied: trunk/connector-api/src/main/java/org/teiid/connector/api/ConnectionContext.java (from rev 1899, branches/JCA/connector-api/src/main/java/org/teiid/connector/api/ConnectionContext.java)
===================================================================
--- trunk/connector-api/src/main/java/org/teiid/connector/api/ConnectionContext.java (rev 0)
+++ trunk/connector-api/src/main/java/org/teiid/connector/api/ConnectionContext.java 2010-03-04 20:47:34 UTC (rev 1913)
@@ -0,0 +1,44 @@
+/*
+ * 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.connector.api;
+
+import javax.security.auth.Subject;
+
+/**
+ * Thread local class to access the Subject in the Connector code. This is set just before the
+ * connector connection is created.
+ */
+public class ConnectionContext {
+ private static ThreadLocal<Subject> SUBJECT = new ThreadLocal<Subject>() {
+ protected Subject initialValue() {
+ return null;
+ }
+ };
+
+ public static Subject getSubject() {
+ return SUBJECT.get();
+ }
+
+ public static void setSubject(Subject subject) {
+ SUBJECT.set(subject);
+ }
+}
Modified: trunk/connector-api/src/main/java/org/teiid/connector/api/Connector.java
===================================================================
--- trunk/connector-api/src/main/java/org/teiid/connector/api/Connector.java 2010-03-04 20:22:20 UTC (rev 1912)
+++ trunk/connector-api/src/main/java/org/teiid/connector/api/Connector.java 2010-03-04 20:47:34 UTC (rev 1913)
@@ -22,67 +22,49 @@
package org.teiid.connector.api;
+import javax.security.auth.Subject;
+
/**
* <p>The primary entry point for a Connector. This interface should be implemented
* by the connector writer.</p>
*
- * <p>The Connector Manager will instantiate the implementation
- * of this class by reflection in an isolated classloader. Once the class has been
+ * <p>The JCA Container will instantiate the implementation of this class. Once the class has been
* instantiated, the {@link #initialize(ConnectorEnvironment)} method will be called
- * with all necessary connector properties. The {@link #start()} and {@link #stop()}
- * methods are lifecycle methods called when starting or stopping the connector.</p>
+ * with all necessary connector properties. </p>
*/
public interface Connector {
+ /**
+ * Initialize the connector with supplied configuration
+ * @param config
+ */
+ void initialize(ConnectorEnvironment config) throws ConnectorException;
+
/**
- * Start the connector with the connector environment. The environment
- * provides access to external resources the connector implementation may
- * need to use.
- * @param environment The connector environment, provided by the Connector Manager
- * @throws ConnectorException
- */
- void start(ConnectorEnvironment environment) throws ConnectorException;
-
- /**
- * Stop the connector. No commands will be executed on the connector when it is
- * stopped.
- */
- void stop();
-
- /**
* Obtain a connection with the connector. The connection typically is associated
- * with a particular security context. The connection is assumed to be pooled in
- * the underlying source if pooling is necessary - the connection will be closed
- * when execution has completed against it.
- * @param context The context of the current user that will be using this connection,
- * may be null if this connection is for an administrative operation.
+ * with a particular security context. The connection is assumed to be pooled by container
+ * if pooling is necessary - the connection will be closed when execution has completed against it.
+ *
+ * If you need to authenticate/authorize and need to get access to {{@link Subject}, then use
+ * {@link ConnectionContext}
+ *
* @return A Connection, created by the Connector
* @throws ConnectorException If an error occurred obtaining a connection
*/
- Connection getConnection( ExecutionContext context ) throws ConnectorException;
+ Connection getConnection() throws ConnectorException;
/**
* Get the capabilities of this connector. The capabilities affect what kinds of
* queries (and other commands) will be sent to the connector.
* @return ConnectorCapabilities, may return null if the Connector provides User scoped capabilities {@link Connection#getCapabilities()}
*/
- ConnectorCapabilities getCapabilities();
+ ConnectorCapabilities getCapabilities() throws ConnectorException;
- /**
- * Create an identity object based on a security context.
- *
- * If single identity is not supported then an exception should be thrown when a
- * null context is supplied.
- *
- * Implementors of this class may use a different implementation of the
- * {@link ConnectorIdentity} interface to similarly affect pooling.
- *
- * @param context The context provided by the Connector Manager
- * @return The associated connector identity
- * @throws ConnectorException If a null context is not accepted or an error occurs while creating the identity.
- */
- ConnectorIdentity createIdentity(ExecutionContext context)
- throws ConnectorException;
-
+ /**
+ * Get the ConnectorEnvironment that this connector is initialized with.
+ * @return
+ * @throws ConnectorException
+ */
+ ConnectorEnvironment getConnectorEnvironment();
}
Modified: trunk/connector-api/src/main/java/org/teiid/connector/api/ConnectorAnnotations.java
===================================================================
--- trunk/connector-api/src/main/java/org/teiid/connector/api/ConnectorAnnotations.java 2010-03-04 20:22:20 UTC (rev 1912)
+++ trunk/connector-api/src/main/java/org/teiid/connector/api/ConnectorAnnotations.java 2010-03-04 20:47:34 UTC (rev 1913)
@@ -31,22 +31,8 @@
public class ConnectorAnnotations {
- /**
- * The Pooling Annotation can be used to enable/suppress automatic pooling.
- *
- * This is especially useful in situations where legacy ConnectionPool properties
- * are still in use and thus {@link ConnectorPropertyNames#CONNECTION_POOL_ENABLED}
- * is set to true or when a connector cannot possibly provide a proper implementation
- * of a {@link ConnectorIdentityFactory}.
- */
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.TYPE})
- public @interface ConnectionPooling {
- boolean enabled() default true;
- }
-
- @Retention(RetentionPolicy.RUNTIME)
- @Target({ElementType.TYPE})
public @interface SynchronousWorkers {
boolean enabled() default true;
}
Modified: trunk/connector-api/src/main/java/org/teiid/connector/api/ConnectorCapabilities.java
===================================================================
--- trunk/connector-api/src/main/java/org/teiid/connector/api/ConnectorCapabilities.java 2010-03-04 20:22:20 UTC (rev 1912)
+++ trunk/connector-api/src/main/java/org/teiid/connector/api/ConnectorCapabilities.java 2010-03-04 20:47:34 UTC (rev 1913)
@@ -24,8 +24,8 @@
import java.util.List;
-import org.teiid.connector.language.IBatchedUpdates;
-import org.teiid.connector.language.ISetQuery;
+import org.teiid.connector.language.BatchedUpdates;
+import org.teiid.connector.language.SetQuery;
/**
@@ -373,7 +373,7 @@
boolean requiresCriteria();
/**
- * Whether the source supports {@link IBatchedUpdates}
+ * Whether the source supports {@link BatchedUpdates}
* @since 6.0
*/
boolean supportsBatchedUpdates();
@@ -386,7 +386,7 @@
/**
* Support indicates that the connector can accept INSERTs with
- * values specified by an {@link ISetQuery}.
+ * values specified by an {@link SetQuery}.
* @since 6.1
*/
boolean supportsInsertWithQueryExpression();
Modified: trunk/connector-api/src/main/java/org/teiid/connector/api/ConnectorEnvironment.java
===================================================================
--- trunk/connector-api/src/main/java/org/teiid/connector/api/ConnectorEnvironment.java 2010-03-04 20:22:20 UTC (rev 1912)
+++ trunk/connector-api/src/main/java/org/teiid/connector/api/ConnectorEnvironment.java 2010-03-04 20:47:34 UTC (rev 1913)
@@ -23,12 +23,8 @@
package org.teiid.connector.api;
import java.util.Properties;
-import java.util.concurrent.Executor;
-import java.util.concurrent.ScheduledFuture;
-import java.util.concurrent.ScheduledThreadPoolExecutor;
-import java.util.concurrent.TimeUnit;
-import org.teiid.connector.language.ILanguageFactory;
+import org.teiid.connector.language.LanguageFactory;
/**
@@ -36,24 +32,47 @@
* environment provides access to external resources the Connector writer may
* need.
*/
-public interface ConnectorEnvironment extends Executor {
+public interface ConnectorEnvironment {
- /**
- * Get all configuration properties provided in the Connector Binding
- * for this connector instance.
- * @return Properties for initializing the connector
- */
- Properties getProperties();
+ /**
+ * Capabilities Class Name
+ * @return
+ */
+ public String getCapabilitiesClass();
+
+ /**
+ * Defines if the Connector is read-only connector
+ * @return
+ */
+ public boolean isImmutable();
+
+ /**
+ * Throw exception if there are more rows in the result set than specified in the MaxResultRows setting.
+ * @return
+ */
+ public boolean isExceptionOnMaxRows();
+ /**
+ * Maximum result set rows to fetch
+ * @return
+ */
+ public int getMaxResultRows();
+
+ /**
+ * Shows the XA transaction capability of the Connector.
+ * @return
+ */
+ public boolean isXaCapable();
+
/**
- * Get the name of the connector binding, as exposed in the console.
- * @return Connector binding name
+ * Indicates whether the connector represents a pooled resource. If it does, then
+ * synchronous workers will be used.
*/
- String getConnectorName();
-
+ boolean isSynchWorkers();
+
/**
* Obtain a reference to the logger that can be used to add messages to the
- * MetaMatrix log files for debugging and error recovery.
+ * log files for debugging and error recovery.
* @return The {@link ConnectorLogger}
*/
ConnectorLogger getLogger();
@@ -63,7 +82,7 @@
* new language interface objects. This is typically needed when modifying the language
* objects passed to the connector or for testing when objects need to be created.
*/
- ILanguageFactory getLanguageFactory();
+ LanguageFactory getLanguageFactory();
/**
* Obtain a reference to the type facility, which can be used to perform many type
@@ -72,40 +91,8 @@
TypeFacility getTypeFacility();
/**
- * Schedule a command for repeated execution with the same contract as
- * {@link ScheduledThreadPoolExecutor#scheduleAtFixedRate(Runnable, long, long, TimeUnit)}
- * Executions will not happen concurrently. If an execution takes longer than a period,
- * the next execution will take place on the first period interval after completion.
- * @param command
- * @param initialDelay
- * @param period
- * @param unit
+ * Get the Override capabilities for the connector
* @return
*/
- ScheduledFuture<?> scheduleAtFixedRate(Runnable command,
- long initialDelay,
- long period,
- TimeUnit unit);
-
-
- /**
- * Get the item from cache based on the scope provided; The required information like session-id, or vdb-name etc
- * are gleaned from runtime context. If such information is not available then error will be raised.
- * @param scope - scope of the cache; {@link CacheScope.REQUEST}, scope is not supported, as request information is not
- * visible. use ExecutionContext.
- * on {@link ExecutionContext}
- * @param key
- * @return
- */
- Object getFromCache(CacheScope scope, Object key);
-
- /**
- * Store the item in the cache based on the scope provided.The required information like session-id, or vdb-name etc
- * are gleaned from runtime context. If such information is not available then error will be raised.
- * @param scope - scope of the cache; {@link CacheScope.REQUEST}, scope is not supported.
- * on {@link ExecutionContext}
- * @param key
- * @param value
- */
- void storeInCache(CacheScope scope, Object key, Object value);
+ Properties getOverrideCapabilities() throws ConnectorException;
}
Modified: trunk/connector-api/src/main/java/org/teiid/connector/api/ConnectorException.java
===================================================================
--- trunk/connector-api/src/main/java/org/teiid/connector/api/ConnectorException.java 2010-03-04 20:22:20 UTC (rev 1912)
+++ trunk/connector-api/src/main/java/org/teiid/connector/api/ConnectorException.java 2010-03-04 20:47:34 UTC (rev 1913)
@@ -22,13 +22,13 @@
package org.teiid.connector.api;
-import com.metamatrix.core.MetaMatrixCoreException;
+import javax.resource.ResourceException;
/**
* An exception the connector writer can return in case of an
* error while using the connector.
*/
-public class ConnectorException extends MetaMatrixCoreException{
+public class ConnectorException extends ResourceException{
private static final long serialVersionUID = -5980862789340592219L;
@@ -49,11 +49,11 @@
}
public ConnectorException( String errorCode, String message ) {
- super( errorCode, message );
+ super( message, errorCode);
}
public ConnectorException( int errorCode, String message ) {
- super( Integer.toString(errorCode), message );
+ super(message, Integer.toString(errorCode));
}
@@ -64,7 +64,7 @@
* @param e An exception to nest within this one
*/
public ConnectorException( Throwable e, String message ) {
- super( e, message );
+ super(message,e);
}
/**
Deleted: trunk/connector-api/src/main/java/org/teiid/connector/api/ConnectorIdentity.java
===================================================================
--- trunk/connector-api/src/main/java/org/teiid/connector/api/ConnectorIdentity.java 2010-03-04 20:22:20 UTC (rev 1912)
+++ trunk/connector-api/src/main/java/org/teiid/connector/api/ConnectorIdentity.java 2010-03-04 20:47:34 UTC (rev 1913)
@@ -1,34 +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.connector.api;
-
-
-/**
- * Represents the identity of a connection in the pool. Identities are
- * used to determine whether two connections can be put in the same pool.
- * Implementors must supply appropriate {@link java.lang.Object#equals(java.lang.Object)} and
- * {@link java.lang.Object#hashCode()} methods.
- */
-public interface ConnectorIdentity {
-
-}
Modified: trunk/connector-api/src/main/java/org/teiid/connector/api/ConnectorLogger.java
===================================================================
--- trunk/connector-api/src/main/java/org/teiid/connector/api/ConnectorLogger.java 2010-03-04 20:22:20 UTC (rev 1912)
+++ trunk/connector-api/src/main/java/org/teiid/connector/api/ConnectorLogger.java 2010-03-04 20:47:34 UTC (rev 1913)
@@ -23,7 +23,7 @@
package org.teiid.connector.api;
/**
- * Provide access to write messages to the MetaMatrix logs.
+ * Provide access to write messages to the logs.
*/
public interface ConnectorLogger {
Deleted: trunk/connector-api/src/main/java/org/teiid/connector/api/ConnectorPropertyNames.java
===================================================================
--- trunk/connector-api/src/main/java/org/teiid/connector/api/ConnectorPropertyNames.java 2010-03-04 20:22:20 UTC (rev 1912)
+++ trunk/connector-api/src/main/java/org/teiid/connector/api/ConnectorPropertyNames.java 2010-03-04 20:47:34 UTC (rev 1913)
@@ -1,114 +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.connector.api;
-
-public class ConnectorPropertyNames {
-
- /**
- * The property that specifies the class name of the custom connector class
- * that connects to the data source. This property is required.
- */
- public static final String CONNECTOR_CLASS = "ConnectorClass"; //$NON-NLS-1$
-
- /**
- * The environment property name whose value defines the maximum number
- * of processor threads. This property is required.
- */
- public static final String MAX_CONNECTIONS = "ConnectorMaxConnections"; //$NON-NLS-1$
-
- /**
- * This property can be used to specify the maximum number of rows to be returned
- * from the datasource of this connector. The connector should stop adding records
- * to the ResultsCollector when the rows collected is equal to this value. This
- * property is optional and if no value is specified, we should return all the rows.
- * @since 3.0
- */
- public static final String MAX_RESULT_ROWS = "MaxResultRows"; //$NON-NLS-1$
-
- /**
- * This property can be used to specify whether or not an exception should be thrown
- * if the number of rows for a query exceeds the value of MAX_RESULT_ROWS. If this
- * flag is set to false, then no more than MAX_RESULT_ROWS values will be returned but
- * no exception will be thrown.
- */
- public static final String EXCEPTION_ON_MAX_ROWS = "ExceptionOnMaxRows"; //$NON-NLS-1$
-
- /**
- * This property can be used to specify whether or not Connection Pooling is enabled.
- * If this flag is set to false, then connection pooling is disabled.
- */
- public static final String CONNECTION_POOL_ENABLED = "ConnectionPoolEnabled"; //$NON-NLS-1$
-
- /**
- * The environment property used to identify a <i>type</i> of connector binding.
- * This property is required and is a component used to uniquely identify a
- * connector instance.
- * @since 4.0
- */
- public static final String CONNECTOR_BINDING_NAME = "ConnectorBindingName"; //$NON-NLS-1$
-
- /**
- * The environment property used to identify a routing ID. This value should
- * be used to locate this particular connector from the DQP.
- * @since 4.0
- */
- public static final String CONNECTOR_ID = "ConnectorID"; //$NON-NLS-1$
-
- /**
- * The name of the VM where the connector is running on.
- * @since 4.0
- */
- public static final String CONNECTOR_VM_NAME = "ConnectorVMName"; //$NON-NLS-1$
-
- /**
- * Indicates whether the connector represents a pooled resource. If it does, then
- * synchronous workers will be used.
- */
- public static final String SYNCH_WORKERS = "SynchWorkers"; //$NON-NLS-1$
-
- public static final String USING_CUSTOM_CLASSLOADER = "UsingCustomClassloader"; //$NON-NLS-1$
-
- public static final String CONNECTOR_CLASSPATH = "ConnectorClassPath"; //$NON-NLS-1$
-
- public static final String CONNECTOR_TYPE_CLASSPATH = "ConnectorTypeClassPath"; //$NON-NLS-1$
-
- public static final String IS_XA = "IsXA"; //$NON-NLS-1$
-
- public static final String USE_CREDENTIALS_MAP = "UseCredentialMap"; //$NON-NLS-1$
-
- public static final String ADMIN_CONNECTIONS_ALLOWED = "AdminConnectionsAllowed"; //$NON-NLS-1$
-
- public static final String USE_RESULTSET_CACHE = "ResultSetCacheEnabled"; //$NON-NLS-1$
- public static final String MAX_RESULTSET_CACHE_SIZE = "ResultSetCacheMaxSize"; //$NON-NLS-1$
- public static final String MAX_RESULTSET_CACHE_AGE = "ResultSetCacheMaxAge"; //$NON-NLS-1$
- public static final String RESULTSET_CACHE_SCOPE = "ResultSetCacheScope"; //$NON-NLS-1$
-
- /**
- * This property can be used to bypass the normal logic that throws an exception when a command
- * is about to be executed by a non-XA compatible connector, but there is a global transaction.
- */
- public static final String IS_IMMUTABLE = "Immutable"; //$NON-NLS-1$
-
- public static final String USE_POST_DELEGATION = "UsePostDelegation"; //$NON-NLS-1$
-
-}
Deleted: trunk/connector-api/src/main/java/org/teiid/connector/api/CredentialMap.java
===================================================================
--- trunk/connector-api/src/main/java/org/teiid/connector/api/CredentialMap.java 2010-03-04 20:22:20 UTC (rev 1912)
+++ trunk/connector-api/src/main/java/org/teiid/connector/api/CredentialMap.java 2010-03-04 20:47:34 UTC (rev 1913)
@@ -1,377 +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.connector.api;
-
-import java.io.Serializable;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import org.teiid.connector.DataPlugin;
-
-import com.metamatrix.core.util.StringUtil;
-
-/**
- * Allows credentials to be passed on a per user basis to a connector.
- *
- * A CredentialsMap object is produced based on information provided in the JDBC
- * URL. The static method parseCredentials() is used for this purpose.
- *
- * This CredentialMap serves as the session "trusted payload".
- *
- * It is the responsibility of a Connector to call
- * {@link ExecutionContext#getTrustedPayload()} to retrieve the CredentialMap.
- *
- * The system name should be the same as the Connector Binding Name retrieved from
- * {@link ConnectorEnvironment#getConnectorName()}.
- *
- * To get the keyword/value pairs use getSystemCredentials(systemName), this will
- * return a Map that contains the properties for the specified system.
- *
- * Specific user and password values can be retrieved with
- * getUser(systemName) and getPassword(systemName)
- */
-public class CredentialMap implements Serializable {
- //Parsing keywords for system, user, and password. Comparison is done
- //ignoring case.
- public final static String SYSTEM_KEYWORD = "system"; //$NON-NLS-1$
- public final static String USER_KEYWORD = "user"; //$NON-NLS-1$
- public final static String PASSWORD_KEYWORD = "password"; //$NON-NLS-1$
- public final static String ESCAPE_CHAR = "\\"; //$NON-NLS-1$
- public final static String DEFAULT_SYSTEM = "default"; //$NON-NLS-1$
-
- private final static String ESCAPE_SLASH = "ESCAPE_SLASH"; // forward slash //$NON-NLS-1$
- private final static String ESCAPE_COMMA = "ESCAPE_COMMA"; // comma //$NON-NLS-1$
- private final static String ESCAPE_EQUAL = "ESCAPE_EQUAL"; // equals //$NON-NLS-1$
-// private final static String ESCAPE_SEMI = "ESCAPE_SEMI"; // semicolon
-// private final static String ESCAPE_CLOSE_PAREN = "ESCAPE_CLOSE_PAREN"; // closing paren
-
-
- private final static String[] escape_chars = {
- ESCAPE_CHAR + "/", // forward slash //$NON-NLS-1$
- ESCAPE_CHAR + ",", // comma //$NON-NLS-1$
- ESCAPE_CHAR + "="}; // equals //$NON-NLS-1$
-// ESCAPE_CHAR + ";", // semicolon
-// ESCAPE_CHAR + ")"}; // closing paren
-
- private final static String[] escape_strings = {
- ESCAPE_SLASH, // forward slash
- ESCAPE_COMMA, // comma
- ESCAPE_EQUAL }; // equals
-// ESCAPE_SEMI, // semicolon
-// ESCAPE_CLOSE_PAREN }; // closing paren
-
- /**
- * In this mode, the CredentialMap will ignore the default credentials
- * and only credentials set for a system will be exposed. This is the
- * default setting for the CredentialMap.
- */
- public static final short MODE_IGNORE_DEFAULTS = 0;
-
- /**
- * In this mode, the default credentials will be returned for any system,
- * overlaid with any system-specific credentials. If a system is unknown,
- * all default credentials are returned for that system.
- */
- public static final short MODE_USE_DEFAULTS_GLOBALLY = 1;
-
- /**
- * In this mode, the default credentials will be returned for any system,
- * overlaid with any system-specific credentials. If a system is unknown,
- * the default credentials are NOT used.
- */
- public static final short MODE_USE_DEFAULTS_ON_EXISTING = 2;
-
- /**
- * The map of map of credentials (keyed by system name, upper case).
- */
- private Map map = new HashMap();
-
- private short defaultCredentialMode = MODE_IGNORE_DEFAULTS;
- private Map defaultCredentials;
-
-
- /**
- * Method to parse a credentials substring extracted from a JDBC URL. The
- * presumed command line syntax is ...;credentials=(...);...
- * Only the substring starting and ending with the parentheses is passed to
- * this method. That is, the first non-blank character must be a '(' and the
- * last non-blank character must be a ')', or an exception will be thrown.
- *
- * Syntax is: (credentialspec1/credentialspec2/.../credentialspecn)
- *
- * Any number one or greater of credential specifications may be included,
- * separated by '/' characters.
- *
- * Each credentials spec will be specified in the following way:
- * Keyword-specified, order-independent name-value pairs of the form
- * keyword=value. The only required keyword is "system", which must be specified
- * for each credentials spec, and must have a value corresponding to the name of an EIS
- * already known to the system.
- *
- * Ex: system=sys1,user=sys1un,pass=sys1pw, whatever=somevalue.
- * Each of the keywords must be unique.
- *
- * All blank space is ignored, except within a keyword or value.
- *
- * Any syntax error will cause an Exception to be thrown.
- *
- * @param inputStr the string to be parsed; first non-blank must be a '(', last non-blank must be a ')'
- * @return a CredentialMap containing the input
- * @throws ConnectorException upon any syntax error; descriptive text included
- */
- public static CredentialMap parseCredentials(String inputStr) throws ConnectorException {
-
- for (int i = 0; i < escape_chars.length; i++) {
- inputStr = StringUtil.replaceAll(inputStr, escape_chars[i], escape_strings[i]);
- }
-
- if (inputStr == null) {
- throw new ConnectorException(DataPlugin.Util.getString("CredentialMap.Null_input")); //$NON-NLS-1$
- }
-
- inputStr = inputStr.trim();
-
- CredentialMap credentialMap = new CredentialMap(); // map of maps keyed on system
- int strLen = inputStr.length();
-
- //Check that not empty
-
- if (strLen == 0) {
- throw new ConnectorException(DataPlugin.Util.getString("CredentialMap.Empty_input")); //$NON-NLS-1$
- }
-
- //Check that first non-blank char is left paren
- if (!inputStr.startsWith("(")|| !inputStr.endsWith(")")) { //$NON-NLS-1$ //$NON-NLS-2$
- throw new ConnectorException(DataPlugin.Util.getString("CredentialMap.Missing_parens")); //$NON-NLS-1$
- }
-
- // strip of ()'s
- inputStr = inputStr.substring(1, inputStr.length()-1);
-
- List credentials = StringUtil.getTokens(inputStr, "/"); //$NON-NLS-1$
- Iterator credentialIter = credentials.iterator();
-
- while (credentialIter.hasNext()) {
- String credential = (String) credentialIter.next();
-
- // Convert the escaped "/" since we already parsed on the "/"
- credential = StringUtil.replaceAll(credential, escape_strings[0], "/"); //$NON-NLS-1$
-
- Map newMap = getCredentialMap(credential.trim());
- String system = (String) newMap.get(SYSTEM_KEYWORD);
- if (system == null || system.length() == 0) {
- throw new ConnectorException(DataPlugin.Util.getString("CredentialMap.Missing_system_prop")); //$NON-NLS-1$
- }
- credentialMap.addSystemCredentials(system, newMap); // add to Map of Maps.
- }
- return credentialMap;
- }
-
-
- /**
- * Takes a string containing key/value pairs.
- * Example "propName1=propValue1,propName2,propValue2,....."
- * and returns a map of key/value pairs.
- */
- private static Map getCredentialMap(String credential) {
- List propList = StringUtil.getTokens(credential, ","); //$NON-NLS-1$
- Iterator propIter = propList.iterator();
- Map map = new HashMap();
- while (propIter.hasNext()) {
- String propVal = (String) propIter.next();
- List pvList = StringUtil.getTokens(propVal, "="); //$NON-NLS-1$
- String key = null;
- String val = null;
- if (pvList.size() > 0) {
- key = (String) pvList.get(0);
- key = key.trim();
- }
- if (pvList.size() > 1) {
- val = (String) pvList.get(1);
- val = val.trim();
- // put back the escaped "," and "=" since we already parsed on these.
- val = StringUtil.replaceAll(val, escape_strings[1], ","); //$NON-NLS-1$
- val = StringUtil.replaceAll(val, escape_strings[2], "="); //$NON-NLS-1$
- }
- map.put(key,val);
- }
- return map;
- }
-
- public CredentialMap() {
- super();
- }
-
- /**
- * Method to return an array of systems that have been added to this
- * CredentialMap.
- *
- * @return array of the systems that have been added using addSystemCredentials() - always uppercase
- */
- public String[] getSystems() {
- Set keySet = map.keySet();
- String[] keys = new String[keySet.size()];
- Iterator it = keySet.iterator();
- for (int i = 0; it.hasNext(); i++) {
- keys[i] = (String)it.next();
- }
- return keys;
- }
-
- /**
- * Method to add a user name and credentials (e.g. password) for a system
- *
- * @param system system name corresponding to the user and credentials
- * @param credentials Map containing name/val pairs
- */
- public void addSystemCredentials(String system, Map credentials) {
- map.put(system.toUpperCase(), credentials);
- }
-
- /**
- * Set the default credentials to use with this credential map. See the
- * various default credential modes to understand when and how these will
- * be returned.
- *
- * @param defaultCredentials Map of credentials
- * @since 4.3
- */
- public void setDefaultCredentials(Map defaultCredentials) {
- this.defaultCredentials = defaultCredentials;
- }
-
- /**
- * Set the default credential mode to determine when default credentials should
- * be returned.
- *
- * @param mode The mode
- * @see #MODE_IGNORE_DEFAULTS
- * @see #MODE_USE_DEFAULTS_GLOBALLY
- * @see #MODE_USE_DEFAULTS_ON_EXISTING
- * @since 4.3
- */
- public void setDefaultCredentialMode(short mode) {
- this.defaultCredentialMode = mode;
- }
-
- /**
- * Method to return the credentials map for a system
- *
- * @param systemName system name
- * @return Map
- */
- public Map getSystemCredentials(String systemName) {
- Map systemCredentials = (Map)map.get(systemName.toUpperCase());
-
- // If ignoring defaults, return just as is
- if(this.defaultCredentialMode == MODE_IGNORE_DEFAULTS) {
- return systemCredentials;
- }
-
- // Pre-load the credential set to return with the defaults if
- // 1. defaults exist
- // 2. AND using defaults globally
- // 3. OR (using defaults on existing AND system credentials exist)
- Map workingMap = null;
- if(this.defaultCredentials != null &&
- (this.defaultCredentialMode == MODE_USE_DEFAULTS_GLOBALLY ||
- (this.defaultCredentialMode == MODE_USE_DEFAULTS_ON_EXISTING &&
- systemCredentials != null))) {
-
- workingMap = new HashMap();
- workingMap.putAll(defaultCredentials);
- }
-
- // Apply system credentials over the top if they exist
- if(systemCredentials != null) {
- if(workingMap == null) {
- workingMap = new HashMap();
- }
- workingMap.putAll(systemCredentials);
- }
-
- return workingMap;
- }
-
- /**
- * Get the user property for the specified system, if it exists. The
- * user property is defined by the static constant {@link #USER_KEYWORD}.
- *
- * @param systemName The system to look up (case insensitive)
- * @return The user name for this system if the system was found and the system had a user property
- * @since 4.3
- */
- public String getUser(String systemName) {
- Map credentials = getSystemCredentials(systemName);
- if(credentials != null) {
- return (String) credentials.get(USER_KEYWORD);
- }
-
- return null;
- }
-
- /**
- * Get the password property for the specified system, if it exists. The
- * password property is defined by the static constant {@link #PASSWORD_KEYWORD}.
- *
- * @param systemName The system to look up (case insensitive)
- * @return The password for this system if the system was found and the system had a password property
- * @since 4.3
- */
- public String getPassword(String systemName) {
- Map credentials = getSystemCredentials(systemName);
- if(credentials != null) {
- return (String) credentials.get(PASSWORD_KEYWORD);
- }
-
- return null;
- }
-
- public String toString() {
- StringBuffer b = new StringBuffer();
- String[] systems = this.getSystems();
- for (int i=0; i < systems.length; i++) {
- String system = systems[i];
- Map map = this.getSystemCredentials(system);
- b.append("\n"); //$NON-NLS-1$
- b.append(system);
- b.append("\n"); //$NON-NLS-1$
- Iterator iter = map.keySet().iterator();
- while (iter.hasNext()) {
- Object key = iter.next();
- b.append("\t"); //$NON-NLS-1$
- b.append(key);
- b.append("="); //$NON-NLS-1$
- b.append(map.get(key));
- b.append("\n"); //$NON-NLS-1$
- }
- }
- return b.toString();
- }
-
-}//end CredentialMap
-
-
Modified: trunk/connector-api/src/main/java/org/teiid/connector/api/ExecutionContext.java
===================================================================
--- trunk/connector-api/src/main/java/org/teiid/connector/api/ExecutionContext.java 2010-03-04 20:22:20 UTC (rev 1912)
+++ trunk/connector-api/src/main/java/org/teiid/connector/api/ExecutionContext.java 2010-03-04 20:47:34 UTC (rev 1913)
@@ -24,7 +24,9 @@
import java.io.Serializable;
+import javax.security.auth.Subject;
+
/**
* The security context provides information about the user context in which
* this query is being run.
@@ -37,25 +39,15 @@
public interface ExecutionContext {
/**
- * Get the {@link ConnectorIdentity} created by the Connector's {@link
- * ConnectorIdentityFactory}
- *
- * @return the {@link ConnectorIdentity} or {@link SingleIdentity} if the
- * Connector does not implement {@link ConnectorIdentityFactory}
- * @since 6.0
- */
- ConnectorIdentity getConnectorIdentity();
-
- /**
* Get the identifier for the current connector running the command
* @return Connector identifier; never null
*/
String getConnectorIdentifier();
/**
- * Get the identifier for the MetaMatrix command being executed. This can be
- * correlated back to identifiers exposed in other parts of the MetaMatrix system.
- * @return MetaMatrix command identifier
+ * Get the identifier for the command being executed. This can be
+ * correlated back to identifiers exposed in other parts of the system.
+ * @return command identifier
*/
String getRequestIdentifier();
@@ -67,7 +59,7 @@
/**
* Execution count defines an id; where every access to the connector from
- * the MetaMatrix server in a given command execution boundary is uniquely defined;
+ * the server in a given command execution boundary is uniquely defined;
* Like for example in the case of "batched execution" of commands, each execution of
* command gets new identifier.
*/
@@ -83,48 +75,32 @@
* Get the version of the VDB this query is being run against.
* @return VDB version, never null
*/
- String getVirtualDatabaseVersion();
+ int getVirtualDatabaseVersion();
/**
- * Get the user name for the user running this query.
- * @return User name, never null
+ * Get the user for the user running this query.
+ * @return User, never null
*/
- String getUser();
-
+ Subject getSubject();
+
/**
- * Get the trusted payload passed when the user connected. MetaMatrix has no
- * knowledge about what the payload contains - it is merely passed through
- * the system. It is most often used to pass security information such as
- * credentials. It is available in the connector, as is the Execution Payload,
- * for connector developers to utilize.
- * @return Trusted payload if one exists, otherwise null
- */
- Serializable getTrustedPayload();
-
- /**
* Get the trusted payload passed when the user statement was executed.
- * MetaMatrix has no knowledge about what the payload contains - it is merely
+ * Teiid has no knowledge about what the payload contains - it is merely
* passed through the system. It is most often used to pass security
* information such as credentials.
*
- * <p>The execution payload differs from the Trusted Payload in that it
- * is set on the Statement and so may not be constant over the Connection lifecycle
- * and may be changed upon each statement execution. The Execution Payload is
- * <em>not</em> authenticated or validated by the MetaMatrix system.</p>
+ * <p>Given that the Execution Payload is not authenticated by the Teiid
+ * system, connector writers are responsible for ensuring its validity. </p>
*
- * <p>Given that the Execution Payload is not authenticated by the MetaMatrix
- * system, connector writers are responsible for ensuring its validity. This
- * can possibly be accomplished by comparing it against the Trusted Payload.</p>
- *
* @return Trusted execution payload if one exists, otherwise null
* @since 4.2
*/
Serializable getExecutionPayload();
-
+
/**
* Get the identifier for the connection through which
* the command is being executed. This represents the original JDBC user
- * connection to the MetaMatrix system
+ * connection to the Teiid system
* @return Connection identifier
*/
String getConnectionIdentifier();
@@ -150,6 +126,10 @@
*/
void addWarning(Exception ex);
+ /**
+ * Flag indicates that the operation needs to be executed in a XA transaction.
+ * @return
+ */
boolean isTransactional();
/**
@@ -166,4 +146,21 @@
* @param value
*/
void put(Object key, Object value);
+
+ /**
+ * Get a item that has been placed previously from cache. If no such object then a null will be returned. The item looked
+ * up in the specified scope.
+ * @param scope
+ * @param key
+ * @return
+ */
+ Object getFromCache(CacheScope scope, Object key);
+
+ /**
+ * Place a item in the Cache in the given scope.
+ * @param scope
+ * @param key
+ * @param value
+ */
+ void storeInCache(CacheScope scope, Object key, Object value);
}
Deleted: trunk/connector-api/src/main/java/org/teiid/connector/api/MappedUserIdentity.java
===================================================================
--- trunk/connector-api/src/main/java/org/teiid/connector/api/MappedUserIdentity.java 2010-03-04 20:22:20 UTC (rev 1912)
+++ trunk/connector-api/src/main/java/org/teiid/connector/api/MappedUserIdentity.java 2010-03-04 20:47:34 UTC (rev 1913)
@@ -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 org.teiid.connector.api;
-
-
-/**
- * This class represents a ConnectorIdentity keyed on a username with
- * a mapped identity
- */
-public class MappedUserIdentity implements ConnectorIdentity {
- private String username;
- private String mappedUser;
- private String password;
-
- /**
- * Construct with a security context
- * @param context The context
- */
- public MappedUserIdentity(String username, String mappedUser, String password){
- this.username = username;
- this.mappedUser = mappedUser;
- this.password = password;
- }
-
- /**
- * Implement equals based on the case-insensitive user name.
- * @param obj Other identity object
- * @return True if other object is a UserIdentity with the same user name
- */
- public boolean equals(Object obj){
- if (this == obj) {
- return true;
- }
-
- if (obj instanceof MappedUserIdentity) {
- MappedUserIdentity that = (MappedUserIdentity)obj;
- return username.equals(that.username);
- }
-
- return false;
- }
-
- /**
- * Get hash code, based on user name
- */
- public int hashCode(){
- return username.hashCode();
- }
-
- public String toString(){
- return "UserIdentity " + username; //$NON-NLS-1$
- }
-
- public String getMappedUser() {
- return mappedUser;
- }
-
- public String getPassword() {
- return password;
- }
-}
Modified: trunk/connector-api/src/main/java/org/teiid/connector/api/ProcedureExecution.java
===================================================================
--- trunk/connector-api/src/main/java/org/teiid/connector/api/ProcedureExecution.java 2010-03-04 20:22:20 UTC (rev 1912)
+++ trunk/connector-api/src/main/java/org/teiid/connector/api/ProcedureExecution.java 2010-03-04 20:47:34 UTC (rev 1913)
@@ -24,11 +24,11 @@
import java.util.List;
-import org.teiid.connector.language.IProcedure;
+import org.teiid.connector.language.Call;
/**
* The procedure execution represents the case where a connector can execute a
- * {@link IProcedure}. The output may include 0 or more output parameters and
+ * {@link Call}. The output may include 0 or more output parameters and
* optionally a result set.
*/
public interface ProcedureExecution extends ResultSetExecution {
Modified: trunk/connector-api/src/main/java/org/teiid/connector/api/ResultSetExecution.java
===================================================================
--- trunk/connector-api/src/main/java/org/teiid/connector/api/ResultSetExecution.java 2010-03-04 20:22:20 UTC (rev 1912)
+++ trunk/connector-api/src/main/java/org/teiid/connector/api/ResultSetExecution.java 2010-03-04 20:47:34 UTC (rev 1913)
@@ -24,11 +24,11 @@
import java.util.List;
-import org.teiid.connector.language.IProcedure;
-import org.teiid.connector.language.IQueryCommand;
+import org.teiid.connector.language.Call;
+import org.teiid.connector.language.QueryExpression;
/**
- * Defines an execution for {@link IQueryCommand}s and {@link IProcedure}s that
+ * Defines an execution for {@link QueryExpression}s and {@link Call}s that
* returns a resultset, which is represented through the iterator method
* {@link #next()}.
*/
Deleted: trunk/connector-api/src/main/java/org/teiid/connector/api/SingleIdentity.java
===================================================================
--- trunk/connector-api/src/main/java/org/teiid/connector/api/SingleIdentity.java 2010-03-04 20:22:20 UTC (rev 1912)
+++ trunk/connector-api/src/main/java/org/teiid/connector/api/SingleIdentity.java 2010-03-04 20:47:34 UTC (rev 1913)
@@ -1,48 +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.connector.api;
-
-
-/**
- * This class represents a single ConnectorIdentity. All the connections are treated the same.
- */
-public class SingleIdentity implements ConnectorIdentity {
-
- public SingleIdentity(){
- }
-
- /**
- * Return true for everything - all identities are identical.
- */
- public boolean equals(Object obj){
- return obj instanceof SingleIdentity;
- }
-
- public String toString(){
- return "SingleIdentity"; //$NON-NLS-1$
- }
-
- public int hashCode(){
- return 0;
- }
-}
Modified: trunk/connector-api/src/main/java/org/teiid/connector/api/UpdateExecution.java
===================================================================
--- trunk/connector-api/src/main/java/org/teiid/connector/api/UpdateExecution.java 2010-03-04 20:22:20 UTC (rev 1912)
+++ trunk/connector-api/src/main/java/org/teiid/connector/api/UpdateExecution.java 2010-03-04 20:47:34 UTC (rev 1913)
@@ -22,15 +22,15 @@
package org.teiid.connector.api;
-import org.teiid.connector.language.IBatchedUpdates;
-import org.teiid.connector.language.IDelete;
-import org.teiid.connector.language.IInsert;
-import org.teiid.connector.language.IUpdate;
+import org.teiid.connector.language.BatchedUpdates;
+import org.teiid.connector.language.Delete;
+import org.teiid.connector.language.Insert;
+import org.teiid.connector.language.Update;
/**
* The update execution represents the case where a connector can
- * execute an {@link IInsert}, {@link IUpdate}, {@link IDelete}, or {@link IBatchedUpdates} command.
+ * execute an {@link Insert}, {@link Update}, {@link Delete}, or {@link BatchedUpdates} command.
*/
public interface UpdateExecution extends Execution {
Modified: trunk/connector-api/src/main/java/org/teiid/connector/basic/BasicConnection.java
===================================================================
--- trunk/connector-api/src/main/java/org/teiid/connector/basic/BasicConnection.java 2010-03-04 20:22:20 UTC (rev 1912)
+++ trunk/connector-api/src/main/java/org/teiid/connector/basic/BasicConnection.java 2010-03-04 20:47:34 UTC (rev 1913)
@@ -22,52 +22,55 @@
package org.teiid.connector.basic;
+import javax.resource.spi.LocalTransaction;
+import javax.transaction.xa.XAResource;
+
import org.teiid.connector.api.Connection;
import org.teiid.connector.api.ConnectorCapabilities;
import org.teiid.connector.api.ConnectorException;
-import org.teiid.connector.api.ConnectorIdentity;
import org.teiid.connector.api.Execution;
import org.teiid.connector.api.ExecutionContext;
import org.teiid.connector.api.ProcedureExecution;
import org.teiid.connector.api.ResultSetExecution;
import org.teiid.connector.api.UpdateExecution;
-import org.teiid.connector.language.ICommand;
-import org.teiid.connector.language.IProcedure;
-import org.teiid.connector.language.IQueryCommand;
+import org.teiid.connector.language.Call;
+import org.teiid.connector.language.Command;
+import org.teiid.connector.language.QueryExpression;
import org.teiid.connector.metadata.runtime.RuntimeMetadata;
/**
* Provides a default implementation of a {@link PoolAwareConnection} for a Connector
* that supports global capabilities. Extensions of this class should implement
- * {@link #createProcedureExecution(IProcedure, ExecutionContext, RuntimeMetadata)}
- * {@link #createResultSetExecution(IProcedure, ExecutionContext, RuntimeMetadata)}
- * {@link #createUpdateExecution(IProcedure, ExecutionContext, RuntimeMetadata)}
+ * {@link #createProcedureExecution(Call, ExecutionContext, RuntimeMetadata)}
+ * {@link #createResultSetExecution(Call, ExecutionContext, RuntimeMetadata)}
+ * {@link #createUpdateExecution(Call, ExecutionContext, RuntimeMetadata)}
* as necessary.
*/
public abstract class BasicConnection implements Connection {
+
@Override
- public Execution createExecution(ICommand command,
+ public Execution createExecution(Command command,
ExecutionContext executionContext, RuntimeMetadata metadata)
throws ConnectorException {
- if (command instanceof IQueryCommand) {
- return createResultSetExecution((IQueryCommand)command, executionContext, metadata);
+ if (command instanceof QueryExpression) {
+ return createResultSetExecution((QueryExpression)command, executionContext, metadata);
}
- if (command instanceof IProcedure) {
- return createProcedureExecution((IProcedure)command, executionContext, metadata);
+ if (command instanceof Call) {
+ return createProcedureExecution((Call)command, executionContext, metadata);
}
return createUpdateExecution(command, executionContext, metadata);
}
- public ResultSetExecution createResultSetExecution(IQueryCommand command, ExecutionContext executionContext, RuntimeMetadata metadata) throws ConnectorException {
+ public ResultSetExecution createResultSetExecution(QueryExpression command, ExecutionContext executionContext, RuntimeMetadata metadata) throws ConnectorException {
throw new ConnectorException("Unsupported Execution");
}
- public ProcedureExecution createProcedureExecution(IProcedure command, ExecutionContext executionContext, RuntimeMetadata metadata) throws ConnectorException {
+ public ProcedureExecution createProcedureExecution(Call command, ExecutionContext executionContext, RuntimeMetadata metadata) throws ConnectorException {
throw new ConnectorException("Unsupported Execution");
}
- public UpdateExecution createUpdateExecution(ICommand command, ExecutionContext executionContext, RuntimeMetadata metadata) throws ConnectorException {
+ public UpdateExecution createUpdateExecution(Command command, ExecutionContext executionContext, RuntimeMetadata metadata) throws ConnectorException {
throw new ConnectorException("Unsupported Execution");
}
@@ -82,14 +85,12 @@
}
@Override
- public void closeCalled() {
-
+ public LocalTransaction getLocalTransaction() {
+ return null;
}
@Override
- public void setConnectorIdentity(ConnectorIdentity context)
- throws ConnectorException {
-
+ public XAResource getXAResource() throws ConnectorException {
+ return null;
}
-
}
Modified: trunk/connector-api/src/main/java/org/teiid/connector/basic/BasicConnector.java
===================================================================
--- trunk/connector-api/src/main/java/org/teiid/connector/basic/BasicConnector.java 2010-03-04 20:22:20 UTC (rev 1912)
+++ trunk/connector-api/src/main/java/org/teiid/connector/basic/BasicConnector.java 2010-03-04 20:47:34 UTC (rev 1913)
@@ -1,81 +1,36 @@
package org.teiid.connector.basic;
-import org.teiid.connector.DataPlugin;
import org.teiid.connector.api.Connector;
+import org.teiid.connector.api.ConnectorCapabilities;
import org.teiid.connector.api.ConnectorEnvironment;
import org.teiid.connector.api.ConnectorException;
-import org.teiid.connector.api.ConnectorIdentity;
-import org.teiid.connector.api.ConnectorPropertyNames;
-import org.teiid.connector.api.CredentialMap;
-import org.teiid.connector.api.ExecutionContext;
-import org.teiid.connector.api.MappedUserIdentity;
-import org.teiid.connector.api.SingleIdentity;
-import com.metamatrix.common.util.PropertiesUtils;
-
public abstract class BasicConnector implements Connector {
- private boolean useCredentialMap;
- private boolean adminConnectionsAllowed = true;
- private String connectorName;
+ protected ConnectorEnvironment config;
+ protected ConnectorCapabilities capabilities;
@Override
- public void start(ConnectorEnvironment environment)
- throws ConnectorException {
- this.connectorName = environment.getConnectorName();
- this.adminConnectionsAllowed = PropertiesUtils.getBooleanProperty(environment.getProperties(), ConnectorPropertyNames.ADMIN_CONNECTIONS_ALLOWED, true);
- this.useCredentialMap = PropertiesUtils.getBooleanProperty(environment.getProperties(), ConnectorPropertyNames.USE_CREDENTIALS_MAP, false);
- }
-
- /* (non-Javadoc)
- * @see com.metamatrix.connector.api.Connector#createIdentity(com.metamatrix.connector.api.ExecutionContext)
- */
- public ConnectorIdentity createIdentity(ExecutionContext context)
- throws ConnectorException {
- if (context == null) {
- if (adminConnectionsAllowed) {
- return new SingleIdentity();
- }
- throw new ConnectorException(DataPlugin.Util.getString("UserIdentityFactory.single_identity_not_supported")); //$NON-NLS-1$
- }
- Object payload = context.getTrustedPayload();
- if (!(payload instanceof CredentialMap)) {
- if (useCredentialMap) {
- throw new ConnectorException(DataPlugin.Util.getString("UserIdentityFactory.extraction_error")); //$NON-NLS-1$
- }
- return new SingleIdentity();
- }
- CredentialMap credMap = (CredentialMap)payload;
- String user = credMap.getUser(connectorName);
- String password = credMap.getPassword(connectorName);
- if (user == null || password == null) {
- throw new ConnectorException(DataPlugin.Util.getString("UserIdentityFactory.missing_credentials", connectorName)); //$NON-NLS-1$
- }
- return new MappedUserIdentity(context.getUser(), user, password);
- }
+ public void initialize(ConnectorEnvironment config) throws ConnectorException {
+ this.config = config;
+ }
- public String getConnectorName() {
- return connectorName;
+ @Override
+ public ConnectorEnvironment getConnectorEnvironment(){
+ return this.config;
}
- public void setConnectorName(String connectorName) {
- this.connectorName = connectorName;
- }
-
- public boolean useCredentialMap() {
- return useCredentialMap;
- }
-
- public void setUseCredentialMap(boolean useCredentialMap) {
- this.useCredentialMap = useCredentialMap;
- }
-
- public boolean areAdminConnectionsAllowed() {
- return adminConnectionsAllowed;
- }
-
- public void setAdminConnectionsAllowed(boolean adminConnectionsAllowed) {
- this.adminConnectionsAllowed = adminConnectionsAllowed;
- }
-
+ public Class<? extends ConnectorCapabilities> getDefaultCapabilities() {
+ return BasicConnectorCapabilities.class;
+ }
+
+ @Override
+ public ConnectorCapabilities getCapabilities() throws ConnectorException {
+ if (capabilities == null) {
+ // create Capabilities
+ capabilities = BasicManagedConnectionFactory.getInstance(ConnectorCapabilities.class, this.config.getCapabilitiesClass(), null, getDefaultCapabilities());
+ }
+ return capabilities;
+ }
+
}
Copied: trunk/connector-api/src/main/java/org/teiid/connector/basic/BasicManagedConnection.java (from rev 1899, branches/JCA/connector-api/src/main/java/org/teiid/connector/basic/BasicManagedConnection.java)
===================================================================
--- trunk/connector-api/src/main/java/org/teiid/connector/basic/BasicManagedConnection.java (rev 0)
+++ trunk/connector-api/src/main/java/org/teiid/connector/basic/BasicManagedConnection.java 2010-03-04 20:47:34 UTC (rev 1913)
@@ -0,0 +1,139 @@
+/*
+ * 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.connector.basic;
+
+import java.io.PrintWriter;
+import java.util.ArrayList;
+import java.util.Collection;
+
+import javax.resource.ResourceException;
+import javax.resource.spi.ConnectionEvent;
+import javax.resource.spi.ConnectionEventListener;
+import javax.resource.spi.ConnectionRequestInfo;
+import javax.resource.spi.LocalTransaction;
+import javax.resource.spi.ManagedConnection;
+import javax.resource.spi.ManagedConnectionMetaData;
+import javax.security.auth.Subject;
+import javax.transaction.xa.XAResource;
+
+import org.teiid.connector.api.ConnectionContext;
+import org.teiid.connector.api.ConnectorException;
+
+public class BasicManagedConnection implements ManagedConnection {
+ protected PrintWriter log;
+ protected final Collection<ConnectionEventListener> listeners = new ArrayList<ConnectionEventListener>();
+ protected WrappedConnection conn;
+ private BasicManagedConnectionFactory mcf;
+
+ public BasicManagedConnection(BasicManagedConnectionFactory mcf) {
+ this.mcf = mcf;
+ }
+
+ @Override
+ public void associateConnection(Object handle) throws ResourceException {
+ if (!(handle instanceof WrappedConnection)) {
+ throw new ConnectorException("Wrong connection supplied to assosiate");
+ }
+ this.conn = (WrappedConnection)handle;
+ this.conn.setManagedConnection(this);
+ }
+
+ @Override
+ public void cleanup() throws ResourceException {
+ if (this.conn != null) {
+ this.conn.close();
+ this.conn = null;
+ }
+ ConnectionContext.setSubject(null);
+ }
+
+ @Override
+ public void destroy() throws ResourceException {
+ cleanup();
+ }
+
+ @Override
+ public ManagedConnectionMetaData getMetaData() throws ResourceException {
+ return null;
+ }
+
+ @Override
+ public Object getConnection(Subject arg0, ConnectionRequestInfo arg1) throws ResourceException {
+ if(!(arg1 instanceof ConnectionRequestInfoWrapper)) {
+ throw new ConnectorException("Un recognized Connection Request Info object received");
+ }
+ ConnectionRequestInfoWrapper criw = (ConnectionRequestInfoWrapper)arg1;
+ ConnectionContext.setSubject(arg0);
+ this.conn = new WrappedConnection(criw.actualConnector.getConnection(), mcf);
+ this.conn.setManagedConnection(this);
+ return this.conn;
+ }
+
+ @Override
+ public LocalTransaction getLocalTransaction() throws ResourceException {
+ return this.conn.getLocalTransaction();
+ }
+
+ @Override
+ public XAResource getXAResource() throws ResourceException {
+ return this.conn.getXAResource();
+ }
+
+ @Override
+ public void addConnectionEventListener(ConnectionEventListener arg0) {
+ synchronized (this.listeners) {
+ this.listeners.add(arg0);
+ }
+ }
+
+ @Override
+ public void removeConnectionEventListener(ConnectionEventListener arg0) {
+ synchronized (this.listeners) {
+ this.listeners.remove(arg0);
+ }
+ }
+
+ @Override
+ public void setLogWriter(PrintWriter arg0) throws ResourceException {
+ this.log = arg0;
+ }
+
+ @Override
+ public PrintWriter getLogWriter() throws ResourceException {
+ return this.log;
+ }
+
+ // called by the wrapped connection to notify the close of the connection.
+ void connectionClosed() {
+ ConnectionEvent ce = new ConnectionEvent(this, ConnectionEvent.CONNECTION_CLOSED);
+ ce.setConnectionHandle(this.conn);
+
+ ArrayList<ConnectionEventListener> copy = null;
+ synchronized (this.listeners) {
+ copy = new ArrayList<ConnectionEventListener>(this.listeners);
+ }
+
+ for(ConnectionEventListener l: copy) {
+ l.connectionClosed(ce);
+ }
+ }
+}
Copied: trunk/connector-api/src/main/java/org/teiid/connector/basic/BasicManagedConnectionFactory.java (from rev 1899, branches/JCA/connector-api/src/main/java/org/teiid/connector/basic/BasicManagedConnectionFactory.java)
===================================================================
--- trunk/connector-api/src/main/java/org/teiid/connector/basic/BasicManagedConnectionFactory.java (rev 0)
+++ trunk/connector-api/src/main/java/org/teiid/connector/basic/BasicManagedConnectionFactory.java 2010-03-04 20:47:34 UTC (rev 1913)
@@ -0,0 +1,224 @@
+/*
+ * 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.connector.basic;
+
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.util.Collection;
+import java.util.Properties;
+import java.util.Set;
+
+import javax.resource.ResourceException;
+import javax.resource.spi.ConnectionManager;
+import javax.resource.spi.ConnectionRequestInfo;
+import javax.resource.spi.ManagedConnection;
+import javax.resource.spi.ManagedConnectionFactory;
+import javax.resource.spi.ResourceAdapter;
+import javax.resource.spi.ResourceAdapterAssociation;
+import javax.security.auth.Subject;
+
+import org.teiid.connector.api.Connector;
+import org.teiid.connector.api.ConnectorEnvironment;
+import org.teiid.connector.api.ConnectorException;
+import org.teiid.connector.api.ConnectorLogger;
+import org.teiid.connector.api.TypeFacility;
+import org.teiid.connector.language.LanguageFactory;
+
+import com.metamatrix.core.MetaMatrixCoreException;
+import com.metamatrix.core.util.ReflectionHelper;
+
+public class BasicManagedConnectionFactory implements ManagedConnectionFactory, ResourceAdapterAssociation, ConnectorEnvironment {
+
+ private static final long serialVersionUID = -7302713800883776790L;
+ private static final TypeFacility TYPE_FACILITY = new TypeFacilityImpl();
+ private ConnectorLogger logger = new DefaultConnectorLogger();
+ private PrintWriter log;
+ private BasicResourceAdapter ra;
+
+ // Properties set by ra.xml
+ private String connectorClass;
+ private String capabilitiesClass = BasicConnectorCapabilities.class.getName();
+ private boolean immutable = false;
+ private boolean exceptionOnMaxRows = false;
+ private int maxResultRows = -1;
+ private boolean xaCapable;
+
+ private boolean synchWorkers = true;
+ private String overrideCapabilitiesFile;
+
+ // derived
+ private Properties overrideCapabilities;
+
+ @Override
+ public Object createConnectionFactory() throws ResourceException {
+ return new ResourceException("Resource Adapter does not currently support running in a non-managed environment.");
+ }
+
+ @Override
+ public Object createConnectionFactory(ConnectionManager arg0) throws ResourceException {
+ try {
+ Object o = ReflectionHelper.create(this.connectorClass, null, Thread.currentThread().getContextClassLoader());
+ if(!(o instanceof Connector)) {
+ throw new ConnectorException("Invalid Connector class specified="+this.connectorClass);
+ }
+ Connector connector = (Connector)o;
+ connector.initialize(this);
+ return new WrappedConnector(connector, arg0, this);
+ } catch (MetaMatrixCoreException e) {
+ throw new ResourceException(e);
+ }
+ }
+
+ @Override
+ public ManagedConnection createManagedConnection(Subject arg0, ConnectionRequestInfo arg1) throws ResourceException {
+ return new BasicManagedConnection(this);
+ }
+
+ @Override
+ public PrintWriter getLogWriter() throws ResourceException {
+ return this.log;
+ }
+
+ @Override
+ public ManagedConnection matchManagedConnections(Set arg0, Subject arg1, ConnectionRequestInfo arg2) throws ResourceException {
+ // rameshTODO: to manage per-user based pools the information in the request info needs to be used to filter.
+ return (ManagedConnection)arg0.iterator().next();
+ }
+
+ @Override
+ public void setLogWriter(PrintWriter arg0) throws ResourceException {
+ this.log = arg0;
+ }
+
+ @Override
+ public ResourceAdapter getResourceAdapter() {
+ return this.ra;
+ }
+
+ @Override
+ public void setResourceAdapter(ResourceAdapter arg0) throws ResourceException {
+ this.ra = (BasicResourceAdapter)arg0;
+ }
+
+ public void setConnectorClass(String arg0) {
+ this.connectorClass = arg0;
+ }
+
+ public void setCapabilitiesClass(String arg0) {
+ this.capabilitiesClass = arg0;
+ }
+
+ public void setImmutable(Boolean arg0) {
+ this.immutable = arg0.booleanValue();
+ }
+
+ public void setExceptionOnMaxRows(Boolean arg0) {
+ this.exceptionOnMaxRows = arg0.booleanValue();
+ }
+
+ public void setMaxResultRows(Integer arg0) {
+ this.maxResultRows = arg0.intValue();
+ }
+
+ public String getCapabilitiesClass() {
+ return capabilitiesClass;
+ }
+
+ public boolean isImmutable() {
+ return immutable;
+ }
+
+ public boolean isExceptionOnMaxRows() {
+ return exceptionOnMaxRows;
+ }
+
+ public int getMaxResultRows() {
+ return maxResultRows;
+ }
+
+ public boolean isXaCapable() {
+ return xaCapable;
+ }
+
+ public void setXaCapable(Boolean arg0) {
+ this.xaCapable = arg0.booleanValue();
+ }
+
+ @Override
+ public LanguageFactory getLanguageFactory() {
+ return LanguageFactory.INSTANCE;
+ }
+
+ @Override
+ public ConnectorLogger getLogger() {
+ return logger;
+ }
+
+ @Override
+ public TypeFacility getTypeFacility() {
+ return TYPE_FACILITY;
+ }
+
+ @Override
+ public boolean isSynchWorkers() {
+ return synchWorkers;
+ }
+
+ public void setSynchWorkers(Boolean arg0) {
+ this.synchWorkers = arg0.booleanValue();
+ }
+
+ @Override
+ public Properties getOverrideCapabilities() throws ConnectorException {
+ if (this.overrideCapabilities == null && this.overrideCapabilitiesFile != null) {
+ try {
+ this.overrideCapabilities = new Properties();
+ this.overrideCapabilities.loadFromXML(this.getClass().getResourceAsStream(this.overrideCapabilitiesFile));
+ } catch (IOException e) {
+ throw new ConnectorException(e);
+ }
+ }
+ return this.overrideCapabilities;
+ }
+
+ public void setOverrideCapabilitiesFile(String propsFile) {
+ this.overrideCapabilitiesFile = propsFile;
+ }
+
+ public static <T> T getInstance(Class<T> expectedType, String className, Collection ctorObjs, Class defaultClass) throws ConnectorException {
+ try {
+ if (className == null) {
+ if (defaultClass == null) {
+ throw new ConnectorException("Neither class name or default class specified to create an instance");
+ }
+ return expectedType.cast(defaultClass.newInstance());
+ }
+ return expectedType.cast(ReflectionHelper.create(className, ctorObjs, Thread.currentThread().getContextClassLoader()));
+ } catch (MetaMatrixCoreException e) {
+ throw new ConnectorException(e);
+ } catch (IllegalAccessException e) {
+ throw new ConnectorException(e);
+ } catch(InstantiationException e) {
+ throw new ConnectorException(e);
+ }
+ }
+}
Copied: trunk/connector-api/src/main/java/org/teiid/connector/basic/BasicResourceAdapter.java (from rev 1899, branches/JCA/connector-api/src/main/java/org/teiid/connector/basic/BasicResourceAdapter.java)
===================================================================
--- trunk/connector-api/src/main/java/org/teiid/connector/basic/BasicResourceAdapter.java (rev 0)
+++ trunk/connector-api/src/main/java/org/teiid/connector/basic/BasicResourceAdapter.java 2010-03-04 20:47:34 UTC (rev 1913)
@@ -0,0 +1,68 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This 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 software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.teiid.connector.basic;
+
+import javax.resource.ResourceException;
+import javax.resource.spi.ActivationSpec;
+import javax.resource.spi.BootstrapContext;
+import javax.resource.spi.ResourceAdapter;
+import javax.resource.spi.ResourceAdapterInternalException;
+import javax.resource.spi.XATerminator;
+import javax.resource.spi.endpoint.MessageEndpointFactory;
+import javax.resource.spi.work.WorkManager;
+import javax.transaction.xa.XAResource;
+
+public class BasicResourceAdapter implements ResourceAdapter {
+ BootstrapContext ctx;
+
+ @Override
+ public void endpointActivation(MessageEndpointFactory endpointFactory, ActivationSpec spec) throws ResourceException {
+ throw new UnsupportedOperationException("not supported");
+ }
+
+ @Override
+ public void endpointDeactivation(MessageEndpointFactory endpointFactory, ActivationSpec spec) {
+ throw new UnsupportedOperationException("not supported");
+ }
+
+ @Override
+ public XAResource[] getXAResources(ActivationSpec[] specs) throws ResourceException {
+ return new XAResource[0];
+ }
+
+ @Override
+ public void start(BootstrapContext ctx) throws ResourceAdapterInternalException {
+ this.ctx = ctx;
+ }
+
+ @Override
+ public void stop() {
+ }
+
+ public WorkManager getWorkManager() {
+ return ctx.getWorkManager();
+ }
+
+ public XATerminator getXATerminator() {
+ return ctx.getXATerminator();
+ }
+}
Copied: trunk/connector-api/src/main/java/org/teiid/connector/basic/ConnectionRequestInfoWrapper.java (from rev 1899, branches/JCA/connector-api/src/main/java/org/teiid/connector/basic/ConnectionRequestInfoWrapper.java)
===================================================================
--- trunk/connector-api/src/main/java/org/teiid/connector/basic/ConnectionRequestInfoWrapper.java (rev 0)
+++ trunk/connector-api/src/main/java/org/teiid/connector/basic/ConnectionRequestInfoWrapper.java 2010-03-04 20:47:34 UTC (rev 1913)
@@ -0,0 +1,34 @@
+/*
+ * 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.connector.basic;
+
+import javax.resource.spi.ConnectionRequestInfo;
+
+import org.teiid.connector.api.Connector;
+
+class ConnectionRequestInfoWrapper implements ConnectionRequestInfo {
+ Connector actualConnector;
+
+ public ConnectionRequestInfoWrapper(Connector connector) {
+ this.actualConnector = connector;
+ }
+}
Copied: trunk/connector-api/src/main/java/org/teiid/connector/basic/DefaultConnectorLogger.java (from rev 1899, branches/JCA/connector-api/src/main/java/org/teiid/connector/basic/DefaultConnectorLogger.java)
===================================================================
--- trunk/connector-api/src/main/java/org/teiid/connector/basic/DefaultConnectorLogger.java (rev 0)
+++ trunk/connector-api/src/main/java/org/teiid/connector/basic/DefaultConnectorLogger.java 2010-03-04 20:47:34 UTC (rev 1913)
@@ -0,0 +1,111 @@
+/*
+ * 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.
+ */
+
+/*
+ * Date: Sep 16, 2003
+ * Time: 11:23:00 AM
+ */
+package org.teiid.connector.basic;
+
+import org.teiid.connector.api.ConnectorLogger;
+
+/**
+ * DefaultConnectorLogger.
+ */
+public class DefaultConnectorLogger implements ConnectorLogger {
+ public static final String CTX_CONNECTOR = "CONNECTOR"; //$NON-NLS-1$
+ @Override
+ public void logError(String message) {
+ //LogManager.logError(CTX_CONNECTOR, message);
+ }
+ @Override
+ public void logError(String message, Throwable error) {
+ // LogManager.logError(CTX_CONNECTOR, error, message);
+ }
+ @Override
+ public void logWarning(String message) {
+ // LogManager.logWarning(CTX_CONNECTOR, message);
+ }
+ @Override
+ public void logInfo(String message) {
+ //LogManager.logInfo(CTX_CONNECTOR, message);
+ }
+ @Override
+ public void logDetail(String message) {
+ //LogManager.logDetail(CTX_CONNECTOR, message);
+ }
+
+ @Override
+ public void logTrace(String message) {
+ // LogManager.logTrace(CTX_CONNECTOR, message);
+ }
+
+ @Override
+ public boolean isDetailEnabled() {
+ //return LogManager.isMessageToBeRecorded(CTX_CONNECTOR, MessageLevel.DETAIL);
+ return true;
+ }
+
+ @Override
+ public boolean isErrorEnabled() {
+ //return LogManager.isMessageToBeRecorded(CTX_CONNECTOR, MessageLevel.ERROR);
+ return true;
+ }
+
+ @Override
+ public boolean isInfoEnabled() {
+ //return LogManager.isMessageToBeRecorded(CTX_CONNECTOR, MessageLevel.INFO);
+ return true;
+ }
+
+ @Override
+ public boolean isTraceEnabled() {
+ //return LogManager.isMessageToBeRecorded(CTX_CONNECTOR, MessageLevel.TRACE);
+ return true;
+ }
+
+ @Override
+ public boolean isWarningEnabled() {
+ //return LogManager.isMessageToBeRecorded(CTX_CONNECTOR, MessageLevel.WARNING);
+ return true;
+ }
+
+ @Override
+ public void logDetail(String message, Throwable error) {
+ //LogManager.log(MessageLevel.DETAIL, CTX_CONNECTOR, error, message);
+ }
+
+ @Override
+ public void logInfo(String message, Throwable error) {
+ //LogManager.log(MessageLevel.INFO, CTX_CONNECTOR, error, message);
+ }
+
+ @Override
+ public void logTrace(String message, Throwable error) {
+ //LogManager.log(MessageLevel.TRACE, CTX_CONNECTOR, error, message);
+ }
+
+ @Override
+ public void logWarning(String message, Throwable error) {
+ //LogManager.log(MessageLevel.WARNING, CTX_CONNECTOR, error, message);
+ }
+}
Copied: trunk/connector-api/src/main/java/org/teiid/connector/basic/TypeFacilityImpl.java (from rev 1899, branches/JCA/connector-api/src/main/java/org/teiid/connector/basic/TypeFacilityImpl.java)
===================================================================
--- trunk/connector-api/src/main/java/org/teiid/connector/basic/TypeFacilityImpl.java (rev 0)
+++ trunk/connector-api/src/main/java/org/teiid/connector/basic/TypeFacilityImpl.java 2010-03-04 20:47:34 UTC (rev 1913)
@@ -0,0 +1,52 @@
+/*
+ * 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.connector.basic;
+
+import java.util.Calendar;
+import java.util.Date;
+import java.util.TimeZone;
+
+import org.teiid.connector.api.TypeFacility;
+
+import com.metamatrix.common.types.DataTypeManager;
+import com.metamatrix.common.util.TimestampWithTimezone;
+
+/**
+ */
+public class TypeFacilityImpl extends TypeFacility {
+
+ public TypeFacilityImpl() {
+ }
+
+ @Override
+ public Object convertToRuntimeType(Object value) {
+ return DataTypeManager.convertToRuntimeType(value);
+ }
+
+ @Override
+ public Object convertDate(Date date, TimeZone initial, Calendar target,
+ Class targetType) {
+ return TimestampWithTimezone.create(date, initial, target, targetType);
+ }
+
+}
Copied: trunk/connector-api/src/main/java/org/teiid/connector/basic/WrappedConnection.java (from rev 1899, branches/JCA/connector-api/src/main/java/org/teiid/connector/basic/WrappedConnection.java)
===================================================================
--- trunk/connector-api/src/main/java/org/teiid/connector/basic/WrappedConnection.java (rev 0)
+++ trunk/connector-api/src/main/java/org/teiid/connector/basic/WrappedConnection.java 2010-03-04 20:47:34 UTC (rev 1913)
@@ -0,0 +1,111 @@
+/*
+ * 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.connector.basic;
+
+import java.lang.reflect.Proxy;
+
+import javax.resource.spi.LocalTransaction;
+import javax.transaction.xa.XAResource;
+
+import org.teiid.connector.api.Connection;
+import org.teiid.connector.api.ConnectorCapabilities;
+import org.teiid.connector.api.ConnectorEnvironment;
+import org.teiid.connector.api.ConnectorException;
+import org.teiid.connector.api.Execution;
+import org.teiid.connector.api.ExecutionContext;
+import org.teiid.connector.api.MetadataProvider;
+import org.teiid.connector.basic.WrappedConnector.CapabilitesOverloader;
+import org.teiid.connector.language.Command;
+import org.teiid.connector.metadata.runtime.MetadataFactory;
+import org.teiid.connector.metadata.runtime.RuntimeMetadata;
+
+public class WrappedConnection implements Connection, MetadataProvider {
+
+ private Connection conn;
+ private ConnectorEnvironment env;
+ private ConnectorCapabilities caps;
+ private BasicManagedConnection mc;
+ boolean closed = false;
+
+ public WrappedConnection(Connection conn, ConnectorEnvironment env) {
+ this.conn = conn;
+ this.env = env;
+ }
+
+ @Override
+ public void close() {
+ if (!this.closed && this.mc != null) {
+ this.closed = true;
+ this.conn.close();
+ this.mc.connectionClosed();
+ this.mc = null;
+ }
+ }
+
+ @Override
+ public Execution createExecution(Command command, ExecutionContext executionContext, RuntimeMetadata metadata)
+ throws ConnectorException {
+ return conn.createExecution(command, executionContext, metadata);
+ }
+
+ @Override
+ public ConnectorCapabilities getCapabilities() throws ConnectorException {
+ if (this.caps == null) {
+ ConnectorCapabilities caps = conn.getCapabilities();
+ if (caps != null && this.env.getOverrideCapabilities() != null) {
+ caps = (ConnectorCapabilities) Proxy.newProxyInstance(Thread.currentThread().getContextClassLoader(), new Class[] {ConnectorCapabilities.class}, new CapabilitesOverloader(caps, this.env.getOverrideCapabilities()));
+ }
+ this.caps = caps;
+ }
+ return this.caps;
+ }
+
+ @Override
+ public LocalTransaction getLocalTransaction() throws ConnectorException {
+ return conn.getLocalTransaction();
+ }
+
+ @Override
+ public boolean isAlive() {
+ return conn.isAlive();
+ }
+
+ @Override
+ public XAResource getXAResource() throws ConnectorException {
+ return conn.getXAResource();
+ }
+
+ @Override
+ public void getConnectorMetadata(MetadataFactory metadataFactory) throws ConnectorException {
+ if (this.conn instanceof MetadataProvider) {
+ ((MetadataProvider) this.conn).getConnectorMetadata(metadataFactory);
+ } else {
+ throw new ConnectorException("Connector is not capable of providing metadata. Extend connector with MetadataProvider interface");
+ }
+ }
+
+ // Called by managed connection for the connection management
+ void setManagedConnection(BasicManagedConnection mc) {
+ this.mc = mc;
+ }
+
+}
Copied: trunk/connector-api/src/main/java/org/teiid/connector/basic/WrappedConnector.java (from rev 1899, branches/JCA/connector-api/src/main/java/org/teiid/connector/basic/WrappedConnector.java)
===================================================================
--- trunk/connector-api/src/main/java/org/teiid/connector/basic/WrappedConnector.java (rev 0)
+++ trunk/connector-api/src/main/java/org/teiid/connector/basic/WrappedConnector.java 2010-03-04 20:47:34 UTC (rev 1913)
@@ -0,0 +1,141 @@
+/*
+ * 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.connector.basic;
+
+import java.io.Serializable;
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.Method;
+import java.lang.reflect.Proxy;
+import java.util.Properties;
+
+import javax.naming.NamingException;
+import javax.naming.Reference;
+import javax.resource.Referenceable;
+import javax.resource.ResourceException;
+import javax.resource.spi.ConnectionManager;
+
+import org.teiid.connector.api.Connection;
+import org.teiid.connector.api.Connector;
+import org.teiid.connector.api.ConnectorCapabilities;
+import org.teiid.connector.api.ConnectorEnvironment;
+import org.teiid.connector.api.ConnectorException;
+
+import com.metamatrix.core.MetaMatrixCoreException;
+import com.metamatrix.core.util.ReflectionHelper;
+import com.metamatrix.core.util.StringUtil;
+
+public class WrappedConnector implements Connector, Referenceable, Serializable {
+
+ private static final long serialVersionUID = 5499157394014613035L;
+ private Connector delegate;
+ private ConnectionManager cm;
+ private BasicManagedConnectionFactory mcf;
+ private Reference reference;
+ ConnectorCapabilities caps;
+
+ public WrappedConnector(Connector delegate, ConnectionManager cm, BasicManagedConnectionFactory mcf) {
+ this.delegate = delegate;
+ this.cm = cm;
+ this.mcf = mcf;
+ }
+
+ @Override
+ public void initialize(ConnectorEnvironment config) throws ConnectorException {
+ this.delegate.initialize(config);
+ }
+
+ @Override
+ public ConnectorCapabilities getCapabilities() throws ConnectorException {
+ if (this.caps != null) {
+ return this.caps;
+ }
+
+ // see if enhanced capabilities are available from the connector.
+ this.caps = delegate.getCapabilities();
+
+ // if not use the default capabilities specified in the configuration.
+ if (this.caps == null) {
+ try {
+ Object o = ReflectionHelper.create(this.mcf.getCapabilitiesClass(), null, Thread.currentThread().getContextClassLoader());
+ if(!(o instanceof ConnectorCapabilities)) {
+ throw new ConnectorException("Invalid Connector Capabilities class specified="+this.mcf.getCapabilitiesClass());
+ }
+ this.caps = (ConnectorCapabilities)o;
+ } catch (MetaMatrixCoreException e) {
+ throw new ConnectorException(e);
+ }
+ }
+ // capabilities overload
+ ConnectorEnvironment env = getConnectorEnvironment();
+ if (this.caps != null && env.getOverrideCapabilities() != null) {
+ this.caps = (ConnectorCapabilities) Proxy.newProxyInstance(Thread.currentThread().getContextClassLoader(), new Class[] {ConnectorCapabilities.class}, new CapabilitesOverloader(this.caps, env.getOverrideCapabilities()));
+ }
+ return caps;
+ }
+
+ @Override
+ public Connection getConnection() throws ConnectorException {
+ try {
+ return (Connection)cm.allocateConnection(mcf, new ConnectionRequestInfoWrapper(this.delegate));
+ } catch (ResourceException e) {
+ throw new ConnectorException(e);
+ }
+ }
+
+ @Override
+ public ConnectorEnvironment getConnectorEnvironment() {
+ return this.delegate.getConnectorEnvironment();
+ }
+
+ @Override
+ public void setReference(Reference arg0) {
+ this.reference = arg0;
+ }
+
+ @Override
+ public Reference getReference() throws NamingException {
+ return this.reference;
+ }
+
+
+ /**
+ * Overloads the connector capabilities with one defined in the connector binding properties
+ */
+ static final class CapabilitesOverloader implements InvocationHandler {
+ ConnectorCapabilities caps;
+ Properties properties;
+
+ CapabilitesOverloader(ConnectorCapabilities caps, Properties properties){
+ this.caps = caps;
+ this.properties = properties;
+ }
+
+ @Override
+ public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
+ String value = this.properties.getProperty(method.getName());
+ if (value == null || value.trim().length() == 0 || (args != null && args.length != 0)) {
+ return method.invoke(this.caps, args);
+ }
+ return StringUtil.valueOf(value, method.getReturnType());
+ }
+ }
+}
Copied: trunk/connector-api/src/main/java/org/teiid/connector/language/AggregateFunction.java (from rev 1899, branches/JCA/connector-api/src/main/java/org/teiid/connector/language/AggregateFunction.java)
===================================================================
--- trunk/connector-api/src/main/java/org/teiid/connector/language/AggregateFunction.java (rev 0)
+++ trunk/connector-api/src/main/java/org/teiid/connector/language/AggregateFunction.java 2010-03-04 20:47:34 UTC (rev 1913)
@@ -0,0 +1,131 @@
+/*
+ * 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.connector.language;
+
+import org.teiid.connector.visitor.framework.LanguageObjectVisitor;
+
+/**
+ * Represents an aggregate function.
+ */
+public class AggregateFunction extends BaseLanguageObject implements Expression {
+
+ public static final String COUNT = "COUNT"; //$NON-NLS-1$
+ public static final String AVG = "AVG"; //$NON-NLS-1$
+ public static final String SUM = "SUM"; //$NON-NLS-1$
+ public static final String MIN = "MIN"; //$NON-NLS-1$
+ public static final String MAX = "MAX"; //$NON-NLS-1$
+
+ private Expression expression;
+ private String aggName;
+ private boolean isDistinct;
+ private Class<?> type;
+
+ public AggregateFunction(String aggName, boolean isDistinct, Expression exp, Class<?> type) {
+ this.expression = exp;
+ this.aggName = aggName;
+ this.isDistinct = isDistinct;
+ this.type = type;
+ }
+
+ /**
+ * Get the name of the aggregate function. This will be one of the constants defined
+ * in this class.
+ * @see #COUNT
+ * @see #AVG
+ * @see #SUM
+ * @see #MIN
+ * @see #MAX
+ */
+ public String getName() {
+ return this.aggName;
+ }
+
+ /**
+ * Determine whether this function was executed with DISTINCT. Executing
+ * with DISTINCT will remove all duplicate values in a group when evaluating
+ * the aggregate function.
+ * @return True if DISTINCT mode is used
+ */
+ public boolean isDistinct() {
+ return this.isDistinct;
+ }
+
+ /**
+ * Get the expression within the aggregate function. The expression will be
+ * null for the special case COUNT(*). This is the only case where the
+ * expression will be null
+ * @return The expression or null for COUNT(*)
+ */
+ public Expression getExpression() {
+ return this.expression;
+ }
+
+ /**
+ * @see org.teiid.connector.language.LanguageObject#acceptVisitor(com.metamatrix.data.visitor.LanguageObjectVisitor)
+ */
+ public void acceptVisitor(LanguageObjectVisitor visitor) {
+ visitor.visit(this);
+ }
+
+ /**
+ * Set the name of the aggregate function. This will be one of the constants defined
+ * in this class.
+ * @param name New aggregate function name
+ * @see #COUNT
+ * @see #AVG
+ * @see #SUM
+ * @see #MIN
+ * @see #MAX
+ */
+ public void setName(String name) {
+ this.aggName = name;
+ }
+
+ /**
+ * Set whether this function was executed with DISTINCT. Executing
+ * with DISTINCT will remove all duplicate values in a group when evaluating
+ * the aggregate function.
+ * @param isDistinct True if DISTINCT mode should be used
+ */
+ public void setDistinct(boolean isDistinct) {
+ this.isDistinct = isDistinct;
+ }
+
+ /**
+ * Set the expression within the aggregate function. The expression will be
+ * null for the special case COUNT(*).
+ * @param expression The new expression
+ */
+ public void setExpression(Expression expression) {
+ this.expression = expression;
+ }
+
+ public Class<?> getType() {
+ return this.type;
+ }
+
+ public void setType(Class<?> type) {
+ this.type = type;
+ }
+
+}
Copied: trunk/connector-api/src/main/java/org/teiid/connector/language/AndOr.java (from rev 1899, branches/JCA/connector-api/src/main/java/org/teiid/connector/language/AndOr.java)
===================================================================
--- trunk/connector-api/src/main/java/org/teiid/connector/language/AndOr.java (rev 0)
+++ trunk/connector-api/src/main/java/org/teiid/connector/language/AndOr.java 2010-03-04 20:47:34 UTC (rev 1913)
@@ -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.connector.language;
+
+import org.teiid.connector.visitor.framework.LanguageObjectVisitor;
+
+/**
+ * Represents a logical criteria such as AND, OR, or NOT.
+ */
+public class AndOr extends Condition {
+
+ public enum Operator {
+ AND,
+ OR,
+ }
+
+ private Condition leftCondition;
+ private Condition rightCondition;
+ private Operator operator = Operator.AND;
+
+ public AndOr(Condition left, Condition right, Operator operator) {
+ this.leftCondition = left;
+ this.rightCondition = right;
+ this.operator = operator;
+ }
+
+ /**
+ * Get operator used to connect these criteria.
+ * @return Operator constant
+ */
+ public Operator getOperator() {
+ return this.operator;
+ }
+
+ public void acceptVisitor(LanguageObjectVisitor visitor) {
+ visitor.visit(this);
+ }
+
+ /**
+ * Set operator used to connect these criteria.
+ * @param operator Operator constant
+ */
+ public void setOperator(Operator operator) {
+ this.operator = operator;
+ }
+
+ public Condition getLeftCondition() {
+ return leftCondition;
+ }
+
+ public Condition getRightCondition() {
+ return rightCondition;
+ }
+
+ public void setLeftCondition(Condition left) {
+ this.leftCondition = left;
+ }
+
+ public void setRightCondition(Condition right) {
+ this.rightCondition = right;
+ }
+
+}
Copied: trunk/connector-api/src/main/java/org/teiid/connector/language/Argument.java (from rev 1899, branches/JCA/connector-api/src/main/java/org/teiid/connector/language/Argument.java)
===================================================================
--- trunk/connector-api/src/main/java/org/teiid/connector/language/Argument.java (rev 0)
+++ trunk/connector-api/src/main/java/org/teiid/connector/language/Argument.java 2010-03-04 20:47:34 UTC (rev 1913)
@@ -0,0 +1,89 @@
+/*
+ * 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.connector.language;
+
+import org.teiid.connector.metadata.runtime.ProcedureParameter;
+import org.teiid.connector.visitor.framework.LanguageObjectVisitor;
+
+public class Argument extends BaseLanguageObject implements MetadataReference<ProcedureParameter> {
+
+ public enum Direction {
+ IN,
+ OUT,
+ INOUT,
+ }
+
+ private Direction direction;
+ private Literal argumentValue;
+ private ProcedureParameter metadataObject;
+ private Class<?> type;
+
+ public Argument(Direction direction, Literal value, Class<?> type, ProcedureParameter metadataObject) {
+ this.direction = direction;
+ this.argumentValue = value;
+ this.metadataObject = metadataObject;
+ this.type = type;
+ }
+
+ public Direction getDirection() {
+ return this.direction;
+ }
+
+ /**
+ * Get the argument value
+ * @return the value or null if this is an out parameter
+ */
+ public Literal getArgumentValue() {
+ return this.argumentValue;
+ }
+
+ public Class<?> getType() {
+ return type;
+ }
+
+ public void setType(Class<?> type) {
+ this.type = type;
+ }
+
+ public void acceptVisitor(LanguageObjectVisitor visitor) {
+ visitor.visit(this);
+ }
+
+ public void setDirection(Direction direction) {
+ this.direction = direction;
+ }
+
+ public void setArgumentValue(Literal value) {
+ this.argumentValue = value;
+ }
+
+ @Override
+ public ProcedureParameter getMetadataObject() {
+ return this.metadataObject;
+ }
+
+ public void setMetadataObject(ProcedureParameter metadataObject) {
+ this.metadataObject = metadataObject;
+ }
+
+}
Copied: trunk/connector-api/src/main/java/org/teiid/connector/language/BaseInCondition.java (from rev 1899, branches/JCA/connector-api/src/main/java/org/teiid/connector/language/BaseInCondition.java)
===================================================================
--- trunk/connector-api/src/main/java/org/teiid/connector/language/BaseInCondition.java (rev 0)
+++ trunk/connector-api/src/main/java/org/teiid/connector/language/BaseInCondition.java 2010-03-04 20:47:34 UTC (rev 1913)
@@ -0,0 +1,65 @@
+/*
+ * 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.connector.language;
+
+public abstract class BaseInCondition extends Condition implements Predicate {
+
+ private Expression leftExpression;
+ private boolean negated;
+
+ public BaseInCondition(Expression leftExpression, boolean negated) {
+ this.leftExpression = leftExpression;
+ this.negated = negated;
+ }
+
+ /**
+ * Get left expression of IN criteria
+ * @return Left expression
+ */
+ public Expression getLeftExpression() {
+ return leftExpression;
+ }
+
+ /**
+ * Set left expression of IN criteria
+ */
+ public void setLeftExpression(Expression leftExpression) {
+ this.leftExpression = leftExpression;
+ }
+
+ /**
+ * Returns whether this criteria is negated.
+ * @return flag indicating whether this criteria contains a NOT
+ */
+ public boolean isNegated() {
+ return negated;
+ }
+
+ /**
+ * Sets whether this criteria is negated.
+ * @param negated Flag indicating whether this criteria contains a NOT
+ */
+ public void setNegated(boolean negated) {
+ this.negated = negated;
+ }
+}
Copied: trunk/connector-api/src/main/java/org/teiid/connector/language/BaseLanguageObject.java (from rev 1899, branches/JCA/connector-api/src/main/java/org/teiid/connector/language/BaseLanguageObject.java)
===================================================================
--- trunk/connector-api/src/main/java/org/teiid/connector/language/BaseLanguageObject.java (rev 0)
+++ trunk/connector-api/src/main/java/org/teiid/connector/language/BaseLanguageObject.java 2010-03-04 20:47:34 UTC (rev 1913)
@@ -0,0 +1,33 @@
+/*
+ * 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.connector.language;
+
+import org.teiid.connector.visitor.util.SQLStringVisitor;
+
+public abstract class BaseLanguageObject implements LanguageObject {
+
+ public String toString() {
+ return SQLStringVisitor.getSQLString(this);
+ }
+
+}
Copied: trunk/connector-api/src/main/java/org/teiid/connector/language/BatchedUpdates.java (from rev 1899, branches/JCA/connector-api/src/main/java/org/teiid/connector/language/BatchedUpdates.java)
===================================================================
--- trunk/connector-api/src/main/java/org/teiid/connector/language/BatchedUpdates.java (rev 0)
+++ trunk/connector-api/src/main/java/org/teiid/connector/language/BatchedUpdates.java 2010-03-04 20:47:34 UTC (rev 1913)
@@ -0,0 +1,51 @@
+/*
+ * 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.connector.language;
+
+import java.util.List;
+
+import org.teiid.connector.visitor.framework.LanguageObjectVisitor;
+
+/**
+ * Represents a batch of INSERT, UPDATE and DELETE commands to be executed together.
+ */
+public class BatchedUpdates extends BaseLanguageObject implements Command {
+
+ private List<Command> updateCommands;
+
+ public BatchedUpdates(List<Command> updateCommands) {
+ this.updateCommands = updateCommands;
+ }
+
+ /**
+ * @return a list of IInsert, IUpdate and IDelete commands in this batched update.
+ */
+ public List<Command> getUpdateCommands() {
+ return updateCommands;
+ }
+
+ public void acceptVisitor(LanguageObjectVisitor visitor) {
+ visitor.visit(this);
+ }
+
+}
Copied: trunk/connector-api/src/main/java/org/teiid/connector/language/Call.java (from rev 1899, branches/JCA/connector-api/src/main/java/org/teiid/connector/language/Call.java)
===================================================================
--- trunk/connector-api/src/main/java/org/teiid/connector/language/Call.java (rev 0)
+++ trunk/connector-api/src/main/java/org/teiid/connector/language/Call.java 2010-03-04 20:47:34 UTC (rev 1913)
@@ -0,0 +1,110 @@
+/*
+ * 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.connector.language;
+
+import java.util.List;
+
+import org.teiid.connector.metadata.runtime.Column;
+import org.teiid.connector.metadata.runtime.ColumnSet;
+import org.teiid.connector.metadata.runtime.Procedure;
+import org.teiid.connector.metadata.runtime.ProcedureParameter;
+import org.teiid.connector.metadata.runtime.ProcedureParameter.Type;
+import org.teiid.connector.visitor.framework.LanguageObjectVisitor;
+
+/**
+ * Represents a procedural execution (such as a stored procedure).
+ */
+public class Call extends BaseLanguageObject implements Command, MetadataReference<Procedure> {
+
+ private String name;
+ private List<Argument> arguments;
+ private Procedure metadataObject;
+ private Class<?> returnType;
+
+ public Call(String name, List<Argument> parameters, Procedure metadataObject) {
+ this.name = name;
+ this.arguments = parameters;
+ this.metadataObject = metadataObject;
+ }
+
+ /**
+ * Get the return type
+ * @return the return parameter type or null if not expecting a return value
+ */
+ public Class<?> getReturnType() {
+ return returnType;
+ }
+
+ public void setReturnType(Class<?> returnType) {
+ this.returnType = returnType;
+ }
+
+ public String getProcedureName() {
+ return this.name;
+ }
+
+ public List<Argument> getArguments() {
+ return arguments;
+ }
+
+ public void acceptVisitor(LanguageObjectVisitor visitor) {
+ visitor.visit(this);
+ }
+
+ public void setProcedureName(String name) {
+ this.name = name;
+ }
+
+ public void setArguments(List<Argument> parameters) {
+ this.arguments = parameters;
+ }
+
+ @Override
+ public Procedure getMetadataObject() {
+ return this.metadataObject;
+ }
+
+ public ProcedureParameter getReturnParameter() {
+ for (ProcedureParameter param : this.metadataObject.getParameters()) {
+ if (param.getType() == Type.ReturnValue) {
+ return param;
+ }
+ }
+ return null;
+ }
+
+ public Class<?>[] getResultSetColumnTypes() {
+ ColumnSet<Procedure> resultSet = this.metadataObject.getResultSet();
+ if (resultSet == null) {
+ return new Class[0];
+ }
+ List<Column> columnMetadata = resultSet.getColumns();
+ int size = columnMetadata.size();
+ Class<?>[] coulmnDTs = new Class[size];
+ for(int i =0; i<size; i++ ){
+ coulmnDTs[i] = columnMetadata.get(i).getJavaType();
+ }
+ return coulmnDTs;
+ }
+
+}
Copied: trunk/connector-api/src/main/java/org/teiid/connector/language/ColumnReference.java (from rev 1899, branches/JCA/connector-api/src/main/java/org/teiid/connector/language/ColumnReference.java)
===================================================================
--- trunk/connector-api/src/main/java/org/teiid/connector/language/ColumnReference.java (rev 0)
+++ trunk/connector-api/src/main/java/org/teiid/connector/language/ColumnReference.java 2010-03-04 20:47:34 UTC (rev 1913)
@@ -0,0 +1,96 @@
+/*
+ * 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.connector.language;
+
+import org.teiid.connector.metadata.runtime.Column;
+import org.teiid.connector.visitor.framework.LanguageObjectVisitor;
+
+/**
+ * Represents an element in the language. An example of an element
+ * would be a column reference in a SELECT clause.
+ */
+public class ColumnReference extends BaseLanguageObject implements MetadataReference<Column>, Expression {
+
+ private NamedTable table;
+ private String name;
+ private Column metadataObject;
+ private Class<?> type;
+
+ public ColumnReference(NamedTable group, String name, Column metadataObject, Class<?> type) {
+ this.table = group;
+ this.name = name;
+ this.metadataObject = metadataObject;
+ this.type = type;
+ }
+
+ /**
+ * Gets the name of the element.
+ * @return the name of the element
+ */
+ public String getName() {
+ return this.name;
+ }
+
+ /**
+ * Return the table that contains this column. May be null.
+ * @return The group reference
+ */
+ public NamedTable getTable() {
+ return table;
+ }
+
+ @Override
+ public Column getMetadataObject() {
+ return this.metadataObject;
+ }
+
+ public void setMetadataObject(Column metadataObject) {
+ this.metadataObject = metadataObject;
+ }
+
+ public void acceptVisitor(LanguageObjectVisitor visitor) {
+ visitor.visit(this);
+ }
+
+
+ public void setTable(NamedTable group) {
+ this.table = group;
+ }
+
+ public Class<?> getType() {
+ return this.type;
+ }
+
+ /**
+ * Sets the name of the element.
+ * @param name The name of the element
+ */
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public void setType(Class<?> type) {
+ this.type = type;
+ }
+
+}
Copied: trunk/connector-api/src/main/java/org/teiid/connector/language/Command.java (from rev 1899, branches/JCA/connector-api/src/main/java/org/teiid/connector/language/Command.java)
===================================================================
--- trunk/connector-api/src/main/java/org/teiid/connector/language/Command.java (rev 0)
+++ trunk/connector-api/src/main/java/org/teiid/connector/language/Command.java 2010-03-04 20:47:34 UTC (rev 1913)
@@ -0,0 +1,32 @@
+/*
+ * 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.connector.language;
+
+/**
+ * Represents a command in the language objects. A command is an instruction of
+ * something to execute sent to the connector. Typical commands perform
+ * SELECT, INSERT, UPDATE, DELETE, etc type operations.
+ */
+public interface Command extends LanguageObject {
+
+}
Copied: trunk/connector-api/src/main/java/org/teiid/connector/language/Comparison.java (from rev 1899, branches/JCA/connector-api/src/main/java/org/teiid/connector/language/Comparison.java)
===================================================================
--- trunk/connector-api/src/main/java/org/teiid/connector/language/Comparison.java (rev 0)
+++ trunk/connector-api/src/main/java/org/teiid/connector/language/Comparison.java 2010-03-04 20:47:34 UTC (rev 1913)
@@ -0,0 +1,117 @@
+/*
+ * 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.connector.language;
+
+import org.teiid.connector.language.SQLReservedWords.Tokens;
+import org.teiid.connector.visitor.framework.LanguageObjectVisitor;
+
+/**
+ * Represents a comparison between two expressions connected with
+ * one of the following operators: =, <>, <, <=, >, >=.
+ */
+public class Comparison extends Condition implements Predicate {
+
+ public enum Operator {
+ EQ(Tokens.EQ),
+ NE(Tokens.NE),
+ LT(Tokens.LT),
+ LE(Tokens.LE),
+ GT(Tokens.GT),
+ GE(Tokens.GE);
+
+ private String toString;
+ Operator(String toString) {
+ this.toString = toString;
+ }
+ @Override
+ public String toString() {
+ return toString;
+ }
+ }
+
+ private Expression leftExpression;
+ private Expression rightExpression;
+ private Operator operator;
+
+ public Comparison(Expression left, Expression right, Operator operator) {
+ leftExpression = left;
+ rightExpression = right;
+ this.operator = operator;
+ }
+
+ /**
+ * Get left expression.
+ * @return Left expression
+ */
+ public Expression getLeftExpression() {
+ return leftExpression;
+ }
+
+ /**
+ * Get right expression.
+ * @return Right expression
+ */
+ public Expression getRightExpression() {
+ return rightExpression;
+ }
+
+ /**
+ * Get the operator
+ * @return Operator constant
+ * @see Operator
+ */
+ public Operator getOperator() {
+ return this.operator;
+ }
+
+ /**
+ * Set left expression of criteria
+ */
+ public void setLeftExpression(Expression expression) {
+ this.leftExpression = expression;
+ }
+
+ /**
+ * Set right expression of criteria
+ */
+ public void setRightExpression(Expression expression) {
+ this.rightExpression = expression;
+ }
+
+ /**
+ * Set the operator
+ * @see Operator
+ */
+ public void setOperator(Operator operator) {
+ this.operator = operator;
+ }
+
+ /**
+ * @see org.teiid.connector.language.LanguageObject#acceptVisitor(com.metamatrix.data.visitor.LanguageObjectVisitor)
+ */
+ public void acceptVisitor(LanguageObjectVisitor visitor) {
+ visitor.visit(this);
+ }
+
+
+}
Copied: trunk/connector-api/src/main/java/org/teiid/connector/language/Condition.java (from rev 1899, branches/JCA/connector-api/src/main/java/org/teiid/connector/language/Condition.java)
===================================================================
--- trunk/connector-api/src/main/java/org/teiid/connector/language/Condition.java (rev 0)
+++ trunk/connector-api/src/main/java/org/teiid/connector/language/Condition.java 2010-03-04 20:47:34 UTC (rev 1913)
@@ -0,0 +1,37 @@
+/*
+ * 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.connector.language;
+
+import org.teiid.connector.api.TypeFacility;
+
+/**
+ * Represents criteria, which is also a boolean expression
+ */
+public abstract class Condition extends BaseLanguageObject implements Expression {
+
+ @Override
+ public Class<?> getType() {
+ return TypeFacility.RUNTIME_TYPES.BOOLEAN;
+ }
+
+}
Copied: trunk/connector-api/src/main/java/org/teiid/connector/language/Delete.java (from rev 1899, branches/JCA/connector-api/src/main/java/org/teiid/connector/language/Delete.java)
===================================================================
--- trunk/connector-api/src/main/java/org/teiid/connector/language/Delete.java (rev 0)
+++ trunk/connector-api/src/main/java/org/teiid/connector/language/Delete.java 2010-03-04 20:47:34 UTC (rev 1913)
@@ -0,0 +1,76 @@
+/*
+ * 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.connector.language;
+
+import org.teiid.connector.visitor.framework.LanguageObjectVisitor;
+
+/**
+ * Represents a DELETE command.
+ */
+public class Delete extends BaseLanguageObject implements Command {
+
+ private NamedTable table;
+ private Condition where;
+
+ public Delete(NamedTable group, Condition criteria) {
+ this.table = group;
+ this.where = criteria;
+ }
+
+ /**
+ * Get group that is being deleted from.
+ * @return Insert group
+ */
+ public NamedTable getTable() {
+ return table;
+ }
+
+ /**
+ * Get criteria that is being used with the delete - may be null
+ * @return Criteria, may be null
+ */
+ public Condition getWhere() {
+ return where;
+ }
+
+ public void acceptVisitor(LanguageObjectVisitor visitor) {
+ visitor.visit(this);
+ }
+
+ /**
+ * Set group that is being deleted from.
+ * @param group Insert group
+ */
+ public void setTable(NamedTable group) {
+ this.table = group;
+ }
+
+ /**
+ * Set criteria that is being used with the delete - may be null
+ * @param criteria Criteria, may be null
+ */
+ public void setWhere(Condition criteria) {
+ this.where = criteria;
+ }
+
+}
Copied: trunk/connector-api/src/main/java/org/teiid/connector/language/DerivedColumn.java (from rev 1899, branches/JCA/connector-api/src/main/java/org/teiid/connector/language/DerivedColumn.java)
===================================================================
--- trunk/connector-api/src/main/java/org/teiid/connector/language/DerivedColumn.java (rev 0)
+++ trunk/connector-api/src/main/java/org/teiid/connector/language/DerivedColumn.java 2010-03-04 20:47:34 UTC (rev 1913)
@@ -0,0 +1,57 @@
+/*
+ * 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.connector.language;
+
+import org.teiid.connector.visitor.framework.LanguageObjectVisitor;
+
+public class DerivedColumn extends BaseLanguageObject {
+
+ private String alias;
+ private Expression expression;
+
+ public DerivedColumn(String name, Expression expression) {
+ this.alias = name;
+ this.expression = expression;
+ }
+
+ public String getAlias() {
+ return alias;
+ }
+
+ public Expression getExpression() {
+ return expression;
+ }
+
+ public void acceptVisitor(LanguageObjectVisitor visitor) {
+ visitor.visit(this);
+ }
+
+ public void setAlias(String name) {
+ this.alias = name;
+ }
+
+ public void setExpression(Expression expression) {
+ this.expression = expression;
+ }
+
+}
Copied: trunk/connector-api/src/main/java/org/teiid/connector/language/DerivedTable.java (from rev 1899, branches/JCA/connector-api/src/main/java/org/teiid/connector/language/DerivedTable.java)
===================================================================
--- trunk/connector-api/src/main/java/org/teiid/connector/language/DerivedTable.java (rev 0)
+++ trunk/connector-api/src/main/java/org/teiid/connector/language/DerivedTable.java 2010-03-04 20:47:34 UTC (rev 1913)
@@ -0,0 +1,60 @@
+/*
+ * 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.connector.language;
+
+import org.teiid.connector.visitor.framework.LanguageObjectVisitor;
+
+/**
+ * Represents a derived table or inline view in the from clause.
+ */
+public class DerivedTable extends BaseLanguageObject implements TableReference {
+
+ private String correlationName;
+ private QueryExpression query;
+
+ public DerivedTable(QueryExpression query, String name) {
+ this.query = query;
+ this.correlationName = name;
+ }
+
+ public String getCorrelationName() {
+ return this.correlationName;
+ }
+
+ public void setCorrelationName(String name) {
+ this.correlationName = name;
+ }
+
+ public QueryExpression getQuery() {
+ return this.query;
+ }
+
+ public void setQuery(QueryExpression query) {
+ this.query = query;
+ }
+
+ public void acceptVisitor(LanguageObjectVisitor visitor) {
+ visitor.visit(this);
+ }
+
+}
Copied: trunk/connector-api/src/main/java/org/teiid/connector/language/Exists.java (from rev 1899, branches/JCA/connector-api/src/main/java/org/teiid/connector/language/Exists.java)
===================================================================
--- trunk/connector-api/src/main/java/org/teiid/connector/language/Exists.java (rev 0)
+++ trunk/connector-api/src/main/java/org/teiid/connector/language/Exists.java 2010-03-04 20:47:34 UTC (rev 1913)
@@ -0,0 +1,51 @@
+/*
+ * 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.connector.language;
+
+import org.teiid.connector.visitor.framework.LanguageObjectVisitor;
+
+/**
+ * Represents an EXISTS criteria that checks whether any results would be
+ * returned from a subquery.
+ */
+public class Exists extends Condition implements Predicate, SubqueryContainer {
+
+ private QueryExpression query;
+
+ public Exists(QueryExpression query) {
+ this.query = query;
+ }
+
+ public QueryExpression getSubquery() {
+ return query;
+ }
+
+ public void acceptVisitor(LanguageObjectVisitor visitor) {
+ visitor.visit(this);
+ }
+
+ public void setSubquery(QueryExpression query) {
+ this.query = query;
+ }
+
+}
Copied: trunk/connector-api/src/main/java/org/teiid/connector/language/Expression.java (from rev 1899, branches/JCA/connector-api/src/main/java/org/teiid/connector/language/Expression.java)
===================================================================
--- trunk/connector-api/src/main/java/org/teiid/connector/language/Expression.java (rev 0)
+++ trunk/connector-api/src/main/java/org/teiid/connector/language/Expression.java 2010-03-04 20:47:34 UTC (rev 1913)
@@ -0,0 +1,39 @@
+/*
+ * 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.connector.language;
+
+/**
+ * Represents an expression in the language. Subinterfaces define specific
+ * types of expressions, such as literal values, element references, and
+ * functions.
+ */
+public interface Expression extends LanguageObject {
+
+ /**
+ * Determine the type returned by this expression.
+ *
+ * @return The type, as defined by a Java class
+ */
+ Class<?> getType();
+
+}
Copied: trunk/connector-api/src/main/java/org/teiid/connector/language/ExpressionValueSource.java (from rev 1899, branches/JCA/connector-api/src/main/java/org/teiid/connector/language/ExpressionValueSource.java)
===================================================================
--- trunk/connector-api/src/main/java/org/teiid/connector/language/ExpressionValueSource.java (rev 0)
+++ trunk/connector-api/src/main/java/org/teiid/connector/language/ExpressionValueSource.java 2010-03-04 20:47:34 UTC (rev 1913)
@@ -0,0 +1,45 @@
+/*
+ * 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.connector.language;
+
+import java.util.List;
+
+import org.teiid.connector.visitor.framework.LanguageObjectVisitor;
+
+public class ExpressionValueSource extends BaseLanguageObject implements InsertValueSource {
+
+ private List<Expression> values;
+
+ public ExpressionValueSource(List<Expression> values) {
+ this.values = values;
+ }
+
+ public List<Expression> getValues() {
+ return values;
+ }
+
+ public void acceptVisitor(LanguageObjectVisitor visitor) {
+ visitor.visit(this);
+ }
+
+}
Copied: trunk/connector-api/src/main/java/org/teiid/connector/language/Function.java (from rev 1899, branches/JCA/connector-api/src/main/java/org/teiid/connector/language/Function.java)
===================================================================
--- trunk/connector-api/src/main/java/org/teiid/connector/language/Function.java (rev 0)
+++ trunk/connector-api/src/main/java/org/teiid/connector/language/Function.java 2010-03-04 20:47:34 UTC (rev 1913)
@@ -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.connector.language;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.teiid.connector.visitor.framework.LanguageObjectVisitor;
+
+/**
+ * Represents a function. A function has a name and 0..n
+ * Expressions that are parameters.
+ */
+public class Function extends BaseLanguageObject implements Expression {
+
+ private String name;
+ private List<Expression> parameters;
+ private Class<?> type;
+
+ public Function(String name, List<? extends Expression> params, Class<?> type) {
+ this.name = name;
+ if (params == null) {
+ this.parameters = new ArrayList<Expression>(0);
+ } else {
+ this.parameters = new ArrayList<Expression>(params);
+ }
+ this.type = type;
+ }
+
+ /**
+ * Get name of the function
+ * @return Function name
+ */
+ public String getName() {
+ return this.name;
+ }
+
+ /**
+ * Get the parameters used in this function.
+ * @return Array of IExpressions defining the parameters
+ */
+ public List<Expression> getParameters() {
+ return parameters;
+ }
+
+ public void acceptVisitor(LanguageObjectVisitor visitor) {
+ visitor.visit(this);
+ }
+
+ /**
+ * Set name of the function
+ * @param name Function name
+ */
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public Class<?> getType() {
+ return this.type;
+ }
+
+ public void setType(Class<?> type) {
+ this.type = type;
+ }
+
+}
Copied: trunk/connector-api/src/main/java/org/teiid/connector/language/GroupBy.java (from rev 1899, branches/JCA/connector-api/src/main/java/org/teiid/connector/language/GroupBy.java)
===================================================================
--- trunk/connector-api/src/main/java/org/teiid/connector/language/GroupBy.java (rev 0)
+++ trunk/connector-api/src/main/java/org/teiid/connector/language/GroupBy.java 2010-03-04 20:47:34 UTC (rev 1913)
@@ -0,0 +1,56 @@
+/*
+ * 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.connector.language;
+
+import java.util.List;
+
+import org.teiid.connector.visitor.framework.LanguageObjectVisitor;
+
+/**
+ * Represents a GROUP BY clause in a query.
+ */
+public class GroupBy extends BaseLanguageObject {
+
+ private List<Expression> elements;
+
+ public GroupBy(List<Expression> elements) {
+ this.elements = elements;
+ }
+
+ /**
+ * Get list of IExpression that the GROUP BY should be grouped on.
+ * @return List of IExpression
+ */
+ public List<Expression> getElements() {
+ return elements;
+ }
+
+ public void acceptVisitor(LanguageObjectVisitor visitor) {
+ visitor.visit(this);
+ }
+
+ public void setElements(List<Expression> elements) {
+ this.elements = elements;
+ }
+
+}
Deleted: trunk/connector-api/src/main/java/org/teiid/connector/language/IAggregate.java
===================================================================
--- trunk/connector-api/src/main/java/org/teiid/connector/language/IAggregate.java 2010-03-04 20:22:20 UTC (rev 1912)
+++ trunk/connector-api/src/main/java/org/teiid/connector/language/IAggregate.java 2010-03-04 20:47:34 UTC (rev 1913)
@@ -1,92 +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.connector.language;
-
-/**
- * Represents an expression in the SELECT clause. Anything
- * other than an aggregate symbol in the SELECT clause will
- * be referenced by an IExpressionSymbol.
- */
-public interface IAggregate extends IExpression {
-
- public static final String COUNT = "COUNT"; //$NON-NLS-1$
- public static final String AVG = "AVG"; //$NON-NLS-1$
- public static final String SUM = "SUM"; //$NON-NLS-1$
- public static final String MIN = "MIN"; //$NON-NLS-1$
- public static final String MAX = "MAX"; //$NON-NLS-1$
-
- /**
- * Get the name of the aggregate function. This will be one of the constants defined
- * in this interface.
- * @see #COUNT
- * @see #AVG
- * @see #SUM
- * @see #MIN
- * @see #MAX
- */
- String getName();
-
- /**
- * Set the name of the aggregate function. This will be one of the constants defined
- * in this interface.
- * @param name New aggregate function name
- * @see #COUNT
- * @see #AVG
- * @see #SUM
- * @see #MIN
- * @see #MAX
- */
- void setName(String name);
-
- /**
- * Determine whether this function was executed with DISTINCT. Executing
- * with DISTINCT will remove all duplicate values in a group when evaluating
- * the aggregate function.
- * @return True if DISTINCT mode is used
- */
- boolean isDistinct();
-
- /**
- * Set whether this function was executed with DISTINCT. Executing
- * with DISTINCT will remove all duplicate values in a group when evaluating
- * the aggregate function.
- * @param isDistinct True if DISTINCT mode should be used
- */
- void setDistinct(boolean isDistinct);
-
- /**
- * Get the expression within the aggregate function. The expression will be
- * null for the special case COUNT(*). This is the only case where the
- * expression will be null
- * @return The expression or null for COUNT(*)
- */
- IExpression getExpression();
-
- /**
- * Set the expression within the aggregate function. The expression will be
- * null for the special case COUNT(*).
- * @param expression The new expression
- */
- void setExpression(IExpression expression);
-
-}
Deleted: trunk/connector-api/src/main/java/org/teiid/connector/language/IBaseInCriteria.java
===================================================================
--- trunk/connector-api/src/main/java/org/teiid/connector/language/IBaseInCriteria.java 2010-03-04 20:22:20 UTC (rev 1912)
+++ trunk/connector-api/src/main/java/org/teiid/connector/language/IBaseInCriteria.java 2010-03-04 20:47:34 UTC (rev 1913)
@@ -1,52 +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.connector.language;
-
-/**
- */
-public interface IBaseInCriteria extends IPredicateCriteria {
- /**
- * Get left expression of IN criteria
- * @return Left expression
- */
- IExpression getLeftExpression();
-
- /**
- * Set left expression of IN criteria
- * @return Left expression
- */
- void setLeftExpression(IExpression expression);
-
- /**
- * Returns whether this criteria is negated.
- * @return flag indicating whether this criteria contains a NOT
- */
- boolean isNegated();
-
- /**
- * Sets whether this criteria is negated.
- * @param negated Flag indicating whether this criteria contains a NOT
- */
- void setNegated(boolean negated);
-
-}
Deleted: trunk/connector-api/src/main/java/org/teiid/connector/language/IBatchedUpdates.java
===================================================================
--- trunk/connector-api/src/main/java/org/teiid/connector/language/IBatchedUpdates.java 2010-03-04 20:22:20 UTC (rev 1912)
+++ trunk/connector-api/src/main/java/org/teiid/connector/language/IBatchedUpdates.java 2010-03-04 20:47:34 UTC (rev 1913)
@@ -1,40 +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.connector.language;
-
-import java.util.List;
-
-
-/**
- * Represents a batch of INSERT, UPDATE and DELETE commands to be executed together.
- * @since 4.2
- */
-public interface IBatchedUpdates extends ICommand {
-
- /**
- *
- * @return a list of IInsert, IUpdate and IDelete commands in this batched update.
- * @since 4.2
- */
- List<ICommand> getUpdateCommands();
-}
Deleted: trunk/connector-api/src/main/java/org/teiid/connector/language/ICommand.java
===================================================================
--- trunk/connector-api/src/main/java/org/teiid/connector/language/ICommand.java 2010-03-04 20:22:20 UTC (rev 1912)
+++ trunk/connector-api/src/main/java/org/teiid/connector/language/ICommand.java 2010-03-04 20:47:34 UTC (rev 1913)
@@ -1,32 +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.connector.language;
-
-/**
- * Represents a command in the language objects. A command is an instruction of
- * something to execute sent to the connector. Typical commands perform
- * SELECT, INSERT, UPDATE, DELETE, etc type operations.
- */
-public interface ICommand extends ILanguageObject {
-
-}
Deleted: trunk/connector-api/src/main/java/org/teiid/connector/language/ICompareCriteria.java
===================================================================
--- trunk/connector-api/src/main/java/org/teiid/connector/language/ICompareCriteria.java 2010-03-04 20:22:20 UTC (rev 1912)
+++ trunk/connector-api/src/main/java/org/teiid/connector/language/ICompareCriteria.java 2010-03-04 20:47:34 UTC (rev 1913)
@@ -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.connector.language;
-
-/**
- * Represents a comparison between two expressions connected with
- * one of the following operators: =, <>, <, <=, >, >=.
- */
-public interface ICompareCriteria extends IPredicateCriteria {
-
- public enum Operator {
- EQ,
- NE,
- LT,
- LE,
- GT,
- GE
- }
-
- /**
- * Get left expression.
- * @return Left expression
- */
- IExpression getLeftExpression();
-
- /**
- * Set left expression of criteria
- * @return Left expression
- */
- void setLeftExpression(IExpression expression);
-
- /**
- * Get right expression.
- * @return Right expression
- */
- IExpression getRightExpression();
-
- /**
- * Set left expression of criteria
- * @return Right expression
- */
- void setRightExpression(IExpression expression);
-
- /**
- * Get operator from set defined in this interface.
- * @return Operator constant
- * @see Operator#EQ
- * @see Operator#NE
- * @see Operator#LT
- * @see Operator#LE
- * @see Operator#GT
- * @see Operator#GE
- */
- Operator getOperator();
-
- /**
- * Set operator from set defined in this interface.
- * @param operator Operator constant
- * @see Operator#EQ
- * @see Operator#NE
- * @see Operator#LT
- * @see Operator#LE
- * @see Operator#GT
- * @see Operator#GE
- */
- void setOperator(Operator operator);
-}
Deleted: trunk/connector-api/src/main/java/org/teiid/connector/language/ICompoundCriteria.java
===================================================================
--- trunk/connector-api/src/main/java/org/teiid/connector/language/ICompoundCriteria.java 2010-03-04 20:22:20 UTC (rev 1912)
+++ trunk/connector-api/src/main/java/org/teiid/connector/language/ICompoundCriteria.java 2010-03-04 20:47:34 UTC (rev 1913)
@@ -1,59 +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.connector.language;
-
-import java.util.List;
-
-/**
- * Represents a compound logical criteria such as AND or OR.
- */
-public interface ICompoundCriteria extends ILogicalCriteria {
-
- public enum Operator {
- AND,
- OR
- }
-
- /**
- * Get operator used to connect these criteria.
- * @return Operator constant
- * @see Operator#AND
- * @see Operator#OR
- */
- Operator getOperator();
-
- /**
- * Set operator used to connect these criteria.
- * @param operator Operator constant
- * @see Operator#AND
- * @see Operator#OR
- */
- void setOperator(Operator operator);
-
- /**
- * Get list of ICriteria combined by this compound criteria.
- * @return List of ICriteria
- */
- List<ICriteria> getCriteria();
-
-}
Deleted: trunk/connector-api/src/main/java/org/teiid/connector/language/ICriteria.java
===================================================================
--- trunk/connector-api/src/main/java/org/teiid/connector/language/ICriteria.java 2010-03-04 20:22:20 UTC (rev 1912)
+++ trunk/connector-api/src/main/java/org/teiid/connector/language/ICriteria.java 2010-03-04 20:47:34 UTC (rev 1913)
@@ -1,30 +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.connector.language;
-
-/**
- * Represents a criteria in the language objects.
- */
-public interface ICriteria extends ILanguageObject {
-
-}
Deleted: trunk/connector-api/src/main/java/org/teiid/connector/language/IDelete.java
===================================================================
--- trunk/connector-api/src/main/java/org/teiid/connector/language/IDelete.java 2010-03-04 20:22:20 UTC (rev 1912)
+++ trunk/connector-api/src/main/java/org/teiid/connector/language/IDelete.java 2010-03-04 20:47:34 UTC (rev 1913)
@@ -1,54 +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.connector.language;
-
-/**
- * Represents a DELETE command in the language objects.
- */
-public interface IDelete extends ICommand {
-
- /**
- * Get group that is being inserted into.
- * @return Insert group
- */
- IGroup getGroup();
-
- /**
- * Get criteria that is being used with the delete - may be null
- * @return Criteria, may be null
- */
- ICriteria getCriteria();
-
- /**
- * Set group that is being inserted into.
- * @param group Insert group
- */
- void setGroup(IGroup group);
-
- /**
- * Set criteria that is being used with the delete - may be null
- * @param criteria Criteria, may be null
- */
- void setCriteria(ICriteria criteria);
-
-}
Deleted: trunk/connector-api/src/main/java/org/teiid/connector/language/IElement.java
===================================================================
--- trunk/connector-api/src/main/java/org/teiid/connector/language/IElement.java 2010-03-04 20:22:20 UTC (rev 1912)
+++ trunk/connector-api/src/main/java/org/teiid/connector/language/IElement.java 2010-03-04 20:47:34 UTC (rev 1913)
@@ -1,57 +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.connector.language;
-
-import org.teiid.connector.metadata.runtime.Element;
-
-/**
- * Represents an element in the language. An example of an element
- * would be a column reference in a SELECT clause.
- */
-public interface IElement extends IMetadataReference<Element>, IExpression {
-
- /**
- * Gets the name of the element.
- * @return the name of the element
- */
- String getName();
-
- /**
- * Return the group that contains this element.
- * @return The group reference
- */
- IGroup getGroup();
-
- /**
- * Sets the name of the element.
- * @param name The name of the element
- */
- void setName(String name);
-
- /**
- * Set the group that contains this element.
- * @return The group reference
- */
- void setGroup(IGroup group);
-
-}
Deleted: trunk/connector-api/src/main/java/org/teiid/connector/language/IExistsCriteria.java
===================================================================
--- trunk/connector-api/src/main/java/org/teiid/connector/language/IExistsCriteria.java 2010-03-04 20:22:20 UTC (rev 1912)
+++ trunk/connector-api/src/main/java/org/teiid/connector/language/IExistsCriteria.java 2010-03-04 20:47:34 UTC (rev 1913)
@@ -1,31 +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.connector.language;
-
-/**
- * Represents an EXISTS criteria that checks whether any results would be
- * returned from a subquery.
- */
-public interface IExistsCriteria extends IPredicateCriteria, ISubqueryContainer {
-
-}
Deleted: trunk/connector-api/src/main/java/org/teiid/connector/language/IExpression.java
===================================================================
--- trunk/connector-api/src/main/java/org/teiid/connector/language/IExpression.java 2010-03-04 20:22:20 UTC (rev 1912)
+++ trunk/connector-api/src/main/java/org/teiid/connector/language/IExpression.java 2010-03-04 20:47:34 UTC (rev 1913)
@@ -1,46 +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.connector.language;
-
-/**
- * Represents an expression in the language. Subinterfaces define specific
- * types of expressions, such as literal values, element references, and
- * functions.
- */
-public interface IExpression extends ILanguageObject {
-
- /**
- * Determine the type returned by this expression.
- *
- * @return The type, as defined by a Java class
- */
- Class<?> getType();
-
- /**
- * Set the type returned by this expression.
- *
- * @param type The type, as defined by a Java class
- */
- void setType(Class<?> type);
-
-}
Deleted: trunk/connector-api/src/main/java/org/teiid/connector/language/IFrom.java
===================================================================
--- trunk/connector-api/src/main/java/org/teiid/connector/language/IFrom.java 2010-03-04 20:22:20 UTC (rev 1912)
+++ trunk/connector-api/src/main/java/org/teiid/connector/language/IFrom.java 2010-03-04 20:47:34 UTC (rev 1913)
@@ -1,38 +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.connector.language;
-
-import java.util.List;
-
-/**
- * Represents a FROM clause in a query.
- */
-public interface IFrom extends ILanguageObject {
-
- /**
- * Get a List of IFromItem in this FROM clause.
- * @return List of IFromItem
- */
- List<IFromItem> getItems();
-
-}
Deleted: trunk/connector-api/src/main/java/org/teiid/connector/language/IFromItem.java
===================================================================
--- trunk/connector-api/src/main/java/org/teiid/connector/language/IFromItem.java 2010-03-04 20:22:20 UTC (rev 1912)
+++ trunk/connector-api/src/main/java/org/teiid/connector/language/IFromItem.java 2010-03-04 20:47:34 UTC (rev 1913)
@@ -1,31 +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.connector.language;
-
-/**
- * Represents an item in the FROM clause - typically this is either a
- * group or a join, as represented by {@link IGroup or IJoin}.
- */
-public interface IFromItem extends ILanguageObject {
-
-}
Deleted: trunk/connector-api/src/main/java/org/teiid/connector/language/IFunction.java
===================================================================
--- trunk/connector-api/src/main/java/org/teiid/connector/language/IFunction.java 2010-03-04 20:22:20 UTC (rev 1912)
+++ trunk/connector-api/src/main/java/org/teiid/connector/language/IFunction.java 2010-03-04 20:47:34 UTC (rev 1913)
@@ -1,51 +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.connector.language;
-
-import java.util.List;
-
-/**
- * Represents a function in the language. A function has a name and 0..n
- * Expressions that are parameters.
- */
-public interface IFunction extends IExpression {
-
- /**
- * Get name of the function
- * @return Function name
- */
- String getName();
-
- /**
- * Get the parameters used in this function.
- * @return Array of IExpressions defining the parameters
- */
- List<IExpression> getParameters();
-
- /**
- * Set name of the function
- * @param name Function name
- */
- void setName(String name);
-
-}
Deleted: trunk/connector-api/src/main/java/org/teiid/connector/language/IGroup.java
===================================================================
--- trunk/connector-api/src/main/java/org/teiid/connector/language/IGroup.java 2010-03-04 20:22:20 UTC (rev 1912)
+++ trunk/connector-api/src/main/java/org/teiid/connector/language/IGroup.java 2010-03-04 20:47:34 UTC (rev 1913)
@@ -1,60 +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.connector.language;
-
-import org.teiid.connector.metadata.runtime.Group;
-
-/**
- * Represents a group in the language objects. An example of a group would
- * be a table reference in the FROM clause. An IGroup may have a context name
- * used in references to this group.
- */
-public interface IGroup extends IMetadataReference<Group>, IFromItem, ILanguageObject {
-
- /**
- * Get the name of the group as defined in the VDB. This is null if the
- * context is the same as the definition.
- * @return Actual group name
- */
- String getDefinition();
-
- /**
- * Get the aliased name this group uses for references in the command.
- * @return Context name
- */
- String getContext();
-
- /**
- * Set the name of the group as defined in the VDB. This is null if the
- * context is the same as the definition.
- * @param definition The definition
- */
- void setDefinition(String definition);
-
- /**
- * Set the aliased name this group uses for references in the command.
- * @param context Context name
- */
- void setContext(String context);
-
-}
Deleted: trunk/connector-api/src/main/java/org/teiid/connector/language/IGroupBy.java
===================================================================
--- trunk/connector-api/src/main/java/org/teiid/connector/language/IGroupBy.java 2010-03-04 20:22:20 UTC (rev 1912)
+++ trunk/connector-api/src/main/java/org/teiid/connector/language/IGroupBy.java 2010-03-04 20:47:34 UTC (rev 1913)
@@ -1,38 +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.connector.language;
-
-import java.util.List;
-
-/**
- * Represents a GROUP BY clause in a query.
- */
-public interface IGroupBy extends ILanguageObject {
-
- /**
- * Get list of IExpression that the GROUP BY should be grouped on.
- * @return List of IExpression
- */
- List<IExpression> getElements();
-
-}
Deleted: trunk/connector-api/src/main/java/org/teiid/connector/language/IInCriteria.java
===================================================================
--- trunk/connector-api/src/main/java/org/teiid/connector/language/IInCriteria.java 2010-03-04 20:22:20 UTC (rev 1912)
+++ trunk/connector-api/src/main/java/org/teiid/connector/language/IInCriteria.java 2010-03-04 20:47:34 UTC (rev 1913)
@@ -1,38 +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.connector.language;
-
-import java.util.List;
-
-/**
- * Represents an IN criteria.
- */
-public interface IInCriteria extends IBaseInCriteria {
-
- /**
- * Get List of IExpression in the set on the right side of the criteria.
- * @return List of IExpression
- */
- List<IExpression> getRightExpressions();
-
-}
Deleted: trunk/connector-api/src/main/java/org/teiid/connector/language/IInlineView.java
===================================================================
--- trunk/connector-api/src/main/java/org/teiid/connector/language/IInlineView.java 2010-03-04 20:22:20 UTC (rev 1912)
+++ trunk/connector-api/src/main/java/org/teiid/connector/language/IInlineView.java 2010-03-04 20:47:34 UTC (rev 1913)
@@ -1,53 +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.connector.language;
-
-/**
- * An inline view represents a subquery in the FROM clause that defines a
- * query-able context for the outer query. An inline view must be named, which allows
- * them to be treated like aliased groups.
- *
- */
-public interface IInlineView extends IGroup, ISubqueryContainer {
-
- String getName();
-
- void setName(String name);
-
- /**
- * Sets the string that represents the query used within the inline view.
- *
- * @param output
- * @since 5.0
- */
- void setOutput(String output);
-
- /**
- * Gets the output for the subquery once it has been preprocessed.
- * Returns null if the subquery has not yet been converted to output form.
- *
- * @return
- * @since 4.3
- */
- String getOutput();
-}
Deleted: trunk/connector-api/src/main/java/org/teiid/connector/language/IInsert.java
===================================================================
--- trunk/connector-api/src/main/java/org/teiid/connector/language/IInsert.java 2010-03-04 20:22:20 UTC (rev 1912)
+++ trunk/connector-api/src/main/java/org/teiid/connector/language/IInsert.java 2010-03-04 20:47:34 UTC (rev 1913)
@@ -1,62 +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.connector.language;
-
-import java.util.List;
-
-/**
- * Represents an INSERT command in the language objects.
- */
-public interface IInsert extends ICommand {
-
- /**
- * Get group that is being inserted into.
- * @return Insert group
- */
- IGroup getGroup();
-
- /**
- * Get list of elements being inserted into
- * @return List of IElement
- */
- List<IElement> getElements();
-
- /**
- * Get the IInsertValues
- * @return
- */
- IInsertValueSource getValueSource();
-
- /**
- * Set the IInsertValues
- * @param values
- */
- void setValueSource(IInsertValueSource values);
-
- /**
- * Set group that is being inserted into.
- * @param group Insert group
- */
- void setGroup(IGroup group);
-
-}
Deleted: trunk/connector-api/src/main/java/org/teiid/connector/language/IInsertExpressionValueSource.java
===================================================================
--- trunk/connector-api/src/main/java/org/teiid/connector/language/IInsertExpressionValueSource.java 2010-03-04 20:22:20 UTC (rev 1912)
+++ trunk/connector-api/src/main/java/org/teiid/connector/language/IInsertExpressionValueSource.java 2010-03-04 20:47:34 UTC (rev 1913)
@@ -1,9 +0,0 @@
-package org.teiid.connector.language;
-
-import java.util.List;
-
-public interface IInsertExpressionValueSource extends IInsertValueSource, ILanguageObject {
-
- List<IExpression> getValues();
-
-}
Deleted: trunk/connector-api/src/main/java/org/teiid/connector/language/IInsertValueSource.java
===================================================================
--- trunk/connector-api/src/main/java/org/teiid/connector/language/IInsertValueSource.java 2010-03-04 20:22:20 UTC (rev 1912)
+++ trunk/connector-api/src/main/java/org/teiid/connector/language/IInsertValueSource.java 2010-03-04 20:47:34 UTC (rev 1913)
@@ -1,5 +0,0 @@
-package org.teiid.connector.language;
-
-public interface IInsertValueSource extends ILanguageObject {
-
-}
Deleted: trunk/connector-api/src/main/java/org/teiid/connector/language/IIsNullCriteria.java
===================================================================
--- trunk/connector-api/src/main/java/org/teiid/connector/language/IIsNullCriteria.java 2010-03-04 20:22:20 UTC (rev 1912)
+++ trunk/connector-api/src/main/java/org/teiid/connector/language/IIsNullCriteria.java 2010-03-04 20:47:34 UTC (rev 1913)
@@ -1,54 +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.connector.language;
-
-/**
- * Represents an IS NULL criteria.
- */
-public interface IIsNullCriteria extends IPredicateCriteria {
-
- /**
- * Get the expression being checked for null.
- * @return Expression being checked
- */
- IExpression getExpression();
-
- /**
- * Set expression of criteria
- * @return Expression
- */
- void setExpression(IExpression expression);
-
- /**
- * Returns whether this criteria is negated.
- * @return flag indicating whether this criteria contains a NOT
- */
- boolean isNegated();
-
- /**
- * Sets whether this criteria is negated.
- * @param negated Flag indicating whether this criteria contains a NOT
- */
- void setNegated(boolean negated);
-
-}
Deleted: trunk/connector-api/src/main/java/org/teiid/connector/language/IJoin.java
===================================================================
--- trunk/connector-api/src/main/java/org/teiid/connector/language/IJoin.java 2010-03-04 20:22:20 UTC (rev 1912)
+++ trunk/connector-api/src/main/java/org/teiid/connector/language/IJoin.java 2010-03-04 20:47:34 UTC (rev 1913)
@@ -1,93 +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.connector.language;
-
-import java.util.List;
-
-/**
- * Represents a join in the FROM clause. A join combines two IFromItems together
- * in a join.
- */
-public interface IJoin extends IFromItem {
-
- public enum JoinType {
- INNER_JOIN,
- CROSS_JOIN,
- LEFT_OUTER_JOIN,
- RIGHT_OUTER_JOIN,
- FULL_OUTER_JOIN
- }
-
- /**
- * Get the left IFromItem
- * @return From item
- */
- IFromItem getLeftItem();
-
- /**
- * Get the right IFromItem
- * @return From item
- */
- IFromItem getRightItem();
-
- /**
- * Get join type
- * @return Join type
- * @see JoinType#INNER_JOIN
- * @see JoinType#CROSS_JOIN
- * @see JoinType#LEFT_OUTER_JOIN
- * @see JoinType#RIGHT_OUTER_JOIN
- * @see JoinType#FULL_OUTER_JOIN
- */
- JoinType getJoinType();
-
- /**
- * Return List of CompareCriteria specifying join criteria.
- * @return List of CompareCriteria
- */
- List<ICriteria> getCriteria();
-
- /**
- * Set the left IFromItem
- * @param item From item
- */
- void setLeftItem(IFromItem item);
-
- /**
- * Set the right IFromItem
- * @param item From item
- */
- void setRightItem(IFromItem item);
-
- /**
- * Set join type
- * @param type Join type
- * @see JoinType#INNER_JOIN
- * @see JoinType#CROSS_JOIN
- * @see JoinType#LEFT_OUTER_JOIN
- * @see JoinType#RIGHT_OUTER_JOIN
- * @see JoinType#FULL_OUTER_JOIN
- */
- void setJoinType(JoinType type);
-
-}
Deleted: trunk/connector-api/src/main/java/org/teiid/connector/language/ILanguageFactory.java
===================================================================
--- trunk/connector-api/src/main/java/org/teiid/connector/language/ILanguageFactory.java 2010-03-04 20:22:20 UTC (rev 1912)
+++ trunk/connector-api/src/main/java/org/teiid/connector/language/ILanguageFactory.java 2010-03-04 20:47:34 UTC (rev 1913)
@@ -1,337 +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.connector.language;
-
-import java.util.List;
-
-import org.teiid.connector.language.ICompoundCriteria.Operator;
-import org.teiid.connector.language.IParameter.Direction;
-import org.teiid.connector.metadata.runtime.Element;
-import org.teiid.connector.metadata.runtime.Group;
-import org.teiid.connector.metadata.runtime.Parameter;
-import org.teiid.connector.metadata.runtime.Procedure;
-
-
-/**
- * Factory for the construction of language objects that implement the language interfaces.
- * This factory is provided by the connector environment and can be used in modifying the language
- * interfaces if needed.
- */
-public interface ILanguageFactory {
-
- /**
- * Create aggregate function.
- * @param name Aggregate function name, as defined by constants in {@link IAggregate}
- * @param isDistinct True if aggregate function is DISTINCT, false otherwise
- * @param expression Inner expression of the aggregate function
- * @param type Data type
- * @return New IAggregate
- */
- IAggregate createAggregate(String name, boolean isDistinct, IExpression expression, Class type);
-
- /**
- * Create compare criteria.
- * @param operator Operator, as defined in constants in {@link ICompareCriteria}
- * @param leftExpression Left expression
- * @param rightExpression Right expression
- * @return New ICompareCriteria
- */
- ICompareCriteria createCompareCriteria(ICompareCriteria.Operator operator, IExpression leftExpression, IExpression rightExpression);
-
- /**
- * Create a new ICompoundCriteria
- * @param operator Operator, as defined by {@link Operator#AND} or
- * {@link Operator#OR}
- * @param innerCriteria List of ICriteria, typically containing two criteria
- * @return New ICompoundCriteria
- */
- ICompoundCriteria createCompoundCriteria(ICompoundCriteria.Operator operator, List<? extends ICriteria> innerCriteria);
-
- /**
- * Create a new IDelete.
- * @param group The group to delete from
- * @param criteria The criteria (can be null)
- * @return New IDelete
- */
- IDelete createDelete(IGroup group, ICriteria criteria);
-
- /**
- * Create new element.
- * @param name Name of the element
- * @param group Group this element is in
- * @param metadataReference Metadata reference describing this element
- * @param type Data type
- * @return New IElement
- */
- IElement createElement(String name, IGroup group, Element metadataReference, Class type);
-
- /**
- * Create new exists criteria.
- * @param query Inner query
- * @return New IExists
- */
- IExistsCriteria createExistsCriteria(IQuery query);
-
- /**
- * Create new from clause
- * @param items List of IFromItem
- * @return New IFrom
- */
- IFrom createFrom(List<? extends IFromItem> items);
-
- /**
- * Create new function
- * @param functionName Name of the function
- * @param args Arguments, should never be null
- * @param type Data type returned
- * @return New IFunction
- */
- IFunction createFunction(String functionName, IExpression[] args, Class<?> type);
-
- /**
- * Create new function
- * @param functionName Name of the function
- * @param args Arguments, should never be null
- * @param type Data type returned
- * @return New IFunction
- */
- IFunction createFunction(String functionName, List<? extends IExpression> args, Class<?> type);
-
- /**
- * Create new group.
- * @param context Alias if it exists, or group name if no alias exists
- * @param definition Group name
- * @param metadataReference Reference to metadata identifier
- * @return New IGroup
- */
- IGroup createGroup(String context, String definition, Group metadataReference);
-
- /**
- * Create new group by.
- * @param items List of IGroupByItem
- * @return New IGroupBy
- */
- IGroupBy createGroupBy(List<? extends IExpression> items);
-
- /**
- * Create new IN criteria
- * @param leftExpression Left expression
- * @param rightExpressions List of right expressions
- * @param isNegated True if NOT IN, false for IN
- * @return New IInCriteria
- */
- IInCriteria createInCriteria(IExpression leftExpression, List<? extends IExpression> rightExpressions, boolean isNegated);
-
- /**
- * Create new inline view
- * @param query The query defining the inline view
- * @param name The name of the inline view
- * @return New IInLineView
- */
- IInlineView createInlineView(IQueryCommand query, String name);
-
- /**
- * Create new insert command
- * @param group Insert group
- * @param columns List of IElement being inserted into
- * @param values List of IExpression (usually ILiteral)
- * @return New IInsert
- */
- IInsert createInsert(IGroup group, List<IElement> columns, IInsertValueSource valueSource);
-
- /**
- * Create a new value source for an insert command
- * @param values
- * @return
- */
- IInsertExpressionValueSource createInsertExpressionValueSource(List<IExpression> values);
-
- /**
- * Create new IS NULL criteria
- * @param expression Expression
- * @param isNegated True if IS NOT NULL, false if IS NULL
- * @return New IIsNullCriteria
- */
- IIsNullCriteria createIsNullCriteria(IExpression expression, boolean isNegated);
-
- /**
- * Create new join predicate
- * @param joinType Join type as defined by constants in {@link IJoin}
- * @param leftItem Left from clause item
- * @param rightItem Right from clause item
- * @param criteria List of ICriteria (considered to be AND'ed together)
- * @return New IJoin
- */
- IJoin createJoin(IJoin.JoinType joinType, IFromItem leftItem, IFromItem rightItem, List<? extends ICriteria> criteria);
-
- /**
- * Create new LIKE criteria
- * @param leftExpression Left expression
- * @param rightExpression Right expression
- * @param escapeCharacter Escape character or null if none
- * @param isNegated True if NOT LIKE, false if LIKE
- * @return New ILikeCriteria
- */
- ILikeCriteria createLikeCriteria(IExpression leftExpression, IExpression rightExpression, Character escapeCharacter, boolean isNegated);
-
- /**
- * Create new literal value.
- * @param value The value, may be null
- * @param type The data type
- * @return New ILiteral
- */
- ILiteral createLiteral(Object value, Class type);
-
- /**
- * Create new NOT criteria
- * @param criteria Inner criteria
- * @return New INotCriteria
- */
- INotCriteria createNotCriteria(ICriteria criteria);
-
- /**
- * Create new ORDER BY clause
- * @param items List of IOrderByItem
- * @return New IOrderBy
- */
- IOrderBy createOrderBy(List<? extends IOrderByItem> items);
-
- /**
- * Create new ORDER BY item
- * @param name Name of item
- * @param element Associated element, if applicable
- * @param direction Direction, defined by constants in {@link IOrderByItem}
- * @return New IOrderByItem
- */
- IOrderByItem createOrderByItem(String name, IElement element, boolean direction);
-
- /**
- * Create new procedure parameter
- * @param index Index in the procedure call
- * @param direction Kind of parameter - IN, OUT, .... as defined in {@link IParameter}
- * @param value Value, may be null if not applicable
- * @param type Data type
- * @param metadataReference Metadata identifier reference
- * @return New IParameter
- */
- IParameter createParameter(int index, Direction direction, Object value, Class type, Parameter metadataReference);
-
- /**
- * Create new procedure
- * @param name Name of procedure
- * @param parameters List of IParameter
- * @param metadataReference Metadata identifier reference
- * @return New IProcedure
- */
- IProcedure createProcedure(String name, List<? extends IParameter> parameters, Procedure metadataReference);
-
- /**
- * Create new query
- * @param select SELECT clause
- * @param from FROM clause
- * @param where WHERE clause
- * @param groupBy GROUP BY clause
- * @param having HAVING clause
- * @param orderBy ORDER BY clause
- * @return New IQuery
- */
- IQuery createQuery(ISelect select, IFrom from, ICriteria where, IGroupBy groupBy, ICriteria having, IOrderBy orderBy);
-
- ISetQuery createSetOp(ISetQuery.Operation operation, boolean all, IQueryCommand leftQuery, IQueryCommand rightQuery, IOrderBy orderBy, ILimit limit);
-
- /**
- * Create new scalar subquery which can be used as an expression
- * @param query Subquery
- * @return New scalar subquery
- */
- IScalarSubquery createScalarSubquery(IQuery query);
-
- /**
- * Create searched case expression.
- * @param whenExpressions List of when expressions, should match thenExpressions
- * @param thenExpressions List of then expressions, should match whenExpressions
- * @param elseExpression Else expression, may be null
- * @param type Data type
- * @return New ICaseExpression
- */
- ISearchedCaseExpression createSearchedCaseExpression(List<? extends ICriteria> whenExpressions, List<? extends IExpression> thenExpressions, IExpression elseExpression, Class type);
-
- /**
- * Create new SELECT clause
- * @param isDistinct True if DISTINCT, false for ALL
- * @param selectSymbols List of ISelectSymbol
- * @return New ISelect
- */
- ISelect createSelect(boolean isDistinct, List<? extends ISelectSymbol> selectSymbols);
-
- /**
- * Create new select symbol
- * @param name Name of the symbol (which may be an alias)
- * @param expression Expression
- * @return New ISelectSymbol
- */
- ISelectSymbol createSelectSymbol(String name, IExpression expression);
-
- /**
- * Create new subquery compare criteria
- * @param leftExpression Left expression
- * @param operator Comparison operator, as defined in {@link ISubqueryCompareCriteria}
- * @param quantifier Quantification operator, as defined in {@link ISubqueryCompareCriteria}
- * @param subquery Right subquery
- * @return New ISubqueryCompareCriteria
- */
- ISubqueryCompareCriteria createSubqueryCompareCriteria(IExpression leftExpression, ICompareCriteria.Operator operator, ISubqueryCompareCriteria.Quantifier quantifier, IQuery subquery);
-
- /**
- * Create new subquery IN criteria
- * @param expression Left expression
- * @param subquery Right subquery
- * @param isNegated True if NOT IN, false if IN
- * @return New ISubqueryInCriteria
- */
- ISubqueryInCriteria createSubqueryInCriteria(IExpression expression, IQuery subquery, boolean isNegated);
-
- /**
- * Create new UPDATE command
- * @param group Group being updated
- * @param updates
- * @param criteria Criteria to use, may be null
- * @return New IUpdate
- */
- IUpdate createUpdate(IGroup group, ISetClauseList updates, ICriteria criteria);
-
- /**
- * Creates a new SetClauseList
- * @param clauses
- * @return
- */
- ISetClauseList createSetClauseList(List<ISetClause> clauses);
-
- /**
- * Creates a new SetClause
- * @param symbol
- * @param value
- * @return
- */
- ISetClause createSetClause(IElement symbol, IExpression value);
-}
Deleted: trunk/connector-api/src/main/java/org/teiid/connector/language/ILanguageObject.java
===================================================================
--- trunk/connector-api/src/main/java/org/teiid/connector/language/ILanguageObject.java 2010-03-04 20:22:20 UTC (rev 1912)
+++ trunk/connector-api/src/main/java/org/teiid/connector/language/ILanguageObject.java 2010-03-04 20:47:34 UTC (rev 1913)
@@ -1,34 +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.connector.language;
-
-import org.teiid.connector.visitor.framework.LanguageObjectVisitor;
-
-/**
- * Root interface for all language object interfaces.
- */
-public interface ILanguageObject {
-
- void acceptVisitor(LanguageObjectVisitor visitor);
-
-}
Deleted: trunk/connector-api/src/main/java/org/teiid/connector/language/ILikeCriteria.java
===================================================================
--- trunk/connector-api/src/main/java/org/teiid/connector/language/ILikeCriteria.java 2010-03-04 20:22:20 UTC (rev 1912)
+++ trunk/connector-api/src/main/java/org/teiid/connector/language/ILikeCriteria.java 2010-03-04 20:47:34 UTC (rev 1913)
@@ -1,78 +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.connector.language;
-
-/**
- * Represents a LIKE criteria in the language.
- */
-public interface ILikeCriteria extends IPredicateCriteria {
-
- /**
- * Get left expression.
- * @return Left expression
- */
- IExpression getLeftExpression();
-
- /**
- * Set left expression of criteria
- * @return Left expression
- */
- void setLeftExpression(IExpression expression);
-
- /**
- * Get right expression.
- * @return Right expression
- */
- IExpression getRightExpression();
-
- /**
- * Set left expression of criteria
- * @return Right expression
- */
- void setRightExpression(IExpression expression);
-
- /**
- * Get escape character, if one is defined.
- * @return Escape character or null if none is defined.
- */
- Character getEscapeCharacter();
-
- /**
- * Set escape character, if one is defined.
- * @param character Escape character or null if none is defined.
- */
- void setEscapeCharacter(Character character);
-
- /**
- * Returns whether this criteria is negated.
- * @return flag indicating whether this criteria contains a NOT
- */
- boolean isNegated();
-
- /**
- * Sets whether this criteria is negated.
- * @param negated Flag indicating whether this criteria contains a NOT
- */
- void setNegated(boolean negated);
-
-}
Deleted: trunk/connector-api/src/main/java/org/teiid/connector/language/ILimit.java
===================================================================
--- trunk/connector-api/src/main/java/org/teiid/connector/language/ILimit.java 2010-03-04 20:22:20 UTC (rev 1912)
+++ trunk/connector-api/src/main/java/org/teiid/connector/language/ILimit.java 2010-03-04 20:47:34 UTC (rev 1913)
@@ -1,46 +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.connector.language;
-
-
-/**
- * Represents a LIMIT clause with row offset and row limit values to bound the resulting rows
- * @since 4.3
- */
-public interface ILimit extends ILanguageObject {
-
- /**
- * Get the max number of rows returned by the connector for this query .
- * @return the max number of rows returned by the connector for this query.
- * @since 5.0 SP1
- */
- int getRowLimit();
-
- /**
- * Gets the offset (relative to the starting row of the produced resultset) of the
- * first row returned by the connector. 0 or less indicates no offset.
- * @return
- * @since 5.0 SP1
- */
- int getRowOffset();
-}
Deleted: trunk/connector-api/src/main/java/org/teiid/connector/language/ILiteral.java
===================================================================
--- trunk/connector-api/src/main/java/org/teiid/connector/language/ILiteral.java 2010-03-04 20:22:20 UTC (rev 1912)
+++ trunk/connector-api/src/main/java/org/teiid/connector/language/ILiteral.java 2010-03-04 20:47:34 UTC (rev 1913)
@@ -1,78 +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.connector.language;
-
-/**
- * Represents a literal value that is used in
- * an expression. The value can be obtained and should match
- * the type specified by {@link ILiteral#getType}.
- */
-public interface ILiteral extends IExpression {
- /**
- * Get the value of the literal
- * @return Object of value
- */
- Object getValue();
-
- /**
- * Get the Java type of the literal
- * @return Java class name of type
- */
- Class<?> getType();
-
- /**
- * Set the value of the literal
- * @param value Object of value
- */
- void setValue(Object value);
-
- /**
- * Set the Java type of the literal
- * @param type Java class name of type
- */
- void setType(Class<?> type);
-
- /**
- * Returns true if this literal should be treated as a bind value
- */
- boolean isBindValue();
-
- /**
- * Set whether this literal should be treated as a bind value
- * @param bindValue
- */
- void setBindValue(boolean bindValue);
-
- /**
- * Returns true if the value for this literal is a list of values.
- * @return
- */
- boolean isMultiValued();
-
- /**
- * Set whether the value for this literal is a list of values.
- * @param multiValued
- */
- void setMultiValued(boolean multiValued);
-
-}
Deleted: trunk/connector-api/src/main/java/org/teiid/connector/language/ILogicalCriteria.java
===================================================================
--- trunk/connector-api/src/main/java/org/teiid/connector/language/ILogicalCriteria.java 2010-03-04 20:22:20 UTC (rev 1912)
+++ trunk/connector-api/src/main/java/org/teiid/connector/language/ILogicalCriteria.java 2010-03-04 20:47:34 UTC (rev 1913)
@@ -1,32 +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.connector.language;
-
-/**
- * Represents a logical criteria, which typically is used to bind
- * together {@link IPredicateCriteria}.
- */
-public interface ILogicalCriteria extends ICriteria {
-
-
-}
Deleted: trunk/connector-api/src/main/java/org/teiid/connector/language/IMetadataReference.java
===================================================================
--- trunk/connector-api/src/main/java/org/teiid/connector/language/IMetadataReference.java 2010-03-04 20:22:20 UTC (rev 1912)
+++ trunk/connector-api/src/main/java/org/teiid/connector/language/IMetadataReference.java 2010-03-04 20:47:34 UTC (rev 1913)
@@ -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.connector.language;
-
-import org.teiid.connector.metadata.runtime.MetadataObject;
-
-/**
- * This interface is used to mark language objects as having a
- * reference to a MetadataID.
- */
-public interface IMetadataReference<T extends MetadataObject> {
-
- T getMetadataObject();
-
-}
Deleted: trunk/connector-api/src/main/java/org/teiid/connector/language/INotCriteria.java
===================================================================
--- trunk/connector-api/src/main/java/org/teiid/connector/language/INotCriteria.java 2010-03-04 20:22:20 UTC (rev 1912)
+++ trunk/connector-api/src/main/java/org/teiid/connector/language/INotCriteria.java 2010-03-04 20:47:34 UTC (rev 1913)
@@ -1,42 +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.connector.language;
-
-/**
- * Represents a NOT criteria, which is wrapped around another criteria.
- */
-public interface INotCriteria extends ILogicalCriteria {
-
- /**
- * The criteria wrapped by the NOT.
- * @return Criteria
- */
- ICriteria getCriteria();
-
- /**
- * The criteria wrapped by the NOT.
- * @param criteria Criteria
- */
- void setCriteria(ICriteria criteria);
-
-}
Deleted: trunk/connector-api/src/main/java/org/teiid/connector/language/IOrderBy.java
===================================================================
--- trunk/connector-api/src/main/java/org/teiid/connector/language/IOrderBy.java 2010-03-04 20:22:20 UTC (rev 1912)
+++ trunk/connector-api/src/main/java/org/teiid/connector/language/IOrderBy.java 2010-03-04 20:47:34 UTC (rev 1913)
@@ -1,43 +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.connector.language;
-
-import java.util.List;
-
-/**
- * Represents an ORDER BY clause in a command. The ORDER BY is
- * conceptually executed on the results of the SELECT clause and thus
- * specifies the columns to order by based on the names of the
- * SELECT symbols. So, the IOrderBy does not work on IExpression, rather
- * it is a list of Strings matching to the values returned from
- * {@link ISelectSymbol#getOutputName()}.
- */
-public interface IOrderBy extends ILanguageObject {
-
- /**
- * Get list of {@link IOrderByItem}s specifying the ordering of the results.
- * @return List of IOrderByItem
- */
- List<IOrderByItem> getItems();
-
-}
Deleted: trunk/connector-api/src/main/java/org/teiid/connector/language/IOrderByItem.java
===================================================================
--- trunk/connector-api/src/main/java/org/teiid/connector/language/IOrderByItem.java 2010-03-04 20:22:20 UTC (rev 1912)
+++ trunk/connector-api/src/main/java/org/teiid/connector/language/IOrderByItem.java 2010-03-04 20:47:34 UTC (rev 1913)
@@ -1,69 +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.connector.language;
-
-/**
- * Represents a single item in the ORDER BY clause.
- */
-public interface IOrderByItem extends ILanguageObject {
-
- public static final boolean ASC = true;
- public static final boolean DESC = false;
-
- /**
- * Get name of the output column to order by
- * @return Name of output column, as specified in {@link ISelectSymbol#getOutputName()}.
- */
- String getName();
-
- /**
- * Get direction of whether to sort ascending or descending.
- * @return {@link #ASC} for ascending or {@link #DESC} for descending
- */
- boolean getDirection();
-
- /**
- * Set name of the output column to order by
- * @param name Name of output column, as specified in {@link ISelectSymbol#getOutputName()}.
- */
- void setName(String name);
-
- /**
- * Set direction of whether to sort ascending or descending.
- * @param direction {@link #ASC} for ascending or {@link #DESC} for descending
- */
- void setDirection(boolean direction);
-
- /**
- * Get the element referred to by this item
- * @return The element, may be null
- */
- IElement getElement();
-
- /**
- * Set the new element for this order by
- * @param element New element
- */
- void setElement(IElement element);
-
-}
Deleted: trunk/connector-api/src/main/java/org/teiid/connector/language/IParameter.java
===================================================================
--- trunk/connector-api/src/main/java/org/teiid/connector/language/IParameter.java 2010-03-04 20:22:20 UTC (rev 1912)
+++ trunk/connector-api/src/main/java/org/teiid/connector/language/IParameter.java 2010-03-04 20:47:34 UTC (rev 1913)
@@ -1,124 +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.connector.language;
-
-import org.teiid.connector.metadata.runtime.Parameter;
-
-/**
- * Represents an execution parameter.
- */
-public interface IParameter extends ILanguageObject, IMetadataReference<Parameter> {
-
- public enum Direction {
- IN,
- OUT,
- INOUT,
- RETURN,
- RESULT_SET
- }
-
- /**
- * Get index of this parameter in the IExecution.
- * @return Index of the parameter
- */
- int getIndex();
-
- /**
- * Get direction of parameter
- * @return Direction
- * @see Direction#IN
- * @see Direction#OUT
- * @see Direction#INOUT
- * @see Direction#RETURN
- */
- Direction getDirection();
-
- /**
- * Get type of parameter, defined as a Java class. Output result sets will
- * return "java.sql.ResultSet".
- * @return Type of parameter
- */
- Class getType();
-
- /**
- * Get value of object if this is an IN parameter.
- * @return Value of IN parameter or null otherwise
- */
- Object getValue();
-
- /**
- * Determine whether a value was set for this parameter. This will only
- * return true if this parameter is an IN or INOUT parameter and a value was
- * set by the caller. If no value was set, then this parameter was determined
- * to be optional and has no default value. Connectors may deal with this
- * optional parameter as necessary, perhaps by using named parameters when
- * executing the procedure to avoid unspecified inputs.
- *
- * @return True if IN or INOUT and no value was set
- * @since 4.3.2
- */
- boolean getValueSpecified();
-
- /**
- * Set index of this parameter in the IExecution.
- * @param index Index of the parameter
- */
- void setIndex(int index);
-
- /**
- * Set direction of parameter
- * @param direction Direction
- * @see Direction#IN
- * @see Direction#OUT
- * @see Direction#INOUT
- * @see Direction#RETURN
- */
- void setDirection(Direction direction);
-
- /**
- * Set type of parameter, defined as a Java class. Output result sets will
- * return "java.sql.ResultSet".
- * @param type Type of parameter
- */
- void setType(Class type);
-
- /**
- * Set value of object if this is an IN parameter. If
- * value is non-null, the valueSpecified attribute will be
- * automatically set. If null, callers must also call {@link #setValueSpecified(boolean)}
- * to indicate whether the null was a missing or actual value.
- *
- * @param value Value of IN parameter or null otherwise
- */
- void setValue(Object value);
-
- /**
- * Indicate that a value was specified for this parameter. If no
- * value was specified, the connector must deal with the optional parameter
- * as necessary.
- *
- * @param specified True if value was specified
- * @since 4.3.2
- */
- void setValueSpecified(boolean specified);
-}
Deleted: trunk/connector-api/src/main/java/org/teiid/connector/language/IPredicateCriteria.java
===================================================================
--- trunk/connector-api/src/main/java/org/teiid/connector/language/IPredicateCriteria.java 2010-03-04 20:22:20 UTC (rev 1912)
+++ trunk/connector-api/src/main/java/org/teiid/connector/language/IPredicateCriteria.java 2010-03-04 20:47:34 UTC (rev 1913)
@@ -1,31 +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.connector.language;
-
-/**
- * Represents a criteria that can occur at the leaf of a tree of
- * criteria.
- */
-public interface IPredicateCriteria extends ICriteria {
-
-}
Deleted: trunk/connector-api/src/main/java/org/teiid/connector/language/IProcedure.java
===================================================================
--- trunk/connector-api/src/main/java/org/teiid/connector/language/IProcedure.java 2010-03-04 20:22:20 UTC (rev 1912)
+++ trunk/connector-api/src/main/java/org/teiid/connector/language/IProcedure.java 2010-03-04 20:47:34 UTC (rev 1913)
@@ -1,63 +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.connector.language;
-
-import java.util.List;
-
-import org.teiid.connector.api.ConnectorException;
-import org.teiid.connector.metadata.runtime.Procedure;
-
-
-/**
- * Represents a procedural execution (such as a stored procedure).
- */
-public interface IProcedure extends ICommand, IMetadataReference<Procedure> {
-
- /**
- * Gets the name of the procedure.
- * @return the name of the procedure
- */
- String getProcedureName();
-
- /**
- * Returns list of the IParameter objects associated with this execution.
- * The parameters describe inputs and outputs.
- * @return List of IParameter
- */
- List<IParameter> getParameters();
-
- /**
- * Sets the name of the procedure.
- * @param name The name of the procedure
- */
- void setProcedureName(String name);
-
- /**
- * Get the procedure result set column types
- * @return an array containing the types or an empty array if there is no
- * result set parameter
- * @throws ConnectorException
- */
- Class<?>[] getResultSetColumnTypes() throws ConnectorException;
-
-}
Deleted: trunk/connector-api/src/main/java/org/teiid/connector/language/IQuery.java
===================================================================
--- trunk/connector-api/src/main/java/org/teiid/connector/language/IQuery.java 2010-03-04 20:22:20 UTC (rev 1912)
+++ trunk/connector-api/src/main/java/org/teiid/connector/language/IQuery.java 2010-03-04 20:47:34 UTC (rev 1913)
@@ -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.connector.language;
-
-/**
- * Represents a SELECT query in the language objects.
- */
-public interface IQuery extends IQueryCommand {
-
- /**
- * Get SELECT clause, should never be null.
- * @return Select clause object
- */
- ISelect getSelect();
-
- /**
- * Get FROM clause, should never be null.
- * @return From clause object
- */
- IFrom getFrom();
-
- /**
- * Get WHERE clause, may be null.
- * @return A criteria object
- */
- ICriteria getWhere();
-
- /**
- * Get GROUP BY clause, may be null.
- * @return A group by object
- */
- IGroupBy getGroupBy();
-
- /**
- * Get HAVING clause, may be null.
- * @return A criteria object
- */
- ICriteria getHaving();
-
- /**
- * Set SELECT clause, should never be null.
- * @param select Select clause object
- */
- void setSelect(ISelect select);
-
- /**
- * Set FROM clause, should never be null.
- * @param from From clause object
- */
- void setFrom(IFrom from);
-
- /**
- * Set WHERE clause, may be null.
- * @param criteria A criteria object
- */
- void setWhere(ICriteria criteria);
-
- /**
- * Set GROUP BY clause, may be null.
- * @param groupBy A group by object
- */
- void setGroupBy(IGroupBy groupBy);
-
- /**
- * Set HAVING clause, may be null.
- * @param criteria A criteria object
- */
- void setHaving(ICriteria criteria);
-
-}
Deleted: trunk/connector-api/src/main/java/org/teiid/connector/language/IQueryCommand.java
===================================================================
--- trunk/connector-api/src/main/java/org/teiid/connector/language/IQueryCommand.java 2010-03-04 20:22:20 UTC (rev 1912)
+++ trunk/connector-api/src/main/java/org/teiid/connector/language/IQueryCommand.java 2010-03-04 20:47:34 UTC (rev 1913)
@@ -1,66 +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.connector.language;
-
-public interface IQueryCommand extends ICommand, IInsertValueSource {
-
- /**
- * Set ORDER BY clause, may be null.
- * @param orderBy An ORDER BY object
- */
- void setOrderBy(IOrderBy orderBy);
- /**
- * Set LIMIT clause, may be null.
- * @param limit A LIMIT object
- */
- void setLimit(ILimit limit);
-
- IQuery getProjectedQuery();
-
- /**
- * Get ORDER BY clause, may be null.
- * @return An ORDER BY object
- */
- IOrderBy getOrderBy();
-
- /**
- * Get LIMIT clause, may be null.
- * @return A LIMIT object
- */
- ILimit getLimit();
-
- /**
- * Get the column names of the output columns for this query
- * @return a String[] containing the column names
- * @since 4.3
- */
- String[] getColumnNames();
-
- /**
- * Get the column types of the output columns for this query
- * @return a Class[] containing the column names
- * @since 4.3
- */
- Class[] getColumnTypes();
-
-}
Deleted: trunk/connector-api/src/main/java/org/teiid/connector/language/IScalarSubquery.java
===================================================================
--- trunk/connector-api/src/main/java/org/teiid/connector/language/IScalarSubquery.java 2010-03-04 20:22:20 UTC (rev 1912)
+++ trunk/connector-api/src/main/java/org/teiid/connector/language/IScalarSubquery.java 2010-03-04 20:47:34 UTC (rev 1913)
@@ -1,32 +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.connector.language;
-
-/**
- * Represents a scalar subquery. That is, a query that is evaluated as a scalar
- * expression and returns a single value. The inner subquery must return exactly
- * 1 column as well.
- */
-public interface IScalarSubquery extends IExpression, ISubqueryContainer {
-
-}
Deleted: trunk/connector-api/src/main/java/org/teiid/connector/language/ISearchedCaseExpression.java
===================================================================
--- trunk/connector-api/src/main/java/org/teiid/connector/language/ISearchedCaseExpression.java 2010-03-04 20:22:20 UTC (rev 1912)
+++ trunk/connector-api/src/main/java/org/teiid/connector/language/ISearchedCaseExpression.java 2010-03-04 20:47:34 UTC (rev 1913)
@@ -1,77 +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.connector.language;
-
-/**
- * Represents a non-searched CASE expression:
- * <br/> CASE WHEN criteria THEN expression ... END
- */
-public interface ISearchedCaseExpression extends IExpression {
-
- /**
- * Gets the number of WHEN and THEN clauses in the CASE expression
- * @return the number of WHEN ... THEN ... parts
- */
- int getWhenCount();
-
- /**
- * Gets the WHEN criteria at the specified index
- * @param index the 0-based index
- * @return the WHEN criteria at the index
- */
- ICriteria getWhenCriteria(int index);
-
- /**
- * Sets the WHEN criteria at the specified index
- * @param index the 0-based index
- * @param criteria The new WHEN criteria at the index
- */
- void setWhenCriteria(int index, ICriteria criteria);
-
- /**
- * Gets the THEN expression at the specified index
- * @param index the 0-based index
- * @return the THEN expression at the index
- */
- IExpression getThenExpression(int index);
-
- /**
- * Sets the THEN expression at the specified index
- * @param index the 0-based index
- * @param expression The new THEN expression at the index
- */
- void setThenExpression(int index, IExpression expression);
-
- /**
- * Gets the ELSE expression, if defined. Can be null.
- * @return the ELSE expression.
- */
- IExpression getElseExpression();
-
- /**
- * Sets the ELSE expression
- * @param expression The new ELSE expression
- */
- void setElseExpression(IExpression expression);
-
-}
Deleted: trunk/connector-api/src/main/java/org/teiid/connector/language/ISelect.java
===================================================================
--- trunk/connector-api/src/main/java/org/teiid/connector/language/ISelect.java 2010-03-04 20:22:20 UTC (rev 1912)
+++ trunk/connector-api/src/main/java/org/teiid/connector/language/ISelect.java 2010-03-04 20:47:34 UTC (rev 1913)
@@ -1,50 +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.connector.language;
-
-import java.util.List;
-
-/**
- * Represents a SELECT clause in the language objects.
- */
-public interface ISelect extends ILanguageObject {
-
- /**
- * Get List of ISelectSymbol.
- * @return List of ISelectSymbol
- */
- List<ISelectSymbol> getSelectSymbols();
-
- /**
- * Determine whether the DISTINCT flag is used in this SELECT.
- * @return True if SELECT DISTINCT, false if SELECT ALL
- */
- boolean isDistinct();
-
- /**
- * Set whether the DISTINCT flag is used in this SELECT.
- * @param distinct True if SELECT DISTINCT, false if SELECT ALL
- */
- void setDistinct(boolean distinct);
-
-}
Deleted: trunk/connector-api/src/main/java/org/teiid/connector/language/ISelectSymbol.java
===================================================================
--- trunk/connector-api/src/main/java/org/teiid/connector/language/ISelectSymbol.java 2010-03-04 20:22:20 UTC (rev 1912)
+++ trunk/connector-api/src/main/java/org/teiid/connector/language/ISelectSymbol.java 2010-03-04 20:47:34 UTC (rev 1913)
@@ -1,71 +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.connector.language;
-
-/**
- * Represents an item in the SELECT clause. Typically the SELECT clause
- * contains expressions which are optionally given an output name.
- */
-public interface ISelectSymbol extends ILanguageObject {
-
- /**
- * Determine whether this symbol is named with an alias.
- * @return True if an alias exists
- */
- boolean hasAlias();
-
- /**
- * Return output column name. This may be the alias name, a name
- * derived from the expression, or a default name assigned to an
- * expression.
- * @return Name of the output column
- */
- String getOutputName();
-
- /**
- * Get the expression referenced by this symbol.
- * @return The expression
- */
- IExpression getExpression();
-
- /**
- * Set whether this symbol is named with an alias.
- * @param alias True if an alias exists
- */
- void setAlias(boolean alias);
-
- /**
- * Set output column name. This may be the alias name, a name
- * derived from the expression, or a default name assigned to an
- * expression.
- * @param name Name of the output column
- */
- void setOutputName(String name);
-
- /**
- * Set the expression referenced by this symbol.
- * @param expression The expression
- */
- void setExpression(IExpression expression);
-
-}
Deleted: trunk/connector-api/src/main/java/org/teiid/connector/language/ISetClause.java
===================================================================
--- trunk/connector-api/src/main/java/org/teiid/connector/language/ISetClause.java 2010-03-04 20:22:20 UTC (rev 1912)
+++ trunk/connector-api/src/main/java/org/teiid/connector/language/ISetClause.java 2010-03-04 20:47:34 UTC (rev 1913)
@@ -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.connector.language;
-
-public interface ISetClause extends ILanguageObject {
-
- IElement getSymbol();
-
- void setSymbol(IElement symbol);
-
- IExpression getValue();
-
- void setValue(IExpression value);
-
-}
Deleted: trunk/connector-api/src/main/java/org/teiid/connector/language/ISetClauseList.java
===================================================================
--- trunk/connector-api/src/main/java/org/teiid/connector/language/ISetClauseList.java 2010-03-04 20:22:20 UTC (rev 1912)
+++ trunk/connector-api/src/main/java/org/teiid/connector/language/ISetClauseList.java 2010-03-04 20:47:34 UTC (rev 1913)
@@ -1,31 +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.connector.language;
-
-import java.util.List;
-
-public interface ISetClauseList extends ILanguageObject {
-
- List<ISetClause> getClauses();
-
-}
Deleted: trunk/connector-api/src/main/java/org/teiid/connector/language/ISetQuery.java
===================================================================
--- trunk/connector-api/src/main/java/org/teiid/connector/language/ISetQuery.java 2010-03-04 20:22:20 UTC (rev 1912)
+++ trunk/connector-api/src/main/java/org/teiid/connector/language/ISetQuery.java 2010-03-04 20:47:34 UTC (rev 1913)
@@ -1,53 +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.connector.language;
-
-public interface ISetQuery extends
- IQueryCommand {
-
- public enum Operation {
- /** Represents UNION of two queries */
- UNION,
- /** Represents intersection of two queries */
- INTERSECT,
- /** Represents set difference of two queries */
- EXCEPT
- }
-
- boolean isAll();
-
- void setAll(boolean all);
-
- Operation getOperation();
-
- void setOperation(Operation operation);
-
- IQueryCommand getLeftQuery();
-
- void setLeftQuery(IQueryCommand leftQuery);
-
- IQueryCommand getRightQuery();
-
- void setRightQuery(IQueryCommand rightQuery);
-
-}
Deleted: trunk/connector-api/src/main/java/org/teiid/connector/language/ISubqueryCompareCriteria.java
===================================================================
--- trunk/connector-api/src/main/java/org/teiid/connector/language/ISubqueryCompareCriteria.java 2010-03-04 20:22:20 UTC (rev 1912)
+++ trunk/connector-api/src/main/java/org/teiid/connector/language/ISubqueryCompareCriteria.java 2010-03-04 20:47:34 UTC (rev 1913)
@@ -1,89 +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.connector.language;
-
-/**
- * Represents a quantified comparison criteria. This criteria has an expression on the left,
- * a comparison operator (such as =, <, etc), a quantification operator (ALL, ANY),
- * and a subquery.
- */
-public interface ISubqueryCompareCriteria extends IPredicateCriteria, ISubqueryContainer {
-
- public enum Quantifier {
- SOME,
- ALL
- }
- /**
- * Get left expression.
- * @return Left expression
- */
- IExpression getLeftExpression();
-
- /**
- * Get operator from set defined in this interface.
- * @return Operator constant
- * @see #EQ
- * @see #NE
- * @see #LT
- * @see #LE
- * @see #GT
- * @see #GE
- */
- ICompareCriteria.Operator getOperator();
-
- /**
- * Get quantifier.
- * @return Quantifier constant
- * @see Quantifier#SOME
- * @see Quantifier#ALL
- */
- Quantifier getQuantifier();
-
- /**
- * Set left expression.
- * @param expression Left expression
- */
- void setLeftExpression(IExpression expression);
-
- /**
- * Set operator from set defined in this interface.
- * @param quantifier Operator constant
- * @see #EQ
- * @see #NE
- * @see #LT
- * @see #LE
- * @see #GT
- * @see #GE
- */
- void setOperator(ICompareCriteria.Operator operator);
-
- /**
- * Set quantifier.
- * @param quantifier Quantifier constant
- * @see Quantifier#SOME
- * @see Quantifier#ALL
- */
- void setQuantifier(Quantifier quantifier);
-
-
-}
Deleted: trunk/connector-api/src/main/java/org/teiid/connector/language/ISubqueryContainer.java
===================================================================
--- trunk/connector-api/src/main/java/org/teiid/connector/language/ISubqueryContainer.java 2010-03-04 20:22:20 UTC (rev 1912)
+++ trunk/connector-api/src/main/java/org/teiid/connector/language/ISubqueryContainer.java 2010-03-04 20:47:34 UTC (rev 1913)
@@ -1,42 +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.connector.language;
-
-/**
- * This is a marker interface for language interfaces that contain a subquery.
- */
-public interface ISubqueryContainer {
-
- /**
- * Get the inner subquery
- * @return Subquery
- */
- IQueryCommand getQuery();
-
- /**
- * Set the inner subquery
- * @param query Subquery
- */
- void setQuery(IQueryCommand query);
-
-}
Deleted: trunk/connector-api/src/main/java/org/teiid/connector/language/ISubqueryInCriteria.java
===================================================================
--- trunk/connector-api/src/main/java/org/teiid/connector/language/ISubqueryInCriteria.java 2010-03-04 20:22:20 UTC (rev 1912)
+++ trunk/connector-api/src/main/java/org/teiid/connector/language/ISubqueryInCriteria.java 2010-03-04 20:47:34 UTC (rev 1913)
@@ -1,31 +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.connector.language;
-
-/**
- * Represents an IN criteria that uses a subquery on the right side rather than a
- * list of values.
- */
-public interface ISubqueryInCriteria extends IBaseInCriteria, ISubqueryContainer {
-
-}
Deleted: trunk/connector-api/src/main/java/org/teiid/connector/language/IUpdate.java
===================================================================
--- trunk/connector-api/src/main/java/org/teiid/connector/language/IUpdate.java 2010-03-04 20:22:20 UTC (rev 1912)
+++ trunk/connector-api/src/main/java/org/teiid/connector/language/IUpdate.java 2010-03-04 20:47:34 UTC (rev 1913)
@@ -1,69 +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.connector.language;
-
-
-/**
- * Represents an UPDATE command in the language objects.
- */
-public interface IUpdate extends ICommand {
-
- /**
- * Get group that is being inserted into.
- * @return Insert group
- */
- IGroup getGroup();
-
- /**
- * Get list of changes that should occur in the UPDATE - every
- * change is of the form "element = expression".
- * @return ISetClauseList
- */
- ISetClauseList getChanges();
-
- /**
- * Get criteria that is being used with the delete - may be null
- * @return Criteria, may be null
- */
- ICriteria getCriteria();
-
- /**
- * Set group that is being inserted into.
- * @param group Insert group
- */
- void setGroup(IGroup group);
-
- /**
- * Set list of changes that should occur in the UPDATE - every
- * change is of the form "element = expression".
- * @param changes
- */
- void setChanges(ISetClauseList changes);
-
- /**
- * Set criteria that is being used with the delete - may be null
- * @param criteria Criteria, may be null
- */
- void setCriteria(ICriteria criteria);
-
-}
Copied: trunk/connector-api/src/main/java/org/teiid/connector/language/In.java (from rev 1899, branches/JCA/connector-api/src/main/java/org/teiid/connector/language/In.java)
===================================================================
--- trunk/connector-api/src/main/java/org/teiid/connector/language/In.java (rev 0)
+++ trunk/connector-api/src/main/java/org/teiid/connector/language/In.java 2010-03-04 20:47:34 UTC (rev 1913)
@@ -0,0 +1,54 @@
+/*
+ * 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.connector.language;
+
+import java.util.List;
+
+import org.teiid.connector.visitor.framework.LanguageObjectVisitor;
+
+public class In extends BaseInCondition {
+
+ private List<Expression> rightExpressions;
+
+ public In(Expression left, List<Expression> right, boolean negated) {
+ super(left, negated);
+ rightExpressions = right;
+ }
+
+ /**
+ * Get List of IExpression in the set on the right side of the criteria.
+ * @return List of IExpression
+ */
+ public List<Expression> getRightExpressions() {
+ return rightExpressions;
+ }
+
+ public void acceptVisitor(LanguageObjectVisitor visitor) {
+ visitor.visit(this);
+ }
+
+ public void setRightExpressions(List<Expression> expressions) {
+ this.rightExpressions = expressions;
+ }
+
+}
Copied: trunk/connector-api/src/main/java/org/teiid/connector/language/Insert.java (from rev 1899, branches/JCA/connector-api/src/main/java/org/teiid/connector/language/Insert.java)
===================================================================
--- trunk/connector-api/src/main/java/org/teiid/connector/language/Insert.java (rev 0)
+++ trunk/connector-api/src/main/java/org/teiid/connector/language/Insert.java 2010-03-04 20:47:34 UTC (rev 1913)
@@ -0,0 +1,70 @@
+/*
+ * 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.connector.language;
+
+import java.util.List;
+
+import org.teiid.connector.visitor.framework.LanguageObjectVisitor;
+
+
+public class Insert extends BaseLanguageObject implements Command {
+
+ private NamedTable table;
+ private List<ColumnReference> columns;
+ private InsertValueSource valueSource;
+
+ public Insert(NamedTable group, List<ColumnReference> elements, InsertValueSource valueSource) {
+ this.table = group;
+ this.columns = elements;
+ this.valueSource = valueSource;
+ }
+
+ public NamedTable getTable() {
+ return table;
+ }
+
+ public List<ColumnReference> getColumns() {
+ return columns;
+ }
+
+ public InsertValueSource getValueSource() {
+ return valueSource;
+ }
+
+ public void acceptVisitor(LanguageObjectVisitor visitor) {
+ visitor.visit(this);
+ }
+
+ public void setTable(NamedTable group) {
+ this.table = group;
+ }
+
+ public void setColumns(List<ColumnReference> elements) {
+ this.columns = elements;
+ }
+
+ public void setValueSource(InsertValueSource values) {
+ this.valueSource = values;
+ }
+
+}
Copied: trunk/connector-api/src/main/java/org/teiid/connector/language/InsertValueSource.java (from rev 1899, branches/JCA/connector-api/src/main/java/org/teiid/connector/language/InsertValueSource.java)
===================================================================
--- trunk/connector-api/src/main/java/org/teiid/connector/language/InsertValueSource.java (rev 0)
+++ trunk/connector-api/src/main/java/org/teiid/connector/language/InsertValueSource.java 2010-03-04 20:47:34 UTC (rev 1913)
@@ -0,0 +1,27 @@
+/*
+ * 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.connector.language;
+
+public interface InsertValueSource extends LanguageObject {
+
+}
Copied: trunk/connector-api/src/main/java/org/teiid/connector/language/IsNull.java (from rev 1899, branches/JCA/connector-api/src/main/java/org/teiid/connector/language/IsNull.java)
===================================================================
--- trunk/connector-api/src/main/java/org/teiid/connector/language/IsNull.java (rev 0)
+++ trunk/connector-api/src/main/java/org/teiid/connector/language/IsNull.java 2010-03-04 20:47:34 UTC (rev 1913)
@@ -0,0 +1,60 @@
+/*
+ * 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.connector.language;
+
+import org.teiid.connector.visitor.framework.LanguageObjectVisitor;
+
+/**
+ * Represents an IS NULL predicate.
+ */
+public class IsNull extends Condition implements Predicate {
+
+ private Expression expression;
+ private boolean negated;
+
+ public IsNull(Expression expr, boolean isNegated) {
+ expression = expr;
+ this.negated = isNegated;
+ }
+
+ public Expression getExpression() {
+ return expression;
+ }
+
+ public boolean isNegated() {
+ return this.negated;
+ }
+
+ public void acceptVisitor(LanguageObjectVisitor visitor) {
+ visitor.visit(this);
+ }
+
+ public void setExpression(Expression expression) {
+ this.expression = expression;
+ }
+
+ public void setNegated(boolean negated) {
+ this.negated = negated;
+ }
+
+}
Copied: trunk/connector-api/src/main/java/org/teiid/connector/language/Join.java (from rev 1899, branches/JCA/connector-api/src/main/java/org/teiid/connector/language/Join.java)
===================================================================
--- trunk/connector-api/src/main/java/org/teiid/connector/language/Join.java (rev 0)
+++ trunk/connector-api/src/main/java/org/teiid/connector/language/Join.java 2010-03-04 20:47:34 UTC (rev 1913)
@@ -0,0 +1,85 @@
+/*
+ * 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.connector.language;
+
+import org.teiid.connector.visitor.framework.LanguageObjectVisitor;
+
+public class Join extends BaseLanguageObject implements TableReference {
+
+ public enum JoinType {
+ INNER_JOIN,
+ CROSS_JOIN,
+ LEFT_OUTER_JOIN,
+ RIGHT_OUTER_JOIN,
+ FULL_OUTER_JOIN
+ }
+
+ private TableReference leftItem;
+ private TableReference rightItem;
+ private JoinType joinType;
+ private Condition condition;
+
+ public Join(TableReference left, TableReference right, JoinType joinType, Condition criteria) {
+ this.leftItem = left;
+ this.rightItem = right;
+ this.joinType = joinType;
+ this.condition = criteria;
+ }
+
+ public TableReference getLeftItem() {
+ return leftItem;
+ }
+
+ public TableReference getRightItem() {
+ return rightItem;
+ }
+
+ public JoinType getJoinType() {
+ return this.joinType;
+ }
+
+ public Condition getCondition() {
+ return condition;
+ }
+
+ public void acceptVisitor(LanguageObjectVisitor visitor) {
+ visitor.visit(this);
+ }
+
+ public void setLeftItem(TableReference item) {
+ this.leftItem = item;
+ }
+
+ public void setRightItem(TableReference item) {
+ this.rightItem = item;
+ }
+
+ public void setJoinType(JoinType type) {
+ this.joinType = type;
+ }
+
+ public void setCondition(Condition criteria) {
+ this.condition = criteria;
+ }
+
+}
Copied: trunk/connector-api/src/main/java/org/teiid/connector/language/LanguageFactory.java (from rev 1899, branches/JCA/connector-api/src/main/java/org/teiid/connector/language/LanguageFactory.java)
===================================================================
--- trunk/connector-api/src/main/java/org/teiid/connector/language/LanguageFactory.java (rev 0)
+++ trunk/connector-api/src/main/java/org/teiid/connector/language/LanguageFactory.java 2010-03-04 20:47:34 UTC (rev 1913)
@@ -0,0 +1,207 @@
+/*
+ * 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.connector.language;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import org.teiid.connector.language.SortSpecification.Ordering;
+import org.teiid.connector.metadata.runtime.Column;
+import org.teiid.connector.metadata.runtime.Procedure;
+import org.teiid.connector.metadata.runtime.ProcedureParameter;
+import org.teiid.connector.metadata.runtime.Table;
+
+/**
+ * Factory for the construction of language objects that implement the language interfaces.
+ * This factory is provided by the connector environment and can be used in modifying the language
+ * interfaces if needed.
+ */
+public class LanguageFactory {
+
+ /**
+ * Public instance, holds no state so can be shared by everyone.
+ */
+ public static final LanguageFactory INSTANCE = new LanguageFactory();
+
+ public AggregateFunction createAggregate(String name, boolean isDistinct, Expression expression, Class<?> type) {
+ return new AggregateFunction(name, isDistinct, expression, type);
+ }
+
+ public Comparison createCompareCriteria(
+ Comparison.Operator operator,
+ Expression leftExpression,
+ Expression rightExpression) {
+ return new Comparison(leftExpression, rightExpression, operator);
+ }
+
+ public AndOr createAndOr(AndOr.Operator operator, Condition left, Condition right) {
+ return new AndOr(left, right, operator);
+ }
+
+ public Delete createDelete(NamedTable group, Condition where) {
+ return new Delete(group, where);
+ }
+
+ public ColumnReference createColumnReference(String name, NamedTable group, Column metadataReference, Class<?> type) {
+ return new ColumnReference(group, name, metadataReference, type);
+ }
+
+ public Exists createExists(Select query) {
+ return new Exists(query);
+ }
+
+ public Function createFunction(String functionName, Expression[] args, Class<?> type) {
+ return new Function(functionName, Arrays.asList(args), type);
+ }
+
+ public Function createFunction(String functionName, List<? extends Expression> args, Class<?> type) {
+ return new Function(functionName, args, type);
+ }
+
+ public NamedTable createNamedTable(String name, String correlationName, Table metadataReference) {
+ return new NamedTable(name, correlationName, metadataReference);
+ }
+
+ public GroupBy createGroupBy(List<Expression> items) {
+ return new GroupBy(items);
+ }
+
+ public In createIn(Expression leftExpression, List<Expression> rightExpressions, boolean isNegated) {
+ return new In(leftExpression, rightExpressions, isNegated);
+ }
+
+ public Insert createInsert(NamedTable group, List<ColumnReference> columns, InsertValueSource valueSource) {
+ return new Insert(group, columns, valueSource);
+ }
+
+ public ExpressionValueSource createInsertExpressionValueSource(List<Expression> values) {
+ return new ExpressionValueSource(values);
+ }
+
+ public IsNull createIsNullCriteria(Expression expression, boolean isNegated) {
+ return new IsNull(expression, isNegated);
+ }
+
+ public Join createJoin(Join.JoinType joinType, TableReference leftItem, TableReference rightItem, Condition condition) {
+ return new Join(leftItem, rightItem, joinType, condition);
+ }
+
+ public Like createLikeCriteria(
+ Expression leftExpression,
+ Expression rightExpression,
+ Character escapeCharacter,
+ boolean isNegated) {
+ return new Like(leftExpression, rightExpression, escapeCharacter, isNegated);
+ }
+
+ public Literal createLiteral(Object value, Class<?> type) {
+ return new Literal(value, type);
+ }
+
+ public Not createNot(Condition criteria) {
+ return new Not(criteria);
+ }
+
+ public OrderBy createOrderBy(List<SortSpecification> items) {
+ return new OrderBy(items);
+ }
+
+ public SortSpecification createOrderByItem(ColumnReference element, Ordering direction) {
+ return new SortSpecification(direction, element);
+ }
+
+ public Argument createArgument(Argument.Direction direction, Literal value, Class<?> type, ProcedureParameter metadataReference) {
+ return new Argument(direction, value, type, metadataReference);
+ }
+
+ public Call createCall(String name, List<Argument> parameters, Procedure metadataReference) {
+ return new Call(name, parameters, metadataReference);
+ }
+
+ public Select createQuery(
+ List<DerivedColumn> select,
+ boolean isDistinct,
+ List<TableReference> from,
+ Condition where,
+ GroupBy groupBy,
+ Condition having,
+ OrderBy orderBy) {
+ return new Select(select, isDistinct, from, where, groupBy, having, orderBy);
+ }
+
+ public ScalarSubquery createScalarSubquery(Select query) {
+ return new ScalarSubquery(query);
+ }
+
+ public SearchedCase createSearchedCaseExpression(
+ List<SearchedWhenClause> cases,
+ Expression elseExpression,
+ Class<?> type) {
+ return new SearchedCase(cases, elseExpression, type);
+ }
+
+ public SearchedWhenClause createSearchedWhenCondition(Condition condition, Expression result) {
+ return new SearchedWhenClause(condition, result);
+ }
+
+ public DerivedColumn createSelectSymbol(String name, Expression expression) {
+ return new DerivedColumn(name, expression);
+ }
+
+ public SubqueryComparison createSubqueryCompareCriteria(
+ Expression leftExpression,
+ Comparison.Operator operator,
+ SubqueryComparison.Quantifier quantifier,
+ Select subquery) {
+ return new SubqueryComparison(leftExpression, operator, quantifier, subquery);
+ }
+
+ public SubqueryIn createSubqueryInCriteria(Expression expression, Select subquery, boolean isNegated) {
+ return new SubqueryIn(expression, isNegated, subquery);
+ }
+
+ public Update createUpdate(NamedTable group, List<SetClause> updates, Condition criteria) {
+ return new Update(group, updates, criteria);
+ }
+
+ public DerivedTable createInlineView(QueryExpression query, String name) {
+ return new DerivedTable(query, name);
+ }
+
+ public SetQuery createSetOp(SetQuery.Operation operation, boolean all, QueryExpression leftQuery, QueryExpression rightQuery, OrderBy orderBy, Limit limit) {
+ SetQuery queryImpl = new SetQuery();
+ queryImpl.setOperation(operation);
+ queryImpl.setAll(all);
+ queryImpl.setLeftQuery(leftQuery);
+ queryImpl.setRightQuery(rightQuery);
+ queryImpl.setOrderBy(orderBy);
+ queryImpl.setLimit(limit);
+ return queryImpl;
+ }
+
+ public SetClause createSetClause(ColumnReference symbol, Expression value) {
+ return new SetClause(symbol, value);
+ }
+
+}
Copied: trunk/connector-api/src/main/java/org/teiid/connector/language/LanguageObject.java (from rev 1899, branches/JCA/connector-api/src/main/java/org/teiid/connector/language/LanguageObject.java)
===================================================================
--- trunk/connector-api/src/main/java/org/teiid/connector/language/LanguageObject.java (rev 0)
+++ trunk/connector-api/src/main/java/org/teiid/connector/language/LanguageObject.java 2010-03-04 20:47:34 UTC (rev 1913)
@@ -0,0 +1,34 @@
+/*
+ * 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.connector.language;
+
+import org.teiid.connector.visitor.framework.LanguageObjectVisitor;
+
+/**
+ * Root interface for all language object interfaces.
+ */
+public interface LanguageObject {
+
+ void acceptVisitor(LanguageObjectVisitor visitor);
+
+}
Modified: trunk/connector-api/src/main/java/org/teiid/connector/language/LanguageUtil.java
===================================================================
--- trunk/connector-api/src/main/java/org/teiid/connector/language/LanguageUtil.java 2010-03-04 20:22:20 UTC (rev 1912)
+++ trunk/connector-api/src/main/java/org/teiid/connector/language/LanguageUtil.java 2010-03-04 20:47:34 UTC (rev 1913)
@@ -24,7 +24,7 @@
import java.util.*;
-import org.teiid.connector.language.ICompoundCriteria.Operator;
+import org.teiid.connector.language.AndOr.Operator;
/**
@@ -48,31 +48,28 @@
* @param criteria Criteria to break, may be null
* @return List of ICriteria, never null
*/
- public static final List separateCriteriaByAnd(ICriteria criteria) {
+ public static final List<Condition> separateCriteriaByAnd(Condition criteria) {
if(criteria == null) {
- return Collections.EMPTY_LIST;
+ return Collections.emptyList();
}
- List parts = new ArrayList();
+ List<Condition> parts = new ArrayList<Condition>();
separateCriteria(criteria, parts);
return parts;
}
/**
- * Helper method for {@link #separateCriteriaByAnd(ICriteria)} that
+ * Helper method for {@link #separateCriteriaByAnd(Condition)} that
* can be called recursively to collect parts.
* @param crit Crit to break apart
* @param parts List to add parts to
*/
- private static void separateCriteria(ICriteria crit, List parts) {
- if(crit instanceof ICompoundCriteria) {
- ICompoundCriteria compCrit = (ICompoundCriteria) crit;
+ private static void separateCriteria(Condition crit, List<Condition> parts) {
+ if(crit instanceof AndOr) {
+ AndOr compCrit = (AndOr) crit;
if(compCrit.getOperator() == Operator.AND) {
- List subCrits = compCrit.getCriteria();
- Iterator iter = subCrits.iterator();
- while(iter.hasNext()) {
- separateCriteria((ICriteria) iter.next(), parts);
- }
+ separateCriteria(compCrit.getLeftCondition(), parts);
+ separateCriteria(compCrit.getRightCondition(), parts);
} else {
parts.add(crit);
}
@@ -84,30 +81,19 @@
/**
* This utility method can be used to combine two criteria using an AND.
* If both criteria are null, then null will be returned. If either is null,
- * then the other will be returned. If neither is null and the primaryCrit is
- * an ICompoundCriteria, then the additionalCrit will be added to the primaryCrit
- * and the primaryCrit will be returned. If the primaryCrit is not compound, a new
- * ICompoundCriteria will be created and both criteria will be added to it.
+ * then the other will be returned.
* @param primaryCrit Primary criteria - may be modified
* @param additionalCrit Won't be modified, but will likely be attached to the returned crit
* @param languageFactory Will be used to construct new ICompoundCriteria if necessary
* @return Combined criteria
*/
- public static ICriteria combineCriteria(ICriteria primaryCrit, ICriteria additionalCrit, ILanguageFactory languageFactory) {
+ public static Condition combineCriteria(Condition primaryCrit, Condition additionalCrit, LanguageFactory languageFactory) {
if(primaryCrit == null) {
return additionalCrit;
} else if(additionalCrit == null) {
return primaryCrit;
- } else if((primaryCrit instanceof ICompoundCriteria) && ((ICompoundCriteria)primaryCrit).getOperator() == Operator.AND) {
- ICompoundCriteria primaryCompound = (ICompoundCriteria) primaryCrit;
- primaryCompound.getCriteria().add(additionalCrit);
- return primaryCrit;
} else {
- List crits = new ArrayList(2);
- crits.add(primaryCrit);
- crits.add(additionalCrit);
- ICompoundCriteria compCrit = languageFactory.createCompoundCriteria(Operator.AND, crits);
- return compCrit;
+ return languageFactory.createAndOr(Operator.AND, primaryCrit, additionalCrit);
}
}
Copied: trunk/connector-api/src/main/java/org/teiid/connector/language/Like.java (from rev 1899, branches/JCA/connector-api/src/main/java/org/teiid/connector/language/Like.java)
===================================================================
--- trunk/connector-api/src/main/java/org/teiid/connector/language/Like.java (rev 0)
+++ trunk/connector-api/src/main/java/org/teiid/connector/language/Like.java 2010-03-04 20:47:34 UTC (rev 1913)
@@ -0,0 +1,78 @@
+/*
+ * 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.connector.language;
+
+import org.teiid.connector.visitor.framework.LanguageObjectVisitor;
+
+public class Like extends Condition implements Predicate {
+
+ private Expression leftExpression;
+ private Expression rightExpression;
+ private Character escapeCharacter;
+ private boolean isNegated;
+
+ public Like(Expression left, Expression right, Character escapeCharacter, boolean negated) {
+ leftExpression = left;
+ rightExpression = right;
+ this.escapeCharacter = escapeCharacter;
+ this.isNegated = negated;
+
+ }
+
+ public Expression getLeftExpression() {
+ return leftExpression;
+ }
+
+ public Expression getRightExpression() {
+ return rightExpression;
+ }
+
+ public Character getEscapeCharacter() {
+ return this.escapeCharacter;
+ }
+
+ public boolean isNegated() {
+ return this.isNegated;
+ }
+
+ public void acceptVisitor(LanguageObjectVisitor visitor) {
+ visitor.visit(this);
+ }
+
+ public void setLeftExpression(Expression expression) {
+ this.leftExpression = expression;
+ }
+
+ public void setRightExpression(Expression expression) {
+ this.rightExpression = expression;
+ }
+
+ public void setEscapeCharacter(Character character) {
+ this.escapeCharacter = character;
+ }
+
+ public void setNegated(boolean negated) {
+ this.isNegated = negated;
+ }
+
+}
Copied: trunk/connector-api/src/main/java/org/teiid/connector/language/Limit.java (from rev 1899, branches/JCA/connector-api/src/main/java/org/teiid/connector/language/Limit.java)
===================================================================
--- trunk/connector-api/src/main/java/org/teiid/connector/language/Limit.java (rev 0)
+++ trunk/connector-api/src/main/java/org/teiid/connector/language/Limit.java 2010-03-04 20:47:34 UTC (rev 1913)
@@ -0,0 +1,66 @@
+/*
+ * 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.connector.language;
+
+import org.teiid.connector.visitor.framework.LanguageObjectVisitor;
+
+/**
+ * Represents a LIMIT clause with row offset and row limit values to bound the resulting rows
+ */
+public class Limit extends BaseLanguageObject {
+
+ private int rowOffset;
+ private int rowLimit;
+
+ public Limit(int offset, int rowLimit) {
+ this.rowOffset = offset;
+ this.rowLimit = rowLimit;
+ }
+
+ /**
+ * Get the max number of rows returned.
+ */
+ public int getRowLimit() {
+ return rowLimit;
+ }
+
+ /**
+ * Get the row offset at which to begin returning rows.
+ */
+ public int getRowOffset() {
+ return rowOffset;
+ }
+
+ public void setRowLimit(int rowLimit) {
+ this.rowLimit = rowLimit;
+ }
+
+ public void setRowOffset(int rowOffset) {
+ this.rowOffset = rowOffset;
+ }
+
+ public void acceptVisitor(LanguageObjectVisitor visitor) {
+ visitor.visit(this);
+ }
+
+}
Copied: trunk/connector-api/src/main/java/org/teiid/connector/language/Literal.java (from rev 1899, branches/JCA/connector-api/src/main/java/org/teiid/connector/language/Literal.java)
===================================================================
--- trunk/connector-api/src/main/java/org/teiid/connector/language/Literal.java (rev 0)
+++ trunk/connector-api/src/main/java/org/teiid/connector/language/Literal.java 2010-03-04 20:47:34 UTC (rev 1913)
@@ -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.connector.language;
+
+import org.teiid.connector.visitor.framework.LanguageObjectVisitor;
+
+/**
+ * Represents a literal value that is used in
+ * an expression. The value can be obtained and should match
+ * the type specified by {@link #getType()}
+ */
+public class Literal extends BaseLanguageObject implements Expression {
+
+ private Object value;
+ private Class<?> type;
+ private boolean bindValue;
+ private boolean multiValued;
+
+ public Literal(Object value, Class<?> type) {
+ this.value = value;
+ this.type = type;
+ }
+
+ public Object getValue() {
+ return this.value;
+ }
+
+ public void acceptVisitor(LanguageObjectVisitor visitor) {
+ visitor.visit(this);
+ }
+
+ public Class<?> getType() {
+ return this.type;
+ }
+
+ public void setValue(Object value) {
+ this.value = value;
+ }
+
+ public boolean isBindValue() {
+ return bindValue;
+ }
+
+ public void setBindValue(boolean bindValue) {
+ this.bindValue = bindValue;
+ }
+
+ public boolean isMultiValued() {
+ return multiValued;
+ }
+
+ public void setMultiValued(boolean multiValued) {
+ this.multiValued = multiValued;
+ }
+
+ public void setType(Class<?> type) {
+ this.type = type;
+ }
+
+}
Copied: trunk/connector-api/src/main/java/org/teiid/connector/language/MetadataReference.java (from rev 1899, branches/JCA/connector-api/src/main/java/org/teiid/connector/language/MetadataReference.java)
===================================================================
--- trunk/connector-api/src/main/java/org/teiid/connector/language/MetadataReference.java (rev 0)
+++ trunk/connector-api/src/main/java/org/teiid/connector/language/MetadataReference.java 2010-03-04 20:47:34 UTC (rev 1913)
@@ -0,0 +1,36 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+
+package org.teiid.connector.language;
+
+import org.teiid.connector.metadata.runtime.AbstractMetadataRecord;
+
+
+/**
+ * This interface is used to mark language objects as having a
+ * reference to a MetadataID.
+ */
+public interface MetadataReference<T extends AbstractMetadataRecord> {
+
+ T getMetadataObject();
+
+}
Copied: trunk/connector-api/src/main/java/org/teiid/connector/language/NamedTable.java (from rev 1899, branches/JCA/connector-api/src/main/java/org/teiid/connector/language/NamedTable.java)
===================================================================
--- trunk/connector-api/src/main/java/org/teiid/connector/language/NamedTable.java (rev 0)
+++ trunk/connector-api/src/main/java/org/teiid/connector/language/NamedTable.java 2010-03-04 20:47:34 UTC (rev 1913)
@@ -0,0 +1,77 @@
+/*
+ * 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.connector.language;
+
+import org.teiid.connector.metadata.runtime.Table;
+import org.teiid.connector.visitor.framework.LanguageObjectVisitor;
+
+/**
+ * Represents a table in the language objects. An example would
+ * be a table reference in the FROM clause.
+ */
+public class NamedTable extends BaseLanguageObject implements MetadataReference<Table>, TableReference {
+
+ private String correlationName;
+ private String name;
+ private Table metadataObject;
+
+ public NamedTable(String name, String correlationName, Table group) {
+ this.name = name;
+ this.correlationName = correlationName;
+ this.metadataObject = group;
+ }
+
+ public String getCorrelationName() {
+ return correlationName;
+ }
+
+ /**
+ * Gets the name of the table. Will typically match the name in the metadata.
+ * @return
+ */
+ public String getName() {
+ return this.name;
+ }
+
+ @Override
+ public Table getMetadataObject() {
+ return this.metadataObject;
+ }
+
+ public void setMetadataObject(Table metadataObject) {
+ this.metadataObject = metadataObject;
+ }
+
+ public void acceptVisitor(LanguageObjectVisitor visitor) {
+ visitor.visit(this);
+ }
+
+ public void setName(String definition) {
+ this.name = definition;
+ }
+
+ public void setCorrelationName(String context) {
+ this.correlationName = context;
+ }
+
+}
Copied: trunk/connector-api/src/main/java/org/teiid/connector/language/Not.java (from rev 1899, branches/JCA/connector-api/src/main/java/org/teiid/connector/language/Not.java)
===================================================================
--- trunk/connector-api/src/main/java/org/teiid/connector/language/Not.java (rev 0)
+++ trunk/connector-api/src/main/java/org/teiid/connector/language/Not.java 2010-03-04 20:47:34 UTC (rev 1913)
@@ -0,0 +1,47 @@
+/*
+ * 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.connector.language;
+
+import org.teiid.connector.visitor.framework.LanguageObjectVisitor;
+
+public class Not extends Condition {
+
+ private Condition criteria;
+
+ public Not(Condition criteria) {
+ this.criteria = criteria;
+ }
+
+ public Condition getCriteria() {
+ return criteria;
+ }
+
+ public void acceptVisitor(LanguageObjectVisitor visitor) {
+ visitor.visit(this);
+ }
+
+ public void setCriteria(Condition criteria) {
+ this.criteria = criteria;
+ }
+
+}
Copied: trunk/connector-api/src/main/java/org/teiid/connector/language/OrderBy.java (from rev 1899, branches/JCA/connector-api/src/main/java/org/teiid/connector/language/OrderBy.java)
===================================================================
--- trunk/connector-api/src/main/java/org/teiid/connector/language/OrderBy.java (rev 0)
+++ trunk/connector-api/src/main/java/org/teiid/connector/language/OrderBy.java 2010-03-04 20:47:34 UTC (rev 1913)
@@ -0,0 +1,52 @@
+/*
+ * 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.connector.language;
+
+import java.util.List;
+
+import org.teiid.connector.visitor.framework.LanguageObjectVisitor;
+
+/**
+ * Represents an ORDER BY clause in a command.
+ */
+public class OrderBy extends BaseLanguageObject {
+
+ private List<SortSpecification> sortSpecifications;
+
+ public OrderBy(List<SortSpecification> items) {
+ this.sortSpecifications = items;
+ }
+
+ public List<SortSpecification> getSortSpecifications() {
+ return sortSpecifications;
+ }
+
+ public void acceptVisitor(LanguageObjectVisitor visitor) {
+ visitor.visit(this);
+ }
+
+ public void setSortSpecifications(List<SortSpecification> items) {
+ this.sortSpecifications = items;
+ }
+
+}
Copied: trunk/connector-api/src/main/java/org/teiid/connector/language/Predicate.java (from rev 1899, branches/JCA/connector-api/src/main/java/org/teiid/connector/language/Predicate.java)
===================================================================
--- trunk/connector-api/src/main/java/org/teiid/connector/language/Predicate.java (rev 0)
+++ trunk/connector-api/src/main/java/org/teiid/connector/language/Predicate.java 2010-03-04 20:47:34 UTC (rev 1913)
@@ -0,0 +1,31 @@
+/*
+ * 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.connector.language;
+
+/**
+ * Represents a criteria that can occur at the leaf of a tree of
+ * criteria.
+ */
+public interface Predicate {
+
+}
Copied: trunk/connector-api/src/main/java/org/teiid/connector/language/QueryExpression.java (from rev 1899, branches/JCA/connector-api/src/main/java/org/teiid/connector/language/QueryExpression.java)
===================================================================
--- trunk/connector-api/src/main/java/org/teiid/connector/language/QueryExpression.java (rev 0)
+++ trunk/connector-api/src/main/java/org/teiid/connector/language/QueryExpression.java 2010-03-04 20:47:34 UTC (rev 1913)
@@ -0,0 +1,96 @@
+/*
+ * 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.connector.language;
+
+import java.util.List;
+
+public abstract class QueryExpression extends BaseLanguageObject implements Command, InsertValueSource {
+
+ private OrderBy orderBy;
+ private Limit limit;
+
+ public abstract Select getProjectedQuery();
+
+ /**
+ * Get ORDER BY clause, may be null.
+ * @return An ORDER BY object
+ */
+ public OrderBy getOrderBy() {
+ return orderBy;
+ }
+
+ /**
+ * Get LIMIT clause, may be null.
+ * @return A LIMIT object
+ */
+ public Limit getLimit() {
+ return limit;
+ }
+
+ /**
+ * Get the derived column names. Note this only reports alias names.
+ * Any other names may not be consistent throughout the translation process.
+ * @return a String[] containing the column names
+ * @since 4.3
+ */
+ public String[] getColumnNames() {
+ List<DerivedColumn> selectSymbols = getProjectedQuery().getDerivedColumns();
+ String[] columnNames = new String[selectSymbols.size()];
+ int symbolIndex = 0;
+ for (DerivedColumn column : selectSymbols) {
+ columnNames[symbolIndex++] = column.getAlias();
+ }
+ return columnNames;
+ }
+
+ /**
+ * Get the column types of the output columns for this query
+ * @return a Class[] containing the column names
+ * @since 4.3
+ */
+ public Class<?>[] getColumnTypes() {
+ List<DerivedColumn> selectSymbols = getProjectedQuery().getDerivedColumns();
+ Class<?>[] columnTypes = new Class[selectSymbols.size()];
+ int symbolIndex = 0;
+ for (DerivedColumn column : selectSymbols) {
+ columnTypes[symbolIndex++] = column.getExpression().getType();
+ }
+ return columnTypes;
+ }
+
+ /**
+ * Set ORDER BY clause, may be null.
+ * @param orderBy An ORDER BY object
+ */
+ public void setOrderBy(OrderBy orderBy) {
+ this.orderBy = orderBy;
+ }
+
+ /**
+ * Set LIMIT clause, may be null.
+ * @param limit A LIMIT object
+ */
+ public void setLimit(Limit limit) {
+ this.limit = limit;
+ }
+}
Copied: trunk/connector-api/src/main/java/org/teiid/connector/language/SQLReservedWords.java (from rev 1899, branches/JCA/connector-api/src/main/java/org/teiid/connector/language/SQLReservedWords.java)
===================================================================
--- trunk/connector-api/src/main/java/org/teiid/connector/language/SQLReservedWords.java (rev 0)
+++ trunk/connector-api/src/main/java/org/teiid/connector/language/SQLReservedWords.java 2010-03-04 20:47:34 UTC (rev 1913)
@@ -0,0 +1,354 @@
+/*
+ * 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.connector.language;
+
+import java.lang.reflect.Field;
+import java.util.Set;
+import java.util.HashSet;
+
+/**
+ * Reserved words for Teiid.
+ */
+public class SQLReservedWords {
+
+ public interface Tokens {
+ public static final String ALL_COLS = "*"; //$NON-NLS-1$
+ public static final String SPACE = " "; //$NON-NLS-1$
+ public static final String COMMA = ","; //$NON-NLS-1$
+ public static final String DOT = "."; //$NON-NLS-1$
+ public static final String QUOTE = "'"; //$NON-NLS-1$
+ public static final String EQ = "="; //$NON-NLS-1$
+ public static final String NE = "<>"; //$NON-NLS-1$
+ public static final String LT = "<"; //$NON-NLS-1$
+ public static final String GT = ">"; //$NON-NLS-1$
+ public static final String LE = "<="; //$NON-NLS-1$
+ public static final String GE = ">="; //$NON-NLS-1$
+ public static final String LPAREN = "("; //$NON-NLS-1$
+ public static final String RPAREN = ")"; //$NON-NLS-1$
+ }
+
+ public static final String ADD = "ADD"; //$NON-NLS-1$
+ public static final String ANY = "ANY"; //$NON-NLS-1$
+ public static final String ALL = "ALL"; //$NON-NLS-1$
+ public static final String ALTER = "ALTER"; //$NON-NLS-1$
+ public static final String AND = "AND"; //$NON-NLS-1$
+ public static final String ARRAY = "ARRAY"; //$NON-NLS-1$s
+ public static final String AS = "AS"; //$NON-NLS-1$
+ public static final String ASC = "ASC"; //$NON-NLS-1$
+ public static final String ATOMIC = "ATOMIC"; //$NON-NLS-1$
+ public static final String AUTHORIZATION = "autorization"; //$NON-NLS-1$
+ public static final String AVG = "AVG"; //$NON-NLS-1$
+ public static final String BEGIN = "BEGIN"; //$NON-NLS-1$
+ public static final String BETWEEN = "BETWEEN"; //$NON-NLS-1$
+ public static final String BIGDECIMAL = "BIGDECIMAL"; //$NON-NLS-1$
+ public static final String BIGINT = "BIGINT"; //$NON-NLS-1$
+ public static final String BIGINTEGER = "BIGINTEGER"; //$NON-NLS-1$
+ public static final String BINARY = "BINARY"; //$NON-NLS-1$
+ public static final String BLOB = "BLOB"; //$NON-NLS-1$
+ public static final String BOTH = "BOTH"; //$NON-NLS-1$
+ public static final String BREAK = "BREAK"; //$NON-NLS-1$
+ public static final String BY = "BY"; //$NON-NLS-1$
+ public static final String BYTE = "BYTE"; //$NON-NLS-1$
+ public static final String CALL = "CALL"; //$NON-NLS-1$
+ public static final String CALLED = "CALLED"; //$NON-NLS-1$
+ public static final String CASE = "CASE"; //$NON-NLS-1$
+ public static final String CAST = "CAST"; //$NON-NLS-1$
+ public static final String CASCADED = "CASCADED"; //$NON-NLS-1$
+ public static final String CHAR = "CHAR"; //$NON-NLS-1$
+ public static final String CHARACTER = "CHARACTER"; //$NON-NLS-1$
+ public static final String CHECK = "CHECK"; //$NON-NLS-1$
+ public static final String CLOB = "CLOB"; //$NON-NLS-1$
+ public static final String CLOSE = "CLOSE"; //$NON-NLS-1$
+ public static final String COLLATE = "COLLATE"; //$NON-NLS-1$
+ public static final String COLUMN = "COLUMN"; //$NON-NLS-1$
+ public static final String COMMIT = "COMMIT"; //$NON-NLS-1$
+ public static final String CONNECT = "CONNECT"; //$NON-NLS-1$
+ public static final String CONVERT = "CONVERT"; //$NON-NLS-1$
+ public static final String CONSTRAINT = "CONSTRAINT"; //$NON-NLS-1$
+ public static final String CONTINUE = "CONTINUE"; //$NON-NLS-1$
+ public static final String COUNT = "COUNT"; //$NON-NLS-1$
+ public static final String CORRESPONDING = "CORRESPONDING"; //$NON-NLS-1$
+ public static final String CRITERIA = "CRITERIA"; //$NON-NLS-1$
+ public static final String CREATE = "CREATE"; //$NON-NLS-1$
+ public static final String CROSS = "CROSS"; //$NON-NLS-1$
+ public static final String CURRENT_DATE = "CURRENT_DATE"; //$NON-NLS-1$
+ public static final String CURRENT_TIME = "CURRENT_TIME"; //$NON-NLS-1$
+ public static final String CURRENT_TIMESTAMP = "CURRENT_TIMESTAMP"; //$NON-NLS-1$
+ public static final String CURRENT_USER = "CURRENT_USER"; //$NON-NLS-1$
+ public static final String CURSOR = "CURSOR"; //$NON-NLS-1$
+ public static final String DATE = "DATE"; //$NON-NLS-1$
+ public static final String DAY = "DAY"; //$NON-NLS-1$
+ public static final String DEALLOCATE = "DEALLOCATE"; //$NON-NLS-1$
+ public static final String DEBUG = "DEBUG"; //$NON-NLS-1$
+ public static final String DECIMAL = "DECIMAL"; //$NON-NLS-1$
+ public static final String DECLARE = "DECLARE"; //$NON-NLS-1$
+ public static final String DEFAULT = "DEFAULT"; //$NON-NLS-1$
+ public static final String DELETE = "DELETE"; //$NON-NLS-1$
+ public static final String DESC = "DESC"; //$NON-NLS-1$
+ public static final String DESCRIBE = "DESCRIBE"; //$NON-NLS-1$
+ public static final String DETERMINISTIC = "DETERMINISTIC"; //$NON-NLS-1$
+ public static final String DISCONNECT = "DISCONNECT"; //$NON-NLS-1$
+ public static final String DISTINCT = "DISTINCT"; //$NON-NLS-1$
+ public static final String DOUBLE = "DOUBLE"; //$NON-NLS-1$
+ public static final String DROP = "DROP"; //$NON-NLS-1$
+ public static final String EACH = "EACH"; //$NON-NLS-1$
+ public static final String ELSE = "ELSE"; //$NON-NLS-1$
+ public static final String END = "END"; //$NON-NLS-1$
+ public static final String ERROR = "ERROR"; //$NON-NLS-1$
+ public static final String ESCAPE = "ESCAPE"; //$NON-NLS-1$
+ public static final String EXCEPT = "EXCEPT"; //$NON-NLS-1$
+ public static final String EXEC = "EXEC"; //$NON-NLS-1$
+ public static final String EXECUTE = "EXECUTE"; //$NON-NLS-1$
+ public static final String EXISTS = "EXISTS"; //$NON-NLS-1$
+ public static final String EXTERNAL = "EXTERNAL"; //$NON-NLS-1$
+ public static final String FALSE = "FALSE"; //$NON-NLS-1$
+ public static final String FETCH = "FETCH"; //$NON-NLS-1$
+ public static final String FILTER = "FILTER"; //$NON-NLS-1$
+ public static final String FLOAT = "FLOAT"; //$NON-NLS-1$
+ public static final String FN = "FN"; //$NON-NLS-1$
+ public static final String FOR = "FOR"; //$NON-NLS-1$
+ public static final String FOREIGN = "FOREIGN"; //$NON-NLS-1$
+ public static final String FROM = "FROM"; //$NON-NLS-1$
+ public static final String FULL = "FULL"; //$NON-NLS-1$
+ public static final String FUNCTION = "FUNCTION"; //$NON-NLS-1$
+ public static final String GET = "GET"; //$NON-NLS-1$
+ public static final String GLOBAL = "GLOBAL"; //$NON-NLS-1$
+ public static final String GRANT = "GRANT"; //$NON-NLS-1$
+ public static final String GROUP = "GROUP"; //$NON-NLS-1$
+ public static final String GROUPING = "GROUPING"; //$NON-NLS-1$
+ public static final String HAS = "HAS"; //$NON-NLS-1$
+ public static final String HAVING = "HAVING"; //$NON-NLS-1$
+ public static final String HOLD = "HOLD"; //$NON-NLS-1$
+ public static final String HOUR = "HOUR"; //$NON-NLS-1$
+ public static final String IDENTITY = "IDENTITY"; //$NON-NLS-1$
+ public static final String INDICATOR = "INDICATOR"; //$NON-NLS-1$
+ public static final String IF = "IF"; //$NON-NLS-1$
+ public static final String IMMEDIATE = "IMMEDIATE"; //$NON-NLS-1$
+ public static final String IN = "IN"; //$NON-NLS-1$
+ public static final String INOUT = "INOUT"; //$NON-NLS-1$
+ public static final String INNER = "INNER"; //$NON-NLS-1$
+ public static final String INPUT = "INPUT"; //$NON-NLS-1$
+ public static final String INSENSITIVE = "INSENSITIVE"; //$NON-NLS-1$
+ public static final String INSERT = "INSERT"; //$NON-NLS-1$
+ public static final String INTEGER = "INTEGER"; //$NON-NLS-1$
+ public static final String INTERSECT = "INTERSECT"; //$NON-NLS-1$
+ public static final String INTERVAL = "INTERVAL"; //$NON-NLS-1$
+ public static final String INTO = "INTO"; //$NON-NLS-1$
+ public static final String IS = "IS"; //$NON-NLS-1$
+ public static final String ISOLATION = "ISOLATION"; //$NON-NLS-1$
+ public static final String JOIN = "JOIN"; //$NON-NLS-1$
+ public static final String LANGUAGE = "LANGUAGE"; //$NON-NLS-1$
+ public static final String LARGE = "LARGE"; //$NON-NLS-1$
+ public static final String LEADING = "LEADING"; //$NON-NLS-1$
+ public static final String LEFT = "LEFT"; //$NON-NLS-1$
+ public static final String LIKE = "LIKE"; //$NON-NLS-1$
+ public static final String LIMIT = "LIMIT"; //$NON-NLS-1$
+ public static final String LOCAL = "LOCAL"; //$NON-NLS-1$
+ public static final String LONG = "LONG"; //$NON-NLS-1$
+ public static final String LOOP = "LOOP"; //$NON-NLS-1$
+ public static final String MAKEDEP = "MAKEDEP"; //$NON-NLS-1$
+ public static final String MAKENOTDEP = "MAKENOTDEP"; //$NON-NLS-1$
+ public static final String MATCH = "MATCH"; //$NON-NLS-1$
+ public static final String MAX = "MAX"; //$NON-NLS-1$
+ public static final String MIN = "MIN"; //$NON-NLS-1$
+ public static final String MERGE = "MERGE"; //$NON-NLS-1$
+ public static final String METHOD = "METHOD"; //$NON-NLS-1$
+ public static final String MINUTE = "MINUTE"; //$NON-NLS-1$
+ public static final String MODIFIES = "MODIFIES"; //$NON-NLS-1$
+ public static final String MODULE = "MODULE"; //$NON-NLS-1$
+ public static final String MONTH = "MONTH"; //$NON-NLS-1$
+ public static final String NATURAL = "NATURAL"; //$NON-NLS-1$
+ public static final String NEW = "NEW"; //$NON-NLS-1$
+ public static final String NO = "NO"; //$NON-NLS-1$
+ public static final String NOCACHE = "NOCACHE"; //$NON-NLS-1$
+ public static final String NONE = "NONE"; //$NON-NLS-1$
+ public static final String NOT = "NOT"; //$NON-NLS-1$
+ public static final String NULL = "NULL"; //$NON-NLS-1$
+ public static final String OBJECT = "OBJECT"; //$NON-NLS-1$
+ public static final String OF = "OF"; //$NON-NLS-1$
+ public static final String OJ = "OJ"; //$NON-NLS-1$
+ public static final String OLD = "OLD"; //$NON-NLS-1$
+ public static final String ON = "ON"; //$NON-NLS-1$
+ public static final String ONLY = "ONLY"; //$NON-NLS-1$
+ public static final String OPEN = "OPEN"; //$NON-NLS-1$
+ public static final String OR = "OR"; //$NON-NLS-1$
+ public static final String ORDER = "ORDER"; //$NON-NLS-1$
+ public static final String OUT = "OUT"; //$NON-NLS-1$
+ public static final String OUTER = "OUTER"; //$NON-NLS-1$
+ public static final String OUTPUT = "OUTPUT"; //$NON-NLS-1$
+ public static final String OPTION = "OPTION"; //$NON-NLS-1$
+ public static final String OVER = "OVER"; //$NON-NLS-1$
+ public static final String OVERLAPS = "OVERLAPS"; //$NON-NLS-1$
+ public static final String PARAMETER = "PARAMETER"; //$NON-NLS-1$
+ public static final String PARTITION = "PARTITION"; //$NON-NLS-1$
+ public static final String PRECISION = "PRECISION"; //$NON-NLS-1$
+ public static final String PREPARE = "PREPARE"; //$NON-NLS-1$
+ public static final String PRIMARY = "PRIMARY"; //$NON-NLS-1$
+ public static final String PROCEDURE = "PROCEDURE"; //$NON-NLS-1$
+ public static final String PLANONLY = "PLANONLY"; //$NON-NLS-1$
+ public static final String RANGE = "RANGE"; //$NON-NLS-1$
+ public static final String READS = "READS"; //$NON-NLS-1$
+ public static final String REAL = "REAL"; //$NON-NLS-1$
+ public static final String RECURSIVE = "RECURSIVE"; //$NON-NLS-1$
+ public static final String REFERENCES = "REFERENCES"; //$NON-NLS-1$
+ public static final String REFERENCING = "REFERENCING"; //$NON-NLS-1$
+ public static final String RETURN = "RETURN"; //$NON-NLS-1$
+ public static final String RETURNS = "RETURNS"; //$NON-NLS-1$
+ public static final String REVOKE = "REVOKE"; //$NON-NLS-1$
+ public static final String RIGHT = "RIGHT"; //$NON-NLS-1$
+ public static final String ROLLBACK = "ROLLBACK"; //$NON-NLS-1$
+ public static final String ROLLUP = "ROLLUP"; //$NON-NLS-1$
+ public static final String ROW = "ROW"; //$NON-NLS-1$
+ public static final String ROWS = "ROWS"; //$NON-NLS-1$
+ public static final String SAVEPOINT = "ROWS"; //$NON-NLS-1$
+ public static final String SCROLL = "ROWS"; //$NON-NLS-1$
+ public static final String SEARCH = "ROWS"; //$NON-NLS-1$
+ public static final String SECOND = "ROWS"; //$NON-NLS-1$
+ public static final String SELECT = "SELECT"; //$NON-NLS-1$
+ public static final String SENSITIVE = "ROWS"; //$NON-NLS-1$
+ public static final String SESSION_USER = "SESSION_USER"; //$NON-NLS-1$
+ public static final String SET = "SET"; //$NON-NLS-1$
+ public static final String SHORT = "SHORT"; //$NON-NLS-1$
+ public static final String SHOWPLAN = "SHOWPLAN"; //$NON-NLS-1$
+ public static final String SIILAR = "ROWS"; //$NON-NLS-1$
+ public static final String SMALLINT = "ROWS"; //$NON-NLS-1$
+ public static final String SOME = "SOME"; //$NON-NLS-1$
+ public static final String SPECIFIC = "ROWS"; //$NON-NLS-1$
+ public static final String SQL = "ROWS"; //$NON-NLS-1$
+ public static final String SQLEXCEPTION = "SQLEXCEPTION"; //$NON-NLS-1$
+ public static final String SQLSTATE = "SQLSTATE"; //$NON-NLS-1$
+ public static final String SQLWARNING = "SQLWARNING"; //$NON-NLS-1$
+ public static final String SQL_TSI_FRAC_SECOND = "SQL_TSI_FRAC_SECOND"; //$NON-NLS-1$
+ public static final String SQL_TSI_SECOND = "SQL_TSI_SECOND"; //$NON-NLS-1$
+ public static final String SQL_TSI_MINUTE = "SQL_TSI_MINUTE"; //$NON-NLS-1$
+ public static final String SQL_TSI_HOUR = "SQL_TSI_HOUR"; //$NON-NLS-1$
+ public static final String SQL_TSI_DAY = "SQL_TSI_DAY"; //$NON-NLS-1$
+ public static final String SQL_TSI_WEEK = "SQL_TSI_WEEK"; //$NON-NLS-1$
+ public static final String SQL_TSI_MONTH = "SQL_TSI_MONTH"; //$NON-NLS-1$
+ public static final String SQL_TSI_QUARTER = "SQL_TSI_QUARTER"; //$NON-NLS-1$
+ public static final String SQL_TSI_YEAR = "SQL_TSI_YEAR"; //$NON-NLS-1$
+ public static final String START = "START"; //$NON-NLS-1$
+ public static final String STATIC = "STATIC"; //$NON-NLS-1$
+ public static final String STRING = "STRING"; //$NON-NLS-1$
+ public static final String SYSTEM = "SYSTEM"; //$NON-NLS-1$
+ public static final String SYSTEM_USER = "SYSTEM_USER"; //$NON-NLS-1$
+ public static final String SUM = "SUM"; //$NON-NLS-1$
+ public static final String TABLE = "TABLE"; //$NON-NLS-1$
+ public static final String TEMPORARY = "TEMPORARY"; //$NON-NLS-1$
+ public static final String THEN = "THEN"; //$NON-NLS-1$
+ public static final String TIME = "TIME"; //$NON-NLS-1$
+ public static final String TIMESTAMP = "TIMESTAMP"; //$NON-NLS-1$
+ public static final String TIMESTAMPADD = "TIMESTAMPADD"; //$NON-NLS-1$
+ public static final String TIMESTAMPDIFF = "TIMESTAMPDIFF"; //$NON-NLS-1$
+ public static final String TIMEZONE_HOUR = "TIMEZONE_HOUR"; //$NON-NLS-1$
+ public static final String TIMEZONE_MINUTE = "TIMEZONE_MINUTE"; //$NON-NLS-1$
+ public static final String TO = "TO"; //$NON-NLS-1$
+ public static final String TRAILING = "TRAILING"; //$NON-NLS-1$
+ public static final String TRANSLATE = "TRANSLATE"; //$NON-NLS-1$
+ public static final String TRIGGER = "TRIGGER"; //$NON-NLS-1$
+ public static final String TRUE = "TRUE"; //$NON-NLS-1$
+ public static final String UNION = "UNION"; //$NON-NLS-1$
+ public static final String UNIQUE = "UNIQUE"; //$NON-NLS-1$
+ public static final String UNKNOWN = "UNKNOWN"; //$NON-NLS-1$
+ public static final String UPDATE = "UPDATE"; //$NON-NLS-1$
+ public static final String USER = "USER"; //$NON-NLS-1$
+ public static final String USING = "USING"; //$NON-NLS-1$
+ public static final String VALUE = "VALUE"; //$NON-NLS-1$
+ public static final String VALUES = "VALUES"; //$NON-NLS-1$
+ public static final String VARCHAR = "VARCHAR"; //$NON-NLS-1$
+ public static final String VIRTUAL = "VIRTUAL"; //$NON-NLS-1$
+ public static final String WHEN = "WHEN"; //$NON-NLS-1$
+ public static final String WHENEVER = "WHENEVER"; //$NON-NLS-1$
+ public static final String WHERE = "WHERE"; //$NON-NLS-1$
+ public static final String WHILE = "WHILE"; //$NON-NLS-1$
+ public static final String WINDOW = "WINDOW"; //$NON-NLS-1$
+ public static final String WITH = "WITH"; //$NON-NLS-1$
+ public static final String WITHIN = "WITHIN"; //$NON-NLS-1$
+ public static final String WITHOUT = "WITHOUT"; //$NON-NLS-1$
+ public static final String YEAR = "YEAR"; //$NON-NLS-1$
+
+ //SQL/XML
+
+ public static final String XML = "XML"; //$NON-NLS-1$
+ public static final String XMLAGG = "XMLAGG"; //$NON-NLS-1$
+ public static final String XMLATTRIBUTES = "XMLATTRIBUTES"; //$NON-NLS-1$
+ public static final String XMLBINARY = "XMLBINARY"; //$NON-NLS-1$
+ public static final String XMLCONCAT = "XMLCONCAT"; //$NON-NLS-1$
+ public static final String XMLCOMMENT = "XMLCOMMENT"; //$NON-NLS-1$
+ public static final String XMLELEMENT = "XMLELEMENT"; //$NON-NLS-1$
+ public static final String XMLFOREST = "XMLFOREST"; //$NON-NLS-1$
+ public static final String XMLNAMESPACES = "XMLNAMESPACES"; //$NON-NLS-1$
+ public static final String XMLPARSE = "XMLPARSE"; //$NON-NLS-1$
+ public static final String XMLPI = "XMLPI"; //$NON-NLS-1$
+ public static final String XMLROOT = "XMLROOT"; //$NON-NLS-1$
+ public static final String XMLSERIALIZE = "XMLSERIALIZE"; //$NON-NLS-1$
+
+ //SQL/MED
+
+ public static final String DATALINK = "DATALINK"; //$NON-NLS-1$
+ public static final String DLNEWCOPY = "DLNEWCOPY"; //$NON-NLS-1$
+ public static final String DLPREVIOUSCOPY = "DLPREVIOUSCOPY"; //$NON-NLS-1$
+ public static final String DLURLCOMPLETE = "DLURLCOMPLETE"; //$NON-NLS-1$
+ public static final String DLURLCOMPLETEWRITE = "DLURELCOMPLETEWRITE"; //$NON-NLS-1$
+ public static final String DLURLCOMPLETEONLY = "DLURLCOMPLETEONLY"; //$NON-NLS-1$
+ public static final String DLURLPATH = "DLURLPATH"; //$NON-NLS-1$
+ public static final String DLURLPATHWRITE = "DLURLPATHWRITE"; //$NON-NLS-1$
+ public static final String DLURLPATHONLY = "DLURLPATHONLY"; //$NON-NLS-1$
+ public static final String DLURLSCHEME = "DLURLSCHEME"; //$NON-NLS-1$
+ public static final String DLURLSERVER = "DLURLSEVER"; //$NON-NLS-1$
+ public static final String DLVALUE = "DLVALUE"; //$NON-NLS-1$
+ public static final String IMPORT = "XMLPI"; //$NON-NLS-1$
+
+ /**
+ * Set of CAPITALIZED reserved words for checking whether a string is a reserved word.
+ */
+ private static final Set<String> RESERVED_WORDS = new HashSet<String>();
+
+ // Initialize RESERVED_WORDS set - This is a poor man's enum. To much legacy code expects the constants to be Strings.
+ static {
+ Field[] fields = SQLReservedWords.class.getDeclaredFields();
+ for (Field field : fields) {
+ if (field.getType() == String.class) {
+ try {
+ RESERVED_WORDS.add((String)field.get(null));
+ } catch (Exception e) {
+ }
+ }
+ }
+ }
+
+ /** Can't construct */
+ private SQLReservedWords() {}
+
+ /**
+ * Check whether a string is a reserved word.
+ * @param str String to check
+ * @return True if reserved word, false if not or null
+ */
+ public static final boolean isReservedWord(String str) {
+ if(str == null) {
+ return false;
+ }
+ return RESERVED_WORDS.contains(str.toUpperCase());
+ }
+}
Copied: trunk/connector-api/src/main/java/org/teiid/connector/language/ScalarSubquery.java (from rev 1899, branches/JCA/connector-api/src/main/java/org/teiid/connector/language/ScalarSubquery.java)
===================================================================
--- trunk/connector-api/src/main/java/org/teiid/connector/language/ScalarSubquery.java (rev 0)
+++ trunk/connector-api/src/main/java/org/teiid/connector/language/ScalarSubquery.java 2010-03-04 20:47:34 UTC (rev 1913)
@@ -0,0 +1,60 @@
+/*
+ * 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.connector.language;
+
+import org.teiid.connector.visitor.framework.LanguageObjectVisitor;
+
+/**
+ * Represents a scalar subquery. That is, a query that is evaluated as a scalar
+ * expression and returns a single value. The inner subquery must return exactly
+ * 1 column as well.
+ */
+public class ScalarSubquery extends BaseLanguageObject implements Expression, SubqueryContainer {
+
+ private QueryExpression query;
+
+ public ScalarSubquery(QueryExpression query) {
+ this.query = query;
+ }
+
+ @Override
+ public QueryExpression getSubquery() {
+ return this.query;
+ }
+
+ @Override
+ public void setSubquery(QueryExpression query) {
+ this.query = query;
+ }
+
+ public void acceptVisitor(LanguageObjectVisitor visitor) {
+ visitor.visit(this);
+ }
+
+ @Override
+ public Class<?> getType() {
+ return query.getProjectedQuery().getDerivedColumns().get(0).getExpression().getType();
+ }
+
+
+}
Copied: trunk/connector-api/src/main/java/org/teiid/connector/language/SearchedCase.java (from rev 1899, branches/JCA/connector-api/src/main/java/org/teiid/connector/language/SearchedCase.java)
===================================================================
--- trunk/connector-api/src/main/java/org/teiid/connector/language/SearchedCase.java (rev 0)
+++ trunk/connector-api/src/main/java/org/teiid/connector/language/SearchedCase.java 2010-03-04 20:47:34 UTC (rev 1913)
@@ -0,0 +1,69 @@
+/*
+ * 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.connector.language;
+
+import java.util.List;
+
+import org.teiid.connector.visitor.framework.LanguageObjectVisitor;
+
+/**
+ * Represents a searched CASE expression:
+ * <br/> CASE WHEN criteria THEN expression ... END
+ */
+public class SearchedCase extends BaseLanguageObject implements Expression {
+
+ private List<SearchedWhenClause> cases;
+ private Expression elseExpression;
+ private Class<?> type;
+
+ public SearchedCase(List<SearchedWhenClause> cases, Expression elseExpression, Class<?> type) {
+ this.cases = cases;
+ this.elseExpression = elseExpression;
+ this.type = type;
+ }
+
+ public Expression getElseExpression() {
+ return elseExpression;
+ }
+
+ public List<SearchedWhenClause> getCases() {
+ return cases;
+ }
+
+ public void acceptVisitor(LanguageObjectVisitor visitor) {
+ visitor.visit(this);
+ }
+
+ public void setElseExpression(Expression expression) {
+ this.elseExpression = expression;
+ }
+
+ public Class<?> getType() {
+ return this.type;
+ }
+
+ public void setType(Class<?> type) {
+ this.type = type;
+ }
+
+}
Copied: trunk/connector-api/src/main/java/org/teiid/connector/language/SearchedWhenClause.java (from rev 1899, branches/JCA/connector-api/src/main/java/org/teiid/connector/language/SearchedWhenClause.java)
===================================================================
--- trunk/connector-api/src/main/java/org/teiid/connector/language/SearchedWhenClause.java (rev 0)
+++ trunk/connector-api/src/main/java/org/teiid/connector/language/SearchedWhenClause.java 2010-03-04 20:47:34 UTC (rev 1913)
@@ -0,0 +1,57 @@
+/*
+ * 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.connector.language;
+
+import org.teiid.connector.visitor.framework.LanguageObjectVisitor;
+
+public class SearchedWhenClause extends BaseLanguageObject {
+
+ private Condition condition;
+ private Expression result;
+
+ public SearchedWhenClause(Condition condition, Expression result) {
+ this.condition = condition;
+ this.result = result;
+ }
+
+ public Condition getCondition() {
+ return condition;
+ }
+
+ public Expression getResult() {
+ return result;
+ }
+
+ public void setCondition(Condition symbol) {
+ this.condition = symbol;
+ }
+
+ public void setResult(Expression value) {
+ this.result = value;
+ }
+
+ public void acceptVisitor(LanguageObjectVisitor visitor) {
+ visitor.visit(this);
+ }
+
+}
Copied: trunk/connector-api/src/main/java/org/teiid/connector/language/Select.java (from rev 1899, branches/JCA/connector-api/src/main/java/org/teiid/connector/language/Select.java)
===================================================================
--- trunk/connector-api/src/main/java/org/teiid/connector/language/Select.java (rev 0)
+++ trunk/connector-api/src/main/java/org/teiid/connector/language/Select.java 2010-03-04 20:47:34 UTC (rev 1913)
@@ -0,0 +1,139 @@
+/*
+ * 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.connector.language;
+
+import java.util.List;
+
+import org.teiid.connector.visitor.framework.LanguageObjectVisitor;
+
+/**
+ * Represents a simple SELECT query.
+ */
+public class Select extends QueryExpression {
+
+ private List<DerivedColumn> derivedColumns;
+ private boolean isDistinct;
+ private List<TableReference> from;
+ private Condition where;
+ private GroupBy groupBy;
+ private Condition having;
+
+ public Select(List<DerivedColumn> derivedColumns, boolean distinct, List<TableReference> from, Condition where,
+ GroupBy groupBy, Condition having, OrderBy orderBy) {
+ this.derivedColumns = derivedColumns;
+ this.isDistinct = distinct;
+ this.from = from;
+ this.where = where;
+ this.groupBy = groupBy;
+ this.having = having;
+ this.setOrderBy(orderBy);
+ }
+
+ public List<DerivedColumn> getDerivedColumns() {
+ return derivedColumns;
+ }
+
+ public boolean isDistinct() {
+ return this.isDistinct;
+ }
+
+ public void setDerivedColumns(List<DerivedColumn> symbols) {
+ this.derivedColumns = symbols;
+ }
+
+ public void setDistinct(boolean distinct) {
+ this.isDistinct = distinct;
+ }
+
+ /**
+ * Get FROM clause, should never be null.
+ * @return From clause object
+ */
+ public List<TableReference> getFrom() {
+ return from;
+ }
+
+ /**
+ * Get WHERE clause, may be null.
+ * @return A criteria object
+ */
+ public Condition getWhere() {
+ return where;
+ }
+
+ /**
+ * Get GROUP BY clause, may be null.
+ * @return A group by object
+ */
+ public GroupBy getGroupBy() {
+ return groupBy;
+ }
+
+ /**
+ * Get HAVING clause, may be null.
+ * @return A criteria object
+ */
+ public Condition getHaving() {
+ return having;
+ }
+
+ public void acceptVisitor(LanguageObjectVisitor visitor) {
+ visitor.visit(this);
+ }
+
+ /**
+ * Set FROM clause, should never be null.
+ * @param from From clause object
+ */
+ public void setFrom(List<TableReference> from) {
+ this.from = from;
+ }
+
+ /**
+ * Set WHERE clause, may be null.
+ * @param criteria A criteria object
+ */
+ public void setWhere(Condition criteria) {
+ this.where = criteria;
+ }
+
+ /**
+ * Set GROUP BY clause, may be null.
+ * @param groupBy A group by object
+ */
+ public void setGroupBy(GroupBy groupBy) {
+ this.groupBy = groupBy;
+ }
+
+ /**
+ * Set HAVING clause, may be null.
+ * @param criteria A criteria object
+ */
+ public void setHaving(Condition criteria) {
+ this.having = criteria;
+ }
+
+ public Select getProjectedQuery() {
+ return this;
+ }
+}
Copied: trunk/connector-api/src/main/java/org/teiid/connector/language/SetClause.java (from rev 1899, branches/JCA/connector-api/src/main/java/org/teiid/connector/language/SetClause.java)
===================================================================
--- trunk/connector-api/src/main/java/org/teiid/connector/language/SetClause.java (rev 0)
+++ trunk/connector-api/src/main/java/org/teiid/connector/language/SetClause.java 2010-03-04 20:47:34 UTC (rev 1913)
@@ -0,0 +1,57 @@
+/*
+ * 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.connector.language;
+
+import org.teiid.connector.visitor.framework.LanguageObjectVisitor;
+
+public class SetClause extends BaseLanguageObject {
+
+ private ColumnReference symbol;
+ private Expression value;
+
+ public SetClause(ColumnReference symbol, Expression value) {
+ this.symbol = symbol;
+ this.value = value;
+ }
+
+ public ColumnReference getSymbol() {
+ return symbol;
+ }
+
+ public Expression getValue() {
+ return value;
+ }
+
+ public void setSymbol(ColumnReference symbol) {
+ this.symbol = symbol;
+ }
+
+ public void setValue(Expression value) {
+ this.value = value;
+ }
+
+ public void acceptVisitor(LanguageObjectVisitor visitor) {
+ visitor.visit(this);
+ }
+
+}
Copied: trunk/connector-api/src/main/java/org/teiid/connector/language/SetQuery.java (from rev 1899, branches/JCA/connector-api/src/main/java/org/teiid/connector/language/SetQuery.java)
===================================================================
--- trunk/connector-api/src/main/java/org/teiid/connector/language/SetQuery.java (rev 0)
+++ trunk/connector-api/src/main/java/org/teiid/connector/language/SetQuery.java 2010-03-04 20:47:34 UTC (rev 1913)
@@ -0,0 +1,116 @@
+/*
+ * 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.connector.language;
+
+import org.teiid.connector.visitor.framework.LanguageObjectVisitor;
+
+public class SetQuery extends QueryExpression {
+
+ public enum Operation {
+ /** Represents UNION of two queries */
+ UNION,
+ /** Represents intersection of two queries */
+ INTERSECT,
+ /** Represents set difference of two queries */
+ EXCEPT
+ }
+
+ private boolean all;
+ private QueryExpression leftQuery;
+ private QueryExpression rightQuery;
+ private Operation operation;
+
+ /**
+ * @see org.teiid.connector.language.QueryExpression#getProjectedQuery()
+ */
+ public Select getProjectedQuery() {
+ if (leftQuery instanceof Select) {
+ return (Select)leftQuery;
+ }
+ return leftQuery.getProjectedQuery();
+ }
+
+ /**
+ * @see org.teiid.connector.language.SetQuery#getLeftQuery()
+ */
+ public QueryExpression getLeftQuery() {
+ return leftQuery;
+ }
+
+ /**
+ * @see org.teiid.connector.language.SetQuery#getOperation()
+ */
+ public Operation getOperation() {
+ return operation;
+ }
+
+ /**
+ * @see org.teiid.connector.language.SetQuery#getRightQuery()
+ */
+ public QueryExpression getRightQuery() {
+ return rightQuery;
+ }
+
+ /**
+ * @see org.teiid.connector.language.SetQuery#isAll()
+ */
+ public boolean isAll() {
+ return all;
+ }
+
+ /**
+ * @see org.teiid.connector.language.SetQuery#setAll(boolean)
+ */
+ public void setAll(boolean all) {
+ this.all = all;
+ }
+
+ /**
+ * @see org.teiid.connector.language.SetQuery#setLeftQuery(org.teiid.connector.language.QueryExpression)
+ */
+ public void setLeftQuery(QueryExpression leftQuery) {
+ this.leftQuery = leftQuery;
+ }
+
+ /**
+ * @see org.teiid.connector.language.SetQuery#setOperation(org.teiid.connector.language.SetQuery.Operation)
+ */
+ public void setOperation(Operation operation) {
+ this.operation = operation;
+ }
+
+ /**
+ * @see org.teiid.connector.language.SetQuery#setRightQuery(org.teiid.connector.language.QueryExpression)
+ */
+ public void setRightQuery(QueryExpression rightQuery) {
+ this.rightQuery = rightQuery;
+ }
+
+ /**
+ * @see org.teiid.connector.language.LanguageObject#acceptVisitor(com.metamatrix.data.visitor.LanguageObjectVisitor)
+ */
+ public void acceptVisitor(LanguageObjectVisitor visitor) {
+ visitor.visit(this);
+ }
+
+}
Copied: trunk/connector-api/src/main/java/org/teiid/connector/language/SortSpecification.java (from rev 1899, branches/JCA/connector-api/src/main/java/org/teiid/connector/language/SortSpecification.java)
===================================================================
--- trunk/connector-api/src/main/java/org/teiid/connector/language/SortSpecification.java (rev 0)
+++ trunk/connector-api/src/main/java/org/teiid/connector/language/SortSpecification.java 2010-03-04 20:47:34 UTC (rev 1913)
@@ -0,0 +1,62 @@
+/*
+ * 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.connector.language;
+
+import org.teiid.connector.visitor.framework.LanguageObjectVisitor;
+
+public class SortSpecification extends BaseLanguageObject {
+
+ public enum Ordering {
+ ASC,
+ DESC
+ }
+
+ private Ordering ordering;
+ private Expression expression;
+
+ public SortSpecification(Ordering direction, Expression expression) {
+ this.ordering = direction;
+ this.expression = expression;
+ }
+
+ public Ordering getOrdering() {
+ return ordering;
+ }
+
+ public void acceptVisitor(LanguageObjectVisitor visitor) {
+ visitor.visit(this);
+ }
+
+ public void setOrdering(Ordering direction) {
+ this.ordering = direction;
+ }
+
+ public Expression getExpression() {
+ return this.expression;
+ }
+
+ public void setExpression(Expression expression) {
+ this.expression = expression;
+ }
+
+}
Copied: trunk/connector-api/src/main/java/org/teiid/connector/language/SubqueryComparison.java (from rev 1899, branches/JCA/connector-api/src/main/java/org/teiid/connector/language/SubqueryComparison.java)
===================================================================
--- trunk/connector-api/src/main/java/org/teiid/connector/language/SubqueryComparison.java (rev 0)
+++ trunk/connector-api/src/main/java/org/teiid/connector/language/SubqueryComparison.java 2010-03-04 20:47:34 UTC (rev 1913)
@@ -0,0 +1,91 @@
+/*
+ * 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.connector.language;
+
+import org.teiid.connector.language.Comparison.Operator;
+import org.teiid.connector.visitor.framework.LanguageObjectVisitor;
+
+/**
+ * Represents a quantified comparison criteria. This criteria has an expression on the left,
+ * a comparison operator (such as =, <, etc), a quantification operator (ALL, ANY),
+ * and a subquery.
+ */
+public class SubqueryComparison extends Condition implements Predicate, SubqueryContainer {
+
+ public enum Quantifier {
+ SOME,
+ ALL
+ }
+
+ private Expression leftExpr;
+ private Operator operator;
+ private Quantifier quantifier;
+ private QueryExpression query;
+
+ /**
+ *
+ */
+ public SubqueryComparison(Expression leftExpr, Operator operator, Quantifier quantifier, QueryExpression query) {
+ this.leftExpr = leftExpr;
+ this.operator = operator;
+ this.quantifier = quantifier;
+ this.query = query;
+ }
+
+ public Expression getLeftExpression() {
+ return this.leftExpr;
+ }
+
+ public Operator getOperator() {
+ return this.operator;
+ }
+
+ public Quantifier getQuantifier() {
+ return this.quantifier;
+ }
+
+ public QueryExpression getSubquery() {
+ return this.query;
+ }
+
+ public void acceptVisitor(LanguageObjectVisitor visitor) {
+ visitor.visit(this);
+ }
+
+ public void setLeftExpression(Expression expression) {
+ this.leftExpr = expression;
+ }
+
+ public void setOperator(Operator operator) {
+ this.operator = operator;
+ }
+
+ public void setQuantifier(Quantifier quantifier) {
+ this.quantifier = quantifier;
+ }
+
+ public void setSubquery(QueryExpression query) {
+ this.query = query;
+ }
+
+}
Copied: trunk/connector-api/src/main/java/org/teiid/connector/language/SubqueryContainer.java (from rev 1899, branches/JCA/connector-api/src/main/java/org/teiid/connector/language/SubqueryContainer.java)
===================================================================
--- trunk/connector-api/src/main/java/org/teiid/connector/language/SubqueryContainer.java (rev 0)
+++ trunk/connector-api/src/main/java/org/teiid/connector/language/SubqueryContainer.java 2010-03-04 20:47:34 UTC (rev 1913)
@@ -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.connector.language;
+
+/**
+ * This is a marker interface for language interfaces that contain a subquery.
+ */
+public interface SubqueryContainer {
+
+ /**
+ * Get the inner subquery
+ * @return Subquery
+ */
+ QueryExpression getSubquery();
+
+ /**
+ * Set the inner subquery
+ * @param query Subquery
+ */
+ void setSubquery(QueryExpression query);
+
+}
Copied: trunk/connector-api/src/main/java/org/teiid/connector/language/SubqueryIn.java (from rev 1899, branches/JCA/connector-api/src/main/java/org/teiid/connector/language/SubqueryIn.java)
===================================================================
--- trunk/connector-api/src/main/java/org/teiid/connector/language/SubqueryIn.java (rev 0)
+++ trunk/connector-api/src/main/java/org/teiid/connector/language/SubqueryIn.java 2010-03-04 20:47:34 UTC (rev 1913)
@@ -0,0 +1,52 @@
+/*
+ * 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.connector.language;
+
+import org.teiid.connector.visitor.framework.LanguageObjectVisitor;
+
+/**
+ * Represents an IN criteria that uses a subquery on the right side rather than a
+ * list of values.
+ */
+public class SubqueryIn extends BaseInCondition implements SubqueryContainer {
+
+ private QueryExpression rightQuery;
+
+ public SubqueryIn(Expression leftExpr, boolean isNegated, QueryExpression rightQuery) {
+ super(leftExpr, isNegated);
+ this.rightQuery = rightQuery;
+ }
+
+ public QueryExpression getSubquery() {
+ return this.rightQuery;
+ }
+
+ public void acceptVisitor(LanguageObjectVisitor visitor) {
+ visitor.visit(this);
+ }
+
+ public void setSubquery(QueryExpression query) {
+ this.rightQuery = query;
+ }
+
+}
Copied: trunk/connector-api/src/main/java/org/teiid/connector/language/TableReference.java (from rev 1899, branches/JCA/connector-api/src/main/java/org/teiid/connector/language/TableReference.java)
===================================================================
--- trunk/connector-api/src/main/java/org/teiid/connector/language/TableReference.java (rev 0)
+++ trunk/connector-api/src/main/java/org/teiid/connector/language/TableReference.java 2010-03-04 20:47:34 UTC (rev 1913)
@@ -0,0 +1,30 @@
+/*
+ * 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.connector.language;
+
+/**
+ * Represents an item in the FROM clause
+ */
+public interface TableReference extends LanguageObject {
+
+}
Copied: trunk/connector-api/src/main/java/org/teiid/connector/language/Update.java (from rev 1899, branches/JCA/connector-api/src/main/java/org/teiid/connector/language/Update.java)
===================================================================
--- trunk/connector-api/src/main/java/org/teiid/connector/language/Update.java (rev 0)
+++ trunk/connector-api/src/main/java/org/teiid/connector/language/Update.java 2010-03-04 20:47:34 UTC (rev 1913)
@@ -0,0 +1,72 @@
+/*
+ * 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.connector.language;
+
+import java.util.List;
+
+import org.teiid.connector.visitor.framework.LanguageObjectVisitor;
+
+/**
+ * Represents an UPDATE command in the language objects.
+ */
+public class Update extends BaseLanguageObject implements Command {
+
+ private NamedTable table;
+ private List<SetClause> changes;
+ private Condition where;
+
+ public Update(NamedTable group, List<SetClause> changes, Condition criteria) {
+ this.table = group;
+ this.changes = changes;
+ this.where = criteria;
+ }
+
+ public NamedTable getTable() {
+ return table;
+ }
+
+ public List<SetClause> getChanges() {
+ return changes;
+ }
+
+ public Condition getWhere() {
+ return where;
+ }
+
+ public void acceptVisitor(LanguageObjectVisitor visitor) {
+ visitor.visit(this);
+ }
+
+ public void setTable(NamedTable group) {
+ this.table = group;
+ }
+
+ public void setChanges(List<SetClause> changes) {
+ this.changes = changes;
+ }
+
+ public void setWhere(Condition criteria) {
+ this.where = criteria;
+ }
+
+}
Modified: trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/AbstractMetadataRecord.java
===================================================================
--- trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/AbstractMetadataRecord.java 2010-03-04 20:22:20 UTC (rev 1912)
+++ trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/AbstractMetadataRecord.java 2010-03-04 20:47:34 UTC (rev 1913)
@@ -26,6 +26,7 @@
import java.util.Collections;
import java.util.LinkedHashMap;
import java.util.Map;
+import java.util.concurrent.atomic.AtomicLong;
import com.metamatrix.core.util.EquivalenceUtil;
@@ -33,8 +34,10 @@
* AbstractMetadataRecord
*/
public abstract class AbstractMetadataRecord implements Serializable {
-
- public final static char NAME_DELIM_CHAR = '.';
+
+ public final static char NAME_DELIM_CHAR = '.';
+
+ private static AtomicLong UUID_SEQUENCE = new AtomicLong();
private String uuid; //globally unique id
private String name; //contextually unique name
@@ -45,6 +48,9 @@
private String annotation;
public String getUUID() {
+ if (uuid == null) {
+ uuid = String.valueOf(UUID_SEQUENCE.getAndIncrement());
+ }
return uuid;
}
@@ -97,9 +103,9 @@
}
/**
- * Return the extension properties for this record - may be null
+ * Return the extension properties for this record - may be unmodifiable
* if {@link #setProperties(LinkedHashMap)} or {@link #setProperty(String, String)}
- * has not been called
+ * has not been called.
* @return
*/
public Map<String, String> getProperties() {
@@ -109,6 +115,11 @@
return properties;
}
+ /**
+ * The preferred setter for extension properties.
+ * @param key
+ * @param value
+ */
public void setProperty(String key, String value) {
if (this.properties == null) {
this.properties = new LinkedHashMap<String, String>();
@@ -146,7 +157,7 @@
}
public int hashCode() {
- return this.uuid.hashCode();
+ return getUUID().hashCode();
}
}
\ No newline at end of file
Modified: trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/BaseColumn.java
===================================================================
--- trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/BaseColumn.java 2010-03-04 20:22:20 UTC (rev 1912)
+++ trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/BaseColumn.java 2010-03-04 20:47:34 UTC (rev 1913)
@@ -22,6 +22,8 @@
package org.teiid.connector.metadata.runtime;
+import org.teiid.connector.api.TypeFacility;
+
public abstract class BaseColumn extends AbstractMetadataRecord {
public enum NullType {
@@ -57,6 +59,10 @@
public String getRuntimeType() {
return runtimeType;
}
+
+ public Class<?> getJavaType() {
+ return TypeFacility.getDataTypeClass(runtimeType);
+ }
public int getLength() {
return length;
@@ -128,5 +134,25 @@
public void setDatatype(Datatype datatype) {
this.datatype = datatype;
}
+
+ public String getDatatypeID() {
+ if (this.datatype != null) {
+ return this.datatype.getDatatypeID();
+ }
+ return null;
+ }
+
+ public String getBaseTypeID() {
+ if (this.datatype != null) {
+ return this.datatype.getBasetypeID();
+ }
+ return null;
+ }
+ public String getPrimitiveTypeID() {
+ if (this.datatype != null) {
+ return this.datatype.getPrimitiveTypeID();
+ }
+ return null;
+ }
}
Deleted: trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/Column.java
===================================================================
--- trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/Column.java 2010-03-04 20:22:20 UTC (rev 1912)
+++ trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/Column.java 2010-03-04 20:47:34 UTC (rev 1913)
@@ -1,250 +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.connector.metadata.runtime;
-
-
-/**
- * ColumnRecordImpl
- */
-public class Column extends BaseColumn implements Comparable<Column> {
-
- public enum SearchType {
- Unsearchable,
- Like_Only {
- @Override
- public String toString() {
- return "Like Only"; //$NON-NLS-1$
- }
- },
- All_Except_Like {
- @Override
- public String toString() {
- return "All Except Like"; //$NON-NLS-1$
- }
- },
- Searchable
- }
-
- private boolean selectable = true;
- private boolean updatable;
- private boolean autoIncrementable;
- private boolean caseSensitive;
- private boolean signed;
- private boolean currency;
- private boolean fixedLength;
- private SearchType searchType;
- private String minValue;
- private String maxValue;
- private String nativeType;
- private String format;
- private int charOctetLength;
- private int distinctValues = -1;
- private int nullValues = -1;
- private ColumnSet parent;
-
- public void setParent(ColumnSet parent) {
- this.parent = parent;
- }
-
- @Override
- public AbstractMetadataRecord getParent() {
- return parent;
- }
-
- @Override
- public int compareTo(Column record) {
- return this.getPosition() - record.getPosition();
- }
-
- public int getCharOctetLength() {
- return charOctetLength;
- }
-
- public String getMaxValue() {
- return maxValue;
- }
-
- public String getMinValue() {
- return minValue;
- }
-
- public SearchType getSearchType() {
- if (searchType == null) {
- return this.getDatatype().getSearchType();
- }
- return searchType;
- }
-
- public String getFormat() {
- return format;
- }
-
- public boolean isAutoIncrementable() {
- return autoIncrementable;
- }
-
- public boolean isCaseSensitive() {
- return caseSensitive;
- }
-
- public boolean isCurrency() {
- return currency;
- }
-
- public boolean isFixedLength() {
- return fixedLength;
- }
-
- public boolean isSelectable() {
- return selectable;
- }
-
- public boolean isSigned() {
- return signed;
- }
-
- public boolean isUpdatable() {
- return updatable;
- }
-
- public String getNativeType() {
- return nativeType;
- }
-
- public int getDistinctValues() {
- return this.distinctValues;
- }
-
- public int getNullValues() {
- return this.nullValues;
- }
-
- /**
- * @param b
- */
- public void setAutoIncrementable(boolean b) {
- autoIncrementable = b;
- }
-
- /**
- * @param b
- */
- public void setCaseSensitive(boolean b) {
- caseSensitive = b;
- }
-
- /**
- * @param i
- */
- public void setCharOctetLength(int i) {
- charOctetLength = i;
- }
-
- /**
- * @param b
- */
- public void setCurrency(boolean b) {
- currency = b;
- }
-
- /**
- * @param b
- */
- public void setFixedLength(boolean b) {
- fixedLength = b;
- }
-
- /**
- * @param object
- */
- public void setMaxValue(String object) {
- maxValue = object;
- }
-
- /**
- * @param object
- */
- public void setMinValue(String object) {
- minValue = object;
- }
-
- /**
- * @param s
- */
- public void setSearchType(SearchType s) {
- searchType = s;
- }
-
- /**
- * @param b
- */
- public void setSelectable(boolean b) {
- selectable = b;
- }
-
- /**
- * @param b
- */
- public void setSigned(boolean b) {
- signed = b;
- }
-
- /**
- * @param b
- */
- public void setUpdatable(boolean b) {
- updatable = b;
- }
-
- /**
- * @param string
- */
- public void setFormat(String string) {
- format = string;
- }
-
- /**
- * @param distinctValues The distinctValues to set.
- * @since 4.3
- */
- public void setDistinctValues(int distinctValues) {
- this.distinctValues = distinctValues;
- }
-
- /**
- * @param nullValues The nullValues to set.
- * @since 4.3
- */
- public void setNullValues(int nullValues) {
- this.nullValues = nullValues;
- }
-
- /**
- * @param nativeType The nativeType to set.
- * @since 4.2
- */
- public void setNativeType(String nativeType) {
- this.nativeType = nativeType;
- }
-
-}
\ No newline at end of file
Copied: trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/Column.java (from rev 1899, branches/JCA/connector-api/src/main/java/org/teiid/connector/metadata/runtime/Column.java)
===================================================================
--- trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/Column.java (rev 0)
+++ trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/Column.java 2010-03-04 20:47:34 UTC (rev 1913)
@@ -0,0 +1,250 @@
+/*
+ * 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.connector.metadata.runtime;
+
+
+/**
+ * ColumnRecordImpl
+ */
+public class Column extends BaseColumn implements Comparable<Column> {
+
+ public enum SearchType {
+ Unsearchable,
+ Like_Only {
+ @Override
+ public String toString() {
+ return "Like Only"; //$NON-NLS-1$
+ }
+ },
+ All_Except_Like {
+ @Override
+ public String toString() {
+ return "All Except Like"; //$NON-NLS-1$
+ }
+ },
+ Searchable
+ }
+
+ private boolean selectable = true;
+ private boolean updatable;
+ private boolean autoIncremented;
+ private boolean caseSensitive;
+ private boolean signed;
+ private boolean currency;
+ private boolean fixedLength;
+ private SearchType searchType;
+ private String minimumValue;
+ private String maximumValue;
+ private String nativeType;
+ private String format;
+ private int charOctetLength;
+ private int distinctValues = -1;
+ private int nullValues = -1;
+ private ColumnSet<?> parent;
+
+ public void setParent(ColumnSet<?> parent) {
+ this.parent = parent;
+ }
+
+ @Override
+ public AbstractMetadataRecord getParent() {
+ return parent;
+ }
+
+ @Override
+ public int compareTo(Column record) {
+ return this.getPosition() - record.getPosition();
+ }
+
+ public int getCharOctetLength() {
+ return charOctetLength;
+ }
+
+ public String getMaximumValue() {
+ return maximumValue;
+ }
+
+ public String getMinimumValue() {
+ return minimumValue;
+ }
+
+ public SearchType getSearchType() {
+ if (searchType == null) {
+ return this.getDatatype().getSearchType();
+ }
+ return searchType;
+ }
+
+ public String getFormat() {
+ return format;
+ }
+
+ public boolean isAutoIncremented() {
+ return autoIncremented;
+ }
+
+ public boolean isCaseSensitive() {
+ return caseSensitive;
+ }
+
+ public boolean isCurrency() {
+ return currency;
+ }
+
+ public boolean isFixedLength() {
+ return fixedLength;
+ }
+
+ public boolean isSelectable() {
+ return selectable;
+ }
+
+ public boolean isSigned() {
+ return signed;
+ }
+
+ public boolean isUpdatable() {
+ return updatable;
+ }
+
+ public String getNativeType() {
+ return nativeType;
+ }
+
+ public int getDistinctValues() {
+ return this.distinctValues;
+ }
+
+ public int getNullValues() {
+ return this.nullValues;
+ }
+
+ /**
+ * @param b
+ */
+ public void setAutoIncremented(boolean b) {
+ autoIncremented = b;
+ }
+
+ /**
+ * @param b
+ */
+ public void setCaseSensitive(boolean b) {
+ caseSensitive = b;
+ }
+
+ /**
+ * @param i
+ */
+ public void setCharOctetLength(int i) {
+ charOctetLength = i;
+ }
+
+ /**
+ * @param b
+ */
+ public void setCurrency(boolean b) {
+ currency = b;
+ }
+
+ /**
+ * @param b
+ */
+ public void setFixedLength(boolean b) {
+ fixedLength = b;
+ }
+
+ /**
+ * @param object
+ */
+ public void setMaximumValue(String object) {
+ maximumValue = object;
+ }
+
+ /**
+ * @param object
+ */
+ public void setMinimumValue(String object) {
+ minimumValue = object;
+ }
+
+ /**
+ * @param s
+ */
+ public void setSearchType(SearchType s) {
+ searchType = s;
+ }
+
+ /**
+ * @param b
+ */
+ public void setSelectable(boolean b) {
+ selectable = b;
+ }
+
+ /**
+ * @param b
+ */
+ public void setSigned(boolean b) {
+ signed = b;
+ }
+
+ /**
+ * @param b
+ */
+ public void setUpdatable(boolean b) {
+ updatable = b;
+ }
+
+ /**
+ * @param string
+ */
+ public void setFormat(String string) {
+ format = string;
+ }
+
+ /**
+ * @param distinctValues The distinctValues to set.
+ * @since 4.3
+ */
+ public void setDistinctValues(int distinctValues) {
+ this.distinctValues = distinctValues;
+ }
+
+ /**
+ * @param nullValues The nullValues to set.
+ * @since 4.3
+ */
+ public void setNullValues(int nullValues) {
+ this.nullValues = nullValues;
+ }
+
+ /**
+ * @param nativeType The nativeType to set.
+ * @since 4.2
+ */
+ public void setNativeType(String nativeType) {
+ this.nativeType = nativeType;
+ }
+
+}
\ No newline at end of file
Deleted: trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/ColumnSet.java
===================================================================
--- trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/ColumnSet.java 2010-03-04 20:22:20 UTC (rev 1912)
+++ trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/ColumnSet.java 2010-03-04 20:47:34 UTC (rev 1913)
@@ -1,53 +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.connector.metadata.runtime;
-
-import java.util.List;
-
-public class ColumnSet<T extends AbstractMetadataRecord> extends AbstractMetadataRecord {
-
- private List<Column> columns;
- private T parent;
-
- public List<Column> getColumns() {
- return columns;
- }
-
- public void addColumn(Column column) {
- columns.add(column);
- }
-
- public void setColumns(List<Column> columns) {
- this.columns = columns;
- }
-
- @Override
- public T getParent() {
- return parent;
- }
-
- public void setParent(T parent) {
- this.parent = parent;
- }
-
-}
\ No newline at end of file
Copied: trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/ColumnSet.java (from rev 1899, branches/JCA/connector-api/src/main/java/org/teiid/connector/metadata/runtime/ColumnSet.java)
===================================================================
--- trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/ColumnSet.java (rev 0)
+++ trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/ColumnSet.java 2010-03-04 20:47:34 UTC (rev 1913)
@@ -0,0 +1,57 @@
+/*
+ * 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.connector.metadata.runtime;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class ColumnSet<T extends AbstractMetadataRecord> extends AbstractMetadataRecord {
+
+ private List<Column> columns;
+ private T parent;
+
+ public List<Column> getColumns() {
+ return columns;
+ }
+
+ public void addColumn(Column column) {
+ if (columns == null) {
+ columns = new ArrayList<Column>();
+ }
+ columns.add(column);
+ }
+
+ public void setColumns(List<Column> columns) {
+ this.columns = columns;
+ }
+
+ @Override
+ public T getParent() {
+ return parent;
+ }
+
+ public void setParent(T parent) {
+ this.parent = parent;
+ }
+
+}
\ No newline at end of file
Deleted: trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/Datatype.java
===================================================================
--- trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/Datatype.java 2010-03-04 20:22:20 UTC (rev 1912)
+++ trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/Datatype.java 2010-03-04 20:47:34 UTC (rev 1913)
@@ -1,282 +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.connector.metadata.runtime;
-
-import org.teiid.connector.metadata.runtime.BaseColumn.NullType;
-import org.teiid.connector.metadata.runtime.Column.SearchType;
-
-
-
-/**
- * ColumnRecordImpl
- */
-public class Datatype extends AbstractMetadataRecord {
-
- public enum Type {
- Basic,
- UserDefined,
- ResultSet
- }
-
- public enum Variety {
- Atomic,
- List,
- Union,
- Complex
- }
-
- /** Delimiter used to separate the URI string from the URI fragment */
- public static final String URI_REFERENCE_DELIMITER = "#"; //$NON-NLS-1$
-
- private static final String DEFAULT_JAVA_CLASS_NAME = "java.lang.Object"; //$NON-NLS-1$
-
- private int length;
- private int precisionLength;
- private int scale;
- private int radix;
- private boolean isSigned;
- private boolean isAutoIncrement;
- private boolean isCaseSensitive;
- private Type type;
- private SearchType searchType;
- private NullType nullType;
- private String javaClassName = DEFAULT_JAVA_CLASS_NAME;
- private String runtimeTypeName;
- private String datatypeID;
- private String basetypeID;
- private String primitiveTypeID;
- private Variety varietyType;
-
- public int getLength() {
- return this.length;
- }
-
- public int getPrecisionLength() {
- return this.precisionLength;
- }
-
- public int getScale() {
- return this.scale;
- }
-
- public int getRadix() {
- return this.radix;
- }
-
- public boolean isSigned() {
- return this.isSigned;
- }
-
- public boolean isAutoIncrement() {
- return this.isAutoIncrement;
- }
-
- public boolean isCaseSensitive() {
- return this.isCaseSensitive;
- }
-
- public Type getType() {
- return this.type;
- }
-
- public boolean isBuiltin() {
- return getType() == Type.Basic;
- }
-
-
- public SearchType getSearchType() {
- return this.searchType;
- }
-
- public NullType getNullType() {
- if (this.nullType == null) {
- return NullType.Unknown;
- }
- return this.nullType;
- }
-
- public String getJavaClassName() {
- return this.javaClassName;
- }
-
- public String getRuntimeTypeName() {
- return this.runtimeTypeName;
- }
-
- public String getDatatypeID() {
- return this.datatypeID;
- }
-
- public String getBasetypeID() {
- return this.basetypeID;
- }
-
- public String getBasetypeName() {
- if ( this.basetypeID != null ) {
- final int i = getBasetypeID().lastIndexOf(URI_REFERENCE_DELIMITER);
- if ( i != -1 && getBasetypeID().length() > (i+1)) {
- return getBasetypeID().substring(i+1);
- }
- }
- return null;
- }
-
- public String getPrimitiveTypeID() {
- return this.primitiveTypeID;
- }
-
- public Variety getVarietyType() {
- return this.varietyType;
- }
-
- /**
- * @param string
- */
- public void setBasetypeID(String string) {
- basetypeID = string;
- }
-
- /**
- * @param string
- */
- public void setPrimitiveTypeID(String string) {
- primitiveTypeID = string;
- }
-
- /**
- * @param b
- */
- public void setAutoIncrement(boolean b) {
- isAutoIncrement = b;
- }
-
- /**
- * @param b
- */
- public void setCaseSensitive(boolean b) {
- isCaseSensitive = b;
- }
-
- /**
- * @param b
- */
- public void setSigned(boolean b) {
- isSigned = b;
- }
-
- /**
- * @param string
- */
- public void setJavaClassName(String string) {
- javaClassName = string;
- }
-
- /**
- * @param i
- */
- public void setLength(int i) {
- length = i;
- }
-
- /**
- * @param s
- */
- public void setNullType(NullType s) {
- nullType = s;
- }
-
- /**
- * @param i
- */
- public void setPrecisionLength(int i) {
- precisionLength = i;
- }
-
- /**
- * @param i
- */
- public void setRadix(int i) {
- radix = i;
- }
-
- /**
- * @param string
- */
- public void setRuntimeTypeName(String string) {
- runtimeTypeName = string;
- }
-
- /**
- * @param i
- */
- public void setScale(int i) {
- scale = i;
- }
-
- /**
- * @param s
- */
- public void setSearchType(SearchType s) {
- searchType = s;
- }
-
- /**
- * @param s
- */
- public void setType(Type s) {
- type = s;
- }
-
- /**
- * @param string
- */
- public void setDatatypeID(String string) {
- datatypeID = string;
- }
-
- /**
- * @param s
- */
- public void setVarietyType(Variety s) {
- varietyType = s;
- }
-
- public String toString() {
- StringBuffer sb = new StringBuffer(100);
- sb.append(getClass().getSimpleName());
- sb.append(" name="); //$NON-NLS-1$
- sb.append(getName());
- sb.append(", basetype name="); //$NON-NLS-1$
- sb.append(getBasetypeName());
- sb.append(", runtimeType="); //$NON-NLS-1$
- sb.append(getRuntimeTypeName());
- sb.append(", javaClassName="); //$NON-NLS-1$
- sb.append(getJavaClassName());
- sb.append(", ObjectID="); //$NON-NLS-1$
- sb.append(getUUID());
- sb.append(", datatypeID="); //$NON-NLS-1$
- sb.append(getDatatypeID());
- return sb.toString();
- }
-
-}
\ No newline at end of file
Copied: trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/Datatype.java (from rev 1899, branches/JCA/connector-api/src/main/java/org/teiid/connector/metadata/runtime/Datatype.java)
===================================================================
--- trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/Datatype.java (rev 0)
+++ trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/Datatype.java 2010-03-04 20:47:34 UTC (rev 1913)
@@ -0,0 +1,282 @@
+/*
+ * 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.connector.metadata.runtime;
+
+import org.teiid.connector.metadata.runtime.BaseColumn.NullType;
+import org.teiid.connector.metadata.runtime.Column.SearchType;
+
+
+
+/**
+ * ColumnRecordImpl
+ */
+public class Datatype extends AbstractMetadataRecord {
+
+ public enum Type {
+ Basic,
+ UserDefined,
+ ResultSet
+ }
+
+ public enum Variety {
+ Atomic,
+ List,
+ Union,
+ Complex
+ }
+
+ /** Delimiter used to separate the URI string from the URI fragment */
+ public static final String URI_REFERENCE_DELIMITER = "#"; //$NON-NLS-1$
+
+ private static final String DEFAULT_JAVA_CLASS_NAME = "java.lang.Object"; //$NON-NLS-1$
+
+ private int length;
+ private int precisionLength;
+ private int scale;
+ private int radix;
+ private boolean isSigned;
+ private boolean isAutoIncrement;
+ private boolean isCaseSensitive;
+ private Type type;
+ private SearchType searchType;
+ private NullType nullType;
+ private String javaClassName = DEFAULT_JAVA_CLASS_NAME;
+ private String runtimeTypeName;
+ private String datatypeID;
+ private String basetypeID;
+ private String primitiveTypeID;
+ private Variety varietyType;
+
+ public int getLength() {
+ return this.length;
+ }
+
+ public int getPrecisionLength() {
+ return this.precisionLength;
+ }
+
+ public int getScale() {
+ return this.scale;
+ }
+
+ public int getRadix() {
+ return this.radix;
+ }
+
+ public boolean isSigned() {
+ return this.isSigned;
+ }
+
+ public boolean isAutoIncrement() {
+ return this.isAutoIncrement;
+ }
+
+ public boolean isCaseSensitive() {
+ return this.isCaseSensitive;
+ }
+
+ public Type getType() {
+ return this.type;
+ }
+
+ public boolean isBuiltin() {
+ return getType() == Type.Basic;
+ }
+
+
+ public SearchType getSearchType() {
+ return this.searchType;
+ }
+
+ public NullType getNullType() {
+ if (this.nullType == null) {
+ return NullType.Unknown;
+ }
+ return this.nullType;
+ }
+
+ public String getJavaClassName() {
+ return this.javaClassName;
+ }
+
+ public String getRuntimeTypeName() {
+ return this.runtimeTypeName;
+ }
+
+ public String getDatatypeID() {
+ return this.datatypeID;
+ }
+
+ public String getBasetypeID() {
+ return this.basetypeID;
+ }
+
+ public String getBasetypeName() {
+ if ( this.basetypeID != null ) {
+ final int i = getBasetypeID().lastIndexOf(URI_REFERENCE_DELIMITER);
+ if ( i != -1 && getBasetypeID().length() > (i+1)) {
+ return getBasetypeID().substring(i+1);
+ }
+ }
+ return null;
+ }
+
+ public String getPrimitiveTypeID() {
+ return this.primitiveTypeID;
+ }
+
+ public Variety getVarietyType() {
+ return this.varietyType;
+ }
+
+ /**
+ * @param string
+ */
+ public void setBasetypeID(String string) {
+ basetypeID = string;
+ }
+
+ /**
+ * @param string
+ */
+ public void setPrimitiveTypeID(String string) {
+ primitiveTypeID = string;
+ }
+
+ /**
+ * @param b
+ */
+ public void setAutoIncrement(boolean b) {
+ isAutoIncrement = b;
+ }
+
+ /**
+ * @param b
+ */
+ public void setCaseSensitive(boolean b) {
+ isCaseSensitive = b;
+ }
+
+ /**
+ * @param b
+ */
+ public void setSigned(boolean b) {
+ isSigned = b;
+ }
+
+ /**
+ * @param string
+ */
+ public void setJavaClassName(String string) {
+ javaClassName = string;
+ }
+
+ /**
+ * @param i
+ */
+ public void setLength(int i) {
+ length = i;
+ }
+
+ /**
+ * @param s
+ */
+ public void setNullType(NullType s) {
+ nullType = s;
+ }
+
+ /**
+ * @param i
+ */
+ public void setPrecisionLength(int i) {
+ precisionLength = i;
+ }
+
+ /**
+ * @param i
+ */
+ public void setRadix(int i) {
+ radix = i;
+ }
+
+ /**
+ * @param string
+ */
+ public void setRuntimeTypeName(String string) {
+ runtimeTypeName = string;
+ }
+
+ /**
+ * @param i
+ */
+ public void setScale(int i) {
+ scale = i;
+ }
+
+ /**
+ * @param s
+ */
+ public void setSearchType(SearchType s) {
+ searchType = s;
+ }
+
+ /**
+ * @param s
+ */
+ public void setType(Type s) {
+ type = s;
+ }
+
+ /**
+ * @param string
+ */
+ public void setDatatypeID(String string) {
+ datatypeID = string;
+ }
+
+ /**
+ * @param s
+ */
+ public void setVarietyType(Variety s) {
+ varietyType = s;
+ }
+
+ public String toString() {
+ StringBuffer sb = new StringBuffer(100);
+ sb.append(getClass().getSimpleName());
+ sb.append(" name="); //$NON-NLS-1$
+ sb.append(getName());
+ sb.append(", basetype name="); //$NON-NLS-1$
+ sb.append(getBasetypeName());
+ sb.append(", runtimeType="); //$NON-NLS-1$
+ sb.append(getRuntimeTypeName());
+ sb.append(", javaClassName="); //$NON-NLS-1$
+ sb.append(getJavaClassName());
+ sb.append(", ObjectID="); //$NON-NLS-1$
+ sb.append(getUUID());
+ sb.append(", datatypeID="); //$NON-NLS-1$
+ sb.append(getDatatypeID());
+ return sb.toString();
+ }
+
+}
\ No newline at end of file
Deleted: trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/Element.java
===================================================================
--- trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/Element.java 2010-03-04 20:22:20 UTC (rev 1912)
+++ trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/Element.java 2010-03-04 20:47:34 UTC (rev 1913)
@@ -1,109 +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.
- */
-
-/*
- * Date: Aug 18, 2003
- * Time: 11:58:05 AM
- */
-package org.teiid.connector.metadata.runtime;
-
-import org.teiid.connector.api.ConnectorException;
-
-/**
- * Represents an element, such as a column, in runtime metadata.
- */
-public interface Element extends MetadataObject, TypeModel {
-
- /**
- * Get position of this element in it's group.
- * @return Position, 0-based
- * @throws ConnectorException If an error occurs retrieving the data
- * from runtime metadata
- */
- int getPosition() throws ConnectorException;
-
- /**
- * Get minimum value
- * @return Minimum value, may be null
- * @throws ConnectorException If an error occurs retrieving the data
- * from runtime metadata
- */
- Object getMinimumValue() throws ConnectorException;
-
- /**
- * Get maximum value
- * @return Maximum value, may be null
- * @throws ConnectorException If an error occurs retrieving the data
- * from runtime metadata
- */
- Object getMaximumValue() throws ConnectorException;
-
- /**
- * Is auto-incremented?
- * @return True if auto-incremented, false otherwise
- * @throws ConnectorException If an error occurs retrieving the data
- * from runtime metadata
- */
- boolean isAutoIncremented() throws ConnectorException;
-
- /**
- * Get searchability of this column.
- * @return Code indicating searchability
- * @throws ConnectorException If an error occurs retrieving the data
- * from runtime metadata
- * @see #NOT_SEARCHABLE
- * @see #SEARCHABLE
- * @see #SEARCHABLE_COMPARE
- * @see #SEARCHABLE_LIKE
- */
- int getSearchability() throws ConnectorException;
-
- /**
- * Is case sensitive?
- * @return True if case sensitive, false otherwise
- * @throws ConnectorException If an error occurs retrieving the data
- * from runtime metadata
- */
- boolean isCaseSensitive() throws ConnectorException;
-
- /**
- * Get the native type imported for this column.
- * @return The native type, may be null
- * @throws ConnectorException If an error occurs retrieving the data
- * @since 4.2
- */
- String getNativeType() throws ConnectorException;
-
- /**
- * Get the Format property
- * @return
- * @throws ConnectorException
- */
- String getFormat() throws ConnectorException;
-
- /**
- * Get the parent
- * @return Parent
- */
- Group getParent() throws ConnectorException;
-
-}
Deleted: trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/ForeignKey.java
===================================================================
--- trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/ForeignKey.java 2010-03-04 20:22:20 UTC (rev 1912)
+++ trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/ForeignKey.java 2010-03-04 20:47:34 UTC (rev 1913)
@@ -1,55 +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.connector.metadata.runtime;
-
-/**
- * ForeignKeyRecordImpl
- */
-public class ForeignKey extends KeyRecord {
-
- private String uniqueKeyID;
- private KeyRecord primaryKey;
-
- public ForeignKey() {
- super(Type.Foreign);
- }
-
- public String getUniqueKeyID() {
- return uniqueKeyID;
- }
-
- /**
- * @param object
- */
- public void setUniqueKeyID(String keyID) {
- uniqueKeyID = keyID;
- }
-
- public KeyRecord getPrimaryKey() {
- return this.primaryKey;
- }
-
- public void setPrimaryKey(KeyRecord primaryKey) {
- this.primaryKey = primaryKey;
- }
-}
\ No newline at end of file
Copied: trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/ForeignKey.java (from rev 1899, branches/JCA/connector-api/src/main/java/org/teiid/connector/metadata/runtime/ForeignKey.java)
===================================================================
--- trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/ForeignKey.java (rev 0)
+++ trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/ForeignKey.java 2010-03-04 20:47:34 UTC (rev 1913)
@@ -0,0 +1,55 @@
+/*
+ * 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.connector.metadata.runtime;
+
+/**
+ * ForeignKeyRecordImpl
+ */
+public class ForeignKey extends KeyRecord {
+
+ private String uniqueKeyID;
+ private KeyRecord primaryKey;
+
+ public ForeignKey() {
+ super(Type.Foreign);
+ }
+
+ public String getUniqueKeyID() {
+ return uniqueKeyID;
+ }
+
+ /**
+ * @param object
+ */
+ public void setUniqueKeyID(String keyID) {
+ uniqueKeyID = keyID;
+ }
+
+ public KeyRecord getPrimaryKey() {
+ return this.primaryKey;
+ }
+
+ public void setPrimaryKey(KeyRecord primaryKey) {
+ this.primaryKey = primaryKey;
+ }
+}
\ No newline at end of file
Deleted: trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/Group.java
===================================================================
--- trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/Group.java 2010-03-04 20:22:20 UTC (rev 1912)
+++ trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/Group.java 2010-03-04 20:47:34 UTC (rev 1913)
@@ -1,37 +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.connector.metadata.runtime;
-
-import java.util.List;
-
-import org.teiid.connector.api.ConnectorException;
-
-
-/**
- * Represents a group, such as a table, in the runtime metadata.
- */
-public interface Group extends MetadataObject {
-
- List<Element> getChildren() throws ConnectorException;
-
-}
Deleted: trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/KeyRecord.java
===================================================================
--- trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/KeyRecord.java 2010-03-04 20:22:20 UTC (rev 1912)
+++ trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/KeyRecord.java 2010-03-04 20:47:34 UTC (rev 1913)
@@ -1,50 +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.connector.metadata.runtime;
-
-public class KeyRecord extends ColumnSet<Table> {
-
- public enum Type {
- Primary,
- Foreign,
- Unique, //constraint
- NonUnique,
- AccessPattern,
- Index,
- }
-
- private Type type;
-
- public KeyRecord(Type type) {
- this.type = type;
- }
-
- public Type getType() {
- return type;
- }
-
- public Table getTable() {
- return super.getParent();
- }
-
-}
Copied: trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/KeyRecord.java (from rev 1899, branches/JCA/connector-api/src/main/java/org/teiid/connector/metadata/runtime/KeyRecord.java)
===================================================================
--- trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/KeyRecord.java (rev 0)
+++ trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/KeyRecord.java 2010-03-04 20:47:34 UTC (rev 1913)
@@ -0,0 +1,46 @@
+/*
+ * 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.connector.metadata.runtime;
+
+public class KeyRecord extends ColumnSet<Table> {
+
+ public enum Type {
+ Primary,
+ Foreign,
+ Unique, //constraint
+ NonUnique,
+ AccessPattern,
+ Index,
+ }
+
+ private Type type;
+
+ public KeyRecord(Type type) {
+ this.type = type;
+ }
+
+ public Type getType() {
+ return type;
+ }
+
+}
Modified: trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/MetadataFactory.java
===================================================================
--- trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/MetadataFactory.java 2010-03-04 20:22:20 UTC (rev 1912)
+++ trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/MetadataFactory.java 2010-03-04 20:47:34 UTC (rev 1913)
@@ -50,11 +50,11 @@
public MetadataFactory(String modelName, Map<String, Datatype> dataTypes, Properties importProperties) {
this.dataTypes = dataTypes;
- this.importProperties = importProperties;
schema = new Schema();
schema.setName(modelName);
setUUID(schema);
store.addSchema(schema);
+ this.importProperties = importProperties;
}
public MetadataStore getMetadataStore() {
@@ -79,11 +79,6 @@
Table table = new Table();
table.setTableType(Table.Type.Table);
table.setName(name);
- table.setColumns(new LinkedList<Column>());
- table.setAccessPatterns(new LinkedList<KeyRecord>());
- table.setIndexes(new LinkedList<KeyRecord>());
- table.setForiegnKeys(new LinkedList<ForeignKey>());
- table.setUniqueKeys(new LinkedList<KeyRecord>());
setUUID(table);
this.schema.addTable(table);
return table;
@@ -103,14 +98,13 @@
}
Column column = new Column();
column.setName(name);
- table.getColumns().add(column);
+ table.addColumn(column);
column.setPosition(table.getColumns().size()); //1 based indexing
Datatype datatype = setColumnType(type, column);
column.setCaseSensitive(datatype.isCaseSensitive());
- column.setAutoIncrementable(datatype.isAutoIncrement());
+ column.setAutoIncremented(datatype.isAutoIncrement());
column.setSigned(datatype.isSigned());
setUUID(column);
- column.setParent(table);
return column;
}
@@ -218,8 +212,8 @@
* @return
* @throws ConnectorException
*/
- public ProcedureRecordImpl addProcedure(String name) throws ConnectorException {
- ProcedureRecordImpl procedure = new ProcedureRecordImpl();
+ public Procedure addProcedure(String name) throws ConnectorException {
+ Procedure procedure = new Procedure();
procedure.setName(name);
setUUID(procedure);
procedure.setParameters(new LinkedList<ProcedureParameter>());
@@ -236,7 +230,7 @@
* @return
* @throws ConnectorException
*/
- public ProcedureParameter addProcedureParameter(String name, String type, ProcedureParameter.Type parameterType, ProcedureRecordImpl procedure) throws ConnectorException {
+ public ProcedureParameter addProcedureParameter(String name, String type, ProcedureParameter.Type parameterType, Procedure procedure) throws ConnectorException {
ProcedureParameter param = new ProcedureParameter();
param.setName(name);
setUUID(param);
@@ -256,9 +250,9 @@
* @return
* @throws ConnectorException
*/
- public Column addProcedureResultSetColumn(String name, String type, ProcedureRecordImpl procedure) throws ConnectorException {
+ public Column addProcedureResultSetColumn(String name, String type, Procedure procedure) throws ConnectorException {
if (procedure.getResultSet() == null) {
- ColumnSet<ProcedureRecordImpl> resultSet = new ColumnSet<ProcedureRecordImpl>();
+ ColumnSet<Procedure> resultSet = new ColumnSet<Procedure>();
resultSet.setParent(procedure);
resultSet.setName("RSParam"); //$NON-NLS-1$
setUUID(resultSet);
@@ -283,5 +277,4 @@
}
}
}
-
}
Deleted: trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/MetadataObject.java
===================================================================
--- trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/MetadataObject.java 2010-03-04 20:22:20 UTC (rev 1912)
+++ trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/MetadataObject.java 2010-03-04 20:47:34 UTC (rev 1913)
@@ -1,63 +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.connector.metadata.runtime;
-
-import java.util.Properties;
-
-import org.teiid.connector.api.ConnectorException;
-
-
-/**
- * Represents a runtime metadata object.
- */
-public interface MetadataObject {
-
- /**
- * Get name in source for this object, as provided in the model
- * @return Name in source
- * @throws ConnectorException If an error occurs retrieving the data
- * from runtime metadata
- */
- String getNameInSource() throws ConnectorException;
-
- /**
- * Get any arbitrary properties that are provided on this object.
- * Typically these properties are provided via metamodel extensions.
- * @return Properties
- * @throws ConnectorException If an error occurs retrieving the data
- * from runtime metadata
- */
- Properties getProperties() throws ConnectorException;
-
- /**
- * Get the short name from the metadataID
- * @return String shortName
- */
- String getName();
-
- /**
- * Get the full name from the metadataID
- * @return String fullName
- */
- String getFullName();
-}
Deleted: trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/MetadataStore.java
===================================================================
--- trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/MetadataStore.java 2010-03-04 20:22:20 UTC (rev 1912)
+++ trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/MetadataStore.java 2010-03-04 20:47:34 UTC (rev 1913)
@@ -1,60 +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.connector.metadata.runtime;
-
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.LinkedHashMap;
-import java.util.Map;
-
-/**
- * Simple holder for metadata.
- */
-public class MetadataStore implements Serializable {
-
- private static final long serialVersionUID = -3130247626435324312L;
- protected Map<String, Schema> schemas = new LinkedHashMap<String, Schema>();
- protected Collection<Datatype> datatypes = new ArrayList<Datatype>();
-
- public Map<String, Schema> getSchemas() {
- return schemas;
- }
-
- public void addSchema(Schema schema) {
- this.schemas.put(schema.getName().toLowerCase(), schema);
- }
-
- public void addDatatype(Datatype datatype) {
- this.datatypes.add(datatype);
- }
-
- /**
- * Get the datatypes defined in this store
- * @return
- */
- public Collection<Datatype> getDatatypes() {
- return datatypes;
- }
-
-}
Copied: trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/MetadataStore.java (from rev 1899, branches/JCA/connector-api/src/main/java/org/teiid/connector/metadata/runtime/MetadataStore.java)
===================================================================
--- trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/MetadataStore.java (rev 0)
+++ trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/MetadataStore.java 2010-03-04 20:47:34 UTC (rev 1913)
@@ -0,0 +1,60 @@
+/*
+ * 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.connector.metadata.runtime;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.LinkedHashMap;
+import java.util.Map;
+
+/**
+ * Simple holder for metadata.
+ */
+public class MetadataStore implements Serializable {
+
+ private static final long serialVersionUID = -3130247626435324312L;
+ protected Map<String, Schema> schemas = new LinkedHashMap<String, Schema>();
+ protected Collection<Datatype> datatypes = new ArrayList<Datatype>();
+
+ public Map<String, Schema> getSchemas() {
+ return schemas;
+ }
+
+ public void addSchema(Schema schema) {
+ this.schemas.put(schema.getName().toLowerCase(), schema);
+ }
+
+ public void addDatatype(Datatype datatype) {
+ this.datatypes.add(datatype);
+ }
+
+ /**
+ * Get the datatypes defined in this store
+ * @return
+ */
+ public Collection<Datatype> getDatatypes() {
+ return datatypes;
+ }
+
+}
Deleted: trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/Parameter.java
===================================================================
--- trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/Parameter.java 2010-03-04 20:22:20 UTC (rev 1912)
+++ trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/Parameter.java 2010-03-04 20:47:34 UTC (rev 1913)
@@ -1,67 +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.connector.metadata.runtime;
-
-import java.util.List;
-
-import org.teiid.connector.api.ConnectorException;
-
-
-/**
- * Represents a procedure parameter in the runtime metadata.
- */
-public interface Parameter extends MetadataObject, TypeModel {
-
- public static final int IN = 0;
- public static final int OUT = 1;
- public static final int INOUT = 2;
- public static final int RETURN = 3;
- public static final int RESULT_SET = 4;
-
- /**
- * Index of the parameter in the procedure. If the parameter has
- * no index, then the index will be returned as -1.
- * @return Index of the parameter
- */
- int getIndex() throws ConnectorException;
-
- /**
- * Get direction of the parameter, as specified by direction constants.
- * @return Direction constant
- * @see #IN
- * @see #OUT
- * @see #INOUT
- * @see #RETURN
- * @see #RESULT_SET
- */
- int getDirection() throws ConnectorException;
-
- /**
- * Get the parent
- * @return Parent
- */
- Procedure getParent() throws ConnectorException;
-
- List<Element> getChildren() throws ConnectorException;
-
-}
Deleted: trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/Procedure.java
===================================================================
--- trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/Procedure.java 2010-03-04 20:22:20 UTC (rev 1912)
+++ trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/Procedure.java 2010-03-04 20:47:34 UTC (rev 1913)
@@ -1,33 +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.connector.metadata.runtime;
-
-import java.util.List;
-
-/**
- * Represents a procedure construct (such as a Stored Procedure).
- */
-public interface Procedure extends MetadataObject{
-
- List<Parameter> getChildren();
-}
Copied: trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/Procedure.java (from rev 1899, branches/JCA/connector-api/src/main/java/org/teiid/connector/metadata/runtime/Procedure.java)
===================================================================
--- trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/Procedure.java (rev 0)
+++ trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/Procedure.java 2010-03-04 20:47:34 UTC (rev 1913)
@@ -0,0 +1,129 @@
+/*
+ * 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.connector.metadata.runtime;
+
+import java.util.LinkedList;
+import java.util.List;
+
+
+/**
+ * ProcedureRecordImpl
+ */
+public class Procedure extends AbstractMetadataRecord {
+
+ public enum Type {
+ Function,
+ UDF,
+ StoredProc,
+ StoredQuery
+ }
+
+ private boolean isFunction;
+ private boolean isVirtual;
+ private int updateCount = 1;
+ private List<ProcedureParameter> parameters = new LinkedList<ProcedureParameter>();
+ private ColumnSet<Procedure> resultSet;
+ private String queryPlan;
+
+ private Schema parent;
+
+ public void setParent(Schema parent) {
+ this.parent = parent;
+ }
+
+ public boolean isFunction() {
+ return isFunction;
+ }
+
+ public boolean isVirtual() {
+ return this.isVirtual;
+ }
+
+ public Type getType() {
+ if (isFunction()) {
+ if (isVirtual()) {
+ return Type.UDF;
+ }
+ return Type.Function;
+ }
+ if (isVirtual()) {
+ return Type.StoredQuery;
+ }
+ return Type.StoredProc;
+ }
+
+ public int getUpdateCount() {
+ return this.updateCount;
+ }
+
+ public List<ProcedureParameter> getParameters() {
+ return parameters;
+ }
+
+ public void setParameters(List<ProcedureParameter> parameters) {
+ this.parameters = parameters;
+ }
+
+ public String getQueryPlan() {
+ return queryPlan;
+ }
+
+ public void setQueryPlan(String queryPlan) {
+ this.queryPlan = queryPlan;
+ }
+
+ /**
+ * @param b
+ */
+ public void setFunction(boolean b) {
+ isFunction = b;
+ }
+
+ /**
+ * @param b
+ */
+ public void setVirtual(boolean b) {
+ isVirtual = b;
+ }
+
+ public void setUpdateCount(int count) {
+ this.updateCount = count;
+ }
+
+ public void setResultSet(ColumnSet<Procedure> resultSet) {
+ this.resultSet = resultSet;
+ if (resultSet != null) {
+ resultSet.setParent(this);
+ }
+ }
+
+ public ColumnSet<Procedure> getResultSet() {
+ return resultSet;
+ }
+
+ @Override
+ public Schema getParent() {
+ return parent;
+ }
+
+}
\ No newline at end of file
Deleted: trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/ProcedureParameter.java
===================================================================
--- trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/ProcedureParameter.java 2010-03-04 20:22:20 UTC (rev 1912)
+++ trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/ProcedureParameter.java 2010-03-04 20:47:34 UTC (rev 1913)
@@ -1,73 +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.connector.metadata.runtime;
-
-
-/**
- * ProcedureParameterRecordImpl
- */
-public class ProcedureParameter extends BaseColumn {
-
- public enum Type {
- Unknown,
- In,
- InOut,
- ResultSet,
- Out,
- ReturnValue
- }
-
- private Type type;
- private boolean optional;
- private ProcedureRecordImpl procedure;
-
- public void setType(Type type) {
- this.type = type;
- }
-
- public Type getType() {
- return type;
- }
-
- public void setOptional(boolean optional) {
- this.optional = optional;
- }
-
- public boolean isOptional() {
- return optional;
- }
-
- public ProcedureRecordImpl getProcedure() {
- return procedure;
- }
-
- public void setProcedure(ProcedureRecordImpl procedure) {
- this.procedure = procedure;
- }
-
- @Override
- public AbstractMetadataRecord getParent() {
- return this.procedure;
- }
-
-}
\ No newline at end of file
Copied: trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/ProcedureParameter.java (from rev 1899, branches/JCA/connector-api/src/main/java/org/teiid/connector/metadata/runtime/ProcedureParameter.java)
===================================================================
--- trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/ProcedureParameter.java (rev 0)
+++ trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/ProcedureParameter.java 2010-03-04 20:47:34 UTC (rev 1913)
@@ -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.connector.metadata.runtime;
+
+import java.util.Collections;
+import java.util.List;
+
+
+/**
+ * ProcedureParameterRecordImpl
+ */
+public class ProcedureParameter extends BaseColumn {
+
+ public enum Type {
+ Unknown,
+ In,
+ InOut,
+ ResultSet,
+ Out,
+ ReturnValue
+ }
+
+ private Type type;
+ private boolean optional;
+ private Procedure procedure;
+
+ public void setType(Type type) {
+ this.type = type;
+ }
+
+ public Type getType() {
+ return type;
+ }
+
+ public void setOptional(boolean optional) {
+ this.optional = optional;
+ }
+
+ public boolean isOptional() {
+ return optional;
+ }
+
+ public void setProcedure(Procedure procedure) {
+ this.procedure = procedure;
+ }
+
+ @Override
+ public Procedure getParent() {
+ return this.procedure;
+ }
+
+ /**
+ * Get the result set columns only if this parameter represents a result set.
+ * @return
+ */
+ public List<Column> getResultSetColumns() {
+ if (this.type == Type.ResultSet) {
+ return this.procedure.getResultSet().getColumns();
+ }
+ return Collections.emptyList();
+ }
+
+}
\ No newline at end of file
Deleted: trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/ProcedureRecordImpl.java
===================================================================
--- trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/ProcedureRecordImpl.java 2010-03-04 20:22:20 UTC (rev 1912)
+++ trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/ProcedureRecordImpl.java 2010-03-04 20:47:34 UTC (rev 1913)
@@ -1,129 +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.connector.metadata.runtime;
-
-import java.util.List;
-
-
-/**
- * ProcedureRecordImpl
- */
-public class ProcedureRecordImpl extends AbstractMetadataRecord {
-
- public enum Type {
- Function,
- UDF,
- StoredProc,
- StoredQuery
- }
-
- private boolean isFunction;
- private boolean isVirtual;
- private int updateCount = 1;
- private List<ProcedureParameter> parameters;
- private ColumnSet<ProcedureRecordImpl> resultSet;
- private String queryPlan;
-
- private Schema schema;
-
- public Schema getSchema() {
- return schema;
- }
-
- public void setSchema(Schema schema) {
- this.schema = schema;
- }
-
- public boolean isFunction() {
- return isFunction;
- }
-
- public boolean isVirtual() {
- return this.isVirtual;
- }
-
- public Type getType() {
- if (isFunction()) {
- if (isVirtual()) {
- return Type.UDF;
- }
- return Type.Function;
- }
- if (isVirtual()) {
- return Type.StoredQuery;
- }
- return Type.StoredProc;
- }
-
- public int getUpdateCount() {
- return this.updateCount;
- }
-
- public List<ProcedureParameter> getParameters() {
- return parameters;
- }
-
- public void setParameters(List<ProcedureParameter> parameters) {
- this.parameters = parameters;
- }
-
- public String getQueryPlan() {
- return queryPlan;
- }
-
- public void setQueryPlan(String queryPlan) {
- this.queryPlan = queryPlan;
- }
-
- /**
- * @param b
- */
- public void setFunction(boolean b) {
- isFunction = b;
- }
-
- /**
- * @param b
- */
- public void setVirtual(boolean b) {
- isVirtual = b;
- }
-
- public void setUpdateCount(int count) {
- this.updateCount = count;
- }
-
- public void setResultSet(ColumnSet<ProcedureRecordImpl> resultSet) {
- this.resultSet = resultSet;
- }
-
- public ColumnSet<ProcedureRecordImpl> getResultSet() {
- return resultSet;
- }
-
- @Override
- public AbstractMetadataRecord getParent() {
- return schema;
- }
-
-}
\ No newline at end of file
Modified: trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/RuntimeMetadata.java
===================================================================
--- trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/RuntimeMetadata.java 2010-03-04 20:22:20 UTC (rev 1912)
+++ trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/RuntimeMetadata.java 2010-03-04 20:47:34 UTC (rev 1913)
@@ -34,14 +34,14 @@
* @param fullName
* @return The object
*/
- Group getGroup(String fullName) throws ConnectorException;
+ Table getGroup(String fullName) throws ConnectorException;
/**
* Look up an object by identifier
* @param fullName
* @return The object
*/
- Element getElement(String fullName) throws ConnectorException;
+ Column getElement(String fullName) throws ConnectorException;
/**
* Look up an object by identifier
Deleted: trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/Schema.java
===================================================================
--- trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/Schema.java 2010-03-04 20:22:20 UTC (rev 1912)
+++ trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/Schema.java 2010-03-04 20:47:34 UTC (rev 1913)
@@ -1,93 +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.connector.metadata.runtime;
-
-import java.util.LinkedHashMap;
-import java.util.Map;
-
-public class Schema extends AbstractMetadataRecord {
-
- private boolean physical = true;
- private boolean isVisible = true;
- private String primaryMetamodelUri = "http://www.metamatrix.com/metamodels/Relational"; //$NON-NLS-1$
-
- private Map<String, Table> tables = new LinkedHashMap<String, Table>();
- private Map<String, ProcedureRecordImpl> procedures = new LinkedHashMap<String, ProcedureRecordImpl>();
-
- public void addTable(Table table) {
- table.setParent(this);
- this.tables.put(table.getName().toLowerCase(), table);
- }
-
- public void addProcedure(ProcedureRecordImpl procedure) {
- procedure.setSchema(this);
- this.procedures.put(procedure.getName().toLowerCase(), procedure);
- }
-
- /**
- * Get the tables defined in this schema
- * @return
- */
- public Map<String, Table> getTables() {
- return tables;
- }
-
- /**
- * Get the procedures defined in this schema
- * @return
- */
- public Map<String, ProcedureRecordImpl> getProcedures() {
- return procedures;
- }
-
- public String getPrimaryMetamodelUri() {
- return primaryMetamodelUri;
- }
-
- public boolean isVisible() {
- return isVisible;
- }
-
- public boolean isPhysical() {
- return physical;
- }
-
- /**
- * @param string
- */
- public void setPrimaryMetamodelUri(String string) {
- primaryMetamodelUri = string;
- }
-
- /**
- * @param b
- */
- public void setVisible(boolean b) {
- isVisible = b;
- }
-
- public void setPhysical(boolean physical) {
- this.physical = physical;
- }
-
-}
Copied: trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/Schema.java (from rev 1899, branches/JCA/connector-api/src/main/java/org/teiid/connector/metadata/runtime/Schema.java)
===================================================================
--- trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/Schema.java (rev 0)
+++ trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/Schema.java 2010-03-04 20:47:34 UTC (rev 1913)
@@ -0,0 +1,93 @@
+/*
+ * 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.connector.metadata.runtime;
+
+import java.util.LinkedHashMap;
+import java.util.Map;
+
+public class Schema extends AbstractMetadataRecord {
+
+ private boolean physical = true;
+ private boolean isVisible = true;
+ private String primaryMetamodelUri = "http://www.metamatrix.com/metamodels/Relational"; //$NON-NLS-1$
+
+ private Map<String, Table> tables = new LinkedHashMap<String, Table>();
+ private Map<String, Procedure> procedures = new LinkedHashMap<String, Procedure>();
+
+ public void addTable(Table table) {
+ table.setParent(this);
+ this.tables.put(table.getName().toLowerCase(), table);
+ }
+
+ public void addProcedure(Procedure procedure) {
+ procedure.setParent(this);
+ this.procedures.put(procedure.getName().toLowerCase(), procedure);
+ }
+
+ /**
+ * Get the tables defined in this schema
+ * @return
+ */
+ public Map<String, Table> getTables() {
+ return tables;
+ }
+
+ /**
+ * Get the procedures defined in this schema
+ * @return
+ */
+ public Map<String, Procedure> getProcedures() {
+ return procedures;
+ }
+
+ public String getPrimaryMetamodelUri() {
+ return primaryMetamodelUri;
+ }
+
+ public boolean isVisible() {
+ return isVisible;
+ }
+
+ public boolean isPhysical() {
+ return physical;
+ }
+
+ /**
+ * @param string
+ */
+ public void setPrimaryMetamodelUri(String string) {
+ primaryMetamodelUri = string;
+ }
+
+ /**
+ * @param b
+ */
+ public void setVisible(boolean b) {
+ isVisible = b;
+ }
+
+ public void setPhysical(boolean physical) {
+ this.physical = physical;
+ }
+
+}
Deleted: trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/Table.java
===================================================================
--- trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/Table.java 2010-03-04 20:22:20 UTC (rev 1912)
+++ trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/Table.java 2010-03-04 20:47:34 UTC (rev 1913)
@@ -1,270 +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.connector.metadata.runtime;
-
-import java.util.Collection;
-import java.util.LinkedList;
-import java.util.List;
-
-/**
- * TableRecordImpl
- */
-public class Table extends ColumnSet<Schema> {
-
- public enum Type {
- Table,
- View,
- Document,
- XmlMappingClass,
- XmlStagingTable,
- MaterializedTable
- }
-
- private int cardinality;
- private Type tableType;
- private boolean isVirtual;
- private boolean isSystem;
- private boolean isMaterialized;
- private boolean supportsUpdate;
- private List<ForeignKey> foriegnKeys;
- private List<KeyRecord> indexes;
- private List<KeyRecord> uniqueKeys;
- private List<KeyRecord> accessPatterns;
- private KeyRecord primaryKey;
-
- //view information
- private String selectTransformation;
- private String insertPlan;
- private String updatePlan;
- private String deletePlan;
- private Table materializedStageTable;
- private Table materializedTable;
-
- //XML specific
- private List<String> bindings;
- private List<String> schemaPaths;
- private String resourcePath;
-
- public Schema getSchema() {
- return super.getParent();
- }
-
- public List<String> getBindings() {
- return bindings;
- }
-
- public void setBindings(List<String> bindings) {
- this.bindings = bindings;
- }
-
- public List<String> getSchemaPaths() {
- return schemaPaths;
- }
-
- public void setSchemaPaths(List<String> schemaPaths) {
- this.schemaPaths = schemaPaths;
- }
-
- public int getCardinality() {
- return cardinality;
- }
-
- public boolean isVirtual() {
- return isVirtual;
- }
-
- public boolean isMaterialized() {
- return isMaterialized;
- }
-
- public boolean isPhysical() {
- return !isVirtual();
- }
-
- public boolean isSystem() {
- return isSystem;
- }
-
- public Type getTableType() {
- if (tableType == null) {
- return Type.Table;
- }
- return tableType;
- }
-
- public boolean supportsUpdate() {
- return supportsUpdate;
- }
-
- /**
- * @param i
- */
- public void setCardinality(int i) {
- cardinality = i;
- }
-
- /**
- * @param i
- */
- public void setTableType(Type i) {
- tableType = i;
- }
-
- /**
- * @param b
- */
- public void setSupportsUpdate(boolean b) {
- supportsUpdate = b;
- }
-
- /**
- * @param b
- */
- public void setVirtual(boolean b) {
- isVirtual = b;
- }
-
- /**
- * @param isMaterialized The isMaterialized to set.
- * @since 4.2
- */
- public void setMaterialized(boolean isMaterialized) {
- this.isMaterialized = isMaterialized;
- }
-
- /**
- * @param b
- */
- public void setSystem(boolean b) {
- isSystem = b;
- }
-
- public String getInsertPlan() {
- return insertPlan;
- }
-
- public String getUpdatePlan() {
- return updatePlan;
- }
-
- public String getDeletePlan() {
- return deletePlan;
- }
-
- public void setInsertPlan(String insertPlan) {
- this.insertPlan = insertPlan;
- }
-
- public void setUpdatePlan(String updatePlan) {
- this.updatePlan = updatePlan;
- }
-
- public void setDeletePlan(String deletePlan) {
- this.deletePlan = deletePlan;
- }
-
- public List<ForeignKey> getForeignKeys() {
- return this.foriegnKeys;
- }
-
- public void setForiegnKeys(List<ForeignKey> foriegnKeys) {
- this.foriegnKeys = foriegnKeys;
- }
-
- public List<KeyRecord> getIndexes() {
- return this.indexes;
- }
-
- public void setIndexes(List<KeyRecord> indexes) {
- this.indexes = indexes;
- }
-
- public List<KeyRecord> getUniqueKeys() {
- return this.uniqueKeys;
- }
-
- public void setUniqueKeys(List<KeyRecord> uniqueKeys) {
- this.uniqueKeys = uniqueKeys;
- }
-
- public List<KeyRecord> getAccessPatterns() {
- return this.accessPatterns;
- }
-
- public void setAccessPatterns(List<KeyRecord> accessPatterns) {
- this.accessPatterns = accessPatterns;
- }
-
- public KeyRecord getPrimaryKey() {
- return this.primaryKey;
- }
-
- public void setPrimaryKey(KeyRecord primaryKey) {
- this.primaryKey = primaryKey;
- }
-
- public String getSelectTransformation() {
- return selectTransformation;
- }
-
- public void setSelectTransformation(String selectTransformation) {
- this.selectTransformation = selectTransformation;
- }
-
- public Table getMaterializedStageTable() {
- return materializedStageTable;
- }
-
- public Table getMaterializedTable() {
- return materializedTable;
- }
-
- public void setMaterializedStageTable(Table materializedStageTable) {
- this.materializedStageTable = materializedStageTable;
- }
-
- public void setMaterializedTable(Table materializedTable) {
- this.materializedTable = materializedTable;
- }
-
- public void setResourcePath(String resourcePath) {
- this.resourcePath = resourcePath;
- }
-
- public String getResourcePath() {
- return resourcePath;
- }
-
- public Collection<KeyRecord> getAllKeys() {
- Collection<KeyRecord> keys = new LinkedList<KeyRecord>();
- if (getPrimaryKey() != null) {
- keys.add(getPrimaryKey());
- }
- keys.addAll(getForeignKeys());
- keys.addAll(getAccessPatterns());
- keys.addAll(getIndexes());
- keys.addAll(getUniqueKeys());
- return keys;
- }
-
-}
\ No newline at end of file
Copied: trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/Table.java (from rev 1899, branches/JCA/connector-api/src/main/java/org/teiid/connector/metadata/runtime/Table.java)
===================================================================
--- trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/Table.java (rev 0)
+++ trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/Table.java 2010-03-04 20:47:34 UTC (rev 1913)
@@ -0,0 +1,272 @@
+/*
+ * 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.connector.metadata.runtime;
+
+import java.util.Collection;
+import java.util.LinkedList;
+import java.util.List;
+
+/**
+ * TableRecordImpl
+ */
+public class Table extends ColumnSet<Schema> {
+
+ public enum Type {
+ Table,
+ View,
+ Document,
+ XmlMappingClass,
+ XmlStagingTable,
+ MaterializedTable
+ }
+
+ private int cardinality;
+ private Type tableType;
+ private boolean isVirtual;
+ private boolean isSystem;
+ private boolean isMaterialized;
+ private boolean supportsUpdate;
+ private List<ForeignKey> foriegnKeys = new LinkedList<ForeignKey>();
+ private List<KeyRecord> indexes = new LinkedList<KeyRecord>();
+ private List<KeyRecord> uniqueKeys = new LinkedList<KeyRecord>();
+ private List<KeyRecord> accessPatterns = new LinkedList<KeyRecord>();
+ private KeyRecord primaryKey;
+
+ //view information
+ private String selectTransformation;
+ private String insertPlan;
+ private String updatePlan;
+ private String deletePlan;
+ private Table materializedStageTable;
+ private Table materializedTable;
+
+ //XML specific
+ private List<String> bindings;
+ private List<String> schemaPaths;
+ private String resourcePath;
+
+ public List<String> getBindings() {
+ return bindings;
+ }
+
+ public void setBindings(List<String> bindings) {
+ this.bindings = bindings;
+ }
+
+ public List<String> getSchemaPaths() {
+ return schemaPaths;
+ }
+
+ public void setSchemaPaths(List<String> schemaPaths) {
+ this.schemaPaths = schemaPaths;
+ }
+
+ public int getCardinality() {
+ return cardinality;
+ }
+
+ public boolean isVirtual() {
+ return isVirtual;
+ }
+
+ public boolean isMaterialized() {
+ return isMaterialized;
+ }
+
+ public boolean isPhysical() {
+ return !isVirtual();
+ }
+
+ public boolean isSystem() {
+ return isSystem;
+ }
+
+ public Type getTableType() {
+ if (tableType == null) {
+ return Type.Table;
+ }
+ return tableType;
+ }
+
+ public boolean supportsUpdate() {
+ return supportsUpdate;
+ }
+
+ /**
+ * @param i
+ */
+ public void setCardinality(int i) {
+ cardinality = i;
+ }
+
+ /**
+ * @param i
+ */
+ public void setTableType(Type i) {
+ tableType = i;
+ }
+
+ /**
+ * @param b
+ */
+ public void setSupportsUpdate(boolean b) {
+ supportsUpdate = b;
+ }
+
+ /**
+ * @param b
+ */
+ public void setVirtual(boolean b) {
+ isVirtual = b;
+ }
+
+ /**
+ * @param isMaterialized The isMaterialized to set.
+ * @since 4.2
+ */
+ public void setMaterialized(boolean isMaterialized) {
+ this.isMaterialized = isMaterialized;
+ }
+
+ /**
+ * @param b
+ */
+ public void setSystem(boolean b) {
+ isSystem = b;
+ }
+
+ public String getInsertPlan() {
+ return insertPlan;
+ }
+
+ public String getUpdatePlan() {
+ return updatePlan;
+ }
+
+ public String getDeletePlan() {
+ return deletePlan;
+ }
+
+ public void setInsertPlan(String insertPlan) {
+ this.insertPlan = insertPlan;
+ }
+
+ public void setUpdatePlan(String updatePlan) {
+ this.updatePlan = updatePlan;
+ }
+
+ public void setDeletePlan(String deletePlan) {
+ this.deletePlan = deletePlan;
+ }
+
+ public List<ForeignKey> getForeignKeys() {
+ return this.foriegnKeys;
+ }
+
+ public void setForiegnKeys(List<ForeignKey> foriegnKeys) {
+ this.foriegnKeys = foriegnKeys;
+ }
+
+ public List<KeyRecord> getIndexes() {
+ return this.indexes;
+ }
+
+ public void setIndexes(List<KeyRecord> indexes) {
+ this.indexes = indexes;
+ }
+
+ public List<KeyRecord> getUniqueKeys() {
+ return this.uniqueKeys;
+ }
+
+ public void setUniqueKeys(List<KeyRecord> uniqueKeys) {
+ this.uniqueKeys = uniqueKeys;
+ }
+
+ public List<KeyRecord> getAccessPatterns() {
+ return this.accessPatterns;
+ }
+
+ public void setAccessPatterns(List<KeyRecord> accessPatterns) {
+ this.accessPatterns = accessPatterns;
+ }
+
+ public KeyRecord getPrimaryKey() {
+ return this.primaryKey;
+ }
+
+ public void setPrimaryKey(KeyRecord primaryKey) {
+ this.primaryKey = primaryKey;
+ }
+
+ public String getSelectTransformation() {
+ return selectTransformation;
+ }
+
+ public void setSelectTransformation(String selectTransformation) {
+ this.selectTransformation = selectTransformation;
+ }
+
+ public Table getMaterializedStageTable() {
+ return materializedStageTable;
+ }
+
+ public Table getMaterializedTable() {
+ return materializedTable;
+ }
+
+ public void setMaterializedStageTable(Table materializedStageTable) {
+ this.materializedStageTable = materializedStageTable;
+ }
+
+ public void setMaterializedTable(Table materializedTable) {
+ this.materializedTable = materializedTable;
+ }
+
+ public void setResourcePath(String resourcePath) {
+ this.resourcePath = resourcePath;
+ }
+
+ public String getResourcePath() {
+ return resourcePath;
+ }
+
+ public Collection<KeyRecord> getAllKeys() {
+ Collection<KeyRecord> keys = new LinkedList<KeyRecord>();
+ if (getPrimaryKey() != null) {
+ keys.add(getPrimaryKey());
+ }
+ keys.addAll(getForeignKeys());
+ keys.addAll(getAccessPatterns());
+ keys.addAll(getIndexes());
+ keys.addAll(getUniqueKeys());
+ return keys;
+ }
+
+ @Override
+ public void addColumn(Column column) {
+ super.addColumn(column);
+ column.setParent(this);
+ }
+
+}
\ No newline at end of file
Deleted: trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/TypeModel.java
===================================================================
--- trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/TypeModel.java 2010-03-04 20:22:20 UTC (rev 1912)
+++ trunk/connector-api/src/main/java/org/teiid/connector/metadata/runtime/TypeModel.java 2010-03-04 20:47:34 UTC (rev 1913)
@@ -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.connector.metadata.runtime;
-
-import org.teiid.connector.api.ConnectorException;
-
-
-/**
- * @since 4.3
- */
-public interface TypeModel {
-
- /**
- * Nullability constant - indicates column does not allow nulls
- */
- public static final int NOT_NULLABLE = 0;
- /**
- * Searchability constant - indicates column is not searchable (cannot be evaluated in a comparison).
- */
- public static final int NOT_SEARCHABLE = 0;
- /**
- * Nullability constant - indicates column does allow nulls
- */
- public static final int NULLABLE = 1;
- /**
- * Nullability constant - indicates column may or may not allow nulls
- */
- public static final int NULLABLE_UNKNOWN = 2;
- /**
- * Searchability constant - indicates column can be searched by either a comparison or a LIKE.
- */
- public static final int SEARCHABLE = 3;
- /**
- * Searchability constant - indicates column can be searched with a comparison but not with a LIKE
- */
- public static final int SEARCHABLE_COMPARE = 1;
- /**
- * Searchability constant - indicates column can be searched with a LIKE but not with a comparison
- */
- public static final int SEARCHABLE_LIKE = 2;
- /**
- * Get the expected Java class that should be returned for this element.
- * @return Data type as Java class
- * @throws ConnectorException If an error occurs retrieving the data
- * from runtime metadata
- */
- Class<?> getJavaType() throws ConnectorException;
-
- /**
- * Get nullability of this column.
- * @return Code indicating nullability
- * @throws ConnectorException If an error occurs retrieving the data
- * from runtime metadata
- * @see #NOT_NULLABLE
- * @see #NULLABLE
- * @see #NULLABLE_UNKNOWN
- */
- int getNullability() throws ConnectorException;
-
- /**
- * Get default value of this element.
- * @return Default value, may be null
- * @throws ConnectorException If an error occurs retrieving the data
- * from runtime metadata
- */
- Object getDefaultValue() throws ConnectorException;
-
- /**
- * Get length of this element or 0 if no length is available.
- * @return Length of this element
- * @throws ConnectorException If an error occurs retrieving the data
- * from runtime metadata
- */
- int getLength() throws ConnectorException;
-
- /**
- * Get precision of this column.
- * @return Precision
- * @throws ConnectorException If an error occurs retrieving the data
- * from runtime metadata
- * @since 4.2
- */
- int getPrecision() throws ConnectorException;
-
- /**
- * Get scale of this column.
- * @return Scale
- * @throws ConnectorException If an error occurs retrieving the data
- * from runtime metadata
- * @since 4.3.2
- */
- int getScale() throws ConnectorException;
-
- /**
- * Get the design-time model type name.
- * @return Model type name
- * @throws ConnectorException If an error occurs retrieving the data
- * from runtime metadata
- * @since 5.0
- */
- String getModeledType() throws ConnectorException;
-
- /**
- * Get the base type of the design-time model type name.
- * @return Model base type name
- * @throws ConnectorException If an error occurs retrieving the data
- * from runtime metadata
- * @since 5.0
- */
- String getModeledBaseType() throws ConnectorException;
-
- /**
- * Get the primitive type of the design-time model type name.
- * @return Model primitive type name
- * @throws ConnectorException If an error occurs retrieving the data
- * from runtime metadata
- * @since 5.0
- */
- String getModeledPrimitiveType() throws ConnectorException;
-
-}
Modified: trunk/connector-api/src/main/java/org/teiid/connector/visitor/framework/AbstractLanguageVisitor.java
===================================================================
--- trunk/connector-api/src/main/java/org/teiid/connector/visitor/framework/AbstractLanguageVisitor.java 2010-03-04 20:22:20 UTC (rev 1912)
+++ trunk/connector-api/src/main/java/org/teiid/connector/visitor/framework/AbstractLanguageVisitor.java 2010-03-04 20:47:34 UTC (rev 1913)
@@ -24,43 +24,41 @@
import java.util.Collection;
-import org.teiid.connector.language.IAggregate;
-import org.teiid.connector.language.IBatchedUpdates;
-import org.teiid.connector.language.ICompareCriteria;
-import org.teiid.connector.language.ICompoundCriteria;
-import org.teiid.connector.language.IDelete;
-import org.teiid.connector.language.IElement;
-import org.teiid.connector.language.IExistsCriteria;
-import org.teiid.connector.language.IFrom;
-import org.teiid.connector.language.IFunction;
-import org.teiid.connector.language.IGroup;
-import org.teiid.connector.language.IGroupBy;
-import org.teiid.connector.language.IInCriteria;
-import org.teiid.connector.language.IInlineView;
-import org.teiid.connector.language.IInsert;
-import org.teiid.connector.language.IInsertExpressionValueSource;
-import org.teiid.connector.language.IIsNullCriteria;
-import org.teiid.connector.language.IJoin;
-import org.teiid.connector.language.ILanguageObject;
-import org.teiid.connector.language.ILikeCriteria;
-import org.teiid.connector.language.ILimit;
-import org.teiid.connector.language.ILiteral;
-import org.teiid.connector.language.INotCriteria;
-import org.teiid.connector.language.IOrderBy;
-import org.teiid.connector.language.IOrderByItem;
-import org.teiid.connector.language.IParameter;
-import org.teiid.connector.language.IProcedure;
-import org.teiid.connector.language.IQuery;
-import org.teiid.connector.language.IScalarSubquery;
-import org.teiid.connector.language.ISearchedCaseExpression;
-import org.teiid.connector.language.ISelect;
-import org.teiid.connector.language.ISelectSymbol;
-import org.teiid.connector.language.ISetClause;
-import org.teiid.connector.language.ISetClauseList;
-import org.teiid.connector.language.ISetQuery;
-import org.teiid.connector.language.ISubqueryCompareCriteria;
-import org.teiid.connector.language.ISubqueryInCriteria;
-import org.teiid.connector.language.IUpdate;
+import org.teiid.connector.language.AggregateFunction;
+import org.teiid.connector.language.AndOr;
+import org.teiid.connector.language.Argument;
+import org.teiid.connector.language.BatchedUpdates;
+import org.teiid.connector.language.Call;
+import org.teiid.connector.language.ColumnReference;
+import org.teiid.connector.language.Comparison;
+import org.teiid.connector.language.Delete;
+import org.teiid.connector.language.DerivedColumn;
+import org.teiid.connector.language.DerivedTable;
+import org.teiid.connector.language.Exists;
+import org.teiid.connector.language.ExpressionValueSource;
+import org.teiid.connector.language.Function;
+import org.teiid.connector.language.GroupBy;
+import org.teiid.connector.language.In;
+import org.teiid.connector.language.Insert;
+import org.teiid.connector.language.IsNull;
+import org.teiid.connector.language.Join;
+import org.teiid.connector.language.LanguageObject;
+import org.teiid.connector.language.Like;
+import org.teiid.connector.language.Limit;
+import org.teiid.connector.language.Literal;
+import org.teiid.connector.language.NamedTable;
+import org.teiid.connector.language.Not;
+import org.teiid.connector.language.OrderBy;
+import org.teiid.connector.language.ScalarSubquery;
+import org.teiid.connector.language.SearchedCase;
+import org.teiid.connector.language.SearchedWhenClause;
+import org.teiid.connector.language.Select;
+import org.teiid.connector.language.SetClause;
+import org.teiid.connector.language.SetQuery;
+import org.teiid.connector.language.SortSpecification;
+import org.teiid.connector.language.SubqueryComparison;
+import org.teiid.connector.language.SubqueryIn;
+import org.teiid.connector.language.Update;
/**
@@ -82,7 +80,7 @@
* @see HierarchyVisitor
* @param obj an ILanguageObject instance
*/
- public void visitNode(ILanguageObject obj) {
+ public void visitNode(LanguageObject obj) {
if (obj != null) {
obj.acceptVisitor(this);
}
@@ -93,9 +91,9 @@
* can be used by subclasses to visit each ILanguageObject in the Collection
* @param nodes a Collection of ILanguageObjects
*/
- public void visitNodes(Collection<? extends ILanguageObject> nodes) {
+ public void visitNodes(Collection<? extends LanguageObject> nodes) {
if (nodes != null && nodes.size() > 0) {
- for (ILanguageObject node : nodes) {
+ for (LanguageObject node : nodes) {
visitNode(node);
}
}
@@ -106,7 +104,7 @@
* subclasses to visit each ILanguageObject in the array.
* @param nodes an ILanguageObject[]
*/
- public void visitNodes(ILanguageObject[] nodes) {
+ public void visitNodes(LanguageObject[] nodes) {
if (nodes != null && nodes.length > 0) {
for (int i = 0; i < nodes.length; i++) {
visitNode(nodes[i]);
@@ -114,40 +112,38 @@
}
}
- public void visit(IAggregate obj) {}
- public void visit(IBatchedUpdates obj) {}
- public void visit(ICompareCriteria obj) {}
- public void visit(ICompoundCriteria obj) {}
- public void visit(IDelete obj) {}
- public void visit(IElement obj) {}
- public void visit(IProcedure obj) {}
- public void visit(IExistsCriteria obj) {}
- public void visit(IFrom obj) {}
- public void visit(IFunction obj) {}
- public void visit(IGroup obj) {}
- public void visit(IGroupBy obj) {}
- public void visit(IInCriteria obj) {}
- public void visit(IInlineView obj) {}
- public void visit(IInsert obj) {}
- public void visit(IInsertExpressionValueSource obj) {}
- public void visit(IIsNullCriteria obj) {}
- public void visit(IJoin obj) {}
- public void visit(ILikeCriteria obj) {}
- public void visit(ILimit obj) {}
- public void visit(ILiteral obj) {}
- public void visit(INotCriteria obj) {}
- public void visit(IOrderBy obj) {}
- public void visit(IOrderByItem obj) {}
- public void visit(IParameter obj) {}
- public void visit(IQuery obj) {}
- public void visit(IScalarSubquery obj) {}
- public void visit(ISearchedCaseExpression obj) {}
- public void visit(ISelect obj) {}
- public void visit(ISelectSymbol obj) {}
- public void visit(ISubqueryCompareCriteria obj) {}
- public void visit(ISubqueryInCriteria obj) {}
- public void visit(IUpdate obj) {}
- public void visit(ISetQuery obj) {}
- public void visit(ISetClauseList obj) {}
- public void visit(ISetClause obj) {}
+ public void visit(AggregateFunction obj) {}
+ public void visit(BatchedUpdates obj) {}
+ public void visit(Comparison obj) {}
+ public void visit(AndOr obj) {}
+ public void visit(Delete obj) {}
+ public void visit(ColumnReference obj) {}
+ public void visit(Call obj) {}
+ public void visit(Exists obj) {}
+ public void visit(Function obj) {}
+ public void visit(NamedTable obj) {}
+ public void visit(GroupBy obj) {}
+ public void visit(In obj) {}
+ public void visit(DerivedTable obj) {}
+ public void visit(Insert obj) {}
+ public void visit(ExpressionValueSource obj) {}
+ public void visit(IsNull obj) {}
+ public void visit(Join obj) {}
+ public void visit(Like obj) {}
+ public void visit(Limit obj) {}
+ public void visit(Literal obj) {}
+ public void visit(Not obj) {}
+ public void visit(OrderBy obj) {}
+ public void visit(SortSpecification obj) {}
+ public void visit(Argument obj) {}
+ public void visit(Select obj) {}
+ public void visit(ScalarSubquery obj) {}
+ public void visit(SearchedCase obj) {}
+ public void visit(DerivedColumn obj) {}
+ public void visit(SubqueryComparison obj) {}
+ public void visit(SubqueryIn obj) {}
+ public void visit(Update obj) {}
+ public void visit(SetQuery obj) {}
+ public void visit(SetClause obj) {}
+ public void visit(SearchedWhenClause obj) {}
}
Modified: trunk/connector-api/src/main/java/org/teiid/connector/visitor/framework/DelegatingHierarchyVisitor.java
===================================================================
--- trunk/connector-api/src/main/java/org/teiid/connector/visitor/framework/DelegatingHierarchyVisitor.java 2010-03-04 20:22:20 UTC (rev 1912)
+++ trunk/connector-api/src/main/java/org/teiid/connector/visitor/framework/DelegatingHierarchyVisitor.java 2010-03-04 20:47:34 UTC (rev 1913)
@@ -23,42 +23,40 @@
package org.teiid.connector.visitor.framework;
import org.teiid.connector.DataPlugin;
-import org.teiid.connector.language.IAggregate;
-import org.teiid.connector.language.IBatchedUpdates;
-import org.teiid.connector.language.ICompareCriteria;
-import org.teiid.connector.language.ICompoundCriteria;
-import org.teiid.connector.language.IDelete;
-import org.teiid.connector.language.IElement;
-import org.teiid.connector.language.IExistsCriteria;
-import org.teiid.connector.language.IFrom;
-import org.teiid.connector.language.IFunction;
-import org.teiid.connector.language.IGroup;
-import org.teiid.connector.language.IGroupBy;
-import org.teiid.connector.language.IInCriteria;
-import org.teiid.connector.language.IInlineView;
-import org.teiid.connector.language.IInsert;
-import org.teiid.connector.language.IIsNullCriteria;
-import org.teiid.connector.language.IJoin;
-import org.teiid.connector.language.ILanguageObject;
-import org.teiid.connector.language.ILikeCriteria;
-import org.teiid.connector.language.ILimit;
-import org.teiid.connector.language.ILiteral;
-import org.teiid.connector.language.INotCriteria;
-import org.teiid.connector.language.IOrderBy;
-import org.teiid.connector.language.IOrderByItem;
-import org.teiid.connector.language.IParameter;
-import org.teiid.connector.language.IProcedure;
-import org.teiid.connector.language.IQuery;
-import org.teiid.connector.language.IScalarSubquery;
-import org.teiid.connector.language.ISearchedCaseExpression;
-import org.teiid.connector.language.ISelect;
-import org.teiid.connector.language.ISelectSymbol;
-import org.teiid.connector.language.ISetClause;
-import org.teiid.connector.language.ISetClauseList;
-import org.teiid.connector.language.ISetQuery;
-import org.teiid.connector.language.ISubqueryCompareCriteria;
-import org.teiid.connector.language.ISubqueryInCriteria;
-import org.teiid.connector.language.IUpdate;
+import org.teiid.connector.language.AggregateFunction;
+import org.teiid.connector.language.AndOr;
+import org.teiid.connector.language.Argument;
+import org.teiid.connector.language.BatchedUpdates;
+import org.teiid.connector.language.Call;
+import org.teiid.connector.language.ColumnReference;
+import org.teiid.connector.language.Comparison;
+import org.teiid.connector.language.Delete;
+import org.teiid.connector.language.DerivedColumn;
+import org.teiid.connector.language.DerivedTable;
+import org.teiid.connector.language.Exists;
+import org.teiid.connector.language.Function;
+import org.teiid.connector.language.GroupBy;
+import org.teiid.connector.language.In;
+import org.teiid.connector.language.Insert;
+import org.teiid.connector.language.IsNull;
+import org.teiid.connector.language.Join;
+import org.teiid.connector.language.LanguageObject;
+import org.teiid.connector.language.Like;
+import org.teiid.connector.language.Limit;
+import org.teiid.connector.language.Literal;
+import org.teiid.connector.language.NamedTable;
+import org.teiid.connector.language.Not;
+import org.teiid.connector.language.OrderBy;
+import org.teiid.connector.language.ScalarSubquery;
+import org.teiid.connector.language.SearchedCase;
+import org.teiid.connector.language.SearchedWhenClause;
+import org.teiid.connector.language.Select;
+import org.teiid.connector.language.SetClause;
+import org.teiid.connector.language.SetQuery;
+import org.teiid.connector.language.SortSpecification;
+import org.teiid.connector.language.SubqueryComparison;
+import org.teiid.connector.language.SubqueryIn;
+import org.teiid.connector.language.Update;
/**
* Delegates pre- and post-processing for each node in the hierarchy to
@@ -86,7 +84,7 @@
return preVisitor;
}
- public void visit(IAggregate obj) {
+ public void visit(AggregateFunction obj) {
if (preVisitor != null) {
preVisitor.visit(obj);
}
@@ -96,7 +94,7 @@
}
}
- public void visit(IBatchedUpdates obj) {
+ public void visit(BatchedUpdates obj) {
if (preVisitor != null) {
preVisitor.visit(obj);
}
@@ -106,7 +104,7 @@
}
}
- public void visit(ICompareCriteria obj) {
+ public void visit(Comparison obj) {
if (preVisitor != null) {
preVisitor.visit(obj);
}
@@ -115,7 +113,7 @@
postVisitor.visit(obj);
}
}
- public void visit(ICompoundCriteria obj) {
+ public void visit(AndOr obj) {
if (preVisitor != null) {
preVisitor.visit(obj);
}
@@ -124,7 +122,7 @@
postVisitor.visit(obj);
}
}
- public void visit(IDelete obj) {
+ public void visit(Delete obj) {
if (preVisitor != null) {
preVisitor.visit(obj);
}
@@ -133,7 +131,7 @@
postVisitor.visit(obj);
}
}
- public void visit(IElement obj) {
+ public void visit(ColumnReference obj) {
if (preVisitor != null) {
preVisitor.visit(obj);
}
@@ -142,7 +140,7 @@
postVisitor.visit(obj);
}
}
- public void visit(IProcedure obj) {
+ public void visit(Call obj) {
if (preVisitor != null) {
preVisitor.visit(obj);
}
@@ -154,7 +152,7 @@
/*
* @see com.metamatrix.data.visitor.LanguageObjectVisitor#visit(com.metamatrix.data.language.IExistsCriteria)
*/
- public void visit(IExistsCriteria obj) {
+ public void visit(Exists obj) {
if (preVisitor != null) {
preVisitor.visit(obj);
}
@@ -163,25 +161,16 @@
postVisitor.visit(obj);
}
}
- public void visit(IFrom obj) {
+ public void visit(Function obj) {
if (preVisitor != null) {
preVisitor.visit(obj);
}
super.visit(obj);
if (postVisitor != null) {
postVisitor.visit(obj);
- }
- }
- public void visit(IFunction obj) {
- if (preVisitor != null) {
- preVisitor.visit(obj);
}
- super.visit(obj);
- if (postVisitor != null) {
- postVisitor.visit(obj);
- }
}
- public void visit(IGroup obj) {
+ public void visit(NamedTable obj) {
if (preVisitor != null) {
preVisitor.visit(obj);
}
@@ -190,7 +179,7 @@
postVisitor.visit(obj);
}
}
- public void visit(IGroupBy obj) {
+ public void visit(GroupBy obj) {
if (preVisitor != null) {
preVisitor.visit(obj);
}
@@ -199,7 +188,7 @@
postVisitor.visit(obj);
}
}
- public void visit(IInCriteria obj) {
+ public void visit(In obj) {
if (preVisitor != null) {
preVisitor.visit(obj);
}
@@ -209,7 +198,7 @@
}
}
- public void visit(IInlineView obj) {
+ public void visit(DerivedTable obj) {
if (preVisitor != null) {
preVisitor.visit(obj);
}
@@ -219,7 +208,7 @@
}
}
- public void visit(IInsert obj) {
+ public void visit(Insert obj) {
if (preVisitor != null) {
preVisitor.visit(obj);
}
@@ -228,7 +217,7 @@
postVisitor.visit(obj);
}
}
- public void visit(IIsNullCriteria obj) {
+ public void visit(IsNull obj) {
if (preVisitor != null) {
preVisitor.visit(obj);
}
@@ -237,7 +226,7 @@
postVisitor.visit(obj);
}
}
- public void visit(IJoin obj) {
+ public void visit(Join obj) {
if (preVisitor != null) {
preVisitor.visit(obj);
}
@@ -246,7 +235,7 @@
postVisitor.visit(obj);
}
}
- public void visit(ILikeCriteria obj) {
+ public void visit(Like obj) {
if (preVisitor != null) {
preVisitor.visit(obj);
}
@@ -255,7 +244,7 @@
postVisitor.visit(obj);
}
}
- public void visit(ILimit obj) {
+ public void visit(Limit obj) {
if (preVisitor != null) {
preVisitor.visit(obj);
}
@@ -264,7 +253,7 @@
postVisitor.visit(obj);
}
}
- public void visit(ILiteral obj) {
+ public void visit(Literal obj) {
if (preVisitor != null) {
preVisitor.visit(obj);
}
@@ -273,7 +262,7 @@
postVisitor.visit(obj);
}
}
- public void visit(INotCriteria obj) {
+ public void visit(Not obj) {
if (preVisitor != null) {
preVisitor.visit(obj);
}
@@ -282,7 +271,7 @@
postVisitor.visit(obj);
}
}
- public void visit(IOrderBy obj) {
+ public void visit(OrderBy obj) {
if (preVisitor != null) {
preVisitor.visit(obj);
}
@@ -291,7 +280,7 @@
postVisitor.visit(obj);
}
}
- public void visit(IOrderByItem obj) {
+ public void visit(SortSpecification obj) {
if (preVisitor != null) {
preVisitor.visit(obj);
}
@@ -300,7 +289,7 @@
postVisitor.visit(obj);
}
}
- public void visit(IParameter obj) {
+ public void visit(Argument obj) {
if (preVisitor != null) {
preVisitor.visit(obj);
}
@@ -309,7 +298,7 @@
postVisitor.visit(obj);
}
}
- public void visit(IQuery obj) {
+ public void visit(Select obj) {
if (preVisitor != null) {
preVisitor.visit(obj);
}
@@ -319,10 +308,7 @@
}
}
- /*
- * @see com.metamatrix.data.visitor.LanguageObjectVisitor#visit(com.metamatrix.data.language.IScalarSubquery)
- */
- public void visit(IScalarSubquery obj) {
+ public void visit(ScalarSubquery obj) {
if (preVisitor != null) {
preVisitor.visit(obj);
}
@@ -331,7 +317,7 @@
postVisitor.visit(obj);
}
}
- public void visit(ISearchedCaseExpression obj) {
+ public void visit(SearchedCase obj) {
if (preVisitor != null) {
preVisitor.visit(obj);
}
@@ -340,7 +326,7 @@
postVisitor.visit(obj);
}
}
- public void visit(ISelect obj) {
+ public void visit(DerivedColumn obj) {
if (preVisitor != null) {
preVisitor.visit(obj);
}
@@ -349,7 +335,7 @@
postVisitor.visit(obj);
}
}
- public void visit(ISelectSymbol obj) {
+ public void visit(SubqueryComparison obj) {
if (preVisitor != null) {
preVisitor.visit(obj);
}
@@ -358,7 +344,7 @@
postVisitor.visit(obj);
}
}
- public void visit(ISubqueryCompareCriteria obj) {
+ public void visit(SubqueryIn obj) {
if (preVisitor != null) {
preVisitor.visit(obj);
}
@@ -367,18 +353,8 @@
postVisitor.visit(obj);
}
}
- public void visit(ISubqueryInCriteria obj) {
- if (preVisitor != null) {
- preVisitor.visit(obj);
- }
- super.visit(obj);
- if (postVisitor != null) {
- postVisitor.visit(obj);
- }
- }
-
- public void visit(ISetQuery obj) {
+ public void visit(SetQuery obj) {
if (preVisitor != null) {
preVisitor.visit(obj);
}
@@ -388,7 +364,7 @@
}
}
- public void visit(IUpdate obj) {
+ public void visit(Update obj) {
if (preVisitor != null) {
preVisitor.visit(obj);
}
@@ -399,7 +375,7 @@
}
@Override
- public void visit(ISetClauseList obj) {
+ public void visit(SetClause obj) {
if (preVisitor != null) {
preVisitor.visit(obj);
}
@@ -407,12 +383,11 @@
if (postVisitor != null) {
postVisitor.visit(obj);
}
-
}
@Override
- public void visit(ISetClause obj) {
- if (preVisitor != null) {
+ public void visit(SearchedWhenClause obj) {
+ if (preVisitor != null) {
preVisitor.visit(obj);
}
super.visit(obj);
@@ -430,7 +405,7 @@
* @param behaviorVisitor The visitor specifying what behavior is performed at each node type
* @param object The root of the object tree to perform visitation on
*/
- public static void preOrderVisit(LanguageObjectVisitor behaviorVisitor, ILanguageObject object) {
+ public static void preOrderVisit(LanguageObjectVisitor behaviorVisitor, LanguageObject object) {
DelegatingHierarchyVisitor hierarchyVisitor = new DelegatingHierarchyVisitor(behaviorVisitor, null);
object.acceptVisitor(hierarchyVisitor);
}
@@ -444,7 +419,7 @@
* @param behaviorVisitor The visitor specifying what behavior is performed at each node type
* @param object The root of the object tree to perform visitation on
*/
- public static void postOrderVisit(LanguageObjectVisitor behaviorVisitor, ILanguageObject object) {
+ public static void postOrderVisit(LanguageObjectVisitor behaviorVisitor, LanguageObject object) {
DelegatingHierarchyVisitor hierarchyVisitor = new DelegatingHierarchyVisitor(null, behaviorVisitor);
object.acceptVisitor(hierarchyVisitor);
}
Modified: trunk/connector-api/src/main/java/org/teiid/connector/visitor/framework/HierarchyVisitor.java
===================================================================
--- trunk/connector-api/src/main/java/org/teiid/connector/visitor/framework/HierarchyVisitor.java 2010-03-04 20:22:20 UTC (rev 1912)
+++ trunk/connector-api/src/main/java/org/teiid/connector/visitor/framework/HierarchyVisitor.java 2010-03-04 20:47:34 UTC (rev 1913)
@@ -22,37 +22,35 @@
package org.teiid.connector.visitor.framework;
-import org.teiid.connector.language.IAggregate;
-import org.teiid.connector.language.IBatchedUpdates;
-import org.teiid.connector.language.ICompareCriteria;
-import org.teiid.connector.language.ICompoundCriteria;
-import org.teiid.connector.language.IDelete;
-import org.teiid.connector.language.IExistsCriteria;
-import org.teiid.connector.language.IFrom;
-import org.teiid.connector.language.IFunction;
-import org.teiid.connector.language.IGroupBy;
-import org.teiid.connector.language.IInCriteria;
-import org.teiid.connector.language.IInlineView;
-import org.teiid.connector.language.IInsert;
-import org.teiid.connector.language.IInsertExpressionValueSource;
-import org.teiid.connector.language.IIsNullCriteria;
-import org.teiid.connector.language.IJoin;
-import org.teiid.connector.language.ILikeCriteria;
-import org.teiid.connector.language.INotCriteria;
-import org.teiid.connector.language.IOrderBy;
-import org.teiid.connector.language.IProcedure;
-import org.teiid.connector.language.IQuery;
-import org.teiid.connector.language.IQueryCommand;
-import org.teiid.connector.language.IScalarSubquery;
-import org.teiid.connector.language.ISearchedCaseExpression;
-import org.teiid.connector.language.ISelect;
-import org.teiid.connector.language.ISelectSymbol;
-import org.teiid.connector.language.ISetClause;
-import org.teiid.connector.language.ISetClauseList;
-import org.teiid.connector.language.ISetQuery;
-import org.teiid.connector.language.ISubqueryCompareCriteria;
-import org.teiid.connector.language.ISubqueryInCriteria;
-import org.teiid.connector.language.IUpdate;
+import org.teiid.connector.language.AggregateFunction;
+import org.teiid.connector.language.AndOr;
+import org.teiid.connector.language.BatchedUpdates;
+import org.teiid.connector.language.Call;
+import org.teiid.connector.language.Comparison;
+import org.teiid.connector.language.Delete;
+import org.teiid.connector.language.DerivedColumn;
+import org.teiid.connector.language.DerivedTable;
+import org.teiid.connector.language.Exists;
+import org.teiid.connector.language.ExpressionValueSource;
+import org.teiid.connector.language.Function;
+import org.teiid.connector.language.GroupBy;
+import org.teiid.connector.language.In;
+import org.teiid.connector.language.Insert;
+import org.teiid.connector.language.IsNull;
+import org.teiid.connector.language.Join;
+import org.teiid.connector.language.Like;
+import org.teiid.connector.language.Not;
+import org.teiid.connector.language.OrderBy;
+import org.teiid.connector.language.QueryExpression;
+import org.teiid.connector.language.ScalarSubquery;
+import org.teiid.connector.language.SearchedCase;
+import org.teiid.connector.language.SearchedWhenClause;
+import org.teiid.connector.language.Select;
+import org.teiid.connector.language.SetClause;
+import org.teiid.connector.language.SetQuery;
+import org.teiid.connector.language.SubqueryComparison;
+import org.teiid.connector.language.SubqueryIn;
+import org.teiid.connector.language.Update;
/**
* Visits each node in a hierarchy of ILanguageObjects. The default
@@ -77,96 +75,91 @@
this.visitSubcommands = visitSubcommands;
}
- public void visit(IAggregate obj) {
+ public void visit(AggregateFunction obj) {
visitNode(obj.getExpression());
}
- public void visit(IBatchedUpdates obj) {
+ public void visit(BatchedUpdates obj) {
visitNodes(obj.getUpdateCommands());
}
- public void visit(ICompareCriteria obj) {
+ public void visit(Comparison obj) {
visitNode(obj.getLeftExpression());
visitNode(obj.getRightExpression());
}
- public void visit(ICompoundCriteria obj) {
- visitNodes(obj.getCriteria());
+ public void visit(AndOr obj) {
+ visitNode(obj.getLeftCondition());
+ visitNode(obj.getRightCondition());
}
- public void visit(IDelete obj) {
- visitNode(obj.getGroup());
- visitNode(obj.getCriteria());
+ public void visit(Delete obj) {
+ visitNode(obj.getTable());
+ visitNode(obj.getWhere());
}
- public void visit(IProcedure obj) {
- visitNodes(obj.getParameters());
+ public void visit(Call obj) {
+ visitNodes(obj.getArguments());
}
- public void visit(IExistsCriteria obj) {
+ public void visit(Exists obj) {
if (visitSubcommands) {
- visitNode(obj.getQuery());
+ visitNode(obj.getSubquery());
}
}
- public void visit(IFrom obj) {
- visitNodes(obj.getItems());
- }
-
- public void visit(IFunction obj) {
+ public void visit(Function obj) {
visitNodes(obj.getParameters());
}
- public void visit(IGroupBy obj) {
+ public void visit(GroupBy obj) {
visitNodes(obj.getElements());
}
- public void visit(IInCriteria obj) {
+ public void visit(In obj) {
visitNode(obj.getLeftExpression());
visitNodes(obj.getRightExpressions());
}
- public void visit(IInsert obj) {
- visitNode(obj.getGroup());
- visitNodes(obj.getElements());
- if (!(obj.getValueSource() instanceof IQueryCommand) || visitSubcommands) {
+ public void visit(Insert obj) {
+ visitNode(obj.getTable());
+ visitNodes(obj.getColumns());
+ if (!(obj.getValueSource() instanceof QueryExpression) || visitSubcommands) {
visitNode(obj.getValueSource());
}
}
@Override
- public void visit(IInsertExpressionValueSource obj) {
+ public void visit(ExpressionValueSource obj) {
visitNodes(obj.getValues());
}
- public void visit(IIsNullCriteria obj) {
+ public void visit(IsNull obj) {
visitNode(obj.getExpression());
}
- public void visit(IJoin obj) {
+ public void visit(Join obj) {
visitNode(obj.getLeftItem());
visitNode(obj.getRightItem());
- if(obj.getCriteria() != null) {
- visitNodes(obj.getCriteria());
- }
+ visitNode(obj.getCondition());
}
- public void visit(ILikeCriteria obj) {
+ public void visit(Like obj) {
visitNode(obj.getLeftExpression());
visitNode(obj.getRightExpression());
}
- public void visit(INotCriteria obj) {
+ public void visit(Not obj) {
visitNode(obj.getCriteria());
}
- public void visit(IOrderBy obj) {
- visitNodes(obj.getItems());
+ public void visit(OrderBy obj) {
+ visitNodes(obj.getSortSpecifications());
}
- public void visit(IQuery obj) {
- visitNode(obj.getSelect());
- visitNode(obj.getFrom());
+ public void visit(Select obj) {
+ visitNodes(obj.getDerivedColumns());
+ visitNodes(obj.getFrom());
visitNode(obj.getWhere());
visitNode(obj.getGroupBy());
visitNode(obj.getHaving());
@@ -174,44 +167,42 @@
visitNode(obj.getLimit());
}
- public void visit(IScalarSubquery obj) {
+ public void visit(ScalarSubquery obj) {
if (visitSubcommands) {
- visitNode(obj.getQuery());
+ visitNode(obj.getSubquery());
}
}
- public void visit(ISearchedCaseExpression obj) {
- int whenCount = obj.getWhenCount();
- for (int i = 0; i < whenCount; i++) {
- visitNode(obj.getWhenCriteria(i));
- visitNode(obj.getThenExpression(i));
- }
+ public void visit(SearchedCase obj) {
+ visitNodes(obj.getCases());
visitNode(obj.getElseExpression());
}
- public void visit(ISelect obj) {
- visitNodes(obj.getSelectSymbols());
+ @Override
+ public void visit(SearchedWhenClause obj) {
+ visitNode(obj.getCondition());
+ visitNode(obj.getResult());
}
- public void visit(ISelectSymbol obj) {
+ public void visit(DerivedColumn obj) {
visitNode(obj.getExpression());
}
- public void visit(ISubqueryCompareCriteria obj) {
+ public void visit(SubqueryComparison obj) {
visitNode(obj.getLeftExpression());
if (visitSubcommands) {
- visitNode(obj.getQuery());
+ visitNode(obj.getSubquery());
}
}
- public void visit(ISubqueryInCriteria obj) {
+ public void visit(SubqueryIn obj) {
visitNode(obj.getLeftExpression());
if (visitSubcommands) {
- visitNode(obj.getQuery());
+ visitNode(obj.getSubquery());
}
}
- public void visit(ISetQuery obj) {
+ public void visit(SetQuery obj) {
if (visitSubcommands) {
visitNode(obj.getLeftQuery());
visitNode(obj.getRightQuery());
@@ -220,26 +211,21 @@
visitNode(obj.getLimit());
}
- public void visit(IUpdate obj) {
- visitNode(obj.getGroup());
- visitNode(obj.getChanges());
- visitNode(obj.getCriteria());
+ public void visit(Update obj) {
+ visitNode(obj.getTable());
+ visitNodes(obj.getChanges());
+ visitNode(obj.getWhere());
}
@Override
- public void visit(IInlineView obj) {
+ public void visit(DerivedTable obj) {
if (visitSubcommands) {
visitNode(obj.getQuery());
}
}
@Override
- public void visit(ISetClauseList obj) {
- visitNodes(obj.getClauses());
- }
-
- @Override
- public void visit(ISetClause obj) {
+ public void visit(SetClause obj) {
visitNode(obj.getSymbol());
visitNode(obj.getValue());
}
Modified: trunk/connector-api/src/main/java/org/teiid/connector/visitor/framework/LanguageObjectVisitor.java
===================================================================
--- trunk/connector-api/src/main/java/org/teiid/connector/visitor/framework/LanguageObjectVisitor.java 2010-03-04 20:22:20 UTC (rev 1912)
+++ trunk/connector-api/src/main/java/org/teiid/connector/visitor/framework/LanguageObjectVisitor.java 2010-03-04 20:47:34 UTC (rev 1913)
@@ -27,40 +27,38 @@
/**
*/
public interface LanguageObjectVisitor {
- public void visit(IAggregate obj);
- public void visit(IBatchedUpdates obj);
- public void visit(IInsertExpressionValueSource obj);
- public void visit(ICompareCriteria obj);
- public void visit(ICompoundCriteria obj);
- public void visit(IDelete obj);
- public void visit(IElement obj);
- public void visit(IProcedure obj);
- public void visit(IExistsCriteria obj);
- public void visit(IFrom obj);
- public void visit(IFunction obj);
- public void visit(IGroup obj);
- public void visit(IGroupBy obj);
- public void visit(IInCriteria obj);
- public void visit(IInlineView obj);
- public void visit(IInsert obj);
- public void visit(IIsNullCriteria obj);
- public void visit(IJoin obj);
- public void visit(ILikeCriteria obj);
- public void visit(ILimit obj);
- public void visit(ILiteral obj);
- public void visit(INotCriteria obj);
- public void visit(IOrderBy obj);
- public void visit(IOrderByItem obj);
- public void visit(IParameter obj);
- public void visit(IQuery obj);
- public void visit(IScalarSubquery obj);
- public void visit(ISearchedCaseExpression obj);
- public void visit(ISelect obj);
- public void visit(ISelectSymbol obj);
- public void visit(ISubqueryCompareCriteria obj);
- public void visit(ISubqueryInCriteria obj);
- public void visit(IUpdate obj);
- public void visit(ISetQuery obj);
- public void visit(ISetClauseList obj);
- public void visit(ISetClause obj);
+ public void visit(AggregateFunction obj);
+ public void visit(BatchedUpdates obj);
+ public void visit(ExpressionValueSource obj);
+ public void visit(Comparison obj);
+ public void visit(AndOr obj);
+ public void visit(Delete obj);
+ public void visit(ColumnReference obj);
+ public void visit(Call obj);
+ public void visit(Exists obj);
+ public void visit(Function obj);
+ public void visit(NamedTable obj);
+ public void visit(GroupBy obj);
+ public void visit(In obj);
+ public void visit(DerivedTable obj);
+ public void visit(Insert obj);
+ public void visit(IsNull obj);
+ public void visit(Join obj);
+ public void visit(Like obj);
+ public void visit(Limit obj);
+ public void visit(Literal obj);
+ public void visit(Not obj);
+ public void visit(OrderBy obj);
+ public void visit(SortSpecification obj);
+ public void visit(Argument obj);
+ public void visit(Select obj);
+ public void visit(ScalarSubquery obj);
+ public void visit(SearchedCase obj);
+ public void visit(DerivedColumn obj);
+ public void visit(SubqueryComparison obj);
+ public void visit(SubqueryIn obj);
+ public void visit(Update obj);
+ public void visit(SetQuery obj);
+ public void visit(SetClause obj);
+ public void visit(SearchedWhenClause obj);
}
Modified: trunk/connector-api/src/main/java/org/teiid/connector/visitor/util/CollectorVisitor.java
===================================================================
--- trunk/connector-api/src/main/java/org/teiid/connector/visitor/util/CollectorVisitor.java 2010-03-04 20:22:20 UTC (rev 1912)
+++ trunk/connector-api/src/main/java/org/teiid/connector/visitor/util/CollectorVisitor.java 2010-03-04 20:47:34 UTC (rev 1913)
@@ -27,43 +27,41 @@
import java.util.HashSet;
import java.util.Set;
-import org.teiid.connector.language.IAggregate;
-import org.teiid.connector.language.IBatchedUpdates;
-import org.teiid.connector.language.ICompareCriteria;
-import org.teiid.connector.language.ICompoundCriteria;
-import org.teiid.connector.language.IDelete;
-import org.teiid.connector.language.IElement;
-import org.teiid.connector.language.IExistsCriteria;
-import org.teiid.connector.language.IFrom;
-import org.teiid.connector.language.IFunction;
-import org.teiid.connector.language.IGroup;
-import org.teiid.connector.language.IGroupBy;
-import org.teiid.connector.language.IInCriteria;
-import org.teiid.connector.language.IInlineView;
-import org.teiid.connector.language.IInsert;
-import org.teiid.connector.language.IInsertExpressionValueSource;
-import org.teiid.connector.language.IIsNullCriteria;
-import org.teiid.connector.language.IJoin;
-import org.teiid.connector.language.ILanguageObject;
-import org.teiid.connector.language.ILikeCriteria;
-import org.teiid.connector.language.ILimit;
-import org.teiid.connector.language.ILiteral;
-import org.teiid.connector.language.INotCriteria;
-import org.teiid.connector.language.IOrderBy;
-import org.teiid.connector.language.IOrderByItem;
-import org.teiid.connector.language.IParameter;
-import org.teiid.connector.language.IProcedure;
-import org.teiid.connector.language.IQuery;
-import org.teiid.connector.language.IScalarSubquery;
-import org.teiid.connector.language.ISearchedCaseExpression;
-import org.teiid.connector.language.ISelect;
-import org.teiid.connector.language.ISelectSymbol;
-import org.teiid.connector.language.ISetClause;
-import org.teiid.connector.language.ISetClauseList;
-import org.teiid.connector.language.ISetQuery;
-import org.teiid.connector.language.ISubqueryCompareCriteria;
-import org.teiid.connector.language.ISubqueryInCriteria;
-import org.teiid.connector.language.IUpdate;
+import org.teiid.connector.language.AggregateFunction;
+import org.teiid.connector.language.AndOr;
+import org.teiid.connector.language.Argument;
+import org.teiid.connector.language.BatchedUpdates;
+import org.teiid.connector.language.Call;
+import org.teiid.connector.language.ColumnReference;
+import org.teiid.connector.language.Comparison;
+import org.teiid.connector.language.Delete;
+import org.teiid.connector.language.DerivedColumn;
+import org.teiid.connector.language.DerivedTable;
+import org.teiid.connector.language.Exists;
+import org.teiid.connector.language.ExpressionValueSource;
+import org.teiid.connector.language.Function;
+import org.teiid.connector.language.GroupBy;
+import org.teiid.connector.language.In;
+import org.teiid.connector.language.Insert;
+import org.teiid.connector.language.IsNull;
+import org.teiid.connector.language.Join;
+import org.teiid.connector.language.LanguageObject;
+import org.teiid.connector.language.Like;
+import org.teiid.connector.language.Limit;
+import org.teiid.connector.language.Literal;
+import org.teiid.connector.language.NamedTable;
+import org.teiid.connector.language.Not;
+import org.teiid.connector.language.OrderBy;
+import org.teiid.connector.language.ScalarSubquery;
+import org.teiid.connector.language.SearchedCase;
+import org.teiid.connector.language.SearchedWhenClause;
+import org.teiid.connector.language.Select;
+import org.teiid.connector.language.SetClause;
+import org.teiid.connector.language.SetQuery;
+import org.teiid.connector.language.SortSpecification;
+import org.teiid.connector.language.SubqueryComparison;
+import org.teiid.connector.language.SubqueryIn;
+import org.teiid.connector.language.Update;
import org.teiid.connector.visitor.framework.DelegatingHierarchyVisitor;
import org.teiid.connector.visitor.framework.LanguageObjectVisitor;
@@ -83,7 +81,7 @@
}
@SuppressWarnings("unchecked")
- private void checkInstance(ILanguageObject obj) {
+ private void checkInstance(LanguageObject obj) {
if(type.isInstance(obj)) {
this.objects.add((T)obj);
}
@@ -93,246 +91,142 @@
return this.objects;
}
- /*
- * @see com.metamatrix.data.visitor.framework.LanguageObjectVisitor#visit(com.metamatrix.data.language.IAggregate)
- */
- public void visit(IAggregate obj) {
+ public void visit(AggregateFunction obj) {
checkInstance(obj);
}
- /*
- * @see com.metamatrix.data.visitor.framework.LanguageObjectVisitor#visit(com.metamatrix.data.language.IBatchedUpdates)
- * @since 4.2
- */
- public void visit(IBatchedUpdates obj) {
+ public void visit(BatchedUpdates obj) {
checkInstance(obj);
}
- /*
- * @see com.metamatrix.data.visitor.framework.LanguageObjectVisitor#visit(com.metamatrix.data.language.ICompareCriteria)
- */
- public void visit(ICompareCriteria obj) {
+ public void visit(Comparison obj) {
checkInstance(obj);
}
- /*
- * @see com.metamatrix.data.visitor.framework.LanguageObjectVisitor#visit(com.metamatrix.data.language.ICompoundCriteria)
- */
- public void visit(ICompoundCriteria obj) {
+ public void visit(AndOr obj) {
checkInstance(obj);
}
- /*
- * @see com.metamatrix.data.visitor.framework.LanguageObjectVisitor#visit(com.metamatrix.data.language.IDelete)
- */
- public void visit(IDelete obj) {
+ public void visit(Delete obj) {
checkInstance(obj);
}
- /*
- * @see com.metamatrix.data.visitor.framework.LanguageObjectVisitor#visit(com.metamatrix.data.language.IElement)
- */
- public void visit(IElement obj) {
+ public void visit(ColumnReference obj) {
checkInstance(obj);
}
- /*
- * @see com.metamatrix.data.visitor.framework.LanguageObjectVisitor#visit(com.metamatrix.data.language.IExistsCriteria)
- */
- public void visit(IExistsCriteria obj) {
+ public void visit(Exists obj) {
checkInstance(obj);
}
- /*
- * @see com.metamatrix.data.visitor.framework.LanguageObjectVisitor#visit(com.metamatrix.data.language.IFrom)
- */
- public void visit(IFrom obj) {
+ public void visit(Function obj) {
checkInstance(obj);
}
- /*
- * @see com.metamatrix.data.visitor.framework.LanguageObjectVisitor#visit(com.metamatrix.data.language.IFunction)
- */
- public void visit(IFunction obj) {
+ public void visit(NamedTable obj) {
checkInstance(obj);
}
- /*
- * @see com.metamatrix.data.visitor.framework.LanguageObjectVisitor#visit(com.metamatrix.data.language.IGroup)
- */
- public void visit(IGroup obj) {
+ public void visit(GroupBy obj) {
checkInstance(obj);
}
- /*
- * @see com.metamatrix.data.visitor.framework.LanguageObjectVisitor#visit(com.metamatrix.data.language.IGroupBy)
- */
- public void visit(IGroupBy obj) {
+ public void visit(In obj) {
checkInstance(obj);
}
- /*
- * @see com.metamatrix.data.visitor.framework.LanguageObjectVisitor#visit(com.metamatrix.data.language.IInCriteria)
- */
- public void visit(IInCriteria obj) {
+ public void visit(DerivedTable obj) {
checkInstance(obj);
}
- public void visit(IInlineView obj) {
+ public void visit(Insert obj) {
checkInstance(obj);
}
- /*
- * @see com.metamatrix.data.visitor.framework.LanguageObjectVisitor#visit(com.metamatrix.data.language.IInsert)
- */
- public void visit(IInsert obj) {
+ public void visit(ExpressionValueSource obj) {
checkInstance(obj);
}
- /*
- * @see com.metamatrix.data.visitor.framework.LanguageObjectVisitor#visit(com.metamatrix.data.language.IBulkInsert)
- */
- public void visit(IInsertExpressionValueSource obj) {
+ public void visit(IsNull obj) {
checkInstance(obj);
}
- /*
- * @see com.metamatrix.data.visitor.framework.LanguageObjectVisitor#visit(com.metamatrix.data.language.IIsNullCriteria)
- */
- public void visit(IIsNullCriteria obj) {
- checkInstance(obj);
- }
- /*
- * @see com.metamatrix.data.visitor.framework.LanguageObjectVisitor#visit(com.metamatrix.data.language.IJoin)
- */
- public void visit(IJoin obj) {
+ public void visit(Join obj) {
checkInstance(obj);
}
- /*
- * @see com.metamatrix.data.visitor.framework.LanguageObjectVisitor#visit(com.metamatrix.data.language.ILikeCriteria)
- */
- public void visit(ILikeCriteria obj) {
+ public void visit(Like obj) {
checkInstance(obj);
}
- /*
- * @see com.metamatrix.data.visitor.framework.LanguageObjectVisitor#visit(com.metamatrix.data.language.ILimit)
- */
- public void visit(ILimit obj) {
+ public void visit(Limit obj) {
checkInstance(obj);
}
- /*
- * @see com.metamatrix.data.visitor.framework.LanguageObjectVisitor#visit(com.metamatrix.data.language.ILiteral)
- */
- public void visit(ILiteral obj) {
+ public void visit(Literal obj) {
checkInstance(obj);
}
- /*
- * @see com.metamatrix.data.visitor.framework.LanguageObjectVisitor#visit(com.metamatrix.data.language.INotCriteria)
- */
- public void visit(INotCriteria obj) {
+ public void visit(Not obj) {
checkInstance(obj);
}
- /*
- * @see com.metamatrix.data.visitor.framework.LanguageObjectVisitor#visit(com.metamatrix.data.language.IOrderBy)
- */
- public void visit(IOrderBy obj) {
+ public void visit(OrderBy obj) {
checkInstance(obj);
}
- /*
- * @see com.metamatrix.data.visitor.framework.LanguageObjectVisitor#visit(com.metamatrix.data.language.IOrderByItem)
- */
- public void visit(IOrderByItem obj) {
+ public void visit(SortSpecification obj) {
checkInstance(obj);
}
- /*
- * @see com.metamatrix.data.visitor.framework.LanguageObjectVisitor#visit(com.metamatrix.data.language.IParameter)
- */
- public void visit(IParameter obj) {
+ public void visit(Argument obj) {
checkInstance(obj);
}
- /*
- * @see com.metamatrix.data.visitor.framework.LanguageObjectVisitor#visit(com.metamatrix.data.language.IProcedure)
- */
- public void visit(IProcedure obj) {
+ public void visit(Call obj) {
checkInstance(obj);
}
- /*
- * @see com.metamatrix.data.visitor.framework.LanguageObjectVisitor#visit(com.metamatrix.data.language.IQuery)
- */
- public void visit(IQuery obj) {
+ public void visit(Select obj) {
checkInstance(obj);
}
- /*
- * @see com.metamatrix.data.visitor.framework.LanguageObjectVisitor#visit(com.metamatrix.data.language.IScalarSubquery)
- */
- public void visit(IScalarSubquery obj) {
+ public void visit(ScalarSubquery obj) {
checkInstance(obj);
}
- /*
- * @see com.metamatrix.data.visitor.framework.LanguageObjectVisitor#visit(com.metamatrix.data.language.ISearchedCaseExpression)
- */
- public void visit(ISearchedCaseExpression obj) {
+ public void visit(SearchedCase obj) {
checkInstance(obj);
}
- /*
- * @see com.metamatrix.data.visitor.framework.LanguageObjectVisitor#visit(com.metamatrix.data.language.ISelect)
- */
- public void visit(ISelect obj) {
+ public void visit(DerivedColumn obj) {
checkInstance(obj);
}
- /*
- * @see com.metamatrix.data.visitor.framework.LanguageObjectVisitor#visit(com.metamatrix.data.language.ISelectSymbol)
- */
- public void visit(ISelectSymbol obj) {
+ public void visit(SubqueryComparison obj) {
checkInstance(obj);
}
- /*
- * @see com.metamatrix.data.visitor.framework.LanguageObjectVisitor#visit(com.metamatrix.data.language.ISubqueryCompareCriteria)
- */
- public void visit(ISubqueryCompareCriteria obj) {
+ public void visit(SubqueryIn obj) {
checkInstance(obj);
}
- /*
- * @see com.metamatrix.data.visitor.framework.LanguageObjectVisitor#visit(com.metamatrix.data.language.ISubqueryInCriteria)
- */
- public void visit(ISubqueryInCriteria obj) {
+ public void visit(Update obj) {
checkInstance(obj);
}
-
- /*
- * @see com.metamatrix.data.visitor.framework.LanguageObjectVisitor#visit(com.metamatrix.data.language.IUpdate)
- */
- public void visit(IUpdate obj) {
- checkInstance(obj);
- }
- public void visit(ISetQuery obj) {
+ public void visit(SetQuery obj) {
checkInstance(obj);
}
@Override
- public void visit(ISetClauseList obj) {
+ public void visit(SetClause obj) {
checkInstance(obj);
}
@Override
- public void visit(ISetClause obj) {
- checkInstance(obj);
+ public void visit(SearchedWhenClause obj) {
+ checkInstance(obj);
}
/**
@@ -343,7 +237,7 @@
* @param object Root of the language object tree
* @return Collection of ILanguageObject of the specified type
*/
- public static <T> Collection<T> collectObjects(Class<T> type, ILanguageObject object) {
+ public static <T> Collection<T> collectObjects(Class<T> type, LanguageObject object) {
CollectorVisitor<T> visitor = new CollectorVisitor<T>(type);
DelegatingHierarchyVisitor hierarchyVisitor = new DelegatingHierarchyVisitor(visitor, null);
object.acceptVisitor(hierarchyVisitor);
@@ -357,8 +251,8 @@
* @param object Root of the language object tree
* @return Collection of IElement of the specified type
*/
- public static Collection<IElement> collectElements(ILanguageObject object) {
- return CollectorVisitor.collectObjects(IElement.class, object);
+ public static Collection<ColumnReference> collectElements(LanguageObject object) {
+ return CollectorVisitor.collectObjects(ColumnReference.class, object);
}
/**
@@ -368,8 +262,8 @@
* @param object Root of the language object tree
* @return Collection of IGroup of the specified type
*/
- public static Collection<IGroup> collectGroups(ILanguageObject object) {
- return CollectorVisitor.collectObjects(IGroup.class, object);
+ public static Collection<NamedTable> collectGroups(LanguageObject object) {
+ return CollectorVisitor.collectObjects(NamedTable.class, object);
}
/**
@@ -379,11 +273,11 @@
* @param object Root of the language object tree
* @return Set of IGroup
*/
- public static Set<IGroup> collectGroupsUsedByElements(ILanguageObject object) {
- Set<IGroup> groups = new HashSet<IGroup>();
- for (IElement element : CollectorVisitor.collectElements(object)) {
- if(element.getGroup() != null) {
- groups.add(element.getGroup());
+ public static Set<NamedTable> collectGroupsUsedByElements(LanguageObject object) {
+ Set<NamedTable> groups = new HashSet<NamedTable>();
+ for (ColumnReference element : CollectorVisitor.collectElements(object)) {
+ if(element.getTable() != null) {
+ groups.add(element.getTable());
}
}
return groups;
Deleted: trunk/connector-api/src/main/java/org/teiid/connector/visitor/util/SQLReservedWords.java
===================================================================
--- trunk/connector-api/src/main/java/org/teiid/connector/visitor/util/SQLReservedWords.java 2010-03-04 20:22:20 UTC (rev 1912)
+++ trunk/connector-api/src/main/java/org/teiid/connector/visitor/util/SQLReservedWords.java 2010-03-04 20:47:34 UTC (rev 1913)
@@ -1,191 +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.connector.visitor.util;
-
-import java.util.HashSet;
-import java.util.Set;
-
-public class SQLReservedWords {
-
- public static final String ANY = "ANY"; //$NON-NLS-1$
- public static final String ALL = "ALL"; //$NON-NLS-1$
- public static final String ALL_COLS = "*"; //$NON-NLS-1$
- public static final String AND = "AND"; //$NON-NLS-1$
- public static final String AS = "AS"; //$NON-NLS-1$
- public static final String ASC = "ASC"; //$NON-NLS-1$
- public static final String AVG = "AVG"; //$NON-NLS-1$
- public static final String BEGIN = "BEGIN"; //$NON-NLS-1$
- public static final String BETWEEN = "BETWEEN"; //$NON-NLS-1$
- public static final String BIGDECIMAL = "BIGDECIMAL"; //$NON-NLS-1$
- public static final String BIGINTEGER = "BIGINTEGER"; //$NON-NLS-1$
- public static final String BREAK = "BREAK"; //$NON-NLS-1$
- public static final String BY = "BY"; //$NON-NLS-1$
- public static final String BYTE = "BYTE"; //$NON-NLS-1$
- public static final String CASE = "CASE"; //$NON-NLS-1$
- public static final String CAST = "CAST"; //$NON-NLS-1$
- public static final String CHAR = "CHAR"; //$NON-NLS-1$
- public static final String CONVERT = "CONVERT"; //$NON-NLS-1$
- public static final String CONTINUE = "CONTINUE"; //$NON-NLS-1$
- public static final String COUNT = "COUNT"; //$NON-NLS-1$
- public static final String CRITERIA = "CRITERIA"; //$NON-NLS-1$
- public static final String CREATE = "CREATE"; //$NON-NLS-1$
- public static final String CROSS = "CROSS"; //$NON-NLS-1$
- public static final String DATE = "DATE"; //$NON-NLS-1$
- public static final String DEBUG = "DEBUG"; //$NON-NLS-1$
- public static final String DECLARE = "DECLARE"; //$NON-NLS-1$
- public static final String DELETE = "DELETE"; //$NON-NLS-1$
- public static final String DESC = "DESC"; //$NON-NLS-1$
- public static final String DISTINCT = "DISTINCT"; //$NON-NLS-1$
- public static final String DOUBLE = "DOUBLE"; //$NON-NLS-1$
- public static final String ELSE = "ELSE"; //$NON-NLS-1$
- public static final String END = "END"; //$NON-NLS-1$
- public static final String ERROR = "ERROR"; //$NON-NLS-1$
- public static final String ESCAPE = "ESCAPE"; //$NON-NLS-1$
- public static final String EXCEPT = "EXCEPT"; //$NON-NLS-1$
- public static final String EXEC = "EXEC"; //$NON-NLS-1$
- public static final String EXECUTE = "EXECUTE"; //$NON-NLS-1$
- public static final String EXISTS = "EXISTS"; //$NON-NLS-1$
- public static final String FALSE = "FALSE"; //$NON-NLS-1$
- public static final String FLOAT = "FLOAT"; //$NON-NLS-1$
- public static final String FOR = "FOR"; //$NON-NLS-1$
- public static final String FROM = "FROM"; //$NON-NLS-1$
- public static final String FULL = "FULL"; //$NON-NLS-1$
- public static final String GROUP = "GROUP"; //$NON-NLS-1$
- public static final String HAS = "HAS"; //$NON-NLS-1$
- public static final String HAVING = "HAVING"; //$NON-NLS-1$
- public static final String IF = "IF"; //$NON-NLS-1$
- public static final String IN = "IN"; //$NON-NLS-1$
- public static final String INNER = "INNER"; //$NON-NLS-1$
- public static final String INSERT = "INSERT"; //$NON-NLS-1$
- public static final String INTEGER = "INTEGER"; //$NON-NLS-1$
- public static final String INTERSECT = "INTERSECT"; //$NON-NLS-1$
- public static final String INTO = "INTO"; //$NON-NLS-1$
- public static final String IS = "IS"; //$NON-NLS-1$
- public static final String JOIN = "JOIN"; //$NON-NLS-1$
- public static final String LEFT = "LEFT"; //$NON-NLS-1$
- public static final String LIKE = "LIKE"; //$NON-NLS-1$
- public static final String LIMIT = "LIMIT"; //$NON-NLS-1$
- public static final String LONG = "LONG"; //$NON-NLS-1$
- public static final String LOOP = "LOOP"; //$NON-NLS-1$
- public static final String MAKEDEP = "MAKEDEP"; //$NON-NLS-1$
- public static final String MIN = "MIN"; //$NON-NLS-1$
- public static final String MAX = "MAX"; //$NON-NLS-1$
- public static final String NOT = "NOT"; //$NON-NLS-1$
- public static final String NULL = "NULL"; //$NON-NLS-1$
- public static final String OBJECT = "OBJECT"; //$NON-NLS-1$
- public static final String ON = "ON"; //$NON-NLS-1$
- public static final String OR = "OR"; //$NON-NLS-1$
- public static final String ORDER = "ORDER"; //$NON-NLS-1$
- public static final String OPTION = "OPTION"; //$NON-NLS-1$
- public static final String OUTER = "OUTER"; //$NON-NLS-1$
- public static final String PROCEDURE = "PROCEDURE"; //$NON-NLS-1$
- public static final String RIGHT = "RIGHT"; //$NON-NLS-1$
- public static final String SELECT = "SELECT"; //$NON-NLS-1$
- public static final String SET = "SET"; //$NON-NLS-1$
- public static final String SHORT = "SHORT"; //$NON-NLS-1$
- public static final String SHOWPLAN = "SHOWPLAN"; //$NON-NLS-1$
- public static final String SOME = "SOME"; //$NON-NLS-1$
- public static final String SQL_TSI_FRAC_SECOND = "SQL_TSI_FRAC_SECOND"; //$NON-NLS-1$
- public static final String SQL_TSI_SECOND = "SQL_TSI_SECOND"; //$NON-NLS-1$
- public static final String SQL_TSI_MINUTE = "SQL_TSI_MINUTE"; //$NON-NLS-1$
- public static final String SQL_TSI_HOUR = "SQL_TSI_HOUR"; //$NON-NLS-1$
- public static final String SQL_TSI_DAY = "SQL_TSI_DAY"; //$NON-NLS-1$
- public static final String SQL_TSI_WEEK = "SQL_TSI_WEEK"; //$NON-NLS-1$
- public static final String SQL_TSI_MONTH = "SQL_TSI_MONTH"; //$NON-NLS-1$
- public static final String SQL_TSI_QUARTER = "SQL_TSI_QUARTER"; //$NON-NLS-1$
- public static final String SQL_TSI_YEAR = "SQL_TSI_YEAR"; //$NON-NLS-1$
- public static final String STRING = "STRING"; //$NON-NLS-1$
- public static final String SUM = "SUM"; //$NON-NLS-1$
- public static final String THEN = "THEN"; //$NON-NLS-1$
- public static final String TIME = "TIME"; //$NON-NLS-1$
- public static final String TIMESTAMP = "TIMESTAMP"; //$NON-NLS-1$
- public static final String TIMESTAMPADD = "TIMESTAMPADD"; //$NON-NLS-1$
- public static final String TIMESTAMPDIFF = "TIMESTAMPDIFF"; //$NON-NLS-1$
- public static final String TRANSLATE = "TRANSLATE"; //$NON-NLS-1$
- public static final String TRUE = "TRUE"; //$NON-NLS-1$
- public static final String UNION = "UNION"; //$NON-NLS-1$
- public static final String UNKNOWN = "UNKNOWN"; //$NON-NLS-1$
- public static final String UPDATE = "UPDATE"; //$NON-NLS-1$
- public static final String USING = "USING"; //$NON-NLS-1$
- public static final String VALUES = "VALUES"; //$NON-NLS-1$
- public static final String VIRTUAL = "VIRTUAL"; //$NON-NLS-1$
- public static final String WHEN = "WHEN"; //$NON-NLS-1$
- public static final String WITH = "WITH"; //$NON-NLS-1$
- public static final String WHERE = "WHERE"; //$NON-NLS-1$
- public static final String WHILE = "WHILE"; //$NON-NLS-1$
-
- public static final String SPACE = " "; //$NON-NLS-1$
- public static final String COMMA = ","; //$NON-NLS-1$
- public static final String DOT = "."; //$NON-NLS-1$
- public static final String QUOTE = "'"; //$NON-NLS-1$
-
- public static final String EQ = "="; //$NON-NLS-1$
- public static final String NE = "<>"; //$NON-NLS-1$
- public static final String LT = "<"; //$NON-NLS-1$
- public static final String GT = ">"; //$NON-NLS-1$
- public static final String LE = "<="; //$NON-NLS-1$
- public static final String GE = ">="; //$NON-NLS-1$
-
- public static final String LPAREN = "("; //$NON-NLS-1$
- public static final String RPAREN = ")"; //$NON-NLS-1$
-
- public static final String[] ALL_WORDS = new String[] {ALL, ALL_COLS, AND, ANY, AS, ASC, AVG, BEGIN, BETWEEN, BIGINTEGER,
- BIGDECIMAL, BREAK, BY, BYTE, CASE, CAST, CHAR, CONVERT, CONTINUE, COUNT, CREATE, CRITERIA, CROSS, DATE, DEBUG, DECLARE,
- DELETE, DESC, DISTINCT, DOUBLE, ELSE, END, ERROR, ESCAPE, EXCEPT, EXEC, EXECUTE, EXISTS, FALSE, FLOAT, FOR, FROM, FULL,
- GROUP, HAS, HAVING, IF, IN, INNER, INSERT, INTEGER, INTERSECT, INTO, IS, JOIN, LEFT, LIKE, LONG, LOOP, MAKEDEP, MIN, MAX,
- NOT, NULL, OBJECT, ON, OR, ORDER, OPTION, OUTER, PROCEDURE, RIGHT, SELECT, SET, SHORT, SHOWPLAN, SOME,
- 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, STRING, SUM, THEN, TIME, TIMESTAMP, TIMESTAMPADD, TIMESTAMPDIFF, TRANSLATE, TRUE, UNION,
- UNKNOWN, UPDATE, USING, VALUES, VIRTUAL, WHEN, WITH, WHERE, WHILE,};
-
- /**
- * Set of CAPITALIZED reserved words for checking whether a string is a reserved word.
- */
- private static final Set RESERVED_WORDS = new HashSet();
-
- // Initialize RESERVED_WORDS set
- static {
- // Iterate through the reserved words and capitalize all of them
- for (int i = 0; i != SQLReservedWords.ALL_WORDS.length; ++i) {
- String reservedWord = SQLReservedWords.ALL_WORDS[i];
- SQLReservedWords.RESERVED_WORDS.add(reservedWord.toUpperCase());
- }
- }
-
- /** Can't construct */
- private SQLReservedWords() {
- }
-
- /**
- * Check whether a string is a reserved word.
- *
- * @param str String to check
- * @return True if reserved word, false if not or null
- */
- public static final boolean isReservedWord( String str ) {
- if (str == null) {
- return false;
- }
- return RESERVED_WORDS.contains(str.toUpperCase());
- }
-}
Modified: trunk/connector-api/src/main/java/org/teiid/connector/visitor/util/SQLStringVisitor.java
===================================================================
--- trunk/connector-api/src/main/java/org/teiid/connector/visitor/util/SQLStringVisitor.java 2010-03-04 20:22:20 UTC (rev 1912)
+++ trunk/connector-api/src/main/java/org/teiid/connector/visitor/util/SQLStringVisitor.java 2010-03-04 20:47:34 UTC (rev 1913)
@@ -24,55 +24,53 @@
import java.util.Arrays;
import java.util.HashSet;
-import java.util.Iterator;
import java.util.List;
import java.util.Set;
-import org.teiid.connector.api.ConnectorException;
-import org.teiid.connector.language.IAggregate;
-import org.teiid.connector.language.ICommand;
-import org.teiid.connector.language.ICompareCriteria;
-import org.teiid.connector.language.ICompoundCriteria;
-import org.teiid.connector.language.ICriteria;
-import org.teiid.connector.language.IDelete;
-import org.teiid.connector.language.IElement;
-import org.teiid.connector.language.IExistsCriteria;
-import org.teiid.connector.language.IExpression;
-import org.teiid.connector.language.IFrom;
-import org.teiid.connector.language.IFromItem;
-import org.teiid.connector.language.IFunction;
-import org.teiid.connector.language.IGroup;
-import org.teiid.connector.language.IGroupBy;
-import org.teiid.connector.language.IInCriteria;
-import org.teiid.connector.language.IInlineView;
-import org.teiid.connector.language.IInsert;
-import org.teiid.connector.language.IInsertExpressionValueSource;
-import org.teiid.connector.language.IIsNullCriteria;
-import org.teiid.connector.language.IJoin;
-import org.teiid.connector.language.ILanguageObject;
-import org.teiid.connector.language.ILikeCriteria;
-import org.teiid.connector.language.ILimit;
-import org.teiid.connector.language.ILiteral;
-import org.teiid.connector.language.INotCriteria;
-import org.teiid.connector.language.IOrderBy;
-import org.teiid.connector.language.IOrderByItem;
-import org.teiid.connector.language.IParameter;
-import org.teiid.connector.language.IPredicateCriteria;
-import org.teiid.connector.language.IProcedure;
-import org.teiid.connector.language.IQuery;
-import org.teiid.connector.language.IQueryCommand;
-import org.teiid.connector.language.IScalarSubquery;
-import org.teiid.connector.language.ISearchedCaseExpression;
-import org.teiid.connector.language.ISelect;
-import org.teiid.connector.language.ISelectSymbol;
-import org.teiid.connector.language.ISetClause;
-import org.teiid.connector.language.ISetClauseList;
-import org.teiid.connector.language.ISetQuery;
-import org.teiid.connector.language.ISubqueryCompareCriteria;
-import org.teiid.connector.language.ISubqueryInCriteria;
-import org.teiid.connector.language.IUpdate;
-import org.teiid.connector.language.IParameter.Direction;
-import org.teiid.connector.metadata.runtime.MetadataObject;
+import org.teiid.connector.language.AggregateFunction;
+import org.teiid.connector.language.AndOr;
+import org.teiid.connector.language.Argument;
+import org.teiid.connector.language.Call;
+import org.teiid.connector.language.ColumnReference;
+import org.teiid.connector.language.Command;
+import org.teiid.connector.language.Comparison;
+import org.teiid.connector.language.Condition;
+import org.teiid.connector.language.Delete;
+import org.teiid.connector.language.DerivedColumn;
+import org.teiid.connector.language.DerivedTable;
+import org.teiid.connector.language.Exists;
+import org.teiid.connector.language.Expression;
+import org.teiid.connector.language.ExpressionValueSource;
+import org.teiid.connector.language.Function;
+import org.teiid.connector.language.GroupBy;
+import org.teiid.connector.language.In;
+import org.teiid.connector.language.Insert;
+import org.teiid.connector.language.IsNull;
+import org.teiid.connector.language.Join;
+import org.teiid.connector.language.LanguageObject;
+import org.teiid.connector.language.Like;
+import org.teiid.connector.language.Limit;
+import org.teiid.connector.language.Literal;
+import org.teiid.connector.language.NamedTable;
+import org.teiid.connector.language.Not;
+import org.teiid.connector.language.OrderBy;
+import org.teiid.connector.language.QueryExpression;
+import org.teiid.connector.language.SQLReservedWords;
+import org.teiid.connector.language.ScalarSubquery;
+import org.teiid.connector.language.SearchedCase;
+import org.teiid.connector.language.SearchedWhenClause;
+import org.teiid.connector.language.Select;
+import org.teiid.connector.language.SetClause;
+import org.teiid.connector.language.SetQuery;
+import org.teiid.connector.language.SortSpecification;
+import org.teiid.connector.language.SubqueryComparison;
+import org.teiid.connector.language.SubqueryIn;
+import org.teiid.connector.language.TableReference;
+import org.teiid.connector.language.Update;
+import org.teiid.connector.language.Argument.Direction;
+import org.teiid.connector.language.SQLReservedWords.Tokens;
+import org.teiid.connector.language.SortSpecification.Ordering;
+import org.teiid.connector.metadata.runtime.AbstractMetadataRecord;
import org.teiid.connector.visitor.framework.AbstractLanguageVisitor;
import com.metamatrix.common.types.DataTypeManager;
@@ -97,23 +95,19 @@
* @param id the id of the group or element
* @return the name of that element or group as defined in the source
*/
- protected String getName(MetadataObject object) {
- try {
- String nameInSource = object.getNameInSource();
- if(nameInSource != null && nameInSource.length() > 0) {
- return nameInSource;
- }
- return object.getName();
- } catch(ConnectorException e) {
- return object.getName();
+ protected String getName(AbstractMetadataRecord object) {
+ String nameInSource = object.getNameInSource();
+ if(nameInSource != null && nameInSource.length() > 0) {
+ return nameInSource;
}
+ return object.getName();
}
/**
* Appends the string form of the ILanguageObject to the current buffer.
* @param obj the language object instance
*/
- public void append(ILanguageObject obj) {
+ public void append(LanguageObject obj) {
if (obj == null) {
buffer.append(UNDEFINED);
} else {
@@ -126,12 +120,12 @@
* by creating a comma-separated list.
* @param items a list of ILanguageObjects
*/
- protected void append(List<? extends ILanguageObject> items) {
+ protected void append(List<? extends LanguageObject> items) {
if (items != null && items.size() != 0) {
append(items.get(0));
for (int i = 1; i < items.size(); i++) {
- buffer.append(SQLReservedWords.COMMA)
- .append(SQLReservedWords.SPACE);
+ buffer.append(Tokens.COMMA)
+ .append(Tokens.SPACE);
append(items.get(i));
}
}
@@ -142,12 +136,12 @@
* by creating a comma-separated list.
* @param items an array of ILanguageObjects
*/
- protected void append(ILanguageObject[] items) {
+ protected void append(LanguageObject[] items) {
if (items != null && items.length != 0) {
append(items[0]);
for (int i = 1; i < items.length; i++) {
- buffer.append(SQLReservedWords.COMMA)
- .append(SQLReservedWords.SPACE);
+ buffer.append(Tokens.COMMA)
+ .append(Tokens.SPACE);
append(items[i]);
}
}
@@ -166,94 +160,69 @@
return buffer.toString();
}
- /**
- * @see com.metamatrix.data.visitor.LanguageObjectVisitor#visit(org.teiid.connector.language.IAggregate)
- */
- public void visit(IAggregate obj) {
+ public void visit(AggregateFunction obj) {
buffer.append(obj.getName())
- .append(SQLReservedWords.LPAREN);
+ .append(Tokens.LPAREN);
if ( obj.isDistinct()) {
buffer.append(SQLReservedWords.DISTINCT)
- .append(SQLReservedWords.SPACE);
+ .append(Tokens.SPACE);
}
if (obj.getExpression() == null) {
- buffer.append(SQLReservedWords.ALL_COLS);
+ buffer.append(Tokens.ALL_COLS);
} else {
append(obj.getExpression());
}
- buffer.append(SQLReservedWords.RPAREN);
+ buffer.append(Tokens.RPAREN);
}
- /**
- * @see com.metamatrix.data.visitor.LanguageObjectVisitor#visit(org.teiid.connector.language.ICompareCriteria)
- */
- public void visit(ICompareCriteria obj) {
+ public void visit(Comparison obj) {
append(obj.getLeftExpression());
- buffer.append(SQLReservedWords.SPACE);
-
- switch(obj.getOperator()) {
- case EQ: buffer.append(SQLReservedWords.EQ); break;
- case GE: buffer.append(SQLReservedWords.GE); break;
- case GT: buffer.append(SQLReservedWords.GT); break;
- case LE: buffer.append(SQLReservedWords.LE); break;
- case LT: buffer.append(SQLReservedWords.LT); break;
- case NE: buffer.append(SQLReservedWords.NE); break;
- default: buffer.append(UNDEFINED);
- }
- buffer.append(SQLReservedWords.SPACE);
+ buffer.append(Tokens.SPACE);
+ buffer.append(obj.getOperator());
+ buffer.append(Tokens.SPACE);
append(obj.getRightExpression());
}
- /**
- * @see com.metamatrix.data.visitor.LanguageObjectVisitor#visit(org.teiid.connector.language.ICompoundCriteria)
- */
- public void visit(ICompoundCriteria obj) {
- String opString = null;
- switch(obj.getOperator()) {
- case AND: opString = SQLReservedWords.AND; break;
- case OR: opString = SQLReservedWords.OR; break;
- default: opString = UNDEFINED;
- }
-
- List criteria = obj.getCriteria();
- if (criteria == null || criteria.size() == 0) {
- buffer.append(UNDEFINED);
- } else if(criteria.size() == 1) {
- // Special case - should really never happen, but we are tolerant
- append((ILanguageObject)criteria.get(0));
- } else {
- buffer.append(SQLReservedWords.LPAREN);
- append((ILanguageObject)criteria.get(0));
- buffer.append(SQLReservedWords.RPAREN);
- for (int i = 1; i < criteria.size(); i++) {
- buffer.append(SQLReservedWords.SPACE)
- .append(opString)
- .append(SQLReservedWords.SPACE)
- .append(SQLReservedWords.LPAREN);
- append((ILanguageObject)criteria.get(i));
- buffer.append(SQLReservedWords.RPAREN);
- }
-
- }
+ public void visit(AndOr obj) {
+ String opString = obj.getOperator().toString();
+
+ appendNestedCondition(obj, obj.getLeftCondition());
+ buffer.append(Tokens.SPACE)
+ .append(opString)
+ .append(Tokens.SPACE);
+ appendNestedCondition(obj, obj.getRightCondition());
}
+
+ protected void appendNestedCondition(AndOr parent, Condition condition) {
+ if (condition instanceof AndOr) {
+ AndOr nested = (AndOr)condition;
+ if (nested.getOperator() != parent.getOperator()) {
+ buffer.append(Tokens.LPAREN);
+ append(condition);
+ buffer.append(Tokens.RPAREN);
+ return;
+ }
+ }
+ append(condition);
+ }
/**
- * @see com.metamatrix.data.visitor.LanguageObjectVisitor#visit(org.teiid.connector.language.IDelete)
+ * @see com.metamatrix.data.visitor.LanguageObjectVisitor#visit(org.teiid.connector.language.Delete)
*/
- public void visit(IDelete obj) {
+ public void visit(Delete obj) {
buffer.append(SQLReservedWords.DELETE)
- .append(SQLReservedWords.SPACE);
+ .append(Tokens.SPACE);
buffer.append(getSourceComment(obj));
buffer.append(SQLReservedWords.FROM)
- .append(SQLReservedWords.SPACE);
- append(obj.getGroup());
- if (obj.getCriteria() != null) {
- buffer.append(SQLReservedWords.SPACE)
+ .append(Tokens.SPACE);
+ append(obj.getTable());
+ if (obj.getWhere() != null) {
+ buffer.append(Tokens.SPACE)
.append(SQLReservedWords.WHERE)
- .append(SQLReservedWords.SPACE);
- append(obj.getCriteria());
+ .append(Tokens.SPACE);
+ append(obj.getWhere());
}
}
@@ -278,30 +247,30 @@
}
/**
- * @see com.metamatrix.data.visitor.LanguageObjectVisitor#visit(org.teiid.connector.language.IElement)
+ * @see com.metamatrix.data.visitor.LanguageObjectVisitor#visit(org.teiid.connector.language.ColumnReference)
*/
- public void visit(IElement obj) {
+ public void visit(ColumnReference obj) {
buffer.append(getElementName(obj, true));
}
- private String getElementName(IElement obj, boolean qualify) {
+ private String getElementName(ColumnReference obj, boolean qualify) {
String groupName = null;
- IGroup group = obj.getGroup();
+ NamedTable group = obj.getTable();
if (group != null && qualify) {
- if(group.getDefinition() != null) {
- groupName = group.getContext();
+ if(group.getCorrelationName() != null) {
+ groupName = group.getCorrelationName();
} else {
- MetadataObject groupID = group.getMetadataObject();
+ AbstractMetadataRecord groupID = group.getMetadataObject();
if(groupID != null) {
groupName = getName(groupID);
} else {
- groupName = group.getContext();
+ groupName = group.getName();
}
}
}
String elemShortName = null;
- MetadataObject elementID = obj.getMetadataObject();
+ AbstractMetadataRecord elementID = obj.getMetadataObject();
if(elementID != null) {
elemShortName = getName(elementID);
} else {
@@ -319,7 +288,7 @@
// If not, do normal logic: [group + "."] + element
if(groupName != null) {
elementName.append(groupName);
- elementName.append(SQLReservedWords.DOT);
+ elementName.append(Tokens.DOT);
}
elementName.append(elemShortName);
return elementName.toString();
@@ -341,9 +310,9 @@
/**
* @see com.metamatrix.data.visitor.LanguageObjectVisitor#visit(com.metamatrix.data.language.IExecute)
*/
- public void visit(IProcedure obj) {
+ public void visit(Call obj) {
buffer.append(SQLReservedWords.EXEC)
- .append(SQLReservedWords.SPACE);
+ .append(Tokens.SPACE);
if(obj.getMetadataObject() != null) {
buffer.append(getName(obj.getMetadataObject()));
@@ -351,139 +320,119 @@
buffer.append(obj.getProcedureName());
}
- buffer.append(SQLReservedWords.LPAREN);
- final List params = obj.getParameters();
+ buffer.append(Tokens.LPAREN);
+ final List<Argument> params = obj.getArguments();
if (params != null && params.size() != 0) {
- IParameter param = null;
+ Argument param = null;
for (int i = 0; i < params.size(); i++) {
- param = (IParameter)params.get(i);
+ param = params.get(i);
if (param.getDirection() == Direction.IN || param.getDirection() == Direction.INOUT) {
if (i != 0) {
- buffer.append(SQLReservedWords.COMMA)
- .append(SQLReservedWords.SPACE);
+ buffer.append(Tokens.COMMA)
+ .append(Tokens.SPACE);
}
- if (param.getValue() != null) {
- buffer.append(param.getValue().toString());
- } else {
- buffer.append(UNDEFINED_PARAM);
- }
+ append(param);
}
}
}
- buffer.append(SQLReservedWords.RPAREN);
+ buffer.append(Tokens.RPAREN);
}
/*
* @see com.metamatrix.data.visitor.LanguageObjectVisitor#visit(com.metamatrix.data.language.IExistsCriteria)
*/
- public void visit(IExistsCriteria obj) {
+ public void visit(Exists obj) {
buffer.append(SQLReservedWords.EXISTS)
- .append(SQLReservedWords.SPACE)
- .append(SQLReservedWords.LPAREN);
- append(obj.getQuery());
- buffer.append(SQLReservedWords.RPAREN);
+ .append(Tokens.SPACE)
+ .append(Tokens.LPAREN);
+ append(obj.getSubquery());
+ buffer.append(Tokens.RPAREN);
}
- /**
- * @see com.metamatrix.data.visitor.LanguageObjectVisitor#visit(org.teiid.connector.language.IFrom)
- */
- public void visit(IFrom obj) {
- buffer.append(SQLReservedWords.FROM)
- .append(SQLReservedWords.SPACE);
- append(obj.getItems());
- }
-
protected boolean isInfixFunction(String function) {
return infixFunctions.contains(function);
}
/**
- * @see com.metamatrix.data.visitor.LanguageObjectVisitor#visit(org.teiid.connector.language.IFunction)
+ * @see com.metamatrix.data.visitor.LanguageObjectVisitor#visit(org.teiid.connector.language.Function)
*/
- public void visit(IFunction obj) {
+ public void visit(Function obj) {
String name = obj.getName();
- List<IExpression> args = obj.getParameters();
+ List<Expression> args = obj.getParameters();
if(name.equalsIgnoreCase(SQLReservedWords.CONVERT) || name.equalsIgnoreCase(SQLReservedWords.CAST)) {
- Object typeValue = ((ILiteral)args.get(1)).getValue();
+ Object typeValue = ((Literal)args.get(1)).getValue();
buffer.append(name);
- buffer.append(SQLReservedWords.LPAREN);
+ buffer.append(Tokens.LPAREN);
append(args.get(0));
if(name.equalsIgnoreCase(SQLReservedWords.CONVERT)) {
- buffer.append(SQLReservedWords.COMMA);
- buffer.append(SQLReservedWords.SPACE);
+ buffer.append(Tokens.COMMA);
+ buffer.append(Tokens.SPACE);
} else {
- buffer.append(SQLReservedWords.SPACE);
+ buffer.append(Tokens.SPACE);
buffer.append(SQLReservedWords.AS);
- buffer.append(SQLReservedWords.SPACE);
+ buffer.append(Tokens.SPACE);
}
buffer.append(typeValue);
- buffer.append(SQLReservedWords.RPAREN);
+ buffer.append(Tokens.RPAREN);
} else if(isInfixFunction(name)) {
- buffer.append(SQLReservedWords.LPAREN);
+ buffer.append(Tokens.LPAREN);
if(args != null) {
for(int i=0; i<args.size(); i++) {
append(args.get(i));
if(i < (args.size()-1)) {
- buffer.append(SQLReservedWords.SPACE);
+ buffer.append(Tokens.SPACE);
buffer.append(name);
- buffer.append(SQLReservedWords.SPACE);
+ buffer.append(Tokens.SPACE);
}
}
}
- buffer.append(SQLReservedWords.RPAREN);
+ buffer.append(Tokens.RPAREN);
} else if(name.equalsIgnoreCase(SQLReservedWords.TIMESTAMPADD) || name.equalsIgnoreCase(SQLReservedWords.TIMESTAMPDIFF)) {
buffer.append(name);
- buffer.append(SQLReservedWords.LPAREN);
+ buffer.append(Tokens.LPAREN);
if(args != null && args.size() > 0) {
- buffer.append(((ILiteral)args.get(0)).getValue());
+ buffer.append(((Literal)args.get(0)).getValue());
for(int i=1; i<args.size(); i++) {
- buffer.append(SQLReservedWords.COMMA);
- buffer.append(SQLReservedWords.SPACE);
+ buffer.append(Tokens.COMMA);
+ buffer.append(Tokens.SPACE);
append(args.get(i));
}
}
- buffer.append(SQLReservedWords.RPAREN);
+ buffer.append(Tokens.RPAREN);
} else {
buffer.append(obj.getName())
- .append(SQLReservedWords.LPAREN);
+ .append(Tokens.LPAREN);
append(obj.getParameters());
- buffer.append(SQLReservedWords.RPAREN);
+ buffer.append(Tokens.RPAREN);
}
}
- /**
- * @see com.metamatrix.data.visitor.LanguageObjectVisitor#visit(org.teiid.connector.language.IGroup)
- */
- public void visit(IGroup obj) {
- MetadataObject groupID = obj.getMetadataObject();
+ public void visit(NamedTable obj) {
+ AbstractMetadataRecord groupID = obj.getMetadataObject();
if(groupID != null) {
buffer.append(getName(groupID));
} else {
- if(obj.getDefinition() == null) {
- buffer.append(obj.getContext());
- } else {
- buffer.append(obj.getDefinition());
- }
+ buffer.append(obj.getName());
}
- if (obj.getDefinition() != null) {
- buffer.append(SQLReservedWords.SPACE);
+ if (obj.getCorrelationName() != null) {
+ buffer.append(Tokens.SPACE);
if (useAsInGroupAlias()){
buffer.append(SQLReservedWords.AS)
- .append(SQLReservedWords.SPACE);
+ .append(Tokens.SPACE);
}
- buffer.append(obj.getContext());
+ buffer.append(obj.getCorrelationName());
}
}
@@ -499,110 +448,98 @@
}
/**
- * @see com.metamatrix.data.visitor.LanguageObjectVisitor#visit(org.teiid.connector.language.IGroupBy)
+ * @see com.metamatrix.data.visitor.LanguageObjectVisitor#visit(org.teiid.connector.language.GroupBy)
*/
- public void visit(IGroupBy obj) {
+ public void visit(GroupBy obj) {
buffer.append(SQLReservedWords.GROUP)
- .append(SQLReservedWords.SPACE)
+ .append(Tokens.SPACE)
.append(SQLReservedWords.BY)
- .append(SQLReservedWords.SPACE);
+ .append(Tokens.SPACE);
append(obj.getElements());
}
/**
- * @see com.metamatrix.data.visitor.LanguageObjectVisitor#visit(org.teiid.connector.language.IInCriteria)
+ * @see com.metamatrix.data.visitor.LanguageObjectVisitor#visit(org.teiid.connector.language.In)
*/
- public void visit(IInCriteria obj) {
+ public void visit(In obj) {
append(obj.getLeftExpression());
if (obj.isNegated()) {
- buffer.append(SQLReservedWords.SPACE)
+ buffer.append(Tokens.SPACE)
.append(SQLReservedWords.NOT);
}
- buffer.append(SQLReservedWords.SPACE)
+ buffer.append(Tokens.SPACE)
.append(SQLReservedWords.IN)
- .append(SQLReservedWords.SPACE)
- .append(SQLReservedWords.LPAREN);
+ .append(Tokens.SPACE)
+ .append(Tokens.LPAREN);
append(obj.getRightExpressions());
- buffer.append(SQLReservedWords.RPAREN);
+ buffer.append(Tokens.RPAREN);
}
- public void visit(IInlineView obj) {
- buffer.append(SQLReservedWords.LPAREN);
- if (obj.getOutput() != null) {
- buffer.append(obj.getOutput());
- } else {
- append(obj.getQuery());
- }
- buffer.append(SQLReservedWords.RPAREN);
- buffer.append(SQLReservedWords.SPACE);
+ public void visit(DerivedTable obj) {
+ buffer.append(Tokens.LPAREN);
+ append(obj.getQuery());
+ buffer.append(Tokens.RPAREN);
+ buffer.append(Tokens.SPACE);
if(useAsInGroupAlias()) {
buffer.append(SQLReservedWords.AS);
- buffer.append(SQLReservedWords.SPACE);
+ buffer.append(Tokens.SPACE);
}
- buffer.append(obj.getContext());
+ buffer.append(obj.getCorrelationName());
}
/**
- * @see com.metamatrix.data.visitor.LanguageObjectVisitor#visit(org.teiid.connector.language.IInsert)
+ * @see com.metamatrix.data.visitor.LanguageObjectVisitor#visit(org.teiid.connector.language.Insert)
*/
- public void visit(IInsert obj) {
- buffer.append(SQLReservedWords.INSERT).append(SQLReservedWords.SPACE);
+ public void visit(Insert obj) {
+ buffer.append(SQLReservedWords.INSERT).append(Tokens.SPACE);
buffer.append(getSourceComment(obj));
- buffer.append(SQLReservedWords.INTO).append(SQLReservedWords.SPACE);
- append(obj.getGroup());
- if (obj.getElements() != null && obj.getElements().size() != 0) {
- buffer.append(SQLReservedWords.SPACE).append(SQLReservedWords.LPAREN);
+ buffer.append(SQLReservedWords.INTO).append(Tokens.SPACE);
+ append(obj.getTable());
+ buffer.append(Tokens.SPACE).append(Tokens.LPAREN);
- int elementCount = obj.getElements().size();
- for (int i = 0; i < elementCount; i++) {
- buffer.append(getElementName(obj.getElements().get(i), false));
- if (i < elementCount - 1) {
- buffer.append(SQLReservedWords.COMMA);
- buffer.append(SQLReservedWords.SPACE);
- }
+ int elementCount = obj.getColumns().size();
+ for (int i = 0; i < elementCount; i++) {
+ buffer.append(getElementName(obj.getColumns().get(i), false));
+ if (i < elementCount - 1) {
+ buffer.append(Tokens.COMMA);
+ buffer.append(Tokens.SPACE);
}
-
- buffer.append(SQLReservedWords.RPAREN);
}
- buffer.append(SQLReservedWords.SPACE);
+
+ buffer.append(Tokens.RPAREN);
+ buffer.append(Tokens.SPACE);
append(obj.getValueSource());
}
@Override
- public void visit(IInsertExpressionValueSource obj) {
- buffer.append(SQLReservedWords.VALUES).append(SQLReservedWords.SPACE).append(SQLReservedWords.LPAREN);
+ public void visit(ExpressionValueSource obj) {
+ buffer.append(SQLReservedWords.VALUES).append(Tokens.SPACE).append(Tokens.LPAREN);
append(obj.getValues());
- buffer.append(SQLReservedWords.RPAREN);
+ buffer.append(Tokens.RPAREN);
}
- /**
- * @see com.metamatrix.data.visitor.LanguageObjectVisitor#visit(org.teiid.connector.language.IIsNullCriteria)
- */
- public void visit(IIsNullCriteria obj) {
+ public void visit(IsNull obj) {
append(obj.getExpression());
- buffer.append(SQLReservedWords.SPACE)
+ buffer.append(Tokens.SPACE)
.append(SQLReservedWords.IS)
- .append(SQLReservedWords.SPACE);
+ .append(Tokens.SPACE);
if (obj.isNegated()) {
buffer.append(SQLReservedWords.NOT)
- .append(SQLReservedWords.SPACE);
+ .append(Tokens.SPACE);
}
buffer.append(SQLReservedWords.NULL);
}
- /**
- * @see com.metamatrix.data.visitor.LanguageObjectVisitor#visit(org.teiid.connector.language.IJoin)
- */
- public void visit(IJoin obj) {
- IFromItem leftItem = obj.getLeftItem();
- if(useParensForJoins() && leftItem instanceof IJoin) {
- buffer.append(SQLReservedWords.LPAREN);
+ public void visit(Join obj) {
+ TableReference leftItem = obj.getLeftItem();
+ if(useParensForJoins() && leftItem instanceof Join) {
+ buffer.append(Tokens.LPAREN);
append(leftItem);
- buffer.append(SQLReservedWords.RPAREN);
+ buffer.append(Tokens.RPAREN);
} else {
append(leftItem);
}
- buffer.append(SQLReservedWords.SPACE);
+ buffer.append(Tokens.SPACE);
switch(obj.getJoinType()) {
case CROSS_JOIN:
@@ -610,7 +547,7 @@
break;
case FULL_OUTER_JOIN:
buffer.append(SQLReservedWords.FULL)
- .append(SQLReservedWords.SPACE)
+ .append(Tokens.SPACE)
.append(SQLReservedWords.OUTER);
break;
case INNER_JOIN:
@@ -618,100 +555,77 @@
break;
case LEFT_OUTER_JOIN:
buffer.append(SQLReservedWords.LEFT)
- .append(SQLReservedWords.SPACE)
+ .append(Tokens.SPACE)
.append(SQLReservedWords.OUTER);
break;
case RIGHT_OUTER_JOIN:
buffer.append(SQLReservedWords.RIGHT)
- .append(SQLReservedWords.SPACE)
+ .append(Tokens.SPACE)
.append(SQLReservedWords.OUTER);
break;
default: buffer.append(UNDEFINED);
}
- buffer.append(SQLReservedWords.SPACE)
+ buffer.append(Tokens.SPACE)
.append(SQLReservedWords.JOIN)
- .append(SQLReservedWords.SPACE);
+ .append(Tokens.SPACE);
- IFromItem rightItem = obj.getRightItem();
- if(rightItem instanceof IJoin && (useParensForJoins() || obj.getJoinType() == IJoin.JoinType.CROSS_JOIN)) {
- buffer.append(SQLReservedWords.LPAREN);
+ TableReference rightItem = obj.getRightItem();
+ if(rightItem instanceof Join && (useParensForJoins() || obj.getJoinType() == Join.JoinType.CROSS_JOIN)) {
+ buffer.append(Tokens.LPAREN);
append(rightItem);
- buffer.append(SQLReservedWords.RPAREN);
+ buffer.append(Tokens.RPAREN);
} else {
append(rightItem);
}
- final List criteria = obj.getCriteria();
- if (criteria != null && criteria.size() != 0) {
- buffer.append(SQLReservedWords.SPACE)
+ final Condition condition = obj.getCondition();
+ if (condition != null) {
+ buffer.append(Tokens.SPACE)
.append(SQLReservedWords.ON)
- .append(SQLReservedWords.SPACE);
-
- Iterator critIter = criteria.iterator();
- while(critIter.hasNext()) {
- ICriteria crit = (ICriteria) critIter.next();
- if(crit instanceof IPredicateCriteria) {
- append(crit);
- } else {
- buffer.append(SQLReservedWords.LPAREN);
- append(crit);
- buffer.append(SQLReservedWords.RPAREN);
- }
-
- if(critIter.hasNext()) {
- buffer.append(SQLReservedWords.SPACE)
- .append(SQLReservedWords.AND)
- .append(SQLReservedWords.SPACE);
- }
- }
+ .append(Tokens.SPACE);
+ append(condition);
}
}
- /**
- * @see com.metamatrix.data.visitor.LanguageObjectVisitor#visit(org.teiid.connector.language.ILikeCriteria)
- */
- public void visit(ILikeCriteria obj) {
+ public void visit(Like obj) {
append(obj.getLeftExpression());
if (obj.isNegated()) {
- buffer.append(SQLReservedWords.SPACE)
+ buffer.append(Tokens.SPACE)
.append(SQLReservedWords.NOT);
}
- buffer.append(SQLReservedWords.SPACE)
+ buffer.append(Tokens.SPACE)
.append(SQLReservedWords.LIKE)
- .append(SQLReservedWords.SPACE);
+ .append(Tokens.SPACE);
append(obj.getRightExpression());
if (obj.getEscapeCharacter() != null) {
- buffer.append(SQLReservedWords.SPACE)
+ buffer.append(Tokens.SPACE)
.append(SQLReservedWords.ESCAPE)
- .append(SQLReservedWords.SPACE)
- .append(SQLReservedWords.QUOTE)
+ .append(Tokens.SPACE)
+ .append(Tokens.QUOTE)
.append(obj.getEscapeCharacter().toString())
- .append(SQLReservedWords.QUOTE);
+ .append(Tokens.QUOTE);
}
}
- public void visit(ILimit obj) {
+ public void visit(Limit obj) {
buffer.append(SQLReservedWords.LIMIT)
- .append(SQLReservedWords.SPACE);
+ .append(Tokens.SPACE);
if (obj.getRowOffset() > 0) {
buffer.append(obj.getRowOffset())
- .append(SQLReservedWords.COMMA)
- .append(SQLReservedWords.SPACE);
+ .append(Tokens.COMMA)
+ .append(Tokens.SPACE);
}
buffer.append(obj.getRowLimit());
}
- /**
- * @see com.metamatrix.data.visitor.LanguageObjectVisitor#visit(org.teiid.connector.language.ILiteral)
- */
- public void visit(ILiteral obj) {
+ public void visit(Literal obj) {
if (obj.isBindValue()) {
buffer.append("?"); //$NON-NLS-1$
} else if (obj.getValue() == null) {
buffer.append(SQLReservedWords.NULL);
} else {
- Class type = obj.getType();
+ Class<?> type = obj.getType();
String val = obj.getValue().toString();
if(Number.class.isAssignableFrom(type)) {
buffer.append(val);
@@ -732,277 +646,218 @@
.append(val)
.append("'}"); //$NON-NLS-1$
} else {
- buffer.append(SQLReservedWords.QUOTE)
- .append(escapeString(val, SQLReservedWords.QUOTE))
- .append(SQLReservedWords.QUOTE);
+ buffer.append(Tokens.QUOTE)
+ .append(escapeString(val, Tokens.QUOTE))
+ .append(Tokens.QUOTE);
}
}
}
- /**
- * @see com.metamatrix.data.visitor.LanguageObjectVisitor#visit(org.teiid.connector.language.INotCriteria)
- */
- public void visit(INotCriteria obj) {
+ public void visit(Not obj) {
buffer.append(SQLReservedWords.NOT)
- .append(SQLReservedWords.SPACE)
- .append(SQLReservedWords.LPAREN);
+ .append(Tokens.SPACE)
+ .append(Tokens.LPAREN);
append(obj.getCriteria());
- buffer.append(SQLReservedWords.RPAREN);
+ buffer.append(Tokens.RPAREN);
}
- /**
- * @see com.metamatrix.data.visitor.LanguageObjectVisitor#visit(org.teiid.connector.language.IOrderBy)
- */
- public void visit(IOrderBy obj) {
+ public void visit(OrderBy obj) {
buffer.append(SQLReservedWords.ORDER)
- .append(SQLReservedWords.SPACE)
+ .append(Tokens.SPACE)
.append(SQLReservedWords.BY)
- .append(SQLReservedWords.SPACE);
- append(obj.getItems());
+ .append(Tokens.SPACE);
+ append(obj.getSortSpecifications());
}
- /**
- * @see com.metamatrix.data.visitor.LanguageObjectVisitor#visit(org.teiid.connector.language.IOrderByItem)
- */
- public void visit(IOrderByItem obj) {
- if(obj.getName() != null) {
- String name = getShortName(obj.getName());
- buffer.append(name);
- } else if (obj.getElement() != null) {
- append(obj.getElement());
- } else {
- buffer.append(UNDEFINED);
- }
- if (obj.getDirection() == IOrderByItem.DESC) {
- buffer.append(SQLReservedWords.SPACE)
+ public void visit(SortSpecification obj) {
+ append(obj.getExpression());
+ if (obj.getOrdering() == Ordering.DESC) {
+ buffer.append(Tokens.SPACE)
.append(SQLReservedWords.DESC);
} // Don't print default "ASC"
}
- /**
- * @see com.metamatrix.data.visitor.LanguageObjectVisitor#visit(org.teiid.connector.language.IParameter)
- */
- public void visit(IParameter obj) {
- if (obj.getValue() == null) {
- buffer.append(UNDEFINED_PARAM);
- } else if (obj.getValue() == null) {
- buffer.append(SQLReservedWords.NULL);
- } else {
- buffer.append(obj.getValue().toString());
- }
+ public void visit(Argument obj) {
+ buffer.append(obj.getArgumentValue());
}
- /**
- * @see com.metamatrix.data.visitor.LanguageObjectVisitor#visit(org.teiid.connector.language.IQuery)
- */
- public void visit(IQuery obj) {
- visitSelect(obj.getSelect(), obj);
+ public void visit(Select obj) {
+ buffer.append(SQLReservedWords.SELECT).append(Tokens.SPACE);
+ buffer.append(getSourceComment(obj));
+ if (obj.isDistinct()) {
+ buffer.append(SQLReservedWords.DISTINCT).append(Tokens.SPACE);
+ }
+ if (useSelectLimit() && obj.getLimit() != null) {
+ append(obj.getLimit());
+ buffer.append(Tokens.SPACE);
+ }
+ append(obj.getDerivedColumns());
if (obj.getFrom() != null) {
- buffer.append(SQLReservedWords.SPACE);
+ buffer.append(Tokens.SPACE).append(SQLReservedWords.FROM).append(Tokens.SPACE);
append(obj.getFrom());
}
if (obj.getWhere() != null) {
- buffer.append(SQLReservedWords.SPACE)
+ buffer.append(Tokens.SPACE)
.append(SQLReservedWords.WHERE)
- .append(SQLReservedWords.SPACE);
+ .append(Tokens.SPACE);
append(obj.getWhere());
}
if (obj.getGroupBy() != null) {
- buffer.append(SQLReservedWords.SPACE);
+ buffer.append(Tokens.SPACE);
append(obj.getGroupBy());
}
if (obj.getHaving() != null) {
- buffer.append(SQLReservedWords.SPACE)
+ buffer.append(Tokens.SPACE)
.append(SQLReservedWords.HAVING)
- .append(SQLReservedWords.SPACE);
+ .append(Tokens.SPACE);
append(obj.getHaving());
}
if (obj.getOrderBy() != null) {
- buffer.append(SQLReservedWords.SPACE);
+ buffer.append(Tokens.SPACE);
append(obj.getOrderBy());
}
if (!useSelectLimit() && obj.getLimit() != null) {
- buffer.append(SQLReservedWords.SPACE);
+ buffer.append(Tokens.SPACE);
append(obj.getLimit());
}
}
- /**
- * @see com.metamatrix.data.visitor.LanguageObjectVisitor#visit(org.teiid.connector.language.ISearchedCaseExpression)
- */
- public void visit(ISearchedCaseExpression obj) {
+ public void visit(SearchedCase obj) {
buffer.append(SQLReservedWords.CASE);
- final int whenCount = obj.getWhenCount();
- for (int i = 0; i < whenCount; i++) {
- buffer.append(SQLReservedWords.SPACE)
- .append(SQLReservedWords.WHEN)
- .append(SQLReservedWords.SPACE);
- append(obj.getWhenCriteria(i));
- buffer.append(SQLReservedWords.SPACE)
- .append(SQLReservedWords.THEN)
- .append(SQLReservedWords.SPACE);
- append(obj.getThenExpression(i));
- }
+ for (SearchedWhenClause swc : obj.getCases()) {
+ append(swc);
+ }
if (obj.getElseExpression() != null) {
- buffer.append(SQLReservedWords.SPACE)
+ buffer.append(Tokens.SPACE)
.append(SQLReservedWords.ELSE)
- .append(SQLReservedWords.SPACE);
+ .append(Tokens.SPACE);
append(obj.getElseExpression());
}
- buffer.append(SQLReservedWords.SPACE)
+ buffer.append(Tokens.SPACE)
.append(SQLReservedWords.END);
}
-
- /**
- * @see com.metamatrix.data.visitor.LanguageObjectVisitor#visit(org.teiid.connector.language.ISelect)
- */
- public void visit(ISelect obj) {
- visitSelect(obj, null);
+
+ @Override
+ public void visit(SearchedWhenClause obj) {
+ buffer.append(Tokens.SPACE).append(SQLReservedWords.WHEN)
+ .append(Tokens.SPACE);
+ append(obj.getCondition());
+ buffer.append(Tokens.SPACE).append(SQLReservedWords.THEN)
+ .append(Tokens.SPACE);
+ append(obj.getResult());
}
- private void visitSelect(ISelect obj, IQuery command) {
- buffer.append(SQLReservedWords.SELECT).append(SQLReservedWords.SPACE);
- buffer.append(getSourceComment(command));
- if (obj.isDistinct()) {
- buffer.append(SQLReservedWords.DISTINCT).append(SQLReservedWords.SPACE);
- }
- if (useSelectLimit() && command.getLimit() != null) {
- append(command.getLimit());
- buffer.append(SQLReservedWords.SPACE);
- }
- append(obj.getSelectSymbols());
- }
-
- protected String getSourceComment(ICommand command) {
+ protected String getSourceComment(Command command) {
return ""; //$NON-NLS-1$
}
- /*
- * @see com.metamatrix.data.visitor.LanguageObjectVisitor#visit(com.metamatrix.data.language.IScalarSubquery)
- */
- public void visit(IScalarSubquery obj) {
- buffer.append(SQLReservedWords.LPAREN);
- append(obj.getQuery());
- buffer.append(SQLReservedWords.RPAREN);
+ public void visit(ScalarSubquery obj) {
+ buffer.append(Tokens.LPAREN);
+ append(obj.getSubquery());
+ buffer.append(Tokens.RPAREN);
}
- /**
- * @see com.metamatrix.data.visitor.LanguageObjectVisitor#visit(org.teiid.connector.language.ISelectSymbol)
- */
- public void visit(ISelectSymbol obj) {
+ public void visit(DerivedColumn obj) {
append(obj.getExpression());
- if (obj.hasAlias()) {
- buffer.append(SQLReservedWords.SPACE)
+ if (obj.getAlias() != null) {
+ buffer.append(Tokens.SPACE)
.append(SQLReservedWords.AS)
- .append(SQLReservedWords.SPACE)
- .append(obj.getOutputName());
+ .append(Tokens.SPACE)
+ .append(obj.getAlias());
}
}
- /*
- * @see com.metamatrix.data.visitor.LanguageObjectVisitor#visit(com.metamatrix.data.language.ISubqueryCompareCriteria)
- */
- public void visit(ISubqueryCompareCriteria obj) {
+ public void visit(SubqueryComparison obj) {
append(obj.getLeftExpression());
- buffer.append(SQLReservedWords.SPACE);
+ buffer.append(Tokens.SPACE);
switch(obj.getOperator()) {
- case EQ: buffer.append(SQLReservedWords.EQ); break;
- case GE: buffer.append(SQLReservedWords.GE); break;
- case GT: buffer.append(SQLReservedWords.GT); break;
- case LE: buffer.append(SQLReservedWords.LE); break;
- case LT: buffer.append(SQLReservedWords.LT); break;
- case NE: buffer.append(SQLReservedWords.NE); break;
+ case EQ: buffer.append(Tokens.EQ); break;
+ case GE: buffer.append(Tokens.GE); break;
+ case GT: buffer.append(Tokens.GT); break;
+ case LE: buffer.append(Tokens.LE); break;
+ case LT: buffer.append(Tokens.LT); break;
+ case NE: buffer.append(Tokens.NE); break;
default: buffer.append(UNDEFINED);
}
- buffer.append(SQLReservedWords.SPACE);
+ buffer.append(Tokens.SPACE);
switch(obj.getQuantifier()) {
case ALL: buffer.append(SQLReservedWords.ALL); break;
case SOME: buffer.append(SQLReservedWords.SOME); break;
default: buffer.append(UNDEFINED);
}
- buffer.append(SQLReservedWords.SPACE);
- buffer.append(SQLReservedWords.LPAREN);
- append(obj.getQuery());
- buffer.append(SQLReservedWords.RPAREN);
+ buffer.append(Tokens.SPACE);
+ buffer.append(Tokens.LPAREN);
+ append(obj.getSubquery());
+ buffer.append(Tokens.RPAREN);
}
- /*
- * @see com.metamatrix.data.visitor.LanguageObjectVisitor#visit(com.metamatrix.data.language.ISubqueryInCriteria)
- */
- public void visit(ISubqueryInCriteria obj) {
+ public void visit(SubqueryIn obj) {
append(obj.getLeftExpression());
if (obj.isNegated()) {
- buffer.append(SQLReservedWords.SPACE)
+ buffer.append(Tokens.SPACE)
.append(SQLReservedWords.NOT);
}
- buffer.append(SQLReservedWords.SPACE)
+ buffer.append(Tokens.SPACE)
.append(SQLReservedWords.IN)
- .append(SQLReservedWords.SPACE)
- .append(SQLReservedWords.LPAREN);
- append(obj.getQuery());
- buffer.append(SQLReservedWords.RPAREN);
+ .append(Tokens.SPACE)
+ .append(Tokens.LPAREN);
+ append(obj.getSubquery());
+ buffer.append(Tokens.RPAREN);
}
- /**
- * @see com.metamatrix.data.visitor.LanguageObjectVisitor#visit(org.teiid.connector.language.IUpdate)
- */
- public void visit(IUpdate obj) {
+ public void visit(Update obj) {
buffer.append(SQLReservedWords.UPDATE)
- .append(SQLReservedWords.SPACE);
+ .append(Tokens.SPACE);
buffer.append(getSourceComment(obj));
- append(obj.getGroup());
- buffer.append(SQLReservedWords.SPACE)
+ append(obj.getTable());
+ buffer.append(Tokens.SPACE)
.append(SQLReservedWords.SET)
- .append(SQLReservedWords.SPACE);
+ .append(Tokens.SPACE);
append(obj.getChanges());
- if (obj.getCriteria() != null) {
- buffer.append(SQLReservedWords.SPACE)
+ if (obj.getWhere() != null) {
+ buffer.append(Tokens.SPACE)
.append(SQLReservedWords.WHERE)
- .append(SQLReservedWords.SPACE);
- append(obj.getCriteria());
+ .append(Tokens.SPACE);
+ append(obj.getWhere());
}
}
- public void visit(ISetClauseList obj) {
- append(obj.getClauses());
- }
-
- public void visit(ISetClause clause) {
+ public void visit(SetClause clause) {
buffer.append(getElementName(clause.getSymbol(), false));
- buffer.append(SQLReservedWords.SPACE).append(SQLReservedWords.EQ).append(SQLReservedWords.SPACE);
+ buffer.append(Tokens.SPACE).append(Tokens.EQ).append(Tokens.SPACE);
append(clause.getValue());
}
- public void visit(ISetQuery obj) {
+ public void visit(SetQuery obj) {
appendSetQuery(obj, obj.getLeftQuery(), false);
- buffer.append(SQLReservedWords.SPACE);
+ buffer.append(Tokens.SPACE);
appendSetOperation(obj.getOperation());
if(obj.isAll()) {
- buffer.append(SQLReservedWords.SPACE);
+ buffer.append(Tokens.SPACE);
buffer.append(SQLReservedWords.ALL);
}
- buffer.append(SQLReservedWords.SPACE);
+ buffer.append(Tokens.SPACE);
appendSetQuery(obj, obj.getRightQuery(), true);
- IOrderBy orderBy = obj.getOrderBy();
+ OrderBy orderBy = obj.getOrderBy();
if(orderBy != null) {
- buffer.append(SQLReservedWords.SPACE);
+ buffer.append(Tokens.SPACE);
append(orderBy);
}
- ILimit limit = obj.getLimit();
+ Limit limit = obj.getLimit();
if(limit != null) {
- buffer.append(SQLReservedWords.SPACE);
+ buffer.append(Tokens.SPACE);
append(limit);
}
}
- protected void appendSetOperation(ISetQuery.Operation operation) {
+ protected void appendSetOperation(SetQuery.Operation operation) {
buffer.append(operation);
}
@@ -1010,17 +865,17 @@
return false;
}
- protected void appendSetQuery(ISetQuery parent, IQueryCommand obj, boolean right) {
- if((!(obj instanceof ISetQuery) && useParensForSetQueries())
- || (right && obj instanceof ISetQuery
- && ((parent.isAll() && !((ISetQuery)obj).isAll())
- || parent.getOperation() != ((ISetQuery)obj).getOperation()))) {
- buffer.append(SQLReservedWords.LPAREN);
+ protected void appendSetQuery(SetQuery parent, QueryExpression obj, boolean right) {
+ if((!(obj instanceof SetQuery) && useParensForSetQueries())
+ || (right && obj instanceof SetQuery
+ && ((parent.isAll() && !((SetQuery)obj).isAll())
+ || parent.getOperation() != ((SetQuery)obj).getOperation()))) {
+ buffer.append(Tokens.LPAREN);
append(obj);
- buffer.append(SQLReservedWords.RPAREN);
+ buffer.append(Tokens.RPAREN);
} else {
- if (!parent.isAll() && obj instanceof ISetQuery) {
- ((ISetQuery)obj).setAll(false);
+ if (!parent.isAll() && obj instanceof SetQuery) {
+ ((SetQuery)obj).setAll(false);
}
append(obj);
}
@@ -1033,7 +888,7 @@
* command
* @return the SQL representation of that ILanguageObject hierarchy
*/
- public static String getSQLString(ILanguageObject obj) {
+ public static String getSQLString(LanguageObject obj) {
SQLStringVisitor visitor = new SQLStringVisitor();
visitor.append(obj);
return visitor.toString();
Deleted: trunk/connector-api/src/test/java/org/teiid/connector/TestCredentialMap.java
===================================================================
--- trunk/connector-api/src/test/java/org/teiid/connector/TestCredentialMap.java 2010-03-04 20:22:20 UTC (rev 1912)
+++ trunk/connector-api/src/test/java/org/teiid/connector/TestCredentialMap.java 2010-03-04 20:47:34 UTC (rev 1913)
@@ -1,350 +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.connector;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.teiid.connector.api.CredentialMap;
-
-
-import junit.framework.TestCase;
-
-/**
- * Note-- due to time constraints, tests make hard-coded assumptions that
- * keywords for system, user name, and password, are "system",
- * "user", and "password". The actual keywords are found in
- * com.metamatrix.platform.security.CredentialsMap: SYSTEM_KEYWORD,
- * USER_KEYWORD, and PASSWORD_KEYWORD.
- */
-public class TestCredentialMap extends TestCase {
-
- /**
- * Constructor for TestCredentialMap.
- * @param arg0
- */
- public TestCredentialMap(String arg0) {
- super(arg0);
- }
-
- public void testParseNullCredentialString() {
- String command = null;
- try {
- CredentialMap.parseCredentials(command);
- fail("Did not throw exception on null credential string"); //$NON-NLS-1$
- } catch (Exception ex) {
- }
- }
-
- public void testParseEmptyCredentialString() {
- String command = ""; //$NON-NLS-1$
- try {
- CredentialMap.parseCredentials(command);
- fail("Did not throw exception on empyt credential string"); //$NON-NLS-1$
- } catch (Exception ex) {
- }
- }
-
-
- public void testParseMissingSystem() {
- String command = "(user=myusername)"; //$NON-NLS-1$
- try {
- CredentialMap.parseCredentials(command);
- fail("Did not throw exception on missing system keyword"); //$NON-NLS-1$
- } catch (Exception ex) {
- }
- }
-
-
- public void testParseNoOpeningParen() {
- String command = "system=mysystem,username=me,mypassword=you)"; //$NON-NLS-1$
- try {
- CredentialMap.parseCredentials(command);
- fail("Did not throw exception on missing open paren"); //$NON-NLS-1$
- } catch (Exception ex) {
- }
- }
-
- public void testParseNoClosingParen() {
- String command = "(system=mysystem,username=me,mypassword=you"; //$NON-NLS-1$
- try {
- CredentialMap.parseCredentials(command);
- fail("Did not throw exception on missing closing paren"); //$NON-NLS-1$
- } catch (Exception ex) {
- }
- }
-
- public void testCaseSensitivity() throws Exception {
- String command = "(system=mysystem,username=me,mypassword=you)"; //$NON-NLS-1$
- CredentialMap cm = CredentialMap.parseCredentials(command);
- Map map = cm.getSystemCredentials("MySystem"); //$NON-NLS-1$
- if (map == null) {
- fail("Error looking up MySystem credentials using different cases."); //$NON-NLS-1$
- }
- }
-
- public void testCorrectMixedEntries() throws Exception {
- String command = "(system=system1,user=username1, password=password1 / " + //$NON-NLS-1$
- " system=system2,user=username2, password=password2 / " + //$NON-NLS-1$
- " system=system3,user=username3, password=password3 / " + //$NON-NLS-1$
- " system=system4,user=username4, password=password4)"; //$NON-NLS-1$
-
- CredentialMap cm = CredentialMap.parseCredentials(command);
- assertNotNull("Null CredentialsMap returned on correct entry", cm); //$NON-NLS-1$
-
- int mapSize = cm.getSystems().length;
- assertEquals("Incorrect number of entries in credential map", 4, //$NON-NLS-1$
- mapSize);
-
- // test 1st set of credentials
- String system = "system1"; //$NON-NLS-1$
- String userVal = "username1"; //$NON-NLS-1$
- String passwordVal = "password1"; //$NON-NLS-1$
-
- Map map = cm.getSystemCredentials(system);
- assertNotNull("Null Map returned on correct entry: system1", map); //$NON-NLS-1$
-
- String user = (String) map.get("user"); //$NON-NLS-1$
- assertTrue("Incorrect username returned for " + system, userVal.equals(user)); //$NON-NLS-1$
-
- String password = (String) map.get("password"); //$NON-NLS-1$
- assertTrue("Incorrect password returned for " + system, passwordVal.equals(password)); //$NON-NLS-1$
-
- // test 2nd set of credentials
- system = "system2"; //$NON-NLS-1$
- userVal = "username2"; //$NON-NLS-1$
- passwordVal = "password2"; //$NON-NLS-1$
-
- map = cm.getSystemCredentials(system);
- assertNotNull("Null Map returned on correct entry: " + system, map); //$NON-NLS-1$
-
- user = (String) map.get("user"); //$NON-NLS-1$
- assertTrue("Incorrect username returned for " + system, userVal.equals(user)); //$NON-NLS-1$
-
- password = (String) map.get("password"); //$NON-NLS-1$
- assertTrue("Incorrect password returned for " + system, passwordVal.equals(password)); //$NON-NLS-1$
-
- // test 3rd set of credentials
- system = "system3"; //$NON-NLS-1$
- userVal = "username3"; //$NON-NLS-1$
- passwordVal = "password3"; //$NON-NLS-1$
-
- map = cm.getSystemCredentials(system);
- assertNotNull("Null Map returned on correct entry: " + system, map); //$NON-NLS-1$
-
- user = (String) map.get("user"); //$NON-NLS-1$
- assertTrue("Incorrect username returned for " + system, userVal.equals(user)); //$NON-NLS-1$
-
- password = (String) map.get("password"); //$NON-NLS-1$
- assertTrue("Incorrect password returned for " + system, passwordVal.equals(password)); //$NON-NLS-1$
-
- // test 4th set of credentials
- system = "system4"; //$NON-NLS-1$
- userVal = "username4"; //$NON-NLS-1$
- passwordVal = "password4"; //$NON-NLS-1$
-
- map = cm.getSystemCredentials(system);
- assertNotNull("Null Map returned on correct entry: " + system, map); //$NON-NLS-1$
-
- user = (String) map.get("user"); //$NON-NLS-1$
- assertTrue("Incorrect username returned for " + system, userVal.equals(user)); //$NON-NLS-1$
-
- password = (String) map.get("password"); //$NON-NLS-1$
- assertTrue("Incorrect password returned for " + system, passwordVal.equals(password)); //$NON-NLS-1$
-
- }
-
- public void testEscapeCharacters() throws Exception {
- String command = "(system=test\\/system1,user=username1, password=\\=password1 / " + //$NON-NLS-1$
- " system=system2,user=username2, password=\\=\\,)\\/;password2 / " + //$NON-NLS-1$
- " system=system3,user=username3, password=\"\'\\password3 / " + //$NON-NLS-1$
- " system=system4,user=username4, password=\\password4)"; //$NON-NLS-1$
-
- CredentialMap cm = CredentialMap.parseCredentials(command);
- assertNotNull("Null CredentialsMap returned on correct entry", cm); //$NON-NLS-1$
-
- int mapSize = cm.getSystems().length;
- assertEquals("Incorrect number of entries in credential map", 4, //$NON-NLS-1$
- mapSize);
-
- // test 1st set of credentials
- String system = "test/system1"; //$NON-NLS-1$
- String userVal = "username1"; //$NON-NLS-1$
- String passwordVal = "=password1"; //$NON-NLS-1$
-
- Map map = cm.getSystemCredentials(system);
- assertNotNull("Null Map returned on correct entry: system1", map); //$NON-NLS-1$
-
- String user = (String) map.get("user"); //$NON-NLS-1$
- assertTrue("Incorrect username returned for " + system, userVal.equals(user)); //$NON-NLS-1$
- assertTrue("Incorrect username returned for " + system, userVal.equals(cm.getUser(system))); //$NON-NLS-1$
-
-
- String password = (String) map.get("password"); //$NON-NLS-1$
- assertTrue("Incorrect password returned for " + system, passwordVal.equals(password)); //$NON-NLS-1$
- assertTrue("Incorrect password returned for " + system, passwordVal.equals(cm.getPassword(system))); //$NON-NLS-1$
-
- // test 2nd set of credentials
- system = "system2"; //$NON-NLS-1$
- userVal = "username2"; //$NON-NLS-1$
- passwordVal = "=,)/;password2"; //$NON-NLS-1$
-
- map = cm.getSystemCredentials(system);
- assertNotNull("Null Map returned on correct entry: " + system, map); //$NON-NLS-1$
-
- user = (String) map.get("user"); //$NON-NLS-1$
- assertTrue("Incorrect username returned for " + system, userVal.equals(user)); //$NON-NLS-1$
- assertTrue("Incorrect username returned for " + system, userVal.equals(cm.getUser(system))); //$NON-NLS-1$
-
- password = (String) map.get("password"); //$NON-NLS-1$
- assertTrue("Incorrect password returned for " + system, passwordVal.equals(password)); //$NON-NLS-1$
- assertTrue("Incorrect password returned for " + system, passwordVal.equals(cm.getPassword(system))); //$NON-NLS-1$
-
- // test 3rd set of credentials
- system = "system3"; //$NON-NLS-1$
- userVal = "username3"; //$NON-NLS-1$
- passwordVal = "\"\'\\password3"; //$NON-NLS-1$
-
- map = cm.getSystemCredentials(system);
- assertNotNull("Null Map returned on correct entry: " + system, map); //$NON-NLS-1$
-
- user = (String) map.get("user"); //$NON-NLS-1$
- assertTrue("Incorrect username returned for " + system, userVal.equals(user)); //$NON-NLS-1$
- assertTrue("Incorrect username returned for " + system, userVal.equals(cm.getUser(system))); //$NON-NLS-1$
-
- password = (String) map.get("password"); //$NON-NLS-1$
- assertTrue("Incorrect password returned for " + system, passwordVal.equals(password)); //$NON-NLS-1$
- assertTrue("Incorrect password returned for " + system, passwordVal.equals(cm.getPassword(system))); //$NON-NLS-1$
-
- // test 4th set of credentials
- system = "system4"; //$NON-NLS-1$
- userVal = "username4"; //$NON-NLS-1$
- passwordVal = "\\password4"; //$NON-NLS-1$
-
- map = cm.getSystemCredentials(system);
- assertNotNull("Null Map returned on correct entry: " + system, map); //$NON-NLS-1$
-
- user = (String) map.get("user"); //$NON-NLS-1$
- assertTrue("Incorrect username returned for " + system, userVal.equals(user)); //$NON-NLS-1$
-
- password = (String) map.get("password"); //$NON-NLS-1$
- assertTrue("Incorrect password returned for " + system, passwordVal.equals(password)); //$NON-NLS-1$
-
- }
-
- private Map getDefaultCredentials() {
- Map defaults = new HashMap();
- defaults.put("user", "defaultUser"); //$NON-NLS-1$ //$NON-NLS-2$
- defaults.put("password", "defaultPassword"); //$NON-NLS-1$ //$NON-NLS-2$
- return defaults;
- }
-
- private Map getSystemCredentials() {
- Map map = new HashMap();
- map.put("user", "user1"); //$NON-NLS-1$ //$NON-NLS-2$
- map.put("password", "password1"); //$NON-NLS-1$ //$NON-NLS-2$
- map.put("bonus1", "ziggy"); //$NON-NLS-1$ //$NON-NLS-2$
- return map;
- }
-
- private Map getPartialSystemCredentials() {
- Map map = new HashMap();
- map.put("bonus2", "ziggy"); //$NON-NLS-1$ //$NON-NLS-2$
- return map;
- }
-
- public CredentialMap setupDefaultsTest(short mode, boolean setDefaults) {
- CredentialMap cm = new CredentialMap();
- if(setDefaults) {
- cm.setDefaultCredentials(getDefaultCredentials());
- }
- cm.addSystemCredentials("sys1", getSystemCredentials()); //$NON-NLS-1$
- cm.addSystemCredentials("sys2", getPartialSystemCredentials()); //$NON-NLS-1$
- cm.setDefaultCredentialMode(mode);
- return cm;
- }
-
- public void assertCredentialsMatch(Map expected, CredentialMap creds, String system) {
- Map sysCreds = creds.getSystemCredentials(system);
- assertEquals(expected, sysCreds);
- }
-
- public void testIgnoreDefaults() {
- CredentialMap cm = setupDefaultsTest(CredentialMap.MODE_IGNORE_DEFAULTS, true);
-
- assertCredentialsMatch(null, cm, "x"); //$NON-NLS-1$
- assertCredentialsMatch(getSystemCredentials(), cm, "sys1"); //$NON-NLS-1$
- assertCredentialsMatch(getPartialSystemCredentials(), cm, "sys2"); //$NON-NLS-1$
- }
-
- public void testGlobalDefaultsUnknownSystem() {
- CredentialMap cm = setupDefaultsTest(CredentialMap.MODE_USE_DEFAULTS_GLOBALLY, true);
-
- assertCredentialsMatch(getDefaultCredentials(), cm, "x"); //$NON-NLS-1$
- assertCredentialsMatch(getSystemCredentials(), cm, "sys1"); //$NON-NLS-1$
-
- // Get mixture of system and defaults
- Map mixed = new HashMap();
- mixed.putAll(getDefaultCredentials());
- mixed.putAll(getPartialSystemCredentials());
- assertCredentialsMatch(mixed, cm, "sys2"); //$NON-NLS-1$
- }
-
- public void testExistingDefaultsUnknownSystem() {
- CredentialMap cm = setupDefaultsTest(CredentialMap.MODE_USE_DEFAULTS_ON_EXISTING, true);
-
- assertCredentialsMatch(null, cm, "x"); //$NON-NLS-1$
- assertCredentialsMatch(getSystemCredentials(), cm, "sys1"); //$NON-NLS-1$
-
- // Get mixture of system and defaults
- Map mixed = new HashMap();
- mixed.putAll(getDefaultCredentials());
- mixed.putAll(getPartialSystemCredentials());
- assertCredentialsMatch(mixed, cm, "sys2"); //$NON-NLS-1$
- }
-
- public void testIgnoreWithNoDefaults() {
- CredentialMap cm = setupDefaultsTest(CredentialMap.MODE_IGNORE_DEFAULTS, false);
-
- assertCredentialsMatch(null, cm, "x"); //$NON-NLS-1$
- assertCredentialsMatch(getSystemCredentials(), cm, "sys1"); //$NON-NLS-1$
- assertCredentialsMatch(getPartialSystemCredentials(), cm, "sys2"); //$NON-NLS-1$
- }
-
- public void testGlobalDefaultsUnknownSystemNoDefaults() {
- CredentialMap cm = setupDefaultsTest(CredentialMap.MODE_USE_DEFAULTS_GLOBALLY, false);
-
- assertCredentialsMatch(null, cm, "x"); //$NON-NLS-1$
- assertCredentialsMatch(getSystemCredentials(), cm, "sys1"); //$NON-NLS-1$
- assertCredentialsMatch(getPartialSystemCredentials(), cm, "sys2"); //$NON-NLS-1$
- }
-
- public void testExistingDefaultsUnknownSystemNoDefaults() {
- CredentialMap cm = setupDefaultsTest(CredentialMap.MODE_USE_DEFAULTS_ON_EXISTING, false);
-
- assertCredentialsMatch(null, cm, "x"); //$NON-NLS-1$
- assertCredentialsMatch(getSystemCredentials(), cm, "sys1"); //$NON-NLS-1$
- assertCredentialsMatch(getPartialSystemCredentials(), cm, "sys2"); //$NON-NLS-1$
- }
-
-}
Copied: trunk/connector-api/src/test/java/org/teiid/connector/TestWrappedConnector.java (from rev 1900, branches/JCA/connector-api/src/test/java/org/teiid/connector/TestWrappedConnector.java)
===================================================================
--- trunk/connector-api/src/test/java/org/teiid/connector/TestWrappedConnector.java (rev 0)
+++ trunk/connector-api/src/test/java/org/teiid/connector/TestWrappedConnector.java 2010-03-04 20:47:34 UTC (rev 1913)
@@ -0,0 +1,71 @@
+/*
+ * 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.connector;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import java.util.Properties;
+
+import org.junit.Test;
+import org.mockito.Mockito;
+import org.teiid.connector.api.Connector;
+import org.teiid.connector.api.ConnectorCapabilities;
+import org.teiid.connector.api.ConnectorEnvironment;
+import org.teiid.connector.basic.BasicConnectorCapabilities;
+import org.teiid.connector.basic.WrappedConnector;
+
+
+public class TestWrappedConnector {
+
+ @Test public void testConnectorCapabilitiesOverride() throws Exception {
+
+ Connector c = Mockito.mock(Connector.class);
+ Mockito.stub(c.getCapabilities()).toReturn(new BasicConnectorCapabilities());
+ ConnectorEnvironment env = Mockito.mock(ConnectorEnvironment.class);
+ Mockito.stub(c.getConnectorEnvironment()).toReturn(env);
+
+ WrappedConnector connector = new WrappedConnector(c, null, null);
+
+ ConnectorCapabilities caps = connector.getCapabilities();
+ assertFalse(caps.supportsExistsCriteria());
+ assertFalse(caps.supportsExcept());
+
+
+ c = Mockito.mock(Connector.class);
+ Mockito.stub(c.getCapabilities()).toReturn(new BasicConnectorCapabilities());
+
+ connector = new WrappedConnector(c, null, null);
+
+ Properties props = new Properties();
+ props.setProperty("supportsExistsCriteria", "true"); //$NON-NLS-1$ //$NON-NLS-2$
+ props.setProperty("supportsExcept", "true"); //$NON-NLS-1$ //$NON-NLS-2$
+
+ env = Mockito.mock(ConnectorEnvironment.class);
+ Mockito.stub(env.getOverrideCapabilities()).toReturn(props);
+ Mockito.stub(c.getConnectorEnvironment()).toReturn(env);
+
+ caps = connector.getCapabilities();
+ assertTrue(caps.supportsExistsCriteria());
+ assertTrue(caps.supportsExcept());
+ }
+}
More information about the teiid-commits
mailing list