Skip to content

Commit

Permalink
Merge branch 'master' into teiid-8.x-upgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
Paul Richardson committed Aug 29, 2012
2 parents 010aff9 + 4e54375 commit abb5854
Show file tree
Hide file tree
Showing 28 changed files with 355 additions and 425 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,6 @@ public PropertyChangePublisher register(String key,
@Override
public Object unregister(String key) {
CoreArgCheck.isNotNull(key);

System.out.println("Unregistering " + key);

Object object = this.entries.remove(key);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Text;
import org.teiid.designer.datatools.connection.ConnectionInfoHelper;
import org.teiid.designer.datatools.ui.DatatoolsUiConstants;
import org.teiid.designer.datatools.ui.DatatoolsUiPlugin;
import org.teiid.designer.ui.common.ICredentialsCommon;
Expand Down Expand Up @@ -233,8 +234,9 @@ private void initControls() {
if (null != props.get(ICredentialsCommon.PASSWORD_PROP_ID)) {
passwordText.setText((String)props.get(ICredentialsCommon.PASSWORD_PROP_ID));
}
if (null != props.get(IWSProfileConstants.URL_PROP_ID)) {
urlText.setText((String)props.get(IWSProfileConstants.URL_PROP_ID));
String url = ConnectionInfoHelper.readURLProperty(props);
if (null != url) {
urlText.setText(url);
}
if (null != props.get(ICredentialsCommon.SECURITY_TYPE_ID)) {
securityText.setText((String)props.get(ICredentialsCommon.SECURITY_TYPE_ID));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ public void handleEvent( Event event ) {
Properties properties = ((NewConnectionProfileWizard)getWizard()).getProfileProperties();
String urlStr = urlText.getText();
if (urlStr != null) urlStr = urlStr.trim();
properties.setProperty(IWSProfileConstants.WSDL_URI_PROP_ID, urlStr);
properties.setProperty(IWSProfileConstants.URL_PROP_ID, urlStr);
}
updateState();
}
Expand Down Expand Up @@ -263,8 +263,8 @@ void updateState() {
descriptionText.setText(((NewConnectionProfileWizard)getWizard()).getProfileDescription());

Properties properties = ((NewConnectionProfileWizard)getWizard()).getProfileProperties();
if (null == properties.get(IWSProfileConstants.WSDL_URI_PROP_ID)
|| properties.get(IWSProfileConstants.WSDL_URI_PROP_ID).toString().isEmpty()) {
if (null == properties.get(IWSProfileConstants.URL_PROP_ID)
|| properties.get(IWSProfileConstants.URL_PROP_ID).toString().isEmpty()) {
setErrorMessage(UTIL.getString("Common.URL.Error.Message")); //$NON-NLS-1$
return;
}
Expand All @@ -273,13 +273,13 @@ void updateState() {
boolean urlError = true;
try {
@SuppressWarnings("unused")
URL url = new URL(properties.get(IWSProfileConstants.WSDL_URI_PROP_ID).toString());
URL url = new URL(properties.get(IWSProfileConstants.URL_PROP_ID).toString());
urlError = false;
} catch(MalformedURLException e) {

}
if( urlError ) {
File file = new File(properties.get(IWSProfileConstants.WSDL_URI_PROP_ID).toString());
File file = new File(properties.get(IWSProfileConstants.URL_PROP_ID).toString());

if( !file.exists() && urlError) {
setErrorMessage(UTIL.getString("Common.URLorFILE.Invalid.Message")); //$NON-NLS-1$
Expand Down Expand Up @@ -313,8 +313,8 @@ private boolean internalComplete(boolean complete) {
Properties properties = ((NewConnectionProfileWizard) getWizard())
.getProfileProperties();
if (complete
&& (null == properties.get(IWSProfileConstants.WSDL_URI_PROP_ID) || properties
.get(IWSProfileConstants.WSDL_URI_PROP_ID).toString()
&& (null == properties.get(IWSProfileConstants.URL_PROP_ID) || properties
.get(IWSProfileConstants.URL_PROP_ID).toString()
.isEmpty())) {
complete = false;
}
Expand All @@ -336,7 +336,7 @@ public List getSummaryData() {
securityType = SecurityType.None.name();
}

result.add(new String[] { UTIL.getString("Common.URL.Label"), properties.getProperty(IWSProfileConstants.WSDL_URI_PROP_ID) }); //$NON-NLS-1$
result.add(new String[] { UTIL.getString("Common.URL.Label"), properties.getProperty(IWSProfileConstants.URL_PROP_ID) }); //$NON-NLS-1$

if (! SecurityType.None.name().equals(securityType)) {
result.add(new String[] { UTIL.getString("Common.SecurityType.Label"), securityType }); //$NON-NLS-1$
Expand Down Expand Up @@ -417,7 +417,7 @@ protected IStatus run( IProgressMonitor monitor ) {
}

public Exception testXmlUrlConnection( IConnectionProfile icp ) {
return WSWizardUtils.testURLConnection(icp, IWSProfileConstants.WSDL_URI_PROP_ID);
return WSWizardUtils.testURLConnection(icp, IWSProfileConstants.URL_PROP_ID);
}

public Throwable getTestConnectionException( IConnection conn ) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Text;
import org.teiid.designer.datatools.connection.ConnectionInfoHelper;
import org.teiid.designer.datatools.ui.DatatoolsUiConstants;
import org.teiid.designer.datatools.ui.DatatoolsUiPlugin;
import org.teiid.designer.ui.common.ICredentialsCommon;
Expand Down Expand Up @@ -149,8 +150,9 @@ private void initControls() {
IConnectionProfile profile = getConnectionProfile();
Properties props = profile.getBaseProperties();

if (null != props.get(IWSProfileConstants.WSDL_URI_PROP_ID)) {
urlText.setText((String) props.get(IWSProfileConstants.WSDL_URI_PROP_ID));
String url = ConnectionInfoHelper.readURLProperty(props);
if (null != url) {
urlText.setText(url);
}

if (null != props.get(ICredentialsCommon.SECURITY_TYPE_ID)) {
Expand All @@ -177,7 +179,7 @@ protected Properties collectProperties() {
if (null == result) {
result = new Properties();
}
result.setProperty(IWSProfileConstants.WSDL_URI_PROP_ID, urlText.getText());
result.setProperty(IWSProfileConstants.URL_PROP_ID, urlText.getText());
result.setProperty(ICredentialsCommon.SECURITY_TYPE_ID, credentialsComposite.getSecurityOption().name());
result.setProperty(ICredentialsCommon.USERNAME_PROP_ID, credentialsComposite.getUserName());
result.setProperty(ICredentialsCommon.PASSWORD_PROP_ID, credentialsComposite.getPassword());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import java.util.Collection;
import java.util.Properties;
import java.util.Set;

import org.eclipse.core.resources.IFile;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IStatus;
Expand All @@ -16,6 +17,7 @@
import org.teiid.designer.core.workspace.ModelWorkspaceException;
import org.teiid.designer.core.workspace.ResourceAnnotationHelper;
import org.teiid.designer.datatools.DatatoolsPlugin;
import org.teiid.designer.datatools.profiles.ws.IWSProfileConstants;

/**
* @since 8.0
Expand Down Expand Up @@ -402,4 +404,22 @@ public void clearConnectionInfo(ModelResource modelResource) throws ModelWorkspa
getHelper().removeProperties(modelResource, CONNECTION_NAMESPACE);
getHelper().removeProperties(modelResource, TRANSLATOR_NAMESPACE);
}

/**
* Utility method for reading the 'endpoint' property from a set of connection profile properties.
* Tries the 'endpoint' property key and then tries the legacy 'wsdlURI' property which was used
* in the wsdl importer during the 7.7.1 release
*
* @param properties
* @return 'endpoint' property value
*/
public static String readURLProperty(Properties properties) {
String urlPropId = properties.getProperty(IWSProfileConstants.URL_PROP_ID);
if (urlPropId == null) {
// Check for the legacy version that was getting used by the WSDL importer in 7.7.1
urlPropId = properties.getProperty(IWSProfileConstants.LEGACY_WSDL_PROP_ID);
}

return urlPropId;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,41 @@ public interface IWSProfileConstants extends ICredentialsCommon {

String TEIID_CATEGORY = "org.teiid.designer.import.category"; //$NON-NLS-1$

String URL_PROP_ID = "EndPoint"; //$NON-NLS-1$
String WSDL_URI_PROP_ID = "wsdlURI"; //$NON-NLS-1$

/*
* Teiid Data Source property key.
*
* Currently only EndPoint is the only property provided by Data Tools connection profile that matches up.
*/
String DS_ENDPOINT = "wsdlURI"; //$NON-NLS-1$
String DS_SECURITY_TYPE = "SecurityType"; //$NON-NLS-1$";
String DS_AUTH_USER_NAME = "AuthUserName"; //$NON-NLS-1$
String DS_AUTH_PASSWORD = "AuthPassword"; //$NON-NLS-1$
String DS_WS_SECURITY_CONFIG_URL = "WsSecurityConfigURL"; //$NON-NLS-1$
String DS_WS_SECURITY_CONFIG_NAME = "WsSecurityConfigName"; //$NON-NLS-1$

String SOURCE_ENDPOINT = "EndPoint"; //$NON-NLS-1$
String SOAP_SERVICE_MODE = "DefaultServiceMode"; //$NON-NLS-1$
String SOAP_BINDING = "DefaultBinding"; //$NON-NLS-1$

/*
* The Web Services Data Source object contains the following properties
*
* connectionClass=org.my.custom.driver.Class
* soapEndPoint=http://my.soap.endpoint.url
* driverClassPath=org.my.first.jar;org.my.second.jar;
*
* The only property that matches up with the teiid-connector-ws.jar definition is the soapEndPoint
*
*/
String URL_PROP_ID = "EndPoint"; //$NON-NLS-1$
String SOAP_ENDPOINT_KEY = "soapEndPoint"; //$NON-NLS-1$
String CONNECTION_CLASS_KEY = "connectionClass"; //$NON-NLS-1$
String DRIVER_CLASS_PATH_KEY = "driverClassPath"; //$NON-NLS-1$

/**
* Used by the WSDL Importer in 7.7.1 for the wsdl URI connection profile property key.
* Should only be used for backward compatibilty
*/
String LEGACY_WSDL_PROP_ID = "wsdlURI"; //$NON-NLS-1$
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public void setConnectionInfo(ModelResource modelResource,

Properties props = connectionProfile.getBaseProperties();

String url = props.getProperty(IWSProfileConstants.URL_PROP_ID);
String url = readURLProperty(props);
if (null != url) {
connectionProps.setProperty(CONNECTION_NAMESPACE + IWSProfileConstants.URL_PROP_ID, url);
}
Expand Down Expand Up @@ -78,7 +78,7 @@ public Properties getTeiidRelatedProperties(
connectionProps.setProperty(ICredentialsCommon.PASSWORD_PROP_ID, password);
}

String url = props.getProperty(IWSProfileConstants.URL_PROP_ID);
String url = readURLProperty(props);
if (null != url) {
connectionProps.setProperty(IWSProfileConstants.URL_PROP_ID, url);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ public void run( final IProgressMonitor monitor ) {
} catch (Throwable err) {
ModelerCore.Util.log(IStatus.ERROR, err, err.getMessage());
} finally {
// This operation is NOT undoable or significant... ALWAYS comit to ensure
// This operation is NOT undoable or significant... ALWAYS commit to ensure
// Nothing is left hanging.
if (startedTxn) {
ModelerCore.commitTxn();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1619,7 +1619,7 @@ public int updateFromSchema( final XmlElement rootElement,
final boolean startedTxn = ModelerCore.startTxn(true,
true,
XmlDocumentPlugin.Util.getString("XmlDocumentBuilderImpl.Update_XML_Document_from_Schema_6"), this); //$NON-NLS-1$
final boolean succeeded = false;
boolean succeeded = false;
try {
// First do all the deletes - Do deletes first to ensure indexes are correct
updateFromSchema(root, false);
Expand All @@ -1634,12 +1634,17 @@ public int updateFromSchema( final XmlElement rootElement,
// Now do the Adds
updateFromSchema(root, true);
count = count + newCount + moveCount;
succeeded = true;
} finally {
cleanup();

// Commit UoW if we started it.
if (startedTxn) if (succeeded) ModelerCore.commitTxn();
else ModelerCore.rollbackTxn();
if (startedTxn) {
if (succeeded)
ModelerCore.commitTxn();
else
ModelerCore.rollbackTxn();
}
}

return count;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import org.eclipse.datatools.connectivity.IConnectionProfile;
import org.teiid.core.event.IChangeListener;
import org.teiid.core.event.IChangeNotifier;
import org.teiid.designer.datatools.profiles.ws.IWSProfileConstants;
import org.teiid.designer.datatools.connection.ConnectionInfoHelper;
import org.teiid.designer.modelgenerator.wsdl.WSDLReader;
import org.teiid.designer.modelgenerator.wsdl.model.Model;
import org.teiid.designer.modelgenerator.wsdl.model.ModelGenerationException;
Expand Down Expand Up @@ -287,7 +287,7 @@ public void setConnectionProfile(IConnectionProfile connectionProfile) {
String password = props.getProperty(ICredentialsCommon.PASSWORD_PROP_ID);
setWSDLCredentials(securityTypeValue, userName, password);

String fileUri = props.getProperty(IWSProfileConstants.WSDL_URI_PROP_ID);
String fileUri = ConnectionInfoHelper.readURLProperty(props);
if( fileUri != null ) {
setWSDLFileUri(fileUri);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,14 @@
import org.teiid.designer.core.workspace.ModelWorkspaceItem;
import org.teiid.designer.core.workspace.ModelWorkspaceManager;
import org.teiid.designer.datatools.connection.IConnectionInfoProvider;
import org.teiid.designer.datatools.profiles.ws.IWSProfileConstants;
import org.teiid.designer.metamodels.relational.Column;
import org.teiid.designer.metamodels.relational.Procedure;
import org.teiid.designer.metamodels.relational.ProcedureParameter;
import org.teiid.designer.metamodels.relational.ProcedureResult;
import org.teiid.designer.metamodels.relational.RelationalFactory;
import org.teiid.designer.metamodels.transformation.SqlTransformationMappingRoot;
import org.teiid.designer.modelgenerator.wsdl.SOAPConnectionInfoProvider;
import org.teiid.designer.modelgenerator.wsdl.WSSoapConnectionInfoProvider;
import org.teiid.designer.modelgenerator.wsdl.model.Operation;
import org.teiid.designer.modelgenerator.wsdl.model.Port;
import org.teiid.designer.modelgenerator.wsdl.ui.Messages;
Expand Down Expand Up @@ -222,26 +223,26 @@ protected void addConnectionProfileInfoToSourceModel(IProgressMonitor monitor, b
String endpoint = this.importManager.getEndPoint();
if( endpoint != null ) {
Properties props = profile.getBaseProperties();
props.put(SOAPConnectionInfoProvider.WSDL_URI_KEY, endpoint);
props.put(IWSProfileConstants.URL_PROP_ID, endpoint);
String defaultServiceMode = this.importManager.getTranslatorDefaultServiceMode();
if( defaultServiceMode.equalsIgnoreCase(WSDLImportWizardManager.MESSAGE ) ) {
props.put(SOAPConnectionInfoProvider.SOAP_SERVICE_MODE, WSDLImportWizardManager.MESSAGE);
props.put(IWSProfileConstants.SOAP_SERVICE_MODE, WSDLImportWizardManager.MESSAGE);
} else {
props.put(SOAPConnectionInfoProvider.SOAP_SERVICE_MODE, WSDLImportWizardManager.PAYLOAD);
props.put(IWSProfileConstants.SOAP_SERVICE_MODE, WSDLImportWizardManager.PAYLOAD);
}
String defaultBinding = this.importManager.getTranslatorDefaultBinding();
if( defaultBinding.equalsIgnoreCase(Port.SOAP12) ) {
props.put(SOAPConnectionInfoProvider.SOAP_BINDING, Port.SOAP12);
props.put(IWSProfileConstants.SOAP_BINDING, Port.SOAP12);
} else {
// remove MESSAGE property if it exists
String theProp = props.getProperty(SOAPConnectionInfoProvider.SOAP_BINDING);
String theProp = props.getProperty(IWSProfileConstants.SOAP_BINDING);
if( theProp != null ) {
props.remove(SOAPConnectionInfoProvider.SOAP_BINDING);
props.remove(IWSProfileConstants.SOAP_BINDING);
}

}
profile.setBaseProperties(props);
IConnectionInfoProvider provider = new SOAPConnectionInfoProvider();
IConnectionInfoProvider provider = new WSSoapConnectionInfoProvider();
provider.setConnectionInfo(sourceModel, profile);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
import org.teiid.core.event.IChangeNotifier;
import org.teiid.core.util.FileUtils;
import org.teiid.designer.core.workspace.ModelUtil;
import org.teiid.designer.datatools.profiles.ws.IWSProfileConstants;
import org.teiid.designer.datatools.connection.ConnectionInfoHelper;
import org.teiid.designer.datatools.ui.dialogs.ConnectionProfileWorker;
import org.teiid.designer.datatools.ui.dialogs.IProfileChangedListener;
import org.teiid.designer.modelgenerator.wsdl.ui.Messages;
Expand Down Expand Up @@ -458,7 +458,7 @@ private void refreshUiFromManager() {
return;
}
Properties props = profile.getBaseProperties();
wsdlURIText.setText(props.getProperty(IWSProfileConstants.WSDL_URI_PROP_ID));
wsdlURIText.setText(ConnectionInfoHelper.readURLProperty(props));
updateWidgetEnablements();
setErrorMessage(null);
setMessage(Messages.WsdlDefinitionPage_select_profile);
Expand Down
8 changes: 0 additions & 8 deletions plugins/org.teiid.designer.modelgenerator.wsdl/plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,6 @@
See the AUTHORS.txt file distributed with this work for a full listing of individual contributors.
-->
<plugin>
<extension
id="org.teiid.designer.modelgenerator.wsdl.ConnectionInfoProvider"
name="%wsdlConnectionInfoProvider.name"
point="org.teiid.designer.datatools.ConnectionInfoProvider">
<ConnectionInfoProvider
category="org.eclipse.datatools.enablement.oda.ws"
class="org.teiid.designer.modelgenerator.wsdl.SOAPConnectionInfoProvider"/>
</extension>
<extension
id="org.teiid.designer.modelgenerator.wsdl.ConnectionInfoProvider"
name="%wsSoapConnectionInfoProvider.name"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ private static String getString( final String id ) {
private RelationalFactory factory;
private DatatypeManager datatypeManager = ModelerCore.getBuiltInTypesManager();
private List<ProcedureBuilder> builders= new ArrayList<ProcedureBuilder>();
private SOAPConnectionInfoProvider connProvider;
private WSSoapConnectionInfoProvider connProvider;
private IConnectionProfile connectionProfile;
private XSDSchema[] schemas;

Expand All @@ -116,7 +116,7 @@ public RelationalModelBuilder(Model model, IConnectionProfile profile) throws Sc
factory = org.teiid.designer.metamodels.relational.RelationalPackage.eINSTANCE
.getRelationalFactory();
connectionProfile = profile;
connProvider = new SOAPConnectionInfoProvider();
connProvider = new WSSoapConnectionInfoProvider();
}

public void modelOperations(List<Operation> operations, IContainer container)
Expand Down

0 comments on commit abb5854

Please sign in to comment.