[teiid-commits] teiid SVN: r930 - in trunk: console/src/main/java/com/metamatrix/console/ui/views/vdb and 10 other directories.
teiid-commits at lists.jboss.org
teiid-commits at lists.jboss.org
Wed May 13 14:07:37 EDT 2009
Author: tejones
Date: 2009-05-13 14:07:37 -0400 (Wed, 13 May 2009)
New Revision: 930
Added:
trunk/common-core/src/main/java/com/metamatrix/common/util/WSDLServletUtil.java
trunk/console/src/main/java/com/metamatrix/console/ui/views/vdb/WSDLWizardRunner.java
trunk/console/src/main/java/com/metamatrix/console/ui/views/vdb/WebServicesPanel.java
Removed:
trunk/soap/src/main/java/com/metamatrix/soap/util/WSDLServletUtil.java
Modified:
trunk/console/src/main/java/com/metamatrix/console/ui/views/vdb/UDDIConfigurationsDialog.java
trunk/console/src/main/java/com/metamatrix/console/ui/views/vdb/VdbMainPanel.java
trunk/console/src/main/java/com/metamatrix/console/util/SavedUDDIRegistryInfo.java
trunk/console/src/main/java/com/metamatrix/console/util/StaticProperties.java
trunk/console/src/main/resources/com/metamatrix/console/i18n.properties
trunk/soap/src/main/java/com/metamatrix/soap/handler/ActionUpdateHandler.java
trunk/soap/src/main/java/com/metamatrix/soap/service/DataServiceWebServiceImpl.java
trunk/soap/src/main/java/com/metamatrix/soap/servlet/MMDiscoverWSDLServlet.java
trunk/soap/src/main/java/com/metamatrix/soap/servlet/MMGetVDBResourceServlet.java
trunk/soap/src/main/java/com/metamatrix/soap/servlet/MMGetWSDLServlet.java
trunk/soap/src/main/java/com/metamatrix/soap/servlet/WSDLURLGenerator.java
trunk/soap/src/main/java/com/metamatrix/soap/util/EndpointUriTranslatorStrategyImpl.java
trunk/soap/src/test/java/com/metamatrix/soap/handler/TestActionUpdateHandler.java
trunk/soap/src/test/java/com/metamatrix/soap/service/TestDataServiceWebServiceImpl.java
trunk/soap/src/test/java/com/metamatrix/soap/servlet/TestMMGetVDBResourceServlet.java
trunk/soap/src/test/java/com/metamatrix/soap/util/TestWSDLServletUtil.java
Log:
TEIID-482 Added UDDI Publishing and re-factored WSDLServletUtil to common-core so that teiid-console and teiid-soap could access it.
Copied: trunk/common-core/src/main/java/com/metamatrix/common/util/WSDLServletUtil.java (from rev 905, trunk/soap/src/main/java/com/metamatrix/soap/util/WSDLServletUtil.java)
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/util/WSDLServletUtil.java (rev 0)
+++ trunk/common-core/src/main/java/com/metamatrix/common/util/WSDLServletUtil.java 2009-05-13 18:07:37 UTC (rev 930)
@@ -0,0 +1,225 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+
+package com.metamatrix.common.util;
+
+import java.io.UnsupportedEncodingException;
+import java.net.URLEncoder;
+import java.text.MessageFormat;
+import java.util.Iterator;
+import java.util.List;
+
+/**
+ * Constants pertaining to WSDL servlet execution.
+ *
+ * @since 4.2
+ */
+
+public class WSDLServletUtil {
+
+ /**
+ * General keys
+ */
+ public static final String SERVER_URL_KEY = "ServerURL"; //$NON-NLS-1$
+
+ public static final String SECURE_PROTOCOL = "Secure"; //$NON-NLS-1$
+
+ public static final String VDB_NAME_KEY = "VDBName"; //$NON-NLS-1$
+
+ public static final String VDB_VERSION_KEY = "VDBVersion"; //$NON-NLS-1$
+
+ public static final String ADD_PROPS = "AdditionalProperties"; //$NON-NLS-1$
+
+ public static final String TXN_AUTO_WRAP = "txnAutoWrap"; //$NON-NLS-1$
+
+ public static final String ADD_EXEC_PROPS = "AddExecProperties"; //$NON-NLS-1$
+
+ public static final String MM_WEBSERVICE_QUERY_TIMEOUT = "com.metamatrix.webservice.querytimeout"; //$NON-NLS-1$
+
+ public static final String DISCOVERED_WSDL = "discovered_wsdl"; //$NON-NLS-1$
+
+ /*
+ * This is the parameter that will tell this servlet when the web service endpoint as defined in WSDL served up by this
+ * servlet will use the HTTP vs HTTPS protocol.
+ */
+ public static final String HTTP_TYPE_PARAMETER_KEY = "httptype"; //$NON-NLS-1$
+
+ /*
+ * This is the value of the httptype URL request param that will indicate that the returned WSDL should have an http endpoint
+ * instead of an https endpoint.
+ */
+ public static final String HTTP_PARAMETER_VALUE = "http"; //$NON-NLS-1$
+
+ /*
+ * Static contant representing the standard http protocol.
+ */
+ public static final String HTTP = "http"; //$NON-NLS-1$
+
+ /**
+ * Static contant representing the secure http protocol.
+ */
+ public static final String HTTPS = "https"; //$NON-NLS-1$
+
+ /**
+ * Default content type for the VDBResourceServlet
+ */
+ public static final String DEFAULT_CONTENT_TYPE = "text/html"; //$NON-NLS-1$
+
+ /**
+ * XML content type for the VDBResourceServlet
+ */
+ public static final String XML_CONTENT_TYPE = "text/xml"; //$NON-NLS-1$
+
+ /**
+ * WSDL URL Generator keys
+ */
+ public static final String MMSERVER_HOST_PORT_KEY = "MMServerHostAndPort"; //$NON-NLS-1$
+
+ public static final String TARGET_HOST_KEY = "TargetHost"; //$NON-NLS-1$
+
+ public static final String TARGET_PORT_KEY = "TargetPort"; //$NON-NLS-1$
+
+ public static final String SERVLET_PATH = "/servlet/ArtifactDocumentService"; //$NON-NLS-1$
+
+ public static final String SQLQUERYWEBSERVICE_WSDL_PATH = "/services/SqlQueryWebService?wsdl"; //$NON-NLS-1$
+
+ public static final String GENERATED_WSDL_NAME = "MetaMatrixDataServices"; //$NON-NLS-1$
+
+ public static final String GENERATED_WSDL_FILENAME = GENERATED_WSDL_NAME + ".wsdl"; //$NON-NLS-1$
+
+ public static final String COLON = ":"; //$NON-NLS-1$
+
+ public static final String SLASH = "/"; //$NON-NLS-1$
+
+ public static final String DOUBLE_SLASH = "//"; //$NON-NLS-1$
+
+ public static final String AMP = "&"; //$NON-NLS-1$
+
+ public static final String QUESTION_MARK = "?"; //$NON-NLS-1$
+
+ public static final String EQUALS = "="; //$NON-NLS-1$
+
+ public static final String COMMA = ","; //$NON-NLS-1$
+
+ private static final String SQLQUERYWEBSERVICE_URL_FORMAT = "{0}://{1}:{2}/{3}"; //$NON-NLS-1$
+
+ /*
+ * this default value is based on Tomcat's default value in its server.xml file. This value can be overridden by setting the
+ * com.metamatrix.webservice.dataservice.httpsport System property for the VM that this servlet is running in.
+ */
+ private static final String DEFAULT_HTTPS_PORT = "8443"; //$NON-NLS-1$
+
+ private static final String DEFAULT_HTTP_PORT = "8080"; //$NON-NLS-1$
+
+ private static final String HTTPS_PORT_PROPERTY_KEY = "com.metamatrix.webservice.dataservice.httpsport"; //$NON-NLS-1$
+
+ private static final String HTTP_PORT_PROPERTY_KEY = "com.metamatrix.webservice.dataservice.httpport"; //$NON-NLS-1$
+
+ /**
+ * Returns the formatted url from the supplied info
+ *
+ * @param scheme the server scheme
+ * @param host the server host name
+ * @param port the server port
+ * @param appContext the context of this application to use in the WSDL url
+ * @param serverURLs the list of server url info, first url is full url including protocol. Subsequent items are just the
+ * host:port strings.
+ * @param vdbName the vdb name
+ * @param vdbVersion the vdb version number
+ */
+ public static String formatURL( String scheme,
+ String host,
+ String port,
+ String appContext,
+ List serverURLs,
+ String vdbName,
+ String vdbVersion ) {
+
+ StringBuffer result = new StringBuffer();
+ try {
+ boolean hasPort = true;
+ boolean hasVDBVersion = true;
+
+ if (port == null || port.length() == 0) {
+ hasPort = false;
+ }
+
+ if (vdbVersion == null || vdbVersion.trim().length() == 0) {
+ hasVDBVersion = false;
+ }
+
+ result.append(scheme).append(COLON).append(DOUBLE_SLASH).append(host);
+
+ if (hasPort) {
+ result.append(COLON).append(port);
+ }
+
+ result.append(appContext).append(SERVLET_PATH).append(SLASH).append(GENERATED_WSDL_FILENAME);
+ result.append(QUESTION_MARK).append(SERVER_URL_KEY).append(EQUALS);
+ // Append comma-delimited server urls
+ Iterator iter = serverURLs.iterator();
+ while (iter.hasNext()) {
+ String serverURL = (String)iter.next();
+ result.append(serverURL);
+ // If there is another url coming, add an encoded comma
+ if (iter.hasNext()) {
+ result.append(URLEncoder.encode(COMMA, "UTF-8")); //$NON-NLS-1$
+ }
+ }
+ result.append(AMP).append(VDB_NAME_KEY).append(EQUALS).append(vdbName);
+ if (hasVDBVersion) {
+ result.append(AMP).append(VDB_VERSION_KEY).append(EQUALS).append(vdbVersion);
+ }
+
+ } catch (UnsupportedEncodingException err) {
+ // ignore
+ }
+
+ return result.toString();
+ }
+
+ /**
+ * Returns the formatted wsdl url for the SqlQueryWebService
+ *
+ * @param server - server name
+ * @param appContext the context of this application to use in the WSDL url
+ * @param secure - secure ssl (true) or non-secure (false)
+ * @return wsdlUrl - String
+ * @since 4.3
+ */
+ public static String getSqlQueryWebServiceUrl( final String server,
+ String appContext,
+ final boolean secure ) {
+
+ appContext=appContext.replace("/",""); //$NON-NLS-1$ //$NON-NLS-2$
+ return MessageFormat.format(SQLQUERYWEBSERVICE_URL_FORMAT, new Object[] {secure ? HTTPS : HTTP, server,
+ secure ? getHttpsPort() : getHttpPort(), appContext+SQLQUERYWEBSERVICE_WSDL_PATH});
+ }
+
+ public static final String getHttpsPort() {
+ return System.getProperty(HTTPS_PORT_PROPERTY_KEY, DEFAULT_HTTPS_PORT);
+ }
+
+ public static final String getHttpPort() {
+ return System.getProperty(HTTP_PORT_PROPERTY_KEY, DEFAULT_HTTP_PORT);
+ }
+}
Property changes on: trunk/common-core/src/main/java/com/metamatrix/common/util/WSDLServletUtil.java
___________________________________________________________________
Name: svn:mergeinfo
+
Modified: trunk/console/src/main/java/com/metamatrix/console/ui/views/vdb/UDDIConfigurationsDialog.java
===================================================================
--- trunk/console/src/main/java/com/metamatrix/console/ui/views/vdb/UDDIConfigurationsDialog.java 2009-05-13 17:45:21 UTC (rev 929)
+++ trunk/console/src/main/java/com/metamatrix/console/ui/views/vdb/UDDIConfigurationsDialog.java 2009-05-13 18:07:37 UTC (rev 930)
@@ -74,10 +74,10 @@
"General.Remove"); //$NON-NLS-1$
private final static String CONFIG_NAME = ConsolePlugin.Util.getString(
"UDDIConfigurationsDialog.configName") + ':'; //$NON-NLS-1$
- private final static String HOST = ConsolePlugin.Util.getString(
- "UDDIConfigurationsDialog.host") + ':'; //$NON-NLS-1$
- private final static String PORT = ConsolePlugin.Util.getString(
- "UDDIConfigurationsDialog.port") + ':'; //$NON-NLS-1$
+ private final static String INQUIRY_URL = ConsolePlugin.Util.getString(
+ "UDDIConfigurationsDialog.uddiInquiryUrl") + ':'; //$NON-NLS-1$
+ private final static String PUBLISH_URL = ConsolePlugin.Util.getString(
+ "UDDIConfigurationsDialog.uddiPublishUrl") + ':'; //$NON-NLS-1$
private final static String USER_NAME = ConsolePlugin.Util.getString(
"UDDIConfigurationsDialog.userName") + ':'; //$NON-NLS-1$
private final static String NOTE_LINE_1 = ConsolePlugin.Util.getString(
@@ -103,8 +103,8 @@
private JButton okButton;
private JButton cancelButton;
private JTextField nameField;
- private JTextField hostField;
- private JTextField portField;
+ private JTextField inquiryUrlField;
+ private JTextField publishUrlField;
private JTextField userField;
private SavedUDDIRegistryInfo removedItem = null;
private int curState = NO_STATE;
@@ -184,13 +184,13 @@
textFieldsPanel.add(nameLabel);
textFieldsLayout.setConstraints(nameLabel, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0,
GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
- JLabel hostLabel = new LabelWidget(HOST);
- textFieldsPanel.add(hostLabel);
- textFieldsLayout.setConstraints(hostLabel, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0,
+ JLabel inquiryUrlLabel = new LabelWidget(INQUIRY_URL);
+ textFieldsPanel.add(inquiryUrlLabel);
+ textFieldsLayout.setConstraints(inquiryUrlLabel, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0,
GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
- JLabel portLabel = new LabelWidget(PORT);
- textFieldsPanel.add(portLabel);
- textFieldsLayout.setConstraints(portLabel, new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0,
+ JLabel publishUrlLabel = new LabelWidget(PUBLISH_URL);
+ textFieldsPanel.add(publishUrlLabel);
+ textFieldsLayout.setConstraints(publishUrlLabel, new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0,
GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
JLabel userLabel = new LabelWidget(USER_NAME);
textFieldsPanel.add(userLabel);
@@ -213,17 +213,17 @@
textFieldsPanel.add(nameField);
textFieldsLayout.setConstraints(nameField, new GridBagConstraints(1, 0, 1, 1, 1.0, 0.0,
GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 2, 0, 0), 0, 0));
- hostField = new TextFieldWidget();
- hostField.getDocument().addDocumentListener(docListener);
- hostField.setEnabled(false);
- textFieldsPanel.add(hostField);
- textFieldsLayout.setConstraints(hostField, new GridBagConstraints(1, 1, 1, 1, 1.0, 0.0,
+ inquiryUrlField = new TextFieldWidget();
+ inquiryUrlField.getDocument().addDocumentListener(docListener);
+ inquiryUrlField.setEnabled(false);
+ textFieldsPanel.add(inquiryUrlField);
+ textFieldsLayout.setConstraints(inquiryUrlField, new GridBagConstraints(1, 1, 1, 1, 1.0, 0.0,
GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 2, 0, 0), 0, 0));
- portField = new TextFieldWidget();
- portField.getDocument().addDocumentListener(docListener);
- portField.setEnabled(false);
- textFieldsPanel.add(portField);
- textFieldsLayout.setConstraints(portField, new GridBagConstraints(1, 2, 1, 1, 1.0, 0.0,
+ publishUrlField = new TextFieldWidget();
+ publishUrlField.getDocument().addDocumentListener(docListener);
+ publishUrlField.setEnabled(false);
+ textFieldsPanel.add(publishUrlField);
+ textFieldsLayout.setConstraints(publishUrlField, new GridBagConstraints(1, 2, 1, 1, 1.0, 0.0,
GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 2, 0, 0), 0, 0));
userField = new TextFieldWidget();
userField.getDocument().addDocumentListener(docListener);
@@ -301,10 +301,10 @@
private void textFieldChanged() {
boolean newConfig = (curState == ADDING);
String configName = nameField.getText().trim();
- String host = hostField.getText().trim();
- String port = portField.getText().trim();
+ String inquiryUrl = inquiryUrlField.getText().trim();
+ String publishUrl = publishUrlField.getText().trim();
String user = userField.getText().trim();
- boolean entriesValid = isValidConfig(configName, host, port, user, newConfig);
+ boolean entriesValid = isValidConfig(configName, inquiryUrl, publishUrl, user, newConfig);
okButton.setEnabled(entriesValid);
}
@@ -339,10 +339,10 @@
case EDITING:
SavedUDDIRegistryInfo item = getSelectedItem();
String configName = item.getName();
- String host = hostField.getText().trim();
- String port = portField.getText().trim();
+ String inquiryUrl = inquiryUrlField.getText().trim();
+ String publishUrl = publishUrlField.getText().trim();
String user = userField.getText().trim();
- SavedUDDIRegistryInfo editedItem = new SavedUDDIRegistryInfo(configName, user, host, port);
+ SavedUDDIRegistryInfo editedItem = new SavedUDDIRegistryInfo(configName, user, inquiryUrl, publishUrl);
if (item.equals(editedItem)) {
handler.unchangedConfiguration(item);
} else {
@@ -351,10 +351,10 @@
break;
case ADDING:
configName = nameField.getText().trim();
- host = hostField.getText().trim();
- port = portField.getText().trim();
+ inquiryUrl = inquiryUrlField.getText().trim();
+ publishUrl = publishUrlField.getText().trim();
user = userField.getText().trim();
- SavedUDDIRegistryInfo newItem = new SavedUDDIRegistryInfo(configName, user, host, port);
+ SavedUDDIRegistryInfo newItem = new SavedUDDIRegistryInfo(configName, user, inquiryUrl, publishUrl);
handler.addedConfiguration(newItem);
break;
case REMOVING:
@@ -377,10 +377,10 @@
return found;
}
- private boolean isValidConfig(String configName, String host, String port, String userName,
+ private boolean isValidConfig(String configName, String inquiryUrl, String publishUrl, String userName,
boolean newConfig) {
boolean valid = false;
- if ((configName.length() > 0) && (host.length() > 0) && (port.length() > 0) && (userName.length() >
+ if ((configName.length() > 0) && (inquiryUrl.length() > 0) && (publishUrl.length() > 0) && (userName.length() >
0)) {
if (newConfig) {
if (!isExistingConfigName(configName)) {
@@ -396,14 +396,14 @@
private void clearText() {
String empty = StringUtil.Constants.EMPTY_STRING;
nameField.setText(empty);
- hostField.setText(empty);
- portField.setText(empty);
+ inquiryUrlField.setText(empty);
+ publishUrlField.setText(empty);
userField.setText(empty);
}
private void enableText(boolean includingName) {
- hostField.setEnabled(true);
- portField.setEnabled(true);
+ inquiryUrlField.setEnabled(true);
+ publishUrlField.setEnabled(true);
userField.setEnabled(true);
if (includingName) {
nameField.setEnabled(true);
@@ -412,8 +412,8 @@
private void disableText() {
nameField.setEnabled(false);
- hostField.setEnabled(false);
- portField.setEnabled(false);
+ inquiryUrlField.setEnabled(false);
+ publishUrlField.setEnabled(false);
userField.setEnabled(false);
}
@@ -431,8 +431,8 @@
clearText();
} else {
nameField.setText(item.getName());
- hostField.setText(item.getHost());
- portField.setText(item.getPort());
+ inquiryUrlField.setText(item.getInquiryUrl());
+ publishUrlField.setText(item.getPublishUrl());
userField.setText(item.getUserName());
}
}
Modified: trunk/console/src/main/java/com/metamatrix/console/ui/views/vdb/VdbMainPanel.java
===================================================================
--- trunk/console/src/main/java/com/metamatrix/console/ui/views/vdb/VdbMainPanel.java 2009-05-13 17:45:21 UTC (rev 929)
+++ trunk/console/src/main/java/com/metamatrix/console/ui/views/vdb/VdbMainPanel.java 2009-05-13 18:07:37 UTC (rev 930)
@@ -118,6 +118,7 @@
private static final String TREE_TAB_TITLE = "Metadata Tree"; //$NON-NLS-1$
private static final String CONNBIND_TAB_TITLE = "Connector Bindings"; //$NON-NLS-1$
private static final String ENTITLEMENTS_TAB_TITLE = "Roles"; //$NON-NLS-1$
+ private static final String WEB_SERVICES_TAB_TITLE = "Web Services"; //$NON-NLS-1$
private static final String MATERIALIZATION_TAB_TITLE = "Materialization"; //$NON-NLS-1$
private static final String ACTIVE_DEFAULT_DISPLAY_LABEL = "Active (Default)"; //$NON-NLS-1$
@@ -248,6 +249,7 @@
pnlBindings = new VdbConnBindPanel(connection);
pnlEntitlements = new VdbEntitlementsPanel(connection);
javax.swing.JPanel pnlMaterialization = new MaterializationPanel(connection);
+ javax.swing.JPanel pnlWebServices = new WebServicesPanel(connection);
javax.swing.JPanel pnlOps = new javax.swing.JPanel();
btnImportVDB = new ButtonWidget();
setup(MenuEntry.ACTION_MENUITEM, btnImportVDB, actionImportVDB);
@@ -292,6 +294,7 @@
tpnDetails.addTab(TREE_TAB_TITLE, pnlTree);
tpnDetails.addTab(CONNBIND_TAB_TITLE, pnlBindings);
tpnDetails.addTab(ENTITLEMENTS_TAB_TITLE, pnlEntitlements);
+ tpnDetails.addTab(WEB_SERVICES_TAB_TITLE, pnlWebServices);
tpnDetails.addTab(MATERIALIZATION_TAB_TITLE, pnlMaterialization);
tpnDetails.setSelectedIndex(0);
pnlBottom.add(tpnDetails);
Added: trunk/console/src/main/java/com/metamatrix/console/ui/views/vdb/WSDLWizardRunner.java
===================================================================
--- trunk/console/src/main/java/com/metamatrix/console/ui/views/vdb/WSDLWizardRunner.java (rev 0)
+++ trunk/console/src/main/java/com/metamatrix/console/ui/views/vdb/WSDLWizardRunner.java 2009-05-13 18:07:37 UTC (rev 930)
@@ -0,0 +1,1139 @@
+/*
+ * Copyright � 2000-2005 MetaMatrix, Inc. All rights reserved.
+ */
+package com.metamatrix.console.ui.views.vdb;
+
+import java.awt.Dimension;
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
+import java.awt.GridLayout;
+import java.awt.Insets;
+import java.awt.Toolkit;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.WindowAdapter;
+import java.awt.event.WindowEvent;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Iterator;
+import java.util.List;
+
+import javax.swing.DefaultComboBoxModel;
+import javax.swing.JButton;
+import javax.swing.JComboBox;
+import javax.swing.JDialog;
+import javax.swing.JLabel;
+import javax.swing.JOptionPane;
+import javax.swing.JPanel;
+import javax.swing.JPasswordField;
+import javax.swing.JScrollPane;
+import javax.swing.JTable;
+import javax.swing.JTextArea;
+import javax.swing.JTextField;
+import javax.swing.event.DocumentEvent;
+import javax.swing.event.DocumentListener;
+import javax.swing.event.ListSelectionEvent;
+import javax.swing.event.ListSelectionListener;
+
+import org.uddi4j.response.BusinessInfo;
+import org.uddi4j.response.BusinessList;
+
+import com.metamatrix.common.config.ResourceNames;
+import com.metamatrix.common.config.api.Configuration;
+import com.metamatrix.common.config.api.ConfigurationID;
+import com.metamatrix.common.config.api.SharedResource;
+import com.metamatrix.common.util.WSDLServletUtil;
+import com.metamatrix.console.ConsolePlugin;
+import com.metamatrix.console.models.ConfigurationManager;
+import com.metamatrix.console.ui.layout.ConsoleMainFrame;
+import com.metamatrix.console.ui.util.BasicWizardSubpanelContainer;
+import com.metamatrix.console.ui.util.IconComponent;
+import com.metamatrix.console.ui.util.WizardInterface;
+import com.metamatrix.console.ui.util.WizardInterfaceImpl;
+import com.metamatrix.console.ui.util.property.Icons;
+import com.metamatrix.console.util.ExceptionUtility;
+import com.metamatrix.console.util.SavedUDDIRegistryInfo;
+import com.metamatrix.console.util.StaticProperties;
+import com.metamatrix.console.util.StaticUtilities;
+import com.metamatrix.core.util.StringUtil;
+import com.metamatrix.toolbox.ui.widget.ButtonWidget;
+import com.metamatrix.toolbox.ui.widget.LabelWidget;
+import com.metamatrix.toolbox.ui.widget.TableWidget;
+import com.metamatrix.toolbox.ui.widget.TextFieldWidget;
+import com.metamatrix.toolbox.ui.widget.table.DefaultTableModel;
+import com.metamatrix.uddi.exception.MMUddiException;
+import com.metamatrix.uddi.util.MMUddiHelper;
+import com.metamatrix.uddi.util.UddiHelper;
+
+/**
+ * @since 5.5.3
+ */
+public class WSDLWizardRunner {
+ private final static int CONFIG_PANEL_STEP_NUM = 1;
+ private final static int BUSINESS_PANEL_STEP_NUM = 2;
+ private final static int WSDL_URL_PANEL_STEP_NUM = 3;
+ private final static int RESULTS_PANEL_STEP_NUM = 4;
+
+ private final static String NO_BUSINESSES = ConsolePlugin.Util.getString("WSDLWizardRunner.noBusinesses"); //$NON-NLS-1$
+ private final static String NO_BUSINESSES_MSG = ConsolePlugin.Util.getString("WSDLWizardRunner.noBusinessesMsg"); //$NON-NLS-1$
+ // private final static String HTTP = "http"; //$NON-NLS-1$
+
+ private Configuration currentConfig;
+ private ConfigurationManager configMgr;
+ private boolean publishing;
+ private String vdbName;
+ private String vdbVersion;
+ private SelectUDDIConfigurationPanel configPanel;
+ private SelectBusinessPanel businessPanel;
+ private CreateWSDLURLElementsPanel wsdlURLPanel;
+ private ResultsPanel resultsPanel;
+ private JPanel currentPanel;
+ private boolean cancelled = false;
+ private boolean finished = false;
+ private WSDLWizardPanel wizardPanel = null;
+ private WSDLWizardPanelDialog dialog;
+ private UddiHelper uddiAPI = null;
+ private String password = StringUtil.Constants.EMPTY_STRING;
+ private BusinessList /* <BusinessEntity> */businesses = null;
+ private boolean haveShownWSDLURLPanel = false;
+ private static String DEFAULT_WEBSERVICE_CONTEXT = "/metamatrix-soap";
+
+
+ public WSDLWizardRunner( String vdbName,
+ String vdbVersion,
+ Configuration currConfig,
+ ConfigurationManager configMgr,
+ boolean publishing ) {
+ super();
+ this.vdbName = vdbName;
+ this.vdbVersion = vdbVersion;
+ this.currentConfig = currConfig;
+ this.configMgr = configMgr;
+ this.publishing = publishing;
+ }
+
+ public void go() {
+ wizardPanel = new WSDLWizardPanel(this);
+ configPanel = new SelectUDDIConfigurationPanel(wizardPanel, CONFIG_PANEL_STEP_NUM);
+ businessPanel = new SelectBusinessPanel(wizardPanel, BUSINESS_PANEL_STEP_NUM);
+ wsdlURLPanel = new CreateWSDLURLElementsPanel(wizardPanel, WSDL_URL_PANEL_STEP_NUM);
+ resultsPanel = new ResultsPanel(wizardPanel, publishing, RESULTS_PANEL_STEP_NUM);
+ wizardPanel.addPage(configPanel);
+ wizardPanel.addPage(businessPanel);
+ wizardPanel.addPage(wsdlURLPanel);
+ wizardPanel.addPage(resultsPanel);
+ wizardPanel.getNextButton().setEnabled(false);
+ currentPanel = configPanel;
+ wizardPanel.getCancelButton().addActionListener(new ActionListener() {
+ public void actionPerformed( ActionEvent ev ) {
+ cancelPressed();
+ }
+ });
+ wizardPanel.getFinishButton().addActionListener(new ActionListener() {
+ public void actionPerformed( ActionEvent ev ) {
+ finishPressed();
+ }
+ });
+ dialog = new WSDLWizardPanelDialog(this, wizardPanel, publishing);
+ dialog.setVisible(true);
+ if (finished && (!cancelled)) {
+ // Insert any post-processing code here
+ }
+ }
+
+ public void dialogWindowClosing() {
+ cancelled = true;
+ }
+
+ public void cancelPressed() {
+ dialog.cancelPressed();
+ cancelled = true;
+ }
+
+ public void finishPressed() {
+ dialog.finishPressed();
+ finished = true;
+ }
+
+ public boolean showNextPage() {
+ boolean goingToNextPage = true;
+ if (currentPanel == configPanel) {
+ if (uddiAPI == null) {
+ uddiAPI = new MMUddiHelper();
+ }
+ SavedUDDIRegistryInfo config = configPanel.getSelectedConfig();
+ UDDIPasswordDialog passwordDialog = new UDDIPasswordDialog(config.getName());
+ passwordDialog.setVisible(true);
+ password = passwordDialog.getPassword();
+ if (password == null) {
+ goingToNextPage = false;
+ } else {
+ String inquiryUrl = config.getInquiryUrl();
+ String publishUrl = config.getPublishUrl();
+ businesses = null;
+ try {
+ StaticUtilities.startWait(dialog.getContentPane());
+ businesses = uddiAPI.getAllBusinesses(inquiryUrl, publishUrl, 100);
+ } catch (MMUddiException ex) {
+ StaticUtilities.endWait(dialog.getContentPane());
+ displayInitialUDDIAccessError(ex);
+ goingToNextPage = false;
+ }
+ if (goingToNextPage) {
+ StaticUtilities.endWait(dialog.getContentPane());
+ if (businesses.getBusinessInfos().size() == 0) {
+ StaticUtilities.displayModalDialogWithOK(NO_BUSINESSES, NO_BUSINESSES_MSG, JOptionPane.WARNING_MESSAGE);
+ goingToNextPage = false;
+ }
+ }
+ if (goingToNextPage) {
+ businessPanel.setBusinesses(businesses);
+ currentPanel = businessPanel;
+ businessPanel.setForwardButtonEnabling();
+ }
+ }
+ } else if (currentPanel == businessPanel) {
+ // Insert here any checks which might prevent proceeding to next page
+ if (goingToNextPage) {
+ if (!haveShownWSDLURLPanel) {
+ ConfigurationID configID = (ConfigurationID)currentConfig.getID();
+ wsdlURLPanel.setdefaultWebServerHost("localhost");
+ wsdlURLPanel.setDefaultWebServerPort("8080");
+ wizardPanel.getNextButton().setEnabled(true);
+ haveShownWSDLURLPanel = true;
+ }
+ currentPanel = wsdlURLPanel;
+ wsdlURLPanel.setForwardButtonEnabling();
+ }
+ } else if (currentPanel == wsdlURLPanel) {
+ String webServerScheme = wsdlURLPanel.getWebServerScheme();
+ String webServerHost = wsdlURLPanel.getWebServerHost();
+ String webServerPort = wsdlURLPanel.getWebServerPort();
+ String wsdlURL = makeURL(webServerScheme, webServerHost, webServerPort);
+ SavedUDDIRegistryInfo config = configPanel.getSelectedConfig();
+ String userName = config.getUserName();
+ String inquiryUrl = config.getInquiryUrl();
+ String publishUrl = config.getPublishUrl();
+ String businessKey = businessPanel.getSelectedBusinessKey();
+ if (publishing) {
+ MMUddiException publishingException = null;
+ boolean isPublished = false;
+ try {
+ isPublished = uddiAPI.isPublished(userName, password, businessKey, wsdlURL, inquiryUrl, publishUrl);
+ } catch (MMUddiException ex) {
+ publishingException = ex;
+ }
+ if (publishingException == null) {
+ if (isPublished) {
+ resultsPanel.addIncorrectPublishingStateText();
+ } else {
+ try {
+ uddiAPI.publish(userName, password, businessKey, wsdlURL, inquiryUrl, publishUrl);
+ } catch (MMUddiException ex) {
+ publishingException = ex;
+ }
+ }
+ }
+ if ((!isPublished) && (publishingException == null)) {
+ resultsPanel.addSuccessText();
+ wizardPanel.getBackButton().setVisible(false);
+ } else {
+ if (publishingException != null) {
+ resultsPanel.addErrorHandlingSubcomponents(publishingException);
+ }
+ }
+ } else {
+ MMUddiException unpublishingException = null;
+ boolean isPublished = false;
+ try {
+ isPublished = uddiAPI.isPublished(userName, password, businessKey, wsdlURL, inquiryUrl, publishUrl);
+ } catch (MMUddiException ex) {
+ unpublishingException = ex;
+ }
+ if (unpublishingException == null) {
+ if (!isPublished) {
+ resultsPanel.addIncorrectPublishingStateText();
+ } else {
+ try {
+ uddiAPI.unPublish(userName, password, businessKey, wsdlURL, inquiryUrl, publishUrl);
+ } catch (MMUddiException ex) {
+ unpublishingException = ex;
+ }
+ }
+ }
+ if (isPublished && (unpublishingException == null)) {
+ resultsPanel.addSuccessText();
+ wizardPanel.getBackButton().setVisible(false);
+ } else {
+ if (unpublishingException != null) {
+ resultsPanel.addErrorHandlingSubcomponents(unpublishingException);
+ }
+ }
+ }
+ // Insert any checks which might prevent proceeding to next page here
+ if (goingToNextPage) {
+ currentPanel = resultsPanel;
+ }
+ }
+ boolean cancelVisible = (currentPanel != resultsPanel);
+ wizardPanel.getCancelButton().setVisible(cancelVisible);
+ return goingToNextPage;
+ }
+
+ public void showPreviousPage() {
+ // Everything on the new current page will be as we left it which was a state that allowed
+ // enabling of the Next button. So it is safe to go ahead and enable the 'Next' button.
+ if (currentPanel == businessPanel) {
+ currentPanel = configPanel;
+ configPanel.enableForwardButton(true);
+ } else if (currentPanel == wsdlURLPanel) {
+ currentPanel = businessPanel;
+ businessPanel.enableForwardButton(true);
+ } else if (currentPanel == resultsPanel) {
+ currentPanel = wsdlURLPanel;
+ wsdlURLPanel.enableForwardButton(true);
+ }
+ boolean cancelVisible = (currentPanel != resultsPanel);
+ wizardPanel.getCancelButton().setVisible(cancelVisible);
+ }
+
+ private String makeURL( String scheme,
+ String host,
+ String port ) {
+ List list = new ArrayList();
+ list.add(configMgr.getConnection().getURL());
+ return WSDLServletUtil.formatURL(scheme, host, port, DEFAULT_WEBSERVICE_CONTEXT, list, vdbName, vdbVersion); //$NON-NLS-1$
+ }
+
+ private void displayInitialUDDIAccessError( MMUddiException ex ) {
+ // TODO-- what to display may depend on contents of exception. If can discern that
+ // unable to connect to UDDI, then so state and do not show option to show error dialog.
+ // Else possibly put up modal dialog with "View Error Dialog" button, but then dispose of
+ // pop-up before going to error dialog.
+ UDDIInitialAccessErrorDialog dlg = new UDDIInitialAccessErrorDialog(ConsoleMainFrame.getInstance(), ex);
+ dlg.setVisible(true);
+ }
+}// end WSDLWizardRunner
+
+class WSDLWizardPanel extends WizardInterfaceImpl {
+ private WSDLWizardRunner controller;
+
+ public WSDLWizardPanel( WSDLWizardRunner cntrlr ) {
+ super();
+ this.controller = cntrlr;
+ }
+
+ public void showNextPage() {
+ boolean continuing = controller.showNextPage();
+ if (continuing) {
+ super.showNextPage();
+ }
+ }
+
+ public void showPreviousPage() {
+ controller.showPreviousPage();
+ super.showPreviousPage();
+ }
+}// end WSDLWizardPanel
+
+class SelectUDDIConfigurationPanel extends BasicWizardSubpanelContainer implements UDDIConfigurationsHandler {
+ private final static String SELECT_CONFIG = ConsolePlugin.Util.getString("WSDLWizardRunner.selectAConfig"); //$NON-NLS-1$
+ private final static String CONFIGURATIONS = ConsolePlugin.Util.getString("WSDLWizardRunner.configurations"); //$NON-NLS-1$
+ private final static String UDDI_CONFIG = ConsolePlugin.Util.getString("UDDIConfigurationsDialog.configName") + ':'; //$NON-NLS-1$
+ private final static String INQUIRY_URL = ConsolePlugin.Util.getString("UDDIConfigurationsDialog.uddiInquiryUrl") + ':'; //$NON-NLS-1$
+ private final static String PUBLISH_URL = ConsolePlugin.Util.getString("UDDIConfigurationsDialog.uddiPublishUrl") + ':'; //$NON-NLS-1$
+ private final static String USER = ConsolePlugin.Util.getString("UDDIConfigurationsDialog.userName") + ':'; //$NON-NLS-1$
+ private final static int TOP_INSET = 10;
+ private final static int LEFT_INSET = 10;
+ private final static int CONFIG_ROW_BOTTOM_INSET = 5;
+ private final static int SECOND_COL_LEFT_INSET = 4;
+ private final static int FIELDS_PANEL_BETWEEN_ROWS_INSET = 4;
+
+ private JPanel thePanel;
+ private JComboBox configsCombo;
+ private JButton configsButton;
+ private JTextField inquiryUrlField;
+ private JTextField publishUrlField;
+ private JTextField userField;
+ private java.util.List /* <SavedUDDIRegistryInfo> */items;
+
+ public SelectUDDIConfigurationPanel( WizardInterface wizardInterface,
+ int stepNum ) {
+ super(wizardInterface);
+ super.setStepText(stepNum, SELECT_CONFIG);
+ SavedUDDIRegistryInfo[] savedItems = StaticProperties.getUDDIRegistryInfo();
+ items = new ArrayList(savedItems.length);
+ for (int i = 0; i < savedItems.length; i++) {
+ items.add(savedItems[i]);
+ }
+ thePanel = createPanel();
+ super.setMainContent(thePanel);
+ }
+
+ private JPanel createPanel() {
+ JPanel panel = new JPanel();
+ GridBagLayout layout = new GridBagLayout();
+ panel.setLayout(layout);
+ JLabel configsLabel = new LabelWidget(UDDI_CONFIG);
+ panel.add(configsLabel);
+ layout.setConstraints(configsLabel, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.NORTHWEST,
+ GridBagConstraints.NONE,
+ new Insets(TOP_INSET, LEFT_INSET, CONFIG_ROW_BOTTOM_INSET, 0),
+ 0, 1));
+ String[] configNamesArray = createConfigNamesArray();
+ configsCombo = new JComboBox(configNamesArray);
+ configsCombo.addActionListener(new ActionListener() {
+ public void actionPerformed( ActionEvent ev ) {
+ configSelectionChanged();
+ }
+ });
+ configsCombo.setEditable(false);
+ panel.add(configsCombo);
+ layout.setConstraints(configsCombo, new GridBagConstraints(1, 0, 1, 1, 1.0, 1.0, GridBagConstraints.NORTH,
+ GridBagConstraints.HORIZONTAL,
+ new Insets(TOP_INSET, SECOND_COL_LEFT_INSET,
+ CONFIG_ROW_BOTTOM_INSET, 0), 0, 0));
+ configsButton = new ButtonWidget(CONFIGURATIONS);
+ configsButton.addActionListener(new ActionListener() {
+ public void actionPerformed( ActionEvent ev ) {
+ configsButtonPressed();
+ }
+ });
+ panel.add(configsButton);
+ layout.setConstraints(configsButton, new GridBagConstraints(2, 0, 1, 1, 0.0, 0.0, GridBagConstraints.NORTHWEST,
+ GridBagConstraints.NONE, new Insets(TOP_INSET, 4,
+ CONFIG_ROW_BOTTOM_INSET,
+ 10), 0, 0));
+ JPanel fieldsPanel = new JPanel();
+ panel.add(fieldsPanel);
+ layout.setConstraints(fieldsPanel, new GridBagConstraints(1, 1, 1, 1, 0.0, 4.0, GridBagConstraints.NORTH,
+ GridBagConstraints.HORIZONTAL, new Insets(20, LEFT_INSET, 20,
+ LEFT_INSET), 0, 0));
+ GridBagLayout fieldsLayout = new GridBagLayout();
+ fieldsPanel.setLayout(fieldsLayout);
+ JLabel hostLabel = new LabelWidget(INQUIRY_URL);
+ fieldsPanel.add(hostLabel);
+ fieldsLayout.setConstraints(hostLabel, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.WEST,
+ GridBagConstraints.NONE,
+ new Insets(0, 0, FIELDS_PANEL_BETWEEN_ROWS_INSET, 0), 0, 0));
+ inquiryUrlField = new TextFieldWidget(100);
+ inquiryUrlField.setEditable(false);
+ fieldsPanel.add(inquiryUrlField);
+ fieldsLayout.setConstraints(inquiryUrlField, new GridBagConstraints(1, 0, 1, 1, 1.0, 0.0, GridBagConstraints.WEST,
+ GridBagConstraints.HORIZONTAL,
+ new Insets(0, SECOND_COL_LEFT_INSET,
+ FIELDS_PANEL_BETWEEN_ROWS_INSET, 0), 0, 0));
+ JLabel portLabel = new LabelWidget(PUBLISH_URL);
+ fieldsPanel.add(portLabel);
+ fieldsLayout.setConstraints(portLabel, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.WEST,
+ GridBagConstraints.NONE,
+ new Insets(FIELDS_PANEL_BETWEEN_ROWS_INSET, 0,
+ FIELDS_PANEL_BETWEEN_ROWS_INSET, 0), 0, 0));
+ publishUrlField = new TextFieldWidget(100);
+ publishUrlField.setEditable(false);
+ fieldsPanel.add(publishUrlField);
+ fieldsLayout.setConstraints(publishUrlField, new GridBagConstraints(1, 1, 1, 1, 1.0, 0.0, GridBagConstraints.WEST,
+ GridBagConstraints.HORIZONTAL,
+ new Insets(FIELDS_PANEL_BETWEEN_ROWS_INSET,
+ SECOND_COL_LEFT_INSET,
+ FIELDS_PANEL_BETWEEN_ROWS_INSET, 0), 0, 0));
+ JLabel userLabel = new LabelWidget(USER);
+ fieldsPanel.add(userLabel);
+ fieldsLayout.setConstraints(userLabel, new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0, GridBagConstraints.WEST,
+ GridBagConstraints.NONE,
+ new Insets(FIELDS_PANEL_BETWEEN_ROWS_INSET, 0, 0, 0), 0, 0));
+ userField = new TextFieldWidget();
+ userField.setEditable(false);
+ fieldsPanel.add(userField);
+ fieldsLayout.setConstraints(userField, new GridBagConstraints(1, 2, 1, 1, 1.0, 0.0, GridBagConstraints.WEST,
+ GridBagConstraints.HORIZONTAL,
+ new Insets(FIELDS_PANEL_BETWEEN_ROWS_INSET,
+ SECOND_COL_LEFT_INSET, 0, 0), 0, 0));
+ return panel;
+ }
+
+ private String[] createConfigNamesArray() {
+ String[] array = new String[items.size() + 1];
+ array[0] = StringUtil.Constants.EMPTY_STRING;
+ Iterator it = items.iterator();
+ for (int i = 1; it.hasNext(); i++) {
+ SavedUDDIRegistryInfo curItem = (SavedUDDIRegistryInfo)it.next();
+ array[i] = curItem.getName();
+ }
+ return array;
+ }
+
+ private void configSelectionChanged() {
+ setForwardButtonEnabling();
+ }
+
+ private void setForwardButtonEnabling() {
+ int index = configsCombo.getSelectedIndex();
+ if (index >= 1) {
+ SavedUDDIRegistryInfo selectedItem = (SavedUDDIRegistryInfo)items.get(index - 1);
+ inquiryUrlField.setText(selectedItem.getInquiryUrl());
+ publishUrlField.setText(selectedItem.getPublishUrl());
+ userField.setText(selectedItem.getUserName());
+ enableForwardButton(true);
+ } else {
+ inquiryUrlField.setText(StringUtil.Constants.EMPTY_STRING);
+ publishUrlField.setText(StringUtil.Constants.EMPTY_STRING);
+ userField.setText(StringUtil.Constants.EMPTY_STRING);
+ enableForwardButton(false);
+ }
+ }
+
+ private void configsButtonPressed() {
+ runConfigsDialog();
+ }
+
+ private void runConfigsDialog() {
+ SavedUDDIRegistryInfo[] array = new SavedUDDIRegistryInfo[items.size()];
+ Iterator it = items.iterator();
+ for (int i = 0; it.hasNext(); i++) {
+ array[i] = (SavedUDDIRegistryInfo)it.next();
+ }
+ UDDIConfigurationsDialog dialog = new UDDIConfigurationsDialog(ConsoleMainFrame.getInstance(), this, array);
+ dialog.setVisible(true);
+ }
+
+ public void addedConfiguration( SavedUDDIRegistryInfo config ) {
+ DefaultComboBoxModel model = (DefaultComboBoxModel)configsCombo.getModel();
+ items.add(config);
+ updateConfigs();
+ model.addElement(config.getName());
+ selectItem(config);
+ }
+
+ public void removedConfiguration( SavedUDDIRegistryInfo config ) {
+ DefaultComboBoxModel model = (DefaultComboBoxModel)configsCombo.getModel();
+ items.remove(config);
+ updateConfigs();
+ model.removeElement(config.getName());
+ }
+
+ public void editedConfiguration( SavedUDDIRegistryInfo config ) {
+ // Cannot change the name when editing the item, so we do not have to change the combo box model
+ int matchIndex = matchIndexOfConfigName(config);
+ if (matchIndex >= 0) {
+ items.set(matchIndex, config);
+ updateConfigs();
+ selectItem(config);
+ }
+ }
+
+ public void unchangedConfiguration( SavedUDDIRegistryInfo config ) {
+ selectItem(config);
+ }
+
+ private void selectItem( SavedUDDIRegistryInfo config ) {
+ int matchIndex = matchIndexOfConfigName(config);
+ if (matchIndex >= 0) {
+ // Offset by 1 to account for blank entry at start of combo
+ configsCombo.setSelectedIndex(matchIndex + 1);
+ }
+ }
+
+ private int matchIndexOfConfigName( SavedUDDIRegistryInfo config ) {
+ String configName = config.getName();
+ int matchIndex = -1;
+ int index = 0;
+ int numItems = items.size();
+ while ((matchIndex < 0) && (index < numItems)) {
+ SavedUDDIRegistryInfo curConfig = (SavedUDDIRegistryInfo)items.get(index);
+ String curConfigName = curConfig.getName();
+ if (configName.equals(curConfigName)) {
+ matchIndex = index;
+ } else {
+ index++;
+ }
+ }
+ return matchIndex;
+ }
+
+ private void updateConfigs() {
+ SavedUDDIRegistryInfo[] array = new SavedUDDIRegistryInfo[items.size()];
+ Iterator it = items.iterator();
+ for (int i = 0; it.hasNext(); i++) {
+ array[i] = (SavedUDDIRegistryInfo)it.next();
+ }
+ StaticProperties.setUDDIRegistryInfo(array);
+ }
+
+ public SavedUDDIRegistryInfo getSelectedConfig() {
+ SavedUDDIRegistryInfo selection = null;
+ int selectedIndex = configsCombo.getSelectedIndex();
+ // Offset by 1 to account for blank entry at top of combo box
+ if (selectedIndex >= 1) {
+ selection = (SavedUDDIRegistryInfo)items.get(selectedIndex - 1);
+ }
+ return selection;
+ }
+
+ /**
+ * Overridden to enable the forward button only if the file selection is valid.
+ *
+ * @see com.metamatrix.console.ui.util.BasicWizardSubpanelContainer#resolveForwardButton()
+ * @since 5.5.3
+ */
+ public void resolveForwardButton() {
+ setForwardButtonEnabling();
+ }
+
+ public Dimension getPreferredSize() {
+ Dimension size = super.getPreferredSize();
+ // System.err.println("in SelectUDDIConfigurationPanel getPreferredSize(), returning " + size);
+ return size;
+ }
+}// end SelectUDDIConfigurationPanel
+
+class SelectBusinessPanel extends BasicWizardSubpanelContainer {
+ private final static String SELECT_A_BUSINESS = ConsolePlugin.Util.getString("WSDLWizardRunner.selectABusiness"); //$NON-NLS-1$
+ private final static String SELECT_A_BUSINESS_LABEL = SELECT_A_BUSINESS + ':';
+ private final static String BUSINESS_NAME = ConsolePlugin.Util.getString("WSDLWizardRunner.businessName"); //$NON-NLS-1$
+ private final static String BUSINESS_KEY = ConsolePlugin.Util.getString("WSDLWizardRunner.businessKey"); //$NON-NLS-1$
+ private final static String DESCRIPTION_LABEL = ConsolePlugin.Util.getString("WSDLWizardRunner.description"); //$NON-NLS-1$
+
+ private final static int BUSINESS_NAME_COL_INDEX = 0;
+ private final static int BUSINESS_KEY_COL_INDEX = 1;
+ // Order must correspond to column index constants
+ private final static String[] COL_HEADERS = new String[] {BUSINESS_NAME, BUSINESS_KEY};
+
+ private final static int LEFT_INSET = 10;
+ private final static int RIGHT_INSET = 10;
+
+ private JPanel thePanel;
+ private BusinessList /* <BusinessEntity> */businesses;
+ private JTable table;
+ private JTextArea descriptionArea;
+
+ public SelectBusinessPanel( WizardInterface wizardInterface,
+ int stepNum ) {
+ super(wizardInterface);
+ super.setStepText(stepNum, SELECT_A_BUSINESS);
+ thePanel = createPanel();
+ super.setMainContent(thePanel);
+ }
+
+ private JPanel createPanel() {
+ table = new SelectBusinessPanelTable(Arrays.asList(COL_HEADERS));
+ table.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
+ public void valueChanged( ListSelectionEvent ev ) {
+ if (!ev.getValueIsAdjusting()) {
+ tableRowSelectionChanged();
+ }
+ }
+ });
+ ((TableWidget)table).setEditable(false);
+
+ JPanel panel = new JPanel();
+ GridBagLayout layout = new GridBagLayout();
+ panel.setLayout(layout);
+ JLabel selectBusinessLabel = new LabelWidget(SELECT_A_BUSINESS_LABEL);
+ panel.add(selectBusinessLabel);
+ layout.setConstraints(selectBusinessLabel, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.WEST,
+ GridBagConstraints.NONE, new Insets(10, LEFT_INSET, 10,
+ RIGHT_INSET), 0, 0));
+ JScrollPane tableScrollPane = new JScrollPane(table);
+ panel.add(tableScrollPane);
+ layout.setConstraints(tableScrollPane, new GridBagConstraints(0, 1, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER,
+ GridBagConstraints.BOTH, new Insets(0, LEFT_INSET, 10,
+ RIGHT_INSET), 0, 0));
+ JLabel descriptionLabel = new LabelWidget(DESCRIPTION_LABEL);
+ panel.add(descriptionLabel);
+ layout.setConstraints(descriptionLabel, new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0, GridBagConstraints.WEST,
+ GridBagConstraints.NONE, new Insets(0, LEFT_INSET, 0,
+ RIGHT_INSET), 0, 0));
+ descriptionArea = new JTextArea();
+ descriptionArea.setEditable(false);
+ descriptionArea.setLineWrap(true);
+ descriptionArea.setWrapStyleWord(true);
+ panel.add(descriptionArea);
+ layout.setConstraints(descriptionArea, new GridBagConstraints(0, 3, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER,
+ GridBagConstraints.BOTH, new Insets(0, LEFT_INSET, 0,
+ RIGHT_INSET), 0, 0));
+ return panel;
+ }
+
+ private void tableRowSelectionChanged() {
+ int selectedRow = table.getSelectedRow();
+ if (selectedRow < 0) {
+ descriptionArea.setText(StringUtil.Constants.EMPTY_STRING);
+ } else {
+ BusinessInfo selectedBusiness = businesses.getBusinessInfos().get(selectedRow);
+ String desc = selectedBusiness.getDefaultDescriptionString();
+ descriptionArea.setText(desc);
+ }
+ setForwardButtonEnabling();
+ }
+
+ public void setBusinesses( BusinessList busList ) {
+ this.businesses = busList;
+ DefaultTableModel model = (DefaultTableModel)table.getModel();
+ model.setRowCount(0);
+ Iterator it = this.businesses.getBusinessInfos().getBusinessInfoVector().iterator();
+ while (it.hasNext()) {
+ BusinessInfo business = (BusinessInfo)it.next();
+ String businessKey = business.getBusinessKey();
+ String businessName = business.getDefaultNameString();
+ String[] rowData = new String[2];
+ rowData[BUSINESS_NAME_COL_INDEX] = businessName;
+ rowData[BUSINESS_KEY_COL_INDEX] = businessKey;
+ model.addRow(rowData);
+ }
+ }
+
+ public String getSelectedBusinessKey() {
+ String key = null;
+ int selectedIndex = table.getSelectedRow();
+ if (selectedIndex >= 0) {
+ key = (String)table.getModel().getValueAt(selectedIndex, BUSINESS_KEY_COL_INDEX);
+ }
+ return key;
+ }
+
+ public void setForwardButtonEnabling() {
+ int selectedRow = table.getSelectedRow();
+ enableForwardButton((selectedRow >= 0));
+ }
+
+ /**
+ * Overridden to enable the forward button only if the file selection is valid.
+ *
+ * @see com.metamatrix.console.ui.util.BasicWizardSubpanelContainer#resolveForwardButton()
+ * @since 5.5.3
+ */
+ public void resolveForwardButton() {
+ setForwardButtonEnabling();
+ }
+
+ public Dimension getPreferredSize() {
+ Dimension size = super.getPreferredSize();
+ // System.err.println("in SelectBusinessPanel getPreferredSize(), returning " + size);
+ return size;
+ }
+}// end SelectBusinessPanel
+
+class SelectBusinessPanelTable extends TableWidget {
+ public SelectBusinessPanelTable( java.util.List columns ) {
+ super(columns);
+ }
+
+ public Dimension getPreferredSize() {
+ Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
+ Dimension preferredSize = super.getPreferredSize();
+ int preferredWidth = Math.max(preferredSize.width, (screenSize.width / 2));
+ return new Dimension(preferredWidth, preferredSize.height);
+ }
+}// end SelectBusinessPanelTable
+
+/**
+ * Panel to set and display SOAP URL connection properties
+ * @since 5.5.3
+ */
+class CreateWSDLURLElementsPanel extends BasicWizardSubpanelContainer {
+ private final static String TITLE = ConsolePlugin.Util.getString("WSDLWizardRunner.setSOAPProperties"); //$NON-NLS-1$
+ private final static String DESC = ConsolePlugin.Util.getString("WSDLWizardRunner.setSOAPPropertiesDesc"); //$NON-NLS-1$
+ private final static String HOST = ConsolePlugin.Util.getString("WSDLWizardRunner.webServerHost"); //$NON-NLS-1$
+ private final static String PORT = ConsolePlugin.Util.getString("WSDLWizardRunner.webServerPort"); //$NON-NLS-1$
+ private final static String DEFAULTS = ConsolePlugin.Util.getString("WSDLWizardRunner.resetToDefaults"); //$NON-NLS-1$
+
+ private final static int BETWEEN_LABELS_VERT_GAP = 2;
+
+ private JPanel thePanel;
+ private String defaultWebServerPort;
+ private String defaultWebServerHost;
+ private JTextField inquiryUrlField;
+ private JTextField publishUrlField;
+
+ /**
+ * Constructor
+ * @param wizardInterface
+ * @param stepNum
+ */
+ public CreateWSDLURLElementsPanel( WizardInterface wizardInterface,
+ int stepNum ) {
+ super(wizardInterface);
+ super.setStepText(stepNum, TITLE);
+ thePanel = createPanel();
+ super.setMainContent(thePanel);
+ }
+
+ private JPanel createPanel() {
+ JPanel panel = new JPanel();
+ GridBagLayout layout = new GridBagLayout();
+ panel.setLayout(layout);
+ JLabel desc = new LabelWidget(DESC);
+ panel.add(desc);
+ layout.setConstraints(desc, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.WEST,
+ GridBagConstraints.NONE, new Insets(10, 10, 10, 10), 0, 0));
+ JPanel textPanel = new JPanel();
+ panel.add(textPanel);
+ layout.setConstraints(textPanel, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER,
+ GridBagConstraints.NONE, new Insets(10, 10, 10, 10), 0, 0));
+ GridBagLayout textPanelLayout = new GridBagLayout();
+ textPanel.setLayout(textPanelLayout);
+ JLabel hostLabel = new LabelWidget(HOST);
+ textPanel.add(hostLabel);
+ textPanelLayout.setConstraints(hostLabel, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.WEST,
+ GridBagConstraints.NONE, new Insets(0, 0, 0, 4), 0, 0));
+ DocumentListener docListener = new DocumentListener() {
+ public void changedUpdate( DocumentEvent ev ) {
+ fieldsChanged();
+ }
+
+ public void removeUpdate( DocumentEvent ev ) {
+ fieldsChanged();
+ }
+
+ public void insertUpdate( DocumentEvent ev ) {
+ fieldsChanged();
+ }
+ };
+ inquiryUrlField = new TextFieldWidget(50);
+ inquiryUrlField.getDocument().addDocumentListener(docListener);
+ textPanel.add(inquiryUrlField);
+ textPanelLayout.setConstraints(inquiryUrlField,
+ new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0, GridBagConstraints.WEST,
+ GridBagConstraints.NONE, new Insets(0, 0, BETWEEN_LABELS_VERT_GAP,
+ 0), 0, 0));
+ JLabel portLabel = new LabelWidget(PORT);
+ textPanel.add(portLabel);
+ textPanelLayout.setConstraints(portLabel, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.WEST,
+ GridBagConstraints.NONE, new Insets(0, 0, 0, 4), 0, 0));
+ publishUrlField = new TextFieldWidget(20);
+ publishUrlField.getDocument().addDocumentListener(docListener);
+ textPanel.add(publishUrlField);
+ textPanelLayout.setConstraints(publishUrlField,
+ new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0, GridBagConstraints.WEST,
+ GridBagConstraints.NONE, new Insets(BETWEEN_LABELS_VERT_GAP, 0, 0,
+ 0), 0, 0));
+ JButton defaultsButton = new ButtonWidget(DEFAULTS);
+ defaultsButton.addActionListener(new ActionListener() {
+ public void actionPerformed( ActionEvent ev ) {
+ defaultsPressed();
+ }
+ });
+ panel.add(defaultsButton);
+ layout.setConstraints(defaultsButton, new GridBagConstraints(0, 2, 1, 1, 0.0, 1.0, GridBagConstraints.NORTH,
+ GridBagConstraints.NONE, new Insets(10, 10, 10, 10), 0, 0));
+ return panel;
+ }
+
+ private void fieldsChanged() {
+ setForwardButtonEnabling();
+ }
+
+ public void setForwardButtonEnabling() {
+ String inquiryUrlText = inquiryUrlField.getText().trim();
+ String publishUrlText = publishUrlField.getText().trim();
+ boolean enabling = ((inquiryUrlText.length() > 0) && (publishUrlText.length() > 0));
+ enableForwardButton(enabling);
+ }
+
+ /**
+ * Overridden to enable the forward button only if the file selection is valid.
+ *
+ * @see com.metamatrix.console.ui.util.BasicWizardSubpanelContainer#resolveForwardButton()
+ * @since 5.5.3
+ */
+ public void resolveForwardButton() {
+ setForwardButtonEnabling();
+ }
+
+ private void defaultsPressed() {
+ inquiryUrlField.setText(defaultWebServerHost);
+ publishUrlField.setText(defaultWebServerPort);
+ }
+
+ public void setDefaultWebServerPort( String port ) {
+ defaultWebServerPort = port;
+ publishUrlField.setText(defaultWebServerPort);
+ }
+
+ public void setdefaultWebServerHost( String host ) {
+ defaultWebServerHost = host;
+ inquiryUrlField.setText(defaultWebServerHost);
+ }
+
+ public String getWebServerScheme() {
+ return inquiryUrlField.getText().trim();
+ }
+
+ public String getWebServerHost() {
+ return inquiryUrlField.getText().trim();
+ }
+
+ public String getWebServerPort() {
+ return publishUrlField.getText().trim();
+ }
+
+ public Dimension getPreferredSize() {
+ Dimension size = super.getPreferredSize();
+ // System.err.println("in CreateWSDLURLElementsPanel getPreferredSize(), returning " + size);
+ return size;
+ }
+}// end CreateWSDLURLElementsPanel
+
+class ResultsPanel extends BasicWizardSubpanelContainer {
+ private final static String SUCCESSFULLY_PUBLISHED = ConsolePlugin.Util.getString("WSDLWizardRunner.publishingSuccessfulMsg"); //$NON-NLS-1$
+ private final static String SUCCESSFULLY_UNPUBLISHED = ConsolePlugin.Util.getString("WSDLWizardRunner.unpublishingSuccessfulMsg"); //$NON-NLS-1$
+ private final static String ALREADY_PUBLISHED = ConsolePlugin.Util.getString("WSDLWizardRunner.wsdlAlreadyPublishedMsg"); //$NON-NLS-1$
+ private final static String NOT_PUBLISHED = ConsolePlugin.Util.getString("WSDLWizardRunner.noWSDLPublishedMsg"); //$NON-NLS-1$
+ private final static String ERROR_1 = ConsolePlugin.Util.getString("WSDLWizardRunner.errorMsg1"); //$NON-NLS-1$
+ private final static String ERROR_2 = ConsolePlugin.Util.getString("WSDLWizardRunner.errorMsg2"); //$NON-NLS-1$
+ private final static String PUBLISH = ConsolePlugin.Util.getString("WSDLWizardRunner.publish"); //$NON-NLS-1$
+ private final static String UNPUBLISH = ConsolePlugin.Util.getString("WSDLWizardRunner.unpublish"); //$NON-NLS-1$
+ private final static String VIEW_ERROR_DIALOG = ConsolePlugin.Util.getString("WSDLWizardRunner.viewErrorDialog"); //$NON-NLS-1$
+ private final static String ERROR_DLG_HEADER = ConsolePlugin.Util.getString("WSDLWizardRunner.errorDlgHeader"); //$NON-NLS-1$
+
+ private JPanel thePanel;
+ private boolean publishing;
+ private Throwable throwable;
+
+ public ResultsPanel( WizardInterface wizardInterface,
+ boolean publishing,
+ int stepNum ) {
+ super(wizardInterface);
+ super.setStepText(stepNum, "Results"); //$NON-NLS-1$
+ thePanel = new JPanel();
+ this.publishing = publishing;
+ super.setMainContent(thePanel);
+ }
+
+ public void addSuccessText() {
+ thePanel.removeAll();
+ GridBagLayout layout = new GridBagLayout();
+ thePanel.setLayout(layout);
+ String text;
+ if (publishing) {
+ text = SUCCESSFULLY_PUBLISHED;
+ } else {
+ text = SUCCESSFULLY_UNPUBLISHED;
+ }
+ JLabel label = new LabelWidget(text);
+ thePanel.add(label);
+ layout.setConstraints(label, new GridBagConstraints(0, 0, 1, 1, 0.0, 1.0, GridBagConstraints.NORTH,
+ GridBagConstraints.NONE, new Insets(20, 10, 10, 10), 0, 0));
+ }
+
+ public void addIncorrectPublishingStateText() {
+ thePanel.removeAll();
+ GridBagLayout layout = new GridBagLayout();
+ thePanel.setLayout(layout);
+ String text;
+ IconComponent icon = new IconComponent(Icons.WARNING_ICON);
+ thePanel.add(icon);
+ layout.setConstraints(icon, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.NORTH,
+ GridBagConstraints.NONE, new Insets(10, 20, 10, 10), 0, 0));
+ if (publishing) {
+ text = ALREADY_PUBLISHED;
+ } else {
+ text = NOT_PUBLISHED;
+ }
+ JLabel label = new LabelWidget(text);
+ thePanel.add(label);
+ layout.setConstraints(label, new GridBagConstraints(1, 0, 1, 1, 0.0, 1.0, GridBagConstraints.NORTH,
+ GridBagConstraints.NONE, new Insets(10, 0, 10, 0), 0, 0));
+ }
+
+ public void addErrorHandlingSubcomponents( Throwable t ) {
+ this.throwable = t;
+ thePanel.removeAll();
+ GridBagLayout layout = new GridBagLayout();
+ thePanel.setLayout(layout);
+ String errorText;
+ if (publishing) {
+ errorText = ERROR_1 + ' ' + PUBLISH + ' ' + ERROR_2;
+ } else {
+ errorText = ERROR_1 + ' ' + UNPUBLISH + ' ' + ERROR_2;
+ }
+ JLabel errorLabel = new LabelWidget(errorText);
+ thePanel.add(errorLabel);
+ layout.setConstraints(errorLabel, new GridBagConstraints(0, 0, 1, 1, 0.0, 1.0, GridBagConstraints.NORTHWEST,
+ GridBagConstraints.NONE, new Insets(20, 4, 10, 4), 0, 0));
+ JButton errorDialogButton = new ButtonWidget(VIEW_ERROR_DIALOG);
+ thePanel.add(errorDialogButton);
+ layout.setConstraints(errorDialogButton,
+ new GridBagConstraints(0, 1, 1, 1, 0.0, 1.0, GridBagConstraints.NORTH, GridBagConstraints.NONE,
+ new Insets(20, 10, 10, 10), 0, 0));
+ errorDialogButton.addActionListener(new ActionListener() {
+ public void actionPerformed( ActionEvent ev ) {
+ viewErrorDialogPressed();
+ }
+ });
+ }
+
+ private void viewErrorDialogPressed() {
+ ExceptionUtility.showMessage(ERROR_DLG_HEADER, throwable);
+ }
+
+ public Dimension getPreferredSize() {
+ Dimension size = super.getPreferredSize();
+ // System.err.println("in ResultsPanel getPreferredSize(), returning " + size);
+ return size;
+ }
+}// end ResultsPanel
+
+class WSDLWizardPanelDialog extends JDialog {
+ private WSDLWizardRunner caller;
+ private WSDLWizardPanel wizardPanel;
+
+ public WSDLWizardPanelDialog( WSDLWizardRunner cllr,
+ WSDLWizardPanel wizPnl,
+ boolean publishing ) {
+ super(ConsoleMainFrame.getInstance(), publishing ? "Web Services Publishing Wizard" : //$NON-NLS-1$
+ "Web Services Unpublishing Wizard"); //$NON-NLS-1$
+ this.caller = cllr;
+ this.wizardPanel = wizPnl;
+ this.setModal(true);
+ this.addWindowListener(new WindowAdapter() {
+ public void windowClosing( WindowEvent ev ) {
+ caller.dialogWindowClosing();
+ }
+ });
+ init();
+ //this.pack();
+ Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
+ // System.err.println("screenSize is " + screenSize);
+ Dimension size = this.getSize();
+ // System.err.println("in WSDLWizardPanelDialog constructor, size is " + size);
+ Dimension newSize = new Dimension(Math.min(Math.max(size.width, (int)(screenSize.width * 0.5)),
+ (int)(screenSize.width * 0.75)), Math.max(size.height,
+ (int)(screenSize.height * 0.75)));
+ this.setSize(newSize);
+ this.setLocation(StaticUtilities.centerFrame(this.getSize()));
+ }
+
+ private void init() {
+ GridBagLayout layout = new GridBagLayout();
+ this.getContentPane().setLayout(layout);
+ this.getContentPane().add(wizardPanel);
+ layout.setConstraints(wizardPanel, new GridBagConstraints(0, 0, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER,
+ GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));
+ }
+
+ public void cancelPressed() {
+ this.dispose();
+ }
+
+ public void finishPressed() {
+ this.dispose();
+ }
+}// end WSDLWizardPanelDialog
+
+class UDDIPasswordDialog extends JDialog {
+ private final static String TITLE = ConsolePlugin.Util.getString("WSDLWizardRunner.passwordDialogTitle"); //$NON-NLS-1$
+ private final static String TEXT_LINE = ConsolePlugin.Util.getString("WSDLWizardRunner.passwordText"); //$NON-NLS-1$
+ private final static String PASSWORD_LABEL = ConsolePlugin.Util.getString("WSDLWizardRunner.passwordLabel"); //$NON-NLS-1$
+ private final static String OK = ConsolePlugin.Util.getString("General.OK"); //$NON-NLS-1$
+ private final static String CANCEL = ConsolePlugin.Util.getString("General.Cancel"); //$NON-NLS-1$
+ private final static int HORIZONTAL_INSETS = 4;
+
+ private JButton okButton;
+ private JButton cancelButton;
+ private JPasswordField passwordField;
+ private String password = null;
+
+ public UDDIPasswordDialog( String configName ) {
+ super(ConsoleMainFrame.getInstance(), TITLE, true);
+ createComponent(configName);
+ }
+
+ private void createComponent( String configName ) {
+ addWindowListener(new WindowAdapter() {
+ public void windowClosing( WindowEvent ev ) {
+ cancelPressed();
+ }
+ });
+ GridBagLayout layout = new GridBagLayout();
+ getContentPane().setLayout(layout);
+ String headerText = TEXT_LINE + ' ' + configName;
+ JLabel headerLabel = new LabelWidget(headerText);
+ getContentPane().add(headerLabel);
+ layout.setConstraints(headerLabel, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.WEST,
+ GridBagConstraints.NONE, new Insets(10, HORIZONTAL_INSETS, 10,
+ HORIZONTAL_INSETS), 0, 0));
+ JPanel passwordPanel = new JPanel();
+ GridBagLayout passwordLayout = new GridBagLayout();
+ passwordPanel.setLayout(passwordLayout);
+ getContentPane().add(passwordPanel);
+ layout.setConstraints(passwordPanel, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER,
+ GridBagConstraints.NONE, new Insets(0, HORIZONTAL_INSETS, 0,
+ HORIZONTAL_INSETS), 0, 0));
+ JLabel passwordLabel = new LabelWidget(PASSWORD_LABEL);
+ passwordPanel.add(passwordLabel);
+ passwordLayout.setConstraints(passwordLabel,
+ new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.EAST,
+ GridBagConstraints.NONE, new Insets(0, 0, 0, 4), 0, 0));
+ passwordField = new JPasswordField(20);
+ passwordField.setPreferredSize(new Dimension(224, 20));
+ passwordField.setMinimumSize(new Dimension(224, 20));
+
+ passwordPanel.add(passwordField);
+ passwordLayout.setConstraints(passwordField,
+ new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0, GridBagConstraints.WEST,
+ GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
+ passwordField.getDocument().addDocumentListener(new DocumentListener() {
+ public void changedUpdate( DocumentEvent ev ) {
+ passwordChanged();
+ }
+
+ public void removeUpdate( DocumentEvent ev ) {
+ passwordChanged();
+ }
+
+ public void insertUpdate( DocumentEvent ev ) {
+ passwordChanged();
+ }
+ });
+ JPanel buttonsPanel = new JPanel(new GridLayout(1, 2, 10, 0));
+ getContentPane().add(buttonsPanel);
+ layout.setConstraints(buttonsPanel, new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER,
+ GridBagConstraints.NONE, new Insets(10, 10, 10, 10), 0, 0));
+ okButton = new ButtonWidget(OK);
+ buttonsPanel.add(okButton);
+ okButton.addActionListener(new ActionListener() {
+ public void actionPerformed( ActionEvent ev ) {
+ okPressed();
+ }
+ });
+ okButton.setEnabled(false);
+ cancelButton = new ButtonWidget(CANCEL);
+ buttonsPanel.add(cancelButton);
+ cancelButton.addActionListener(new ActionListener() {
+ public void actionPerformed( ActionEvent ev ) {
+ cancelPressed();
+ }
+ });
+ this.pack();
+ this.setLocation(StaticUtilities.centerFrame(this.getSize()));
+ }
+
+ private void passwordChanged() {
+ char[] passwordArray = passwordField.getPassword();
+ if (passwordArray.length == 0) {
+ password = null;
+ } else {
+ password = new String(passwordArray);
+ password = password.trim();
+ if (password.length() == 0) {
+ password = null;
+ }
+ }
+ okButton.setEnabled((password != null));
+ }
+
+ private void cancelPressed() {
+ password = null;
+ this.dispose();
+ }
+
+ private void okPressed() {
+ this.dispose();
+ }
+
+ public String getPassword() {
+ return password;
+ }
+}// end UDDIPasswordDialog
Property changes on: trunk/console/src/main/java/com/metamatrix/console/ui/views/vdb/WSDLWizardRunner.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/console/src/main/java/com/metamatrix/console/ui/views/vdb/WebServicesPanel.java
===================================================================
--- trunk/console/src/main/java/com/metamatrix/console/ui/views/vdb/WebServicesPanel.java (rev 0)
+++ trunk/console/src/main/java/com/metamatrix/console/ui/views/vdb/WebServicesPanel.java 2009-05-13 18:07:37 UTC (rev 930)
@@ -0,0 +1,187 @@
+/*
+ * Copyright © 2000-2008 MetaMatrix, Inc. All rights reserved.
+ */
+package com.metamatrix.console.ui.views.vdb;
+
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
+import java.awt.GridLayout;
+import java.awt.Insets;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+
+import javax.swing.JButton;
+import javax.swing.JOptionPane;
+import javax.swing.JPanel;
+import javax.swing.JTextArea;
+
+import com.metamatrix.common.config.api.Configuration;
+import com.metamatrix.common.log.LogManager;
+import com.metamatrix.console.ConsolePlugin;
+import com.metamatrix.console.connections.ConnectionInfo;
+import com.metamatrix.console.models.ConfigurationManager;
+import com.metamatrix.console.models.ModelManager;
+import com.metamatrix.console.models.VdbManager;
+import com.metamatrix.console.util.ExceptionUtility;
+import com.metamatrix.console.util.LogContexts;
+import com.metamatrix.console.util.StaticUtilities;
+import com.metamatrix.metadata.runtime.api.VirtualDatabase;
+import com.metamatrix.metadata.runtime.api.VirtualDatabaseID;
+import com.metamatrix.platform.admin.api.ConfigurationAdminAPI;
+import com.metamatrix.toolbox.ui.widget.ButtonWidget;
+
+/**
+ * @since 5.5.3
+ */
+public class WebServicesPanel extends JPanel implements
+ VdbDisplayer {
+
+ private final static String PUBLISH_BTN_LABEL = ConsolePlugin.Util.getString("WebServicesPanel.publish"); //$NON-NLS-1$
+ private final static String UNPUBLISH_BTN_LABEL = ConsolePlugin.Util.getString("WebServicesPanel.unpublish"); //$NON-NLS-1$
+ private final static String NO_WSDL_TEXT = ConsolePlugin.Util.getString("WebServicesPanel.noModelsMsg"); //$NON-NLS-1$
+ private final static String ERROR_RETRIEVING_DATABASES = ConsolePlugin.Util
+ .getString("WebServicesPanel.errorRetrievingVirtualDatabases"); //$NON-NLS-1$
+ private final static String ERROR_RETRIEVING_CURRENT_CONFIGURATION = ConsolePlugin.Util
+ .getString("WebServicesPanel.errorRetrievingCurrentConfiguration"); //$NON-NLS-1$
+ private final static String NOT_ACTIVE_HDR = ConsolePlugin.Util.getString("WebServicesPanel.notActiveHdr"); //$NON-NLS-1$
+ private final static String NOT_ACTIVE_MSG = ConsolePlugin.Util.getString("WebServicesPanel.notActiveMsg"); //$NON-NLS-1$
+
+ private VirtualDatabase vdb;
+ private JButton publishButton;
+ private JButton unpublishButton;
+ private JPanel buttonsPanel;
+ private ConnectionInfo connection;
+
+ /**
+ * Constructor
+ * @param connection
+ */
+ public WebServicesPanel(ConnectionInfo connection) {
+ super();
+ this.connection = connection;
+ createButtons();
+ }
+
+ private VdbManager getVdbManager() {
+ return ModelManager.getVdbManager(connection);
+ }
+
+ private void createButtons() {
+ publishButton = new ButtonWidget(PUBLISH_BTN_LABEL);
+ unpublishButton = new ButtonWidget(UNPUBLISH_BTN_LABEL);
+ publishButton.addActionListener(new ActionListener() {
+
+ public void actionPerformed(ActionEvent ev) {
+ publishPressed();
+ }
+ });
+ unpublishButton.addActionListener(new ActionListener() {
+
+ public void actionPerformed(ActionEvent ev) {
+ unpublishPressed();
+ }
+ });
+ buttonsPanel = new JPanel(new GridLayout(1, 2, 5, 0));
+ buttonsPanel.add(publishButton);
+ buttonsPanel.add(unpublishButton);
+ }
+
+ private void publishPressed() {
+ if (checkIfActive()) {
+ launchWizard(true);
+ } else {
+ displayNotActiveDialog();
+ }
+ }
+
+ private void unpublishPressed() {
+ if (checkIfActive()) {
+ launchWizard(false);
+ } else {
+ displayNotActiveDialog();
+ }
+ }
+
+ private boolean checkIfActive() {
+ boolean continuing = true;
+ Boolean active = null;
+ boolean isActive = false;
+ try {
+ String vdbName = vdb.getName();
+ VirtualDatabaseID id = (VirtualDatabaseID)vdb.getID();
+ int version = (new Integer(id.getVersion())).intValue();
+ active = getVdbManager().isVDBActive(vdbName, version);
+ } catch (Exception ex) {
+ LogManager.logError(LogContexts.VIRTUAL_DATABASE, ex, ERROR_RETRIEVING_DATABASES);
+ ExceptionUtility.showMessage(ERROR_RETRIEVING_DATABASES, ex);
+ isActive = false;
+ continuing = false;
+ }
+ if (continuing) {
+ isActive = active.booleanValue();
+ }
+ return isActive;
+ }
+
+ private void displayNotActiveDialog() {
+ StaticUtilities.displayModalDialogWithOK(NOT_ACTIVE_HDR, NOT_ACTIVE_MSG, JOptionPane.WARNING_MESSAGE);
+ }
+
+ private void launchWizard(boolean publishing) {
+ ConfigurationManager configManager = ModelManager.getConfigurationManager(connection);
+ ConfigurationAdminAPI configAPI = ModelManager.getConfigurationAPI(connection);
+ Configuration currentConfig = null;
+ try {
+ currentConfig = configAPI.getCurrentConfiguration();
+ } catch (Exception ex) {
+ LogManager.logError(LogContexts.VIRTUAL_DATABASE, ex, ERROR_RETRIEVING_CURRENT_CONFIGURATION);
+ ExceptionUtility.showMessage(ERROR_RETRIEVING_CURRENT_CONFIGURATION, ex);
+ }
+ if (currentConfig != null) {
+ VirtualDatabaseID id = (VirtualDatabaseID)vdb.getID();
+ String version = id.getVersion();
+ WSDLWizardRunner runner = new WSDLWizardRunner(vdb.getName(), version, currentConfig, configManager, publishing);
+ runner.go();
+ }
+ }
+
+ public void setVirtualDatabase(VirtualDatabase vdb) {
+ if (this.vdb != vdb) {
+ this.vdb = vdb;
+
+ this.removeAll();
+ if (vdb != null) {
+ GridBagLayout layout = new GridBagLayout();
+ setLayout(layout);
+ WSDLOperationsDescription desc = getVdbManager().getWSDLOperationsDescription(vdb);
+ if (desc == null) {
+ JTextArea noWSDLTextArea = new JTextArea(NO_WSDL_TEXT);
+ noWSDLTextArea.setEditable(false);
+ noWSDLTextArea.setLineWrap(true);
+ noWSDLTextArea.setWrapStyleWord(true);
+ noWSDLTextArea.setBackground(this.getBackground());
+ this.add(noWSDLTextArea);
+ layout.setConstraints(noWSDLTextArea, new GridBagConstraints(0, 0, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER,
+ GridBagConstraints.BOTH, new Insets(10, 10, 10,
+ 10), 0, 0));
+ } else {
+ JPanel opsPanel = addOperationsDescription(desc);
+ add(opsPanel);
+ layout
+ .setConstraints(opsPanel, new GridBagConstraints(0, 0, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER,
+ GridBagConstraints.BOTH, new Insets(4, 4, 4, 4), 0, 0));
+ add(buttonsPanel);
+ layout.setConstraints(buttonsPanel, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER,
+ GridBagConstraints.NONE, new Insets(4, 4, 4, 4),
+ 0, 0));
+ }
+ }
+
+ }
+ }
+
+ private JPanel addOperationsDescription(WSDLOperationsDescription desc) {
+ // TODO
+ return new JPanel();
+ }
+}
Property changes on: trunk/console/src/main/java/com/metamatrix/console/ui/views/vdb/WebServicesPanel.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/console/src/main/java/com/metamatrix/console/util/SavedUDDIRegistryInfo.java
===================================================================
--- trunk/console/src/main/java/com/metamatrix/console/util/SavedUDDIRegistryInfo.java 2009-05-13 17:45:21 UTC (rev 929)
+++ trunk/console/src/main/java/com/metamatrix/console/util/SavedUDDIRegistryInfo.java 2009-05-13 18:07:37 UTC (rev 930)
@@ -1,123 +1,106 @@
/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
+ * Copyright 2000-2008 MetaMatrix, Inc. All rights reserved.
*/
-
package com.metamatrix.console.util;
-
-/**
+/**
* Data class to represent the info on UDDI registy that is saved to the properties file.
*
- * @since 4.2
+ * @since 5.5.3
*/
public class SavedUDDIRegistryInfo {
- private String name;
- private String userName;
- private String host;
- private String port;
-
- public SavedUDDIRegistryInfo(String name, String userName, String host, String port) {
- super();
- this.name = name;
- this.userName = userName;
- this.host = host;
- this.port = port;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public String getUserName() {
- return userName;
- }
-
- public void setUserName(String userName) {
- this.userName = userName;
- }
-
- public String getHost() {
- return host;
- }
-
- public void setHost(String host) {
- this.host = host;
- }
-
- public String getPort() {
- return port;
- }
-
- public void setPort(String port) {
- this.port = port;
- }
-
- public boolean equals(Object obj) {
- boolean same;
- if (obj == this) {
- same = true;
- } else if (!(obj instanceof SavedUDDIRegistryInfo)) {
- same = false;
- } else {
- SavedUDDIRegistryInfo that = (SavedUDDIRegistryInfo)obj;
- boolean nameMatches;
- boolean userNameMatches = false;
- boolean hostMatches = false;
- boolean portMatches = false;
- String thatName = that.getName();
- if (name == null) {
- nameMatches = (thatName == null);
- } else {
- nameMatches = name.equals(thatName);
- }
- if (nameMatches) {
- String thatUserName = that.getUserName();
- if (userName == null) {
- userNameMatches = (thatUserName == null);
- } else {
- userNameMatches = userName.equals(thatUserName);
- }
- if (userNameMatches) {
- String thatHost = that.getHost();
- if (host == null) {
- hostMatches = (thatHost == null);
- } else {
- hostMatches = host.equals(thatHost);
- }
- if (hostMatches) {
- String thatPort = that.getPort();
- if (port == null) {
- portMatches = (thatPort == null);
- } else {
- portMatches = port.equals(thatPort);
- }
- }
- }
- }
- same = (nameMatches && userNameMatches && hostMatches && portMatches);
- }
- return same;
- }
+ private String name;
+ private String userName;
+ private String inquiryUrl;
+ private String publishUrl;
+
+ public SavedUDDIRegistryInfo( String name,
+ String userName,
+ String inquiryUrl,
+ String publishUrl ) {
+ super();
+ this.name = name;
+ this.userName = userName;
+ this.inquiryUrl = inquiryUrl;
+ this.publishUrl = publishUrl;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName( String name ) {
+ this.name = name;
+ }
+
+ public String getUserName() {
+ return userName;
+ }
+
+ public void setUserName( String userName ) {
+ this.userName = userName;
+ }
+
+ public String getInquiryUrl() {
+ return inquiryUrl;
+ }
+
+ public void setInquiryUrl( String inquiryUrl ) {
+ this.inquiryUrl = inquiryUrl;
+ }
+
+ public String getPublishUrl() {
+ return publishUrl;
+ }
+
+ public void setPublishUrl( String publishUrl ) {
+ this.publishUrl = publishUrl;
+ }
+
+ public boolean equals( Object obj ) {
+ boolean same;
+ if (obj == this) {
+ same = true;
+ } else if (!(obj instanceof SavedUDDIRegistryInfo)) {
+ same = false;
+ } else {
+ SavedUDDIRegistryInfo that = (SavedUDDIRegistryInfo)obj;
+ boolean nameMatches;
+ boolean userNameMatches = false;
+ boolean inquiryUrlMatches = false;
+ boolean publishUrlMatches = false;
+ String thatName = that.getName();
+ if (name == null) {
+ nameMatches = (thatName == null);
+ } else {
+ nameMatches = name.equals(thatName);
+ }
+ if (nameMatches) {
+ String thatUserName = that.getUserName();
+ if (userName == null) {
+ userNameMatches = (thatUserName == null);
+ } else {
+ userNameMatches = userName.equals(thatUserName);
+ }
+ if (userNameMatches) {
+ String thatInquiryUrl = that.getInquiryUrl();
+ if (inquiryUrl == null) {
+ inquiryUrlMatches = (thatInquiryUrl == null);
+ } else {
+ inquiryUrlMatches = inquiryUrl.equals(thatInquiryUrl);
+ }
+ if (inquiryUrlMatches) {
+ String thatPublishUrl = that.getPublishUrl();
+ if (publishUrl == null) {
+ publishUrlMatches = (thatPublishUrl == null);
+ } else {
+ publishUrlMatches = publishUrl.equals(thatPublishUrl);
+ }
+ }
+ }
+ }
+ same = (nameMatches && userNameMatches && inquiryUrlMatches && publishUrlMatches);
+ }
+ return same;
+ }
}
Modified: trunk/console/src/main/java/com/metamatrix/console/util/StaticProperties.java
===================================================================
--- trunk/console/src/main/java/com/metamatrix/console/util/StaticProperties.java 2009-05-13 17:45:21 UTC (rev 929)
+++ trunk/console/src/main/java/com/metamatrix/console/util/StaticProperties.java 2009-05-13 18:07:37 UTC (rev 930)
@@ -215,155 +215,155 @@
}
public static SavedUDDIRegistryInfo[] getUDDIRegistryInfo() {
- Map /*<Integer (index stored with property) to SavedUDDIRegistryInfo>*/ infoMap = new HashMap();
- Properties properties = getProperties();
- Iterator it = properties.entrySet().iterator();
- while (it.hasNext()) {
- Map.Entry me = (Map.Entry)it.next();
- String key = (String)me.getKey();
- if (key.startsWith(UDDI_REGISTRY_NAME)) {
- String remainder = key.substring(UDDI_REGISTRY_NAME_STR_LEN);
- Integer index = null;
- try {
- index = new Integer(remainder);
- } catch (Exception ex) {
- }
- if (index != null) {
- String name = (String)me.getValue();
- SavedUDDIRegistryInfo info = (SavedUDDIRegistryInfo)infoMap.get(index);
- if (info == null) {
- info = new SavedUDDIRegistryInfo(name, null, null, null);
- infoMap.put(index, info);
- } else {
- info.setName(name);
- }
- }
- } else if (key.startsWith(UDDI_REGISTRY_USER)) {
- String remainder = key.substring(UDDI_REGISTRY_USER_STR_LEN);
- Integer index = null;
- try {
- index = new Integer(remainder);
- } catch (Exception ex) {
- }
- if (index != null) {
- String user = (String)me.getValue();
- SavedUDDIRegistryInfo info = (SavedUDDIRegistryInfo)infoMap.get(index);
- if (info == null) {
- info = new SavedUDDIRegistryInfo(null, user, null, null);
- infoMap.put(index, info);
- } else {
- info.setUserName(user);
- }
- }
- } else if (key.startsWith(UDDI_REGISTRY_HOST)) {
- String remainder = key.substring(UDDI_REGISTRY_HOST_STR_LEN);
- Integer index = null;
- try {
- index = new Integer(remainder);
- } catch (Exception ex) {
- }
- if (index != null) {
- String host = (String)me.getValue();
- SavedUDDIRegistryInfo info = (SavedUDDIRegistryInfo)infoMap.get(index);
- if (info == null) {
- info = new SavedUDDIRegistryInfo(null, null, host, null);
- infoMap.put(index, info);
- } else {
- info.setHost(host);
- }
- }
- } else if (key.startsWith(UDDI_REGISTRY_PORT)) {
- String remainder = key.substring(UDDI_REGISTRY_PORT_STR_LEN);
- Integer index = null;
- try {
- index = new Integer(remainder);
- } catch (Exception ex) {
- }
- if (index != null) {
- String port = (String)me.getValue();
- SavedUDDIRegistryInfo info = (SavedUDDIRegistryInfo)infoMap.get(index);
- if (info == null) {
- info = new SavedUDDIRegistryInfo(null, null, null, port);
- infoMap.put(index, info);
- } else {
- info.setPort(port);
- }
- }
- }
- }
- Map revisedInfoMap = new HashMap();
- it = infoMap.entrySet().iterator();
- while (it.hasNext()) {
- Map.Entry me = (Map.Entry)it.next();
- SavedUDDIRegistryInfo info = (SavedUDDIRegistryInfo)me.getValue();
- if ((info.getUserName() != null) && (info.getHost() != null) && (info.getPort() != null)) {
- revisedInfoMap.put(me.getKey(), info);
- }
- }
- SavedUDDIRegistryInfo[] result = new SavedUDDIRegistryInfo[revisedInfoMap.size()];
- int[] indices = new int[result.length];
- it = revisedInfoMap.entrySet().iterator();
- for (int i = 0; it.hasNext(); i++) {
- Map.Entry me = (Map.Entry)it.next();
- Integer intKey = (Integer)me.getKey();
- indices[i] = intKey.intValue();
- result[i] = (SavedUDDIRegistryInfo)me.getValue();
- }
- //Do bubble sort to put items in ascending order by index value
- boolean done = false;
- while (!done) {
- done = true;
- for (int i = 0; i < indices.length - 1; i++) {
- if (indices[i] > indices[i + 1]) {
- done = false;
- int tempInt = indices[i];
- indices[i] = indices[i + 1];
- indices[i + 1] = tempInt;
- SavedUDDIRegistryInfo tempInfo = result[i];
- result[i] = result[i + 1];
- result[i + 1] = tempInfo;
- }
- }
- }
- if (StaticProperties.numUDDIRegistries < 0) {
- StaticProperties.numUDDIRegistries = result.length;
- }
- return result;
- }
+ Map /* <Integer (index stored with property) to SavedUDDIRegistryInfo> */infoMap = new HashMap();
+ Properties properties = getProperties();
+ Iterator it = properties.entrySet().iterator();
+ while (it.hasNext()) {
+ Map.Entry me = (Map.Entry)it.next();
+ String key = (String)me.getKey();
+ if (key.startsWith(UDDI_REGISTRY_NAME)) {
+ String remainder = key.substring(UDDI_REGISTRY_NAME_STR_LEN);
+ Integer index = null;
+ try {
+ index = new Integer(remainder);
+ } catch (Exception ex) {
+ }
+ if (index != null) {
+ String name = (String)me.getValue();
+ SavedUDDIRegistryInfo info = (SavedUDDIRegistryInfo)infoMap.get(index);
+ if (info == null) {
+ info = new SavedUDDIRegistryInfo(name, null, null, null);
+ infoMap.put(index, info);
+ } else {
+ info.setName(name);
+ }
+ }
+ } else if (key.startsWith(UDDI_REGISTRY_USER)) {
+ String remainder = key.substring(UDDI_REGISTRY_USER_STR_LEN);
+ Integer index = null;
+ try {
+ index = new Integer(remainder);
+ } catch (Exception ex) {
+ }
+ if (index != null) {
+ String user = (String)me.getValue();
+ SavedUDDIRegistryInfo info = (SavedUDDIRegistryInfo)infoMap.get(index);
+ if (info == null) {
+ info = new SavedUDDIRegistryInfo(null, user, null, null);
+ infoMap.put(index, info);
+ } else {
+ info.setUserName(user);
+ }
+ }
+ } else if (key.startsWith(UDDI_REGISTRY_HOST)) {
+ String remainder = key.substring(UDDI_REGISTRY_HOST_STR_LEN);
+ Integer index = null;
+ try {
+ index = new Integer(remainder);
+ } catch (Exception ex) {
+ }
+ if (index != null) {
+ String inquiryUrl = (String)me.getValue();
+ SavedUDDIRegistryInfo info = (SavedUDDIRegistryInfo)infoMap.get(index);
+ if (info == null) {
+ info = new SavedUDDIRegistryInfo(null, null, inquiryUrl, null);
+ infoMap.put(index, info);
+ } else {
+ info.setInquiryUrl(inquiryUrl);
+ }
+ }
+ } else if (key.startsWith(UDDI_REGISTRY_PORT)) {
+ String remainder = key.substring(UDDI_REGISTRY_PORT_STR_LEN);
+ Integer index = null;
+ try {
+ index = new Integer(remainder);
+ } catch (Exception ex) {
+ }
+ if (index != null) {
+ String publishUrl = (String)me.getValue();
+ SavedUDDIRegistryInfo info = (SavedUDDIRegistryInfo)infoMap.get(index);
+ if (info == null) {
+ info = new SavedUDDIRegistryInfo(null, null, null, publishUrl);
+ infoMap.put(index, info);
+ } else {
+ info.setPublishUrl(publishUrl);
+ }
+ }
+ }
+ }
+ Map revisedInfoMap = new HashMap();
+ it = infoMap.entrySet().iterator();
+ while (it.hasNext()) {
+ Map.Entry me = (Map.Entry)it.next();
+ SavedUDDIRegistryInfo info = (SavedUDDIRegistryInfo)me.getValue();
+ if ((info.getUserName() != null) && (info.getInquiryUrl() != null) && (info.getPublishUrl() != null)) {
+ revisedInfoMap.put(me.getKey(), info);
+ }
+ }
+ SavedUDDIRegistryInfo[] result = new SavedUDDIRegistryInfo[revisedInfoMap.size()];
+ int[] indices = new int[result.length];
+ it = revisedInfoMap.entrySet().iterator();
+ for (int i = 0; it.hasNext(); i++) {
+ Map.Entry me = (Map.Entry)it.next();
+ Integer intKey = (Integer)me.getKey();
+ indices[i] = intKey.intValue();
+ result[i] = (SavedUDDIRegistryInfo)me.getValue();
+ }
+ // Do bubble sort to put items in ascending order by index value
+ boolean done = false;
+ while (!done) {
+ done = true;
+ for (int i = 0; i < indices.length - 1; i++) {
+ if (indices[i] > indices[i + 1]) {
+ done = false;
+ int tempInt = indices[i];
+ indices[i] = indices[i + 1];
+ indices[i + 1] = tempInt;
+ SavedUDDIRegistryInfo tempInfo = result[i];
+ result[i] = result[i + 1];
+ result[i + 1] = tempInfo;
+ }
+ }
+ }
+ if (StaticProperties.numUDDIRegistries < 0) {
+ StaticProperties.numUDDIRegistries = result.length;
+ }
+ return result;
+ }
+
+ public static void setUDDIRegistryInfo( SavedUDDIRegistryInfo[] info ) {
+ // First clean out the old
+ Properties properties = getProperties();
+ // To avoid ConcurrentModificationException, copy the keys to a separate list and
+ // iterate through that list.
+ java.util.List tempList = new ArrayList(properties.size());
+ Iterator it = properties.keySet().iterator();
+ while (it.hasNext()) {
+ String key = (String)it.next();
+ tempList.add(key);
+ }
+ it = tempList.iterator();
+ while (it.hasNext()) {
+ String key = (String)it.next();
+ if (key.startsWith(UDDI_REGISTRY_NAME) || key.startsWith(UDDI_REGISTRY_USER) || key.startsWith(UDDI_REGISTRY_HOST)
+ || key.startsWith(UDDI_REGISTRY_PORT)) {
+ UserPreferences.getInstance().removeValue(key);
+ }
+ }
+ // Then add the new
+ for (int i = 0; i < info.length; i++) {
+ int index = i + 1;
+ String key = UDDI_REGISTRY_NAME + index;
+ setProperty(key, info[i].getName());
+ key = UDDI_REGISTRY_USER + index;
+ setProperty(key, info[i].getUserName());
+ key = UDDI_REGISTRY_HOST + index;
+ setProperty(key, info[i].getInquiryUrl());
+ key = UDDI_REGISTRY_PORT + index;
+ setProperty(key, info[i].getPublishUrl());
+ }
+ }
- public static void setUDDIRegistryInfo(SavedUDDIRegistryInfo[] info) {
- //First clean out the old
- Properties properties = getProperties();
- //To avoid ConcurrentModificationException, copy the keys to a separate list and
- //iterate through that list.
- java.util.List tempList = new ArrayList(properties.size());
- Iterator it = properties.keySet().iterator();
- while (it.hasNext()) {
- String key = (String)it.next();
- tempList.add(key);
- }
- it = tempList.iterator();
- while (it.hasNext()) {
- String key = (String)it.next();
- if (key.startsWith(UDDI_REGISTRY_NAME) || key.startsWith(UDDI_REGISTRY_USER)
- || key.startsWith(UDDI_REGISTRY_HOST) || key.startsWith(UDDI_REGISTRY_PORT)) {
- UserPreferences.getInstance().removeValue(key);
- }
- }
- //Then add the new
- for (int i = 0; i < info.length; i++) {
- int index = i + 1;
- String key = UDDI_REGISTRY_NAME + index;
- setProperty(key, info[i].getName());
- key = UDDI_REGISTRY_USER + index;
- setProperty(key, info[i].getUserName());
- key = UDDI_REGISTRY_HOST + index;
- setProperty(key, info[i].getHost());
- key = UDDI_REGISTRY_PORT + index;
- setProperty(key, info[i].getPort());
- }
- }
-
public static Properties getProperties() {
return UserPreferences.getInstance().getProperties();
}
Modified: trunk/console/src/main/resources/com/metamatrix/console/i18n.properties
===================================================================
--- trunk/console/src/main/resources/com/metamatrix/console/i18n.properties 2009-05-13 17:45:21 UTC (rev 929)
+++ trunk/console/src/main/resources/com/metamatrix/console/i18n.properties 2009-05-13 18:07:37 UTC (rev 930)
@@ -190,11 +190,12 @@
UDDIConfigurationsDialog.selectAConfiguration=Select a Configuration:
UDDIConfigurationsDialog.configurationsColHdr=UDDI Configurations
UDDIConfigurationsDialog.configName=UDDI Configuration Name
-UDDIConfigurationsDialog.host=UDDI Host
-UDDIConfigurationsDialog.port=UDDI Port
+UDDIConfigurationsDialog.uddiInquiryUrl=UDDI Inquiry Url
+UDDIConfigurationsDialog.uddiPublishUrl=UDDI Publish Url
UDDIConfigurationsDialog.userName=UDDI User Name
UDDIConfigurationsDialog.noteLine1=Note: You will be prompted to enter a password whenever using
-UDDIConfigurationsDialog.noteLine2=a UDDI Configuration.
+UDDIConfigurationsDialog.noteLine2=a UDDI Configuration.
+
WebServicesPanel.publish=Publish Web Services
WebServicesPanel.unpublish=Unpublish Web Services
@@ -202,8 +203,39 @@
WebServicesPanel.errorRetrievingVirtualDatabases=Error Retrieving Virtual Databases
WebServicesPanel.errorRetrievingCurrentConfiguration=Error Retrieving Current Configuration
WebServicesPanel.notActiveMsg=This virtual database is not Active. Cannot publish or unpublish unless the virtual database is Active.
-WebServicesPanel.notActiveHdr=Not Active
+WebServicesPanel.notActiveHdr=Not Active
+
+MMUddiHelper.InvalidParameterException_in_Add_Business=InvalidParameterException while adding business: {0}
+MMUddiHelper.TransportException_in_WSDL_publish=TransportException while publishing WSDL: {0}
+MMUddiHelper.MalformedURLException_in_WSDL_publish=MalformedURLExceptrion while publishing WSDL: {0}
+MMUddiHelper.UDDIException_in_WSDL_publish=UDDIExceptrion while publishing WSDL: {0}
+MMUddiHelper.InvalidParameterException_in_WSDL_publish=InvalidParameterExceptrion while publishing WSDL: {0}
+MMUddiHelper.SOAPException_in_WSDL_publish=SOAPExceptrion while publishing WSDL: {0}
+
+MMUddiHelper.TransportException_in_WSDL_unpublish=TransportException while un-publishing WSDL: {0}
+MMUddiHelper.MalformedURLException_in_WSDL_unpublish=MalformedURLExceptrion while un-publishing WSDL: {0}
+MMUddiHelper.UDDIException_in_WSDL_unpublish=UDDIExceptrion while un-publishing WSDL: {0}
+MMUddiHelper.InvalidParameterException_in_WSDL_unpublish=InvalidParameterExceptrion while un-publishing WSDL: {0}
+MMUddiHelper.SOAPException_in_WSDL_unpublish=SOAPExceptrion while un-publishing WSDL: {0}
+
+MMUddiHelper.TransportException_isPublished=MMUddiHelper.TransportException in isPublished()" {0}
+MMUddiHelper.MalformedURLException_isPublished=MMUddiHelper. in isPublished()" {0}
+MMUddiHelper.UDDIException_isPublished=UDDIException in isPublished(): {0}
+
+MMUddiHelper.TransportException_finding_businesses_by_name=TransportException while finding business by name: {0}
+MMUddiHelper.MalformedURLException_finding_businesses_by_name=MalformedURLException while finding business by name: {0}
+MMUddiHelper.UDDIException_finding_businesses_by_name=UDDIException while finding business by name: {0}
+MMUddiHelper.InvalidParameterException_finding_businesses_by_name=InvalidParameterExceptrion while finding business by name: {0}
+MMUddiHelper.SOAPException_finding_businesses_by_name=SOAPException while finding business by name: {0}
+
+MMUddiHelper.TransportException_finding_all_businesses=TransportException while finding all businesses: {0}
+MMUddiHelper.MalformedURLException_finding_all_businesses=MalformedURLException while finding all businesses: {0}
+MMUddiHelper.UDDIException_finding_all_businesses=UDDIException while finding finding all businesses: {0}
+MMUddiHelper.InvalidParameterException_finding_all_businesses=InvalidParameterExceptrion while finding all businesses: {0}
+MMUddiHelper.SOAPException_finding_all_businesses=SOAPException while finding all businesses: {0}
+UnPublishWSDL.UnpublishWsdl.ErrorDeletingService=Error during deletion of Service operator: {0} generic: {1}
+
#----------------------------------------
# Materialization
#----------------------------------------
Modified: trunk/soap/src/main/java/com/metamatrix/soap/handler/ActionUpdateHandler.java
===================================================================
--- trunk/soap/src/main/java/com/metamatrix/soap/handler/ActionUpdateHandler.java 2009-05-13 17:45:21 UTC (rev 929)
+++ trunk/soap/src/main/java/com/metamatrix/soap/handler/ActionUpdateHandler.java 2009-05-13 18:07:37 UTC (rev 930)
@@ -42,8 +42,8 @@
import org.apache.axis2.handlers.AbstractHandler;
import org.apache.axis2.transport.http.HTTPConstants;
+import com.metamatrix.common.util.WSDLServletUtil;
import com.metamatrix.soap.exceptions.SOAPProcessingException;
-import com.metamatrix.soap.util.WSDLServletUtil;
import com.metamatrix.soap.util.WebServiceUtil;
/**
Modified: trunk/soap/src/main/java/com/metamatrix/soap/service/DataServiceWebServiceImpl.java
===================================================================
--- trunk/soap/src/main/java/com/metamatrix/soap/service/DataServiceWebServiceImpl.java 2009-05-13 17:45:21 UTC (rev 929)
+++ trunk/soap/src/main/java/com/metamatrix/soap/service/DataServiceWebServiceImpl.java 2009-05-13 18:07:37 UTC (rev 930)
@@ -43,6 +43,7 @@
import com.metamatrix.admin.api.objects.LogConfiguration;
import com.metamatrix.common.util.ByteArrayHelper;
+import com.metamatrix.common.util.WSDLServletUtil;
import com.metamatrix.core.util.StringUtil;
import com.metamatrix.jdbc.api.SQLStates;
import com.metamatrix.soap.SOAPPlugin;
@@ -50,7 +51,6 @@
import com.metamatrix.soap.security.Credential;
import com.metamatrix.soap.sqlquerywebservice.log.LogUtil;
import com.metamatrix.soap.util.EndpointUriTranslatorStrategyImpl;
-import com.metamatrix.soap.util.WSDLServletUtil;
import com.metamatrix.soap.util.WebServiceUtil;
/**
Modified: trunk/soap/src/main/java/com/metamatrix/soap/servlet/MMDiscoverWSDLServlet.java
===================================================================
--- trunk/soap/src/main/java/com/metamatrix/soap/servlet/MMDiscoverWSDLServlet.java 2009-05-13 17:45:21 UTC (rev 929)
+++ trunk/soap/src/main/java/com/metamatrix/soap/servlet/MMDiscoverWSDLServlet.java 2009-05-13 18:07:37 UTC (rev 930)
@@ -35,12 +35,12 @@
import com.metamatrix.admin.api.exception.AdminException;
import com.metamatrix.api.exception.security.LogonException;
+import com.metamatrix.common.util.WSDLServletUtil;
import com.metamatrix.core.log.FileLogWriter;
import com.metamatrix.core.log.MessageLevel;
import com.metamatrix.core.util.StringUtil;
import com.metamatrix.soap.SOAPPlugin;
import com.metamatrix.soap.object.MMServerInfo;
-import com.metamatrix.soap.util.WSDLServletUtil;
import com.metamatrix.soap.util.WebServiceUtil;
/**
Modified: trunk/soap/src/main/java/com/metamatrix/soap/servlet/MMGetVDBResourceServlet.java
===================================================================
--- trunk/soap/src/main/java/com/metamatrix/soap/servlet/MMGetVDBResourceServlet.java 2009-05-13 17:45:21 UTC (rev 929)
+++ trunk/soap/src/main/java/com/metamatrix/soap/servlet/MMGetVDBResourceServlet.java 2009-05-13 18:07:37 UTC (rev 930)
@@ -48,6 +48,7 @@
import org.apache.log4j.Logger;
import com.metamatrix.common.api.MMURL;
+import com.metamatrix.common.util.WSDLServletUtil;
import com.metamatrix.core.CoreConstants;
import com.metamatrix.core.log.FileLogWriter;
import com.metamatrix.core.log.LogListener;
@@ -56,7 +57,6 @@
import com.metamatrix.soap.SOAPPlugin;
import com.metamatrix.soap.util.ErrorMessageKeys;
import com.metamatrix.soap.util.SOAPConstants;
-import com.metamatrix.soap.util.WSDLServletUtil;
import com.metamatrix.soap.util.WebServiceUtil;
Modified: trunk/soap/src/main/java/com/metamatrix/soap/servlet/MMGetWSDLServlet.java
===================================================================
--- trunk/soap/src/main/java/com/metamatrix/soap/servlet/MMGetWSDLServlet.java 2009-05-13 17:45:21 UTC (rev 929)
+++ trunk/soap/src/main/java/com/metamatrix/soap/servlet/MMGetWSDLServlet.java 2009-05-13 18:07:37 UTC (rev 930)
@@ -34,13 +34,13 @@
import org.apache.log4j.Logger;
+import com.metamatrix.common.util.WSDLServletUtil;
import com.metamatrix.core.log.FileLogWriter;
import com.metamatrix.core.log.MessageLevel;
import com.metamatrix.core.util.StringUtil;
import com.metamatrix.soap.SOAPPlugin;
import com.metamatrix.soap.util.ErrorMessageKeys;
import com.metamatrix.soap.util.SOAPConstants;
-import com.metamatrix.soap.util.WSDLServletUtil;
import com.metamatrix.soap.util.WebServiceUtil;
/**
Modified: trunk/soap/src/main/java/com/metamatrix/soap/servlet/WSDLURLGenerator.java
===================================================================
--- trunk/soap/src/main/java/com/metamatrix/soap/servlet/WSDLURLGenerator.java 2009-05-13 17:45:21 UTC (rev 929)
+++ trunk/soap/src/main/java/com/metamatrix/soap/servlet/WSDLURLGenerator.java 2009-05-13 18:07:37 UTC (rev 930)
@@ -43,13 +43,13 @@
import org.apache.log4j.Logger;
+import com.metamatrix.common.util.WSDLServletUtil;
import com.metamatrix.core.log.FileLogWriter;
import com.metamatrix.core.log.LogListener;
import com.metamatrix.core.log.MessageLevel;
import com.metamatrix.soap.SOAPPlugin;
import com.metamatrix.soap.util.ErrorMessageKeys;
import com.metamatrix.soap.util.SOAPConstants;
-import com.metamatrix.soap.util.WSDLServletUtil;
/**
* Servlet to build the WSDL URL for the specified VDB
Modified: trunk/soap/src/main/java/com/metamatrix/soap/util/EndpointUriTranslatorStrategyImpl.java
===================================================================
--- trunk/soap/src/main/java/com/metamatrix/soap/util/EndpointUriTranslatorStrategyImpl.java 2009-05-13 17:45:21 UTC (rev 929)
+++ trunk/soap/src/main/java/com/metamatrix/soap/util/EndpointUriTranslatorStrategyImpl.java 2009-05-13 18:07:37 UTC (rev 930)
@@ -30,6 +30,7 @@
import org.apache.axis2.context.MessageContext;
+import com.metamatrix.common.util.WSDLServletUtil;
import com.metamatrix.soap.exceptions.SOAPProcessingException;
import com.metamatrix.soap.handler.ActionUpdateHandler;
import com.metamatrix.soap.service.DataServiceInfo;
Deleted: trunk/soap/src/main/java/com/metamatrix/soap/util/WSDLServletUtil.java
===================================================================
--- trunk/soap/src/main/java/com/metamatrix/soap/util/WSDLServletUtil.java 2009-05-13 17:45:21 UTC (rev 929)
+++ trunk/soap/src/main/java/com/metamatrix/soap/util/WSDLServletUtil.java 2009-05-13 18:07:37 UTC (rev 930)
@@ -1,225 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package com.metamatrix.soap.util;
-
-import java.io.UnsupportedEncodingException;
-import java.net.URLEncoder;
-import java.text.MessageFormat;
-import java.util.Iterator;
-import java.util.List;
-
-/**
- * Constants pertaining to WSDL servlet execution.
- *
- * @since 4.2
- */
-
-public class WSDLServletUtil {
-
- /**
- * General keys
- */
- public static final String SERVER_URL_KEY = "ServerURL"; //$NON-NLS-1$
-
- public static final String SECURE_PROTOCOL = "Secure"; //$NON-NLS-1$
-
- public static final String VDB_NAME_KEY = "VDBName"; //$NON-NLS-1$
-
- public static final String VDB_VERSION_KEY = "VDBVersion"; //$NON-NLS-1$
-
- public static final String ADD_PROPS = "AdditionalProperties"; //$NON-NLS-1$
-
- public static final String TXN_AUTO_WRAP = "txnAutoWrap"; //$NON-NLS-1$
-
- public static final String ADD_EXEC_PROPS = "AddExecProperties"; //$NON-NLS-1$
-
- public static final String MM_WEBSERVICE_QUERY_TIMEOUT = "com.metamatrix.webservice.querytimeout"; //$NON-NLS-1$
-
- public static final String DISCOVERED_WSDL = "discovered_wsdl"; //$NON-NLS-1$
-
- /*
- * This is the parameter that will tell this servlet when the web service endpoint as defined in WSDL served up by this
- * servlet will use the HTTP vs HTTPS protocol.
- */
- public static final String HTTP_TYPE_PARAMETER_KEY = "httptype"; //$NON-NLS-1$
-
- /*
- * This is the value of the httptype URL request param that will indicate that the returned WSDL should have an http endpoint
- * instead of an https endpoint.
- */
- public static final String HTTP_PARAMETER_VALUE = "http"; //$NON-NLS-1$
-
- /*
- * Static contant representing the standard http protocol.
- */
- public static final String HTTP = "http"; //$NON-NLS-1$
-
- /**
- * Static contant representing the secure http protocol.
- */
- public static final String HTTPS = "https"; //$NON-NLS-1$
-
- /**
- * Default content type for the VDBResourceServlet
- */
- public static final String DEFAULT_CONTENT_TYPE = "text/html"; //$NON-NLS-1$
-
- /**
- * XML content type for the VDBResourceServlet
- */
- public static final String XML_CONTENT_TYPE = "text/xml"; //$NON-NLS-1$
-
- /**
- * WSDL URL Generator keys
- */
- public static final String MMSERVER_HOST_PORT_KEY = "MMServerHostAndPort"; //$NON-NLS-1$
-
- public static final String TARGET_HOST_KEY = "TargetHost"; //$NON-NLS-1$
-
- public static final String TARGET_PORT_KEY = "TargetPort"; //$NON-NLS-1$
-
- public static final String SERVLET_PATH = "/servlet/ArtifactDocumentService"; //$NON-NLS-1$
-
- public static final String SQLQUERYWEBSERVICE_WSDL_PATH = "/services/SqlQueryWebService?wsdl"; //$NON-NLS-1$
-
- public static final String GENERATED_WSDL_NAME = "MetaMatrixDataServices"; //$NON-NLS-1$
-
- public static final String GENERATED_WSDL_FILENAME = GENERATED_WSDL_NAME + ".wsdl"; //$NON-NLS-1$
-
- public static final String COLON = ":"; //$NON-NLS-1$
-
- public static final String SLASH = "/"; //$NON-NLS-1$
-
- public static final String DOUBLE_SLASH = "//"; //$NON-NLS-1$
-
- public static final String AMP = "&"; //$NON-NLS-1$
-
- public static final String QUESTION_MARK = "?"; //$NON-NLS-1$
-
- public static final String EQUALS = "="; //$NON-NLS-1$
-
- public static final String COMMA = ","; //$NON-NLS-1$
-
- private static final String SQLQUERYWEBSERVICE_URL_FORMAT = "{0}://{1}:{2}/{3}"; //$NON-NLS-1$
-
- /*
- * this default value is based on Tomcat's default value in its server.xml file. This value can be overridden by setting the
- * com.metamatrix.webservice.dataservice.httpsport System property for the VM that this servlet is running in.
- */
- private static final String DEFAULT_HTTPS_PORT = "8443"; //$NON-NLS-1$
-
- private static final String DEFAULT_HTTP_PORT = "8080"; //$NON-NLS-1$
-
- private static final String HTTPS_PORT_PROPERTY_KEY = "com.metamatrix.webservice.dataservice.httpsport"; //$NON-NLS-1$
-
- private static final String HTTP_PORT_PROPERTY_KEY = "com.metamatrix.webservice.dataservice.httpport"; //$NON-NLS-1$
-
- /**
- * Returns the formatted url from the supplied info
- *
- * @param scheme the server scheme
- * @param host the server host name
- * @param port the server port
- * @param appContext the context of this application to use in the WSDL url
- * @param serverURLs the list of server url info, first url is full url including protocol. Subsequent items are just the
- * host:port strings.
- * @param vdbName the vdb name
- * @param vdbVersion the vdb version number
- */
- public static String formatURL( String scheme,
- String host,
- String port,
- String appContext,
- List serverURLs,
- String vdbName,
- String vdbVersion ) {
-
- StringBuffer result = new StringBuffer();
- try {
- boolean hasPort = true;
- boolean hasVDBVersion = true;
-
- if (port == null || port.length() == 0) {
- hasPort = false;
- }
-
- if (vdbVersion == null || vdbVersion.trim().length() == 0) {
- hasVDBVersion = false;
- }
-
- result.append(scheme).append(COLON).append(DOUBLE_SLASH).append(host);
-
- if (hasPort) {
- result.append(COLON).append(port);
- }
-
- result.append(appContext).append(SERVLET_PATH).append(SLASH).append(GENERATED_WSDL_FILENAME);
- result.append(QUESTION_MARK).append(SERVER_URL_KEY).append(EQUALS);
- // Append comma-delimited server urls
- Iterator iter = serverURLs.iterator();
- while (iter.hasNext()) {
- String serverURL = (String)iter.next();
- result.append(serverURL);
- // If there is another url coming, add an encoded comma
- if (iter.hasNext()) {
- result.append(URLEncoder.encode(COMMA, "UTF-8")); //$NON-NLS-1$
- }
- }
- result.append(AMP).append(VDB_NAME_KEY).append(EQUALS).append(vdbName);
- if (hasVDBVersion) {
- result.append(AMP).append(VDB_VERSION_KEY).append(EQUALS).append(vdbVersion);
- }
-
- } catch (UnsupportedEncodingException err) {
- // ignore
- }
-
- return result.toString();
- }
-
- /**
- * Returns the formatted wsdl url for the SqlQueryWebService
- *
- * @param server - server name
- * @param appContext the context of this application to use in the WSDL url
- * @param secure - secure ssl (true) or non-secure (false)
- * @return wsdlUrl - String
- * @since 4.3
- */
- public static String getSqlQueryWebServiceUrl( final String server,
- String appContext,
- final boolean secure ) {
-
- appContext=appContext.replace("/",""); //$NON-NLS-1$ //$NON-NLS-2$
- return MessageFormat.format(SQLQUERYWEBSERVICE_URL_FORMAT, new Object[] {secure ? HTTPS : HTTP, server,
- secure ? getHttpsPort() : getHttpPort(), appContext+SQLQUERYWEBSERVICE_WSDL_PATH});
- }
-
- public static final String getHttpsPort() {
- return System.getProperty(HTTPS_PORT_PROPERTY_KEY, DEFAULT_HTTPS_PORT);
- }
-
- public static final String getHttpPort() {
- return System.getProperty(HTTP_PORT_PROPERTY_KEY, DEFAULT_HTTP_PORT);
- }
-}
Modified: trunk/soap/src/test/java/com/metamatrix/soap/handler/TestActionUpdateHandler.java
===================================================================
--- trunk/soap/src/test/java/com/metamatrix/soap/handler/TestActionUpdateHandler.java 2009-05-13 17:45:21 UTC (rev 929)
+++ trunk/soap/src/test/java/com/metamatrix/soap/handler/TestActionUpdateHandler.java 2009-05-13 18:07:37 UTC (rev 930)
@@ -29,7 +29,7 @@
import org.apache.axis2.context.MessageContext;
-import com.metamatrix.soap.util.WSDLServletUtil;
+import com.metamatrix.common.util.WSDLServletUtil;
public class TestActionUpdateHandler extends TestCase{
Modified: trunk/soap/src/test/java/com/metamatrix/soap/service/TestDataServiceWebServiceImpl.java
===================================================================
--- trunk/soap/src/test/java/com/metamatrix/soap/service/TestDataServiceWebServiceImpl.java 2009-05-13 17:45:21 UTC (rev 929)
+++ trunk/soap/src/test/java/com/metamatrix/soap/service/TestDataServiceWebServiceImpl.java 2009-05-13 18:07:37 UTC (rev 930)
@@ -28,7 +28,7 @@
import org.apache.axis2.AxisFault;
-import com.metamatrix.soap.util.WSDLServletUtil;
+import com.metamatrix.common.util.WSDLServletUtil;
/**
*
Modified: trunk/soap/src/test/java/com/metamatrix/soap/servlet/TestMMGetVDBResourceServlet.java
===================================================================
--- trunk/soap/src/test/java/com/metamatrix/soap/servlet/TestMMGetVDBResourceServlet.java 2009-05-13 17:45:21 UTC (rev 929)
+++ trunk/soap/src/test/java/com/metamatrix/soap/servlet/TestMMGetVDBResourceServlet.java 2009-05-13 18:07:37 UTC (rev 930)
@@ -25,7 +25,7 @@
import java.util.Map;
import java.util.TreeMap;
-import com.metamatrix.soap.util.WSDLServletUtil;
+import com.metamatrix.common.util.WSDLServletUtil;
import junit.framework.TestCase;
Modified: trunk/soap/src/test/java/com/metamatrix/soap/util/TestWSDLServletUtil.java
===================================================================
--- trunk/soap/src/test/java/com/metamatrix/soap/util/TestWSDLServletUtil.java 2009-05-13 17:45:21 UTC (rev 929)
+++ trunk/soap/src/test/java/com/metamatrix/soap/util/TestWSDLServletUtil.java 2009-05-13 18:07:37 UTC (rev 930)
@@ -25,7 +25,7 @@
import java.util.ArrayList;
import java.util.List;
-import com.metamatrix.soap.util.WSDLServletUtil;
+import com.metamatrix.common.util.WSDLServletUtil;
import junit.framework.TestCase;
More information about the teiid-commits
mailing list