Skip to content

Commit 53bf295

Browse files
committed
forward merge of 7.6.1
1 parent 503b51d commit 53bf295

File tree

45 files changed

+634
-283
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+634
-283
lines changed

build/kits/jboss-container/deployers/teiid.deployer/teiid-deployer-jboss-beans.xml

+1
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@
8888
<bean name="VDBStatusChecker" class="org.teiid.deployers.VDBStatusChecker">
8989
<property name="VDBRepository"><inject bean="VDBRepository"/></property>
9090
<property name="threadPool"><inject bean="jboss.system:service=ThreadPool"/></property>
91+
<property name="translatorRepository"><inject bean="translatorRepository"/></property>
9192
</bean>
9293

9394
<!-- Persistence class for the VDB deployment file -->

build/kits/jboss-container/teiid-examples/dynamicvdb-ws-weather/README.txt

+13-11
Original file line numberDiff line numberDiff line change
@@ -38,18 +38,20 @@ select t.* from
3838
2. SOAP11 RPC call providing all of the parameter values for the invoke procedure. With a SOAP
3939
invocation, the action is used to convey the SOAPAction header value if needed. Also note
4040
the use of the endpoint here with an absolute URL, which will be used instead of the default
41-
on the datasource.
41+
on the datasource. We are also using the DefaultServiceMode of MESSAGE (see the weather-vdb.xml file)
42+
to use the full SOAP message request and response.
4243

4344
select xmlserialize(document w.result as string) from
44-
(call weather.invoke(action=>'http://www.weather.gov/forecasts/xml/DWMLgen/wsdl/ndfdXML.wsdl#LatLonListZipCode',
45-
endpoint=>'http://www.weather.gov/forecasts/xml/SOAP_server/ndfdXMLserver.php',
45+
(call weather.invoke(action=>'http://graphical.weather.gov/xml/SOAP_server/ndfdXMLserver.php#LatLonListZipCode',
46+
endpoint=>'http://graphical.weather.gov/xml/SOAP_server/ndfdXMLserver.php',
4647
binding=>'SOAP11',
4748
request=>'
48-
<ns1:LatLonListZipCode xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
49-
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
50-
xmlns:ns1="http://www.weather.gov/forecasts/xml/DWMLgen/wsdl/ndfdXML.wsdl">
51-
<zipCodeList xsi:type="ns2:zipCodeListType" xmlns:ns2="http://www.weather.gov/forecasts/xml/DWMLgen/schema/DWML.xsd">63303</zipCodeList>
52-
</ns1:LatLonListZipCode>')) as w
53-
54-
See the DatabaseMetadata on the invoke procedure for a full description of the parameters.
55-
49+
<SOAP-ENV:Envelope SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/">
50+
<SOAP-ENV:Body>
51+
<ns8077:LatLonListZipCode xmlns:ns8077="uri:DWMLgen">
52+
<listZipCodeList xsi:type="xsd:string">20910 25414</listZipCodeList>
53+
</ns8077:LatLonListZipCode>
54+
</SOAP-ENV:Body>
55+
</SOAP-ENV:Envelope>')) as w
56+
57+
See the Reference or retrieve the JDBC DatabaseMetadata on the invoke procedure for a full description of the parameters.

build/kits/jboss-container/teiid-examples/dynamicvdb-ws-weather/weather-ds.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<rar-name>teiid-connector-ws.rar</rar-name>
88
<connection-definition>javax.resource.cci.ConnectionFactory</connection-definition>
99

10-
<config-property name="EndPoint">http://www.weather.gov/forecasts/xml/sample_products/browser_interface/ndfdXMLclient.php</config-property>
10+
<config-property name="EndPoint">http://graphical.weather.gov/xml/sample_products/browser_interface/ndfdXMLclient.php</config-property>
1111

1212
<max-pool-size>20</max-pool-size>
1313

build/kits/jboss-container/teiid-examples/dynamicvdb-ws-weather/weather-vdb.xml

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<vdb name="weather" version="1">
33

44
<!--
5-
See the dynamicvdb Portfolio example, or http://community.jboss.org/wiki/DynamicVDBinTeiid70
5+
See the dynamicvdb Portfolio example, or the Reference
66
for more information on the format of a vdb.xml file.
77
-->
88

@@ -16,6 +16,7 @@
1616

1717
<translator name="MessageWeather" type="ws">
1818
<property name="DefaultBinding" value="HTTP"/>
19+
<property name="DefaultServiceMode" value="MESSAGE"/>
1920
</translator>
2021

2122
</vdb>

build/kits/jboss-container/teiid-examples/simpleclient/run.bat

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ rem First one sets the path for the client
22
set CLIENT_PATH=.
33

44
rem Second one adds the Teiid client
5-
set TEIID_PATH=../lib/teiid-${pom.version}-client.jar
5+
set TEIID_PATH=../../lib/teiid-${pom.version}-client.jar
66

77
java -cp %CLIENT_PATH%;%TEIID_PATH% JDBCClient %*
88

cache-jbosscache/pom.xml

+5
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,11 @@
3434
<groupId>org.jboss.as</groupId>
3535
<artifactId>jboss-as-clustering-jgroups</artifactId>
3636
<scope>provided</scope>
37+
</dependency>
38+
<dependency>
39+
<groupId>org.jgroups</groupId>
40+
<artifactId>jgroups</artifactId>
41+
<scope>provided</scope>
3742
</dependency>
3843
</dependencies>
3944
</project>

client/src/main/java/org/teiid/gss/MakeGSS.java

+36-2
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,42 @@ public static LogonResult authenticate(ILogon logon, Properties props)
6767

6868
Object result = null;
6969

70-
String jaasApplicationName = props.getProperty(TeiidURL.CONNECTION.JAAS_NAME, "teiid"); //$NON-NLS-1$
71-
String kerberosPrincipalName = props.getProperty(TeiidURL.CONNECTION.KERBEROS_SERVICE_PRINCIPLE_NAME, "teiid"); //$NON-NLS-1$
70+
StringBuilder errors = new StringBuilder();
71+
String jaasApplicationName = props.getProperty(TeiidURL.CONNECTION.JAAS_NAME);
72+
String nl = System.getProperty("line.separator");//$NON-NLS-1$
73+
if (jaasApplicationName == null) {
74+
errors.append(JDBCPlugin.Util.getString("client_prop_missing", TeiidURL.CONNECTION.JAAS_NAME)); //$NON-NLS-1$
75+
errors.append(nl);
76+
}
77+
78+
String kerberosPrincipalName = props.getProperty(TeiidURL.CONNECTION.KERBEROS_SERVICE_PRINCIPLE_NAME);
79+
if (kerberosPrincipalName == null) {
80+
errors.append(JDBCPlugin.Util.getString("client_prop_missing", TeiidURL.CONNECTION.KERBEROS_SERVICE_PRINCIPLE_NAME)); //$NON-NLS-1$
81+
errors.append(nl);
82+
}
83+
84+
String realm = System.getProperty("java.security.krb5.realm"); //$NON-NLS-1$
85+
if (realm == null) {
86+
errors.append(JDBCPlugin.Util.getString("system_prop_missing", "java.security.krb5.realm")); //$NON-NLS-1$ //$NON-NLS-2$
87+
errors.append(nl);
88+
}
89+
90+
String kdc = System.getProperty("java.security.krb5.kdc"); //$NON-NLS-1$
91+
if (kdc == null) {
92+
errors.append(JDBCPlugin.Util.getString("system_prop_missing", "java.security.krb5.kdc")); //$NON-NLS-1$ //$NON-NLS-2$
93+
errors.append(nl);
94+
}
95+
96+
String config = System.getProperty("java.security.auth.login.config"); //$NON-NLS-1$
97+
if (config == null) {
98+
errors.append(JDBCPlugin.Util.getString("system_prop_missing", "java.security.auth.login.config")); //$NON-NLS-1$ //$NON-NLS-2$
99+
errors.append(nl);
100+
}
101+
102+
if (errors.length() > 0) {
103+
throw new LogonException(errors.toString());
104+
}
105+
72106
String user = props.getProperty(TeiidURL.CONNECTION.USER_NAME);
73107
String password = props.getProperty(TeiidURL.CONNECTION.PASSWORD);
74108

client/src/main/resources/org/teiid/jdbc/i18n.properties

+2
Original file line numberDiff line numberDiff line change
@@ -155,3 +155,5 @@ BatchSerializer.datatype_mismatch=The modeled datatype {0} for column {1} doesn'
155155
no_krb_ticket=No cached kerberos ticket found and/or no password supplied
156156
gss_auth_failed=GSS Authentication failed
157157
setup_failed=Protocol error. Session setup failed.
158+
client_prop_missing=Client URL connection property missing "{0}". Please add the property to connection URL.
159+
system_prop_missing=System property "{0}" missing, please add using -D option on the VM startup script.

connectors/connector-ws/src/main/java/org/teiid/resource/adapter/ws/WSConnectionImpl.java

+28
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,25 @@
1+
/*
2+
* JBoss, Home of Professional Open Source.
3+
* See the COPYRIGHT.txt file distributed with this work for information
4+
* regarding copyright ownership. Some portions may be licensed
5+
* to Red Hat, Inc. under one or more contributor license agreements.
6+
*
7+
* This library is free software; you can redistribute it and/or
8+
* modify it under the terms of the GNU Lesser General Public
9+
* License as published by the Free Software Foundation; either
10+
* version 2.1 of the License, or (at your option) any later version.
11+
*
12+
* This library is distributed in the hope that it will be useful,
13+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15+
* Lesser General Public License for more details.
16+
*
17+
* You should have received a copy of the GNU Lesser General Public
18+
* License along with this library; if not, write to the Free Software
19+
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
20+
* 02110-1301 USA.
21+
*/
22+
123
package org.teiid.resource.adapter.ws;
224

325
import java.io.IOException;
@@ -188,6 +210,9 @@ public <T> Dispatch<T> createDispatch(String binding, String endpoint, Class<T>
188210
String defaultEndpoint = mcf.getEndPoint();
189211
String defaultQueryString = null;
190212
String defaultFragment = null;
213+
if (defaultEndpoint == null) {
214+
throw new WebServiceException(WSManagedConnectionFactory.UTIL.getString("null_default_endpoint")); //$NON-NLS-1$
215+
}
191216
String[] parts = defaultEndpoint.split("\\?", 2); //$NON-NLS-1$
192217
defaultEndpoint = parts[0];
193218
if (parts.length > 1) {
@@ -212,6 +237,9 @@ public <T> Dispatch<T> createDispatch(String binding, String endpoint, Class<T>
212237
}
213238
} else {
214239
endpoint = mcf.getEndPoint();
240+
if (endpoint == null) {
241+
throw new WebServiceException(WSManagedConnectionFactory.UTIL.getString("null_endpoint")); //$NON-NLS-1$
242+
}
215243
}
216244
Dispatch<T> dispatch = null;
217245
if (HTTPBinding.HTTP_BINDING.equals(binding) && type == DataSource.class) {

connectors/connector-ws/src/main/resources/org/teiid/resource/adapter/ws/i18n.properties

+2
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,5 @@
2020
# 02110-1301 USA.
2121
#
2222

23+
null_endpoint=An endpoint must be specified by the procedure call or have a default value set by the EndPoint datasource property.
24+
null_default_endpoint=The use of a relative endpoint in a procedure call requires a a default endpoint on the datasource.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
/*
2+
* JBoss, Home of Professional Open Source.
3+
* See the COPYRIGHT.txt file distributed with this work for information
4+
* regarding copyright ownership. Some portions may be licensed
5+
* to Red Hat, Inc. under one or more contributor license agreements.
6+
*
7+
* This library is free software; you can redistribute it and/or
8+
* modify it under the terms of the GNU Lesser General Public
9+
* License as published by the Free Software Foundation; either
10+
* version 2.1 of the License, or (at your option) any later version.
11+
*
12+
* This library is distributed in the hope that it will be useful,
13+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15+
* Lesser General Public License for more details.
16+
*
17+
* You should have received a copy of the GNU Lesser General Public
18+
* License along with this library; if not, write to the Free Software
19+
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
20+
* 02110-1301 USA.
21+
*/
22+
23+
package org.teiid.resource.adapter.ws;
24+
25+
import javax.resource.ResourceException;
26+
import javax.xml.transform.stream.StreamSource;
27+
import javax.xml.ws.WebServiceException;
28+
import javax.xml.ws.Service.Mode;
29+
import javax.xml.ws.http.HTTPBinding;
30+
31+
import org.junit.Test;
32+
33+
public class TestWSAdapter {
34+
35+
@Test(expected=WebServiceException.class) public void testMissingEndpoint() throws ResourceException {
36+
WSManagedConnectionFactory wsmcf = new WSManagedConnectionFactory();
37+
38+
WSConnectionImpl conn = (WSConnectionImpl)wsmcf.createConnectionFactory().getConnection();
39+
conn.createDispatch(HTTPBinding.HTTP_BINDING, null, StreamSource.class, Mode.PAYLOAD);
40+
}
41+
42+
@Test(expected=WebServiceException.class) public void testMissingEndpoint1() throws ResourceException {
43+
WSManagedConnectionFactory wsmcf = new WSManagedConnectionFactory();
44+
45+
WSConnectionImpl conn = (WSConnectionImpl)wsmcf.createConnectionFactory().getConnection();
46+
conn.createDispatch(HTTPBinding.HTTP_BINDING, "/x", StreamSource.class, Mode.PAYLOAD); //$NON-NLS-1$
47+
}
48+
49+
}

connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/SQLConversionVisitor.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -211,9 +211,9 @@ public void visit(Call obj) {
211211
if (obj.getArguments().get(i).getDirection() != Direction.IN) {
212212
throw new IllegalArgumentException(JDBCPlugin.Util.getString("SQLConversionVisitor.not_in_parameter", i+1)); //$NON-NLS-1$
213213
}
214-
visit(obj.getArguments().get(i));
214+
buffer.append('?');
215215
if (this.prepared) {
216-
this.preparedValues.add(obj.getArguments());
216+
this.preparedValues = obj.getArguments();
217217
}
218218
}
219219
}

connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/oracle/OracleExecutionFactory.java

+3-2
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@
7070
import org.teiid.translator.jdbc.JDBCExecutionFactory;
7171
import org.teiid.translator.jdbc.JDBCPlugin;
7272
import org.teiid.translator.jdbc.LocateFunctionModifier;
73+
import org.teiid.translator.jdbc.SQLConversionVisitor;
7374
import org.teiid.translator.jdbc.TranslatedCommand;
7475

7576

@@ -606,8 +607,8 @@ public boolean isOracleSuppliedDriver() {
606607
public List<?> translate(LanguageObject obj, ExecutionContext context) {
607608
if (oracleSuppliedDriver && obj instanceof Call) {
608609
Call call = (Call)obj;
609-
//oracle returns the resultset as a parameter
610-
if (call.getReturnType() == null) {
610+
if (call.getReturnType() == null && call.getMetadataObject() != null && call.getMetadataObject().getProperties().get(SQLConversionVisitor.TEIID_NATIVE_QUERY) == null) {
611+
//oracle returns the resultset as a parameter
611612
call.setReturnType(RefCursorType.class);
612613
}
613614
}

connectors/translator-jdbc/src/test/java/org/teiid/translator/jdbc/oracle/TestOracleTranslator.java

+21-1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
import java.sql.CallableStatement;
2828
import java.sql.Connection;
2929
import java.sql.ResultSet;
30+
import java.sql.Types;
3031
import java.util.Arrays;
3132
import java.util.List;
3233

@@ -875,11 +876,30 @@ public void helpTestVisitor(String vdb, String input, String expectedOutput) thr
875876

876877
@Test public void testNativeQueryProc() throws Exception {
877878
String input = "call proc(2)"; //$NON-NLS-1$
878-
String output = "select x from y where z = 2"; //$NON-NLS-1$
879+
String output = "select x from y where z = ?"; //$NON-NLS-1$
879880

880881
QueryMetadataInterface metadata = getOracleSpecificMetadata();
881882

882883
helpTestVisitor(metadata, input, EMPTY_CONTEXT, null, output);
883884
}
885+
886+
@Test public void testNativeQueryProcPreparedExecution() throws Exception {
887+
CommandBuilder commandBuilder = new CommandBuilder(getOracleSpecificMetadata());
888+
Command command = commandBuilder.getCommand("call proc(2)");
889+
Connection connection = Mockito.mock(Connection.class);
890+
CallableStatement cs = Mockito.mock(CallableStatement.class);
891+
Mockito.stub(cs.getUpdateCount()).toReturn(-1);
892+
ResultSet rs = Mockito.mock(ResultSet.class);
893+
Mockito.stub(cs.getObject(1)).toReturn(rs);
894+
Mockito.stub(cs.getInt(3)).toReturn(4);
895+
Mockito.stub(connection.prepareCall("select x from y where z = ?")).toReturn(cs); //$NON-NLS-1$
896+
OracleExecutionFactory ef = new OracleExecutionFactory();
897+
898+
JDBCProcedureExecution procedureExecution = new JDBCProcedureExecution(command, connection, Mockito.mock(ExecutionContext.class), ef);
899+
procedureExecution.execute();
900+
Mockito.verify(cs, Mockito.never()).registerOutParameter(1, OracleExecutionFactory.CURSOR_TYPE);
901+
Mockito.verify(cs, Mockito.never()).getObject(1);
902+
Mockito.verify(cs, Mockito.times(1)).setObject(1, 2, Types.INTEGER);
903+
}
884904

885905
}

connectors/translator-salesforce/src/main/java/org/teiid/translator/salesforce/SalesForceExecutionFactory.java

+5
Original file line numberDiff line numberDiff line change
@@ -167,5 +167,10 @@ public boolean supportsOrCriteria() {
167167
public boolean supportsCompareCriteriaOrdered() {
168168
return true;
169169
}
170+
171+
@Override
172+
public boolean supportsIsNullCriteria() {
173+
return true;
174+
}
170175

171176
}

connectors/translator-salesforce/src/main/java/org/teiid/translator/salesforce/Util.java

+8-10
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@
2121
*/
2222
package org.teiid.translator.salesforce;
2323

24-
import java.text.DateFormat;
2524
import java.text.SimpleDateFormat;
25+
import java.util.Date;
2626

2727
import org.teiid.translator.TranslatorException;
2828

@@ -56,16 +56,14 @@ public static void validateQueryLength(StringBuffer query) throws TranslatorExce
5656
}
5757
}
5858

59-
public static SimpleDateFormat getSalesforceDateTimeFormat() {
60-
return new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS"); //$NON-NLS-1$
61-
}
59+
private static String timeZone;
6260

63-
public static SimpleDateFormat getTimeZoneOffsetFormat() {
64-
return new SimpleDateFormat("Z"); //$NON-NLS-1$
61+
public static String getDefaultTimeZoneString() {
62+
if (timeZone == null) {
63+
String s = new SimpleDateFormat("Z").format(new Date(0)); //$NON-NLS-1$
64+
timeZone = s.substring(0, 3) + ':' + s.substring(3, 5);
65+
}
66+
return timeZone;
6567
}
6668

67-
public static DateFormat getSalesforceDateFormat() {
68-
return new SimpleDateFormat("yyyy-MM-dd"); //$NON-NLS-1$
69-
}
70-
7169
}

0 commit comments

Comments
 (0)