teiid SVN: r1518 - in trunk: runtime/src/main/java/com/metamatrix/platform/security/session/service and 1 other directories.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2009-10-01 20:36:59 -0400 (Thu, 01 Oct 2009)
New Revision: 1518
Modified:
trunk/engine/src/main/java/com/metamatrix/platform/security/api/service/SessionServiceInterface.java
trunk/runtime/src/main/java/com/metamatrix/platform/security/session/service/SessionServiceImpl.java
trunk/runtime/src/main/java/org/teiid/transport/LocalServerConnection.java
Log:
TEIID-867 local clients now by-pass ping altogether
Modified: trunk/engine/src/main/java/com/metamatrix/platform/security/api/service/SessionServiceInterface.java
===================================================================
--- trunk/engine/src/main/java/com/metamatrix/platform/security/api/service/SessionServiceInterface.java 2009-10-01 21:23:46 UTC (rev 1517)
+++ trunk/engine/src/main/java/com/metamatrix/platform/security/api/service/SessionServiceInterface.java 2009-10-02 00:36:59 UTC (rev 1518)
@@ -156,4 +156,6 @@
*/
public void register(SessionListener listener);
+ public void setLocalSession(MetaMatrixSessionID sessionID);
+
}
Modified: trunk/runtime/src/main/java/com/metamatrix/platform/security/session/service/SessionServiceImpl.java
===================================================================
--- trunk/runtime/src/main/java/com/metamatrix/platform/security/session/service/SessionServiceImpl.java 2009-10-01 21:23:46 UTC (rev 1517)
+++ trunk/runtime/src/main/java/com/metamatrix/platform/security/session/service/SessionServiceImpl.java 2009-10-02 00:36:59 UTC (rev 1518)
@@ -345,4 +345,12 @@
this.sessionListener = listener;
}
+ @Override
+ public void setLocalSession(MetaMatrixSessionID sessionID) {
+ MetaMatrixSessionInfo info = this.sessionCache.get(sessionID);
+ if (info != null) {
+ info.setLastPingTime(Long.MAX_VALUE);
+ }
+ }
+
}
Modified: trunk/runtime/src/main/java/org/teiid/transport/LocalServerConnection.java
===================================================================
--- trunk/runtime/src/main/java/org/teiid/transport/LocalServerConnection.java 2009-10-01 21:23:46 UTC (rev 1517)
+++ trunk/runtime/src/main/java/org/teiid/transport/LocalServerConnection.java 2009-10-02 00:36:59 UTC (rev 1518)
@@ -27,8 +27,6 @@
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;
import java.util.Properties;
-import java.util.Timer;
-import java.util.TimerTask;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
@@ -56,57 +54,25 @@
private boolean shutdown;
private DQPWorkContext workContext;
private ClassLoader classLoader;
- ClientServiceRegistry clientServices;
- SessionServiceInterface sessionService;
- private Timer pingTimer;
+ private ClientServiceRegistry clientServices;
+ private SessionServiceInterface sessionService;
private ILogon logon;
-
-
public LocalServerConnection(Properties connectionProperties, ClientServiceRegistry clientServices, SessionServiceInterface sessionService) throws CommunicationException, ConnectionException{
-
this.clientServices = clientServices;
-
+ this.sessionService = sessionService;
//Initialize the workContext
workContext = new DQPWorkContext();
DQPWorkContext.setWorkContext(workContext);
-
- this.result = authenticate(connectionProperties);
-
this.classLoader = Thread.currentThread().getContextClassLoader();
-
- this.sessionService = sessionService;
-
this.logon = this.getService(ILogon.class);
- this.pingTimer = new Timer("LocalPing", true); //$NON-NLS-1$
-
- schedulePing();
+ this.result = authenticate(connectionProperties);
}
- private void schedulePing() {
- if (this.pingTimer != null) {
- this.pingTimer.schedule(new TimerTask() {
- @Override
- public void run() {
- try {
- if (isOpen()) {
- logon.ping();
- return;
- }
- } catch (InvalidSessionException e) {
- shutdown(false);
- } catch (MetaMatrixComponentException e) {
- shutdown();
- }
- this.cancel();
- }
- }, PING_INTERVAL, PING_INTERVAL);
- }
- }
-
public synchronized LogonResult authenticate(Properties connProps) throws ConnectionException, CommunicationException {
try {
LogonResult logonResult = this.logon.logon(connProps);
+ this.sessionService.setLocalSession(logonResult.getSessionID());
return logonResult;
} catch (LogonException e) {
// Propagate the original message as it contains the message we want
16 years, 3 months
teiid SVN: r1517 - trunk/test-integration/db.
by teiid-commits@lists.jboss.org
Author: vhalbert(a)redhat.com
Date: 2009-10-01 17:23:46 -0400 (Thu, 01 Oct 2009)
New Revision: 1517
Modified:
trunk/test-integration/db/pom.xml
Log:
Teiid 773 - cleanup
Modified: trunk/test-integration/db/pom.xml
===================================================================
--- trunk/test-integration/db/pom.xml 2009-10-01 20:57:01 UTC (rev 1516)
+++ trunk/test-integration/db/pom.xml 2009-10-01 21:23:46 UTC (rev 1517)
@@ -13,6 +13,17 @@
<groupId>org.jboss.teiid.teiid-test-integration</groupId>
<description>Integration tests that require external database dependencies </description>
+ <repositories>
+ <repository>
+ <id>jboss</id>
+ <url>http://repository.jboss.com/maven2/</url>
+ </repository>
+ <repository>
+ <id>jboss-snapshot</id>
+ <url>http://snapshots.jboss.org/maven2</url>
+ </repository>
+ </repositories>
+
<dependencies>
<dependency>
<groupId>org.apache.ant</groupId>
16 years, 3 months
teiid SVN: r1516 - trunk/test-integration/db.
by teiid-commits@lists.jboss.org
Author: vhalbert(a)redhat.com
Date: 2009-10-01 16:57:01 -0400 (Thu, 01 Oct 2009)
New Revision: 1516
Modified:
trunk/test-integration/db/howto
trunk/test-integration/db/pom.xml
Log:
Teiid 773 - changes to support running one test class at a time
Modified: trunk/test-integration/db/howto
===================================================================
--- trunk/test-integration/db/howto 2009-10-01 20:20:05 UTC (rev 1515)
+++ trunk/test-integration/db/howto 2009-10-01 20:57:01 UTC (rev 1516)
@@ -10,10 +10,7 @@
==========================================
- Unit test should be created under db/src/test/java
-- See SingleSourceTransactionTest.java as an example
-
- NOTE: the current tests are currently organized by the number of datasources they require in order
- to give some organization to the test for tracking purposes.
+- See LocalTransactionDriverFalseOffTest.java as an example
- Test should extend org.teiid.transaction.test.BaseAbstractTransactionTestCase
@@ -22,12 +19,32 @@
- when calling: this.getSource("modelname") --- the "modelname" represents the model for which
you want the connection for
- INFO: to know which source this model is mapped to, find the config properties file being
- loaded for this test (default is the default-config.properties) and look for
- the model-to-datasource mapping(s)
-
- The default Transaction.vdb has 2 models: pm1 and pm2
+
+ By default, the datasource assigned to a model will be (somewhat) random. There is not coding to
+ specifically control this assignment, as long as the -Dusedatasources option is not used.
+
+ If the -Dusedatasources option is used, then there is an implied model-to-datasource assignment.
+ To understand how this assignment will be made, find the config properties file being
+ loaded for this test (default is the default-config.properties) and look for
+ the model-to-order mapping(s)
+
+ The default Transaction.vdb has 2 models: pm1 and pm2
+
+ example: pm1:1
+ pm2:2
+
+ Therefore, the model-to-order mapping will map to the relative order specified in the usedatasources property.
+
+ example: -Dusedatasources=oracle,postgres
+
+ This will result in model pm1 --> oracle
+ pm2 --> postgres
+ To EXCLUDE a test from using a specific database type, call addProperty(ConfigPropertyNames.EXCLUDE_DATASBASE_TYPES_PROP, "postgres");
+ during setup()
+
+ NOTE: The EXCLUDE option excludes based on db.type, where "usedatasources" specifies the actual datasource (not by type)
+
==========================================
Setting up a Datasource to be used during Testing
@@ -61,6 +78,10 @@
run: mvn clean install -Dusedatasources=<comma seperated datasource names>
Example: mvn clean install -Dusedatasources=oracle,sqlserver
+
+ c. To run a single class of tests, run the "singleclass" profile
+ run: mvn clean install -Psingleclass -Dclassname=<classname> ====> don't add .java to classname
+
Modified: trunk/test-integration/db/pom.xml
===================================================================
--- trunk/test-integration/db/pom.xml 2009-10-01 20:20:05 UTC (rev 1515)
+++ trunk/test-integration/db/pom.xml 2009-10-01 20:57:01 UTC (rev 1516)
@@ -99,6 +99,7 @@
<additionalClasspathElement>${basedir}/lib/classes12_g.jar</additionalClasspathElement>
<additionalClasspathElement>${basedir}/lib/sqljdbc4.jar</additionalClasspathElement>
<additionalClasspathElement>${basedir}/lib/db2jcc4.jar</additionalClasspathElement>
+ <additionalClasspathElement>${basedir}/lib/jbedsp-datadirect.jar</additionalClasspathElement>
</additionalClasspathElements>
<systemProperties>
@@ -123,7 +124,7 @@
<exclude>**/*Abstract*TestCase.java</exclude>
<exclude>**/*Abstract*Test.java</exclude>
<!-- hack to prevent anonymous inner classes in Tests from being run as tests -->
- <include>**/Test*$*.java</include>
+ <exclude>**/Test*$*.java</exclude>
</excludes>
</configuration>
@@ -134,6 +135,64 @@
</profile>
<profile>
+ <id>singleclass</id>
+ <activation>
+ <property>
+ <name>classname</name>
+ </property>
+ </activation>
+ <build>
+ <plugins>
+ <!-- Specify the compiler options and settings -->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <source>1.6</source>
+ <target>1.6</target>
+ <showDeprecation>false</showDeprecation>
+ <showWarnings>false</showWarnings>
+ </configuration>
+ </plugin>
+ <plugin>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <additionalClasspathElements>
+ <additionalClasspathElement>${basedir}/lib/classes12_g.jar</additionalClasspathElement>
+ <additionalClasspathElement>${basedir}/lib/sqljdbc4.jar</additionalClasspathElement>
+ <additionalClasspathElement>${basedir}/lib/db2jcc4.jar</additionalClasspathElement>
+ <additionalClasspathElement>${basedir}/lib/jbedsp-datadirect.jar</additionalClasspathElement>
+ </additionalClasspathElements>
+ <systemProperties>
+ <property>
+ <name>usedatasources</name>
+ <value>${usedatasources}</value>
+ </property>
+ </systemProperties>
+
+
+ <forkMode>always</forkMode>
+<!--
+ <forkedProcessTimeoutInSeconds>600</forkedProcessTimeoutInSeconds>
+ -->
+ <includes>
+ <include>**/${classname}.java</include>
+ </includes>
+ <excludes>
+ <exclude>**/*Abstract*TestCase.java</exclude>
+ <exclude>**/*Abstract*Test.java</exclude>
+ <!-- hack to prevent anonymous inner classes in Tests from being run as tests -->
+ <exclude>**/Test*$*.java</exclude>
+ </excludes>
+ </configuration>
+ </plugin>
+
+ </plugins>
+ </build>
+ </profile>
+
+
+ <profile>
<id>setupdatasources</id>
<build>
<plugins>
16 years, 3 months
teiid SVN: r1515 - in trunk/test-integration/db/src/main/java/org/teiid/test/framework: connection and 1 other directories.
by teiid-commits@lists.jboss.org
Author: vhalbert(a)redhat.com
Date: 2009-10-01 16:20:05 -0400 (Thu, 01 Oct 2009)
New Revision: 1515
Modified:
trunk/test-integration/db/src/main/java/org/teiid/test/framework/TransactionContainer.java
trunk/test-integration/db/src/main/java/org/teiid/test/framework/TransactionQueryTest.java
trunk/test-integration/db/src/main/java/org/teiid/test/framework/connection/ConnectionStrategyFactory.java
trunk/test-integration/db/src/main/java/org/teiid/test/framework/datasource/DataSourceFactory.java
Log:
Teiid 773 - added back the logic to bypass a test if the required number of datasources are not available (logic was removed when the last refactoring was done)
Modified: trunk/test-integration/db/src/main/java/org/teiid/test/framework/TransactionContainer.java
===================================================================
--- trunk/test-integration/db/src/main/java/org/teiid/test/framework/TransactionContainer.java 2009-10-01 19:09:43 UTC (rev 1514)
+++ trunk/test-integration/db/src/main/java/org/teiid/test/framework/TransactionContainer.java 2009-10-01 20:20:05 UTC (rev 1515)
@@ -6,8 +6,6 @@
import java.util.Properties;
-import net.sf.saxon.functions.Substring;
-
import org.teiid.test.framework.connection.ConnectionStrategy;
import org.teiid.test.framework.connection.ConnectionStrategyFactory;
import org.teiid.test.framework.datasource.DataSourceFactory;
@@ -39,11 +37,7 @@
this.props = new Properties();
this.props.putAll(this.connStrategy.getEnvironment());
- test.setConnectionStrategy(connStrategy);
-
- test.setupDataSource();
-
-
+
}
protected void before(TransactionQueryTest test){}
@@ -79,12 +73,22 @@
}
private void runIt(TransactionQueryTest test) {
-
+
detail("Start transaction test: " + test.getTestName());
-
+
try {
setUp(test);
+
+ if (test.getNumberRequiredDataSources() > this.dsfactory.getNumberAvailableDataSources()) {
+ detail(test.getTestName() + " will not be run, it requires " + test.getNumberRequiredDataSources() +
+ " datasources, but only available is " + this.dsfactory.getNumberAvailableDataSources());
+ return;
+ }
+
+ test.setConnectionStrategy(connStrategy);
+ test.setupDataSource();
+
debug(" setConnection");
test.setConnection(this.connStrategy.getConnection());
Modified: trunk/test-integration/db/src/main/java/org/teiid/test/framework/TransactionQueryTest.java
===================================================================
--- trunk/test-integration/db/src/main/java/org/teiid/test/framework/TransactionQueryTest.java 2009-10-01 19:09:43 UTC (rev 1514)
+++ trunk/test-integration/db/src/main/java/org/teiid/test/framework/TransactionQueryTest.java 2009-10-01 20:20:05 UTC (rev 1515)
@@ -1,13 +1,11 @@
package org.teiid.test.framework;
import java.sql.Connection;
-import java.util.Map;
import java.util.Properties;
import javax.sql.XAConnection;
import org.teiid.test.framework.connection.ConnectionStrategy;
-import org.teiid.test.framework.datasource.DataSource;
import org.teiid.test.framework.exception.QueryTestFailedException;
/**
Modified: trunk/test-integration/db/src/main/java/org/teiid/test/framework/connection/ConnectionStrategyFactory.java
===================================================================
--- trunk/test-integration/db/src/main/java/org/teiid/test/framework/connection/ConnectionStrategyFactory.java 2009-10-01 19:09:43 UTC (rev 1514)
+++ trunk/test-integration/db/src/main/java/org/teiid/test/framework/connection/ConnectionStrategyFactory.java 2009-10-01 20:20:05 UTC (rev 1515)
@@ -52,5 +52,15 @@
strategy.configure();
return strategy;
- }
+ }
+
+ public static void main(String[] args) {
+ //NOTE: to run this test to validate the DataSourceMgr, do the following:
+ // --- need 3 datasources, Oracle, SqlServer and 1 other
+
+ ConfigPropertyLoader config = ConfigPropertyLoader.createInstance();
+
+ DataSourceFactory factory = new DataSourceFactory(config);
+
+ }
}
Modified: trunk/test-integration/db/src/main/java/org/teiid/test/framework/datasource/DataSourceFactory.java
===================================================================
--- trunk/test-integration/db/src/main/java/org/teiid/test/framework/datasource/DataSourceFactory.java 2009-10-01 19:09:43 UTC (rev 1514)
+++ trunk/test-integration/db/src/main/java/org/teiid/test/framework/datasource/DataSourceFactory.java 2009-10-01 20:20:05 UTC (rev 1515)
@@ -47,14 +47,10 @@
private static final String DO_NOT_USE_DEFAULT="${usedatasources}";
private ConfigPropertyLoader configprops;
- // contains the names of the datasources when the -Dusedatasources option is
- // used
+ // contains the names of the datasources when the -Dusedatasources option is used
private Map<String, String> useDS = null;
- private Set<String> excludedDBTypes = null;
-
- private Set<String> unmappedds = new HashSet<String>();
- private Map<String, DataSource> allDatasourcesMap = null;
+ private Map<String, DataSource> useDataSources = null;
// map of the datasources assigned to with model
private Map<String, DataSource> modelToDatasourceMap = new HashMap<String, DataSource>(); // key
@@ -81,13 +77,19 @@
* inclusions are considered for the next executed set of test.
*
*
+ * 1st, check for the usedatasource property, if exist, then only add those specific datasources
+ * to the useDataSources, otherwise add all available.
+ * 2nd, if the exclude option is used, then remove any excluded datasources from the useDataSources.
+ *
* @since
*/
private void config() {
System.out.println("Configure Datasource Factory ");
- this.allDatasourcesMap = DataSourceMgr.getInstance().getDataSources();
-
+ Map<String, DataSource> availDatasources = DataSourceMgr.getInstance().getDataSources();
+
+ useDataSources = new HashMap<String, DataSource>(availDatasources.size());
+
String limitdsprop = configprops
.getProperty(ConfigPropertyNames.USE_DATASOURCES_PROP);
if (limitdsprop != null && limitdsprop.length() > 0 && ! limitdsprop.equalsIgnoreCase(DO_NOT_USE_DEFAULT)) {
@@ -96,23 +98,51 @@
List<String> dss = StringUtil.split(limitdsprop, ",");
useDS = new HashMap<String, String>(dss.size());
+ DataSource ds = null;
int i = 1;
for (Iterator<String> it = dss.iterator(); it.hasNext(); i++) {
- useDS.put(String.valueOf(i), it.next());
+ String dssName = it.next();
+ useDS.put(String.valueOf(i), dssName);
+ ds = availDatasources.get(dssName);
+
+ useDataSources.put(dssName, ds);
+
}
+ } else {
+ useDataSources.putAll(availDatasources);
}
String excludeprop = configprops
.getProperty(ConfigPropertyNames.EXCLUDE_DATASBASE_TYPES_PROP);
+
+ Set<String> excludedDBTypes = null;
if (excludeprop != null && excludeprop.length() > 0) {
List<String> eprops = StringUtil.split(excludeprop, ",");
excludedDBTypes = new HashSet<String>(eprops.size());
excludedDBTypes.addAll(eprops);
System.out.println("EXCLUDE datasources: " + excludeprop);
+
+ Iterator<DataSource> it = useDataSources.values().iterator();
+
+ // go thru all the datasources and remove those that are excluded
+ while (it.hasNext()) {
+ DataSource checkit = it.next();
+
+ if (excludedDBTypes.contains(checkit.getDBType())) {
+ it.remove();
+ }
+ }
+
}
+
+
}
+
+ public int getNumberAvailableDataSources() {
+ return this.useDataSources.size();
+ }
public synchronized DataSource getDatasource(String datasourceid,
String modelName) throws QueryTestFailedException {
@@ -138,7 +168,7 @@
if (useDS != null) {
String dsname = useDS.get(datasourceid);
if (dsname != null) {
- ds = allDatasourcesMap.get(dsname);
+ ds = useDataSources.get(dsname);
if (ds == null) {
throw new QueryTestFailedException("Datasource name "
+ dsname
@@ -158,7 +188,7 @@
}
- Iterator<DataSource> it = allDatasourcesMap.values().iterator();
+ Iterator<DataSource> it = useDataSources.values().iterator();
// need to go thru all the datasources to know if any has already been
// assigned
@@ -166,10 +196,10 @@
while (it.hasNext()) {
DataSource checkit = it.next();
- if (excludedDBTypes != null
- && excludedDBTypes.contains(checkit.getDBType())) {
- continue;
- }
+// if (excludedDBTypes != null
+// && excludedDBTypes.contains(checkit.getDBType())) {
+// continue;
+// }
if (!assignedDataSources.contains(checkit.getName())) {
ds = checkit;
@@ -193,7 +223,7 @@
if (cnt == this.lastassigned) {
- ds = allDatasourcesMap.get(dsname);
+ ds = useDataSources.get(dsname);
this.lastassigned++;
if (lastassigned >= assignedDataSources.size()) {
@@ -221,11 +251,9 @@
public void cleanup() {
modelToDatasourceMap.clear();
- unmappedds.clear();
assignedDataSources.clear();
useDS = null;
- excludedDBTypes = null;
}
@@ -251,9 +279,9 @@
// the following verifies that order of "use" datasources is applied to request for datasources.
- System.setProperty(ConfigPropertyNames.USE_DATASOURCES_PROP, "oracle,sqlserver");
+ config = ConfigPropertyLoader.createInstance();
- config = ConfigPropertyLoader.createInstance();
+ config.setProperty(ConfigPropertyNames.USE_DATASOURCES_PROP, "oracle,sqlserver");
factory = new DataSourceFactory(config);
@@ -289,31 +317,30 @@
// the following test verifies that a sqlserver datasource is not
// returned (excluded)
factory.cleanup();
-
-
-
- System.setProperty(ConfigPropertyNames.EXCLUDE_DATASBASE_TYPES_PROP, "sqlserver");
-
+
+
config = ConfigPropertyLoader.createInstance();
-
+ config.setProperty(ConfigPropertyNames.EXCLUDE_DATASBASE_TYPES_PROP, "sqlserver");
+
factory = new DataSourceFactory(config);
+ int n = factory.getNumberAvailableDataSources();
+ System.out.println("Num avail datasources: " + n);
+
+ for (int i=0; i<n; i++) {
- DataSource ds1 = factory.getDatasource("1", "model1");
+ String k = String.valueOf(i);
+ DataSource ds1 = factory.getDatasource(k, "model" + k);
if (ds1 == null) {
- throw new RuntimeException("No 1st datasource was found");
+ throw new RuntimeException("No datasource was found for: model:" + k);
}
+ }
- DataSource ds2 = factory.getDatasource("2", "model1");
- if (ds2 == null) {
- throw new RuntimeException("No 2nd datasource was found");
-
- }
- DataSource reuse = factory.getDatasource("3", "model1");
- if (reuse == ds1 || reuse == ds2) {
+ DataSource reuse = factory.getDatasource(String.valueOf(n + 1), "model1");
+ if (reuse != null) {
} else {
throw new RuntimeException("The process was not able to reassign an already used datasource");
16 years, 3 months
teiid SVN: r1514 - trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/h2.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2009-10-01 15:09:43 -0400 (Thu, 01 Oct 2009)
New Revision: 1514
Modified:
trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/h2/H2Capabilities.java
Log:
TEIID-822 TEIID-868 adding h2 and hsqldb translators, also simplifying datetime functions inline with what sources typically support.
Modified: trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/h2/H2Capabilities.java
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/h2/H2Capabilities.java 2009-10-01 16:15:27 UTC (rev 1513)
+++ trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/h2/H2Capabilities.java 2009-10-01 19:09:43 UTC (rev 1514)
@@ -84,16 +84,12 @@
supportedFunctions.add(SourceSystemFunctions.DAYOFWEEK);
supportedFunctions.add(SourceSystemFunctions.DAYOFYEAR);
- supportedFunctions.add(SourceSystemFunctions.FORMATDATE);
- supportedFunctions.add(SourceSystemFunctions.FORMATTIME);
supportedFunctions.add(SourceSystemFunctions.FORMATTIMESTAMP);
supportedFunctions.add(SourceSystemFunctions.HOUR);
supportedFunctions.add(SourceSystemFunctions.MINUTE);
supportedFunctions.add(SourceSystemFunctions.MONTH);
supportedFunctions.add(SourceSystemFunctions.MONTHNAME);
- supportedFunctions.add(SourceSystemFunctions.PARSEDATE);
- supportedFunctions.add(SourceSystemFunctions.PARSETIME);
supportedFunctions.add(SourceSystemFunctions.PARSETIMESTAMP);
supportedFunctions.add(SourceSystemFunctions.QUARTER);
supportedFunctions.add(SourceSystemFunctions.SECOND);
16 years, 3 months
teiid SVN: r1513 - trunk/engine/src/main/java/com/metamatrix/query/function/source.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2009-10-01 12:15:27 -0400 (Thu, 01 Oct 2009)
New Revision: 1513
Modified:
trunk/engine/src/main/java/com/metamatrix/query/function/source/SystemSource.java
Log:
TEIID-822 TEIID-868 adding h2 and hsqldb translators, also simplifying datetime functions inline with what sources typically support.
Modified: trunk/engine/src/main/java/com/metamatrix/query/function/source/SystemSource.java
===================================================================
--- trunk/engine/src/main/java/com/metamatrix/query/function/source/SystemSource.java 2009-10-01 16:00:08 UTC (rev 1512)
+++ trunk/engine/src/main/java/com/metamatrix/query/function/source/SystemSource.java 2009-10-01 16:15:27 UTC (rev 1513)
@@ -801,13 +801,13 @@
new FunctionParameter("format", DataTypeManager.DefaultDataTypes.STRING, QueryPlugin.Util.getString("SystemSource.Formattimestamp_arg2")) }, //$NON-NLS-1$ //$NON-NLS-2$
new FunctionParameter("result", DataTypeManager.DefaultDataTypes.STRING, QueryPlugin.Util.getString("SystemSource.Formattimestamp_result_desc")) ) ); //$NON-NLS-1$ //$NON-NLS-2$
functions.add(
- new FunctionMethod(SourceSystemFunctions.FORMATDATE, QueryPlugin.Util.getString("SystemSource.Formatdate_desc"),CONVERSION, FunctionMethod.SYNTHETIC, null, null, //$NON-NLS-1$
+ new FunctionMethod(FunctionLibrary.FORMATDATE, QueryPlugin.Util.getString("SystemSource.Formatdate_desc"),CONVERSION, FunctionMethod.SYNTHETIC, null, null, //$NON-NLS-1$
new FunctionParameter[] {
new FunctionParameter("date", DataTypeManager.DefaultDataTypes.DATE, QueryPlugin.Util.getString("SystemSource.Formatdate_arg1")), //$NON-NLS-1$ //$NON-NLS-2$
new FunctionParameter("format", DataTypeManager.DefaultDataTypes.STRING, QueryPlugin.Util.getString("SystemSource.Formatdate_arg2")) }, //$NON-NLS-1$ //$NON-NLS-2$
new FunctionParameter("result", DataTypeManager.DefaultDataTypes.STRING, QueryPlugin.Util.getString("SystemSource.Formatdate_result_desc")) ) ); //$NON-NLS-1$ //$NON-NLS-2$
functions.add(
- new FunctionMethod(SourceSystemFunctions.FORMATTIME, QueryPlugin.Util.getString("SystemSource.Formattime_desc"),CONVERSION, FunctionMethod.SYNTHETIC, null, null, //$NON-NLS-1$
+ new FunctionMethod(FunctionLibrary.FORMATTIME, QueryPlugin.Util.getString("SystemSource.Formattime_desc"),CONVERSION, FunctionMethod.SYNTHETIC, null, null, //$NON-NLS-1$
new FunctionParameter[] {
new FunctionParameter("time", DataTypeManager.DefaultDataTypes.TIME, QueryPlugin.Util.getString("SystemSource.Formattime_arg1")), //$NON-NLS-1$ //$NON-NLS-2$
new FunctionParameter("format", DataTypeManager.DefaultDataTypes.STRING, QueryPlugin.Util.getString("SystemSource.Formattime_arg2")) }, //$NON-NLS-1$ //$NON-NLS-2$
@@ -822,13 +822,13 @@
new FunctionParameter("format", DataTypeManager.DefaultDataTypes.STRING, QueryPlugin.Util.getString("SystemSource.Parsetimestamp_arg2")) }, //$NON-NLS-1$ //$NON-NLS-2$
new FunctionParameter("result", DataTypeManager.DefaultDataTypes.TIMESTAMP, QueryPlugin.Util.getString("SystemSource.Parsetimestamp_result_desc")) ) ); //$NON-NLS-1$ //$NON-NLS-2$
functions.add(
- new FunctionMethod(SourceSystemFunctions.PARSETIME, QueryPlugin.Util.getString("SystemSource.Parsetime_desc"),CONVERSION, FunctionMethod.SYNTHETIC, null, null, //$NON-NLS-1$
+ new FunctionMethod(FunctionLibrary.PARSETIME, QueryPlugin.Util.getString("SystemSource.Parsetime_desc"),CONVERSION, FunctionMethod.SYNTHETIC, null, null, //$NON-NLS-1$
new FunctionParameter[] {
new FunctionParameter("time", DataTypeManager.DefaultDataTypes.STRING, QueryPlugin.Util.getString("SystemSource.Parsetime_arg1")), //$NON-NLS-1$ //$NON-NLS-2$
new FunctionParameter("format", DataTypeManager.DefaultDataTypes.STRING, QueryPlugin.Util.getString("SystemSource.Parsetime_arg2")) }, //$NON-NLS-1$ //$NON-NLS-2$
new FunctionParameter("result", DataTypeManager.DefaultDataTypes.TIME, QueryPlugin.Util.getString("SystemSource.Parsetime_result_desc")) ) ); //$NON-NLS-1$ //$NON-NLS-2$
functions.add(
- new FunctionMethod(SourceSystemFunctions.PARSEDATE, QueryPlugin.Util.getString("SystemSource.Parsedate_desc"),CONVERSION, FunctionMethod.SYNTHETIC, null, null, //$NON-NLS-1$
+ new FunctionMethod(FunctionLibrary.PARSEDATE, QueryPlugin.Util.getString("SystemSource.Parsedate_desc"),CONVERSION, FunctionMethod.SYNTHETIC, null, null, //$NON-NLS-1$
new FunctionParameter[] {
new FunctionParameter("date", DataTypeManager.DefaultDataTypes.STRING, QueryPlugin.Util.getString("SystemSource.Parsedate_arg1")), //$NON-NLS-1$ //$NON-NLS-2$
new FunctionParameter("format", DataTypeManager.DefaultDataTypes.STRING, QueryPlugin.Util.getString("SystemSource.Parsedate_arg2")) }, //$NON-NLS-1$ //$NON-NLS-2$
16 years, 3 months
teiid SVN: r1512 - trunk/runtime/src/main/java/org/teiid/transport.
by teiid-commits@lists.jboss.org
Author: rareddy
Date: 2009-10-01 12:00:08 -0400 (Thu, 01 Oct 2009)
New Revision: 1512
Modified:
trunk/runtime/src/main/java/org/teiid/transport/LocalServerConnection.java
Log:
TEIID-867: Adding the ping support from the local connection. Even though technically local connections do not require ping, engine code does not distinguish between embedded vs socket connection, so server contract must be followed.
Modified: trunk/runtime/src/main/java/org/teiid/transport/LocalServerConnection.java
===================================================================
--- trunk/runtime/src/main/java/org/teiid/transport/LocalServerConnection.java 2009-10-01 14:46:23 UTC (rev 1511)
+++ trunk/runtime/src/main/java/org/teiid/transport/LocalServerConnection.java 2009-10-01 16:00:08 UTC (rev 1512)
@@ -27,6 +27,8 @@
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;
import java.util.Properties;
+import java.util.Timer;
+import java.util.TimerTask;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
@@ -56,7 +58,10 @@
private ClassLoader classLoader;
ClientServiceRegistry clientServices;
SessionServiceInterface sessionService;
+ private Timer pingTimer;
+ private ILogon logon;
+
public LocalServerConnection(Properties connectionProperties, ClientServiceRegistry clientServices, SessionServiceInterface sessionService) throws CommunicationException, ConnectionException{
@@ -71,11 +76,37 @@
this.classLoader = Thread.currentThread().getContextClassLoader();
this.sessionService = sessionService;
+
+ this.logon = this.getService(ILogon.class);
+ this.pingTimer = new Timer("LocalPing", true); //$NON-NLS-1$
+
+ schedulePing();
}
+
+ private void schedulePing() {
+ if (this.pingTimer != null) {
+ this.pingTimer.schedule(new TimerTask() {
+ @Override
+ public void run() {
+ try {
+ if (isOpen()) {
+ logon.ping();
+ return;
+ }
+ } catch (InvalidSessionException e) {
+ shutdown(false);
+ } catch (MetaMatrixComponentException e) {
+ shutdown();
+ }
+ this.cancel();
+ }
+ }, PING_INTERVAL, PING_INTERVAL);
+ }
+ }
public synchronized LogonResult authenticate(Properties connProps) throws ConnectionException, CommunicationException {
try {
- LogonResult logonResult = getService(ILogon.class).logon(connProps);
+ LogonResult logonResult = this.logon.logon(connProps);
return logonResult;
} catch (LogonException e) {
// Propagate the original message as it contains the message we want
@@ -126,26 +157,31 @@
}
public void shutdown() {
+ shutdown(true);
+ }
+
+ private void shutdown(boolean logoff) {
if (shutdown) {
return;
}
- try {
- //make a best effort to send the logoff
- Future<?> writeFuture = getService(ILogon.class).logoff();
- if (writeFuture != null) {
- writeFuture.get(5000, TimeUnit.MILLISECONDS);
+ if (logoff) {
+ try {
+ //make a best effort to send the logoff
+ Future<?> writeFuture = this.logon.logoff();
+ if (writeFuture != null) {
+ writeFuture.get(5000, TimeUnit.MILLISECONDS);
+ }
+ } catch (InvalidSessionException e) {
+ //ignore
+ } catch (InterruptedException e) {
+ //ignore
+ } catch (ExecutionException e) {
+ //ignore
+ } catch (TimeoutException e) {
+ //ignore
}
- } catch (InvalidSessionException e) {
- //ignore
- } catch (InterruptedException e) {
- //ignore
- } catch (ExecutionException e) {
- //ignore
- } catch (TimeoutException e) {
- //ignore
}
-
this.shutdown = true;
}
16 years, 3 months