Skip to content

Commit

Permalink
TEIID-4423 adding unwrap
Browse files Browse the repository at this point in the history
  • Loading branch information
shawkins committed Sep 1, 2016
1 parent ad9bffc commit de8eae1
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
Expand Up @@ -31,6 +31,7 @@
import java.util.concurrent.ConcurrentHashMap;

import javax.naming.InitialContext;
import javax.resource.ResourceException;

import org.teiid.core.TeiidComponentException;
import org.teiid.core.TeiidRuntimeException;
Expand All @@ -49,6 +50,7 @@
import org.teiid.query.optimizer.capabilities.SourceCapabilities;
import org.teiid.query.sql.lang.Command;
import org.teiid.query.validator.ValidatorReport;
import org.teiid.resource.spi.WrappedConnection;
import org.teiid.translator.ExecutionContext;
import org.teiid.translator.ExecutionFactory;
import org.teiid.translator.TranslatorException;
Expand Down Expand Up @@ -181,6 +183,13 @@ private BasicSourceCapabilities buildCapabilities(ExecutionFactory<Object, Objec
if (connection == null) {
throw new TranslatorException(QueryPlugin.Event.TEIID31108, QueryPlugin.Util.getString("datasource_not_found", getConnectionName())); //$NON-NLS-1$);
}
if (connection instanceof WrappedConnection) {
try {
connection = ((WrappedConnection)connection).unwrap();
} catch (ResourceException e) {
throw new TranslatorException(QueryPlugin.Event.TEIID30477, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID30477, getConnectionName()));
}
}
LogManager.logDetail(LogConstants.CTX_CONNECTOR, "Initializing the capabilities for", translatorName); //$NON-NLS-1$
synchronized (executionFactory) {
executionFactory.initCapabilities(connection);
Expand Down
Expand Up @@ -340,7 +340,7 @@ public synchronized void execute() throws TranslatorException {
try {
unwrapped = ((WrappedConnection)connection).unwrap();
} catch (ResourceException e) {
throw new TranslatorException(QueryPlugin.Event.TEIID30477, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID30477));
throw new TranslatorException(QueryPlugin.Event.TEIID30477, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID30477, this.manager.getConnectionName()));
}
}

Expand Down
2 changes: 1 addition & 1 deletion engine/src/main/resources/org/teiid/query/i18n.properties
Expand Up @@ -1180,7 +1180,7 @@ TEIID30416=Expected a java.sql.Array, or java array type, but got: {0}
TEIID30431={0} has invalid character: {1}
TEIID30449=Invalid escape sequence "{0}" with escape character "{1}"
TEIID30452=Wrong type of child node is being added.
TEIID30477=Failed to unwrap the source connection for schema {0}.
TEIID30477=Failed to unwrap the source connection for {0}.
TEIID30563=The request {0} has been cancelled.=======
TEIID30564=Invalid locale {0} for collation, using default collation
TEIID30565=Using collator for locale {0}
Expand Down

0 comments on commit de8eae1

Please sign in to comment.