Skip to content

Commit

Permalink
Merge pull request #381 from tejones/teiiddes-2188
Browse files Browse the repository at this point in the history
Teiiddes 2188
  • Loading branch information
blafond committed Jul 1, 2014
2 parents d44e4f4 + 8181bc5 commit b222bfe
Show file tree
Hide file tree
Showing 15 changed files with 207 additions and 199 deletions.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
52 changes: 11 additions & 41 deletions documentation/guides/Teiid_Designer_User_Guide/en-US/importers.xml
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,7 @@
<figure>
<title>Import from Flat File Source</title>
<mediaobject><imageobject>
<imagedata fileref="images/screencaps/teiid-data-file-import-options.png"/>
<imagedata fileref="images/screencaps/teiid-designer-import-options.png"/>
</imageobject></mediaobject>
</figure>
</listitem>
Expand Down Expand Up @@ -667,7 +667,7 @@
<figure>
<title>Import from XML File Source</title>
<mediaobject><imageobject>
<imagedata fileref="images/screencaps/teiid-data-file-import-options.png"/>
<imagedata fileref="images/screencaps/teiid-designer-import-options.png"/>
</imageobject></mediaobject>
</figure>
</listitem>
Expand Down Expand Up @@ -1326,50 +1326,25 @@
</listitem>
<listitem>
<para><emphasis role="bold">Step 2</emphasis> - Select the import
option <emphasis role="bold">Teiid Designer &gt; File Source
(XML) &gt;&gt; Source and View Model</emphasis> and click
option <emphasis role="bold">Teiid Designer &gt; Web Service Source
&gt;&gt; Source and View Model (REST)</emphasis> and click
<emphasis role="bold">Next&gt;</emphasis></para>
<figure>
<title>Import from XML File Source</title>
<title>Import from REST Web Service Source</title>
<mediaobject><imageobject>
<imagedata fileref="images/screencaps/teiid-data-file-import-options.png"/>
<imagedata fileref="images/screencaps/teiid-designer-import-options.png"/>
</imageobject></mediaobject>
</figure>
</listitem>
<listitem>
<para><emphasis role="bold">Step 3</emphasis> - The next page of
the wizard allows selection of the XML Import mode that specifies
whether the XML file is local or remote. The description at the
top describes what operations this wizard will perform. Select
<guilabel>XML file via remote URL</guilabel> and click
<emphasis role="bold">Next&gt;</emphasis></para>
<figure>
<title>XML Import File Options Page</title>
<mediaobject><imageobject>
<imagedata fileref="images/screencaps/import-xml-rest-options.png"/>
</imageobject></mediaobject>
</figure>
</listitem>
<listitem>
<para><emphasis role="bold">Step 4</emphasis> - Select existing
<para><emphasis role="bold">Step 3</emphasis> - Select existing
or previous connection profile from the drop-down selector or
press <guibutton>New...</guibutton> button to launch the
<guilabel>New Connection Profile</guilabel> dialog or <guibutton>
Edit...</guibutton> to modify/change an existing connection
profile prior to selection.</para>
</listitem>
<listitem>
<para><emphasis role="bold">Creating a new REST Connection
Profile</emphasis></para>
<para>If creating a new Connection Profile, choose the REST Web
Services URL option when prompted and then click the <guibutton>
OK</guibutton> button</para>
<figure>
<title>XML Connection Profile Options</title>
<mediaobject><imageobject>
<imagedata fileref="images/screencaps/xml-connection-profile-options.png"/>
</imageobject></mediaobject>
</figure>
<para>Name your new REST Connection Profile and click the
<guibutton>Next &gt;</guibutton></para>
<figure>
Expand All @@ -1380,24 +1355,19 @@
</figure>
<para>Set your REST URL in the Connection URL text field and your
Security Type and credentials, if applicable. There is also an
option to add Request Header parameters. The importer assumes an
option to add URL and Request Header parameters. The importer assumes an
<emphasis role="bold">Accept</emphasis> header value of
<emphasis role="bold">application/xml</emphasis> and a
<emphasis role="bold">Content-Type</emphasis> header value of
<emphasis role="bold">application/xml</emphasis>. These defaults
can be overriden in the <emphasis role="bold">Optional Request
Header Properties</emphasis> section. You can also add any other
header properties required for the service. Click the <guibutton>
header properties required for the service. When adding a parameter you can specify
URI or Query String, depending on what the target service is expecting. Click the <guibutton>
Test Connection</guibutton> button to validate your connection
properties are correct. Click <guibutton>Next &gt;</guibutton> to
see a summary of your properties or click <guibutton>
Finish</guibutton>.</para>
<figure>
<title>REST Service Connection Properties</title>
<mediaobject><imageobject>
<imagedata fileref="images/screencaps/web-service-connection-properties.png"/>
</imageobject></mediaobject>
</figure>
<para>After selecting or creating a new <emphasis role="bold">
Connection Profile</emphasis>, the REST XML result from the
connection profile will be displayed in the <emphasis role="bold">
Expand Down Expand Up @@ -1427,7 +1397,7 @@
</figure>
</listitem>
<listitem>
<para><emphasis role="bold">Step 5</emphasis> - The primary
<para><emphasis role="bold">Step 4</emphasis> - The primary
purpose of this importer is to help you create a view procedure
containing the transformations required to query the user-defined
data file. The panel contains an XML tree view of your result
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ a source model via the 'Modeling > Set Connection Profile' action. This 'Parent
This connection profile is also utilized during the importing of a local XML file (see 'Import... > Teiid Designer > File Source (XML) feature)
WSSoapProfileDetailsWizardPage.descriptionMessage=The URL defined for this connection profile provides the hook to inject the 'Endpoint' property into \
a source model via the 'Modeling > Set Connection Profile' action. This 'Endpoint' value is required by the 'ws' translator.\n\n\
(see 'Import... > Teiid Designer > WSDL File or URL >> Source and View Model (SOAP))
(see 'Import... > Teiid Designer > Web Service Source >> Source and View Model (SOAP))
WSSoapProfileDetailsWizardPage.validatingWsdlMessage=Validating the WSDL ...
WSSoapProfileDetailsWizardPage.validationSuccessfulWsdlMessage=The WSDL has been successfully pinged and validated
WSSoapProfileDetailsWizardPage.validationErrorWsdlMessage=Failed to validate the WSDL
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
pluginProvider = JBoss by Red Hat
pluginName=Designer Generator Web Service UI Plug-in

importWsdlSoapWizard.name = WSDL File or URL >> Source and View Model (SOAP)
importWsdlSoapWizard.name = Web Service Source >> Source and View Model (SOAP)
relationalFromWSDLImportWizard.name = WSDL File or URL >> Source and View Model
relationalFromWSDLImportWizard.description = Create Relational Model from WSDL file or URL via a Data Tools Web Service connection profile.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -49,5 +49,8 @@ teiidMetadataImportWizard.description = Import metadata from Flat File into a ne
teiidXmlImportWizard.name=File Source (XML) >> Source and View Model
teiidXmlImportWizard.description = Import metadata from XML File into a source procedure and view table transformation.

teiidRestImportWizard.name=Web Service Source >> Source and View Model (REST)
teiidRestImportWizard.description = Import metadata from REST web service into a source procedure and view table transformation.

newChildViewTableAction=Table...
newSiblingViewTableAction=Table...
15 changes: 15 additions & 0 deletions plugins/org.teiid.designer.transformation.ui/plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,21 @@
</wizard>
</extension>

<extension
point="org.eclipse.ui.importWizards">
<!-- Teiid REST Metadata Import Wizard -->
<wizard
name="%teiidRestImportWizard.name"
icon="icons/full/ctool16/import_wsdl.gif"
category="org.teiid.designer.ui"
class="org.teiid.designer.transformation.ui.wizards.rest.TeiidRestImportWizard"
id="teiidRestImportWizard">
<description>
%teiidRestImportWizard.description
</description>
</wizard>
</extension>

<extension
id="newChildViewTableAction"
name="%newChildViewTableAction"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1029,8 +1029,6 @@ TeiidXmlConnectionOptionsDialog.xmlUrlProfileOption=XML File URL
TeiidXmlConnectionOptionsDialog.restProfileOption=REST Web Services URL
TeiidXmlConnectionOptionsDialog.xmlUrlProfileOption.message= \
Enables connections to XML documents that are either file or URL-based.
TeiidXmlConnectionOptionsDialog.restProfileOption.message= \
Enables connections to any REST-based web service including OData services such as SAP NetWeaver Gateway.

####################### DefineViewTableDialog ############
DefineViewTableDialog.title=Define View Table
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ public class TeiidMetadataImportInfo implements UiConstants {
public static final int FILE_MODE_FLAT_FILE_URL = 1;
public static final int FILE_MODE_TEIID_XML_FILE = 2;
public static final int FILE_MODE_TEIID_XML_URL = 3;
public static final int REST_MODE_URL = 4;

private static final String I18N_PREFIX = I18nUtil.getPropertyPrefix(TeiidMetadataImportInfo.class);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ public void init(IWorkbench workbench, IStructuredSelection inputSelection) {

// Construct the business object
this.filesInfo = new TeiidMetadataImportInfo();
this.filesInfo.setFileMode(TeiidMetadataImportInfo.FILE_MODE_FLAT_FILE_LOCAL);
this.filesInfo.setFileMode(TeiidMetadataImportInfo.REST_MODE_URL);

// Set initial view model and view model location values if present from selection
if( isViewRelationalModel ) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,153 @@
/*
* JBoss, Home of Professional Open Source.
*
* See the LEGAL.txt file distributed with this work for information regarding copyright ownership and licensing.
*
* See the AUTHORS.txt file distributed with this work for a full listing of individual contributors.
*/
package org.teiid.designer.transformation.ui.wizards.rest;

import java.util.Properties;

import org.eclipse.core.resources.IContainer;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.ui.IWorkbench;
import org.teiid.core.designer.util.I18nUtil;
import org.teiid.designer.transformation.ui.UiPlugin;
import org.teiid.designer.transformation.ui.wizards.file.TeiidMetadataImportInfo;
import org.teiid.designer.transformation.ui.wizards.file.TeiidMetadataImportViewModelPage;
import org.teiid.designer.transformation.ui.wizards.file.TeiidMetadataImportWizard;
import org.teiid.designer.transformation.ui.wizards.xmlfile.TeiidXmlFileImportProcessor;
import org.teiid.designer.transformation.ui.wizards.xmlfile.TeiidXmlFileInfo;
import org.teiid.designer.transformation.ui.wizards.xmlfile.TeiidXmlImportOptionsPage;
import org.teiid.designer.transformation.ui.wizards.xmlfile.TeiidXmlImportSourcePage;
import org.teiid.designer.transformation.ui.wizards.xmlfile.TeiidXmlImportXmlConfigurationPage;
import org.teiid.designer.ui.common.util.UiUtil;
import org.teiid.designer.ui.viewsupport.DesignerPropertiesUtil;
import org.teiid.designer.ui.viewsupport.IPropertiesContext;


/**
* @since 8.0
*/
public class TeiidRestImportWizard extends TeiidMetadataImportWizard {

private static final String I18N_PREFIX = I18nUtil.getPropertyPrefix(TeiidRestImportWizard.class);

private static final String TITLE = getString("title"); //$NON-NLS-1$
private static final ImageDescriptor IMAGE = UiPlugin.getDefault().getImageDescriptor(Images.IMPORT_TEIID_METADATA);

private static String getString( final String id ) {
return Util.getString(I18N_PREFIX + id);
}

TeiidXmlImportOptionsPage optionsPage;

TeiidXmlImportSourcePage sourcePage;
//
// private Properties designerProperties;

/**
*
*/
public TeiidRestImportWizard() {
super(UiPlugin.getDefault(), TITLE, IMAGE);
}

@Override
public void init(IWorkbench workbench, IStructuredSelection inputSelection) {
super.init(workbench, inputSelection);

getFileInfo().setFileMode(TeiidMetadataImportInfo.REST_MODE_URL);
}

@Override
public void addPages() {
// this.optionsPage = new TeiidXmlImportOptionsPage(getFileInfo());
// addPage(optionsPage);

this.sourcePage = new TeiidXmlImportSourcePage(getFileInfo());
addPage(sourcePage);

TeiidXmlImportXmlConfigurationPage sqlPage = new TeiidXmlImportXmlConfigurationPage(getFileInfo());
addPage(sqlPage);

TeiidMetadataImportViewModelPage viewModelPage = new TeiidMetadataImportViewModelPage(getFileInfo());
addPage(viewModelPage);
}

@Override
public boolean finish() {
final TeiidXmlFileImportProcessor processor = new TeiidXmlFileImportProcessor(getFileInfo(), this.getShell());

UiUtil.runInSwtThread(new Runnable() {
@Override
public void run() {
processor.execute();
}
}, false);

// Update Properties to include the created source and view Models
if( getDesignerProperties() != null ) {
DesignerPropertiesUtil.setSourceModelName(getDesignerProperties(), getFileInfo().getSourceModelName());
DesignerPropertiesUtil.setViewModelName(getDesignerProperties(), getFileInfo().getViewModelName());
// Should be one info object
if( ! getFileInfo().getXmlFileInfos().isEmpty() && getFileInfo().getXmlFileInfos().size() == 1 ) {
TeiidXmlFileInfo info = this.getFileInfo().getXmlFileInfos().iterator().next();
DesignerPropertiesUtil.setPreviewTargetModelName(getDesignerProperties(), getFileInfo().getViewModelName());
DesignerPropertiesUtil.setPreviewTargetObjectName(getDesignerProperties(), info.getViewTableName());
}
}

return true;
}

/**
* @param option the file option
*/
public void setFileOption(int option) {
getFileInfo().setFileMode(option);
}

// @Override
// public void setProperties(Properties properties) {
// this.designerProperties = properties;
// }

@Override
protected void updateForProperties() {
Properties desProps = getDesignerProperties();
if( desProps == null || desProps.isEmpty() ) {
return;
}

// Check for Sources and View Folder from property definitions
IContainer project = DesignerPropertiesUtil.getProject(getDesignerProperties());
IContainer srcFolderResrc = DesignerPropertiesUtil.getSourcesFolder(desProps);
IContainer viewFolderResrc = DesignerPropertiesUtil.getViewsFolder(desProps);
if (srcFolderResrc != null) {
getFileInfo().setSourceModelLocation(srcFolderResrc.getFullPath());
} else if( project != null ) {
getFileInfo().setSourceModelLocation(project.getFullPath());
}
if (viewFolderResrc != null) {
getFileInfo().setViewModelLocation(viewFolderResrc.getFullPath());
} else if( project != null ) {
getFileInfo().setViewModelLocation(project.getFullPath());
}

// Get Connection Profile from property definitions
String profileName = DesignerPropertiesUtil.getConnectionProfileName(desProps);
if( profileName != null && !profileName.isEmpty() ) {
// Set properties - needs later to determine the connection profile
sourcePage.setDesignerProperties(desProps);
}

this.optionsPage.setDesignerProperties(desProps);

if( !openProjectExists()) {
DesignerPropertiesUtil.setProjectStatus(desProps, IPropertiesContext.NO_OPEN_PROJECT);
}
}
}

0 comments on commit b222bfe

Please sign in to comment.