Skip to content

Commit

Permalink
TEIID-5563 pulling module dependency out of the client (#1110)
Browse files Browse the repository at this point in the history
* TEIID-5563 pulling module dependency out of the client

* TEIID-5563 removing javax.resource

resource Connection removed from interfaces
consolidated file related logic, removes vfs from translator
creates a new module for the resource adapter spi
creates a thin api replacement for
WrappedConnection/Connection/ConnectionFactory
  • Loading branch information
shawkins committed Dec 17, 2018
1 parent 1fdfaa9 commit 7b80f97
Show file tree
Hide file tree
Showing 145 changed files with 1,258 additions and 1,357 deletions.
5 changes: 0 additions & 5 deletions api/pom.xml
Expand Up @@ -32,11 +32,6 @@
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.jboss.spec.javax.resource</groupId>
<artifactId>jboss-connector-api_1.7_spec</artifactId>
</dependency>

<dependency>
<groupId>org.jboss.spec.javax.xml.ws</groupId>
<artifactId>jboss-jaxws-api_2.3_spec</artifactId>
Expand Down
25 changes: 25 additions & 0 deletions api/src/main/java/org/teiid/resource/api/Connection.java
@@ -0,0 +1,25 @@
/*
* Copyright Red Hat, Inc. and/or its affiliates
* and other contributors as indicated by the @author tags and
* the COPYRIGHT.txt file distributed with this work.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package org.teiid.resource.api;

public interface Connection {

public void close() throws Exception;

}
25 changes: 25 additions & 0 deletions api/src/main/java/org/teiid/resource/api/ConnectionFactory.java
@@ -0,0 +1,25 @@
/*
* Copyright Red Hat, Inc. and/or its affiliates
* and other contributors as indicated by the @author tags and
* the COPYRIGHT.txt file distributed with this work.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package org.teiid.resource.api;

public interface ConnectionFactory {

public Connection getConnection() throws Exception;

}
25 changes: 25 additions & 0 deletions api/src/main/java/org/teiid/resource/api/WrappedConnection.java
@@ -0,0 +1,25 @@
/*
* Copyright Red Hat, Inc. and/or its affiliates
* and other contributors as indicated by the @author tags and
* the COPYRIGHT.txt file distributed with this work.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package org.teiid.resource.api;

public interface WrappedConnection extends Connection {

Object unwrap() throws Exception;

}
10 changes: 4 additions & 6 deletions api/src/main/java/org/teiid/translator/ExecutionFactory.java
Expand Up @@ -22,10 +22,6 @@
import java.util.LinkedList;
import java.util.List;

import javax.resource.ResourceException;
import javax.resource.cci.Connection;
import javax.resource.cci.ConnectionFactory;

import org.teiid.connector.DataPlugin;
import org.teiid.core.TeiidException;
import org.teiid.core.util.PropertiesUtils;
Expand All @@ -44,6 +40,8 @@
import org.teiid.metadata.FunctionParameter;
import org.teiid.metadata.MetadataFactory;
import org.teiid.metadata.RuntimeMetadata;
import org.teiid.resource.api.Connection;
import org.teiid.resource.api.ConnectionFactory;
import org.teiid.translator.CacheDirective.Scope;
import org.teiid.translator.TypeFacility.RUNTIME_CODES;
import org.teiid.translator.TypeFacility.RUNTIME_NAMES;
Expand Down Expand Up @@ -178,7 +176,7 @@ public C getConnection(F factory) throws TranslatorException {
if (factory instanceof ConnectionFactory) {
try {
return (C) ((ConnectionFactory)factory).getConnection();
} catch (ResourceException e) {
} catch (Exception e) {
throw new TranslatorException(DataPlugin.Event.TEIID60000, e);
}
}
Expand Down Expand Up @@ -217,7 +215,7 @@ public void closeConnection(C connection, F factory) {
if (connection instanceof Connection) {
try {
((Connection)connection).close();
} catch (ResourceException e) {
} catch (Exception e) {
LogManager.logDetail(LogConstants.CTX_CONNECTOR, e, "Error closing"); //$NON-NLS-1$
}
return;
Expand Down
101 changes: 0 additions & 101 deletions api/src/main/java/org/teiid/translator/FileConnection.java

This file was deleted.

5 changes: 2 additions & 3 deletions api/src/main/java/org/teiid/translator/WSConnection.java
Expand Up @@ -23,17 +23,16 @@
import java.net.URL;
import java.net.URLEncoder;

import javax.resource.cci.Connection;
import javax.xml.namespace.QName;
import javax.xml.transform.Source;
import javax.xml.transform.stream.StreamSource;
import javax.xml.ws.Dispatch;
import javax.xml.ws.Service;

/**
* Simple {@link Connection} interface for web services
* Simple interface for web services
*/
public interface WSConnection extends Connection {
public interface WSConnection {

public static final String STATUS_CODE = "status-code"; //$NON-NLS-1$

Expand Down
10 changes: 10 additions & 0 deletions build-configuration/bom/pom.xml
Expand Up @@ -719,6 +719,11 @@
<artifactId>teiid-api</artifactId>
<version>${version.org.teiid}</version>
</dependency>
<dependency>
<groupId>org.teiid</groupId>
<artifactId>teiid-resource-spi</artifactId>
<version>${version.org.teiid}</version>
</dependency>
<dependency>
<groupId>org.teiid</groupId>
<artifactId>teiid-api</artifactId>
Expand All @@ -731,6 +736,11 @@
<artifactId>teiid-client</artifactId>
<version>${version.org.teiid}</version>
</dependency>
<dependency>
<groupId>org.teiid</groupId>
<artifactId>teiid-jboss-client</artifactId>
<version>${version.org.teiid}</version>
</dependency>
<dependency>
<groupId>org.teiid</groupId>
<artifactId>teiid-admin</artifactId>
Expand Down
7 changes: 1 addition & 6 deletions client/pom.xml
Expand Up @@ -52,12 +52,7 @@
<artifactId>teiid-common-core</artifactId>
<type>test-jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jboss.modules</groupId>
<artifactId>jboss-modules</artifactId>
</dependency>

</dependency>
<dependency>
<groupId>io.opentracing</groupId>
<artifactId>opentracing-api</artifactId>
Expand Down
3 changes: 1 addition & 2 deletions client/src/main/java/org/teiid/jdbc/ConnectionProfile.java
Expand Up @@ -24,8 +24,7 @@
public interface ConnectionProfile {

/**
* This method tries to make a connection to the given URL. This class
* will return a null if this is not the right driver to connect to the given URL.
* This method tries to make a connection to the given URL.
* @param The URL used to establish a connection.
* @return Connection object created
* @throws SQLException if it is unable to establish a connection
Expand Down
34 changes: 4 additions & 30 deletions client/src/main/java/org/teiid/jdbc/LocalProfile.java
Expand Up @@ -18,44 +18,18 @@

package org.teiid.jdbc;

import java.sql.SQLException;
import java.util.Properties;

import org.teiid.core.TeiidException;
import org.teiid.core.TeiidRuntimeException;
import org.teiid.net.ServerConnection;


public class LocalProfile implements ConnectionProfile {
public interface LocalProfile extends ConnectionProfile {

public static final String USE_CALLING_THREAD = "useCallingThread"; //$NON-NLS-1$
public static final String WAIT_FOR_LOAD = "waitForLoad"; //$NON-NLS-1$
public static final String TRANSPORT_NAME = "transportName"; //$NON-NLS-1$
public static final Object DQP_WORK_CONTEXT = "dqpWorkContext"; //$NON-NLS-1$

/**
* This method tries to make a connection to the given URL. This class
* will return a null if this is not the right driver to connect to the given URL.
* @param The URL used to establish a connection.
* @return Connection object created
* @throws SQLException if it is unable to establish a connection
*/
public ConnectionImpl connect(String url, Properties info)
throws TeiidSQLException {
try {
ServerConnection sc = createServerConnection(info);
return new ConnectionImpl(sc, info, url);
} catch (TeiidRuntimeException e) {
throw TeiidSQLException.create(e);
} catch (TeiidException e) {
throw TeiidSQLException.create(e);
} catch (LinkageError e) {
throw TeiidSQLException.create(e, JDBCPlugin.Util.gs(JDBCPlugin.Event.TEIID20039));
}
}

public ServerConnection createServerConnection(Properties info) throws TeiidException {
return ModuleHelper.createFromModule(info);
}


public ServerConnection createServerConnection(Properties info) throws TeiidException;

}

0 comments on commit 7b80f97

Please sign in to comment.