teiid SVN: r3787 - trunk.
by teiid-commits@lists.jboss.org
Author: rareddy
Date: 2012-01-11 15:21:29 -0500 (Wed, 11 Jan 2012)
New Revision: 3787
Removed:
trunk/cache-jbosscache/
Log:
moving jboss-caching into jboss-integration
12 years, 11 months
teiid SVN: r3786 - in trunk: jboss-integration and 1 other directory.
by teiid-commits@lists.jboss.org
Author: rareddy
Date: 2012-01-11 15:17:31 -0500 (Wed, 11 Jan 2012)
New Revision: 3786
Modified:
trunk/jboss-integration/pom.xml
trunk/pom.xml
Log:
moving jboss-caching into jboss-integration
Modified: trunk/jboss-integration/pom.xml
===================================================================
--- trunk/jboss-integration/pom.xml 2012-01-11 19:18:32 UTC (rev 3785)
+++ trunk/jboss-integration/pom.xml 2012-01-11 20:17:31 UTC (rev 3786)
@@ -16,11 +16,6 @@
<groupId>org.jboss.teiid</groupId>
<artifactId>teiid-runtime</artifactId>
</dependency>
-
- <dependency>
- <groupId>org.jboss.teiid</groupId>
- <artifactId>teiid-cache-jbosscache</artifactId>
- </dependency>
<dependency>
<groupId>org.jboss.teiid</groupId>
@@ -69,7 +64,7 @@
<artifactId>jboss-as-security</artifactId>
<scope>provided</scope>
</dependency>
-
+
<!-- This dependency is to read the ra.xml file details -->
<dependency>
<groupId>org.jboss.as</groupId>
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2012-01-11 19:18:32 UTC (rev 3785)
+++ trunk/pom.xml 2012-01-11 20:17:31 UTC (rev 3786)
@@ -331,11 +331,6 @@
<artifactId>teiid-txn-jbossts</artifactId>
<version>${project.version}</version>
</dependency>
- <dependency>
- <groupId>org.jboss.teiid</groupId>
- <artifactId>teiid-cache-jbosscache</artifactId>
- <version>${project.version}</version>
- </dependency>
<dependency>
<groupId>org.jboss.teiid</groupId>
<artifactId>teiid-jboss-integration</artifactId>
@@ -615,7 +610,6 @@
<module>metadata</module>
<module>runtime</module>
<module>adminshell</module>
- <module>cache-jbosscache</module>
<module>hibernate-dialect</module>
<module>jboss-integration</module>
<module>test-integration</module>
12 years, 11 months
teiid SVN: r3785 - in trunk: api/src/main/java/org/teiid/logging and 36 other directories.
by teiid-commits@lists.jboss.org
Author: rareddy
Date: 2012-01-11 14:18:32 -0500 (Wed, 11 Jan 2012)
New Revision: 3785
Added:
trunk/jboss-integration/src/main/java/org/teiid/cache/
trunk/jboss-integration/src/main/java/org/teiid/cache/jboss/
trunk/jboss-integration/src/main/java/org/teiid/cache/jboss/JBossCache.java
trunk/jboss-integration/src/main/java/org/teiid/cache/jboss/JBossCacheFactory.java
trunk/jboss-integration/src/main/java/org/teiid/jboss/JBossLogger.java
trunk/jboss-integration/src/main/java/org/teiid/replication/
trunk/jboss-integration/src/main/java/org/teiid/replication/jboss/
trunk/jboss-integration/src/main/java/org/teiid/replication/jboss/AddressWrapper.java
trunk/jboss-integration/src/main/java/org/teiid/replication/jboss/JGroupsInputStream.java
trunk/jboss-integration/src/main/java/org/teiid/replication/jboss/JGroupsObjectReplicator.java
trunk/jboss-integration/src/main/java/org/teiid/replication/jboss/JGroupsOutputStream.java
Removed:
trunk/cache-jbosscache/src/main/java/org/teiid/cache/jboss/JBossCache.java
trunk/cache-jbosscache/src/main/java/org/teiid/cache/jboss/JBossCacheFactory.java
trunk/cache-jbosscache/src/main/java/org/teiid/replication/jboss/AddressWrapper.java
trunk/cache-jbosscache/src/main/java/org/teiid/replication/jboss/JGroupsInputStream.java
trunk/cache-jbosscache/src/main/java/org/teiid/replication/jboss/JGroupsObjectReplicator.java
trunk/cache-jbosscache/src/main/java/org/teiid/replication/jboss/JGroupsOutputStream.java
trunk/jboss-integration/src/main/java/org/teiid/jboss/Log4jListener.java
Modified:
trunk/admin/src/main/java/org/teiid/adminapi/AdminComponentException.java
trunk/admin/src/main/java/org/teiid/adminapi/AdminException.java
trunk/admin/src/main/java/org/teiid/adminapi/AdminProcessingException.java
trunk/api/src/main/java/org/teiid/logging/LogManager.java
trunk/common-core/src/main/java/org/teiid/core/BundleUtil.java
trunk/common-core/src/main/java/org/teiid/core/TeiidRuntimeException.java
trunk/connectors/sandbox/translator-yahoo/src/main/java/org/teiid/translator/yahoo/YahooExecution.java
trunk/connectors/sandbox/translator-yahoo/src/main/java/org/teiid/translator/yahoo/YahooPlugin.java
trunk/connectors/sandbox/translator-yahoo/src/main/resources/org/teiid/translator/yahoo/i18n.properties
trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/JDBCExecutionFactory.java
trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/JDBCPlugin.java
trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/oracle/OracleExecutionFactory.java
trunk/connectors/translator-jdbc/src/main/resources/org/teiid/translator/jdbc/i18n.properties
trunk/connectors/translator-ldap/src/main/java/org/teiid/translator/ldap/IQueryToLdapSearchParser.java
trunk/connectors/translator-ldap/src/main/java/org/teiid/translator/ldap/LDAPPlugin.java
trunk/connectors/translator-ldap/src/main/java/org/teiid/translator/ldap/LDAPSyncQueryExecution.java
trunk/connectors/translator-ldap/src/main/java/org/teiid/translator/ldap/LDAPUpdateExecution.java
trunk/connectors/translator-ldap/src/main/resources/org/teiid/translator/ldap/i18n.properties
trunk/connectors/translator-salesforce/src/main/java/org/teiid/translator/salesforce/MetadataProcessor.java
trunk/connectors/translator-salesforce/src/main/java/org/teiid/translator/salesforce/SalesForcePlugin.java
trunk/connectors/translator-salesforce/src/main/resources/org/teiid/translator/salesforce/i18n.properties
trunk/engine/src/main/java/org/teiid/common/buffer/impl/BufferFrontedFileStoreCache.java
trunk/engine/src/main/java/org/teiid/common/buffer/impl/BufferManagerImpl.java
trunk/engine/src/main/java/org/teiid/dqp/internal/datamgr/CapabilitiesConverter.java
trunk/engine/src/main/java/org/teiid/dqp/internal/datamgr/ConnectorWorkItem.java
trunk/engine/src/main/java/org/teiid/dqp/internal/process/CachedResults.java
trunk/engine/src/main/java/org/teiid/dqp/internal/process/DQPCore.java
trunk/engine/src/main/java/org/teiid/dqp/internal/process/LobWorkItem.java
trunk/engine/src/main/java/org/teiid/dqp/internal/process/RequestWorkItem.java
trunk/engine/src/main/java/org/teiid/dqp/internal/process/ThreadReuseExecutor.java
trunk/engine/src/main/java/org/teiid/query/QueryPlugin.java
trunk/engine/src/main/java/org/teiid/query/function/FunctionTree.java
trunk/engine/src/main/java/org/teiid/query/optimizer/relational/rules/NewCalculateCostUtil.java
trunk/engine/src/main/java/org/teiid/query/processor/relational/DependentCriteriaProcessor.java
trunk/engine/src/main/java/org/teiid/query/processor/xml/XMLPlan.java
trunk/engine/src/main/java/org/teiid/query/tempdata/TempTableDataManager.java
trunk/engine/src/main/java/org/teiid/query/util/CommandContext.java
trunk/engine/src/main/resources/org/teiid/query/i18n.properties
trunk/jboss-integration/src/main/java/org/teiid/jboss/DQPCoreService.java
trunk/jboss-integration/src/main/java/org/teiid/jboss/EventDistributorFactoryService.java
trunk/jboss-integration/src/main/java/org/teiid/jboss/IntegrationPlugin.java
trunk/jboss-integration/src/main/java/org/teiid/jboss/ObjectSerializer.java
trunk/jboss-integration/src/main/java/org/teiid/jboss/TeiidExtension.java
trunk/jboss-integration/src/main/java/org/teiid/jboss/TeiidOperationHandler.java
trunk/jboss-integration/src/main/java/org/teiid/jboss/TranslatorAdd.java
trunk/jboss-integration/src/main/java/org/teiid/jboss/TranslatorDeployer.java
trunk/jboss-integration/src/main/java/org/teiid/jboss/TranslatorService.java
trunk/jboss-integration/src/main/java/org/teiid/jboss/TransportAdd.java
trunk/jboss-integration/src/main/java/org/teiid/jboss/TransportService.java
trunk/jboss-integration/src/main/java/org/teiid/jboss/VDBDependencyDeployer.java
trunk/jboss-integration/src/main/java/org/teiid/jboss/VDBDeployer.java
trunk/jboss-integration/src/main/java/org/teiid/jboss/VDBParserDeployer.java
trunk/jboss-integration/src/main/java/org/teiid/jboss/VDBService.java
trunk/jboss-integration/src/main/resources/org/teiid/jboss/i18n.properties
trunk/runtime/src/main/java/org/teiid/deployers/EventDistributorImpl.java
trunk/runtime/src/main/java/org/teiid/deployers/TranslatorUtil.java
trunk/runtime/src/main/java/org/teiid/deployers/VDBRepository.java
trunk/runtime/src/main/java/org/teiid/deployers/VDBStatusChecker.java
trunk/runtime/src/main/java/org/teiid/runtime/RuntimePlugin.java
trunk/runtime/src/main/java/org/teiid/services/SessionServiceImpl.java
trunk/runtime/src/main/java/org/teiid/transport/LogonImpl.java
trunk/runtime/src/main/java/org/teiid/transport/PgBackendProtocol.java
trunk/runtime/src/main/java/org/teiid/transport/ServerWorkItem.java
trunk/runtime/src/main/resources/org/teiid/runtime/i18n.properties
trunk/test-integration/common/pom.xml
Log:
TEIID-1889: Adding Event ID for messages that are at INFO or at higher level
Modified: trunk/admin/src/main/java/org/teiid/adminapi/AdminComponentException.java
===================================================================
--- trunk/admin/src/main/java/org/teiid/adminapi/AdminComponentException.java 2012-01-10 17:28:44 UTC (rev 3784)
+++ trunk/admin/src/main/java/org/teiid/adminapi/AdminComponentException.java 2012-01-11 19:18:32 UTC (rev 3785)
@@ -58,7 +58,7 @@
* @param msg the error message.
* @since 4.3
*/
- public AdminComponentException(int code, String msg) {
+ public AdminComponentException(String code, String msg) {
super(code, msg);
}
@@ -66,7 +66,7 @@
super(msg, cause);
}
- public AdminComponentException(int code, String msg, Throwable cause) {
+ public AdminComponentException(String code, String msg, Throwable cause) {
super(code, msg, cause);
}
Modified: trunk/admin/src/main/java/org/teiid/adminapi/AdminException.java
===================================================================
--- trunk/admin/src/main/java/org/teiid/adminapi/AdminException.java 2012-01-10 17:28:44 UTC (rev 3784)
+++ trunk/admin/src/main/java/org/teiid/adminapi/AdminException.java 2012-01-11 19:18:32 UTC (rev 3785)
@@ -74,16 +74,16 @@
* @param msg the error message.
* @since 4.3
*/
- AdminException(int code, String msg) {
- super(Integer.toString(code), msg);
+ AdminException(String code, String msg) {
+ super(code, msg);
}
AdminException(String msg, Throwable cause) {
super(cause, msg);
}
- AdminException(int code, String msg, Throwable cause) {
- super(cause, Integer.toString(code),msg);
+ AdminException(String code, String msg, Throwable cause) {
+ super(cause, code,msg);
}
/**
Modified: trunk/admin/src/main/java/org/teiid/adminapi/AdminProcessingException.java
===================================================================
--- trunk/admin/src/main/java/org/teiid/adminapi/AdminProcessingException.java 2012-01-10 17:28:44 UTC (rev 3784)
+++ trunk/admin/src/main/java/org/teiid/adminapi/AdminProcessingException.java 2012-01-11 19:18:32 UTC (rev 3785)
@@ -63,7 +63,7 @@
* @param msg the error message.
* @since 4.3
*/
- public AdminProcessingException(int code, String msg) {
+ public AdminProcessingException(String code, String msg) {
super(code, msg);
}
@@ -71,7 +71,7 @@
super(msg, cause);
}
- public AdminProcessingException(int code, String msg, Throwable cause) {
+ public AdminProcessingException(String code, String msg, Throwable cause) {
super(code, msg, cause);
}
Modified: trunk/api/src/main/java/org/teiid/logging/LogManager.java
===================================================================
--- trunk/api/src/main/java/org/teiid/logging/LogManager.java 2012-01-10 17:28:44 UTC (rev 3784)
+++ trunk/api/src/main/java/org/teiid/logging/LogManager.java 2012-01-11 19:18:32 UTC (rev 3785)
@@ -146,7 +146,7 @@
* @param message the log message; the message is
* not logged if this parameter is null
*/
- public static void logCritical(String context, String message) {
+ public static void logCritical(String context, Object message) {
logMessage(MessageLevel.CRITICAL, context, message);
}
@@ -165,7 +165,7 @@
* not logged if this parameter is null
* @param message the log message (may be null)
*/
- public static void logCritical(String context, Throwable e, String message) {
+ public static void logCritical(String context, Throwable e, Object message) {
log(MessageLevel.CRITICAL,context,e,message);
}
@@ -181,7 +181,7 @@
* @param message the log message; the message is
* not logged if this parameter is null
*/
- public static void logError(String context, String message) {
+ public static void logError(String context, Object message) {
logMessage(MessageLevel.ERROR, context,message);
}
@@ -198,7 +198,7 @@
* not logged if this parameter is null
* @param message the log message (may be null)
*/
- public static void logError(String context, Throwable e, String message) {
+ public static void logError(String context, Throwable e, Object message) {
log(MessageLevel.ERROR,context,e,message);
}
@@ -214,7 +214,7 @@
* @param message the log message; the message is
* not logged if this parameter is null
*/
- public static void logWarning(String context, String message) {
+ public static void logWarning(String context, Object message) {
logMessage(MessageLevel.WARNING, context,message);
}
@@ -231,7 +231,7 @@
* not logged if this parameter is null
* @param message the log message (may be null)
*/
- public static void logWarning(String context, Throwable e, String message) {
+ public static void logWarning(String context, Throwable e, Object message) {
log(MessageLevel.WARNING,context,e,message);
}
@@ -248,7 +248,7 @@
* @param message the log message; the message is
* not logged if this parameter is null
*/
- public static void logInfo(String context, String message) {
+ public static void logInfo(String context, Object message) {
logMessage(MessageLevel.INFO, context,message);
}
Deleted: trunk/cache-jbosscache/src/main/java/org/teiid/cache/jboss/JBossCache.java
===================================================================
--- trunk/cache-jbosscache/src/main/java/org/teiid/cache/jboss/JBossCache.java 2012-01-10 17:28:44 UTC (rev 3784)
+++ trunk/cache-jbosscache/src/main/java/org/teiid/cache/jboss/JBossCache.java 2012-01-11 19:18:32 UTC (rev 3785)
@@ -1,89 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package org.teiid.cache.jboss;
-
-import java.util.Set;
-import java.util.concurrent.TimeUnit;
-
-import org.teiid.cache.Cache;
-
-
-/**
- * Implementation of Cache using Infinispan
- */
-public class JBossCache<K, V> implements Cache<String, V> {
-
- protected org.infinispan.Cache<String, V> cacheStore;
- private final String name;
-
- public JBossCache(org.infinispan.Cache<String, V> cacheStore, String cacheName) {
- this.cacheStore = cacheStore;
- this.name = cacheName;
- }
-
- private String fqn(String key) {
- return this.name+"."+key; //$NON-NLS-1$
- }
-
- @Override
- public V get(String key) {
- return this.cacheStore.get(fqn(key));
- }
-
- public V put(String key, V value) {
- return this.cacheStore.put(fqn(key), value);
- }
-
- @Override
- public V put(String key, V value, Long ttl) {
- if (ttl != null) {
- return this.cacheStore.put(fqn(key), value, ttl, TimeUnit.MILLISECONDS);
- }
- return this.cacheStore.put(fqn(key), value);
- }
-
- @Override
- public V remove(String key) {
- return this.cacheStore.remove(fqn(key));
- }
-
- @Override
- public int size() {
- return this.cacheStore.size();
- }
-
- @Override
- public void clear() {
- this.cacheStore.clear();
- }
-
- @Override
- public String getName() {
- return this.name;
- }
-
- @Override
- public Set<String> keys() {
- return this.cacheStore.keySet();
- }
-}
Deleted: trunk/cache-jbosscache/src/main/java/org/teiid/cache/jboss/JBossCacheFactory.java
===================================================================
--- trunk/cache-jbosscache/src/main/java/org/teiid/cache/jboss/JBossCacheFactory.java 2012-01-10 17:28:44 UTC (rev 3784)
+++ trunk/cache-jbosscache/src/main/java/org/teiid/cache/jboss/JBossCacheFactory.java 2012-01-11 19:18:32 UTC (rev 3785)
@@ -1,71 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package org.teiid.cache.jboss;
-
-import java.io.Serializable;
-
-import org.infinispan.manager.CacheContainer;
-import org.teiid.cache.Cache;
-import org.teiid.cache.CacheConfiguration;
-import org.teiid.cache.CacheFactory;
-import org.teiid.core.TeiidRuntimeException;
-
-
-public class JBossCacheFactory implements CacheFactory, Serializable{
- private static final long serialVersionUID = -2767452034178675653L;
- private transient org.infinispan.Cache cacheStore;
- private volatile boolean destroyed = false;
-
-
- public JBossCacheFactory(String name, CacheContainer cm) {
- if (name != null) {
- this.cacheStore = cm.getCache(name);
- }
- else {
- this.cacheStore = cm.getCache();
- }
- }
-
- /**
- * {@inheritDoc}
- */
- public Cache get(String location, CacheConfiguration config) {
- if (!destroyed) {
- return new JBossCache(this.cacheStore, config.getLocation());
- }
- throw new TeiidRuntimeException("Cache system has been shutdown"); //$NON-NLS-1$
- }
-
- public void destroy() {
- this.destroyed = true;
- }
-
- public void stop() {
- destroy();
- }
-
- @Override
- public boolean isReplicated() {
- return true;
- }
-}
Deleted: trunk/cache-jbosscache/src/main/java/org/teiid/replication/jboss/AddressWrapper.java
===================================================================
--- trunk/cache-jbosscache/src/main/java/org/teiid/replication/jboss/AddressWrapper.java 2012-01-10 17:28:44 UTC (rev 3784)
+++ trunk/cache-jbosscache/src/main/java/org/teiid/replication/jboss/AddressWrapper.java 2012-01-11 19:18:32 UTC (rev 3785)
@@ -1,86 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package org.teiid.replication.jboss;
-
-import java.io.Externalizable;
-import java.io.IOException;
-import java.io.ObjectInput;
-import java.io.ObjectOutput;
-
-import org.jgroups.Address;
-import org.teiid.core.util.ReflectionHelper;
-
-/**
- * Allows JGroups {@link Address} objects to be serializable
- */
-public final class AddressWrapper implements Externalizable {
-
- Address address;
-
- public AddressWrapper() {
-
- }
-
- public AddressWrapper(Address address) {
- this.address = address;
- }
-
- @Override
- public int hashCode() {
- return address.hashCode();
- }
-
- @Override
- public boolean equals(Object obj) {
- if (obj == this) {
- return true;
- }
- if (!(obj instanceof AddressWrapper)) {
- return false;
- }
- return address.equals(((AddressWrapper)obj).address);
- }
-
- @Override
- public void readExternal(ObjectInput in) throws IOException,
- ClassNotFoundException {
- String className = in.readUTF();
- try {
- this.address = (Address) ReflectionHelper.create(className, null, Thread.currentThread().getContextClassLoader());
- this.address.readFrom(in);
- } catch (Exception e) {
- throw new IOException(e);
- }
- }
-
- @Override
- public void writeExternal(ObjectOutput out) throws IOException {
- out.writeUTF(address.getClass().getName());
- try {
- address.writeTo(out);
- } catch (Exception e) {
- throw new IOException(e);
- }
- }
-
-}
\ No newline at end of file
Deleted: trunk/cache-jbosscache/src/main/java/org/teiid/replication/jboss/JGroupsInputStream.java
===================================================================
--- trunk/cache-jbosscache/src/main/java/org/teiid/replication/jboss/JGroupsInputStream.java 2012-01-10 17:28:44 UTC (rev 3784)
+++ trunk/cache-jbosscache/src/main/java/org/teiid/replication/jboss/JGroupsInputStream.java 2012-01-11 19:18:32 UTC (rev 3785)
@@ -1,114 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package org.teiid.replication.jboss;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.TimeoutException;
-import java.util.concurrent.locks.Condition;
-import java.util.concurrent.locks.ReentrantLock;
-
-public class JGroupsInputStream extends InputStream {
-
- private long timeout = 15000;
- private volatile byte[] buf;
- private volatile int index=0;
- private ReentrantLock lock = new ReentrantLock();
- private Condition write = lock.newCondition();
- private Condition doneReading = lock.newCondition();
-
- public JGroupsInputStream(long timeout) {
- this.timeout = timeout;
- }
-
- @Override
- public int read() throws IOException {
- if (index < 0) {
- return -1;
- }
- if (buf == null) {
- lock.lock();
- try {
- write.await(timeout, TimeUnit.MILLISECONDS);
- if (index < 0) {
- return -1;
- }
- if (buf == null) {
- throw new IOException(new TimeoutException());
- }
- } catch(InterruptedException e) {
- throw new IOException(e);
- } finally {
- lock.unlock();
- }
- }
- if (index == buf.length) {
- lock.lock();
- try {
- buf = null;
- index = 0;
- doneReading.signal();
- } finally {
- lock.unlock();
- }
- return read();
- }
- return buf[index++] & 0xff;
- }
-
- @Override
- public void close() {
- lock.lock();
- try {
- buf = null;
- index = -1;
- doneReading.signal();
- } finally {
- lock.unlock();
- }
- }
-
- public void receive(byte[] bytes) throws InterruptedException {
- lock.lock();
- try {
- if (index == -1) {
- return;
- }
- if (buf != null) {
- doneReading.await();
- }
- if (index == -1) {
- return;
- }
- buf = bytes;
- if (bytes == null) {
- index = -1;
- }
- write.signal();
- } finally {
- lock.unlock();
- }
- }
-
-}
\ No newline at end of file
Deleted: trunk/cache-jbosscache/src/main/java/org/teiid/replication/jboss/JGroupsObjectReplicator.java
===================================================================
--- trunk/cache-jbosscache/src/main/java/org/teiid/replication/jboss/JGroupsObjectReplicator.java 2012-01-10 17:28:44 UTC (rev 3784)
+++ trunk/cache-jbosscache/src/main/java/org/teiid/replication/jboss/JGroupsObjectReplicator.java 2012-01-11 19:18:32 UTC (rev 3785)
@@ -1,609 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package org.teiid.replication.jboss;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
-import java.io.Serializable;
-import java.lang.reflect.InvocationHandler;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.lang.reflect.Proxy;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.Executor;
-import java.util.concurrent.Executors;
-
-import org.jboss.as.clustering.jgroups.ChannelFactory;
-import org.jgroups.Address;
-import org.jgroups.Channel;
-import org.jgroups.MembershipListener;
-import org.jgroups.Message;
-import org.jgroups.MessageListener;
-import org.jgroups.ReceiverAdapter;
-import org.jgroups.View;
-import org.jgroups.blocks.MethodCall;
-import org.jgroups.blocks.MethodLookup;
-import org.jgroups.blocks.RequestOptions;
-import org.jgroups.blocks.ResponseMode;
-import org.jgroups.blocks.RpcDispatcher;
-import org.jgroups.util.Buffer;
-import org.jgroups.util.Promise;
-import org.jgroups.util.Rsp;
-import org.jgroups.util.RspList;
-import org.teiid.Replicated;
-import org.teiid.Replicated.ReplicationMode;
-import org.teiid.core.TeiidRuntimeException;
-import org.teiid.core.util.ObjectInputStreamWithClassloader;
-import org.teiid.logging.LogConstants;
-import org.teiid.logging.LogManager;
-import org.teiid.query.ObjectReplicator;
-import org.teiid.query.ReplicatedObject;
-
-@SuppressWarnings("unchecked")
-public class JGroupsObjectReplicator implements ObjectReplicator, Serializable {
-
- private static final int IO_TIMEOUT = 15000;
-
- private final class ReplicatorRpcDispatcher<S> extends RpcDispatcher {
- private final S object;
- private boolean initialized;
- private final HashMap<Method, Short> methodMap;
- private final ArrayList<Method> methodList;
- Map<List<?>, JGroupsInputStream> inputStreams = new ConcurrentHashMap<List<?>, JGroupsInputStream>();
-
- private ReplicatorRpcDispatcher(Channel channel, MessageListener l,
- MembershipListener l2, Object serverObj, S object,
- HashMap<Method, Short> methodMap, ArrayList<Method> methodList) {
- super(channel, l, l2, serverObj);
- this.object = object;
- this.methodMap = methodMap;
- this.methodList = methodList;
- setMarshaller(new ContextAwareMarshaller(getClass().getClassLoader()));
- }
-
- @Override
- public Object handle(Message req) {
- Object body=null;
-
- if(req == null || req.getLength() == 0) {
- if(log.isErrorEnabled()) log.error("message or message buffer is null"); //$NON-NLS-1$
- return null;
- }
-
- try {
- body=req_marshaller != null?
- req_marshaller.objectFromBuffer(req.getBuffer(), req.getOffset(), req.getLength())
- : req.getObject();
- }
- catch(Throwable e) {
- if(log.isErrorEnabled()) log.error("exception marshalling object", e); //$NON-NLS-1$
- return e;
- }
-
- if(!(body instanceof MethodCall)) {
- if(log.isErrorEnabled()) log.error("message does not contain a MethodCall object"); //$NON-NLS-1$
-
- // create an exception to represent this and return it
- return new IllegalArgumentException("message does not contain a MethodCall object") ; //$NON-NLS-1$
- }
-
- final MethodCall method_call=(MethodCall)body;
-
- try {
- if(log.isTraceEnabled())
- log.trace("[sender=" + req.getSrc() + "], method_call: " + method_call); //$NON-NLS-1$ //$NON-NLS-2$
-
- if (method_call.getId() >= methodList.size() - 5 && req.getSrc().equals(local_addr)) {
- return null;
- }
-
- if (method_call.getId() >= methodList.size() - 3) {
- Serializable address = new AddressWrapper(req.getSrc());
- Serializable stateId = (Serializable)method_call.getArgs()[0];
- List<?> key = Arrays.asList(stateId, address);
- JGroupsInputStream is = inputStreams.get(key);
- if (method_call.getId() == methodList.size() - 3) {
- LogManager.logTrace(LogConstants.CTX_RUNTIME, object, "create state", stateId); //$NON-NLS-1$
- if (is != null) {
- is.receive(null);
- }
- is = new JGroupsInputStream(IO_TIMEOUT);
- this.inputStreams.put(key, is);
- executor.execute(new StreamingRunner(object, stateId, is, null));
- } else if (method_call.getId() == methodList.size() - 2) {
- LogManager.logTrace(LogConstants.CTX_RUNTIME, object, "building state", stateId); //$NON-NLS-1$
- if (is != null) {
- is.receive((byte[])method_call.getArgs()[1]);
- }
- } else if (method_call.getId() == methodList.size() - 1) {
- LogManager.logTrace(LogConstants.CTX_RUNTIME, object, "finished state", stateId); //$NON-NLS-1$
- if (is != null) {
- is.receive(null);
- }
- this.inputStreams.remove(key);
- }
- return null;
- } else if (method_call.getId() == methodList.size() - 5) {
- //hasState
- ReplicatedObject ro = (ReplicatedObject)object;
- Serializable stateId = (Serializable)method_call.getArgs()[0];
-
- if (stateId == null) {
- synchronized (this) {
- if (initialized) {
- return Boolean.TRUE;
- }
- return null;
- }
- }
-
- if (ro.hasState(stateId)) {
- return Boolean.TRUE;
- }
- return null;
- } else if (method_call.getId() == methodList.size() - 4) {
- //sendState
- ReplicatedObject ro = (ReplicatedObject)object;
- String stateId = (String)method_call.getArgs()[0];
- AddressWrapper dest = (AddressWrapper)method_call.getArgs()[1];
-
- JGroupsOutputStream oStream = new JGroupsOutputStream(this, Arrays.asList(dest.address), stateId, (short)(methodMap.size() - 3), false);
- try {
- if (stateId == null) {
- ro.getState(oStream);
- } else {
- ro.getState(stateId, oStream);
- }
- } finally {
- oStream.close();
- }
- LogManager.logTrace(LogConstants.CTX_RUNTIME, object, "sent state", stateId); //$NON-NLS-1$
- return null;
- }
-
- Method m=method_lookup.findMethod(method_call.getId());
- if(m == null)
- throw new Exception("no method found for " + method_call.getId()); //$NON-NLS-1$
- method_call.setMethod(m);
-
- return method_call.invoke(server_obj);
- }
- catch(Throwable x) {
- return x;
- }
- }
- }
-
- private static final long serialVersionUID = -6851804958313095166L;
- private static final String HAS_STATE = "hasState"; //$NON-NLS-1$
- private static final String SEND_STATE = "sendState"; //$NON-NLS-1$
- private static final String CREATE_STATE = "createState"; //$NON-NLS-1$
- private static final String BUILD_STATE = "buildState"; //$NON-NLS-1$
- private static final String FINISH_STATE = "finishState"; //$NON-NLS-1$
-
- private final static class StreamingRunner implements Runnable {
- private final Object object;
- private final Serializable stateId;
- private final JGroupsInputStream is;
- private Promise<Boolean> promise;
-
- private StreamingRunner(Object object, Serializable stateId, JGroupsInputStream is, Promise<Boolean> promise) {
- this.object = object;
- this.stateId = stateId;
- this.is = is;
- this.promise = promise;
- }
-
- @Override
- public void run() {
- try {
- if (stateId == null) {
- ((ReplicatedObject<?>)object).setState(is);
- } else {
- ((ReplicatedObject)object).setState(stateId, is);
- }
- if (promise != null) {
- promise.setResult(Boolean.TRUE);
- }
- LogManager.logDetail(LogConstants.CTX_RUNTIME, "state set", stateId); //$NON-NLS-1$
- } catch (Exception e) {
- if (promise != null) {
- promise.setResult(Boolean.FALSE);
- }
- LogManager.logError(LogConstants.CTX_RUNTIME, e, "error setting state " + stateId); //$NON-NLS-1$
- } finally {
- is.close();
- }
- }
- }
-
- private final class ReplicatedInvocationHandler<S> extends ReceiverAdapter implements
- InvocationHandler, Serializable {
-
- private static final int PULL_RETRIES = 3;
- private static final long serialVersionUID = -2943462899945966103L;
- private final S object;
- private transient ReplicatorRpcDispatcher<S> disp;
- private final HashMap<Method, Short> methodMap;
- protected List<Address> remoteMembers = Collections.synchronizedList(new ArrayList<Address>());
- private Map<Serializable, Promise<Boolean>> loadingStates = new HashMap<Serializable, Promise<Boolean>>();
-
- private ReplicatedInvocationHandler(S object,HashMap<Method, Short> methodMap) {
- this.object = object;
- this.methodMap = methodMap;
- }
-
- List<Address> getRemoteMembersCopy() {
- synchronized (remoteMembers) {
- return new ArrayList<Address>(remoteMembers);
- }
- }
-
- public void setDisp(ReplicatorRpcDispatcher<S> disp) {
- this.disp = disp;
- }
-
- @Override
- public Object invoke(Object proxy, Method method, Object[] args)
- throws Throwable {
- Short methodNum = methodMap.get(method);
- if (methodNum == null || remoteMembers.isEmpty()) {
- if (methodNum != null) {
- Replicated annotation = method.getAnnotation(Replicated.class);
- if (annotation != null && annotation.remoteOnly()) {
- return null;
- }
- }
- try {
- return method.invoke(object, args);
- } catch (InvocationTargetException e) {
- throw e.getCause();
- }
- }
- try {
- Replicated annotation = method.getAnnotation(Replicated.class);
- if (annotation.replicateState() != ReplicationMode.NONE) {
- return handleReplicateState(method, args, annotation);
- }
- MethodCall call=new MethodCall(methodNum, args);
- List<Address> dests = null;
- if (annotation.remoteOnly()) {
- dests = getRemoteMembersCopy();
- if (dests.isEmpty()) {
- return null;
- }
- }
- RspList<Object> responses = disp.callRemoteMethods(dests, call, new RequestOptions().setMode(annotation.asynch()?ResponseMode.GET_NONE:ResponseMode.GET_ALL).setTimeout(annotation.timeout()).setAnycasting(dests != null));
- if (annotation.asynch()) {
- return null;
- }
- List<Object> results = responses.getResults();
- if (method.getReturnType() == boolean.class) {
- for (Object o : results) {
- if (!Boolean.TRUE.equals(o)) {
- return false;
- }
- }
- return true;
- } else if (method.getReturnType() == Collection.class) {
- ArrayList<Object> result = new ArrayList<Object>();
- for (Object o : results) {
- result.addAll((Collection)o);
- }
- return results;
- }
- return null;
- } catch(Exception e) {
- throw new RuntimeException(method + " " + args + " failed", e); //$NON-NLS-1$ //$NON-NLS-2$
- }
- }
-
- protected Address whereIsState(Serializable stateId, long timeout) throws Exception {
- if (remoteMembers.isEmpty()) {
- return null;
- }
- RspList<Boolean> resp = this.disp.callRemoteMethods(getRemoteMembersCopy(), new MethodCall((short)(methodMap.size() - 5), new Object[]{stateId}), new RequestOptions(ResponseMode.GET_ALL, timeout));
- Collection<Rsp<Boolean>> values = resp.values();
- Rsp<Boolean> rsp = null;
- for (Rsp<Boolean> response : values) {
- if (Boolean.TRUE.equals(response.getValue())) {
- rsp = response;
- break;
- }
- }
- if (rsp == null) {
- return null;
- }
- return rsp.getSender();
- }
-
- private Object handleReplicateState(Method method, Object[] args,
- Replicated annotation) throws IllegalAccessException,
- Throwable, IOException, IllegalStateException, Exception {
- Object result = null;
- try {
- result = method.invoke(object, args);
- } catch (InvocationTargetException e) {
- throw e.getCause();
- }
- ReplicatedObject ro = (ReplicatedObject)object;
- Serializable stateId = (Serializable)args[0];
- if (annotation.replicateState() == ReplicationMode.PUSH) {
- if (!remoteMembers.isEmpty()) {
- LogManager.logDetail(LogConstants.CTX_RUNTIME, object, "replicating state", stateId); //$NON-NLS-1$
- JGroupsOutputStream oStream = new JGroupsOutputStream(disp, null, stateId, (short)(methodMap.size() - 3), true);
- try {
- ro.getState(stateId, oStream);
- } finally {
- oStream.close();
- }
- LogManager.logTrace(LogConstants.CTX_RUNTIME, object, "sent state", stateId); //$NON-NLS-1$
- }
- return result;
- }
- if (result != null) {
- return result;
- }
- long timeout = annotation.timeout();
- return pullState(method, args, stateId, timeout);
- }
-
- /**
- * Pull the remote state. The method and args are optional
- * to determine if the state has been made available.
- */
- Object pullState(Method method, Object[] args, Serializable stateId,
- long timeout) throws Throwable {
- Object result = null;
- for (int i = 0; i < PULL_RETRIES; i++) {
- Promise<Boolean> p = null;
- boolean wait = true;
- synchronized (loadingStates) {
- p = loadingStates.get(stateId);
- if (p == null) {
- wait = false;
- if (method != null) {
- try {
- result = method.invoke(object, args);
- } catch (InvocationTargetException e) {
- throw e.getCause();
- }
- if (result != null) {
- return result;
- }
- }
- p = new Promise<Boolean>();
- loadingStates.put(stateId, p);
- }
- }
- if (wait) {
- p.getResult(timeout);
- continue;
- }
- try {
- LogManager.logDetail(LogConstants.CTX_RUNTIME, object, "pulling state", stateId); //$NON-NLS-1$
- Address addr = whereIsState(stateId, timeout);
- if (addr == null) {
- LogManager.logDetail(LogConstants.CTX_RUNTIME, object, "timeout exceeded or first member"); //$NON-NLS-1$
- break;
- }
- JGroupsInputStream is = new JGroupsInputStream(IO_TIMEOUT);
- StreamingRunner runner = new StreamingRunner(object, stateId, is, p);
- List<?> key = Arrays.asList(stateId, new AddressWrapper(addr));
- disp.inputStreams.put(key, is);
- executor.execute(runner);
-
- this.disp.callRemoteMethod(addr, new MethodCall((short)(methodMap.size() - 4), stateId, new AddressWrapper(this.disp.getChannel().getAddress())), new RequestOptions(ResponseMode.GET_NONE, 0).setAnycasting(true));
-
- Boolean fetched = p.getResult(timeout);
-
- if (fetched != null) {
- if (fetched) {
- LogManager.logDetail(LogConstants.CTX_RUNTIME, object, "pulled state", stateId); //$NON-NLS-1$
- if (method !=null) {
- try {
- result = method.invoke(object, args);
- } catch (InvocationTargetException e) {
- throw e.getCause();
- }
- if (result != null) {
- return result;
- }
- }
- break;
- }
- LogManager.logWarning(LogConstants.CTX_RUNTIME, object + " failed to pull " + stateId); //$NON-NLS-1$
- } else {
- LogManager.logWarning(LogConstants.CTX_RUNTIME, object + " timeout pulling " + stateId); //$NON-NLS-1$
- }
- } finally {
- synchronized (loadingStates) {
- loadingStates.remove(stateId);
- }
- }
- }
- return null; //could not fetch the remote state
- }
-
- @Override
- public void viewAccepted(View newView) {
- if (newView.getMembers() != null) {
- synchronized (remoteMembers) {
- remoteMembers.removeAll(newView.getMembers());
- if (object instanceof ReplicatedObject<?> && !remoteMembers.isEmpty()) {
- HashSet<Serializable> dropped = new HashSet<Serializable>();
- for (Address address : remoteMembers) {
- dropped.add(new AddressWrapper(address));
- }
- ((ReplicatedObject<?>)object).droppedMembers(dropped);
- }
- remoteMembers.clear();
- remoteMembers.addAll(newView.getMembers());
- remoteMembers.remove(this.disp.getChannel().getAddress());
- }
- }
- }
- }
-
- private interface Streaming {
- void sendState(Serializable id, AddressWrapper dest);
- void createState(Serializable id);
- void buildState(Serializable id, byte[] bytes);
- void finishState(Serializable id);
- }
-
- //TODO: this should be configurable, or use a common executor
- private transient Executor executor = Executors.newCachedThreadPool();
- private transient ChannelFactory channelFactory;
-
- public JGroupsObjectReplicator(ChannelFactory channelFactory) {
- this.channelFactory = channelFactory;
- }
-
- public void stop(Object object) {
- if (!Proxy.isProxyClass(object.getClass())) {
- return;
- }
- ReplicatedInvocationHandler<?> handler = (ReplicatedInvocationHandler<?>) Proxy.getInvocationHandler(object);
- Channel c = handler.disp.getChannel();
- handler.disp.stop();
- c.close();
- }
-
- @Override
- public <T, S> T replicate(String mux_id,
- Class<T> iface, final S object, long startTimeout) throws Exception {
- Channel channel = channelFactory.createChannel(mux_id);
- Method[] methods = iface.getMethods();
-
- final HashMap<Method, Short> methodMap = new HashMap<Method, Short>();
- final ArrayList<Method> methodList = new ArrayList<Method>();
-
- for (Method method : methods) {
- if (method.getAnnotation(Replicated.class) == null) {
- continue;
- }
- methodList.add(method);
- methodMap.put(method, (short)(methodList.size() - 1));
- }
-
- Method hasState = ReplicatedObject.class.getMethod(HAS_STATE, new Class<?>[] {Serializable.class});
- methodList.add(hasState);
- methodMap.put(hasState, (short)(methodList.size() - 1));
-
- Method sendState = JGroupsObjectReplicator.Streaming.class.getMethod(SEND_STATE, new Class<?>[] {Serializable.class, AddressWrapper.class});
- methodList.add(sendState);
- methodMap.put(sendState, (short)(methodList.size() - 1));
-
- //add in streaming methods
- Method createState = JGroupsObjectReplicator.Streaming.class.getMethod(CREATE_STATE, new Class<?>[] {Serializable.class});
- methodList.add(createState);
- methodMap.put(createState, (short)(methodList.size() - 1));
- Method buildState = JGroupsObjectReplicator.Streaming.class.getMethod(BUILD_STATE, new Class<?>[] {Serializable.class, byte[].class});
- methodList.add(buildState);
- methodMap.put(buildState, (short)(methodList.size() - 1));
- Method finishState = JGroupsObjectReplicator.Streaming.class.getMethod(FINISH_STATE, new Class<?>[] {Serializable.class});
- methodList.add(finishState);
- methodMap.put(finishState, (short)(methodList.size() - 1));
-
- ReplicatedInvocationHandler<S> proxy = new ReplicatedInvocationHandler<S>(object, methodMap);
- /*
- * TODO: could have an object implement streaming
- * Override the normal handle method to support streaming
- */
- ReplicatorRpcDispatcher disp = new ReplicatorRpcDispatcher<S>(channel, proxy, proxy, object,
- object, methodMap, methodList);
-
- proxy.setDisp(disp);
- disp.setMethodLookup(new MethodLookup() {
- public Method findMethod(short id) {
- return methodList.get(id);
- }
- });
-
- T replicatedProxy = (T) Proxy.newProxyInstance(Thread.currentThread().getContextClassLoader(), new Class[] {iface}, proxy);
- boolean success = false;
- try {
- channel.connect(mux_id);
- if (object instanceof ReplicatedObject) {
- ((ReplicatedObject)object).setAddress(new AddressWrapper(channel.getAddress()));
- proxy.pullState(null, null, null, startTimeout);
- }
- success = true;
- return replicatedProxy;
- } catch (Throwable e) {
- if (e instanceof Exception) {
- throw (Exception)e;
- }
- throw new TeiidRuntimeException(e);
- } finally {
- if (!success) {
- channel.close();
- } else {
- synchronized (disp) {
- //mark as initialized so that state can be pulled if needed
- disp.initialized = true;
- }
- }
- }
- }
-
- // This class is used so that the objects are loaded with the current classes class loader
- // rather than foreign class loader
- static class ContextAwareMarshaller implements RpcDispatcher.Marshaller {
- private ClassLoader classloader;
-
- public ContextAwareMarshaller(ClassLoader classloader) {
- this.classloader = classloader;
- }
-
- @Override
- public Buffer objectToBuffer(Object obj) throws Exception {
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
- ObjectOutputStream out = new ObjectOutputStream(baos);
- out.writeObject(obj);
- out.close();
- return new Buffer(baos.toByteArray());
- }
-
- @Override
- public Object objectFromBuffer(byte[] buf, int offset, int length) throws Exception {
- ObjectInputStream in = new ObjectInputStreamWithClassloader(new ByteArrayInputStream(buf, offset, length), this.classloader);
- Object anObj = in.readObject();
- in.close();
- return anObj;
- }
- }
-
-}
Deleted: trunk/cache-jbosscache/src/main/java/org/teiid/replication/jboss/JGroupsOutputStream.java
===================================================================
--- trunk/cache-jbosscache/src/main/java/org/teiid/replication/jboss/JGroupsOutputStream.java 2012-01-10 17:28:44 UTC (rev 3784)
+++ trunk/cache-jbosscache/src/main/java/org/teiid/replication/jboss/JGroupsOutputStream.java 2012-01-11 19:18:32 UTC (rev 3785)
@@ -1,104 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package org.teiid.replication.jboss;
-
-import java.io.IOException;
-import java.io.OutputStream;
-import java.io.Serializable;
-import java.util.Arrays;
-import java.util.List;
-
-import org.jgroups.Address;
-import org.jgroups.blocks.MethodCall;
-import org.jgroups.blocks.RequestOptions;
-import org.jgroups.blocks.ResponseMode;
-import org.jgroups.blocks.RpcDispatcher;
-import org.teiid.core.types.Streamable;
-
-public class JGroupsOutputStream extends OutputStream {
-
- static final int CHUNK_SIZE=Streamable.STREAMING_BATCH_SIZE_IN_BYTES;
-
- protected final RpcDispatcher disp;
- protected final List<Address> dests;
- protected final Serializable stateId;
- protected final short methodOffset;
-
- private volatile boolean closed=false;
- private final byte[] buffer=new byte[CHUNK_SIZE];
- private int index=0;
-
- public JGroupsOutputStream(RpcDispatcher disp, List<Address> dests, Serializable stateId, short methodOffset, boolean sendCreate) throws IOException {
- this.disp=disp;
- this.dests=dests;
- this.stateId=stateId;
- this.methodOffset = methodOffset;
- if (sendCreate) {
- try {
- disp.callRemoteMethods(this.dests, new MethodCall(methodOffset, new Object[] {stateId}), new RequestOptions(ResponseMode.GET_NONE, 0).setAnycasting(dests != null));
- } catch(Exception e) {
- throw new IOException(e);
- }
- }
- }
-
- public void close() throws IOException {
- if(closed) {
- return;
- }
- flush();
- try {
- disp.callRemoteMethods(dests, new MethodCall((short)(methodOffset + 2), new Object[] {stateId}), new RequestOptions(ResponseMode.GET_NONE, 0).setAnycasting(dests != null));
- } catch(Exception e) {
- }
- closed=true;
- }
-
- public void flush() throws IOException {
- checkClosed();
- try {
- if(index == 0) {
- return;
- }
- disp.callRemoteMethods(dests, new MethodCall((short)(methodOffset + 1), new Object[] {stateId, Arrays.copyOf(buffer, index)}), new RequestOptions(ResponseMode.GET_NONE, 0).setAnycasting(dests != null));
- index=0;
- } catch(Exception e) {
- throw new IOException(e);
- }
- }
-
- private void checkClosed() throws IOException {
- if(closed) {
- throw new IOException("output stream is closed"); //$NON-NLS-1$
- }
- }
-
- public void write(int b) throws IOException {
- checkClosed();
- if(index >= buffer.length) {
- flush();
- }
- buffer[index++]=(byte)b;
- }
-
-}
\ No newline at end of file
Modified: trunk/common-core/src/main/java/org/teiid/core/BundleUtil.java
===================================================================
--- trunk/common-core/src/main/java/org/teiid/core/BundleUtil.java 2012-01-10 17:28:44 UTC (rev 3784)
+++ trunk/common-core/src/main/java/org/teiid/core/BundleUtil.java 2012-01-11 19:18:32 UTC (rev 3785)
@@ -50,6 +50,10 @@
protected final String pluginId;
+ public interface Event {
+ //String id();
+ }
+
/**
* Return the {@link BundleUtil} for the class. The bundle must be in the same package or a parent package of the class.
* @param clazz
@@ -224,6 +228,18 @@
return MessageFormat.format(text, parameters);
}
+
+ public String gs(final String key, final Object... parameters) {
+ return getString(key, parameters);
+ }
+
+ public String gs(final Event key, final Object... parameters) {
+ StringBuilder sb = new StringBuilder();
+ sb.append(key);
+ sb.append(" "); //$NON-NLS-1$
+ sb.append(getString(key.toString(), parameters));
+ return sb.toString();
+ }
public String getStringOrKey(final String key) {
ArgCheck.isNotNull(key);
Modified: trunk/common-core/src/main/java/org/teiid/core/TeiidRuntimeException.java
===================================================================
--- trunk/common-core/src/main/java/org/teiid/core/TeiidRuntimeException.java 2012-01-10 17:28:44 UTC (rev 3784)
+++ trunk/common-core/src/main/java/org/teiid/core/TeiidRuntimeException.java 2012-01-11 19:18:32 UTC (rev 3785)
@@ -70,6 +70,12 @@
// The following setCode call should be executed after setting the message
setCode(code);
}
+
+ public TeiidRuntimeException(final String[] message) {
+ super(message[1]);
+ // The following setCode call should be executed after setting the message
+ setCode(message[0]);
+ }
/**
* Construct an instance with a linked exception specified. If the exception is a {@link TeiidException} or a
Modified: trunk/connectors/sandbox/translator-yahoo/src/main/java/org/teiid/translator/yahoo/YahooExecution.java
===================================================================
--- trunk/connectors/sandbox/translator-yahoo/src/main/java/org/teiid/translator/yahoo/YahooExecution.java 2012-01-10 17:28:44 UTC (rev 3784)
+++ trunk/connectors/sandbox/translator-yahoo/src/main/java/org/teiid/translator/yahoo/YahooExecution.java 2012-01-11 19:18:32 UTC (rev 3785)
@@ -200,7 +200,7 @@
row.add(new java.sql.Date(date.getTime()));
} catch(ParseException e) {
Object[] params = new Object[] { data, e.getMessage() };
- LogManager.logWarning(LogConstants.CTX_CONNECTOR, YahooPlugin.Util.getString("YahooExecution.Parse_date_error", params)); //$NON-NLS-1$
+ LogManager.logWarning(LogConstants.CTX_CONNECTOR, YahooPlugin.Util.gs(YahooPlugin.Event.TEIID14001, params));
row.add(null);
}
} else{
@@ -213,7 +213,7 @@
row.add(new java.sql.Time(time.getTime()));
} catch(ParseException e) {
Object[] params = new Object[] { data, e.getMessage() };
- LogManager.logWarning(LogConstants.CTX_CONNECTOR, YahooPlugin.Util.getString("YahooExecution.Parse_time_value", params)); //$NON-NLS-1$
+ LogManager.logWarning(LogConstants.CTX_CONNECTOR, YahooPlugin.Util.gs(YahooPlugin.Event.TEIID14002, params));
row.add(null);
}
} else {
Modified: trunk/connectors/sandbox/translator-yahoo/src/main/java/org/teiid/translator/yahoo/YahooPlugin.java
===================================================================
--- trunk/connectors/sandbox/translator-yahoo/src/main/java/org/teiid/translator/yahoo/YahooPlugin.java 2012-01-10 17:28:44 UTC (rev 3784)
+++ trunk/connectors/sandbox/translator-yahoo/src/main/java/org/teiid/translator/yahoo/YahooPlugin.java 2012-01-11 19:18:32 UTC (rev 3785)
@@ -30,4 +30,9 @@
public class YahooPlugin {
public static final String PLUGIN_ID = "org.teiid.translator.yahoo" ; //$NON-NLS-1$
public static final BundleUtil Util = new BundleUtil(PLUGIN_ID,PLUGIN_ID + ".i18n", ResourceBundle.getBundle(PLUGIN_ID + ".i18n")); //$NON-NLS-1$ //$NON-NLS-2$
+
+ public static enum Event implements BundleUtil.Event{
+ TEIID14001, // parse data error
+ TEIID14002, // parse time error.
+ }
}
Modified: trunk/connectors/sandbox/translator-yahoo/src/main/resources/org/teiid/translator/yahoo/i18n.properties
===================================================================
--- trunk/connectors/sandbox/translator-yahoo/src/main/resources/org/teiid/translator/yahoo/i18n.properties 2012-01-10 17:28:44 UTC (rev 3784)
+++ trunk/connectors/sandbox/translator-yahoo/src/main/resources/org/teiid/translator/yahoo/i18n.properties 2012-01-11 19:18:32 UTC (rev 3785)
@@ -27,6 +27,6 @@
TickerCollectorVisitor.Unexpected_expression=Unable to parse expression: {0}
YahooExecution.No_tickers=Yahoo connector must be called with tickers in the criteria
YahooExecution.Must_have_criteria=Query against Yahoo connector must have criteria
-YahooExecution.Parse_date_error=Unable to parse date value: {0}, got: {1}
-YahooExecution.Parse_time_value=Unable to parse time value: {0}, got: {1}
+TEIID14001=Unable to parse date value: {0}, got: {1}
+TEIID14002=Unable to parse time value: {0}, got: {1}
YahooExecution.Invalid_select_symbol=Yahoo connector can''t handle {0} in SELECT
Modified: trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/JDBCExecutionFactory.java
===================================================================
--- trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/JDBCExecutionFactory.java 2012-01-10 17:28:44 UTC (rev 3784)
+++ trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/JDBCExecutionFactory.java 2012-01-11 19:18:32 UTC (rev 3785)
@@ -1026,8 +1026,7 @@
LogManager.logInfo(LogConstants.CTX_CONNECTOR, sb.toString());
} catch (SQLException e) {
- String errorStr = JDBCPlugin.Util.getString("ConnectionListener.failed_to_report_jdbc_connection_details"); //$NON-NLS-1$
- LogManager.logInfo(LogConstants.CTX_CONNECTOR, errorStr);
+ LogManager.logInfo(LogConstants.CTX_CONNECTOR, JDBCPlugin.Util.gs(JDBCPlugin.Event.TEIID11002));
}
}
Modified: trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/JDBCPlugin.java
===================================================================
--- trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/JDBCPlugin.java 2012-01-10 17:28:44 UTC (rev 3784)
+++ trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/JDBCPlugin.java 2012-01-11 19:18:32 UTC (rev 3785)
@@ -35,4 +35,11 @@
public static final BundleUtil Util = new BundleUtil(PLUGIN_ID,
PLUGIN_ID + ".i18n", ResourceBundle.getBundle(PLUGIN_ID + ".i18n")); //$NON-NLS-1$ //$NON-NLS-2$
+
+
+ public static enum Event implements BundleUtil.Event{
+ TEIID11001, // connection details
+ TEIID11002, // connection creation failed
+ TEIID11003, // invalid hint
+ }
}
Modified: trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/oracle/OracleExecutionFactory.java
===================================================================
--- trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/oracle/OracleExecutionFactory.java 2012-01-10 17:28:44 UTC (rev 3784)
+++ trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/oracle/OracleExecutionFactory.java 2012-01-11 19:18:32 UTC (rev 3785)
@@ -362,7 +362,7 @@
comment += payloadString + " "; //$NON-NLS-1$
usingPayloadComment = true;
} else {
- String msg = JDBCPlugin.Util.getString("OraleExecutionFactory.invalid_hint", "Execution Payload", payloadString); //$NON-NLS-1$ //$NON-NLS-2$
+ String msg = JDBCPlugin.Util.gs(JDBCPlugin.Event.TEIID11003, "Execution Payload", payloadString); //$NON-NLS-1$
context.addWarning(new TranslatorException(msg));
LogManager.logWarning(LogConstants.CTX_CONNECTOR, msg);
}
@@ -381,7 +381,7 @@
if (!hint.contains(HINT_PREFIX)) {
comment += HINT_PREFIX + ' ' + hint + ' ' + HINT_SUFFIX + ' ';
} else {
- String msg = JDBCPlugin.Util.getString("OraleExecutionFactory.invalid_hint", "Source Hint", hint); //$NON-NLS-1$ //$NON-NLS-2$
+ String msg = JDBCPlugin.Util.gs(JDBCPlugin.Event.TEIID11003, "Source Hint", hint); //$NON-NLS-1$
context.addWarning(new TranslatorException(msg));
LogManager.logWarning(LogConstants.CTX_CONNECTOR, msg);
}
Modified: trunk/connectors/translator-jdbc/src/main/resources/org/teiid/translator/jdbc/i18n.properties
===================================================================
--- trunk/connectors/translator-jdbc/src/main/resources/org/teiid/translator/jdbc/i18n.properties 2012-01-10 17:28:44 UTC (rev 3784)
+++ trunk/connectors/translator-jdbc/src/main/resources/org/teiid/translator/jdbc/i18n.properties 2012-01-11 19:18:32 UTC (rev 3785)
@@ -28,6 +28,6 @@
JDBCQueryExecution.Error_executing_query__1 = ''{0}'' error executing statement(s): {1}
SQLConversionVisitor.invalid_parameter=Invalid parameter {0}. Must be between 1 and {1}.
SQLConversionVisitor.not_in_parameter=Invalid parameter {0}. Native query procedures cannot use non IN parameters.
-OraleExecutionFactory.invalid_hint=Not using oracle execution payload {0} as hint, since it apprears to contain more than just a single comment.
-ConnectionListener.failed_to_report_jdbc_connection_details=Failed to report the JDBC driver and connection information
+TEIID11003=Not using oracle execution payload {0} as hint, since it apprears to contain more than just a single comment.
+TEIID11002=Failed to report the JDBC driver and connection information
JDBCMetadataProcessor.not_unique=Teiid runtime names, which are case insensitive, for the imported metadata are not unique. If not already set, use the setting importer.useFullSchemaName to create Teiid names that include the source schema.
\ No newline at end of file
Modified: trunk/connectors/translator-ldap/src/main/java/org/teiid/translator/ldap/IQueryToLdapSearchParser.java
===================================================================
--- trunk/connectors/translator-ldap/src/main/java/org/teiid/translator/ldap/IQueryToLdapSearchParser.java 2012-01-10 17:28:44 UTC (rev 3784)
+++ trunk/connectors/translator-ldap/src/main/java/org/teiid/translator/ldap/IQueryToLdapSearchParser.java 2012-01-11 19:18:32 UTC (rev 3785)
@@ -400,13 +400,13 @@
} else {
if(e instanceof AggregateFunction) {
- LogManager.logError(LogConstants.CTX_CONNECTOR, "Received IAggregate, but it is not supported. Check capabilities."); //$NON-NLS-1$
+ LogManager.logError(LogConstants.CTX_CONNECTOR, LDAPPlugin.Util.gs(LDAPPlugin.Event.TEIID12001));
} else if(e instanceof Function) {
- LogManager.logError(LogConstants.CTX_CONNECTOR, "Received IFunction, but it is not supported. Check capabilties."); //$NON-NLS-1$
+ LogManager.logError(LogConstants.CTX_CONNECTOR, LDAPPlugin.Util.gs(LDAPPlugin.Event.TEIID12005));
} else if(e instanceof ScalarSubquery) {
- LogManager.logError(LogConstants.CTX_CONNECTOR, "Received IScalarSubquery, but it is not supported. Check capabilties."); //$NON-NLS-1$
+ LogManager.logError(LogConstants.CTX_CONNECTOR, LDAPPlugin.Util.gs(LDAPPlugin.Event.TEIID12006));
} else if (e instanceof SearchedCase) {
- LogManager.logError(LogConstants.CTX_CONNECTOR, "Received ISearchedCaseExpression, but it is not supported. Check capabilties."); //$NON-NLS-1$
+ LogManager.logError(LogConstants.CTX_CONNECTOR, LDAPPlugin.Util.gs(LDAPPlugin.Event.TEIID12007));
}
final String msg = LDAPPlugin.Util.getString("IQueryToLdapSearchParser.unsupportedElementError"); //$NON-NLS-1$
throw new TranslatorException(msg + e.toString());
Modified: trunk/connectors/translator-ldap/src/main/java/org/teiid/translator/ldap/LDAPPlugin.java
===================================================================
--- trunk/connectors/translator-ldap/src/main/java/org/teiid/translator/ldap/LDAPPlugin.java 2012-01-10 17:28:44 UTC (rev 3784)
+++ trunk/connectors/translator-ldap/src/main/java/org/teiid/translator/ldap/LDAPPlugin.java 2012-01-11 19:18:32 UTC (rev 3785)
@@ -38,4 +38,14 @@
*/
public static final BundleUtil Util = new BundleUtil(PLUGIN_ID, PLUGIN_ID + ".i18n", ResourceBundle.getBundle(PLUGIN_ID + ".i18n")); //$NON-NLS-1$ //$NON-NLS-2$
+ public static enum Event implements BundleUtil.Event {
+ TEIID12001, // unsupported capability
+ TEIID12002, // search failed
+ TEIID12003, // close context
+ TEIID12004, // attribute fetch error
+ TEIID12005,
+ TEIID12006,
+ TEIID12007,
+ TEIID12008
+ }
}
Modified: trunk/connectors/translator-ldap/src/main/java/org/teiid/translator/ldap/LDAPSyncQueryExecution.java
===================================================================
--- trunk/connectors/translator-ldap/src/main/java/org/teiid/translator/ldap/LDAPSyncQueryExecution.java 2012-01-10 17:28:44 UTC (rev 3784)
+++ trunk/connectors/translator-ldap/src/main/java/org/teiid/translator/ldap/LDAPSyncQueryExecution.java 2012-01-11 19:18:32 UTC (rev 3785)
@@ -200,8 +200,7 @@
ldapCtx = (LdapContext) this.ldapConnection.lookup(searchDetails.getContextName());
} catch (NamingException ne) {
if (searchDetails.getContextName() != null) {
- LogManager.logError(LogConstants.CTX_CONNECTOR, "Attempted to search context: " //$NON-NLS-1$
- + searchDetails.getContextName());
+ LogManager.logError(LogConstants.CTX_CONNECTOR, LDAPPlugin.Util.gs(LDAPPlugin.Event.TEIID12002, searchDetails.getContextName()));
}
final String msg = LDAPPlugin.Util.getString("LDAPSyncQueryExecution.createContextError"); //$NON-NLS-1$
throw new TranslatorException(msg);
@@ -275,8 +274,7 @@
try {
ldapCtx.close();
} catch (NamingException ne) {
- final String msg = LDAPPlugin.Util.getString("LDAPSyncQueryExecution.closeContextError",ne.getExplanation()); //$NON-NLS-1$
- LogManager.logWarning(LogConstants.CTX_CONNECTOR, msg);
+ LogManager.logWarning(LogConstants.CTX_CONNECTOR, LDAPPlugin.Util.gs(LDAPPlugin.Event.TEIID12003, ne.getExplanation()));
}
}
}
@@ -330,7 +328,7 @@
return result;
} catch (SizeLimitExceededException e) {
if (resultCount != searchDetails.getCountLimit()) {
- String msg = "LDAP Search results exceeded size limit. Results may be incomplete."; //$NON-NLS-1$
+ String msg = LDAPPlugin.Util.gs(LDAPPlugin.Event.TEIID12008);
TranslatorException te = new TranslatorException(e, msg);
if (executionFactory.isExceptionOnSizeLimitExceeded()) {
throw te;
@@ -340,7 +338,7 @@
}
return null; // GHH 20080326 - if size limit exceeded don't try to read more results
} catch (NamingException ne) {
- throw new TranslatorException(ne, "Ldap error while processing next batch of results"); //$NON-NLS-1$
+ throw new TranslatorException(ne, LDAPPlugin.Util.gs("ldap_error")); //$NON-NLS-1$
}
}
@@ -436,7 +434,7 @@
//just a single value
objResult = resultAttr.get();
} catch (NamingException ne) {
- final String msg = LDAPPlugin.Util.getString("LDAPSyncQueryExecution.attrValueFetchError",modelAttrName) +" : "+ne.getExplanation(); //$NON-NLS-1$m//$NON-NLS-2$
+ final String msg = LDAPPlugin.Util.gs(LDAPPlugin.Event.TEIID12004, modelAttrName) +" : "+ne.getExplanation(); //$NON-NLS-1$m
LogManager.logWarning(LogConstants.CTX_CONNECTOR, msg);
throw new TranslatorException(msg);
}
Modified: trunk/connectors/translator-ldap/src/main/java/org/teiid/translator/ldap/LDAPUpdateExecution.java
===================================================================
--- trunk/connectors/translator-ldap/src/main/java/org/teiid/translator/ldap/LDAPUpdateExecution.java 2012-01-10 17:28:44 UTC (rev 3784)
+++ trunk/connectors/translator-ldap/src/main/java/org/teiid/translator/ldap/LDAPUpdateExecution.java 2012-01-11 19:18:32 UTC (rev 3785)
@@ -431,8 +431,7 @@
ldapCtx.close();
}
} catch (NamingException ne) {
- final String msg = LDAPPlugin.Util.getString("LDAPUpdateExecution.closeContextError",ne.getExplanation()); //$NON-NLS-1$
- LogManager.logWarning(LogConstants.CTX_CONNECTOR,msg);
+ LogManager.logWarning(LogConstants.CTX_CONNECTOR, LDAPPlugin.Util.gs(LDAPPlugin.Event.TEIID12003, ne.getExplanation()));
}
}
Modified: trunk/connectors/translator-ldap/src/main/resources/org/teiid/translator/ldap/i18n.properties
===================================================================
--- trunk/connectors/translator-ldap/src/main/resources/org/teiid/translator/ldap/i18n.properties 2012-01-10 17:28:44 UTC (rev 3784)
+++ trunk/connectors/translator-ldap/src/main/resources/org/teiid/translator/ldap/i18n.properties 2012-01-11 19:18:32 UTC (rev 3785)
@@ -35,9 +35,9 @@
LDAPSyncQueryExecution.createContextError=Failed to create LDAP search context from the specified context name. Check the table/group name in source to ensure the context exists.
LDAPSyncQueryExecution.execSearchError=Execute search failed. Please check logs for search details.
LDAPSyncQueryExecution.nullAttrError=Encountered null attribute name for a select symbol. Please check name in source for each column.
-LDAPSyncQueryExecution.attrValueFetchError=Failed to fetch attribute value for attribute {0}. Rowset cannot be constructed from incomplete LDAP results.
+TEIID12004=Failed to fetch attribute value for attribute {0}. Rowset cannot be constructed from incomplete LDAP results.
LDAPSyncQueryExecution.supportedClassNotFoundError=Supported class not found.
-LDAPSyncQueryExecution.closeContextError=LDAP error occurred during attempt to close context : {0}
+TEIID12003=LDAP error occurred during attempt to close context : {0}
#
LDAPUpdateExecution.createContextError=Failed to create copy of the initial LDAP context: {0}
LDAPUpdateExecution.incorrectCommandError=Incorrect command type. Expecting INSERT, UPDATE, or DELETE.
@@ -58,6 +58,13 @@
LDAPUpdateExecution.criteriaSrcColumnError=criteria is on source column {0}, but should be on a source column named DN
LDAPUpdateExecution.criteriaRHSNotLiteralError=right side of equals comparison against DN is not a literal - must be a string literal
LDAPUpdateExecution.criteriaRHSNotStringError=right side of equals comparison against DN is not a string - must be a string literal
-LDAPUpdateExecution.closeContextError=LDAP error occurred during attempt to close context : {0}
LDAPSyncQueryExecution.timestampParseFailed=Timestamp could not be parsed. Please check to ensure the Format field for attribute {0} is configured using SimpleDateFormat conventions.
+ldap_error=Ldap error while processing next batch of results
+
+TEIID12001=Received IAggregate, but it is not supported. Check capabilities.
+TEIID12005=Received IFunction, but it is not supported. Check capabilties.
+TEIID12006=Received IScalarSubquery, but it is not supported. Check capabilties.
+TEIID12007=Received ISearchedCaseExpression, but it is not supported. Check capabilties.
+TEIID12002=Attempted to search context: {0}
+TEIID12008=LDAP Search results exceeded size limit. Results may be incomplete.
\ No newline at end of file
Modified: trunk/connectors/translator-salesforce/src/main/java/org/teiid/translator/salesforce/MetadataProcessor.java
===================================================================
--- trunk/connectors/translator-salesforce/src/main/java/org/teiid/translator/salesforce/MetadataProcessor.java 2012-01-10 17:28:44 UTC (rev 3784)
+++ trunk/connectors/translator-salesforce/src/main/java/org/teiid/translator/salesforce/MetadataProcessor.java 2012-01-11 19:18:32 UTC (rev 3785)
@@ -270,7 +270,7 @@
column.setNativeType(sfTypeName);
}
if(null == column) {
- LogManager.logError(LogConstants.CTX_CONNECTOR, "Unknown type returned by SalesForce: " + sfTypeName);
+ LogManager.logError(LogConstants.CTX_CONNECTOR, SalesForcePlugin.Util.gs(SalesForcePlugin.Event.TEIID13001, sfTypeName));
continue;
} else {
column.setNameInSource(field.getName());
Modified: trunk/connectors/translator-salesforce/src/main/java/org/teiid/translator/salesforce/SalesForcePlugin.java
===================================================================
--- trunk/connectors/translator-salesforce/src/main/java/org/teiid/translator/salesforce/SalesForcePlugin.java 2012-01-10 17:28:44 UTC (rev 3784)
+++ trunk/connectors/translator-salesforce/src/main/java/org/teiid/translator/salesforce/SalesForcePlugin.java 2012-01-11 19:18:32 UTC (rev 3785)
@@ -42,5 +42,7 @@
private static final String BUNDLE_NAME = PLUGIN_ID + ".i18n"; //$NON-NLS-1$
public static final BundleUtil Util = new BundleUtil(PLUGIN_ID,BUNDLE_NAME,ResourceBundle.getBundle(BUNDLE_NAME));
-
+ public static enum Event implements BundleUtil.Event{
+ TEIID13001
+ }
}
Modified: trunk/connectors/translator-salesforce/src/main/resources/org/teiid/translator/salesforce/i18n.properties
===================================================================
--- trunk/connectors/translator-salesforce/src/main/resources/org/teiid/translator/salesforce/i18n.properties 2012-01-10 17:28:44 UTC (rev 3784)
+++ trunk/connectors/translator-salesforce/src/main/resources/org/teiid/translator/salesforce/i18n.properties 2012-01-11 19:18:32 UTC (rev 3785)
@@ -38,3 +38,4 @@
CriteriaVisitor.LIKE.not.supported.on.multiselect=LIKE criteria are not allowed on columns of native type Multi-Select Picklist
Util.query.exceeds.max.length=Queries cannot exceed 10,000 characters
+TEIID13001=Unknown type returned by SalesForce: {0}
Modified: trunk/engine/src/main/java/org/teiid/common/buffer/impl/BufferFrontedFileStoreCache.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/common/buffer/impl/BufferFrontedFileStoreCache.java 2012-01-10 17:28:44 UTC (rev 3784)
+++ trunk/engine/src/main/java/org/teiid/common/buffer/impl/BufferFrontedFileStoreCache.java 2012-01-11 19:18:32 UTC (rev 3785)
@@ -445,7 +445,7 @@
sleep = false;
} while (shouldDefrag(blockStore, segment));
} catch (IOException e) {
- LogManager.logWarning(LogConstants.CTX_BUFFER_MGR, e, "Error performing defrag"); //$NON-NLS-1$
+ LogManager.logWarning(LogConstants.CTX_BUFFER_MGR, e, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID30022));
} catch (InterruptedException e) {
throw new TeiidRuntimeException(e);
}
@@ -464,7 +464,7 @@
long newLength = (endBlock + 1) * blockStore.blockSize;
blockStore.stores[segment].setLength(newLength);
} catch (IOException e) {
- LogManager.logWarning(LogConstants.CTX_BUFFER_MGR, e, "Error performing defrag truncate"); //$NON-NLS-1$
+ LogManager.logWarning(LogConstants.CTX_BUFFER_MGR, e, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID30023));
} finally {
blockStore.locks[segment].writeLock().unlock();
}
@@ -613,9 +613,9 @@
//entries are mutable after adding, the original should be removed shortly so just ignore
LogManager.logDetail(LogConstants.CTX_BUFFER_MGR, "Object "+ entry.getId() +" changed size since first persistence, keeping the original."); //$NON-NLS-1$ //$NON-NLS-2$
} else if (e == BlockOutputStream.exceededMax){
- LogManager.logError(LogConstants.CTX_BUFFER_MGR, "Max block number exceeded. Increase the maxStorageObjectSize to support larger storage objects. Alternatively you could make the processor batch size smaller."); //$NON-NLS-1$
+ LogManager.logError(LogConstants.CTX_BUFFER_MGR, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID30001));
} else {
- LogManager.logError(LogConstants.CTX_BUFFER_MGR, e, "Error persisting, attempts to read "+ entry.getId() +" later will result in an exception."); //$NON-NLS-1$ //$NON-NLS-2$
+ LogManager.logError(LogConstants.CTX_BUFFER_MGR, e, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID30002,entry.getId()));
}
} finally {
if (hasPermit) {
@@ -902,7 +902,7 @@
block = blockStore.writeToStorageBlock(info, is);
}
} catch (IOException e) {
- LogManager.logError(LogConstants.CTX_BUFFER_MGR, e, "Error transferring block to storage " + oid); //$NON-NLS-1$
+ LogManager.logError(LogConstants.CTX_BUFFER_MGR, e, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID30016, oid));
} finally {
//ensure post conditions
synchronized (info) {
Modified: trunk/engine/src/main/java/org/teiid/common/buffer/impl/BufferManagerImpl.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/common/buffer/impl/BufferManagerImpl.java 2012-01-10 17:28:44 UTC (rev 3784)
+++ trunk/engine/src/main/java/org/teiid/common/buffer/impl/BufferManagerImpl.java 2012-01-11 19:18:32 UTC (rev 3785)
@@ -711,7 +711,7 @@
try {
evicted = evict(ce);
} catch (Throwable e) {
- LogManager.logError(LogConstants.CTX_BUFFER_MGR, e, "Error persisting batch, attempts to read batch "+ ce.getId() +" later will result in an exception"); //$NON-NLS-1$ //$NON-NLS-2$
+ LogManager.logError(LogConstants.CTX_BUFFER_MGR, e, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID30017, ce.getId() ));
} finally {
synchronized (ce) {
if (evicted && memoryEntries.remove(ce.getId()) != null) {
Modified: trunk/engine/src/main/java/org/teiid/dqp/internal/datamgr/CapabilitiesConverter.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/dqp/internal/datamgr/CapabilitiesConverter.java 2012-01-10 17:28:44 UTC (rev 3784)
+++ trunk/engine/src/main/java/org/teiid/dqp/internal/datamgr/CapabilitiesConverter.java 2012-01-11 19:18:32 UTC (rev 3785)
@@ -152,7 +152,7 @@
}
for (Capability capability : required) {
if (!tgtCaps.supportsCapability(capability)) {
- LogManager.logWarning(LogConstants.CTX_CONNECTOR, QueryPlugin.Util.getString("support_required", cap, capability, connectorID)); //$NON-NLS-1$
+ LogManager.logWarning(LogConstants.CTX_CONNECTOR, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID30003, cap, capability, connectorID));
supports = false;
}
}
Modified: trunk/engine/src/main/java/org/teiid/dqp/internal/datamgr/ConnectorWorkItem.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/dqp/internal/datamgr/ConnectorWorkItem.java 2012-01-10 17:28:44 UTC (rev 3784)
+++ trunk/engine/src/main/java/org/teiid/dqp/internal/datamgr/ConnectorWorkItem.java 2012-01-11 19:18:32 UTC (rev 3785)
@@ -124,7 +124,7 @@
LogManager.logDetail(LogConstants.CTX_CONNECTOR, QueryPlugin.Util.getString("DQPCore.The_atomic_request_has_been_cancelled", this.id)); //$NON-NLS-1$
}
} catch (TranslatorException e) {
- LogManager.logWarning(LogConstants.CTX_CONNECTOR, e, QueryPlugin.Util.getString("Cancel_request_failed", this.id)); //$NON-NLS-1$
+ LogManager.logWarning(LogConstants.CTX_CONNECTOR, e, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID30024, this.id));
}
}
@@ -343,7 +343,7 @@
if ( !lastBatch && currentRowCount == 0 ) {
// Defect 13366 - Should send all batches, even if they're zero size.
// Log warning if received a zero-size non-last batch from the connector.
- LogManager.logWarning(LogConstants.CTX_CONNECTOR, QueryPlugin.Util.getString("ConnectorWorker.zero_size_non_last_batch", requestMsg.getConnectorName())); //$NON-NLS-1$
+ LogManager.logWarning(LogConstants.CTX_CONNECTOR, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID30004, requestMsg.getConnectorName()));
}
AtomicResultsMessage response = createResultsMessage(rows.toArray(new List[currentRowCount]));
Modified: trunk/engine/src/main/java/org/teiid/dqp/internal/process/CachedResults.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/dqp/internal/process/CachedResults.java 2012-01-10 17:28:44 UTC (rev 3784)
+++ trunk/engine/src/main/java/org/teiid/dqp/internal/process/CachedResults.java 2012-01-11 19:18:32 UTC (rev 3785)
@@ -113,7 +113,7 @@
try {
this.accessInfo.restore();
} catch (TeiidException e) {
- LogManager.logWarning(LogConstants.CTX_DQP, e, QueryPlugin.Util.getString("unexpected_exception_restoring_results")); //$NON-NLS-1$
+ LogManager.logWarning(LogConstants.CTX_DQP, e, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID30025));
return false;
}
}
Modified: trunk/engine/src/main/java/org/teiid/dqp/internal/process/DQPCore.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/dqp/internal/process/DQPCore.java 2012-01-10 17:28:44 UTC (rev 3784)
+++ trunk/engine/src/main/java/org/teiid/dqp/internal/process/DQPCore.java 2012-01-11 19:18:32 UTC (rev 3785)
@@ -351,7 +351,7 @@
wi.requestCancel();
}
} catch (TeiidComponentException e) {
- LogManager.logError(LogConstants.CTX_DQP, e, "Error processing cancellation task."); //$NON-NLS-1$
+ LogManager.logError(LogConstants.CTX_DQP, e, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID30018));
}
}
}, timeout));
@@ -524,7 +524,7 @@
try {
cancelRequest(reqId);
} catch (TeiidComponentException err) {
- LogManager.logWarning(LogConstants.CTX_DQP, err, "Failed to cancel " + reqId); //$NON-NLS-1$
+ LogManager.logWarning(LogConstants.CTX_DQP, err, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID30026,reqId));
}
}
}
@@ -532,7 +532,7 @@
try {
transactionService.cancelTransactions(sessionId, false);
} catch (XATransactionException err) {
- LogManager.logWarning(LogConstants.CTX_DQP, "rollback failed for requestID=" + sessionId); //$NON-NLS-1$
+ LogManager.logWarning(LogConstants.CTX_DQP, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID30005,sessionId));
}
}
@@ -653,7 +653,7 @@
this.maxActivePlans = config.getMaxActivePlans();
if (this.maxActivePlans > config.getMaxThreads()) {
- LogManager.logWarning(LogConstants.CTX_DQP, QueryPlugin.Util.getString("DQPCore.invalid_max_active_plan", this.maxActivePlans, config.getMaxThreads())); //$NON-NLS-1$
+ LogManager.logWarning(LogConstants.CTX_DQP, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID30006, this.maxActivePlans, config.getMaxThreads()));
this.maxActivePlans = config.getMaxThreads();
}
Modified: trunk/engine/src/main/java/org/teiid/dqp/internal/process/LobWorkItem.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/dqp/internal/process/LobWorkItem.java 2012-01-10 17:28:44 UTC (rev 3784)
+++ trunk/engine/src/main/java/org/teiid/dqp/internal/process/LobWorkItem.java 2012-01-11 19:18:32 UTC (rev 3785)
@@ -75,7 +75,7 @@
chunk = stream.getNextChunk();
shouldClose = chunk.isLast();
} catch (TeiidComponentException e) {
- LogManager.logWarning(org.teiid.logging.LogConstants.CTX_DQP, e, QueryPlugin.Util.getString("ProcessWorker.LobError")); //$NON-NLS-1$
+ LogManager.logWarning(org.teiid.logging.LogConstants.CTX_DQP, e, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID30027));
ex = e;
} catch (IOException e) {
ex = e;
@@ -102,7 +102,7 @@
stream.close();
}
} catch (IOException e) {
- LogManager.logWarning(org.teiid.logging.LogConstants.CTX_DQP, e, QueryPlugin.Util.getString("ProcessWorker.LobError")); //$NON-NLS-1$
+ LogManager.logWarning(org.teiid.logging.LogConstants.CTX_DQP, e, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID30027));
}
parent.removeLobStream(streamRequestId);
}
Modified: trunk/engine/src/main/java/org/teiid/dqp/internal/process/RequestWorkItem.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/dqp/internal/process/RequestWorkItem.java 2012-01-10 17:28:44 UTC (rev 3784)
+++ trunk/engine/src/main/java/org/teiid/dqp/internal/process/RequestWorkItem.java 2012-01-11 19:18:32 UTC (rev 3785)
@@ -343,9 +343,9 @@
} else {
elem = cause.getMessage();
}
- LogManager.logWarning(LogConstants.CTX_DQP, QueryPlugin.Util.getString("ProcessWorker.processing_error", e.getMessage(), requestID, e.getClass().getName(), elem)); //$NON-NLS-1$
- }else {
- LogManager.logError(LogConstants.CTX_DQP, e, QueryPlugin.Util.getString("ProcessWorker.error", requestID)); //$NON-NLS-1$
+ LogManager.logWarning(LogConstants.CTX_DQP, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID30020, e.getMessage(), requestID, e.getClass().getName(), elem));
+ } else {
+ LogManager.logError(LogConstants.CTX_DQP, e, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID30019, requestID));
}
}
@@ -460,7 +460,7 @@
try {
this.transactionService.rollback(transactionContext);
} catch (XATransactionException e1) {
- LogManager.logWarning(LogConstants.CTX_DQP, e1, QueryPlugin.Util.getString("ProcessWorker.failed_rollback")); //$NON-NLS-1$
+ LogManager.logWarning(LogConstants.CTX_DQP, e1, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID30028));
}
} else {
suspend();
@@ -612,7 +612,7 @@
}
if (determinismLevel.compareTo(Determinism.SESSION_DETERMINISTIC) <= 0) {
- LogManager.logInfo(LogConstants.CTX_DQP, QueryPlugin.Util.getString("RequestWorkItem.cache_nondeterministic", originalCommand)); //$NON-NLS-1$
+ LogManager.logInfo(LogConstants.CTX_DQP, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID30008, originalCommand));
}
dqpCore.getRsCache().put(cid, determinismLevel, cr, originalCommand.getCacheHint() != null?originalCommand.getCacheHint().getTtl():null);
}
@@ -942,7 +942,7 @@
try {
requestCancel();
} catch (TeiidComponentException e) {
- LogManager.logWarning(LogConstants.CTX_DQP, e, "Failed to cancel " + requestID); //$NON-NLS-1$
+ LogManager.logWarning(LogConstants.CTX_DQP, e, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID30026,requestID));
}
}
Modified: trunk/engine/src/main/java/org/teiid/dqp/internal/process/ThreadReuseExecutor.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/dqp/internal/process/ThreadReuseExecutor.java 2012-01-10 17:28:44 UTC (rev 3784)
+++ trunk/engine/src/main/java/org/teiid/dqp/internal/process/ThreadReuseExecutor.java 2012-01-11 19:18:32 UTC (rev 3785)
@@ -240,7 +240,7 @@
@Override
protected void afterExecute(Runnable r, Throwable t) {
if (t != null) {
- LogManager.logError(LogConstants.CTX_RUNTIME, t, QueryPlugin.Util.getString("WorkerPool.uncaughtException")); //$NON-NLS-1$
+ LogManager.logError(LogConstants.CTX_RUNTIME, t, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID30021));
}
}
@@ -305,7 +305,7 @@
if (success) {
long warnTime = warnWaitTime;
if (r != null && System.currentTimeMillis() - r.getCreationTime() > warnTime) {
- LogManager.logWarning(LogConstants.CTX_RUNTIME, QueryPlugin.Util.getString("WorkerPool.Max_thread", maximumPoolSize, poolName, highestQueueSize, warnTime)); //$NON-NLS-1$
+ LogManager.logWarning(LogConstants.CTX_RUNTIME, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID30009, maximumPoolSize, poolName, highestQueueSize, warnTime));
warnWaitTime*=2; //we don't really care if this is synchronized
}
}
Modified: trunk/engine/src/main/java/org/teiid/query/QueryPlugin.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/QueryPlugin.java 2012-01-10 17:28:44 UTC (rev 3784)
+++ trunk/engine/src/main/java/org/teiid/query/QueryPlugin.java 2012-01-11 19:18:32 UTC (rev 3785)
@@ -41,4 +41,39 @@
public static final BundleUtil Util = new BundleUtil(PLUGIN_ID,
PLUGIN_ID + ".i18n", ResourceBundle.getBundle(PLUGIN_ID + ".i18n")); //$NON-NLS-1$ //$NON-NLS-2$
+
+
+ public static enum Event implements BundleUtil.Event{
+ TEIID30001, // buffer manager max block exceeded
+ TEIID30002, // error persisting buffer manager
+ TEIID30003, // capability required
+ TEIID30004, // zero size batch
+ TEIID30005, // rollback failed
+ TEIID30006, // invalid max active plans
+ TEIID30007, // general process worker error
+ TEIID30008, // request not deterministic
+ TEIID30009, // max threads exceeded
+ TEIID30010, // duplicate function
+ TEIID30011, // dependent criteria over max
+ TEIID30012, // mat row refresh
+ TEIID30013, // mat table loading
+ TEIID30014, // mat table loaded
+ TEIID30015, //faild to load mat table
+ TEIID30016, // error transfer
+ TEIID30017, // error persisting batch in bm
+ TEIID30018,
+ TEIID30019, // process worker error
+ TEIID30020, // process worker error
+ TEIID30021, // uncaught exception during work
+ TEIID30022, // error defrag
+ TEIID30023, // error defrag truncate
+ TEIID30024, // cancel request failed
+ TEIID30025, // failed to restore results
+ TEIID30026, // failed to cancel
+ TEIID30027, // lob error
+ TEIID30028, // failed to rollback
+ TEIID30029, // unexpected format
+ TEIID30030, // unexpected exp1
+ TEIID30031, // unexpected exp2
+ }
}
Modified: trunk/engine/src/main/java/org/teiid/query/function/FunctionTree.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/function/FunctionTree.java 2012-01-10 17:28:44 UTC (rev 3784)
+++ trunk/engine/src/main/java/org/teiid/query/function/FunctionTree.java 2012-01-11 19:18:32 UTC (rev 3785)
@@ -104,7 +104,7 @@
// Add to tree
addFunction(name, source, method);
} else if (!CoreConstants.SYSTEM_MODEL.equalsIgnoreCase(name)) {
- LogManager.logWarning(LogConstants.CTX_FUNCTION_TREE, QueryPlugin.Util.getString("ERR.015.001.0046", new Object[]{method})); //$NON-NLS-1$
+ LogManager.logWarning(LogConstants.CTX_FUNCTION_TREE, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID30011, new Object[]{method}));
}
}
}
Modified: trunk/engine/src/main/java/org/teiid/query/optimizer/relational/rules/NewCalculateCostUtil.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/optimizer/relational/rules/NewCalculateCostUtil.java 2012-01-10 17:28:44 UTC (rev 3784)
+++ trunk/engine/src/main/java/org/teiid/query/optimizer/relational/rules/NewCalculateCostUtil.java 2012-01-11 19:18:32 UTC (rev 3785)
@@ -980,8 +980,8 @@
costMultiple = 0;
}
cost = childCost * costMultiple;
- }catch(IllegalArgumentException e) {
- LogManager.logWarning(LogConstants.CTX_QUERY_PLANNER, e, QueryPlugin.Util.getString("NewCalculateCostUtil.badCost")); //$NON-NLS-1$
+ } catch(IllegalArgumentException e) {
+ LogManager.logWarning(LogConstants.CTX_QUERY_PLANNER, e, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID30029));
// If we were unable to parse the timestamp we will revert to the divide by three estimate
if (unknownChildCost) {
return UNKNOWN_VALUE;
Modified: trunk/engine/src/main/java/org/teiid/query/processor/relational/DependentCriteriaProcessor.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/processor/relational/DependentCriteriaProcessor.java 2012-01-10 17:28:44 UTC (rev 3784)
+++ trunk/engine/src/main/java/org/teiid/query/processor/relational/DependentCriteriaProcessor.java 2012-01-11 19:18:32 UTC (rev 3785)
@@ -109,7 +109,7 @@
last = next;
}
if (!setState.overMax && distinctCount > setState.maxNdv) {
- LogManager.logWarning(LogConstants.CTX_DQP, QueryPlugin.Util.getString("DependentCriteriaProcessor.dep_join_backoff", valueSource, setState.valueExpression, setState.maxNdv)); //$NON-NLS-1$
+ LogManager.logWarning(LogConstants.CTX_DQP, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID30011, valueSource, setState.valueExpression, setState.maxNdv));
setState.overMax = true;
}
}
Modified: trunk/engine/src/main/java/org/teiid/query/processor/xml/XMLPlan.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/processor/xml/XMLPlan.java 2012-01-10 17:28:44 UTC (rev 3784)
+++ trunk/engine/src/main/java/org/teiid/query/processor/xml/XMLPlan.java 2012-01-11 19:18:32 UTC (rev 3785)
@@ -387,9 +387,7 @@
try{
return "XMLPlan:\n" + ProgramUtil.programToString(this.originalProgram); //$NON-NLS-1$
} catch (Exception e){
- e.printStackTrace();
- LogManager.logWarning(LogConstants.CTX_XML_PLAN, e,
- QueryPlugin.Util.getString("ERR.015.006.0001")); //$NON-NLS-1$
+ LogManager.logWarning(LogConstants.CTX_XML_PLAN, e, QueryPlugin.Util.getString("ERR.015.006.0001")); //$NON-NLS-1$
}
return "XMLPlan"; //$NON-NLS-1$
}
Modified: trunk/engine/src/main/java/org/teiid/query/tempdata/TempTableDataManager.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/tempdata/TempTableDataManager.java 2012-01-10 17:28:44 UTC (rev 3784)
+++ trunk/engine/src/main/java/org/teiid/query/tempdata/TempTableDataManager.java 2012-01-11 19:18:32 UTC (rev 3785)
@@ -302,7 +302,7 @@
throw new QueryProcessingException(QueryPlugin.Util.getString("TempTableDataManager.row_refresh_updatable", matViewName)); //$NON-NLS-1$
}
Constant key = (Constant)proc.getParameter(2).getExpression();
- LogManager.logInfo(LogConstants.CTX_MATVIEWS, QueryPlugin.Util.getString("TempTableDataManager.row_refresh", matViewName, key)); //$NON-NLS-1$
+ LogManager.logInfo(LogConstants.CTX_MATVIEWS, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID30012, matViewName, key));
Object id = ids.iterator().next();
String targetTypeName = metadata.getElementType(id);
Object value = DataTypeManager.transformValue(key.getValue(), DataTypeManager.getDataTypeClass(targetTypeName));
@@ -432,7 +432,7 @@
private int loadGlobalTable(CommandContext context,
GroupSymbol group, final String tableName, GlobalTableStore globalStore)
throws TeiidComponentException, TeiidProcessingException {
- LogManager.logInfo(LogConstants.CTX_MATVIEWS, QueryPlugin.Util.getString("TempTableDataManager.loading", tableName)); //$NON-NLS-1$
+ LogManager.logInfo(LogConstants.CTX_MATVIEWS, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID30013, tableName));
QueryMetadataInterface metadata = context.getMetadata();
List<ElementSymbol> allColumns = ResolverUtil.resolveElementsInGroup(group, metadata);
TempTable table = globalStore.createMatTable(tableName, group);
@@ -463,17 +463,17 @@
table.setUpdatable(hint.isUpdatable());
}
} catch (TeiidComponentException e) {
- LogManager.logError(LogConstants.CTX_MATVIEWS, e, QueryPlugin.Util.getString("TempTableDataManager.failed_load", tableName)); //$NON-NLS-1$
+ LogManager.logError(LogConstants.CTX_MATVIEWS, e, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID30015, tableName));
throw e;
} catch (TeiidProcessingException e) {
- LogManager.logError(LogConstants.CTX_MATVIEWS, e, QueryPlugin.Util.getString("TempTableDataManager.failed_load", tableName)); //$NON-NLS-1$
+ LogManager.logError(LogConstants.CTX_MATVIEWS, e, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID30015, tableName));
throw e;
} finally {
if (rowCount == -1) {
globalStore.failedLoad(tableName);
} else {
globalStore.loaded(tableName, table);
- LogManager.logInfo(LogConstants.CTX_MATVIEWS, QueryPlugin.Util.getString("TempTableDataManager.loaded", tableName, rowCount)); //$NON-NLS-1$
+ LogManager.logInfo(LogConstants.CTX_MATVIEWS, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID30014, tableName, rowCount));
}
}
return rowCount;
Modified: trunk/engine/src/main/java/org/teiid/query/util/CommandContext.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/util/CommandContext.java 2012-01-10 17:28:44 UTC (rev 3784)
+++ trunk/engine/src/main/java/org/teiid/query/util/CommandContext.java 2012-01-11 19:18:32 UTC (rev 3785)
@@ -663,7 +663,7 @@
try {
reusableExecution.dispose();
} catch (Exception e) {
- LogManager.logWarning(LogConstants.CTX_DQP, e, "Unhandled exception disposing reusable execution"); //$NON-NLS-1$
+ LogManager.logWarning(LogConstants.CTX_DQP, e, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID30030));
}
}
this.globalState.reusableExecutions.clear();
@@ -673,7 +673,7 @@
try {
listener.commandClosed(this);
} catch (Exception e) {
- LogManager.logWarning(LogConstants.CTX_DQP, e, "Unhandled exception calling CommandListener"); //$NON-NLS-1$
+ LogManager.logWarning(LogConstants.CTX_DQP, e, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID30031));
}
}
this.globalState.commandListeners.clear();
Modified: trunk/engine/src/main/resources/org/teiid/query/i18n.properties
===================================================================
--- trunk/engine/src/main/resources/org/teiid/query/i18n.properties 2012-01-10 17:28:44 UTC (rev 3784)
+++ trunk/engine/src/main/resources/org/teiid/query/i18n.properties 2012-01-11 19:18:32 UTC (rev 3785)
@@ -39,7 +39,7 @@
ERR.015.001.0042 = Illegal argument for formating: {0}
ERR.015.001.0043 = Parse Exception occurs for executing: {0} {1}
ERR.015.001.0044 = Function metadata source is of invalid type: {0}
-ERR.015.001.0046 = The function "{0}" will not be added because a function with the same name and signature already exists.
+TEIID30011 = The function "{0}" will not be added because a function with the same name and signature already exists.
ERR.015.001.0047 = Unexpected exception while loading "{1}.{2}" for UDF "{0}"
FunctionTree.not_void = UDF "{0}" method "{1}" must not return void.
FunctionTree.not_public = UDF "{0}" method "{1}" must be public.
@@ -747,10 +747,10 @@
QueryUtil.Error_executing_conversion_function_to_convert_value=Error converting parameter number {0} with value "{1}" to expected type {2}.
InsertResolver.cant_convert_query_type=Cannot convert insert query expression projected symbol ''{0}'' of type {1} to insert column ''{2}'' of type {3}
SetClause.resolvingError=Cannot set symbol ''{1}'' with expected type {2} to expression ''{0}''
-NewCalculateCostUtil.badCost=Unexpected format encountered for max or min value
+TEIID30029=Unexpected format encountered for max or min value
-WorkerPool.Max_thread=Reached maximum thread count "{0}" for worker pool "{1}" with a queue size high of "{2}". Queued work waited {3} ms prior to executing. To avoid queuing of work you may consider increasing "max-threads" or decreasing the "max-active-plans" in the "standalone-teiid.xml" file.
-WorkerPool.uncaughtException=Uncaught exception processing work
+TEIID30009=Reached maximum thread count "{0}" for worker pool "{1}" with a queue size high of "{2}". Queued work waited {3} ms prior to executing. To avoid queuing of work you may consider increasing "max-threads" or decreasing the "max-active-plans" in the "standalone-teiid.xml" file.
+TEIID30021=Uncaught exception processing work
TempTable.duplicate_key=Duplicate key
@@ -821,15 +821,15 @@
XMLTableNode.path_error=Error evaluating XMLTable column path expression for column: {0}
XMLTableName.multi_value=Unexpected multi-valued result was returned for XMLTable column "{0}". Path expressions for non-XML type columns should return at most a single result.
-TempTableDataManager.failed_load=Failed to load materialized view table {0}.
-TempTableDataManager.loaded=Loaded materialized view table {0} with row count {1}.
-TempTableDataManager.loading=Loading materialized view table {0}
+TEIID30015=Failed to load materialized view table {0}.
+TEIID30014=Loaded materialized view table {0} with row count {1}.
+TEIID30013=Loading materialized view table {0}
TempTableDataManager.cache_load=Loaded materialized view table {0} from cached contents from another clustered node.
TempTableDataManager.not_implicit_matview={0} does not target an internal materialized view.
TempTableDataManager.row_refresh_pk=Materialized view {0} cannot have a row refreshed since there is no primary key.
TempTableDataManager.row_refresh_composite=Materialized view {0} cannot have a row refreshed because it uses a composite key.
TempTableDataManager.row_refresh_updatable=Materialized view {0} cannot have a row refreshed because it's cache hint did not specify \"updatable\".
-TempTableDataManager.row_refresh=Refreshing row {1} for materialized view {0}.
+TEIID30012=Refreshing row {1} for materialized view {0}.
CriteriaPlanner.no_context=No root node found.
BasicInterceptor.ProcessTree_for__4=ProcessTree for
@@ -841,7 +841,8 @@
Cancel_request_failed=AtomicRequest {0} failed to cancel.
ConnectorWorker.MaxResultRowsExceed=The number of result rows has exceeded the maximum result rows "{0}"
-ConnectorWorker.zero_size_non_last_batch=Connector returned a 0 row non-last batch: {0}.
+TEIID30004=Connector returned a 0 row non-last batch: {0}.
+TEIID30005=rollback failed for requestID={0}
ConnectorWorker.process_failed=Connector worker process failed for atomic-request={0}
ConnectorWorker.ConnectorWorker_result_set_unexpected_columns=Could not process stored procedure results for {0}. Expected {1} result set columns, but was {2}. Please update your models to allow for stored procedure results batching.
@@ -858,11 +859,11 @@
DQPCore.The_request_has_been_closed.=The request {0} has been closed.
DQPCore.The_atomic_request_has_been_cancelled=The atomic request {0} has been canceled.
DQPCore.failed_to_cancel=Failed to Cancel request, as request already finished processing
-DQPCore.invalid_max_active_plan=The maxActivePlan {0} setting should never be greater than the max processing threads {1}.
+TEIID30006=The maxActivePlan {0} setting should never be greater than the max processing threads {1}.
-ProcessWorker.failed_rollback=Failed to properly rollback autowrap transaction properly
-ProcessWorker.error=Unexpected exception for request {0}
-ProcessWorker.processing_error=Processing exception ''{0}'' for request {1}. Exception type {2} thrown from {3}. Enable more detailed logging to see the entire stacktrace.
+TEIID30028=Failed to properly rollback autowrap transaction properly
+TEIID30019=Unexpected exception for request {0}
+TEIID30020=Processing exception ''{0}'' for request {1}. Exception type {2} thrown from {3}. Enable more detailed logging to see the entire stacktrace.
# #query (018.005)
@@ -875,7 +876,7 @@
Request.result_set=The query does not return an update count.
ProcessWorker.wrongdata=Wrong type of data found or no data found; expecting streamable object from the buffer manager.
-ProcessWorker.LobError=An error occurred during streaming of Lob Chunks to Client.
+TEIID30027=An error occurred during streaming of Lob Chunks to Client.
TransactionServer.existing_transaction=Client thread already involved in a transaction. Transaction nesting is not supported. The current transaction must be completed first.
TransactionServer.no_transaction=No transaction found for client {0}.
@@ -912,9 +913,9 @@
translator_not_found=Translator {0} not accessible.
datasource_not_found=Data Source {0} not accessible.
-RequestWorkItem.cache_nondeterministic=Caching command "{0}" at a session level, but less deterministic functions were evaluated.
+TEIID30008=Caching command "{0}" at a session level, but less deterministic functions were evaluated.
not_found_cache=Failed to restore results, since batch entries were missing. The entry will be re-populated.
-unexpected_exception_restoring_results=Failed to restore results. The entry will be re-populated.
+TEIID30025=Failed to restore results. The entry will be re-populated.
failed_to_cache=Failed to store the result set contents to disk.
failed_to_unwrap_connection=Failed to unwrap the source connection.
connection_factory_not_found=Failed to find the Connection Factory with JNDI name {0}. Please check the name or deploy the Connection Factory with specified name.
@@ -939,9 +940,19 @@
error_refresh=error occurred during refreshing the materialized view entries for view {0}
-support_required=Without required support property {0}, pushdown will not be enabled for {1} on translator {2}.
+TEIID30003=Without required support property {0}, pushdown will not be enabled for {1} on translator {2}.
full_state_not_supported=Full state transfer is not supported in the resultset cache distribution
RuleAssignOutputElements.couldnt_push_expression=Expression(s) {0} cannot be pushed to source.
RuleAssignOutputElements.cannot_introduce_expressions=Cannot introduce new expressions {1} in duplicate removal.
-DependentCriteriaProcessor.dep_join_backoff=Not performing dependent join using source {0}, since the number of distinct rows for expression {1} exceeds {2}. You should ensure that your source statistics, including column distinct value counts, accurately reflect the source or use a MAKE_DEP hint to force the join.
\ No newline at end of file
+TEIID30011=Not performing dependent join using source {0}, since the number of distinct rows for expression {1} exceeds {2}. You should ensure that your source statistics, including column distinct value counts, accurately reflect the source or use a MAKE_DEP hint to force the join.
+TEIID30001=Max block number exceeded. Increase the maxStorageObjectSize to support larger storage objects. Alternatively you could make the processor batch size smaller.
+TEIID30002=Error persisting, attempts to read {0} later will result in an exception.
+TEIID30016=Error transferring block to storage {0}
+TEIID30017=Error persisting batch, attempts to read batch {0} later will result in an exception
+TEIID30018=Error processing cancellation task.
+TEIID30022=Error performing defrag
+TEIID30023=Error performing defrag truncate
+TEIID30026=Failed to cancel {0}
+TEIID30030=Unhandled exception disposing reusable execution
+TEIID30031=Unhandled exception calling CommandListener
Copied: trunk/jboss-integration/src/main/java/org/teiid/cache/jboss/JBossCache.java (from rev 3777, trunk/cache-jbosscache/src/main/java/org/teiid/cache/jboss/JBossCache.java)
===================================================================
--- trunk/jboss-integration/src/main/java/org/teiid/cache/jboss/JBossCache.java (rev 0)
+++ trunk/jboss-integration/src/main/java/org/teiid/cache/jboss/JBossCache.java 2012-01-11 19:18:32 UTC (rev 3785)
@@ -0,0 +1,89 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+
+package org.teiid.cache.jboss;
+
+import java.util.Set;
+import java.util.concurrent.TimeUnit;
+
+import org.teiid.cache.Cache;
+
+
+/**
+ * Implementation of Cache using Infinispan
+ */
+public class JBossCache<K, V> implements Cache<String, V> {
+
+ protected org.infinispan.Cache<String, V> cacheStore;
+ private final String name;
+
+ public JBossCache(org.infinispan.Cache<String, V> cacheStore, String cacheName) {
+ this.cacheStore = cacheStore;
+ this.name = cacheName;
+ }
+
+ private String fqn(String key) {
+ return this.name+"."+key; //$NON-NLS-1$
+ }
+
+ @Override
+ public V get(String key) {
+ return this.cacheStore.get(fqn(key));
+ }
+
+ public V put(String key, V value) {
+ return this.cacheStore.put(fqn(key), value);
+ }
+
+ @Override
+ public V put(String key, V value, Long ttl) {
+ if (ttl != null) {
+ return this.cacheStore.put(fqn(key), value, ttl, TimeUnit.MILLISECONDS);
+ }
+ return this.cacheStore.put(fqn(key), value);
+ }
+
+ @Override
+ public V remove(String key) {
+ return this.cacheStore.remove(fqn(key));
+ }
+
+ @Override
+ public int size() {
+ return this.cacheStore.size();
+ }
+
+ @Override
+ public void clear() {
+ this.cacheStore.clear();
+ }
+
+ @Override
+ public String getName() {
+ return this.name;
+ }
+
+ @Override
+ public Set<String> keys() {
+ return this.cacheStore.keySet();
+ }
+}
Copied: trunk/jboss-integration/src/main/java/org/teiid/cache/jboss/JBossCacheFactory.java (from rev 3777, trunk/cache-jbosscache/src/main/java/org/teiid/cache/jboss/JBossCacheFactory.java)
===================================================================
--- trunk/jboss-integration/src/main/java/org/teiid/cache/jboss/JBossCacheFactory.java (rev 0)
+++ trunk/jboss-integration/src/main/java/org/teiid/cache/jboss/JBossCacheFactory.java 2012-01-11 19:18:32 UTC (rev 3785)
@@ -0,0 +1,71 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+
+package org.teiid.cache.jboss;
+
+import java.io.Serializable;
+
+import org.infinispan.manager.CacheContainer;
+import org.teiid.cache.Cache;
+import org.teiid.cache.CacheConfiguration;
+import org.teiid.cache.CacheFactory;
+import org.teiid.core.TeiidRuntimeException;
+
+
+public class JBossCacheFactory implements CacheFactory, Serializable{
+ private static final long serialVersionUID = -2767452034178675653L;
+ private transient org.infinispan.Cache cacheStore;
+ private volatile boolean destroyed = false;
+
+
+ public JBossCacheFactory(String name, CacheContainer cm) {
+ if (name != null) {
+ this.cacheStore = cm.getCache(name);
+ }
+ else {
+ this.cacheStore = cm.getCache();
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public Cache get(String location, CacheConfiguration config) {
+ if (!destroyed) {
+ return new JBossCache(this.cacheStore, config.getLocation());
+ }
+ throw new TeiidRuntimeException("Cache system has been shutdown"); //$NON-NLS-1$
+ }
+
+ public void destroy() {
+ this.destroyed = true;
+ }
+
+ public void stop() {
+ destroy();
+ }
+
+ @Override
+ public boolean isReplicated() {
+ return true;
+ }
+}
Modified: trunk/jboss-integration/src/main/java/org/teiid/jboss/DQPCoreService.java
===================================================================
--- trunk/jboss-integration/src/main/java/org/teiid/jboss/DQPCoreService.java 2012-01-10 17:28:44 UTC (rev 3784)
+++ trunk/jboss-integration/src/main/java/org/teiid/jboss/DQPCoreService.java 2012-01-11 19:18:32 UTC (rev 3785)
@@ -140,7 +140,7 @@
}
});
- LogManager.logInfo(LogConstants.CTX_RUNTIME, IntegrationPlugin.Util.getString("engine_started", this.dqpCore.getRuntimeVersion(), new Date(System.currentTimeMillis()).toString())); //$NON-NLS-1$
+ LogManager.logInfo(LogConstants.CTX_RUNTIME, IntegrationPlugin.Util.gs(IntegrationPlugin.Event.TEIID50001, this.dqpCore.getRuntimeVersion(), new Date(System.currentTimeMillis()).toString()));
}
@Override
@@ -156,7 +156,7 @@
// this bean is already shutdown
}
- LogManager.logInfo(LogConstants.CTX_RUNTIME, IntegrationPlugin.Util.getString("engine_stopped", new Date(System.currentTimeMillis()).toString())); //$NON-NLS-1$
+ LogManager.logInfo(LogConstants.CTX_RUNTIME, IntegrationPlugin.Util.gs(IntegrationPlugin.Event.TEIID50002, new Date(System.currentTimeMillis()).toString()));
}
public void setBufferService(BufferService service) {
Modified: trunk/jboss-integration/src/main/java/org/teiid/jboss/EventDistributorFactoryService.java
===================================================================
--- trunk/jboss-integration/src/main/java/org/teiid/jboss/EventDistributorFactoryService.java 2012-01-10 17:28:44 UTC (rev 3784)
+++ trunk/jboss-integration/src/main/java/org/teiid/jboss/EventDistributorFactoryService.java 2012-01-11 19:18:32 UTC (rev 3785)
@@ -70,9 +70,9 @@
try {
this.replicatableEventDistributor = objectReplicatorInjector.getValue().replicate(LocalServerConnection.TEIID_RUNTIME_CONTEXT, EventDistributor.class, ed, 0);
} catch (Exception e) {
- LogManager.logError(LogConstants.CTX_RUNTIME, e, IntegrationPlugin.Util.getString("replication_failed", this)); //$NON-NLS-1$
+ LogManager.logError(LogConstants.CTX_RUNTIME, e, IntegrationPlugin.Util.gs(IntegrationPlugin.Event.TEIID50004, this));
}
- LogManager.logInfo(LogConstants.CTX_RUNTIME, IntegrationPlugin.Util.getString("distributed_cache_enabled")); //$NON-NLS-1$
+ LogManager.logInfo(LogConstants.CTX_RUNTIME, IntegrationPlugin.Util.gs(IntegrationPlugin.Event.TEIID50003));
}
else {
LogManager.logDetail(LogConstants.CTX_RUNTIME, IntegrationPlugin.Util.getString("distributed_cache_not_enabled")); //$NON-NLS-1$
Modified: trunk/jboss-integration/src/main/java/org/teiid/jboss/IntegrationPlugin.java
===================================================================
--- trunk/jboss-integration/src/main/java/org/teiid/jboss/IntegrationPlugin.java 2012-01-10 17:28:44 UTC (rev 3784)
+++ trunk/jboss-integration/src/main/java/org/teiid/jboss/IntegrationPlugin.java 2012-01-11 19:18:32 UTC (rev 3785)
@@ -37,5 +37,53 @@
locale = Locale.getDefault();
}
return ResourceBundle.getBundle(IntegrationPlugin.BUNDLE_NAME, locale);
- }
+ }
+
+ public static enum Event implements BundleUtil.Event {
+ TEIID50001,
+ TEIID50002,
+ TEIID50003,
+ TEIID50004,
+ TEIID50005,
+ TEIID50006,
+ TEIID50007, // failed to load module
+ TEIID50008,
+ TEIID50009,
+ TEIID50010,
+ TEIID50011,
+ TEIID50012, // socket enabled
+ TEIID50013, // Wrong socket protocol
+ TEIID50014, // socket disabled
+ TEIID50015, // admin max sessions
+ TEIID50016, // invalid vdb file
+ TEIID50017, // vdb.xml parse exception
+ TEIID50018, // failed VDB dependency processing
+ TEIID50019, // redeploying VDB
+ TEIID50020, // replication error failed to pull
+ TEIID50021, // vdb defined translator not found
+ TEIID50022, // replication error timeout during the pull
+ TEIID50023, // replication failed
+ TEIID50024, // failed metadata load
+ TEIID50025, // VDB deployed
+ TEIID50026, // VDB undeployed
+ TEIID50027, // metadata in-process of loading
+ TEIID50028, // failed metadata loading
+ TEIID50029, // dynamic metadata loaded
+ TEIID50030, // no sources to retrieve data
+ TEIID50031, // failed to load cached index files
+ TEIID50032, // duplicate VDB
+ TEIID50033, // duplicate source name in vdb
+ TEIID50034, // Source name mismatch
+ TEIID50035, // translator not found
+ TEIID50036, // failed to retrive metadata
+ TEIID50037, // odbc enabled
+ TEIID50038, // embedded enabled
+ TEIID50039, // socket_disabled
+ TEIID50040, // odbc_disabled
+ TEIID50041, // embedded disabled
+ TEIID50042, // error state
+ TEIID50043,
+ TEIID50044, // vdb save failed
+
+ }
}
Added: trunk/jboss-integration/src/main/java/org/teiid/jboss/JBossLogger.java
===================================================================
--- trunk/jboss-integration/src/main/java/org/teiid/jboss/JBossLogger.java (rev 0)
+++ trunk/jboss-integration/src/main/java/org/teiid/jboss/JBossLogger.java 2012-01-11 19:18:32 UTC (rev 3785)
@@ -0,0 +1,112 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+
+package org.teiid.jboss;
+
+import org.jboss.logging.Logger;
+import org.jboss.logging.Logger.Level;
+import org.teiid.logging.MessageLevel;
+
+public class JBossLogger implements org.teiid.logging.Logger {
+
+ @Override
+ public boolean isEnabled(String context, int level) {
+ if ( context == null ) {
+ return false;
+ }
+ Level logLevel = convert2JbossLevel(level);
+ Logger log = getLogger(context);
+ return log.isEnabled(logLevel);
+ }
+
+ @Override
+ public void log(int level, String context, Object msg) {
+ Logger logger = getLogger(context);
+ logger.log(convert2JbossLevel(level), msg);
+ }
+
+ @Override
+ public void log(int level, String context, Throwable t, Object msg) {
+ Logger logger = getLogger(context);
+ logger.log(convert2JbossLevel(level), msg, t);
+ }
+
+ /**
+ * Convert {@link MessageLevel} to {@link Level}
+ * @param level
+ * @return
+ */
+ public static Level convert2JbossLevel(int level) {
+ switch (level) {
+ case MessageLevel.CRITICAL:
+ return Level.FATAL;
+ case MessageLevel.ERROR:
+ return Level.ERROR;
+ case MessageLevel.WARNING:
+ return Level.WARN;
+ case MessageLevel.INFO:
+ return Level.INFO;
+ case MessageLevel.DETAIL:
+ return Level.DEBUG;
+ case MessageLevel.TRACE:
+ return Level.TRACE;
+ }
+ return Level.DEBUG;
+ }
+
+ /**
+ * Convert {@link Level} to {@link MessageLevel}
+ * @param level
+ * @return
+ */
+ public static int convert2MessageLevel(Level level) {
+ switch (level) {
+ case FATAL:
+ return MessageLevel.CRITICAL;
+ case ERROR:
+ return MessageLevel.ERROR;
+ case WARN:
+ return MessageLevel.WARNING;
+ case INFO:
+ return MessageLevel.INFO;
+ case DEBUG:
+ return MessageLevel.DETAIL;
+ case TRACE:
+ return MessageLevel.NONE;
+ }
+ return MessageLevel.DETAIL;
+ }
+
+ /**
+ * Get the logger for the given context.
+ * @param context
+ * @return
+ */
+ private Logger getLogger(String context) {
+ return Logger.getLogger(context);
+ }
+
+ @Override
+ public void shutdown() {
+ }
+
+}
Property changes on: trunk/jboss-integration/src/main/java/org/teiid/jboss/JBossLogger.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Deleted: trunk/jboss-integration/src/main/java/org/teiid/jboss/Log4jListener.java
===================================================================
--- trunk/jboss-integration/src/main/java/org/teiid/jboss/Log4jListener.java 2012-01-10 17:28:44 UTC (rev 3784)
+++ trunk/jboss-integration/src/main/java/org/teiid/jboss/Log4jListener.java 2012-01-11 19:18:32 UTC (rev 3785)
@@ -1,120 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package org.teiid.jboss;
-
-import org.apache.log4j.Level;
-import org.apache.log4j.Logger;
-import org.teiid.logging.MessageLevel;
-
-
-/**
- * Log4J Listener
- */
-public class Log4jListener implements org.teiid.logging.Logger {
-
- @Override
- public boolean isEnabled(String context, int level) {
- if ( context == null ) {
- return false;
- }
- Level logLevel = convert2Log4JLevel(level);
- if ( logLevel == Level.OFF) {
- return false;
- }
- Logger log = getLogger(context);
- return log.isEnabledFor(logLevel);
- }
-
- @Override
- public void log(int level, String context, Object msg) {
- Logger log4j = getLogger(context);
- log4j.log(convert2Log4JLevel(level), msg);
- }
-
- public void log(int level, String context, Throwable t, Object msg) {
- Logger log4j = getLogger(context);
- log4j.log(convert2Log4JLevel(level), msg, t);
- }
-
- /**
- * Convert {@link MessageLevel} to {@link Level}
- * @param level
- * @return
- */
- public static Level convert2Log4JLevel(int level) {
- switch (level) {
- case MessageLevel.CRITICAL:
- return Level.FATAL;
- case MessageLevel.ERROR:
- return Level.ERROR;
- case MessageLevel.WARNING:
- return Level.WARN;
- case MessageLevel.INFO:
- return Level.INFO;
- case MessageLevel.DETAIL:
- return Level.DEBUG;
- case MessageLevel.TRACE:
- return Level.TRACE;
- case MessageLevel.NONE:
- return Level.OFF;
- }
- return Level.DEBUG;
- }
-
- /**
- * Convert {@link Level} to {@link MessageLevel}
- * @param level
- * @return
- */
- public static int convert2MessageLevel(Level level) {
- switch (level.toInt()) {
- case Level.FATAL_INT:
- return MessageLevel.CRITICAL;
- case Level.ERROR_INT:
- return MessageLevel.ERROR;
- case Level.WARN_INT:
- return MessageLevel.WARNING;
- case Level.INFO_INT:
- return MessageLevel.INFO;
- case Level.DEBUG_INT:
- return MessageLevel.DETAIL;
- case Level.OFF_INT:
- return MessageLevel.NONE;
- }
- return MessageLevel.DETAIL;
- }
-
- /**
- * Get the logger for the given context.
- * @param context
- * @return
- */
- public static Logger getLogger(String context) {
- return Logger.getLogger(context);
- }
-
- @Override
- public void shutdown() {
- }
-
-}
\ No newline at end of file
Modified: trunk/jboss-integration/src/main/java/org/teiid/jboss/ObjectSerializer.java
===================================================================
--- trunk/jboss-integration/src/main/java/org/teiid/jboss/ObjectSerializer.java 2012-01-10 17:28:44 UTC (rev 3784)
+++ trunk/jboss-integration/src/main/java/org/teiid/jboss/ObjectSerializer.java 2012-01-11 19:18:32 UTC (rev 3785)
@@ -21,14 +21,19 @@
*/
package org.teiid.jboss;
-import java.io.*;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.io.OutputStream;
import org.jboss.logging.Logger;
import org.teiid.adminapi.impl.VDBMetaData;
import org.teiid.core.util.FileUtils;
import org.teiid.logging.LogConstants;
import org.teiid.logging.LogManager;
-import org.teiid.runtime.RuntimePlugin;
public class ObjectSerializer {
@@ -114,7 +119,7 @@
}
return null;
} catch (Exception e) {
- LogManager.logWarning(LogConstants.CTX_RUNTIME, e, RuntimePlugin.Util.getString("invalid_metadata_file", cacheFile.getAbsolutePath())); //$NON-NLS-1$
+ LogManager.logWarning(LogConstants.CTX_RUNTIME, e, IntegrationPlugin.Util.gs(IntegrationPlugin.Event.TEIID50043, cacheFile.getAbsolutePath()));
}
cacheFile.delete();
return null;
Modified: trunk/jboss-integration/src/main/java/org/teiid/jboss/TeiidExtension.java
===================================================================
--- trunk/jboss-integration/src/main/java/org/teiid/jboss/TeiidExtension.java 2012-01-10 17:28:44 UTC (rev 3784)
+++ trunk/jboss-integration/src/main/java/org/teiid/jboss/TeiidExtension.java 2012-01-11 19:18:32 UTC (rev 3785)
@@ -61,7 +61,7 @@
public void initialize(ExtensionContext context) {
final SubsystemRegistration registration = context.registerSubsystem(TEIID_SUBSYSTEM);
- LogManager.setLogListener(new Log4jListener());
+ LogManager.setLogListener(new JBossLogger());
registration.registerXMLElementWriter(parser);
Modified: trunk/jboss-integration/src/main/java/org/teiid/jboss/TeiidOperationHandler.java
===================================================================
--- trunk/jboss-integration/src/main/java/org/teiid/jboss/TeiidOperationHandler.java 2012-01-10 17:28:44 UTC (rev 3784)
+++ trunk/jboss-integration/src/main/java/org/teiid/jboss/TeiidOperationHandler.java 2012-01-11 19:18:32 UTC (rev 3785)
@@ -427,11 +427,11 @@
if (operation.hasDefined(OperationsConstants.VDB_NAME) && operation.hasDefined(OperationsConstants.VDB_VERSION)) {
String vdbName = operation.get(OperationsConstants.VDB_NAME).asString();
int vdbVersion = operation.get(OperationsConstants.VDB_VERSION).asInt();
- LogManager.logInfo(LogConstants.CTX_DQP, IntegrationPlugin.Util.getString("clearing_cache_vdb", cacheType, vdbName, vdbVersion)); //$NON-NLS-1$
+ LogManager.logInfo(LogConstants.CTX_DQP, IntegrationPlugin.Util.gs(IntegrationPlugin.Event.TEIID50005, cacheType, vdbName, vdbVersion));
cache.clearForVDB(vdbName, vdbVersion);
}
else {
- LogManager.logInfo(LogConstants.CTX_DQP, IntegrationPlugin.Util.getString("clearing_cache", cacheType)); //$NON-NLS-1$
+ LogManager.logInfo(LogConstants.CTX_DQP, IntegrationPlugin.Util.gs(IntegrationPlugin.Event.TEIID50005, cacheType));
cache.clearAll();
}
}
Modified: trunk/jboss-integration/src/main/java/org/teiid/jboss/TranslatorAdd.java
===================================================================
--- trunk/jboss-integration/src/main/java/org/teiid/jboss/TranslatorAdd.java 2012-01-10 17:28:44 UTC (rev 3784)
+++ trunk/jboss-integration/src/main/java/org/teiid/jboss/TranslatorAdd.java 2012-01-11 19:18:32 UTC (rev 3785)
@@ -100,7 +100,7 @@
module = ml.loadModule(ModuleIdentifier.create(moduleName));
translatorLoader = module.getClassLoader();
} catch (ModuleLoadException e) {
- throw new OperationFailedException(e, new ModelNode().set(IntegrationPlugin.Util.getString("failed_load_module", moduleName, translatorName))); //$NON-NLS-1$
+ throw new OperationFailedException(e, new ModelNode().set(IntegrationPlugin.Util.getString("failed_load_module", IntegrationPlugin.Event.TEIID50007, moduleName, translatorName))); //$NON-NLS-1$
}
}
@@ -110,12 +110,12 @@
for (ExecutionFactory ef:serviceLoader) {
VDBTranslatorMetaData metadata = TranslatorUtil.buildTranslatorMetadata(ef, moduleName);
if (metadata == null) {
- throw new OperationFailedException( new ModelNode().set(IntegrationPlugin.Util.getString("error_adding_translator", translatorName))); //$NON-NLS-1$
+ throw new OperationFailedException( new ModelNode().set(IntegrationPlugin.Util.getString("error_adding_translator", IntegrationPlugin.Event.TEIID50008, translatorName))); //$NON-NLS-1$
}
metadata.addAttchment(ClassLoader.class, translatorLoader);
if (translatorName.equalsIgnoreCase(metadata.getName())) {
- LogManager.logInfo(LogConstants.CTX_RUNTIME, IntegrationPlugin.Util.getString("translator.added", metadata.getName())); //$NON-NLS-1$
+ LogManager.logInfo(LogConstants.CTX_RUNTIME, IntegrationPlugin.Util.gs(IntegrationPlugin.Event.TEIID50006, metadata.getName()));
TranslatorService translatorService = new TranslatorService(metadata);
ServiceBuilder<VDBTranslatorMetaData> builder = target.addService(TeiidServiceNames.translatorServiceName(metadata.getName()), translatorService);
@@ -129,7 +129,7 @@
}
if (!added) {
- throw new OperationFailedException(new ModelNode().set(IntegrationPlugin.Util.getString("translator.failed-to-load", translatorName, moduleName))); //$NON-NLS-1$
+ throw new OperationFailedException(new ModelNode().set(IntegrationPlugin.Util.getString("translator.failed-to-load", IntegrationPlugin.Event.TEIID50009, translatorName, moduleName))); //$NON-NLS-1$
}
}
}
Modified: trunk/jboss-integration/src/main/java/org/teiid/jboss/TranslatorDeployer.java
===================================================================
--- trunk/jboss-integration/src/main/java/org/teiid/jboss/TranslatorDeployer.java 2012-01-10 17:28:44 UTC (rev 3784)
+++ trunk/jboss-integration/src/main/java/org/teiid/jboss/TranslatorDeployer.java 2012-01-11 19:18:32 UTC (rev 3785)
@@ -68,7 +68,7 @@
}
metadata.addAttchment(ClassLoader.class, translatorLoader);
- LogManager.logInfo(LogConstants.CTX_RUNTIME, IntegrationPlugin.Util.getString("translator.added", metadata.getName())); //$NON-NLS-1$
+ LogManager.logInfo(LogConstants.CTX_RUNTIME, IntegrationPlugin.Util.gs(IntegrationPlugin.Event.TEIID50006, metadata.getName()));
TranslatorService translatorService = new TranslatorService(metadata);
ServiceBuilder<VDBTranslatorMetaData> builder = target.addService(TeiidServiceNames.translatorServiceName(metadata.getName()), translatorService);
Modified: trunk/jboss-integration/src/main/java/org/teiid/jboss/TranslatorService.java
===================================================================
--- trunk/jboss-integration/src/main/java/org/teiid/jboss/TranslatorService.java 2012-01-10 17:28:44 UTC (rev 3784)
+++ trunk/jboss-integration/src/main/java/org/teiid/jboss/TranslatorService.java 2012-01-11 19:18:32 UTC (rev 3785)
@@ -53,7 +53,7 @@
public void stop(StopContext context) {
this.repositoryInjector.getValue().removeTranslatorMetadata(this.translator.getName());
this.statusCheckerInjector.getValue().translatorRemoved(this.translator.getName());
- LogManager.logInfo(LogConstants.CTX_RUNTIME, IntegrationPlugin.Util.getString("translator.removed", this.translator.getName())); //$NON-NLS-1$
+ LogManager.logInfo(LogConstants.CTX_RUNTIME, IntegrationPlugin.Util.gs(IntegrationPlugin.Event.TEIID50010, this.translator.getName()));
}
@Override
Modified: trunk/jboss-integration/src/main/java/org/teiid/jboss/TransportAdd.java
===================================================================
--- trunk/jboss-integration/src/main/java/org/teiid/jboss/TransportAdd.java 2012-01-10 17:28:44 UTC (rev 3784)
+++ trunk/jboss-integration/src/main/java/org/teiid/jboss/TransportAdd.java 2012-01-11 19:18:32 UTC (rev 3785)
@@ -183,7 +183,7 @@
// add security domains
for (String domain:domainList) {
- LogManager.logInfo(LogConstants.CTX_SECURITY, IntegrationPlugin.Util.getString("security_enabled", domain, transportName)); //$NON-NLS-1$
+ LogManager.logInfo(LogConstants.CTX_SECURITY, IntegrationPlugin.Util.gs(IntegrationPlugin.Event.TEIID50011, domain, transportName));
transportBuilder.addDependency(ServiceName.JBOSS.append("security", "security-domain", domain), SecurityDomainContext.class, new ConcurrentMapInjector<String,SecurityDomainContext>(transport.securityDomains, domain)); //$NON-NLS-1$ //$NON-NLS-2$
}
Modified: trunk/jboss-integration/src/main/java/org/teiid/jboss/TransportService.java
===================================================================
--- trunk/jboss-integration/src/main/java/org/teiid/jboss/TransportService.java 2012-01-10 17:28:44 UTC (rev 3784)
+++ trunk/jboss-integration/src/main/java/org/teiid/jboss/TransportService.java 2012-01-11 19:18:32 UTC (rev 3785)
@@ -132,20 +132,20 @@
}
if (protocol == Protocol.teiid) {
this.socketListener = new SocketListener(address, this.socketConfig, this.csr, getBufferServiceInjector().getValue().getBufferManager());
- LogManager.logInfo(LogConstants.CTX_RUNTIME, IntegrationPlugin.Util.getString("socket_enabled", address.getHostName(), String.valueOf(address.getPort()), (sslEnabled?"ON":"OFF"), authenticationDomains)); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ LogManager.logInfo(LogConstants.CTX_RUNTIME, IntegrationPlugin.Util.gs(IntegrationPlugin.Event.TEIID50012, address.getHostName(), String.valueOf(address.getPort()), (sslEnabled?"ON":"OFF"), authenticationDomains)); //$NON-NLS-1$ //$NON-NLS-2$
}
else if (protocol == Protocol.pg) {
getVdbRepository().odbcEnabled();
ODBCSocketListener odbc = new ODBCSocketListener(address, this.socketConfig, this.csr, getBufferServiceInjector().getValue().getBufferManager(), getMaxODBCLobSizeAllowed(), this.logon);
odbc.setAuthenticationType(this.sessionService.getAuthenticationType());
- LogManager.logInfo(LogConstants.CTX_RUNTIME, IntegrationPlugin.Util.getString("odbc_enabled", address.getHostName(), String.valueOf(address.getPort()), (sslEnabled?"ON":"OFF"), authenticationDomains)); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ LogManager.logInfo(LogConstants.CTX_RUNTIME, IntegrationPlugin.Util.gs(IntegrationPlugin.Event.TEIID50037, address.getHostName(), String.valueOf(address.getPort()), (sslEnabled?"ON":"OFF"), authenticationDomains)); //$NON-NLS-1$ //$NON-NLS-2$
}
else {
- throw new StartException(IntegrationPlugin.Util.getString("wrong_protocol")); //$NON-NLS-1$
+ throw new StartException(IntegrationPlugin.Util.gs(IntegrationPlugin.Event.TEIID50013));
}
}
else {
- LogManager.logInfo(LogConstants.CTX_RUNTIME, IntegrationPlugin.Util.getString("embedded_enabled", LocalServerConnection.TEIID_RUNTIME_CONTEXT)); //$NON-NLS-1$
+ LogManager.logInfo(LogConstants.CTX_RUNTIME, IntegrationPlugin.Util.gs(IntegrationPlugin.Event.TEIID50038, LocalServerConnection.TEIID_RUNTIME_CONTEXT));
}
DQP dqpProxy = proxyService(DQP.class, getDQP(), LogConstants.CTX_DQP);
@@ -165,14 +165,14 @@
if (this.socketConfig != null) {
Protocol protocol = Protocol.valueOf(socketConfig.getProtocol());
if (protocol == Protocol.teiid) {
- LogManager.logInfo(LogConstants.CTX_RUNTIME, IntegrationPlugin.Util.getString("socket_disabled", this.address.getHostName(), String.valueOf(this.address.getPort()))); //$NON-NLS-1$
+ LogManager.logInfo(LogConstants.CTX_RUNTIME, IntegrationPlugin.Util.gs(IntegrationPlugin.Event.TEIID50039, this.address.getHostName(), String.valueOf(this.address.getPort())));
}
else if (protocol == Protocol.pg) {
- LogManager.logInfo(LogConstants.CTX_RUNTIME, IntegrationPlugin.Util.getString("odbc_disabled", this.address.getHostName(), String.valueOf(this.address.getPort()))); //$NON-NLS-1$
+ LogManager.logInfo(LogConstants.CTX_RUNTIME, IntegrationPlugin.Util.gs(IntegrationPlugin.Event.TEIID50040, this.address.getHostName(), String.valueOf(this.address.getPort())));
}
}
else {
- LogManager.logInfo(LogConstants.CTX_RUNTIME, IntegrationPlugin.Util.getString("embedded_disabled", LocalServerConnection.TEIID_RUNTIME_CONTEXT)); //$NON-NLS-1$
+ LogManager.logInfo(LogConstants.CTX_RUNTIME, IntegrationPlugin.Util.gs(IntegrationPlugin.Event.TEIID50041, LocalServerConnection.TEIID_RUNTIME_CONTEXT));
}
}
Modified: trunk/jboss-integration/src/main/java/org/teiid/jboss/VDBDependencyDeployer.java
===================================================================
--- trunk/jboss-integration/src/main/java/org/teiid/jboss/VDBDependencyDeployer.java 2012-01-10 17:28:44 UTC (rev 3784)
+++ trunk/jboss-integration/src/main/java/org/teiid/jboss/VDBDependencyDeployer.java 2012-01-11 19:18:32 UTC (rev 3785)
@@ -75,7 +75,7 @@
ModuleRootMarker.mark(jarArchiveRoot);
deploymentUnit.addToAttachmentList(Attachments.RESOURCE_ROOTS, jarArchiveRoot);
} catch (IOException e) {
- throw new DeploymentUnitProcessingException("failed to process " + archive, e); //$NON-NLS-1$
+ throw new DeploymentUnitProcessingException(IntegrationPlugin.Event.TEIID50018.name()+IntegrationPlugin.Util.getString("failed_to_process_vdb_archive", archive), e); //$NON-NLS-1$
}
}
}
@@ -92,7 +92,7 @@
moduleSpecification.addLocalDependency(new ModuleDependency(moduleLoader, ModuleIdentifier.create("org.jboss.teiid.common-core"), false, false, false)); //$NON-NLS-1$
moduleSpecification.addLocalDependency(new ModuleDependency(moduleLoader, ModuleIdentifier.create("javax.api"), false, false, false)); //$NON-NLS-1$
} catch (ModuleLoadException e) {
- throw new DeploymentUnitProcessingException(e);
+ throw new DeploymentUnitProcessingException(IntegrationPlugin.Event.TEIID50018.name(), e);
}
}
Modified: trunk/jboss-integration/src/main/java/org/teiid/jboss/VDBDeployer.java
===================================================================
--- trunk/jboss-integration/src/main/java/org/teiid/jboss/VDBDeployer.java 2012-01-10 17:28:44 UTC (rev 3784)
+++ trunk/jboss-integration/src/main/java/org/teiid/jboss/VDBDeployer.java 2012-01-11 19:18:32 UTC (rev 3785)
@@ -81,7 +81,7 @@
// check to see if there is old vdb already deployed.
final ServiceController<?> controller = context.getServiceRegistry().getService(TeiidServiceNames.vdbServiceName(deployment.getName(), deployment.getVersion()));
if (controller != null) {
- LogManager.logInfo(LogConstants.CTX_RUNTIME, RuntimePlugin.Util.getString("redeploying_vdb", deployment)); //$NON-NLS-1$
+ LogManager.logInfo(LogConstants.CTX_RUNTIME, IntegrationPlugin.Util.gs(IntegrationPlugin.Event.TEIID50019, deployment));
controller.setMode(ServiceController.Mode.REMOVE);
}
@@ -89,7 +89,7 @@
if (!preview) {
List<String> errors = deployment.getValidityErrors();
if (errors != null && !errors.isEmpty()) {
- throw new DeploymentUnitProcessingException(RuntimePlugin.Util.getString("validity_errors_in_vdb", deployment)); //$NON-NLS-1$
+ throw new DeploymentUnitProcessingException(RuntimePlugin.Util.getString("validity_errors_in_vdb", RuntimePlugin.Event.TEIID40004, deployment)); //$NON-NLS-1$
}
}
@@ -100,7 +100,7 @@
String type = data.getType();
Translator parent = this.translatorRepository.getTranslatorMetaData(type);
if ( parent == null) {
- throw new DeploymentUnitProcessingException(RuntimePlugin.Util.getString("translator_type_not_found", deploymentName)); //$NON-NLS-1$
+ throw new DeploymentUnitProcessingException(RuntimePlugin.Util.getString("translator_type_not_found", IntegrationPlugin.Event.TEIID50021, deploymentName)); //$NON-NLS-1$
}
}
@@ -173,7 +173,7 @@
vdbService.setInitialMode(Mode.PASSIVE).install();
if (!unAvailableDS.isEmpty()) {
- LogManager.logInfo(LogConstants.CTX_RUNTIME, IntegrationPlugin.Util.getString("vdb-inactive", deployment.getName(), deployment.getVersion(), unAvailableDS)); //$NON-NLS-1$
+ LogManager.logInfo(LogConstants.CTX_RUNTIME, IntegrationPlugin.Util.gs(IntegrationPlugin.Event.TEIID50021, deployment.getName(), deployment.getVersion(), unAvailableDS));
}
}
Modified: trunk/jboss-integration/src/main/java/org/teiid/jboss/VDBParserDeployer.java
===================================================================
--- trunk/jboss-integration/src/main/java/org/teiid/jboss/VDBParserDeployer.java 2012-01-10 17:28:44 UTC (rev 3784)
+++ trunk/jboss-integration/src/main/java/org/teiid/jboss/VDBParserDeployer.java 2012-01-11 19:18:32 UTC (rev 3785)
@@ -114,9 +114,9 @@
LogManager.logDetail(LogConstants.CTX_RUNTIME,"VDB "+file.getName()+" has been parsed."); //$NON-NLS-1$ //$NON-NLS-2$
return vdb;
} catch (XMLStreamException e) {
- throw new DeploymentUnitProcessingException(e);
+ throw new DeploymentUnitProcessingException(IntegrationPlugin.Event.TEIID50017.name(), e);
} catch (IOException e) {
- throw new DeploymentUnitProcessingException(e);
+ throw new DeploymentUnitProcessingException(IntegrationPlugin.Event.TEIID50017.name(), e);
}
}
@@ -130,7 +130,7 @@
VirtualFile file = deploymentUnit.getAttachment(Attachments.DEPLOYMENT_ROOT).getRoot();
if (vdb == null) {
- LogManager.logError(LogConstants.CTX_RUNTIME, RuntimePlugin.Util.getString("invlaid_vdb_file",file.getName())); //$NON-NLS-1$
+ LogManager.logError(LogConstants.CTX_RUNTIME, RuntimePlugin.Util.gs(IntegrationPlugin.Event.TEIID50016,file.getName()));
return null;
}
@@ -158,9 +158,9 @@
}
}
} catch(IOException e) {
- throw new DeploymentUnitProcessingException(e);
+ throw new DeploymentUnitProcessingException(IntegrationPlugin.Event.TEIID50017.name(), e);
} catch (XMLStreamException e) {
- throw new DeploymentUnitProcessingException(e);
+ throw new DeploymentUnitProcessingException(IntegrationPlugin.Event.TEIID50017.name(), e);
}
LogManager.logTrace(LogConstants.CTX_RUNTIME, "VDB", file.getName(), "has been parsed."); //$NON-NLS-1$ //$NON-NLS-2$
Modified: trunk/jboss-integration/src/main/java/org/teiid/jboss/VDBService.java
===================================================================
--- trunk/jboss-integration/src/main/java/org/teiid/jboss/VDBService.java 2012-01-10 17:28:44 UTC (rev 3784)
+++ trunk/jboss-integration/src/main/java/org/teiid/jboss/VDBService.java 2012-01-11 19:18:32 UTC (rev 3785)
@@ -142,7 +142,7 @@
try {
gts = getObjectReplicatorInjector().getValue().replicate(name + version, GlobalTableStore.class, gts, 300000);
} catch (Exception e) {
- LogManager.logError(LogConstants.CTX_RUNTIME, e, IntegrationPlugin.Util.getString("replication_failed", gts)); //$NON-NLS-1$
+ LogManager.logError(LogConstants.CTX_RUNTIME, e, IntegrationPlugin.Util.gs(IntegrationPlugin.Event.TEIID50023, gts));
}
}
vdb.getVDB().addAttchment(GlobalTableStore.class, gts);
@@ -174,7 +174,7 @@
try {
store.addStore(indexFactory.getMetadataStore(getVDBRepository().getSystemStore().getDatatypes()));
} catch (IOException e) {
- throw new StartException(e);
+ throw new StartException(IntegrationPlugin.Event.TEIID50031.name(), e);
}
}
else {
@@ -188,7 +188,7 @@
}
if (store == null) {
- LogManager.logError(LogConstants.CTX_RUNTIME, RuntimePlugin.Util.getString("failed_matadata_load", this.vdb.getName(), vdb.getVersion())); //$NON-NLS-1$
+ LogManager.logError(LogConstants.CTX_RUNTIME, IntegrationPlugin.Util.gs(IntegrationPlugin.Event.TEIID50024, this.vdb.getName(), vdb.getVersion()));
}
LinkedHashMap<String, Resource> visibilityMap = null;
@@ -201,7 +201,7 @@
// add transformation metadata to the repository.
getVDBRepository().addVDB(this.vdb, store, visibilityMap, udf, cmr);
} catch (VirtualDatabaseException e) {
- throw new StartException(e);
+ throw new StartException(IntegrationPlugin.Event.TEIID50032.name(), e);
}
boolean valid = true;
@@ -212,7 +212,7 @@
LogManager.logTrace(LogConstants.CTX_RUNTIME, "VDB ", vdb.getName(), " metadata has been cached to data folder"); //$NON-NLS-1$ //$NON-NLS-2$
}
} catch (IOException e1) {
- LogManager.logWarning(LogConstants.CTX_RUNTIME, e1, RuntimePlugin.Util.getString("vdb_save_failed", vdb.getName()+"."+vdb.getVersion())); //$NON-NLS-1$ //$NON-NLS-2$
+ LogManager.logWarning(LogConstants.CTX_RUNTIME, e1, IntegrationPlugin.Util.gs(IntegrationPlugin.Event.TEIID50044, vdb.getName(), vdb.getVersion()));
}
}
if (!preview) {
@@ -235,7 +235,7 @@
this.vdb.removeAttachment(MetadataStoreGroup.class);
this.vdb.removeAttachment(IndexMetadataFactory.class);
- LogManager.logInfo(LogConstants.CTX_RUNTIME, RuntimePlugin.Util.getString("vdb_deployed",vdb, valid?"active":"inactive")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ LogManager.logInfo(LogConstants.CTX_RUNTIME, IntegrationPlugin.Util.gs(IntegrationPlugin.Event.TEIID50025, vdb, valid?"active":"inactive")); //$NON-NLS-1$ //$NON-NLS-2$
}
@Override
@@ -256,7 +256,7 @@
LogManager.logTrace(LogConstants.CTX_RUNTIME, "VDB "+vdb.getName()+" metadata removed"); //$NON-NLS-1$ //$NON-NLS-2$
}
- LogManager.logInfo(LogConstants.CTX_RUNTIME, RuntimePlugin.Util.getString("vdb_undeployed", this.vdb)); //$NON-NLS-1$
+ LogManager.logInfo(LogConstants.CTX_RUNTIME, IntegrationPlugin.Util.gs(IntegrationPlugin.Event.TEIID50026, this.vdb));
}
@Override
@@ -270,7 +270,7 @@
for (Model model:deployment.getModels()) {
List<String> sourceNames = model.getSourceNames();
if (sourceNames.size() != new HashSet<String>(sourceNames).size()) {
- throw new StartException(IntegrationPlugin.Util.getString("duplicate_source_name", model.getName(), deployment.getName(), deployment.getVersion())); //$NON-NLS-1$
+ throw new StartException(IntegrationPlugin.Util.getString("duplicate_source_name", model.getName(), deployment.getName(), deployment.getVersion(), IntegrationPlugin.Event.TEIID50033)); //$NON-NLS-1$
}
for (String source:sourceNames) {
ConnectorManager cm = cmr.getConnectorManager(source);
@@ -279,7 +279,7 @@
if (cm != null) {
if (!cm.getTranslatorName().equals(name)
|| !cm.getConnectionName().equals(connection)) {
- throw new StartException(IntegrationPlugin.Util.getString("source_name_mismatch", source, deployment.getName(), deployment.getVersion())); //$NON-NLS-1$
+ throw new StartException(IntegrationPlugin.Util.getString("source_name_mismatch", source, deployment.getName(), deployment.getVersion(),IntegrationPlugin.Event.TEIID50034)); //$NON-NLS-1$
}
continue;
}
@@ -291,9 +291,9 @@
cmr.addConnectorManager(source, cm);
} catch (TranslatorNotFoundException e) {
if (e.getCause() != null) {
- throw new StartException(e.getCause());
+ throw new StartException(IntegrationPlugin.Event.TEIID50035.name(), e.getCause());
}
- throw new StartException(e.getMessage());
+ throw new StartException(IntegrationPlugin.Event.TEIID50035.name()+" "+e.getMessage()); //$NON-NLS-1$
}
}
}
@@ -453,19 +453,19 @@
synchronized (vdb) {
if (loaded == null || !loaded) {
vdb.setStatus(VDB.Status.INACTIVE);
- String failed_msg = RuntimePlugin.Util.getString(loaded==null?"failed_to_retrive_metadata":"nosources_to_retrive_metadata", vdb.getName(), vdb.getVersion(), model.getName()); //$NON-NLS-1$ //$NON-NLS-2$
+ String failed_msg = IntegrationPlugin.Util.gs(loaded==null?IntegrationPlugin.Event.TEIID50036:IntegrationPlugin.Event.TEIID50030, vdb.getName(), vdb.getVersion(), model.getName());
model.addError(ModelMetaData.ValidationError.Severity.ERROR.toString(), failed_msg);
if (exceptionMessage != null) {
model.addError(ModelMetaData.ValidationError.Severity.ERROR.toString(), exceptionMessage);
}
LogManager.logWarning(LogConstants.CTX_RUNTIME, failed_msg);
} else {
- LogManager.logInfo(LogConstants.CTX_RUNTIME, RuntimePlugin.Util.getString("metadata_loaded",vdb.getName(), vdb.getVersion(), model.getName())); //$NON-NLS-1$
+ LogManager.logInfo(LogConstants.CTX_RUNTIME, IntegrationPlugin.Util.gs(IntegrationPlugin.Event.TEIID50029,vdb.getName(), vdb.getVersion(), model.getName()));
model.clearErrors();
if (vdb.isValid()) {
getVDBRepository().finishDeployment(vdb.getName(), vdb.getVersion());
vdb.setStatus(VDB.Status.ACTIVE);
- LogManager.logInfo(LogConstants.CTX_RUNTIME, RuntimePlugin.Util.getString("vdb_activated",vdb.getName(), vdb.getVersion())); //$NON-NLS-1$
+ LogManager.logInfo(LogConstants.CTX_RUNTIME, IntegrationPlugin.Util.gs(RuntimePlugin.Event.TEIID40003,vdb.getName(), vdb.getVersion()));
}
}
}
Copied: trunk/jboss-integration/src/main/java/org/teiid/replication/jboss/AddressWrapper.java (from rev 3777, trunk/cache-jbosscache/src/main/java/org/teiid/replication/jboss/AddressWrapper.java)
===================================================================
--- trunk/jboss-integration/src/main/java/org/teiid/replication/jboss/AddressWrapper.java (rev 0)
+++ trunk/jboss-integration/src/main/java/org/teiid/replication/jboss/AddressWrapper.java 2012-01-11 19:18:32 UTC (rev 3785)
@@ -0,0 +1,86 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+
+package org.teiid.replication.jboss;
+
+import java.io.Externalizable;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+
+import org.jgroups.Address;
+import org.teiid.core.util.ReflectionHelper;
+
+/**
+ * Allows JGroups {@link Address} objects to be serializable
+ */
+public final class AddressWrapper implements Externalizable {
+
+ Address address;
+
+ public AddressWrapper() {
+
+ }
+
+ public AddressWrapper(Address address) {
+ this.address = address;
+ }
+
+ @Override
+ public int hashCode() {
+ return address.hashCode();
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (obj == this) {
+ return true;
+ }
+ if (!(obj instanceof AddressWrapper)) {
+ return false;
+ }
+ return address.equals(((AddressWrapper)obj).address);
+ }
+
+ @Override
+ public void readExternal(ObjectInput in) throws IOException,
+ ClassNotFoundException {
+ String className = in.readUTF();
+ try {
+ this.address = (Address) ReflectionHelper.create(className, null, Thread.currentThread().getContextClassLoader());
+ this.address.readFrom(in);
+ } catch (Exception e) {
+ throw new IOException(e);
+ }
+ }
+
+ @Override
+ public void writeExternal(ObjectOutput out) throws IOException {
+ out.writeUTF(address.getClass().getName());
+ try {
+ address.writeTo(out);
+ } catch (Exception e) {
+ throw new IOException(e);
+ }
+ }
+
+}
\ No newline at end of file
Property changes on: trunk/jboss-integration/src/main/java/org/teiid/replication/jboss/AddressWrapper.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: svn:mergeinfo
+ /branches/7.6.x/cache-jbosscache/src/main/java/org/teiid/replication/jboss/AddressWrapper.java:3673-3711,3754-3769
/trunk/cache-jbosscache/src/main/java/org/teiid/replication/jboss/AddressWrapper.java:3507-3666
Copied: trunk/jboss-integration/src/main/java/org/teiid/replication/jboss/JGroupsInputStream.java (from rev 3777, trunk/cache-jbosscache/src/main/java/org/teiid/replication/jboss/JGroupsInputStream.java)
===================================================================
--- trunk/jboss-integration/src/main/java/org/teiid/replication/jboss/JGroupsInputStream.java (rev 0)
+++ trunk/jboss-integration/src/main/java/org/teiid/replication/jboss/JGroupsInputStream.java 2012-01-11 19:18:32 UTC (rev 3785)
@@ -0,0 +1,114 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+
+package org.teiid.replication.jboss;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.TimeoutException;
+import java.util.concurrent.locks.Condition;
+import java.util.concurrent.locks.ReentrantLock;
+
+public class JGroupsInputStream extends InputStream {
+
+ private long timeout = 15000;
+ private volatile byte[] buf;
+ private volatile int index=0;
+ private ReentrantLock lock = new ReentrantLock();
+ private Condition write = lock.newCondition();
+ private Condition doneReading = lock.newCondition();
+
+ public JGroupsInputStream(long timeout) {
+ this.timeout = timeout;
+ }
+
+ @Override
+ public int read() throws IOException {
+ if (index < 0) {
+ return -1;
+ }
+ if (buf == null) {
+ lock.lock();
+ try {
+ write.await(timeout, TimeUnit.MILLISECONDS);
+ if (index < 0) {
+ return -1;
+ }
+ if (buf == null) {
+ throw new IOException(new TimeoutException());
+ }
+ } catch(InterruptedException e) {
+ throw new IOException(e);
+ } finally {
+ lock.unlock();
+ }
+ }
+ if (index == buf.length) {
+ lock.lock();
+ try {
+ buf = null;
+ index = 0;
+ doneReading.signal();
+ } finally {
+ lock.unlock();
+ }
+ return read();
+ }
+ return buf[index++] & 0xff;
+ }
+
+ @Override
+ public void close() {
+ lock.lock();
+ try {
+ buf = null;
+ index = -1;
+ doneReading.signal();
+ } finally {
+ lock.unlock();
+ }
+ }
+
+ public void receive(byte[] bytes) throws InterruptedException {
+ lock.lock();
+ try {
+ if (index == -1) {
+ return;
+ }
+ if (buf != null) {
+ doneReading.await();
+ }
+ if (index == -1) {
+ return;
+ }
+ buf = bytes;
+ if (bytes == null) {
+ index = -1;
+ }
+ write.signal();
+ } finally {
+ lock.unlock();
+ }
+ }
+
+}
\ No newline at end of file
Property changes on: trunk/jboss-integration/src/main/java/org/teiid/replication/jboss/JGroupsInputStream.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: svn:mergeinfo
+ /branches/7.4.x/cache-jbosscache/src/main/java/org/teiid/replication/jboss/JGroupsInputStream.java:3535-3555
/branches/7.6.x/cache-jbosscache/src/main/java/org/teiid/replication/jboss/JGroupsInputStream.java:3673-3711,3754-3769
/trunk/cache-jbosscache/src/main/java/org/teiid/replication/jboss/JGroupsInputStream.java:3507-3666
Copied: trunk/jboss-integration/src/main/java/org/teiid/replication/jboss/JGroupsObjectReplicator.java (from rev 3777, trunk/cache-jbosscache/src/main/java/org/teiid/replication/jboss/JGroupsObjectReplicator.java)
===================================================================
--- trunk/jboss-integration/src/main/java/org/teiid/replication/jboss/JGroupsObjectReplicator.java (rev 0)
+++ trunk/jboss-integration/src/main/java/org/teiid/replication/jboss/JGroupsObjectReplicator.java 2012-01-11 19:18:32 UTC (rev 3785)
@@ -0,0 +1,610 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+
+package org.teiid.replication.jboss;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.io.Serializable;
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.lang.reflect.Proxy;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.Executor;
+import java.util.concurrent.Executors;
+
+import org.jboss.as.clustering.jgroups.ChannelFactory;
+import org.jgroups.Address;
+import org.jgroups.Channel;
+import org.jgroups.MembershipListener;
+import org.jgroups.Message;
+import org.jgroups.MessageListener;
+import org.jgroups.ReceiverAdapter;
+import org.jgroups.View;
+import org.jgroups.blocks.MethodCall;
+import org.jgroups.blocks.MethodLookup;
+import org.jgroups.blocks.RequestOptions;
+import org.jgroups.blocks.ResponseMode;
+import org.jgroups.blocks.RpcDispatcher;
+import org.jgroups.util.Buffer;
+import org.jgroups.util.Promise;
+import org.jgroups.util.Rsp;
+import org.jgroups.util.RspList;
+import org.teiid.Replicated;
+import org.teiid.Replicated.ReplicationMode;
+import org.teiid.core.TeiidRuntimeException;
+import org.teiid.core.util.ObjectInputStreamWithClassloader;
+import org.teiid.jboss.IntegrationPlugin;
+import org.teiid.logging.LogConstants;
+import org.teiid.logging.LogManager;
+import org.teiid.query.ObjectReplicator;
+import org.teiid.query.ReplicatedObject;
+
+@SuppressWarnings("unchecked")
+public class JGroupsObjectReplicator implements ObjectReplicator, Serializable {
+
+ private static final int IO_TIMEOUT = 15000;
+
+ private final class ReplicatorRpcDispatcher<S> extends RpcDispatcher {
+ private final S object;
+ private boolean initialized;
+ private final HashMap<Method, Short> methodMap;
+ private final ArrayList<Method> methodList;
+ Map<List<?>, JGroupsInputStream> inputStreams = new ConcurrentHashMap<List<?>, JGroupsInputStream>();
+
+ private ReplicatorRpcDispatcher(Channel channel, MessageListener l,
+ MembershipListener l2, Object serverObj, S object,
+ HashMap<Method, Short> methodMap, ArrayList<Method> methodList) {
+ super(channel, l, l2, serverObj);
+ this.object = object;
+ this.methodMap = methodMap;
+ this.methodList = methodList;
+ setMarshaller(new ContextAwareMarshaller(getClass().getClassLoader()));
+ }
+
+ @Override
+ public Object handle(Message req) {
+ Object body=null;
+
+ if(req == null || req.getLength() == 0) {
+ if(log.isErrorEnabled()) log.error("message or message buffer is null"); //$NON-NLS-1$
+ return null;
+ }
+
+ try {
+ body=req_marshaller != null?
+ req_marshaller.objectFromBuffer(req.getBuffer(), req.getOffset(), req.getLength())
+ : req.getObject();
+ }
+ catch(Throwable e) {
+ if(log.isErrorEnabled()) log.error("exception marshalling object", e); //$NON-NLS-1$
+ return e;
+ }
+
+ if(!(body instanceof MethodCall)) {
+ if(log.isErrorEnabled()) log.error("message does not contain a MethodCall object"); //$NON-NLS-1$
+
+ // create an exception to represent this and return it
+ return new IllegalArgumentException("message does not contain a MethodCall object") ; //$NON-NLS-1$
+ }
+
+ final MethodCall method_call=(MethodCall)body;
+
+ try {
+ if(log.isTraceEnabled())
+ log.trace("[sender=" + req.getSrc() + "], method_call: " + method_call); //$NON-NLS-1$ //$NON-NLS-2$
+
+ if (method_call.getId() >= methodList.size() - 5 && req.getSrc().equals(local_addr)) {
+ return null;
+ }
+
+ if (method_call.getId() >= methodList.size() - 3) {
+ Serializable address = new AddressWrapper(req.getSrc());
+ Serializable stateId = (Serializable)method_call.getArgs()[0];
+ List<?> key = Arrays.asList(stateId, address);
+ JGroupsInputStream is = inputStreams.get(key);
+ if (method_call.getId() == methodList.size() - 3) {
+ LogManager.logTrace(LogConstants.CTX_RUNTIME, object, "create state", stateId); //$NON-NLS-1$
+ if (is != null) {
+ is.receive(null);
+ }
+ is = new JGroupsInputStream(IO_TIMEOUT);
+ this.inputStreams.put(key, is);
+ executor.execute(new StreamingRunner(object, stateId, is, null));
+ } else if (method_call.getId() == methodList.size() - 2) {
+ LogManager.logTrace(LogConstants.CTX_RUNTIME, object, "building state", stateId); //$NON-NLS-1$
+ if (is != null) {
+ is.receive((byte[])method_call.getArgs()[1]);
+ }
+ } else if (method_call.getId() == methodList.size() - 1) {
+ LogManager.logTrace(LogConstants.CTX_RUNTIME, object, "finished state", stateId); //$NON-NLS-1$
+ if (is != null) {
+ is.receive(null);
+ }
+ this.inputStreams.remove(key);
+ }
+ return null;
+ } else if (method_call.getId() == methodList.size() - 5) {
+ //hasState
+ ReplicatedObject ro = (ReplicatedObject)object;
+ Serializable stateId = (Serializable)method_call.getArgs()[0];
+
+ if (stateId == null) {
+ synchronized (this) {
+ if (initialized) {
+ return Boolean.TRUE;
+ }
+ return null;
+ }
+ }
+
+ if (ro.hasState(stateId)) {
+ return Boolean.TRUE;
+ }
+ return null;
+ } else if (method_call.getId() == methodList.size() - 4) {
+ //sendState
+ ReplicatedObject ro = (ReplicatedObject)object;
+ String stateId = (String)method_call.getArgs()[0];
+ AddressWrapper dest = (AddressWrapper)method_call.getArgs()[1];
+
+ JGroupsOutputStream oStream = new JGroupsOutputStream(this, Arrays.asList(dest.address), stateId, (short)(methodMap.size() - 3), false);
+ try {
+ if (stateId == null) {
+ ro.getState(oStream);
+ } else {
+ ro.getState(stateId, oStream);
+ }
+ } finally {
+ oStream.close();
+ }
+ LogManager.logTrace(LogConstants.CTX_RUNTIME, object, "sent state", stateId); //$NON-NLS-1$
+ return null;
+ }
+
+ Method m=method_lookup.findMethod(method_call.getId());
+ if(m == null)
+ throw new Exception("no method found for " + method_call.getId()); //$NON-NLS-1$
+ method_call.setMethod(m);
+
+ return method_call.invoke(server_obj);
+ }
+ catch(Throwable x) {
+ return x;
+ }
+ }
+ }
+
+ private static final long serialVersionUID = -6851804958313095166L;
+ private static final String HAS_STATE = "hasState"; //$NON-NLS-1$
+ private static final String SEND_STATE = "sendState"; //$NON-NLS-1$
+ private static final String CREATE_STATE = "createState"; //$NON-NLS-1$
+ private static final String BUILD_STATE = "buildState"; //$NON-NLS-1$
+ private static final String FINISH_STATE = "finishState"; //$NON-NLS-1$
+
+ private final static class StreamingRunner implements Runnable {
+ private final Object object;
+ private final Serializable stateId;
+ private final JGroupsInputStream is;
+ private Promise<Boolean> promise;
+
+ private StreamingRunner(Object object, Serializable stateId, JGroupsInputStream is, Promise<Boolean> promise) {
+ this.object = object;
+ this.stateId = stateId;
+ this.is = is;
+ this.promise = promise;
+ }
+
+ @Override
+ public void run() {
+ try {
+ if (stateId == null) {
+ ((ReplicatedObject<?>)object).setState(is);
+ } else {
+ ((ReplicatedObject)object).setState(stateId, is);
+ }
+ if (promise != null) {
+ promise.setResult(Boolean.TRUE);
+ }
+ LogManager.logDetail(LogConstants.CTX_RUNTIME, "state set", stateId); //$NON-NLS-1$
+ } catch (Exception e) {
+ if (promise != null) {
+ promise.setResult(Boolean.FALSE);
+ }
+ LogManager.logError(LogConstants.CTX_RUNTIME, e, IntegrationPlugin.Util.gs(IntegrationPlugin.Event.TEIID50042,stateId));
+ } finally {
+ is.close();
+ }
+ }
+ }
+
+ private final class ReplicatedInvocationHandler<S> extends ReceiverAdapter implements
+ InvocationHandler, Serializable {
+
+ private static final int PULL_RETRIES = 3;
+ private static final long serialVersionUID = -2943462899945966103L;
+ private final S object;
+ private transient ReplicatorRpcDispatcher<S> disp;
+ private final HashMap<Method, Short> methodMap;
+ protected List<Address> remoteMembers = Collections.synchronizedList(new ArrayList<Address>());
+ private Map<Serializable, Promise<Boolean>> loadingStates = new HashMap<Serializable, Promise<Boolean>>();
+
+ private ReplicatedInvocationHandler(S object,HashMap<Method, Short> methodMap) {
+ this.object = object;
+ this.methodMap = methodMap;
+ }
+
+ List<Address> getRemoteMembersCopy() {
+ synchronized (remoteMembers) {
+ return new ArrayList<Address>(remoteMembers);
+ }
+ }
+
+ public void setDisp(ReplicatorRpcDispatcher<S> disp) {
+ this.disp = disp;
+ }
+
+ @Override
+ public Object invoke(Object proxy, Method method, Object[] args)
+ throws Throwable {
+ Short methodNum = methodMap.get(method);
+ if (methodNum == null || remoteMembers.isEmpty()) {
+ if (methodNum != null) {
+ Replicated annotation = method.getAnnotation(Replicated.class);
+ if (annotation != null && annotation.remoteOnly()) {
+ return null;
+ }
+ }
+ try {
+ return method.invoke(object, args);
+ } catch (InvocationTargetException e) {
+ throw e.getCause();
+ }
+ }
+ try {
+ Replicated annotation = method.getAnnotation(Replicated.class);
+ if (annotation.replicateState() != ReplicationMode.NONE) {
+ return handleReplicateState(method, args, annotation);
+ }
+ MethodCall call=new MethodCall(methodNum, args);
+ List<Address> dests = null;
+ if (annotation.remoteOnly()) {
+ dests = getRemoteMembersCopy();
+ if (dests.isEmpty()) {
+ return null;
+ }
+ }
+ RspList<Object> responses = disp.callRemoteMethods(dests, call, new RequestOptions().setMode(annotation.asynch()?ResponseMode.GET_NONE:ResponseMode.GET_ALL).setTimeout(annotation.timeout()).setAnycasting(dests != null));
+ if (annotation.asynch()) {
+ return null;
+ }
+ List<Object> results = responses.getResults();
+ if (method.getReturnType() == boolean.class) {
+ for (Object o : results) {
+ if (!Boolean.TRUE.equals(o)) {
+ return false;
+ }
+ }
+ return true;
+ } else if (method.getReturnType() == Collection.class) {
+ ArrayList<Object> result = new ArrayList<Object>();
+ for (Object o : results) {
+ result.addAll((Collection)o);
+ }
+ return results;
+ }
+ return null;
+ } catch(Exception e) {
+ throw new RuntimeException(method + " " + args + " failed", e); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ }
+
+ protected Address whereIsState(Serializable stateId, long timeout) throws Exception {
+ if (remoteMembers.isEmpty()) {
+ return null;
+ }
+ RspList<Boolean> resp = this.disp.callRemoteMethods(getRemoteMembersCopy(), new MethodCall((short)(methodMap.size() - 5), new Object[]{stateId}), new RequestOptions(ResponseMode.GET_ALL, timeout));
+ Collection<Rsp<Boolean>> values = resp.values();
+ Rsp<Boolean> rsp = null;
+ for (Rsp<Boolean> response : values) {
+ if (Boolean.TRUE.equals(response.getValue())) {
+ rsp = response;
+ break;
+ }
+ }
+ if (rsp == null) {
+ return null;
+ }
+ return rsp.getSender();
+ }
+
+ private Object handleReplicateState(Method method, Object[] args,
+ Replicated annotation) throws IllegalAccessException,
+ Throwable, IOException, IllegalStateException, Exception {
+ Object result = null;
+ try {
+ result = method.invoke(object, args);
+ } catch (InvocationTargetException e) {
+ throw e.getCause();
+ }
+ ReplicatedObject ro = (ReplicatedObject)object;
+ Serializable stateId = (Serializable)args[0];
+ if (annotation.replicateState() == ReplicationMode.PUSH) {
+ if (!remoteMembers.isEmpty()) {
+ LogManager.logDetail(LogConstants.CTX_RUNTIME, object, "replicating state", stateId); //$NON-NLS-1$
+ JGroupsOutputStream oStream = new JGroupsOutputStream(disp, null, stateId, (short)(methodMap.size() - 3), true);
+ try {
+ ro.getState(stateId, oStream);
+ } finally {
+ oStream.close();
+ }
+ LogManager.logTrace(LogConstants.CTX_RUNTIME, object, "sent state", stateId); //$NON-NLS-1$
+ }
+ return result;
+ }
+ if (result != null) {
+ return result;
+ }
+ long timeout = annotation.timeout();
+ return pullState(method, args, stateId, timeout);
+ }
+
+ /**
+ * Pull the remote state. The method and args are optional
+ * to determine if the state has been made available.
+ */
+ Object pullState(Method method, Object[] args, Serializable stateId,
+ long timeout) throws Throwable {
+ Object result = null;
+ for (int i = 0; i < PULL_RETRIES; i++) {
+ Promise<Boolean> p = null;
+ boolean wait = true;
+ synchronized (loadingStates) {
+ p = loadingStates.get(stateId);
+ if (p == null) {
+ wait = false;
+ if (method != null) {
+ try {
+ result = method.invoke(object, args);
+ } catch (InvocationTargetException e) {
+ throw e.getCause();
+ }
+ if (result != null) {
+ return result;
+ }
+ }
+ p = new Promise<Boolean>();
+ loadingStates.put(stateId, p);
+ }
+ }
+ if (wait) {
+ p.getResult(timeout);
+ continue;
+ }
+ try {
+ LogManager.logDetail(LogConstants.CTX_RUNTIME, object, "pulling state", stateId); //$NON-NLS-1$
+ Address addr = whereIsState(stateId, timeout);
+ if (addr == null) {
+ LogManager.logDetail(LogConstants.CTX_RUNTIME, object, "timeout exceeded or first member"); //$NON-NLS-1$
+ break;
+ }
+ JGroupsInputStream is = new JGroupsInputStream(IO_TIMEOUT);
+ StreamingRunner runner = new StreamingRunner(object, stateId, is, p);
+ List<?> key = Arrays.asList(stateId, new AddressWrapper(addr));
+ disp.inputStreams.put(key, is);
+ executor.execute(runner);
+
+ this.disp.callRemoteMethod(addr, new MethodCall((short)(methodMap.size() - 4), stateId, new AddressWrapper(this.disp.getChannel().getAddress())), new RequestOptions(ResponseMode.GET_NONE, 0).setAnycasting(true));
+
+ Boolean fetched = p.getResult(timeout);
+
+ if (fetched != null) {
+ if (fetched) {
+ LogManager.logDetail(LogConstants.CTX_RUNTIME, object, "pulled state", stateId); //$NON-NLS-1$
+ if (method !=null) {
+ try {
+ result = method.invoke(object, args);
+ } catch (InvocationTargetException e) {
+ throw e.getCause();
+ }
+ if (result != null) {
+ return result;
+ }
+ }
+ break;
+ }
+ LogManager.logWarning(LogConstants.CTX_RUNTIME, IntegrationPlugin.Util.gs(IntegrationPlugin.Event.TEIID50020, object, stateId));
+ } else {
+ LogManager.logWarning(LogConstants.CTX_RUNTIME, IntegrationPlugin.Util.gs(IntegrationPlugin.Event.TEIID50022, object, stateId));
+ }
+ } finally {
+ synchronized (loadingStates) {
+ loadingStates.remove(stateId);
+ }
+ }
+ }
+ return null; //could not fetch the remote state
+ }
+
+ @Override
+ public void viewAccepted(View newView) {
+ if (newView.getMembers() != null) {
+ synchronized (remoteMembers) {
+ remoteMembers.removeAll(newView.getMembers());
+ if (object instanceof ReplicatedObject<?> && !remoteMembers.isEmpty()) {
+ HashSet<Serializable> dropped = new HashSet<Serializable>();
+ for (Address address : remoteMembers) {
+ dropped.add(new AddressWrapper(address));
+ }
+ ((ReplicatedObject<?>)object).droppedMembers(dropped);
+ }
+ remoteMembers.clear();
+ remoteMembers.addAll(newView.getMembers());
+ remoteMembers.remove(this.disp.getChannel().getAddress());
+ }
+ }
+ }
+ }
+
+ private interface Streaming {
+ void sendState(Serializable id, AddressWrapper dest);
+ void createState(Serializable id);
+ void buildState(Serializable id, byte[] bytes);
+ void finishState(Serializable id);
+ }
+
+ //TODO: this should be configurable, or use a common executor
+ private transient Executor executor = Executors.newCachedThreadPool();
+ private transient ChannelFactory channelFactory;
+
+ public JGroupsObjectReplicator(ChannelFactory channelFactory) {
+ this.channelFactory = channelFactory;
+ }
+
+ public void stop(Object object) {
+ if (!Proxy.isProxyClass(object.getClass())) {
+ return;
+ }
+ ReplicatedInvocationHandler<?> handler = (ReplicatedInvocationHandler<?>) Proxy.getInvocationHandler(object);
+ Channel c = handler.disp.getChannel();
+ handler.disp.stop();
+ c.close();
+ }
+
+ @Override
+ public <T, S> T replicate(String mux_id,
+ Class<T> iface, final S object, long startTimeout) throws Exception {
+ Channel channel = channelFactory.createChannel(mux_id);
+ Method[] methods = iface.getMethods();
+
+ final HashMap<Method, Short> methodMap = new HashMap<Method, Short>();
+ final ArrayList<Method> methodList = new ArrayList<Method>();
+
+ for (Method method : methods) {
+ if (method.getAnnotation(Replicated.class) == null) {
+ continue;
+ }
+ methodList.add(method);
+ methodMap.put(method, (short)(methodList.size() - 1));
+ }
+
+ Method hasState = ReplicatedObject.class.getMethod(HAS_STATE, new Class<?>[] {Serializable.class});
+ methodList.add(hasState);
+ methodMap.put(hasState, (short)(methodList.size() - 1));
+
+ Method sendState = JGroupsObjectReplicator.Streaming.class.getMethod(SEND_STATE, new Class<?>[] {Serializable.class, AddressWrapper.class});
+ methodList.add(sendState);
+ methodMap.put(sendState, (short)(methodList.size() - 1));
+
+ //add in streaming methods
+ Method createState = JGroupsObjectReplicator.Streaming.class.getMethod(CREATE_STATE, new Class<?>[] {Serializable.class});
+ methodList.add(createState);
+ methodMap.put(createState, (short)(methodList.size() - 1));
+ Method buildState = JGroupsObjectReplicator.Streaming.class.getMethod(BUILD_STATE, new Class<?>[] {Serializable.class, byte[].class});
+ methodList.add(buildState);
+ methodMap.put(buildState, (short)(methodList.size() - 1));
+ Method finishState = JGroupsObjectReplicator.Streaming.class.getMethod(FINISH_STATE, new Class<?>[] {Serializable.class});
+ methodList.add(finishState);
+ methodMap.put(finishState, (short)(methodList.size() - 1));
+
+ ReplicatedInvocationHandler<S> proxy = new ReplicatedInvocationHandler<S>(object, methodMap);
+ /*
+ * TODO: could have an object implement streaming
+ * Override the normal handle method to support streaming
+ */
+ ReplicatorRpcDispatcher disp = new ReplicatorRpcDispatcher<S>(channel, proxy, proxy, object,
+ object, methodMap, methodList);
+
+ proxy.setDisp(disp);
+ disp.setMethodLookup(new MethodLookup() {
+ public Method findMethod(short id) {
+ return methodList.get(id);
+ }
+ });
+
+ T replicatedProxy = (T) Proxy.newProxyInstance(Thread.currentThread().getContextClassLoader(), new Class[] {iface}, proxy);
+ boolean success = false;
+ try {
+ channel.connect(mux_id);
+ if (object instanceof ReplicatedObject) {
+ ((ReplicatedObject)object).setAddress(new AddressWrapper(channel.getAddress()));
+ proxy.pullState(null, null, null, startTimeout);
+ }
+ success = true;
+ return replicatedProxy;
+ } catch (Throwable e) {
+ if (e instanceof Exception) {
+ throw (Exception)e;
+ }
+ throw new TeiidRuntimeException(e);
+ } finally {
+ if (!success) {
+ channel.close();
+ } else {
+ synchronized (disp) {
+ //mark as initialized so that state can be pulled if needed
+ disp.initialized = true;
+ }
+ }
+ }
+ }
+
+ // This class is used so that the objects are loaded with the current classes class loader
+ // rather than foreign class loader
+ static class ContextAwareMarshaller implements RpcDispatcher.Marshaller {
+ private ClassLoader classloader;
+
+ public ContextAwareMarshaller(ClassLoader classloader) {
+ this.classloader = classloader;
+ }
+
+ @Override
+ public Buffer objectToBuffer(Object obj) throws Exception {
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ ObjectOutputStream out = new ObjectOutputStream(baos);
+ out.writeObject(obj);
+ out.close();
+ return new Buffer(baos.toByteArray());
+ }
+
+ @Override
+ public Object objectFromBuffer(byte[] buf, int offset, int length) throws Exception {
+ ObjectInputStream in = new ObjectInputStreamWithClassloader(new ByteArrayInputStream(buf, offset, length), this.classloader);
+ Object anObj = in.readObject();
+ in.close();
+ return anObj;
+ }
+ }
+
+}
Property changes on: trunk/jboss-integration/src/main/java/org/teiid/replication/jboss/JGroupsObjectReplicator.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: svn:mergeinfo
+ /branches/7.4.x/cache-jbosscache/src/main/java/org/teiid/replication/jboss/JGroupsObjectReplicator.java:3535-3555
/branches/7.6.x/cache-jbosscache/src/main/java/org/teiid/replication/jboss/JGroupsObjectReplicator.java:3673-3711,3754-3769
/trunk/cache-jbosscache/src/main/java/org/teiid/replication/jboss/JGroupsObjectReplicator.java:3507-3666
Copied: trunk/jboss-integration/src/main/java/org/teiid/replication/jboss/JGroupsOutputStream.java (from rev 3777, trunk/cache-jbosscache/src/main/java/org/teiid/replication/jboss/JGroupsOutputStream.java)
===================================================================
--- trunk/jboss-integration/src/main/java/org/teiid/replication/jboss/JGroupsOutputStream.java (rev 0)
+++ trunk/jboss-integration/src/main/java/org/teiid/replication/jboss/JGroupsOutputStream.java 2012-01-11 19:18:32 UTC (rev 3785)
@@ -0,0 +1,104 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+
+package org.teiid.replication.jboss;
+
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.Serializable;
+import java.util.Arrays;
+import java.util.List;
+
+import org.jgroups.Address;
+import org.jgroups.blocks.MethodCall;
+import org.jgroups.blocks.RequestOptions;
+import org.jgroups.blocks.ResponseMode;
+import org.jgroups.blocks.RpcDispatcher;
+import org.teiid.core.types.Streamable;
+
+public class JGroupsOutputStream extends OutputStream {
+
+ static final int CHUNK_SIZE=Streamable.STREAMING_BATCH_SIZE_IN_BYTES;
+
+ protected final RpcDispatcher disp;
+ protected final List<Address> dests;
+ protected final Serializable stateId;
+ protected final short methodOffset;
+
+ private volatile boolean closed=false;
+ private final byte[] buffer=new byte[CHUNK_SIZE];
+ private int index=0;
+
+ public JGroupsOutputStream(RpcDispatcher disp, List<Address> dests, Serializable stateId, short methodOffset, boolean sendCreate) throws IOException {
+ this.disp=disp;
+ this.dests=dests;
+ this.stateId=stateId;
+ this.methodOffset = methodOffset;
+ if (sendCreate) {
+ try {
+ disp.callRemoteMethods(this.dests, new MethodCall(methodOffset, new Object[] {stateId}), new RequestOptions(ResponseMode.GET_NONE, 0).setAnycasting(dests != null));
+ } catch(Exception e) {
+ throw new IOException(e);
+ }
+ }
+ }
+
+ public void close() throws IOException {
+ if(closed) {
+ return;
+ }
+ flush();
+ try {
+ disp.callRemoteMethods(dests, new MethodCall((short)(methodOffset + 2), new Object[] {stateId}), new RequestOptions(ResponseMode.GET_NONE, 0).setAnycasting(dests != null));
+ } catch(Exception e) {
+ }
+ closed=true;
+ }
+
+ public void flush() throws IOException {
+ checkClosed();
+ try {
+ if(index == 0) {
+ return;
+ }
+ disp.callRemoteMethods(dests, new MethodCall((short)(methodOffset + 1), new Object[] {stateId, Arrays.copyOf(buffer, index)}), new RequestOptions(ResponseMode.GET_NONE, 0).setAnycasting(dests != null));
+ index=0;
+ } catch(Exception e) {
+ throw new IOException(e);
+ }
+ }
+
+ private void checkClosed() throws IOException {
+ if(closed) {
+ throw new IOException("output stream is closed"); //$NON-NLS-1$
+ }
+ }
+
+ public void write(int b) throws IOException {
+ checkClosed();
+ if(index >= buffer.length) {
+ flush();
+ }
+ buffer[index++]=(byte)b;
+ }
+
+}
\ No newline at end of file
Property changes on: trunk/jboss-integration/src/main/java/org/teiid/replication/jboss/JGroupsOutputStream.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: svn:mergeinfo
+ /branches/7.4.x/cache-jbosscache/src/main/java/org/teiid/replication/jboss/JGroupsOutputStream.java:3535-3555
/branches/7.6.x/cache-jbosscache/src/main/java/org/teiid/replication/jboss/JGroupsOutputStream.java:3673-3711,3754-3769
/trunk/cache-jbosscache/src/main/java/org/teiid/replication/jboss/JGroupsOutputStream.java:3507-3666
Modified: trunk/jboss-integration/src/main/resources/org/teiid/jboss/i18n.properties
===================================================================
--- trunk/jboss-integration/src/main/resources/org/teiid/jboss/i18n.properties 2012-01-10 17:28:44 UTC (rev 3784)
+++ trunk/jboss-integration/src/main/resources/org/teiid/jboss/i18n.properties 2012-01-11 19:18:32 UTC (rev 3785)
@@ -20,15 +20,14 @@
# 02110-1301 USA.
#
-engine_started=Teiid Engine {0} Started = {1}
-socket_enabled=Teiid JDBC - Host = {0}, Port = {1}, SSL = {2}, security-domains = {3}
-socket_disabled=Teiid JDBC - Host = {0}, Port = {1} has been shutdown.
-odbc_not_enabled=ODBC transport is not enabled in Teiid.
-odbc_enabled=Teiid ODBC - Host = {0}, Port = {1}, SSL = {2}, security-domains = {3}
-odbc_disabled=Teiid ODBC - Host = {0}, Port = {1} has been shutdown.
-embedded_enabled=Teiid Embedded transport enabled. Bound to: {0}
-embedded_disabled=Teiid Embedded transport disabled. Local Connections will fail. UnBound : {0}
-engine_stopped=Teiid Engine stopped {0}
+TEIID50001=Teiid Engine {0} Started = {1}
+TEIID50012=Teiid JDBC - Host = {0}, Port = {1}, SSL = {2}, security-domains = {3}
+TEIID50039=Teiid JDBC - Host = {0}, Port = {1} has been shutdown.
+TEIID50037=Teiid ODBC - Host = {0}, Port = {1}, SSL = {2}, security-domains = {3}
+TEIID50040=Teiid ODBC - Host = {0}, Port = {1} has been shutdown.
+TEIID50038=Teiid Embedded transport enabled. Bound to: {0}
+TEIID50041=Teiid Embedded transport disabled. Local Connections will fail. UnBound : {0}
+TEIID50002=Teiid Engine stopped {0}
admin_connection_closed=Teiid admin connection is already closed.
bad_vdb_extension=The extension of the file name must be either ".vdb" for designer vdb or "xxx-vdb.xml" for dynamic VDBs
vdb_not_found=VDB with name "{0}" version "{1}" not found in configuration
@@ -42,6 +41,8 @@
source_not_found=Source with name {0} not found in the Model {1} in VDB {2}.{3}
model_not_found=Model with name {0} not found in the VDB {1}.{2}
event_distributor_bound=org.teiid.events.EventDistributorFactory is bound to {0} for manual control of Teiid events.
+TEIID50004=Could not replicate object {0}
+TEIID50019=Re-deploying VDB {0}
no_operation=No operation found with given name = {0}
failed_to_remove=Failed to remove the deployment
@@ -54,23 +55,36 @@
datasource_template_not_found=Template {0} for creating the data source is not found.
jndi_failed=JNDI lookup failed {0}.
distributed_cache_not_enabled= Distributed caching NOT enabled. Missing "distributed-cache" property in the configuration or running in standalone mode.
-distributed_cache_enabled=Distributed caching enabled.
+TEIID50003=Distributed caching enabled.
distribute_failed=Deploy of the archive failed {0}
template_not_found=Template not found for {0}
admin_executing=JOPR admin {0} is executing command {1}
error_adding_translator=Error loading the Translator {0}. Execution Factory class is not valid class or not defined.
-failed_load_module=Failed to load module "{0}"
+failed_load_module={0} Failed to load module "{1}"
translator.add=Add Translator
translator.remove=Remove Translator
protocol_not_found=protocol is not defined for the transport configuration.
-security_enabled=Security enabled for transport "{1}" with security-domain set to {0}
+TEIID50011=Security enabled for transport "{1}" with security-domain set to {0}
DQPCore.unable_to_process_event=Unable to process event.
-translator.added = Teiid translator "{0}" added.
-wrong_protocol=Wrong type of protocol supplied
+TEIID50006 = Teiid translator "{0}" added.
+TEIID50013=Wrong type of protocol supplied
socket_binding_not_defined=Socket binding not specified for transport {0}; only embedded access is granted.
vdb-undeploy-failed=error during the undeploy of vdb {0}.{1}
error_adding_translator_deployment=Error adding translator from deployment {0}
cache_not_found=Cache Type {0} not found in the configuration
+failed_to_process_vdb_archive= failed to process VDB archive {0}
+TEIID50023=replication failed {0}
+TEIID50024=Failed to load metadata for VDB {0}.{1}
+TEIID50044=Failed to save metadata for VDB {0}.{1}
+TEIID50025=VDB "{0}" deployed in {1} state.
+TEIID50026=VDB "{0}" undeployed.
+TEIID50036={0}.{1} is now "incomplete", because model "{2}" can not retrieve metadata. Please fix any errors and re-deploy relevant DataSources and/or the VDB.
+TEIID50030={0}.{1} is now "incomplete", because model "{2}" can not retrieve metadata. Please deploy the necessary DataSources.
+TEIID50029=VDB {0}.{1} model {2} metadata is currently being loaded.
+TEIID50042=error setting state {0}
+duplicate_source_name={3} Source names are not unique for model {0} in {1}.{2}
+source_name_mismatch={3} There are different sources with the name {0} in {1}.{2}
+TEIID50043=Invalid metadata file found at {0}; delete this file and restart server.
# subsystem description
teiid.add = Add the Teiid Subsystem
@@ -178,16 +192,18 @@
transport.describe = transport description
engine_service_not_found= Query Engine Service with name {0} is not found
-translator.removed = Translator "{0}" removed
+TEIID50010 = Translator "{0}" removed
translator.failed-to-load = Translator "{0}" not found in the module "{1}"
cache-container-name-required=container-name required for the resultset cache configuration
enable.describe=enabled
clearing_cache=Clearing cache {0} for all the deployed vdbs.
-clearing_cache_vdb=Clearing cache {0} for vdb {1}.{2}
-vdb-inactive=VDB {0}.{1} deployed in inactive state due to unavailability of data sources {2}
+TEIID50005=Clearing cache {0} for vdb {1}.{2}
+TEIID50021=VDB {0}.{1} deployed in inactive state due to unavailability of data sources {2}
+TEIID50016=Invalid VDB file deployment failed {0}
+TEIID50020= {0} Failed to Pull {1}
+TEIID50022={0} timeout pulling {1}
-
remove.reply.describe=remove service
remove.describe=remove service
@@ -353,5 +369,3 @@
mark-datasource-available.ds-name.describe=Data Source name
mark-datasource-available.reply=void
-duplicate_source_name=Source names are not unique for model {0} in {1}.{2}
-source_name_mismatch=There are different sources with the name {0} in {1}.{2}
Modified: trunk/runtime/src/main/java/org/teiid/deployers/EventDistributorImpl.java
===================================================================
--- trunk/runtime/src/main/java/org/teiid/deployers/EventDistributorImpl.java 2012-01-10 17:28:44 UTC (rev 3784)
+++ trunk/runtime/src/main/java/org/teiid/deployers/EventDistributorImpl.java 2012-01-11 19:18:32 UTC (rev 3785)
@@ -57,7 +57,7 @@
try {
gts.updateMatViewRow((RelationalPlanner.MAT_PREFIX + schema + '.' + viewName).toUpperCase(), tuple, delete);
} catch (TeiidComponentException e) {
- LogManager.logError(LogConstants.CTX_RUNTIME, e, RuntimePlugin.Util.getString("replication_failed", "updateMatViewRow")); //$NON-NLS-1$ //$NON-NLS-2$
+ LogManager.logError(LogConstants.CTX_RUNTIME, e, RuntimePlugin.Util.gs(RuntimePlugin.Event.TEIID40013, "updateMatViewRow")); //$NON-NLS-1$
}
}
}
Modified: trunk/runtime/src/main/java/org/teiid/deployers/TranslatorUtil.java
===================================================================
--- trunk/runtime/src/main/java/org/teiid/deployers/TranslatorUtil.java 2012-01-10 17:28:44 UTC (rev 3784)
+++ trunk/runtime/src/main/java/org/teiid/deployers/TranslatorUtil.java 2012-01-11 19:18:32 UTC (rev 3785)
@@ -125,7 +125,7 @@
}
caseInsensitivProps.remove(Translator.EXECUTION_FACTORY_CLASS);
if (!caseInsensitivProps.isEmpty()) {
- LogManager.logWarning(LogConstants.CTX_RUNTIME, RuntimePlugin.Util.getString("undefined_translator_props", caseInsensitivProps.keySet(), data.getName())); //$NON-NLS-1$
+ LogManager.logWarning(LogConstants.CTX_RUNTIME, RuntimePlugin.Util.gs(RuntimePlugin.Event.TEIID40001, caseInsensitivProps.keySet(), data.getName()));
}
}
Modified: trunk/runtime/src/main/java/org/teiid/deployers/VDBRepository.java
===================================================================
--- trunk/runtime/src/main/java/org/teiid/deployers/VDBRepository.java 2012-01-10 17:28:44 UTC (rev 3784)
+++ trunk/runtime/src/main/java/org/teiid/deployers/VDBRepository.java 2012-01-11 19:18:32 UTC (rev 3785)
@@ -235,7 +235,7 @@
PgCatalogMetadataStore pg = new PgCatalogMetadataStore(CoreConstants.ODBC_MODEL, getBuiltinDatatypes(), new Properties());
return pg.getMetadataStore();
} catch (TranslatorException e) {
- LogManager.logError(LogConstants.CTX_DQP, RuntimePlugin.Util.getString("failed_to_load_odbc_metadata")); //$NON-NLS-1$
+ LogManager.logError(LogConstants.CTX_DQP, RuntimePlugin.Util.gs(RuntimePlugin.Event.TEIID40002));
}
return null;
}
Modified: trunk/runtime/src/main/java/org/teiid/deployers/VDBStatusChecker.java
===================================================================
--- trunk/runtime/src/main/java/org/teiid/deployers/VDBStatusChecker.java 2012-01-10 17:28:44 UTC (rev 3784)
+++ trunk/runtime/src/main/java/org/teiid/deployers/VDBStatusChecker.java 2012-01-11 19:18:32 UTC (rev 3785)
@@ -178,7 +178,7 @@
}
} else if (valid) {
vdb.setStatus(VDB.Status.ACTIVE);
- LogManager.logInfo(LogConstants.CTX_RUNTIME, RuntimePlugin.Util.getString("vdb_activated",vdb.getName(), vdb.getVersion())); //$NON-NLS-1$
+ LogManager.logInfo(LogConstants.CTX_RUNTIME, RuntimePlugin.Util.gs(RuntimePlugin.Event.TEIID40003,vdb.getName(), vdb.getVersion()));
}
}
}
@@ -198,14 +198,14 @@
vdb.setStatus(VDB.Status.INACTIVE);
String msg = null;
if (translator) {
- msg = RuntimePlugin.Util.getString("translator_not_found", vdb.getName(), vdb.getVersion(), model.getSourceTranslatorName(sourceName)); //$NON-NLS-1$
+ msg = RuntimePlugin.Util.gs(RuntimePlugin.Event.TEIID40005, vdb.getName(), vdb.getVersion(), model.getSourceTranslatorName(sourceName));
}
else {
- msg = RuntimePlugin.Util.getString("datasource_not_found", vdb.getName(), vdb.getVersion(), resourceName); //$NON-NLS-1$
+ msg = RuntimePlugin.Util.gs(RuntimePlugin.Event.TEIID40012, vdb.getName(), vdb.getVersion(), resourceName);
}
model.addError(ModelMetaData.ValidationError.Severity.ERROR.name(), msg);
LogManager.logInfo(LogConstants.CTX_RUNTIME, msg);
- LogManager.logInfo(LogConstants.CTX_RUNTIME, RuntimePlugin.Util.getString("vdb_inactivated",vdb.getName(), vdb.getVersion())); //$NON-NLS-1$
+ LogManager.logInfo(LogConstants.CTX_RUNTIME, RuntimePlugin.Util.gs(RuntimePlugin.Event.TEIID40006,vdb.getName(), vdb.getVersion()));
}
}
}
Modified: trunk/runtime/src/main/java/org/teiid/runtime/RuntimePlugin.java
===================================================================
--- trunk/runtime/src/main/java/org/teiid/runtime/RuntimePlugin.java 2012-01-10 17:28:44 UTC (rev 3784)
+++ trunk/runtime/src/main/java/org/teiid/runtime/RuntimePlugin.java 2012-01-11 19:18:32 UTC (rev 3785)
@@ -31,4 +31,26 @@
private static final String BUNDLE_NAME = PLUGIN_ID + ".i18n"; //$NON-NLS-1$
public static final BundleUtil Util = new BundleUtil(PLUGIN_ID,BUNDLE_NAME,ResourceBundle.getBundle(BUNDLE_NAME));
+ public static enum Event implements BundleUtil.Event{
+ TEIID40001, // undefined translator properties
+ TEIID40002, // failed to load ODBC metadata
+ TEIID40003, // VDB Active
+ TEIID40004, // VDB validity errors
+ TEIID40005, // datasource or translator not found
+ TEIID40006, // VDB inactive
+ TEIID40007, // keep alive failed
+ TEIID40008, // expired session
+ TEIID40009, // terminate session
+ TEIID40010, // odbc error
+ TEIID40011, // processing error
+ TEIID40012, // data source not found
+ TEIID40013, // replication failed
+ TEIID40014, // krb5 failed
+ TEIID40015, // pg error
+ TEIID40016, // pg ssl error
+ TEIID40017, // unexpected exp for session
+ TEIID40018,
+ TEIID40019,
+ TEIID40020
+ }
}
Modified: trunk/runtime/src/main/java/org/teiid/services/SessionServiceImpl.java
===================================================================
--- trunk/runtime/src/main/java/org/teiid/services/SessionServiceImpl.java 2012-01-10 17:28:44 UTC (rev 3784)
+++ trunk/runtime/src/main/java/org/teiid/services/SessionServiceImpl.java 2012-01-11 19:18:32 UTC (rev 3785)
@@ -104,10 +104,10 @@
for (SessionMetadata info : sessionCache.values()) {
try {
if (!info.isEmbedded() && currentTime - info.getLastPingTime() > ServerConnection.PING_INTERVAL * 5) {
- LogManager.logInfo(LogConstants.CTX_SECURITY, RuntimePlugin.Util.getString( "SessionServiceImpl.keepaliveFailed", info.getSessionId())); //$NON-NLS-1$
+ LogManager.logInfo(LogConstants.CTX_SECURITY, RuntimePlugin.Util.gs(RuntimePlugin.Event.TEIID40007, info.getSessionId()));
closeSession(info.getSessionId());
} else if (sessionExpirationTimeLimit > 0 && currentTime - info.getCreatedTime() > sessionExpirationTimeLimit) {
- LogManager.logInfo(LogConstants.CTX_SECURITY, RuntimePlugin.Util.getString( "SessionServiceImpl.expireSession", info.getSessionId())); //$NON-NLS-1$
+ LogManager.logInfo(LogConstants.CTX_SECURITY,RuntimePlugin.Util.gs(RuntimePlugin.Event.TEIID40008, info.getSessionId()));
closeSession(info.getSessionId());
}
} catch (Exception e) {
@@ -130,7 +130,7 @@
try {
dqp.terminateSession(info.getSessionId());
} catch (Exception e) {
- LogManager.logWarning(LogConstants.CTX_SECURITY,e,"Exception terminitating session"); //$NON-NLS-1$
+ LogManager.logWarning(LogConstants.CTX_SECURITY,e, RuntimePlugin.Util.gs(RuntimePlugin.Event.TEIID40018));
}
}
}
@@ -307,12 +307,12 @@
@Override
public boolean terminateSession(String terminatedSessionID, String adminSessionID) {
Object[] params = {adminSessionID, terminatedSessionID};
- LogManager.logInfo(LogConstants.CTX_SECURITY, RuntimePlugin.Util.getString( "SessionServiceImpl.terminateSession", params)); //$NON-NLS-1$
+ LogManager.logInfo(LogConstants.CTX_SECURITY, RuntimePlugin.Util.gs(RuntimePlugin.Event.TEIID40009, params));
try {
closeSession(terminatedSessionID);
return true;
} catch (InvalidSessionException e) {
- LogManager.logWarning(LogConstants.CTX_SECURITY,e,RuntimePlugin.Util.getString("SessionServiceImpl.invalid_session", new Object[] {e.getMessage()})); //$NON-NLS-1$
+ LogManager.logWarning(LogConstants.CTX_SECURITY,e,RuntimePlugin.Util.gs(RuntimePlugin.Event.TEIID40019, new Object[] {e.getMessage()}));
return false;
}
}
Modified: trunk/runtime/src/main/java/org/teiid/transport/LogonImpl.java
===================================================================
--- trunk/runtime/src/main/java/org/teiid/transport/LogonImpl.java 2012-01-10 17:28:44 UTC (rev 3784)
+++ trunk/runtime/src/main/java/org/teiid/transport/LogonImpl.java 2012-01-11 19:18:32 UTC (rev 3785)
@@ -134,7 +134,7 @@
this.serviceTicket = context.acceptSecContext(this.serviceTicket, 0, this.serviceTicket.length);
return new GSSResult(context, serviceTicket);
} catch (GSSException e) {
- LogManager.logError(LogConstants.CTX_SECURITY, e, "Kerberos context login failed"); //$NON-NLS-1$
+ LogManager.logError(LogConstants.CTX_SECURITY, e, RuntimePlugin.Util.gs(RuntimePlugin.Event.TEIID40014));
}
return null;
}
Modified: trunk/runtime/src/main/java/org/teiid/transport/PgBackendProtocol.java
===================================================================
--- trunk/runtime/src/main/java/org/teiid/transport/PgBackendProtocol.java 2012-01-10 17:28:44 UTC (rev 3784)
+++ trunk/runtime/src/main/java/org/teiid/transport/PgBackendProtocol.java 2012-01-11 19:18:32 UTC (rev 3785)
@@ -578,9 +578,9 @@
try {
engine = config.getServerSSLEngine();
} catch (IOException e) {
- LogManager.logError(LogConstants.CTX_ODBC, e, RuntimePlugin.Util.getString("PgBackendProtocol.ssl_error"));
+ LogManager.logError(LogConstants.CTX_ODBC, e, RuntimePlugin.Util.gs(RuntimePlugin.Event.TEIID40016));
} catch (GeneralSecurityException e) {
- LogManager.logError(LogConstants.CTX_ODBC, e, RuntimePlugin.Util.getString("PgBackendProtocol.ssl_error"));
+ LogManager.logError(LogConstants.CTX_ODBC, e, RuntimePlugin.Util.gs(RuntimePlugin.Event.TEIID40016));
}
ChannelBuffer buffer = ctx.getChannel().getConfig().getBufferFactory().getBuffer(1);
if (engine == null) {
@@ -596,11 +596,11 @@
if (t instanceof SQLException) {
//we are just re-logging an exception raised by the engine
if (LogManager.isMessageToBeRecorded(LogConstants.CTX_ODBC, MessageLevel.DETAIL)) {
- LogManager.logWarning(LogConstants.CTX_ODBC, t, "Error occurred"); //$NON-NLS-1$ //$NON-NLS-2$
+ LogManager.logWarning(LogConstants.CTX_ODBC, t, RuntimePlugin.Util.gs(RuntimePlugin.Event.TEIID40020)); //$NON-NLS-1$ //$NON-NLS-2$
}
} else {
//should be in the odbc layer
- LogManager.logError(LogConstants.CTX_ODBC, t, RuntimePlugin.Util.getString("PgBackendProtocol.unexpected_error")); //$NON-NLS-1$
+ LogManager.logError(LogConstants.CTX_ODBC, t, RuntimePlugin.Util.gs(RuntimePlugin.Event.TEIID40015));
}
SQLException e = TeiidSQLException.create(t);
startMessage('E');
Modified: trunk/runtime/src/main/java/org/teiid/transport/ServerWorkItem.java
===================================================================
--- trunk/runtime/src/main/java/org/teiid/transport/ServerWorkItem.java 2012-01-10 17:28:44 UTC (rev 3784)
+++ trunk/runtime/src/main/java/org/teiid/transport/ServerWorkItem.java 2012-01-11 19:18:32 UTC (rev 3785)
@@ -148,7 +148,7 @@
} else if (e instanceof AdminProcessingException) {
logProcessingException(e, context);
} else {
- LogManager.logError(context, e, RuntimePlugin.Util.getString("ServerWorkItem.Received_exception_processing_request", this.socketClientInstance.getWorkContext().getSessionId())); //$NON-NLS-1$
+ LogManager.logError(context, e, RuntimePlugin.Util.gs(RuntimePlugin.Event.TEIID40017, this.socketClientInstance.getWorkContext().getSessionId()));
}
return new ExceptionHolder(e);
@@ -161,6 +161,6 @@
}
StackTraceElement elem = cause.getStackTrace()[0];
LogManager.logDetail(context, e, "Processing exception for session", this.socketClientInstance.getWorkContext().getSessionId()); //$NON-NLS-1$
- LogManager.logWarning(context, RuntimePlugin.Util.getString("ServerWorkItem.processing_error", e.getMessage(), this.socketClientInstance.getWorkContext().getSessionId(), e.getClass().getName(), elem)); //$NON-NLS-1$
+ LogManager.logWarning(context, RuntimePlugin.Util.gs(RuntimePlugin.Event.TEIID40011, e.getMessage(), this.socketClientInstance.getWorkContext().getSessionId(), e.getClass().getName(), elem));
}
}
\ No newline at end of file
Modified: trunk/runtime/src/main/resources/org/teiid/runtime/i18n.properties
===================================================================
--- trunk/runtime/src/main/resources/org/teiid/runtime/i18n.properties 2012-01-10 17:28:44 UTC (rev 3784)
+++ trunk/runtime/src/main/resources/org/teiid/runtime/i18n.properties 2012-01-11 19:18:32 UTC (rev 3785)
@@ -30,18 +30,18 @@
VDBService.VDB_does_not_exist._3=Invalid VDB version \"{0}\" - must be a positive integer.
# session service
-SessionServiceImpl.invalid_session=The specified session ID "{0}" is invalid. It cannot be found in the userbase.
+TEIID40019=The specified session ID "{0}" is invalid. It cannot be found in the userbase.
SessionServiceImpl.reached_max_sessions = The server has reached the maximum number of sessions of {0} as defined by the property "session-max-limit". If more sessions are required, modify this property value in the "standalone-teiid.xml" file.
-SessionServiceImpl.expireSession = Expiring session {0}
-SessionServiceImpl.keepaliveFailed = Keepalive failed for session {0}
+TEIID40008 = Expiring session {0}
+TEIID40007 = Keepalive failed for session {0}
SessionServiceImpl.The_username_0_and/or_password_are_incorrect=The username "{0}" and/or password and/or payload token could not be authenticated by any membership domain.
-SessionServiceImpl.terminateSession = Admin [{0}] is terminating this session: {1}.
+TEIID40009 = Admin [{0}] is terminating this session: {1}.
no_passthrough_identity_found = Passthrough authentication failed. No authentication information found.
-ServerWorkItem.Received_exception_processing_request=Unexpected exception for session {0}
-ServerWorkItem.processing_error=Processing exception ''{0}'' for session {1}. Exception type {2} thrown from {3}. Enable more detailed logging to see the entire stacktrace.
+TEIID40017=Unexpected exception for session {0}
+TEIID40011=Processing exception ''{0}'' for session {1}. Exception type {2} thrown from {3}. Enable more detailed logging to see the entire stacktrace.
ServerWorkItem.Component_Not_Found=Only {0} connections are allowed on this port. Component not found: {1}
SocketTransport.1=Bound to address {0} listening on port {1}
@@ -49,29 +49,30 @@
SocketClientInstance.invalid_sessionkey=Invalid session key used during handshake
SSLAwareChannelHandler.channel_closed=Channel closed
-invlaid_vdb_file=Invalid VDB file deployment failed {0}
-redeploying_vdb=Re-deploying VDB {0}
-validity_errors_in_vdb=VDB has validity errors; failed to deploy - {0}
-vdb_save_failed=Failed to save metadata for VDB {0}
+
+TEIID40003=VDB {0}.{1} is set to "active"
+TEIID40006=VDB {0}.{1} is set to "inactive"
+validity_errors_in_vdb={0} VDB has validity errors; failed to deploy - {1}
+
vdb_delete_failed=Failed to delete the cached metadata files due to:
-vdb_deployed=VDB "{0}" deployed in {1} state.
-vdb_undeployed=VDB "{0}" undeployed.
+
+
system_vdb_load_error=System.vdb needs to be loaded before any other VDBs.
fail_to_deploy="{0}" Can not be active because model "{1}" is not fully configured.
-failed_to_retrive_metadata={0}.{1} is now "incomplete", because model "{2}" can not retrieve metadata. Please fix any errors and re-deploy relevant DataSources and/or the VDB.
-nosources_to_retrive_metadata={0}.{1} is now "incomplete", because model "{2}" can not retrieve metadata. Please deploy the necessary DataSources.
-invalid_metadata_file=Invalid metadata file found at {0}; delete this file and restart server.
+
+
+
udf_model_not_found=User Defined Function (UDF) model "{0}" not found in the VDB
duplicate_vdb=VDB with given name and version already exists! {0}.{1}
system_vdb_not_found=System.vdb not found in classpath
invalid_udf_file=No "path" information found to load the FUNCTION model {0}; FUNCTION model must have path information.
-failed_matadata_load=Failed to load metadata for VDB {0}.{1}
+
vdb_not_found=VDB {0}.{1} not found deployed.
-translator_not_found=For {0}.{1} VDB, Translator "{2}" not found.
+TEIID40005=For {0}.{1} VDB, Translator "{2}" not found.
recursive_delegation=For {0}.{1} VDB, recursive delegation {2} found.
-datasource_not_found=For {0}.{1} VDB, Data Source "{2}" not found.
+TEIID40012=For {0}.{1} VDB, Data Source "{2}" not found.
datasource_replaced=For {0}.{1} VDB, Data Source "{2}" replaced with "{3}"
-vdb_activated={0}.{1} status has been changed to active
+TEIID40003={0}.{1} status has been changed to active
vdb_inactivated={0}.{1} status has been changed to inactive. Check the required translators and data sources!
translator_added=Teiid translator "{0}" has been added.
invalid_class={0} invalid type of class specified. Must be of type org.teiid.connector.api.Connector
@@ -79,26 +80,30 @@
translator_removed=Teiid translator "{0}" removed.
no_set_method=No {0} method found for translator property {1}
required_property_not_exists=Required property "{0}" has no value. Deployment is incomplete.
-undefined_translator_props=The provided translator property values {0} were not used. Please check the properties that are expected by translator {1}.
+TEIID40001=The provided translator property values {0} were not used. Please check the properties that are expected by translator {1}.
name_not_found=Translator property "name" not defined for the deployment "{0}"
translator_type_not_found=The parent translator defined not found in configuration "{0}"
-failed_to_load_odbc_metadata=Failed to load the ODBC metadata repository.
+TEIID40002=Failed to load the ODBC metadata repository.
bad_binding=Binding on a statement, that has not been prepared:{0}
not_bound=No bound statement found with name {0}
no_stmt_found=No prepared statement found with name {0}
error_closing_stmt=Error closing portal statement {0}
model_metadata_loading=VDB {0}.{1} model {2} metadata is currently being loaded. Start Time: {3}
-metadata_loaded=VDB {0}.{1} model {2} metadata is currently being loaded.
+
ambigious_name=Ambiguous VDB name specified. Only single occurrence of the "." is allowed in the VDB name. Also, when version based vdb name is specified, then a separate "version" connection option is not allowed:{0}.{1}
lo_not_supported=LO functions are not supported
SSLConfiguration.no_anonymous=The anonymous cipher suite TLS_DH_anon_WITH_AES_128_CBC_SHA is not available. Please change the transport to be non-SSL or use non-anonymous SSL.
-replication_failed=Could not replicate object {0}
-PgBackendProtocol.ssl_error=Could not initialize ODBC SSL. non-SSL connections will still be allowed.
-PgBackendProtocol.unexpected_error=Unexpected error occurred
+
+TEIID40016=Could not initialize ODBC SSL. non-SSL connections will still be allowed.
+TEIID40015=Unexpected error occurred
wrong_logon_type_jaas = Wrong logon method is being used. Server is not set up for JAAS based authentication. Correct your client's 'AuthenticationType' property.
wrong_logon_type_krb5 = Wrong logon method is being used. Server is not set up for Kerberos based authentication. Correct your client's 'AuthenticationType' property.
krb5_login_failed=Kerberos context login failed
no_security_domains=No security domain configured for Kerberos authentication. Can not authenticate.
krb5_user_not_found=GSS authentication is in use, however authenticated user not found in the context to proceed.
auth_type=Authentication Type set to {0} for security-domains {1}
+replication_failed=replication failed to {0}
+TEIID40014=Kerberos context login failed
+TEIID40018=Exception terminitating session
+TEIID40020=Error occurred
\ No newline at end of file
Modified: trunk/test-integration/common/pom.xml
===================================================================
--- trunk/test-integration/common/pom.xml 2012-01-10 17:28:44 UTC (rev 3784)
+++ trunk/test-integration/common/pom.xml 2012-01-11 19:18:32 UTC (rev 3785)
@@ -22,7 +22,7 @@
</dependency>
<dependency>
- <artifactId>teiid-cache-jbosscache</artifactId>
+ <artifactId>teiid-jboss-integration</artifactId>
<groupId>org.jboss.teiid</groupId>
</dependency>
<dependency>
12 years, 11 months
teiid SVN: r3784 - in trunk: documentation/developer-guide/src/main/docbook/en-US/content and 2 other directories.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2012-01-10 12:28:44 -0500 (Tue, 10 Jan 2012)
New Revision: 3784
Modified:
trunk/api/src/main/java/org/teiid/language/Parameter.java
trunk/api/src/main/java/org/teiid/language/Select.java
trunk/documentation/developer-guide/src/main/docbook/en-US/content/translator-api.xml
trunk/engine/src/main/java/org/teiid/dqp/internal/datamgr/LanguageBridgeFactory.java
trunk/engine/src/test/java/org/teiid/query/processor/HardcodedDataManager.java
trunk/engine/src/test/java/org/teiid/query/processor/TestDependentJoins.java
Log:
TEIID-1540 refining support for dependent join pushdown, with a list rather than an iterator
Modified: trunk/api/src/main/java/org/teiid/language/Parameter.java
===================================================================
--- trunk/api/src/main/java/org/teiid/language/Parameter.java 2012-01-10 16:07:11 UTC (rev 3783)
+++ trunk/api/src/main/java/org/teiid/language/Parameter.java 2012-01-10 17:28:44 UTC (rev 3784)
@@ -28,7 +28,7 @@
private Class<?> type;
private int valueIndex;
- private String dependentSet;
+ private String dependentValueId;
@Override
public Class<?> getType() {
@@ -57,16 +57,16 @@
}
/**
- * The name of the dependent set this parameter references. Dependent sets are available via {@link Select#getDependentSets()}
+ * The id of the dependent values this parameter references. Dependent values are available via {@link Select#getDependentValues()}
* Will only be set for dependent join pushdown.
* @return
*/
- public String getDependentSet() {
- return dependentSet;
+ public String getDependentValueId() {
+ return dependentValueId;
}
- public void setDependentSet(String dependentSet) {
- this.dependentSet = dependentSet;
+ public void setDependentValueId(String dependentValueId) {
+ this.dependentValueId = dependentValueId;
}
}
Modified: trunk/api/src/main/java/org/teiid/language/Select.java
===================================================================
--- trunk/api/src/main/java/org/teiid/language/Select.java 2012-01-10 16:07:11 UTC (rev 3783)
+++ trunk/api/src/main/java/org/teiid/language/Select.java 2012-01-10 17:28:44 UTC (rev 3784)
@@ -38,7 +38,7 @@
private Condition where;
private GroupBy groupBy;
private Condition having;
- private Map<String, Iterable<List<?>>> dependentSets;
+ private Map<String, List<? extends List<?>>> dependentValues;
public Select(List<DerivedColumn> derivedColumns, boolean distinct, List<TableReference> from, Condition where,
GroupBy groupBy, Condition having, OrderBy orderBy) {
@@ -140,13 +140,16 @@
}
/**
- * @return the dependent sets or null if this is not a dependent join pushdown
+ * Gets the dependent value lists. The lists are memory-safe. Caution should be used
+ * to not access large lists in a non-memory safe manner. The lists are invalid
+ * after returning results from the pushdown query.
+ * @return the map of dependent values or null if this is not a dependent join pushdown
*/
- public Map<String, Iterable<List<?>>> getDependentSets() {
- return dependentSets;
+ public Map<String, List<? extends List<?>>> getDependentValues() {
+ return dependentValues;
}
- public void setDependentSets(Map<String, Iterable<List<?>>> dependentSets) {
- this.dependentSets = dependentSets;
+ public void setDependentValues(Map<String, List<? extends List<?>>> dependentValues) {
+ this.dependentValues = dependentValues;
}
}
Modified: trunk/documentation/developer-guide/src/main/docbook/en-US/content/translator-api.xml
===================================================================
--- trunk/documentation/developer-guide/src/main/docbook/en-US/content/translator-api.xml 2012-01-10 16:07:11 UTC (rev 3783)
+++ trunk/documentation/developer-guide/src/main/docbook/en-US/content/translator-api.xml 2012-01-10 17:28:44 UTC (rev 3784)
@@ -1633,9 +1633,9 @@
<title>Dependent Join Pushdown</title>
<para>Dependent joins are a technique used in federation to reduce the cost of cross source joins. Join values from one side of a join are made available
to the other side which reduces the number of tuples needed to preform the join. Translators may indicate support for dependent join pushdown via the supportsDependentJoin capability. The
- handling of pushdown dependent join queries can be quite complicated. The ordering (if present) and all of the non-dependent set constructs on the pushdown command must be honored, but if needed
+ handling of pushdown dependent join queries can be quite complicated. The ordering (if present) and all of the non-dependent criteria constructs on the pushdown command must be honored, but if needed
the dependent criteria, which will be a <code>Comparison</code> with a <code>Parameter</code>, may be ignored in part or in total. Pushdown dependent join queries will be instances of
- <code>Select</code> with the relevant dependent sets available via <code>Select.getDependentSets()</code>. The dependent set is associated to Parameters by name via the <code>Parameter.getDepenentSet()</code>
+ <code>Select</code> with the relevant dependent sets available via <code>Select.getDependentSets()</code>. The dependent set is associated to Parameters by id via the <code>Parameter.getDepenentValueId()</code>
identifier. The dependent set tuple iterators provide rows that are referenced by the column positions (available via <code>Parameter.getValueIndex()</code>) on the dependent join Comparison
criteria right expression. Care should be taken with the tuple values as they may guareenteed to be unique or ordered.
</para>
Modified: trunk/engine/src/main/java/org/teiid/dqp/internal/datamgr/LanguageBridgeFactory.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/dqp/internal/datamgr/LanguageBridgeFactory.java 2012-01-10 16:07:11 UTC (rev 3783)
+++ trunk/engine/src/main/java/org/teiid/dqp/internal/datamgr/LanguageBridgeFactory.java 2012-01-10 17:28:44 UTC (rev 3784)
@@ -22,14 +22,7 @@
package org.teiid.dqp.internal.datamgr;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.NoSuchElementException;
+import java.util.*;
import org.teiid.api.exception.query.QueryMetadataException;
import org.teiid.client.metadata.ParameterInfo;
@@ -70,7 +63,32 @@
public class LanguageBridgeFactory {
- private final class TupleSourceIterator implements Iterator<List<?>> {
+ private final class TupleBufferList extends AbstractList<List<?>> implements RandomAccess {
+ private final TupleBuffer tb;
+
+ private TupleBufferList(TupleBuffer tb) {
+ this.tb = tb;
+ }
+
+ @Override
+ public List<?> get(int index) {
+ if (index < 0 || index >= size()) {
+ throw new IndexOutOfBoundsException(String.valueOf(index));
+ }
+ try {
+ return tb.getBatch(index+1).getTuple(index+1);
+ } catch (TeiidComponentException e) {
+ throw new TeiidRuntimeException(e);
+ }
+ }
+
+ @Override
+ public int size() {
+ return tb.getRowCount();
+ }
+ }
+
+ private final class TupleSourceIterator implements Iterator<List<?>> {
private final TupleSource ts;
List<?> nextRow;
@@ -111,7 +129,7 @@
private RuntimeMetadataImpl metadataFactory = null;
private int valueIndex = 0;
private List<List<?>> allValues = new LinkedList<List<?>>();
- private Map<String, Iterable<List<?>>> dependentSets;
+ private Map<String, List<? extends List<?>>> dependentSets;
public LanguageBridgeFactory(QueryMetadataInterface metadata) {
if (metadata != null) {
@@ -120,25 +138,31 @@
}
public org.teiid.language.Command translate(Command command) {
- if (command == null) return null;
- if (command instanceof Query) {
- Select result = translate((Query)command);
- result.setDependentSets(this.dependentSets);
- return result;
- } else if (command instanceof SetQuery) {
- return translate((SetQuery)command);
- } else if (command instanceof Insert) {
- return translate((Insert)command);
- } else if (command instanceof Update) {
- return translate((Update)command);
- } else if (command instanceof Delete) {
- return translate((Delete)command);
- } else if (command instanceof StoredProcedure) {
- return translate((StoredProcedure)command);
- } else if (command instanceof BatchedUpdateCommand) {
- return translate((BatchedUpdateCommand)command);
- }
- throw new AssertionError();
+ try {
+ if (command == null) return null;
+ if (command instanceof Query) {
+ Select result = translate((Query)command);
+ result.setDependentValues(this.dependentSets);
+ return result;
+ } else if (command instanceof SetQuery) {
+ return translate((SetQuery)command);
+ } else if (command instanceof Insert) {
+ return translate((Insert)command);
+ } else if (command instanceof Update) {
+ return translate((Update)command);
+ } else if (command instanceof Delete) {
+ return translate((Delete)command);
+ } else if (command instanceof StoredProcedure) {
+ return translate((StoredProcedure)command);
+ } else if (command instanceof BatchedUpdateCommand) {
+ return translate((BatchedUpdateCommand)command);
+ }
+ throw new AssertionError();
+ } finally {
+ this.allValues.clear();
+ this.dependentSets = null;
+ this.valueIndex = 0;
+ }
}
QueryExpression translate(QueryCommand command) {
@@ -306,17 +330,11 @@
p.setType(criteria.getExpression().getType());
final TupleBuffer tb = criteria.getDependentValueSource().getTupleBuffer();
p.setValueIndex(tb.getSchema().indexOf(criteria.getValueExpression()));
- p.setDependentSet(criteria.getContextSymbol());
+ p.setDependentValueId(criteria.getContextSymbol());
if (this.dependentSets == null) {
- this.dependentSets = new HashMap<String, Iterable<List<?>>>();
+ this.dependentSets = new HashMap<String, List<? extends List<?>>>();
}
- this.dependentSets.put(criteria.getContextSymbol(), new Iterable<List<?>>() {
-
- @Override
- public Iterator<List<?>> iterator() {
- return new TupleSourceIterator(tb.createIndexedTupleSource());
- }
- });
+ this.dependentSets.put(criteria.getContextSymbol(), new TupleBufferList(tb));
Comparison result = new org.teiid.language.Comparison(translate(criteria.getExpression()),
p, operator);
return result;
Modified: trunk/engine/src/test/java/org/teiid/query/processor/HardcodedDataManager.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/processor/HardcodedDataManager.java 2012-01-10 16:07:11 UTC (rev 3783)
+++ trunk/engine/src/test/java/org/teiid/query/processor/HardcodedDataManager.java 2012-01-10 17:28:44 UTC (rev 3784)
@@ -36,6 +36,7 @@
import org.teiid.metadata.MetadataRepository;
import org.teiid.query.metadata.QueryMetadataInterface;
import org.teiid.query.sql.lang.Command;
+import org.teiid.query.sql.symbol.Expression;
import org.teiid.query.util.CommandContext;
@@ -47,10 +48,10 @@
ProcessorDataManager {
// sql string to data
- private Map<String, List[]> data = new HashMap<String, List[]>();
+ private Map<String, List<?>[]> data = new HashMap<String, List<?>[]>();
// valid models - if null, any is assumed valid
- private Set validModels;
+ private Set<String> validModels;
private boolean mustRegisterCommands = true;
@@ -58,6 +59,7 @@
// Collect all commands run against this class
private List<Command> commandHistory = new ArrayList<Command>(); // Commands
+ private List<org.teiid.language.Command> pushdownCommands = new ArrayList<org.teiid.language.Command>(); // Commands
private LanguageBridgeFactory lbf;
@@ -74,7 +76,7 @@
this.mustRegisterCommands = mustRegisterCommands;
}
- public void addData(String sql, List[] rows) {
+ public void addData(String sql, List<?>[] rows) {
data.put(sql, rows);
}
@@ -92,7 +94,7 @@
* @param models
* @since 4.2
*/
- public void setValidModels(Set models) {
+ public void setValidModels(Set<String> models) {
this.validModels = models;
}
@@ -101,10 +103,14 @@
* @return
* @since 4.2
*/
- public List getCommandHistory() {
+ public List<Command> getCommandHistory() {
return this.commandHistory;
}
+ public List<org.teiid.language.Command> getPushdownCommands() {
+ return pushdownCommands;
+ }
+
/**
* @see org.teiid.query.processor.ProcessorDataManager#lookupCodeValue(org.teiid.query.util.CommandContext, java.lang.String, java.lang.String, java.lang.String, java.lang.Object)
* @since 4.2
@@ -132,16 +138,18 @@
}
this.commandHistory.add(command);
- List projectedSymbols = command.getProjectedSymbols();
+ List<Expression> projectedSymbols = command.getProjectedSymbols();
String commandString = null;
if (lbf == null) {
commandString = command.toString();
} else {
- commandString = lbf.translate(command).toString();
+ org.teiid.language.Command cmd = lbf.translate(command);
+ this.pushdownCommands.add(cmd);
+ commandString = cmd.toString();
}
- List[] rows = data.get(commandString);
+ List<?>[] rows = data.get(commandString);
if(rows == null) {
if (mustRegisterCommands) {
throw new TeiidComponentException("Unknown command: " + commandString); //$NON-NLS-1$
@@ -172,13 +180,11 @@
@Override
public EventDistributor getEventDistributor() {
- // TODO Auto-generated method stub
return null;
}
@Override
public MetadataRepository getMetadataRepository() {
- // TODO Auto-generated method stub
return null;
}
Modified: trunk/engine/src/test/java/org/teiid/query/processor/TestDependentJoins.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/processor/TestDependentJoins.java 2012-01-10 16:07:11 UTC (rev 3783)
+++ trunk/engine/src/test/java/org/teiid/query/processor/TestDependentJoins.java 2012-01-10 17:28:44 UTC (rev 3784)
@@ -31,6 +31,7 @@
import org.junit.Test;
import org.teiid.core.TeiidComponentException;
import org.teiid.core.TeiidProcessingException;
+import org.teiid.language.Select;
import org.teiid.query.metadata.QueryMetadataInterface;
import org.teiid.query.optimizer.TestOptimizer;
import org.teiid.query.optimizer.TestOptimizer.ComparisonMode;
@@ -944,6 +945,11 @@
// Run query
TestProcessor.helpProcess(plan, dataManager, expected);
+
+ Select s = (Select)dataManager.getPushdownCommands().get(1);
+ assertEquals(1, s.getDependentValues().size());
+ List<? extends List<?>> vals = s.getDependentValues().values().iterator().next();
+ assertEquals(1, vals.size());
}
}
12 years, 11 months
teiid SVN: r3783 - in trunk: api/src/main/java/org/teiid/translator and 8 other directories.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2012-01-10 11:07:11 -0500 (Tue, 10 Jan 2012)
New Revision: 3783
Modified:
trunk/api/src/main/java/org/teiid/language/Parameter.java
trunk/api/src/main/java/org/teiid/language/Select.java
trunk/api/src/main/java/org/teiid/translator/ExecutionFactory.java
trunk/build/kits/jboss-as7/docs/teiid/teiid-releasenotes.html
trunk/documentation/developer-guide/src/main/docbook/en-US/content/translator-api.xml
trunk/engine/src/main/java/org/teiid/dqp/internal/datamgr/CapabilitiesConverter.java
trunk/engine/src/main/java/org/teiid/dqp/internal/datamgr/LanguageBridgeFactory.java
trunk/engine/src/main/java/org/teiid/query/optimizer/capabilities/SourceCapabilities.java
trunk/engine/src/main/java/org/teiid/query/optimizer/relational/PlanToProcessConverter.java
trunk/engine/src/main/java/org/teiid/query/processor/relational/DependentAccessNode.java
trunk/engine/src/main/java/org/teiid/query/sql/lang/DependentSetCriteria.java
trunk/engine/src/test/java/org/teiid/query/processor/TestDependentJoins.java
Log:
TEIID-1540 adding support for dependent join pushdown
Modified: trunk/api/src/main/java/org/teiid/language/Parameter.java
===================================================================
--- trunk/api/src/main/java/org/teiid/language/Parameter.java 2012-01-09 19:33:46 UTC (rev 3782)
+++ trunk/api/src/main/java/org/teiid/language/Parameter.java 2012-01-10 16:07:11 UTC (rev 3783)
@@ -28,6 +28,7 @@
private Class<?> type;
private int valueIndex;
+ private String dependentSet;
@Override
public Class<?> getType() {
@@ -55,4 +56,17 @@
return valueIndex;
}
+ /**
+ * The name of the dependent set this parameter references. Dependent sets are available via {@link Select#getDependentSets()}
+ * Will only be set for dependent join pushdown.
+ * @return
+ */
+ public String getDependentSet() {
+ return dependentSet;
+ }
+
+ public void setDependentSet(String dependentSet) {
+ this.dependentSet = dependentSet;
+ }
+
}
Modified: trunk/api/src/main/java/org/teiid/language/Select.java
===================================================================
--- trunk/api/src/main/java/org/teiid/language/Select.java 2012-01-09 19:33:46 UTC (rev 3782)
+++ trunk/api/src/main/java/org/teiid/language/Select.java 2012-01-10 16:07:11 UTC (rev 3783)
@@ -23,6 +23,7 @@
package org.teiid.language;
import java.util.List;
+import java.util.Map;
import org.teiid.language.visitor.LanguageObjectVisitor;
@@ -37,6 +38,7 @@
private Condition where;
private GroupBy groupBy;
private Condition having;
+ private Map<String, Iterable<List<?>>> dependentSets;
public Select(List<DerivedColumn> derivedColumns, boolean distinct, List<TableReference> from, Condition where,
GroupBy groupBy, Condition having, OrderBy orderBy) {
@@ -136,4 +138,15 @@
public Select getProjectedQuery() {
return this;
}
+
+ /**
+ * @return the dependent sets or null if this is not a dependent join pushdown
+ */
+ public Map<String, Iterable<List<?>>> getDependentSets() {
+ return dependentSets;
+ }
+
+ public void setDependentSets(Map<String, Iterable<List<?>>> dependentSets) {
+ this.dependentSets = dependentSets;
+ }
}
Modified: trunk/api/src/main/java/org/teiid/translator/ExecutionFactory.java
===================================================================
--- trunk/api/src/main/java/org/teiid/translator/ExecutionFactory.java 2012-01-09 19:33:46 UTC (rev 3782)
+++ trunk/api/src/main/java/org/teiid/translator/ExecutionFactory.java 2012-01-10 16:07:11 UTC (rev 3783)
@@ -930,5 +930,13 @@
public boolean supportsOnlyLiteralComparison() {
return false;
}
+
+ /**
+ * @return true if dependent join pushdown is supported
+ * @since 8.0
+ */
+ public boolean supportsDependentJoins() {
+ return false;
+ }
}
Modified: trunk/build/kits/jboss-as7/docs/teiid/teiid-releasenotes.html
===================================================================
--- trunk/build/kits/jboss-as7/docs/teiid/teiid-releasenotes.html 2012-01-09 19:33:46 UTC (rev 3782)
+++ trunk/build/kits/jboss-as7/docs/teiid/teiid-releasenotes.html 2012-01-10 16:07:11 UTC (rev 3783)
@@ -27,13 +27,12 @@
<H2><A NAME="Highlights"></A>Highlights</H2>
<UL>
<LI><B>CallableStatement Named Parameters</B> - you can now use CallableStatement named parameter get/set methods.
- <LI><B>New Translator capabilities</B> - translators may indicate which convert functions they support and restrict non-join comparisons
- to only literals.
<LI><B>New Translator capabilities</B>
<UL>
<LI>translators may indicate which convert functions they support
<LI>restrict non-join comparisons to only literals.
- <LI>return ReusableExecution instances for processing nodes that issue multiple queries.
+ <LI>return ReusableExecution instances for processing nodes that issue multiple queries.
+ <LI>translators may indicate support for dependent join handling
</UL>
<LI><B>Continuous Asynch Queries</B> to process plans in a streamed window fashion the TeiidStatement/TeiidPreparedStatement methods now take a RequestOptions object to specify continuous mode. See the Client and Developers Guides for more.
</UL>
Modified: trunk/documentation/developer-guide/src/main/docbook/en-US/content/translator-api.xml
===================================================================
--- trunk/documentation/developer-guide/src/main/docbook/en-US/content/translator-api.xml 2012-01-09 19:33:46 UTC (rev 3782)
+++ trunk/documentation/developer-guide/src/main/docbook/en-US/content/translator-api.xml 2012-01-10 16:07:11 UTC (rev 3783)
@@ -915,6 +915,18 @@
</row>
<row>
<entry>
+ <para>DependentJoins</para>
+ </entry>
+ <entry>
+ <para>Base join and criteria support</para>
+ </entry>
+ <entry>
+ <para>Translator supports dependent join pushdown. See <xref linkend="dependent_joins"/>. When set the MaxDependentInPredicates and MaxInCriteriaSize values are not used by the engine, rather all
+ independent values are made available to the pushdown command.</para>
+ </entry>
+ </row>
+ <row>
+ <entry>
<para>InlineViews</para>
</entry>
<entry>
@@ -1617,6 +1629,20 @@
</section>
+ <section id="dependent_joins">
+ <title>Dependent Join Pushdown</title>
+ <para>Dependent joins are a technique used in federation to reduce the cost of cross source joins. Join values from one side of a join are made available
+ to the other side which reduces the number of tuples needed to preform the join. Translators may indicate support for dependent join pushdown via the supportsDependentJoin capability. The
+ handling of pushdown dependent join queries can be quite complicated. The ordering (if present) and all of the non-dependent set constructs on the pushdown command must be honored, but if needed
+ the dependent criteria, which will be a <code>Comparison</code> with a <code>Parameter</code>, may be ignored in part or in total. Pushdown dependent join queries will be instances of
+ <code>Select</code> with the relevant dependent sets available via <code>Select.getDependentSets()</code>. The dependent set is associated to Parameters by name via the <code>Parameter.getDepenentSet()</code>
+ identifier. The dependent set tuple iterators provide rows that are referenced by the column positions (available via <code>Parameter.getValueIndex()</code>) on the dependent join Comparison
+ criteria right expression. Care should be taken with the tuple values as they may guareenteed to be unique or ordered.
+ </para>
+ <note><para>There is no reference implementation of this functionality as all built-in translators
+ rely on the engine to handle breaking up dependent joins into simplier queries.</para></note>
+ </section>
+
<section id="delegating_translator">
<title>Delegating Translator</title>
<para>In some instances you may wish to extend several differnt kinds of translators with the same functionality.
Modified: trunk/engine/src/main/java/org/teiid/dqp/internal/datamgr/CapabilitiesConverter.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/dqp/internal/datamgr/CapabilitiesConverter.java 2012-01-09 19:33:46 UTC (rev 3782)
+++ trunk/engine/src/main/java/org/teiid/dqp/internal/datamgr/CapabilitiesConverter.java 2012-01-10 16:07:11 UTC (rev 3783)
@@ -111,6 +111,7 @@
tgtCaps.setCapabilitySupport(Capability.CRITERIA_LIKE_REGEX, srcCaps.supportsLikeRegex());
setSupports(connectorID, tgtCaps, Capability.WINDOW_FUNCTION_DISTINCT_AGGREGATES, srcCaps.supportsWindowDistinctAggregates(), Capability.ELEMENTARY_OLAP, Capability.QUERY_AGGREGATES_DISTINCT);
tgtCaps.setCapabilitySupport(Capability.CRITERIA_ONLY_LITERAL_COMPARE, srcCaps.supportsOnlyLiteralComparison());
+ tgtCaps.setCapabilitySupport(Capability.DEPENDENT_JOIN, srcCaps.supportsDependentJoins());
//TODO: as more types are added it may make more sense to just delegate calls to the executionfactory
for (int i = 0; i <= DataTypeManager.MAX_TYPE_CODE; i++) {
Modified: trunk/engine/src/main/java/org/teiid/dqp/internal/datamgr/LanguageBridgeFactory.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/dqp/internal/datamgr/LanguageBridgeFactory.java 2012-01-09 19:33:46 UTC (rev 3782)
+++ trunk/engine/src/main/java/org/teiid/dqp/internal/datamgr/LanguageBridgeFactory.java 2012-01-10 16:07:11 UTC (rev 3783)
@@ -24,13 +24,16 @@
import java.util.ArrayList;
import java.util.Collection;
+import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
+import java.util.Map;
import java.util.NoSuchElementException;
import org.teiid.api.exception.query.QueryMetadataException;
import org.teiid.client.metadata.ParameterInfo;
+import org.teiid.common.buffer.TupleBuffer;
import org.teiid.common.buffer.TupleSource;
import org.teiid.core.CoreConstants;
import org.teiid.core.TeiidComponentException;
@@ -67,9 +70,48 @@
public class LanguageBridgeFactory {
- private RuntimeMetadataImpl metadataFactory = null;
+ private final class TupleSourceIterator implements Iterator<List<?>> {
+ private final TupleSource ts;
+ List<?> nextRow;
+
+ private TupleSourceIterator(TupleSource ts) {
+ this.ts = ts;
+ }
+
+ @Override
+ public boolean hasNext() {
+ if (nextRow == null) {
+ try {
+ nextRow = ts.nextTuple();
+ } catch (TeiidComponentException e) {
+ throw new TeiidRuntimeException(e);
+ } catch (TeiidProcessingException e) {
+ throw new TeiidRuntimeException(e);
+ }
+ }
+ return nextRow != null;
+ }
+
+ @Override
+ public List<?> next() {
+ if (nextRow == null && !hasNext()) {
+ throw new NoSuchElementException();
+ }
+ List<?> result = nextRow;
+ nextRow = null;
+ return result;
+ }
+
+ @Override
+ public void remove() {
+ throw new UnsupportedOperationException();
+ }
+ }
+
+ private RuntimeMetadataImpl metadataFactory = null;
private int valueIndex = 0;
private List<List<?>> allValues = new LinkedList<List<?>>();
+ private Map<String, Iterable<List<?>>> dependentSets;
public LanguageBridgeFactory(QueryMetadataInterface metadata) {
if (metadata != null) {
@@ -80,7 +122,9 @@
public org.teiid.language.Command translate(Command command) {
if (command == null) return null;
if (command instanceof Query) {
- return translate((Query)command);
+ Select result = translate((Query)command);
+ result.setDependentSets(this.dependentSets);
+ return result;
} else if (command instanceof SetQuery) {
return translate((SetQuery)command);
} else if (command instanceof Insert) {
@@ -250,10 +294,34 @@
return translate((SubqueryCompareCriteria)criteria);
} else if (criteria instanceof SubquerySetCriteria) {
return translate((SubquerySetCriteria)criteria);
+ } else if (criteria instanceof DependentSetCriteria) {
+ return translate((DependentSetCriteria)criteria);
}
throw new AssertionError();
}
+
+ org.teiid.language.Comparison translate(DependentSetCriteria criteria) {
+ Operator operator = Operator.EQ;
+ Parameter p = new Parameter();
+ p.setType(criteria.getExpression().getType());
+ final TupleBuffer tb = criteria.getDependentValueSource().getTupleBuffer();
+ p.setValueIndex(tb.getSchema().indexOf(criteria.getValueExpression()));
+ p.setDependentSet(criteria.getContextSymbol());
+ if (this.dependentSets == null) {
+ this.dependentSets = new HashMap<String, Iterable<List<?>>>();
+ }
+ this.dependentSets.put(criteria.getContextSymbol(), new Iterable<List<?>>() {
+ @Override
+ public Iterator<List<?>> iterator() {
+ return new TupleSourceIterator(tb.createIndexedTupleSource());
+ }
+ });
+ Comparison result = new org.teiid.language.Comparison(translate(criteria.getExpression()),
+ p, operator);
+ return result;
+ }
+
org.teiid.language.Comparison translate(CompareCriteria criteria) {
Operator operator = Operator.EQ;
switch(criteria.getOperator()) {
@@ -558,39 +626,7 @@
valueSource = translate(insert.getQueryExpression());
} else if (insert.getTupleSource() != null) {
final TupleSource ts = insert.getTupleSource();
- parameterValues = new Iterator<List<?>>() {
- List<?> nextRow;
-
- @Override
- public boolean hasNext() {
- if (nextRow == null) {
- try {
- nextRow = ts.nextTuple();
- } catch (TeiidComponentException e) {
- throw new TeiidRuntimeException(e);
- } catch (TeiidProcessingException e) {
- throw new TeiidRuntimeException(e);
- }
- }
- return nextRow != null;
- }
-
- @Override
- public List<?> next() {
- if (nextRow == null && !hasNext()) {
- throw new NoSuchElementException();
- }
- List<?> result = nextRow;
- nextRow = null;
- return result;
- }
-
- @Override
- public void remove() {
- throw new UnsupportedOperationException();
- }
-
- };
+ parameterValues = new TupleSourceIterator(ts);
List<org.teiid.language.Expression> translatedValues = new ArrayList<org.teiid.language.Expression>();
for (int i = 0; i < insert.getVariables().size(); i++) {
ElementSymbol es = insert.getVariables().get(i);
Modified: trunk/engine/src/main/java/org/teiid/query/optimizer/capabilities/SourceCapabilities.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/optimizer/capabilities/SourceCapabilities.java 2012-01-09 19:33:46 UTC (rev 3782)
+++ trunk/engine/src/main/java/org/teiid/query/optimizer/capabilities/SourceCapabilities.java 2012-01-10 16:07:11 UTC (rev 3783)
@@ -329,7 +329,8 @@
ELEMENTARY_OLAP("ElementaryOLAP"), //$NON-NLS-1$
WINDOW_FUNCTION_ORDER_BY_AGGREGATES("WindowOrderByAggregates"), //$NON-NLS-1$
CRITERIA_SIMILAR,
- CRITERIA_LIKE_REGEX,
+ CRITERIA_LIKE_REGEX,
+ DEPENDENT_JOIN,
WINDOW_FUNCTION_DISTINCT_AGGREGATES("WindowDistinctAggregates"); //$NON-NLS-1$
Modified: trunk/engine/src/main/java/org/teiid/query/optimizer/relational/PlanToProcessConverter.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/optimizer/relational/PlanToProcessConverter.java 2012-01-09 19:33:46 UTC (rev 3782)
+++ trunk/engine/src/main/java/org/teiid/query/optimizer/relational/PlanToProcessConverter.java 2012-01-10 16:07:11 UTC (rev 3783)
@@ -288,6 +288,7 @@
DependentAccessNode depAccessNode = new DependentAccessNode(getID());
if(modelID != null){
+ depAccessNode.setPushdown(CapabilitiesUtil.supports(Capability.DEPENDENT_JOIN, modelID, metadata, capFinder));
depAccessNode.setMaxSetSize(CapabilitiesUtil.getMaxInCriteriaSize(modelID, metadata, capFinder));
depAccessNode.setMaxPredicates(CapabilitiesUtil.getMaxDependentPredicates(modelID, metadata, capFinder));
}
Modified: trunk/engine/src/main/java/org/teiid/query/processor/relational/DependentAccessNode.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/processor/relational/DependentAccessNode.java 2012-01-09 19:33:46 UTC (rev 3782)
+++ trunk/engine/src/main/java/org/teiid/query/processor/relational/DependentAccessNode.java 2012-01-10 16:07:11 UTC (rev 3783)
@@ -22,13 +22,16 @@
package org.teiid.query.processor.relational;
+import java.util.ArrayList;
import java.util.Collections;
+import java.util.List;
import org.teiid.core.TeiidComponentException;
import org.teiid.core.TeiidProcessingException;
import org.teiid.core.util.Assertion;
import org.teiid.query.sql.lang.Command;
import org.teiid.query.sql.lang.Criteria;
+import org.teiid.query.sql.lang.DependentSetCriteria;
import org.teiid.query.sql.lang.Query;
@@ -43,6 +46,7 @@
//plan state
private int maxSetSize;
private int maxPredicates;
+ private boolean pushdown;
//processing state
private DependentCriteriaProcessor criteriaProcessor;
@@ -99,6 +103,7 @@
DependentAccessNode clonedNode = new DependentAccessNode(super.getID());
clonedNode.maxSetSize = this.maxSetSize;
clonedNode.maxPredicates = this.maxPredicates;
+ clonedNode.pushdown = this.pushdown;
super.copy(this, clonedNode);
return clonedNode;
}
@@ -134,6 +139,24 @@
Assertion.assertTrue(atomicCommand instanceof Query);
Query query = (Query)atomicCommand;
+
+ if (pushdown) {
+ List<Criteria> newCriteria = new ArrayList<Criteria>();
+ List<Criteria> queryCriteria = Criteria.separateCriteriaByAnd(query.getCriteria());
+ for (Criteria criteria : queryCriteria) {
+ if (!(criteria instanceof DependentSetCriteria)) {
+ newCriteria.add(criteria);
+ continue;
+ }
+ DependentSetCriteria dsc = (DependentSetCriteria)criteria;
+ dsc = dsc.clone();
+ DependentValueSource dvs = (DependentValueSource) getContext().getVariableContext().getGlobalValue(dsc.getContextSymbol());
+ dsc.setDependentValueSource(dvs);
+ newCriteria.add(dsc);
+ }
+ query.setCriteria(Criteria.combineCriteria(newCriteria));
+ return RelationalNodeUtil.shouldExecute(atomicCommand, true);
+ }
if (this.criteriaProcessor == null) {
this.criteriaProcessor = new DependentCriteriaProcessor(this.maxSetSize, this.maxPredicates, this, query.getCriteria());
@@ -176,7 +199,14 @@
* @see org.teiid.query.processor.relational.AccessNode#hasNextCommand()
*/
protected boolean hasNextCommand() {
+ if (pushdown) {
+ return false;
+ }
return criteriaProcessor.hasNextCommand();
}
+ public void setPushdown(boolean pushdown) {
+ this.pushdown = pushdown;
+ }
+
}
\ No newline at end of file
Modified: trunk/engine/src/main/java/org/teiid/query/sql/lang/DependentSetCriteria.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/sql/lang/DependentSetCriteria.java 2012-01-09 19:33:46 UTC (rev 3782)
+++ trunk/engine/src/main/java/org/teiid/query/sql/lang/DependentSetCriteria.java 2012-01-10 16:07:11 UTC (rev 3783)
@@ -25,6 +25,7 @@
import org.teiid.core.util.EquivalenceUtil;
import org.teiid.core.util.HashCodeUtil;
import org.teiid.query.optimizer.relational.rules.NewCalculateCostUtil;
+import org.teiid.query.processor.relational.DependentValueSource;
import org.teiid.query.sql.LanguageVisitor;
import org.teiid.query.sql.symbol.ContextReference;
import org.teiid.query.sql.symbol.Expression;
@@ -50,6 +51,11 @@
private float ndv = NewCalculateCostUtil.UNKNOWN_VALUE;
private float maxNdv = NewCalculateCostUtil.UNKNOWN_VALUE;
+ /**
+ * set only for dependent pushdown
+ */
+ private DependentValueSource dependentValueSource;
+
/**
* Construct with the left expression
*/
@@ -142,7 +148,7 @@
* the original object, just like Reference.
* @return Deep copy of object
*/
- public Object clone() {
+ public DependentSetCriteria clone() {
Expression copy = null;
if(getExpression() != null) {
copy = (Expression) getExpression().clone();
@@ -165,4 +171,13 @@
}
}
+ public DependentValueSource getDependentValueSource() {
+ return dependentValueSource;
+ }
+
+ public void setDependentValueSource(
+ DependentValueSource dependentValueSource) {
+ this.dependentValueSource = dependentValueSource;
+ }
+
}
Modified: trunk/engine/src/test/java/org/teiid/query/processor/TestDependentJoins.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/processor/TestDependentJoins.java 2012-01-09 19:33:46 UTC (rev 3782)
+++ trunk/engine/src/test/java/org/teiid/query/processor/TestDependentJoins.java 2012-01-10 16:07:11 UTC (rev 3783)
@@ -35,6 +35,7 @@
import org.teiid.query.optimizer.TestOptimizer;
import org.teiid.query.optimizer.TestOptimizer.ComparisonMode;
import org.teiid.query.optimizer.capabilities.BasicSourceCapabilities;
+import org.teiid.query.optimizer.capabilities.DefaultCapabilitiesFinder;
import org.teiid.query.optimizer.capabilities.FakeCapabilitiesFinder;
import org.teiid.query.optimizer.capabilities.SourceCapabilities.Capability;
import org.teiid.query.processor.relational.JoinNode;
@@ -921,4 +922,28 @@
TestProcessor.helpProcess(plan, dataManager, expected);
}
+ @Test public void testMakeIndHintPushdown() {
+ // Create query
+ String sql = "SELECT pm1.g1.e1 FROM /*+ MAKEIND */ pm1.g1, pm2.g1 WHERE pm1.g1.e1 = pm2.g1.e1 AND pm1.g1.e2=pm2.g1.e2 order by pm1.g1.e1"; //$NON-NLS-1$
+
+ // Create expected results
+ List[] expected = new List[] {
+ Arrays.asList(new Object[] { "a" }), //$NON-NLS-1$
+ };
+
+ // Construct data manager with data
+ HardcodedDataManager dataManager = new HardcodedDataManager(RealMetadataFactory.example1Cached());
+ dataManager.addData("SELECT g_0.e1 AS c_0, g_0.e2 AS c_1 FROM g1 AS g_0 ORDER BY c_0, c_1", new List[] {Arrays.asList("a", 1)});
+ dataManager.addData("SELECT g_0.e1 AS c_0, g_0.e2 AS c_1 FROM g1 AS g_0 WHERE g_0.e1 = ? AND g_0.e2 = ? ORDER BY c_0, c_1", new List[] {Arrays.asList("a", 1)});
+ BasicSourceCapabilities bsc = TestOptimizer.getTypicalCapabilities();
+ bsc.setCapabilitySupport(Capability.DEPENDENT_JOIN, true);
+ DefaultCapabilitiesFinder dcf = new DefaultCapabilitiesFinder(bsc);
+ // Plan query
+ ProcessorPlan plan = TestProcessor.helpGetPlan(sql, RealMetadataFactory.example1Cached(), dcf);
+ TestOptimizer.checkDependentJoinCount(plan, 1);
+
+ // Run query
+ TestProcessor.helpProcess(plan, dataManager, expected);
+ }
+
}
12 years, 11 months
teiid SVN: r3782 - in trunk: api/src/main/java/org/teiid/language/visitor and 11 other directories.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2012-01-09 14:33:46 -0500 (Mon, 09 Jan 2012)
New Revision: 3782
Added:
trunk/api/src/main/java/org/teiid/language/BatchedCommand.java
trunk/api/src/main/java/org/teiid/language/Parameter.java
Removed:
trunk/api/src/main/java/org/teiid/language/IteratorValueSource.java
Modified:
trunk/api/src/main/java/org/teiid/language/Delete.java
trunk/api/src/main/java/org/teiid/language/Insert.java
trunk/api/src/main/java/org/teiid/language/Literal.java
trunk/api/src/main/java/org/teiid/language/Update.java
trunk/api/src/main/java/org/teiid/language/visitor/AbstractLanguageVisitor.java
trunk/api/src/main/java/org/teiid/language/visitor/LanguageObjectVisitor.java
trunk/api/src/main/java/org/teiid/language/visitor/SQLStringVisitor.java
trunk/api/src/main/java/org/teiid/translator/BaseDelegatingExecutionFactory.java
trunk/api/src/main/java/org/teiid/translator/ExecutionFactory.java
trunk/build/kits/jboss-as7/docs/teiid/teiid-releasenotes.html
trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/JDBCBaseExecution.java
trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/JDBCExecutionFactory.java
trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/JDBCQueryExecution.java
trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/JDBCUpdateExecution.java
trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/SQLConversionVisitor.java
trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/TranslatedCommand.java
trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/db2/SubstringFunctionModifier.java
trunk/connectors/translator-jdbc/src/test/java/org/teiid/translator/jdbc/TestJDBCUpdateExecution.java
trunk/documentation/developer-guide/src/main/docbook/en-US/content/translator-api.xml
trunk/engine/src/main/java/org/teiid/dqp/internal/datamgr/CapabilitiesConverter.java
trunk/engine/src/main/java/org/teiid/dqp/internal/datamgr/LanguageBridgeFactory.java
trunk/engine/src/main/java/org/teiid/query/optimizer/relational/PlanToProcessConverter.java
trunk/engine/src/main/java/org/teiid/query/processor/relational/ProjectIntoNode.java
trunk/engine/src/test/java/org/teiid/query/processor/TestInsertProcessing.java
trunk/engine/src/test/java/org/teiid/query/processor/relational/TestProjectIntoNode.java
Log:
TEIID-1894 removed the bulk insert mode from the project into node and consolidated the translator api via an new expression type, Parameter
Added: trunk/api/src/main/java/org/teiid/language/BatchedCommand.java
===================================================================
--- trunk/api/src/main/java/org/teiid/language/BatchedCommand.java (rev 0)
+++ trunk/api/src/main/java/org/teiid/language/BatchedCommand.java 2012-01-09 19:33:46 UTC (rev 3782)
@@ -0,0 +1,34 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+
+package org.teiid.language;
+
+import java.util.Iterator;
+import java.util.List;
+
+public interface BatchedCommand extends Command {
+
+ Iterator<? extends List<?>> getParameterValues();
+
+ void setParameterValues(Iterator<? extends List<?>> values);
+
+}
Property changes on: trunk/api/src/main/java/org/teiid/language/BatchedCommand.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified: trunk/api/src/main/java/org/teiid/language/Delete.java
===================================================================
--- trunk/api/src/main/java/org/teiid/language/Delete.java 2012-01-07 16:10:27 UTC (rev 3781)
+++ trunk/api/src/main/java/org/teiid/language/Delete.java 2012-01-09 19:33:46 UTC (rev 3782)
@@ -22,15 +22,19 @@
package org.teiid.language;
+import java.util.Iterator;
+import java.util.List;
+
import org.teiid.language.visitor.LanguageObjectVisitor;
/**
* Represents a DELETE command.
*/
-public class Delete extends BaseLanguageObject implements Command {
+public class Delete extends BaseLanguageObject implements BatchedCommand {
private NamedTable table;
private Condition where;
+ private Iterator<? extends List<?>> parameterValues;
public Delete(NamedTable group, Condition criteria) {
this.table = group;
@@ -72,5 +76,14 @@
public void setWhere(Condition criteria) {
this.where = criteria;
}
+
+ @Override
+ public Iterator<? extends List<?>> getParameterValues() {
+ return parameterValues;
+ }
+
+ public void setParameterValues(Iterator<? extends List<?>> parameterValues) {
+ this.parameterValues = parameterValues;
+ }
}
Modified: trunk/api/src/main/java/org/teiid/language/Insert.java
===================================================================
--- trunk/api/src/main/java/org/teiid/language/Insert.java 2012-01-07 16:10:27 UTC (rev 3781)
+++ trunk/api/src/main/java/org/teiid/language/Insert.java 2012-01-09 19:33:46 UTC (rev 3782)
@@ -22,16 +22,18 @@
package org.teiid.language;
+import java.util.Iterator;
import java.util.List;
import org.teiid.language.visitor.LanguageObjectVisitor;
-public class Insert extends BaseLanguageObject implements Command {
+public class Insert extends BaseLanguageObject implements BatchedCommand {
private NamedTable table;
private List<ColumnReference> columns;
private InsertValueSource valueSource;
+ private Iterator<? extends List<?>> parameterValues;
public Insert(NamedTable group, List<ColumnReference> elements, InsertValueSource valueSource) {
this.table = group;
@@ -66,5 +68,14 @@
public void setValueSource(InsertValueSource values) {
this.valueSource = values;
}
+
+ @Override
+ public Iterator<? extends List<?>> getParameterValues() {
+ return parameterValues;
+ }
+
+ public void setParameterValues(Iterator<? extends List<?>> parameterValues) {
+ this.parameterValues = parameterValues;
+ }
}
Deleted: trunk/api/src/main/java/org/teiid/language/IteratorValueSource.java
===================================================================
--- trunk/api/src/main/java/org/teiid/language/IteratorValueSource.java 2012-01-07 16:10:27 UTC (rev 3781)
+++ trunk/api/src/main/java/org/teiid/language/IteratorValueSource.java 2012-01-09 19:33:46 UTC (rev 3782)
@@ -1,58 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package org.teiid.language;
-
-import java.util.Iterator;
-import java.util.List;
-
-import org.teiid.language.visitor.LanguageObjectVisitor;
-
-public class IteratorValueSource<T extends List<?>> extends BaseLanguageObject implements InsertValueSource {
-
- private Iterator<T> iter;
- private int columnCount;
-
- public IteratorValueSource(Iterator<T> iter, int columnCount) {
- this.iter = iter;
- this.columnCount = columnCount;
- }
-
- /**
- * A memory safe iterator of the insert values. Only 1 iterator is associated
- * with the value source. Once it is consumed there are no more values.
- * @return
- */
- public Iterator<T> getIterator() {
- return iter;
- }
-
- public int getColumnCount() {
- return columnCount;
- }
-
- @Override
- public void acceptVisitor(LanguageObjectVisitor visitor) {
- visitor.visit(this);
- }
-
-}
Modified: trunk/api/src/main/java/org/teiid/language/Literal.java
===================================================================
--- trunk/api/src/main/java/org/teiid/language/Literal.java 2012-01-07 16:10:27 UTC (rev 3781)
+++ trunk/api/src/main/java/org/teiid/language/Literal.java 2012-01-09 19:33:46 UTC (rev 3782)
@@ -33,8 +33,6 @@
private Object value;
private Class<?> type;
- private boolean bindValue;
- private boolean multiValued;
private boolean isBindEligible;
public Literal(Object value, Class<?> type) {
@@ -58,22 +56,6 @@
this.value = value;
}
- public boolean isBindValue() {
- return bindValue;
- }
-
- public void setBindValue(boolean bindValue) {
- this.bindValue = bindValue;
- }
-
- public boolean isMultiValued() {
- return multiValued;
- }
-
- public void setMultiValued(boolean multiValued) {
- this.multiValued = multiValued;
- }
-
public void setType(Class<?> type) {
this.type = type;
}
@@ -81,7 +63,6 @@
/**
* Set by the optimizer if the literal was created by the evaluation of another expression.
* Setting to true will not always result in the value being handled as a bind value.
- * That can be forced {@link #isBindValue()}
* @return
*/
public boolean isBindEligible() {
Added: trunk/api/src/main/java/org/teiid/language/Parameter.java
===================================================================
--- trunk/api/src/main/java/org/teiid/language/Parameter.java (rev 0)
+++ trunk/api/src/main/java/org/teiid/language/Parameter.java 2012-01-09 19:33:46 UTC (rev 3782)
@@ -0,0 +1,58 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+
+package org.teiid.language;
+
+import org.teiid.language.visitor.LanguageObjectVisitor;
+
+public class Parameter extends BaseLanguageObject implements Expression {
+
+ private Class<?> type;
+ private int valueIndex;
+
+ @Override
+ public Class<?> getType() {
+ return type;
+ }
+
+ public void setType(Class<?> type) {
+ this.type = type;
+ }
+
+ @Override
+ public void acceptVisitor(LanguageObjectVisitor visitor) {
+ visitor.visit(this);
+ }
+
+ public void setValueIndex(int valueIndex) {
+ this.valueIndex = valueIndex;
+ }
+
+ /**
+ * 0-based index of the parameter values in the {@link BatchedCommand#getParameterValues()} row value
+ * @return
+ */
+ public int getValueIndex() {
+ return valueIndex;
+ }
+
+}
Property changes on: trunk/api/src/main/java/org/teiid/language/Parameter.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified: trunk/api/src/main/java/org/teiid/language/Update.java
===================================================================
--- trunk/api/src/main/java/org/teiid/language/Update.java 2012-01-07 16:10:27 UTC (rev 3781)
+++ trunk/api/src/main/java/org/teiid/language/Update.java 2012-01-09 19:33:46 UTC (rev 3782)
@@ -22,6 +22,7 @@
package org.teiid.language;
+import java.util.Iterator;
import java.util.List;
import org.teiid.language.visitor.LanguageObjectVisitor;
@@ -29,11 +30,12 @@
/**
* Represents an UPDATE command in the language objects.
*/
-public class Update extends BaseLanguageObject implements Command {
+public class Update extends BaseLanguageObject implements BatchedCommand {
private NamedTable table;
private List<SetClause> changes;
private Condition where;
+ private Iterator<? extends List<?>> parameterValues;
public Update(NamedTable group, List<SetClause> changes, Condition criteria) {
this.table = group;
@@ -68,5 +70,14 @@
public void setWhere(Condition criteria) {
this.where = criteria;
}
+
+ @Override
+ public Iterator<? extends List<?>> getParameterValues() {
+ return parameterValues;
+ }
+
+ public void setParameterValues(Iterator<? extends List<?>> parameterValues) {
+ this.parameterValues = parameterValues;
+ }
}
Modified: trunk/api/src/main/java/org/teiid/language/visitor/AbstractLanguageVisitor.java
===================================================================
--- trunk/api/src/main/java/org/teiid/language/visitor/AbstractLanguageVisitor.java 2012-01-07 16:10:27 UTC (rev 3781)
+++ trunk/api/src/main/java/org/teiid/language/visitor/AbstractLanguageVisitor.java 2012-01-09 19:33:46 UTC (rev 3782)
@@ -24,42 +24,7 @@
import java.util.Collection;
-import org.teiid.language.AggregateFunction;
-import org.teiid.language.AndOr;
-import org.teiid.language.Argument;
-import org.teiid.language.BatchedUpdates;
-import org.teiid.language.Call;
-import org.teiid.language.ColumnReference;
-import org.teiid.language.Comparison;
-import org.teiid.language.Delete;
-import org.teiid.language.DerivedColumn;
-import org.teiid.language.DerivedTable;
-import org.teiid.language.Exists;
-import org.teiid.language.ExpressionValueSource;
-import org.teiid.language.Function;
-import org.teiid.language.GroupBy;
-import org.teiid.language.In;
-import org.teiid.language.Insert;
-import org.teiid.language.IsNull;
-import org.teiid.language.IteratorValueSource;
-import org.teiid.language.Join;
-import org.teiid.language.LanguageObject;
-import org.teiid.language.Like;
-import org.teiid.language.Limit;
-import org.teiid.language.Literal;
-import org.teiid.language.NamedTable;
-import org.teiid.language.Not;
-import org.teiid.language.OrderBy;
-import org.teiid.language.ScalarSubquery;
-import org.teiid.language.SearchedCase;
-import org.teiid.language.SearchedWhenClause;
-import org.teiid.language.Select;
-import org.teiid.language.SetClause;
-import org.teiid.language.SetQuery;
-import org.teiid.language.SortSpecification;
-import org.teiid.language.SubqueryComparison;
-import org.teiid.language.SubqueryIn;
-import org.teiid.language.Update;
+import org.teiid.language.*;
/**
@@ -147,5 +112,5 @@
public void visit(SetQuery obj) {}
public void visit(SetClause obj) {}
public void visit(SearchedWhenClause obj) {}
- public void visit(IteratorValueSource obj) {}
+ public void visit(Parameter obj) {}
}
Modified: trunk/api/src/main/java/org/teiid/language/visitor/LanguageObjectVisitor.java
===================================================================
--- trunk/api/src/main/java/org/teiid/language/visitor/LanguageObjectVisitor.java 2012-01-07 16:10:27 UTC (rev 3781)
+++ trunk/api/src/main/java/org/teiid/language/visitor/LanguageObjectVisitor.java 2012-01-09 19:33:46 UTC (rev 3782)
@@ -22,45 +22,7 @@
package org.teiid.language.visitor;
-import org.teiid.language.AggregateFunction;
-import org.teiid.language.AndOr;
-import org.teiid.language.Argument;
-import org.teiid.language.BatchedUpdates;
-import org.teiid.language.Call;
-import org.teiid.language.ColumnReference;
-import org.teiid.language.Comparison;
-import org.teiid.language.Delete;
-import org.teiid.language.DerivedColumn;
-import org.teiid.language.DerivedTable;
-import org.teiid.language.Exists;
-import org.teiid.language.ExpressionValueSource;
-import org.teiid.language.Function;
-import org.teiid.language.GroupBy;
-import org.teiid.language.In;
-import org.teiid.language.Insert;
-import org.teiid.language.IsNull;
-import org.teiid.language.IteratorValueSource;
-import org.teiid.language.Join;
-import org.teiid.language.Like;
-import org.teiid.language.Limit;
-import org.teiid.language.Literal;
-import org.teiid.language.NamedTable;
-import org.teiid.language.Not;
-import org.teiid.language.OrderBy;
-import org.teiid.language.ScalarSubquery;
-import org.teiid.language.SearchedCase;
-import org.teiid.language.SearchedWhenClause;
-import org.teiid.language.Select;
-import org.teiid.language.SetClause;
-import org.teiid.language.SetQuery;
-import org.teiid.language.SortSpecification;
-import org.teiid.language.SubqueryComparison;
-import org.teiid.language.SubqueryIn;
-import org.teiid.language.Update;
-import org.teiid.language.WindowFunction;
-import org.teiid.language.WindowSpecification;
-import org.teiid.language.With;
-import org.teiid.language.WithItem;
+import org.teiid.language.*;
/**
*/
@@ -99,9 +61,9 @@
public void visit(SetQuery obj);
public void visit(SetClause obj);
public void visit(SearchedWhenClause obj);
- public void visit(IteratorValueSource obj);
public void visit(With obj);
public void visit(WithItem obj);
public void visit(WindowFunction windowFunction);
public void visit(WindowSpecification windowSpecification);
+ public void visit(Parameter obj);
}
Modified: trunk/api/src/main/java/org/teiid/language/visitor/SQLStringVisitor.java
===================================================================
--- trunk/api/src/main/java/org/teiid/language/visitor/SQLStringVisitor.java 2012-01-07 16:10:27 UTC (rev 3781)
+++ trunk/api/src/main/java/org/teiid/language/visitor/SQLStringVisitor.java 2012-01-09 19:33:46 UTC (rev 3782)
@@ -31,51 +31,7 @@
import org.teiid.core.types.DataTypeManager;
import org.teiid.core.util.StringUtil;
-import org.teiid.language.AggregateFunction;
-import org.teiid.language.AndOr;
-import org.teiid.language.Argument;
-import org.teiid.language.Call;
-import org.teiid.language.ColumnReference;
-import org.teiid.language.Command;
-import org.teiid.language.Comparison;
-import org.teiid.language.Condition;
-import org.teiid.language.Delete;
-import org.teiid.language.DerivedColumn;
-import org.teiid.language.DerivedTable;
-import org.teiid.language.Exists;
-import org.teiid.language.Expression;
-import org.teiid.language.ExpressionValueSource;
-import org.teiid.language.Function;
-import org.teiid.language.GroupBy;
-import org.teiid.language.In;
-import org.teiid.language.Insert;
-import org.teiid.language.IsNull;
-import org.teiid.language.IteratorValueSource;
-import org.teiid.language.Join;
-import org.teiid.language.LanguageObject;
-import org.teiid.language.Like;
-import org.teiid.language.Limit;
-import org.teiid.language.Literal;
-import org.teiid.language.NamedTable;
-import org.teiid.language.Not;
-import org.teiid.language.OrderBy;
-import org.teiid.language.QueryExpression;
-import org.teiid.language.SQLConstants;
-import org.teiid.language.ScalarSubquery;
-import org.teiid.language.SearchedCase;
-import org.teiid.language.SearchedWhenClause;
-import org.teiid.language.Select;
-import org.teiid.language.SetClause;
-import org.teiid.language.SetQuery;
-import org.teiid.language.SortSpecification;
-import org.teiid.language.SubqueryComparison;
-import org.teiid.language.SubqueryIn;
-import org.teiid.language.TableReference;
-import org.teiid.language.Update;
-import org.teiid.language.WindowFunction;
-import org.teiid.language.WindowSpecification;
-import org.teiid.language.With;
-import org.teiid.language.WithItem;
+import org.teiid.language.*;
import org.teiid.language.Argument.Direction;
import org.teiid.language.SQLConstants.NonReserved;
import org.teiid.language.SQLConstants.Tokens;
@@ -538,17 +494,10 @@
}
@Override
- public void visit(IteratorValueSource obj) {
- buffer.append(VALUES).append(Tokens.SPACE).append(Tokens.LPAREN);
- for (int i = 0; i < obj.getColumnCount(); i++) {
- if (i > 0) {
- buffer.append(", "); //$NON-NLS-1$
- }
- buffer.append("?"); //$NON-NLS-1$
- }
- buffer.append(Tokens.RPAREN);
+ public void visit(Parameter obj) {
+ buffer.append('?');
}
-
+
public void visit(IsNull obj) {
append(obj.getExpression());
buffer.append(Tokens.SPACE)
@@ -664,9 +613,7 @@
}
public void visit(Literal obj) {
- if (obj.isBindValue()) {
- buffer.append("?"); //$NON-NLS-1$
- } else if (obj.getValue() == null) {
+ if (obj.getValue() == null) {
buffer.append(NULL);
} else {
Class<?> type = obj.getType();
Modified: trunk/api/src/main/java/org/teiid/translator/BaseDelegatingExecutionFactory.java
===================================================================
--- trunk/api/src/main/java/org/teiid/translator/BaseDelegatingExecutionFactory.java 2012-01-07 16:10:27 UTC (rev 3781)
+++ trunk/api/src/main/java/org/teiid/translator/BaseDelegatingExecutionFactory.java 2012-01-09 19:33:46 UTC (rev 3782)
@@ -254,10 +254,6 @@
return delegate.supportsInlineViews();
}
@Override
- public boolean supportsInsertWithIterator() {
- return delegate.supportsInsertWithIterator();
- }
- @Override
public boolean supportsInsertWithQueryExpression() {
return delegate.supportsInsertWithQueryExpression();
}
Modified: trunk/api/src/main/java/org/teiid/translator/ExecutionFactory.java
===================================================================
--- trunk/api/src/main/java/org/teiid/translator/ExecutionFactory.java 2012-01-07 16:10:27 UTC (rev 3781)
+++ trunk/api/src/main/java/org/teiid/translator/ExecutionFactory.java 2012-01-09 19:33:46 UTC (rev 3782)
@@ -23,7 +23,6 @@
package org.teiid.translator;
import java.util.Collection;
-import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
@@ -804,16 +803,6 @@
return false;
}
- /**
- * Support indicates that the connector can accept INSERTs
- * with values specified by an {@link Iterator}
- * @since 7.1
- * @return
- */
- public boolean supportsInsertWithIterator() {
- return false;
- }
-
public static <T> T getInstance(Class<T> expectedType, String className, Collection<?> ctorObjs, Class<? extends T> defaultClass) throws TranslatorException {
try {
if (className == null) {
Modified: trunk/build/kits/jboss-as7/docs/teiid/teiid-releasenotes.html
===================================================================
--- trunk/build/kits/jboss-as7/docs/teiid/teiid-releasenotes.html 2012-01-07 16:10:27 UTC (rev 3781)
+++ trunk/build/kits/jboss-as7/docs/teiid/teiid-releasenotes.html 2012-01-09 19:33:46 UTC (rev 3782)
@@ -57,7 +57,9 @@
<li>BigDecimal division that returns a quotient that is equal to zero will have a scale of zero as well. Prior releases would typically return a zero value with a scale of 16.
<li>The env function no longer returns the value for the session id, the session_id() function should be used instead.
<li>The CommandContext no longer provides getEnvironmentProperties()
- <li>Unaliased derived columns in the SELECT clause have different default names than prior releases. The name will be exprX where X is the SELECT clause position.
+ <li>Unaliased derived columns in the SELECT clause have different default names than prior releases. The name will be exprX where X is the SELECT clause position.
+ <li>The translator API facilities for iterator/bulk updates were combined and updated. Multi-valued literals were replaced by the Parameter class with an associated value iterator
+ available on the BatchedCommand. The IteratorValueSource class was also removed.
</ul>
<h4>from 7.5</h4>
Modified: trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/JDBCBaseExecution.java
===================================================================
--- trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/JDBCBaseExecution.java 2012-01-07 16:10:27 UTC (rev 3781)
+++ trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/JDBCBaseExecution.java 2012-01-09 19:33:46 UTC (rev 3782)
@@ -32,12 +32,13 @@
import org.teiid.language.Command;
import org.teiid.language.Literal;
+import org.teiid.language.Parameter;
import org.teiid.logging.LogConstants;
import org.teiid.logging.LogManager;
import org.teiid.logging.MessageLevel;
-import org.teiid.translator.TranslatorException;
import org.teiid.translator.Execution;
import org.teiid.translator.ExecutionContext;
+import org.teiid.translator.TranslatorException;
/**
@@ -77,25 +78,31 @@
/**
* Bind the values in the TranslatedCommand to the PreparedStatement
*/
- protected void bindPreparedStatementValues(PreparedStatement stmt, TranslatedCommand tc, int rowCount) throws SQLException {
- List<?> params = tc.getPreparedValues();
+ protected void bind(PreparedStatement stmt, List<?> params, List<?> batchValues)
+ throws SQLException {
+ for (int i = 0; i< params.size(); i++) {
+ Object paramValue = params.get(i);
+ Object value = null;
+ Class<?> paramType = null;
+ if (paramValue instanceof Literal) {
+ Literal litParam = (Literal)paramValue;
+ value = litParam.getValue();
+ paramType = litParam.getType();
+ } else {
+ Parameter param = (Parameter)paramValue;
+ if (batchValues == null) {
+ throw new AssertionError("Expected batchValues when using a Parameter"); //$NON-NLS-1$
+ }
+ value = batchValues.get(param.getValueIndex());
+ paramType = param.getType();
+ }
+ this.executionFactory.bindValue(stmt, value, paramType, i+1);
+ }
+ if (batchValues != null) {
+ stmt.addBatch();
+ }
+ }
- for (int row = 0; row < rowCount; row++) {
- for (int i = 0; i< params.size(); i++) {
- Literal paramValue = (Literal)params.get(i);
- Object value = paramValue.getValue();
- if (paramValue.isMultiValued()) {
- value = ((List<?>)value).get(row);
- }
- Class<?> paramType = paramValue.getType();
- this.executionFactory.bindValue(stmt, value, paramType, i+1);
- }
- if (rowCount > 1) {
- stmt.addBatch();
- }
- }
- }
-
// ===========================================================================================================================
// Methods
// ===========================================================================================================================
Modified: trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/JDBCExecutionFactory.java
===================================================================
--- trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/JDBCExecutionFactory.java 2012-01-07 16:10:27 UTC (rev 3781)
+++ trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/JDBCExecutionFactory.java 2012-01-09 19:33:46 UTC (rev 3782)
@@ -47,34 +47,14 @@
import javax.sql.DataSource;
import org.teiid.core.util.PropertiesUtils;
-import org.teiid.language.Argument;
-import org.teiid.language.Call;
-import org.teiid.language.ColumnReference;
-import org.teiid.language.Command;
-import org.teiid.language.Expression;
-import org.teiid.language.Function;
-import org.teiid.language.LanguageObject;
-import org.teiid.language.Limit;
-import org.teiid.language.Literal;
-import org.teiid.language.QueryExpression;
-import org.teiid.language.SQLConstants;
-import org.teiid.language.SetQuery;
+import org.teiid.language.*;
import org.teiid.language.Argument.Direction;
import org.teiid.language.SetQuery.Operation;
import org.teiid.logging.LogConstants;
import org.teiid.logging.LogManager;
import org.teiid.metadata.MetadataFactory;
import org.teiid.metadata.RuntimeMetadata;
-import org.teiid.translator.ExecutionContext;
-import org.teiid.translator.ExecutionFactory;
-import org.teiid.translator.ProcedureExecution;
-import org.teiid.translator.ResultSetExecution;
-import org.teiid.translator.SourceSystemFunctions;
-import org.teiid.translator.Translator;
-import org.teiid.translator.TranslatorException;
-import org.teiid.translator.TranslatorProperty;
-import org.teiid.translator.TypeFacility;
-import org.teiid.translator.UpdateExecution;
+import org.teiid.translator.*;
/**
@@ -446,11 +426,6 @@
}
@Override
- public boolean supportsInsertWithIterator() {
- return super.supportsBulkUpdate();
- }
-
- @Override
public boolean supportsBatchedUpdates() {
return true;
}
Modified: trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/JDBCQueryExecution.java
===================================================================
--- trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/JDBCQueryExecution.java 2012-01-07 16:10:27 UTC (rev 3781)
+++ trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/JDBCQueryExecution.java 2012-01-09 19:33:46 UTC (rev 3782)
@@ -36,10 +36,10 @@
import org.teiid.language.QueryExpression;
import org.teiid.logging.LogConstants;
import org.teiid.logging.LogManager;
-import org.teiid.translator.TranslatorException;
import org.teiid.translator.DataNotAvailableException;
import org.teiid.translator.ExecutionContext;
import org.teiid.translator.ResultSetExecution;
+import org.teiid.translator.TranslatorException;
/**
@@ -82,7 +82,7 @@
results = getStatement().executeQuery(sql);
} else {
PreparedStatement pstatement = getPreparedStatement(sql);
- bindPreparedStatementValues(pstatement, translatedComm, 1);
+ bind(pstatement, translatedComm.getPreparedValues(), null);
results = pstatement.executeQuery();
}
addStatementWarnings();
Modified: trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/JDBCUpdateExecution.java
===================================================================
--- trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/JDBCUpdateExecution.java 2012-01-07 16:10:27 UTC (rev 3781)
+++ trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/JDBCUpdateExecution.java 2012-01-09 19:33:46 UTC (rev 3782)
@@ -29,11 +29,10 @@
import java.util.Iterator;
import java.util.List;
+import org.teiid.language.BatchedCommand;
import org.teiid.language.BatchedUpdates;
import org.teiid.language.Command;
import org.teiid.language.Insert;
-import org.teiid.language.IteratorValueSource;
-import org.teiid.language.Literal;
import org.teiid.translator.DataNotAvailableException;
import org.teiid.translator.ExecutionContext;
import org.teiid.translator.TranslatorException;
@@ -107,7 +106,7 @@
}
pstmt = getPreparedStatement(tCommand.getSql());
}
- bindPreparedStatementValues(pstmt, tCommand, 1);
+ bind(pstmt, tCommand.getPreparedValues(), null);
pstmt.addBatch();
} else {
if (previousCommand != null && previousCommand.isPrepared()) {
@@ -170,57 +169,43 @@
} else {
PreparedStatement pstatement = getPreparedStatement(sql);
- if (command instanceof Insert) {
- Insert insert = (Insert)command;
- if (insert.getValueSource() instanceof IteratorValueSource) {
- commitType = getAutoCommit(translatedComm);
- if (commitType) {
- connection.setAutoCommit(false);
- }
-
- IteratorValueSource<List<Object>> ivs = (IteratorValueSource)insert.getValueSource();
- List<Object>[] values = new List[ivs.getColumnCount()];
- for (int i = 0; i < ivs.getColumnCount(); i++) {
- values[i] = new ArrayList<Object>();
- Literal literal = new Literal(values[i], insert.getColumns().get(i).getType());
- literal.setMultiValued(true);
- translatedComm.getPreparedValues().add(literal);
- }
- Iterator<List<Object>> i = ivs.getIterator();
- int maxBatchSize = this.executionFactory.getMaxPreparedInsertBatchSize();
- while (i.hasNext()) {
- int batchSize = 0;
- while (i.hasNext() && batchSize++ < maxBatchSize) {
- List<Object> next = i.next();
- for (int j = 0; j < ivs.getColumnCount(); j++) {
- values[j].add(next.get(j));
- }
- }
- updateCount += executePreparedBatch(translatedComm, pstatement, batchSize);
- for (int j = 0; j < ivs.getColumnCount(); j++) {
- values[j].clear();
- }
- }
- succeeded = true;
- return new int[updateCount];
- }
- }
+ Iterator<? extends List<?>> vi = null;
+ if (command instanceof BatchedCommand) {
+ BatchedCommand batchCommand = (BatchedCommand)command;
+ vi = batchCommand.getParameterValues();
+ }
- int rowCount = 1;
- for (int i = 0; i< translatedComm.getPreparedValues().size(); i++) {
- Literal paramValue = (Literal)translatedComm.getPreparedValues().get(i);
- if (paramValue.isMultiValued()) {
- rowCount = ((List<?>)paramValue.getValue()).size();
- break;
- }
- }
- if (rowCount > 1) {
+ if (vi != null) {
commitType = getAutoCommit(translatedComm);
if (commitType) {
connection.setAutoCommit(false);
}
+ int maxBatchSize = (command instanceof Insert)?this.executionFactory.getMaxPreparedInsertBatchSize():Integer.MAX_VALUE;
+ boolean done = false;
+ outer: while (!done) {
+ for (int i = 0; i < maxBatchSize; i++) {
+ if (vi.hasNext()) {
+ List<?> values = vi.next();
+ bind(pstatement, translatedComm.getPreparedValues(), values);
+ } else {
+ if (i == 0) {
+ break outer;
+ }
+ done = true;
+ break;
+ }
+ }
+ int[] results = pstatement.executeBatch();
+
+ for (int i=0; i<results.length; i++) {
+ updateCount += results[i];
+ }
+ }
+ } else {
+ bind(pstatement, translatedComm.getPreparedValues(), null);
+ updateCount = pstatement.executeUpdate();
+ addStatementWarnings();
}
- updateCount = executePreparedBatch(translatedComm, pstatement, rowCount);
succeeded = true;
}
return new int[] {updateCount};
@@ -233,23 +218,6 @@
}
}
- private int executePreparedBatch(TranslatedCommand translatedComm, PreparedStatement pstatement, int rowCount)
- throws SQLException {
- bindPreparedStatementValues(pstatement, translatedComm, rowCount);
- int updateCount = 0;
- if (rowCount > 1) {
- int[] results = pstatement.executeBatch();
-
- for (int i=0; i<results.length; i++) {
- updateCount += results[i];
- }
- } else {
- updateCount = pstatement.executeUpdate();
- }
- addStatementWarnings();
- return updateCount;
- }
-
/**
* @param command
* @return
Modified: trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/SQLConversionVisitor.java
===================================================================
--- trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/SQLConversionVisitor.java 2012-01-07 16:10:27 UTC (rev 3781)
+++ trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/SQLConversionVisitor.java 2012-01-09 19:33:46 UTC (rev 3782)
@@ -39,20 +39,7 @@
import java.util.regex.Matcher;
import java.util.regex.Pattern;
-import org.teiid.language.Argument;
-import org.teiid.language.Call;
-import org.teiid.language.Command;
-import org.teiid.language.Comparison;
-import org.teiid.language.DerivedColumn;
-import org.teiid.language.ExpressionValueSource;
-import org.teiid.language.Function;
-import org.teiid.language.In;
-import org.teiid.language.LanguageObject;
-import org.teiid.language.Like;
-import org.teiid.language.Literal;
-import org.teiid.language.NamedTable;
-import org.teiid.language.SearchedCase;
-import org.teiid.language.SetClause;
+import org.teiid.language.*;
import org.teiid.language.Argument.Direction;
import org.teiid.language.SQLConstants.Reserved;
import org.teiid.language.SQLConstants.Tokens;
@@ -255,12 +242,18 @@
}
return parts;
}
+
+ @Override
+ public void visit(Parameter obj) {
+ buffer.append(UNDEFINED_PARAM);
+ preparedValues.add(obj);
+ }
/**
* @see org.teiid.language.visitor.SQLStringVisitor#visit(org.teiid.language.Literal)
*/
public void visit(Literal obj) {
- if (this.prepared && ((replaceWithBinding && obj.isBindEligible()) || TranslatedCommand.isBindEligible(obj) || obj.isBindValue())) {
+ if (this.prepared && ((replaceWithBinding && obj.isBindEligible()) || TranslatedCommand.isBindEligible(obj))) {
buffer.append(UNDEFINED_PARAM);
preparedValues.add(obj);
} else {
Modified: trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/TranslatedCommand.java
===================================================================
--- trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/TranslatedCommand.java 2012-01-07 16:10:27 UTC (rev 3781)
+++ trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/TranslatedCommand.java 2012-01-09 19:33:46 UTC (rev 3782)
@@ -27,12 +27,11 @@
import java.util.List;
import org.teiid.language.Command;
-import org.teiid.language.Insert;
-import org.teiid.language.IteratorValueSource;
import org.teiid.language.Literal;
+import org.teiid.language.Parameter;
import org.teiid.language.visitor.CollectorVisitor;
-import org.teiid.translator.TranslatorException;
import org.teiid.translator.ExecutionContext;
+import org.teiid.translator.TranslatorException;
import org.teiid.translator.TypeFacility;
@@ -86,15 +85,14 @@
* @return
*/
private boolean hasBindValue(Command command) {
+ if (!CollectorVisitor.collectObjects(Parameter.class, command).isEmpty()) {
+ return true;
+ }
for (Literal l : CollectorVisitor.collectObjects(Literal.class, command)) {
- if (l.isBindValue() || isBindEligible(l)) {
+ if (isBindEligible(l)) {
return true;
}
}
- if (command instanceof Insert) {
- Insert insert = (Insert)command;
- return insert.getValueSource() instanceof IteratorValueSource<?>;
- }
return false;
}
Modified: trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/db2/SubstringFunctionModifier.java
===================================================================
--- trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/db2/SubstringFunctionModifier.java 2012-01-07 16:10:27 UTC (rev 3781)
+++ trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/db2/SubstringFunctionModifier.java 2012-01-09 19:33:46 UTC (rev 3782)
@@ -55,10 +55,8 @@
Boolean isNegative = null;
if (length instanceof Literal) {
Literal l = (Literal)length;
- if (!l.isMultiValued()) {
- int value = (Integer)l.getValue();
- isNegative = value < 0;
- }
+ int value = (Integer)l.getValue();
+ isNegative = value < 0;
}
Expression maxLength = new Function(
SourceSystemFunctions.SUBTRACT_OP,
Modified: trunk/connectors/translator-jdbc/src/test/java/org/teiid/translator/jdbc/TestJDBCUpdateExecution.java
===================================================================
--- trunk/connectors/translator-jdbc/src/test/java/org/teiid/translator/jdbc/TestJDBCUpdateExecution.java 2012-01-07 16:10:27 UTC (rev 3781)
+++ trunk/connectors/translator-jdbc/src/test/java/org/teiid/translator/jdbc/TestJDBCUpdateExecution.java 2012-01-09 19:33:46 UTC (rev 3782)
@@ -24,50 +24,32 @@
import java.sql.Connection;
import java.sql.PreparedStatement;
-import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import org.junit.Test;
import org.mockito.Mockito;
-import org.teiid.language.Command;
+import org.teiid.core.types.DataTypeManager;
+import org.teiid.language.Expression;
import org.teiid.language.ExpressionValueSource;
import org.teiid.language.Insert;
-import org.teiid.language.IteratorValueSource;
-import org.teiid.language.Literal;
+import org.teiid.language.Parameter;
import org.teiid.translator.ExecutionContext;
public class TestJDBCUpdateExecution {
- @Test public void testBulkUpdate() throws Exception {
- Command command = TranslationHelper.helpTranslate(TranslationHelper.BQT_VDB, "insert into BQT1.SmallA (IntKey, IntNum) values (1, 2)"); //$NON-NLS-1$
- Literal value = ((Literal)((ExpressionValueSource)((Insert)command).getValueSource()).getValues().get(0));
- Literal value1 = ((Literal)((ExpressionValueSource)((Insert)command).getValueSource()).getValues().get(1));
- value.setMultiValued(true);
- value.setBindValue(true);
- value.setValue(Arrays.asList(1, 2));
- value1.setMultiValued(true);
- value1.setBindValue(true);
- value1.setValue(Arrays.asList(2, 3));
- Connection connection = Mockito.mock(Connection.class);
- PreparedStatement p = Mockito.mock(PreparedStatement.class);
- Mockito.stub(p.executeBatch()).toReturn(new int [] {1, 1});
- Mockito.stub(connection.prepareStatement("INSERT INTO SmallA (IntKey, IntNum) VALUES (?, ?)")).toReturn(p); //$NON-NLS-1$
-
- JDBCExecutionFactory config = new JDBCExecutionFactory();
-
- JDBCUpdateExecution updateExecution = new JDBCUpdateExecution(command, connection, Mockito.mock(ExecutionContext.class), config);
- updateExecution.execute();
- Mockito.verify(p, Mockito.times(2)).addBatch();
- }
-
@Test public void testInsertIteratorUpdate() throws Exception {
Insert command = (Insert)TranslationHelper.helpTranslate(TranslationHelper.BQT_VDB, "insert into BQT1.SmallA (IntKey, IntNum) values (1, 2)"); //$NON-NLS-1$
- List<List<Integer>> values = new ArrayList<List<Integer>>();
- values.add(Arrays.asList(1, 2));
- values.add(Arrays.asList(2, 3));
- command.setValueSource(new IteratorValueSource(values.iterator(), 2));
-
+ Parameter param = new Parameter();
+ param.setType(DataTypeManager.DefaultDataClasses.INTEGER);
+ param.setValueIndex(0);
+ List<Expression> values = ((ExpressionValueSource)command.getValueSource()).getValues();
+ values.set(0, param);
+ param = new Parameter();
+ param.setType(DataTypeManager.DefaultDataClasses.INTEGER);
+ param.setValueIndex(1);
+ values.set(1, param);
+ command.setParameterValues(Arrays.asList(Arrays.asList(1, 2), Arrays.asList(1, 2)).iterator());
Connection connection = Mockito.mock(Connection.class);
PreparedStatement p = Mockito.mock(PreparedStatement.class);
Mockito.stub(p.executeBatch()).toReturn(new int [] {1, 1});
Modified: trunk/documentation/developer-guide/src/main/docbook/en-US/content/translator-api.xml
===================================================================
--- trunk/documentation/developer-guide/src/main/docbook/en-US/content/translator-api.xml 2012-01-07 16:10:27 UTC (rev 3781)
+++ trunk/documentation/developer-guide/src/main/docbook/en-US/content/translator-api.xml 2012-01-09 19:33:46 UTC (rev 3782)
@@ -465,10 +465,15 @@
<listitem>
<para>
<code>Literal</code>
- – represents a literal scalar value, but may also be multi-valued in
- the case of bulk updates.
+ – represents a literal scalar value.
</para>
</listitem>
+ <listitem>
+ <para>
+ <code>Parameter</code>
+ – represents a parameter with multiple values. The command should be an instance of BatchedCommand, which provides all values via getParameterValues.
+ </para>
+ </listitem>
<listitem>
<para>
<code>Function</code>
@@ -585,7 +590,7 @@
inserted into. It will also has a list of <code>ColumnReference</code> specifying the columns
of the <code>NamedTable</code> that are being inserted into. It also has
<code>InsertValueSource</code>, which will be a list of
- Expressions (<code>ExpressionValueSource</code>), or a <code>QueryExpression</code>, or an Iterator (<code>IteratorValueSource</code>)</para>
+ Expressions (<code>ExpressionValueSource</code>) or a <code>QueryExpression</code></para>
</section>
<section>
@@ -1416,17 +1421,6 @@
</row>
<row>
<entry>
- <para>InsertWithIterator</para>
- </entry>
- <entry>
- <para/>
- </entry>
- <entry>
- <para>Translator supports inserts with an iterator of values. The values would typically be from an evaluated QueryExpression.</para>
- </entry>
- </row>
- <row>
- <entry>
<para>CommonTableExpressions</para>
</entry>
<entry>
Modified: trunk/engine/src/main/java/org/teiid/dqp/internal/datamgr/CapabilitiesConverter.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/dqp/internal/datamgr/CapabilitiesConverter.java 2012-01-07 16:10:27 UTC (rev 3781)
+++ trunk/engine/src/main/java/org/teiid/dqp/internal/datamgr/CapabilitiesConverter.java 2012-01-09 19:33:46 UTC (rev 3782)
@@ -101,7 +101,7 @@
tgtCaps.setCapabilitySupport(Capability.QUERY_ORDERBY_UNRELATED, srcCaps.supportsOrderByUnrelated());
tgtCaps.setCapabilitySupport(Capability.QUERY_AGGREGATES_ENHANCED_NUMERIC, srcCaps.supportsAggregatesEnhancedNumeric());
tgtCaps.setCapabilitySupport(Capability.QUERY_ORDERBY_NULL_ORDERING, srcCaps.supportsOrderByNullOrdering());
- tgtCaps.setCapabilitySupport(Capability.INSERT_WITH_ITERATOR, srcCaps.supportsInsertWithIterator());
+ tgtCaps.setCapabilitySupport(Capability.INSERT_WITH_ITERATOR, srcCaps.supportsBulkUpdate());
tgtCaps.setCapabilitySupport(Capability.COMMON_TABLE_EXPRESSIONS, srcCaps.supportsCommonTableExpressions());
tgtCaps.setCapabilitySupport(Capability.ELEMENTARY_OLAP, srcCaps.supportsElementaryOlapOperations());
setSupports(connectorID, tgtCaps, Capability.ADVANCED_OLAP, srcCaps.supportsAdvancedOlapOperations(), Capability.ELEMENTARY_OLAP);
Modified: trunk/engine/src/main/java/org/teiid/dqp/internal/datamgr/LanguageBridgeFactory.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/dqp/internal/datamgr/LanguageBridgeFactory.java 2012-01-07 16:10:27 UTC (rev 3781)
+++ trunk/engine/src/main/java/org/teiid/dqp/internal/datamgr/LanguageBridgeFactory.java 2012-01-09 19:33:46 UTC (rev 3782)
@@ -25,6 +25,7 @@
import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
+import java.util.LinkedList;
import java.util.List;
import java.util.NoSuchElementException;
@@ -33,7 +34,7 @@
import org.teiid.common.buffer.TupleSource;
import org.teiid.core.CoreConstants;
import org.teiid.core.TeiidComponentException;
-import org.teiid.core.TeiidException;
+import org.teiid.core.TeiidProcessingException;
import org.teiid.core.TeiidRuntimeException;
import org.teiid.language.*;
import org.teiid.language.DerivedColumn;
@@ -67,6 +68,8 @@
public class LanguageBridgeFactory {
private RuntimeMetadataImpl metadataFactory = null;
+ private int valueIndex = 0;
+ private List<List<?>> allValues = new LinkedList<List<?>>();
public LanguageBridgeFactory(QueryMetadataInterface metadata) {
if (metadata != null) {
@@ -454,11 +457,17 @@
result.setWindowSpecification(ws);
return result;
}
-
- Literal translate(Constant constant) {
+
+ org.teiid.language.Expression translate(Constant constant) {
+ if (constant.isMultiValued()) {
+ Parameter result = new Parameter();
+ result.setType(constant.getType());
+ final List<?> values = (List<?>)constant.getValue();
+ allValues.add(values);
+ result.setValueIndex(valueIndex++);
+ return result;
+ }
Literal result = new Literal(constant.getValue(), constant.getType());
- result.setBindValue(constant.isMultiValued());
- result.setMultiValued(constant.isMultiValued());
result.setBindEligible(constant.isBindEligible());
return result;
}
@@ -543,44 +552,54 @@
for (ElementSymbol elementSymbol : elements) {
translatedElements.add(translate(elementSymbol));
}
-
+ Iterator<List<?>> parameterValues = null;
InsertValueSource valueSource = null;
if (insert.getQueryExpression() != null) {
valueSource = translate(insert.getQueryExpression());
} else if (insert.getTupleSource() != null) {
final TupleSource ts = insert.getTupleSource();
- valueSource = new IteratorValueSource<List<?>>(new Iterator<List<?>>() {
-
- List<?> next;
+ parameterValues = new Iterator<List<?>>() {
+ List<?> nextRow;
@Override
- public void remove() {
- throw new UnsupportedOperationException();
+ public boolean hasNext() {
+ if (nextRow == null) {
+ try {
+ nextRow = ts.nextTuple();
+ } catch (TeiidComponentException e) {
+ throw new TeiidRuntimeException(e);
+ } catch (TeiidProcessingException e) {
+ throw new TeiidRuntimeException(e);
+ }
+ }
+ return nextRow != null;
}
@Override
public List<?> next() {
- if (hasNext()) {
- List<?> result = next;
- next = null;
- return result;
+ if (nextRow == null && !hasNext()) {
+ throw new NoSuchElementException();
}
- throw new NoSuchElementException();
+ List<?> result = nextRow;
+ nextRow = null;
+ return result;
}
@Override
- public boolean hasNext() {
- if (next != null) {
- return true;
- }
- try {
- next = ts.nextTuple();
- } catch (TeiidException e) {
- throw new TeiidRuntimeException(e);
- }
- return next != null;
+ public void remove() {
+ throw new UnsupportedOperationException();
}
- }, elements.size());
+
+ };
+ List<org.teiid.language.Expression> translatedValues = new ArrayList<org.teiid.language.Expression>();
+ for (int i = 0; i < insert.getVariables().size(); i++) {
+ ElementSymbol es = insert.getVariables().get(i);
+ Parameter param = new Parameter();
+ param.setType(es.getType());
+ param.setValueIndex(i);
+ translatedValues.add(param);
+ }
+ valueSource = new ExpressionValueSource(translatedValues);
} else {
// This is for the simple one row insert.
List values = insert.getValues();
@@ -591,16 +610,40 @@
valueSource = new ExpressionValueSource(translatedValues);
}
- return new org.teiid.language.Insert(translate(insert.getGroup()),
+ org.teiid.language.Insert result = new org.teiid.language.Insert(translate(insert.getGroup()),
translatedElements,
valueSource);
+ result.setParameterValues(parameterValues);
+ setBatchValues(result);
+ return result;
}
+
+ private void setBatchValues(BatchedCommand bc) {
+ if (valueIndex == 0) {
+ return;
+ }
+ if (bc.getParameterValues() != null) {
+ throw new IllegalStateException("Already set batch values"); //$NON-NLS-1$
+ }
+ int rowCount = allValues.get(0).size();
+ List<List<?>> result = new ArrayList<List<?>>(rowCount);
+ for (int i = 0; i < rowCount; i++) {
+ List<Object> row = new ArrayList<Object>(allValues.size());
+ for (List<?> vals : allValues) {
+ row.add(vals.get(i));
+ }
+ result.add(row);
+ }
+ bc.setParameterValues(result.iterator());
+ }
/* Update */
org.teiid.language.Update translate(Update update) {
- return new org.teiid.language.Update(translate(update.getGroup()),
+ org.teiid.language.Update result = new org.teiid.language.Update(translate(update.getGroup()),
translate(update.getChangeList()),
translate(update.getCriteria()));
+ setBatchValues(result);
+ return result;
}
List<org.teiid.language.SetClause> translate(SetClauseList setClauseList) {
@@ -619,6 +662,7 @@
org.teiid.language.Delete translate(Delete delete) {
org.teiid.language.Delete deleteImpl = new org.teiid.language.Delete(translate(delete.getGroup()),
translate(delete.getCriteria()));
+ setBatchValues(deleteImpl);
return deleteImpl;
}
Modified: trunk/engine/src/main/java/org/teiid/query/optimizer/relational/PlanToProcessConverter.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/optimizer/relational/PlanToProcessConverter.java 2012-01-07 16:10:27 UTC (rev 3781)
+++ trunk/engine/src/main/java/org/teiid/query/optimizer/relational/PlanToProcessConverter.java 2012-01-09 19:33:46 UTC (rev 3782)
@@ -171,8 +171,6 @@
SourceCapabilities caps = capFinder.findCapabilities(modelName);
if (caps.supportsCapability(Capability.INSERT_WITH_ITERATOR)) {
pinode.setMode(org.teiid.query.processor.relational.ProjectIntoNode.Mode.ITERATOR);
- } else if (caps.supportsCapability(Capability.BULK_UPDATE)) {
- pinode.setMode(org.teiid.query.processor.relational.ProjectIntoNode.Mode.BULK);
} else if (caps.supportsCapability(Capability.BATCHED_UPDATES)) {
pinode.setMode(org.teiid.query.processor.relational.ProjectIntoNode.Mode.BATCH);
} else {
Modified: trunk/engine/src/main/java/org/teiid/query/processor/relational/ProjectIntoNode.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/processor/relational/ProjectIntoNode.java 2012-01-07 16:10:27 UTC (rev 3781)
+++ trunk/engine/src/main/java/org/teiid/query/processor/relational/ProjectIntoNode.java 2012-01-09 19:33:46 UTC (rev 3782)
@@ -27,6 +27,7 @@
import static org.teiid.query.analysis.AnalysisRecord.*;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.List;
import org.teiid.client.plan.PlanNode;
@@ -48,7 +49,7 @@
public class ProjectIntoNode extends RelationalNode {
public enum Mode {
- BATCH, BULK, ITERATOR, SINGLE
+ BATCH, ITERATOR, SINGLE
}
private static int REQUEST_CREATION = 1;
@@ -157,31 +158,13 @@
requests = 0;
}
break;
- case BULK:
- //convert to multivalued parameter
- List<Constant> parameters = new ArrayList<Constant>(intoElements.size());
- for (int i = 0; i < intoElements.size(); i++) {
- Constant value = new Constant(null, ((ElementSymbol)intoElements.get(i)).getType());
- value.setMultiValued(new ArrayList<Object>(currentBatch.getTuples().size()));
- parameters.add(value);
- }
- for (List row : currentBatch.getTuples()) {
- for (int i = 0; i < row.size(); i++) {
- ((List<Object>)parameters.get(i).getValue()).add(row.get(i));
- }
- }
- // Create a bulk insert command batching all rows in the current batch.
- Insert insert = new Insert(intoGroup, intoElements, parameters);
- // Register insert command against source
- registerRequest(insert);
- break;
case BATCH:
// Register batched update command against source
int endRow = currentBatch.getEndRow();
- List rows = new ArrayList(endRow-batchRow);
+ List<Command> rows = new ArrayList<Command>(endRow-batchRow);
for(int rowNum = batchRow; rowNum <= endRow; rowNum++) {
- insert = new Insert( intoGroup,
+ Insert insert = new Insert( intoGroup,
intoElements,
convertValuesToConstants(currentBatch.getTuple(rowNum), intoElements));
rows.add( insert );
@@ -205,9 +188,7 @@
checkExitConditions();
// End this node's work
- List outputRow = new ArrayList(1);
- outputRow.add(new Integer(this.insertCount));
- addBatchRow(outputRow);
+ addBatchRow(Arrays.asList(insertCount));
terminateBatches();
return pullBatch();
}
@@ -271,11 +252,11 @@
return props;
}
- private List convertValuesToConstants(List values, List elements) {
- ArrayList constants = new ArrayList(values.size());
+ private List<Constant> convertValuesToConstants(List<?> values, List<ElementSymbol> elements) {
+ ArrayList<Constant> constants = new ArrayList<Constant>(values.size());
for(int i=0; i<elements.size(); i++) {
- ElementSymbol es = (ElementSymbol)elements.get(i);
- Class type = es.getType();
+ ElementSymbol es = elements.get(i);
+ Class<?> type = es.getType();
constants.add(new Constant(values.get(i),type));
}
return constants;
Modified: trunk/engine/src/test/java/org/teiid/query/processor/TestInsertProcessing.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/processor/TestInsertProcessing.java 2012-01-07 16:10:27 UTC (rev 3781)
+++ trunk/engine/src/test/java/org/teiid/query/processor/TestInsertProcessing.java 2012-01-09 19:33:46 UTC (rev 3782)
@@ -95,6 +95,7 @@
caps.setCapabilitySupport(Capability.BATCHED_UPDATES, doBatching);
caps.setCapabilitySupport(Capability.BULK_UPDATE, doBulkInsert);
+ caps.setCapabilitySupport(Capability.INSERT_WITH_ITERATOR, doBulkInsert);
caps.setCapabilitySupport(Capability.QUERY_FROM_GROUP_ALIAS, false);
capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
@@ -108,7 +109,7 @@
Arrays.asList(new Object[] { "2", new Integer(2), Boolean.TRUE, new Double(2) })}); //$NON-NLS-1$
if (doBulkInsert) {
- dataManager.addData("INSERT INTO pm1.g2 (pm1.g2.e1, pm1.g2.e2, pm1.g2.e3, pm1.g2.e4) VALUES (?, ?, ?, ?)", //$NON-NLS-1$
+ dataManager.addData("INSERT INTO pm1.g2 (pm1.g2.e1, pm1.g2.e2, pm1.g2.e3, pm1.g2.e4) VALUES (...)", //$NON-NLS-1$
new List[] { Arrays.asList(new Object[] { new Integer(2)})});
}
else
@@ -153,7 +154,7 @@
FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
BasicSourceCapabilities caps = TestOptimizer.getTypicalCapabilities();
- caps.setCapabilitySupport(Capability.BULK_UPDATE, true);
+ caps.setCapabilitySupport(Capability.INSERT_WITH_ITERATOR, true);
caps.setFunctionSupport(SourceSystemFunctions.CONVERT, true);
capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
@@ -164,7 +165,7 @@
QueryMetadataInterface metadata = RealMetadataFactory.createTransformationMetadata(metadataStore, "foo");
HardcodedDataManager dataManager = new HardcodedDataManager();
- dataManager.addData("INSERT INTO pm1.g1 (pm1.g1.e1, pm1.g1.e2) VALUES (?, ?)", //$NON-NLS-1$
+ 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, convert(1, float) INTO pm1.g1"; //$NON-NLS-1$
@@ -230,7 +231,7 @@
}
@Test public void testInsertIntoWithSubquery_Bulk() {
- helpInsertIntoWithSubquery( Capability.BULK_UPDATE );
+ helpInsertIntoWithSubquery( Capability.INSERT_WITH_ITERATOR );
}
@Test public void testInsertIntoWithSubquery_Pushdown() {
@@ -257,8 +258,8 @@
if (cap != null) {
switch (cap) {
- case BULK_UPDATE:
- dataManager.addData("INSERT INTO pm1.g2 (pm1.g2.e1, pm1.g2.e2, pm1.g2.e3, pm1.g2.e4) VALUES (?, ?, ?, ?)", //$NON-NLS-1$
+ case INSERT_WITH_ITERATOR:
+ dataManager.addData("INSERT INTO pm1.g2 (pm1.g2.e1, pm1.g2.e2, pm1.g2.e3, pm1.g2.e4) VALUES (...)", //$NON-NLS-1$
new List[] { Arrays.asList(new Object[] { new Integer(2)})});
break;
case BATCHED_UPDATES:
@@ -324,6 +325,7 @@
caps.setCapabilitySupport(Capability.BATCHED_UPDATES, doBatching);
caps.setCapabilitySupport(Capability.BULK_UPDATE, doBulkInsert);
+ caps.setCapabilitySupport(Capability.INSERT_WITH_ITERATOR, doBulkInsert);
caps.setCapabilitySupport(Capability.QUERY_FROM_GROUP_ALIAS, false);
capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
@@ -337,8 +339,8 @@
Arrays.asList(new Object[] { "2", new Integer(2), Boolean.TRUE, new Double(2) })}); //$NON-NLS-1$
if (doBulkInsert) {
- dataManager.addData("INSERT INTO pm1.g2 (pm1.g2.e1, pm1.g2.e2, pm1.g2.e3, pm1.g2.e4) VALUES (?, ?, ?, ?)", //$NON-NLS-1$
- new List[] { Arrays.asList(new Object[] { new Integer(2)})});
+ dataManager.addData("INSERT INTO pm1.g2 (pm1.g2.e1, pm1.g2.e2, pm1.g2.e3, pm1.g2.e4) VALUES (...)", //$NON-NLS-1$
+ new List[] { Arrays.asList(new Object[] { new Integer(4)})});
}
else
if (doBatching) {
Modified: trunk/engine/src/test/java/org/teiid/query/processor/relational/TestProjectIntoNode.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/processor/relational/TestProjectIntoNode.java 2012-01-07 16:10:27 UTC (rev 3781)
+++ trunk/engine/src/test/java/org/teiid/query/processor/relational/TestProjectIntoNode.java 2012-01-09 19:33:46 UTC (rev 3782)
@@ -111,10 +111,6 @@
helpTestNextBatch(100, Mode.BATCH);
}
- @Test public void testNextBatch_BulkInsert() throws Exception {
- helpTestNextBatch(100, Mode.BULK);
- }
-
@Test public void testNextBatch_NoBatching() throws Exception {
helpTestNextBatch(100, Mode.SINGLE);
}
12 years, 11 months
teiid SVN: r3781 - in branches/7.6.x/engine/src: main/java/org/teiid/query/optimizer/relational/rules and 1 other directories.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2012-01-07 11:10:27 -0500 (Sat, 07 Jan 2012)
New Revision: 3781
Modified:
branches/7.6.x/engine/src/main/java/org/teiid/query/optimizer/relational/RelationalPlanner.java
branches/7.6.x/engine/src/main/java/org/teiid/query/optimizer/relational/rules/NewCalculateCostUtil.java
branches/7.6.x/engine/src/main/java/org/teiid/query/optimizer/relational/rules/RuleCleanCriteria.java
branches/7.6.x/engine/src/test/java/org/teiid/query/optimizer/TestUnionPlanning.java
Log:
TEIID-1893 fix for invalid output columns
Modified: branches/7.6.x/engine/src/main/java/org/teiid/query/optimizer/relational/RelationalPlanner.java
===================================================================
--- branches/7.6.x/engine/src/main/java/org/teiid/query/optimizer/relational/RelationalPlanner.java 2012-01-06 20:53:01 UTC (rev 3780)
+++ branches/7.6.x/engine/src/main/java/org/teiid/query/optimizer/relational/RelationalPlanner.java 2012-01-07 16:10:27 UTC (rev 3781)
@@ -408,7 +408,7 @@
rules.push(RuleConstants.PLAN_SORTS);
- //TODO: update plan sorts to take advantage or semi-join ordering
+ //TODO: update plan sorts to take advantage of semi-join ordering
if (hints.hasJoin || hints.hasCriteria) {
rules.push(new RuleMergeCriteria(idGenerator, capFinder, analysisRecord, context, metadata));
}
@@ -431,9 +431,7 @@
rules.push(new RulePushAggregates(idGenerator));
}
if(hints.hasJoin) {
- rules.push(RuleConstants.CHOOSE_DEPENDENT);
- }
- if(hints.hasJoin) {
+ rules.push(RuleConstants.CHOOSE_DEPENDENT);
rules.push(RuleConstants.CHOOSE_JOIN_STRATEGY);
rules.push(RuleConstants.RAISE_ACCESS);
//after planning the joins, let the criteria be pushed back into place
@@ -444,8 +442,9 @@
if (hints.hasSetQuery) {
rules.push(RuleConstants.PLAN_UNIONS);
}
- if(hints.hasCriteria || hints.hasJoin) {
+ if(hints.hasCriteria || hints.hasJoin || hints.hasVirtualGroups) {
//after copy criteria, it is no longer necessary to have phantom criteria nodes, so do some cleaning
+ //also remove possible erroneous output elements
rules.push(RuleConstants.CLEAN_CRITERIA);
}
if(hints.hasJoin) {
Modified: branches/7.6.x/engine/src/main/java/org/teiid/query/optimizer/relational/rules/NewCalculateCostUtil.java
===================================================================
--- branches/7.6.x/engine/src/main/java/org/teiid/query/optimizer/relational/rules/NewCalculateCostUtil.java 2012-01-06 20:53:01 UTC (rev 3780)
+++ branches/7.6.x/engine/src/main/java/org/teiid/query/optimizer/relational/rules/NewCalculateCostUtil.java 2012-01-07 16:10:27 UTC (rev 3781)
@@ -310,10 +310,14 @@
QueryMetadataInterface metadata, float cost)
throws QueryMetadataException, TeiidComponentException {
PlanNode projectNode = NodeEditor.findNodePreOrder(node, NodeConstants.Types.PROJECT);
+ float result = cost;
if (projectNode != null) {
- cost = getNDVEstimate(node.getParent(), metadata, cost, (List)projectNode.getProperty(NodeConstants.Info.PROJECT_COLS), false);
+ result = getNDVEstimate(node.getParent(), metadata, cost, (List)projectNode.getProperty(NodeConstants.Info.PROJECT_COLS), false);
+ if (result == UNKNOWN_VALUE) {
+ return cost;
+ }
}
- return cost;
+ return result;
}
private static void setCardinalityEstimate(PlanNode node, Float bestEstimate, boolean setColEstimates, QueryMetadataInterface metadata) throws QueryMetadataException, TeiidComponentException {
Modified: branches/7.6.x/engine/src/main/java/org/teiid/query/optimizer/relational/rules/RuleCleanCriteria.java
===================================================================
--- branches/7.6.x/engine/src/main/java/org/teiid/query/optimizer/relational/rules/RuleCleanCriteria.java 2012-01-06 20:53:01 UTC (rev 3780)
+++ branches/7.6.x/engine/src/main/java/org/teiid/query/optimizer/relational/rules/RuleCleanCriteria.java 2012-01-07 16:10:27 UTC (rev 3781)
@@ -35,6 +35,7 @@
import org.teiid.query.optimizer.relational.plantree.NodeConstants;
import org.teiid.query.optimizer.relational.plantree.NodeEditor;
import org.teiid.query.optimizer.relational.plantree.PlanNode;
+import org.teiid.query.optimizer.relational.plantree.NodeConstants.Info;
import org.teiid.query.sql.lang.Criteria;
import org.teiid.query.sql.visitor.EvaluatableVisitor;
import org.teiid.query.util.CommandContext;
@@ -53,40 +54,7 @@
boolean pushRaiseNull = false;
- for (PlanNode critNode : NodeEditor.findAllNodes(plan, NodeConstants.Types.SELECT)) {
-
- if (critNode.hasBooleanProperty(NodeConstants.Info.IS_PHANTOM)) {
- NodeEditor.removeChildNode(critNode.getParent(), critNode);
- continue;
- }
-
- //TODO: remove dependent set criteria that has not been meaningfully pushed from its parent join
-
- if (critNode.hasBooleanProperty(NodeConstants.Info.IS_HAVING) || critNode.getGroups().size() != 0) {
- continue;
- }
-
- Criteria crit = (Criteria)critNode.getProperty(NodeConstants.Info.SELECT_CRITERIA);
- //if not evaluatable, just move on to the next criteria
- if (!EvaluatableVisitor.isFullyEvaluatable(crit, true)) {
- continue;
- }
- //if evaluatable
- try {
- boolean eval = Evaluator.evaluate(crit);
- if(eval) {
- NodeEditor.removeChildNode(critNode.getParent(), critNode);
- } else {
- FrameUtil.replaceWithNullNode(critNode);
- pushRaiseNull = true;
- }
- //none of the following exceptions should ever occur
- } catch(BlockedException e) {
- throw new TeiidComponentException(e);
- } catch (ExpressionEvaluationException e) {
- throw new TeiidComponentException(e);
- }
- }
+ pushRaiseNull = clean(plan);
if (pushRaiseNull) {
rules.push(RuleConstants.RAISE_NULL);
@@ -94,7 +62,55 @@
return plan;
}
+
+ private boolean clean(PlanNode plan)
+ throws TeiidComponentException {
+ boolean pushRaiseNull = false;
+ plan.setProperty(Info.OUTPUT_COLS, null);
+ for (PlanNode node : plan.getChildren()) {
+ pushRaiseNull |= clean(node);
+ }
+ if (plan.getType() == NodeConstants.Types.SELECT) {
+ pushRaiseNull = cleanCriteria(plan);
+ }
+ return pushRaiseNull;
+ }
+ boolean cleanCriteria(PlanNode critNode) throws TeiidComponentException {
+ if (critNode.hasBooleanProperty(NodeConstants.Info.IS_PHANTOM)) {
+ NodeEditor.removeChildNode(critNode.getParent(), critNode);
+ return false;
+ }
+
+ //TODO: remove dependent set criteria that has not been meaningfully pushed from its parent join
+
+ if (critNode.hasBooleanProperty(NodeConstants.Info.IS_HAVING) || critNode.getGroups().size() != 0) {
+ return false;
+ }
+
+ Criteria crit = (Criteria)critNode.getProperty(NodeConstants.Info.SELECT_CRITERIA);
+ //if not evaluatable, just move on to the next criteria
+ if (!EvaluatableVisitor.isFullyEvaluatable(crit, true)) {
+ return false;
+ }
+ //if evaluatable
+ try {
+ boolean eval = Evaluator.evaluate(crit);
+ if(eval) {
+ NodeEditor.removeChildNode(critNode.getParent(), critNode);
+ } else {
+ FrameUtil.replaceWithNullNode(critNode);
+ return true;
+ }
+ //none of the following exceptions should ever occur
+ } catch(BlockedException e) {
+ throw new TeiidComponentException(e);
+ } catch (ExpressionEvaluationException e) {
+ throw new TeiidComponentException(e);
+ }
+ return false;
+ }
+
public String toString() {
return "CleanCriteria"; //$NON-NLS-1$
}
Modified: branches/7.6.x/engine/src/test/java/org/teiid/query/optimizer/TestUnionPlanning.java
===================================================================
--- branches/7.6.x/engine/src/test/java/org/teiid/query/optimizer/TestUnionPlanning.java 2012-01-06 20:53:01 UTC (rev 3780)
+++ branches/7.6.x/engine/src/test/java/org/teiid/query/optimizer/TestUnionPlanning.java 2012-01-07 16:10:27 UTC (rev 3781)
@@ -23,8 +23,10 @@
package org.teiid.query.optimizer;
import org.junit.Test;
+import org.teiid.query.metadata.TransformationMetadata;
import org.teiid.query.optimizer.TestOptimizer.ComparisonMode;
import org.teiid.query.optimizer.capabilities.BasicSourceCapabilities;
+import org.teiid.query.optimizer.capabilities.DefaultCapabilitiesFinder;
import org.teiid.query.optimizer.capabilities.FakeCapabilitiesFinder;
import org.teiid.query.optimizer.capabilities.SourceCapabilities.Capability;
import org.teiid.query.processor.ProcessorPlan;
@@ -254,5 +256,36 @@
0, // Sort
2 // UnionAll
});
- }
+ }
+
+ @Test public void testUnionCosting() throws Exception {
+ TransformationMetadata metadata = RealMetadataFactory.example1();
+ RealMetadataFactory.setCardinality("pm1.g1", 100, metadata);
+ RealMetadataFactory.setCardinality("pm1.g2", 100, metadata);
+ RealMetadataFactory.setCardinality("pm1.g3", 100, metadata);
+ RealMetadataFactory.setCardinality("pm1.g4", 100, metadata);
+ BasicSourceCapabilities bac = new BasicSourceCapabilities();
+ bac.setCapabilitySupport(Capability.QUERY_SELECT_EXPRESSION, true);
+ bac.setCapabilitySupport(Capability.CRITERIA_COMPARE_EQ, true);
+ ProcessorPlan plan = TestOptimizer.helpPlan("SELECT T.e1 AS e1, T.e2 AS e2, T.e3 AS e3 FROM (SELECT e1, 'a' AS e2, e3 FROM pm1.g1 UNION SELECT e1, 'b' AS e2, e3 FROM pm1.g2 UNION SELECT e1, 'c' AS e2, e3 FROM pm1.g3) AS T, vm1.g1 AS L WHERE (T.e1 = L.e1) AND (T.e3 = TRUE)", metadata, null, new DefaultCapabilitiesFinder(bac),//$NON-NLS-1$
+ new String[] { "SELECT pm1.g1.e1 FROM pm1.g1", "SELECT pm1.g1.e1, pm1.g1.e3 FROM pm1.g1 WHERE pm1.g1.e3 = TRUE", "SELECT pm1.g3.e1, pm1.g3.e3 FROM pm1.g3 WHERE pm1.g3.e3 = TRUE", "SELECT pm1.g2.e1, pm1.g2.e3 FROM pm1.g2 WHERE pm1.g2.e3 = TRUE" }, ComparisonMode.EXACT_COMMAND_STRING);
+
+ TestOptimizer.checkNodeTypes(plan, new int[] {
+ 4, // Access
+ 0, // DependentAccess
+ 0, // DependentSelect
+ 0, // DependentProject
+ 0, // DupRemove
+ 0, // Grouping
+ 0, // NestedLoopJoinStrategy
+ 1, // MergeJoinStrategy
+ 0, // Null
+ 0, // PlanExecution
+ 1, // Project
+ 0, // Select
+ 0, // Sort
+ 2 // UnionAll
+ });
+ }
+
}
12 years, 11 months
teiid SVN: r3780 - in branches/7.6.x/engine/src: test/java/org/teiid/query/processor and 1 other directory.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2012-01-06 15:53:01 -0500 (Fri, 06 Jan 2012)
New Revision: 3780
Modified:
branches/7.6.x/engine/src/main/java/org/teiid/query/optimizer/relational/rules/NewCalculateCostUtil.java
branches/7.6.x/engine/src/test/java/org/teiid/query/processor/TestDependentJoins.java
Log:
TEIID-1868 TEIID-1533 refining the backoff logic to not be used unless the ndv is known.
Modified: branches/7.6.x/engine/src/main/java/org/teiid/query/optimizer/relational/rules/NewCalculateCostUtil.java
===================================================================
--- branches/7.6.x/engine/src/main/java/org/teiid/query/optimizer/relational/rules/NewCalculateCostUtil.java 2012-01-06 20:06:41 UTC (rev 3779)
+++ branches/7.6.x/engine/src/main/java/org/teiid/query/optimizer/relational/rules/NewCalculateCostUtil.java 2012-01-06 20:53:01 UTC (rev 3780)
@@ -1161,7 +1161,12 @@
for (int i = 0; i < independentExpressions.size(); i++) {
Expression indExpr = (Expression)independentExpressions.get(i);
Collection<ElementSymbol> indElements = ElementCollectorVisitor.getElements(indExpr, true);
- float indSymbolNDV = getNDVEstimate(independentNode, metadata, independentCardinality, indElements, true);
+ float indSymbolNDV = getNDVEstimate(independentNode, metadata, independentCardinality, indElements, false);
+ boolean unknownNDV = false;
+ if (indSymbolNDV == UNKNOWN_VALUE) {
+ unknownNDV = true;
+ indSymbolNDV = independentCardinality/2;
+ }
Expression depExpr = (Expression)dependentExpressions.get(i);
LinkedList<Expression> depExpressions = new LinkedList<Expression>();
@@ -1220,6 +1225,7 @@
}
}
depSymbolNDV = Math.max((float)Math.pow(depTargetCardinality, .75), Math.min(indSymbolOrigNDV, depTargetCardinality));
+ unknownNDV = true;
} else {
depSymbolNDV = depTargetCardinality;
}
@@ -1236,6 +1242,10 @@
dca.expectedCardinality = Math.min(dca.expectedCardinality, estimates[0]);
}
}
+ //don't use the ndv if it is unknown
+ if (unknownNDV) {
+ continue;
+ }
dca.expectedNdv[i] = indSymbolNDV;
//use a quick binary search to find the max ndv
float min = 0;
Modified: branches/7.6.x/engine/src/test/java/org/teiid/query/processor/TestDependentJoins.java
===================================================================
--- branches/7.6.x/engine/src/test/java/org/teiid/query/processor/TestDependentJoins.java 2012-01-06 20:06:41 UTC (rev 3779)
+++ branches/7.6.x/engine/src/test/java/org/teiid/query/processor/TestDependentJoins.java 2012-01-06 20:53:01 UTC (rev 3780)
@@ -29,9 +29,11 @@
import java.util.List;
import org.junit.Test;
+import org.teiid.api.exception.query.QueryMetadataException;
import org.teiid.core.TeiidComponentException;
import org.teiid.core.TeiidProcessingException;
import org.teiid.query.metadata.QueryMetadataInterface;
+import org.teiid.query.metadata.TransformationMetadata;
import org.teiid.query.optimizer.TestOptimizer;
import org.teiid.query.optimizer.TestOptimizer.ComparisonMode;
import org.teiid.query.optimizer.capabilities.BasicSourceCapabilities;
@@ -832,17 +834,40 @@
}
@Test public void testDependentJoinBackoff() throws Exception {
- // Create query
+ FakeDataManager dataManager = helpTestBackoff(true);
+
+ //note that the dependent join was not actually performed
+ assertEquals(new HashSet<String>(Arrays.asList("SELECT pm1.g1.e1 FROM pm1.g1", "SELECT pm6.g1.e1 FROM pm6.g1 ORDER BY pm6.g1.e1")),
+ new HashSet<String>(dataManager.getQueries()));
+ }
+
+ @Test public void testDependentJoinBackoff1() throws Exception {
+ FakeDataManager dataManager = helpTestBackoff(false);
+
+ //note that the dependent join was performed
+ assertEquals(4, new HashSet<String>(dataManager.getQueries()).size());
+ }
+
+ private FakeDataManager helpTestBackoff(boolean setNdv) throws Exception,
+ QueryMetadataException, TeiidComponentException,
+ TeiidProcessingException {
+ // Create query
String sql = "SELECT pm1.g1.e1 FROM pm1.g1, pm6.g1 WHERE pm1.g1.e1=pm6.g1.e1"; //$NON-NLS-1$
// Construct data manager with data
FakeDataManager dataManager = new FakeDataManager();
sampleData4(dataManager);
- QueryMetadataInterface fakeMetadata = RealMetadataFactory.example1();
+ TransformationMetadata fakeMetadata = RealMetadataFactory.example1();
RealMetadataFactory.setCardinality("pm1.g1", 1, fakeMetadata);
+ if (setNdv) {
+ fakeMetadata.getElementID("pm1.g1.e1").setDistinctValues(1);
+ }
RealMetadataFactory.setCardinality("pm6.g1", 1000, fakeMetadata);
+ if (setNdv) {
+ fakeMetadata.getElementID("pm6.g1.e1").setDistinctValues(1000);
+ }
// Plan query
FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
BasicSourceCapabilities depcaps = new BasicSourceCapabilities();
@@ -867,11 +892,8 @@
// Run query
TestProcessor.helpProcess(plan, dataManager, expected);
-
- //note that the dependent join was not actually performed
- assertEquals(new HashSet<String>(Arrays.asList("SELECT pm1.g1.e1 FROM pm1.g1", "SELECT pm6.g1.e1 FROM pm6.g1 ORDER BY pm6.g1.e1")),
- new HashSet<String>(dataManager.getQueries()));
- }
+ return dataManager;
+ }
@Test public void testDjHint() {
// Create query
12 years, 11 months
teiid SVN: r3779 - in branches/7.4.x/engine/src: test/java/org/teiid/dqp/internal/process and 1 other directory.
by teiid-commits@lists.jboss.org
Author: jolee
Date: 2012-01-06 15:06:41 -0500 (Fri, 06 Jan 2012)
New Revision: 3779
Modified:
branches/7.4.x/engine/src/main/java/org/teiid/dqp/internal/process/RequestWorkItem.java
branches/7.4.x/engine/src/test/java/org/teiid/dqp/internal/process/TestDQPCore.java
Log:
TEIID-1884 fixing final row count when using foward only and fix of unit test to avoid in-process thread during row count.
Modified: branches/7.4.x/engine/src/main/java/org/teiid/dqp/internal/process/RequestWorkItem.java
===================================================================
--- branches/7.4.x/engine/src/main/java/org/teiid/dqp/internal/process/RequestWorkItem.java 2012-01-05 21:59:14 UTC (rev 3778)
+++ branches/7.4.x/engine/src/main/java/org/teiid/dqp/internal/process/RequestWorkItem.java 2012-01-06 20:06:41 UTC (rev 3779)
@@ -503,8 +503,9 @@
return;
}
super.flushBatchDirect(batch, add);
- //restrict the buffer size for forward only results
- if (add && !processor.hasFinalBuffer()
+ if (!add && !processor.hasFinalBuffer()) {
+ resultsBuffer.setRowCount(batch.getEndRow());
+ } else if (!processor.hasFinalBuffer() //restrict the buffer size for forward only results
&& !batch.getTerminationFlag()
&& this.getTupleBuffer().getManagedRowCount() >= OUTPUT_BUFFER_MAX_BATCHES * this.getTupleBuffer().getBatchSize()) {
if (!dqpCore.hasWaitingPlans(RequestWorkItem.this)) {
Modified: branches/7.4.x/engine/src/test/java/org/teiid/dqp/internal/process/TestDQPCore.java
===================================================================
--- branches/7.4.x/engine/src/test/java/org/teiid/dqp/internal/process/TestDQPCore.java 2012-01-05 21:59:14 UTC (rev 3778)
+++ branches/7.4.x/engine/src/test/java/org/teiid/dqp/internal/process/TestDQPCore.java 2012-01-06 20:06:41 UTC (rev 3779)
@@ -333,6 +333,25 @@
assertEquals(100, item.resultsBuffer.getRowCount());
}
+ @Test public void testFinalRow() throws Exception {
+ String sql = "SELECT A.IntKey FROM BQT1.SmallA as A"; //$NON-NLS-1$
+ String userName = "1"; //$NON-NLS-1$
+ String sessionid = "1"; //$NON-NLS-1$
+
+ RequestMessage reqMsg = exampleRequestMessage(sql);
+ reqMsg.setCursorType(ResultSet.TYPE_FORWARD_ONLY);
+ DQPWorkContext.getWorkContext().getSession().setSessionId(sessionid);
+ DQPWorkContext.getWorkContext().getSession().setUserName(userName);
+ ((BufferManagerImpl)core.getBufferManager()).setProcessorBatchSize(10);
+ Future<ResultsMessage> message = core.executeRequest(reqMsg.getExecutionId(), reqMsg);
+ ResultsMessage rm = message.get(500000, TimeUnit.MILLISECONDS);
+ assertNull(rm.getException());
+ assertEquals(10, rm.getResults().length);
+ RequestWorkItem item = core.getRequestWorkItem(DQPWorkContext.getWorkContext().getRequestID(reqMsg.getExecutionId()));
+ while(item.isProcessing());
+ assertEquals(10, item.resultsBuffer.getRowCount());
+ }
+
@Test public void testBufferReuse1() throws Exception {
//the sql should return 100 rows
String sql = "SELECT IntKey FROM texttable('11\n12\n13\n14\n15' columns intkey integer) t " +
12 years, 11 months