teiid SVN: r1305 - in trunk/connectors/connector-xml/src: main/java/com/metamatrix/connector/xml/base and 2 other directories.
by teiid-commits@lists.jboss.org
Author: jdoyle
Date: 2009-09-02 14:20:57 -0400 (Wed, 02 Sep 2009)
New Revision: 1305
Modified:
trunk/connectors/connector-xml/src/main/java/com/metamatrix/connector/xml/XMLConnectorState.java
trunk/connectors/connector-xml/src/main/java/com/metamatrix/connector/xml/base/XMLConnectorStateImpl.java
trunk/connectors/connector-xml/src/main/resources/connector-xml.xml
trunk/connectors/connector-xml/src/test/java/com/metamatrix/connector/xml/base/ProxyObjectFactory.java
trunk/connectors/connector-xml/src/test/java/com/metamatrix/connector/xml/base/TestXMLConnector.java
trunk/connectors/connector-xml/src/test/java/com/metamatrix/connector/xml/base/TestXMLConnectorState.java
Log:
TEEID-816
XML-Relational File connector throws NPE.
Cleaned up some cruft left over from the cache change.
Modified: trunk/connectors/connector-xml/src/main/java/com/metamatrix/connector/xml/XMLConnectorState.java
===================================================================
--- trunk/connectors/connector-xml/src/main/java/com/metamatrix/connector/xml/XMLConnectorState.java 2009-09-02 15:28:03 UTC (rev 1304)
+++ trunk/connectors/connector-xml/src/main/java/com/metamatrix/connector/xml/XMLConnectorState.java 2009-09-02 18:20:57 UTC (rev 1305)
@@ -33,29 +33,10 @@
public static final String STATE_CLASS_PROP = "ConnectorStateClass"; //$NON-NLS-1$
- /**
- * @return Returns the m_cacheTimeout.
- */
- public abstract int getCacheTimeoutSeconds();
-
- public abstract int getCacheTimeoutMillis();
-
public abstract boolean isPreprocess();
public abstract ConnectorCapabilities getConnectorCapabilities();
- public abstract int getMaxMemoryCacheSizeByte();
-
- public abstract int getMaxMemoryCacheSizeKB();
-
- public abstract int getMaxInMemoryStringSize();
-
- public abstract int getMaxFileCacheSizeKB();
-
- public abstract int getMaxFileCacheSizeByte();
-
- public abstract String getCacheLocation();
-
public abstract boolean isLogRequestResponse();
public abstract SAXFilterProvider getSAXFilterProvider();
Modified: trunk/connectors/connector-xml/src/main/java/com/metamatrix/connector/xml/base/XMLConnectorStateImpl.java
===================================================================
--- trunk/connectors/connector-xml/src/main/java/com/metamatrix/connector/xml/base/XMLConnectorStateImpl.java 2009-09-02 15:28:03 UTC (rev 1304)
+++ trunk/connectors/connector-xml/src/main/java/com/metamatrix/connector/xml/base/XMLConnectorStateImpl.java 2009-09-02 18:20:57 UTC (rev 1305)
@@ -37,18 +37,8 @@
public abstract class XMLConnectorStateImpl implements Cloneable,
XMLConnectorState {
- private int m_cacheTimeout;
-
- private int m_maxMemoryCacheSize;
-
- private int m_maxInMemoryStringSize;
-
- private int m_maxFileCacheSize;
-
private boolean m_preprocess;
- private String m_cacheLocation;
-
private String m_saxProviderClass;
private String m_queryPreprocessorClass;
@@ -57,22 +47,8 @@
private String m_pluggableInputStreamFilterClass;
- private static final int SECONDS_TO_MILLIS = 1000;
-
- private static final int KB_TO_BYTES = 1000;
-
- public static final String CACHE_TIMEOUT = "CacheTimeout"; //$NON-NLS-1$
-
public static final String CACHE_ENABLED = "CacheEnabled"; //$NON-NLS-1$
- public static final String MAX_IN_MEMORY_STRING_SIZE = "MaxInMemoryStringSize"; //$NON-NLS-1$
-
- public static final String MAX_MEMORY_CACHE_SIZE = "MaxMemoryCacheSize"; //$NON-NLS-1$
-
- public static final String MAX_FILE_CACHE_SIZE = "MaxFileCacheSize"; //$NON-NLS-1$
-
- public static final String FILE_CACHE_LOCATION = "FileCacheLocation"; //$NON-NLS-1$
-
public static final String LOG_REQUEST_RESPONSE_DOCS = "LogRequestResponseDocs"; //$NON-NLS-1$
public static final String SAX_FILTER_PROVIDER_CLASS = "SaxFilterProviderClass"; //$NON-NLS-1$
@@ -99,16 +75,9 @@
private String capabilitiesClass;
- private Boolean caching;
+ private boolean caching = false;
public XMLConnectorStateImpl() {
- final int defaultCacheTimeoutMillis = 60000;
- final int defaultMemoryCacheSize = 512;
- final int defaultFileCacheSize = -1; // unbounded
- setCacheTimeoutMillis(defaultCacheTimeoutMillis);
- setMaxMemoryCacheSizeKB(defaultMemoryCacheSize);
- setMaxInMemoryStringSize(128 * 1024);
- setMaxFileCacheSizeKB(defaultFileCacheSize);
setPreprocess(true);
setLogRequestResponse(false);
setSaxProviderClass(SAX_FILTER_PROVIDER_CLASS_DEFAULT);
@@ -127,33 +96,6 @@
setCaching(caching);
}
- String cache = props.getProperty(CACHE_TIMEOUT);
- if (cache != null) {
- setCacheTimeoutSeconds(Integer.parseInt(cache));
- }
- String maxMCache = props.getProperty(MAX_MEMORY_CACHE_SIZE);
- if (maxMCache != null) {
- setMaxMemoryCacheSizeKB(Integer.parseInt(maxMCache));
- }
-
- String maxStringSize = props.getProperty(MAX_IN_MEMORY_STRING_SIZE);
- if (maxStringSize != null) {
- setMaxInMemoryStringSize(Integer.parseInt(maxStringSize) * 1024);
- }
-
- String maxFCache = props.getProperty(MAX_FILE_CACHE_SIZE);
- if (maxFCache != null) {
- setMaxFileCacheSizeKB(Integer.parseInt(maxFCache));
- }
-
- String cacheLoc = props.getProperty(FILE_CACHE_LOCATION);
- if (cacheLoc != null) {
- setCacheLocation(cacheLoc);
- } else {
- String temp = System.getProperty("java.io.tmpdir");
- setCacheLocation(temp);
- }
-
String logReqRes = props.getProperty(LOG_REQUEST_RESPONSE_DOCS);
if (logReqRes != null) {
setLogRequestResponse(Boolean.valueOf(logReqRes).booleanValue());
@@ -241,21 +183,8 @@
public java.util.Properties getState() {
Properties props = new Properties();
- props.setProperty(CACHE_TIMEOUT, Integer
- .toString(getCacheTimeoutSeconds()));
- props.setProperty(MAX_MEMORY_CACHE_SIZE, Integer
- .toString(getMaxMemoryCacheSizeKB()));
- props.setProperty(MAX_IN_MEMORY_STRING_SIZE, Integer
- .toString(getMaxInMemoryStringSize()));
- props.setProperty(MAX_FILE_CACHE_SIZE, Integer
- .toString(getMaxFileCacheSizeKB()));
props.setProperty(LOG_REQUEST_RESPONSE_DOCS, Boolean
.toString(isLogRequestResponse()));
- String location = getCacheLocation();
- if (location == null) {
- location = "";//$NON-NLS-1$
- }
- props.setProperty(FILE_CACHE_LOCATION, location);
props.setProperty(SAX_FILTER_PROVIDER_CLASS, getSaxProviderClass());
props.setProperty(QUERY_PREPROCESS_CLASS, getQueryPreprocessorClass());
return props;
@@ -265,39 +194,6 @@
return (value != null && !value.equals(""));
}
- /**
- * @param m_cacheTimeout
- * The m_cacheTimeout to set.
- */
- private final void setCacheTimeoutSeconds(int cacheTimeoutseconds) {
-
- m_cacheTimeout = cacheTimeoutseconds * SECONDS_TO_MILLIS;
- }
-
- private final void setCacheTimeoutMillis(int cacheTimeoutmillis) {
-
- m_cacheTimeout = cacheTimeoutmillis;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see com.metamatrix.connector.xml.base.XMLConnectorState#getCacheTimeoutSeconds()
- */
- public final int getCacheTimeoutSeconds() {
- return m_cacheTimeout / SECONDS_TO_MILLIS;
-
- }
-
- /*
- * (non-Javadoc)
- *
- * @see com.metamatrix.connector.xml.base.XMLConnectorState#getCacheTimeoutMillis()
- */
- public final int getCacheTimeoutMillis() {
- return m_cacheTimeout;
- }
-
private void setPreprocess(boolean preprocess) {
this.m_preprocess = preprocess;
}
@@ -324,84 +220,7 @@
this.capabilites = capabilities;
}
- private void setMaxMemoryCacheSizeKB(int maxMemoryCacheSizeKB) {
- m_maxMemoryCacheSize = maxMemoryCacheSizeKB * KB_TO_BYTES;
- }
- private void setMaxMemoryCacheSizeBytes(int maxMemoryCacheSizeByte) {
- m_maxMemoryCacheSize = maxMemoryCacheSizeByte;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see com.metamatrix.connector.xml.base.XMLConnectorState#getMaxMemoryCacheSizeByte()
- */
- public int getMaxMemoryCacheSizeByte() {
- return m_maxMemoryCacheSize;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see com.metamatrix.connector.xml.base.XMLConnectorState#getMaxMemoryCacheSizeKB()
- */
- public int getMaxMemoryCacheSizeKB() {
- return m_maxMemoryCacheSize / KB_TO_BYTES;
- }
-
- private void setMaxInMemoryStringSize(int maxInMemoryStringSize) {
- m_maxInMemoryStringSize = maxInMemoryStringSize;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see com.metamatrix.connector.xml.base.XMLConnectorState#getMaxInMemoryStringSize()
- */
- public int getMaxInMemoryStringSize() {
- return m_maxInMemoryStringSize;
- }
-
- private void setMaxFileCacheSizeByte(int maxFileCacheSize) {
- m_maxFileCacheSize = maxFileCacheSize;
- }
-
- private void setMaxFileCacheSizeKB(int maxFileCacheSize) {
- m_maxFileCacheSize = maxFileCacheSize * KB_TO_BYTES;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see com.metamatrix.connector.xml.base.XMLConnectorState#getMaxFileCacheSizeKB()
- */
- public int getMaxFileCacheSizeKB() {
- return m_maxFileCacheSize / KB_TO_BYTES;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see com.metamatrix.connector.xml.base.XMLConnectorState#getMaxFileCacheSizeByte()
- */
- public int getMaxFileCacheSizeByte() {
- return m_maxFileCacheSize;
- }
-
- private void setCacheLocation(String cacheLocation) {
- m_cacheLocation = cacheLocation;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see com.metamatrix.connector.xml.base.XMLConnectorState#getCacheLocation()
- */
- public String getCacheLocation() {
- return m_cacheLocation;
- }
-
private void setLogRequestResponse(boolean logRequestResponse) {
m_logRequestResponse = logRequestResponse;
}
Modified: trunk/connectors/connector-xml/src/main/resources/connector-xml.xml
===================================================================
--- trunk/connectors/connector-xml/src/main/resources/connector-xml.xml 2009-09-02 15:28:03 UTC (rev 1304)
+++ trunk/connectors/connector-xml/src/main/resources/connector-xml.xml 2009-09-02 18:20:57 UTC (rev 1305)
@@ -27,30 +27,22 @@
<PropertyDefinition Name="TrustType" DisplayName="Trust Type:(DirectReference or IssuerSerial)" ShortDescription="Only required for Signature and Signed SAML; The issuer-serial method presumes that all trusted users of the service are known to the service and have pre-registered their certificate chains before using the service. The direct-reference method presumes that the service operator trusts all users with certificates issued by a trusted CA." DefaultValue="DirectReference" IsExpert="true" />
</ComponentType>
<ComponentType Name="XML-Relational File Connector" ComponentTypeCode="2" Deployable="true" Deprecated="false" Monitorable="false" SuperComponentType="XML Connector" ParentComponentType="Connectors" LastChangedDate="2008-10-31T10:26:19.918-06:00" CreationDate="2008-10-31T10:26:19.918-06:00">
- <PropertyDefinition Name="TextExtractionThreshold" DisplayName="Text Extraction Threshold (in kb)" ShortDescription="extract text sections larger than this size to a file where more efficient access as a CLOB can be effected." DefaultValue="128" PropertyType="Integer" IsExpert="true" />
<PropertyDefinition Name="FilePath" DisplayName="File Path" ShortDescription="" IsRequired="true" />
<PropertyDefinition Name="Standard" DisplayName="Standard Type" ShortDescription="Standard Built-in Connector Type" DefaultValue="true" PropertyType="Boolean" IsExpert="true" IsModifiable="false" />
- <PropertyDefinition Name="FileCacheLocation" DisplayName="Location of the File Cache" ShortDescription="" DefaultValue="" />
- <PropertyDefinition Name="CacheTimeout" DisplayName="Cache Timeout (in seconds)" ShortDescription="" DefaultValue="60" IsRequired="true" PropertyType="Integer" />
+ <PropertyDefinition Name="CacheEnabled" DisplayName="Enable Document Caching" ShortDescription="" DefaultValue="false" IsRequired="true" PropertyType="Boolean" />
<PropertyDefinition Name="SaxFilterProviderClass" DisplayName="XML Filter Provider" ShortDescription="The class the provides extended XML Filters" DefaultValue="com.metamatrix.connector.xml.base.NoExtendedFilters" IsExpert="true" />
<PropertyDefinition Name="ConnectorClass" DisplayName="Connector Class" ShortDescription="" DefaultValue="com.metamatrix.connector.xml.base.XMLConnector" IsRequired="true" IsExpert="true" />
- <PropertyDefinition Name="MaxFileCacheSize" DisplayName="Max Size of file cache (in kb)" ShortDescription="" DefaultValue="-1" IsRequired="true" PropertyType="Integer" />
<PropertyDefinition Name="ConnectorStateClass" DisplayName="Connector State Class" ShortDescription="" DefaultValue="com.metamatrix.connector.xml.file.FileConnectorState" IsRequired="true" IsExpert="true" />
<PropertyDefinition Name="LogRequestResponseDocs" DisplayName="Log XML Request and Response Documents" ShortDescription="Write the request and response documents to the log at Info level" DefaultValue="false" PropertyType="Boolean" IsExpert="true" />
<PropertyDefinition Name="InputStreamFilterClass" DisplayName="Input Stream Filter Class" ShortDescription="The class to use to preprocess raw XML input stream" DefaultValue="com.metamatrix.connector.xml.base.PluggableInputStreamFilterImpl" IsExpert="true" />
- <PropertyDefinition Name="MaxMemoryCacheSize" DisplayName="Max Size of in-memory cache (in kb)" ShortDescription="" DefaultValue="16384" IsRequired="true" PropertyType="Integer" />
<PropertyDefinition Name="FileName" DisplayName="File Name" ShortDescription="" DefaultValue="" />
<PropertyDefinition Name="QueryPreprocessorClass" DisplayName="Query Preprocessor Class" ShortDescription="The class to use to preprocess the IQuery" DefaultValue="com.metamatrix.connector.xml.base.NoQueryPreprocessing" IsExpert="true" />
<PropertyDefinition Name="ConnectorCapabilities" DisplayName="Connector Capabilities Class" ShortDescription="The class to use to provide the Connector Capabilities" DefaultValue="com.metamatrix.connector.xml.base.XMLCapabilities" IsExpert="true" />
</ComponentType>
<ComponentType Name="XML-Relational HTTP Connector" ComponentTypeCode="2" Deployable="true" Deprecated="false" Monitorable="false" SuperComponentType="XML Connector" ParentComponentType="Connectors" LastChangedDate="2008-10-31T10:26:19.920-06:00" CreationDate="2008-10-31T10:26:19.921-06:00">
- <PropertyDefinition Name="TextExtractionThreshold" DisplayName="Text Extraction Threshold (in kb)" ShortDescription="Extract text sections larger than this size to a file where more efficient access as a CLOB can be effected." DefaultValue="128" PropertyType="Integer" IsExpert="true" />
- <PropertyDefinition Name="FileCacheLocation" DisplayName="Location of the File Cache" ShortDescription="" DefaultValue="" />
- <PropertyDefinition Name="CacheTimeout" DisplayName="Cache Timeout (in seconds)" ShortDescription="" DefaultValue="60" IsRequired="true" PropertyType="Integer" />
<PropertyDefinition Name="SaxFilterProviderClass" DisplayName="XML Filter Provider" ShortDescription="The class the provides extended XML Filters" DefaultValue="com.metamatrix.connector.xml.base.NoExtendedFilters" IsExpert="true" />
<PropertyDefinition Name="XMLParmName" DisplayName="XML Parameter Name" ShortDescription="" />
<PropertyDefinition Name="RequestTimeout" DisplayName="Request Timeout (in Milliseconds)" ShortDescription="" DefaultValue="10000" IsRequired="true" PropertyType="Integer" />
- <PropertyDefinition Name="MaxFileCacheSize" DisplayName="Max Size of file cache (in kb)" ShortDescription="" DefaultValue="-1" IsRequired="true" PropertyType="Integer" />
<PropertyDefinition Name="Authenticate" DisplayName="Authentication Required" ShortDescription="" DefaultValue="false" PropertyType="Boolean" IsModifiable="true" />
<PropertyDefinition Name="ConnectorStateClass" DisplayName="Connector State Class" ShortDescription="" DefaultValue="com.metamatrix.connector.xml.http.HTTPConnectorState" IsRequired="true" IsExpert="true" />
<PropertyDefinition Name="HttpBasicAuthPassword" DisplayName="HTTP Basic Authentication Password" ShortDescription="Password value for HTTP basic authentication" DefaultValue="" IsExpert="true" IsMasked="true" />
@@ -59,7 +51,6 @@
<AllowedValue>post</AllowedValue>
</PropertyDefinition>
<PropertyDefinition Name="ProxyUri" DisplayName="Proxy Server URI" ShortDescription="The URI of the proxy server" DefaultValue="" />
- <PropertyDefinition Name="ExceptionOnIntraQueryCacheExpiration" DisplayName="Exception On Intra-Query Cache Expiration" ShortDescription="Throw an exception when a document expires from the cache between executing different parts of a single query (instead of requesting the document again)" DefaultValue="true" PropertyType="Boolean" IsExpert="true" />
<PropertyDefinition Name="ConnectorCapabilities" DisplayName="Connector Capabilities Class" ShortDescription="The class to use to provide the Connector Capabilities" DefaultValue="com.metamatrix.connector.xml.base.XMLCapabilities" IsExpert="true" />
<PropertyDefinition Name="Standard" DisplayName="Standard Type" ShortDescription="Standard Built-in Connector Type" DefaultValue="true" PropertyType="Boolean" IsExpert="true" IsModifiable="false" />
<PropertyDefinition Name="HttpBasicAuthUserName" DisplayName="HTTP Basic Authentication Name" ShortDescription="Name value for HTTP basic authentication" DefaultValue="" IsExpert="true" />
@@ -74,23 +65,18 @@
<AllowedValue>XMLRequest</AllowedValue>
<AllowedValue>XMLInQueryString</AllowedValue>
</PropertyDefinition>
- <PropertyDefinition Name="MaxMemoryCacheSize" DisplayName="Max Size of in-memory cache (in kb)" ShortDescription="" DefaultValue="16384" IsRequired="true" PropertyType="Integer" />
<PropertyDefinition Name="InputStreamFilterClass" DisplayName="Input Stream Filter Class" ShortDescription="The class to use to preprocess raw XML input stream" DefaultValue="com.metamatrix.connector.xml.base.PluggableInputStreamFilterImpl" IsExpert="true" />
<PropertyDefinition Name="HostnameVerifier" DisplayName="Hostname Verifier" ShortDescription="Class implementing javax.net.ssl.HostnameVerifier. Used to implement a hostname mismatch workaround." IsExpert="true" />
<PropertyDefinition Name="QueryPreprocessorClass" DisplayName="Query Preprocessor Class" ShortDescription="The class to use to preprocess the IQuery" DefaultValue="com.metamatrix.connector.xml.base.NoQueryPreprocessing" IsExpert="true" />
</ComponentType>
<ComponentType Name="XML-Relational SOAP Connector" ComponentTypeCode="2" Deployable="true" Deprecated="false" Monitorable="false" SuperComponentType="XML Connector" ParentComponentType="Connectors" LastChangedDate="2008-10-31T10:26:19.919-06:00" CreationDate="2008-10-31T10:26:19.919-06:00">
- <PropertyDefinition Name="TextExtractionThreshold" DisplayName="Text Extraction Threshold (in kb)" ShortDescription="Extract text sections larger than this size to a file where more efficient access as a CLOB can be effected." DefaultValue="128" PropertyType="Integer" IsExpert="true" />
<PropertyDefinition Name="AuthPassword" DisplayName="Authentication User Password" ShortDescription="Password value for authentication" DefaultValue="" IsExpert="true" IsMasked="true" />
- <PropertyDefinition Name="FileCacheLocation" DisplayName="Location of the File Cache" ShortDescription="" DefaultValue="" />
<PropertyDefinition Name="SaxFilterProviderClass" DisplayName="XML Filter Provider" ShortDescription="The class the provides extended XML Filters" DefaultValue="com.metamatrix.connector.xml.base.NoExtendedFilters" IsExpert="true" />
<PropertyDefinition Name="AuthUserName" DisplayName="Authentication User Name" ShortDescription="Name value for authentication" DefaultValue="" IsExpert="true" />
- <PropertyDefinition Name="CacheTimeout" DisplayName="Cache Timeout (in seconds)" ShortDescription="" DefaultValue="60" IsRequired="true" PropertyType="Integer" />
<PropertyDefinition Name="WSSecurityType" DisplayName="WS-Security Type(UsernameToken, SAML..)" ShortDescription="Type of WS-Security to be used; Combinations of multiple security types can be used with a space in-between. Allowed types are: (UsernameToken, UsernameToken-Digest, SAMLTokenUnsigned, SAMLTokenSigned, Signature, Timestamp, Encrypt)" DefaultValue="" />
<PropertyDefinition Name="XMLParmName" DisplayName="XML Parameter Name" ShortDescription="" DefaultValue="" IsModifiable="false" />
<PropertyDefinition Name="EncryptUserName" DisplayName="Encrypt UserName (only if Encrypt profile used)" ShortDescription="The username to be used in the encryption; if blank uses auth username" DefaultValue="" IsExpert="true" />
<PropertyDefinition Name="ExceptionOnSOAPFault" DisplayName="Exception on SOAP Fault" ShortDescription="Throw connector exception when SOAP fault is returned from source." DefaultValue="true" PropertyType="Boolean" IsExpert="true" />
- <PropertyDefinition Name="MaxFileCacheSize" DisplayName="Max Size of file cache (in kb)" ShortDescription="" DefaultValue="-1" IsRequired="true" PropertyType="Integer" />
<PropertyDefinition Name="RequestTimeout" DisplayName="Request Timeout (in Milliseconds)" ShortDescription="" DefaultValue="10000" IsRequired="true" PropertyType="Integer" />
<PropertyDefinition Name="CryptoPropertyFile" DisplayName="User Crypto Property File (If SAML or Signature profile used)" ShortDescription="The file defines properties of cryptography;defines the certificates;(crypto.properties)" DefaultValue="" IsExpert="true" />
<PropertyDefinition Name="ConnectorStateClass" DisplayName="Connector State Class" ShortDescription="" DefaultValue="com.metamatrix.connector.xml.soap.SOAPConnectorState" IsRequired="true" IsExpert="true" />
@@ -101,7 +87,6 @@
</PropertyDefinition>
<PropertyDefinition Name="ProxyUri" DisplayName="Proxy Server URI" ShortDescription="The URI of the proxy server" DefaultValue="" />
<PropertyDefinition Name="EncryptPropertyFile" DisplayName="Encrypt crypto property file (only if Encrypt profile used)" ShortDescription="The file defines properties of cryptography for encryption of the message;(crypto.properties)" DefaultValue="" IsExpert="true" />
- <PropertyDefinition Name="ExceptionOnIntraQueryCacheExpiration" DisplayName="Exception On Intra-Query Cache Expiration" ShortDescription="Throw an exception when a document expires from the cache between executing different parts of a single query (instead of requesting the document again)" DefaultValue="true" PropertyType="Boolean" IsExpert="true" />
<PropertyDefinition Name="ConnectorCapabilities" DisplayName="Connector Capabilities Class" ShortDescription="The class to use to provide the Connector Capabilities" DefaultValue="com.metamatrix.connector.xml.base.XMLCapabilities" IsExpert="true" />
<PropertyDefinition Name="SAMLPropertyFile" DisplayName="SAML Property File (only required when SAML profile used)" ShortDescription="SAML Security property file (saml.properties)" DefaultValue="" IsExpert="true" />
<PropertyDefinition Name="Standard" DisplayName="Standard Type" ShortDescription="Standard Built-in Connector Type" DefaultValue="true" PropertyType="Boolean" IsExpert="true" IsModifiable="false" />
@@ -123,7 +108,6 @@
<AllowedValue>XMLInQueryString</AllowedValue>
</PropertyDefinition>
<PropertyDefinition Name="InputStreamFilterClass" DisplayName="Input Stream Filter Class" ShortDescription="The class to use to preprocess raw XML input stream" DefaultValue="com.metamatrix.connector.xml.base.PluggableInputStreamFilterImpl" IsExpert="true" />
- <PropertyDefinition Name="MaxMemoryCacheSize" DisplayName="Max Size of in-memory cache (in kb)" ShortDescription="" DefaultValue="16384" IsRequired="true" PropertyType="Integer" />
<PropertyDefinition Name="HostnameVerifier" DisplayName="Hostname Verifier" ShortDescription="a class implmenting javax.net.ssl.HostnameVerifier. Used to implement a hostname mismatch workaround." IsExpert="true" />
<PropertyDefinition Name="TrustType" DisplayName="Trust Type:(DirectReference or IssuerSerial)" ShortDescription="Only required for Signature and Signed SAML; The issuer-serial method presumes that all trusted users of the service are known to the service and have pre-registered their certificate chains before using the service. The direct-reference method presumes that the service operator trusts all users with certificates issued by a trusted CA." DefaultValue="DirectReference" IsExpert="true" />
<PropertyDefinition Name="QueryPreprocessorClass" DisplayName="Query Preprocessor Class" ShortDescription="The class to use to preprocess the IQuery" DefaultValue="com.metamatrix.connector.xml.base.NoQueryPreprocessing" IsExpert="true" />
Modified: trunk/connectors/connector-xml/src/test/java/com/metamatrix/connector/xml/base/ProxyObjectFactory.java
===================================================================
--- trunk/connectors/connector-xml/src/test/java/com/metamatrix/connector/xml/base/ProxyObjectFactory.java 2009-09-02 15:28:03 UTC (rev 1304)
+++ trunk/connectors/connector-xml/src/test/java/com/metamatrix/connector/xml/base/ProxyObjectFactory.java 2009-09-02 18:20:57 UTC (rev 1305)
@@ -88,11 +88,7 @@
public static Properties getDefaultFileProps() {
Properties testFileProps = new Properties();
- testFileProps.put(XMLConnectorStateImpl.CACHE_TIMEOUT, new String("500000"));
- testFileProps.put(XMLConnectorStateImpl.MAX_MEMORY_CACHE_SIZE, new String("5000"));
- testFileProps.put(XMLConnectorStateImpl.MAX_FILE_CACHE_SIZE, new String("5000"));
testFileProps.setProperty(XMLConnectorStateImpl.CACHE_ENABLED, "false");
- testFileProps.put(XMLConnectorStateImpl.FILE_CACHE_LOCATION, UnitTestUtil.getTestScratchPath()+"/test/cache");
testFileProps.setProperty(XMLConnectorState.STATE_CLASS_PROP, "com.metamatrix.connector.xml.file.FileConnectorState");
testFileProps.setProperty(XMLConnectorStateImpl.QUERY_PREPROCESS_CLASS, "com.metamatrix.connector.xml.base.NoQueryPreprocessing");
testFileProps.setProperty(XMLConnectorStateImpl.SAX_FILTER_PROVIDER_CLASS, "com.metamatrix.connector.xml.base.NoExtendedFilters");
@@ -111,12 +107,7 @@
public static Properties getDefaultHTTPProps() {
Properties testHTTPProps = new Properties();
- testHTTPProps.setProperty(XMLConnectorStateImpl.CACHE_TIMEOUT, new String("5000")); //$NON-NLS-1$
- testHTTPProps.setProperty(XMLConnectorStateImpl.MAX_MEMORY_CACHE_SIZE, new String("50")); //$NON-NLS-1$
- testHTTPProps.setProperty(XMLConnectorStateImpl.MAX_FILE_CACHE_SIZE, new String("50")); //$NON-NLS-1$
testHTTPProps.setProperty(XMLConnectorStateImpl.CACHE_ENABLED, Boolean.TRUE.toString());
- testHTTPProps.setProperty(XMLConnectorStateImpl.FILE_CACHE_LOCATION, UnitTestUtil.getTestScratchPath()+"/test/cache");//$NON-NLS-1$
- testHTTPProps.setProperty(XMLConnectorStateImpl.MAX_IN_MEMORY_STRING_SIZE, "10"); //$NON-NSL-1$
testHTTPProps.setProperty(HTTPConnectorState.URI, "http://localhost:8673"); //$NON-NLS-1$
testHTTPProps.setProperty(HTTPConnectorState.REQUEST_TIMEOUT, "60"); //$NON-NLS-1$
testHTTPProps.setProperty(XMLConnectorState.STATE_CLASS_PROP, "com.metamatrix.connector.xml.http.HTTPConnectorState"); //$NON-NLS-1$
@@ -142,11 +133,7 @@
public static Properties getDefaultHttpProps() {
Properties testHTTPProps = new Properties();
- testHTTPProps.put(XMLConnectorStateImpl.CACHE_TIMEOUT, new String("5000"));
- testHTTPProps.put(XMLConnectorStateImpl.MAX_MEMORY_CACHE_SIZE, new String("5000"));
- testHTTPProps.put(XMLConnectorStateImpl.MAX_FILE_CACHE_SIZE, new String("5000"));
testHTTPProps.put(XMLConnectorStateImpl.CACHE_ENABLED, Boolean.TRUE);
- testHTTPProps.put(XMLConnectorStateImpl.FILE_CACHE_LOCATION, UnitTestUtil.getTestScratchPath()+"/test/cache");
testHTTPProps.put(XMLConnectorStateImpl.CONNECTOR_CAPABILITES, "com.metamatrix.connector.xml.base.XMLCapabilities");
testHTTPProps.setProperty(XMLConnectorState.STATE_CLASS_PROP, "com.metamatrix.connector.xml.http.HTTPConnectorState");
testHTTPProps.setProperty(XMLConnectorStateImpl.QUERY_PREPROCESS_CLASS, "com.metamatrix.connector.xml.base.NoQueryPreprocessing");
Modified: trunk/connectors/connector-xml/src/test/java/com/metamatrix/connector/xml/base/TestXMLConnector.java
===================================================================
--- trunk/connectors/connector-xml/src/test/java/com/metamatrix/connector/xml/base/TestXMLConnector.java 2009-09-02 15:28:03 UTC (rev 1304)
+++ trunk/connectors/connector-xml/src/test/java/com/metamatrix/connector/xml/base/TestXMLConnector.java 2009-09-02 18:20:57 UTC (rev 1305)
@@ -60,20 +60,10 @@
}
public void testInitMethod() {
- //init test environment
XMLConnector connector = new XMLConnector();
try {
connector.start(m_env);
assertNotNull("state is null", connector.getState());
- XMLConnectorState state = connector.getState();
- Properties testFileProps = ProxyObjectFactory.getDefaultFileProps();
- assertEquals(state.getMaxMemoryCacheSizeKB(),
- Integer.parseInt((String) testFileProps.get(XMLConnectorStateImpl.MAX_MEMORY_CACHE_SIZE)));
- assertEquals(state.getMaxFileCacheSizeKB(),
- Integer.parseInt((String) testFileProps.get(XMLConnectorStateImpl.MAX_FILE_CACHE_SIZE)));
- assertEquals(state.getCacheLocation(), (String) testFileProps.get(XMLConnectorStateImpl.FILE_CACHE_LOCATION));
- int expectedTimeout = Integer.parseInt((String) testFileProps.get(XMLConnectorStateImpl.CACHE_TIMEOUT));
- assertEquals(state.getCacheTimeoutSeconds(), expectedTimeout);
assertNotNull("Logger is null", connector.getLogger());
} catch (ConnectorException ex) {
ex.printStackTrace();
@@ -138,11 +128,7 @@
XMLConnector connector = new XMLConnector();
try {
Properties testFileProps = new Properties();
- testFileProps.put(XMLConnectorStateImpl.CACHE_TIMEOUT, new String("5000"));
- testFileProps.put(XMLConnectorStateImpl.MAX_MEMORY_CACHE_SIZE, new String("50"));
- testFileProps.put(XMLConnectorStateImpl.MAX_FILE_CACHE_SIZE, new String("50"));
testFileProps.put(XMLConnectorStateImpl.CACHE_ENABLED, Boolean.TRUE);
- testFileProps.put(XMLConnectorStateImpl.FILE_CACHE_LOCATION, new String("./test/cache"));
testFileProps.setProperty(XMLConnectorState.STATE_CLASS_PROP, "sure.to.Fail");
testFileProps.put(FileConnectorState.FILE_NAME, "state_college.xml");
Modified: trunk/connectors/connector-xml/src/test/java/com/metamatrix/connector/xml/base/TestXMLConnectorState.java
===================================================================
--- trunk/connectors/connector-xml/src/test/java/com/metamatrix/connector/xml/base/TestXMLConnectorState.java 2009-09-02 15:28:03 UTC (rev 1304)
+++ trunk/connectors/connector-xml/src/test/java/com/metamatrix/connector/xml/base/TestXMLConnectorState.java 2009-09-02 18:20:57 UTC (rev 1305)
@@ -54,12 +54,7 @@
@Override
public void setUp() {
m_testFileProps = new Properties();
- m_testFileProps.setProperty(XMLConnectorStateImpl.CACHE_TIMEOUT, new String("5000"));
- m_testFileProps.setProperty(XMLConnectorStateImpl.MAX_MEMORY_CACHE_SIZE, new String("50"));
- m_testFileProps.setProperty(XMLConnectorStateImpl.MAX_IN_MEMORY_STRING_SIZE, new String("1280"));
- m_testFileProps.setProperty(XMLConnectorStateImpl.MAX_FILE_CACHE_SIZE, new String("50"));
m_testFileProps.setProperty(XMLConnectorStateImpl.CACHE_ENABLED, new String("true"));
- m_testFileProps.setProperty(XMLConnectorStateImpl.FILE_CACHE_LOCATION, new String("./test/cache"));
m_testFileProps.setProperty(XMLConnectorStateImpl.SAX_FILTER_PROVIDER_CLASS, "com.metamatrix.connector.xml.base.NoExtendedFilters");
m_testFileProps.setProperty(XMLConnectorStateImpl.QUERY_PREPROCESS_CLASS, "com.metamatrix.connector.xml.base.NoQueryPreprocessing");
m_testFileProps.put(XMLConnectorStateImpl.CONNECTOR_CAPABILITES, "com.metamatrix.connector.xml.base.XMLCapabilities");
@@ -81,14 +76,6 @@
fail(ce.getMessage());
}
assertNotNull(state.getState());
- assertEquals(m_testFileProps.getProperty(XMLConnectorStateImpl.CACHE_TIMEOUT),
- state.getState().getProperty(XMLConnectorStateImpl.CACHE_TIMEOUT));
- assertEquals(m_testFileProps.getProperty(XMLConnectorStateImpl.MAX_FILE_CACHE_SIZE),
- state.getState().getProperty(XMLConnectorStateImpl.MAX_FILE_CACHE_SIZE));
- assertEquals(m_testFileProps.getProperty(XMLConnectorStateImpl.MAX_MEMORY_CACHE_SIZE),
- state.getState().getProperty(XMLConnectorStateImpl.MAX_MEMORY_CACHE_SIZE));
- assertEquals(m_testFileProps.getProperty(XMLConnectorStateImpl.FILE_CACHE_LOCATION),
- state.getState().getProperty(XMLConnectorStateImpl.FILE_CACHE_LOCATION));
}
private class TestXMLConnectorStateImpl extends XMLConnectorStateImpl {
15 years, 3 months
teiid SVN: r1304 - in trunk: client/src/main/java/com/metamatrix/dqp/embedded and 10 other directories.
by teiid-commits@lists.jboss.org
Author: rareddy
Date: 2009-09-02 11:28:03 -0400 (Wed, 02 Sep 2009)
New Revision: 1304
Modified:
trunk/build/kit-runtime/deploy/log4j.xml
trunk/client/src/main/java/com/metamatrix/dqp/embedded/DQPEmbeddedProperties.java
trunk/runtime/src/main/java/com/metamatrix/jdbc/EmbeddedConnectionFactoryImpl.java
trunk/test-integration/src/test/java/com/metamatrix/server/integration/TestAdminApi.java
trunk/test-integration/src/test/java/org/teiid/runtime/adminapi/TestDqpReDeployment.java
trunk/test-integration/src/test/resources/admin/dqp-membership.properties
trunk/test-integration/src/test/resources/admin/dqp.properties
trunk/test-integration/src/test/resources/authcheck/bqt.properties
trunk/test-integration/src/test/resources/bqt/bqt.properties
trunk/test-integration/src/test/resources/metadata/dqp.properties
trunk/test-integration/src/test/resources/partssupplier/dqp.properties
trunk/test-integration/src/test/resources/vdbless/dqp.properties
trunk/test-integration/src/test/resources/xml-vp/xmlvp.properties
Log:
TEIID-812: setting a system property for teiid.home contributed to making the following tests to use the previously set teiid.home instead of the current test. Logging is now using ${teiid.logdir} as the system property, but a teiid configuration specifies it with dqp.logdir, so they will never collide and provides the accepted behavior.
Modified: trunk/build/kit-runtime/deploy/log4j.xml
===================================================================
--- trunk/build/kit-runtime/deploy/log4j.xml 2009-09-01 21:42:42 UTC (rev 1303)
+++ trunk/build/kit-runtime/deploy/log4j.xml 2009-09-02 15:28:03 UTC (rev 1304)
@@ -7,7 +7,7 @@
</appender>
<appender name="FILE" class="org.apache.log4j.RollingFileAppender">
- <param name="File" value="${teiid.home}/log/teiid.log"/>
+ <param name="File" value="${teiid.logdir}/teiid.log"/>
<param name="MaxFileSize" value="1000KB"/>
<param name="MaxBackupIndex" value="25"/>
@@ -28,7 +28,7 @@
<!-- un-comment to enable COMMAND log
<appender name="COMMAND" class="org.apache.log4j.RollingFileAppender">
- <param name="File" value="log/command.log"/>
+ <param name="File" value="${teiid.logdir}/command.log"/>
<param name="MaxFileSize" value="1000KB"/>
<param name="MaxBackupIndex" value="25"/>
<layout class="org.apache.log4j.PatternLayout">
@@ -39,7 +39,7 @@
<!-- Un-comment to enable AUDIT log
<appender name="AUDIT" class="org.apache.log4j.RollingFileAppender">
- <param name="File" value="log/audit.log"/>
+ <param name="File" value="${teiid.logdir}/audit.log"/>
<param name="MaxFileSize" value="1000KB"/>
<param name="MaxBackupIndex" value="25"/>
<layout class="org.apache.log4j.PatternLayout">
@@ -50,7 +50,7 @@
<!-- Un-comment to enable Process Info log
<appender name="PROCESS_INFO" class="org.apache.log4j.RollingFileAppender">
- <param name="File" value="log/process_info.log"/>
+ <param name="File" value="${teiid.logdir}/process_info.log"/>
<param name="MaxFileSize" value="1000KB"/>
<param name="MaxBackupIndex" value="25"/>
<layout class="org.apache.log4j.PatternLayout">
Modified: trunk/client/src/main/java/com/metamatrix/dqp/embedded/DQPEmbeddedProperties.java
===================================================================
--- trunk/client/src/main/java/com/metamatrix/dqp/embedded/DQPEmbeddedProperties.java 2009-09-01 21:42:42 UTC (rev 1303)
+++ trunk/client/src/main/java/com/metamatrix/dqp/embedded/DQPEmbeddedProperties.java 2009-09-02 15:28:03 UTC (rev 1304)
@@ -30,6 +30,7 @@
public static final String COMMON_EXTENSION_CLASPATH = "dqp.extension.CommonClasspath"; //$NON-NLS-1$
public static final String DQP_WORKDIR = "dqp.workdir"; //$NON-NLS-1$
public static final String DQP_DEPLOYDIR = "dqp.deploydir"; //$NON-NLS-1$
+ public static final String DQP_LOGDIR = "dqp.logdir"; //$NON-NLS-1$
public static final String DQP_LIBDIR = "dqp.lib"; //$NON-NLS-1$
public static final String PROCESSNAME = "processName"; //$NON-NLS-1$
public static final String CLUSTERNAME = "clusterName"; //$NON-NLS-1$
@@ -69,6 +70,7 @@
public static final String HOST_ADDRESS = "hostAddress"; //$NON-NLS-1$
public static final String DQP_BOOTSTRAP_FILE = "bootstrapFile"; //$NON-NLS-1$
public static final String TEIID_HOME = "teiid.home"; //$NON-NLS-1$
+ public static final String TEIID_LOGDIR = "teiid.logdir"; //$NON-NLS-1$
/**
Modified: trunk/runtime/src/main/java/com/metamatrix/jdbc/EmbeddedConnectionFactoryImpl.java
===================================================================
--- trunk/runtime/src/main/java/com/metamatrix/jdbc/EmbeddedConnectionFactoryImpl.java 2009-09-01 21:42:42 UTC (rev 1303)
+++ trunk/runtime/src/main/java/com/metamatrix/jdbc/EmbeddedConnectionFactoryImpl.java 2009-09-02 15:28:03 UTC (rev 1304)
@@ -119,9 +119,6 @@
bootstrapURL = URLHelper.buildURL(props.getProperty(DQPEmbeddedProperties.BOOTURL));
// Create a temporary workspace directory
String teiidHome = props.getProperty(DQPEmbeddedProperties.TEIID_HOME);
- if (System.getProperty(DQPEmbeddedProperties.TEIID_HOME) == null) {
- System.setProperty(DQPEmbeddedProperties.TEIID_HOME, teiidHome);
- }
this.workspaceDirectory = createWorkspace(teiidHome, props.getProperty(DQPEmbeddedProperties.DQP_WORKDIR, "work"), processName); //$NON-NLS-1$
props.setProperty(DQPEmbeddedProperties.DQP_WORKDIR, this.workspaceDirectory);
@@ -138,6 +135,14 @@
if (vdbDefinitions == null) {
props.setProperty(DQPEmbeddedProperties.VDB_DEFINITION, deployDirectory.getCanonicalPath());
}
+
+ // set the log directory
+ File logDir = new File(teiidHome, props.getProperty(DQPEmbeddedProperties.DQP_LOGDIR, "log")); //$NON-NLS-1$
+ if (!logDir.exists()) {
+ logDir.mkdirs();
+ }
+ System.setProperty(DQPEmbeddedProperties.TEIID_LOGDIR, logDir.getCanonicalPath());
+
} catch (IOException e) {
throw new ApplicationInitializationException(e);
}
Modified: trunk/test-integration/src/test/java/com/metamatrix/server/integration/TestAdminApi.java
===================================================================
--- trunk/test-integration/src/test/java/com/metamatrix/server/integration/TestAdminApi.java 2009-09-01 21:42:42 UTC (rev 1303)
+++ trunk/test-integration/src/test/java/com/metamatrix/server/integration/TestAdminApi.java 2009-09-02 15:28:03 UTC (rev 1304)
@@ -72,8 +72,8 @@
@Before
public void setUp() throws Exception {
- FileUtils.copy(UnitTestUtil.getTestDataPath()+"/admin/Admin.vdb", UnitTestUtil.getTestScratchPath()+"/Admin.vdb"); //$NON-NLS-1$ //$NON-NLS-2$
- FileUtils.copy(UnitTestUtil.getTestDataPath()+"/ServerConfig.xml", UnitTestUtil.getTestScratchPath()+"/configuration.xml"); //$NON-NLS-1$ //$NON-NLS-2$
+ FileUtils.copy(UnitTestUtil.getTestDataPath()+"/admin/Admin.vdb", UnitTestUtil.getTestScratchPath()+"/adminapi/deploy/Admin.vdb"); //$NON-NLS-1$ //$NON-NLS-2$
+ FileUtils.copy(UnitTestUtil.getTestDataPath()+"/ServerConfig.xml", UnitTestUtil.getTestScratchPath()+"/adminapi/deploy/configuration.xml"); //$NON-NLS-1$ //$NON-NLS-2$
}
private void cleanDeploy() throws Exception {
@@ -705,7 +705,7 @@
addVDB(BQT, UnitTestUtil.getTestDataPath()+"/admin/QT_Ora9DSwDEF.vdb"); //$NON-NLS-1$
// make susre it exists as file
- File vdb = new File(UnitTestUtil.getTestScratchPath()+"/BQT_1.vdb"); //$NON-NLS-1$
+ File vdb = new File(UnitTestUtil.getTestScratchPath()+"/adminapi/deploy/BQT_1.vdb"); //$NON-NLS-1$
assertTrue("Persisted VDB file does not exists", vdb.exists()); //$NON-NLS-1$
// Check when it last modified
@@ -807,7 +807,7 @@
// testcase (1) (here the file should still exist; but report as non existent from API)
deleteVDB(BQT, "1"); //$NON-NLS-1$
assertFalse("VDB should exist because we still have an active user", hasVDB(BQT, "1")); //$NON-NLS-1$ //$NON-NLS-2$
- File f = new File(UnitTestUtil.getTestScratchPath()+"/BQT_1.vdb"); //$NON-NLS-1$
+ File f = new File(UnitTestUtil.getTestScratchPath()+"/adminapi/deploy/BQT_1.vdb"); //$NON-NLS-1$
assertTrue("since the connection is still open this file should exist", f.exists()); //$NON-NLS-1$
// testcase (2)
@@ -875,7 +875,7 @@
// here it should be gone we call delete
deleteVDB(BQT, "2"); //$NON-NLS-1$
assertFalse("VDB should exist because we still have an active user", hasVDB(BQT, "2")); //$NON-NLS-1$ //$NON-NLS-2$
- f = new File(UnitTestUtil.getTestScratchPath()+"/BQT_2.vdb"); //$NON-NLS-1$
+ f = new File(UnitTestUtil.getTestScratchPath()+"/adminapi/deploy/BQT_2.vdb"); //$NON-NLS-1$
assertFalse("since the connection is still open this file should exist", f.exists()); //$NON-NLS-1$
// close the 1st connection
@@ -916,7 +916,7 @@
helpConnectorBindingAddTest(AdminOptions.OnConflict.OVERWRITE, 1);
}
- @Test public void testAddConnectorBindingWithProeprties() throws Exception {
+ @Test public void testAddConnectorBindingWithProperties() throws Exception {
getConnection(ADMIN, PROPS_FILE);
cleanDeploy();
Modified: trunk/test-integration/src/test/java/org/teiid/runtime/adminapi/TestDqpReDeployment.java
===================================================================
--- trunk/test-integration/src/test/java/org/teiid/runtime/adminapi/TestDqpReDeployment.java 2009-09-01 21:42:42 UTC (rev 1303)
+++ trunk/test-integration/src/test/java/org/teiid/runtime/adminapi/TestDqpReDeployment.java 2009-09-02 15:28:03 UTC (rev 1304)
@@ -25,8 +25,8 @@
@Before
public void setUp() throws Exception {
- FileUtils.copy(UnitTestUtil.getTestDataPath()+"/admin/Admin.vdb", UnitTestUtil.getTestScratchPath()+"/Admin.vdb"); //$NON-NLS-1$ //$NON-NLS-2$
- FileUtils.copy(UnitTestUtil.getTestDataPath()+"/ServerConfig.xml", UnitTestUtil.getTestScratchPath()+"/configuration.xml"); //$NON-NLS-1$ //$NON-NLS-2$
+ FileUtils.copy(UnitTestUtil.getTestDataPath()+"/admin/Admin.vdb", UnitTestUtil.getTestScratchPath()+"/adminapi/deploy/Admin.vdb"); //$NON-NLS-1$ //$NON-NLS-2$
+ FileUtils.copy(UnitTestUtil.getTestDataPath()+"/ServerConfig.xml", UnitTestUtil.getTestScratchPath()+"/adminapi/deploy/configuration.xml"); //$NON-NLS-1$ //$NON-NLS-2$
}
@After
Modified: trunk/test-integration/src/test/resources/admin/dqp-membership.properties
===================================================================
--- trunk/test-integration/src/test/resources/admin/dqp-membership.properties 2009-09-01 21:42:42 UTC (rev 1303)
+++ trunk/test-integration/src/test/resources/admin/dqp-membership.properties 2009-09-02 15:28:03 UTC (rev 1304)
@@ -1,8 +1,6 @@
-dqp.configFile=../../../../target/scratch/configuration.xml
+dqp.configFile=../../../../target/scratch/adminapi/deploy/configuration.xml
dqp.buffer.usedisk=false
xa.enable_recovery=false
-dqp.deploydir=../../../../target/scratch
-dqp.workdir=../../../../target/scratch/work
membership.enabled=true
membership.superUser=admin
@@ -18,4 +16,6 @@
dqp.userDefinedFunctionsFile=extensionjar:FunctionDefinitions.xmi
processName=localhost
-dqp.extensions=../../../../target/scratch/extensions/;./extensions
\ No newline at end of file
+dqp.extensions=../../../../target/scratch/adminapi/extensions/;./extensions
+
+teiid.home=target/scratch/adminapi
\ No newline at end of file
Modified: trunk/test-integration/src/test/resources/admin/dqp.properties
===================================================================
--- trunk/test-integration/src/test/resources/admin/dqp.properties 2009-09-01 21:42:42 UTC (rev 1303)
+++ trunk/test-integration/src/test/resources/admin/dqp.properties 2009-09-02 15:28:03 UTC (rev 1304)
@@ -1,12 +1,15 @@
-dqp.configFile=../../../../target/scratch/configuration.xml
+dqp.configFile=../../../../target/scratch/adminapi/deploy/configuration.xml
dqp.buffer.usedisk=false
xa.enable_recovery=false
-dqp.deploydir=../../../../target/scratch
-dqp.workdir=../../../../target/scratch/work
+#dqp.deploydir=../../../../target/scratch
+#dqp.workdir=../../../../target/scratch/work
membership.enabled=true
membership.superUser=admin
membership.superUserPassword=teiid
auth.check_entitlements=false
dqp.userDefinedFunctionsFile=extensionjar:FunctionDefinitions.xmi
processName=localhost
-dqp.extensions=../../../../target/scratch/extensions/;./extensions
\ No newline at end of file
+dqp.extensions=../../../../target/scratch/adminapi/extensions/;./extensions
+
+
+teiid.home=target/scratch/adminapi
\ No newline at end of file
Modified: trunk/test-integration/src/test/resources/authcheck/bqt.properties
===================================================================
--- trunk/test-integration/src/test/resources/authcheck/bqt.properties 2009-09-01 21:42:42 UTC (rev 1303)
+++ trunk/test-integration/src/test/resources/authcheck/bqt.properties 2009-09-02 15:28:03 UTC (rev 1304)
@@ -38,6 +38,6 @@
entitlements.enabled=true
-teiid.home=target/scratch
+teiid.home=target/scratch/authcheck
processName=auth
\ No newline at end of file
Modified: trunk/test-integration/src/test/resources/bqt/bqt.properties
===================================================================
--- trunk/test-integration/src/test/resources/bqt/bqt.properties 2009-09-01 21:42:42 UTC (rev 1303)
+++ trunk/test-integration/src/test/resources/bqt/bqt.properties 2009-09-02 15:28:03 UTC (rev 1304)
@@ -28,5 +28,5 @@
-teiid.home=target/scratch
+teiid.home=target/scratch/bqt
processName=bqt
\ No newline at end of file
Modified: trunk/test-integration/src/test/resources/metadata/dqp.properties
===================================================================
--- trunk/test-integration/src/test/resources/metadata/dqp.properties 2009-09-01 21:42:42 UTC (rev 1303)
+++ trunk/test-integration/src/test/resources/metadata/dqp.properties 2009-09-02 15:28:03 UTC (rev 1304)
@@ -29,5 +29,5 @@
xa.enable_recovery=false
-teiid.home=target/scratch
+teiid.home=target/scratch/metadata
processName=metadata
\ No newline at end of file
Modified: trunk/test-integration/src/test/resources/partssupplier/dqp.properties
===================================================================
--- trunk/test-integration/src/test/resources/partssupplier/dqp.properties 2009-09-01 21:42:42 UTC (rev 1303)
+++ trunk/test-integration/src/test/resources/partssupplier/dqp.properties 2009-09-02 15:28:03 UTC (rev 1304)
@@ -33,6 +33,6 @@
xa.enable_recovery=false
-teiid.home=target/scratch
+teiid.home=target/scratch/parts
processName=partssupplier
Modified: trunk/test-integration/src/test/resources/vdbless/dqp.properties
===================================================================
--- trunk/test-integration/src/test/resources/vdbless/dqp.properties 2009-09-01 21:42:42 UTC (rev 1303)
+++ trunk/test-integration/src/test/resources/vdbless/dqp.properties 2009-09-02 15:28:03 UTC (rev 1304)
@@ -27,6 +27,6 @@
#only for testing, as this takes more time to start and shutdown
xa.enable_recovery=false
-teiid.home=target/scratch
+teiid.home=target/scratch/vdbsless
processName=vdbless
\ No newline at end of file
Modified: trunk/test-integration/src/test/resources/xml-vp/xmlvp.properties
===================================================================
--- trunk/test-integration/src/test/resources/xml-vp/xmlvp.properties 2009-09-01 21:42:42 UTC (rev 1303)
+++ trunk/test-integration/src/test/resources/xml-vp/xmlvp.properties 2009-09-02 15:28:03 UTC (rev 1304)
@@ -32,6 +32,6 @@
#only for testing, as this takes more time to start and shutdown
xa.enable_recovery=false
-teiid.home=target/scratch
+teiid.home=target/scratch/xml-vp
processName=xml-vp
15 years, 3 months
teiid SVN: r1303 - in trunk/connectors/connector-jdbc/src/main: resources/org/teiid/connector/jdbc and 1 other directory.
by teiid-commits@lists.jboss.org
Author: rareddy
Date: 2009-09-01 17:42:42 -0400 (Tue, 01 Sep 2009)
New Revision: 1303
Modified:
trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/JDBCConnector.java
trunk/connectors/connector-jdbc/src/main/resources/org/teiid/connector/jdbc/i18n.properties
Log:
TEIID-805: JNDI based connection creation.
Modified: trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/JDBCConnector.java
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/JDBCConnector.java 2009-09-01 19:41:31 UTC (rev 1302)
+++ trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/JDBCConnector.java 2009-09-01 21:42:42 UTC (rev 1303)
@@ -31,6 +31,8 @@
import java.util.Enumeration;
import java.util.Properties;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
import javax.sql.DataSource;
import javax.sql.XADataSource;
@@ -62,6 +64,8 @@
@ConnectionPooling
public class JDBCConnector extends BasicConnector implements XAConnector, MetadataProvider {
+ private static final String JNDI = "JNDI:"; //$NON-NLS-1$
+
static final int NO_ISOLATION_LEVEL_SET = Integer.MIN_VALUE;
enum TransactionIsolationLevel {
@@ -227,59 +231,68 @@
protected void createDataSources(String dataSourceClassName, final Properties connectionProps) throws ConnectorException {
// create data source
- Object temp = null;
- try {
- temp = ReflectionHelper.create(dataSourceClassName, null, Thread.currentThread().getContextClassLoader());
- } catch (MetaMatrixCoreException e) {
- throw new ConnectorException(e,JDBCPlugin.Util.getString("JDBCSourceConnectionFactory.Unable_to_load_the_JDBC_driver_class_6", dataSourceClassName)); //$NON-NLS-1$
- }
-
- final String url = connectionProps.getProperty(JDBCPropertyNames.URL);
-
- if (temp instanceof Driver) {
- final Driver driver = (Driver)temp;
- // check URL if there is one
- if (url == null || url.trim().length() == 0) {
- throw new ConnectorException(JDBCPlugin.Util.getString("JDBCSourceConnectionFactory.Missing_JDBC_database_name_3")); //$NON-NLS-1$
- }
- validateURL(driver, url);
- this.ds = (DataSource)Proxy.newProxyInstance(Thread.currentThread().getContextClassLoader(), new Class[] {DataSource.class}, new InvocationHandler() {
- @Override
- public Object invoke(Object proxy, Method method,
- Object[] args) throws Throwable {
- if (method.getName().equals("getConnection")) { //$NON-NLS-1$
- Properties p = new Properties();
- String user = null;
- String password = null;
- if (args != null && args.length == 2) {
- user = (String)args[0];
- password = (String)args[1];
- } else {
- user = connectionProps.getProperty(JDBCPropertyNames.USERNAME);
- password = connectionProps.getProperty(JDBCPropertyNames.PASSWORD);
- }
- if (user != null) {
- p.put("user", user); //$NON-NLS-1$
- }
- if (password != null) {
- p.put("password", password); //$NON-NLS-1$
- }
- return driver.connect(url, p);
- }
- throw new UnsupportedOperationException("Driver DataSource proxy only provides Connections"); //$NON-NLS-1$
- }
- });
- } else {
- if (temp instanceof DataSource) {
- this.ds = (DataSource)temp;
- PropertiesUtils.setBeanProperties(this.ds, connectionProps, null);
- } else if (temp instanceof XADataSource) {
- this.xaDs = (XADataSource)temp;
- PropertiesUtils.setBeanProperties(this.xaDs, connectionProps, null);
- } else {
- throw new ConnectorException(JDBCPlugin.Util.getString("JDBCConnector.invalid_source", dataSourceClassName)); //$NON-NLS-1$
- }
- }
+ if (dataSourceClassName.startsWith(JNDI)) {
+ try {
+ InitialContext ic = new InitialContext();
+ this.ds = (DataSource) ic.lookup(dataSourceClassName.substring(JNDI.length()));
+ } catch (NamingException e) {
+ throw new ConnectorException(e,JDBCPlugin.Util.getString("JDBCSourceConnectionFactory.Unable_to_find_jndi_ds", dataSourceClassName.substring(JNDI.length()))); //$NON-NLS-1$
+ }
+ } else {
+ Object temp = null;
+ try {
+ temp = ReflectionHelper.create(dataSourceClassName, null, Thread.currentThread().getContextClassLoader());
+ } catch (MetaMatrixCoreException e) {
+ throw new ConnectorException(e,JDBCPlugin.Util.getString("JDBCSourceConnectionFactory.Unable_to_load_the_JDBC_driver_class_6", dataSourceClassName)); //$NON-NLS-1$
+ }
+
+ final String url = connectionProps.getProperty(JDBCPropertyNames.URL);
+
+ if (temp instanceof Driver) {
+ final Driver driver = (Driver)temp;
+ // check URL if there is one
+ if (url == null || url.trim().length() == 0) {
+ throw new ConnectorException(JDBCPlugin.Util.getString("JDBCSourceConnectionFactory.Missing_JDBC_database_name_3")); //$NON-NLS-1$
+ }
+ validateURL(driver, url);
+ this.ds = (DataSource)Proxy.newProxyInstance(Thread.currentThread().getContextClassLoader(), new Class[] {DataSource.class}, new InvocationHandler() {
+ @Override
+ public Object invoke(Object proxy, Method method,
+ Object[] args) throws Throwable {
+ if (method.getName().equals("getConnection")) { //$NON-NLS-1$
+ Properties p = new Properties();
+ String user = null;
+ String password = null;
+ if (args != null && args.length == 2) {
+ user = (String)args[0];
+ password = (String)args[1];
+ } else {
+ user = connectionProps.getProperty(JDBCPropertyNames.USERNAME);
+ password = connectionProps.getProperty(JDBCPropertyNames.PASSWORD);
+ }
+ if (user != null) {
+ p.put("user", user); //$NON-NLS-1$
+ }
+ if (password != null) {
+ p.put("password", password); //$NON-NLS-1$
+ }
+ return driver.connect(url, p);
+ }
+ throw new UnsupportedOperationException("Driver DataSource proxy only provides Connections"); //$NON-NLS-1$
+ }
+ });
+ } else {
+ if (temp instanceof DataSource) {
+ this.ds = (DataSource)temp;
+ PropertiesUtils.setBeanProperties(this.ds, connectionProps, null);
+ } else if (temp instanceof XADataSource) {
+ this.xaDs = (XADataSource)temp;
+ PropertiesUtils.setBeanProperties(this.xaDs, connectionProps, null);
+ } else {
+ throw new ConnectorException(JDBCPlugin.Util.getString("JDBCConnector.invalid_source", dataSourceClassName)); //$NON-NLS-1$
+ }
+ }
+ }
if (this.ds instanceof XADataSource) {
this.xaDs = (XADataSource)this.ds;
}
Modified: trunk/connectors/connector-jdbc/src/main/resources/org/teiid/connector/jdbc/i18n.properties
===================================================================
--- trunk/connectors/connector-jdbc/src/main/resources/org/teiid/connector/jdbc/i18n.properties 2009-09-01 19:41:31 UTC (rev 1302)
+++ trunk/connectors/connector-jdbc/src/main/resources/org/teiid/connector/jdbc/i18n.properties 2009-09-01 21:42:42 UTC (rev 1303)
@@ -30,6 +30,7 @@
JDBCSourceConnectionFactory.til=Unsupported transaction isolation level "{0}".
JDBCSourceConnectionFactory.MissingProp=Missing required property: {0}
JDBCSourceXAConnecton.Connection_still_leased=Connection is still leased to connector worker. However, transaction ended, so terminating the lease.
+JDBCSourceConnectionFactory.Unable_to_find_jndi_ds=Failed to locate data source named {0} through JNDI lookup.
JDBCTranslator.Unexpected_exception_translating_results___8=Unexpected exception while translating results: {0}
JDBCTranslator.Unknown_error_translating_results___9=Unknown error translating results: {0}
15 years, 3 months
teiid SVN: r1302 - in trunk: runtime/src/main/java/com/metamatrix/jdbc and 1 other directory.
by teiid-commits@lists.jboss.org
Author: rareddy
Date: 2009-09-01 15:41:31 -0400 (Tue, 01 Sep 2009)
New Revision: 1302
Modified:
trunk/build/kit-runtime/deploy/log4j.xml
trunk/runtime/src/main/java/com/metamatrix/jdbc/EmbeddedConnectionFactoryImpl.java
Log:
TEIID-812: configured to place the log file in the ${teiid.home} location, this sets up a system property, but there seems to be any other alternative to configure this. In the embedded case in given VM Teiid only allows single instance this should be acceptable.
Modified: trunk/build/kit-runtime/deploy/log4j.xml
===================================================================
--- trunk/build/kit-runtime/deploy/log4j.xml 2009-09-01 17:58:00 UTC (rev 1301)
+++ trunk/build/kit-runtime/deploy/log4j.xml 2009-09-01 19:41:31 UTC (rev 1302)
@@ -7,7 +7,7 @@
</appender>
<appender name="FILE" class="org.apache.log4j.RollingFileAppender">
- <param name="File" value="log/teiid.log"/>
+ <param name="File" value="${teiid.home}/log/teiid.log"/>
<param name="MaxFileSize" value="1000KB"/>
<param name="MaxBackupIndex" value="25"/>
Modified: trunk/runtime/src/main/java/com/metamatrix/jdbc/EmbeddedConnectionFactoryImpl.java
===================================================================
--- trunk/runtime/src/main/java/com/metamatrix/jdbc/EmbeddedConnectionFactoryImpl.java 2009-09-01 17:58:00 UTC (rev 1301)
+++ trunk/runtime/src/main/java/com/metamatrix/jdbc/EmbeddedConnectionFactoryImpl.java 2009-09-01 19:41:31 UTC (rev 1302)
@@ -119,6 +119,10 @@
bootstrapURL = URLHelper.buildURL(props.getProperty(DQPEmbeddedProperties.BOOTURL));
// Create a temporary workspace directory
String teiidHome = props.getProperty(DQPEmbeddedProperties.TEIID_HOME);
+ if (System.getProperty(DQPEmbeddedProperties.TEIID_HOME) == null) {
+ System.setProperty(DQPEmbeddedProperties.TEIID_HOME, teiidHome);
+ }
+
this.workspaceDirectory = createWorkspace(teiidHome, props.getProperty(DQPEmbeddedProperties.DQP_WORKDIR, "work"), processName); //$NON-NLS-1$
props.setProperty(DQPEmbeddedProperties.DQP_WORKDIR, this.workspaceDirectory);
15 years, 3 months
teiid SVN: r1301 - in trunk: common-core/src/main/java/com/metamatrix/common/types/basic and 5 other directories.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2009-09-01 13:58:00 -0400 (Tue, 01 Sep 2009)
New Revision: 1301
Modified:
trunk/common-core/src/main/java/com/metamatrix/common/types/DataTypeManager.java
trunk/common-core/src/main/java/com/metamatrix/common/types/Transform.java
trunk/common-core/src/main/java/com/metamatrix/common/types/basic/BigDecimalToBigIntegerTransform.java
trunk/common-core/src/main/java/com/metamatrix/common/types/basic/ClobToStringTransform.java
trunk/common-core/src/main/java/com/metamatrix/common/types/basic/FloatingNumberToBigIntegerTransform.java
trunk/common-core/src/main/java/com/metamatrix/common/types/basic/NumberToBooleanTransform.java
trunk/common-core/src/main/java/com/metamatrix/common/types/basic/NumberToByteTransform.java
trunk/common-core/src/main/java/com/metamatrix/common/types/basic/NumberToDoubleTransform.java
trunk/common-core/src/main/java/com/metamatrix/common/types/basic/NumberToFloatTransform.java
trunk/common-core/src/main/java/com/metamatrix/common/types/basic/NumberToIntegerTransform.java
trunk/common-core/src/main/java/com/metamatrix/common/types/basic/NumberToLongTransform.java
trunk/common-core/src/main/java/com/metamatrix/common/types/basic/NumberToShortTransform.java
trunk/common-core/src/main/java/com/metamatrix/common/types/basic/ObjectToAnyTransform.java
trunk/common-core/src/main/java/com/metamatrix/common/types/basic/SQLXMLToStringTransform.java
trunk/common-core/src/main/java/com/metamatrix/common/types/basic/StringToBigDecimalTransform.java
trunk/common-core/src/main/java/com/metamatrix/common/types/basic/StringToBigIntegerTransform.java
trunk/common-core/src/main/java/com/metamatrix/common/types/basic/StringToBooleanTransform.java
trunk/common-core/src/main/java/com/metamatrix/common/types/basic/StringToByteTransform.java
trunk/common-core/src/main/java/com/metamatrix/common/types/basic/StringToCharacterTransform.java
trunk/common-core/src/main/java/com/metamatrix/common/types/basic/StringToDateTransform.java
trunk/common-core/src/main/java/com/metamatrix/common/types/basic/StringToDoubleTransform.java
trunk/common-core/src/main/java/com/metamatrix/common/types/basic/StringToFloatTransform.java
trunk/common-core/src/main/java/com/metamatrix/common/types/basic/StringToIntegerTransform.java
trunk/common-core/src/main/java/com/metamatrix/common/types/basic/StringToLongTransform.java
trunk/common-core/src/main/java/com/metamatrix/common/types/basic/StringToSQLXMLTransform.java
trunk/common-core/src/main/java/com/metamatrix/common/types/basic/StringToShortTransform.java
trunk/common-core/src/main/java/com/metamatrix/common/types/basic/StringToTimeTransform.java
trunk/common-core/src/main/java/com/metamatrix/common/types/basic/StringToTimestampTransform.java
trunk/common-core/src/main/java/com/metamatrix/common/types/basic/TimestampToDateTransform.java
trunk/common-core/src/main/java/com/metamatrix/common/types/basic/TimestampToTimeTransform.java
trunk/common-core/src/test/java/com/metamatrix/common/types/TestDataTypeManager.java
trunk/documentation/reference/src/main/docbook/en-US/content/datatypes.xml
trunk/engine/src/main/java/com/metamatrix/query/rewriter/QueryRewriter.java
trunk/engine/src/test/java/com/metamatrix/query/function/TestFunctionLibrary.java
trunk/engine/src/test/java/com/metamatrix/query/processor/TestInsertProcessing.java
Log:
TEIID-744 simplifying inNarrowing call to be isExplicit, also correcting int to float conversion as explicit since it can loose precision
Modified: trunk/common-core/src/main/java/com/metamatrix/common/types/DataTypeManager.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/types/DataTypeManager.java 2009-09-01 04:26:32 UTC (rev 1300)
+++ trunk/common-core/src/main/java/com/metamatrix/common/types/DataTypeManager.java 2009-09-01 17:58:00 UTC (rev 1301)
@@ -33,7 +33,7 @@
import com.metamatrix.core.jdbc.SQLXML;
## JDBC3.0-JDK1.5-end ##*/
import java.sql.Timestamp;
-import java.util.Arrays;
+import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
@@ -162,24 +162,10 @@
/** Base data type names and classes, Type class --> Type name */
private static Map<Class, String> dataTypeClasses = new LinkedHashMap<Class, String>();
- private static Set<String> DATA_TYPE_NAMES = Collections
- .unmodifiableSet(dataTypeNames.keySet());
+ private static Set<String> DATA_TYPE_NAMES = Collections.unmodifiableSet(dataTypeNames.keySet());
- private static Set<Class> DATA_TYPE_CLASSES = Collections
- .unmodifiableSet(dataTypeClasses.keySet());
+ private static Set<Class> DATA_TYPE_CLASSES = Collections.unmodifiableSet(dataTypeClasses.keySet());
- /**
- * Map of a type to the list of types that type may be converted to
- * implicitly
- */
- private static Map<String, List<String>> implicitConversions = new HashMap<String, List<String>>();
-
- /**
- * Map of a type to the list of types that type may be converted to
- * implicitly OR explicitly
- */
- private static Map<String, List<String>> explicitConversions = new HashMap<String, List<String>>();
-
private static Map<Class<?>, SourceTransform> sourceConverters = new HashMap<Class<?>, SourceTransform>();
// Static initializer - loads basic transforms types
@@ -189,12 +175,6 @@
// Load default transforms
loadBasicTransforms();
-
- // Load implicit conversions
- loadImplicitConversions();
-
- // Load allowed conversions
- loadExplicitConversions();
loadSourceConversions();
}
@@ -385,34 +365,32 @@
innerMap.put(targetName, transform);
}
- static void setImplicitConversions(String type, List<String> conversions) {
- implicitConversions.put(type, conversions);
- }
-
public static List<String> getImplicitConversions(String type) {
- return implicitConversions.get(type);
+ Map<String, Transform> innerMap = transforms.get(type);
+ if (innerMap != null) {
+ List<String> result = new ArrayList<String>(innerMap.size());
+ for (Map.Entry<String, Transform> entry : innerMap.entrySet()) {
+ if (!entry.getValue().isExplicit()) {
+ result.add(entry.getKey());
+ }
+ }
+ return result;
+ }
+ return Collections.emptyList();
}
public static boolean isImplicitConversion(String srcType, String tgtType) {
- List<String> conversions = implicitConversions.get(srcType);
- if (conversions != null) {
- return conversions.contains(tgtType);
+ Transform t = getTransform(srcType, tgtType);
+ if (t != null) {
+ return !t.isExplicit();
}
return false;
}
- static void setExplicitConversions(String type, List<String> conversions) {
- explicitConversions.put(type, conversions);
- }
-
- public static List<String> getExplicitConversions(String type) {
- return explicitConversions.get(type);
- }
-
public static boolean isExplicitConversion(String srcType, String tgtType) {
- List<String> conversions = explicitConversions.get(srcType);
- if (conversions != null) {
- return conversions.contains(tgtType);
+ Transform t = getTransform(srcType, tgtType);
+ if (t != null) {
+ return t.isExplicit();
}
return false;
}
@@ -439,44 +417,25 @@
* Load default data types.
*/
static void loadDataTypes() {
- DataTypeManager.addDataType(DefaultDataTypes.BOOLEAN,
- DefaultDataClasses.BOOLEAN);
- DataTypeManager.addDataType(DefaultDataTypes.BYTE,
- DefaultDataClasses.BYTE);
- DataTypeManager.addDataType(DefaultDataTypes.SHORT,
- DefaultDataClasses.SHORT);
- DataTypeManager.addDataType(DefaultDataTypes.CHAR,
- DefaultDataClasses.CHAR);
- DataTypeManager.addDataType(DefaultDataTypes.INTEGER,
- DefaultDataClasses.INTEGER);
- DataTypeManager.addDataType(DefaultDataTypes.LONG,
- DefaultDataClasses.LONG);
- DataTypeManager.addDataType(DefaultDataTypes.BIG_INTEGER,
- DefaultDataClasses.BIG_INTEGER);
- DataTypeManager.addDataType(DefaultDataTypes.FLOAT,
- DefaultDataClasses.FLOAT);
- DataTypeManager.addDataType(DefaultDataTypes.DOUBLE,
- DefaultDataClasses.DOUBLE);
- DataTypeManager.addDataType(DefaultDataTypes.BIG_DECIMAL,
- DefaultDataClasses.BIG_DECIMAL);
- DataTypeManager.addDataType(DefaultDataTypes.DATE,
- DefaultDataClasses.DATE);
- DataTypeManager.addDataType(DefaultDataTypes.TIME,
- DefaultDataClasses.TIME);
- DataTypeManager.addDataType(DefaultDataTypes.TIMESTAMP,
- DefaultDataClasses.TIMESTAMP);
- DataTypeManager.addDataType(DefaultDataTypes.STRING,
- DefaultDataClasses.STRING);
- DataTypeManager.addDataType(DefaultDataTypes.CLOB,
- DefaultDataClasses.CLOB);
- DataTypeManager.addDataType(DefaultDataTypes.XML,
- DefaultDataClasses.XML);
- DataTypeManager.addDataType(DefaultDataTypes.OBJECT,
- DefaultDataClasses.OBJECT);
- DataTypeManager.addDataType(DefaultDataTypes.NULL,
- DefaultDataClasses.NULL);
- DataTypeManager.addDataType(DefaultDataTypes.BLOB,
- DefaultDataClasses.BLOB);
+ DataTypeManager.addDataType(DefaultDataTypes.BOOLEAN, DefaultDataClasses.BOOLEAN);
+ DataTypeManager.addDataType(DefaultDataTypes.BYTE, DefaultDataClasses.BYTE);
+ DataTypeManager.addDataType(DefaultDataTypes.SHORT, DefaultDataClasses.SHORT);
+ DataTypeManager.addDataType(DefaultDataTypes.CHAR, DefaultDataClasses.CHAR);
+ DataTypeManager.addDataType(DefaultDataTypes.INTEGER, DefaultDataClasses.INTEGER);
+ DataTypeManager.addDataType(DefaultDataTypes.LONG, DefaultDataClasses.LONG);
+ DataTypeManager.addDataType(DefaultDataTypes.BIG_INTEGER, DefaultDataClasses.BIG_INTEGER);
+ DataTypeManager.addDataType(DefaultDataTypes.FLOAT, DefaultDataClasses.FLOAT);
+ DataTypeManager.addDataType(DefaultDataTypes.DOUBLE, DefaultDataClasses.DOUBLE);
+ DataTypeManager.addDataType(DefaultDataTypes.BIG_DECIMAL, DefaultDataClasses.BIG_DECIMAL);
+ DataTypeManager.addDataType(DefaultDataTypes.DATE, DefaultDataClasses.DATE);
+ DataTypeManager.addDataType(DefaultDataTypes.TIME, DefaultDataClasses.TIME);
+ DataTypeManager.addDataType(DefaultDataTypes.TIMESTAMP, DefaultDataClasses.TIMESTAMP);
+ DataTypeManager.addDataType(DefaultDataTypes.STRING, DefaultDataClasses.STRING);
+ DataTypeManager.addDataType(DefaultDataTypes.CLOB, DefaultDataClasses.CLOB);
+ DataTypeManager.addDataType(DefaultDataTypes.XML, DefaultDataClasses.XML);
+ DataTypeManager.addDataType(DefaultDataTypes.OBJECT, DefaultDataClasses.OBJECT);
+ DataTypeManager.addDataType(DefaultDataTypes.NULL, DefaultDataClasses.NULL);
+ DataTypeManager.addDataType(DefaultDataTypes.BLOB, DefaultDataClasses.BLOB);
}
/**
@@ -484,199 +443,126 @@
* set is always installed but may be overridden.
*/
static void loadBasicTransforms() {
- DataTypeManager
- .addTransform(new com.metamatrix.common.types.basic.BigDecimalToBigIntegerTransform());
DataTypeManager.addTransform(new NumberToBooleanTransform(BigDecimal.valueOf(0)));
- DataTypeManager.addTransform(new NumberToByteTransform(
- DefaultDataClasses.BIG_DECIMAL));
- DataTypeManager.addTransform(new NumberToDoubleTransform(
- DefaultDataClasses.BIG_DECIMAL, true, false));
- DataTypeManager.addTransform(new NumberToFloatTransform(
- DefaultDataClasses.BIG_DECIMAL, true, false));
- DataTypeManager.addTransform(new NumberToIntegerTransform(
- DefaultDataClasses.BIG_DECIMAL, true));
- DataTypeManager.addTransform(new NumberToLongTransform(
- DefaultDataClasses.BIG_DECIMAL, true, false));
- DataTypeManager.addTransform(new NumberToShortTransform(
- DefaultDataClasses.BIG_DECIMAL, true));
+ DataTypeManager.addTransform(new NumberToByteTransform(DefaultDataClasses.BIG_DECIMAL));
+ DataTypeManager.addTransform(new NumberToShortTransform(DefaultDataClasses.BIG_DECIMAL, true));
+ DataTypeManager.addTransform(new NumberToIntegerTransform(DefaultDataClasses.BIG_DECIMAL, true));
+ DataTypeManager.addTransform(new NumberToLongTransform(DefaultDataClasses.BIG_DECIMAL, true, false));
+ DataTypeManager.addTransform(new com.metamatrix.common.types.basic.BigDecimalToBigIntegerTransform());
+ DataTypeManager.addTransform(new NumberToFloatTransform(DefaultDataClasses.BIG_DECIMAL, true, false));
+ DataTypeManager.addTransform(new NumberToDoubleTransform(DefaultDataClasses.BIG_DECIMAL, true, false));
DataTypeManager.addTransform(new AnyToStringTransform(DefaultDataClasses.BIG_DECIMAL));
- DataTypeManager
- .addTransform(new com.metamatrix.common.types.basic.BigIntegerToBigDecimalTransform());
DataTypeManager.addTransform(new NumberToBooleanTransform(BigInteger.valueOf(0)));
- DataTypeManager.addTransform(new NumberToByteTransform(
- DefaultDataClasses.BIG_INTEGER));
- DataTypeManager.addTransform(new NumberToDoubleTransform(
- DefaultDataClasses.BIG_INTEGER, true, false));
- DataTypeManager.addTransform(new NumberToFloatTransform(
- DefaultDataClasses.BIG_INTEGER, true, false));
- DataTypeManager.addTransform(new NumberToIntegerTransform(
- DefaultDataClasses.BIG_INTEGER, true));
- DataTypeManager.addTransform(new NumberToLongTransform(
- DefaultDataClasses.BIG_INTEGER, true, false));
- DataTypeManager.addTransform(new NumberToShortTransform(
- DefaultDataClasses.BIG_INTEGER, true));
+ DataTypeManager.addTransform(new NumberToByteTransform(DefaultDataClasses.BIG_INTEGER));
+ DataTypeManager.addTransform(new NumberToShortTransform(DefaultDataClasses.BIG_INTEGER, true));
+ DataTypeManager.addTransform(new NumberToIntegerTransform(DefaultDataClasses.BIG_INTEGER, true));
+ DataTypeManager.addTransform(new NumberToLongTransform(DefaultDataClasses.BIG_INTEGER, true, false));
+ DataTypeManager.addTransform(new NumberToFloatTransform(DefaultDataClasses.BIG_INTEGER, true, false));
+ DataTypeManager.addTransform(new NumberToDoubleTransform(DefaultDataClasses.BIG_INTEGER, true, false));
+ DataTypeManager.addTransform(new com.metamatrix.common.types.basic.BigIntegerToBigDecimalTransform());
DataTypeManager.addTransform(new AnyToStringTransform(DefaultDataClasses.BIG_INTEGER));
- DataTypeManager
- .addTransform(new BooleanToNumberTransform(BigDecimal.valueOf(1), BigDecimal.valueOf(0)));
- DataTypeManager
- .addTransform(new BooleanToNumberTransform(BigInteger.valueOf(1), BigInteger.valueOf(0)));
- DataTypeManager
- .addTransform(new BooleanToNumberTransform(Double.valueOf(1), Double.valueOf(0)));
- DataTypeManager
- .addTransform(new BooleanToNumberTransform(Float.valueOf(1), Float.valueOf(0)));
- DataTypeManager
- .addTransform(new BooleanToNumberTransform(Long.valueOf(1), Long.valueOf(0)));
- DataTypeManager
- .addTransform(new BooleanToNumberTransform(Integer.valueOf(1), Integer.valueOf(0)));
- DataTypeManager
- .addTransform(new BooleanToNumberTransform(Short.valueOf((short)1), Short.valueOf((short)0)));
- DataTypeManager
- .addTransform(new BooleanToNumberTransform(Byte.valueOf((byte)1), Byte.valueOf((byte)0)));
+ DataTypeManager.addTransform(new BooleanToNumberTransform(Byte.valueOf((byte)1), Byte.valueOf((byte)0)));
+ DataTypeManager.addTransform(new BooleanToNumberTransform(Short.valueOf((short)1), Short.valueOf((short)0)));
+ DataTypeManager.addTransform(new BooleanToNumberTransform(Integer.valueOf(1), Integer.valueOf(0)));
+ DataTypeManager.addTransform(new BooleanToNumberTransform(Long.valueOf(1), Long.valueOf(0)));
+ DataTypeManager.addTransform(new BooleanToNumberTransform(BigInteger.valueOf(1), BigInteger.valueOf(0)));
+ DataTypeManager.addTransform(new BooleanToNumberTransform(Float.valueOf(1), Float.valueOf(0)));
+ DataTypeManager.addTransform(new BooleanToNumberTransform(Double.valueOf(1), Double.valueOf(0)));
+ DataTypeManager.addTransform(new BooleanToNumberTransform(BigDecimal.valueOf(1), BigDecimal.valueOf(0)));
DataTypeManager.addTransform(new AnyToStringTransform(DefaultDataClasses.BOOLEAN));
- DataTypeManager.addTransform(new FixedNumberToBigDecimalTransform(DefaultDataClasses.BYTE));
- DataTypeManager.addTransform(new FixedNumberToBigIntegerTransform(DefaultDataClasses.BYTE));
DataTypeManager.addTransform(new NumberToBooleanTransform(Byte.valueOf((byte)0)));
- DataTypeManager.addTransform(new NumberToDoubleTransform(
- DefaultDataClasses.BYTE, false, false));
- DataTypeManager.addTransform(new NumberToFloatTransform(
- DefaultDataClasses.BYTE, false, false));
- DataTypeManager.addTransform(new NumberToIntegerTransform(
- DefaultDataClasses.BYTE, false));
- DataTypeManager.addTransform(new NumberToLongTransform(
- DefaultDataClasses.BYTE, false, false));
- DataTypeManager.addTransform(new NumberToShortTransform(
- DefaultDataClasses.BYTE, false));
+ DataTypeManager.addTransform(new NumberToShortTransform(DefaultDataClasses.BYTE, false));
+ DataTypeManager.addTransform(new NumberToIntegerTransform(DefaultDataClasses.BYTE, false));
+ DataTypeManager.addTransform(new NumberToLongTransform(DefaultDataClasses.BYTE, false, false));
+ DataTypeManager.addTransform(new FixedNumberToBigIntegerTransform(DefaultDataClasses.BYTE));
+ DataTypeManager.addTransform(new NumberToFloatTransform(DefaultDataClasses.BYTE, false, false));
+ DataTypeManager.addTransform(new NumberToDoubleTransform(DefaultDataClasses.BYTE, false, false));
+ DataTypeManager.addTransform(new FixedNumberToBigDecimalTransform(DefaultDataClasses.BYTE));
DataTypeManager.addTransform(new AnyToStringTransform(DefaultDataClasses.BYTE));
DataTypeManager.addTransform(new AnyToStringTransform(DefaultDataClasses.CHAR));
- DataTypeManager
- .addTransform(new com.metamatrix.common.types.basic.ClobToStringTransform());
+ DataTypeManager.addTransform(new com.metamatrix.common.types.basic.ClobToStringTransform());
+ DataTypeManager.addTransform(new com.metamatrix.common.types.basic.DateToTimestampTransform());
DataTypeManager.addTransform(new AnyToStringTransform(DefaultDataClasses.DATE));
- DataTypeManager
- .addTransform(new com.metamatrix.common.types.basic.DateToTimestampTransform());
- DataTypeManager.addTransform(new FloatingNumberToBigDecimalTransform(DefaultDataClasses.DOUBLE));
- DataTypeManager.addTransform(new FloatingNumberToBigIntegerTransform(DefaultDataClasses.DOUBLE));
DataTypeManager.addTransform(new NumberToBooleanTransform(Double.valueOf(0)));
- DataTypeManager.addTransform(new NumberToByteTransform(
- DefaultDataClasses.DOUBLE));
- DataTypeManager.addTransform(new NumberToFloatTransform(
- DefaultDataClasses.DOUBLE, true, false));
- DataTypeManager.addTransform(new NumberToIntegerTransform(
- DefaultDataClasses.DOUBLE, true));
- DataTypeManager.addTransform(new NumberToLongTransform(
- DefaultDataClasses.DOUBLE, false, true)); //lossy, but not narrowing
- DataTypeManager.addTransform(new NumberToShortTransform(
- DefaultDataClasses.DOUBLE, true));
+ DataTypeManager.addTransform(new NumberToByteTransform(DefaultDataClasses.DOUBLE));
+ DataTypeManager.addTransform(new NumberToShortTransform(DefaultDataClasses.DOUBLE, true));
+ DataTypeManager.addTransform(new NumberToIntegerTransform(DefaultDataClasses.DOUBLE, true));
+ DataTypeManager.addTransform(new NumberToLongTransform( DefaultDataClasses.DOUBLE, false, true)); //lossy, but not narrowing
+ DataTypeManager.addTransform(new FloatingNumberToBigIntegerTransform(DefaultDataClasses.DOUBLE));
+ DataTypeManager.addTransform(new NumberToFloatTransform(DefaultDataClasses.DOUBLE, true, false));
+ DataTypeManager.addTransform(new FloatingNumberToBigDecimalTransform(DefaultDataClasses.DOUBLE));
DataTypeManager.addTransform(new AnyToStringTransform(DefaultDataClasses.DOUBLE));
- DataTypeManager.addTransform(new FloatingNumberToBigDecimalTransform(DefaultDataClasses.FLOAT));
- DataTypeManager.addTransform(new FloatingNumberToBigIntegerTransform(DefaultDataClasses.FLOAT));
DataTypeManager.addTransform(new NumberToBooleanTransform(Float.valueOf(0)));
- DataTypeManager.addTransform(new NumberToByteTransform(
- DefaultDataClasses.FLOAT));
- DataTypeManager.addTransform(new NumberToDoubleTransform(
- DefaultDataClasses.FLOAT, false, false));
- DataTypeManager.addTransform(new NumberToIntegerTransform(
- DefaultDataClasses.FLOAT, true));
- DataTypeManager.addTransform(new NumberToLongTransform(
- DefaultDataClasses.FLOAT, false, true)); //lossy, but not narrowing
- DataTypeManager.addTransform(new NumberToShortTransform(
- DefaultDataClasses.FLOAT, true));
+ DataTypeManager.addTransform(new NumberToByteTransform(DefaultDataClasses.FLOAT));
+ DataTypeManager.addTransform(new NumberToShortTransform(DefaultDataClasses.FLOAT, true));
+ DataTypeManager.addTransform(new NumberToIntegerTransform(DefaultDataClasses.FLOAT, true));
+ DataTypeManager.addTransform(new NumberToLongTransform(DefaultDataClasses.FLOAT, false, true)); //lossy, but not narrowing
+ DataTypeManager.addTransform(new FloatingNumberToBigIntegerTransform(DefaultDataClasses.FLOAT));
+ DataTypeManager.addTransform(new NumberToDoubleTransform(DefaultDataClasses.FLOAT, false, false));
+ DataTypeManager.addTransform(new FloatingNumberToBigDecimalTransform(DefaultDataClasses.FLOAT));
DataTypeManager.addTransform(new AnyToStringTransform(DefaultDataClasses.FLOAT));
- DataTypeManager.addTransform(new FixedNumberToBigDecimalTransform(DefaultDataClasses.INTEGER));
- DataTypeManager.addTransform(new FixedNumberToBigIntegerTransform(DefaultDataClasses.INTEGER));
DataTypeManager.addTransform(new NumberToBooleanTransform(Integer.valueOf(0)));
- DataTypeManager.addTransform(new NumberToByteTransform(
- DefaultDataClasses.INTEGER));
- DataTypeManager.addTransform(new NumberToDoubleTransform(
- DefaultDataClasses.INTEGER, false, false));
- DataTypeManager.addTransform(new NumberToFloatTransform(
- DefaultDataClasses.INTEGER, false, true)); //lossy, but not narrowing
- DataTypeManager.addTransform(new NumberToLongTransform(
- DefaultDataClasses.INTEGER, false, false));
- DataTypeManager.addTransform(new NumberToShortTransform(
- DefaultDataClasses.INTEGER, true));
+ DataTypeManager.addTransform(new NumberToByteTransform(DefaultDataClasses.INTEGER));
+ DataTypeManager.addTransform(new NumberToShortTransform(DefaultDataClasses.INTEGER, true));
+ DataTypeManager.addTransform(new NumberToLongTransform(DefaultDataClasses.INTEGER, false, false));
+ DataTypeManager.addTransform(new FixedNumberToBigIntegerTransform(DefaultDataClasses.INTEGER));
+ DataTypeManager.addTransform(new NumberToFloatTransform(DefaultDataClasses.INTEGER, false, true)); //lossy, but not narrowing
+ DataTypeManager.addTransform(new NumberToDoubleTransform(DefaultDataClasses.INTEGER, false, false));
+ DataTypeManager.addTransform(new FixedNumberToBigDecimalTransform(DefaultDataClasses.INTEGER));
DataTypeManager.addTransform(new AnyToStringTransform(DefaultDataClasses.INTEGER));
- DataTypeManager.addTransform(new FixedNumberToBigDecimalTransform(DefaultDataClasses.LONG));
- DataTypeManager.addTransform(new FixedNumberToBigIntegerTransform(DefaultDataClasses.LONG));
DataTypeManager.addTransform(new NumberToBooleanTransform(Long.valueOf(0)));
- DataTypeManager.addTransform(new NumberToByteTransform(
- DefaultDataClasses.LONG));
- DataTypeManager.addTransform(new NumberToDoubleTransform(
- DefaultDataClasses.LONG, false, true)); //lossy, but not narrowing
- DataTypeManager.addTransform(new NumberToFloatTransform(
- DefaultDataClasses.LONG, false, true)); //lossy, but not narrowing
- DataTypeManager.addTransform(new NumberToIntegerTransform(
- DefaultDataClasses.LONG, true));
- DataTypeManager.addTransform(new NumberToShortTransform(
- DefaultDataClasses.LONG, true));
+ DataTypeManager.addTransform(new NumberToByteTransform(DefaultDataClasses.LONG));
+ DataTypeManager.addTransform(new NumberToShortTransform(DefaultDataClasses.LONG, true));
+ DataTypeManager.addTransform(new NumberToIntegerTransform(DefaultDataClasses.LONG, true));
+ DataTypeManager.addTransform(new FixedNumberToBigIntegerTransform(DefaultDataClasses.LONG));
+ DataTypeManager.addTransform(new NumberToFloatTransform(DefaultDataClasses.LONG, false, true)); //lossy, but not narrowing
+ DataTypeManager.addTransform(new NumberToDoubleTransform(DefaultDataClasses.LONG, false, true)); //lossy, but not narrowing
+ DataTypeManager.addTransform(new FixedNumberToBigDecimalTransform(DefaultDataClasses.LONG));
DataTypeManager.addTransform(new AnyToStringTransform(DefaultDataClasses.LONG));
- DataTypeManager.addTransform(new FixedNumberToBigDecimalTransform(DefaultDataClasses.SHORT));
- DataTypeManager.addTransform(new FixedNumberToBigIntegerTransform(DefaultDataClasses.SHORT));
DataTypeManager.addTransform(new NumberToBooleanTransform(Short.valueOf((short)0)));
- DataTypeManager.addTransform(new NumberToByteTransform(
- DefaultDataClasses.SHORT));
- DataTypeManager.addTransform(new NumberToDoubleTransform(
- DefaultDataClasses.SHORT, false, false));
- DataTypeManager.addTransform(new NumberToFloatTransform(
- DefaultDataClasses.SHORT, false, false));
- DataTypeManager.addTransform(new NumberToIntegerTransform(
- DefaultDataClasses.SHORT, false));
- DataTypeManager.addTransform(new NumberToLongTransform(
- DefaultDataClasses.SHORT, false, false));
+ DataTypeManager.addTransform(new NumberToByteTransform(DefaultDataClasses.SHORT));
+ DataTypeManager.addTransform(new NumberToIntegerTransform(DefaultDataClasses.SHORT, false));
+ DataTypeManager.addTransform(new NumberToLongTransform(DefaultDataClasses.SHORT, false, false));
+ DataTypeManager.addTransform(new FixedNumberToBigIntegerTransform(DefaultDataClasses.SHORT));
+ DataTypeManager.addTransform(new NumberToFloatTransform(DefaultDataClasses.SHORT, false, false));
+ DataTypeManager.addTransform(new NumberToDoubleTransform(DefaultDataClasses.SHORT, false, false));
+ DataTypeManager.addTransform(new FixedNumberToBigDecimalTransform(DefaultDataClasses.SHORT));
DataTypeManager.addTransform(new AnyToStringTransform(DefaultDataClasses.SHORT));
- DataTypeManager
- .addTransform(new com.metamatrix.common.types.basic.StringToBigDecimalTransform());
- DataTypeManager
- .addTransform(new com.metamatrix.common.types.basic.StringToBigIntegerTransform());
- DataTypeManager
- .addTransform(new com.metamatrix.common.types.basic.StringToBooleanTransform());
- DataTypeManager
- .addTransform(new com.metamatrix.common.types.basic.StringToByteTransform());
- DataTypeManager
- .addTransform(new com.metamatrix.common.types.basic.StringToCharacterTransform());
- DataTypeManager
- .addTransform(new com.metamatrix.common.types.basic.StringToClobTransform());
- DataTypeManager
- .addTransform(new com.metamatrix.common.types.basic.StringToDateTransform());
- DataTypeManager
- .addTransform(new com.metamatrix.common.types.basic.StringToDoubleTransform());
- DataTypeManager
- .addTransform(new com.metamatrix.common.types.basic.StringToFloatTransform());
- DataTypeManager
- .addTransform(new com.metamatrix.common.types.basic.StringToIntegerTransform());
- DataTypeManager
- .addTransform(new com.metamatrix.common.types.basic.StringToLongTransform());
- DataTypeManager
- .addTransform(new com.metamatrix.common.types.basic.StringToShortTransform());
- DataTypeManager
- .addTransform(new com.metamatrix.common.types.basic.StringToTimestampTransform());
- DataTypeManager
- .addTransform(new com.metamatrix.common.types.basic.StringToTimeTransform());
- DataTypeManager
- .addTransform(new com.metamatrix.common.types.basic.StringToSQLXMLTransform());
+ DataTypeManager.addTransform(new com.metamatrix.common.types.basic.StringToBooleanTransform());
+ DataTypeManager.addTransform(new com.metamatrix.common.types.basic.StringToByteTransform());
+ DataTypeManager.addTransform(new com.metamatrix.common.types.basic.StringToShortTransform());
+ DataTypeManager.addTransform(new com.metamatrix.common.types.basic.StringToIntegerTransform());
+ DataTypeManager.addTransform(new com.metamatrix.common.types.basic.StringToLongTransform());
+ DataTypeManager.addTransform(new com.metamatrix.common.types.basic.StringToBigIntegerTransform());
+ DataTypeManager.addTransform(new com.metamatrix.common.types.basic.StringToFloatTransform());
+ DataTypeManager.addTransform(new com.metamatrix.common.types.basic.StringToDoubleTransform());
+ DataTypeManager.addTransform(new com.metamatrix.common.types.basic.StringToBigDecimalTransform());
+ DataTypeManager.addTransform(new com.metamatrix.common.types.basic.StringToTimeTransform());
+ DataTypeManager.addTransform(new com.metamatrix.common.types.basic.StringToDateTransform());
+ DataTypeManager.addTransform(new com.metamatrix.common.types.basic.StringToTimestampTransform());
+ DataTypeManager.addTransform(new com.metamatrix.common.types.basic.StringToCharacterTransform());
+ DataTypeManager.addTransform(new com.metamatrix.common.types.basic.StringToClobTransform());
+ DataTypeManager.addTransform(new com.metamatrix.common.types.basic.StringToSQLXMLTransform());
- DataTypeManager
- .addTransform(new com.metamatrix.common.types.basic.SQLXMLToStringTransform());
+ DataTypeManager.addTransform(new com.metamatrix.common.types.basic.SQLXMLToStringTransform());
- DataTypeManager
- .addTransform(new com.metamatrix.common.types.basic.TimestampToDateTransform());
+ DataTypeManager.addTransform(new com.metamatrix.common.types.basic.TimestampToTimeTransform());
+ DataTypeManager.addTransform(new com.metamatrix.common.types.basic.TimestampToDateTransform());
DataTypeManager.addTransform(new AnyToStringTransform(DefaultDataClasses.TIMESTAMP));
- DataTypeManager
- .addTransform(new com.metamatrix.common.types.basic.TimestampToTimeTransform());
-
- DataTypeManager
- .addTransform(new com.metamatrix.common.types.basic.TimeToTimestampTransform());
+
+ DataTypeManager.addTransform(new com.metamatrix.common.types.basic.TimeToTimestampTransform());
DataTypeManager.addTransform(new AnyToStringTransform(DefaultDataClasses.TIME));
for (Class<?> type : getAllDataTypeClasses()) {
@@ -691,176 +577,6 @@
}
- static void loadImplicitConversions() {
- DataTypeManager.setImplicitConversions(DefaultDataTypes.STRING, Arrays
- .asList(new String[] { DefaultDataTypes.CLOB,
- DefaultDataTypes.OBJECT }));
- DataTypeManager.setImplicitConversions(DefaultDataTypes.CHAR, Arrays
- .asList(new String[] { DefaultDataTypes.STRING,
- DefaultDataTypes.OBJECT }));
- DataTypeManager.setImplicitConversions(DefaultDataTypes.BOOLEAN, Arrays
- .asList(new String[] { DefaultDataTypes.STRING,
- DefaultDataTypes.BYTE, DefaultDataTypes.SHORT,
- DefaultDataTypes.INTEGER, DefaultDataTypes.LONG,
- DefaultDataTypes.BIG_INTEGER, DefaultDataTypes.FLOAT,
- DefaultDataTypes.DOUBLE, DefaultDataTypes.BIG_DECIMAL,
- DefaultDataTypes.OBJECT }));
- DataTypeManager.setImplicitConversions(DefaultDataTypes.BYTE,
- Arrays
- .asList(new String[] { DefaultDataTypes.STRING,
- DefaultDataTypes.SHORT,
- DefaultDataTypes.INTEGER,
- DefaultDataTypes.LONG,
- DefaultDataTypes.BIG_INTEGER,
- DefaultDataTypes.FLOAT,
- DefaultDataTypes.DOUBLE,
- DefaultDataTypes.BIG_DECIMAL,
- DefaultDataTypes.OBJECT }));
- DataTypeManager.setImplicitConversions(DefaultDataTypes.SHORT, Arrays
- .asList(new String[] { DefaultDataTypes.STRING,
- DefaultDataTypes.INTEGER, DefaultDataTypes.LONG,
- DefaultDataTypes.BIG_INTEGER, DefaultDataTypes.FLOAT,
- DefaultDataTypes.DOUBLE, DefaultDataTypes.BIG_DECIMAL,
- DefaultDataTypes.OBJECT }));
- DataTypeManager.setImplicitConversions(DefaultDataTypes.INTEGER,
- Arrays
- .asList(new String[] { DefaultDataTypes.STRING,
- DefaultDataTypes.LONG,
- DefaultDataTypes.BIG_INTEGER,
- DefaultDataTypes.FLOAT,
- DefaultDataTypes.DOUBLE,
- DefaultDataTypes.BIG_DECIMAL,
- DefaultDataTypes.OBJECT }));
- DataTypeManager.setImplicitConversions(DefaultDataTypes.LONG, Arrays
- .asList(new String[] { DefaultDataTypes.STRING,
- DefaultDataTypes.BIG_INTEGER, DefaultDataTypes.BIG_DECIMAL,
- DefaultDataTypes.OBJECT }));
- DataTypeManager.setImplicitConversions(DefaultDataTypes.BIG_INTEGER,
- Arrays
- .asList(new String[] { DefaultDataTypes.STRING,
- DefaultDataTypes.BIG_DECIMAL,
- DefaultDataTypes.OBJECT }));
- DataTypeManager.setImplicitConversions(DefaultDataTypes.FLOAT, Arrays
- .asList(new String[] { DefaultDataTypes.STRING,
- DefaultDataTypes.DOUBLE, DefaultDataTypes.BIG_DECIMAL,
- DefaultDataTypes.OBJECT }));
- DataTypeManager.setImplicitConversions(DefaultDataTypes.DOUBLE,
- Arrays
- .asList(new String[] { DefaultDataTypes.STRING,
- DefaultDataTypes.BIG_DECIMAL,
- DefaultDataTypes.OBJECT }));
- DataTypeManager.setImplicitConversions(DefaultDataTypes.BIG_DECIMAL,
- Arrays.asList(new String[] { DefaultDataTypes.STRING,
- DefaultDataTypes.OBJECT }));
- DataTypeManager.setImplicitConversions(DefaultDataTypes.DATE, Arrays
- .asList(new String[] { DefaultDataTypes.STRING,
- DefaultDataTypes.TIMESTAMP, DefaultDataTypes.OBJECT }));
- DataTypeManager.setImplicitConversions(DefaultDataTypes.TIME, Arrays
- .asList(new String[] { DefaultDataTypes.STRING,
- DefaultDataTypes.TIMESTAMP,
- DefaultDataTypes.OBJECT }));
- DataTypeManager.setImplicitConversions(DefaultDataTypes.TIMESTAMP,
- Arrays.asList(new String[] { DefaultDataTypes.STRING,
- DefaultDataTypes.OBJECT }));
- DataTypeManager.setImplicitConversions(DefaultDataTypes.OBJECT, Arrays
- .asList(new String[] {}));
- DataTypeManager.setImplicitConversions(DefaultDataTypes.NULL, Arrays
- .asList(new String[] { DefaultDataTypes.STRING,
- DefaultDataTypes.CHAR, DefaultDataTypes.BOOLEAN,
- DefaultDataTypes.BYTE, DefaultDataTypes.SHORT,
- DefaultDataTypes.INTEGER, DefaultDataTypes.LONG,
- DefaultDataTypes.BIG_INTEGER, DefaultDataTypes.FLOAT,
- DefaultDataTypes.DOUBLE, DefaultDataTypes.BIG_DECIMAL,
- DefaultDataTypes.DATE, DefaultDataTypes.TIME,
- DefaultDataTypes.TIMESTAMP, DefaultDataTypes.OBJECT,
- DefaultDataTypes.BLOB, DefaultDataTypes.CLOB,
- DefaultDataTypes.XML }));
- DataTypeManager.setImplicitConversions(DefaultDataTypes.BLOB, Arrays
- .asList(new String[] { DefaultDataTypes.OBJECT }));
- DataTypeManager.setImplicitConversions(DefaultDataTypes.CLOB, Arrays
- .asList(new String[] { DefaultDataTypes.OBJECT }));
- DataTypeManager.setImplicitConversions(DefaultDataTypes.XML, Arrays
- .asList(new String[] { DefaultDataTypes.OBJECT }));
- }
-
- static void loadExplicitConversions() {
- DataTypeManager.setExplicitConversions(DefaultDataTypes.STRING, Arrays
- .asList(new String[] { DefaultDataTypes.CHAR,
- DefaultDataTypes.BOOLEAN, DefaultDataTypes.BYTE,
- DefaultDataTypes.SHORT, DefaultDataTypes.INTEGER,
- DefaultDataTypes.LONG, DefaultDataTypes.BIG_INTEGER,
- DefaultDataTypes.FLOAT, DefaultDataTypes.DOUBLE,
- DefaultDataTypes.BIG_DECIMAL, DefaultDataTypes.DATE,
- DefaultDataTypes.TIME, DefaultDataTypes.TIMESTAMP,
- DefaultDataTypes.XML }));
- DataTypeManager.setExplicitConversions(DefaultDataTypes.CHAR, Arrays
- .asList(new String[] {}));
- DataTypeManager.setExplicitConversions(DefaultDataTypes.BOOLEAN, Arrays
- .asList(new String[] {}));
- DataTypeManager.setExplicitConversions(DefaultDataTypes.BYTE, Arrays
- .asList(new String[] { DefaultDataTypes.BOOLEAN }));
- DataTypeManager.setExplicitConversions(DefaultDataTypes.SHORT, Arrays
- .asList(new String[] { DefaultDataTypes.BOOLEAN,
- DefaultDataTypes.BYTE }));
- DataTypeManager.setExplicitConversions(DefaultDataTypes.INTEGER, Arrays
- .asList(new String[] { DefaultDataTypes.BOOLEAN,
- DefaultDataTypes.BYTE, DefaultDataTypes.SHORT }));
- DataTypeManager.setExplicitConversions(DefaultDataTypes.LONG, Arrays
- .asList(new String[] { DefaultDataTypes.BOOLEAN,
- DefaultDataTypes.BYTE, DefaultDataTypes.SHORT,
- DefaultDataTypes.INTEGER, DefaultDataTypes.FLOAT,
- DefaultDataTypes.DOUBLE}));
- DataTypeManager.setExplicitConversions(DefaultDataTypes.BIG_INTEGER,
- Arrays.asList(new String[] { DefaultDataTypes.BOOLEAN,
- DefaultDataTypes.BYTE, DefaultDataTypes.SHORT,
- DefaultDataTypes.INTEGER, DefaultDataTypes.LONG,
- DefaultDataTypes.FLOAT, DefaultDataTypes.DOUBLE }));
- DataTypeManager.setExplicitConversions(DefaultDataTypes.FLOAT, Arrays
- .asList(new String[] { DefaultDataTypes.BOOLEAN,
- DefaultDataTypes.BYTE, DefaultDataTypes.SHORT,
- DefaultDataTypes.INTEGER, DefaultDataTypes.LONG,
- DefaultDataTypes.BIG_INTEGER }));
- DataTypeManager
- .setExplicitConversions(DefaultDataTypes.DOUBLE, Arrays
- .asList(new String[] { DefaultDataTypes.BOOLEAN,
- DefaultDataTypes.BYTE, DefaultDataTypes.SHORT,
- DefaultDataTypes.INTEGER,
- DefaultDataTypes.LONG,
- DefaultDataTypes.BIG_INTEGER,
- DefaultDataTypes.FLOAT }));
- DataTypeManager.setExplicitConversions(DefaultDataTypes.BIG_DECIMAL,
- Arrays.asList(new String[] { DefaultDataTypes.BOOLEAN,
- DefaultDataTypes.BYTE, DefaultDataTypes.SHORT,
- DefaultDataTypes.INTEGER, DefaultDataTypes.LONG,
- DefaultDataTypes.BIG_INTEGER, DefaultDataTypes.FLOAT,
- DefaultDataTypes.DOUBLE }));
- DataTypeManager.setExplicitConversions(DefaultDataTypes.DATE, Arrays
- .asList(new String[] {}));
- DataTypeManager.setExplicitConversions(DefaultDataTypes.TIME, Arrays
- .asList(new String[] {}));
- DataTypeManager.setExplicitConversions(DefaultDataTypes.TIMESTAMP,
- Arrays.asList(new String[] { DefaultDataTypes.DATE,
- DefaultDataTypes.TIME }));
- DataTypeManager.setExplicitConversions(DefaultDataTypes.OBJECT, Arrays
- .asList(new String[] { DefaultDataTypes.STRING,
- DefaultDataTypes.CHAR, DefaultDataTypes.BOOLEAN,
- DefaultDataTypes.BYTE, DefaultDataTypes.SHORT,
- DefaultDataTypes.INTEGER, DefaultDataTypes.LONG,
- DefaultDataTypes.BIG_INTEGER, DefaultDataTypes.FLOAT,
- DefaultDataTypes.DOUBLE, DefaultDataTypes.BIG_DECIMAL,
- DefaultDataTypes.DATE, DefaultDataTypes.TIME,
- DefaultDataTypes.TIMESTAMP, DefaultDataTypes.BLOB,
- DefaultDataTypes.CLOB, DefaultDataTypes.XML }));
- DataTypeManager.setExplicitConversions(DefaultDataTypes.NULL, Arrays
- .asList(new String[] {}));
- DataTypeManager.setExplicitConversions(DefaultDataTypes.BLOB, Arrays
- .asList(new String[] {}));
- DataTypeManager.setExplicitConversions(DefaultDataTypes.CLOB, Arrays
- .asList(new String[] { DefaultDataTypes.STRING }));
- DataTypeManager.setExplicitConversions(DefaultDataTypes.XML, Arrays
- .asList(new String[] { DefaultDataTypes.STRING }));
- }
-
static void loadSourceConversions() {
sourceConverters.put(Clob.class, new SourceTransform<Clob, ClobType>() {
//## JDBC4.0-begin ##
Modified: trunk/common-core/src/main/java/com/metamatrix/common/types/Transform.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/types/Transform.java 2009-09-01 04:26:32 UTC (rev 1300)
+++ trunk/common-core/src/main/java/com/metamatrix/common/types/Transform.java 2009-09-01 17:58:00 UTC (rev 1301)
@@ -95,21 +95,10 @@
return getDisplayName();
}
- /**
- * Flag if the transformation from source to target is
- * a narrowing transformation that may lose information.
- * This class returns false by default. This method should
- * be overridden if the transform is a narrowing transform.
- * @return False unless overridden.
- */
- public boolean isNarrowing() {
+ public boolean isExplicit() {
return false;
}
- public boolean isLossy() {
- return isNarrowing();
- }
-
/**
* Override Object.toString() to do getDisplayName() version.
* @return String representation of object
Modified: trunk/common-core/src/main/java/com/metamatrix/common/types/basic/BigDecimalToBigIntegerTransform.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/types/basic/BigDecimalToBigIntegerTransform.java 2009-09-01 04:26:32 UTC (rev 1300)
+++ trunk/common-core/src/main/java/com/metamatrix/common/types/basic/BigDecimalToBigIntegerTransform.java 2009-09-01 17:58:00 UTC (rev 1301)
@@ -58,12 +58,7 @@
return BigInteger.class;
}
- /**
- * Flag if the transformation from source to target is
- * a narrowing transformation that may lose information.
- * @return True - this transformation is narrowing
- */
- public boolean isNarrowing() {
+ public boolean isExplicit() {
return true;
}
Modified: trunk/common-core/src/main/java/com/metamatrix/common/types/basic/ClobToStringTransform.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/types/basic/ClobToStringTransform.java 2009-09-01 04:26:32 UTC (rev 1300)
+++ trunk/common-core/src/main/java/com/metamatrix/common/types/basic/ClobToStringTransform.java 2009-09-01 17:58:00 UTC (rev 1301)
@@ -69,9 +69,9 @@
}
/**
- * @see com.metamatrix.common.types.Transform#isNarrowing()
+ * @see com.metamatrix.common.types.Transform#isExplicit()
*/
- public boolean isNarrowing() {
+ public boolean isExplicit() {
return true;
}
}
Modified: trunk/common-core/src/main/java/com/metamatrix/common/types/basic/FloatingNumberToBigIntegerTransform.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/types/basic/FloatingNumberToBigIntegerTransform.java 2009-09-01 04:26:32 UTC (rev 1300)
+++ trunk/common-core/src/main/java/com/metamatrix/common/types/basic/FloatingNumberToBigIntegerTransform.java 2009-09-01 17:58:00 UTC (rev 1301)
@@ -65,7 +65,7 @@
}
@Override
- public boolean isNarrowing() {
+ public boolean isExplicit() {
return true;
}
Modified: trunk/common-core/src/main/java/com/metamatrix/common/types/basic/NumberToBooleanTransform.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/types/basic/NumberToBooleanTransform.java 2009-09-01 04:26:32 UTC (rev 1300)
+++ trunk/common-core/src/main/java/com/metamatrix/common/types/basic/NumberToBooleanTransform.java 2009-09-01 17:58:00 UTC (rev 1301)
@@ -55,7 +55,7 @@
}
@Override
- public boolean isNarrowing() {
+ public boolean isExplicit() {
return true;
}
Modified: trunk/common-core/src/main/java/com/metamatrix/common/types/basic/NumberToByteTransform.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/types/basic/NumberToByteTransform.java 2009-09-01 04:26:32 UTC (rev 1300)
+++ trunk/common-core/src/main/java/com/metamatrix/common/types/basic/NumberToByteTransform.java 2009-09-01 17:58:00 UTC (rev 1301)
@@ -59,5 +59,10 @@
public Class<?> getTargetType() {
return DataTypeManager.DefaultDataClasses.BYTE;
}
-
+
+ @Override
+ public boolean isExplicit() {
+ return true;
+ }
+
}
Modified: trunk/common-core/src/main/java/com/metamatrix/common/types/basic/NumberToDoubleTransform.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/types/basic/NumberToDoubleTransform.java 2009-09-01 04:26:32 UTC (rev 1300)
+++ trunk/common-core/src/main/java/com/metamatrix/common/types/basic/NumberToDoubleTransform.java 2009-09-01 17:58:00 UTC (rev 1301)
@@ -67,13 +67,8 @@
}
@Override
- public boolean isNarrowing() {
- return isNarrowing;
+ public boolean isExplicit() {
+ return isNarrowing || isLossy;
}
- @Override
- public boolean isLossy() {
- return isLossy;
- }
-
}
Modified: trunk/common-core/src/main/java/com/metamatrix/common/types/basic/NumberToFloatTransform.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/types/basic/NumberToFloatTransform.java 2009-09-01 04:26:32 UTC (rev 1300)
+++ trunk/common-core/src/main/java/com/metamatrix/common/types/basic/NumberToFloatTransform.java 2009-09-01 17:58:00 UTC (rev 1301)
@@ -67,13 +67,8 @@
}
@Override
- public boolean isNarrowing() {
- return isNarrowing;
+ public boolean isExplicit() {
+ return isNarrowing || isLossy;
}
- @Override
- public boolean isLossy() {
- return isLossy;
- }
-
}
Modified: trunk/common-core/src/main/java/com/metamatrix/common/types/basic/NumberToIntegerTransform.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/types/basic/NumberToIntegerTransform.java 2009-09-01 04:26:32 UTC (rev 1300)
+++ trunk/common-core/src/main/java/com/metamatrix/common/types/basic/NumberToIntegerTransform.java 2009-09-01 17:58:00 UTC (rev 1301)
@@ -65,7 +65,7 @@
}
@Override
- public boolean isNarrowing() {
+ public boolean isExplicit() {
return isNarrowing;
}
Modified: trunk/common-core/src/main/java/com/metamatrix/common/types/basic/NumberToLongTransform.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/types/basic/NumberToLongTransform.java 2009-09-01 04:26:32 UTC (rev 1300)
+++ trunk/common-core/src/main/java/com/metamatrix/common/types/basic/NumberToLongTransform.java 2009-09-01 17:58:00 UTC (rev 1301)
@@ -67,13 +67,8 @@
}
@Override
- public boolean isNarrowing() {
- return isNarrowing;
+ public boolean isExplicit() {
+ return isNarrowing || isLossy;
}
- @Override
- public boolean isLossy() {
- return isLossy;
- }
-
}
Modified: trunk/common-core/src/main/java/com/metamatrix/common/types/basic/NumberToShortTransform.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/types/basic/NumberToShortTransform.java 2009-09-01 04:26:32 UTC (rev 1300)
+++ trunk/common-core/src/main/java/com/metamatrix/common/types/basic/NumberToShortTransform.java 2009-09-01 17:58:00 UTC (rev 1301)
@@ -65,7 +65,7 @@
}
@Override
- public boolean isNarrowing() {
+ public boolean isExplicit() {
return isNarrowing;
}
Modified: trunk/common-core/src/main/java/com/metamatrix/common/types/basic/ObjectToAnyTransform.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/types/basic/ObjectToAnyTransform.java 2009-09-01 04:26:32 UTC (rev 1300)
+++ trunk/common-core/src/main/java/com/metamatrix/common/types/basic/ObjectToAnyTransform.java 2009-09-01 17:58:00 UTC (rev 1301)
@@ -68,9 +68,9 @@
}
/**
- * @see com.metamatrix.common.types.Transform#isNarrowing()
+ * @see com.metamatrix.common.types.Transform#isExplicit()
*/
- public boolean isNarrowing() {
+ public boolean isExplicit() {
return true;
}
}
Modified: trunk/common-core/src/main/java/com/metamatrix/common/types/basic/SQLXMLToStringTransform.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/types/basic/SQLXMLToStringTransform.java 2009-09-01 04:26:32 UTC (rev 1300)
+++ trunk/common-core/src/main/java/com/metamatrix/common/types/basic/SQLXMLToStringTransform.java 2009-09-01 17:58:00 UTC (rev 1301)
@@ -60,9 +60,9 @@
}
/**
- * @see com.metamatrix.common.types.Transform#isNarrowing()
+ * @see com.metamatrix.common.types.Transform#isExplicit()
*/
- public boolean isNarrowing() {
+ public boolean isExplicit() {
return true;
}
}
Modified: trunk/common-core/src/main/java/com/metamatrix/common/types/basic/StringToBigDecimalTransform.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/types/basic/StringToBigDecimalTransform.java 2009-09-01 04:26:32 UTC (rev 1300)
+++ trunk/common-core/src/main/java/com/metamatrix/common/types/basic/StringToBigDecimalTransform.java 2009-09-01 17:58:00 UTC (rev 1301)
@@ -64,7 +64,7 @@
}
@Override
- public boolean isNarrowing() {
+ public boolean isExplicit() {
return true;
}
Modified: trunk/common-core/src/main/java/com/metamatrix/common/types/basic/StringToBigIntegerTransform.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/types/basic/StringToBigIntegerTransform.java 2009-09-01 04:26:32 UTC (rev 1300)
+++ trunk/common-core/src/main/java/com/metamatrix/common/types/basic/StringToBigIntegerTransform.java 2009-09-01 17:58:00 UTC (rev 1301)
@@ -64,7 +64,7 @@
}
@Override
- public boolean isNarrowing() {
+ public boolean isExplicit() {
return true;
}
Modified: trunk/common-core/src/main/java/com/metamatrix/common/types/basic/StringToBooleanTransform.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/types/basic/StringToBooleanTransform.java 2009-09-01 04:26:32 UTC (rev 1300)
+++ trunk/common-core/src/main/java/com/metamatrix/common/types/basic/StringToBooleanTransform.java 2009-09-01 17:58:00 UTC (rev 1301)
@@ -70,7 +70,7 @@
}
@Override
- public boolean isNarrowing() {
+ public boolean isExplicit() {
return true;
}
Modified: trunk/common-core/src/main/java/com/metamatrix/common/types/basic/StringToByteTransform.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/types/basic/StringToByteTransform.java 2009-09-01 04:26:32 UTC (rev 1300)
+++ trunk/common-core/src/main/java/com/metamatrix/common/types/basic/StringToByteTransform.java 2009-09-01 17:58:00 UTC (rev 1301)
@@ -62,7 +62,7 @@
}
@Override
- public boolean isNarrowing() {
+ public boolean isExplicit() {
return true;
}
Modified: trunk/common-core/src/main/java/com/metamatrix/common/types/basic/StringToCharacterTransform.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/types/basic/StringToCharacterTransform.java 2009-09-01 04:26:32 UTC (rev 1300)
+++ trunk/common-core/src/main/java/com/metamatrix/common/types/basic/StringToCharacterTransform.java 2009-09-01 17:58:00 UTC (rev 1301)
@@ -62,7 +62,7 @@
}
@Override
- public boolean isNarrowing() {
+ public boolean isExplicit() {
return true;
}
Modified: trunk/common-core/src/main/java/com/metamatrix/common/types/basic/StringToDateTransform.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/types/basic/StringToDateTransform.java 2009-09-01 04:26:32 UTC (rev 1300)
+++ trunk/common-core/src/main/java/com/metamatrix/common/types/basic/StringToDateTransform.java 2009-09-01 17:58:00 UTC (rev 1301)
@@ -70,7 +70,7 @@
}
@Override
- public boolean isNarrowing() {
+ public boolean isExplicit() {
return true;
}
Modified: trunk/common-core/src/main/java/com/metamatrix/common/types/basic/StringToDoubleTransform.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/types/basic/StringToDoubleTransform.java 2009-09-01 04:26:32 UTC (rev 1300)
+++ trunk/common-core/src/main/java/com/metamatrix/common/types/basic/StringToDoubleTransform.java 2009-09-01 17:58:00 UTC (rev 1301)
@@ -62,7 +62,7 @@
}
@Override
- public boolean isNarrowing() {
+ public boolean isExplicit() {
return true;
}
Modified: trunk/common-core/src/main/java/com/metamatrix/common/types/basic/StringToFloatTransform.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/types/basic/StringToFloatTransform.java 2009-09-01 04:26:32 UTC (rev 1300)
+++ trunk/common-core/src/main/java/com/metamatrix/common/types/basic/StringToFloatTransform.java 2009-09-01 17:58:00 UTC (rev 1301)
@@ -62,7 +62,7 @@
}
@Override
- public boolean isNarrowing() {
+ public boolean isExplicit() {
return true;
}
Modified: trunk/common-core/src/main/java/com/metamatrix/common/types/basic/StringToIntegerTransform.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/types/basic/StringToIntegerTransform.java 2009-09-01 04:26:32 UTC (rev 1300)
+++ trunk/common-core/src/main/java/com/metamatrix/common/types/basic/StringToIntegerTransform.java 2009-09-01 17:58:00 UTC (rev 1301)
@@ -62,7 +62,7 @@
}
@Override
- public boolean isNarrowing() {
+ public boolean isExplicit() {
return true;
}
Modified: trunk/common-core/src/main/java/com/metamatrix/common/types/basic/StringToLongTransform.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/types/basic/StringToLongTransform.java 2009-09-01 04:26:32 UTC (rev 1300)
+++ trunk/common-core/src/main/java/com/metamatrix/common/types/basic/StringToLongTransform.java 2009-09-01 17:58:00 UTC (rev 1301)
@@ -62,7 +62,7 @@
}
@Override
- public boolean isNarrowing() {
+ public boolean isExplicit() {
return true;
}
Modified: trunk/common-core/src/main/java/com/metamatrix/common/types/basic/StringToSQLXMLTransform.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/types/basic/StringToSQLXMLTransform.java 2009-09-01 04:26:32 UTC (rev 1300)
+++ trunk/common-core/src/main/java/com/metamatrix/common/types/basic/StringToSQLXMLTransform.java 2009-09-01 17:58:00 UTC (rev 1301)
@@ -76,4 +76,9 @@
return XMLType.class;
}
+ @Override
+ public boolean isExplicit() {
+ return true;
+ }
+
}
Modified: trunk/common-core/src/main/java/com/metamatrix/common/types/basic/StringToShortTransform.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/types/basic/StringToShortTransform.java 2009-09-01 04:26:32 UTC (rev 1300)
+++ trunk/common-core/src/main/java/com/metamatrix/common/types/basic/StringToShortTransform.java 2009-09-01 17:58:00 UTC (rev 1301)
@@ -62,7 +62,7 @@
}
@Override
- public boolean isNarrowing() {
+ public boolean isExplicit() {
return true;
}
Modified: trunk/common-core/src/main/java/com/metamatrix/common/types/basic/StringToTimeTransform.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/types/basic/StringToTimeTransform.java 2009-09-01 04:26:32 UTC (rev 1300)
+++ trunk/common-core/src/main/java/com/metamatrix/common/types/basic/StringToTimeTransform.java 2009-09-01 17:58:00 UTC (rev 1301)
@@ -70,7 +70,7 @@
}
@Override
- public boolean isNarrowing() {
+ public boolean isExplicit() {
return true;
}
Modified: trunk/common-core/src/main/java/com/metamatrix/common/types/basic/StringToTimestampTransform.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/types/basic/StringToTimestampTransform.java 2009-09-01 04:26:32 UTC (rev 1300)
+++ trunk/common-core/src/main/java/com/metamatrix/common/types/basic/StringToTimestampTransform.java 2009-09-01 17:58:00 UTC (rev 1301)
@@ -71,7 +71,7 @@
}
@Override
- public boolean isNarrowing() {
+ public boolean isExplicit() {
return true;
}
Modified: trunk/common-core/src/main/java/com/metamatrix/common/types/basic/TimestampToDateTransform.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/types/basic/TimestampToDateTransform.java 2009-09-01 04:26:32 UTC (rev 1300)
+++ trunk/common-core/src/main/java/com/metamatrix/common/types/basic/TimestampToDateTransform.java 2009-09-01 17:58:00 UTC (rev 1301)
@@ -60,9 +60,9 @@
}
/**
- * @see com.metamatrix.common.types.Transform#isNarrowing()
+ * @see com.metamatrix.common.types.Transform#isExplicit()
*/
- public boolean isNarrowing() {
+ public boolean isExplicit() {
return true;
}
Modified: trunk/common-core/src/main/java/com/metamatrix/common/types/basic/TimestampToTimeTransform.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/types/basic/TimestampToTimeTransform.java 2009-09-01 04:26:32 UTC (rev 1300)
+++ trunk/common-core/src/main/java/com/metamatrix/common/types/basic/TimestampToTimeTransform.java 2009-09-01 17:58:00 UTC (rev 1301)
@@ -59,9 +59,9 @@
}
/**
- * @see com.metamatrix.common.types.Transform#isNarrowing()
+ * @see com.metamatrix.common.types.Transform#isExplicit()
*/
- public boolean isNarrowing() {
+ public boolean isExplicit() {
return true;
}
Modified: trunk/common-core/src/test/java/com/metamatrix/common/types/TestDataTypeManager.java
===================================================================
--- trunk/common-core/src/test/java/com/metamatrix/common/types/TestDataTypeManager.java 2009-09-01 04:26:32 UTC (rev 1300)
+++ trunk/common-core/src/test/java/com/metamatrix/common/types/TestDataTypeManager.java 2009-09-01 17:58:00 UTC (rev 1301)
@@ -70,7 +70,7 @@
/*bool*/ { 'I','N','O','I','I','I','I','I','I','I','I','N','N','N','I','N','N','N' },
/*byte*/ { 'I','N','C','O','I','I','I','I','I','I','I','N','N','N','I','N','N','N' },
/*short*/ { 'I','N','C','C','O','I','I','I','I','I','I','N','N','N','I','N','N','N' },
- /*int*/ { 'I','N','C','C','C','O','I','I','I','I','I','N','N','N','I','N','N','N' },
+ /*int*/ { 'I','N','C','C','C','O','I','I','C','I','I','N','N','N','I','N','N','N' },
/*long*/ { 'I','N','C','C','C','C','O','I','C','C','I','N','N','N','I','N','N','N' },
/*bigint*/ { 'I','N','C','C','C','C','C','O','C','C','I','N','N','N','I','N','N','N' },
/*float*/ { 'I','N','C','C','C','C','C','C','O','I','I','N','N','N','I','N','N','N' },
Modified: trunk/documentation/reference/src/main/docbook/en-US/content/datatypes.xml
===================================================================
--- trunk/documentation/reference/src/main/docbook/en-US/content/datatypes.xml 2009-09-01 04:26:32 UTC (rev 1300)
+++ trunk/documentation/reference/src/main/docbook/en-US/content/datatypes.xml 2009-09-01 17:58:00 UTC (rev 1301)
@@ -293,9 +293,9 @@
</row>
<row>
<entry>integer</entry>
- <entry>string, long, biginteger, float, double,
+ <entry>string, long, biginteger, double,
bigdecimal</entry>
- <entry>boolean, byte, short</entry>
+ <entry>boolean, byte, short, float</entry>
</row>
<row>
<entry>long</entry>
Modified: trunk/engine/src/main/java/com/metamatrix/query/rewriter/QueryRewriter.java
===================================================================
--- trunk/engine/src/main/java/com/metamatrix/query/rewriter/QueryRewriter.java 2009-09-01 04:26:32 UTC (rev 1300)
+++ trunk/engine/src/main/java/com/metamatrix/query/rewriter/QueryRewriter.java 2009-09-01 17:58:00 UTC (rev 1301)
@@ -54,7 +54,6 @@
import com.metamatrix.api.exception.query.QueryValidatorException;
import com.metamatrix.common.buffer.BlockedException;
import com.metamatrix.common.types.DataTypeManager;
-import com.metamatrix.common.types.Transform;
import com.metamatrix.common.util.TimestampWithTimezone;
import com.metamatrix.core.MetaMatrixRuntimeException;
import com.metamatrix.core.util.Assertion;
@@ -1482,10 +1481,7 @@
private Criteria simplifyConvertFunction(CompareCriteria crit) throws QueryValidatorException {
Function leftFunction = (Function) crit.getLeftExpression();
Expression leftExpr = leftFunction.getArgs()[0];
- if (leftExpr.getType() == crit.getRightExpression().getType()) {
- crit.setLeftExpression(leftExpr);
- return crit;
- }
+
if(!(crit.getRightExpression() instanceof Constant)
//TODO: this can be relaxed for order preserving operations
|| !(crit.getOperator() == CompareCriteria.EQ || crit.getOperator() == CompareCriteria.NE)) {
@@ -1507,9 +1503,7 @@
return getSimpliedCriteria(crit, leftExpr, crit.getOperator() != CompareCriteria.EQ, true);
}
- Transform transform = DataTypeManager.getTransform(leftExpr.getType(), crit.getRightExpression().getType());
-
- if (transform.isLossy()) {
+ if (!DataTypeManager.isImplicitConversion(leftExprTypeName, DataTypeManager.getDataTypeName(rightConstant.getType()))) {
return crit;
}
Modified: trunk/engine/src/test/java/com/metamatrix/query/function/TestFunctionLibrary.java
===================================================================
--- trunk/engine/src/test/java/com/metamatrix/query/function/TestFunctionLibrary.java 2009-09-01 04:26:32 UTC (rev 1300)
+++ trunk/engine/src/test/java/com/metamatrix/query/function/TestFunctionLibrary.java 2009-09-01 17:58:00 UTC (rev 1301)
@@ -368,14 +368,14 @@
"+", new Class[] { T_INTEGER, T_FLOAT }, //$NON-NLS-1$
new FunctionDescriptor[] {
helpCreateDescriptor(FunctionLibrary.CONVERT, new Class[] { T_INTEGER, T_STRING }),
- null } );
+ helpCreateDescriptor(FunctionLibrary.CONVERT, new Class[] { T_FLOAT, T_STRING }) } );
}
@Test public void testFind2ArgConversion3() {
helpFindConversions(
"+", new Class[] { T_FLOAT, T_INTEGER }, //$NON-NLS-1$
new FunctionDescriptor[] {
- null,
+ helpCreateDescriptor(FunctionLibrary.CONVERT, new Class[] { T_FLOAT, T_STRING }),
helpCreateDescriptor(FunctionLibrary.CONVERT, new Class[] { T_INTEGER, T_STRING }) } );
}
Modified: trunk/engine/src/test/java/com/metamatrix/query/processor/TestInsertProcessing.java
===================================================================
--- trunk/engine/src/test/java/com/metamatrix/query/processor/TestInsertProcessing.java 2009-09-01 04:26:32 UTC (rev 1300)
+++ trunk/engine/src/test/java/com/metamatrix/query/processor/TestInsertProcessing.java 2009-09-01 17:58:00 UTC (rev 1301)
@@ -49,7 +49,7 @@
dataManager.addData("BatchedUpdate{I}", //$NON-NLS-1$
new List[] { Arrays.asList(new Object[] { new Integer(1) })});
- String sql = "SELECT 1, 1, 1 INTO pm1.g1"; //$NON-NLS-1$
+ String sql = "SELECT 1, convert(1, float), convert(1, float) INTO pm1.g1"; //$NON-NLS-1$
Command command = helpParse(sql);
ProcessorPlan plan = helpGetPlan(command, metadata, capFinder);
@@ -173,7 +173,7 @@
dataManager.addData("INSERT INTO pm1.g1 (pm1.g1.e1, pm1.g1.e2) VALUES (?, ?)", //$NON-NLS-1$
new List[] { Arrays.asList(new Object[] { new Integer(1) })});
- String sql = "SELECT 1, 1 INTO pm1.g1"; //$NON-NLS-1$
+ String sql = "SELECT 1, convert(1, float) INTO pm1.g1"; //$NON-NLS-1$
Command command = helpParse(sql);
ProcessorPlan plan = helpGetPlan(command, metadata, capFinder);
@@ -213,7 +213,7 @@
dataManager.addData("INSERT INTO pm1.g1 (pm1.g1.e1, pm1.g1.e2) VALUES (1, 1.0)", //$NON-NLS-1$
new List[] { Arrays.asList(new Object[] { new Integer(1) })});
- String sql = "SELECT 1, 1 INTO pm1.g1"; //$NON-NLS-1$
+ String sql = "SELECT 1, convert(1, float) INTO pm1.g1"; //$NON-NLS-1$
Command command = helpParse(sql);
ProcessorPlan plan = helpGetPlan(command, metadata, capFinder);
15 years, 3 months
teiid SVN: r1300 - in trunk: common-core/src/main/java/com/metamatrix/common/types/basic and 2 other directories.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2009-09-01 00:26:32 -0400 (Tue, 01 Sep 2009)
New Revision: 1300
Modified:
trunk/common-core/src/main/java/com/metamatrix/common/types/DataTypeManager.java
trunk/common-core/src/main/java/com/metamatrix/common/types/Transform.java
trunk/common-core/src/main/java/com/metamatrix/common/types/basic/NumberToDoubleTransform.java
trunk/common-core/src/main/java/com/metamatrix/common/types/basic/NumberToFloatTransform.java
trunk/common-core/src/main/java/com/metamatrix/common/types/basic/NumberToIntegerTransform.java
trunk/common-core/src/main/java/com/metamatrix/common/types/basic/NumberToLongTransform.java
trunk/common-core/src/main/java/com/metamatrix/common/types/basic/NumberToShortTransform.java
trunk/engine/src/main/java/com/metamatrix/query/rewriter/QueryRewriter.java
trunk/engine/src/test/java/com/metamatrix/query/rewriter/TestQueryRewriter.java
Log:
TEIID-744 more accurately capturing non-invertable converts as lossy
Modified: trunk/common-core/src/main/java/com/metamatrix/common/types/DataTypeManager.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/types/DataTypeManager.java 2009-08-31 22:18:33 UTC (rev 1299)
+++ trunk/common-core/src/main/java/com/metamatrix/common/types/DataTypeManager.java 2009-09-01 04:26:32 UTC (rev 1300)
@@ -490,13 +490,13 @@
DataTypeManager.addTransform(new NumberToByteTransform(
DefaultDataClasses.BIG_DECIMAL));
DataTypeManager.addTransform(new NumberToDoubleTransform(
- DefaultDataClasses.BIG_DECIMAL, true));
+ DefaultDataClasses.BIG_DECIMAL, true, false));
DataTypeManager.addTransform(new NumberToFloatTransform(
- DefaultDataClasses.BIG_DECIMAL, true));
+ DefaultDataClasses.BIG_DECIMAL, true, false));
DataTypeManager.addTransform(new NumberToIntegerTransform(
DefaultDataClasses.BIG_DECIMAL, true));
DataTypeManager.addTransform(new NumberToLongTransform(
- DefaultDataClasses.BIG_DECIMAL, true));
+ DefaultDataClasses.BIG_DECIMAL, true, false));
DataTypeManager.addTransform(new NumberToShortTransform(
DefaultDataClasses.BIG_DECIMAL, true));
DataTypeManager.addTransform(new AnyToStringTransform(DefaultDataClasses.BIG_DECIMAL));
@@ -507,13 +507,13 @@
DataTypeManager.addTransform(new NumberToByteTransform(
DefaultDataClasses.BIG_INTEGER));
DataTypeManager.addTransform(new NumberToDoubleTransform(
- DefaultDataClasses.BIG_INTEGER, true));
+ DefaultDataClasses.BIG_INTEGER, true, false));
DataTypeManager.addTransform(new NumberToFloatTransform(
- DefaultDataClasses.BIG_INTEGER, true));
+ DefaultDataClasses.BIG_INTEGER, true, false));
DataTypeManager.addTransform(new NumberToIntegerTransform(
DefaultDataClasses.BIG_INTEGER, true));
DataTypeManager.addTransform(new NumberToLongTransform(
- DefaultDataClasses.BIG_INTEGER, true));
+ DefaultDataClasses.BIG_INTEGER, true, false));
DataTypeManager.addTransform(new NumberToShortTransform(
DefaultDataClasses.BIG_INTEGER, true));
DataTypeManager.addTransform(new AnyToStringTransform(DefaultDataClasses.BIG_INTEGER));
@@ -540,13 +540,13 @@
DataTypeManager.addTransform(new FixedNumberToBigIntegerTransform(DefaultDataClasses.BYTE));
DataTypeManager.addTransform(new NumberToBooleanTransform(Byte.valueOf((byte)0)));
DataTypeManager.addTransform(new NumberToDoubleTransform(
- DefaultDataClasses.BYTE, false));
+ DefaultDataClasses.BYTE, false, false));
DataTypeManager.addTransform(new NumberToFloatTransform(
- DefaultDataClasses.BYTE, false));
+ DefaultDataClasses.BYTE, false, false));
DataTypeManager.addTransform(new NumberToIntegerTransform(
DefaultDataClasses.BYTE, false));
DataTypeManager.addTransform(new NumberToLongTransform(
- DefaultDataClasses.BYTE, false));
+ DefaultDataClasses.BYTE, false, false));
DataTypeManager.addTransform(new NumberToShortTransform(
DefaultDataClasses.BYTE, false));
DataTypeManager.addTransform(new AnyToStringTransform(DefaultDataClasses.BYTE));
@@ -566,11 +566,11 @@
DataTypeManager.addTransform(new NumberToByteTransform(
DefaultDataClasses.DOUBLE));
DataTypeManager.addTransform(new NumberToFloatTransform(
- DefaultDataClasses.DOUBLE, true));
+ DefaultDataClasses.DOUBLE, true, false));
DataTypeManager.addTransform(new NumberToIntegerTransform(
DefaultDataClasses.DOUBLE, true));
DataTypeManager.addTransform(new NumberToLongTransform(
- DefaultDataClasses.DOUBLE, false)); //lossy, but not narrowing
+ DefaultDataClasses.DOUBLE, false, true)); //lossy, but not narrowing
DataTypeManager.addTransform(new NumberToShortTransform(
DefaultDataClasses.DOUBLE, true));
DataTypeManager.addTransform(new AnyToStringTransform(DefaultDataClasses.DOUBLE));
@@ -581,11 +581,11 @@
DataTypeManager.addTransform(new NumberToByteTransform(
DefaultDataClasses.FLOAT));
DataTypeManager.addTransform(new NumberToDoubleTransform(
- DefaultDataClasses.FLOAT, false));
+ DefaultDataClasses.FLOAT, false, false));
DataTypeManager.addTransform(new NumberToIntegerTransform(
DefaultDataClasses.FLOAT, true));
DataTypeManager.addTransform(new NumberToLongTransform(
- DefaultDataClasses.FLOAT, false)); //lossy, but not narrowing
+ DefaultDataClasses.FLOAT, false, true)); //lossy, but not narrowing
DataTypeManager.addTransform(new NumberToShortTransform(
DefaultDataClasses.FLOAT, true));
DataTypeManager.addTransform(new AnyToStringTransform(DefaultDataClasses.FLOAT));
@@ -596,11 +596,11 @@
DataTypeManager.addTransform(new NumberToByteTransform(
DefaultDataClasses.INTEGER));
DataTypeManager.addTransform(new NumberToDoubleTransform(
- DefaultDataClasses.INTEGER, false));
+ DefaultDataClasses.INTEGER, false, false));
DataTypeManager.addTransform(new NumberToFloatTransform(
- DefaultDataClasses.INTEGER, false)); //lossy, but not narrowing
+ DefaultDataClasses.INTEGER, false, true)); //lossy, but not narrowing
DataTypeManager.addTransform(new NumberToLongTransform(
- DefaultDataClasses.INTEGER, false));
+ DefaultDataClasses.INTEGER, false, false));
DataTypeManager.addTransform(new NumberToShortTransform(
DefaultDataClasses.INTEGER, true));
DataTypeManager.addTransform(new AnyToStringTransform(DefaultDataClasses.INTEGER));
@@ -611,9 +611,9 @@
DataTypeManager.addTransform(new NumberToByteTransform(
DefaultDataClasses.LONG));
DataTypeManager.addTransform(new NumberToDoubleTransform(
- DefaultDataClasses.LONG, false)); //lossy, but not narrowing
+ DefaultDataClasses.LONG, false, true)); //lossy, but not narrowing
DataTypeManager.addTransform(new NumberToFloatTransform(
- DefaultDataClasses.LONG, false)); //lossy, but not narrowing
+ DefaultDataClasses.LONG, false, true)); //lossy, but not narrowing
DataTypeManager.addTransform(new NumberToIntegerTransform(
DefaultDataClasses.LONG, true));
DataTypeManager.addTransform(new NumberToShortTransform(
@@ -626,13 +626,13 @@
DataTypeManager.addTransform(new NumberToByteTransform(
DefaultDataClasses.SHORT));
DataTypeManager.addTransform(new NumberToDoubleTransform(
- DefaultDataClasses.SHORT, false));
+ DefaultDataClasses.SHORT, false, false));
DataTypeManager.addTransform(new NumberToFloatTransform(
- DefaultDataClasses.SHORT, false));
+ DefaultDataClasses.SHORT, false, false));
DataTypeManager.addTransform(new NumberToIntegerTransform(
DefaultDataClasses.SHORT, false));
DataTypeManager.addTransform(new NumberToLongTransform(
- DefaultDataClasses.SHORT, false));
+ DefaultDataClasses.SHORT, false, false));
DataTypeManager.addTransform(new AnyToStringTransform(DefaultDataClasses.SHORT));
DataTypeManager
Modified: trunk/common-core/src/main/java/com/metamatrix/common/types/Transform.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/types/Transform.java 2009-08-31 22:18:33 UTC (rev 1299)
+++ trunk/common-core/src/main/java/com/metamatrix/common/types/Transform.java 2009-09-01 04:26:32 UTC (rev 1300)
@@ -105,6 +105,10 @@
public boolean isNarrowing() {
return false;
}
+
+ public boolean isLossy() {
+ return isNarrowing();
+ }
/**
* Override Object.toString() to do getDisplayName() version.
Modified: trunk/common-core/src/main/java/com/metamatrix/common/types/basic/NumberToDoubleTransform.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/types/basic/NumberToDoubleTransform.java 2009-08-31 22:18:33 UTC (rev 1299)
+++ trunk/common-core/src/main/java/com/metamatrix/common/types/basic/NumberToDoubleTransform.java 2009-09-01 04:26:32 UTC (rev 1300)
@@ -30,10 +30,12 @@
private Class<?> sourceType;
private boolean isNarrowing;
+ private boolean isLossy;
- public NumberToDoubleTransform(Class<?> sourceType, boolean isNarrowing) {
+ public NumberToDoubleTransform(Class<?> sourceType, boolean isNarrowing, boolean isLossy) {
this.sourceType = sourceType;
this.isNarrowing = isNarrowing;
+ this.isLossy = isLossy;
}
@Override
@@ -64,4 +66,14 @@
return DataTypeManager.DefaultDataClasses.DOUBLE;
}
+ @Override
+ public boolean isNarrowing() {
+ return isNarrowing;
+ }
+
+ @Override
+ public boolean isLossy() {
+ return isLossy;
+ }
+
}
Modified: trunk/common-core/src/main/java/com/metamatrix/common/types/basic/NumberToFloatTransform.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/types/basic/NumberToFloatTransform.java 2009-08-31 22:18:33 UTC (rev 1299)
+++ trunk/common-core/src/main/java/com/metamatrix/common/types/basic/NumberToFloatTransform.java 2009-09-01 04:26:32 UTC (rev 1300)
@@ -30,10 +30,12 @@
private Class<?> sourceType;
private boolean isNarrowing;
+ private boolean isLossy;
- public NumberToFloatTransform(Class<?> sourceType, boolean isNarrowing) {
+ public NumberToFloatTransform(Class<?> sourceType, boolean isNarrowing, boolean isLossy) {
this.sourceType = sourceType;
this.isNarrowing = isNarrowing;
+ this.isLossy = isLossy;
}
@Override
@@ -64,4 +66,14 @@
return DataTypeManager.DefaultDataClasses.FLOAT;
}
+ @Override
+ public boolean isNarrowing() {
+ return isNarrowing;
+ }
+
+ @Override
+ public boolean isLossy() {
+ return isLossy;
+ }
+
}
Modified: trunk/common-core/src/main/java/com/metamatrix/common/types/basic/NumberToIntegerTransform.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/types/basic/NumberToIntegerTransform.java 2009-08-31 22:18:33 UTC (rev 1299)
+++ trunk/common-core/src/main/java/com/metamatrix/common/types/basic/NumberToIntegerTransform.java 2009-09-01 04:26:32 UTC (rev 1300)
@@ -64,4 +64,9 @@
return DataTypeManager.DefaultDataClasses.INTEGER;
}
+ @Override
+ public boolean isNarrowing() {
+ return isNarrowing;
+ }
+
}
Modified: trunk/common-core/src/main/java/com/metamatrix/common/types/basic/NumberToLongTransform.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/types/basic/NumberToLongTransform.java 2009-08-31 22:18:33 UTC (rev 1299)
+++ trunk/common-core/src/main/java/com/metamatrix/common/types/basic/NumberToLongTransform.java 2009-09-01 04:26:32 UTC (rev 1300)
@@ -30,10 +30,12 @@
private Class<?> sourceType;
private boolean isNarrowing;
+ private boolean isLossy;
- public NumberToLongTransform(Class<?> sourceType, boolean isNarrowing) {
+ public NumberToLongTransform(Class<?> sourceType, boolean isNarrowing, boolean isLossy) {
this.sourceType = sourceType;
this.isNarrowing = isNarrowing;
+ this.isLossy = isLossy;
}
@Override
@@ -64,4 +66,14 @@
return DataTypeManager.DefaultDataClasses.LONG;
}
+ @Override
+ public boolean isNarrowing() {
+ return isNarrowing;
+ }
+
+ @Override
+ public boolean isLossy() {
+ return isLossy;
+ }
+
}
Modified: trunk/common-core/src/main/java/com/metamatrix/common/types/basic/NumberToShortTransform.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/types/basic/NumberToShortTransform.java 2009-08-31 22:18:33 UTC (rev 1299)
+++ trunk/common-core/src/main/java/com/metamatrix/common/types/basic/NumberToShortTransform.java 2009-09-01 04:26:32 UTC (rev 1300)
@@ -64,4 +64,9 @@
return DataTypeManager.DefaultDataClasses.SHORT;
}
+ @Override
+ public boolean isNarrowing() {
+ return isNarrowing;
+ }
+
}
Modified: trunk/engine/src/main/java/com/metamatrix/query/rewriter/QueryRewriter.java
===================================================================
--- trunk/engine/src/main/java/com/metamatrix/query/rewriter/QueryRewriter.java 2009-08-31 22:18:33 UTC (rev 1299)
+++ trunk/engine/src/main/java/com/metamatrix/query/rewriter/QueryRewriter.java 2009-09-01 04:26:32 UTC (rev 1300)
@@ -1509,7 +1509,7 @@
Transform transform = DataTypeManager.getTransform(leftExpr.getType(), crit.getRightExpression().getType());
- if (transform.isNarrowing()) {
+ if (transform.isLossy()) {
return crit;
}
@@ -1567,6 +1567,10 @@
Constant result = null;
try {
result = ResolverUtil.convertConstant(DataTypeManager.getDataTypeName(rightConstant.getType()), leftExprTypeName, rightConstant);
+ Constant other = ResolverUtil.convertConstant(leftExprTypeName, DataTypeManager.getDataTypeName(rightConstant.getType()), result);
+ if (((Comparable)rightConstant.getValue()).compareTo(other.getValue()) != 0) {
+ result = null;
+ }
} catch(QueryResolverException e) {
}
Modified: trunk/engine/src/test/java/com/metamatrix/query/rewriter/TestQueryRewriter.java
===================================================================
--- trunk/engine/src/test/java/com/metamatrix/query/rewriter/TestQueryRewriter.java 2009-08-31 22:18:33 UTC (rev 1299)
+++ trunk/engine/src/test/java/com/metamatrix/query/rewriter/TestQueryRewriter.java 2009-09-01 04:26:32 UTC (rev 1300)
@@ -1008,7 +1008,7 @@
String rewritProc = "CREATE PROCEDURE\n"; //$NON-NLS-1$
rewritProc = rewritProc + "BEGIN\n"; //$NON-NLS-1$
- rewritProc = rewritProc + "SELECT e2 FROM pm1.g1 WHERE sqrt(pm1.g1.e2) = 10.0;\n"; //$NON-NLS-1$
+ rewritProc = rewritProc + "SELECT e2 FROM pm1.g1 WHERE convert(sqrt(pm1.g1.e2), integer) = 10;\n"; //$NON-NLS-1$
rewritProc = rewritProc + "END"; //$NON-NLS-1$
String procReturned = this.getReWrittenProcedure(procedure, userQuery,
@@ -1613,7 +1613,7 @@
}
@Test public void testRewriteCase1954e() {
- helpTestRewriteCriteria("convert(pm1.g1.e4, integer) = 2", "pm1.g1.e4 = 2.0"); //$NON-NLS-1$ //$NON-NLS-2$
+ helpTestRewriteCriteria("convert(pm1.g1.e4, integer) = 2", "convert(pm1.g1.e4, integer) = 2"); //$NON-NLS-1$ //$NON-NLS-2$
}
/** Check that this fails, x is not convertable to an int */
15 years, 3 months