teiid SVN: r4154 - branches/7.7.x/common-core/src/main/java/org/teiid/core.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2012-05-31 16:36:33 -0400 (Thu, 31 May 2012)
New Revision: 4154
Modified:
branches/7.7.x/common-core/src/main/java/org/teiid/core/TeiidException.java
branches/7.7.x/common-core/src/main/java/org/teiid/core/TeiidRuntimeException.java
Log:
TEIID-2060 fixing toString methods
Modified: branches/7.7.x/common-core/src/main/java/org/teiid/core/TeiidException.java
===================================================================
--- branches/7.7.x/common-core/src/main/java/org/teiid/core/TeiidException.java 2012-05-31 19:46:20 UTC (rev 4153)
+++ branches/7.7.x/common-core/src/main/java/org/teiid/core/TeiidException.java 2012-05-31 20:36:33 UTC (rev 4154)
@@ -162,12 +162,4 @@
return super.getCause();
}
- /**
- * Returns a string representation of this class.
- *
- * @return String representation of instance
- */
- public String toString() {
- return getFullMessage();
- }
}
Modified: branches/7.7.x/common-core/src/main/java/org/teiid/core/TeiidRuntimeException.java
===================================================================
--- branches/7.7.x/common-core/src/main/java/org/teiid/core/TeiidRuntimeException.java 2012-05-31 19:46:20 UTC (rev 4153)
+++ branches/7.7.x/common-core/src/main/java/org/teiid/core/TeiidRuntimeException.java 2012-05-31 20:36:33 UTC (rev 4154)
@@ -22,7 +22,6 @@
package org.teiid.core;
-import org.teiid.core.util.ExceptionUtil;
/**
@@ -136,13 +135,4 @@
this.code = code;
}
- /**
- * Returns a string representation of this class.
- *
- * @return String representation of instance
- */
- public String toString() {
- return ExceptionUtil.getLinkedMessages(this);
- }
-
}
12 years, 6 months
teiid SVN: r4153 - trunk/connectors/translator-salesforce.
by teiid-commits@lists.jboss.org
Author: rareddy
Date: 2012-05-31 15:46:20 -0400 (Thu, 31 May 2012)
New Revision: 4153
Modified:
trunk/connectors/translator-salesforce/pom.xml
Log:
misc: avoid adding the sales force api jar to the modules directory.
Modified: trunk/connectors/translator-salesforce/pom.xml
===================================================================
--- trunk/connectors/translator-salesforce/pom.xml 2012-05-31 19:00:50 UTC (rev 4152)
+++ trunk/connectors/translator-salesforce/pom.xml 2012-05-31 19:46:20 UTC (rev 4153)
@@ -25,6 +25,7 @@
<groupId>org.jboss.teiid.connectors</groupId>
<artifactId>salesforce-api</artifactId>
<version>${project.version}</version>
+ <scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.resource</groupId>
12 years, 6 months
teiid SVN: r4152 - in trunk: admin/src/main/java/org/teiid/adminapi and 24 other directories.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2012-05-31 15:00:50 -0400 (Thu, 31 May 2012)
New Revision: 4152
Added:
trunk/test-integration/common/src/test/java/org/teiid/arquillian/AdminUtil.java
trunk/test-integration/common/src/test/java/org/teiid/arquillian/IntegrationTestVDBReuse.java
Modified:
trunk/admin/src/main/java/org/teiid/adminapi/AdminException.java
trunk/admin/src/main/java/org/teiid/adminapi/AdminFactory.java
trunk/admin/src/main/java/org/teiid/adminapi/VDB.java
trunk/admin/src/main/java/org/teiid/adminapi/impl/VDBMetaData.java
trunk/admin/src/main/java/org/teiid/adminapi/impl/VDBMetadataMapper.java
trunk/admin/src/test/resources/vdb-describe.txt
trunk/api/src/main/java/org/teiid/metadata/MetadataFactory.java
trunk/common-core/src/main/java/org/teiid/core/TeiidException.java
trunk/common-core/src/main/java/org/teiid/core/TeiidRuntimeException.java
trunk/common-core/src/main/java/org/teiid/core/util/ExceptionUtil.java
trunk/common-core/src/test/java/org/teiid/core/TestMetaMatrixRuntimeException.java
trunk/common-core/src/test/java/org/teiid/core/util/TestMetaMatrixExceptionUtil.java
trunk/common-core/src/test/java/org/teiid/core/util/TestPropertiesUtils.java
trunk/documentation/pom.xml
trunk/engine/src/main/java/org/teiid/dqp/internal/process/DQPCore.java
trunk/engine/src/main/java/org/teiid/query/QueryPlugin.java
trunk/engine/src/main/java/org/teiid/query/metadata/MetadataValidator.java
trunk/engine/src/main/resources/org/teiid/query/i18n.properties
trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestDQPCore.java
trunk/engine/src/test/java/org/teiid/query/processor/eval/TestExpressionEvaluator.java
trunk/engine/src/test/java/org/teiid/query/sql/visitor/TestDeepGroupCollectorVisitor.java
trunk/jboss-integration/src/main/java/org/teiid/jboss/DQPCoreService.java
trunk/jboss-integration/src/main/java/org/teiid/jboss/TranslatorDeployer.java
trunk/jboss-integration/src/main/java/org/teiid/jboss/TransportService.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/pom.xml
trunk/runtime/src/main/java/org/teiid/deployers/CompositeVDB.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/ClientServiceRegistry.java
trunk/runtime/src/main/java/org/teiid/transport/ClientServiceRegistryImpl.java
trunk/runtime/src/main/java/org/teiid/transport/LocalServerConnection.java
trunk/runtime/src/main/resources/org/teiid/runtime/i18n.properties
trunk/test-integration/common/src/test/java/org/teiid/arquillian/IntegrationTestDeployment.java
trunk/test-integration/common/src/test/java/org/teiid/arquillian/IntegrationTestDynamicViewDefinition.java
trunk/test-integration/common/src/test/java/org/teiid/arquillian/SampleExecutionFactory.java
trunk/test-integration/common/src/test/resources/dynamicview-vdb.xml
trunk/test-integration/db/src/main/java/org/teiid/test/framework/exception/QueryTestFailedException.java
Log:
TEIID-1366 TEIID-2022 adding arquillian tests for reuse and misc fixes including refining exception handling
Modified: trunk/admin/src/main/java/org/teiid/adminapi/AdminException.java
===================================================================
--- trunk/admin/src/main/java/org/teiid/adminapi/AdminException.java 2012-05-30 15:39:59 UTC (rev 4151)
+++ trunk/admin/src/main/java/org/teiid/adminapi/AdminException.java 2012-05-31 19:00:50 UTC (rev 4152)
@@ -45,7 +45,7 @@
private static final long serialVersionUID = -4446936145500241358L;
// List of Admin exceptions in
// case of multiple failure
- private List children;
+ private List<AdminException> children;
/**
* No-arg ctor.
@@ -110,8 +110,11 @@
* @return The non-null list of failures.
* @since 4.3
*/
- public List getChildren() {
- return (children != null ? children : Collections.EMPTY_LIST);
+ public List<AdminException> getChildren() {
+ if (children == null) {
+ return Collections.emptyList();
+ }
+ return children;
}
/**
@@ -123,7 +126,7 @@
*/
public void addChild(AdminException child) {
if ( children == null ) {
- children = new ArrayList();
+ children = new ArrayList<AdminException>();
}
children.add(child);
}
Modified: trunk/admin/src/main/java/org/teiid/adminapi/AdminFactory.java
===================================================================
--- trunk/admin/src/main/java/org/teiid/adminapi/AdminFactory.java 2012-05-30 15:39:59 UTC (rev 4151)
+++ trunk/admin/src/main/java/org/teiid/adminapi/AdminFactory.java 2012-05-31 19:00:50 UTC (rev 4152)
@@ -67,6 +67,7 @@
@SuppressWarnings("nls")
public class AdminFactory {
private static final Logger LOGGER = Logger.getLogger(AdminFactory.class.getName());
+ private static Set<String> optionalProps = new HashSet<String>(Arrays.asList("connection-url", "password", "check-valid-connection-sql", "pool-prefill", "max-pool-size", "min-pool-size"));
private static AdminFactory INSTANCE = new AdminFactory();
public static AdminFactory getInstance() {
@@ -398,21 +399,15 @@
builder.addProperty("driver-name", templateName);
builder.addProperty("pool-name", deploymentName);
- builder.addProperty("pool-prefill", "false");
- builder.addProperty("max-pool-size", "20");
- builder.addProperty("min-pool-size", "10");
if (properties != null) {
builder.addProperty("connection-url", properties.getProperty("connection-url"));
- if (properties.getProperty("user-name") != null) {
- builder.addProperty("user-name", properties.getProperty("user-name"));
+ for (String prop : optionalProps) {
+ String value = properties.getProperty(prop);
+ if (value != null) {
+ builder.addProperty(prop, value);
+ }
}
- if (properties.getProperty("password") != null) {
- builder.addProperty("password", properties.getProperty("password"));
- }
- if (properties.getProperty("check-valid-connection-sql") != null) {
- builder.addProperty("check-valid-connection-sql", properties.getProperty("check-valid-connection-sql"));
- }
}
else {
throw new AdminProcessingException(AdminPlugin.Event.TEIID70005, AdminPlugin.Util.gs(AdminPlugin.Event.TEIID70005));
Modified: trunk/admin/src/main/java/org/teiid/adminapi/VDB.java
===================================================================
--- trunk/admin/src/main/java/org/teiid/adminapi/VDB.java 2012-05-30 15:39:59 UTC (rev 4151)
+++ trunk/admin/src/main/java/org/teiid/adminapi/VDB.java 2012-05-31 19:00:50 UTC (rev 4152)
@@ -40,7 +40,22 @@
*/
public interface VDB extends AdminObject, DomainAware {
- public static enum Status{INACTIVE, ACTIVE};
+ public static enum Status{
+ //loaded | valid
+ INCOMPLETE(true), //f f
+ LOADING(true), //f t
+ INVALID(false), //t f
+ ACTIVE(false), //t t
+ REMOVED(false);
+
+ private boolean loading;
+ private Status(boolean loading) {
+ this.loading = loading;
+ }
+
+ public boolean isLoading() {
+ return loading;
+ }};
public enum ConnectionType {NONE, BY_VERSION, ANY}
Modified: trunk/admin/src/main/java/org/teiid/adminapi/impl/VDBMetaData.java
===================================================================
--- trunk/admin/src/main/java/org/teiid/adminapi/impl/VDBMetaData.java 2012-05-30 15:39:59 UTC (rev 4151)
+++ trunk/admin/src/main/java/org/teiid/adminapi/impl/VDBMetaData.java 2012-05-31 19:00:50 UTC (rev 4152)
@@ -79,33 +79,15 @@
protected String description;
private boolean dynamic = false;
- private VDB.Status status = VDB.Status.INACTIVE;
+ private volatile VDB.Status status = VDB.Status.ACTIVE;
private ConnectionType connectionType = VDB.ConnectionType.BY_VERSION;
- private boolean removed;
private long queryTimeout = Long.MIN_VALUE;
private Set<String> importedModels = Collections.emptySet();
- public String getName() {
- return super.getName();
- }
-
public String getFullName() {
return getName() + VERSION_DELIM + getVersion();
}
- // This needed by JAXB marshaling
- public void setName(String name) {
- super.setName(name);
- }
-
- public boolean isRemoved() {
- return removed;
- }
-
- public void setRemoved(boolean removed) {
- this.removed = removed;
- }
-
@Override
public ConnectionType getConnectionType() {
return this.connectionType;
@@ -124,12 +106,20 @@
return this.status;
}
- public void setStatus(Status s) {
+ public boolean isLoading() {
+ return this.status.isLoading();
+ }
+
+ public synchronized void setStatus(Status s) {
+ this.notifyAll();
+ if (this.status == Status.REMOVED) {
+ return;
+ }
this.status = s;
}
public void setStatus(String s) {
- this.status = Status.valueOf(s);
+ setStatus(Status.valueOf(s));
}
@Override
Modified: trunk/admin/src/main/java/org/teiid/adminapi/impl/VDBMetadataMapper.java
===================================================================
--- trunk/admin/src/main/java/org/teiid/adminapi/impl/VDBMetadataMapper.java 2012-05-30 15:39:59 UTC (rev 4151)
+++ trunk/admin/src/main/java/org/teiid/adminapi/impl/VDBMetadataMapper.java 2012-05-31 19:00:50 UTC (rev 4152)
@@ -211,7 +211,10 @@
ModelNode statusAllowed = new ModelNode();
statusAllowed.add(Status.ACTIVE.toString());
- statusAllowed.add(Status.INACTIVE.toString());
+ statusAllowed.add(Status.LOADING.toString());
+ statusAllowed.add(Status.INVALID.toString());
+ statusAllowed.add(Status.REMOVED.toString());
+ statusAllowed.add(Status.INCOMPLETE.toString());
addAttribute(node, STATUS, ModelType.STRING, true);
node.get(STATUS).get(ALLOWED).set(statusAllowed);
Modified: trunk/admin/src/test/resources/vdb-describe.txt
===================================================================
--- trunk/admin/src/test/resources/vdb-describe.txt 2012-05-30 15:39:59 UTC (rev 4151)
+++ trunk/admin/src/test/resources/vdb-describe.txt 2012-05-31 19:00:50 UTC (rev 4152)
@@ -26,7 +26,10 @@
"required" : true,
"allowed" : [
"ACTIVE",
- "INACTIVE"
+ "LOADING",
+ "INVALID",
+ "REMOVED",
+ "INCOMPLETE"
]
},
"vdb-version" : {
Modified: trunk/api/src/main/java/org/teiid/metadata/MetadataFactory.java
===================================================================
--- trunk/api/src/main/java/org/teiid/metadata/MetadataFactory.java 2012-05-30 15:39:59 UTC (rev 4151)
+++ trunk/api/src/main/java/org/teiid/metadata/MetadataFactory.java 2012-05-31 19:00:50 UTC (rev 4152)
@@ -22,6 +22,7 @@
package org.teiid.metadata;
+import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collection;
import java.util.LinkedList;
@@ -42,7 +43,7 @@
* TODO: add support for datatype import
* TODO: add support for unique constraints
*/
-public class MetadataFactory {
+public class MetadataFactory implements Serializable {
private static final long serialVersionUID = 8590341087771685630L;
private String vdbName;
Modified: trunk/common-core/src/main/java/org/teiid/core/TeiidException.java
===================================================================
--- trunk/common-core/src/main/java/org/teiid/core/TeiidException.java 2012-05-30 15:39:59 UTC (rev 4151)
+++ trunk/common-core/src/main/java/org/teiid/core/TeiidException.java 2012-05-31 19:00:50 UTC (rev 4152)
@@ -23,7 +23,6 @@
package org.teiid.core;
import java.sql.SQLException;
-import java.util.Iterator;
import org.teiid.core.util.ExceptionUtil;
@@ -54,14 +53,29 @@
public TeiidException(BundleUtil.Event code, Throwable t, final String message) {
super(message, t);
- setCode(code.toString());
+ if (message != null && message.equals(t.getMessage())) {
+ setCode(code, t);
+ } else {
+ setCode(code.toString());
+ }
}
public TeiidException(BundleUtil.Event code, Throwable t) {
super(t);
- setCode(code.toString());
- }
+ setCode(code, t);
+ }
+ private void setCode(BundleUtil.Event code, Throwable t) {
+ String codeStr = code.toString();
+ if (t instanceof TeiidException) {
+ TeiidException te = (TeiidException)t;
+ if (te.getCode() != null) {
+ codeStr = te.getCode();
+ }
+ }
+ setCode(codeStr);
+ }
+
public TeiidException(Throwable e) {
this(e, e != null? e.getMessage() : null);
}
@@ -107,62 +121,15 @@
}
/**
- * Returns the error message, formatted for output. <P>
- *
- * The default formatting provided by this method is to prepend the
- * error message with the level and the name of the class, and to
- * append the error code on the end if a non-zero code is defined. <P>
- *
- * This method provides a hook for subclasses to override the default
- * formatting of any one exception.
- *
- * @param throwable The exception to print
- * @param level The depth of the exception in the chain of exceptions
- * @return A formatted string for the exception
- */
- static String getFormattedMessage(final Throwable throwable, final int level) {
- String code;
- if (throwable instanceof TeiidException) {
- code = ((TeiidException) throwable).getCode();
- } else if (throwable instanceof TeiidRuntimeException) {
- code = ((TeiidRuntimeException) throwable).getCode();
- } else {
- code = null;
- }
- return ((level != 0) ? ("\n" + level + " ") : "") //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- + "[" + throwable.getClass().getSimpleName() + "]" //$NON-NLS-1$ //$NON-NLS-2$
- + ((code != null) ? (' ' + code + ": ") : "") //$NON-NLS-1$ //$NON-NLS-2$
- + (throwable.getMessage() == null ? "" : throwable.getMessage()); //$NON-NLS-1$
- }
-
- /**
* Get the full error message, including any message(s) from child
- * exceptions. Messages of any exceptions chained to this exception are
- * prepended with their "level" in the chain.
+ * exceptions.
*
* @return The full error message
*
* @see #getFormattedMessage
*/
public String getFullMessage() {
- int level = 0;
- StringBuffer buf = new StringBuffer();
- buf.append(getFormattedMessage(this,level));
- Iterator children = ExceptionUtil.getChildrenIterator(this);
- while ( children.hasNext() ){
- level++;
- Throwable exception = (Throwable)children.next();
- buf.append(getFormattedMessage(exception,level));
- }
- return buf.toString();
+ return ExceptionUtil.getLinkedMessagesVerbose(this);
}
- /**
- * Returns a string representation of this class.
- *
- * @return String representation of instance
- */
- public String toString() {
- return getFullMessage();
- }
}
Modified: trunk/common-core/src/main/java/org/teiid/core/TeiidRuntimeException.java
===================================================================
--- trunk/common-core/src/main/java/org/teiid/core/TeiidRuntimeException.java 2012-05-30 15:39:59 UTC (rev 4151)
+++ trunk/common-core/src/main/java/org/teiid/core/TeiidRuntimeException.java 2012-05-31 19:00:50 UTC (rev 4152)
@@ -154,8 +154,16 @@
*
* @return String representation of instance
*/
- public String toString() {
- return ExceptionUtil.getLinkedMessages(this);
+ public String getFullMessage() {
+ return ExceptionUtil.getLinkedMessagesVerbose(this);
}
+
+ public String getMessage() {
+ String message = super.getMessage();
+ if (code == null || code.length() == 0 || message.startsWith(code)) {
+ return message;
+ }
+ return code+" "+message; //$NON-NLS-1$
+ }
}
Modified: trunk/common-core/src/main/java/org/teiid/core/util/ExceptionUtil.java
===================================================================
--- trunk/common-core/src/main/java/org/teiid/core/util/ExceptionUtil.java 2012-05-30 15:39:59 UTC (rev 4151)
+++ trunk/common-core/src/main/java/org/teiid/core/util/ExceptionUtil.java 2012-05-31 19:00:50 UTC (rev 4152)
@@ -22,16 +22,13 @@
package org.teiid.core.util;
-import java.io.PrintStream;
import java.sql.SQLException;
import java.util.Iterator;
import java.util.NoSuchElementException;
import javax.naming.ConfigurationException;
-import org.teiid.core.TeiidRuntimeException;
-
/**
* Utility class that provides some useful things for users of the
* com.metamatrix.api.exception package. Also provides package-level
@@ -46,49 +43,22 @@
super();
}
- /**
- * Convenience method that takes any Throwable and returns an appropriate
- * Iterator over any nested exceptions in that Throwable. Currently,
- * only instances of MetaMatrixException and MetaMatrixRuntimeException
- * are capable of nesting Throwables - calling this method in that case
- * is equivalent to calling
- * {@link TeiidException#getChildren MetaMatrixException.getChildren()}
- * or
- * {@link TeiidRuntimeException#getChildren MetaMatrixRuntimeException.getChildren()}.
- * Otherwise, a non-null "empty" Iterator is returned, one that simply has
- * no Objects in it.
- * @param e any Throwable
- * @return an appropriate Iterator over any nested children Throwables;
- */
- public static Iterator getChildrenIterator(Throwable e){
+ static Iterator<Throwable> getChildrenIterator(Throwable e){
return new NestedExceptionIterator(e);
}
- public static void printNestedStackTrace(Throwable exception, PrintStream output) {
- if (exception != null){
- exception.printStackTrace(output);
-
- Iterator children = getChildrenIterator(exception);
- while ( children.hasNext() ){
- exception = (Throwable)children.next();
- output.print(TeiidRuntimeException.CAUSED_BY_STRING);
- exception.printStackTrace(output);
- }
- }
- }
-
public static String getLinkedMessagesVerbose(Throwable exception) {
return getLinkedMessagesVerbose(exception, 0);
}
- public static String getLinkedMessagesVerbose( Throwable exception, int level ) {
+ static String getLinkedMessagesVerbose( Throwable exception, int level ) {
if (exception != null){
StringBuffer buf = new StringBuffer();
String lastMessage = appendMessage("", buf, null, exception); //$NON-NLS-1$
- Iterator children = getChildrenIterator(exception);
+ Iterator<Throwable> children = getChildrenIterator(exception);
while ( children.hasNext() ){
level++;
- exception = (Throwable)children.next();
+ exception = children.next();
lastMessage = appendMessage("->", buf, lastMessage, exception); //$NON-NLS-1$
}
return buf.toString();
@@ -96,49 +66,10 @@
return ""; //$NON-NLS-1$
}
- public static String getLinkedMessages(Throwable exception) {
- return getLinkedMessages(exception, 0);
- }
-
- /**
- * Get the chain of messages, starting with the specified exception. The
- * level number in the chain is prepended. <P>
- *
- * This method calls the <CODE>getMessage</CODE> method for the exception
- * passed in, and appends on the result returned from a recursive call to
- * this method for the child of the passed in exception. The passed in
- * exception is updated on each recursive call to be the child of the
- * original exception, and the level is incremented on each call.
- *
- * @param exception The exception to print the chained message list of
- * @param level (zero-based) The depth of the exception parameter in
- * the chain of exceptions.
- * @param messageFormatter the formatter of the message; may not be null
- * @return A string of chained messages, each prepended by its level
- * in the chain, and each followed by a newline (blank string if
- * the exception passed in is null)
- *
- * @see Throwable#getMessage()
- */
- public static String getLinkedMessages( Throwable exception, int level ) {
- if (exception != null){
- StringBuffer buf = new StringBuffer();
- buf.append(exception.getMessage());
- Iterator children = getChildrenIterator(exception);
- while ( children.hasNext() ){
- level++;
- exception = (Throwable)children.next();
- buf.append(exception.getMessage());
- }
- return buf.toString();
- }
- return ""; //$NON-NLS-1$
- }
-
private static final String appendMessage(String prefix, StringBuffer buffer, String lastMessage, Throwable exception) {
String message = exception.getMessage();
buffer.append(prefix);
- buffer.append(getClassName(exception));
+ buffer.append(exception.getClass().getSimpleName());
if (message != null && !message.equals(lastMessage)) {
buffer.append('-');
buffer.append(message);
@@ -146,15 +77,6 @@
return message;
}
- private static final String getClassName(Throwable exception) {
- String className = exception.getClass().getName();
- int index = className.lastIndexOf('.');
- if (index >= 0 && index < className.length()-1) {
- return className.substring(index+1);
- }
- return className;
- }
-
/**
* <p>An Iterator over any nested children <code>Throwable</code>s
* of either a MetaMatrixException or a MetaMatrixRuntimeException.
@@ -168,7 +90,7 @@
* <code>MetaMatrixException</code> or <code>MetaMatrixRuntimeException</code>
* whose {@link #getChild} method will return the same Object A.</p>
*/
- public static class NestedExceptionIterator implements Iterator{
+ public static class NestedExceptionIterator implements Iterator<Throwable>{
Throwable exception;
Throwable child;
@@ -177,25 +99,12 @@
exception = e;
}
- /**
- * Returns <tt>true</tt> if the iteration has more elements. (In other
- * words, returns <tt>true</tt> if <tt>next</tt> would return an element
- * rather than throwing an exception.)
- *
- * @return <tt>true</tt> if the iterator has more elements.
- */
public boolean hasNext(){
check();
return (child != null);
}
- /**
- * Returns the next element in the iteration.
- *
- * @return the next element in the iteration.
- * @exception NoSuchElementException iteration has no more elements.
- */
- public Object next(){
+ public Throwable next(){
if (!hasNext()) {
throw new NoSuchElementException();
}
@@ -222,22 +131,6 @@
}
}
- /**
- *
- * Removes from the underlying collection the last element returned by the
- * iterator (optional operation). This method can be called only once per
- * call to <tt>next</tt>. The behavior of an iterator is unspecified if
- * the underlying collection is modified while the iteration is in
- * progress in any way other than by calling this method.
- *
- * @exception UnsupportedOperationException if the <tt>remove</tt>
- * operation is not supported by this Iterator.
-
- * @exception IllegalStateException if the <tt>next</tt> method has not
- * yet been called, or the <tt>remove</tt> method has already
- * been called after the last call to the <tt>next</tt>
- * method.
- */
public void remove(){
throw new UnsupportedOperationException();
}
Modified: trunk/common-core/src/test/java/org/teiid/core/TestMetaMatrixRuntimeException.java
===================================================================
--- trunk/common-core/src/test/java/org/teiid/core/TestMetaMatrixRuntimeException.java 2012-05-30 15:39:59 UTC (rev 4151)
+++ trunk/common-core/src/test/java/org/teiid/core/TestMetaMatrixRuntimeException.java 2012-05-31 19:00:50 UTC (rev 4152)
@@ -26,8 +26,6 @@
*/
package org.teiid.core;
-import org.teiid.core.TeiidRuntimeException;
-
import junit.framework.TestCase;
@@ -82,7 +80,7 @@
final TeiidRuntimeException err = new TeiidRuntimeException(code, "Test"); //$NON-NLS-1$
assertNull(err.getCause());
assertEquals(code, err.getCode());
- assertEquals("Test", err.getMessage()); //$NON-NLS-1$
+ assertEquals("1234 Test", err.getMessage()); //$NON-NLS-1$
}
@@ -92,7 +90,7 @@
final TeiidRuntimeException err = new TeiidRuntimeException(child, "Test"); //$NON-NLS-1$
assertSame(child, err.getCause());
assertEquals(code, err.getCode());
- assertEquals("Test", err.getMessage()); //$NON-NLS-1$
+ assertEquals("1234 Test", err.getMessage()); //$NON-NLS-1$
}
public static enum Event implements BundleUtil.Event {
@@ -104,7 +102,7 @@
final TeiidRuntimeException err = new TeiidRuntimeException(Event.Code, child,"Test"); //$NON-NLS-1$
assertSame(child, err.getCause());
assertEquals("Code", err.getCode()); //$NON-NLS-1$
- assertEquals("Test", err.getMessage()); //$NON-NLS-1$
+ assertEquals("Code Test", err.getMessage()); //$NON-NLS-1$
}
}
\ No newline at end of file
Modified: trunk/common-core/src/test/java/org/teiid/core/util/TestMetaMatrixExceptionUtil.java
===================================================================
--- trunk/common-core/src/test/java/org/teiid/core/util/TestMetaMatrixExceptionUtil.java 2012-05-30 15:39:59 UTC (rev 4151)
+++ trunk/common-core/src/test/java/org/teiid/core/util/TestMetaMatrixExceptionUtil.java 2012-05-31 19:00:50 UTC (rev 4152)
@@ -24,12 +24,11 @@
import javax.naming.ConfigurationException;
+import junit.framework.TestCase;
+
import org.teiid.core.TeiidException;
import org.teiid.core.TeiidRuntimeException;
-import org.teiid.core.util.ExceptionUtil;
-import junit.framework.TestCase;
-
public class TestMetaMatrixExceptionUtil extends TestCase {
public TestMetaMatrixExceptionUtil(String name) {
@@ -40,14 +39,12 @@
NullPointerException npe = new NullPointerException();
TeiidRuntimeException e = new TeiidRuntimeException(npe);
assertEquals("TeiidRuntimeException->NullPointerException", ExceptionUtil.getLinkedMessagesVerbose(e)); //$NON-NLS-1$
- assertEquals("nullnull", ExceptionUtil.getLinkedMessages(e)); //$NON-NLS-1$
}
public void testWithMessage() {
NullPointerException npe = new NullPointerException("problem"); //$NON-NLS-1$
TeiidRuntimeException e = new TeiidRuntimeException(npe);
assertEquals("TeiidRuntimeException-problem->NullPointerException", ExceptionUtil.getLinkedMessagesVerbose(e)); //$NON-NLS-1$
- assertEquals("problemproblem", ExceptionUtil.getLinkedMessages(e)); //$NON-NLS-1$
}
public void testWithAndWithoutMessage() {
@@ -55,7 +52,6 @@
TeiidException ce = new TeiidException(npe, "problem"); //$NON-NLS-1$
TeiidRuntimeException e = new TeiidRuntimeException(ce);
assertEquals("TeiidRuntimeException-problem->TeiidException->NullPointerException", ExceptionUtil.getLinkedMessagesVerbose(e)); //$NON-NLS-1$
- assertEquals("problemproblemnull", ExceptionUtil.getLinkedMessages(e)); //$NON-NLS-1$
}
public void testConfigurationException() {
@@ -64,6 +60,5 @@
configException.setRootCause(npe);
TeiidException e = new TeiidException(configException, "problem3"); //$NON-NLS-1$
assertEquals("TeiidException-problem3->ConfigurationException-problem2->NullPointerException-problem1", ExceptionUtil.getLinkedMessagesVerbose(e)); //$NON-NLS-1$
- assertEquals("problem3problem2problem1", ExceptionUtil.getLinkedMessages(e)); //$NON-NLS-1$
}
}
Modified: trunk/common-core/src/test/java/org/teiid/core/util/TestPropertiesUtils.java
===================================================================
--- trunk/common-core/src/test/java/org/teiid/core/util/TestPropertiesUtils.java 2012-05-30 15:39:59 UTC (rev 4151)
+++ trunk/common-core/src/test/java/org/teiid/core/util/TestPropertiesUtils.java 2012-05-31 19:00:50 UTC (rev 4152)
@@ -23,23 +23,13 @@
package org.teiid.core.util;
import java.io.File;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.Enumeration;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Properties;
+import java.util.*;
-import org.teiid.core.util.PropertiesUtils;
-import org.teiid.core.util.PropertiesUtils.InvalidPropertyException;
-
import junit.framework.TestCase;
+import org.teiid.core.util.PropertiesUtils.InvalidPropertyException;
+
/**
* Tests primarily the various cloning scenarios available with PropertiesUtils
*/
@@ -496,7 +486,7 @@
PropertiesUtils.getIntProperty(p, "x", 1); //$NON-NLS-1$
fail("expected exception"); //$NON-NLS-1$
} catch (InvalidPropertyException e) {
- assertEquals("Property 'x' with value 'y' is not a valid Integer.", e.getMessage()); //$NON-NLS-1$
+ assertEquals("TEIID10037 Property 'x' with value 'y' is not a valid Integer.", e.getMessage()); //$NON-NLS-1$
}
}
Modified: trunk/documentation/pom.xml
===================================================================
--- trunk/documentation/pom.xml 2012-05-30 15:39:59 UTC (rev 4151)
+++ trunk/documentation/pom.xml 2012-05-31 19:00:50 UTC (rev 4152)
@@ -11,12 +11,6 @@
<name>Documents</name>
<description>Teiid Documentation Aggregator</description>
<modules>
- <module>admin-guide</module>
- <module>reference</module>
- <module>developer-guide</module>
- <module>quick-start-example</module>
- <module>client-developers-guide</module>
- <module>caching-guide</module>
<module>javadocs</module>
</modules>
</project>
\ No newline at end of file
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-05-30 15:39:59 UTC (rev 4151)
+++ trunk/engine/src/main/java/org/teiid/dqp/internal/process/DQPCore.java 2012-05-31 19:00:50 UTC (rev 4152)
@@ -316,8 +316,9 @@
return results;
}
- public ResultsFuture<ResultsMessage> executeRequest(long reqID,RequestMessage requestMsg) {
+ public ResultsFuture<ResultsMessage> executeRequest(long reqID,RequestMessage requestMsg) throws TeiidProcessingException {
DQPWorkContext workContext = DQPWorkContext.getWorkContext();
+ checkLoading(workContext);
RequestID requestID = workContext.getRequestID(reqID);
requestMsg.setFetchSize(Math.min(requestMsg.getFetchSize(), this.config.getMaxRowsFetchSize()));
Request request = null;
@@ -690,7 +691,12 @@
RequestMessage request = new RequestMessage(command);
request.setParameterValues(parameters);
request.setStatementType(StatementType.PREPARED);
- ResultsFuture<ResultsMessage> result = executeRequest(0, request);
+ ResultsFuture<ResultsMessage> result;
+ try {
+ result = executeRequest(0, request);
+ } catch (TeiidProcessingException e) {
+ throw new TeiidRuntimeException(e);
+ }
result.addCompletionListener(new ResultsFuture.CompletionListener<ResultsMessage>() {
@Override
@@ -868,9 +874,17 @@
boolean allowDoubleQuotedVariable)
throws TeiidComponentException, TeiidProcessingException {
DQPWorkContext workContext = DQPWorkContext.getWorkContext();
+ checkLoading(workContext);
MetaDataProcessor processor = new MetaDataProcessor(this, this.prepPlanCache, workContext.getVdbName(), workContext.getVdbVersion());
return processor.processMessage(workContext.getRequestID(requestID), workContext, preparedSql, allowDoubleQuotedVariable);
}
+
+ private void checkLoading(DQPWorkContext workContext)
+ throws TeiidProcessingException {
+ if (workContext.getVDB().isLoading()) {
+ throw new TeiidProcessingException(QueryPlugin.Event.TEIID31099, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID31099, workContext.getVDB()));
+ }
+ }
public boolean isExceptionOnMaxSourceRows() {
return this.config.isExceptionOnMaxSourceRows();
Modified: trunk/engine/src/main/java/org/teiid/query/QueryPlugin.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/QueryPlugin.java 2012-05-30 15:39:59 UTC (rev 4151)
+++ trunk/engine/src/main/java/org/teiid/query/QueryPlugin.java 2012-05-31 19:00:50 UTC (rev 4152)
@@ -559,5 +559,6 @@
TEIID31096,
TEIID31097,
TEIID31098, //alter imported
+ TEIID31099, //vdb loading
}
}
Modified: trunk/engine/src/main/java/org/teiid/query/metadata/MetadataValidator.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/metadata/MetadataValidator.java 2012-05-30 15:39:59 UTC (rev 4151)
+++ trunk/engine/src/main/java/org/teiid/query/metadata/MetadataValidator.java 2012-05-31 19:00:50 UTC (rev 4152)
@@ -235,7 +235,7 @@
}
}
- private static Datatype getDataType(Collection<Datatype> dataTypes, Class clazz) {
+ private static Datatype getDataType(Collection<Datatype> dataTypes, Class<?> clazz) {
for (Datatype type:dataTypes) {
if (type.getJavaClassName().equals(clazz.getName())) {
return type;
Modified: trunk/engine/src/main/resources/org/teiid/query/i18n.properties
===================================================================
--- trunk/engine/src/main/resources/org/teiid/query/i18n.properties 2012-05-30 15:39:59 UTC (rev 4151)
+++ trunk/engine/src/main/resources/org/teiid/query/i18n.properties 2012-05-31 19:00:50 UTC (rev 4152)
@@ -1046,4 +1046,6 @@
TEIID30601=User defined aggregate function "{0}" class "{1}" does not implement {2}
TEIID30602=User defined aggregate function "{0}" class "{1}" does not provide a public no-arg constructor.
-TEIID31096=Canceling query {0} since it has exceeded the timeout of {1} milliseconds.
\ No newline at end of file
+TEIID31096=Canceling query {0} since it has exceeded the timeout of {1} milliseconds.
+
+TEIID31099=VDB {0} is still loading. Resubmit your query after loading has completed.
\ No newline at end of file
Modified: trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestDQPCore.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestDQPCore.java 2012-05-30 15:39:59 UTC (rev 4151)
+++ trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestDQPCore.java 2012-05-31 19:00:50 UTC (rev 4152)
@@ -42,8 +42,8 @@
import org.teiid.cache.CacheConfiguration;
import org.teiid.cache.DefaultCacheFactory;
import org.teiid.client.RequestMessage;
+import org.teiid.client.ResultsMessage;
import org.teiid.client.RequestMessage.StatementType;
-import org.teiid.client.ResultsMessage;
import org.teiid.client.lob.LobChunk;
import org.teiid.client.util.ResultsFuture;
import org.teiid.common.buffer.BufferManagerFactory;
@@ -458,7 +458,7 @@
}
private void helpTestPlanInvalidation(String query) throws InterruptedException,
- ExecutionException, TimeoutException {
+ ExecutionException, TimeoutException, TeiidProcessingException {
String sql = "insert into #temp select * FROM vqt.SmallB"; //$NON-NLS-1$
String userName = "1"; //$NON-NLS-1$
int sessionid = 1; //$NON-NLS-1$
@@ -627,7 +627,7 @@
}
private ResultsMessage execute(String userName, int sessionid, RequestMessage reqMsg)
- throws InterruptedException, ExecutionException, TimeoutException {
+ throws InterruptedException, ExecutionException, TimeoutException, TeiidProcessingException {
DQPWorkContext.getWorkContext().getSession().setSessionId(String.valueOf(sessionid));
DQPWorkContext.getWorkContext().getSession().setUserName(userName);
Modified: trunk/engine/src/test/java/org/teiid/query/processor/eval/TestExpressionEvaluator.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/processor/eval/TestExpressionEvaluator.java 2012-05-30 15:39:59 UTC (rev 4151)
+++ trunk/engine/src/test/java/org/teiid/query/processor/eval/TestExpressionEvaluator.java 2012-05-31 19:00:50 UTC (rev 4152)
@@ -72,7 +72,7 @@
Object actualValue = helpEval(expr, elementList, valueList, dataMgr, context);
assertEquals("Did not get expected result", expectedValue, actualValue); //$NON-NLS-1$
} catch(TeiidException e) {
- fail("Received unexpected exception: " + e.getFullMessage()); //$NON-NLS-1$
+ throw new RuntimeException(e);
}
}
Modified: trunk/engine/src/test/java/org/teiid/query/sql/visitor/TestDeepGroupCollectorVisitor.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/sql/visitor/TestDeepGroupCollectorVisitor.java 2012-05-30 15:39:59 UTC (rev 4151)
+++ trunk/engine/src/test/java/org/teiid/query/sql/visitor/TestDeepGroupCollectorVisitor.java 2012-05-31 19:00:50 UTC (rev 4152)
@@ -25,15 +25,14 @@
import java.util.Collection;
import java.util.Iterator;
+import junit.framework.TestCase;
+
import org.teiid.core.TeiidException;
import org.teiid.query.parser.QueryParser;
import org.teiid.query.sql.LanguageObject;
import org.teiid.query.sql.symbol.GroupSymbol;
-import org.teiid.query.sql.visitor.GroupCollectorVisitor;
-import junit.framework.TestCase;
-
public class TestDeepGroupCollectorVisitor extends TestCase {
public TestDeepGroupCollectorVisitor(String name) {
super(name);
@@ -42,10 +41,9 @@
public void helpTestVisitor(String sql, String[] expectedGroups) {
LanguageObject obj = null;
try {
- QueryParser parser = new QueryParser();
- obj = parser.parseCommand(sql);
+ obj = QueryParser.getQueryParser().parseCommand(sql);
} catch(TeiidException e) {
- fail("Unexpected exception while parsing: " + e.getFullMessage()); //$NON-NLS-1$
+ throw new RuntimeException(e);
}
Collection actualGroups = GroupCollectorVisitor.getGroupsIgnoreInlineViews(obj, false);
Modified: trunk/jboss-integration/src/main/java/org/teiid/jboss/DQPCoreService.java
===================================================================
--- trunk/jboss-integration/src/main/java/org/teiid/jboss/DQPCoreService.java 2012-05-30 15:39:59 UTC (rev 4151)
+++ trunk/jboss-integration/src/main/java/org/teiid/jboss/DQPCoreService.java 2012-05-31 19:00:50 UTC (rev 4152)
@@ -95,7 +95,7 @@
// add vdb life cycle listeners
getVdbRepository().addListener(new VDBLifeCycleListener() {
- private Set<VDBKey> recentlyRemoved = Collections.newSetFromMap(new LRUCache<VDBKey, Boolean>(10000));
+ private Set<VDBKey> recentlyRemoved = Collections.synchronizedSet(Collections.newSetFromMap(new LRUCache<VDBKey, Boolean>(10000)));
@Override
public void removed(String name, int version, CompositeVDB vdb) {
Modified: trunk/jboss-integration/src/main/java/org/teiid/jboss/TranslatorDeployer.java
===================================================================
--- trunk/jboss-integration/src/main/java/org/teiid/jboss/TranslatorDeployer.java 2012-05-30 15:39:59 UTC (rev 4151)
+++ trunk/jboss-integration/src/main/java/org/teiid/jboss/TranslatorDeployer.java 2012-05-31 19:00:50 UTC (rev 4152)
@@ -46,7 +46,9 @@
*/
public final class TranslatorDeployer implements DeploymentUnitProcessor {
- @Override
+ private static final String DEPLOYMENT_NAME = "deployment-name"; //$NON-NLS-1$
+
+ @Override
public void deploy(final DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
final ServiceTarget target = phaseContext.getServiceTarget();
@@ -66,6 +68,7 @@
if (metadata == null) {
throw new DeploymentUnitProcessingException(IntegrationPlugin.Util.gs(IntegrationPlugin.Event.TEIID50070, moduleName));
}
+ metadata.addProperty(DEPLOYMENT_NAME, deploymentUnit.getName());
metadata.addAttchment(ClassLoader.class, translatorLoader);
LogManager.logInfo(LogConstants.CTX_RUNTIME, IntegrationPlugin.Util.gs(IntegrationPlugin.Event.TEIID50006, metadata.getName()));
Modified: trunk/jboss-integration/src/main/java/org/teiid/jboss/TransportService.java
===================================================================
--- trunk/jboss-integration/src/main/java/org/teiid/jboss/TransportService.java 2012-05-30 15:39:59 UTC (rev 4151)
+++ trunk/jboss-integration/src/main/java/org/teiid/jboss/TransportService.java 2012-05-31 19:00:50 UTC (rev 4152)
@@ -102,6 +102,16 @@
public ClientServiceRegistry getValue() throws IllegalStateException, IllegalArgumentException {
return this;
}
+
+ @Override
+ public void waitForFinished(String vdbName, int vdbVersion) {
+ VDBRepository repo = this.vdbRepositoryInjector.getValue();
+ try {
+ repo.waitForFinished(vdbName, vdbVersion);
+ } catch (InterruptedException e) {
+ return; //just allow the thread to continue/error
+ }
+ }
@Override
public void start(StartContext context) throws StartException {
Modified: trunk/jboss-integration/src/main/java/org/teiid/jboss/VDBDeployer.java
===================================================================
--- trunk/jboss-integration/src/main/java/org/teiid/jboss/VDBDeployer.java 2012-05-30 15:39:59 UTC (rev 4151)
+++ trunk/jboss-integration/src/main/java/org/teiid/jboss/VDBDeployer.java 2012-05-31 19:00:50 UTC (rev 4152)
@@ -72,6 +72,7 @@
class VDBDeployer implements DeploymentUnitProcessor {
+ private static final String DEPLOYMENT_NAME = "deployment-name"; //$NON-NLS-1$
private static final String JAVA_CONTEXT = "java:/"; //$NON-NLS-1$
private TranslatorRepository translatorRepository;
private String asyncThreadPoolName;
@@ -89,7 +90,7 @@
return;
}
final VDBMetaData deployment = deploymentUnit.getAttachment(TeiidAttachments.VDB_METADATA);
-
+ deployment.addProperty(DEPLOYMENT_NAME, deploymentUnit.getName());
// 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) {
Modified: trunk/jboss-integration/src/main/java/org/teiid/jboss/VDBParserDeployer.java
===================================================================
--- trunk/jboss-integration/src/main/java/org/teiid/jboss/VDBParserDeployer.java 2012-05-30 15:39:59 UTC (rev 4151)
+++ trunk/jboss-integration/src/main/java/org/teiid/jboss/VDBParserDeployer.java 2012-05-31 19:00:50 UTC (rev 4152)
@@ -35,6 +35,7 @@
import org.jboss.msc.service.ServiceController;
import org.jboss.vfs.VirtualFile;
import org.teiid.adminapi.Model;
+import org.teiid.adminapi.VDB.Status;
import org.teiid.adminapi.impl.ModelMetaData;
import org.teiid.adminapi.impl.VDBMetaData;
import org.teiid.adminapi.impl.VDBMetadataParser;
@@ -115,6 +116,7 @@
if (serializer.buildVdbXml(vdb).exists()) {
vdb = VDBMetadataParser.unmarshell(new FileInputStream(serializer.buildVdbXml(vdb)));
}
+ vdb.setStatus(Status.LOADING);
deploymentUnit.putAttachment(TeiidAttachments.VDB_METADATA, vdb);
LogManager.logDetail(LogConstants.CTX_RUNTIME,"VDB "+file.getName()+" has been parsed."); //$NON-NLS-1$ //$NON-NLS-2$
return vdb;
Modified: trunk/jboss-integration/src/main/java/org/teiid/jboss/VDBService.java
===================================================================
--- trunk/jboss-integration/src/main/java/org/teiid/jboss/VDBService.java 2012-05-30 15:39:59 UTC (rev 4151)
+++ trunk/jboss-integration/src/main/java/org/teiid/jboss/VDBService.java 2012-05-31 19:00:50 UTC (rev 4152)
@@ -33,6 +33,7 @@
import java.util.Map;
import java.util.Set;
import java.util.concurrent.Executor;
+import java.util.concurrent.atomic.AtomicInteger;
import javax.xml.stream.XMLStreamException;
@@ -160,8 +161,6 @@
getVDBRepository().addListener(this.vdbListener);
- boolean preview = this.vdb.isPreview();
-
MetadataStore store = new MetadataStore();
try {
@@ -174,6 +173,7 @@
this.vdb.removeAttachment(UDFMetaData.class);
// load metadata from the models
+ AtomicInteger loadCount = new AtomicInteger(this.vdb.getModelMetaDatas().values().size());
for (ModelMetaData model: this.vdb.getModelMetaDatas().values()) {
MetadataRepository metadataRepository = model.getAttachment(MetadataRepository.class);
if (metadataRepository == null) {
@@ -181,19 +181,13 @@
}
model.addAttchment(MetadataRepository.class, metadataRepository);
if (model.getModelType() == Model.Type.PHYSICAL || model.getModelType() == Model.Type.VIRTUAL) {
- loadMetadata(this.vdb, model, cmr, metadataRepository, store);
+ loadMetadata(this.vdb, model, cmr, metadataRepository, store, loadCount);
LogManager.logTrace(LogConstants.CTX_RUNTIME, "Model ", model.getName(), "in VDB ", vdb.getName(), " was being loaded from its repository in separate thread"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
else {
LogManager.logTrace(LogConstants.CTX_RUNTIME, "Model ", model.getName(), "in VDB ", vdb.getName(), " skipped being loaded because of its type ", model.getModelType()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
}
-
- synchronized (this.vdb) {
- if (preview) {
- vdb.setStatus(VDB.Status.ACTIVE);
- }
- }
}
private ServiceBuilder<Void> addVDBFinishedService(StartContext context) {
@@ -230,8 +224,10 @@
this.objectReplicatorInjector.getValue().stop(gts);
}
getVDBRepository().removeListener(this.vdbListener);
- getVDBRepository().removeVDB(this.vdb.getName(), this.vdb.getVersion());
- this.vdb.setRemoved(true);
+ VDBMetaData runtimeMetadata = getVDBRepository().removeVDB(this.vdb.getName(), this.vdb.getVersion());
+ if (runtimeMetadata != null) {
+ runtimeMetadata.setStatus(VDB.Status.REMOVED);
+ }
final ServiceController<?> controller = context.getController().getServiceContainer().getService(TeiidServiceNames.vdbFinishedServiceName(vdb.getName(), vdb.getVersion()));
if (controller != null) {
controller.setMode(ServiceController.Mode.REMOVE);
@@ -320,7 +316,7 @@
}
- private boolean loadMetadata(final VDBMetaData vdb, final ModelMetaData model, final ConnectorManagerRepository cmr, final MetadataRepository metadataRepo, final MetadataStore vdbMetadataStore) {
+ private boolean loadMetadata(final VDBMetaData vdb, final ModelMetaData model, final ConnectorManagerRepository cmr, final MetadataRepository metadataRepo, final MetadataStore vdbMetadataStore, final AtomicInteger loadCount) {
String msg = IntegrationPlugin.Util.gs(IntegrationPlugin.Event.TEIID50029,vdb.getName(), vdb.getVersion(), model.getName(), SimpleDateFormat.getInstance().format(new Date()));
model.addError(ModelMetaData.ValidationError.Severity.ERROR.toString(), msg);
@@ -385,7 +381,7 @@
model.clearErrors();
- if (vdb.isValid()) {
+ if (loadCount.decrementAndGet() == 0) {
getVDBRepository().finishDeployment(vdb.getName(), vdb.getVersion());
}
}
@@ -428,7 +424,7 @@
// if is not dynamic always cache; else check for the flag (this may need to be revisited with index vdb)
private void cacheMetadataStore(final VDBMetaData vdb, MetadataFactory schema) {
boolean cache = !vdb.isDynamic();
- if (!vdb.isDynamic()) {
+ if (vdb.isDynamic()) {
cache = "cached".equalsIgnoreCase(vdb.getPropertyValue("UseConnectorMetadata")); //$NON-NLS-1$ //$NON-NLS-2$
}
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2012-05-30 15:39:59 UTC (rev 4151)
+++ trunk/pom.xml 2012-05-31 19:00:50 UTC (rev 4152)
@@ -123,6 +123,10 @@
This is to enable faster build for development time.
-->
<id>dev</id>
+ <properties>
+ <maven.javadoc.skip>true</maven.javadoc.skip>
+ <skipTests>true</skipTests>
+ </properties>
<modules>
<module>build</module>
</modules>
Modified: trunk/runtime/src/main/java/org/teiid/deployers/CompositeVDB.java
===================================================================
--- trunk/runtime/src/main/java/org/teiid/deployers/CompositeVDB.java 2012-05-30 15:39:59 UTC (rev 4151)
+++ trunk/runtime/src/main/java/org/teiid/deployers/CompositeVDB.java 2012-05-31 19:00:50 UTC (rev 4152)
@@ -144,7 +144,11 @@
}
newMergedVDB.getImportedModels().add(m.getName());
}
- mergedRepo.getConnectorManagers().putAll(importedVDB.cmr.getConnectorManagers());
+ for (Map.Entry<String, ConnectorManager> entry : importedVDB.cmr.getConnectorManagers().entrySet()) {
+ if (mergedRepo.getConnectorManagers().put(entry.getKey(), entry.getValue()) != null) {
+ throw new VirtualDatabaseException(RuntimePlugin.Event.TEIID40086, RuntimePlugin.Util.gs(RuntimePlugin.Event.TEIID40086, vdb.getName(), vdb.getVersion(), vdbImport.getName(), vdbImport.getVersion(), entry.getKey()));
+ }
+ }
}
this.mergedVDB = newMergedVDB;
}
@@ -180,6 +184,9 @@
return mergedUDF;
}
+ /**
+ * TODO: we are not checking for collisions here.
+ */
private LinkedHashMap<String, Resource> getVisibilityMap() {
if (this.children == null || this.children.isEmpty()) {
return this.visibilityMap;
Modified: trunk/runtime/src/main/java/org/teiid/deployers/VDBRepository.java
===================================================================
--- trunk/runtime/src/main/java/org/teiid/deployers/VDBRepository.java 2012-05-30 15:39:59 UTC (rev 4151)
+++ trunk/runtime/src/main/java/org/teiid/deployers/VDBRepository.java 2012-05-31 19:00:50 UTC (rev 4152)
@@ -24,6 +24,7 @@
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collection;
+import java.util.Date;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
@@ -31,6 +32,8 @@
import java.util.NavigableMap;
import java.util.concurrent.ConcurrentSkipListMap;
import java.util.concurrent.CopyOnWriteArrayList;
+import java.util.concurrent.locks.Condition;
+import java.util.concurrent.locks.ReentrantLock;
import org.teiid.adminapi.VDB;
import org.teiid.adminapi.impl.ModelMetaData;
@@ -57,6 +60,9 @@
* Repository for VDBs
*/
public class VDBRepository implements Serializable{
+ private static final int DEPLOY_TIMEOUT = 60000;
+ private static final int LOAD_TIMEOUT = 600000;
+
private static final long serialVersionUID = 312177538191772674L;
private NavigableMap<VDBKey, CompositeVDB> vdbRepo = new ConcurrentSkipListMap<VDBKey, CompositeVDB>();
@@ -66,12 +72,11 @@
private List<VDBLifeCycleListener> listeners = new CopyOnWriteArrayList<VDBLifeCycleListener>();
private SystemFunctionManager systemFunctionManager;
private Map<String, Datatype> datatypeMap = new HashMap<String, Datatype>();
+ private ReentrantLock lock = new ReentrantLock();
+ private Condition vdbAdded = lock.newCondition();
-
public void addVDB(VDBMetaData vdb, MetadataStore metadataStore, LinkedHashMap<String, Resource> visibilityMap, UDFMetaData udf, ConnectorManagerRepository cmr) throws VirtualDatabaseException {
- if (getVDB(vdb.getName(), vdb.getVersion()) != null) {
- throw new VirtualDatabaseException(RuntimePlugin.Event.TEIID40035, RuntimePlugin.Util.gs(RuntimePlugin.Event.TEIID40035, vdb.getName(), vdb.getVersion()));
- }
+ VDBKey key = vdbId(vdb);
// get the system VDB metadata store
if (this.systemStore == null) {
@@ -90,9 +95,41 @@
}
CompositeVDB cvdb = new CompositeVDB(vdb, metadataStore, visibilityMap, udf, this.systemFunctionManager.getSystemFunctions(), cmr, stores);
cvdb.buildCompositeState(this);
- this.vdbRepo.put(vdbId(vdb), cvdb);
+ lock.lock();
+ try {
+ if (vdbRepo.containsKey(key)) {
+ throw new VirtualDatabaseException(RuntimePlugin.Event.TEIID40035, RuntimePlugin.Util.gs(RuntimePlugin.Event.TEIID40035, vdb.getName(), vdb.getVersion()));
+ }
+ this.vdbRepo.put(key, cvdb);
+ vdbAdded.signalAll();
+ } finally {
+ lock.unlock();
+ }
notifyAdd(vdb.getName(), vdb.getVersion(), cvdb);
}
+
+ public void waitForFinished(String vdbName, int vdbVersion) throws InterruptedException {
+ CompositeVDB cvdb = null;
+ VDBKey key = new VDBKey(vdbName, vdbVersion);
+ Date toWait = new Date(System.currentTimeMillis() + DEPLOY_TIMEOUT);
+ lock.lock();
+ try {
+ while (cvdb == null) {
+ cvdb = this.vdbRepo.get(key);
+ if (cvdb == null && !vdbAdded.awaitUntil(toWait)) {
+ return; //TODO: should there be a message/exception
+ }
+ }
+ } finally {
+ lock.unlock();
+ }
+ VDBMetaData vdb = cvdb.getVDB();
+ synchronized (vdb) {
+ while (vdb.isLoading()) {
+ vdb.wait(LOAD_TIMEOUT);
+ }
+ }
+ }
CompositeVDB getCompositeVDB(String name, int version) {
return this.vdbRepo.get(new VDBKey(name, version));
@@ -211,14 +248,14 @@
this.odbcEnabled = true;
}
- public boolean removeVDB(String vdbName, int vdbVersion) {
+ public VDBMetaData removeVDB(String vdbName, int vdbVersion) {
VDBKey key = new VDBKey(vdbName, vdbVersion);
CompositeVDB removed = this.vdbRepo.remove(key);
if (removed == null) {
- return false;
+ return null;
}
notifyRemove(key.getName(), key.getVersion(), removed);
- return true;
+ return removed.getVDB();
}
public Map<String, Datatype> getBuiltinDatatypes() {
@@ -259,7 +296,7 @@
metdataAwareVDB.setStatus(VDB.Status.ACTIVE);
}
else {
- metdataAwareVDB.setStatus(VDB.Status.INACTIVE);
+ metdataAwareVDB.setStatus(VDB.Status.INVALID);
}
LogManager.logInfo(LogConstants.CTX_RUNTIME, (VDB.Status.ACTIVE == metdataAwareVDB.getStatus())?RuntimePlugin.Util.gs(RuntimePlugin.Event.TEIID40003,name, version):RuntimePlugin.Util.gs(RuntimePlugin.Event.TEIID40006,name, version));
notifyFinished(name, version, v);
Modified: trunk/runtime/src/main/java/org/teiid/deployers/VDBStatusChecker.java
===================================================================
--- trunk/runtime/src/main/java/org/teiid/deployers/VDBStatusChecker.java 2012-05-30 15:39:59 UTC (rev 4151)
+++ trunk/runtime/src/main/java/org/teiid/deployers/VDBStatusChecker.java 2012-05-31 19:00:50 UTC (rev 4152)
@@ -27,6 +27,7 @@
import org.teiid.adminapi.AdminProcessingException;
import org.teiid.adminapi.Model;
import org.teiid.adminapi.VDB;
+import org.teiid.adminapi.VDB.Status;
import org.teiid.adminapi.impl.ModelMetaData;
import org.teiid.adminapi.impl.VDBMetaData;
import org.teiid.adminapi.impl.VDBTranslatorMetaData;
@@ -83,7 +84,7 @@
boolean dsReplaced = false;
if (!cm.getConnectionName().equals(dsName)){
- vdb.setStatus(VDB.Status.INACTIVE);
+ markInvalid(vdb);
String msg = RuntimePlugin.Util.gs(RuntimePlugin.Event.TEIID40076, vdb.getName(), vdb.getVersion(), model.getSourceTranslatorName(sourceName), dsName);
model.addError(ModelMetaData.ValidationError.Severity.ERROR.name(), msg);
cm = new ConnectorManager(translatorName, dsName);
@@ -117,10 +118,18 @@
}
}
}
+
+ private void markInvalid(VDBMetaData vdb) {
+ if (vdb.getStatus() == Status.LOADING) {
+ vdb.setStatus(Status.INCOMPLETE);
+ } else if (vdb.getStatus() == Status.ACTIVE){
+ vdb.setStatus(Status.INVALID);
+ }
+ }
public void resourceAdded(String resourceName, boolean translator) {
for (VDBMetaData vdb:getVDBRepository().getVDBs()) {
- if (vdb.getStatus() == VDB.Status.ACTIVE || vdb.isPreview()) {
+ if (vdb.getStatus() == VDB.Status.ACTIVE) {
continue;
}
LinkedList<Runnable> runnables = new LinkedList<Runnable>();
@@ -167,7 +176,11 @@
getExecutor().execute(runnable);
}
} else if (valid) {
- vdb.setStatus(VDB.Status.ACTIVE);
+ if (vdb.getStatus() == Status.INVALID) {
+ vdb.setStatus(VDB.Status.ACTIVE);
+ } else {
+ vdb.setStatus(VDB.Status.LOADING);
+ }
LogManager.logInfo(LogConstants.CTX_RUNTIME, RuntimePlugin.Util.gs(RuntimePlugin.Event.TEIID40003,vdb.getName(), vdb.getVersion()));
}
}
@@ -176,16 +189,13 @@
public void resourceRemoved(String resourceName, boolean translator) {
for (VDBMetaData vdb:getVDBRepository().getVDBs()) {
- if (vdb.isPreview()) {
- continue;
- }
synchronized (vdb) {
for (Model m:vdb.getModels()) {
ModelMetaData model = (ModelMetaData)m;
String sourceName = getSourceName(resourceName, model, translator);
if (sourceName != null) {
- vdb.setStatus(VDB.Status.INACTIVE);
+ markInvalid(vdb);
String msg = null;
if (translator) {
msg = RuntimePlugin.Util.gs(RuntimePlugin.Event.TEIID40005, vdb.getName(), vdb.getVersion(), model.getSourceTranslatorName(sourceName));
Modified: trunk/runtime/src/main/java/org/teiid/runtime/RuntimePlugin.java
===================================================================
--- trunk/runtime/src/main/java/org/teiid/runtime/RuntimePlugin.java 2012-05-30 15:39:59 UTC (rev 4151)
+++ trunk/runtime/src/main/java/org/teiid/runtime/RuntimePlugin.java 2012-05-31 19:00:50 UTC (rev 4152)
@@ -48,7 +48,6 @@
TEIID40016, // pg ssl error
TEIID40017, // unexpected exp for session
TEIID40018,
- TEIID40019,
TEIID40020,
TEIID40021,
TEIID40022,
@@ -78,8 +77,6 @@
TEIID40046,
TEIID40047,
TEIID40048,
- TEIID40049,
- TEIID40050,
TEIID40051,
TEIID40052,
TEIID40053,
@@ -115,5 +112,6 @@
TEIID40083, //vdb import does not exist
TEIID40084, //imported role conflict
TEIID40085, //imported model conflict
+ TEIID40086, //imported connector manager conflict
}
}
Modified: trunk/runtime/src/main/java/org/teiid/services/SessionServiceImpl.java
===================================================================
--- trunk/runtime/src/main/java/org/teiid/services/SessionServiceImpl.java 2012-05-30 15:39:59 UTC (rev 4151)
+++ trunk/runtime/src/main/java/org/teiid/services/SessionServiceImpl.java 2012-05-31 19:00:50 UTC (rev 4152)
@@ -44,7 +44,6 @@
import javax.security.auth.login.LoginContext;
import javax.security.auth.login.LoginException;
-import org.teiid.adminapi.VDB;
import org.teiid.adminapi.VDB.ConnectionType;
import org.teiid.adminapi.impl.SessionMetadata;
import org.teiid.adminapi.impl.VDBMetaData;
@@ -118,13 +117,7 @@
@Override
public void closeSession(String sessionID) throws InvalidSessionException {
LogManager.logDetail(LogConstants.CTX_SECURITY, new Object[] {"closeSession", sessionID}); //$NON-NLS-1$
- if (sessionID == null) {
- throw new InvalidSessionException(RuntimePlugin.Event.TEIID40041, RuntimePlugin.Util.gs(RuntimePlugin.Event.TEIID40041, sessionID));
- }
- SessionMetadata info = this.sessionCache.remove(sessionID);
- if (info == null) {
- throw new InvalidSessionException(RuntimePlugin.Event.TEIID40042, RuntimePlugin.Util.gs(RuntimePlugin.Event.TEIID40042, sessionID));
- }
+ SessionMetadata info = getSessionInfo(sessionID, true);
if (info.getVDBName() != null) {
try {
dqp.terminateSession(info.getSessionId());
@@ -226,21 +219,15 @@
} catch (NumberFormatException e) {
throw new SessionServiceException(RuntimePlugin.Event.TEIID40045, e, RuntimePlugin.Util.gs(RuntimePlugin.Event.TEIID40045, vdbVersion));
}
-
if (vdb == null) {
throw new SessionServiceException(RuntimePlugin.Event.TEIID40046, RuntimePlugin.Util.gs(RuntimePlugin.Event.TEIID40046, vdbName, vdbVersion));
}
-
- if (vdb.getStatus() != VDB.Status.ACTIVE) {
- throw new SessionServiceException(RuntimePlugin.Event.TEIID40047, RuntimePlugin.Util.gs(RuntimePlugin.Event.TEIID40047, vdbName, vdbVersion));
- }
if (vdb.getConnectionType() == ConnectionType.NONE) {
throw new SessionServiceException(RuntimePlugin.Event.TEIID40048, RuntimePlugin.Util.gs(RuntimePlugin.Event.TEIID40048, vdbName, vdbVersion));
}
return vdb;
}
-
@Override
public LoginContext createLoginContext(final String securityDomain, final String user, final String password) throws LoginException{
CallbackHandler handler = new CallbackHandler() {
@@ -297,7 +284,7 @@
@Override
public void pingServer(String sessionID) throws InvalidSessionException {
- SessionMetadata info = getSessionInfo(sessionID);
+ SessionMetadata info = getSessionInfo(sessionID, false);
info.setLastPingTime(System.currentTimeMillis());
this.sessionCache.put(sessionID, info);
LogManager.logDetail(LogConstants.CTX_SECURITY, "Keep-alive ping received for session:", sessionID); //$NON-NLS-1$
@@ -311,25 +298,25 @@
closeSession(terminatedSessionID);
return true;
} catch (InvalidSessionException e) {
- LogManager.logWarning(LogConstants.CTX_SECURITY,e,RuntimePlugin.Util.gs(RuntimePlugin.Event.TEIID40019, new Object[] {e.getMessage()}));
+ LogManager.logWarning(LogConstants.CTX_SECURITY,e,e.getMessage());
return false;
}
}
@Override
public SessionMetadata validateSession(String sessionID) throws InvalidSessionException, SessionServiceException {
- SessionMetadata info = getSessionInfo(sessionID);
+ SessionMetadata info = getSessionInfo(sessionID, false);
return info;
}
- private SessionMetadata getSessionInfo(String sessionID)
+ private SessionMetadata getSessionInfo(String sessionID, boolean remove)
throws InvalidSessionException {
if (sessionID == null) {
- throw new InvalidSessionException(RuntimePlugin.Event.TEIID40049, RuntimePlugin.Util.gs(RuntimePlugin.Event.TEIID40049, sessionID));
+ throw new InvalidSessionException(RuntimePlugin.Event.TEIID40041, RuntimePlugin.Util.gs(RuntimePlugin.Event.TEIID40041));
}
- SessionMetadata info = this.sessionCache.get(sessionID);
+ SessionMetadata info = remove?this.sessionCache.remove(sessionID):this.sessionCache.get(sessionID);
if (info == null) {
- throw new InvalidSessionException(RuntimePlugin.Event.TEIID40050, RuntimePlugin.Util.gs(RuntimePlugin.Event.TEIID40050, sessionID));
+ throw new InvalidSessionException(RuntimePlugin.Event.TEIID40042, RuntimePlugin.Util.gs(RuntimePlugin.Event.TEIID40042, sessionID));
}
return info;
}
Modified: trunk/runtime/src/main/java/org/teiid/transport/ClientServiceRegistry.java
===================================================================
--- trunk/runtime/src/main/java/org/teiid/transport/ClientServiceRegistry.java 2012-05-30 15:39:59 UTC (rev 4151)
+++ trunk/runtime/src/main/java/org/teiid/transport/ClientServiceRegistry.java 2012-05-31 19:00:50 UTC (rev 4152)
@@ -39,4 +39,6 @@
AuthenticationType getAuthenticationType();
+ void waitForFinished(String vdbName, int vdbVersion);
+
}
Modified: trunk/runtime/src/main/java/org/teiid/transport/ClientServiceRegistryImpl.java
===================================================================
--- trunk/runtime/src/main/java/org/teiid/transport/ClientServiceRegistryImpl.java 2012-05-30 15:39:59 UTC (rev 4151)
+++ trunk/runtime/src/main/java/org/teiid/transport/ClientServiceRegistryImpl.java 2012-05-31 19:00:50 UTC (rev 4152)
@@ -103,5 +103,10 @@
public AuthenticationType getAuthenticationType() {
return authenticationType;
}
+
+ @Override
+ public void waitForFinished(String vdbName, int vdbVersion) {
+ }
+
}
Modified: trunk/runtime/src/main/java/org/teiid/transport/LocalServerConnection.java
===================================================================
--- trunk/runtime/src/main/java/org/teiid/transport/LocalServerConnection.java 2012-05-30 15:39:59 UTC (rev 4151)
+++ trunk/runtime/src/main/java/org/teiid/transport/LocalServerConnection.java 2012-05-31 19:00:50 UTC (rev 4152)
@@ -61,6 +61,18 @@
public LocalServerConnection(Properties connectionProperties, boolean useCallingThread) throws CommunicationException, ConnectionException{
this.connectionProperties = connectionProperties;
this.csr = getClientServiceRegistry();
+
+ String vdbVersion = connectionProperties.getProperty(TeiidURL.JDBC.VDB_VERSION);
+ String vdbName = connectionProperties.getProperty(TeiidURL.JDBC.VDB_NAME);
+ int firstIndex = vdbName.indexOf('.');
+ int lastIndex = vdbName.lastIndexOf('.');
+ if (firstIndex != -1 && firstIndex == lastIndex) {
+ vdbVersion = vdbName.substring(firstIndex+1);
+ vdbName = vdbName.substring(0, firstIndex);
+ }
+ if (vdbVersion != null) {
+ this.csr.waitForFinished(connectionProperties.getProperty(TeiidURL.JDBC.VDB_NAME), Integer.valueOf(vdbVersion));
+ }
workContext.setSecurityHelper(csr.getSecurityHelper());
workContext.setUseCallingThread(useCallingThread);
authenticate();
Modified: trunk/runtime/src/main/resources/org/teiid/runtime/i18n.properties
===================================================================
--- trunk/runtime/src/main/resources/org/teiid/runtime/i18n.properties 2012-05-30 15:39:59 UTC (rev 4151)
+++ trunk/runtime/src/main/resources/org/teiid/runtime/i18n.properties 2012-05-31 19:00:50 UTC (rev 4152)
@@ -28,7 +28,6 @@
TEIID40045=Invalid VDB version \"{0}\" - must be a positive integer.
# session service
-TEIID40019=The specified session ID "{0}" is invalid. It cannot be found in the userbase.
TEIID40043=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.
TEIID40008 = Expiring session {0}
TEIID40007 = Keepalive failed for session {0}
@@ -84,8 +83,6 @@
TEIID40014=Kerberos context login failed
TEIID40018=Exception terminitating session
TEIID40020=Error occurred
-TEIID40049=Invalid Session. Session may have been terminated. Re-connect and try again.
-TEIID40050=Invalid Session. Session may have been terminated. Re-connect and try again.
TEIID40034=The description field = {0} does not end with \"}\""
TEIID40023=System.vdb needs to be loaded before any other VDBs.
TEIID40022=System.vdb needs to be loaded before any other VDBs.
@@ -93,11 +90,12 @@
TEIID40030=TranslatorProperty annotation should be placed on valid getter or setter method, {0} is not valid.
TEIID40031=TranslatorProperty annotation should not both be advanced and required
TEIID40032=Translator {2} not found in repository for VDB {0}.{1}
-TEIID40041=Invalid Session. Session may have been terminated. Re-connect and try again.
-TEIID40042=Invalid Session. Session may have been terminated. Re-connect and try again.
+TEIID40041=Invalid null Session
+TEIID40042=Invalid Session {0}. Session may have already been terminated.
TEIID40072=Model {0} is defined as VIRTUAL model, however it is defined with source mappings! check your vdb.xml file.
TEIID40073=The metadata for the VDB {0}.{1} is loaded, however it is not valid. Check models for errors. Correct the metadata and re-deploy.
TEIID40083={0}.{1} imports a non-existent VDB {2}.{3}
TEIID40084={0}.{1} imports a conflicting role {4} from {2}.{3}
-TEIID40085={0}.{1} imports a conflicting model {4} from {2}.{3}
\ No newline at end of file
+TEIID40085={0}.{1} imports a conflicting model {4} from {2}.{3}
+TEIID40086={0}.{1} imports a duplicate source {4} from {2}.{3}
\ No newline at end of file
Added: trunk/test-integration/common/src/test/java/org/teiid/arquillian/AdminUtil.java
===================================================================
--- trunk/test-integration/common/src/test/java/org/teiid/arquillian/AdminUtil.java (rev 0)
+++ trunk/test-integration/common/src/test/java/org/teiid/arquillian/AdminUtil.java 2012-05-31 19:00:50 UTC (rev 4152)
@@ -0,0 +1,81 @@
+/*
+ * 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.arquillian;
+
+import java.util.Properties;
+
+import org.teiid.adminapi.Admin;
+import org.teiid.adminapi.AdminException;
+import org.teiid.adminapi.VDB;
+
+@SuppressWarnings("nls")
+public class AdminUtil {
+
+ static void cleanUp(Admin admin) throws AdminException {
+ //TODO: cleanup when as supports it
+ /*for (String name : admin.getDataSourceNames()) {
+ admin.deleteDataSource(name);
+ }*/
+ for (VDB vdb : admin.getVDBs()) {
+ String deploymentName = vdb.getPropertyValue("deployment-name");
+ if (deploymentName != null) {
+ admin.undeploy(deploymentName);
+ }
+ }
+ }
+
+ //TODO: this should not be needed, but cli doesn't currently support delete
+ static boolean createDataSource(Admin admin, String deploymentName, String templateName, Properties properties) throws AdminException {
+ if (admin.getDataSourceNames().contains(deploymentName)) {
+ return false;
+ }
+ admin.createDataSource(deploymentName, templateName, properties);
+ return true;
+ }
+
+ static boolean waitForVDBLoad(Admin admin, String vdbName, int vdbVersion,
+ int timeoutInSecs) throws AdminException {
+ long waitUntil = System.currentTimeMillis() + timeoutInSecs*1000;
+ if (timeoutInSecs < 0) {
+ waitUntil = Long.MAX_VALUE;
+ }
+ boolean first = true;
+ do {
+ if (!first) {
+ try {
+ Thread.sleep(2000);
+ } catch (InterruptedException e) {
+ break;
+ }
+ } else {
+ first = false;
+ }
+ VDB vdb = admin.getVDB(vdbName, vdbVersion);
+ if (vdb != null && !vdb.getStatus().isLoading()) {
+ return true;
+ }
+ } while (System.currentTimeMillis() < waitUntil);
+ return false;
+ }
+
+}
Property changes on: trunk/test-integration/common/src/test/java/org/teiid/arquillian/AdminUtil.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified: trunk/test-integration/common/src/test/java/org/teiid/arquillian/IntegrationTestDeployment.java
===================================================================
--- trunk/test-integration/common/src/test/java/org/teiid/arquillian/IntegrationTestDeployment.java 2012-05-30 15:39:59 UTC (rev 4151)
+++ trunk/test-integration/common/src/test/java/org/teiid/arquillian/IntegrationTestDeployment.java 2012-05-31 19:00:50 UTC (rev 4152)
@@ -1,12 +1,28 @@
+/*
+ * 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.arquillian;
-import static org.junit.Assert.assertArrayEquals;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
+import static org.junit.Assert.*;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
@@ -28,16 +44,7 @@
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
-import org.teiid.adminapi.Admin;
-import org.teiid.adminapi.AdminException;
-import org.teiid.adminapi.AdminFactory;
-import org.teiid.adminapi.DataPolicy;
-import org.teiid.adminapi.Model;
-import org.teiid.adminapi.PropertyDefinition;
-import org.teiid.adminapi.Request;
-import org.teiid.adminapi.Session;
-import org.teiid.adminapi.Translator;
-import org.teiid.adminapi.VDB;
+import org.teiid.adminapi.*;
import org.teiid.adminapi.VDB.ConnectionType;
import org.teiid.adminapi.VDB.Status;
import org.teiid.adminapi.impl.VDBTranslatorMetaData;
@@ -56,57 +63,54 @@
}
@After
- public void teardown() {
+ public void teardown() throws AdminException {
+ AdminUtil.cleanUp(admin);
admin.close();
}
@Test
public void testVDBDeployment() throws Exception {
- try {
- Collection<?> vdbs = admin.getVDBs();
- assertTrue(vdbs.isEmpty());
-
- Collection<String> dsNames = admin.getDataSourceNames();
- if (dsNames.contains("Oracle11_PushDS")) {
- admin.deleteDataSource("Oracle11_PushDS");
- }
-
- admin.deploy("bqt.vdb",new FileInputStream(UnitTestUtil.getTestDataFile("bqt.vdb")));
+ Collection<?> vdbs = admin.getVDBs();
+ assertTrue(vdbs.isEmpty());
+
+ Collection<String> dsNames = admin.getDataSourceNames();
+ if (dsNames.contains("Oracle11_PushDS")) {
+ admin.deleteDataSource("Oracle11_PushDS");
+ }
+
+ admin.deploy("bqt.vdb",new FileInputStream(UnitTestUtil.getTestDataFile("bqt.vdb")));
- vdbs = admin.getVDBs();
- assertFalse(vdbs.isEmpty());
+ vdbs = admin.getVDBs();
+ assertFalse(vdbs.isEmpty());
- VDB vdb = admin.getVDB("bqt", 1);
- assertFalse(vdb.isValid());
- assertTrue(vdb.getStatus().equals(Status.INACTIVE));
+ VDB vdb = admin.getVDB("bqt", 1);
+ assertFalse(vdb.isValid());
+ assertTrue(AdminUtil.waitForVDBLoad(admin, "bqt", 1, 3));
+ assertEquals(Status.INVALID, vdb.getStatus());
- Properties props = new Properties();
- props.setProperty("connection-url","jdbc:h2:mem:test;DB_CLOSE_DELAY=-1");
- props.setProperty("user-name", "sa");
- props.setProperty("password", "sa");
-
- admin.createDataSource("Oracle11_PushDS", "h2", props);
- Thread.sleep(2000);
- vdb = admin.getVDB("bqt", 1);
- assertTrue(vdb.isValid());
- assertTrue(vdb.getStatus().equals(Status.ACTIVE));
-
- dsNames = admin.getDataSourceNames();
- assertTrue(dsNames.contains("Oracle11_PushDS"));
+ Properties props = new Properties();
+ props.setProperty("connection-url","jdbc:h2:mem:test;DB_CLOSE_DELAY=-1");
+ props.setProperty("user-name", "sa");
+ props.setProperty("password", "sa");
+
+ admin.createDataSource("Oracle11_PushDS", "h2", props);
+
+ vdb = admin.getVDB("bqt", 1);
+ assertTrue(vdb.isValid());
+ assertTrue(vdb.getStatus().equals(Status.ACTIVE));
+
+ dsNames = admin.getDataSourceNames();
+ assertTrue(dsNames.contains("Oracle11_PushDS"));
- admin.deleteDataSource("Oracle11_PushDS");
- vdb = admin.getVDB("bqt", 1);
- assertFalse(vdb.isValid());
- assertTrue(vdb.getStatus().equals(Status.INACTIVE));
- } finally {
- undeploy();
- }
+ admin.deleteDataSource("Oracle11_PushDS");
+ vdb = admin.getVDB("bqt", 1);
+ assertFalse(vdb.isValid());
+ assertEquals(Status.INVALID, vdb.getStatus());
}
@Test
public void testTraslators() throws Exception {
Collection<? extends Translator> translators = admin.getTranslators();
- System.out.println(translators);
assertEquals(30, translators.size());
JavaArchive jar = getLoopyArchive();
@@ -138,61 +142,52 @@
@Test
public void testVDBConnectionType() throws Exception {
+ admin.deploy("bqt.vdb", new FileInputStream(UnitTestUtil.getTestDataFile("bqt.vdb")));
+
+ VDB vdb = admin.getVDB("bqt", 1);
+ Model model = vdb.getModels().get(0);
+ admin.assignToModel("bqt", 1, model.getName(), "Source", "h2", "java:jboss/datasources/ExampleDS");
+ assertEquals(ConnectionType.BY_VERSION, vdb.getConnectionType());
+
try {
-
- admin.deploy("bqt.vdb", new FileInputStream(UnitTestUtil.getTestDataFile("bqt.vdb")));
-
- VDB vdb = admin.getVDB("bqt", 1);
- Model model = vdb.getModels().get(0);
- admin.assignToModel("bqt", 1, model.getName(), "Source", "h2", "java:jboss/datasources/ExampleDS");
- assertEquals(ConnectionType.BY_VERSION, vdb.getConnectionType());
-
- try {
- Connection conn = TeiidDriver.getInstance().connect("jdbc:teiid:bqt@mm://localhost:31000;user=user;password=user", null);
- conn.close();
- } catch (Exception e) {
- fail("must have succeeded in connection");
- }
-
- admin.changeVDBConnectionType("bqt", 1, ConnectionType.NONE);
+ Connection conn = TeiidDriver.getInstance().connect("jdbc:teiid:bqt@mm://localhost:31000;user=user;password=user", null);
+ conn.close();
+ } catch (Exception e) {
+ fail("must have succeeded in connection");
+ }
+
+ admin.changeVDBConnectionType("bqt", 1, ConnectionType.NONE);
- try {
- TeiidDriver.getInstance().connect("jdbc:teiid:bqt@mm://localhost:31000;user=user;password=user", null);
- fail("should have failed to connect as no new connections allowed");
- } catch (Exception e) {
- //pass
- }
+ try {
+ TeiidDriver.getInstance().connect("jdbc:teiid:bqt@mm://localhost:31000;user=user;password=user", null);
+ fail("should have failed to connect as no new connections allowed");
+ } catch (Exception e) {
+ //pass
+ }
- admin.deploy("bqt2.vdb", new FileInputStream(UnitTestUtil.getTestDataFile("bqt2.vdb")));
- admin.assignToModel("bqt", 2, model.getName(), "Source", "h2", "java:jboss/datasources/ExampleDS");
-
- try {
- Connection conn = TeiidDriver.getInstance().connect("jdbc:teiid:bqt@mm://localhost:31000;user=user;password=user", null);
- conn.close();
- } catch (Exception e) {
- fail("should not have failed to connect");
- }
-
- admin.changeVDBConnectionType("bqt", 2, ConnectionType.ANY);
- try {
- Connection conn = TeiidDriver.getInstance().connect("jdbc:teiid:bqt@mm://localhost:31000;user=user;password=user", null);
- conn.close();
- } catch (Exception e) {
- fail("should have connected to the second vdb");
- }
-
- vdb = admin.getVDB("bqt", 2);
- model = vdb.getModels().get(0);
- assertEquals(model.getSourceConnectionJndiName("Source"), "java:jboss/datasources/ExampleDS");
- assertEquals(model.getSourceTranslatorName("Source"), "h2");
- assertEquals(ConnectionType.ANY, vdb.getConnectionType());
-
- } finally {
- undeploy();
- if(admin.getVDB("bqt", 2) != null){
- admin.undeploy("bqt2.vdb");
- }
+ admin.deploy("bqt2.vdb", new FileInputStream(UnitTestUtil.getTestDataFile("bqt2.vdb")));
+ admin.assignToModel("bqt", 2, model.getName(), "Source", "h2", "java:jboss/datasources/ExampleDS");
+
+ try {
+ Connection conn = TeiidDriver.getInstance().connect("jdbc:teiid:bqt@mm://localhost:31000;user=user;password=user", null);
+ conn.close();
+ } catch (Exception e) {
+ fail("should not have failed to connect");
}
+
+ admin.changeVDBConnectionType("bqt", 2, ConnectionType.ANY);
+ try {
+ Connection conn = TeiidDriver.getInstance().connect("jdbc:teiid:bqt@mm://localhost:31000;user=user;password=user", null);
+ conn.close();
+ } catch (Exception e) {
+ fail("should have connected to the second vdb");
+ }
+
+ vdb = admin.getVDB("bqt", 2);
+ model = vdb.getModels().get(0);
+ assertEquals(model.getSourceConnectionJndiName("Source"), "java:jboss/datasources/ExampleDS");
+ assertEquals(model.getSourceTranslatorName("Source"), "h2");
+ assertEquals(ConnectionType.ANY, vdb.getConnectionType());
}
@Test
@@ -204,46 +199,33 @@
@Test
public void testSessions() throws Exception {
- try {
- deployVdb();
+ deployVdb();
- Collection<? extends Session> sessions = admin.getSessions();
- assertEquals (0, sessions.size());
-
- try {
- Connection conn = TeiidDriver.getInstance().connect("jdbc:teiid:bqt@mm://localhost:31000;user=user;password=user;ApplicationName=test", null);
- sessions = admin.getSessions();
- assertEquals (1, sessions.size());
- Session s = sessions.iterator().next();
-
- assertEquals("user@teiid-security", s.getUserName());
- assertEquals("test", s.getApplicationName());
- assertEquals("bqt", s.getVDBName());
- assertEquals(1, s.getVDBVersion());
- assertNotNull(s.getSessionId());
-
- conn.close();
- } catch (Exception e) {
- fail("should have connected to the vdb");
- }
-
- try {
- Connection conn = TeiidDriver.getInstance().connect("jdbc:teiid:bqt@mm://localhost:31000;user=user;password=user;ApplicationName=test", null);
- sessions = admin.getSessions();
- assertEquals (1, sessions.size());
- Session s = sessions.iterator().next();
+ Collection<? extends Session> sessions = admin.getSessions();
+ assertEquals (0, sessions.size());
+
+ Connection conn = TeiidDriver.getInstance().connect("jdbc:teiid:bqt@mm://localhost:31000;user=user;password=user;ApplicationName=test", null);
+ sessions = admin.getSessions();
+ assertEquals (1, sessions.size());
+ Session s = sessions.iterator().next();
+
+ assertEquals("user@teiid-security", s.getUserName());
+ assertEquals("test", s.getApplicationName());
+ assertEquals("bqt", s.getVDBName());
+ assertEquals(1, s.getVDBVersion());
+ assertNotNull(s.getSessionId());
+
+ conn.close();
+
+ conn = TeiidDriver.getInstance().connect("jdbc:teiid:bqt@mm://localhost:31000;user=user;password=user;ApplicationName=test", null);
+ sessions = admin.getSessions();
+ assertEquals (1, sessions.size());
+ s = sessions.iterator().next();
- admin.terminateSession(s.getSessionId());
- sessions = admin.getSessions();
- assertEquals (0, sessions.size());
- conn.close();
- } catch (Exception e) {
- fail("should have connected to the vdb");
- }
-
- } finally {
- undeploy();
- }
+ admin.terminateSession(s.getSessionId());
+ sessions = admin.getSessions();
+ assertEquals (0, sessions.size());
+ conn.close();
}
private boolean deployVdb() throws AdminException, FileNotFoundException {
@@ -257,13 +239,6 @@
return vdbOneDeployed;
}
- private void undeploy() throws Exception {
- VDB vdb = admin.getVDB("bqt", 1);
- if (vdb != null) {
- admin.undeploy("bqt.vdb");
- }
- }
-
@Test
public void testGetRequests() throws Exception {
JavaArchive jar = getLoopyArchive();
@@ -314,118 +289,97 @@
} finally {
admin.undeploy("loopy.jar");
- undeploy();
}
}
@Test
public void getDatasourceTemplateNames() throws Exception {
String[] array = {"teiid-connector-file.rar", "teiid-local", "teiid", "teiid-connector-salesforce.rar", "teiid-connector-ldap.rar", "teiid-connector-ws.rar", "h2"};
- try {
- deployVdb();
- Set<String> templates = admin.getDataSourceTemplateNames();
- System.out.println(templates);
- assertArrayEquals(array, templates.toArray(new String[templates.size()]));
- } finally {
- undeploy();
- }
+ deployVdb();
+ Set<String> templates = admin.getDataSourceTemplateNames();
+ assertArrayEquals(array, templates.toArray(new String[templates.size()]));
}
@Test
public void getTemplatePropertyDefinitions() throws Exception{
- try {
- HashSet<String> props = new HashSet<String>();
-
- deployVdb();
-
- Collection<? extends PropertyDefinition> pds = admin.getTemplatePropertyDefinitions("h2");
- for(PropertyDefinition pd:pds) {
- props.add(pd.getName());
- }
- assertTrue(props.contains("connection-url"));
- assertTrue(props.contains("user-name"));
- assertTrue(props.contains("password"));
- assertTrue(props.contains("check-valid-connection-sql"));
-
-
- HashSet<String> rar_props = new HashSet<String>();
- pds = admin.getTemplatePropertyDefinitions("teiid-connector-file.rar");
- for(PropertyDefinition pd:pds) {
- rar_props.add(pd.getName());
- }
-
- assertTrue(rar_props.contains("ParentDirectory"));
- assertTrue(rar_props.contains("FileMapping"));
- assertTrue(rar_props.contains("AllowParentPaths"));
-
- } finally {
- undeploy();
- }
+ HashSet<String> props = new HashSet<String>();
+
+ deployVdb();
+
+ Collection<? extends PropertyDefinition> pds = admin.getTemplatePropertyDefinitions("h2");
+ for(PropertyDefinition pd:pds) {
+ props.add(pd.getName());
+ }
+ assertTrue(props.contains("connection-url"));
+ assertTrue(props.contains("user-name"));
+ assertTrue(props.contains("password"));
+ assertTrue(props.contains("check-valid-connection-sql"));
+
+
+ HashSet<String> rar_props = new HashSet<String>();
+ pds = admin.getTemplatePropertyDefinitions("teiid-connector-file.rar");
+ for(PropertyDefinition pd:pds) {
+ rar_props.add(pd.getName());
+ }
+
+ assertTrue(rar_props.contains("ParentDirectory"));
+ assertTrue(rar_props.contains("FileMapping"));
+ assertTrue(rar_props.contains("AllowParentPaths"));
}
@Test
public void getWorkerPoolStats() throws Exception{
- try {
- deployVdb();
- assertNotNull(admin.getWorkerPoolStats());
- } finally {
- undeploy();
- }
+ deployVdb();
+ assertNotNull(admin.getWorkerPoolStats());
}
@Test
public void testDataRoleMapping() throws Exception{
- try {
- admin.deploy("bqt2.vdb", new FileInputStream(UnitTestUtil.getTestDataFile("bqt2.vdb")));
-
- VDB vdb = admin.getVDB("bqt", 2);
- Model model = vdb.getModels().get(0);
- admin.assignToModel("bqt", 2, model.getName(), "Source", "h2", "java:jboss/datasources/ExampleDS");
-
- vdb = admin.getVDB("bqt", 2);
- assertTrue(vdb.isValid());
- List<DataPolicy> policies = vdb.getDataPolicies();
- assertEquals(1, policies.size());
-
- DataPolicy dp = policies.get(0);
- assertEquals("roleOne", dp.getName());
- assertEquals(2, dp.getPermissions().size());
- assertTrue(dp.isAllowCreateTemporaryTables());
- assertTrue(dp.isAnyAuthenticated());
-
- List<String> roleNames = dp.getMappedRoleNames();
- assertArrayEquals(new String[]{"ROLE1", "ROLE2"}, roleNames.toArray());
-
- admin.removeDataRoleMapping("bqt", 2, "roleOne", "ROLE1");
-
- vdb = admin.getVDB("bqt", 2);
- policies = vdb.getDataPolicies();
- dp = policies.get(0);
-
- roleNames = dp.getMappedRoleNames();
- assertArrayEquals(new String[]{"ROLE2"}, roleNames.toArray());
-
- admin.addDataRoleMapping("bqt", 2, "roleOne", "ROLE3");
-
- vdb = admin.getVDB("bqt", 2);
- policies = vdb.getDataPolicies();
- dp = policies.get(0);
-
- roleNames = dp.getMappedRoleNames();
- assertArrayEquals(new String[]{"ROLE2", "ROLE3"}, roleNames.toArray());
-
- admin.setAnyAuthenticatedForDataRole("bqt", 2, "roleOne", false);
-
- vdb = admin.getVDB("bqt", 2);
- policies = vdb.getDataPolicies();
- dp = policies.get(0);
-
- assertFalse(dp.isAnyAuthenticated());
- } finally {
- if (admin.getVDB("bqt", 2) != null) {
- admin.undeploy("bqt2.vdb");
- }
- }
+ admin.deploy("bqt2.vdb", new FileInputStream(UnitTestUtil.getTestDataFile("bqt2.vdb")));
+
+ VDB vdb = admin.getVDB("bqt", 2);
+ Model model = vdb.getModels().get(0);
+ admin.assignToModel("bqt", 2, model.getName(), "Source", "h2", "java:jboss/datasources/ExampleDS");
+
+ vdb = admin.getVDB("bqt", 2);
+ assertTrue(vdb.isValid());
+ List<DataPolicy> policies = vdb.getDataPolicies();
+ assertEquals(1, policies.size());
+
+ DataPolicy dp = policies.get(0);
+ assertEquals("roleOne", dp.getName());
+ assertEquals(2, dp.getPermissions().size());
+ assertTrue(dp.isAllowCreateTemporaryTables());
+ assertTrue(dp.isAnyAuthenticated());
+
+ List<String> roleNames = dp.getMappedRoleNames();
+ assertArrayEquals(new String[]{"ROLE1", "ROLE2"}, roleNames.toArray());
+
+ admin.removeDataRoleMapping("bqt", 2, "roleOne", "ROLE1");
+
+ vdb = admin.getVDB("bqt", 2);
+ policies = vdb.getDataPolicies();
+ dp = policies.get(0);
+
+ roleNames = dp.getMappedRoleNames();
+ assertArrayEquals(new String[]{"ROLE2"}, roleNames.toArray());
+
+ admin.addDataRoleMapping("bqt", 2, "roleOne", "ROLE3");
+
+ vdb = admin.getVDB("bqt", 2);
+ policies = vdb.getDataPolicies();
+ dp = policies.get(0);
+
+ roleNames = dp.getMappedRoleNames();
+ assertArrayEquals(new String[]{"ROLE2", "ROLE3"}, roleNames.toArray());
+
+ admin.setAnyAuthenticatedForDataRole("bqt", 2, "roleOne", false);
+
+ vdb = admin.getVDB("bqt", 2);
+ policies = vdb.getDataPolicies();
+ dp = policies.get(0);
+
+ assertFalse(dp.isAnyAuthenticated());
}
@Test
Modified: trunk/test-integration/common/src/test/java/org/teiid/arquillian/IntegrationTestDynamicViewDefinition.java
===================================================================
--- trunk/test-integration/common/src/test/java/org/teiid/arquillian/IntegrationTestDynamicViewDefinition.java 2012-05-30 15:39:59 UTC (rev 4151)
+++ trunk/test-integration/common/src/test/java/org/teiid/arquillian/IntegrationTestDynamicViewDefinition.java 2012-05-31 19:00:50 UTC (rev 4152)
@@ -1,5 +1,29 @@
+/*
+ * 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.arquillian;
+import static org.junit.Assert.*;
+
import java.io.FileInputStream;
import java.util.Properties;
@@ -9,6 +33,7 @@
import org.junit.Test;
import org.junit.runner.RunWith;
import org.teiid.adminapi.Admin;
+import org.teiid.adminapi.AdminException;
import org.teiid.adminapi.AdminFactory;
import org.teiid.core.util.UnitTestUtil;
import org.teiid.jdbc.AbstractMMQueryTestCase;
@@ -26,10 +51,11 @@
}
@After
- public void teardown() {
+ public void teardown() throws AdminException {
+ AdminUtil.cleanUp(admin);
admin.close();
}
-
+
@Test
public void testViewDefinition() throws Exception {
@@ -40,18 +66,13 @@
props.setProperty("AllowParentPaths", "true");
props.setProperty("class-name", "org.teiid.resource.adapter.file.FileManagedConnectionFactory");
- admin.createDataSource("marketdata-file", "teiid-connector-file.rar", props);
-
- Thread.sleep(3000);
+ AdminUtil.createDataSource(admin, "marketdata-file", "teiid-connector-file.rar", props);
+ assertTrue(AdminUtil.waitForVDBLoad(admin, "dynamic", 1, 3));
+
this.internalConnection = TeiidDriver.getInstance().connect("jdbc:teiid:dynamic@mm://localhost:31000;user=user;password=user", null);
execute("SELECT * FROM Sys.Columns WHERE tablename='stock'"); //$NON-NLS-1$
- //TestMMDatabaseMetaData.compareResultSet("TestDymamicImportedMetaData/columns", this.internalResultSet);
-
- admin.undeploy("dynamicview-vdb.xml");
-
- admin.deleteDataSource("marketdata-file");
}
}
Added: trunk/test-integration/common/src/test/java/org/teiid/arquillian/IntegrationTestVDBReuse.java
===================================================================
--- trunk/test-integration/common/src/test/java/org/teiid/arquillian/IntegrationTestVDBReuse.java (rev 0)
+++ trunk/test-integration/common/src/test/java/org/teiid/arquillian/IntegrationTestVDBReuse.java 2012-05-31 19:00:50 UTC (rev 4152)
@@ -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.arquillian;
+
+import static org.junit.Assert.*;
+
+import java.io.FileInputStream;
+import java.util.Properties;
+
+import org.jboss.arquillian.junit.Arquillian;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.teiid.adminapi.Admin;
+import org.teiid.adminapi.AdminException;
+import org.teiid.adminapi.AdminFactory;
+import org.teiid.core.util.UnitTestUtil;
+import org.teiid.jdbc.AbstractMMQueryTestCase;
+import org.teiid.jdbc.TeiidDriver;
+
+(a)RunWith(Arquillian.class)
+@SuppressWarnings("nls")
+public class IntegrationTestVDBReuse extends AbstractMMQueryTestCase {
+
+ private Admin admin;
+
+ @Before
+ public void setup() throws Exception {
+ admin = AdminFactory.getInstance().createAdmin("localhost", 9999, "admin", "admin".toCharArray());
+ }
+
+ @After
+ public void teardown() throws AdminException {
+ AdminUtil.cleanUp(admin);
+ admin.close();
+ }
+
+ @Test
+ public void testReuse() throws Exception {
+ admin.deploy("dynamicview-vdb.xml",new FileInputStream(UnitTestUtil.getTestDataFile("dynamicview-vdb.xml")));
+
+ Properties props = new Properties();
+ props.setProperty("ParentDirectory", "../docs/teiid/examples/dynamicvdb-portfolio/data");
+ props.setProperty("AllowParentPaths", "true");
+ props.setProperty("class-name", "org.teiid.resource.adapter.file.FileManagedConnectionFactory");
+
+ AdminUtil.createDataSource(admin, "marketdata-file", "teiid-connector-file.rar", props);
+
+ assertTrue(AdminUtil.waitForVDBLoad(admin, "dynamic", 1, 3));
+
+ this.internalConnection = TeiidDriver.getInstance().connect("jdbc:teiid:dynamic@mm://localhost:31000;user=user;password=user", null);
+
+ execute("SELECT count(*) FROM Sys.Columns"); //$NON-NLS-1$
+ this.internalResultSet.next();
+ int cols = this.internalResultSet.getInt(1);
+
+ admin.deploy("reuse-vdb.xml",new FileInputStream(UnitTestUtil.getTestDataFile("reuse-vdb.xml")));
+
+ assertTrue(AdminUtil.waitForVDBLoad(admin, "reuse", 1, 3));
+
+ this.internalConnection = TeiidDriver.getInstance().connect("jdbc:teiid:reuse@mm://localhost:31000;user=user;password=user", null);
+
+ execute("SELECT count(*) FROM Sys.Columns"); //$NON-NLS-1$
+ this.internalResultSet.next();
+ assertTrue(this.internalResultSet.getInt(1) > cols);
+ }
+
+}
Property changes on: trunk/test-integration/common/src/test/java/org/teiid/arquillian/IntegrationTestVDBReuse.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified: trunk/test-integration/common/src/test/java/org/teiid/arquillian/SampleExecutionFactory.java
===================================================================
--- trunk/test-integration/common/src/test/java/org/teiid/arquillian/SampleExecutionFactory.java 2012-05-30 15:39:59 UTC (rev 4151)
+++ trunk/test-integration/common/src/test/java/org/teiid/arquillian/SampleExecutionFactory.java 2012-05-31 19:00:50 UTC (rev 4152)
@@ -1,3 +1,25 @@
+/*
+ * 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.arquillian;
import org.teiid.translator.loopback.LoopbackExecutionFactory;
Modified: trunk/test-integration/common/src/test/resources/dynamicview-vdb.xml
===================================================================
--- trunk/test-integration/common/src/test/resources/dynamicview-vdb.xml 2012-05-30 15:39:59 UTC (rev 4151)
+++ trunk/test-integration/common/src/test/resources/dynamicview-vdb.xml 2012-05-31 19:00:50 UTC (rev 4152)
@@ -3,7 +3,7 @@
<source name="text-connector" translator-name="file" connection-jndi-name="java:/marketdata-file"/>
</model>
<model visible = "true" type = "VIRTUAL" name = "portfolio">
- <metadata import-type = "DDL"><![CDATA[
+ <metadata type = "DDL"><![CDATA[
CREATE VIEW stock (
symbol varchar,
price decimal
Modified: trunk/test-integration/db/src/main/java/org/teiid/test/framework/exception/QueryTestFailedException.java
===================================================================
--- trunk/test-integration/db/src/main/java/org/teiid/test/framework/exception/QueryTestFailedException.java 2012-05-30 15:39:59 UTC (rev 4151)
+++ trunk/test-integration/db/src/main/java/org/teiid/test/framework/exception/QueryTestFailedException.java 2012-05-31 19:00:50 UTC (rev 4152)
@@ -3,7 +3,6 @@
*/
package org.teiid.test.framework.exception;
-import java.io.Serializable;
import java.util.List;
import org.teiid.core.TeiidRuntimeException;
@@ -22,8 +21,7 @@
* Subclasses of this exception typically only need to implement whatever
* constructors they need. <p>
*/
-public class QueryTestFailedException extends Exception
- implements Serializable{
+public class QueryTestFailedException extends Exception {
//############################################################################################################################
//# Static Methods #
//############################################################################################################################
@@ -187,7 +185,7 @@
* @see #getFormattedMessage
*/
public String getFullMessage() {
- return ExceptionUtil.getLinkedMessages(this, 0 );
+ return ExceptionUtil.getLinkedMessagesVerbose(this);
}
/* (non-Javadoc)
12 years, 6 months
teiid SVN: r4151 - in trunk/client/src/main: resources/org/teiid/jdbc and 1 other directory.
by teiid-commits@lists.jboss.org
Author: rareddy
Date: 2012-05-30 11:39:59 -0400 (Wed, 30 May 2012)
New Revision: 4151
Modified:
trunk/client/src/main/java/org/teiid/gss/MakeGSS.java
trunk/client/src/main/resources/org/teiid/jdbc/i18n.properties
Log:
TEIID-2013: Allow using the "java.security.krb5.conf" property for kerberoes configuration.
Modified: trunk/client/src/main/java/org/teiid/gss/MakeGSS.java
===================================================================
--- trunk/client/src/main/java/org/teiid/gss/MakeGSS.java 2012-05-30 14:41:59 UTC (rev 4150)
+++ trunk/client/src/main/java/org/teiid/gss/MakeGSS.java 2012-05-30 15:39:59 UTC (rev 4151)
@@ -81,18 +81,31 @@
errors.append(nl);
}
+ String krb5 = System.getProperty("java.security.krb5.conf"); //$NON-NLS-1$
String realm = System.getProperty("java.security.krb5.realm"); //$NON-NLS-1$
- if (realm == null) {
- errors.append(JDBCPlugin.Util.getString("system_prop_missing", "java.security.krb5.realm")); //$NON-NLS-1$ //$NON-NLS-2$
+ String kdc = System.getProperty("java.security.krb5.kdc"); //$NON-NLS-1$
+
+
+ if (krb5 == null && realm == null && kdc == null) {
+ errors.append(JDBCPlugin.Util.getString("no_gss_selection")); //$NON-NLS-1$
errors.append(nl);
}
+ else if (krb5 != null && (realm != null || kdc != null)) {
+ errors.append(JDBCPlugin.Util.getString("ambigious_gss_selection")); //$NON-NLS-1$
+ errors.append(nl);
+ }
+ else if ((realm != null && kdc == null) || (realm == null && kdc != null)) {
+ // krb5 is null here..
+ if (realm == null) {
+ errors.append(JDBCPlugin.Util.getString("system_prop_missing", "java.security.krb5.realm")); //$NON-NLS-1$ //$NON-NLS-2$
+ errors.append(nl);
+ }
+ if (kdc == null) {
+ errors.append(JDBCPlugin.Util.getString("system_prop_missing", "java.security.krb5.kdc")); //$NON-NLS-1$ //$NON-NLS-2$
+ errors.append(nl);
+ }
+ }
- String kdc = System.getProperty("java.security.krb5.kdc"); //$NON-NLS-1$
- if (kdc == null) {
- errors.append(JDBCPlugin.Util.getString("system_prop_missing", "java.security.krb5.kdc")); //$NON-NLS-1$ //$NON-NLS-2$
- errors.append(nl);
- }
-
String config = System.getProperty("java.security.auth.login.config"); //$NON-NLS-1$
if (config == null) {
errors.append(JDBCPlugin.Util.getString("system_prop_missing", "java.security.auth.login.config")); //$NON-NLS-1$ //$NON-NLS-2$
Modified: trunk/client/src/main/resources/org/teiid/jdbc/i18n.properties
===================================================================
--- trunk/client/src/main/resources/org/teiid/jdbc/i18n.properties 2012-05-30 14:41:59 UTC (rev 4150)
+++ trunk/client/src/main/resources/org/teiid/jdbc/i18n.properties 2012-05-30 15:39:59 UTC (rev 4151)
@@ -172,4 +172,6 @@
TEIID20023=connection closed
TEIID20007=Duplicate Class
TEIID20028=data length too big: {0} > max of {1}. You may need to adjust the maxObjectSize client setting.
-unexpected_element=Unexpected Element {0} encountered, expecting one of {1}
\ No newline at end of file
+unexpected_element=Unexpected Element {0} encountered, expecting one of {1}
+ambigious_gss_selection=Either configure "java.security.krb5.conf" property or combination of "java.security.krb5.realm" and "java.security.krb5.kdc" properties. Not both.
+no_gss_selection=No KRB5 configuration found. Either configure "java.security.krb5.conf" property or combination of "java.security.krb5.realm" and "java.security.krb5.kdc" properties.
\ No newline at end of file
12 years, 6 months
teiid SVN: r4150 - branches/7.7.x/test-integration/common/src/test/java/org/teiid/dqp/internal/process.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2012-05-30 10:41:59 -0400 (Wed, 30 May 2012)
New Revision: 4150
Modified:
branches/7.7.x/test-integration/common/src/test/java/org/teiid/dqp/internal/process/TestTPCR.java
Log:
TEIID-2058 refining criteria placement
Modified: branches/7.7.x/test-integration/common/src/test/java/org/teiid/dqp/internal/process/TestTPCR.java
===================================================================
--- branches/7.7.x/test-integration/common/src/test/java/org/teiid/dqp/internal/process/TestTPCR.java 2012-05-30 12:29:32 UTC (rev 4149)
+++ branches/7.7.x/test-integration/common/src/test/java/org/teiid/dqp/internal/process/TestTPCR.java 2012-05-30 14:41:59 UTC (rev 4150)
@@ -201,7 +201,7 @@
ProcessorPlan plan = TestOptimizer.helpPlan("select S_ACCTBAL, S_NAME, N_NAME, P_PARTKEY, P_MFGR, S_ADDRESS, S_PHONE, S_COMMENT from (SELECT SUPPLIER.S_ACCTBAL, SUPPLIER.S_NAME, NATION.N_NAME, PART.P_PARTKEY, PART.P_MFGR, SUPPLIER.S_ADDRESS, SUPPLIER.S_PHONE, SUPPLIER.S_COMMENT FROM PART, SUPPLIER, PARTSUPP, NATION, REGION WHERE (PART.P_PARTKEY = PS_PARTKEY) AND (S_SUPPKEY = PS_SUPPKEY) AND (P_SIZE = 15) AND (P_TYPE LIKE '%BRASS') AND (S_NATIONKEY = N_NATIONKEY) AND (N_REGIONKEY = R_REGIONKEY) AND (R_NAME = 'EUROPE') AND (PS_SUPPLYCOST = (SELECT MIN(PS_SUPPLYCOST) FROM PARTSUPP, SUPPLIER, NATION, REGION WHERE (PART.P_PARTKEY = PS_PARTKEY) AND (S_SUPPKEY = PS_SUPPKEY) AND (S_NATIONKEY = N_NATIONKEY) AND (N_REGIONKEY = R_REGIONKEY) AND (R_NAME = 'EUROPE'))) ORDER BY SUPPLIER.S_ACCTBAL DESC, NATION.N_NAME, SUPPLIER.S_NAME, PART.P_PARTKEY) as x", //$NON-NLS-1$
METADATA, null, finder,
- new String[] {"SELECT g_1.S_ACCTBAL, g_1.S_NAME, g_3.N_NAME, g_0.P_PARTKEY, g_0.P_MFGR, g_1.S_ADDRESS, g_1.S_PHONE, g_1.S_COMMENT FROM TPCR_Oracle_9i.PART AS g_0, TPCR_Oracle_9i.SUPPLIER AS g_1, TPCR_Oracle_9i.PARTSUPP AS g_2, TPCR_Oracle_9i.NATION AS g_3, TPCR_Oracle_9i.REGION AS g_4 WHERE (g_3.N_REGIONKEY = g_4.R_REGIONKEY) AND (g_1.S_NATIONKEY = g_3.N_NATIONKEY) AND (g_1.S_SUPPKEY = g_2.PS_SUPPKEY) AND (g_0.P_PARTKEY = g_2.PS_PARTKEY) AND (g_2.PS_SUPPLYCOST = (SELECT MIN(g_5.PS_SUPPLYCOST) FROM TPCR_Oracle_9i.PARTSUPP AS g_5, TPCR_Oracle_9i.SUPPLIER AS g_6, TPCR_Oracle_9i.NATION AS g_7, TPCR_Oracle_9i.REGION AS g_8 WHERE (g_6.S_SUPPKEY = g_5.PS_SUPPKEY) AND (g_6.S_NATIONKEY = g_7.N_NATIONKEY) AND (g_7.N_REGIONKEY = g_8.R_REGIONKEY) AND (g_5.PS_PARTKEY = g_0.P_PARTKEY) AND (g_8.R_NAME = 'EUROPE'))) AND (g_0.P_SIZE = 15.0) AND (g_0.P_TYPE LIKE '%BRASS') AND (g_4.R_NAME = 'EUROPE')"}, ComparisonMode.EXACT_COMMAND_STRING); //$NON-NLS-1$
+ new String[] {"SELECT g_1.S_ACCTBAL, g_1.S_NAME, g_3.N_NAME, g_0.P_PARTKEY, g_0.P_MFGR, g_1.S_ADDRESS, g_1.S_PHONE, g_1.S_COMMENT FROM TPCR_Oracle_9i.PART AS g_0, TPCR_Oracle_9i.SUPPLIER AS g_1, TPCR_Oracle_9i.PARTSUPP AS g_2, TPCR_Oracle_9i.NATION AS g_3, TPCR_Oracle_9i.REGION AS g_4 WHERE (g_3.N_REGIONKEY = g_4.R_REGIONKEY) AND (g_1.S_NATIONKEY = g_3.N_NATIONKEY) AND (g_1.S_SUPPKEY = g_2.PS_SUPPKEY) AND (g_2.PS_SUPPLYCOST = (SELECT MIN(g_5.PS_SUPPLYCOST) FROM TPCR_Oracle_9i.PARTSUPP AS g_5, TPCR_Oracle_9i.SUPPLIER AS g_6, TPCR_Oracle_9i.NATION AS g_7, TPCR_Oracle_9i.REGION AS g_8 WHERE (g_6.S_SUPPKEY = g_5.PS_SUPPKEY) AND (g_6.S_NATIONKEY = g_7.N_NATIONKEY) AND (g_7.N_REGIONKEY = g_8.R_REGIONKEY) AND (g_5.PS_PARTKEY = g_0.P_PARTKEY) AND (g_8.R_NAME = 'EUROPE'))) AND (g_0.P_PARTKEY = g_2.PS_PARTKEY) AND (g_0.P_SIZE = 15.0) AND (g_0.P_TYPE LIKE '%BRASS') AND (g_4.R_NAME = 'EUROPE')"}, ComparisonMode.EXACT_COMMAND_STRING); //$NON-NLS-1$
TestOptimizer.checkNodeTypes(plan, TestOptimizer.FULL_PUSHDOWN);
}
12 years, 6 months
teiid SVN: r4149 - in trunk: connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/db2 and 5 other directories.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2012-05-30 08:29:32 -0400 (Wed, 30 May 2012)
New Revision: 4149
Modified:
trunk/api/src/main/java/org/teiid/translator/BaseDelegatingExecutionFactory.java
trunk/api/src/main/java/org/teiid/translator/ExecutionFactory.java
trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/db2/BaseDB2ExecutionFactory.java
trunk/engine/src/main/java/org/teiid/dqp/internal/datamgr/CapabilitiesConverter.java
trunk/engine/src/main/java/org/teiid/query/optimizer/capabilities/SourceCapabilities.java
trunk/engine/src/main/java/org/teiid/query/optimizer/relational/rules/RulePushSelectCriteria.java
trunk/engine/src/main/java/org/teiid/query/optimizer/relational/rules/RuleRaiseAccess.java
trunk/engine/src/test/java/org/teiid/query/optimizer/TestOptimizer.java
trunk/engine/src/test/java/org/teiid/query/optimizer/TestSubqueryPushdown.java
trunk/test-integration/common/src/test/java/org/teiid/dqp/internal/process/TestTPCR.java
Log:
TEIID-2058 refining criteria placement
Modified: trunk/api/src/main/java/org/teiid/translator/BaseDelegatingExecutionFactory.java
===================================================================
--- trunk/api/src/main/java/org/teiid/translator/BaseDelegatingExecutionFactory.java 2012-05-29 20:25:52 UTC (rev 4148)
+++ trunk/api/src/main/java/org/teiid/translator/BaseDelegatingExecutionFactory.java 2012-05-30 12:29:32 UTC (rev 4149)
@@ -418,6 +418,10 @@
return delegate.supportsAdvancedOlapOperations();
}
@Override
+ public boolean supportsSubqueryInOn() {
+ return delegate.supportsSubqueryInOn();
+ }
+ @Override
public boolean supportsConvert(int fromType, int toType) {
return delegate.supportsConvert(fromType, toType);
}
Modified: trunk/api/src/main/java/org/teiid/translator/ExecutionFactory.java
===================================================================
--- trunk/api/src/main/java/org/teiid/translator/ExecutionFactory.java 2012-05-29 20:25:52 UTC (rev 4148)
+++ trunk/api/src/main/java/org/teiid/translator/ExecutionFactory.java 2012-05-30 12:29:32 UTC (rev 4149)
@@ -968,5 +968,13 @@
public boolean supportsFormatLiteral(String literal, Format format) {
return false;
}
+
+ /**
+ * Refines subquery support.
+ * @return true if subqueries are supported in the on clause.
+ */
+ public boolean supportsSubqueryInOn() {
+ return true;
+ }
}
Modified: trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/db2/BaseDB2ExecutionFactory.java
===================================================================
--- trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/db2/BaseDB2ExecutionFactory.java 2012-05-29 20:25:52 UTC (rev 4148)
+++ trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/db2/BaseDB2ExecutionFactory.java 2012-05-30 12:29:32 UTC (rev 4149)
@@ -173,4 +173,9 @@
return true;
}
+ @Override
+ public boolean supportsSubqueryInOn() {
+ return false;
+ }
+
}
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-05-29 20:25:52 UTC (rev 4148)
+++ trunk/engine/src/main/java/org/teiid/dqp/internal/datamgr/CapabilitiesConverter.java 2012-05-30 12:29:32 UTC (rev 4149)
@@ -112,6 +112,7 @@
tgtCaps.setCapabilitySupport(Capability.ONLY_FORMAT_LITERALS, srcCaps.supportsOnlyFormatLiterals());
tgtCaps.setCapabilitySupport(Capability.CRITERIA_ONLY_LITERAL_COMPARE, srcCaps.supportsOnlyLiteralComparison());
tgtCaps.setCapabilitySupport(Capability.DEPENDENT_JOIN, srcCaps.supportsDependentJoins());
+ tgtCaps.setCapabilitySupport(Capability.CRITERIA_ON_SUBQUERY, srcCaps.supportsSubqueryInOn());
List<String> functions = srcCaps.getSupportedFunctions();
if(functions != null && functions.size() > 0) {
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-05-29 20:25:52 UTC (rev 4148)
+++ trunk/engine/src/main/java/org/teiid/query/optimizer/capabilities/SourceCapabilities.java 2012-05-30 12:29:32 UTC (rev 4149)
@@ -330,7 +330,8 @@
DEPENDENT_JOIN,
WINDOW_FUNCTION_DISTINCT_AGGREGATES("WindowDistinctAggregates"), //$NON-NLS-1$
QUERY_ONLY_SINGLE_TABLE_GROUP_BY,
- ONLY_FORMAT_LITERALS;
+ ONLY_FORMAT_LITERALS,
+ CRITERIA_ON_SUBQUERY;
private final String toString;
Modified: trunk/engine/src/main/java/org/teiid/query/optimizer/relational/rules/RulePushSelectCriteria.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/optimizer/relational/rules/RulePushSelectCriteria.java 2012-05-29 20:25:52 UTC (rev 4148)
+++ trunk/engine/src/main/java/org/teiid/query/optimizer/relational/rules/RulePushSelectCriteria.java 2012-05-30 12:29:32 UTC (rev 4149)
@@ -129,10 +129,10 @@
case NodeConstants.Types.JOIN:
{
//pushing below a join is not necessary under an access node
- if (NodeEditor.findParent(critNode, NodeConstants.Types.ACCESS) == null) {
+ if (NodeEditor.findParent(critNode, NodeConstants.Types.ACCESS) == null && critNode.getSubqueryContainers().isEmpty()) {
moved = handleJoinCriteria(sourceNode, critNode, metadata);
- break;
}
+ break;
}
case NodeConstants.Types.GROUP:
{
Modified: trunk/engine/src/main/java/org/teiid/query/optimizer/relational/rules/RuleRaiseAccess.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/optimizer/relational/rules/RuleRaiseAccess.java 2012-05-29 20:25:52 UTC (rev 4148)
+++ trunk/engine/src/main/java/org/teiid/query/optimizer/relational/rules/RuleRaiseAccess.java 2012-05-30 12:29:32 UTC (rev 4149)
@@ -55,6 +55,7 @@
import org.teiid.query.sql.symbol.Expression;
import org.teiid.query.sql.symbol.GroupSymbol;
import org.teiid.query.sql.util.SymbolMap;
+import org.teiid.query.sql.visitor.ValueIteratorProviderCollectorVisitor;
import org.teiid.query.util.CommandContext;
import org.teiid.translator.ExecutionFactory.SupportedJoinCriteria;
@@ -687,6 +688,10 @@
return false;
}
if (sjc == SupportedJoinCriteria.ANY) {
+ boolean subqueryOn = CapabilitiesUtil.supports(Capability.CRITERIA_ON_SUBQUERY, accessModelID, metadata, capFinder);
+ if (!subqueryOn && !ValueIteratorProviderCollectorVisitor.getValueIteratorProviders(crit).isEmpty()) {
+ return false;
+ }
return true;
}
//theta join must be between elements with a compare predicate
Modified: trunk/engine/src/test/java/org/teiid/query/optimizer/TestOptimizer.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/optimizer/TestOptimizer.java 2012-05-29 20:25:52 UTC (rev 4148)
+++ trunk/engine/src/test/java/org/teiid/query/optimizer/TestOptimizer.java 2012-05-30 12:29:32 UTC (rev 4149)
@@ -2787,7 +2787,7 @@
}
/** Case 1456, defect 10492*/
- @Test public void testAliasingDefect2(){
+ @Test public void testAliasingDefect2() throws TeiidComponentException, TeiidProcessingException{
// Create query
String sql = "SELECT X.e1 FROM vm1.g1 X, vm1.g1 Z WHERE X.e2 = (SELECT MAX(e2) FROM vm1.g1 Y WHERE X.e1 = Y.e1 AND Y.e2 = Z.e2) AND X.e1 = Z.e1";//$NON-NLS-1$
@@ -2807,7 +2807,7 @@
ProcessorPlan plan = helpPlan(sql, metadata,
null, capFinder,
- new String[] { "SELECT g1__1.e1 FROM pm1.g1 AS g1__1, pm1.g1 AS g1__2 WHERE (g1__1.e2 = (SELECT MAX(pm1.g1.e2) FROM pm1.g1 WHERE (pm1.g1.e1 = g1__1.e1) AND (pm1.g1.e2 = g1__2.e2))) AND (g1__1.e1 = g1__2.e1)" }, SHOULD_SUCCEED); //$NON-NLS-1$
+ new String[] { "SELECT g_0.e1 FROM pm1.g1 AS g_0, pm1.g1 AS g_1 WHERE (g_0.e1 = g_1.e1) AND (g_0.e2 = (SELECT MAX(g_2.e2) FROM pm1.g1 AS g_2 WHERE (g_2.e1 = g_0.e1) AND (g_2.e2 = g_1.e2)))" }, ComparisonMode.EXACT_COMMAND_STRING); //$NON-NLS-1$
checkNodeTypes(plan, FULL_PUSHDOWN);
}
Modified: trunk/engine/src/test/java/org/teiid/query/optimizer/TestSubqueryPushdown.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/optimizer/TestSubqueryPushdown.java 2012-05-29 20:25:52 UTC (rev 4148)
+++ trunk/engine/src/test/java/org/teiid/query/optimizer/TestSubqueryPushdown.java 2012-05-30 12:29:32 UTC (rev 4149)
@@ -40,6 +40,7 @@
import org.teiid.query.processor.ProcessorPlan;
import org.teiid.query.rewriter.TestQueryRewriter;
import org.teiid.query.unittest.RealMetadataFactory;
+import org.teiid.translator.ExecutionFactory;
import org.teiid.translator.SourceSystemFunctions;
@SuppressWarnings("nls")
@@ -176,7 +177,7 @@
"(c37s.stringkey = ('1' || (m37s.intkey || '0'))) AND " + //$NON-NLS-1$
"(m37s.stringkey = m37n.stringkey) ))"; //$NON-NLS-1$
- String sqlOut = "SELECT g_0.intkey FROM bqt1.mediuma AS g_0, bqt1.smallb AS g_1 WHERE (g_0.stringkey = concat('1', concat(g_1.intkey, '0'))) AND (g_0.datevalue = (SELECT MAX(g_2.datevalue) FROM bqt1.mediuma AS g_2, bqt1.smallb AS g_3 WHERE (g_2.stringkey = concat('1', concat(g_3.intkey, '0'))) AND (g_3.stringkey LIKE '%0') AND (g_3.stringkey = g_1.stringkey))) AND (g_1.stringkey LIKE '%0')"; //$NON-NLS-1$
+ String sqlOut = "SELECT g_0.intkey FROM bqt1.mediuma AS g_0, bqt1.smallb AS g_1 WHERE (g_0.stringkey = concat('1', concat(g_1.intkey, '0'))) AND (g_1.stringkey LIKE '%0') AND (g_0.datevalue = (SELECT MAX(g_2.datevalue) FROM bqt1.mediuma AS g_2, bqt1.smallb AS g_3 WHERE (g_2.stringkey = concat('1', concat(g_3.intkey, '0'))) AND (g_3.stringkey LIKE '%0') AND (g_3.stringkey = g_1.stringkey)))"; //$NON-NLS-1$
ProcessorPlan plan = helpPlan(sqlIn, RealMetadataFactory.exampleBQTCached(),
null, capFinder,
@@ -1059,5 +1060,61 @@
});
checkJoinCounts(plan, 0, 0);
}
+
+ /**
+ * Shows the default preference against on subquery
+ */
+ @Test public void testSubuqeryOn() throws Exception {
+ BasicSourceCapabilities bsc = getTypicalCapabilities();
+ bsc.setCapabilitySupport(Capability.QUERY_FROM_JOIN_INNER, true);
+ bsc.setCapabilitySupport(Capability.QUERY_FROM_JOIN_OUTER, true);
+ bsc.setSourceProperty(Capability.JOIN_CRITERIA_ALLOWED, ExecutionFactory.SupportedJoinCriteria.ANY);
+ bsc.setCapabilitySupport(Capability.QUERY_SUBQUERIES_CORRELATED, true);
+ bsc.setCapabilitySupport(Capability.CRITERIA_EXISTS, true);
+ bsc.setCapabilitySupport(Capability.QUERY_FROM_ANSI_JOIN, true);
+ bsc.setCapabilitySupport(Capability.CRITERIA_ON_SUBQUERY, true);
+ ProcessorPlan plan = TestOptimizer.helpPlan("SELECT 1 FROM bqt1.smalla as Y93 INNER JOIN bqt1.smallb as AG5 ON 1 = 1 WHERE EXISTS (SELECT 'Y' FROM bqt1.mediuma WHERE AG5.intkey = 1 AND Y93.intkey = 1 )", //$NON-NLS-1$
+ RealMetadataFactory.exampleBQTCached(), null, new DefaultCapabilitiesFinder(bsc),
+ new String[] {
+ "SELECT 1 FROM BQT1.SmallA AS g_0 CROSS JOIN BQT1.SmallB AS g_1 WHERE EXISTS (SELECT 'Y' FROM BQT1.MediumA AS g_2 WHERE (g_1.intkey = 1) AND (g_0.intkey = 1))"}, ComparisonMode.EXACT_COMMAND_STRING); //$NON-NLS-1$
+ TestOptimizer.checkNodeTypes(plan, FULL_PUSHDOWN);
+ }
+
+ /**
+ * Shows the pushdown is inhibited due to lack of support
+ */
+ @Test public void testSubuqeryOn1() throws Exception {
+ BasicSourceCapabilities bsc = getTypicalCapabilities();
+ bsc.setCapabilitySupport(Capability.QUERY_FROM_JOIN_INNER, true);
+ bsc.setCapabilitySupport(Capability.QUERY_FROM_JOIN_OUTER, true);
+ bsc.setSourceProperty(Capability.JOIN_CRITERIA_ALLOWED, ExecutionFactory.SupportedJoinCriteria.ANY);
+ bsc.setCapabilitySupport(Capability.QUERY_SUBQUERIES_CORRELATED, true);
+ bsc.setCapabilitySupport(Capability.CRITERIA_EXISTS, true);
+ bsc.setCapabilitySupport(Capability.QUERY_FROM_ANSI_JOIN, true);
+ TestOptimizer.helpPlan("SELECT 1 FROM bqt1.smalla as Y93 LEFT OUTER JOIN bqt1.smallb as AG5 ON EXISTS (SELECT 'Y' FROM bqt1.mediuma WHERE AG5.intkey = 1 AND Y93.intkey = 1 )", //$NON-NLS-1$
+ RealMetadataFactory.exampleBQTCached(), null, new DefaultCapabilitiesFinder(bsc),
+ new String[] {
+ "SELECT g_0.intkey FROM BQT1.SmallA AS g_0", "SELECT g_0.intkey FROM BQT1.SmallB AS g_0"}, ComparisonMode.EXACT_COMMAND_STRING); //$NON-NLS-1$
+ }
+ /**
+ * Shows pushdown of on subquery with support
+ */
+ @Test public void testSubuqeryOn2() throws Exception {
+ BasicSourceCapabilities bsc = getTypicalCapabilities();
+ bsc.setCapabilitySupport(Capability.QUERY_FROM_JOIN_INNER, true);
+ bsc.setCapabilitySupport(Capability.QUERY_FROM_JOIN_OUTER, true);
+ bsc.setSourceProperty(Capability.JOIN_CRITERIA_ALLOWED, ExecutionFactory.SupportedJoinCriteria.ANY);
+ bsc.setCapabilitySupport(Capability.QUERY_SUBQUERIES_CORRELATED, true);
+ bsc.setCapabilitySupport(Capability.CRITERIA_EXISTS, true);
+ bsc.setCapabilitySupport(Capability.QUERY_FROM_ANSI_JOIN, true);
+ bsc.setCapabilitySupport(Capability.CRITERIA_ON_SUBQUERY, true);
+ TestOptimizer.helpPlan("SELECT 1 FROM bqt1.smalla as Y93 LEFT OUTER JOIN bqt1.smallb as AG5 ON EXISTS (SELECT 'Y' FROM bqt1.mediuma WHERE AG5.intkey = 1 AND Y93.intkey = 1 )", //$NON-NLS-1$
+ RealMetadataFactory.exampleBQTCached(), null, new DefaultCapabilitiesFinder(bsc),
+ new String[] {
+ "SELECT 1 FROM BQT1.SmallA AS g_0 LEFT OUTER JOIN BQT1.SmallB AS g_1 ON EXISTS (SELECT 'Y' FROM BQT1.MediumA AS g_2 WHERE (g_1.intkey = 1) AND (g_0.intkey = 1))"}, ComparisonMode.EXACT_COMMAND_STRING); //$NON-NLS-1$
+
+
+ }
+
}
Modified: trunk/test-integration/common/src/test/java/org/teiid/dqp/internal/process/TestTPCR.java
===================================================================
--- trunk/test-integration/common/src/test/java/org/teiid/dqp/internal/process/TestTPCR.java 2012-05-29 20:25:52 UTC (rev 4148)
+++ trunk/test-integration/common/src/test/java/org/teiid/dqp/internal/process/TestTPCR.java 2012-05-30 12:29:32 UTC (rev 4149)
@@ -201,7 +201,7 @@
ProcessorPlan plan = TestOptimizer.helpPlan("select S_ACCTBAL, S_NAME, N_NAME, P_PARTKEY, P_MFGR, S_ADDRESS, S_PHONE, S_COMMENT from (SELECT SUPPLIER.S_ACCTBAL, SUPPLIER.S_NAME, NATION.N_NAME, PART.P_PARTKEY, PART.P_MFGR, SUPPLIER.S_ADDRESS, SUPPLIER.S_PHONE, SUPPLIER.S_COMMENT FROM PART, SUPPLIER, PARTSUPP, NATION, REGION WHERE (PART.P_PARTKEY = PS_PARTKEY) AND (S_SUPPKEY = PS_SUPPKEY) AND (P_SIZE = 15) AND (P_TYPE LIKE '%BRASS') AND (S_NATIONKEY = N_NATIONKEY) AND (N_REGIONKEY = R_REGIONKEY) AND (R_NAME = 'EUROPE') AND (PS_SUPPLYCOST = (SELECT MIN(PS_SUPPLYCOST) FROM PARTSUPP, SUPPLIER, NATION, REGION WHERE (PART.P_PARTKEY = PS_PARTKEY) AND (S_SUPPKEY = PS_SUPPKEY) AND (S_NATIONKEY = N_NATIONKEY) AND (N_REGIONKEY = R_REGIONKEY) AND (R_NAME = 'EUROPE'))) ORDER BY SUPPLIER.S_ACCTBAL DESC, NATION.N_NAME, SUPPLIER.S_NAME, PART.P_PARTKEY) as x", //$NON-NLS-1$
METADATA, null, finder,
- new String[] {"SELECT g_1.S_ACCTBAL, g_1.S_NAME, g_3.N_NAME, g_0.P_PARTKEY, g_0.P_MFGR, g_1.S_ADDRESS, g_1.S_PHONE, g_1.S_COMMENT FROM TPCR_Oracle_9i.PART AS g_0, TPCR_Oracle_9i.SUPPLIER AS g_1, TPCR_Oracle_9i.PARTSUPP AS g_2, TPCR_Oracle_9i.NATION AS g_3, TPCR_Oracle_9i.REGION AS g_4 WHERE (g_3.N_REGIONKEY = g_4.R_REGIONKEY) AND (g_1.S_NATIONKEY = g_3.N_NATIONKEY) AND (g_1.S_SUPPKEY = g_2.PS_SUPPKEY) AND (g_0.P_PARTKEY = g_2.PS_PARTKEY) AND (g_2.PS_SUPPLYCOST = (SELECT MIN(g_5.PS_SUPPLYCOST) FROM TPCR_Oracle_9i.PARTSUPP AS g_5, TPCR_Oracle_9i.SUPPLIER AS g_6, TPCR_Oracle_9i.NATION AS g_7, TPCR_Oracle_9i.REGION AS g_8 WHERE (g_6.S_SUPPKEY = g_5.PS_SUPPKEY) AND (g_6.S_NATIONKEY = g_7.N_NATIONKEY) AND (g_7.N_REGIONKEY = g_8.R_REGIONKEY) AND (g_5.PS_PARTKEY = g_0.P_PARTKEY) AND (g_8.R_NAME = 'EUROPE'))) AND (g_0.P_SIZE = 15.0) AND (g_0.P_TYPE LIKE '%BRASS') AND (g_4.R_NAME = 'EUROPE')"}, ComparisonMode.EXACT_COMMAND_STRING); //$NON-NLS-1$
+ new String[] {"SELECT g_1.S_ACCTBAL, g_1.S_NAME, g_3.N_NAME, g_0.P_PARTKEY, g_0.P_MFGR, g_1.S_ADDRESS, g_1.S_PHONE, g_1.S_COMMENT FROM TPCR_Oracle_9i.PART AS g_0, TPCR_Oracle_9i.SUPPLIER AS g_1, TPCR_Oracle_9i.PARTSUPP AS g_2, TPCR_Oracle_9i.NATION AS g_3, TPCR_Oracle_9i.REGION AS g_4 WHERE (g_3.N_REGIONKEY = g_4.R_REGIONKEY) AND (g_1.S_NATIONKEY = g_3.N_NATIONKEY) AND (g_1.S_SUPPKEY = g_2.PS_SUPPKEY) AND (g_2.PS_SUPPLYCOST = (SELECT MIN(g_5.PS_SUPPLYCOST) FROM TPCR_Oracle_9i.PARTSUPP AS g_5, TPCR_Oracle_9i.SUPPLIER AS g_6, TPCR_Oracle_9i.NATION AS g_7, TPCR_Oracle_9i.REGION AS g_8 WHERE (g_6.S_SUPPKEY = g_5.PS_SUPPKEY) AND (g_6.S_NATIONKEY = g_7.N_NATIONKEY) AND (g_7.N_REGIONKEY = g_8.R_REGIONKEY) AND (g_5.PS_PARTKEY = g_0.P_PARTKEY) AND (g_8.R_NAME = 'EUROPE'))) AND (g_0.P_PARTKEY = g_2.PS_PARTKEY) AND (g_0.P_SIZE = 15.0) AND (g_0.P_TYPE LIKE '%BRASS') AND (g_4.R_NAME = 'EUROPE')"}, ComparisonMode.EXACT_COMMAND_STRING); //$NON-NLS-1$
TestOptimizer.checkNodeTypes(plan, TestOptimizer.FULL_PUSHDOWN);
}
12 years, 6 months
teiid SVN: r4148 - in branches/7.7.x: connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/db2 and 5 other directories.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2012-05-29 16:25:52 -0400 (Tue, 29 May 2012)
New Revision: 4148
Modified:
branches/7.7.x/api/src/main/java/org/teiid/translator/BaseDelegatingExecutionFactory.java
branches/7.7.x/api/src/main/java/org/teiid/translator/ExecutionFactory.java
branches/7.7.x/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/db2/BaseDB2ExecutionFactory.java
branches/7.7.x/documentation/developer-guide/src/main/docbook/en-US/content/translator-api.xml
branches/7.7.x/engine/src/main/java/org/teiid/dqp/internal/datamgr/CapabilitiesConverter.java
branches/7.7.x/engine/src/main/java/org/teiid/query/optimizer/capabilities/SourceCapabilities.java
branches/7.7.x/engine/src/main/java/org/teiid/query/optimizer/relational/rules/RulePushSelectCriteria.java
branches/7.7.x/engine/src/main/java/org/teiid/query/optimizer/relational/rules/RuleRaiseAccess.java
branches/7.7.x/engine/src/test/java/org/teiid/query/optimizer/TestOptimizer.java
branches/7.7.x/engine/src/test/java/org/teiid/query/optimizer/TestSubqueryPushdown.java
Log:
TEIID-2058 refining criteria placement
Modified: branches/7.7.x/api/src/main/java/org/teiid/translator/BaseDelegatingExecutionFactory.java
===================================================================
--- branches/7.7.x/api/src/main/java/org/teiid/translator/BaseDelegatingExecutionFactory.java 2012-05-29 18:56:00 UTC (rev 4147)
+++ branches/7.7.x/api/src/main/java/org/teiid/translator/BaseDelegatingExecutionFactory.java 2012-05-29 20:25:52 UTC (rev 4148)
@@ -429,4 +429,8 @@
public boolean supportsAdvancedOlapOperations() {
return delegate.supportsAdvancedOlapOperations();
}
+ @Override
+ public boolean supportsSubqueryInOn() {
+ return delegate.supportsSubqueryInOn();
+ }
}
Modified: branches/7.7.x/api/src/main/java/org/teiid/translator/ExecutionFactory.java
===================================================================
--- branches/7.7.x/api/src/main/java/org/teiid/translator/ExecutionFactory.java 2012-05-29 18:56:00 UTC (rev 4147)
+++ branches/7.7.x/api/src/main/java/org/teiid/translator/ExecutionFactory.java 2012-05-29 20:25:52 UTC (rev 4148)
@@ -962,5 +962,13 @@
public boolean supportsFormatLiteral(String literal, Format format) {
return false;
}
+
+ /**
+ * Refines subquery support.
+ * @return true if subqueries are supported in the on clause.
+ */
+ public boolean supportsSubqueryInOn() {
+ return true;
+ }
}
Modified: branches/7.7.x/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/db2/BaseDB2ExecutionFactory.java
===================================================================
--- branches/7.7.x/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/db2/BaseDB2ExecutionFactory.java 2012-05-29 18:56:00 UTC (rev 4147)
+++ branches/7.7.x/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/db2/BaseDB2ExecutionFactory.java 2012-05-29 20:25:52 UTC (rev 4148)
@@ -173,4 +173,9 @@
return true;
}
+ @Override
+ public boolean supportsSubqueryInOn() {
+ return false;
+ }
+
}
Modified: branches/7.7.x/documentation/developer-guide/src/main/docbook/en-US/content/translator-api.xml
===================================================================
--- branches/7.7.x/documentation/developer-guide/src/main/docbook/en-US/content/translator-api.xml 2012-05-29 18:56:00 UTC (rev 4147)
+++ branches/7.7.x/documentation/developer-guide/src/main/docbook/en-US/content/translator-api.xml 2012-05-29 20:25:52 UTC (rev 4148)
@@ -844,6 +844,17 @@
</row>
<row>
<entry>
+ <para>SubqueryInOn</para>
+ </entry>
+ <entry>
+ <para>Join and base subquery support, such as ExistsCriteria</para>
+ </entry>
+ <entry>
+ <para>Translator can support subqueries in the ON clause. Defaults to true.</para>
+ </entry>
+ </row>
+ <row>
+ <entry>
<para>InlineViews</para>
</entry>
<entry>
Modified: branches/7.7.x/engine/src/main/java/org/teiid/dqp/internal/datamgr/CapabilitiesConverter.java
===================================================================
--- branches/7.7.x/engine/src/main/java/org/teiid/dqp/internal/datamgr/CapabilitiesConverter.java 2012-05-29 18:56:00 UTC (rev 4147)
+++ branches/7.7.x/engine/src/main/java/org/teiid/dqp/internal/datamgr/CapabilitiesConverter.java 2012-05-29 20:25:52 UTC (rev 4148)
@@ -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.ONLY_FORMAT_LITERALS, srcCaps.supportsOnlyFormatLiterals());
+ tgtCaps.setCapabilitySupport(Capability.CRITERIA_ON_SUBQUERY, srcCaps.supportsSubqueryInOn());
List<String> functions = srcCaps.getSupportedFunctions();
if(functions != null && functions.size() > 0) {
Modified: branches/7.7.x/engine/src/main/java/org/teiid/query/optimizer/capabilities/SourceCapabilities.java
===================================================================
--- branches/7.7.x/engine/src/main/java/org/teiid/query/optimizer/capabilities/SourceCapabilities.java 2012-05-29 18:56:00 UTC (rev 4147)
+++ branches/7.7.x/engine/src/main/java/org/teiid/query/optimizer/capabilities/SourceCapabilities.java 2012-05-29 20:25:52 UTC (rev 4148)
@@ -332,7 +332,8 @@
CRITERIA_LIKE_REGEX,
WINDOW_FUNCTION_DISTINCT_AGGREGATES("WindowDistinctAggregates"), //$NON-NLS-1$
QUERY_ONLY_SINGLE_TABLE_GROUP_BY,
- ONLY_FORMAT_LITERALS;
+ ONLY_FORMAT_LITERALS,
+ CRITERIA_ON_SUBQUERY;
private final String toString;
Modified: branches/7.7.x/engine/src/main/java/org/teiid/query/optimizer/relational/rules/RulePushSelectCriteria.java
===================================================================
--- branches/7.7.x/engine/src/main/java/org/teiid/query/optimizer/relational/rules/RulePushSelectCriteria.java 2012-05-29 18:56:00 UTC (rev 4147)
+++ branches/7.7.x/engine/src/main/java/org/teiid/query/optimizer/relational/rules/RulePushSelectCriteria.java 2012-05-29 20:25:52 UTC (rev 4148)
@@ -129,10 +129,10 @@
case NodeConstants.Types.JOIN:
{
//pushing below a join is not necessary under an access node
- if (NodeEditor.findParent(critNode, NodeConstants.Types.ACCESS) == null) {
+ if (NodeEditor.findParent(critNode, NodeConstants.Types.ACCESS) == null && critNode.getSubqueryContainers().isEmpty()) {
moved = handleJoinCriteria(sourceNode, critNode, metadata);
- break;
}
+ break;
}
case NodeConstants.Types.GROUP:
{
Modified: branches/7.7.x/engine/src/main/java/org/teiid/query/optimizer/relational/rules/RuleRaiseAccess.java
===================================================================
--- branches/7.7.x/engine/src/main/java/org/teiid/query/optimizer/relational/rules/RuleRaiseAccess.java 2012-05-29 18:56:00 UTC (rev 4147)
+++ branches/7.7.x/engine/src/main/java/org/teiid/query/optimizer/relational/rules/RuleRaiseAccess.java 2012-05-29 20:25:52 UTC (rev 4148)
@@ -56,6 +56,7 @@
import org.teiid.query.sql.symbol.GroupSymbol;
import org.teiid.query.sql.symbol.SingleElementSymbol;
import org.teiid.query.sql.util.SymbolMap;
+import org.teiid.query.sql.visitor.ValueIteratorProviderCollectorVisitor;
import org.teiid.query.util.CommandContext;
import org.teiid.translator.ExecutionFactory.SupportedJoinCriteria;
@@ -694,6 +695,10 @@
return false;
}
if (sjc == SupportedJoinCriteria.ANY) {
+ boolean subqueryOn = CapabilitiesUtil.supports(Capability.CRITERIA_ON_SUBQUERY, accessModelID, metadata, capFinder);
+ if (!subqueryOn && !ValueIteratorProviderCollectorVisitor.getValueIteratorProviders(crit).isEmpty()) {
+ return false;
+ }
return true;
}
//theta join must be between elements with a compare predicate
Modified: branches/7.7.x/engine/src/test/java/org/teiid/query/optimizer/TestOptimizer.java
===================================================================
--- branches/7.7.x/engine/src/test/java/org/teiid/query/optimizer/TestOptimizer.java 2012-05-29 18:56:00 UTC (rev 4147)
+++ branches/7.7.x/engine/src/test/java/org/teiid/query/optimizer/TestOptimizer.java 2012-05-29 20:25:52 UTC (rev 4148)
@@ -2786,7 +2786,7 @@
}
/** Case 1456, defect 10492*/
- @Test public void testAliasingDefect2(){
+ @Test public void testAliasingDefect2() throws TeiidComponentException, TeiidProcessingException{
// Create query
String sql = "SELECT X.e1 FROM vm1.g1 X, vm1.g1 Z WHERE X.e2 = (SELECT MAX(e2) FROM vm1.g1 Y WHERE X.e1 = Y.e1 AND Y.e2 = Z.e2) AND X.e1 = Z.e1";//$NON-NLS-1$
@@ -2806,7 +2806,7 @@
ProcessorPlan plan = helpPlan(sql, metadata,
null, capFinder,
- new String[] { "SELECT g1__1.e1 FROM pm1.g1 AS g1__1, pm1.g1 AS g1__2 WHERE (g1__1.e2 = (SELECT MAX(pm1.g1.e2) FROM pm1.g1 WHERE (pm1.g1.e1 = g1__1.e1) AND (pm1.g1.e2 = g1__2.e2))) AND (g1__1.e1 = g1__2.e1)" }, SHOULD_SUCCEED); //$NON-NLS-1$
+ new String[] { "SELECT g_0.e1 FROM pm1.g1 AS g_0, pm1.g1 AS g_1 WHERE (g_0.e1 = g_1.e1) AND (g_0.e2 = (SELECT MAX(g_2.e2) FROM pm1.g1 AS g_2 WHERE (g_2.e1 = g_0.e1) AND (g_2.e2 = g_1.e2)))" }, ComparisonMode.EXACT_COMMAND_STRING); //$NON-NLS-1$
checkNodeTypes(plan, FULL_PUSHDOWN);
}
Modified: branches/7.7.x/engine/src/test/java/org/teiid/query/optimizer/TestSubqueryPushdown.java
===================================================================
--- branches/7.7.x/engine/src/test/java/org/teiid/query/optimizer/TestSubqueryPushdown.java 2012-05-29 18:56:00 UTC (rev 4147)
+++ branches/7.7.x/engine/src/test/java/org/teiid/query/optimizer/TestSubqueryPushdown.java 2012-05-29 20:25:52 UTC (rev 4148)
@@ -40,6 +40,7 @@
import org.teiid.query.processor.ProcessorPlan;
import org.teiid.query.rewriter.TestQueryRewriter;
import org.teiid.query.unittest.RealMetadataFactory;
+import org.teiid.translator.ExecutionFactory;
import org.teiid.translator.SourceSystemFunctions;
@SuppressWarnings("nls")
@@ -176,7 +177,7 @@
"(c37s.stringkey = ('1' || (m37s.intkey || '0'))) AND " + //$NON-NLS-1$
"(m37s.stringkey = m37n.stringkey) ))"; //$NON-NLS-1$
- String sqlOut = "SELECT g_0.intkey FROM bqt1.mediuma AS g_0, bqt1.smallb AS g_1 WHERE (g_0.stringkey = concat('1', concat(g_1.intkey, '0'))) AND (g_0.datevalue = (SELECT MAX(g_2.datevalue) FROM bqt1.mediuma AS g_2, bqt1.smallb AS g_3 WHERE (g_2.stringkey = concat('1', concat(g_3.intkey, '0'))) AND (g_3.stringkey LIKE '%0') AND (g_3.stringkey = g_1.stringkey))) AND (g_1.stringkey LIKE '%0')"; //$NON-NLS-1$
+ String sqlOut = "SELECT g_0.intkey FROM bqt1.mediuma AS g_0, bqt1.smallb AS g_1 WHERE (g_0.stringkey = concat('1', concat(g_1.intkey, '0'))) AND (g_1.stringkey LIKE '%0') AND (g_0.datevalue = (SELECT MAX(g_2.datevalue) FROM bqt1.mediuma AS g_2, bqt1.smallb AS g_3 WHERE (g_2.stringkey = concat('1', concat(g_3.intkey, '0'))) AND (g_3.stringkey LIKE '%0') AND (g_3.stringkey = g_1.stringkey)))"; //$NON-NLS-1$
ProcessorPlan plan = helpPlan(sqlIn, RealMetadataFactory.exampleBQTCached(),
null, capFinder,
@@ -1059,5 +1060,61 @@
});
checkJoinCounts(plan, 0, 0);
}
+
+ /**
+ * Shows the default preference against on subquery
+ */
+ @Test public void testSubuqeryOn() throws Exception {
+ BasicSourceCapabilities bsc = getTypicalCapabilities();
+ bsc.setCapabilitySupport(Capability.QUERY_FROM_JOIN_INNER, true);
+ bsc.setCapabilitySupport(Capability.QUERY_FROM_JOIN_OUTER, true);
+ bsc.setSourceProperty(Capability.JOIN_CRITERIA_ALLOWED, ExecutionFactory.SupportedJoinCriteria.ANY);
+ bsc.setCapabilitySupport(Capability.QUERY_SUBQUERIES_CORRELATED, true);
+ bsc.setCapabilitySupport(Capability.CRITERIA_EXISTS, true);
+ bsc.setCapabilitySupport(Capability.QUERY_FROM_ANSI_JOIN, true);
+ bsc.setCapabilitySupport(Capability.CRITERIA_ON_SUBQUERY, true);
+ ProcessorPlan plan = TestOptimizer.helpPlan("SELECT 1 FROM bqt1.smalla as Y93 INNER JOIN bqt1.smallb as AG5 ON 1 = 1 WHERE EXISTS (SELECT 'Y' FROM bqt1.mediuma WHERE AG5.intkey = 1 AND Y93.intkey = 1 )", //$NON-NLS-1$
+ RealMetadataFactory.exampleBQTCached(), null, new DefaultCapabilitiesFinder(bsc),
+ new String[] {
+ "SELECT 1 FROM bqt1.smalla AS g_0 CROSS JOIN bqt1.smallb AS g_1 WHERE EXISTS (SELECT 'Y' FROM bqt1.mediuma AS g_2 WHERE (g_1.intkey = 1) AND (g_0.intkey = 1))"}, ComparisonMode.EXACT_COMMAND_STRING); //$NON-NLS-1$
+ TestOptimizer.checkNodeTypes(plan, FULL_PUSHDOWN);
+ }
+
+ /**
+ * Shows the pushdown is inhibited due to lack of support
+ */
+ @Test public void testSubuqeryOn1() throws Exception {
+ BasicSourceCapabilities bsc = getTypicalCapabilities();
+ bsc.setCapabilitySupport(Capability.QUERY_FROM_JOIN_INNER, true);
+ bsc.setCapabilitySupport(Capability.QUERY_FROM_JOIN_OUTER, true);
+ bsc.setSourceProperty(Capability.JOIN_CRITERIA_ALLOWED, ExecutionFactory.SupportedJoinCriteria.ANY);
+ bsc.setCapabilitySupport(Capability.QUERY_SUBQUERIES_CORRELATED, true);
+ bsc.setCapabilitySupport(Capability.CRITERIA_EXISTS, true);
+ bsc.setCapabilitySupport(Capability.QUERY_FROM_ANSI_JOIN, true);
+ TestOptimizer.helpPlan("SELECT 1 FROM bqt1.smalla as Y93 LEFT OUTER JOIN bqt1.smallb as AG5 ON EXISTS (SELECT 'Y' FROM bqt1.mediuma WHERE AG5.intkey = 1 AND Y93.intkey = 1 )", //$NON-NLS-1$
+ RealMetadataFactory.exampleBQTCached(), null, new DefaultCapabilitiesFinder(bsc),
+ new String[] {
+ "SELECT g_0.intkey FROM bqt1.smalla AS g_0", "SELECT g_0.intkey FROM bqt1.smallb AS g_0"}, ComparisonMode.EXACT_COMMAND_STRING); //$NON-NLS-1$
+ }
+ /**
+ * Shows pushdown of on subquery with support
+ */
+ @Test public void testSubuqeryOn2() throws Exception {
+ BasicSourceCapabilities bsc = getTypicalCapabilities();
+ bsc.setCapabilitySupport(Capability.QUERY_FROM_JOIN_INNER, true);
+ bsc.setCapabilitySupport(Capability.QUERY_FROM_JOIN_OUTER, true);
+ bsc.setSourceProperty(Capability.JOIN_CRITERIA_ALLOWED, ExecutionFactory.SupportedJoinCriteria.ANY);
+ bsc.setCapabilitySupport(Capability.QUERY_SUBQUERIES_CORRELATED, true);
+ bsc.setCapabilitySupport(Capability.CRITERIA_EXISTS, true);
+ bsc.setCapabilitySupport(Capability.QUERY_FROM_ANSI_JOIN, true);
+ bsc.setCapabilitySupport(Capability.CRITERIA_ON_SUBQUERY, true);
+ TestOptimizer.helpPlan("SELECT 1 FROM bqt1.smalla as Y93 LEFT OUTER JOIN bqt1.smallb as AG5 ON EXISTS (SELECT 'Y' FROM bqt1.mediuma WHERE AG5.intkey = 1 AND Y93.intkey = 1 )", //$NON-NLS-1$
+ RealMetadataFactory.exampleBQTCached(), null, new DefaultCapabilitiesFinder(bsc),
+ new String[] {
+ "SELECT 1 FROM bqt1.smalla AS g_0 LEFT OUTER JOIN bqt1.smallb AS g_1 ON EXISTS (SELECT 'Y' FROM bqt1.mediuma AS g_2 WHERE (g_1.intkey = 1) AND (g_0.intkey = 1))"}, ComparisonMode.EXACT_COMMAND_STRING); //$NON-NLS-1$
+
+
+ }
+
}
12 years, 6 months
teiid SVN: r4147 - branches/7.7.x/connectors/translator-object/src/test/resources/ObjectProject.
by teiid-commits@lists.jboss.org
Author: van.halbert
Date: 2012-05-29 14:56:00 -0400 (Tue, 29 May 2012)
New Revision: 4147
Added:
branches/7.7.x/connectors/translator-object/src/test/resources/ObjectProject/.project
Log:
missed the project file for importing into designer
Added: branches/7.7.x/connectors/translator-object/src/test/resources/ObjectProject/.project
===================================================================
--- branches/7.7.x/connectors/translator-object/src/test/resources/ObjectProject/.project (rev 0)
+++ branches/7.7.x/connectors/translator-object/src/test/resources/ObjectProject/.project 2012-05-29 18:56:00 UTC (rev 4147)
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>Object</name>
+ <comment>No Product Application, version 7.7.0.v20120327-0117-H1030-Beta2</comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.teiid.designer.core.modelBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.teiid.designer.core.modelNature</nature>
+ </natures>
+</projectDescription>
12 years, 6 months
teiid SVN: r4146 - in branches/7.4.x: adminshell and 38 other directories.
by teiid-commits@lists.jboss.org
Author: jolee
Date: 2012-05-29 09:21:59 -0400 (Tue, 29 May 2012)
New Revision: 4146
Modified:
branches/7.4.x/adminshell/pom.xml
branches/7.4.x/api/pom.xml
branches/7.4.x/build/kits/jboss-container/teiid-releasenotes.html
branches/7.4.x/build/pom.xml
branches/7.4.x/cache-jbosscache/pom.xml
branches/7.4.x/client-jdk15/pom.xml
branches/7.4.x/client/pom.xml
branches/7.4.x/common-core/pom.xml
branches/7.4.x/connectors/connector-file/pom.xml
branches/7.4.x/connectors/connector-ldap/pom.xml
branches/7.4.x/connectors/connector-salesforce/pom.xml
branches/7.4.x/connectors/connector-ws/pom.xml
branches/7.4.x/connectors/pom.xml
branches/7.4.x/connectors/salesforce-api/pom.xml
branches/7.4.x/connectors/sandbox/pom.xml
branches/7.4.x/connectors/sandbox/translator-yahoo/pom.xml
branches/7.4.x/connectors/translator-file/pom.xml
branches/7.4.x/connectors/translator-jdbc/pom.xml
branches/7.4.x/connectors/translator-ldap/pom.xml
branches/7.4.x/connectors/translator-loopback/pom.xml
branches/7.4.x/connectors/translator-olap/pom.xml
branches/7.4.x/connectors/translator-salesforce/pom.xml
branches/7.4.x/connectors/translator-ws/pom.xml
branches/7.4.x/console/pom.xml
branches/7.4.x/documentation/admin-guide/pom.xml
branches/7.4.x/documentation/caching-guide/pom.xml
branches/7.4.x/documentation/client-developers-guide/pom.xml
branches/7.4.x/documentation/developer-guide/pom.xml
branches/7.4.x/documentation/pom.xml
branches/7.4.x/documentation/quick-start-example/pom.xml
branches/7.4.x/documentation/reference/pom.xml
branches/7.4.x/engine/pom.xml
branches/7.4.x/hibernate-dialect/pom.xml
branches/7.4.x/jboss-integration/pom.xml
branches/7.4.x/metadata/pom.xml
branches/7.4.x/pom.xml
branches/7.4.x/runtime/pom.xml
branches/7.4.x/test-integration/common/pom.xml
branches/7.4.x/test-integration/db/pom.xml
branches/7.4.x/test-integration/pom.xml
Log:
BZ-819904 Update of releasenotes, version numbers & scripts with version number references
Modified: branches/7.4.x/adminshell/pom.xml
===================================================================
--- branches/7.4.x/adminshell/pom.xml 2012-05-29 12:26:43 UTC (rev 4145)
+++ branches/7.4.x/adminshell/pom.xml 2012-05-29 13:21:59 UTC (rev 4146)
@@ -3,7 +3,7 @@
<parent>
<artifactId>teiid-parent</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.4.3</version>
+ <version>7.4.4</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>teiid-adminshell</artifactId>
Modified: branches/7.4.x/api/pom.xml
===================================================================
--- branches/7.4.x/api/pom.xml 2012-05-29 12:26:43 UTC (rev 4145)
+++ branches/7.4.x/api/pom.xml 2012-05-29 13:21:59 UTC (rev 4146)
@@ -3,7 +3,7 @@
<parent>
<artifactId>teiid-parent</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.4.3</version>
+ <version>7.4.4</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>teiid-api</artifactId>
Modified: branches/7.4.x/build/kits/jboss-container/teiid-releasenotes.html
===================================================================
--- branches/7.4.x/build/kits/jboss-container/teiid-releasenotes.html 2012-05-29 12:26:43 UTC (rev 4145)
+++ branches/7.4.x/build/kits/jboss-container/teiid-releasenotes.html 2012-05-29 13:21:59 UTC (rev 4146)
@@ -255,6 +255,20 @@
</h2>
<h4>From ${project.version}</h4>
<ul>
+<li>[<a href='https://issues.jboss.org/browse/TEIID-832'>TEIID-832</a>] - (modified to only support TEIID-2005 changes) added support for calling oracle stored procedures returning cursor/resultsets</li>
+<li>[<a href='https://issues.jboss.org/browse/TEIID-1533'>TEIID-1533</a>] - additional controls for dependent joins</li>
+<li>[<a href='https://issues.jboss.org/browse/TEIID-1868'>TEIID-1868</a>] - Internal Materialized View - Load/Refresh and Assertion Failed</li>
+<li>[<a href='https://issues.jboss.org/browse/TEIID-1899'>TEIID-1899</a>] - Getting Assertion when running Inner Merge Join query with SELECT COUNT(*) on top</li>
+<li>[<a href='https://issues.jboss.org/browse/TEIID-1956'>TEIID-1956</a>] - WHERE clause throws org.teiid.jdbc.TeiidSQLException: Index: 2, Size: 1</li>
+<li>[<a href='https://issues.jboss.org/browse/TEIID-2005'>TEIID-2005</a>] - Source query for Oracle sequence adds an alias, which will return "sequence doesn't exist" errors</li>
+<li>[<a href='https://issues.jboss.org/browse/TEIID-2020'>TEIID-2020</a>] - Running Sybase procedure with jconnect driver in Teiid fails</li>
+<li>[<a href='https://issues.jboss.org/browse/TEIID-2037'>TEIID-2037</a>] - Security context is not propagated correctly between Teiid engine and data sources</li>
+<li>[<a href='https://issues.jboss.org/browse/TEIID-2045'>TEIID-2045</a>] - fix for insert with query expression</li>
+<li>[<a href='https://issues.jboss.org/browse/TEIID-2048'>TEIID-2048</a>] - Error during dependent procedure execution</li>
+</ul>
+
+<h4>From 7.4.3</h4>
+<ul>
<li>[<a href='https://issues.jboss.org/browse/TEIID-1920'>TEIID-1920</a>] - fixing issues with dynamic sql</li>
<li>[<a href='https://issues.jboss.org/browse/TEIID-1925'>TEIID-1925</a>] - Corrected method name to getExecutionId. Also removed getProcessingTime method since that has been removed</li>
<li>[<a href='https://issues.jboss.org/browse/TEIID-1950'>TEIID-1950</a>] - renaming the teiid-client-settings in the client to not interfere with signed jars</li>
Modified: branches/7.4.x/build/pom.xml
===================================================================
--- branches/7.4.x/build/pom.xml 2012-05-29 12:26:43 UTC (rev 4145)
+++ branches/7.4.x/build/pom.xml 2012-05-29 13:21:59 UTC (rev 4146)
@@ -2,7 +2,7 @@
<parent>
<artifactId>teiid-parent</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.4.3</version>
+ <version>7.4.4</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>teiid</artifactId>
Modified: branches/7.4.x/cache-jbosscache/pom.xml
===================================================================
--- branches/7.4.x/cache-jbosscache/pom.xml 2012-05-29 12:26:43 UTC (rev 4145)
+++ branches/7.4.x/cache-jbosscache/pom.xml 2012-05-29 13:21:59 UTC (rev 4146)
@@ -3,7 +3,7 @@
<parent>
<artifactId>teiid-parent</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.4.3</version>
+ <version>7.4.4</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>teiid-cache-jbosscache</artifactId>
Modified: branches/7.4.x/client/pom.xml
===================================================================
--- branches/7.4.x/client/pom.xml 2012-05-29 12:26:43 UTC (rev 4145)
+++ branches/7.4.x/client/pom.xml 2012-05-29 13:21:59 UTC (rev 4146)
@@ -3,7 +3,7 @@
<parent>
<artifactId>teiid-parent</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.4.3</version>
+ <version>7.4.4</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>teiid-client</artifactId>
Modified: branches/7.4.x/client-jdk15/pom.xml
===================================================================
--- branches/7.4.x/client-jdk15/pom.xml 2012-05-29 12:26:43 UTC (rev 4145)
+++ branches/7.4.x/client-jdk15/pom.xml 2012-05-29 13:21:59 UTC (rev 4146)
@@ -3,7 +3,7 @@
<parent>
<artifactId>teiid-parent</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.4.3</version>
+ <version>7.4.4</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>teiid-client-jdk15</artifactId>
Modified: branches/7.4.x/common-core/pom.xml
===================================================================
--- branches/7.4.x/common-core/pom.xml 2012-05-29 12:26:43 UTC (rev 4145)
+++ branches/7.4.x/common-core/pom.xml 2012-05-29 13:21:59 UTC (rev 4146)
@@ -3,7 +3,7 @@
<parent>
<artifactId>teiid-parent</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.4.3</version>
+ <version>7.4.4</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>teiid-common-core</artifactId>
Modified: branches/7.4.x/connectors/connector-file/pom.xml
===================================================================
--- branches/7.4.x/connectors/connector-file/pom.xml 2012-05-29 12:26:43 UTC (rev 4145)
+++ branches/7.4.x/connectors/connector-file/pom.xml 2012-05-29 13:21:59 UTC (rev 4146)
@@ -3,7 +3,7 @@
<parent>
<artifactId>connectors</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.4.3</version>
+ <version>7.4.4</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>connector-file</artifactId>
Modified: branches/7.4.x/connectors/connector-ldap/pom.xml
===================================================================
--- branches/7.4.x/connectors/connector-ldap/pom.xml 2012-05-29 12:26:43 UTC (rev 4145)
+++ branches/7.4.x/connectors/connector-ldap/pom.xml 2012-05-29 13:21:59 UTC (rev 4146)
@@ -2,7 +2,7 @@
<parent>
<artifactId>connectors</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.4.3</version>
+ <version>7.4.4</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>connector-ldap</artifactId>
Modified: branches/7.4.x/connectors/connector-salesforce/pom.xml
===================================================================
--- branches/7.4.x/connectors/connector-salesforce/pom.xml 2012-05-29 12:26:43 UTC (rev 4145)
+++ branches/7.4.x/connectors/connector-salesforce/pom.xml 2012-05-29 13:21:59 UTC (rev 4146)
@@ -3,7 +3,7 @@
<parent>
<artifactId>connectors</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.4.3</version>
+ <version>7.4.4</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>connector-salesforce</artifactId>
Modified: branches/7.4.x/connectors/connector-ws/pom.xml
===================================================================
--- branches/7.4.x/connectors/connector-ws/pom.xml 2012-05-29 12:26:43 UTC (rev 4145)
+++ branches/7.4.x/connectors/connector-ws/pom.xml 2012-05-29 13:21:59 UTC (rev 4146)
@@ -3,7 +3,7 @@
<parent>
<artifactId>connectors</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.4.3</version>
+ <version>7.4.4</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>connector-ws</artifactId>
Modified: branches/7.4.x/connectors/pom.xml
===================================================================
--- branches/7.4.x/connectors/pom.xml 2012-05-29 12:26:43 UTC (rev 4145)
+++ branches/7.4.x/connectors/pom.xml 2012-05-29 13:21:59 UTC (rev 4146)
@@ -3,7 +3,7 @@
<parent>
<artifactId>teiid-parent</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.4.3</version>
+ <version>7.4.4</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.jboss.teiid</groupId>
Modified: branches/7.4.x/connectors/salesforce-api/pom.xml
===================================================================
--- branches/7.4.x/connectors/salesforce-api/pom.xml 2012-05-29 12:26:43 UTC (rev 4145)
+++ branches/7.4.x/connectors/salesforce-api/pom.xml 2012-05-29 13:21:59 UTC (rev 4146)
@@ -2,7 +2,7 @@
<parent>
<artifactId>connectors</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.4.3</version>
+ <version>7.4.4</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>salesforce-api</artifactId>
Modified: branches/7.4.x/connectors/sandbox/pom.xml
===================================================================
--- branches/7.4.x/connectors/sandbox/pom.xml 2012-05-29 12:26:43 UTC (rev 4145)
+++ branches/7.4.x/connectors/sandbox/pom.xml 2012-05-29 13:21:59 UTC (rev 4146)
@@ -3,7 +3,7 @@
<parent>
<artifactId>connectors</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.4.3</version>
+ <version>7.4.4</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.jboss.teiid.connectors</groupId>
Modified: branches/7.4.x/connectors/sandbox/translator-yahoo/pom.xml
===================================================================
--- branches/7.4.x/connectors/sandbox/translator-yahoo/pom.xml 2012-05-29 12:26:43 UTC (rev 4145)
+++ branches/7.4.x/connectors/sandbox/translator-yahoo/pom.xml 2012-05-29 13:21:59 UTC (rev 4146)
@@ -3,7 +3,7 @@
<parent>
<artifactId>sandbox</artifactId>
<groupId>org.jboss.teiid.connectors</groupId>
- <version>7.4.3</version>
+ <version>7.4.4</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>translator-yahoo</artifactId>
Modified: branches/7.4.x/connectors/translator-file/pom.xml
===================================================================
--- branches/7.4.x/connectors/translator-file/pom.xml 2012-05-29 12:26:43 UTC (rev 4145)
+++ branches/7.4.x/connectors/translator-file/pom.xml 2012-05-29 13:21:59 UTC (rev 4146)
@@ -3,7 +3,7 @@
<parent>
<artifactId>connectors</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.4.3</version>
+ <version>7.4.4</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>translator-file</artifactId>
Modified: branches/7.4.x/connectors/translator-jdbc/pom.xml
===================================================================
--- branches/7.4.x/connectors/translator-jdbc/pom.xml 2012-05-29 12:26:43 UTC (rev 4145)
+++ branches/7.4.x/connectors/translator-jdbc/pom.xml 2012-05-29 13:21:59 UTC (rev 4146)
@@ -3,7 +3,7 @@
<parent>
<artifactId>connectors</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.4.3</version>
+ <version>7.4.4</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>translator-jdbc</artifactId>
Modified: branches/7.4.x/connectors/translator-ldap/pom.xml
===================================================================
--- branches/7.4.x/connectors/translator-ldap/pom.xml 2012-05-29 12:26:43 UTC (rev 4145)
+++ branches/7.4.x/connectors/translator-ldap/pom.xml 2012-05-29 13:21:59 UTC (rev 4146)
@@ -2,7 +2,7 @@
<parent>
<artifactId>connectors</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.4.3</version>
+ <version>7.4.4</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>translator-ldap</artifactId>
Modified: branches/7.4.x/connectors/translator-loopback/pom.xml
===================================================================
--- branches/7.4.x/connectors/translator-loopback/pom.xml 2012-05-29 12:26:43 UTC (rev 4145)
+++ branches/7.4.x/connectors/translator-loopback/pom.xml 2012-05-29 13:21:59 UTC (rev 4146)
@@ -3,7 +3,7 @@
<parent>
<artifactId>connectors</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.4.3</version>
+ <version>7.4.4</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>translator-loopback</artifactId>
Modified: branches/7.4.x/connectors/translator-olap/pom.xml
===================================================================
--- branches/7.4.x/connectors/translator-olap/pom.xml 2012-05-29 12:26:43 UTC (rev 4145)
+++ branches/7.4.x/connectors/translator-olap/pom.xml 2012-05-29 13:21:59 UTC (rev 4146)
@@ -3,7 +3,7 @@
<parent>
<artifactId>connectors</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.4.3</version>
+ <version>7.4.4</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>translator-olap</artifactId>
Modified: branches/7.4.x/connectors/translator-salesforce/pom.xml
===================================================================
--- branches/7.4.x/connectors/translator-salesforce/pom.xml 2012-05-29 12:26:43 UTC (rev 4145)
+++ branches/7.4.x/connectors/translator-salesforce/pom.xml 2012-05-29 13:21:59 UTC (rev 4146)
@@ -3,7 +3,7 @@
<parent>
<artifactId>connectors</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.4.3</version>
+ <version>7.4.4</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>translator-salesforce</artifactId>
Modified: branches/7.4.x/connectors/translator-ws/pom.xml
===================================================================
--- branches/7.4.x/connectors/translator-ws/pom.xml 2012-05-29 12:26:43 UTC (rev 4145)
+++ branches/7.4.x/connectors/translator-ws/pom.xml 2012-05-29 13:21:59 UTC (rev 4146)
@@ -3,7 +3,7 @@
<parent>
<artifactId>connectors</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.4.3</version>
+ <version>7.4.4</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>translator-ws</artifactId>
Modified: branches/7.4.x/console/pom.xml
===================================================================
--- branches/7.4.x/console/pom.xml 2012-05-29 12:26:43 UTC (rev 4145)
+++ branches/7.4.x/console/pom.xml 2012-05-29 13:21:59 UTC (rev 4146)
@@ -3,7 +3,7 @@
<parent>
<artifactId>teiid-parent</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.4.3</version>
+ <version>7.4.4</version>
</parent>
<modelVersion>4.0.0</modelVersion>
Modified: branches/7.4.x/documentation/admin-guide/pom.xml
===================================================================
--- branches/7.4.x/documentation/admin-guide/pom.xml 2012-05-29 12:26:43 UTC (rev 4145)
+++ branches/7.4.x/documentation/admin-guide/pom.xml 2012-05-29 13:21:59 UTC (rev 4146)
@@ -2,7 +2,7 @@
<parent>
<groupId>org.jboss.teiid</groupId>
<artifactId>documentation</artifactId>
- <version>7.4.3</version>
+ <version>7.4.4</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>admin-guide</artifactId>
Modified: branches/7.4.x/documentation/caching-guide/pom.xml
===================================================================
--- branches/7.4.x/documentation/caching-guide/pom.xml 2012-05-29 12:26:43 UTC (rev 4145)
+++ branches/7.4.x/documentation/caching-guide/pom.xml 2012-05-29 13:21:59 UTC (rev 4146)
@@ -2,7 +2,7 @@
<parent>
<groupId>org.jboss.teiid</groupId>
<artifactId>documentation</artifactId>
- <version>7.4.3</version>
+ <version>7.4.4</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>caching-guide</artifactId>
Modified: branches/7.4.x/documentation/client-developers-guide/pom.xml
===================================================================
--- branches/7.4.x/documentation/client-developers-guide/pom.xml 2012-05-29 12:26:43 UTC (rev 4145)
+++ branches/7.4.x/documentation/client-developers-guide/pom.xml 2012-05-29 13:21:59 UTC (rev 4146)
@@ -2,7 +2,7 @@
<parent>
<groupId>org.jboss.teiid</groupId>
<artifactId>documentation</artifactId>
- <version>7.4.3</version>
+ <version>7.4.4</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>client-developers-guide</artifactId>
Modified: branches/7.4.x/documentation/developer-guide/pom.xml
===================================================================
--- branches/7.4.x/documentation/developer-guide/pom.xml 2012-05-29 12:26:43 UTC (rev 4145)
+++ branches/7.4.x/documentation/developer-guide/pom.xml 2012-05-29 13:21:59 UTC (rev 4146)
@@ -2,7 +2,7 @@
<parent>
<groupId>org.jboss.teiid</groupId>
<artifactId>documentation</artifactId>
- <version>7.4.3</version>
+ <version>7.4.4</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>developer-guide</artifactId>
Modified: branches/7.4.x/documentation/pom.xml
===================================================================
--- branches/7.4.x/documentation/pom.xml 2012-05-29 12:26:43 UTC (rev 4145)
+++ branches/7.4.x/documentation/pom.xml 2012-05-29 13:21:59 UTC (rev 4146)
@@ -2,7 +2,7 @@
<parent>
<artifactId>teiid-parent</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.4.3</version>
+ <version>7.4.4</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.jboss.teiid</groupId>
Modified: branches/7.4.x/documentation/quick-start-example/pom.xml
===================================================================
--- branches/7.4.x/documentation/quick-start-example/pom.xml 2012-05-29 12:26:43 UTC (rev 4145)
+++ branches/7.4.x/documentation/quick-start-example/pom.xml 2012-05-29 13:21:59 UTC (rev 4146)
@@ -2,7 +2,7 @@
<parent>
<groupId>org.jboss.teiid</groupId>
<artifactId>documentation</artifactId>
- <version>7.4.3</version>
+ <version>7.4.4</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>quick-start-example</artifactId>
Modified: branches/7.4.x/documentation/reference/pom.xml
===================================================================
--- branches/7.4.x/documentation/reference/pom.xml 2012-05-29 12:26:43 UTC (rev 4145)
+++ branches/7.4.x/documentation/reference/pom.xml 2012-05-29 13:21:59 UTC (rev 4146)
@@ -2,7 +2,7 @@
<parent>
<groupId>org.jboss.teiid</groupId>
<artifactId>documentation</artifactId>
- <version>7.4.3</version>
+ <version>7.4.4</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>reference</artifactId>
Modified: branches/7.4.x/engine/pom.xml
===================================================================
--- branches/7.4.x/engine/pom.xml 2012-05-29 12:26:43 UTC (rev 4145)
+++ branches/7.4.x/engine/pom.xml 2012-05-29 13:21:59 UTC (rev 4146)
@@ -3,7 +3,7 @@
<parent>
<artifactId>teiid-parent</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.4.3</version>
+ <version>7.4.4</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>teiid-engine</artifactId>
Modified: branches/7.4.x/hibernate-dialect/pom.xml
===================================================================
--- branches/7.4.x/hibernate-dialect/pom.xml 2012-05-29 12:26:43 UTC (rev 4145)
+++ branches/7.4.x/hibernate-dialect/pom.xml 2012-05-29 13:21:59 UTC (rev 4146)
@@ -2,7 +2,7 @@
<parent>
<artifactId>teiid-parent</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.4.3</version>
+ <version>7.4.4</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>teiid-hibernate-dialect</artifactId>
Modified: branches/7.4.x/jboss-integration/pom.xml
===================================================================
--- branches/7.4.x/jboss-integration/pom.xml 2012-05-29 12:26:43 UTC (rev 4145)
+++ branches/7.4.x/jboss-integration/pom.xml 2012-05-29 13:21:59 UTC (rev 4146)
@@ -2,7 +2,7 @@
<parent>
<artifactId>teiid-parent</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.4.3</version>
+ <version>7.4.4</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.jboss.teiid</groupId>
Modified: branches/7.4.x/metadata/pom.xml
===================================================================
--- branches/7.4.x/metadata/pom.xml 2012-05-29 12:26:43 UTC (rev 4145)
+++ branches/7.4.x/metadata/pom.xml 2012-05-29 13:21:59 UTC (rev 4146)
@@ -3,7 +3,7 @@
<parent>
<artifactId>teiid-parent</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.4.3</version>
+ <version>7.4.4</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>teiid-metadata</artifactId>
Modified: branches/7.4.x/pom.xml
===================================================================
--- branches/7.4.x/pom.xml 2012-05-29 12:26:43 UTC (rev 4145)
+++ branches/7.4.x/pom.xml 2012-05-29 13:21:59 UTC (rev 4146)
@@ -5,7 +5,7 @@
<artifactId>teiid-parent</artifactId>
<packaging>pom</packaging>
<name>Teiid</name>
- <version>7.4.3</version>
+ <version>7.4.4</version>
<description>Federated SQL and XML query engine.</description>
<properties>
<ant.version>1.7.0</ant.version>
Modified: branches/7.4.x/runtime/pom.xml
===================================================================
--- branches/7.4.x/runtime/pom.xml 2012-05-29 12:26:43 UTC (rev 4145)
+++ branches/7.4.x/runtime/pom.xml 2012-05-29 13:21:59 UTC (rev 4146)
@@ -3,7 +3,7 @@
<parent>
<artifactId>teiid-parent</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.4.3</version>
+ <version>7.4.4</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.jboss.teiid</groupId>
Modified: branches/7.4.x/test-integration/common/pom.xml
===================================================================
--- branches/7.4.x/test-integration/common/pom.xml 2012-05-29 12:26:43 UTC (rev 4145)
+++ branches/7.4.x/test-integration/common/pom.xml 2012-05-29 13:21:59 UTC (rev 4146)
@@ -3,7 +3,7 @@
<parent>
<artifactId>teiid-test-integration</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.4.3</version>
+ <version>7.4.4</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>test-integration-common</artifactId>
Modified: branches/7.4.x/test-integration/db/pom.xml
===================================================================
--- branches/7.4.x/test-integration/db/pom.xml 2012-05-29 12:26:43 UTC (rev 4145)
+++ branches/7.4.x/test-integration/db/pom.xml 2012-05-29 13:21:59 UTC (rev 4146)
@@ -9,7 +9,7 @@
<parent>
<artifactId>teiid-test-integration</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.4.3</version>
+ <version>7.4.4</version>
</parent>
<modelVersion>4.0.0</modelVersion>
Modified: branches/7.4.x/test-integration/pom.xml
===================================================================
--- branches/7.4.x/test-integration/pom.xml 2012-05-29 12:26:43 UTC (rev 4145)
+++ branches/7.4.x/test-integration/pom.xml 2012-05-29 13:21:59 UTC (rev 4146)
@@ -3,7 +3,7 @@
<parent>
<artifactId>teiid-parent</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>7.4.3</version>
+ <version>7.4.4</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>teiid-test-integration</artifactId>
12 years, 6 months
teiid SVN: r4145 - in branches/7.4.x: engine/src/main/java/org/teiid/security and 4 other directories.
by teiid-commits@lists.jboss.org
Author: jolee
Date: 2012-05-29 08:26:43 -0400 (Tue, 29 May 2012)
New Revision: 4145
Modified:
branches/7.4.x/engine/src/main/java/org/teiid/dqp/internal/process/DQPWorkContext.java
branches/7.4.x/engine/src/main/java/org/teiid/dqp/internal/process/ThreadReuseExecutor.java
branches/7.4.x/engine/src/main/java/org/teiid/security/SecurityHelper.java
branches/7.4.x/jboss-integration/src/main/java/org/teiid/jboss/JBossSecurityHelper.java
branches/7.4.x/runtime/src/main/java/org/teiid/services/TeiidLoginContext.java
branches/7.4.x/runtime/src/main/java/org/teiid/transport/SocketClientInstance.java
branches/7.4.x/runtime/src/test/java/org/teiid/services/TestMembershipServiceImpl.java
Log:
TEIID-2037 Security context is not propagated correctly between Teiid engine and data sources
Modified: branches/7.4.x/engine/src/main/java/org/teiid/dqp/internal/process/DQPWorkContext.java
===================================================================
--- branches/7.4.x/engine/src/main/java/org/teiid/dqp/internal/process/DQPWorkContext.java 2012-05-25 15:11:25 UTC (rev 4144)
+++ branches/7.4.x/engine/src/main/java/org/teiid/dqp/internal/process/DQPWorkContext.java 2012-05-29 12:26:43 UTC (rev 4145)
@@ -94,12 +94,12 @@
}
public static void setWorkContext(DQPWorkContext context) {
- CONTEXTS.set(context);
+ if (context == null) {
+ CONTEXTS.remove();
+ } else {
+ CONTEXTS.set(context);
+ }
}
-
- public static void releaseWorkContext() {
- CONTEXTS.set(null);
- }
private SessionMetadata session = new SessionMetadata();
private String clientAddress;
@@ -132,6 +132,10 @@
public void setSecurityHelper(SecurityHelper securityHelper) {
this.securityHelper = securityHelper;
}
+
+ public SecurityHelper getSecurityHelper() {
+ return securityHelper;
+ }
/**
* @return
@@ -225,29 +229,21 @@
public void runInContext(final Runnable runnable) {
DQPWorkContext previous = DQPWorkContext.getWorkContext();
- boolean associated = attachDQPWorkContext();
+ DQPWorkContext.setWorkContext(this);
+ Object previousSecurityContext = null;
+ if (securityHelper != null) {
+ previousSecurityContext = securityHelper.assosiateSecurityContext(this.getSecurityContext());
+ }
try {
runnable.run();
} finally {
- if (associated) {
- securityHelper.clearSecurityContext(this.getSecurityDomain());
+ if (securityHelper != null) {
+ securityHelper.assosiateSecurityContext(previousSecurityContext);
}
- DQPWorkContext.releaseWorkContext();
- if (previous != null) {
- previous.attachDQPWorkContext();
- }
+ DQPWorkContext.setWorkContext(previous);
}
- }
+ }
- private boolean attachDQPWorkContext() {
- DQPWorkContext.setWorkContext(this);
- boolean associated = false;
- if (securityHelper != null && this.getSubject() != null) {
- associated = securityHelper.assosiateSecurityContext(this.getSecurityDomain(), this.getSecurityContext());
- }
- return associated;
- }
-
public HashMap<String, DataPolicy> getAllowedDataPolicies() {
if (this.policies == null) {
this.policies = new HashMap<String, DataPolicy>();
Modified: branches/7.4.x/engine/src/main/java/org/teiid/dqp/internal/process/ThreadReuseExecutor.java
===================================================================
--- branches/7.4.x/engine/src/main/java/org/teiid/dqp/internal/process/ThreadReuseExecutor.java 2012-05-25 15:11:25 UTC (rev 4144)
+++ branches/7.4.x/engine/src/main/java/org/teiid/dqp/internal/process/ThreadReuseExecutor.java 2012-05-29 12:26:43 UTC (rev 4145)
@@ -115,6 +115,10 @@
@Override
public void run() {
+ if (workContext.getSecurityHelper() != null) {
+ //if using the inheritable thread local security or if un-association has been sloppy, there may a security context associated
+ workContext.getSecurityHelper().clearSecurityContext();
+ }
workContext.runInContext(r);
}
Modified: branches/7.4.x/engine/src/main/java/org/teiid/security/SecurityHelper.java
===================================================================
--- branches/7.4.x/engine/src/main/java/org/teiid/security/SecurityHelper.java 2012-05-25 15:11:25 UTC (rev 4144)
+++ branches/7.4.x/engine/src/main/java/org/teiid/security/SecurityHelper.java 2012-05-29 12:26:43 UTC (rev 4145)
@@ -28,9 +28,9 @@
public interface SecurityHelper {
- boolean assosiateSecurityContext(String securityDomain, Object context);
+ Object assosiateSecurityContext(Object context);
- void clearSecurityContext(String securityDomain);
+ void clearSecurityContext();
Object getSecurityContext(String securityDomain);
Modified: branches/7.4.x/jboss-integration/src/main/java/org/teiid/jboss/JBossSecurityHelper.java
===================================================================
--- branches/7.4.x/jboss-integration/src/main/java/org/teiid/jboss/JBossSecurityHelper.java 2012-05-25 15:11:25 UTC (rev 4144)
+++ branches/7.4.x/jboss-integration/src/main/java/org/teiid/jboss/JBossSecurityHelper.java 2012-05-29 12:26:43 UTC (rev 4145)
@@ -36,17 +36,16 @@
private static final long serialVersionUID = 3598997061994110254L;
@Override
- public boolean assosiateSecurityContext(String securityDomain, Object newContext) {
+ public Object assosiateSecurityContext(Object newContext) {
SecurityContext context = SecurityActions.getSecurityContext();
- if (newContext != null && (context == null || newContext != context)) {
+ if (newContext != context) {
SecurityActions.setSecurityContext((SecurityContext)newContext);
- return true;
}
- return false;
+ return context;
}
@Override
- public void clearSecurityContext(String securityDomain) {
+ public void clearSecurityContext() {
SecurityActions.clearSecurityContext();
}
Modified: branches/7.4.x/runtime/src/main/java/org/teiid/services/TeiidLoginContext.java
===================================================================
--- branches/7.4.x/runtime/src/main/java/org/teiid/services/TeiidLoginContext.java 2012-05-25 15:11:25 UTC (rev 4144)
+++ branches/7.4.x/runtime/src/main/java/org/teiid/services/TeiidLoginContext.java 2012-05-29 12:26:43 UTC (rev 4145)
@@ -59,6 +59,7 @@
private String securitydomain;
private Object credentials;
private SecurityHelper securityHelper;
+ private Object securityContext;
public TeiidLoginContext(SecurityHelper helper) {
this.securityHelper = helper;
@@ -79,6 +80,7 @@
this.userName = getUserName(existing)+AT+domain;
this.securitydomain = domain;
this.loginContext = createLoginContext(domain, existing);
+ this.securityContext = this.securityHelper.getSecurityContext(this.securitydomain);
return;
}
}
@@ -118,7 +120,16 @@
this.loginContext.login();
this.userName = baseUsername+AT+domain;
this.securitydomain = domain;
- return;
+ Subject subject = this.loginContext.getSubject();
+ Principal principal = null;
+ for(Principal p:subject.getPrincipals()) {
+ if (baseUsername.equals(p.getName())) {
+ principal = p;
+ break;
+ }
+ }
+ this.securityContext = this.securityHelper.createSecurityContext(this.securitydomain, principal, credentials, subject);
+ return;
} catch (LoginException e) {
LogManager.logDetail(LogConstants.CTX_SECURITY,e, e.getMessage());
}
@@ -158,22 +169,7 @@
}
public Object getSecurityContext() {
- Object sc = null;
- if (this.loginContext != null) {
- sc = this.securityHelper.getSecurityContext(this.securitydomain);
- if ( sc == null){
- Subject subject = this.loginContext.getSubject();
- Principal principal = null;
- for(Principal p:subject.getPrincipals()) {
- if (this.userName.startsWith(p.getName())) {
- principal = p;
- break;
- }
- }
- return this.securityHelper.createSecurityContext(this.securitydomain, principal, credentials, subject);
- }
- }
- return sc;
+ return this.securityContext;
}
static String getBaseUsername(String username) {
Modified: branches/7.4.x/runtime/src/main/java/org/teiid/transport/SocketClientInstance.java
===================================================================
--- branches/7.4.x/runtime/src/main/java/org/teiid/transport/SocketClientInstance.java 2012-05-25 15:11:25 UTC (rev 4144)
+++ branches/7.4.x/runtime/src/main/java/org/teiid/transport/SocketClientInstance.java 2012-05-29 12:26:43 UTC (rev 4145)
@@ -159,6 +159,9 @@
if (LogManager.isMessageToBeRecorded(LogConstants.CTX_TRANSPORT, MessageLevel.DETAIL)) {
LogManager.logDetail(LogConstants.CTX_TRANSPORT, "processing message:" + packet); //$NON-NLS-1$
}
+ if (this.workContext.getSecurityHelper() != null) {
+ this.workContext.getSecurityHelper().clearSecurityContext();
+ }
final ServerWorkItem work = new ServerWorkItem(this, packet.getMessageKey(), packet, this.csr);
this.workContext.runInContext(work);
}
Modified: branches/7.4.x/runtime/src/test/java/org/teiid/services/TestMembershipServiceImpl.java
===================================================================
--- branches/7.4.x/runtime/src/test/java/org/teiid/services/TestMembershipServiceImpl.java 2012-05-25 15:11:25 UTC (rev 4144)
+++ branches/7.4.x/runtime/src/test/java/org/teiid/services/TestMembershipServiceImpl.java 2012-05-29 12:26:43 UTC (rev 4145)
@@ -59,17 +59,19 @@
HashSet<Principal> principals = new HashSet<Principal>();
principals.add(p);
- Subject subject = new Subject(false, principals, new HashSet(), new HashSet());
+ final Subject subject = new Subject(false, principals, new HashSet(), new HashSet());
SecurityHelper sh = Mockito.mock(SecurityHelper.class);
Mockito.stub(sh.getSubjectInContext("passthrough")).toReturn(subject); //$NON-NLS-1$
TeiidLoginContext membershipService = new TeiidLoginContext(sh) {
public LoginContext createLoginContext(String domain, CallbackHandler handler) throws LoginException {
LoginContext context = Mockito.mock(LoginContext.class);
+ Mockito.stub(context.getSubject()).toReturn(subject);
return context;
}
protected LoginContext createLoginContext(String domain, Subject subject) throws LoginException {
LoginContext context = Mockito.mock(LoginContext.class);
+ Mockito.stub(context.getSubject()).toReturn(subject);
return context;
}
};
12 years, 6 months