Skip to content

Commit

Permalink
Merge pull request #441 from mdrillin/master
Browse files Browse the repository at this point in the history
Changes for backward compatibility with java 1.6
  • Loading branch information
blafond committed Mar 30, 2015
2 parents 1292877 + a9e6a8b commit 31417ec
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 50 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ public boolean isGreaterThan(ITeiidServerVersion otherVersion) {
try {
int myMax = Integer.parseInt(myMaxVersion.getMajor());
int otherMin = Integer.parseInt(otherMinVersion.getMajor());
majCompResult = Integer.compare(myMax, otherMin);
majCompResult = Integer.valueOf(myMax).compareTo(Integer.valueOf(otherMin));

} catch (NumberFormatException ex) {
// One or other is a string so compare lexographically
Expand All @@ -341,7 +341,7 @@ public boolean isGreaterThan(ITeiidServerVersion otherVersion) {
try {
int myMax = Integer.parseInt(myMaxVersion.getMinor());
int otherMin = Integer.parseInt(otherMinVersion.getMinor());
minCompResult = Integer.compare(myMax, otherMin);
minCompResult = Integer.valueOf(myMax).compareTo(Integer.valueOf(otherMin));

} catch (NumberFormatException ex) {
// One or other is a string so compare lexographically
Expand All @@ -355,7 +355,7 @@ public boolean isGreaterThan(ITeiidServerVersion otherVersion) {
try {
int myMax = Integer.parseInt(myMaxVersion.getMicro());
int otherMin = Integer.parseInt(otherMinVersion.getMicro());
micCompResult = Integer.compare(myMax, otherMin);
micCompResult = Integer.valueOf(myMax).compareTo(Integer.valueOf(otherMin));

} catch (NumberFormatException ex) {
// One or other is a string so compare lexographically
Expand All @@ -377,7 +377,7 @@ public boolean isLessThan(ITeiidServerVersion otherVersion) {
try {
int myMax = Integer.parseInt(myMaxVersion.getMajor());
int otherMin = Integer.parseInt(otherMinVersion.getMajor());
majCompResult = Integer.compare(myMax, otherMin);
majCompResult = Integer.valueOf(myMax).compareTo(Integer.valueOf(otherMin));

} catch (NumberFormatException ex) {
// One or other is a string so compare lexographically
Expand All @@ -391,8 +391,7 @@ public boolean isLessThan(ITeiidServerVersion otherVersion) {
try {
int myMax = Integer.parseInt(myMaxVersion.getMinor());
int otherMin = Integer.parseInt(otherMinVersion.getMinor());
minCompResult = Integer.compare(myMax, otherMin);

minCompResult = Integer.valueOf(myMax).compareTo(Integer.valueOf(otherMin));
} catch (NumberFormatException ex) {
// One or other is a string so compare lexographically
minCompResult = myMaxVersion.getMinor().compareTo(otherMinVersion.getMinor());
Expand All @@ -405,8 +404,7 @@ public boolean isLessThan(ITeiidServerVersion otherVersion) {
try {
int myMax = Integer.parseInt(myMaxVersion.getMicro());
int otherMin = Integer.parseInt(otherMinVersion.getMicro());
micCompResult = Integer.compare(myMax, otherMin);

micCompResult = Integer.valueOf(myMax).compareTo(Integer.valueOf(otherMin));
} catch (NumberFormatException ex) {
// One or other is a string so compare lexographically
micCompResult = myMaxVersion.getMicro().compareTo(otherMinVersion.getMicro());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
import org.teiid.core.designer.util.CoreStringUtil;
import org.teiid.designer.runtime.spi.ITeiidDataSource;
import org.teiid.designer.runtime.spi.TeiidPropertyDefinition;
import org.teiid.designer.runtime.version.spi.ITeiidServerVersion;
import org.teiid.designer.teiidimporter.ui.Messages;
import org.teiid.designer.teiidimporter.ui.UiConstants;
import org.teiid.designer.teiidimporter.ui.wizard.ITeiidImportServer;
Expand Down Expand Up @@ -270,21 +269,16 @@ public List<PropertyItem> getDataSourcePropertyItems(String dsName) {
public List<PropertyItem> getDriverPropertyItems(String driverName) {
List<PropertyItem> propertyItemList = new ArrayList<PropertyItem>();
Collection<TeiidPropertyDefinition> propDefns;
ITeiidServerVersion teiidVersion = null;
try {
// Get the driver template properties
propDefns = teiidImportServer.getTemplatePropertyDefns(driverName);
teiidVersion = teiidImportServer.getTeiidServerVersion();
} catch (Exception ex) {
propDefns = new ArrayList<TeiidPropertyDefinition>();
UTIL.log(ex);
}

// Get the Managed connection factory class for rars
String rarConnFactoryValue = null;
if(isRarDriver(driverName,teiidVersion)) {
rarConnFactoryValue = getManagedConnectionFactoryClassDefault(propDefns);
}
String rarConnFactoryValue = getManagedConnectionFactoryClassDefault(propDefns);

// Create the PropertyItems, setting the template values for this source
for(TeiidPropertyDefinition propDefn: propDefns) {
Expand Down Expand Up @@ -466,34 +460,6 @@ private String findDSTemplateWithMatchingClass(String className) {
return dsTemplateName;
}

/**
* Determine if this is a 'rar' type driver that is deployed with Teiid
* @param driverName the name of the driver
* @param teiidVersion the teiid instance version
* @return 'true' if the driver is a rar driver, 'false' if not.
*/
private boolean isRarDriver(String driverName, ITeiidServerVersion teiidVersion) {
boolean isRarDriver = false;
if(!CoreStringUtil.isEmpty(driverName)) {
// Teiid 8.3 and before
if(!TranslatorHelper.isTeiid84OrHigher(teiidVersion)) {
if (driverName.endsWith(DOT_RAR)) {
isRarDriver = true;
}
// Teiid 8.4 and later
} else {
if( driverName.equals(TranslatorHelper.TEIID_FILE_DRIVER_84UP) || driverName.equals(TranslatorHelper.TEIID_GOOGLE_DRIVER_84UP)
|| driverName.equals(TranslatorHelper.TEIID_INFINISPAN_DRIVER_84UP) || driverName.equals(TranslatorHelper.TEIID_LDAP_DRIVER_84UP)
|| driverName.equals(TranslatorHelper.TEIID_SALESORCE_DRIVER_84UP) || driverName.equals(TranslatorHelper.TEIID_WEBSERVICE_DRIVER_84UP)
|| driverName.equals(TranslatorHelper.TEIID_MONGODB_DRIVER_84UP)) {
isRarDriver = true;
}
}
}

return isRarDriver;
}

/*
* Return the isModifiable property value. Need this currently because Teiid isModifiable values
* are inverted for all .rar sources
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,6 @@ public class TranslatorHelper implements UiConstants {
public static final String TEIID_WEBSERVICE_DRIVER_DISPLAYNAME = "WebService"; //$NON-NLS-1$

public static final String TEIID_GOOGLE_CLASS = "org.teiid.resource.adapter.google.SpreadsheetManagedConnectionFactory"; //$NON-NLS-1$
// public static final String TEIID_FILE_CLASS = "org.teiid.resource.adapter.file.FileManagedConnectionFactory"; //$NON-NLS-1$
// public static final String TEIID_INFINISPAN_CLASS = "org.teiid.resource.adapter.infinispan.InfinispanManagedConnectionFactory"; //$NON-NLS-1$
// public static final String TEIID_LDAP_CLASS = "org.teiid.resource.adapter.ldap.LDAPManagedConnectionFactory"; //$NON-NLS-1$
// public static final String TEIID_SALESORCE_CLASS = "org.teiid.resource.adapter.salesforce.SalesForceManagedConnectionFactory"; //$NON-NLS-1$
// public static final String TEIID_WEBSERVICE_CLASS = "org.teiid.resource.adapter.ws.WSManagedConnectionFactory"; //$NON-NLS-1$
// public static final String TEIID_MONGODB_CLASS = "org.teiid.resource.adapter.mongodb.MongoDBManagedConnectionFactory"; //$NON-NLS-1$

public static final String ACCESS = "access"; //$NON-NLS-1$
public static final String DB2 = "db2"; //$NON-NLS-1$
Expand Down Expand Up @@ -299,7 +293,7 @@ public static String getUrlTemplate(String driverName) {
}


if( driverName.startsWith("sap") || driverName.contains("hgdbc")) {
if( driverName.startsWith("sap") || driverName.contains("hgdbc")) { //$NON-NLS-1$ //$NON-NLS-2$
return URL_SAP_HANA;
}

Expand Down

0 comments on commit 31417ec

Please sign in to comment.