diff options
Diffstat (limited to 'bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/uddi/actions')
63 files changed, 9880 insertions, 0 deletions
diff --git a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/uddi/actions/AddItemsToFavoritesAction.java b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/uddi/actions/AddItemsToFavoritesAction.java new file mode 100644 index 000000000..6043aebc1 --- /dev/null +++ b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/uddi/actions/AddItemsToFavoritesAction.java @@ -0,0 +1,56 @@ +/******************************************************************************* + * Copyright (c) 2001, 2004 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ + +package org.eclipse.wst.ws.internal.explorer.platform.uddi.actions; + +import org.eclipse.wst.ws.internal.explorer.platform.constants.*; +import org.eclipse.wst.ws.internal.explorer.platform.perspective.*; +import org.eclipse.wst.ws.internal.explorer.platform.uddi.constants.*; +import org.eclipse.wst.ws.internal.explorer.platform.uddi.perspective.*; +import org.eclipse.wst.ws.internal.explorer.platform.util.*; + +import java.util.*; + +public class AddItemsToFavoritesAction extends UDDIPropertiesFormAction +{ + public AddItemsToFavoritesAction(Controller controller) + { + super(controller); + } + + protected boolean processParsedResults(MultipartFormDataParser parser) throws MultipartFormDataException + { + String[] selectedNodeIds = parser.getParameterValues(ActionInputs.NODEID); + // The client Javascript enforces the rule that at least one item was selected before the form can be submitted. + propertyTable_.put(UDDIActionInputs.SELECTED_NODEIDS,selectedNodeIds); + return true; + } + + public final boolean run() + { + String[] selectedNodeIds = (String[])propertyTable_.get(UDDIActionInputs.SELECTED_NODEIDS); + AddToFavoritesAction action = new AddToFavoritesAction(controller_); + Hashtable propertyTable = action.getPropertyTable(); + for (int i=0;i<selectedNodeIds.length;i++) + { + propertyTable.put(ActionInputs.NODEID,selectedNodeIds[i]); + if (action.favoriteExists()) { + UDDIPerspective uddiPerspective = controller_.getUDDIPerspective(); + Node node = uddiPerspective.getNavigatorManager().getNode(Integer.parseInt(selectedNodeIds[i])); + String nodeName = node.getNodeName(); + uddiPerspective.getMessageQueue().addMessage(uddiPerspective.getMessage("MSG_ERROR_FAVORITE_ALREADY_EXISTS",nodeName)); + } + else + action.run(); + } + return true; + } +} diff --git a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/uddi/actions/AddPublisherAssertionsAction.java b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/uddi/actions/AddPublisherAssertionsAction.java new file mode 100644 index 000000000..91dcb6ff1 --- /dev/null +++ b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/uddi/actions/AddPublisherAssertionsAction.java @@ -0,0 +1,231 @@ +/******************************************************************************* + * Copyright (c) 2001, 2004 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ + +package org.eclipse.wst.ws.internal.explorer.platform.uddi.actions; + +import org.eclipse.wst.ws.internal.explorer.platform.datamodel.*; +import org.eclipse.wst.ws.internal.explorer.platform.perspective.*; +import org.eclipse.wst.ws.internal.explorer.platform.uddi.constants.*; +import org.eclipse.wst.ws.internal.explorer.platform.uddi.datamodel.*; +import org.eclipse.wst.ws.internal.explorer.platform.uddi.perspective.*; +import org.eclipse.wst.ws.internal.explorer.platform.util.*; + +import org.uddi4j.*; +import org.uddi4j.util.*; +import org.uddi4j.response.*; +import org.uddi4j.client.UDDIProxy; +import org.uddi4j.datatype.assertion.*; +import org.uddi4j.datatype.business.BusinessEntity; +import org.uddi4j.datatype.tmodel.TModel; +import org.uddi4j.transport.TransportException; + +import java.util.*; +import java.net.*; + +public class AddPublisherAssertionsAction extends CommonPublisherAssertionsAction +{ + public AddPublisherAssertionsAction(Controller controller) + { + super(controller); + } + + protected final boolean processParsedResults(MultipartFormDataParser parser) throws MultipartFormDataException + { + if (registryNode_ == null) + return false; + + boolean inputsValid = true; + UDDIPerspective uddiPerspective = controller_.getUDDIPerspective(); + MessageQueue messageQueue = uddiPerspective.getMessageQueue(); + FormTool formTool = getSelectedFormTool(); + + // ids from uddiObjects_table.jsp + String[] selectedBusIds = parser.getParameterValues(UDDIActionInputs.PUBLISHER_ASSERTIONS_SELECTED_BUS_ID); + if (selectedBusIds == null || selectedBusIds.length == 0) { + // Synchronize client view and server model (uddiObject_table.jsp) + synchronizeUDDIObjectTable(); + inputsValid = false; + } + else { + propertyTable_.put(UDDIActionInputs.PUBLISHER_ASSERTIONS_SELECTED_BUS_ID, selectedBusIds); + // Synchronize client view and server model (uddiObject_table.jsp) + synchronizeUDDIObjectTable(); + } + + String[] assertionTypes = parser.getParameterValues(UDDIActionInputs.PUBLISHER_ASSERTIONS_TYPE); + if (assertionTypes != null && assertionTypes.length > 0) + propertyTable_.put(UDDIActionInputs.PUBLISHER_ASSERTIONS_TYPE, assertionTypes); + else + inputsValid = false; + + String[] directions = parser.getParameterValues(UDDIActionInputs.PUBLISHER_ASSERTIONS_DIRECTION); + if (directions != null && directions.length > 0) + propertyTable_.put(UDDIActionInputs.PUBLISHER_ASSERTIONS_DIRECTION, directions); + else + inputsValid = false; + + // if not yet logged in, validate the parameters needed to log in + if (!isLoggedIn_) { + String publishURL = parser.getParameter(UDDIActionInputs.QUERY_INPUT_ADVANCED_PUBLISH_URL); + String userID = parser.getParameter(UDDIActionInputs.QUERY_INPUT_ADVANCED_USERID); + String password = parser.getParameter(UDDIActionInputs.QUERY_INPUT_ADVANCED_PASSWORD); + + if (publishURL != null) + { + propertyTable_.put(UDDIActionInputs.QUERY_INPUT_ADVANCED_PUBLISH_URL,publishURL); + formTool.setProperty(UDDIActionInputs.QUERY_INPUT_ADVANCED_PUBLISH_URL,publishURL); + } + + if (!Validator.validateString(publishURL)) + { + inputsValid = false; + formTool.flagError(UDDIActionInputs.QUERY_INPUT_ADVANCED_PUBLISH_URL); + messageQueue.addMessage(uddiPerspective.getMessage("MSG_ERROR_INVALID_PUBLISH_URL")); + } + + if (userID != null) + { + propertyTable_.put(UDDIActionInputs.QUERY_INPUT_ADVANCED_USERID,userID); + formTool.setProperty(UDDIActionInputs.QUERY_INPUT_ADVANCED_USERID,userID); + } + + if (!Validator.validateString(userID)) + { + inputsValid = false; + formTool.flagError(UDDIActionInputs.QUERY_INPUT_ADVANCED_USERID); + messageQueue.addMessage(uddiPerspective.getMessage("MSG_ERROR_INVALID_USERID")); + } + + if (password != null) + { + propertyTable_.put(UDDIActionInputs.QUERY_INPUT_ADVANCED_PASSWORD,password); + formTool.setProperty(UDDIActionInputs.QUERY_INPUT_ADVANCED_PASSWORD,password); + } + } + + return inputsValid; + } + + public boolean run() + { + if (registryNode_ == null) + return false; + + RegistryElement registryElement = (RegistryElement)registryNode_.getTreeElement(); + UDDIPerspective uddiPerspective = controller_.getUDDIPerspective(); + MessageQueue messageQueue = uddiPerspective.getMessageQueue(); + NodeManager navigatorManager = uddiPerspective.getNavigatorManager(); + Node selectedNode = navigatorManager.getSelectedNode(); + TreeElement selectedElement = selectedNode.getTreeElement(); + + // if not yet logged in, log in first + if (!isLoggedIn_) { + String publishURL = (String)propertyTable_.get(UDDIActionInputs.QUERY_INPUT_ADVANCED_PUBLISH_URL); + String userID = (String)propertyTable_.get(UDDIActionInputs.QUERY_INPUT_ADVANCED_USERID); + String password = (String)propertyTable_.get(UDDIActionInputs.QUERY_INPUT_ADVANCED_PASSWORD); + + try { + registryElement.performLogin(publishURL, userID, password); + } + catch (TransportException te) { + messageQueue.addMessage(controller_.getMessage("MSG_ERROR_UNEXPECTED")); + messageQueue.addMessage("TransportException"); + messageQueue.addMessage(te.getMessage()); + return false; + } + catch (UDDIException uddie) { + messageQueue.addMessage(controller_.getMessage("MSG_ERROR_UNEXPECTED")); + messageQueue.addMessage("UDDIException"); + messageQueue.addMessage(uddie.toString()); + return false; + } + catch (MalformedURLException me) { + messageQueue.addMessage(controller_.getMessage("MSG_ERROR_UNEXPECTED")); + messageQueue.addMessage("MalformedURLException"); + messageQueue.addMessage(me.getMessage()); + return false; + } + } + + UDDIProxy proxy = registryElement.getProxy(); + String userID = registryElement.getUserId(); + String cred = registryElement.getCred(); + BusinessElement busElement = (BusinessElement)selectedElement; + + // determine whether this is a owned business + // if not, the AddPublisherAssertionsAction cannot be performed + if (!isBusinessOwned(busElement)) { + messageQueue.addMessage(controller_.getMessage("MSG_ERROR_NOT_OWNED_BUSINESS")); + return false; + } + + try { + String[] assertionTypes = (String[])propertyTable_.get(UDDIActionInputs.PUBLISHER_ASSERTIONS_TYPE); + String[] directions = (String[])propertyTable_.get(UDDIActionInputs.PUBLISHER_ASSERTIONS_DIRECTION); + String thisBusinessKey = busElement.getBusinessEntity().getBusinessKey(); + + // get all selected businesses + FormTool formTool = (FormTool)(selectedNode.getCurrentToolManager().getSelectedTool()); + String subQueryKey = (String)formTool.getProperty(UDDIActionInputs.SUBQUERY_KEY); + FormToolPropertiesInterface formToolPI = ((MultipleFormToolPropertiesInterface)formTool).getFormToolProperties(subQueryKey); + Vector selectedBusinesses = (Vector)formToolPI.getProperty(UDDIActionInputs.QUERY_INPUT_ADD_PUBLISHER_ASSERTIONS); + Enumeration e = selectedBusinesses.elements(); + if (!e.hasMoreElements()) + return true; + + // create a vector of publisher assertions based on all the selected businesses + Vector pubAssertionVector = new Vector(); + int i = 0; + while (e.hasMoreElements()) { + ListElement le = (ListElement)e.nextElement(); + BusinessEntity sp = (BusinessEntity)le.getObject(); + KeyedReference keyedRef = new KeyedReference(assertionTypes[i], assertionTypes[i], TModel.RELATIONSHIPS_TMODEL_KEY); + if (Integer.parseInt(directions[i]) == UDDIActionInputs.DIRECTION_TO) + pubAssertionVector.add(new PublisherAssertion(sp.getBusinessKey(), thisBusinessKey, keyedRef)); + else + pubAssertionVector.add(new PublisherAssertion(thisBusinessKey, sp.getBusinessKey(), keyedRef)); + i++; + } + + // proxy.add_publisherAssertions(...) + DispositionReport report = proxy.add_publisherAssertions(registryElement.getAuthInfoString(), pubAssertionVector); + + // refresh publisher assertions iff proxy reports success + if (report.success()) { + selectedBusinesses.removeAllElements(); + ShowPublisherAssertionsAction showPAAction = new ShowPublisherAssertionsAction(controller_); + Hashtable propertyTable = showPAAction.getPropertyTable(); + Object ids = propertyTable_.get(UDDIActionInputs.PUBLISHER_ASSERTIONS_SELECTED_BUS_ID); + if (ids != null) + propertyTable.put(UDDIActionInputs.PUBLISHER_ASSERTIONS_SELECTED_BUS_ID, ids); + showPAAction.run(); + } + + return report.success(); + } + catch (UDDIException uddie) { + messageQueue.addMessage(controller_.getMessage("MSG_ERROR_UNEXPECTED")); + messageQueue.addMessage("UDDIException"); + DispositionReport report = uddie.getDispositionReport(); + Vector reportErrInfo = report.getResultVector(); + for (int i = 0; i < reportErrInfo.size(); i++) { + messageQueue.addMessage(((Result) reportErrInfo.get(i)).getErrInfo().getText()); + } + return false; + } + catch(Exception e) { + messageQueue.addMessage(controller_.getMessage("MSG_ERROR_UNEXPECTED")); + messageQueue.addMessage("Exception"); + messageQueue.addMessage(e.getMessage()); + return false; + } + } +} diff --git a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/uddi/actions/AddToFavoritesAction.java b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/uddi/actions/AddToFavoritesAction.java new file mode 100644 index 000000000..1a337bc0a --- /dev/null +++ b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/uddi/actions/AddToFavoritesAction.java @@ -0,0 +1,231 @@ +/******************************************************************************* + * Copyright (c) 2001, 2004 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ + +package org.eclipse.wst.ws.internal.explorer.platform.uddi.actions; + + +import org.eclipse.wst.ws.internal.explorer.platform.constants.*; +import org.eclipse.wst.ws.internal.explorer.platform.datamodel.*; +import org.eclipse.wst.ws.internal.explorer.platform.favorites.constants.*; +import org.eclipse.wst.ws.internal.explorer.platform.favorites.datamodel.*; +import org.eclipse.wst.ws.internal.explorer.platform.favorites.perspective.*; +import org.eclipse.wst.ws.internal.explorer.platform.perspective.*; +import org.eclipse.wst.ws.internal.explorer.platform.uddi.datamodel.*; +import org.eclipse.wst.ws.internal.explorer.platform.uddi.perspective.*; + +import java.util.*; + +public class AddToFavoritesAction extends UDDINodeAction +{ + public AddToFavoritesAction(Controller controller) + { + super(controller); + } + + public static String getActionLink(int nodeId) + { + StringBuffer actionLink = new StringBuffer("uddi/actions/CheckFavoriteExistsActionJSP.jsp?"); + actionLink.append(ActionInputs.NODEID).append('=').append(nodeId); + return actionLink.toString(); + } + + public final boolean registryExists(String registryName,Node registryNode) + { + RegistryElement regElement = (RegistryElement)registryNode.getTreeElement(); + Hashtable table = new Hashtable(); + table.put(FavoritesModelConstants.PROP_UDDI_REGISTRY_NAME,registryName); + return favoriteExists(table,FavoritesModelConstants.REL_UDDI_REGISTRY_FOLDER_NODE); + } + + public final boolean businessExists(String businessName,Node businessNode) + { + BusinessElement busElement = (BusinessElement)businessNode.getTreeElement(); + RegistryElement regElement = (RegistryElement)regNode_.getTreeElement(); + String businessKey = busElement.getBusinessEntity().getBusinessKey(); + String inquiryURL = regElement.getInquiryURL(); + Hashtable table = new Hashtable(); + table.put(FavoritesModelConstants.PROP_UDDI_BUSINESS_NAME,businessName); + table.put(FavoritesModelConstants.PROP_UDDI_BUSINESS_INQUIRY_API,inquiryURL); + table.put(FavoritesModelConstants.PROP_UDDI_BUSINESS_KEY, businessKey); + return favoriteExists(table,FavoritesModelConstants.REL_UDDI_BUSINESS_FOLDER_NODE); + } + + public final boolean serviceExists(String serviceName,Node serviceNode) + { + ServiceElement serviceElement = (ServiceElement)serviceNode.getTreeElement(); + RegistryElement regElement = (RegistryElement)regNode_.getTreeElement(); + String serviceKey = serviceElement.getBusinessService().getServiceKey(); + String inquiryURL = regElement.getInquiryURL(); + Hashtable table = new Hashtable(); + table.put(FavoritesModelConstants.PROP_UDDI_SERVICE_NAME,serviceName); + table.put(FavoritesModelConstants.PROP_UDDI_SERVICE_INQUIRY_API,inquiryURL); + table.put(FavoritesModelConstants.PROP_UDDI_SERVICE_KEY,serviceKey); + return favoriteExists(table,FavoritesModelConstants.REL_UDDI_SERVICE_FOLDER_NODE); + } + + public final boolean serviceInterfaceExists(String siName,Node siNode) + { + ServiceInterfaceElement siElement = (ServiceInterfaceElement)siNode.getTreeElement(); + RegistryElement regElement = (RegistryElement)regNode_.getTreeElement(); + String tModelKey = siElement.getTModel().getTModelKey(); + String inquiryURL = regElement.getInquiryURL(); + Hashtable table = new Hashtable(); + table.put(FavoritesModelConstants.PROP_UDDI_SERVICE_INTERFACE_NAME,siName); + table.put(FavoritesModelConstants.PROP_UDDI_SERVICE_INTERFACE_INQUIRY_API,inquiryURL); + table.put(FavoritesModelConstants.PROP_UDDI_SERVICE_INTERFACE_KEY,tModelKey); + return favoriteExists(table,FavoritesModelConstants.REL_UDDI_SERVICE_INTERFACE_FOLDER_NODE); + } + + public final boolean addRegistryToFavorites(String registryName,Node registryNode) + { + RegistryElement regElement = (RegistryElement)registryNode.getTreeElement(); + String inquiryURL = regElement.getInquiryURL(); + String publishURL = regElement.getPublishURL(); + if (publishURL == null) + publishURL = ""; + Hashtable table = new Hashtable(); + table.put(FavoritesModelConstants.PROP_UDDI_REGISTRY_PUBLISH_API,publishURL); + table.put(FavoritesModelConstants.PROP_UDDI_REGISTRY_INQUIRY_API,inquiryURL); + table.put(FavoritesModelConstants.PROP_UDDI_REGISTRY_NAME,registryName); + Enumeration userDefinedCategoriesEnum = regElement.getUserDefinedCategories(); + if (userDefinedCategoriesEnum != null) + { + table.put(FavoritesModelConstants.PROP_UDDI_REGISTRY_CATEGORIES_ENUM,userDefinedCategoriesEnum); + table.put(FavoritesModelConstants.PROP_PLUGIN_METADATA_DIRECTORY,controller_.getServletEngineStateLocation()); + } + return addToFavorites(table,FavoritesModelConstants.REL_UDDI_REGISTRY_FOLDER_NODE); + } + + public final boolean addBusinessToFavorites(String businessName,Node businessNode) + { + BusinessElement busElement = (BusinessElement)businessNode.getTreeElement(); + RegistryElement regElement = (RegistryElement)regNode_.getTreeElement(); + String businessKey = busElement.getBusinessEntity().getBusinessKey(); + String inquiryURL = regElement.getInquiryURL(); + Hashtable table = new Hashtable(); + table.put(FavoritesModelConstants.PROP_UDDI_BUSINESS_NAME,businessName); + table.put(FavoritesModelConstants.PROP_UDDI_BUSINESS_INQUIRY_API,inquiryURL); + table.put(FavoritesModelConstants.PROP_UDDI_BUSINESS_KEY, businessKey); + return addToFavorites(table,FavoritesModelConstants.REL_UDDI_BUSINESS_FOLDER_NODE); + } + + public final boolean addServiceToFavorites(String serviceName,Node serviceNode) + { + ServiceElement serviceElement = (ServiceElement)serviceNode.getTreeElement(); + RegistryElement regElement = (RegistryElement)regNode_.getTreeElement(); + String serviceKey = serviceElement.getBusinessService().getServiceKey(); + String inquiryURL = regElement.getInquiryURL(); + Hashtable table = new Hashtable(); + table.put(FavoritesModelConstants.PROP_UDDI_SERVICE_NAME,serviceName); + table.put(FavoritesModelConstants.PROP_UDDI_SERVICE_INQUIRY_API,inquiryURL); + table.put(FavoritesModelConstants.PROP_UDDI_SERVICE_KEY,serviceKey); + return addToFavorites(table,FavoritesModelConstants.REL_UDDI_SERVICE_FOLDER_NODE); + } + + public final boolean addServiceInterfaceToFavorites(String siName,Node siNode) + { + ServiceInterfaceElement siElement = (ServiceInterfaceElement)siNode.getTreeElement(); + RegistryElement regElement = (RegistryElement)regNode_.getTreeElement(); + String tModelKey = siElement.getTModel().getTModelKey(); + String inquiryURL = regElement.getInquiryURL(); + Hashtable table = new Hashtable(); + table.put(FavoritesModelConstants.PROP_UDDI_SERVICE_INTERFACE_NAME,siName); + table.put(FavoritesModelConstants.PROP_UDDI_SERVICE_INTERFACE_INQUIRY_API,inquiryURL); + table.put(FavoritesModelConstants.PROP_UDDI_SERVICE_INTERFACE_KEY,tModelKey); + return addToFavorites(table,FavoritesModelConstants.REL_UDDI_SERVICE_INTERFACE_FOLDER_NODE); + } + + public boolean favoriteExists() + { + int nodeId = Integer.parseInt((String)propertyTable_.get(ActionInputs.NODEID)); + Node node = nodeManager_.getNode(nodeId); + String nodeName = node.getNodeName(); + if (node instanceof RegistryNode) + return registryExists(nodeName,node); + else if (node instanceof BusinessNode) + return businessExists(nodeName,node); + else if (node instanceof ServiceNode) + return serviceExists(nodeName,node); + else if (node instanceof ServiceInterfaceNode) + return serviceInterfaceExists(nodeName,node); + else + return false; + } + + public boolean run() + { + int nodeId = Integer.parseInt((String)propertyTable_.get(ActionInputs.NODEID)); + Node node = nodeManager_.getNode(nodeId); + String nodeName = node.getNodeName(); + UDDIPerspective uddiPerspective = controller_.getUDDIPerspective(); + MessageQueue messageQueue = uddiPerspective.getMessageQueue(); + boolean addToFavoritesResult = false; + if (node instanceof RegistryNode) + { + addToFavoritesResult = addRegistryToFavorites(nodeName,node); + RegistryElement regElement = (RegistryElement)node.getTreeElement(); + Enumeration e = regElement.getUserDefinedCategories(); + if (e != null) + { + while (e.hasMoreElements()) + { + CategoryModel categoryModel = (CategoryModel)e.nextElement(); + Throwable errorException = categoryModel.getErrorException(); + if (errorException != null) + { + String[] args = {categoryModel.getDisplayName(),errorException.getMessage()}; + messageQueue.addMessage(uddiPerspective.getMessage("MSG_ERROR_SAVING_CATEGORY_DATA",args)); + } + } + } + } + else if (node instanceof BusinessNode) + addToFavoritesResult = addBusinessToFavorites(nodeName,node); + else if (node instanceof ServiceNode) + addToFavoritesResult = addServiceToFavorites(nodeName,node); + else if (node instanceof ServiceInterfaceNode) + addToFavoritesResult = addServiceInterfaceToFavorites(nodeName,node); + if (addToFavoritesResult) + messageQueue.addMessage(uddiPerspective.getMessage("MSG_INFO_FAVORITE_ADDED",nodeName)); + else + messageQueue.addMessage(uddiPerspective.getMessage("MSG_ERROR_FAVORITE_NOT_ADDED",nodeName)); + return addToFavoritesResult; + } + + protected boolean addToFavorites(Hashtable table, String rel) + { + FavoritesPerspective favPerspective = controller_.getFavoritesPerspective(); + NodeManager favNodeManager = favPerspective.getNodeManager(); + TreeElement favRootElement = favNodeManager.getRootNode().getTreeElement(); + Enumeration e = favRootElement.getElements(rel); + if (!e.hasMoreElements()) + return false; + FavoritesFolderElement favFolderElement = (FavoritesFolderElement)e.nextElement(); + return favFolderElement.addFavorite(table); + } + + protected boolean favoriteExists(Hashtable table, String rel) + { + FavoritesPerspective favPerspective = controller_.getFavoritesPerspective(); + NodeManager favNodeManager = favPerspective.getNodeManager(); + TreeElement favRootElement = favNodeManager.getRootNode().getTreeElement(); + Enumeration e = favRootElement.getElements(rel); + if (!e.hasMoreElements()) + return false; + FavoritesFolderElement favFolderElement = (FavoritesFolderElement)e.nextElement(); + return favFolderElement.favoriteExists(table); + } + + public final String getActionLinkForHistory() + { + return null; + } +} diff --git a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/uddi/actions/BusPublishServiceAdvancedAction.java b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/uddi/actions/BusPublishServiceAdvancedAction.java new file mode 100644 index 000000000..6961248ec --- /dev/null +++ b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/uddi/actions/BusPublishServiceAdvancedAction.java @@ -0,0 +1,52 @@ +/******************************************************************************* + * Copyright (c) 2004 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.wst.ws.internal.explorer.platform.uddi.actions; + +import org.eclipse.wst.ws.internal.explorer.platform.datamodel.*; +import org.eclipse.wst.ws.internal.explorer.platform.perspective.*; +import org.eclipse.wst.ws.internal.explorer.platform.uddi.constants.*; +import org.eclipse.wst.ws.internal.explorer.platform.uddi.datamodel.*; +import org.eclipse.wst.ws.internal.explorer.platform.util.*; + +import java.util.*; + +import org.uddi4j.datatype.business.BusinessEntity; + +public class BusPublishServiceAdvancedAction extends PublishAction +{ + private RegPublishServiceAdvancedAction regPublishServiceAdvancedAction_; + public BusPublishServiceAdvancedAction(Controller controller) + { + super(controller); + regPublishServiceAdvancedAction_ = new RegPublishServiceAdvancedAction(controller); + propertyTable_ = regPublishServiceAdvancedAction_.getPropertyTable(); + } + + protected final boolean processOthers(MultipartFormDataParser parser,FormToolPropertiesInterface formToolPI) throws MultipartFormDataException + { + Node businessNode = getSelectedNavigatorNode(); + BusinessElement businessElement = (BusinessElement)businessNode.getTreeElement(); + BusinessEntity businessEntity = businessElement.getBusinessEntity(); + ListElement busListElement = new ListElement(businessEntity); + Vector serviceBusinessCopy = new Vector(); + serviceBusinessCopy.addElement(busListElement); + formToolPI.setProperty(UDDIActionInputs.QUERY_INPUT_ADVANCED_SERVICE_BUSINESS_COPY,serviceBusinessCopy); + boolean result = regPublishServiceAdvancedAction_.processOthers(parser,formToolPI); + if (!propertyTable_.containsKey(UDDIActionInputs.QUERY_INPUT_ADVANCED_SERVICE_SERVICE_PROVIDER)) + propertyTable_.put(UDDIActionInputs.QUERY_INPUT_ADVANCED_SERVICE_SERVICE_PROVIDER,businessEntity); + return result; + } + + public final boolean run() + { + return regPublishServiceAdvancedAction_.run(); + } +} diff --git a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/uddi/actions/BusPublishServiceSimpleAction.java b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/uddi/actions/BusPublishServiceSimpleAction.java new file mode 100644 index 000000000..ea9da0af8 --- /dev/null +++ b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/uddi/actions/BusPublishServiceSimpleAction.java @@ -0,0 +1,53 @@ +/******************************************************************************* + * Copyright (c) 2004 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.wst.ws.internal.explorer.platform.uddi.actions; + +import org.eclipse.wst.ws.internal.explorer.platform.datamodel.*; +import org.eclipse.wst.ws.internal.explorer.platform.perspective.*; +import org.eclipse.wst.ws.internal.explorer.platform.uddi.constants.*; +import org.eclipse.wst.ws.internal.explorer.platform.uddi.datamodel.*; +import org.eclipse.wst.ws.internal.explorer.platform.util.*; + +import java.util.*; + +import org.uddi4j.datatype.business.BusinessEntity; + +public class BusPublishServiceSimpleAction extends PublishAction +{ + private RegPublishServiceSimpleAction regPublishServiceSimpleAction_; + + public BusPublishServiceSimpleAction(Controller controller) + { + super(controller); + regPublishServiceSimpleAction_ = new RegPublishServiceSimpleAction(controller); + propertyTable_ = regPublishServiceSimpleAction_.getPropertyTable(); + } + + protected boolean processOthers(MultipartFormDataParser parser,FormToolPropertiesInterface formToolPI) throws MultipartFormDataException + { + Node businessNode = getSelectedNavigatorNode(); + BusinessElement businessElement = (BusinessElement)businessNode.getTreeElement(); + BusinessEntity businessEntity = businessElement.getBusinessEntity(); + ListElement busListElement = new ListElement(businessEntity); + Vector serviceBusinessCopy = new Vector(); + serviceBusinessCopy.addElement(busListElement); + formToolPI.setProperty(UDDIActionInputs.QUERY_INPUT_SIMPLE_SERVICE_BUSINESS_COPY,serviceBusinessCopy); + boolean result = regPublishServiceSimpleAction_.processOthers(parser,formToolPI); + if (!propertyTable_.containsKey(UDDIActionInputs.QUERY_INPUT_SIMPLE_SERVICE_SERVICE_PROVIDER)) + propertyTable_.put(UDDIActionInputs.QUERY_INPUT_SIMPLE_SERVICE_SERVICE_PROVIDER,businessEntity); + return result; + } + + public final boolean run() + { + return regPublishServiceSimpleAction_.run(); + } +} diff --git a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/uddi/actions/BusinessGetServicesAction.java b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/uddi/actions/BusinessGetServicesAction.java new file mode 100644 index 000000000..9f305f803 --- /dev/null +++ b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/uddi/actions/BusinessGetServicesAction.java @@ -0,0 +1,81 @@ +/******************************************************************************* + * Copyright (c) 2001, 2004 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ + +package org.eclipse.wst.ws.internal.explorer.platform.uddi.actions; + +import org.eclipse.wst.ws.internal.explorer.platform.constants.*; +import org.eclipse.wst.ws.internal.explorer.platform.datamodel.*; +import org.eclipse.wst.ws.internal.explorer.platform.perspective.*; +import org.eclipse.wst.ws.internal.explorer.platform.uddi.constants.*; +import org.eclipse.wst.ws.internal.explorer.platform.uddi.datamodel.*; +import org.eclipse.wst.ws.internal.explorer.platform.uddi.perspective.*; + +import org.uddi4j.datatype.business.BusinessEntity; + +import java.util.*; + +public class BusinessGetServicesAction extends UDDINodeAction +{ + private BusinessNode busNode_; + public BusinessGetServicesAction(Controller controller) + { + super(controller); + busNode_ = null; + } + + // uddi/actions/BusinessGetServicesActionJSP.jsp?nodeId=... + public static String getActionLink(int nodeId) + { + StringBuffer actionLink = new StringBuffer("uddi/actions/BusinessGetServicesActionJSP.jsp?"); + actionLink.append(ActionInputs.NODEID).append('=').append(nodeId); + return actionLink.toString(); + } + + public final boolean validateBusiness() + { + int busNodeId = Integer.parseInt((String)propertyTable_.get(ActionInputs.NODEID)); + busNode_ = (BusinessNode)nodeManager_.getNode(busNodeId); + BusinessElement busElement = (BusinessElement)busNode_.getTreeElement(); + RegFindBusinessUUIDAction verifyAction = new RegFindBusinessUUIDAction(controller_); + Hashtable propertyTable = verifyAction.getPropertyTable(); + propertyTable.put(UDDIActionInputs.QUERY_INPUT_OVERRIDE_ADD_QUERY_NODE,Boolean.TRUE); + propertyTable.put(UDDIActionInputs.QUERY_INPUT_UUID_BUSINESS_KEY,busElement.getBusinessEntity().getBusinessKey()); + boolean result = verifyAction.run(); + if (result) + propertyTable_.put(UDDIActionInputs.LATEST_OBJECT,propertyTable.get(UDDIActionInputs.LATEST_OBJECT)); + return result; + } + + public final String getActionLinkForHistory() + { + return null; + } + + public final boolean run() + { + UDDIPerspective uddiPerspective = controller_.getUDDIPerspective(); + BusinessEntity sp = (BusinessEntity)propertyTable_.get(UDDIActionInputs.LATEST_OBJECT); + + RegFindServicesAdvancedAction action = new RegFindServicesAdvancedAction(controller_); + Hashtable propertyTable = action.getPropertyTable(); + propertyTable.put(UDDIActionInputs.QUERY_NAME,uddiPerspective.getMessage("NODE_NAME_BUSINESS_SERVICES",busNode_.getNodeName())); + propertyTable.put(UDDIActionInputs.QUERY_INPUT_ADVANCED_SERVICE_SERVICE_PROVIDER,sp); + + ListElement businessListElement = new ListElement(sp); + businessListElement.setTargetViewToolInfo(busNode_.getNodeId(),busNode_.getToolManager().getSelectedToolId(),busNode_.getViewId()); + Vector businessListVector = new Vector(); + businessListVector.addElement(businessListElement); + propertyTable.put(UDDIActionInputs.QUERY_INPUT_ADVANCED_SERVICE_BUSINESS,businessListVector); + + + return action.run(); + } +} diff --git a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/uddi/actions/ClearNavigatorFolderNodeAction.java b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/uddi/actions/ClearNavigatorFolderNodeAction.java new file mode 100644 index 000000000..3a5db863c --- /dev/null +++ b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/uddi/actions/ClearNavigatorFolderNodeAction.java @@ -0,0 +1,44 @@ +/******************************************************************************* + * Copyright (c) 2001, 2004 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ + +package org.eclipse.wst.ws.internal.explorer.platform.uddi.actions; + +import org.eclipse.wst.ws.internal.explorer.platform.constants.*; +import org.eclipse.wst.ws.internal.explorer.platform.datamodel.*; +import org.eclipse.wst.ws.internal.explorer.platform.perspective.*; + +public class ClearNavigatorFolderNodeAction extends ClearNavigatorNodeAction +{ + public ClearNavigatorFolderNodeAction(Controller controller) + { + super(controller); + } + + // uddi/actions/ClearNavigatorFolderNodeAction.jsp?nodeId=... + public static String getActionLink(int nodeId) + { + StringBuffer actionLink = new StringBuffer("uddi/actions/ClearNavigatorFolderNodeActionJSP.jsp?"); + actionLink.append(ActionInputs.NODEID).append('=').append(nodeId); + return actionLink.toString(); + } + + public final boolean run() + { + int nodeId = Integer.parseInt((String)propertyTable_.get(ActionInputs.NODEID)); + if (!isStaleNode(nodeId)) + { + Node node = nodeManager_.getNode(nodeId); + TreeElement element = node.getTreeElement(); + element.disconnectRel(element.getPropertyAsString(ModelConstants.REL_CHILDREN)); + } + return false; + } +} diff --git a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/uddi/actions/ClearNavigatorNodeAction.java b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/uddi/actions/ClearNavigatorNodeAction.java new file mode 100644 index 000000000..75e4b421b --- /dev/null +++ b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/uddi/actions/ClearNavigatorNodeAction.java @@ -0,0 +1,63 @@ +/******************************************************************************* + * Copyright (c) 2001, 2004 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ + +package org.eclipse.wst.ws.internal.explorer.platform.uddi.actions; + +import org.eclipse.wst.ws.internal.explorer.platform.actions.*; +import org.eclipse.wst.ws.internal.explorer.platform.constants.*; +import org.eclipse.wst.ws.internal.explorer.platform.perspective.*; + +public class ClearNavigatorNodeAction extends ClearNodeAction +{ + public ClearNavigatorNodeAction(Controller controller) + { + super(controller,controller.getUDDIPerspective().getNavigatorManager()); + propertyTable_.put(ActionInputs.NODEID,String.valueOf(controller.getUDDIPerspective().getNavigatorManager().getSelectedNodeId())); + } + + // uddi/actions/ClearNavigatorNodeAction.jsp?nodeId=... + public static String getActionLink(int nodeId) + { + StringBuffer actionLink = new StringBuffer("uddi/actions/ClearNavigatorNodeActionJSP.jsp?"); + actionLink.append(ActionInputs.NODEID).append('=').append(nodeId); + return actionLink.toString(); + } + + public final String getTreeContentVar() + { + return "navigatorContent"; + } + + public final String getTreeContentPage() + { + return "uddi/navigator_content.jsp"; + } + + public final String getPropertiesContainerVar() + { + return "propertiesContainer"; + } + + public final String getPropertiesContainerPage() + { + return "uddi/properties_container.jsp"; + } + + public final String getStatusContentVar() + { + return "statusContent"; + } + + public final String getStatusContentPage() + { + return "uddi/status_content.jsp"; + } +} diff --git a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/uddi/actions/ClearNavigatorNodesAction.java b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/uddi/actions/ClearNavigatorNodesAction.java new file mode 100644 index 000000000..e0f5166d2 --- /dev/null +++ b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/uddi/actions/ClearNavigatorNodesAction.java @@ -0,0 +1,53 @@ +/******************************************************************************* + * Copyright (c) 2001, 2004 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ + +package org.eclipse.wst.ws.internal.explorer.platform.uddi.actions; + +import org.eclipse.wst.ws.internal.explorer.platform.constants.*; +import org.eclipse.wst.ws.internal.explorer.platform.perspective.*; +import org.eclipse.wst.ws.internal.explorer.platform.uddi.constants.*; +import org.eclipse.wst.ws.internal.explorer.platform.util.*; + +import java.util.*; + +public class ClearNavigatorNodesAction extends UDDIPropertiesFormAction +{ + public ClearNavigatorNodesAction(Controller controller) + { + super(controller); + } + + protected boolean processParsedResults(MultipartFormDataParser parser) throws MultipartFormDataException + { + String[] selectedNodeIds = parser.getParameterValues(ActionInputs.NODEID); + if (selectedNodeIds != null) + propertyTable_.put(UDDIActionInputs.SELECTED_NODEIDS,selectedNodeIds); + else + removeProperty(UDDIActionInputs.SELECTED_NODEIDS); + return true; + } + + public final boolean run() + { + String[] selectedNodeIds = (String[])propertyTable_.get(UDDIActionInputs.SELECTED_NODEIDS); + if (selectedNodeIds != null) + { + ClearNavigatorNodeAction action = new ClearNavigatorNodeAction(controller_); + Hashtable propertyTable = action.getPropertyTable(); + for (int i=0;i<selectedNodeIds.length;i++) + { + propertyTable.put(ActionInputs.NODEID,selectedNodeIds[i]); + action.run(); + } + } + return true; + } +} diff --git a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/uddi/actions/CommonPublisherAssertionsAction.java b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/uddi/actions/CommonPublisherAssertionsAction.java new file mode 100644 index 000000000..5e14725a3 --- /dev/null +++ b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/uddi/actions/CommonPublisherAssertionsAction.java @@ -0,0 +1,98 @@ +/******************************************************************************* + * Copyright (c) 2002, 2004 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ + +package org.eclipse.wst.ws.internal.explorer.platform.uddi.actions; + +import org.eclipse.wst.ws.internal.explorer.platform.datamodel.*; +import org.eclipse.wst.ws.internal.explorer.platform.perspective.*; +import org.eclipse.wst.ws.internal.explorer.platform.uddi.constants.*; +import org.eclipse.wst.ws.internal.explorer.platform.uddi.datamodel.*; +import org.eclipse.wst.ws.internal.explorer.platform.uddi.perspective.*; + +import org.uddi4j.client.UDDIProxy; +import org.uddi4j.response.BusinessInfo; +import org.uddi4j.response.RegisteredInfo; + +import java.util.Vector; +import java.util.Iterator; +import java.util.Enumeration; + +public abstract class CommonPublisherAssertionsAction extends UDDIPropertiesFormAction +{ + + protected RegistryNode registryNode_; + protected boolean isLoggedIn_; + + public CommonPublisherAssertionsAction(Controller controller) + { + super(controller); + + registryNode_ = getRegistryNode(); + if (registryNode_ != null) + isLoggedIn_ = ((RegistryElement)registryNode_.getTreeElement()).isLoggedIn(); + } + + protected void synchronizeUDDIObjectTable() { + String[] selectedBusIds = (String[])propertyTable_.get(UDDIActionInputs.PUBLISHER_ASSERTIONS_SELECTED_BUS_ID); + Node selectedNode = controller_.getUDDIPerspective().getNavigatorManager().getSelectedNode(); + FormTool formTool = (FormTool)(selectedNode.getCurrentToolManager().getSelectedTool()); + String subQueryKey = (String)formTool.getProperty(UDDIActionInputs.SUBQUERY_KEY); + FormToolPropertiesInterface formToolPI = ((MultipleFormToolPropertiesInterface)formTool).getFormToolProperties(subQueryKey); + Vector businessVector = (Vector)formToolPI.getProperty(UDDIActionInputs.QUERY_INPUT_ADD_PUBLISHER_ASSERTIONS); + ListManager businessCopy = (ListManager)formToolPI.getProperty(UDDIActionInputs.QUERY_INPUT_ADD_PUBLISHER_ASSERTIONS_COPY); + if (selectedBusIds == null || selectedBusIds.length <= 0) { + businessVector.removeAllElements(); + businessCopy.clear(); + } + Enumeration e = businessCopy.getListElements(); + while (e.hasMoreElements()) { + boolean isIdFound = false; + ListElement le = (ListElement)e.nextElement(); + int listElementViewId = le.getViewId(); + for (int i = 0; i < selectedBusIds.length; i++) { + if (listElementViewId == Integer.parseInt(selectedBusIds[i])) { + isIdFound = true; + break; + } + } + if (!isIdFound) + businessVector.remove(le); + } + } + + protected boolean isBusinessOwned(BusinessElement busElement) { + boolean isBusinessOwned = false; + String isBusinessOwnedString = busElement.getPropertyAsString(UDDIModelConstants.IS_BUSINESS_OWNED); + if (isBusinessOwnedString != null) { + isBusinessOwned = Boolean.valueOf(isBusinessOwnedString).booleanValue(); + } + else if (isLoggedIn_) { + try { + RegistryElement regElement = (RegistryElement)registryNode_.getTreeElement(); + UDDIProxy proxy = regElement.getProxy(); + RegisteredInfo ri = proxy.get_registeredInfo(regElement.getAuthInfoString()); + Vector beVector = ri.getBusinessInfos().getBusinessInfoVector(); + for (Iterator it = beVector.iterator(); it.hasNext();) + { + BusinessInfo bi = (BusinessInfo)it.next(); + if (bi.getBusinessKey().equals(busElement.getBusinessEntity().getBusinessKey())) + { + isBusinessOwned = true; + break; + } + } + busElement.setPropertyAsString(UDDIModelConstants.IS_BUSINESS_OWNED, String.valueOf(isBusinessOwned)); + } + catch (Exception e) {} + } + return isBusinessOwned; + } +} diff --git a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/uddi/actions/CompletePublisherAssertionsAction.java b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/uddi/actions/CompletePublisherAssertionsAction.java new file mode 100644 index 000000000..8f73b8efd --- /dev/null +++ b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/uddi/actions/CompletePublisherAssertionsAction.java @@ -0,0 +1,206 @@ +/******************************************************************************* + * Copyright (c) 2001, 2004 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ + +package org.eclipse.wst.ws.internal.explorer.platform.uddi.actions; + +import org.eclipse.wst.ws.internal.explorer.platform.datamodel.*; +import org.eclipse.wst.ws.internal.explorer.platform.perspective.*; +import org.eclipse.wst.ws.internal.explorer.platform.uddi.constants.*; +import org.eclipse.wst.ws.internal.explorer.platform.uddi.datamodel.*; +import org.eclipse.wst.ws.internal.explorer.platform.uddi.perspective.*; +import org.eclipse.wst.ws.internal.explorer.platform.util.*; + +import org.uddi4j.client.UDDIProxy; +import org.uddi4j.UDDIException; +import org.uddi4j.response.*; +import org.uddi4j.transport.TransportException; + +import java.util.*; +import java.net.*; + +public class CompletePublisherAssertionsAction extends CommonPublisherAssertionsAction +{ + public CompletePublisherAssertionsAction(Controller controller) + { + super(controller); + } + + protected final boolean processParsedResults(MultipartFormDataParser parser) throws MultipartFormDataException + { + if (registryNode_ == null) + return false; + + boolean inputsValid = true; + UDDIPerspective uddiPerspective = controller_.getUDDIPerspective(); + MessageQueue messageQueue = uddiPerspective.getMessageQueue(); + FormTool formTool = getSelectedFormTool(); + + // ids from uddiObjects_table + String[] selectedBusIds = parser.getParameterValues(UDDIActionInputs.PUBLISHER_ASSERTIONS_SELECTED_BUS_ID); + if (selectedBusIds != null && selectedBusIds.length > 0) + propertyTable_.put(UDDIActionInputs.PUBLISHER_ASSERTIONS_SELECTED_BUS_ID, selectedBusIds); + // Synchronize client view and server model (uddiObject_table.jsp) + synchronizeUDDIObjectTable(); + + // if not yet logged in, validate the parameters needed to log in + if (!isLoggedIn_) { + String publishURL = parser.getParameter(UDDIActionInputs.QUERY_INPUT_ADVANCED_PUBLISH_URL); + String userID = parser.getParameter(UDDIActionInputs.QUERY_INPUT_ADVANCED_USERID); + String password = parser.getParameter(UDDIActionInputs.QUERY_INPUT_ADVANCED_PASSWORD); + + if (publishURL != null) + { + propertyTable_.put(UDDIActionInputs.QUERY_INPUT_ADVANCED_PUBLISH_URL,publishURL); + formTool.setProperty(UDDIActionInputs.QUERY_INPUT_ADVANCED_PUBLISH_URL,publishURL); + } + + if (!Validator.validateString(publishURL)) + { + inputsValid = false; + formTool.flagError(UDDIActionInputs.QUERY_INPUT_ADVANCED_PUBLISH_URL); + messageQueue.addMessage(uddiPerspective.getMessage("MSG_ERROR_INVALID_PUBLISH_URL")); + } + + if (userID != null) + { + propertyTable_.put(UDDIActionInputs.QUERY_INPUT_ADVANCED_USERID,userID); + formTool.setProperty(UDDIActionInputs.QUERY_INPUT_ADVANCED_USERID,userID); + } + + if (!Validator.validateString(userID)) + { + inputsValid = false; + formTool.flagError(UDDIActionInputs.QUERY_INPUT_ADVANCED_USERID); + messageQueue.addMessage(uddiPerspective.getMessage("MSG_ERROR_INVALID_USERID")); + } + + if (password != null) + { + propertyTable_.put(UDDIActionInputs.QUERY_INPUT_ADVANCED_PASSWORD,password); + formTool.setProperty(UDDIActionInputs.QUERY_INPUT_ADVANCED_PASSWORD,password); + } + } + + // ids from publisher assertion table + String[] pubAssertionsViewIds = parser.getParameterValues(UDDIActionInputs.PUBLISHER_ASSERTIONS_VIEWID); + if (pubAssertionsViewIds == null || pubAssertionsViewIds.length == 0) + inputsValid = false; + else + propertyTable_.put(UDDIActionInputs.PUBLISHER_ASSERTIONS_VIEWID, pubAssertionsViewIds); + + return inputsValid; + } + + public boolean run() + { + if (registryNode_ == null) + return false; + + RegistryElement registryElement = (RegistryElement)registryNode_.getTreeElement(); + UDDIPerspective uddiPerspective = controller_.getUDDIPerspective(); + MessageQueue messageQueue = uddiPerspective.getMessageQueue(); + NodeManager navigatorManager = uddiPerspective.getNavigatorManager(); + Node selectedNode = navigatorManager.getSelectedNode(); + TreeElement selectedElement = selectedNode.getTreeElement(); + + // if not yet logged in, log in first + if (!isLoggedIn_) { + String publishURL = (String)propertyTable_.get(UDDIActionInputs.QUERY_INPUT_ADVANCED_PUBLISH_URL); + String userID = (String)propertyTable_.get(UDDIActionInputs.QUERY_INPUT_ADVANCED_USERID); + String password = (String)propertyTable_.get(UDDIActionInputs.QUERY_INPUT_ADVANCED_PASSWORD); + + try { + registryElement.performLogin(publishURL, userID, password); + } + catch (TransportException te) { + messageQueue.addMessage(controller_.getMessage("MSG_ERROR_UNEXPECTED")); + messageQueue.addMessage("TransportException"); + messageQueue.addMessage(te.getMessage()); + return false; + } + catch (UDDIException uddie) { + messageQueue.addMessage(controller_.getMessage("MSG_ERROR_UNEXPECTED")); + messageQueue.addMessage("UDDIException"); + messageQueue.addMessage(uddie.toString()); + return false; + } + catch (MalformedURLException me) { + messageQueue.addMessage(controller_.getMessage("MSG_ERROR_UNEXPECTED")); + messageQueue.addMessage("MalformedURLException"); + messageQueue.addMessage(me.getMessage()); + return false; + } + } + + UDDIProxy proxy = registryElement.getProxy(); + String userID = registryElement.getUserId(); + String cred = registryElement.getCred(); + BusinessElement busElement = (BusinessElement)selectedElement; + ListManager pubAssertions = busElement.getPublisherAssertions(); + + // determine whether this is a owned business + // if not, the AddPublisherAssertionsAction cannot be performed + if (!isBusinessOwned(busElement)) { + messageQueue.addMessage(uddiPerspective.getMessage("MSG_ERROR_NOT_OWNED_BUSINESS")); + return false; + } + + try { + String[] pubAssertionViewIds = (String[])propertyTable_.get(UDDIActionInputs.PUBLISHER_ASSERTIONS_VIEWID); + Vector pubAssertionVector = new Vector(); + + for (int i = 0; i < pubAssertionViewIds.length; i++) { + int viewID = Integer.parseInt(pubAssertionViewIds[i]); + ListElement listElement = pubAssertions.getElementWithViewId(viewID); + PublisherAssertionElement pubAssertionElement = (PublisherAssertionElement)listElement.getObject(); + if (!(pubAssertionElement.getStatus().equals(CompletionStatus.COMPLETE))) + pubAssertionVector.add(pubAssertionElement.getPublisherAssertion()); + } + + if (pubAssertionVector.size() <= 0) { + messageQueue.addMessage(uddiPerspective.getMessage("MSG_ERROR_NO_INCOMPLETE_ASSERTION_SELECTED")); + return false; + } + + DispositionReport report = proxy.add_publisherAssertions(registryElement.getAuthInfoString(), pubAssertionVector); + //report status + Vector reportErrInfo = report.getResultVector(); + for (int j = 0; j < reportErrInfo.size(); j++) { + messageQueue.addMessage(((Result) reportErrInfo.get(j)).getErrInfo().getText()); + } + + ShowPublisherAssertionsAction showPAAction = new ShowPublisherAssertionsAction(controller_); + Hashtable propertyTable = showPAAction.getPropertyTable(); + Object ids = propertyTable_.get(UDDIActionInputs.PUBLISHER_ASSERTIONS_SELECTED_BUS_ID); + if (ids != null) + propertyTable.put(UDDIActionInputs.PUBLISHER_ASSERTIONS_SELECTED_BUS_ID, ids); + showPAAction.run(); + + return report.success(); + } + catch (UDDIException uddie) { + messageQueue.addMessage(controller_.getMessage("MSG_ERROR_UNEXPECTED")); + messageQueue.addMessage("UDDIException"); + DispositionReport report = uddie.getDispositionReport(); + Vector reportErrInfo = report.getResultVector(); + for (int j = 0; j < reportErrInfo.size(); j++) { + messageQueue.addMessage(((Result) reportErrInfo.get(j)).getErrInfo().getText()); + } + return false; + } + catch (Exception e) { + messageQueue.addMessage(controller_.getMessage("MSG_ERROR_UNEXPECTED")); + messageQueue.addMessage("Exception"); + messageQueue.addMessage(e.getMessage()); + return false; + } + } +} diff --git a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/uddi/actions/FindAction.java b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/uddi/actions/FindAction.java new file mode 100644 index 000000000..b33b22a34 --- /dev/null +++ b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/uddi/actions/FindAction.java @@ -0,0 +1,249 @@ +/******************************************************************************* + * Copyright (c) 2004 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.wst.ws.internal.explorer.platform.uddi.actions; + +import org.eclipse.wst.ws.internal.explorer.platform.constants.*; +import org.eclipse.wst.ws.internal.explorer.platform.engine.transformer.ITransformer; +import org.eclipse.wst.ws.internal.explorer.platform.engine.transformer.MultipartFormDataParserTransformer; +import org.eclipse.wst.ws.internal.explorer.platform.perspective.*; +import org.eclipse.wst.ws.internal.explorer.platform.uddi.constants.*; +import org.eclipse.wst.ws.internal.explorer.platform.uddi.datamodel.*; +import org.eclipse.wst.ws.internal.explorer.platform.uddi.perspective.*; +import org.eclipse.wst.ws.internal.explorer.platform.util.*; + +import java.util.*; + +public abstract class FindAction extends UDDIPropertiesFormAction +{ + protected QueryElement queryElement_; + protected String subQueryKey_; + protected boolean isSubQueryGet_; + protected String newSubQuery_; + protected String newSubQueryItem_; + protected boolean subQueryInitiated_; + protected RegistryNode regNode_; + private boolean isRefreshAction_; + + public FindAction(Controller controller) + { + super(controller); + queryElement_ = null; + subQueryKey_ = null; + isSubQueryGet_ = false; + subQueryInitiated_ = false; + regNode_ = getRegistryNode(); + isRefreshAction_ = false; + } + + protected abstract boolean processOthers(MultipartFormDataParser parser,FormToolPropertiesInterface formToolPI) throws MultipartFormDataException; + + protected final boolean processParsedResults(MultipartFormDataParser parser) throws MultipartFormDataException + { + // Setup for MultipartFormDataParserTransformer + propertyTable_.put(ActionInputs.MULTIPART_FORM_DATA_PARSER, parser); + + newSubQuery_ = parser.getParameter(UDDIActionInputs.NEW_SUBQUERY_INITIATED); + String isSubQueryGetString = parser.getParameter(UDDIActionInputs.SUBQUERY_GET); + newSubQueryItem_ = parser.getParameter(UDDIActionInputs.NEW_SUBQUERY_QUERY_ITEM); + subQueryKey_ = parser.getParameter(UDDIActionInputs.SUBQUERY_KEY); + String queryName = parser.getParameter(UDDIActionInputs.QUERY_NAME); + + // Validate the data. + boolean inputsValid = true; + UDDIPerspective uddiPerspective = controller_.getUDDIPerspective(); + MessageQueue messageQueue = uddiPerspective.getMessageQueue(); + + FormTool formTool = getSelectedFormTool(); + FormToolPropertiesInterface formToolPI = ((MultipleFormToolPropertiesInterface)formTool).getFormToolProperties(subQueryKey_); + formToolPI.clearErrors(); + + if (newSubQuery_ != null && newSubQuery_.length() > 0) + subQueryInitiated_ = true; + else + subQueryInitiated_ = false; + + if (isSubQueryGetString != null) + isSubQueryGet_ = Boolean.valueOf(isSubQueryGetString).booleanValue(); + + if (queryName != null) + propertyTable_.put(UDDIActionInputs.QUERY_NAME,queryName); + + if (!Validator.validateString(queryName) && !subQueryInitiated_) + { + inputsValid = false; + formToolPI.flagError(UDDIActionInputs.QUERY_NAME); + messageQueue.addMessage(uddiPerspective.getMessage("MSG_ERROR_INVALID_QUERY_NAME")); + } + + if (!processOthers(parser,formToolPI) && !subQueryInitiated_) + inputsValid = false; + + for (int i=0;i<removedProperties_.size();i++) + formToolPI.removeProperty(removedProperties_.elementAt(i)); + formToolPI.updatePropertyTable(propertyTable_); + + // Process authentication information. If valid, these should be set in the formTool (not the formToolPI). + String ownedChecked = parser.getParameter(UDDIActionInputs.QUERY_INPUT_ADVANCED_OWNED); + String publishURL = parser.getParameter(UDDIActionInputs.QUERY_INPUT_ADVANCED_PUBLISH_URL); + String userId = parser.getParameter(UDDIActionInputs.QUERY_INPUT_ADVANCED_USERID); + String password = parser.getParameter(UDDIActionInputs.QUERY_INPUT_ADVANCED_PASSWORD); + RegistryElement regElement = (RegistryElement)regNode_.getTreeElement(); + + boolean validateAuthentication = (ownedChecked != null) && (!regElement.isLoggedIn()) && !overrideAuthenticationValidation(); + + if (publishURL != null) + { + propertyTable_.put(UDDIActionInputs.QUERY_INPUT_ADVANCED_PUBLISH_URL,publishURL); + formTool.setProperty(UDDIActionInputs.QUERY_INPUT_ADVANCED_PUBLISH_URL,publishURL); + } + + if (!subQueryInitiated_ && validateAuthentication && !Validator.validateString(publishURL)) + { + inputsValid = false; + formTool.flagError(UDDIActionInputs.QUERY_INPUT_ADVANCED_PUBLISH_URL); + messageQueue.addMessage(uddiPerspective.getMessage("MSG_ERROR_INVALID_PUBLISH_URL")); + } + + if (userId != null) + { + propertyTable_.put(UDDIActionInputs.QUERY_INPUT_ADVANCED_USERID,userId); + formTool.setProperty(UDDIActionInputs.QUERY_INPUT_ADVANCED_USERID,userId); + } + + if (!subQueryInitiated_ && validateAuthentication && !Validator.validateString(userId)) + { + inputsValid = false; + formTool.flagError(UDDIActionInputs.QUERY_INPUT_ADVANCED_USERID); + messageQueue.addMessage(uddiPerspective.getMessage("MSG_ERROR_INVALID_USERID")); + } + + if (password != null) + { + propertyTable_.put(UDDIActionInputs.QUERY_INPUT_ADVANCED_PASSWORD,password); + formTool.setProperty(UDDIActionInputs.QUERY_INPUT_ADVANCED_PASSWORD,password); + } + + return inputsValid; + } + + protected boolean overrideAuthenticationValidation() + { + return false; + } + + public final boolean isSubQueryInitiated() + { + return subQueryInitiated_; + } + + public final boolean isSubQueryGet() + { + return isSubQueryGet_; + } + + public final String getSubQueryKey() + { + return subQueryKey_; + } + + public final String getNewSubQuery() + { + return newSubQuery_; + } + + public final String getNewSubQueryItem() + { + return newSubQueryItem_; + } + + public final void setRefreshAction(boolean isRefreshAction) + { + isRefreshAction_ = isRefreshAction; + } + + public final boolean isRefreshAction() + { + return isRefreshAction_; + } + + protected final void addQueryNode() + { + // If the queryElement already exists, remove it first. + String queryName = queryElement_.getName(); + RegistryElement regElement = (RegistryElement)regNode_.getTreeElement(); + QueryParentElement queryParentElement = regElement.getQueryParentElement(); + Enumeration e = queryParentElement.getQueries(); + while (e.hasMoreElements()) + { + QueryElement qe = (QueryElement)e.nextElement(); + if (qe.getName().equals(queryName)) + { + SubQueryTransferTarget subQueryTransferTarget = (SubQueryTransferTarget)qe.getPropertyAsObject(UDDIModelConstants.SUBQUERY_TRANSFER_TARGET); + if (subQueryTransferTarget != null && (qe.getQueryType() == queryElement_.getQueryType())) + queryElement_.setPropertyAsObject(UDDIModelConstants.SUBQUERY_TRANSFER_TARGET,subQueryTransferTarget); + qe.disconnectAll(); + break; + } + } + if (!isRefreshAction_) + { + // We can make safe assumptions about the node that is currently selected. + if (subQueryKey_ != null && subQueryKey_.length() > 0) + { + String parentQueryKey; + int lastSeparatorPos = subQueryKey_.lastIndexOf(':'); + if (lastSeparatorPos == -1) + parentQueryKey = ""; + else + parentQueryKey = subQueryKey_.substring(0,lastSeparatorPos); + FormToolPropertiesInterface parentFormToolPI = ((MultipleFormToolPropertiesInterface)getSelectedFormTool()).getFormToolProperties(parentQueryKey); + Object queryItem = parentFormToolPI.getProperty(UDDIActionInputs.QUERY_ITEM); + Object queryStyleBus = parentFormToolPI.getProperty(UDDIActionInputs.QUERY_STYLE_BUSINESSES); + Object queryStyleSer = parentFormToolPI.getProperty(UDDIActionInputs.QUERY_STYLE_SERVICES); + Object queryStyleSerInt = parentFormToolPI.getProperty(UDDIActionInputs.QUERY_STYLE_SERVICE_INTERFACES); + Hashtable parentQueryData = new Hashtable(); + if (queryItem != null) + parentQueryData.put(UDDIActionInputs.QUERY_ITEM, queryItem); + if (queryStyleBus != null) + parentQueryData.put(UDDIActionInputs.QUERY_STYLE_BUSINESSES, queryStyleBus); + if (queryStyleSer != null) + parentQueryData.put(UDDIActionInputs.QUERY_STYLE_SERVICES, queryStyleSer); + if (queryStyleSerInt != null) + parentQueryData.put(UDDIActionInputs.QUERY_STYLE_SERVICE_INTERFACES, queryStyleSerInt); + queryElement_.setPropertyAsObject(UDDIModelConstants.SUBQUERY_TRANSFER_TARGET,new SubQueryTransferTarget(getSelectedNavigatorNode(),subQueryKey_,parentQueryData)); + } + } + queryParentElement.connect(queryElement_,UDDIModelConstants.REL_QUERIES,ModelConstants.REL_OWNER); + QueryNode queryNode = (QueryNode)(regNode_.getChildNode(queryParentElement).getChildNode(queryElement_)); + int newSelectedNodeId; + // If there is only 1 result, select the result. Otherwise, select the query node to present a summary. + if (queryNode.getChildNodes().size() == 1 && (subQueryKey_ == null || subQueryKey_.length() == 0)) + newSelectedNodeId = ((Node)(queryNode.getChildNodes().elementAt(0))).getNodeId(); + else + newSelectedNodeId = queryNode.getNodeId(); + NodeManager nodeManager = regNode_.getNodeManager(); + nodeManager.setSelectedNodeId(newSelectedNodeId); + queryNode.setFindToolProperties(this); + Node selectedNode = nodeManager.getSelectedNode(); + ToolManager toolManager = selectedNode.getCurrentToolManager(); + Tool selectedTool = toolManager.getSelectedTool(); + addToHistory(ActionInputs.PERSPECTIVE_UDDI,selectedTool.getSelectToolActionHref(true)); + } + + public ITransformer[] getTransformers() + { + ITransformer[] parentTransformers = super.getTransformers(); + ITransformer[] transformers = new ITransformer[parentTransformers.length + 1]; + System.arraycopy(parentTransformers, 0, transformers, 0, parentTransformers.length); + transformers[transformers.length - 1] = new MultipartFormDataParserTransformer(controller_); + return transformers; + } +}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/uddi/actions/ManageReferencedServicesAction.java b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/uddi/actions/ManageReferencedServicesAction.java new file mode 100644 index 000000000..0e470bad6 --- /dev/null +++ b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/uddi/actions/ManageReferencedServicesAction.java @@ -0,0 +1,365 @@ +/******************************************************************************* + * Copyright (c) 2001, 2004 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ + +package org.eclipse.wst.ws.internal.explorer.platform.uddi.actions; + +import org.eclipse.wst.ws.internal.explorer.platform.datamodel.*; +import org.eclipse.wst.ws.internal.explorer.platform.perspective.*; +import org.eclipse.wst.ws.internal.explorer.platform.uddi.constants.*; +import org.eclipse.wst.ws.internal.explorer.platform.uddi.datamodel.*; +import org.eclipse.wst.ws.internal.explorer.platform.uddi.perspective.*; +import org.eclipse.wst.ws.internal.explorer.platform.util.*; + +import org.uddi4j.datatype.business.BusinessEntity; +import org.uddi4j.datatype.service.BusinessService; +import org.uddi4j.datatype.service.BusinessServices; +import org.uddi4j.client.UDDIProxy; +import org.uddi4j.UDDIException; +import org.uddi4j.transport.TransportException; + +import java.util.*; +import java.net.*; + +public class ManageReferencedServicesAction extends UDDIPropertiesFormAction +{ + protected String subQueryKey_; + protected boolean isSubQueryGet_; + protected String newSubQuery_; + protected String newSubQueryItem_; + protected boolean subQueryInitiated_; + protected RegistryNode regNode_; + + public ManageReferencedServicesAction(Controller controller) + { + super(controller); + subQueryKey_ = null; + isSubQueryGet_ = false; + subQueryInitiated_ = false; + regNode_ = getRegistryNode(); + } + + protected final boolean processParsedResults(MultipartFormDataParser parser) throws MultipartFormDataException + { + newSubQuery_ = parser.getParameter(UDDIActionInputs.NEW_SUBQUERY_INITIATED); + String isSubQueryGetString = parser.getParameter(UDDIActionInputs.SUBQUERY_GET); + newSubQueryItem_ = parser.getParameter(UDDIActionInputs.NEW_SUBQUERY_QUERY_ITEM); + subQueryKey_ = parser.getParameter(UDDIActionInputs.SUBQUERY_KEY); + String[] referencedServicesCheckboxes = parser.getParameterValues(UDDIActionInputs.REFERENCED_SERVICE_SELECT_STATE); + String[] serviceNodeIds = parser.getParameterValues(UDDIActionInputs.NODEID_SERVICE); + String operation = parser.getParameter(UDDIActionInputs.MANAGE_REFERENCED_SERVICES_OPERATION); + String publishURL = parser.getParameter(UDDIActionInputs.QUERY_INPUT_ADVANCED_PUBLISH_URL); + String userId = parser.getParameter(UDDIActionInputs.QUERY_INPUT_ADVANCED_USERID); + String password = parser.getParameter(UDDIActionInputs.QUERY_INPUT_ADVANCED_PASSWORD); + + // Validate the data. + boolean inputsValid = true; + UDDIPerspective uddiPerspective = controller_.getUDDIPerspective(); + MessageQueue messageQueue = uddiPerspective.getMessageQueue(); + + FormTool formTool = getSelectedFormTool(); + FormToolPropertiesInterface formToolPI = ((MultipleFormToolPropertiesInterface)formTool).getFormToolProperties(subQueryKey_); + formToolPI.clearErrors(); + + if (newSubQuery_ != null && newSubQuery_.length() > 0) + subQueryInitiated_ = true; + else + subQueryInitiated_ = false; + + if (isSubQueryGetString != null) + isSubQueryGet_ = Boolean.valueOf(isSubQueryGetString).booleanValue(); + + if (operation != null) + propertyTable_.put(UDDIActionInputs.MANAGE_REFERENCED_SERVICES_OPERATION,operation); + else + removeProperty(UDDIActionInputs.MANAGE_REFERENCED_SERVICES_OPERATION); + + if (referencedServicesCheckboxes != null) + propertyTable_.put(UDDIActionInputs.REFERENCED_SERVICE_SELECT_STATE,referencedServicesCheckboxes); + else + removeProperty(UDDIActionInputs.REFERENCED_SERVICE_SELECT_STATE); + + if (serviceNodeIds != null) + { + Vector services = (Vector)formToolPI.getProperty(UDDIActionInputs.QUERY_INPUT_SERVICES); + if (services == null) + services = new Vector(); + Hashtable resultHash = new Hashtable(); + for (int i=0;i<serviceNodeIds.length;i++) + resultHash.put(serviceNodeIds[i],Boolean.TRUE); + for (int i=0;i<services.size();i++) + { + ListElement listElement = (ListElement)services.elementAt(i); + if (resultHash.get(String.valueOf(listElement.getTargetNodeId())) == null) + { + services.removeElementAt(i); + i--; + } + } + propertyTable_.put(UDDIActionInputs.QUERY_INPUT_SERVICES,services); + } + else + removeProperty(UDDIActionInputs.QUERY_INPUT_SERVICES); + + RegistryElement regElement = (RegistryElement)regNode_.getTreeElement(); + if (!regElement.isLoggedIn()) + { + if (publishURL != null) + { + propertyTable_.put(UDDIActionInputs.QUERY_INPUT_ADVANCED_PUBLISH_URL,publishURL); + formTool.setProperty(UDDIActionInputs.QUERY_INPUT_ADVANCED_PUBLISH_URL,publishURL); + } + + if (!subQueryInitiated_ && !Validator.validateString(publishURL)) + { + inputsValid = false; + formTool.flagError(UDDIActionInputs.QUERY_INPUT_ADVANCED_PUBLISH_URL); + messageQueue.addMessage(uddiPerspective.getMessage("MSG_ERROR_INVALID_PUBLISH_URL")); + } + + if (userId != null) + { + propertyTable_.put(UDDIActionInputs.QUERY_INPUT_ADVANCED_USERID,userId); + formTool.setProperty(UDDIActionInputs.QUERY_INPUT_ADVANCED_USERID,userId); + } + + if (!subQueryInitiated_ && !Validator.validateString(userId)) + { + inputsValid = false; + formTool.flagError(UDDIActionInputs.QUERY_INPUT_ADVANCED_USERID); + messageQueue.addMessage(uddiPerspective.getMessage("MSG_ERROR_INVALID_USERID")); + } + + if (password != null) + { + propertyTable_.put(UDDIActionInputs.QUERY_INPUT_ADVANCED_PASSWORD,password); + formTool.setProperty(UDDIActionInputs.QUERY_INPUT_ADVANCED_PASSWORD,password); + } + } + + for (int i=0;i<removedProperties_.size();i++) + formToolPI.removeProperty(removedProperties_.elementAt(i)); + formToolPI.updatePropertyTable(propertyTable_); + + return inputsValid; + } + + public boolean run() + { + UDDIPerspective uddiPerspective = controller_.getUDDIPerspective(); + MessageQueue messageQueue = uddiPerspective.getMessageQueue(); + String operationString = (String)propertyTable_.get(UDDIActionInputs.MANAGE_REFERENCED_SERVICES_OPERATION); + int operation = Integer.parseInt(operationString); + RegistryElement regElement = (RegistryElement)regNode_.getTreeElement(); + BusinessElement busElement = (BusinessElement)(getSelectedNavigatorNode().getTreeElement()); + FormTool formTool = getSelectedFormTool(); + FormToolPropertiesInterface formToolPI = ((MultipleFormToolPropertiesInterface)formTool).getFormToolProperties(subQueryKey_); + Vector referencedServices = (Vector)formToolPI.getProperty(UDDIActionInputs.QUERY_INPUT_REFERENCED_SERVICES); + boolean operationResult = true; + try + { + String publishURL = (String)propertyTable_.get(UDDIActionInputs.QUERY_INPUT_ADVANCED_PUBLISH_URL); + String userId = (String)propertyTable_.get(UDDIActionInputs.QUERY_INPUT_ADVANCED_USERID); + String password = (String)propertyTable_.get(UDDIActionInputs.QUERY_INPUT_ADVANCED_PASSWORD); + UDDIProxy proxy = regElement.getProxy(); + BusinessEntity currentSP = busElement.getBusinessEntity(); + BusinessEntity sp = (BusinessEntity)proxy.get_businessDetail(currentSP.getBusinessKey()).getBusinessEntityVector().get(0); + + if (!regElement.isLoggedIn()) + regElement.performLogin(publishURL,userId,password); + + Hashtable servicesHash = new Hashtable(); + Vector backupBusServiceVector = new Vector(); + switch (operation) + { + case UDDIActionInputs.MANAGE_REFERENCED_SERVICES_OPERATION_ADD: + Vector services = (Vector)propertyTable_.get(UDDIActionInputs.QUERY_INPUT_SERVICES); + for (int i=0;i<services.size();i++) + { + ListElement serviceListElement = (ListElement)services.elementAt(i); + BusinessService bs = (BusinessService)serviceListElement.getObject(); + servicesHash.put(bs.getServiceKey(),bs); + } + + // Save the current list of BusinessServices for rollback operations. + backupAndUpdateBusinessServices(backupBusServiceVector,sp,servicesHash,true); + + try + { + Vector beVector = new Vector(); + beVector.add(sp); + sp = (BusinessEntity)proxy.save_business(regElement.getAuthInfoString(), beVector).getBusinessEntityVector().get(0); + for (int i=0;i<services.size();i++) + { + ListElement serviceElement = (ListElement)services.elementAt(i); + BusinessService bs = (BusinessService)serviceElement.getObject(); + String bsName = bs.getDefaultNameString(); + messageQueue.addMessage(uddiPerspective.getMessage("MSG_INFO_SERVICE_REFERENCED",bsName)); + services.removeElementAt(i); + i--; + } + } + catch (TransportException e) + { + // Roll back and restore the old list of services. + rollbackBusinessServices(sp,backupBusServiceVector,services,uddiPerspective,messageQueue,"MSG_ERROR_SERVICE_NOT_REFERENCED"); + handleUnexpectedException(uddiPerspective,messageQueue,"TransportException",e); + operationResult = false; + } + catch (UDDIException e) + { + // Roll back and restore the old list of services. + rollbackBusinessServices(sp,backupBusServiceVector,services,uddiPerspective,messageQueue,"MSG_ERROR_SERVICE_NOT_REFERENCED"); + messageQueue.addMessage(uddiPerspective.getController().getMessage("MSG_ERROR_UNEXPECTED")); + messageQueue.addMessage("UDDIException"); + messageQueue.addMessage(e.toString()); + operationResult = false; + } + formToolPI.setProperty(UDDIActionInputs.QUERY_INPUT_SERVICES,services); + break; + case UDDIActionInputs.MANAGE_REFERENCED_SERVICES_OPERATION_REMOVE: + String[] referencedServicesCheckboxes = (String[])propertyTable_.get(UDDIActionInputs.REFERENCED_SERVICE_SELECT_STATE); + Vector selectedReferencedServiceVector = new Vector(); + for (int i=0;i<referencedServicesCheckboxes.length;i++) + { + boolean isChecked = Boolean.valueOf(referencedServicesCheckboxes[i]).booleanValue(); + if (isChecked) + { + ListElement referencedServiceListElement = (ListElement)referencedServices.elementAt(i); + BusinessService bs = (BusinessService)referencedServiceListElement.getObject(); + servicesHash.put(bs.getServiceKey(),bs); + selectedReferencedServiceVector.addElement(bs); + } + } + + // Save the current list of business services for rollback operations. + backupAndUpdateBusinessServices(backupBusServiceVector,sp,servicesHash,false); + + try + { + Vector beVector = new Vector(); + beVector.add(sp); + sp = (BusinessEntity)proxy.save_business(regElement.getAuthInfoString(), beVector).getBusinessEntityVector().get(0); + for (int i=0;i<selectedReferencedServiceVector.size();i++) + { + BusinessService bs = (BusinessService)selectedReferencedServiceVector.elementAt(i); + String bsName = bs.getDefaultNameString(); + messageQueue.addMessage(uddiPerspective.getMessage("MSG_INFO_SERVICE_REFERENCE_REMOVED",bsName)); + } + } + catch (TransportException e) + { + // Roll back and restore the old list of services. + rollbackBusinessServices(sp,backupBusServiceVector,selectedReferencedServiceVector,uddiPerspective,messageQueue,"MSG_ERROR_REFERENCE_NOT_REMOVED"); + handleUnexpectedException(uddiPerspective,messageQueue,"TransportException",e); + operationResult = false; + } + catch (UDDIException e) + { + // Roll back and restore the old list of services. + rollbackBusinessServices(sp,backupBusServiceVector,selectedReferencedServiceVector,uddiPerspective,messageQueue,"MSG_ERROR_REFERENCE_NOT_REMOVED"); + messageQueue.addMessage(uddiPerspective.getController().getMessage("MSG_ERROR_UNEXPECTED")); + messageQueue.addMessage("UDDIException"); + messageQueue.addMessage(e.toString()); + operationResult = false; + } + } + // Ensure that the referenced services are refreshed when the form reloads. + formToolPI.removeProperty(UDDIActionInputs.QUERY_INPUT_REFERENCED_SERVICES); + busElement.setBusinessEntity(sp); + return operationResult; + } + catch (TransportException e) + { + handleUnexpectedException(uddiPerspective,messageQueue,"TransportException",e); + operationResult = false; + } + catch (UDDIException e) + { + messageQueue.addMessage(uddiPerspective.getController().getMessage("MSG_ERROR_UNEXPECTED")); + messageQueue.addMessage("UDDIException"); + messageQueue.addMessage(e.toString()); + operationResult = false; + } + catch (MalformedURLException e) + { + handleUnexpectedException(uddiPerspective,messageQueue,"MalformedURLException",e); + operationResult = false; + } + return operationResult; + } + + public final boolean isSubQueryInitiated() + { + return subQueryInitiated_; + } + + public final boolean isSubQueryGet() + { + return isSubQueryGet_; + } + + public final String getSubQueryKey() + { + return subQueryKey_; + } + + public final String getNewSubQuery() + { + return newSubQuery_; + } + + public final String getNewSubQueryItem() + { + return newSubQueryItem_; + } + + // Backup the business services and remove those in serviceHash from the current list. Return the updated list of business services + private final void backupAndUpdateBusinessServices(Vector backupBusServiceVector,BusinessEntity be,Hashtable servicesHash,boolean isAdd) + { + // Save the current list of business services for rollback operations. + BusinessServices currentBusServices = be.getBusinessServices(); + if (currentBusServices == null) + currentBusServices = new BusinessServices(); + Vector currentBusServiceVector = currentBusServices.getBusinessServiceVector(); + for (int i=0;i<currentBusServiceVector.size();i++) + { + BusinessService currentBusService = (BusinessService)currentBusServiceVector.elementAt(i); + backupBusServiceVector.addElement(currentBusService); + // If the current business service is a member of the list to be removed/added, remove it now. + if (servicesHash.get(currentBusService.getServiceKey()) != null) + { + currentBusServiceVector.removeElementAt(i); + i--; + } + } + + if (isAdd) + { + Enumeration e = servicesHash.elements(); + while (e.hasMoreElements()) + currentBusServiceVector.addElement((BusinessService)e.nextElement()); + } + be.setBusinessServices(currentBusServices); + } + + private final void rollbackBusinessServices(BusinessEntity be,Vector backupBusServiceVector,Vector operatedServices,Perspective perspective,MessageQueue messageQueue,String errorMessageKey) + { + // Roll back and restore the old list of services. + be.getBusinessServices().setBusinessServiceVector(backupBusServiceVector); + for (int i=0;i<operatedServices.size();i++) + { + ListElement serviceListElement = (ListElement)operatedServices.elementAt(i); + BusinessService bs = (BusinessService)serviceListElement.getObject(); + String bsName = bs.getDefaultNameString(); + messageQueue.addMessage(perspective.getMessage(errorMessageKey,bsName)); + } + } +} diff --git a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/uddi/actions/OpenCategoryBrowserAction.java b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/uddi/actions/OpenCategoryBrowserAction.java new file mode 100644 index 000000000..55573c624 --- /dev/null +++ b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/uddi/actions/OpenCategoryBrowserAction.java @@ -0,0 +1,60 @@ +/******************************************************************************* + * Copyright (c) 2001, 2004 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ + +package org.eclipse.wst.ws.internal.explorer.platform.uddi.actions; + +import org.eclipse.wst.ws.internal.explorer.platform.actions.*; +import org.eclipse.wst.ws.internal.explorer.platform.constants.*; +import org.eclipse.wst.ws.internal.explorer.platform.uddi.constants.*; + +import javax.servlet.http.*; + +public class OpenCategoryBrowserAction extends Action +{ + public OpenCategoryBrowserAction() + { + } + + private static final void addSessionAndTModelKey(StringBuffer result,String sessionId,String categoryTModelKey) + { + result.append(ActionInputs.SESSIONID).append('=').append(sessionId).append('&').append(UDDIActionInputs.CATEGORY_TMODEL_KEY).append('=').append(categoryTModelKey); + } + + // uddi/category_browser.jsp?sessionId=...&categoryTModelKey=... + public static final String getActionLink(String sessionId,String categoryTModelKey) + { + StringBuffer actionLink = new StringBuffer("uddi/category_browser.jsp?"); + addSessionAndTModelKey(actionLink,sessionId,categoryTModelKey); + return actionLink.toString(); + } + + public static final String getCategoryContentPage(String sessionId,String categoryTModelKey) + { + StringBuffer actionLink = new StringBuffer("uddi/category_content.jsp?"); + addSessionAndTModelKey(actionLink,sessionId,categoryTModelKey); + return actionLink.toString(); + } + + public static final String getWildCardActionLink(String sessionId) + { + return getActionLink(sessionId,"%"); + } + + public final boolean populatePropertyTable(HttpServletRequest request) + { + return true; + } + + public final boolean run() + { + return true; + } +} diff --git a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/uddi/actions/OpenRegistryAction.java b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/uddi/actions/OpenRegistryAction.java new file mode 100644 index 000000000..e07820f97 --- /dev/null +++ b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/uddi/actions/OpenRegistryAction.java @@ -0,0 +1,232 @@ +/******************************************************************************* + * Copyright (c) 2004 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.wst.ws.internal.explorer.platform.uddi.actions; + +import org.eclipse.wst.ws.internal.explorer.platform.constants.*; +import org.eclipse.wst.ws.internal.explorer.platform.perspective.*; +import org.eclipse.wst.ws.internal.explorer.platform.uddi.constants.*; +import org.eclipse.wst.ws.internal.explorer.platform.uddi.datamodel.*; +import org.eclipse.wst.ws.internal.explorer.platform.uddi.perspective.*; +import org.eclipse.wst.ws.internal.explorer.platform.util.*; + +import org.uddi4j.client.UDDIProxy; +import org.uddi4j.datatype.tmodel.*; +import org.uddi4j.transport.*; +import org.uddi4j.response.*; +import org.uddi4j.util.*; +import org.uddi4j.*; + +import java.util.*; +import java.net.*; + +public class OpenRegistryAction extends UDDIPropertiesFormAction +{ + public OpenRegistryAction(Controller controller) + { + super(controller); + // Select UDDI Main. + } + + protected final boolean processParsedResults(MultipartFormDataParser parser) throws MultipartFormDataException + { + String registryName = parser.getParameter(UDDIActionInputs.REGISTRY_NAME); + String inquiryURL = parser.getParameter(UDDIActionInputs.INQUIRY_URL); + String publishURL = parser.getParameter(UDDIActionInputs.PUBLISH_URL); + String username = parser.getParameter(UDDIActionInputs.UDDI_USERNAME); + String password = parser.getParameter(UDDIActionInputs.UDDI_PASSWORD); + String checkUserDefinedCategoriesChecked = parser.getParameter(UDDIActionInputs.CHECK_USER_DEFINED_CATEGORIES); + String categoriesDirectory = parser.getParameter(UDDIActionInputs.CATEGORIES_DIRECTORY); + + // Validate the data. + boolean inputsValid = true; + UDDIPerspective uddiPerspective = controller_.getUDDIPerspective(); + MessageQueue messageQueue = uddiPerspective.getMessageQueue(); + FormTool formTool = getSelectedFormTool(); + if (registryName != null) + propertyTable_.put(UDDIActionInputs.REGISTRY_NAME,registryName); + + if (!Validator.validateString(registryName)) + { + inputsValid = false; + formTool.flagError(UDDIActionInputs.REGISTRY_NAME); + messageQueue.addMessage(uddiPerspective.getMessage("MSG_ERROR_INVALID_REGISTRY_NAME")); + } + + if (inquiryURL != null) + propertyTable_.put(UDDIActionInputs.INQUIRY_URL,inquiryURL); + if (!Validator.validateURL(inquiryURL)) + { + inputsValid = false; + formTool.flagError(UDDIActionInputs.INQUIRY_URL); + messageQueue.addMessage(uddiPerspective.getMessage("MSG_ERROR_INVALID_INQUIRY_URL")); + } + + if (publishURL != null) + propertyTable_.put(UDDIActionInputs.PUBLISH_URL, publishURL); + + if (username != null) + propertyTable_.put(UDDIActionInputs.UDDI_USERNAME, username); + + if (password != null) + propertyTable_.put(UDDIActionInputs.UDDI_PASSWORD, password); + + if (checkUserDefinedCategoriesChecked != null) + propertyTable_.put(UDDIActionInputs.CHECK_USER_DEFINED_CATEGORIES,checkUserDefinedCategoriesChecked); + else + removeProperty(UDDIActionInputs.CHECK_USER_DEFINED_CATEGORIES); + + if (categoriesDirectory != null) + propertyTable_.put(UDDIActionInputs.CATEGORIES_DIRECTORY,categoriesDirectory); + else + removeProperty(UDDIActionInputs.CATEGORIES_DIRECTORY); + + formTool.updatePropertyTable(propertyTable_); + return inputsValid; + } + + public final void gatherWSUserDefinedCategories(UDDIProxy proxy,Hashtable categoryModels) + { + try + { + CategoryBag categoryBag = new CategoryBag(); + categoryBag.add(new KeyedReference("","categorization",TModel.TYPES_TMODEL_KEY)); + TModelList tModelList = proxy.find_tModel("%",categoryBag,null,null,100); + TModelInfos tModelInfos = tModelList.getTModelInfos(); + Vector tModelKeyVector = new Vector(); + for (int i=0;i<tModelInfos.size();i++) + { + TModelInfo tModelInfo = tModelInfos.get(i); + tModelKeyVector.addElement(tModelInfo.getTModelKey()); + } + TModelDetail tModelDetail = proxy.get_tModelDetail(tModelKeyVector); + Vector tModelVector = tModelDetail.getTModelVector(); + for (int i=0;i<tModelVector.size();i++) + { + TModel tModel = (TModel)tModelVector.elementAt(i); + boolean checked = false; + String displayName = null; + String categoryKey = null; + categoryBag = tModel.getCategoryBag(); + for (int j=0;j<categoryBag.size();j++) + { + KeyedReference kr = categoryBag.get(j); + String krTModelKey = kr.getTModelKey(); + if (krTModelKey.equalsIgnoreCase(TModel.GENERAL_KEYWORDS_TMODEL_KEY)) + { + String krKeyName = kr.getKeyName(); + if (krKeyName.equals("urn:x-ibm:uddi:customTaxonomy:key")) + categoryKey = kr.getKeyValue(); + else if (krKeyName.equals("urn:x-ibm:uddi:customTaxonomy:displayName")) + displayName = kr.getKeyValue(); + } + else if (krTModelKey.equalsIgnoreCase(TModel.TYPES_TMODEL_KEY)) + checked = kr.getKeyValue().equals("checked"); + } + if (categoryKey != null) + { + if (displayName == null) + displayName = tModel.getNameString(); + CategoryModel categoryModel = new CategoryModel(); + categoryModel.setCategoryKey(categoryKey); + categoryModel.enableChecked(checked); + categoryModel.setDisplayName(displayName); + String tModelKey = tModel.getTModelKey(); + categoryModel.setTModelKey(tModelKey); + categoryModels.put(tModelKey,categoryModel); + } + } + } + catch (UDDIException e) + { + } + catch (TransportException e) + { + } + } + + public final boolean run() + { + UDDIPerspective uddiPerspective = controller_.getUDDIPerspective(); + MessageQueue messageQueue = uddiPerspective.getMessageQueue(); + try + { + String registryName = (String)propertyTable_.get(UDDIActionInputs.REGISTRY_NAME); + String inquiryURL = (String)propertyTable_.get(UDDIActionInputs.INQUIRY_URL); + String publishURL = (String)propertyTable_.get(UDDIActionInputs.PUBLISH_URL); + String registrationURL = (String)propertyTable_.get(UDDIActionInputs.REGISTRATION_URL); + String username = (String)propertyTable_.get(UDDIActionInputs.UDDI_USERNAME); + String password = (String)propertyTable_.get(UDDIActionInputs.UDDI_PASSWORD); + boolean checkForUserDefinedCategoriesChecked = (propertyTable_.get(UDDIActionInputs.CHECK_USER_DEFINED_CATEGORIES) != null); + String categoriesDirectory = (String)propertyTable_.get(UDDIActionInputs.CATEGORIES_DIRECTORY); + + String recognizedPublishURL = uddiPerspective.getKnownRegistryPublishURL(inquiryURL); + String recognizedRegistrationURL = uddiPerspective.getKnownRegistryRegistrationURL(inquiryURL); + + if (publishURL == null) + publishURL = recognizedPublishURL; + if (registrationURL == null) + registrationURL = recognizedRegistrationURL; + + UDDIMainNode uddiMainNode = (UDDIMainNode)(controller_.getUDDIPerspective().getNavigatorManager().getRootNode()); + UDDIMainElement uddiMainElement = (UDDIMainElement)uddiMainNode.getTreeElement(); + Properties props = new Properties(); + props.put(ActionInputs.TRANSPORT_CLASS_NAME, ActionInputs.TRASPORT_CLASS); + UDDIProxy proxy = new UDDIProxy(props); + proxy.setInquiryURL(new URL(inquiryURL)); + RegistryElement registryElement = new RegistryElement(proxy,inquiryURL,registryName,uddiMainElement.getModel()); + // Set registry element's publish URL and registration URL provided by external callers (e.g. favorites). + if (publishURL != null) + registryElement.setCachedPublishURL(publishURL); + if (registrationURL != null) + registryElement.setRegistrationURL(registrationURL); + if (username != null) + registryElement.setUserId(username); + if (password != null) + registryElement.setCred(password); + registryElement.setCheckForUserDefinedCategories(checkForUserDefinedCategoriesChecked); + if (checkForUserDefinedCategoriesChecked) + { + Hashtable categoryModels = new Hashtable(); + gatherWSUserDefinedCategories(proxy,categoryModels); + if (categoryModels.size() > 0) + registryElement.setUserDefinedCategories(categoryModels); + else + messageQueue.addMessage(uddiPerspective.getMessage("MSG_INFO_NO_USER_DEFINED_CATEGORIES_FOUND")); + } + registryElement.setCategoriesDirectory(categoriesDirectory); + uddiMainElement.connect(registryElement,UDDIModelConstants.REL_REGISTRIES,ModelConstants.REL_OWNER); + NodeManager nodeManager = uddiMainNode.getNodeManager(); + int newRegistryNodeId = uddiMainNode.getChildNode(registryElement).getNodeId(); + // Select the new registry node and add the select action to the history. + nodeManager.setSelectedNodeId(newRegistryNodeId); + Node registryNode = nodeManager.getSelectedNode(); + ToolManager toolManager = registryNode.getCurrentToolManager(); + addToHistory(ActionInputs.PERSPECTIVE_UDDI,toolManager.getSelectedTool().getSelectToolActionHref(true)); + messageQueue.addMessage(uddiPerspective.getMessage("MSG_INFO_REGISTRY_OPENED",new String[]{registryName,inquiryURL})); + return true; + } + catch (MalformedURLException e) + { + messageQueue.addMessage(controller_.getMessage("MSG_ERROR_UNEXPECTED")); + messageQueue.addMessage("MalformedURLException"); + messageQueue.addMessage(e.getMessage()); + FormTool formTool = getSelectedFormTool(); + formTool.flagError(UDDIActionInputs.INQUIRY_URL); + } + /* + catch (FormInputException e) + { + messageQueue.addMessage(e.getMessage()); + } + */ + return false; + } +} diff --git a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/uddi/actions/PublishAction.java b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/uddi/actions/PublishAction.java new file mode 100644 index 000000000..01a22061e --- /dev/null +++ b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/uddi/actions/PublishAction.java @@ -0,0 +1,223 @@ +/******************************************************************************* + * Copyright (c) 2004 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.wst.ws.internal.explorer.platform.uddi.actions; + +import org.eclipse.wst.ws.internal.explorer.platform.constants.*; +import org.eclipse.wst.ws.internal.explorer.platform.datamodel.*; +import org.eclipse.wst.ws.internal.explorer.platform.engine.transformer.ITransformer; +import org.eclipse.wst.ws.internal.explorer.platform.engine.transformer.MultipartFormDataParserTransformer; +import org.eclipse.wst.ws.internal.explorer.platform.perspective.*; +import org.eclipse.wst.ws.internal.explorer.platform.uddi.constants.*; +import org.eclipse.wst.ws.internal.explorer.platform.uddi.datamodel.*; +import org.eclipse.wst.ws.internal.explorer.platform.uddi.perspective.*; +import org.eclipse.wst.ws.internal.explorer.platform.util.*; + +import org.uddi4j.datatype.business.BusinessEntity; +import org.uddi4j.datatype.service.BusinessService; +import org.uddi4j.datatype.tmodel.TModel; + +import java.util.*; + +public abstract class PublishAction extends UDDIPropertiesFormAction +{ + protected String subQueryKey_; + protected boolean subQueryInitiated_; + protected String newSubQuery_; + protected boolean isSubQueryGet_; + protected String newSubQueryItem_; + protected RegistryNode regNode_; + + public PublishAction(Controller controller) + { + super(controller); + subQueryKey_ = null; + isSubQueryGet_ = false; + subQueryInitiated_ = false; + regNode_ = getRegistryNode(); + } + + protected abstract boolean processOthers(MultipartFormDataParser parser,FormToolPropertiesInterface formToolPI) throws MultipartFormDataException; + + protected final boolean processParsedResults(MultipartFormDataParser parser) throws MultipartFormDataException + { + // Setup for MultipartFormDataParserTransformer + propertyTable_.put(ActionInputs.MULTIPART_FORM_DATA_PARSER, parser); + + newSubQuery_ = parser.getParameter(UDDIActionInputs.NEW_SUBQUERY_INITIATED); + String isSubQueryGetString = parser.getParameter(UDDIActionInputs.SUBQUERY_GET); + newSubQueryItem_ = parser.getParameter(UDDIActionInputs.NEW_SUBQUERY_QUERY_ITEM); + subQueryKey_ = parser.getParameter(UDDIActionInputs.SUBQUERY_KEY); + + // Validate the data. + boolean inputsValid = true; + UDDIPerspective uddiPerspective = controller_.getUDDIPerspective(); + MessageQueue messageQueue = uddiPerspective.getMessageQueue(); + FormTool formTool = getSelectedFormTool(); + FormToolPropertiesInterface formToolPI = ((MultipleFormToolPropertiesInterface)formTool).getFormToolProperties(subQueryKey_); + formToolPI.clearErrors(); + + if (newSubQuery_ != null && newSubQuery_.length() > 0) + subQueryInitiated_ = true; + else + subQueryInitiated_ = false; + + if (isSubQueryGetString != null) + isSubQueryGet_ = Boolean.valueOf(isSubQueryGetString).booleanValue(); + + if (!processOthers(parser,formToolPI) && !subQueryInitiated_) + inputsValid = false; + + for (int i=0;i<removedProperties_.size();i++) + formToolPI.removeProperty(removedProperties_.elementAt(i)); + formToolPI.updatePropertyTable(propertyTable_); + + String publishURL = parser.getParameter(UDDIActionInputs.QUERY_INPUT_ADVANCED_PUBLISH_URL); + String userId = parser.getParameter(UDDIActionInputs.QUERY_INPUT_ADVANCED_USERID); + String password = parser.getParameter(UDDIActionInputs.QUERY_INPUT_ADVANCED_PASSWORD); + RegistryElement regElement = (RegistryElement)regNode_.getTreeElement(); + + boolean validateAuthentication = !regElement.isLoggedIn(); + + if (publishURL != null) + { + propertyTable_.put(UDDIActionInputs.QUERY_INPUT_ADVANCED_PUBLISH_URL,publishURL); + formTool.setProperty(UDDIActionInputs.QUERY_INPUT_ADVANCED_PUBLISH_URL,publishURL); + } + + if (!subQueryInitiated_ && validateAuthentication && !Validator.validateString(publishURL)) + { + inputsValid = false; + formTool.flagError(UDDIActionInputs.QUERY_INPUT_ADVANCED_PUBLISH_URL); + messageQueue.addMessage(uddiPerspective.getMessage("MSG_ERROR_INVALID_PUBLISH_URL")); + } + + if (userId != null) + { + propertyTable_.put(UDDIActionInputs.QUERY_INPUT_ADVANCED_USERID,userId); + formTool.setProperty(UDDIActionInputs.QUERY_INPUT_ADVANCED_USERID,userId); + } + + if (!subQueryInitiated_ && validateAuthentication && !Validator.validateString(userId)) + { + inputsValid = false; + formTool.flagError(UDDIActionInputs.QUERY_INPUT_ADVANCED_USERID); + messageQueue.addMessage(uddiPerspective.getMessage("MSG_ERROR_INVALID_USERID")); + } + + if (password != null) + { + propertyTable_.put(UDDIActionInputs.QUERY_INPUT_ADVANCED_PASSWORD,password); + formTool.setProperty(UDDIActionInputs.QUERY_INPUT_ADVANCED_PASSWORD,password); + } + + return inputsValid; + } + + protected final void addPublishedItemNode(BusinessEntity be,RegistryElement regElement) + { + BusinessElement beElement = new BusinessElement(be,regElement.getModel()); + PublishedItemsElement publishedBusinessesElement = regElement.getPublishedBusinessesElement(); + Enumeration e = publishedBusinessesElement.getItems(); + while (e.hasMoreElements()) + { + BusinessElement element = (BusinessElement)e.nextElement(); + BusinessEntity elementBE = element.getBusinessEntity(); + if (elementBE.getBusinessKey().equals(be.getBusinessKey())) + { + element.disconnectAll(); + break; + } + } + connectElements(publishedBusinessesElement,beElement); + } + + protected final void addPublishedItemNode(BusinessService bs,RegistryElement regElement) + { + ServiceElement sElement = new ServiceElement(bs,regElement.getModel()); + PublishedItemsElement publishedServicesElement = regElement.getPublishedServicesElement(); + Enumeration e = publishedServicesElement.getItems(); + while (e.hasMoreElements()) + { + ServiceElement element = (ServiceElement)e.nextElement(); + BusinessService elementBS = element.getBusinessService(); + if (elementBS.getServiceKey().equals(bs.getServiceKey())) + { + element.disconnectAll(); + break; + } + } + connectElements(publishedServicesElement,sElement); + } + + protected final void addPublishedItemNode(TModel tModel,RegistryElement regElement) + { + ServiceInterfaceElement siElement = new ServiceInterfaceElement(tModel,regElement.getModel()); + PublishedItemsElement publishedServiceInterfacesElement = regElement.getPublishedServiceInterfacesElement(); + Enumeration e = publishedServiceInterfacesElement.getItems(); + while (e.hasMoreElements()) + { + ServiceInterfaceElement element = (ServiceInterfaceElement)e.nextElement(); + TModel elementTModel = element.getTModel(); + if (tModel.getTModelKey().equals(elementTModel.getTModelKey())) + { + element.disconnectAll(); + break; + } + } + connectElements(publishedServiceInterfacesElement,siElement); + } + + private final void connectElements(PublishedItemsElement publishedItemsElement,TreeElement itemElement) + { + publishedItemsElement.connect(itemElement,UDDIModelConstants.REL_PUBLISHED_ITEMS,ModelConstants.REL_OWNER); + int newNodeId = regNode_.getChildNode(publishedItemsElement).getChildNode(itemElement).getNodeId(); + NodeManager nodeManager = regNode_.getNodeManager(); + nodeManager.setSelectedNodeId(newNodeId); + Node newNode = nodeManager.getSelectedNode(); + ToolManager toolManager = newNode.getToolManager(); + Tool selectedTool = toolManager.getSelectedTool(); + addToHistory(ActionInputs.PERSPECTIVE_UDDI,selectedTool.getSelectToolActionHref(true)); + } + + public final boolean isSubQueryInitiated() + { + return subQueryInitiated_; + } + + public final boolean isSubQueryGet() + { + return isSubQueryGet_; + } + + public final String getSubQueryKey() + { + return subQueryKey_; + } + + public final String getNewSubQuery() + { + return newSubQuery_; + } + + public final String getNewSubQueryItem() + { + return newSubQueryItem_; + } + + public ITransformer[] getTransformers() + { + ITransformer[] parentTransformers = super.getTransformers(); + ITransformer[] transformers = new ITransformer[parentTransformers.length + 1]; + System.arraycopy(parentTransformers, 0, transformers, 0, parentTransformers.length); + transformers[transformers.length - 1] = new MultipartFormDataParserTransformer(controller_); + return transformers; + } +}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/uddi/actions/RefreshUDDINodeAction.java b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/uddi/actions/RefreshUDDINodeAction.java new file mode 100644 index 000000000..489bc0102 --- /dev/null +++ b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/uddi/actions/RefreshUDDINodeAction.java @@ -0,0 +1,239 @@ +/******************************************************************************* + * Copyright (c) 2001, 2004 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ + +package org.eclipse.wst.ws.internal.explorer.platform.uddi.actions; + +import org.eclipse.wst.ws.internal.explorer.platform.constants.*; +import org.eclipse.wst.ws.internal.explorer.platform.datamodel.*; +import org.eclipse.wst.ws.internal.explorer.platform.favorites.actions.*; +import org.eclipse.wst.ws.internal.explorer.platform.perspective.*; +import org.eclipse.wst.ws.internal.explorer.platform.uddi.constants.*; +import org.eclipse.wst.ws.internal.explorer.platform.uddi.datamodel.*; +import org.eclipse.wst.ws.internal.explorer.platform.uddi.perspective.*; + +import org.uddi4j.datatype.business.BusinessEntity; +import org.uddi4j.datatype.service.BusinessService; +import org.uddi4j.datatype.tmodel.TModel; + +import java.util.*; + +public class RefreshUDDINodeAction extends UDDINodeAction +{ + private Vector staleNodes_; + public RefreshUDDINodeAction(Controller controller) + { + super(controller); + propertyTable_.put(ActionInputs.NODEID,String.valueOf(controller.getUDDIPerspective().getNavigatorManager().getSelectedNodeId())); + staleNodes_ = new Vector(); + } + + // uddi/actions/RefreshUDDINodeActionJSP.jsp?nodeId=... + public static String getActionLink(int nodeId) + { + StringBuffer actionLink = new StringBuffer("uddi/actions/RefreshUDDINodeActionJSP.jsp?"); + actionLink.append(ActionInputs.NODEID).append('=').append(nodeId); + return actionLink.toString(); + } + + public final boolean verifyNodeData() + { + int nodeId = Integer.parseInt((String)propertyTable_.get(ActionInputs.NODEID)); + Node node = nodeManager_.getNode(nodeId); + if (node instanceof BusinessNode) + return refreshBusinessElement((BusinessNode)node); + else if (node instanceof ServiceNode) + return refreshServiceElement((ServiceNode)node); + else if (node instanceof ServiceInterfaceNode) + return refreshServiceInterfaceElement((ServiceInterfaceNode)node); + else if (node instanceof QueryNode) + { + // Nothing to verify + return true; + } + else if (node != null) + { + // RegistryNode + if (node instanceof RegistryNode) + refreshRegistryElement((RegistryNode)node); + + // FolderNodes + Vector childNodes = node.getChildNodes(); + Vector refreshActions = new Vector(); + for (int i=0;i<childNodes.size();i++) + { + Node childNode = (Node)childNodes.elementAt(i); + RefreshUDDINodeAction action = new RefreshUDDINodeAction(controller_); + action.setStaleNodes(staleNodes_); + Hashtable propertyTable = action.getPropertyTable(); + String childNodeIdString = String.valueOf(childNode.getNodeId()); + propertyTable.put(ActionInputs.NODEID,childNodeIdString); + if (!action.verifyNodeData()) + staleNodes_.addElement(childNode); + else + refreshActions.addElement(action); + } + propertyTable_.put(UDDIActionInputs.LATEST_OBJECT,refreshActions); + return true; + } + return true; + } + + private final void refreshRegistryElement(RegistryNode regNode) + { + RegistryElement regElement = (RegistryElement)regNode.getTreeElement(); + Hashtable userDefinedCategories = null; + if (regElement.getCheckForUserDefinedCategories()) + { + userDefinedCategories = new Hashtable(); + OpenRegistryAction openRegAction = new OpenRegistryAction(controller_); + openRegAction.gatherWSUserDefinedCategories(regElement.getProxy(),userDefinedCategories); + if (!userDefinedCategories.keys().hasMoreElements()) + { + userDefinedCategories = null; + regNode.setImagePath(RegistryNode.IMAGE_PATH_STANDARD); + } + else + { + String categoriesDirectory = regElement.getCategoriesDirectory(); + AddRegistryToUDDIPerspectiveAction addAction = new AddRegistryToUDDIPerspectiveAction(controller_); + if (categoriesDirectory != null) + addAction.linkCategoryModelsWithSavedData(userDefinedCategories.elements(),categoriesDirectory); + else + addAction.linkCategoryModelsWithSavedData(regElement.getName(),userDefinedCategories.elements()); + regNode.setImagePath(RegistryNode.IMAGE_PATH_WITH_USER_DEFINED_CATEGORIES); + } + } + regElement.setUserDefinedCategories(userDefinedCategories); + } + + private final boolean refreshBusinessElement(BusinessNode busNode) + { + BusinessElement busElement = (BusinessElement)busNode.getTreeElement(); + String uuidKey = busElement.getBusinessEntity().getBusinessKey(); + RegFindBusinessUUIDAction verifyAction = new RegFindBusinessUUIDAction(controller_); + Hashtable propertyTable = verifyAction.getPropertyTable(); + propertyTable.put(UDDIActionInputs.QUERY_INPUT_UUID_BUSINESS_KEY,uuidKey); + propertyTable.put(UDDIActionInputs.REFRESH_NODE,busNode); + propertyTable.put(UDDIActionInputs.QUERY_INPUT_OVERRIDE_ADD_QUERY_NODE,Boolean.TRUE); + boolean verifyResult = verifyAction.run(); + if (verifyResult) + propertyTable_.put(UDDIActionInputs.LATEST_OBJECT,new BusinessElement((BusinessEntity)propertyTable.get(UDDIActionInputs.LATEST_OBJECT),busElement.getModel())); + return verifyResult; + } + + private final boolean refreshServiceElement(ServiceNode serviceNode) + { + ServiceElement serviceElement = (ServiceElement)serviceNode.getTreeElement(); + String uuidKey = serviceElement.getBusinessService().getServiceKey(); + RegFindServiceUUIDAction verifyAction = new RegFindServiceUUIDAction(controller_); + Hashtable propertyTable = verifyAction.getPropertyTable(); + propertyTable.put(UDDIActionInputs.QUERY_INPUT_UUID_SERVICE_KEY,uuidKey); + propertyTable.put(UDDIActionInputs.REFRESH_NODE,serviceNode); + propertyTable.put(UDDIActionInputs.QUERY_INPUT_OVERRIDE_ADD_QUERY_NODE,Boolean.TRUE); + boolean verifyResult = verifyAction.run(); + if (verifyResult) + propertyTable_.put(UDDIActionInputs.LATEST_OBJECT,new ServiceElement((BusinessService)propertyTable.get(UDDIActionInputs.LATEST_OBJECT),serviceElement.getModel())); + return verifyResult; + } + + private final boolean refreshServiceInterfaceElement(ServiceInterfaceNode siNode) + { + ServiceInterfaceElement siElement = (ServiceInterfaceElement)siNode.getTreeElement(); + String uuidKey = siElement.getTModel().getTModelKey(); + RegFindServiceInterfaceUUIDAction verifyAction = new RegFindServiceInterfaceUUIDAction(controller_); + Hashtable propertyTable = verifyAction.getPropertyTable(); + propertyTable.put(UDDIActionInputs.QUERY_INPUT_UUID_SERVICE_INTERFACE_KEY,uuidKey); + propertyTable.put(UDDIActionInputs.REFRESH_NODE,siNode); + propertyTable.put(UDDIActionInputs.QUERY_INPUT_OVERRIDE_ADD_QUERY_NODE,Boolean.TRUE); + boolean verifyResult = verifyAction.run(); + if (verifyResult) + propertyTable_.put(UDDIActionInputs.LATEST_OBJECT,new ServiceInterfaceElement((TModel)propertyTable.get(UDDIActionInputs.LATEST_OBJECT),siElement.getModel())); + return verifyResult; + } + + public final void connectElements(Node parentNode,TreeElement newElement) + { + TreeElement parentElement = parentNode.getTreeElement(); + String rel = null; + if (parentNode instanceof PublishedItemsNode) + rel = UDDIModelConstants.REL_PUBLISHED_ITEMS; + else if (parentNode instanceof QueryNode) + rel = UDDIModelConstants.REL_QUERY_RESULTS; + else if (parentNode instanceof QueryParentNode) + rel = UDDIModelConstants.REL_QUERIES; + parentElement.connect(newElement,rel,ModelConstants.REL_OWNER); + Node newNode = parentNode.getChildNode(newElement); + int newNodeId = newNode.getNodeId(); + nodeManager_.setSelectedNodeId(newNodeId); + ToolManager toolManager = newNode.getToolManager(); + Tool selectedTool = toolManager.getSelectedTool(); + addToHistory(ActionInputs.PERSPECTIVE_UDDI,selectedTool.getSelectToolActionHref(true)); + } + + public final String getActionLinkForHistory() + { + return null; + } + + public final boolean run() + { + UDDIPerspective uddiPerspective = controller_.getUDDIPerspective(); + MessageQueue messageQueue = uddiPerspective.getMessageQueue(); + int nodeId = Integer.parseInt((String)propertyTable_.get(ActionInputs.NODEID)); + if (!isStaleNode(nodeId)) + { + Node node = nodeManager_.getNode(nodeId); + Object latestObject = propertyTable_.get(UDDIActionInputs.LATEST_OBJECT); + if (latestObject != null) + { + if (latestObject instanceof Vector) + { + Vector refreshActions = (Vector)propertyTable_.get(UDDIActionInputs.LATEST_OBJECT); + for (int i=0;i<refreshActions.size();i++) + { + RefreshUDDINodeAction refreshAction = (RefreshUDDINodeAction)refreshActions.elementAt(i); + refreshAction.run(); + } + nodeManager_.setSelectedNodeId(nodeId); + } + else + { + TreeElement oldElement = node.getTreeElement(); + oldElement.disconnectAll(); + connectElements(node.getParent(),(TreeElement)propertyTable_.get(UDDIActionInputs.LATEST_OBJECT)); + } + } + else + { + // QueryNodes + QueryNode queryNode = (QueryNode)node; + FindAction findAction = queryNode.getFindAction(); + findAction.setRefreshAction(true); + if (!findAction.run()) + queryNode.removeChildNodes(true); + findAction.setRefreshAction(false); + } + messageQueue.addMessage(uddiPerspective.getMessage("MSG_INFO_NODE_REFRESHED",node.getNodeName())); + return true; + } + return false; + } + + public final Vector getStaleNodes() + { + return staleNodes_; + } + + public final void setStaleNodes(Vector staleNodes) + { + staleNodes_ = staleNodes; + } +} diff --git a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/uddi/actions/RefreshUDDINodesAction.java b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/uddi/actions/RefreshUDDINodesAction.java new file mode 100644 index 000000000..4b3d246e9 --- /dev/null +++ b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/uddi/actions/RefreshUDDINodesAction.java @@ -0,0 +1,69 @@ +/******************************************************************************* + * Copyright (c) 2001, 2004 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ + +package org.eclipse.wst.ws.internal.explorer.platform.uddi.actions; + +import org.eclipse.wst.ws.internal.explorer.platform.constants.*; +import org.eclipse.wst.ws.internal.explorer.platform.perspective.*; +import org.eclipse.wst.ws.internal.explorer.platform.uddi.constants.*; +import org.eclipse.wst.ws.internal.explorer.platform.uddi.perspective.*; +import org.eclipse.wst.ws.internal.explorer.platform.util.*; + +import java.util.*; + +public class RefreshUDDINodesAction extends UDDIPropertiesFormAction +{ + private Vector staleNodes_; + + public RefreshUDDINodesAction(Controller controller) + { + super(controller); + staleNodes_ = new Vector(); + } + + protected boolean processParsedResults(MultipartFormDataParser parser) throws MultipartFormDataException + { + String[] selectedNodeIds = parser.getParameterValues(ActionInputs.NODEID); + // The client Javascript enforces the rule that at least one item was selected before the form can be submitted. + propertyTable_.put(UDDIActionInputs.SELECTED_NODEIDS,selectedNodeIds); + return true; + } + + public final boolean run() + { + UDDIPerspective uddiPerspective = controller_.getUDDIPerspective(); + NodeManager navigatorManager = uddiPerspective.getNavigatorManager(); + MessageQueue messageQueue = uddiPerspective.getMessageQueue(); + int collectorNodeId = getSelectedNavigatorNode().getNodeId(); + String[] selectedNodeIds = (String[])propertyTable_.get(UDDIActionInputs.SELECTED_NODEIDS); + RefreshUDDINodeAction action = new RefreshUDDINodeAction(controller_); + Hashtable propertyTable = action.getPropertyTable(); + for (int i=0;i<selectedNodeIds.length;i++) + { + propertyTable.put(ActionInputs.NODEID,selectedNodeIds[i]); + if (action.verifyNodeData()) + action.run(); + else + { + int nodeId = Integer.parseInt(selectedNodeIds[i]); + staleNodes_.addElement(navigatorManager.getNode(nodeId)); + messageQueue.addMessage(uddiPerspective.getMessage("MSG_ERROR_NODE_DATA_VALIDATION_FAILED",navigatorManager.getNode(nodeId).getNodeName())); + } + } + navigatorManager.setSelectedNodeId(collectorNodeId); + return true; + } + + public final Vector getStaleNodes() + { + return staleNodes_; + } +} diff --git a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/uddi/actions/RegFindBusinessUUIDAction.java b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/uddi/actions/RegFindBusinessUUIDAction.java new file mode 100644 index 000000000..34223f5dd --- /dev/null +++ b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/uddi/actions/RegFindBusinessUUIDAction.java @@ -0,0 +1,108 @@ +/******************************************************************************* + * Copyright (c) 2001, 2004 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ + +package org.eclipse.wst.ws.internal.explorer.platform.uddi.actions; + +import org.eclipse.wst.ws.internal.explorer.platform.actions.*; +import org.eclipse.wst.ws.internal.explorer.platform.perspective.*; +import org.eclipse.wst.ws.internal.explorer.platform.uddi.constants.*; +import org.eclipse.wst.ws.internal.explorer.platform.uddi.datamodel.*; +import org.eclipse.wst.ws.internal.explorer.platform.uddi.perspective.*; +import org.eclipse.wst.ws.internal.explorer.platform.util.*; + +import org.uddi4j.UDDIException; +import org.uddi4j.transport.TransportException; +import org.uddi4j.client.UDDIProxy; +import org.uddi4j.datatype.business.BusinessEntity; + +import java.util.*; + +public class RegFindBusinessUUIDAction extends FindAction +{ + public RegFindBusinessUUIDAction(Controller controller) + { + super(controller); + propertyTable_.put(UDDIActionInputs.QUERY_ITEM,String.valueOf(UDDIActionInputs.QUERY_ITEM_BUSINESSES)); + propertyTable_.put(UDDIActionInputs.QUERY_STYLE_BUSINESSES,String.valueOf(UDDIActionInputs.QUERY_STYLE_UUID)); + } + + protected final boolean processOthers(MultipartFormDataParser parser,FormToolPropertiesInterface formToolPI) throws MultipartFormDataException + { + String uuidKey = parser.getParameter(UDDIActionInputs.QUERY_INPUT_UUID_KEY); + + // Validate the data. + boolean inputsValid = true; + UDDIPerspective uddiPerspective = controller_.getUDDIPerspective(); + MessageQueue messageQueue = uddiPerspective.getMessageQueue(); + + if (uuidKey != null) + propertyTable_.put(UDDIActionInputs.QUERY_INPUT_UUID_BUSINESS_KEY,uuidKey); + + if (!subQueryInitiated_ && !Validator.validateString(uuidKey)) + { + inputsValid = false; + formToolPI.flagError(UDDIActionInputs.QUERY_INPUT_UUID_BUSINESS_KEY); + messageQueue.addMessage(uddiPerspective.getMessage("MSG_ERROR_INVALID_UUID_KEY")); + } + return inputsValid; + } + + public final boolean run() + { + UDDIPerspective uddiPerspective = controller_.getUDDIPerspective(); + MessageQueue messageQueue = uddiPerspective.getMessageQueue(); + try + { + boolean shouldAddQueryNode = (propertyTable_.get(UDDIActionInputs.QUERY_INPUT_OVERRIDE_ADD_QUERY_NODE) == null); + String uuidKey = (String)propertyTable_.get(UDDIActionInputs.QUERY_INPUT_UUID_BUSINESS_KEY); + + // The action can be run under the context of either a registry or a query node or even UDDIMainNode. + if (regNode_ == null) + regNode_ = getRegistryNode((Node)propertyTable_.get(UDDIActionInputs.REFRESH_NODE)); + RegistryElement regElement = (RegistryElement)regNode_.getTreeElement(); + UDDIProxy proxy = regElement.getProxy(); + BusinessEntity[] beList = new BusinessEntity[1]; + Vector beVector = proxy.get_businessDetail(uuidKey).getBusinessEntityVector(); + if (beVector.size() > 0) + { + beVector.toArray(beList); + if (shouldAddQueryNode) + { + String queryName = (String)propertyTable_.get(UDDIActionInputs.QUERY_NAME); + queryElement_ = new QueryElement(beList,queryName,regElement.getModel()); + addQueryNode(); + messageQueue.addMessage(uddiPerspective.getMessage("MSG_INFO_BUSINESSES_FOUND",String.valueOf(beList.length))); + } + propertyTable_.put(UDDIActionInputs.LATEST_OBJECT,beList[0]); + return true; + } + else + throw new FormInputException(uddiPerspective.getMessage("MSG_ERROR_NO_BUSINESSES_FOUND")); + } + catch (TransportException e) + { + messageQueue.addMessage(controller_.getMessage("MSG_ERROR_UNEXPECTED")); + messageQueue.addMessage("TransportException"); + messageQueue.addMessage(e.getMessage()); + } + catch (UDDIException e) + { + messageQueue.addMessage(controller_.getMessage("MSG_ERROR_UNEXPECTED")); + messageQueue.addMessage("UDDIException"); + messageQueue.addMessage(e.toString()); + } + catch (FormInputException e) + { + messageQueue.addMessage(e.getMessage()); + } + return false; + } +} diff --git a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/uddi/actions/RegFindBusinessesAdvancedAction.java b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/uddi/actions/RegFindBusinessesAdvancedAction.java new file mode 100644 index 000000000..c4f8fc1d7 --- /dev/null +++ b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/uddi/actions/RegFindBusinessesAdvancedAction.java @@ -0,0 +1,303 @@ +/******************************************************************************* + * Copyright (c) 2001, 2004 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ + +package org.eclipse.wst.ws.internal.explorer.platform.uddi.actions; + +import org.eclipse.wst.ws.internal.explorer.platform.actions.FormInputException; +import org.eclipse.wst.ws.internal.explorer.platform.datamodel.*; +import org.eclipse.wst.ws.internal.explorer.platform.perspective.*; +import org.eclipse.wst.ws.internal.explorer.platform.uddi.constants.*; +import org.eclipse.wst.ws.internal.explorer.platform.uddi.datamodel.*; +import org.eclipse.wst.ws.internal.explorer.platform.uddi.perspective.*; +import org.eclipse.wst.ws.internal.explorer.platform.util.*; + +import org.uddi4j.UDDIException; +import org.uddi4j.transport.TransportException; +import org.uddi4j.client.UDDIProxy; +import org.uddi4j.datatype.tmodel.TModel; +import org.uddi4j.datatype.business.BusinessEntity; +import org.uddi4j.datatype.*; +import org.uddi4j.response.BusinessInfo; +import org.uddi4j.response.BusinessInfos; +import org.uddi4j.util.*; + +import java.util.*; +import java.net.MalformedURLException; + +public class RegFindBusinessesAdvancedAction extends FindAction +{ + public RegFindBusinessesAdvancedAction(Controller controller) + { + super(controller); + propertyTable_.put(UDDIActionInputs.QUERY_ITEM,String.valueOf(UDDIActionInputs.QUERY_ITEM_BUSINESSES)); + propertyTable_.put(UDDIActionInputs.QUERY_STYLE_BUSINESSES,String.valueOf(UDDIActionInputs.QUERY_STYLE_ADVANCED)); + propertyTable_.put(UDDIActionInputs.QUERY_INPUT_ADVANCED_BUSINESS_MAX_SEARCH_SET,String.valueOf(UDDIActionInputs.QUERY_MAX_SEARCH_SET)); + propertyTable_.put(UDDIActionInputs.QUERY_INPUT_ADVANCED_BUSINESS_MAX_RESULTS,String.valueOf(UDDIActionInputs.QUERY_MAX_RESULTS)); + } + + protected final boolean processOthers(MultipartFormDataParser parser,FormToolPropertiesInterface formToolPI) throws MultipartFormDataException + { + String ownedChecked = parser.getParameter(UDDIActionInputs.QUERY_INPUT_ADVANCED_OWNED); + String[] languages = parser.getParameterValues(UDDIActionInputs.QUERY_INPUT_ADVANCED_NAME_LANGUAGE); + String[] names = parser.getParameterValues(UDDIActionInputs.QUERY_INPUT_ADVANCED_NAME); + String[] idTypes = parser.getParameterValues(UDDIActionInputs.QUERY_INPUT_ADVANCED_IDENTIFIER_TYPE); + String[] idKeyNames = parser.getParameterValues(UDDIActionInputs.QUERY_INPUT_ADVANCED_IDENTIFIER_KEY_NAME); + String[] idKeyValues = parser.getParameterValues(UDDIActionInputs.QUERY_INPUT_ADVANCED_IDENTIFIER_KEY_VALUE); + String[] catTypes = parser.getParameterValues(UDDIActionInputs.QUERY_INPUT_ADVANCED_CATEGORY_TYPE); + String[] catKeyNames = parser.getParameterValues(UDDIActionInputs.QUERY_INPUT_ADVANCED_CATEGORY_KEY_NAME); + String[] catKeyValues = parser.getParameterValues(UDDIActionInputs.QUERY_INPUT_ADVANCED_CATEGORY_KEY_VALUE); + String[] siNodeIds = parser.getParameterValues(UDDIActionInputs.NODEID_SERVICE_INTERFACE); + String[] discoveryURLValues = parser.getParameterValues(UDDIActionInputs.QUERY_INPUT_ADVANCED_DISCOVERYURL); + String[] findQualifierValues = parser.getParameterValues(UDDIActionInputs.QUERY_INPUT_ADVANCED_FINDQUALIFIER); + String maxSearchSet = parser.getParameter(UDDIActionInputs.QUERY_INPUT_ADVANCED_MAX_SEARCH_SET); + String maxResults = parser.getParameter(UDDIActionInputs.QUERY_INPUT_ADVANCED_MAX_RESULTS); + + // Validate the data. + boolean inputsValid = true; + UDDIPerspective uddiPerspective = controller_.getUDDIPerspective(); + MessageQueue messageQueue = uddiPerspective.getMessageQueue(); + Node selectedNode = getSelectedNavigatorNode(); + Node regNode = getRegistryNode(); + RegistryElement regElement = (RegistryElement)regNode_.getTreeElement(); + + if (ownedChecked != null) + propertyTable_.put(UDDIActionInputs.QUERY_INPUT_ADVANCED_BUSINESS_OWNED,ownedChecked); + else + removeProperty(UDDIActionInputs.QUERY_INPUT_ADVANCED_BUSINESS_OWNED); + + if (languages != null && names != null) + { + Vector nameVector = new Vector(); + for (int i=0;i<names.length;i++) + { + Name uddi4jName; + if (languages[i].length() > 0) + uddi4jName = new Name(names[i],languages[i]); + else + uddi4jName = new Name(names[i]); + nameVector.addElement(uddi4jName); + } + propertyTable_.put(UDDIActionInputs.QUERY_INPUT_ADVANCED_BUSINESS_NAMES,nameVector); + } + else + removeProperty(UDDIActionInputs.QUERY_INPUT_ADVANCED_BUSINESS_NAMES); + + if (idTypes != null && idKeyNames != null && idKeyValues != null) + { + IdentifierBag idBag = new IdentifierBag(); + for (int i=0;i<idKeyNames.length;i++) + { + KeyedReference kr = new KeyedReference(idKeyNames[i],idKeyValues[i],idTypes[i]); + idBag.add(kr); + } + propertyTable_.put(UDDIActionInputs.QUERY_INPUT_ADVANCED_BUSINESS_IDENTIFIERS,idBag); + } + else + removeProperty(UDDIActionInputs.QUERY_INPUT_ADVANCED_BUSINESS_IDENTIFIERS); + + if (catTypes != null && catKeyNames != null && catKeyValues != null) + { + CategoryBag catBag = new CategoryBag(); + for (int i=0;i<catTypes.length;i++) + { + KeyedReference kr = new KeyedReference(catKeyNames[i],catKeyValues[i],catTypes[i]); + catBag.add(kr); + } + propertyTable_.put(UDDIActionInputs.QUERY_INPUT_ADVANCED_BUSINESS_CATEGORIES,catBag); + } + else + removeProperty(UDDIActionInputs.QUERY_INPUT_ADVANCED_BUSINESS_CATEGORIES); + + if (siNodeIds != null) + { + // Although we already have the "submitted" data, deletions occur on the client side and thus the need to track this using hidden form elements. + Vector busServiceInterfaces = (Vector)formToolPI.getProperty(UDDIActionInputs.QUERY_INPUT_ADVANCED_BUSINESS_SERVICE_INTERFACES); + if (busServiceInterfaces == null) + busServiceInterfaces = new Vector(); + else + busServiceInterfaces.removeAllElements(); + Vector busServiceInterfacesCopy = (Vector)formToolPI.getProperty(UDDIActionInputs.QUERY_INPUT_ADVANCED_BUSINESS_SERVICE_INTERFACES_COPY); + Vector tModelKeyStringVector = new Vector(); + Hashtable resultHash = new Hashtable(); + for (int i=0;i<siNodeIds.length;i++) + resultHash.put(siNodeIds[i],Boolean.TRUE); + for (int i=0;i<busServiceInterfacesCopy.size();i++) + { + ListElement listElement = (ListElement)busServiceInterfacesCopy.elementAt(i); + if (resultHash.get(String.valueOf(listElement.getTargetNodeId())) != null) + { + busServiceInterfaces.addElement(listElement); + TModel tModel = (TModel)listElement.getObject(); + tModelKeyStringVector.addElement(tModel.getTModelKey()); + } + } + TModelBag tModelBag = new TModelBag(tModelKeyStringVector); + propertyTable_.put(UDDIActionInputs.QUERY_INPUT_ADVANCED_BUSINESS_SERVICE_INTERFACES,busServiceInterfaces); + propertyTable_.put(UDDIActionInputs.QUERY_INPUT_ADVANCED_BUSINESS_TMODELBAG,tModelBag); + } + else + { + removeProperty(UDDIActionInputs.QUERY_INPUT_ADVANCED_BUSINESS_SERVICE_INTERFACES); + removeProperty(UDDIActionInputs.QUERY_INPUT_ADVANCED_BUSINESS_TMODELBAG); + } + + if (discoveryURLValues != null) + { + DiscoveryURLs discoveryURLs = new DiscoveryURLs(); + Vector discoveryURLVector = new Vector(); + for (int i=0;i<discoveryURLValues.length;i++) + { + DiscoveryURL discoveryURL = new DiscoveryURL(discoveryURLValues[i],""); + discoveryURLVector.addElement(discoveryURL); + } + discoveryURLs.setDiscoveryURLVector(discoveryURLVector); + propertyTable_.put(UDDIActionInputs.QUERY_INPUT_ADVANCED_BUSINESS_DISCOVERYURLS,discoveryURLs); + } + else + removeProperty(UDDIActionInputs.QUERY_INPUT_ADVANCED_BUSINESS_DISCOVERYURLS); + + if (findQualifierValues != null) + { + FindQualifiers findQualifiers = new FindQualifiers(); + Vector findQualifierVector = new Vector(); + for (int i=0;i<findQualifierValues.length;i++) + { + FindQualifier findQualifier = new FindQualifier(findQualifierValues[i]); + findQualifierVector.addElement(findQualifier); + } + findQualifiers.setFindQualifierVector(findQualifierVector); + propertyTable_.put(UDDIActionInputs.QUERY_INPUT_ADVANCED_BUSINESS_FINDQUALIFIERS,findQualifiers); + } + else + removeProperty(UDDIActionInputs.QUERY_INPUT_ADVANCED_BUSINESS_FINDQUALIFIERS); + + if (maxSearchSet != null) + propertyTable_.put(UDDIActionInputs.QUERY_INPUT_ADVANCED_BUSINESS_MAX_SEARCH_SET,maxSearchSet); + if (!subQueryInitiated_ && !Validator.validateInteger(maxSearchSet)) + { + formToolPI.flagError(UDDIActionInputs.QUERY_INPUT_ADVANCED_BUSINESS_MAX_SEARCH_SET); + messageQueue.addMessage(uddiPerspective.getMessage("MSG_ERROR_INVALID_MAX_SEARCH_SET")); + inputsValid = false; + } + + if (maxResults != null) + propertyTable_.put(UDDIActionInputs.QUERY_INPUT_ADVANCED_BUSINESS_MAX_RESULTS,maxResults); + if (!subQueryInitiated_ && !Validator.validateInteger(maxResults)) + { + formToolPI.flagError(UDDIActionInputs.QUERY_INPUT_ADVANCED_BUSINESS_MAX_RESULTS); + messageQueue.addMessage(uddiPerspective.getMessage("MSG_ERROR_INVALID_MAX_RESULTS")); + inputsValid = false; + } + return inputsValid; + } + + private DiscoveryURLs dupDiscoveryURLs(DiscoveryURLs discoveryURLs, String useType, String dupUseType) { + if (discoveryURLs == null) + return discoveryURLs; + Vector discoveryURLVector = discoveryURLs.getDiscoveryURLVector(); + if (discoveryURLVector == null) + return discoveryURLs; + Vector newDiscoveryURLVector = new Vector(discoveryURLVector); + Enumeration e = discoveryURLVector.elements(); + while (e.hasMoreElements()) { + DiscoveryURL discoveryURL = (DiscoveryURL)e.nextElement(); + if (discoveryURL.getUseType().equals(useType)) { + newDiscoveryURLVector.add(new DiscoveryURL(discoveryURL.getText(), dupUseType)); + } + } + DiscoveryURLs newDiscoveryURLs = new DiscoveryURLs(); + newDiscoveryURLs.setDiscoveryURLVector(newDiscoveryURLVector); + return newDiscoveryURLs; + } + + public final boolean run() + { + UDDIPerspective uddiPerspective = controller_.getUDDIPerspective(); + MessageQueue messageQueue = uddiPerspective.getMessageQueue(); + try + { + boolean shouldAddQueryNode = (propertyTable_.get(UDDIActionInputs.QUERY_INPUT_OVERRIDE_ADD_QUERY_NODE) == null); + FindQualifiers findQualifiers = (FindQualifiers)propertyTable_.get(UDDIActionInputs.QUERY_INPUT_ADVANCED_BUSINESS_FINDQUALIFIERS); + Vector nameVector = (Vector)propertyTable_.get(UDDIActionInputs.QUERY_INPUT_ADVANCED_BUSINESS_NAMES); + DiscoveryURLs discoveryURLs = (DiscoveryURLs)propertyTable_.get(UDDIActionInputs.QUERY_INPUT_ADVANCED_BUSINESS_DISCOVERYURLS); + IdentifierBag identifierBag = (IdentifierBag)propertyTable_.get(UDDIActionInputs.QUERY_INPUT_ADVANCED_BUSINESS_IDENTIFIERS); + CategoryBag categoryBag = (CategoryBag)propertyTable_.get(UDDIActionInputs.QUERY_INPUT_ADVANCED_BUSINESS_CATEGORIES); + TModelBag tModelBag = (TModelBag)propertyTable_.get(UDDIActionInputs.QUERY_INPUT_ADVANCED_BUSINESS_TMODELBAG); + boolean owned = (propertyTable_.get(UDDIActionInputs.QUERY_INPUT_ADVANCED_BUSINESS_OWNED) != null); + String publishURL = (String)propertyTable_.get(UDDIActionInputs.QUERY_INPUT_ADVANCED_PUBLISH_URL); + String userId = (String)propertyTable_.get(UDDIActionInputs.QUERY_INPUT_ADVANCED_USERID); + String password = (String)propertyTable_.get(UDDIActionInputs.QUERY_INPUT_ADVANCED_PASSWORD); + int maxSearchSet = Integer.parseInt((String)propertyTable_.get(UDDIActionInputs.QUERY_INPUT_ADVANCED_BUSINESS_MAX_SEARCH_SET)); + int maxResults = Integer.parseInt((String)propertyTable_.get(UDDIActionInputs.QUERY_INPUT_ADVANCED_BUSINESS_MAX_RESULTS)); + + // The action can be run under the context of either a registry or a query node. + RegistryElement regElement = (RegistryElement)regNode_.getTreeElement(); + if (owned && !regElement.isLoggedIn()) + regElement.performLogin(publishURL,userId,password); + + UDDIProxy proxy = regElement.getProxy(); + + BusinessInfos busInfos = null; + if (owned) + busInfos = proxy.get_registeredInfo(regElement.getAuthInfoString()).getBusinessInfos(); + else + busInfos = proxy.find_business(nameVector, dupDiscoveryURLs(discoveryURLs,"",UDDIActionInputs.DISCOVERY_URL_TYPE), identifierBag, categoryBag, tModelBag, findQualifiers, maxSearchSet).getBusinessInfos(); + + int finalNumberOfBusinessEntities = Math.min(maxResults, busInfos.size()); + Vector businessKeys = new Vector(); + for (int i = 0; i < finalNumberOfBusinessEntities; i++) + { + BusinessInfo busInfo = (BusinessInfo)busInfos.get(i); + businessKeys.addElement(busInfo.getBusinessKey()); + } + + if (finalNumberOfBusinessEntities > 0) + { + if (shouldAddQueryNode) + { + Vector beVector = proxy.get_businessDetail(businessKeys).getBusinessEntityVector(); + BusinessEntity[] beList = new BusinessEntity[beVector.size()]; + beVector.toArray(beList); + String queryName = (String)propertyTable_.get(UDDIActionInputs.QUERY_NAME); + queryElement_ = new QueryElement(beList,queryName,regElement.getModel()); + addQueryNode(); + messageQueue.addMessage(uddiPerspective.getMessage("MSG_INFO_BUSINESSES_FOUND",String.valueOf(beList.length))); + } + return true; + } + else + throw new FormInputException(uddiPerspective.getMessage("MSG_ERROR_NO_BUSINESSES_FOUND")); + } + catch (TransportException e) + { + messageQueue.addMessage(controller_.getMessage("MSG_ERROR_UNEXPECTED")); + messageQueue.addMessage("TransportException"); + messageQueue.addMessage(e.getMessage()); + } + catch (UDDIException e) + { + messageQueue.addMessage(controller_.getMessage("MSG_ERROR_UNEXPECTED")); + messageQueue.addMessage("UDDIException"); + messageQueue.addMessage(e.toString()); + } + catch (FormInputException e) + { + messageQueue.addMessage(e.getMessage()); + } + catch (MalformedURLException e) + { + messageQueue.addMessage(controller_.getMessage("MSG_ERROR_UNEXPECTED")); + messageQueue.addMessage("MalformedURLException"); + messageQueue.addMessage(e.getMessage()); + } + return false; + } +} diff --git a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/uddi/actions/RegFindBusinessesSimpleAction.java b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/uddi/actions/RegFindBusinessesSimpleAction.java new file mode 100644 index 000000000..00f285a6c --- /dev/null +++ b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/uddi/actions/RegFindBusinessesSimpleAction.java @@ -0,0 +1,117 @@ +/******************************************************************************* + * Copyright (c) 2001, 2004 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ + +package org.eclipse.wst.ws.internal.explorer.platform.uddi.actions; + +import org.eclipse.wst.ws.internal.explorer.platform.actions.*; +import org.eclipse.wst.ws.internal.explorer.platform.perspective.*; +import org.eclipse.wst.ws.internal.explorer.platform.uddi.constants.*; +import org.eclipse.wst.ws.internal.explorer.platform.uddi.datamodel.*; +import org.eclipse.wst.ws.internal.explorer.platform.uddi.perspective.*; +import org.eclipse.wst.ws.internal.explorer.platform.util.*; + +import org.uddi4j.UDDIException; +import org.uddi4j.client.UDDIProxy; +import org.uddi4j.transport.TransportException; +import org.uddi4j.datatype.business.BusinessEntity; +import org.uddi4j.datatype.*; +import org.uddi4j.response.BusinessInfo; +import org.uddi4j.response.BusinessInfos; + +import java.util.*; + +public class RegFindBusinessesSimpleAction extends FindAction +{ + public RegFindBusinessesSimpleAction(Controller controller) + { + super(controller); + propertyTable_.put(UDDIActionInputs.QUERY_ITEM,String.valueOf(UDDIActionInputs.QUERY_ITEM_BUSINESSES)); + propertyTable_.put(UDDIActionInputs.QUERY_STYLE_BUSINESSES,String.valueOf(UDDIActionInputs.QUERY_STYLE_SIMPLE)); + } + + protected final boolean processOthers(MultipartFormDataParser parser,FormToolPropertiesInterface formToolPI) throws MultipartFormDataException + { + String name = parser.getParameter(UDDIActionInputs.QUERY_INPUT_SIMPLE_BUSINESS_NAME); + + // Validate the data. + boolean inputsValid = true; + + if (name != null) + propertyTable_.put(UDDIActionInputs.QUERY_INPUT_SIMPLE_BUSINESS_NAME,name); + else + { + // This shouldn't occur. + inputsValid = false; + } + return inputsValid; + } + + public final boolean run() + { + UDDIPerspective uddiPerspective = controller_.getUDDIPerspective(); + MessageQueue messageQueue = uddiPerspective.getMessageQueue(); + try + { + boolean shouldAddQueryNode = (propertyTable_.get(UDDIActionInputs.QUERY_INPUT_OVERRIDE_ADD_QUERY_NODE) == null); + String name = (String)propertyTable_.get(UDDIActionInputs.QUERY_INPUT_SIMPLE_BUSINESS_NAME); + Vector nameVector = new Vector(); + nameVector.addElement(new Name(name)); + + // The action can be run under the context of either a registry or a query node. + Node selectedNode = getSelectedNavigatorNode(); + RegistryElement regElement = (RegistryElement)regNode_.getTreeElement(); + UDDIProxy proxy = regElement.getProxy(); + + BusinessInfos busInfos = proxy.find_business(nameVector, null, null, null, null, null, UDDIActionInputs.QUERY_MAX_SEARCH_SET).getBusinessInfos(); + int finalNumberOfBusinessEntities = Math.min(UDDIActionInputs.QUERY_MAX_RESULTS, busInfos.size()); + Vector businessKeys = new Vector(); + for (int i = 0; i < finalNumberOfBusinessEntities; i++) + { + BusinessInfo busInfo = busInfos.get(i); + businessKeys.addElement(busInfo.getBusinessKey()); + } + + if (finalNumberOfBusinessEntities > 0) + { + if (shouldAddQueryNode) + { + Vector beVector = proxy.get_businessDetail(businessKeys).getBusinessEntityVector(); + BusinessEntity[] beList = new BusinessEntity[beVector.size()]; + beVector.toArray(beList); + String queryName = (String)propertyTable_.get(UDDIActionInputs.QUERY_NAME); + queryElement_ = new QueryElement(beList,queryName,regElement.getModel()); + addQueryNode(); + messageQueue.addMessage(uddiPerspective.getMessage("MSG_INFO_BUSINESSES_FOUND",String.valueOf(beList.length))); + } + return true; + } + else + throw new FormInputException(uddiPerspective.getMessage("MSG_ERROR_NO_BUSINESSES_FOUND")); + } + catch (TransportException e) + { + messageQueue.addMessage(controller_.getMessage("MSG_ERROR_UNEXPECTED")); + messageQueue.addMessage("TransportException"); + messageQueue.addMessage(e.getMessage()); + } + catch (UDDIException e) + { + messageQueue.addMessage(controller_.getMessage("MSG_ERROR_UNEXPECTED")); + messageQueue.addMessage("UDDIException"); + messageQueue.addMessage(e.toString()); + } + catch (FormInputException e) + { + messageQueue.addMessage(e.getMessage()); + } + return false; + } +} diff --git a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/uddi/actions/RegFindServiceInterfaceUUIDAction.java b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/uddi/actions/RegFindServiceInterfaceUUIDAction.java new file mode 100644 index 000000000..ead534a14 --- /dev/null +++ b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/uddi/actions/RegFindServiceInterfaceUUIDAction.java @@ -0,0 +1,108 @@ +/******************************************************************************* + * Copyright (c) 2001, 2004 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ + +package org.eclipse.wst.ws.internal.explorer.platform.uddi.actions; + +import org.eclipse.wst.ws.internal.explorer.platform.actions.*; +import org.eclipse.wst.ws.internal.explorer.platform.perspective.*; +import org.eclipse.wst.ws.internal.explorer.platform.uddi.constants.*; +import org.eclipse.wst.ws.internal.explorer.platform.uddi.datamodel.*; +import org.eclipse.wst.ws.internal.explorer.platform.uddi.perspective.*; +import org.eclipse.wst.ws.internal.explorer.platform.util.*; + +import org.uddi4j.client.UDDIProxy; +import org.uddi4j.datatype.tmodel.TModel; +import org.uddi4j.response.*; +import org.uddi4j.transport.TransportException; +import org.uddi4j.UDDIException; + +import java.util.*; + +public class RegFindServiceInterfaceUUIDAction extends FindAction +{ + public RegFindServiceInterfaceUUIDAction(Controller controller) + { + super(controller); + propertyTable_.put(UDDIActionInputs.QUERY_ITEM,String.valueOf(UDDIActionInputs.QUERY_ITEM_SERVICE_INTERFACES)); + propertyTable_.put(UDDIActionInputs.QUERY_STYLE_SERVICE_INTERFACES,String.valueOf(UDDIActionInputs.QUERY_STYLE_UUID)); + } + + protected final boolean processOthers(MultipartFormDataParser parser,FormToolPropertiesInterface formToolPI) throws MultipartFormDataException + { + String uuidKey = parser.getParameter(UDDIActionInputs.QUERY_INPUT_UUID_KEY); + // Validate the data. + boolean inputsValid = true; + UDDIPerspective uddiPerspective = controller_.getUDDIPerspective(); + MessageQueue messageQueue = uddiPerspective.getMessageQueue(); + + if (uuidKey != null) + propertyTable_.put(UDDIActionInputs.QUERY_INPUT_UUID_SERVICE_INTERFACE_KEY,uuidKey); + + if (!subQueryInitiated_ && !Validator.validateString(uuidKey)) + { + inputsValid = false; + formToolPI.flagError(UDDIActionInputs.QUERY_INPUT_UUID_SERVICE_INTERFACE_KEY); + messageQueue.addMessage(uddiPerspective.getMessage("MSG_ERROR_INVALID_UUID_KEY")); + } + return inputsValid; + } + + public final boolean run() + { + UDDIPerspective uddiPerspective = controller_.getUDDIPerspective(); + MessageQueue messageQueue = uddiPerspective.getMessageQueue(); + try + { + boolean shouldAddQueryNode = (propertyTable_.get(UDDIActionInputs.QUERY_INPUT_OVERRIDE_ADD_QUERY_NODE) == null); + String uuidKey = (String)propertyTable_.get(UDDIActionInputs.QUERY_INPUT_UUID_SERVICE_INTERFACE_KEY); + + // The action can be run under the context of either a registry or a query node or even UDDIMainNode. + if (regNode_ == null) + regNode_ = getRegistryNode((Node)propertyTable_.get(UDDIActionInputs.REFRESH_NODE)); + RegistryElement regElement = (RegistryElement)regNode_.getTreeElement(); + UDDIProxy proxy = regElement.getProxy(); + TModelDetail tModelDetail = proxy.get_tModelDetail(uuidKey); + Vector tModelVector = tModelDetail.getTModelVector(); + if (tModelVector.size() > 0) + { + TModel tModel = (TModel)tModelVector.elementAt(0); + if (shouldAddQueryNode) + { + TModel[] tModelArray = new TModel[1]; + tModelArray[0] = tModel; + String queryName = (String)propertyTable_.get(UDDIActionInputs.QUERY_NAME); + queryElement_ = new QueryElement(tModelArray,queryName,regElement.getModel()); + addQueryNode(); + messageQueue.addMessage(uddiPerspective.getMessage("MSG_INFO_SERVICE_INTERFACES_FOUND",String.valueOf(tModelArray.length))); + } + propertyTable_.put(UDDIActionInputs.LATEST_OBJECT,tModel); + return true; + } + else + throw new FormInputException(uddiPerspective.getMessage("MSG_ERROR_NO_SERVICE_INTERFACES_FOUND")); + } + catch (UDDIException e) + { + messageQueue.addMessage(uddiPerspective.getController().getMessage("MSG_ERROR_UNEXPECTED")); + messageQueue.addMessage("UDDIException"); + messageQueue.addMessage(e.toString()); + } + catch (TransportException e) + { + handleUnexpectedException(uddiPerspective,messageQueue,"TransportException",e); + } + catch (FormInputException e) + { + messageQueue.addMessage(e.getMessage()); + } + return false; + } +} diff --git a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/uddi/actions/RegFindServiceInterfacesAdvancedAction.java b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/uddi/actions/RegFindServiceInterfacesAdvancedAction.java new file mode 100644 index 000000000..defaddacb --- /dev/null +++ b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/uddi/actions/RegFindServiceInterfacesAdvancedAction.java @@ -0,0 +1,363 @@ +/******************************************************************************* + * Copyright (c) 2004 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.wst.ws.internal.explorer.platform.uddi.actions; + +import org.eclipse.wst.ws.internal.explorer.platform.actions.*; +import org.eclipse.wst.ws.internal.explorer.platform.datamodel.*; +import org.eclipse.wst.ws.internal.explorer.platform.perspective.*; +import org.eclipse.wst.ws.internal.explorer.platform.uddi.constants.*; +import org.eclipse.wst.ws.internal.explorer.platform.uddi.datamodel.*; +import org.eclipse.wst.ws.internal.explorer.platform.uddi.perspective.*; +import org.eclipse.wst.ws.internal.explorer.platform.util.*; + +import org.uddi4j.client.UDDIProxy; +import org.uddi4j.datatype.binding.*; +import org.uddi4j.datatype.service.*; +import org.uddi4j.datatype.tmodel.*; +import org.uddi4j.response.*; +import org.uddi4j.transport.TransportException; +import org.uddi4j.util.*; +import org.uddi4j.UDDIException; + +import java.util.*; +import java.net.*; + +public class RegFindServiceInterfacesAdvancedAction extends FindAction +{ + public RegFindServiceInterfacesAdvancedAction(Controller controller) + { + super(controller); + propertyTable_.put(UDDIActionInputs.QUERY_ITEM,String.valueOf(UDDIActionInputs.QUERY_ITEM_SERVICE_INTERFACES)); + propertyTable_.put(UDDIActionInputs.QUERY_STYLE_SERVICE_INTERFACES,String.valueOf(UDDIActionInputs.QUERY_STYLE_ADVANCED)); + propertyTable_.put(UDDIActionInputs.QUERY_INPUT_ADVANCED_SERVICE_INTERFACE_MAX_SEARCH_SET,String.valueOf(UDDIActionInputs.QUERY_MAX_SEARCH_SET)); + propertyTable_.put(UDDIActionInputs.QUERY_INPUT_ADVANCED_SERVICE_INTERFACE_MAX_RESULTS,String.valueOf(UDDIActionInputs.QUERY_MAX_RESULTS)); + } + + protected final boolean processOthers(MultipartFormDataParser parser,FormToolPropertiesInterface formToolPI) throws MultipartFormDataException + { + String useServiceChecked = parser.getParameter(UDDIActionInputs.QUERY_INPUT_ADVANCED_SERVICE_INTERFACE_USE_SERVICE); + String[] serviceNodeIds = parser.getParameterValues(UDDIActionInputs.NODEID_SERVICE); + String ownedChecked = parser.getParameter(UDDIActionInputs.QUERY_INPUT_ADVANCED_OWNED); + String name = parser.getParameter(UDDIActionInputs.QUERY_INPUT_ADVANCED_SERVICE_INTERFACE_NAME); + String[] idTypes = parser.getParameterValues(UDDIActionInputs.QUERY_INPUT_ADVANCED_IDENTIFIER_TYPE); + String[] idKeyNames = parser.getParameterValues(UDDIActionInputs.QUERY_INPUT_ADVANCED_IDENTIFIER_KEY_NAME); + String[] idKeyValues = parser.getParameterValues(UDDIActionInputs.QUERY_INPUT_ADVANCED_IDENTIFIER_KEY_VALUE); + String[] catTypes = parser.getParameterValues(UDDIActionInputs.QUERY_INPUT_ADVANCED_CATEGORY_TYPE); + String[] catKeyNames = parser.getParameterValues(UDDIActionInputs.QUERY_INPUT_ADVANCED_CATEGORY_KEY_NAME); + String[] catKeyValues = parser.getParameterValues(UDDIActionInputs.QUERY_INPUT_ADVANCED_CATEGORY_KEY_VALUE); + String[] findQualifierValues = parser.getParameterValues(UDDIActionInputs.QUERY_INPUT_ADVANCED_FINDQUALIFIER); + String maxSearchSet = parser.getParameter(UDDIActionInputs.QUERY_INPUT_ADVANCED_MAX_SEARCH_SET); + String maxResults = parser.getParameter(UDDIActionInputs.QUERY_INPUT_ADVANCED_MAX_RESULTS); + + // Validate the data. + boolean inputsValid = true; + UDDIPerspective uddiPerspective = controller_.getUDDIPerspective(); + MessageQueue messageQueue = uddiPerspective.getMessageQueue(); + RegistryElement regElement = (RegistryElement)regNode_.getTreeElement(); + + if (useServiceChecked != null) + propertyTable_.put(UDDIActionInputs.QUERY_INPUT_ADVANCED_SERVICE_INTERFACE_USE_SERVICE,useServiceChecked); + else + removeProperty(UDDIActionInputs.QUERY_INPUT_ADVANCED_SERVICE_INTERFACE_USE_SERVICE); + + if (serviceNodeIds != null) + { + // Although we already have the "submitted" data, deletions occur on the client side and thus the need to track this using hidden form elements. + Vector siService = (Vector)formToolPI.getProperty(UDDIActionInputs.QUERY_INPUT_ADVANCED_SERVICE_INTERFACE_SERVICE); + if (siService == null) + siService = new Vector(); + else + siService.removeAllElements(); + Vector siServiceCopy = (Vector)formToolPI.getProperty(UDDIActionInputs.QUERY_INPUT_ADVANCED_SERVICE_INTERFACE_SERVICE_COPY); + // The browser will enforce the rule of having only one service in this list. + ListElement listElement = (ListElement)siServiceCopy.elementAt(0); + siService.addElement(listElement); + BusinessService bs = (BusinessService)listElement.getObject(); + propertyTable_.put(UDDIActionInputs.QUERY_INPUT_ADVANCED_SERVICE_INTERFACE_SERVICE,siService); + propertyTable_.put(UDDIActionInputs.QUERY_INPUT_ADVANCED_SERVICE_INTERFACE_BUSINESS_SERVICE,bs); + } + else + { + removeProperty(UDDIActionInputs.QUERY_INPUT_ADVANCED_SERVICE_INTERFACE_SERVICE); + removeProperty(UDDIActionInputs.QUERY_INPUT_ADVANCED_SERVICE_INTERFACE_BUSINESS_SERVICE); + if (!subQueryInitiated_ && useServiceChecked != null) + { + inputsValid = false; + formToolPI.flagError(UDDIActionInputs.QUERY_INPUT_ADVANCED_SERVICE_INTERFACE_SERVICE); + messageQueue.addMessage(uddiPerspective.getMessage("MSG_ERROR_INVALID_SERVICE")); + } + } + + if (ownedChecked != null) + propertyTable_.put(UDDIActionInputs.QUERY_INPUT_ADVANCED_SERVICE_INTERFACE_OWNED,ownedChecked); + else + removeProperty(UDDIActionInputs.QUERY_INPUT_ADVANCED_SERVICE_INTERFACE_OWNED); + + if (name != null) + propertyTable_.put(UDDIActionInputs.QUERY_INPUT_ADVANCED_SERVICE_INTERFACE_NAME,name); + + if (idTypes != null && idKeyNames != null && idKeyValues != null) + { + IdentifierBag idBag = new IdentifierBag(); + for (int i=0;i<idKeyNames.length;i++) + { + KeyedReference kr = new KeyedReference(idKeyNames[i],idKeyValues[i],idTypes[i]); + idBag.add(kr); + } + propertyTable_.put(UDDIActionInputs.QUERY_INPUT_ADVANCED_SERVICE_INTERFACE_IDENTIFIERS,idBag); + } + else + removeProperty(UDDIActionInputs.QUERY_INPUT_ADVANCED_SERVICE_INTERFACE_IDENTIFIERS); + + if (catTypes != null && catKeyNames != null && catKeyValues != null) + { + CategoryBag catBag = new CategoryBag(); + for (int i=0;i<catTypes.length;i++) + { + KeyedReference kr = new KeyedReference(catKeyNames[i],catKeyValues[i],catTypes[i]); + catBag.add(kr); + } + propertyTable_.put(UDDIActionInputs.QUERY_INPUT_ADVANCED_SERVICE_INTERFACE_CATEGORIES,catBag); + } + else + removeProperty(UDDIActionInputs.QUERY_INPUT_ADVANCED_SERVICE_INTERFACE_CATEGORIES); + + if (findQualifierValues != null) + { + FindQualifiers findQualifiers = new FindQualifiers(); + Vector findQualifierVector = new Vector(); + for (int i=0;i<findQualifierValues.length;i++) + { + FindQualifier findQualifier = new FindQualifier(findQualifierValues[i]); + findQualifierVector.addElement(findQualifier); + } + findQualifiers.setFindQualifierVector(findQualifierVector); + propertyTable_.put(UDDIActionInputs.QUERY_INPUT_ADVANCED_SERVICE_INTERFACE_FINDQUALIFIERS,findQualifiers); + } + else + removeProperty(UDDIActionInputs.QUERY_INPUT_ADVANCED_SERVICE_INTERFACE_FINDQUALIFIERS); + + if (maxSearchSet != null) + { + propertyTable_.put(UDDIActionInputs.QUERY_INPUT_ADVANCED_MAX_SEARCH_SET,maxSearchSet); + propertyTable_.put(UDDIActionInputs.QUERY_INPUT_ADVANCED_SERVICE_INTERFACE_MAX_SEARCH_SET,maxSearchSet); + } + if (!subQueryInitiated_ && !Validator.validateInteger(maxSearchSet)) + { + formToolPI.flagError(UDDIActionInputs.QUERY_INPUT_ADVANCED_SERVICE_INTERFACE_MAX_SEARCH_SET); + messageQueue.addMessage(uddiPerspective.getMessage("MSG_ERROR_INVALID_MAX_SEARCH_SET")); + inputsValid = false; + } + + if (maxResults != null) + { + propertyTable_.put(UDDIActionInputs.QUERY_INPUT_ADVANCED_MAX_RESULTS,maxResults); + propertyTable_.put(UDDIActionInputs.QUERY_INPUT_ADVANCED_SERVICE_INTERFACE_MAX_RESULTS,maxResults); + } + if (!subQueryInitiated_ && !Validator.validateInteger(maxResults)) + { + formToolPI.flagError(UDDIActionInputs.QUERY_INPUT_ADVANCED_SERVICE_INTERFACE_MAX_RESULTS); + messageQueue.addMessage(uddiPerspective.getMessage("MSG_ERROR_INVALID_MAX_RESULTS")); + inputsValid = false; + } + return inputsValid; + } + + public final boolean overrideAuthenticationValidation() + { + return (propertyTable_.get(UDDIActionInputs.QUERY_INPUT_ADVANCED_SERVICE_INTERFACE_USE_SERVICE) != null); + } + + public final boolean run() + { + UDDIPerspective uddiPerspective = controller_.getUDDIPerspective(); + MessageQueue messageQueue = uddiPerspective.getMessageQueue(); + try + { + boolean shouldAddQueryNode = (propertyTable_.get(UDDIActionInputs.QUERY_INPUT_OVERRIDE_ADD_QUERY_NODE) == null); + boolean useService = (propertyTable_.get(UDDIActionInputs.QUERY_INPUT_ADVANCED_SERVICE_INTERFACE_USE_SERVICE) != null); + BusinessService bs = (BusinessService)propertyTable_.get(UDDIActionInputs.QUERY_INPUT_ADVANCED_SERVICE_INTERFACE_BUSINESS_SERVICE); + String name = (String)propertyTable_.get(UDDIActionInputs.QUERY_INPUT_ADVANCED_SERVICE_INTERFACE_NAME); + FindQualifiers findQualifiers = (FindQualifiers)propertyTable_.get(UDDIActionInputs.QUERY_INPUT_ADVANCED_SERVICE_INTERFACE_FINDQUALIFIERS); + IdentifierBag identifierBag = (IdentifierBag)propertyTable_.get(UDDIActionInputs.QUERY_INPUT_ADVANCED_SERVICE_INTERFACE_IDENTIFIERS); + CategoryBag categoryBag = (CategoryBag)propertyTable_.get(UDDIActionInputs.QUERY_INPUT_ADVANCED_SERVICE_INTERFACE_CATEGORIES); + boolean owned = (propertyTable_.get(UDDIActionInputs.QUERY_INPUT_ADVANCED_SERVICE_INTERFACE_OWNED) != null); + String publishURL = (String)propertyTable_.get(UDDIActionInputs.QUERY_INPUT_ADVANCED_PUBLISH_URL); + String userId = (String)propertyTable_.get(UDDIActionInputs.QUERY_INPUT_ADVANCED_USERID); + String password = (String)propertyTable_.get(UDDIActionInputs.QUERY_INPUT_ADVANCED_PASSWORD); + int maxSearchSet = Integer.parseInt((String)propertyTable_.get(UDDIActionInputs.QUERY_INPUT_ADVANCED_SERVICE_INTERFACE_MAX_SEARCH_SET)); + int maxResults = Integer.parseInt((String)propertyTable_.get(UDDIActionInputs.QUERY_INPUT_ADVANCED_SERVICE_INTERFACE_MAX_RESULTS)); + + // The action can be run under the context of either a registry or a query node. + RegistryElement regElement = (RegistryElement)regNode_.getTreeElement(); + UDDIProxy proxy = regElement.getProxy(); + Vector tModelKeyVector = new Vector(); + + if (owned) + { + if (!regElement.isLoggedIn()) + regElement.performLogin(publishURL,userId,password); + tModelKeyVector = findAllOwnedTModels(proxy, regElement.getAuthInfoString(), maxResults); + } + if (useService) + { + BindingTemplates bindingTemplates = bs.getBindingTemplates(); + boolean endSearch = false; + if (bindingTemplates != null) + { + for (int i=0;i<bindingTemplates.size();i++) + { + BindingTemplate bt = bindingTemplates.get(i); + TModelInstanceDetails tModelInstanceDetails = bt.getTModelInstanceDetails(); + for (int j=0;j<tModelInstanceDetails.size();j++) + { + TModelInstanceInfo tModelInstanceInfo = tModelInstanceDetails.get(j); + if (tModelKeyVector.size() < maxResults) + tModelKeyVector.addElement(tModelInstanceInfo.getTModelKey()); + else + { + endSearch = true; + break; + } + } + if (endSearch) + break; + } + } + } + else + { + TModelList tModelList = proxy.find_tModel(name,categoryBag,identifierBag,findQualifiers,maxSearchSet); + TModelInfos tModelInfos = tModelList.getTModelInfos(); + for (int i=0;i<tModelInfos.size();i++) + { + TModelInfo tModelInfo = tModelInfos.get(i); + if (tModelKeyVector.size() < maxResults) + tModelKeyVector.addElement(tModelInfo.getTModelKey()); + else + break; + } + } + + int finalNumberOfTModelKeys = tModelKeyVector.size(); + if (finalNumberOfTModelKeys > 0) + { + if (shouldAddQueryNode) + { + Vector finalTModelVector = new Vector(); + int currentIndex = 0; + int windowSize = finalNumberOfTModelKeys; + while (currentIndex < tModelKeyVector.size()) + { + int subListToIndex = Math.min(currentIndex+windowSize,tModelKeyVector.size()); + try + { + TModelDetail tModelDetail = proxy.get_tModelDetail(new Vector(tModelKeyVector.subList(currentIndex,subListToIndex))); + Vector tModelVector = tModelDetail.getTModelVector(); + for (int i=0;i<tModelVector.size();i++) + finalTModelVector.addElement(tModelVector.elementAt(i)); + if (tModelDetail.getTruncatedBoolean()) + windowSize = tModelVector.size(); + currentIndex += windowSize; + } + catch (UDDIException e) + { + DispositionReport dr = e.getDispositionReport(); + if (((Result) dr.getResultVector().get(0)).getErrInfo().getErrCode() == DispositionReport.E_invalidKeyPassed) + { + String errInfoText = ((Result) dr.getResultVector().get(0)).getErrInfo().getText(); + for (int i=currentIndex;i<subListToIndex;i++) + { + String tModelKey = (String)tModelKeyVector.elementAt(i); + if (errInfoText.indexOf(tModelKey) != -1 || errInfoText.indexOf(tModelKey.toUpperCase()) != -1 || errInfoText.indexOf(tModelKey.toLowerCase()) != -1) + { + tModelKeyVector.removeElementAt(i); + break; + } + } + } + else + throw e; + } + catch (TransportException e) + { + throw e; + } + } + + int finalNumberOfTModels = finalTModelVector.size(); + if (finalNumberOfTModels > 0) + { + TModel[] tModelArray = new TModel[finalNumberOfTModels]; + finalTModelVector.toArray(tModelArray); + String queryName = (String)propertyTable_.get(UDDIActionInputs.QUERY_NAME); + queryElement_ = new QueryElement(tModelArray,queryName,regElement.getModel()); + addQueryNode(); + messageQueue.addMessage(uddiPerspective.getMessage("MSG_INFO_SERVICE_INTERFACES_FOUND",String.valueOf(tModelArray.length))); + } + else + throw new FormInputException(uddiPerspective.getMessage("MSG_ERROR_NO_SERVICE_INTERFACES_FOUND")); + } + return true; + } + else + throw new FormInputException(uddiPerspective.getMessage("MSG_ERROR_NO_SERVICE_INTERFACES_FOUND")); + } + catch (UDDIException e) + { + messageQueue.addMessage(uddiPerspective.getController().getMessage("MSG_ERROR_UNEXPECTED")); + messageQueue.addMessage("UDDIException"); + messageQueue.addMessage(e.toString()); + } + catch (TransportException e) + { + handleUnexpectedException(uddiPerspective,messageQueue,"TransportException",e); + } + catch (MalformedURLException e) + { + handleUnexpectedException(uddiPerspective,messageQueue,"MalformedURLException",e); + } + catch (FormInputException e) + { + messageQueue.addMessage(e.getMessage()); + } + return false; + } + + // Copied directly from UDDIWSDLProxy's findAllServiceInterfaces() method with minor modifications. The hardcoded strings should NOT be translated. + private final Vector findAllOwnedTModels(UDDIProxy proxy, String authInfoString, int maxResults) throws UDDIException, TransportException + { + RegisteredInfo registeredInfo = null; + + // Get the complete list of owned (registered) info. + // (A RegisteredInfo consists of BusinessInfos and TModelInfos. + // BusinessInfos also contain ServiceInfos.) + registeredInfo = proxy.get_registeredInfo(authInfoString); + + //Create a Vector to add the TModelKeys from the registeredInfo. + Vector tModelKeyList = new Vector(); + + //Get the TModelInfos from the registeredInfo. + TModelInfos tModelInfos = registeredInfo.getTModelInfos(); + + //Get all the TModelKeys from within the TModelInfos + boolean endSearch = false; + for (int i = 0; i < tModelInfos.size(); i++) + { + TModelInfo tModelInfo = tModelInfos.get(i); + if (tModelKeyList.size() < maxResults) + tModelKeyList.addElement(tModelInfo.getTModelKey()); + else + break; + } + return tModelKeyList; + } +} diff --git a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/uddi/actions/RegFindServiceInterfacesSimpleAction.java b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/uddi/actions/RegFindServiceInterfacesSimpleAction.java new file mode 100644 index 000000000..6cc3c1e87 --- /dev/null +++ b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/uddi/actions/RegFindServiceInterfacesSimpleAction.java @@ -0,0 +1,114 @@ +/******************************************************************************* + * Copyright (c) 2001, 2004 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ + +package org.eclipse.wst.ws.internal.explorer.platform.uddi.actions; + +import org.eclipse.wst.ws.internal.explorer.platform.actions.*; +import org.eclipse.wst.ws.internal.explorer.platform.perspective.*; +import org.eclipse.wst.ws.internal.explorer.platform.uddi.constants.*; +import org.eclipse.wst.ws.internal.explorer.platform.uddi.datamodel.*; +import org.eclipse.wst.ws.internal.explorer.platform.uddi.perspective.*; +import org.eclipse.wst.ws.internal.explorer.platform.util.*; + +import org.uddi4j.client.UDDIProxy; +import org.uddi4j.datatype.tmodel.TModel; +import org.uddi4j.response.*; +import org.uddi4j.transport.TransportException; +import org.uddi4j.UDDIException; + +import java.util.*; + +public class RegFindServiceInterfacesSimpleAction extends FindAction +{ + public RegFindServiceInterfacesSimpleAction(Controller controller) + { + super(controller); + propertyTable_.put(UDDIActionInputs.QUERY_ITEM,String.valueOf(UDDIActionInputs.QUERY_ITEM_SERVICE_INTERFACES)); + propertyTable_.put(UDDIActionInputs.QUERY_STYLE_SERVICE_INTERFACES,String.valueOf(UDDIActionInputs.QUERY_STYLE_SIMPLE)); + } + + protected final boolean processOthers(MultipartFormDataParser parser,FormToolPropertiesInterface formToolPI) throws MultipartFormDataException + { + String name = parser.getParameter(UDDIActionInputs.QUERY_INPUT_SIMPLE_SERVICE_INTERFACE_NAME); + + // Validate the data. + boolean inputsValid = true; + UDDIPerspective uddiPerspective = controller_.getUDDIPerspective(); + MessageQueue messageQueue = uddiPerspective.getMessageQueue(); + if (name != null) + propertyTable_.put(UDDIActionInputs.QUERY_INPUT_SIMPLE_SERVICE_INTERFACE_NAME,name); + else + { + // This should never occur. + inputsValid = false; + } + return inputsValid; + } + + public final boolean run() + { + UDDIPerspective uddiPerspective = controller_.getUDDIPerspective(); + MessageQueue messageQueue = uddiPerspective.getMessageQueue(); + try + { + boolean shouldAddQueryNode = (propertyTable_.get(UDDIActionInputs.QUERY_INPUT_OVERRIDE_ADD_QUERY_NODE) == null); + String name = (String)propertyTable_.get(UDDIActionInputs.QUERY_INPUT_SIMPLE_SERVICE_INTERFACE_NAME); + // The action can be run under the context of either a registry or a query node. + RegistryElement regElement = (RegistryElement)regNode_.getTreeElement(); + UDDIProxy proxy = regElement.getProxy(); + TModelList tModelList = proxy.find_tModel(name,null,null,null,UDDIActionInputs.QUERY_MAX_SEARCH_SET); + TModelInfos tModelInfos = tModelList.getTModelInfos(); + Vector tModelKeyVector = new Vector(); + + for (int i=0;i<tModelInfos.size();i++) + { + TModelInfo tModelInfo = tModelInfos.get(i); + if (tModelKeyVector.size() < UDDIActionInputs.QUERY_MAX_RESULTS) + tModelKeyVector.addElement(tModelInfo.getTModelKey()); + else + break; + } + + if (tModelKeyVector.size() > 0) + { + if (shouldAddQueryNode) + { + TModelDetail tModelDetail = proxy.get_tModelDetail(tModelKeyVector); + Vector tModelVector = tModelDetail.getTModelVector(); + TModel[] tModelArray = new TModel[tModelVector.size()]; + tModelVector.toArray(tModelArray); + String queryName = (String)propertyTable_.get(UDDIActionInputs.QUERY_NAME); + queryElement_ = new QueryElement(tModelArray,queryName,regElement.getModel()); + addQueryNode(); + messageQueue.addMessage(uddiPerspective.getMessage("MSG_INFO_SERVICE_INTERFACES_FOUND",String.valueOf(tModelArray.length))); + } + return true; + } + else + throw new FormInputException(uddiPerspective.getMessage("MSG_ERROR_NO_SERVICE_INTERFACES_FOUND")); + } + catch (UDDIException e) + { + messageQueue.addMessage(uddiPerspective.getController().getMessage("MSG_ERROR_UNEXPECTED")); + messageQueue.addMessage("UDDIException"); + messageQueue.addMessage(e.toString()); + } + catch (TransportException e) + { + handleUnexpectedException(uddiPerspective,messageQueue,"TransportException",e); + } + catch (FormInputException e) + { + messageQueue.addMessage(e.getMessage()); + } + return false; + } +} diff --git a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/uddi/actions/RegFindServiceUUIDAction.java b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/uddi/actions/RegFindServiceUUIDAction.java new file mode 100644 index 000000000..207e86876 --- /dev/null +++ b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/uddi/actions/RegFindServiceUUIDAction.java @@ -0,0 +1,108 @@ +/******************************************************************************* + * Copyright (c) 2001, 2004 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ + +package org.eclipse.wst.ws.internal.explorer.platform.uddi.actions; + +import org.eclipse.wst.ws.internal.explorer.platform.actions.*; +import org.eclipse.wst.ws.internal.explorer.platform.perspective.*; +import org.eclipse.wst.ws.internal.explorer.platform.uddi.constants.*; +import org.eclipse.wst.ws.internal.explorer.platform.uddi.datamodel.*; +import org.eclipse.wst.ws.internal.explorer.platform.uddi.perspective.*; +import org.eclipse.wst.ws.internal.explorer.platform.util.*; + +import org.uddi4j.client.UDDIProxy; +import org.uddi4j.datatype.service.BusinessService; +import org.uddi4j.response.*; +import org.uddi4j.transport.TransportException; +import org.uddi4j.UDDIException; + +import java.util.*; + +public class RegFindServiceUUIDAction extends FindAction +{ + public RegFindServiceUUIDAction(Controller controller) + { + super(controller); + propertyTable_.put(UDDIActionInputs.QUERY_ITEM,String.valueOf(UDDIActionInputs.QUERY_ITEM_SERVICES)); + propertyTable_.put(UDDIActionInputs.QUERY_STYLE_SERVICES,String.valueOf(UDDIActionInputs.QUERY_STYLE_UUID)); + } + + protected final boolean processOthers(MultipartFormDataParser parser,FormToolPropertiesInterface formToolPI) throws MultipartFormDataException + { + String uuidKey = parser.getParameter(UDDIActionInputs.QUERY_INPUT_UUID_KEY); + + // Validate the data. + boolean inputsValid = true; + UDDIPerspective uddiPerspective = controller_.getUDDIPerspective(); + MessageQueue messageQueue = uddiPerspective.getMessageQueue(); + + if (uuidKey != null) + propertyTable_.put(UDDIActionInputs.QUERY_INPUT_UUID_SERVICE_KEY,uuidKey); + + if (!subQueryInitiated_ && !Validator.validateString(uuidKey)) + { + inputsValid = false; + formToolPI.flagError(UDDIActionInputs.QUERY_INPUT_UUID_SERVICE_KEY); + messageQueue.addMessage(uddiPerspective.getMessage("MSG_ERROR_INVALID_UUID_KEY")); + } + return inputsValid; + } + + public final boolean run() + { + UDDIPerspective uddiPerspective = controller_.getUDDIPerspective(); + MessageQueue messageQueue = uddiPerspective.getMessageQueue(); + try + { + boolean shouldAddQueryNode = (propertyTable_.get(UDDIActionInputs.QUERY_INPUT_OVERRIDE_ADD_QUERY_NODE) == null); + String uuidKey = (String)propertyTable_.get(UDDIActionInputs.QUERY_INPUT_UUID_SERVICE_KEY); + + // The action can be run under the context of either a registry or a query node or even UDDIMainNode. + if (regNode_ == null) + regNode_ = getRegistryNode((Node)propertyTable_.get(UDDIActionInputs.REFRESH_NODE)); + RegistryElement regElement = (RegistryElement)regNode_.getTreeElement(); + UDDIProxy proxy = regElement.getProxy(); + BusinessService[] bsArray = new BusinessService[1]; + ServiceDetail serviceDetail = proxy.get_serviceDetail(uuidKey); + Vector bsVector = serviceDetail.getBusinessServiceVector(); + if (bsVector.size() > 0) + { + bsVector.toArray(bsArray); + if (shouldAddQueryNode) + { + String queryName = (String)propertyTable_.get(UDDIActionInputs.QUERY_NAME); + queryElement_ = new QueryElement(bsArray,queryName,regElement.getModel()); + addQueryNode(); + messageQueue.addMessage(uddiPerspective.getMessage("MSG_INFO_SERVICES_FOUND",String.valueOf(bsArray.length))); + } + propertyTable_.put(UDDIActionInputs.LATEST_OBJECT,bsArray[0]); + return true; + } + else + throw new FormInputException(uddiPerspective.getMessage("MSG_ERROR_NO_SERVICES_FOUND")); + } + catch (UDDIException e) + { + messageQueue.addMessage(uddiPerspective.getController().getMessage("MSG_ERROR_UNEXPECTED")); + messageQueue.addMessage("UDDIException"); + messageQueue.addMessage(e.toString()); + } + catch (TransportException e) + { + handleUnexpectedException(uddiPerspective,messageQueue,"TransportException",e); + } + catch (FormInputException e) + { + messageQueue.addMessage(e.getMessage()); + } + return false; + } +} diff --git a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/uddi/actions/RegFindServicesAdvancedAction.java b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/uddi/actions/RegFindServicesAdvancedAction.java new file mode 100644 index 000000000..08d064c57 --- /dev/null +++ b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/uddi/actions/RegFindServicesAdvancedAction.java @@ -0,0 +1,376 @@ +/******************************************************************************* + * Copyright (c) 2004 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.wst.ws.internal.explorer.platform.uddi.actions; + +import org.eclipse.wst.ws.internal.explorer.platform.actions.*; +import org.eclipse.wst.ws.internal.explorer.platform.datamodel.*; +import org.eclipse.wst.ws.internal.explorer.platform.perspective.*; +import org.eclipse.wst.ws.internal.explorer.platform.uddi.constants.*; +import org.eclipse.wst.ws.internal.explorer.platform.uddi.datamodel.*; +import org.eclipse.wst.ws.internal.explorer.platform.uddi.perspective.*; +import org.eclipse.wst.ws.internal.explorer.platform.util.*; + +import org.uddi4j.client.UDDIProxy; +import org.uddi4j.datatype.business.BusinessEntity; +import org.uddi4j.datatype.service.BusinessService; +import org.uddi4j.datatype.tmodel.TModel; +import org.uddi4j.response.*; +import org.uddi4j.transport.TransportException; +import org.uddi4j.datatype.*; +import org.uddi4j.util.*; +import org.uddi4j.UDDIException; + +import java.util.*; +import java.net.*; + +public class RegFindServicesAdvancedAction extends FindAction +{ + public RegFindServicesAdvancedAction(Controller controller) + { + super(controller); + propertyTable_.put(UDDIActionInputs.QUERY_ITEM,String.valueOf(UDDIActionInputs.QUERY_ITEM_SERVICES)); + propertyTable_.put(UDDIActionInputs.QUERY_STYLE_SERVICES,String.valueOf(UDDIActionInputs.QUERY_STYLE_ADVANCED)); + propertyTable_.put(UDDIActionInputs.QUERY_INPUT_ADVANCED_SERVICE_MAX_SEARCH_SET,String.valueOf(UDDIActionInputs.QUERY_MAX_SEARCH_SET)); + propertyTable_.put(UDDIActionInputs.QUERY_INPUT_ADVANCED_SERVICE_MAX_RESULTS,String.valueOf(UDDIActionInputs.QUERY_MAX_RESULTS)); + } + + protected final boolean processOthers(MultipartFormDataParser parser,FormToolPropertiesInterface formToolPI) throws MultipartFormDataException + { + String ownedChecked = parser.getParameter(UDDIActionInputs.QUERY_INPUT_ADVANCED_OWNED); + String[] busNodeIds = parser.getParameterValues(UDDIActionInputs.NODEID_BUSINESS); + String[] languages = parser.getParameterValues(UDDIActionInputs.QUERY_INPUT_ADVANCED_NAME_LANGUAGE); + String[] names = parser.getParameterValues(UDDIActionInputs.QUERY_INPUT_ADVANCED_NAME); + String[] catTypes = parser.getParameterValues(UDDIActionInputs.QUERY_INPUT_ADVANCED_CATEGORY_TYPE); + String[] catKeyNames = parser.getParameterValues(UDDIActionInputs.QUERY_INPUT_ADVANCED_CATEGORY_KEY_NAME); + String[] catKeyValues = parser.getParameterValues(UDDIActionInputs.QUERY_INPUT_ADVANCED_CATEGORY_KEY_VALUE); + String[] siNodeIds = parser.getParameterValues(UDDIActionInputs.NODEID_SERVICE_INTERFACE); + String[] findQualifierValues = parser.getParameterValues(UDDIActionInputs.QUERY_INPUT_ADVANCED_FINDQUALIFIER); + String maxSearchSet = parser.getParameter(UDDIActionInputs.QUERY_INPUT_ADVANCED_MAX_SEARCH_SET); + String maxResults = parser.getParameter(UDDIActionInputs.QUERY_INPUT_ADVANCED_MAX_RESULTS); + + // Validate the data. + boolean inputsValid = true; + UDDIPerspective uddiPerspective = controller_.getUDDIPerspective(); + MessageQueue messageQueue = uddiPerspective.getMessageQueue(); + RegistryElement regElement = (RegistryElement)regNode_.getTreeElement(); + + if (ownedChecked != null) + propertyTable_.put(UDDIActionInputs.QUERY_INPUT_ADVANCED_SERVICE_OWNED,ownedChecked); + else + removeProperty(UDDIActionInputs.QUERY_INPUT_ADVANCED_SERVICE_OWNED); + + if (busNodeIds != null) + { + // Although we already have the "submitted" data, deletions occur on the client side and thus the need to track this using hidden form elements. + Vector serviceBusiness = (Vector)formToolPI.getProperty(UDDIActionInputs.QUERY_INPUT_ADVANCED_SERVICE_BUSINESS); + if (serviceBusiness == null) + serviceBusiness = new Vector(); + else + serviceBusiness.removeAllElements(); + Vector serviceBusinessCopy = (Vector)formToolPI.getProperty(UDDIActionInputs.QUERY_INPUT_ADVANCED_SERVICE_BUSINESS_COPY); + // The browser will enforce the rule of having only one business in this list. + ListElement listElement = (ListElement)serviceBusinessCopy.elementAt(0); + serviceBusiness.addElement(listElement); + BusinessEntity sp = (BusinessEntity)listElement.getObject(); + propertyTable_.put(UDDIActionInputs.QUERY_INPUT_ADVANCED_SERVICE_BUSINESS,serviceBusiness); + propertyTable_.put(UDDIActionInputs.QUERY_INPUT_ADVANCED_SERVICE_SERVICE_PROVIDER,sp); + } + else + { + removeProperty(UDDIActionInputs.QUERY_INPUT_ADVANCED_SERVICE_BUSINESS); + removeProperty(UDDIActionInputs.QUERY_INPUT_ADVANCED_SERVICE_SERVICE_PROVIDER); + } + + if (languages != null && names != null) + { + Vector nameVector = new Vector(); + for (int i=0;i<names.length;i++) + { + Name uddi4jName; + if (languages[i].length() > 0) + uddi4jName = new Name(names[i],languages[i]); + else + uddi4jName = new Name(names[i]); + nameVector.addElement(uddi4jName); + } + propertyTable_.put(UDDIActionInputs.QUERY_INPUT_ADVANCED_SERVICE_NAMES,nameVector); + } + else + removeProperty(UDDIActionInputs.QUERY_INPUT_ADVANCED_SERVICE_NAMES); + + if (catTypes != null && catKeyNames != null && catKeyValues != null) + { + CategoryBag catBag = new CategoryBag(); + for (int i=0;i<catTypes.length;i++) + { + KeyedReference kr = new KeyedReference(catKeyNames[i],catKeyValues[i],catTypes[i]); + catBag.add(kr); + } + propertyTable_.put(UDDIActionInputs.QUERY_INPUT_ADVANCED_SERVICE_CATEGORIES,catBag); + } + else + removeProperty(UDDIActionInputs.QUERY_INPUT_ADVANCED_SERVICE_CATEGORIES); + + if (siNodeIds != null) + { + // Although we already have the "submitted" data, deletions occur on the client side and thus the need to track this using hidden form elements. + Vector serviceServiceInterfaces = (Vector)formToolPI.getProperty(UDDIActionInputs.QUERY_INPUT_ADVANCED_SERVICE_SERVICE_INTERFACES); + if (serviceServiceInterfaces == null) + serviceServiceInterfaces = new Vector(); + else + serviceServiceInterfaces.removeAllElements(); + Vector serviceServiceInterfacesCopy = (Vector)formToolPI.getProperty(UDDIActionInputs.QUERY_INPUT_ADVANCED_SERVICE_SERVICE_INTERFACES_COPY); + Vector tModelKeyStringVector = new Vector(); + Hashtable resultHash = new Hashtable(); + for (int i=0;i<siNodeIds.length;i++) + resultHash.put(siNodeIds[i],Boolean.TRUE); + for (int i=0;i<serviceServiceInterfacesCopy.size();i++) + { + ListElement listElement = (ListElement)serviceServiceInterfacesCopy.elementAt(i); + if (resultHash.get(String.valueOf(listElement.getTargetNodeId())) != null) + { + serviceServiceInterfaces.addElement(listElement); + TModel tModel = (TModel)listElement.getObject(); + tModelKeyStringVector.addElement(tModel.getTModelKey()); + } + } + TModelBag tModelBag = new TModelBag(tModelKeyStringVector); + propertyTable_.put(UDDIActionInputs.QUERY_INPUT_ADVANCED_SERVICE_SERVICE_INTERFACES,serviceServiceInterfaces); + propertyTable_.put(UDDIActionInputs.QUERY_INPUT_ADVANCED_SERVICE_TMODELBAG,tModelBag); + } + else + { + removeProperty(UDDIActionInputs.QUERY_INPUT_ADVANCED_SERVICE_SERVICE_INTERFACES); + removeProperty(UDDIActionInputs.QUERY_INPUT_ADVANCED_SERVICE_TMODELBAG); + } + + if (findQualifierValues != null) + { + FindQualifiers findQualifiers = new FindQualifiers(); + Vector findQualifierVector = new Vector(); + for (int i=0;i<findQualifierValues.length;i++) + { + FindQualifier findQualifier = new FindQualifier(findQualifierValues[i]); + findQualifierVector.addElement(findQualifier); + } + findQualifiers.setFindQualifierVector(findQualifierVector); + propertyTable_.put(UDDIActionInputs.QUERY_INPUT_ADVANCED_SERVICE_FINDQUALIFIERS,findQualifiers); + } + else + removeProperty(UDDIActionInputs.QUERY_INPUT_ADVANCED_SERVICE_FINDQUALIFIERS); + + if (maxSearchSet != null) + { + propertyTable_.put(UDDIActionInputs.QUERY_INPUT_ADVANCED_MAX_SEARCH_SET,maxSearchSet); + propertyTable_.put(UDDIActionInputs.QUERY_INPUT_ADVANCED_SERVICE_MAX_SEARCH_SET,maxSearchSet); + } + if (!subQueryInitiated_ && !Validator.validateInteger(maxSearchSet)) + { + formToolPI.flagError(UDDIActionInputs.QUERY_INPUT_ADVANCED_SERVICE_MAX_SEARCH_SET); + messageQueue.addMessage(uddiPerspective.getMessage("MSG_ERROR_INVALID_MAX_SEARCH_SET")); + inputsValid = false; + } + + if (maxResults != null) + { + propertyTable_.put(UDDIActionInputs.QUERY_INPUT_ADVANCED_MAX_RESULTS,maxResults); + propertyTable_.put(UDDIActionInputs.QUERY_INPUT_ADVANCED_SERVICE_MAX_RESULTS,maxResults); + } + if (!subQueryInitiated_ && !Validator.validateInteger(maxResults)) + { + formToolPI.flagError(UDDIActionInputs.QUERY_INPUT_ADVANCED_SERVICE_MAX_RESULTS); + messageQueue.addMessage(uddiPerspective.getMessage("MSG_ERROR_INVALID_MAX_RESULTS")); + inputsValid = false; + } + return inputsValid; + } + + public final boolean run() + { + UDDIPerspective uddiPerspective = controller_.getUDDIPerspective(); + MessageQueue messageQueue = uddiPerspective.getMessageQueue(); + try + { + boolean shouldAddQueryNode = (propertyTable_.get(UDDIActionInputs.QUERY_INPUT_OVERRIDE_ADD_QUERY_NODE) == null); + FindQualifiers findQualifiers = (FindQualifiers)propertyTable_.get(UDDIActionInputs.QUERY_INPUT_ADVANCED_SERVICE_FINDQUALIFIERS); + BusinessEntity sp = (BusinessEntity)propertyTable_.get(UDDIActionInputs.QUERY_INPUT_ADVANCED_SERVICE_SERVICE_PROVIDER); + Vector nameVector = (Vector)propertyTable_.get(UDDIActionInputs.QUERY_INPUT_ADVANCED_SERVICE_NAMES); + CategoryBag categoryBag = (CategoryBag)propertyTable_.get(UDDIActionInputs.QUERY_INPUT_ADVANCED_SERVICE_CATEGORIES); + TModelBag tModelBag = (TModelBag)propertyTable_.get(UDDIActionInputs.QUERY_INPUT_ADVANCED_SERVICE_TMODELBAG); + boolean owned = (propertyTable_.get(UDDIActionInputs.QUERY_INPUT_ADVANCED_SERVICE_OWNED) != null); + String publishURL = (String)propertyTable_.get(UDDIActionInputs.QUERY_INPUT_ADVANCED_PUBLISH_URL); + String userId = (String)propertyTable_.get(UDDIActionInputs.QUERY_INPUT_ADVANCED_USERID); + String password = (String)propertyTable_.get(UDDIActionInputs.QUERY_INPUT_ADVANCED_PASSWORD); + int maxSearchSet = Integer.parseInt((String)propertyTable_.get(UDDIActionInputs.QUERY_INPUT_ADVANCED_SERVICE_MAX_SEARCH_SET)); + int maxResults = Integer.parseInt((String)propertyTable_.get(UDDIActionInputs.QUERY_INPUT_ADVANCED_SERVICE_MAX_RESULTS)); + + // The action can be run under the context of either a registry or a query node. + RegistryElement regElement = (RegistryElement)regNode_.getTreeElement(); + if (owned && !regElement.isLoggedIn()) + regElement.performLogin(publishURL,userId,password); + + UDDIProxy proxy = regElement.getProxy(); + String businessKey; + if (sp != null) + businessKey = sp.getBusinessKey(); + else + businessKey = ""; + + int finalNumberOfServiceKeys; + Vector serviceKeyVector; + if (owned) + { + serviceKeyVector = findAllOwnedServices(proxy,regElement.getAuthInfoString(),businessKey,maxResults); + finalNumberOfServiceKeys = serviceKeyVector.size(); + } + else + { + ServiceList serviceList = proxy.find_service(businessKey,nameVector,categoryBag,tModelBag,findQualifiers,maxSearchSet); + ServiceInfos sInfos = serviceList.getServiceInfos(); + finalNumberOfServiceKeys = Math.min(maxResults,sInfos.size()); + serviceKeyVector = new Vector(); + for (int i=0;i<finalNumberOfServiceKeys;i++) + { + ServiceInfo sInfo = sInfos.get(i); + serviceKeyVector.addElement(sInfo.getServiceKey()); + } + } + + if (finalNumberOfServiceKeys > 0) + { + if (shouldAddQueryNode) + { + Vector finalBusServiceVector = new Vector(); + int currentIndex = 0; + int windowSize = finalNumberOfServiceKeys; + while (currentIndex < serviceKeyVector.size()) + { + int subListToIndex = Math.min(currentIndex+windowSize,serviceKeyVector.size()); + try + { + ServiceDetail serviceDetail = proxy.get_serviceDetail(new Vector(serviceKeyVector.subList(currentIndex,subListToIndex))); + Vector busServiceVector = serviceDetail.getBusinessServiceVector(); + for (int i=0;i<busServiceVector.size();i++) + finalBusServiceVector.addElement(busServiceVector.elementAt(i)); + if (serviceDetail.getTruncatedBoolean()) + windowSize = busServiceVector.size(); + currentIndex += windowSize; + } + catch (UDDIException e) + { + DispositionReport dr = e.getDispositionReport(); + if (((Result) dr.getResultVector().get(0)).getErrInfo().getErrCode() == DispositionReport.E_invalidKeyPassed) + { + String errInfoText = ((Result) dr.getResultVector().get(0)).getErrInfo().getText(); + for (int i=currentIndex;i<subListToIndex;i++) + { + String serviceKey = (String)serviceKeyVector.elementAt(i); + if (errInfoText.indexOf(serviceKey) != -1 || errInfoText.indexOf(serviceKey.toUpperCase()) != -1 || errInfoText.indexOf(serviceKey.toLowerCase()) != -1) + { + serviceKeyVector.removeElementAt(i); + break; + } + } + } + else + throw e; + } + catch (TransportException e) + { + throw e; + } + } + + int finalNumberOfBusinessServices = finalBusServiceVector.size(); + if (finalNumberOfBusinessServices > 0) + { + BusinessService[] bsArray = new BusinessService[finalNumberOfBusinessServices]; + finalBusServiceVector.toArray(bsArray); + String queryName = (String)propertyTable_.get(UDDIActionInputs.QUERY_NAME); + queryElement_ = new QueryElement(bsArray,queryName,regElement.getModel()); + addQueryNode(); + messageQueue.addMessage(uddiPerspective.getMessage("MSG_INFO_SERVICES_FOUND",String.valueOf(bsArray.length))); + } + else + throw new FormInputException(uddiPerspective.getMessage("MSG_ERROR_NO_SERVICES_FOUND")); + } + return true; + } + else + throw new FormInputException(uddiPerspective.getMessage("MSG_ERROR_NO_SERVICES_FOUND")); + } + catch (UDDIException e) + { + messageQueue.addMessage(uddiPerspective.getController().getMessage("MSG_ERROR_UNEXPECTED")); + messageQueue.addMessage("UDDIException"); + messageQueue.addMessage(e.toString()); + } + catch (TransportException e) + { + handleUnexpectedException(uddiPerspective,messageQueue,"TransportException",e); + } + catch (FormInputException e) + { + messageQueue.addMessage(e.getMessage()); + } + catch (MalformedURLException e) + { + handleUnexpectedException(uddiPerspective,messageQueue,"MalformedURLException",e); + } + return false; + } + + // Copied directly from UDDIWSDLProxy's findAllOwnedServices() method with minor modifications. The hardcoded strings should NOT be translated. + private final Vector findAllOwnedServices(UDDIProxy proxy,String authInfoString,String businessKey,int maxResults) throws UDDIException, TransportException + { + RegisteredInfo registeredInfo = null; + + // Get the complete list of owned (registered) info. + // (A RegisteredInfo consists of BusinessInfos and TModelInfos. + // BusinessInfos also contain ServiceInfos.) + registeredInfo = proxy.get_registeredInfo(authInfoString); + + //Create a vector to add the serviceKeys from the registeredInfo to. + Vector serviceKeyList = new Vector(); + + //Get the businessInfos from the registeredInfo. + BusinessInfos businessInfos = registeredInfo.getBusinessInfos(); + + //Get all the serviceKeys from the serviceInfos within the businessInfos, + //and add them to the serviceKeyList. + boolean endSearch = false; + for (int i = 0; i < businessInfos.size(); i++) + { + BusinessInfo businessInfo = businessInfos.get(i); + String currentBusinessKey = businessInfo.getBusinessKey(); + if (businessKey.length() > 0 && currentBusinessKey.equals(businessKey)) + endSearch = true; + ServiceInfos serviceInfos = businessInfo.getServiceInfos(); + for (int j = 0; j < serviceInfos.size(); j++) + { + ServiceInfo serviceInfo = serviceInfos.get(j); + if (serviceInfo.getBusinessKey().equals(currentBusinessKey)) + { + if (serviceKeyList.size() < maxResults) + serviceKeyList.add(serviceInfo.getServiceKey()); + else + { + endSearch = true; + break; + } + } + } + if (endSearch) + break; + } + return serviceKeyList; + } +} diff --git a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/uddi/actions/RegFindServicesSimpleAction.java b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/uddi/actions/RegFindServicesSimpleAction.java new file mode 100644 index 000000000..05618e42a --- /dev/null +++ b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/uddi/actions/RegFindServicesSimpleAction.java @@ -0,0 +1,116 @@ +/******************************************************************************* + * Copyright (c) 2001, 2004 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ + +package org.eclipse.wst.ws.internal.explorer.platform.uddi.actions; + +import org.eclipse.wst.ws.internal.explorer.platform.actions.*; +import org.eclipse.wst.ws.internal.explorer.platform.perspective.*; +import org.eclipse.wst.ws.internal.explorer.platform.uddi.constants.*; +import org.eclipse.wst.ws.internal.explorer.platform.uddi.datamodel.*; +import org.eclipse.wst.ws.internal.explorer.platform.uddi.perspective.*; +import org.eclipse.wst.ws.internal.explorer.platform.util.*; + +import org.uddi4j.client.UDDIProxy; +import org.uddi4j.datatype.service.BusinessService; +import org.uddi4j.datatype.*; +import org.uddi4j.response.*; +import org.uddi4j.transport.TransportException; +import org.uddi4j.UDDIException; + +import java.util.*; + +public class RegFindServicesSimpleAction extends FindAction +{ + public RegFindServicesSimpleAction(Controller controller) + { + super(controller); + propertyTable_.put(UDDIActionInputs.QUERY_ITEM,String.valueOf(UDDIActionInputs.QUERY_ITEM_SERVICES)); + propertyTable_.put(UDDIActionInputs.QUERY_STYLE_SERVICES,String.valueOf(UDDIActionInputs.QUERY_STYLE_SIMPLE)); + } + + protected final boolean processOthers(MultipartFormDataParser parser,FormToolPropertiesInterface formToolPI) throws MultipartFormDataException + { + String name = parser.getParameter(UDDIActionInputs.QUERY_INPUT_SIMPLE_SERVICE_NAME); + + // Validate the data. + boolean inputsValid = true; + + if (name != null) + propertyTable_.put(UDDIActionInputs.QUERY_INPUT_SIMPLE_SERVICE_NAME,name); + else + { + // This shouldn't occur. + inputsValid = false; + } + return inputsValid; + } + + public final boolean run() + { + UDDIPerspective uddiPerspective = controller_.getUDDIPerspective(); + MessageQueue messageQueue = uddiPerspective.getMessageQueue(); + try + { + boolean shouldAddQueryNode = (propertyTable_.get(UDDIActionInputs.QUERY_INPUT_OVERRIDE_ADD_QUERY_NODE) == null); + String name = (String)propertyTable_.get(UDDIActionInputs.QUERY_INPUT_SIMPLE_SERVICE_NAME); + Vector nameVector = new Vector(); + nameVector.addElement(new Name(name)); + + // The action can be run under the context of either a registry or a query node. + Node selectedNode = getSelectedNavigatorNode(); + RegistryElement regElement = (RegistryElement)regNode_.getTreeElement(); + UDDIProxy proxy = regElement.getProxy(); + ServiceList serviceList = proxy.find_service("",nameVector,null,null,null,UDDIActionInputs.QUERY_MAX_SEARCH_SET); + + ServiceInfos sInfos = serviceList.getServiceInfos(); + int finalNumberOfBusinessServices = Math.min(UDDIActionInputs.QUERY_MAX_RESULTS,sInfos.size()); + Vector serviceKeyVector = new Vector(); + for (int i=0;i<finalNumberOfBusinessServices;i++) + { + ServiceInfo sInfo = sInfos.get(i); + serviceKeyVector.addElement(sInfo.getServiceKey()); + } + + if (finalNumberOfBusinessServices > 0) + { + if (shouldAddQueryNode) + { + ServiceDetail serviceDetail = proxy.get_serviceDetail(serviceKeyVector); + Vector businessServiceVector = serviceDetail.getBusinessServiceVector(); + String queryName = (String)propertyTable_.get(UDDIActionInputs.QUERY_NAME); + BusinessService[] bsArray = new BusinessService[finalNumberOfBusinessServices]; + businessServiceVector.toArray(bsArray); + queryElement_ = new QueryElement(bsArray,queryName,regElement.getModel()); + addQueryNode(); + messageQueue.addMessage(uddiPerspective.getMessage("MSG_INFO_SERVICES_FOUND",String.valueOf(bsArray.length))); + } + return true; + } + else + throw new FormInputException(uddiPerspective.getMessage("MSG_ERROR_NO_SERVICES_FOUND")); + } + catch (UDDIException e) + { + messageQueue.addMessage(uddiPerspective.getController().getMessage("MSG_ERROR_UNEXPECTED")); + messageQueue.addMessage("UDDIException"); + messageQueue.addMessage(e.toString()); + } + catch (TransportException e) + { + handleUnexpectedException(uddiPerspective,messageQueue,"TransportException",e); + } + catch (FormInputException e) + { + messageQueue.addMessage(e.getMessage()); + } + return false; + } +} diff --git a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/uddi/actions/RegPublishBusinessAdvancedAction.java b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/uddi/actions/RegPublishBusinessAdvancedAction.java new file mode 100644 index 000000000..001fbad7e --- /dev/null +++ b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/uddi/actions/RegPublishBusinessAdvancedAction.java @@ -0,0 +1,265 @@ +/******************************************************************************* + * Copyright (c) 2001, 2004 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ + +package org.eclipse.wst.ws.internal.explorer.platform.uddi.actions; + +import org.eclipse.wst.ws.internal.explorer.platform.perspective.*; +import org.eclipse.wst.ws.internal.explorer.platform.uddi.constants.*; +import org.eclipse.wst.ws.internal.explorer.platform.uddi.datamodel.*; +import org.eclipse.wst.ws.internal.explorer.platform.uddi.perspective.*; +import org.eclipse.wst.ws.internal.explorer.platform.util.*; + +import org.uddi4j.UDDIException; +import org.uddi4j.client.UDDIProxy; +import org.uddi4j.transport.TransportException; +import org.uddi4j.datatype.business.BusinessEntity; +import org.uddi4j.datatype.*; +import org.uddi4j.util.IdentifierBag; +import org.uddi4j.util.CategoryBag; +import org.uddi4j.util.DiscoveryURLs; +import org.uddi4j.util.DiscoveryURL; +import org.uddi4j.util.KeyedReference; + +import java.util.*; +import java.net.*; + +public class RegPublishBusinessAdvancedAction extends PublishAction +{ + public RegPublishBusinessAdvancedAction(Controller controller) + { + super(controller); + propertyTable_.put(UDDIActionInputs.QUERY_ITEM,String.valueOf(UDDIActionInputs.QUERY_ITEM_BUSINESSES)); + propertyTable_.put(UDDIActionInputs.QUERY_STYLE_BUSINESSES,String.valueOf(UDDIActionInputs.QUERY_STYLE_ADVANCED)); + } + + protected final boolean processOthers(MultipartFormDataParser parser,FormToolPropertiesInterface formToolPI) throws MultipartFormDataException + { + String[] nameLanguages = parser.getParameterValues(UDDIActionInputs.QUERY_INPUT_ADVANCED_NAME_LANGUAGE); + String[] names = parser.getParameterValues(UDDIActionInputs.QUERY_INPUT_ADVANCED_NAME); + String[] descriptionLanguages = parser.getParameterValues(UDDIActionInputs.QUERY_INPUT_ADVANCED_DESCRIPTION_LANGUAGE); + String[] descriptions = parser.getParameterValues(UDDIActionInputs.QUERY_INPUT_ADVANCED_DESCRIPTION); + String[] idTypes = parser.getParameterValues(UDDIActionInputs.QUERY_INPUT_ADVANCED_IDENTIFIER_TYPE); + String[] idKeyNames = parser.getParameterValues(UDDIActionInputs.QUERY_INPUT_ADVANCED_IDENTIFIER_KEY_NAME); + String[] idKeyValues = parser.getParameterValues(UDDIActionInputs.QUERY_INPUT_ADVANCED_IDENTIFIER_KEY_VALUE); + String[] catTypes = parser.getParameterValues(UDDIActionInputs.QUERY_INPUT_ADVANCED_CATEGORY_TYPE); + String[] catKeyNames = parser.getParameterValues(UDDIActionInputs.QUERY_INPUT_ADVANCED_CATEGORY_KEY_NAME); + String[] catKeyValues = parser.getParameterValues(UDDIActionInputs.QUERY_INPUT_ADVANCED_CATEGORY_KEY_VALUE); + String[] discoveryURLValues = parser.getParameterValues(UDDIActionInputs.QUERY_INPUT_ADVANCED_DISCOVERYURL); + + // Validate the data. + boolean inputsValid = true; + UDDIPerspective uddiPerspective = controller_.getUDDIPerspective(); + MessageQueue messageQueue = uddiPerspective.getMessageQueue(); + + Hashtable languageHash = new Hashtable(); + if (nameLanguages != null && names != null) + { + Vector nameVector = new Vector(); + // UDDI's save API (Appendix C of the UDDI V2 Programmers API Specification) requires the following: + // 1) Only the first row can have a blank language. + // 2) Only 1 name per language. + String[] parameters = new String[2]; + parameters[0] = uddiPerspective.getMessage("FORM_LABEL_NAME"); + for (int i=0;i<names.length;i++) + { + parameters[1] = String.valueOf(i+1); + Name uddi4jName; + if (nameLanguages[i].length() > 0) + uddi4jName = new Name(names[i],nameLanguages[i]); + else + { + uddi4jName = new Name(names[i]); + if (i != 0 && !subQueryInitiated_) + { + inputsValid = false; + formToolPI.flagRowError(UDDIActionInputs.QUERY_INPUT_ADVANCED_BUSINESS_NAMES,i); + messageQueue.addMessage(uddiPerspective.getMessage("MSG_ERROR_ROW_BLANK_LANGUAGE",parameters)); + } + } + if (languageHash.get(nameLanguages[i]) != null) + { + inputsValid = false; + formToolPI.flagRowError(UDDIActionInputs.QUERY_INPUT_ADVANCED_BUSINESS_NAMES,i); + messageQueue.addMessage(uddiPerspective.getMessage("MSG_ERROR_ROW_DUPLICATE_LANGUAGE",parameters)); + } + else + languageHash.put(nameLanguages[i],Boolean.TRUE); + if (names[i].trim().length() < 1) + { + inputsValid = false; + formToolPI.flagRowError(UDDIActionInputs.QUERY_INPUT_ADVANCED_BUSINESS_NAMES,i); + messageQueue.addMessage(uddiPerspective.getMessage("MSG_ERROR_ROW_INVALID_TEXT",parameters)); + } + nameVector.addElement(uddi4jName); + } + propertyTable_.put(UDDIActionInputs.QUERY_INPUT_ADVANCED_BUSINESS_NAMES,nameVector); + } + else + { + removeProperty(UDDIActionInputs.QUERY_INPUT_ADVANCED_BUSINESS_NAMES); + if (!subQueryInitiated_) + { + inputsValid = false; + formToolPI.flagError(UDDIActionInputs.QUERY_INPUT_ADVANCED_BUSINESS_NAMES); + messageQueue.addMessage(uddiPerspective.getMessage("MSG_ERROR_NO_NAMES")); + } + } + + if (descriptionLanguages != null && descriptions != null) + { + Vector descriptionVector = new Vector(); + String[] parameters = new String[2]; + parameters[0] = uddiPerspective.getMessage("FORM_LABEL_DESCRIPTION"); + languageHash.clear(); + for (int i=0;i<descriptions.length;i++) + { + parameters[1] = String.valueOf(i+1); + Description uddi4jDescription; + if (descriptionLanguages[i].length() > 0) + uddi4jDescription = new Description(descriptions[i],descriptionLanguages[i]); + else + { + uddi4jDescription = new Description(descriptions[i]); + if (i != 0 && !subQueryInitiated_) + { + inputsValid = false; + formToolPI.flagRowError(UDDIActionInputs.QUERY_INPUT_ADVANCED_BUSINESS_DESCRIPTIONS,i); + messageQueue.addMessage(uddiPerspective.getMessage("MSG_ERROR_ROW_BLANK_LANGUAGE",parameters)); + } + } + if (languageHash.get(descriptionLanguages[i]) != null) + { + inputsValid = false; + formToolPI.flagRowError(UDDIActionInputs.QUERY_INPUT_ADVANCED_BUSINESS_DESCRIPTIONS,i); + messageQueue.addMessage(uddiPerspective.getMessage("MSG_ERROR_ROW_DUPLICATE_LANGUAGE",parameters)); + } + else + languageHash.put(descriptionLanguages[i],Boolean.TRUE); + if (descriptions[i].trim().length() < 1) + { + inputsValid = false; + formToolPI.flagRowError(UDDIActionInputs.QUERY_INPUT_ADVANCED_BUSINESS_DESCRIPTIONS,i); + messageQueue.addMessage(uddiPerspective.getMessage("MSG_ERROR_ROW_INVALID_TEXT",parameters)); + } + descriptionVector.addElement(uddi4jDescription); + } + propertyTable_.put(UDDIActionInputs.QUERY_INPUT_ADVANCED_BUSINESS_DESCRIPTIONS,descriptionVector); + } + else + removeProperty(UDDIActionInputs.QUERY_INPUT_ADVANCED_BUSINESS_DESCRIPTIONS); + + if (idTypes != null && idKeyNames != null && idKeyValues != null) + { + IdentifierBag idBag = new IdentifierBag(); + for (int i=0;i<idKeyNames.length;i++) + { + KeyedReference kr = new KeyedReference(idKeyNames[i],idKeyValues[i],idTypes[i]); + idBag.add(kr); + } + propertyTable_.put(UDDIActionInputs.QUERY_INPUT_ADVANCED_BUSINESS_IDENTIFIERS,idBag); + } + else + removeProperty(UDDIActionInputs.QUERY_INPUT_ADVANCED_BUSINESS_IDENTIFIERS); + + if (catTypes != null && catKeyNames != null && catKeyValues != null) + { + CategoryBag catBag = new CategoryBag(); + for (int i=0;i<catTypes.length;i++) + { + KeyedReference kr = new KeyedReference(catKeyNames[i],catKeyValues[i],catTypes[i]); + catBag.add(kr); + } + propertyTable_.put(UDDIActionInputs.QUERY_INPUT_ADVANCED_BUSINESS_CATEGORIES,catBag); + } + else + removeProperty(UDDIActionInputs.QUERY_INPUT_ADVANCED_BUSINESS_CATEGORIES); + + if (discoveryURLValues != null) + { + DiscoveryURLs discoveryURLs = new DiscoveryURLs(); + String[] parameters = new String[2]; + parameters[0] = uddiPerspective.getMessage("FORM_LABEL_DISCOVERYURL"); + for (int i=0;i<discoveryURLValues.length;i++) + { + parameters[1] = String.valueOf(i+1); + if (!subQueryInitiated_ && !Validator.validateURL(discoveryURLValues[i])) + { + inputsValid = false; + formToolPI.flagRowError(UDDIActionInputs.QUERY_INPUT_ADVANCED_BUSINESS_DISCOVERYURLS,i); + messageQueue.addMessage(uddiPerspective.getMessage("MSG_ERROR_ROW_INVALID_TEXT",parameters)); + } + discoveryURLs.add(new DiscoveryURL(discoveryURLValues[i],"")); + } + propertyTable_.put(UDDIActionInputs.QUERY_INPUT_ADVANCED_BUSINESS_DISCOVERYURLS,discoveryURLs); + } + else + removeProperty(UDDIActionInputs.QUERY_INPUT_ADVANCED_BUSINESS_DISCOVERYURLS); + + return inputsValid; + } + + public final boolean run() + { + UDDIPerspective uddiPerspective = controller_.getUDDIPerspective(); + MessageQueue messageQueue = uddiPerspective.getMessageQueue(); + try + { + String publishURL = (String)propertyTable_.get(UDDIActionInputs.QUERY_INPUT_ADVANCED_PUBLISH_URL); + String userId = (String)propertyTable_.get(UDDIActionInputs.QUERY_INPUT_ADVANCED_USERID); + String password = (String)propertyTable_.get(UDDIActionInputs.QUERY_INPUT_ADVANCED_PASSWORD); + Vector nameVector = (Vector)propertyTable_.get(UDDIActionInputs.QUERY_INPUT_ADVANCED_BUSINESS_NAMES); + Vector descriptionVector = (Vector)propertyTable_.get(UDDIActionInputs.QUERY_INPUT_ADVANCED_BUSINESS_DESCRIPTIONS); + IdentifierBag identifierBag = (IdentifierBag)propertyTable_.get(UDDIActionInputs.QUERY_INPUT_ADVANCED_BUSINESS_IDENTIFIERS); + CategoryBag categoryBag = (CategoryBag)propertyTable_.get(UDDIActionInputs.QUERY_INPUT_ADVANCED_BUSINESS_CATEGORIES); + DiscoveryURLs discoveryURLs = (DiscoveryURLs)propertyTable_.get(UDDIActionInputs.QUERY_INPUT_ADVANCED_BUSINESS_DISCOVERYURLS); + + // The action can be run under the context of either a registry or a query node. + RegistryElement regElement = (RegistryElement)regNode_.getTreeElement(); + if (!regElement.isLoggedIn()) + regElement.performLogin(publishURL,userId,password); + UDDIProxy proxy = regElement.getProxy(); + + BusinessEntity be = new BusinessEntity(); + be.setBusinessKey(""); + be.setNameVector(nameVector); + be.setDescriptionVector(descriptionVector); + be.setIdentifierBag(identifierBag); + be.setCategoryBag(categoryBag); + be.setDiscoveryURLs(discoveryURLs); + Vector beVector = new Vector(); + beVector.add(be); + + be = (BusinessEntity)proxy.save_business(regElement.getAuthInfoString(), beVector).getBusinessEntityVector().get(0); + addPublishedItemNode(be,regElement); + messageQueue.addMessage(uddiPerspective.getMessage("MSG_INFO_BUSINESS_PUBLISHED",be.getDefaultNameString())); + return true; + } + catch (TransportException e) + { + messageQueue.addMessage(controller_.getMessage("MSG_ERROR_UNEXPECTED")); + messageQueue.addMessage("TransportException"); + messageQueue.addMessage(e.getMessage()); + } + catch (UDDIException e) + { + messageQueue.addMessage(controller_.getMessage("MSG_ERROR_UNEXPECTED")); + messageQueue.addMessage("UDDIException"); + messageQueue.addMessage(e.toString()); + } + catch (MalformedURLException e) + { + messageQueue.addMessage(controller_.getMessage("MSG_ERROR_UNEXPECTED")); + messageQueue.addMessage("MalformedURLException"); + messageQueue.addMessage(e.getMessage()); + } + return false; + } +} diff --git a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/uddi/actions/RegPublishBusinessSimpleAction.java b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/uddi/actions/RegPublishBusinessSimpleAction.java new file mode 100644 index 000000000..10ee7ef74 --- /dev/null +++ b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/uddi/actions/RegPublishBusinessSimpleAction.java @@ -0,0 +1,111 @@ +/******************************************************************************* + * Copyright (c) 2001, 2004 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ + +package org.eclipse.wst.ws.internal.explorer.platform.uddi.actions; + +import org.eclipse.wst.ws.internal.explorer.platform.perspective.*; +import org.eclipse.wst.ws.internal.explorer.platform.uddi.constants.*; +import org.eclipse.wst.ws.internal.explorer.platform.uddi.datamodel.*; +import org.eclipse.wst.ws.internal.explorer.platform.uddi.perspective.*; +import org.eclipse.wst.ws.internal.explorer.platform.util.*; + +import org.uddi4j.UDDIException; +import org.uddi4j.client.UDDIProxy; +import org.uddi4j.transport.TransportException; +import org.uddi4j.datatype.business.BusinessEntity; +import org.uddi4j.datatype.*; + +import java.util.*; +import java.net.*; + +public class RegPublishBusinessSimpleAction extends PublishAction +{ + public RegPublishBusinessSimpleAction(Controller controller) + { + super(controller); + propertyTable_.put(UDDIActionInputs.QUERY_ITEM,String.valueOf(UDDIActionInputs.QUERY_ITEM_BUSINESSES)); + propertyTable_.put(UDDIActionInputs.QUERY_STYLE_BUSINESSES,String.valueOf(UDDIActionInputs.QUERY_STYLE_SIMPLE)); + } + + protected boolean processOthers(MultipartFormDataParser parser,FormToolPropertiesInterface formToolPI) throws MultipartFormDataException + { + String name = parser.getParameter(UDDIActionInputs.QUERY_INPUT_SIMPLE_BUSINESS_NAME); + String description = parser.getParameter(UDDIActionInputs.QUERY_INPUT_SIMPLE_BUSINESS_DESCRIPTION); + + boolean inputsValid = true; + UDDIPerspective uddiPerspective = controller_.getUDDIPerspective(); + MessageQueue messageQueue = uddiPerspective.getMessageQueue(); + + if (name != null) + propertyTable_.put(UDDIActionInputs.QUERY_INPUT_SIMPLE_BUSINESS_NAME,name); + + if (!subQueryInitiated_ && !Validator.validateString(name)) + { + inputsValid = false; + formToolPI.flagError(UDDIActionInputs.QUERY_INPUT_SIMPLE_BUSINESS_NAME); + messageQueue.addMessage(uddiPerspective.getMessage("MSG_ERROR_INVALID_NAME")); + } + + if (description != null) + propertyTable_.put(UDDIActionInputs.QUERY_INPUT_SIMPLE_BUSINESS_DESCRIPTION,description); + + return inputsValid; + } + + public final boolean run() + { + String publishURL = (String)propertyTable_.get(UDDIActionInputs.QUERY_INPUT_ADVANCED_PUBLISH_URL); + String userId = (String)propertyTable_.get(UDDIActionInputs.QUERY_INPUT_ADVANCED_USERID); + String password = (String)propertyTable_.get(UDDIActionInputs.QUERY_INPUT_ADVANCED_PASSWORD); + String name = (String)propertyTable_.get(UDDIActionInputs.QUERY_INPUT_SIMPLE_BUSINESS_NAME); + String description = (String)propertyTable_.get(UDDIActionInputs.QUERY_INPUT_SIMPLE_BUSINESS_DESCRIPTION); + UDDIPerspective uddiPerspective = controller_.getUDDIPerspective(); + MessageQueue messageQueue = uddiPerspective.getMessageQueue(); + RegistryElement regElement = (RegistryElement)regNode_.getTreeElement(); + try + { + UDDIProxy proxy = regElement.getProxy(); + if (!regElement.isLoggedIn()) + regElement.performLogin(publishURL,userId,password); + + BusinessEntity be = new BusinessEntity(); + be.setBusinessKey(""); + be.setDefaultName(new Name(name)); + be.setDefaultDescriptionString(description); + Vector beVector = new Vector(); + beVector.add(be); + + be = (BusinessEntity)proxy.save_business(regElement.getAuthInfoString(), beVector).getBusinessEntityVector().get(0); + addPublishedItemNode(be,regElement); + messageQueue.addMessage(uddiPerspective.getMessage("MSG_INFO_BUSINESS_PUBLISHED",be.getDefaultNameString())); + return true; + } + catch (TransportException e) + { + messageQueue.addMessage(controller_.getMessage("MSG_ERROR_UNEXPECTED")); + messageQueue.addMessage("TransportException"); + messageQueue.addMessage(e.getMessage()); + } + catch (UDDIException e) + { + messageQueue.addMessage(controller_.getMessage("MSG_ERROR_UNEXPECTED")); + messageQueue.addMessage("UDDIException"); + messageQueue.addMessage(e.toString()); + } + catch (MalformedURLException e) + { + messageQueue.addMessage(controller_.getMessage("MSG_ERROR_UNEXPECTED")); + messageQueue.addMessage("MalformedURLException"); + messageQueue.addMessage(e.getMessage()); + } + return false; + } +} diff --git a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/uddi/actions/RegPublishServiceAdvancedAction.java b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/uddi/actions/RegPublishServiceAdvancedAction.java new file mode 100644 index 000000000..d9a3ca50a --- /dev/null +++ b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/uddi/actions/RegPublishServiceAdvancedAction.java @@ -0,0 +1,363 @@ +/******************************************************************************* + * Copyright (c) 2004 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.wst.ws.internal.explorer.platform.uddi.actions; + +import org.eclipse.wst.ws.internal.explorer.platform.constants.*; +import org.eclipse.wst.ws.internal.explorer.platform.datamodel.*; +import org.eclipse.wst.ws.internal.explorer.platform.perspective.*; +import org.eclipse.wst.ws.internal.explorer.platform.uddi.constants.*; +import org.eclipse.wst.ws.internal.explorer.platform.uddi.datamodel.*; +import org.eclipse.wst.ws.internal.explorer.platform.uddi.perspective.*; +import org.eclipse.wst.ws.internal.explorer.platform.uddi.util.Uddi4jHelper; +import org.eclipse.wst.ws.internal.explorer.platform.util.*; + +import org.uddi4j.UDDIException; +import org.uddi4j.client.UDDIProxy; +import org.uddi4j.transport.TransportException; +import org.uddi4j.datatype.business.BusinessEntity; +import org.uddi4j.datatype.service.BusinessService; +import org.uddi4j.datatype.tmodel.TModel; +import org.uddi4j.datatype.*; +import org.uddi4j.util.*; + +import javax.wsdl.Definition; +import javax.wsdl.WSDLException; +import java.util.*; +import java.net.*; + +public class RegPublishServiceAdvancedAction extends PublishAction +{ + public RegPublishServiceAdvancedAction(Controller controller) + { + super(controller); + propertyTable_.put(UDDIActionInputs.QUERY_ITEM,String.valueOf(UDDIActionInputs.QUERY_ITEM_SERVICES)); + propertyTable_.put(UDDIActionInputs.QUERY_STYLE_SERVICES,String.valueOf(UDDIActionInputs.QUERY_STYLE_ADVANCED)); + } + + protected final boolean processOthers(MultipartFormDataParser parser,FormToolPropertiesInterface formToolPI) throws MultipartFormDataException + { + String busNodeIds = parser.getParameter(UDDIActionInputs.NODEID_BUSINESS); + String[] serIntIds = parser.getParameterValues(UDDIActionInputs.NODEID_SERVICE_INTERFACE); + String wsdlURL = parser.getParameter(ActionInputs.QUERY_INPUT_WSDL_URL); + String[] nameLanguages = parser.getParameterValues(UDDIActionInputs.QUERY_INPUT_ADVANCED_NAME_LANGUAGE); + String[] names = parser.getParameterValues(UDDIActionInputs.QUERY_INPUT_ADVANCED_NAME); + String[] descriptionLanguages = parser.getParameterValues(UDDIActionInputs.QUERY_INPUT_ADVANCED_DESCRIPTION_LANGUAGE); + String[] descriptions = parser.getParameterValues(UDDIActionInputs.QUERY_INPUT_ADVANCED_DESCRIPTION); + String[] catTypes = parser.getParameterValues(UDDIActionInputs.QUERY_INPUT_ADVANCED_CATEGORY_TYPE); + String[] catKeyNames = parser.getParameterValues(UDDIActionInputs.QUERY_INPUT_ADVANCED_CATEGORY_KEY_NAME); + String[] catKeyValues = parser.getParameterValues(UDDIActionInputs.QUERY_INPUT_ADVANCED_CATEGORY_KEY_VALUE); + + // Validate the data. + boolean inputsValid = true; + UDDIPerspective uddiPerspective = controller_.getUDDIPerspective(); + MessageQueue messageQueue = uddiPerspective.getMessageQueue(); + + if (busNodeIds != null) + { + Vector serviceBusiness = (Vector)formToolPI.getProperty(UDDIActionInputs.QUERY_INPUT_ADVANCED_SERVICE_BUSINESS); + if (serviceBusiness == null) + serviceBusiness = new Vector(); + else + serviceBusiness.removeAllElements(); + Vector serviceBusinessCopy = (Vector)formToolPI.getProperty(UDDIActionInputs.QUERY_INPUT_ADVANCED_SERVICE_BUSINESS_COPY); + // The browser will enforce the rule of having only one business in this list. + ListElement listElement = (ListElement)serviceBusinessCopy.elementAt(0); + serviceBusiness.addElement(listElement); + BusinessEntity sp = (BusinessEntity)listElement.getObject(); + propertyTable_.put(UDDIActionInputs.QUERY_INPUT_ADVANCED_SERVICE_BUSINESS,serviceBusiness); + propertyTable_.put(UDDIActionInputs.QUERY_INPUT_ADVANCED_SERVICE_SERVICE_PROVIDER,sp); + propertyTable_.put(UDDIActionInputs.QUERY_INPUT_UUID_BUSINESS_KEY,sp.getBusinessKey()); + } + else + { + removeProperty(UDDIActionInputs.QUERY_INPUT_ADVANCED_SERVICE_BUSINESS); + removeProperty(UDDIActionInputs.QUERY_INPUT_ADVANCED_SERVICE_SERVICE_PROVIDER); + if (!subQueryInitiated_) + { + inputsValid = false; + formToolPI.flagError(UDDIActionInputs.QUERY_INPUT_ADVANCED_SERVICE_BUSINESS); + messageQueue.addMessage(uddiPerspective.getMessage("MSG_ERROR_INVALID_BUSINESS")); + } + } + + if (serIntIds != null && serIntIds.length > 0) + { + Vector serviceInterfaces = (Vector)formToolPI.getProperty(UDDIActionInputs.QUERY_INPUT_ADVANCED_SERVICE_SERVICE_INTERFACES); + if (serviceInterfaces == null) + serviceInterfaces = new Vector(); + else + serviceInterfaces.removeAllElements(); + Vector serviceInterfacesCopy = (Vector)formToolPI.getProperty(UDDIActionInputs.QUERY_INPUT_ADVANCED_SERVICE_SERVICE_INTERFACES_COPY); + Vector tmodels = new Vector(); + for (Iterator it = serviceInterfacesCopy.iterator(); it.hasNext();) + { + ListElement listElement = (ListElement)it.next(); + int targetNodeId = listElement.getTargetNodeId(); + for (int i = 0; i < serIntIds.length; i++) + { + try + { + if (targetNodeId == Integer.parseInt(serIntIds[i])) + { + serviceInterfaces.add(listElement); + tmodels.add(listElement.getObject()); + break; + } + } + catch (NumberFormatException nfe) + { + } + } + } + propertyTable_.put(UDDIActionInputs.QUERY_INPUT_ADVANCED_SERVICE_SERVICE_INTERFACES, serviceInterfaces); + propertyTable_.put(UDDIActionInputs.QUERY_INPUT_ADVANCED_SERVICE_TMODEL, tmodels); + } + else + { + removeProperty(UDDIActionInputs.QUERY_INPUT_ADVANCED_SERVICE_SERVICE_INTERFACES); + removeProperty(UDDIActionInputs.QUERY_INPUT_ADVANCED_SERVICE_TMODEL); + } + + if (wsdlURL != null) + { + propertyTable_.put(ActionInputs.QUERY_INPUT_WSDL_URL,wsdlURL); + propertyTable_.put(UDDIActionInputs.QUERY_INPUT_ADVANCED_SERVICE_WSDL_URL,wsdlURL); + } + + if (!subQueryInitiated_ && !Validator.validateString(wsdlURL)) + { + inputsValid = false; + formToolPI.flagError(UDDIActionInputs.QUERY_INPUT_ADVANCED_SERVICE_WSDL_URL); + messageQueue.addMessage(uddiPerspective.getMessage("MSG_ERROR_INVALID_WSDL_URL")); + } + + Hashtable languageHash = new Hashtable(); + if (nameLanguages != null && names != null) + { + Vector nameVector = new Vector(); + // UDDI's save API (Appendix C of the UDDI V2 Programmers API Specification) requires the following: + // 1) Only the first row can have a blank language. + // 2) Only 1 name per language. + String[] parameters = new String[2]; + parameters[0] = uddiPerspective.getMessage("FORM_LABEL_NAME"); + for (int i=0;i<names.length;i++) + { + parameters[1] = String.valueOf(i+1); + Name uddi4jName; + if (nameLanguages[i].length() > 0) + uddi4jName = new Name(names[i],nameLanguages[i]); + else + { + uddi4jName = new Name(names[i]); + if (i != 0 && !subQueryInitiated_) + { + inputsValid = false; + formToolPI.flagRowError(UDDIActionInputs.QUERY_INPUT_ADVANCED_SERVICE_NAMES,i); + messageQueue.addMessage(uddiPerspective.getMessage("MSG_ERROR_ROW_BLANK_LANGUAGE",parameters)); + } + } + if (languageHash.get(nameLanguages[i]) != null) + { + inputsValid = false; + formToolPI.flagRowError(UDDIActionInputs.QUERY_INPUT_ADVANCED_SERVICE_NAMES,i); + messageQueue.addMessage(uddiPerspective.getMessage("MSG_ERROR_ROW_DUPLICATE_LANGUAGE",parameters)); + } + else + languageHash.put(nameLanguages[i],Boolean.TRUE); + if (names[i].trim().length() < 1) + { + inputsValid = false; + formToolPI.flagRowError(UDDIActionInputs.QUERY_INPUT_ADVANCED_SERVICE_NAMES,i); + messageQueue.addMessage(uddiPerspective.getMessage("MSG_ERROR_ROW_INVALID_TEXT",parameters)); + } + nameVector.addElement(uddi4jName); + } + propertyTable_.put(UDDIActionInputs.QUERY_INPUT_ADVANCED_SERVICE_NAMES,nameVector); + } + else + { + removeProperty(UDDIActionInputs.QUERY_INPUT_ADVANCED_SERVICE_NAMES); + if (!subQueryInitiated_) + { + inputsValid = false; + formToolPI.flagError(UDDIActionInputs.QUERY_INPUT_ADVANCED_SERVICE_NAMES); + messageQueue.addMessage(uddiPerspective.getMessage("MSG_ERROR_NO_NAMES")); + } + } + + if (descriptionLanguages != null && descriptions != null) + { + Vector descriptionVector = new Vector(); + String[] parameters = new String[2]; + parameters[0] = uddiPerspective.getMessage("FORM_LABEL_DESCRIPTION"); + languageHash.clear(); + for (int i=0;i<descriptions.length;i++) + { + parameters[1] = String.valueOf(i+1); + Description uddi4jDescription; + if (descriptionLanguages[i].length() > 0) + uddi4jDescription = new Description(descriptions[i],descriptionLanguages[i]); + else + { + uddi4jDescription = new Description(descriptions[i]); + if (i != 0 && !subQueryInitiated_) + { + inputsValid = false; + formToolPI.flagRowError(UDDIActionInputs.QUERY_INPUT_ADVANCED_SERVICE_DESCRIPTIONS,i); + messageQueue.addMessage(uddiPerspective.getMessage("MSG_ERROR_ROW_BLANK_LANGUAGE",parameters)); + } + } + if (languageHash.get(descriptionLanguages[i]) != null) + { + inputsValid = false; + formToolPI.flagRowError(UDDIActionInputs.QUERY_INPUT_ADVANCED_SERVICE_DESCRIPTIONS,i); + messageQueue.addMessage(uddiPerspective.getMessage("MSG_ERROR_ROW_DUPLICATE_LANGUAGE",parameters)); + } + else + languageHash.put(descriptionLanguages[i],Boolean.TRUE); + if (descriptions[i].trim().length() < 1) + { + inputsValid = false; + formToolPI.flagRowError(UDDIActionInputs.QUERY_INPUT_ADVANCED_SERVICE_DESCRIPTIONS,i); + messageQueue.addMessage(uddiPerspective.getMessage("MSG_ERROR_ROW_INVALID_TEXT",parameters)); + } + descriptionVector.addElement(uddi4jDescription); + } + propertyTable_.put(UDDIActionInputs.QUERY_INPUT_ADVANCED_SERVICE_DESCRIPTIONS,descriptionVector); + } + else + removeProperty(UDDIActionInputs.QUERY_INPUT_ADVANCED_SERVICE_DESCRIPTIONS); + + if (catTypes != null && catKeyNames != null && catKeyValues != null) + { + CategoryBag catBag = new CategoryBag(); + for (int i=0;i<catTypes.length;i++) + { + KeyedReference kr = new KeyedReference(catKeyNames[i],catKeyValues[i],catTypes[i]); + catBag.add(kr); + } + propertyTable_.put(UDDIActionInputs.QUERY_INPUT_ADVANCED_SERVICE_CATEGORIES,catBag); + } + else + removeProperty(UDDIActionInputs.QUERY_INPUT_ADVANCED_SERVICE_CATEGORIES); + + return inputsValid; + } + + public final boolean run() + { + UDDIPerspective uddiPerspective = controller_.getUDDIPerspective(); + MessageQueue messageQueue = uddiPerspective.getMessageQueue(); + try + { + String publishURL = (String)propertyTable_.get(UDDIActionInputs.QUERY_INPUT_ADVANCED_PUBLISH_URL); + String userId = (String)propertyTable_.get(UDDIActionInputs.QUERY_INPUT_ADVANCED_USERID); + String password = (String)propertyTable_.get(UDDIActionInputs.QUERY_INPUT_ADVANCED_PASSWORD); + BusinessEntity be = (BusinessEntity)propertyTable_.get(UDDIActionInputs.QUERY_INPUT_ADVANCED_SERVICE_SERVICE_PROVIDER); + String businessKey = (String)propertyTable_.get(UDDIActionInputs.QUERY_INPUT_UUID_BUSINESS_KEY); + Vector tModelVector = (Vector)propertyTable_.get(UDDIActionInputs.QUERY_INPUT_ADVANCED_SERVICE_TMODEL); + String wsdlURL = (String)propertyTable_.get(UDDIActionInputs.QUERY_INPUT_ADVANCED_SERVICE_WSDL_URL); + Vector nameVector = (Vector)propertyTable_.get(UDDIActionInputs.QUERY_INPUT_ADVANCED_SERVICE_NAMES); + Vector descriptionVector = (Vector)propertyTable_.get(UDDIActionInputs.QUERY_INPUT_ADVANCED_SERVICE_DESCRIPTIONS); + CategoryBag categoryBag = (CategoryBag)propertyTable_.get(UDDIActionInputs.QUERY_INPUT_ADVANCED_SERVICE_CATEGORIES); + + // The action can be run under the context of either a registry or a query node. + RegistryElement regElement = (RegistryElement)regNode_.getTreeElement(); + if (!regElement.isLoggedIn()) + regElement.performLogin(publishURL,userId,password); + UDDIProxy proxy = regElement.getProxy(); + + Uddi4jHelper uddi4jHelper = new Uddi4jHelper(); + Definition def = uddi4jHelper.getWSDLDefinition(wsdlURL); + + BusinessService bs; + if (tModelVector != null && tModelVector.size() > 0) + bs = uddi4jHelper.newBusinessService(wsdlURL, def, (TModel[])tModelVector.toArray(new TModel[0])); + else + { + RegPublishServiceInterfaceSimpleAction regPublishSIAction = new RegPublishServiceInterfaceSimpleAction(controller_); + int currentNodeId = getSelectedNavigatorNode().getNodeId(); + NodeManager nodeManager = regNode_.getNodeManager(); + TModel[] tModels = null; + if (uddi4jHelper.isMonolithicWSDL(def)) + { + tModels = new TModel[1]; + tModels[0] = uddi4jHelper.newTModel(wsdlURL, def); + } + else + { + String[] imports = uddi4jHelper.getImports(def, wsdlURL); + tModels = new TModel[imports.length]; + for (int i = 0; i < tModels.length; i++) + tModels[i] = uddi4jHelper.newTModel(imports[i]); + } + Hashtable tModelsTable = new Hashtable(); + if (tModels != null) + { + for (int i=0;i<tModels.length;i++) + { + boolean inputsValid = regPublishSIAction.populatePropertyTable(uddi4jHelper.getWSDL(tModels[i]), tModels[i]); + if (inputsValid) + { + regPublishSIAction.run(); + Object savedTModel = regPublishSIAction.getPropertyTable().get(UDDIActionInputs.QUERY_OUTPUT_SAVED_TMODEL); + if (savedTModel != null) + tModelsTable.put(((TModel)savedTModel).getNameString(), savedTModel); + // Reselect the current node. + nodeManager.setSelectedNodeId(currentNodeId); + } + } + } + bs = uddi4jHelper.newBusinessService(wsdlURL, def, tModelsTable); + } + + if (be != null) + bs.setBusinessKey(be.getBusinessKey()); + else if (businessKey != null) + bs.setBusinessKey(businessKey); + bs.setNameVector(nameVector); + bs.setDescriptionVector(descriptionVector); + bs.setCategoryBag(categoryBag); + Vector bsVector = new Vector(); + bsVector.add(bs); + regElement.handlePreInvocation(bs); + bs = (BusinessService)proxy.save_service(regElement.getAuthInfoString(), bsVector).getBusinessServiceVector().get(0); + addPublishedItemNode(bs,regElement); + messageQueue.addMessage(uddiPerspective.getMessage("MSG_INFO_SERVICE_PUBLISHED",bs.getDefaultNameString())); + return true; + } + catch (WSDLException e) + { + messageQueue.addMessage(controller_.getMessage("MSG_ERROR_UNEXPECTED")); + messageQueue.addMessage("WSDLException"); + messageQueue.addMessage(e.getMessage()); + } + catch (TransportException e) + { + messageQueue.addMessage(controller_.getMessage("MSG_ERROR_UNEXPECTED")); + messageQueue.addMessage("TransportException"); + messageQueue.addMessage(e.getMessage()); + } + catch (UDDIException e) + { + messageQueue.addMessage(controller_.getMessage("MSG_ERROR_UNEXPECTED")); + messageQueue.addMessage("UDDIException"); + messageQueue.addMessage(e.toString()); + } + catch (MalformedURLException e) + { + messageQueue.addMessage(controller_.getMessage("MSG_ERROR_UNEXPECTED")); + messageQueue.addMessage("MalformedURLException"); + messageQueue.addMessage(e.getMessage()); + } + return false; + } +} diff --git a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/uddi/actions/RegPublishServiceInterfaceAdvancedAction.java b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/uddi/actions/RegPublishServiceInterfaceAdvancedAction.java new file mode 100644 index 000000000..ef218529a --- /dev/null +++ b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/uddi/actions/RegPublishServiceInterfaceAdvancedAction.java @@ -0,0 +1,234 @@ +/******************************************************************************* + * Copyright (c) 2001, 2004 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ + +package org.eclipse.wst.ws.internal.explorer.platform.uddi.actions; + +import org.eclipse.wst.ws.internal.explorer.platform.constants.*; +import org.eclipse.wst.ws.internal.explorer.platform.perspective.*; +import org.eclipse.wst.ws.internal.explorer.platform.uddi.constants.*; +import org.eclipse.wst.ws.internal.explorer.platform.uddi.datamodel.*; +import org.eclipse.wst.ws.internal.explorer.platform.uddi.perspective.*; +import org.eclipse.wst.ws.internal.explorer.platform.uddi.util.Uddi4jHelper; +import org.eclipse.wst.ws.internal.explorer.platform.util.*; + +import org.uddi4j.UDDIException; +import org.uddi4j.client.UDDIProxy; +import org.uddi4j.transport.TransportException; +import org.uddi4j.datatype.tmodel.TModel; +import org.uddi4j.datatype.*; +import org.uddi4j.util.*; + +import javax.wsdl.WSDLException; +import java.util.*; +import java.net.*; + +public class RegPublishServiceInterfaceAdvancedAction extends PublishAction +{ + public RegPublishServiceInterfaceAdvancedAction(Controller controller) + { + super(controller); + propertyTable_.put(UDDIActionInputs.QUERY_ITEM,String.valueOf(UDDIActionInputs.QUERY_ITEM_SERVICE_INTERFACES)); + propertyTable_.put(UDDIActionInputs.QUERY_STYLE_SERVICE_INTERFACES,String.valueOf(UDDIActionInputs.QUERY_STYLE_ADVANCED)); + } + + protected final boolean processOthers(MultipartFormDataParser parser,FormToolPropertiesInterface formToolPI) throws MultipartFormDataException + { + String wsdlURL = parser.getParameter(ActionInputs.QUERY_INPUT_WSDL_URL); + String name = parser.getParameter(UDDIActionInputs.QUERY_INPUT_ADVANCED_SERVICE_INTERFACE_NAME); + String[] descriptionLanguages = parser.getParameterValues(UDDIActionInputs.QUERY_INPUT_ADVANCED_DESCRIPTION_LANGUAGE); + String[] descriptions = parser.getParameterValues(UDDIActionInputs.QUERY_INPUT_ADVANCED_DESCRIPTION); + String[] idTypes = parser.getParameterValues(UDDIActionInputs.QUERY_INPUT_ADVANCED_IDENTIFIER_TYPE); + String[] idKeyNames = parser.getParameterValues(UDDIActionInputs.QUERY_INPUT_ADVANCED_IDENTIFIER_KEY_NAME); + String[] idKeyValues = parser.getParameterValues(UDDIActionInputs.QUERY_INPUT_ADVANCED_IDENTIFIER_KEY_VALUE); + String[] catTypes = parser.getParameterValues(UDDIActionInputs.QUERY_INPUT_ADVANCED_CATEGORY_TYPE); + String[] catKeyNames = parser.getParameterValues(UDDIActionInputs.QUERY_INPUT_ADVANCED_CATEGORY_KEY_NAME); + String[] catKeyValues = parser.getParameterValues(UDDIActionInputs.QUERY_INPUT_ADVANCED_CATEGORY_KEY_VALUE); + + // Validate the data. + boolean inputsValid = true; + UDDIPerspective uddiPerspective = controller_.getUDDIPerspective(); + MessageQueue messageQueue = uddiPerspective.getMessageQueue(); + + Hashtable languageHash = new Hashtable(); + + if (wsdlURL != null) + propertyTable_.put(UDDIActionInputs.QUERY_INPUT_ADVANCED_SERVICE_INTERFACE_WSDL_URL,wsdlURL); + + if (!subQueryInitiated_ && !Validator.validateString(wsdlURL)) + { + inputsValid = false; + formToolPI.flagError(UDDIActionInputs.QUERY_INPUT_ADVANCED_SERVICE_INTERFACE_WSDL_URL); + messageQueue.addMessage(uddiPerspective.getMessage("MSG_ERROR_INVALID_WSDL_URL")); + } + + if (name != null) + propertyTable_.put(UDDIActionInputs.QUERY_INPUT_ADVANCED_SERVICE_INTERFACE_NAME,name); + + if (!subQueryInitiated_ && !Validator.validateString(name)) + { + inputsValid = false; + formToolPI.flagError(UDDIActionInputs.QUERY_INPUT_ADVANCED_SERVICE_INTERFACE_NAME); + messageQueue.addMessage(uddiPerspective.getMessage("MSG_ERROR_INVALID_NAME")); + } + + if (descriptionLanguages != null && descriptions != null) + { + Vector descriptionVector = new Vector(); + String[] parameters = new String[2]; + parameters[0] = uddiPerspective.getMessage("FORM_LABEL_DESCRIPTION"); + languageHash.clear(); + for (int i=0;i<descriptions.length;i++) + { + parameters[1] = String.valueOf(i+1); + Description uddi4jDescription; + if (descriptionLanguages[i].length() > 0) + uddi4jDescription = new Description(descriptions[i],descriptionLanguages[i]); + else + { + uddi4jDescription = new Description(descriptions[i]); + if (i != 0 && !subQueryInitiated_) + { + inputsValid = false; + formToolPI.flagRowError(UDDIActionInputs.QUERY_INPUT_ADVANCED_SERVICE_INTERFACE_DESCRIPTIONS,i); + messageQueue.addMessage(uddiPerspective.getMessage("MSG_ERROR_ROW_BLANK_LANGUAGE",parameters)); + } + } + if (languageHash.get(descriptionLanguages[i]) != null) + { + inputsValid = false; + formToolPI.flagRowError(UDDIActionInputs.QUERY_INPUT_ADVANCED_SERVICE_INTERFACE_DESCRIPTIONS,i); + messageQueue.addMessage(uddiPerspective.getMessage("MSG_ERROR_ROW_DUPLICATE_LANGUAGE",parameters)); + } + else + languageHash.put(descriptionLanguages[i],Boolean.TRUE); + if (descriptions[i].trim().length() < 1) + { + inputsValid = false; + formToolPI.flagRowError(UDDIActionInputs.QUERY_INPUT_ADVANCED_SERVICE_INTERFACE_DESCRIPTIONS,i); + messageQueue.addMessage(uddiPerspective.getMessage("MSG_ERROR_ROW_INVALID_TEXT",parameters)); + } + descriptionVector.addElement(uddi4jDescription); + } + propertyTable_.put(UDDIActionInputs.QUERY_INPUT_ADVANCED_SERVICE_INTERFACE_DESCRIPTIONS,descriptionVector); + } + else + removeProperty(UDDIActionInputs.QUERY_INPUT_ADVANCED_SERVICE_INTERFACE_DESCRIPTIONS); + + if (idTypes != null && idKeyNames != null && idKeyValues != null) + { + IdentifierBag idBag = new IdentifierBag(); + for (int i=0;i<idKeyNames.length;i++) + { + KeyedReference kr = new KeyedReference(idKeyNames[i],idKeyValues[i],idTypes[i]); + idBag.add(kr); + } + propertyTable_.put(UDDIActionInputs.QUERY_INPUT_ADVANCED_SERVICE_INTERFACE_IDENTIFIERS,idBag); + } + else + removeProperty(UDDIActionInputs.QUERY_INPUT_ADVANCED_SERVICE_INTERFACE_IDENTIFIERS); + + if (catTypes != null && catKeyNames != null && catKeyValues != null) + { + CategoryBag catBag = new CategoryBag(); + for (int i=0;i<catTypes.length;i++) + { + KeyedReference kr = new KeyedReference(catKeyNames[i],catKeyValues[i],catTypes[i]); + catBag.add(kr); + } + propertyTable_.put(UDDIActionInputs.QUERY_INPUT_ADVANCED_SERVICE_INTERFACE_CATEGORIES,catBag); + } + else + removeProperty(UDDIActionInputs.QUERY_INPUT_ADVANCED_SERVICE_INTERFACE_CATEGORIES); + + return inputsValid; + } + + public final boolean run() + { + UDDIPerspective uddiPerspective = controller_.getUDDIPerspective(); + MessageQueue messageQueue = uddiPerspective.getMessageQueue(); + try + { + String publishURL = (String)propertyTable_.get(UDDIActionInputs.QUERY_INPUT_ADVANCED_PUBLISH_URL); + String userId = (String)propertyTable_.get(UDDIActionInputs.QUERY_INPUT_ADVANCED_USERID); + String password = (String)propertyTable_.get(UDDIActionInputs.QUERY_INPUT_ADVANCED_PASSWORD); + String wsdlURL = (String)propertyTable_.get(UDDIActionInputs.QUERY_INPUT_ADVANCED_SERVICE_INTERFACE_WSDL_URL); + String name = (String)propertyTable_.get(UDDIActionInputs.QUERY_INPUT_ADVANCED_SERVICE_INTERFACE_NAME); + Vector descriptionVector = (Vector)propertyTable_.get(UDDIActionInputs.QUERY_INPUT_ADVANCED_SERVICE_INTERFACE_DESCRIPTIONS); + IdentifierBag identifierBag = (IdentifierBag)propertyTable_.get(UDDIActionInputs.QUERY_INPUT_ADVANCED_SERVICE_INTERFACE_IDENTIFIERS); + CategoryBag categoryBag = (CategoryBag)propertyTable_.get(UDDIActionInputs.QUERY_INPUT_ADVANCED_SERVICE_INTERFACE_CATEGORIES); + + // The action can be run under the context of either a registry or a query node. + RegistryElement regElement = (RegistryElement)regNode_.getTreeElement(); + if (!regElement.isLoggedIn()) + regElement.performLogin(publishURL,userId,password); + UDDIProxy proxy = regElement.getProxy(); + + TModel tModel = (new Uddi4jHelper()).newTModel(wsdlURL); + tModel.setName(name); + tModel.setDescriptionVector(descriptionVector); + tModel.setIdentifierBag(identifierBag); + + // The category bag may contain wsdlSpec. + CategoryBag defaultCategoryBag = tModel.getCategoryBag(); + Vector defaultKeyedReferenceVector = null; + if (defaultCategoryBag != null) + { + if (categoryBag == null) + categoryBag = defaultCategoryBag; + else + { + defaultKeyedReferenceVector = defaultCategoryBag.getKeyedReferenceVector(); + for (int i=0;i<defaultKeyedReferenceVector.size();i++) + { + KeyedReference kr = (KeyedReference)defaultKeyedReferenceVector.elementAt(i); + if (categoryBag != null) + categoryBag.add(kr); + } + } + } + tModel.setCategoryBag(categoryBag); + + Vector tModelVector = new Vector(); + tModelVector.add(tModel); + tModel = (TModel)proxy.save_tModel(regElement.getAuthInfoString(), tModelVector).getTModelVector().get(0); + propertyTable_.put(UDDIActionInputs.QUERY_OUTPUT_SAVED_TMODEL, tModel); + addPublishedItemNode(tModel,regElement); + messageQueue.addMessage(uddiPerspective.getMessage("MSG_INFO_SERVICE_INTERFACE_PUBLISHED",tModel.getNameString())); + return true; + } + catch (WSDLException e) + { + messageQueue.addMessage(controller_.getMessage("MSG_ERROR_UNEXPECTED")); + messageQueue.addMessage("WSDLException"); + messageQueue.addMessage(e.getMessage()); + } + catch (TransportException e) + { + messageQueue.addMessage(controller_.getMessage("MSG_ERROR_UNEXPECTED")); + messageQueue.addMessage("TransportException"); + messageQueue.addMessage(e.getMessage()); + } + catch (UDDIException e) + { + messageQueue.addMessage(controller_.getMessage("MSG_ERROR_UNEXPECTED")); + messageQueue.addMessage("UDDIException"); + messageQueue.addMessage(e.toString()); + } + catch (MalformedURLException e) + { + messageQueue.addMessage(controller_.getMessage("MSG_ERROR_UNEXPECTED")); + messageQueue.addMessage("MalformedURLException"); + messageQueue.addMessage(e.getMessage()); + } + return false; + } +} diff --git a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/uddi/actions/RegPublishServiceInterfaceSimpleAction.java b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/uddi/actions/RegPublishServiceInterfaceSimpleAction.java new file mode 100644 index 000000000..211baade0 --- /dev/null +++ b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/uddi/actions/RegPublishServiceInterfaceSimpleAction.java @@ -0,0 +1,156 @@ +/******************************************************************************* + * Copyright (c) 2001, 2004 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ + +package org.eclipse.wst.ws.internal.explorer.platform.uddi.actions; + +import org.eclipse.wst.ws.internal.explorer.platform.constants.*; +import org.eclipse.wst.ws.internal.explorer.platform.perspective.*; +import org.eclipse.wst.ws.internal.explorer.platform.uddi.constants.*; +import org.eclipse.wst.ws.internal.explorer.platform.uddi.datamodel.*; +import org.eclipse.wst.ws.internal.explorer.platform.uddi.perspective.*; +import org.eclipse.wst.ws.internal.explorer.platform.uddi.util.Uddi4jHelper; +import org.eclipse.wst.ws.internal.explorer.platform.util.*; + +import org.uddi4j.UDDIException; +import org.uddi4j.client.UDDIProxy; +import org.uddi4j.transport.TransportException; +import org.uddi4j.datatype.tmodel.TModel; + +import javax.wsdl.WSDLException; +import java.util.*; +import java.net.*; + +public class RegPublishServiceInterfaceSimpleAction extends PublishAction +{ + public RegPublishServiceInterfaceSimpleAction(Controller controller) + { + super(controller); + propertyTable_.put(UDDIActionInputs.QUERY_ITEM,String.valueOf(UDDIActionInputs.QUERY_ITEM_SERVICE_INTERFACES)); + propertyTable_.put(UDDIActionInputs.QUERY_STYLE_SERVICE_INTERFACES,String.valueOf(UDDIActionInputs.QUERY_STYLE_SIMPLE)); + } + + protected boolean processOthers(MultipartFormDataParser parser,FormToolPropertiesInterface formToolPI) throws MultipartFormDataException + { + String wsdlURL = parser.getParameter(ActionInputs.QUERY_INPUT_WSDL_URL); + String name = parser.getParameter(UDDIActionInputs.QUERY_INPUT_SIMPLE_SERVICE_INTERFACE_NAME); + String description = parser.getParameter(UDDIActionInputs.QUERY_INPUT_SIMPLE_SERVICE_INTERFACE_DESCRIPTION); + + boolean inputsValid = true; + UDDIPerspective uddiPerspective = controller_.getUDDIPerspective(); + MessageQueue messageQueue = uddiPerspective.getMessageQueue(); + + if (wsdlURL != null) + propertyTable_.put(UDDIActionInputs.QUERY_INPUT_SIMPLE_SERVICE_INTERFACE_WSDL_URL,wsdlURL); + + if (!subQueryInitiated_ && !Validator.validateString(wsdlURL)) + { + inputsValid = false; + formToolPI.flagError(UDDIActionInputs.QUERY_INPUT_SIMPLE_SERVICE_INTERFACE_WSDL_URL); + messageQueue.addMessage(uddiPerspective.getMessage("MSG_ERROR_INVALID_WSDL_URL")); + } + + if (name != null) + propertyTable_.put(UDDIActionInputs.QUERY_INPUT_SIMPLE_SERVICE_INTERFACE_NAME,name); + + if (!subQueryInitiated_ && !Validator.validateString(name)) + { + inputsValid = false; + formToolPI.flagError(UDDIActionInputs.QUERY_INPUT_SIMPLE_SERVICE_INTERFACE_NAME); + messageQueue.addMessage(uddiPerspective.getMessage("MSG_ERROR_INVALID_NAME")); + } + + if (description != null) + propertyTable_.put(UDDIActionInputs.QUERY_INPUT_SIMPLE_SERVICE_INTERFACE_DESCRIPTION,description); + + return inputsValid; + } + + public final boolean populatePropertyTable(String wsdlURL, TModel tModel) + { + boolean inputsValid = true; + String name = tModel.getNameString(); + String description = tModel.getDefaultDescriptionString(); + if (wsdlURL != null) + propertyTable_.put(UDDIActionInputs.QUERY_INPUT_SIMPLE_SERVICE_INTERFACE_WSDL_URL,wsdlURL); + else + inputsValid = false; + + if (name != null) + propertyTable_.put(UDDIActionInputs.QUERY_INPUT_SIMPLE_SERVICE_INTERFACE_NAME,name); + else + inputsValid = false; + + if (description != null) + propertyTable_.put(UDDIActionInputs.QUERY_INPUT_SIMPLE_SERVICE_INTERFACE_DESCRIPTION,description); + else + propertyTable_.put(UDDIActionInputs.QUERY_INPUT_SIMPLE_SERVICE_INTERFACE_DESCRIPTION,""); + return inputsValid; + } + + public final boolean run() + { + String publishURL = (String)propertyTable_.get(UDDIActionInputs.QUERY_INPUT_ADVANCED_PUBLISH_URL); + String userId = (String)propertyTable_.get(UDDIActionInputs.QUERY_INPUT_ADVANCED_USERID); + String password = (String)propertyTable_.get(UDDIActionInputs.QUERY_INPUT_ADVANCED_PASSWORD); + String wsdlURL = (String)propertyTable_.get(UDDIActionInputs.QUERY_INPUT_SIMPLE_SERVICE_INTERFACE_WSDL_URL); + String name = (String)propertyTable_.get(UDDIActionInputs.QUERY_INPUT_SIMPLE_SERVICE_INTERFACE_NAME); + String description = (String)propertyTable_.get(UDDIActionInputs.QUERY_INPUT_SIMPLE_SERVICE_INTERFACE_DESCRIPTION); + UDDIPerspective uddiPerspective = controller_.getUDDIPerspective(); + MessageQueue messageQueue = uddiPerspective.getMessageQueue(); + RegistryElement regElement = (RegistryElement)regNode_.getTreeElement(); + try + { + UDDIProxy proxy = regElement.getProxy(); + if (!regElement.isLoggedIn()) + regElement.performLogin(publishURL,userId,password); + + TModel tModel = (new Uddi4jHelper()).newTModel(wsdlURL); + tModel.setName(name); + tModel.setDefaultDescriptionString(description); + + Vector tModelVector = new Vector(); + tModelVector.add(tModel); + tModel = (TModel)proxy.save_tModel(regElement.getAuthInfoString(), tModelVector).getTModelVector().get(0); + propertyTable_.put(UDDIActionInputs.QUERY_OUTPUT_SAVED_TMODEL, tModel); + addPublishedItemNode(tModel,regElement); + messageQueue.addMessage(uddiPerspective.getMessage("MSG_INFO_SERVICE_INTERFACE_PUBLISHED",tModel.getNameString())); + return true; + } + catch (WSDLException e) + { + e.printStackTrace(); + messageQueue.addMessage(controller_.getMessage("MSG_ERROR_UNEXPECTED")); + messageQueue.addMessage("WSDLException"); + messageQueue.addMessage(e.getMessage()); + } + catch (TransportException e) + { + e.printStackTrace(); + messageQueue.addMessage(controller_.getMessage("MSG_ERROR_UNEXPECTED")); + messageQueue.addMessage("TransportException"); + messageQueue.addMessage(e.getMessage()); + } + catch (UDDIException e) + { + messageQueue.addMessage(controller_.getMessage("MSG_ERROR_UNEXPECTED")); + messageQueue.addMessage("UDDIException"); + messageQueue.addMessage(e.toString()); + } + catch (MalformedURLException e) + { + e.printStackTrace(); + messageQueue.addMessage(controller_.getMessage("MSG_ERROR_UNEXPECTED")); + messageQueue.addMessage("MalformedURLException"); + messageQueue.addMessage(e.getMessage()); + } + return false; + } +} diff --git a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/uddi/actions/RegPublishServiceSimpleAction.java b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/uddi/actions/RegPublishServiceSimpleAction.java new file mode 100644 index 000000000..bbe0caafb --- /dev/null +++ b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/uddi/actions/RegPublishServiceSimpleAction.java @@ -0,0 +1,212 @@ +/******************************************************************************* + * Copyright (c) 2004 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.wst.ws.internal.explorer.platform.uddi.actions; + +import org.eclipse.wst.ws.internal.explorer.platform.constants.*; +import org.eclipse.wst.ws.internal.explorer.platform.datamodel.*; +import org.eclipse.wst.ws.internal.explorer.platform.perspective.*; +import org.eclipse.wst.ws.internal.explorer.platform.uddi.constants.*; +import org.eclipse.wst.ws.internal.explorer.platform.uddi.datamodel.*; +import org.eclipse.wst.ws.internal.explorer.platform.uddi.perspective.*; +import org.eclipse.wst.ws.internal.explorer.platform.uddi.util.Uddi4jHelper; +import org.eclipse.wst.ws.internal.explorer.platform.util.*; + +import org.uddi4j.UDDIException; +import org.uddi4j.client.UDDIProxy; +import org.uddi4j.transport.TransportException; +import org.uddi4j.datatype.business.BusinessEntity; +import org.uddi4j.datatype.service.BusinessService; +import org.uddi4j.datatype.tmodel.TModel; +import org.uddi4j.datatype.*; + +import javax.wsdl.WSDLException; +import javax.wsdl.Definition; +import java.util.*; +import java.net.*; + +public class RegPublishServiceSimpleAction extends PublishAction +{ + public RegPublishServiceSimpleAction(Controller controller) + { + super(controller); + propertyTable_.put(UDDIActionInputs.QUERY_ITEM,String.valueOf(UDDIActionInputs.QUERY_ITEM_SERVICES)); + propertyTable_.put(UDDIActionInputs.QUERY_STYLE_SERVICES,String.valueOf(UDDIActionInputs.QUERY_STYLE_SIMPLE)); + } + + protected boolean processOthers(MultipartFormDataParser parser,FormToolPropertiesInterface formToolPI) throws MultipartFormDataException + { + String busNodeIds = parser.getParameter(UDDIActionInputs.NODEID_BUSINESS); + String wsdlURL = parser.getParameter(ActionInputs.QUERY_INPUT_WSDL_URL); + String name = parser.getParameter(UDDIActionInputs.QUERY_INPUT_SIMPLE_SERVICE_NAME); + String description = parser.getParameter(UDDIActionInputs.QUERY_INPUT_SIMPLE_SERVICE_DESCRIPTION); + + boolean inputsValid = true; + UDDIPerspective uddiPerspective = controller_.getUDDIPerspective(); + MessageQueue messageQueue = uddiPerspective.getMessageQueue(); + + if (busNodeIds != null) + { + Vector serviceBusiness = (Vector)formToolPI.getProperty(UDDIActionInputs.QUERY_INPUT_SIMPLE_SERVICE_BUSINESS); + if (serviceBusiness == null) + serviceBusiness = new Vector(); + else + serviceBusiness.removeAllElements(); + Vector serviceBusinessCopy = (Vector)formToolPI.getProperty(UDDIActionInputs.QUERY_INPUT_SIMPLE_SERVICE_BUSINESS_COPY); + // The browser will enforce the rule of having only one business in this list. + ListElement listElement = (ListElement)serviceBusinessCopy.elementAt(0); + serviceBusiness.addElement(listElement); + BusinessEntity be = (BusinessEntity)listElement.getObject(); + propertyTable_.put(UDDIActionInputs.QUERY_INPUT_SIMPLE_SERVICE_BUSINESS,serviceBusiness); + propertyTable_.put(UDDIActionInputs.QUERY_INPUT_SIMPLE_SERVICE_SERVICE_PROVIDER,be); + propertyTable_.put(UDDIActionInputs.QUERY_INPUT_UUID_BUSINESS_KEY,be.getBusinessKey()); + } + else + { + removeProperty(UDDIActionInputs.QUERY_INPUT_SIMPLE_SERVICE_BUSINESS); + removeProperty(UDDIActionInputs.QUERY_INPUT_SIMPLE_SERVICE_SERVICE_PROVIDER); + if (!subQueryInitiated_) + { + inputsValid = false; + formToolPI.flagError(UDDIActionInputs.QUERY_INPUT_SIMPLE_SERVICE_BUSINESS); + messageQueue.addMessage(uddiPerspective.getMessage("MSG_ERROR_INVALID_BUSINESS")); + } + } + + if (wsdlURL != null) + { + propertyTable_.put(ActionInputs.QUERY_INPUT_WSDL_URL,wsdlURL); + propertyTable_.put(UDDIActionInputs.QUERY_INPUT_SIMPLE_SERVICE_WSDL_URL,wsdlURL); + } + + if (!subQueryInitiated_ && !Validator.validateString(wsdlURL)) + { + inputsValid = false; + formToolPI.flagError(UDDIActionInputs.QUERY_INPUT_SIMPLE_SERVICE_WSDL_URL); + messageQueue.addMessage(uddiPerspective.getMessage("MSG_ERROR_INVALID_WSDL_URL")); + } + + if (name != null) + propertyTable_.put(UDDIActionInputs.QUERY_INPUT_SIMPLE_SERVICE_NAME,name); + + if (!subQueryInitiated_ && !Validator.validateString(name)) + { + inputsValid = false; + formToolPI.flagError(UDDIActionInputs.QUERY_INPUT_SIMPLE_SERVICE_NAME); + messageQueue.addMessage(uddiPerspective.getMessage("MSG_ERROR_INVALID_NAME")); + } + + if (description != null) + propertyTable_.put(UDDIActionInputs.QUERY_INPUT_SIMPLE_SERVICE_DESCRIPTION,description); + + return inputsValid; + } + + public final boolean run() + { + String publishURL = (String)propertyTable_.get(UDDIActionInputs.QUERY_INPUT_ADVANCED_PUBLISH_URL); + String userId = (String)propertyTable_.get(UDDIActionInputs.QUERY_INPUT_ADVANCED_USERID); + String password = (String)propertyTable_.get(UDDIActionInputs.QUERY_INPUT_ADVANCED_PASSWORD); + BusinessEntity be = (BusinessEntity)propertyTable_.get(UDDIActionInputs.QUERY_INPUT_SIMPLE_SERVICE_SERVICE_PROVIDER); + String businessKey = (String)propertyTable_.get(UDDIActionInputs.QUERY_INPUT_UUID_BUSINESS_KEY); + String wsdlURL = (String)propertyTable_.get(UDDIActionInputs.QUERY_INPUT_SIMPLE_SERVICE_WSDL_URL); + String name = (String)propertyTable_.get(UDDIActionInputs.QUERY_INPUT_SIMPLE_SERVICE_NAME); + String description = (String)propertyTable_.get(UDDIActionInputs.QUERY_INPUT_SIMPLE_SERVICE_DESCRIPTION); + UDDIPerspective uddiPerspective = controller_.getUDDIPerspective(); + MessageQueue messageQueue = uddiPerspective.getMessageQueue(); + RegistryElement regElement = (RegistryElement)regNode_.getTreeElement(); + try + { + UDDIProxy proxy = regElement.getProxy(); + if (!regElement.isLoggedIn()) + regElement.performLogin(publishURL,userId,password); + + Uddi4jHelper uddi4jHelper = new Uddi4jHelper(); + Definition def = uddi4jHelper.getWSDLDefinition(wsdlURL); + RegPublishServiceInterfaceSimpleAction regPublishSIAction = new RegPublishServiceInterfaceSimpleAction(controller_); + int currentNodeId = getSelectedNavigatorNode().getNodeId(); + NodeManager nodeManager = regNode_.getNodeManager(); + + Hashtable tModelsTable = new Hashtable(); + TModel[] tModels = null; + if (uddi4jHelper.isMonolithicWSDL(def)) + { + tModels = new TModel[1]; + tModels[0] = uddi4jHelper.newTModel(wsdlURL, def); + } + else + { + String[] imports = uddi4jHelper.getImports(def, wsdlURL); + tModels = new TModel[imports.length]; + for (int i = 0; i < tModels.length; i++) + tModels[i] = uddi4jHelper.newTModel(imports[i]); + } + + if (tModels != null) + { + for (int i=0;i<tModels.length;i++) + { + boolean inputsValid = regPublishSIAction.populatePropertyTable(uddi4jHelper.getWSDL(tModels[i]), tModels[i]); + if (inputsValid) + { + regPublishSIAction.run(); + Object savedTModel = regPublishSIAction.getPropertyTable().get(UDDIActionInputs.QUERY_OUTPUT_SAVED_TMODEL); + if (savedTModel != null) + { + tModelsTable.put(((TModel)savedTModel).getNameString(), savedTModel); + } + // Reselect the current node. + nodeManager.setSelectedNodeId(currentNodeId); + } + } + } + + BusinessService bs = uddi4jHelper.newBusinessService(wsdlURL, def, tModelsTable); + if (be != null) + bs.setBusinessKey(be.getBusinessKey()); + else if (businessKey != null) + bs.setBusinessKey(businessKey); + bs.setDefaultName(new Name(name)); + bs.setDefaultDescriptionString(description); + Vector bsVector = new Vector(); + bsVector.add(bs); + regElement.handlePreInvocation(bs); + bs = (BusinessService)proxy.save_service(regElement.getAuthInfoString(), bsVector).getBusinessServiceVector().get(0); + addPublishedItemNode(bs,regElement); + messageQueue.addMessage(uddiPerspective.getMessage("MSG_INFO_SERVICE_PUBLISHED",bs.getDefaultNameString())); + return true; + } + catch (WSDLException e) + { + messageQueue.addMessage(controller_.getMessage("MSG_ERROR_UNEXPECTED")); + messageQueue.addMessage("WSDLException"); + messageQueue.addMessage(e.getMessage()); + } + catch (TransportException e) + { + messageQueue.addMessage(controller_.getMessage("MSG_ERROR_UNEXPECTED")); + messageQueue.addMessage("TransportException"); + messageQueue.addMessage(e.getMessage()); + } + catch (UDDIException e) + { + messageQueue.addMessage(controller_.getMessage("MSG_ERROR_UNEXPECTED")); + messageQueue.addMessage("UDDIException"); + messageQueue.addMessage(e.toString()); + } + catch (MalformedURLException e) + { + messageQueue.addMessage(controller_.getMessage("MSG_ERROR_UNEXPECTED")); + messageQueue.addMessage("MalformedURLException"); + messageQueue.addMessage(e.getMessage()); + } + return false; + } +} diff --git a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/uddi/actions/RemovePublisherAssertionsAction.java b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/uddi/actions/RemovePublisherAssertionsAction.java new file mode 100644 index 000000000..87dce12d6 --- /dev/null +++ b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/uddi/actions/RemovePublisherAssertionsAction.java @@ -0,0 +1,217 @@ +/******************************************************************************* + * Copyright (c) 2001, 2004 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ + +package org.eclipse.wst.ws.internal.explorer.platform.uddi.actions; + +import org.eclipse.wst.ws.internal.explorer.platform.datamodel.*; +import org.eclipse.wst.ws.internal.explorer.platform.perspective.*; +import org.eclipse.wst.ws.internal.explorer.platform.uddi.constants.*; +import org.eclipse.wst.ws.internal.explorer.platform.uddi.datamodel.*; +import org.eclipse.wst.ws.internal.explorer.platform.uddi.perspective.*; +import org.eclipse.wst.ws.internal.explorer.platform.util.*; + +import org.uddi4j.*; +import org.uddi4j.response.*; +import org.uddi4j.datatype.assertion.*; +import org.uddi4j.client.UDDIProxy; +import org.uddi4j.transport.TransportException; + +import java.util.*; +import java.net.*; + +public class RemovePublisherAssertionsAction extends CommonPublisherAssertionsAction +{ + public RemovePublisherAssertionsAction(Controller controller) + { + super(controller); + } + + protected final boolean processParsedResults(MultipartFormDataParser parser) throws MultipartFormDataException + { + if (registryNode_ == null) + return false; + + boolean inputsValid = true; + UDDIPerspective uddiPerspective = controller_.getUDDIPerspective(); + MessageQueue messageQueue = uddiPerspective.getMessageQueue(); + FormTool formTool = getSelectedFormTool(); + + // ids from uddiObjects_table + String[] selectedBusIds = parser.getParameterValues(UDDIActionInputs.PUBLISHER_ASSERTIONS_SELECTED_BUS_ID); + if (selectedBusIds != null && selectedBusIds.length > 0) + propertyTable_.put(UDDIActionInputs.PUBLISHER_ASSERTIONS_SELECTED_BUS_ID, selectedBusIds); + // Synchronize client view and server model (uddiObject_table.jsp) + synchronizeUDDIObjectTable(); + + // if not yet logged in, validate the parameters needed to log in + if (!isLoggedIn_) { + String publishURL = parser.getParameter(UDDIActionInputs.QUERY_INPUT_ADVANCED_PUBLISH_URL); + String userID = parser.getParameter(UDDIActionInputs.QUERY_INPUT_ADVANCED_USERID); + String password = parser.getParameter(UDDIActionInputs.QUERY_INPUT_ADVANCED_PASSWORD); + + if (publishURL != null) + { + propertyTable_.put(UDDIActionInputs.QUERY_INPUT_ADVANCED_PUBLISH_URL,publishURL); + formTool.setProperty(UDDIActionInputs.QUERY_INPUT_ADVANCED_PUBLISH_URL,publishURL); + } + + if (!Validator.validateURL(publishURL)) + { + inputsValid = false; + formTool.flagError(UDDIActionInputs.QUERY_INPUT_ADVANCED_PUBLISH_URL); + messageQueue.addMessage(uddiPerspective.getMessage("MSG_ERROR_INVALID_PUBLISH_URL")); + } + + if (userID!= null) + { + propertyTable_.put(UDDIActionInputs.QUERY_INPUT_ADVANCED_USERID,userID); + formTool.setProperty(UDDIActionInputs.QUERY_INPUT_ADVANCED_USERID,userID); + } + + if (!Validator.validateString(userID)) + { + inputsValid = false; + formTool.flagError(UDDIActionInputs.QUERY_INPUT_ADVANCED_USERID); + messageQueue.addMessage(uddiPerspective.getMessage("MSG_ERROR_INVALID_USERID")); + } + + if (password != null) + { + propertyTable_.put(UDDIActionInputs.QUERY_INPUT_ADVANCED_PASSWORD,password); + formTool.setProperty(UDDIActionInputs.QUERY_INPUT_ADVANCED_PASSWORD,password); + } + } + + // ids from publisher assertion table + String[] pubAssertionsViewIds = parser.getParameterValues(UDDIActionInputs.PUBLISHER_ASSERTIONS_VIEWID); + if (pubAssertionsViewIds == null || pubAssertionsViewIds.length == 0) + inputsValid = false; + else + propertyTable_.put(UDDIActionInputs.PUBLISHER_ASSERTIONS_VIEWID, pubAssertionsViewIds); + + return inputsValid; + } + + public boolean run() + { + if (registryNode_ == null) + return false; + + RegistryElement registryElement = (RegistryElement)registryNode_.getTreeElement(); + UDDIPerspective uddiPerspective = controller_.getUDDIPerspective(); + MessageQueue messageQueue = uddiPerspective.getMessageQueue(); + NodeManager navigatorManager = uddiPerspective.getNavigatorManager(); + Node selectedNode = navigatorManager.getSelectedNode(); + TreeElement selectedElement = selectedNode.getTreeElement(); + + if (!(selectedElement instanceof BusinessElement)) + return false; + + // if not yet logged in, log in first + if (!isLoggedIn_) { + String publishURL = (String)propertyTable_.get(UDDIActionInputs.QUERY_INPUT_ADVANCED_PUBLISH_URL); + String userID = (String)propertyTable_.get(UDDIActionInputs.QUERY_INPUT_ADVANCED_USERID); + String password = (String)propertyTable_.get(UDDIActionInputs.QUERY_INPUT_ADVANCED_PASSWORD); + + try { + registryElement.performLogin(publishURL, userID, password); + } + catch (TransportException te) { + messageQueue.addMessage(controller_.getMessage("MSG_ERROR_UNEXPECTED")); + messageQueue.addMessage("TransportException"); + messageQueue.addMessage(te.getMessage()); + return false; + } + catch (UDDIException uddie) { + messageQueue.addMessage(controller_.getMessage("MSG_ERROR_UNEXPECTED")); + messageQueue.addMessage("UDDIException"); + messageQueue.addMessage(uddie.toString()); + return false; + } + catch (MalformedURLException me) { + messageQueue.addMessage(controller_.getMessage("MSG_ERROR_UNEXPECTED")); + messageQueue.addMessage("MalformedURLException"); + messageQueue.addMessage(me.getMessage()); + return false; + } + } + + UDDIProxy proxy = registryElement.getProxy(); + String userID = registryElement.getUserId(); + String cred = registryElement.getCred(); + BusinessElement busElement = (BusinessElement)selectedElement; + ListManager pubAssertions = busElement.getPublisherAssertions(); + + // determine whether this is a owned business + // if not, the AddPublisherAssertionsAction cannot be performed + if (!isBusinessOwned(busElement)) { + messageQueue.addMessage(uddiPerspective.getMessage("MSG_ERROR_NOT_OWNED_BUSINESS")); + return false; + } + + try { + String[] pubAssertionViewIds = (String[])propertyTable_.get(UDDIActionInputs.PUBLISHER_ASSERTIONS_VIEWID); + Vector pubAssertionVector = new Vector(); + boolean refreshRequired = false; + + for (int i = 0; i < pubAssertionViewIds.length; i++) { + int viewID = Integer.parseInt(pubAssertionViewIds[i]); + ListElement listElement = pubAssertions.getElementWithViewId(viewID); + PublisherAssertionElement pubAssertionElement = (PublisherAssertionElement)listElement.getObject(); + PublisherAssertion pubAssertion = pubAssertionElement.getPublisherAssertion(); + pubAssertionVector.add(pubAssertion); + if (pubAssertionElement.getStatus().equals(CompletionStatus.COMPLETE)) + refreshRequired = true; + } + + DispositionReport report = proxy.delete_publisherAssertions(registryElement.getAuthInfoString(), pubAssertionVector); + //report status + Vector reportErrInfo = report.getResultVector(); + for (int i = 0; i < reportErrInfo.size(); i++) { + messageQueue.addMessage(((Result) reportErrInfo.get(i)).getErrInfo().getText()); + } + + // refresh is required, refresh the whole publisher assertion table + if (refreshRequired) { + ShowPublisherAssertionsAction showPAAction = new ShowPublisherAssertionsAction(controller_); + Hashtable propertyTable = showPAAction.getPropertyTable(); + Object ids = propertyTable_.get(UDDIActionInputs.PUBLISHER_ASSERTIONS_SELECTED_BUS_ID); + if (ids != null) + propertyTable.put(UDDIActionInputs.PUBLISHER_ASSERTIONS_SELECTED_BUS_ID, ids); + showPAAction.run(); + } + // refresh is not required, delete the selected publisher assertion elements + else { + for (int k = 0; k < pubAssertionViewIds.length; k++) { + pubAssertions.removeElementWithViewId(Integer.parseInt(pubAssertionViewIds[k])); + } + } + + return report.success(); + } + catch (UDDIException uddie) { + messageQueue.addMessage(controller_.getMessage("MSG_ERROR_UNEXPECTED")); + messageQueue.addMessage("UDDIException"); + DispositionReport report = uddie.getDispositionReport(); + Vector reportErrInfo = report.getResultVector(); + for (int i = 0; i < reportErrInfo.size(); i++) { + messageQueue.addMessage(((Result) reportErrInfo.get(i)).getErrInfo().getText()); + } + return false; + } + catch (Exception e) { + messageQueue.addMessage(controller_.getMessage("MSG_ERROR_UNEXPECTED")); + messageQueue.addMessage("Exception"); + messageQueue.addMessage(e.getMessage()); + return false; + } + } +} diff --git a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/uddi/actions/RemoveSubQueryItemAction.java b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/uddi/actions/RemoveSubQueryItemAction.java new file mode 100644 index 000000000..6c824874c --- /dev/null +++ b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/uddi/actions/RemoveSubQueryItemAction.java @@ -0,0 +1,75 @@ +/******************************************************************************* + * Copyright (c) 2001, 2004 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ + +package org.eclipse.wst.ws.internal.explorer.platform.uddi.actions; + +import org.eclipse.wst.ws.internal.explorer.platform.actions.*; +import org.eclipse.wst.ws.internal.explorer.platform.perspective.*; +import org.eclipse.wst.ws.internal.explorer.platform.uddi.constants.*; +import org.eclipse.wst.ws.internal.explorer.platform.uddi.perspective.*; + +import javax.servlet.http.*; + +import java.util.*; + +public class RemoveSubQueryItemAction extends Action +{ + private Controller controller_; + + public RemoveSubQueryItemAction(Controller controller) + { + super(); + controller_ = controller; + } + + // uddi/actions/RemoveSubQueryItemActionJSP.jsp?subQueryKey=...&subQueryListKey=...&subQueryListItemId=... + public static final String getActionLink(String subQueryKey,String subQueryListKey,int subQueryListItemId) + { + StringBuffer actionLink = new StringBuffer("uddi/actions/RemoveSubQueryItemActionJSP.jsp?"); + actionLink.append(UDDIActionInputs.SUBQUERY_KEY).append('=').append(subQueryKey); + actionLink.append('&').append(UDDIActionInputs.SUBQUERY_LIST_KEY).append('=').append(subQueryListKey); + actionLink.append('&').append(UDDIActionInputs.SUBQUERY_LIST_ITEMID).append('=').append(subQueryListItemId); + return actionLink.toString(); + } + + public boolean populatePropertyTable(HttpServletRequest request) + { + String subQueryKey = request.getParameter(UDDIActionInputs.SUBQUERY_KEY); + String subQueryListKey = request.getParameter(UDDIActionInputs.SUBQUERY_LIST_KEY); + String subQueryListItemId = request.getParameter(UDDIActionInputs.SUBQUERY_LIST_ITEMID); + + if (subQueryKey != null) + propertyTable_.put(UDDIActionInputs.SUBQUERY_KEY,subQueryKey); + + if (subQueryListKey != null) + propertyTable_.put(UDDIActionInputs.SUBQUERY_LIST_KEY,subQueryListKey); + + if (subQueryListItemId != null) + propertyTable_.put(UDDIActionInputs.SUBQUERY_LIST_ITEMID,subQueryListItemId); + + return true; + } + + public boolean run() + { + String subQueryKey = (String)propertyTable_.get(UDDIActionInputs.SUBQUERY_KEY); + String subQueryListKey = (String)propertyTable_.get(UDDIActionInputs.SUBQUERY_LIST_KEY); + int subQueryListItemId = Integer.parseInt((String)propertyTable_.get(UDDIActionInputs.SUBQUERY_LIST_ITEMID)); + UDDIPerspective uddiPerspective = controller_.getUDDIPerspective(); + NodeManager navigatorManager = uddiPerspective.getNavigatorManager(); + Node currentNode = navigatorManager.getSelectedNode(); + FormTool formTool = (FormTool)(currentNode.getCurrentToolManager().getSelectedTool()); + FormToolPropertiesInterface formToolPI = ((MultipleFormToolPropertiesInterface)formTool).getFormToolProperties((String)propertyTable_.get(UDDIActionInputs.SUBQUERY_KEY)); + Vector list = (Vector)formToolPI.getProperty((String)propertyTable_.get(UDDIActionInputs.SUBQUERY_LIST_KEY)); + list.removeElementAt(subQueryListItemId); + return true; + } +} diff --git a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/uddi/actions/ResizeUDDIFramesAction.java b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/uddi/actions/ResizeUDDIFramesAction.java new file mode 100644 index 000000000..93041d66d --- /dev/null +++ b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/uddi/actions/ResizeUDDIFramesAction.java @@ -0,0 +1,129 @@ +/******************************************************************************* + * Copyright (c) 2001, 2004 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ + +package org.eclipse.wst.ws.internal.explorer.platform.uddi.actions; + +import org.eclipse.wst.ws.internal.explorer.platform.actions.*; +import org.eclipse.wst.ws.internal.explorer.platform.constants.*; +import org.eclipse.wst.ws.internal.explorer.platform.perspective.*; +import org.eclipse.wst.ws.internal.explorer.platform.uddi.constants.*; +import org.eclipse.wst.ws.internal.explorer.platform.uddi.perspective.*; +import org.eclipse.wst.ws.internal.explorer.platform.util.*; + +public class ResizeUDDIFramesAction extends ResizeFramesAction +{ + public ResizeUDDIFramesAction(Controller controller) + { + super(controller); + } + + protected boolean processOthers(MultipartFormDataParser parser) throws MultipartFormDataException + { + String perspectiveContentFramesetCols = parser.getParameter(UDDIActionInputs.FRAMESET_COLS_PERSPECTIVE_CONTENT); + String actionsContainerFramesetRows = parser.getParameter(UDDIActionInputs.FRAMESET_ROWS_ACTIONS_CONTAINER); + if (perspectiveContentFramesetCols != null && actionsContainerFramesetRows != null) + { + propertyTable_.put(UDDIActionInputs.FRAMESET_COLS_PERSPECTIVE_CONTENT,perspectiveContentFramesetCols); + propertyTable_.put(UDDIActionInputs.FRAMESET_ROWS_ACTIONS_CONTAINER,actionsContainerFramesetRows); + return true; + } + return false; + } + + public final boolean run() + { + // Save the current frameset sizes. + String frameName = (String)propertyTable_.get(ActionInputs.FRAME_NAME); + String perspectiveContentFramesetCols = (String)propertyTable_.get(UDDIActionInputs.FRAMESET_COLS_PERSPECTIVE_CONTENT); + String actionsContainerFramesetRows = (String)propertyTable_.get(UDDIActionInputs.FRAMESET_ROWS_ACTIONS_CONTAINER); + UDDIPerspective uddiPerspective = controller_.getUDDIPerspective(); + + // Set the new frameset sizes. + boolean saveFrameSettings = false; + if (frameName.equals(UDDIFrameNames.NAVIGATOR_CONTAINER)) + { + uddiPerspective.setActionsContainerFramesetRows(actionsContainerFramesetRows); + uddiPerspective.setSavedActionsContainerFramesetRows(actionsContainerFramesetRows); + if (perspectiveContentFramesetCols.startsWith("100%")) + { + // Restore. + uddiPerspective.setPerspectiveContentFramesetCols(uddiPerspective.getSavedPerspectiveContentFramesetCols()); + } + else + { + // Maximize. + uddiPerspective.setSavedPerspectiveContentFramesetCols(perspectiveContentFramesetCols); + uddiPerspective.setPerspectiveContentFramesetCols("100%,0%"); + } + } + else if (frameName.equals(UDDIFrameNames.PROPERTIES_CONTAINER)) + { + if (actionsContainerFramesetRows.startsWith("100%")) + { + if (perspectiveContentFramesetCols.endsWith("100%")) + { + // Restore. + uddiPerspective.setPerspectiveContentFramesetCols(uddiPerspective.getSavedPerspectiveContentFramesetCols()); + uddiPerspective.setActionsContainerFramesetRows(uddiPerspective.getSavedActionsContainerFramesetRows()); + } + else + { + // Maximize. + uddiPerspective.setSavedPerspectiveContentFramesetCols(perspectiveContentFramesetCols); + uddiPerspective.setSavedActionsContainerFramesetRows(actionsContainerFramesetRows); + uddiPerspective.setPerspectiveContentFramesetCols("0%,100%"); + } + } + else + { + // Maximize. + uddiPerspective.setSavedActionsContainerFramesetRows(actionsContainerFramesetRows); + uddiPerspective.setActionsContainerFramesetRows("100%,0%"); + if (!perspectiveContentFramesetCols.endsWith("100%")) + { + uddiPerspective.setSavedPerspectiveContentFramesetCols(perspectiveContentFramesetCols); + uddiPerspective.setPerspectiveContentFramesetCols("0%,100%"); + } + } + } + else if (frameName.equals(UDDIFrameNames.STATUS_CONTAINER)) + { + if (actionsContainerFramesetRows.endsWith("100%")) + { + if (perspectiveContentFramesetCols.endsWith("100%")) + { + // Restore. + uddiPerspective.setPerspectiveContentFramesetCols(uddiPerspective.getSavedPerspectiveContentFramesetCols()); + uddiPerspective.setActionsContainerFramesetRows(uddiPerspective.getSavedActionsContainerFramesetRows()); + } + else + { + // Maximize. + uddiPerspective.setSavedPerspectiveContentFramesetCols(perspectiveContentFramesetCols); + uddiPerspective.setSavedActionsContainerFramesetRows(actionsContainerFramesetRows); + uddiPerspective.setPerspectiveContentFramesetCols("0%,100%"); + } + } + else + { + // Maximize. + uddiPerspective.setSavedActionsContainerFramesetRows(actionsContainerFramesetRows); + uddiPerspective.setActionsContainerFramesetRows("0%,100%"); + if (!perspectiveContentFramesetCols.endsWith("100%")) + { + uddiPerspective.setSavedPerspectiveContentFramesetCols(perspectiveContentFramesetCols); + uddiPerspective.setPerspectiveContentFramesetCols("0%,100%"); + } + } + } + return true; + } +} diff --git a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/uddi/actions/SelectCategoryNodeAction.java b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/uddi/actions/SelectCategoryNodeAction.java new file mode 100644 index 000000000..7fa3d43df --- /dev/null +++ b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/uddi/actions/SelectCategoryNodeAction.java @@ -0,0 +1,71 @@ +/******************************************************************************* + * Copyright (c) 2001, 2004 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ + +package org.eclipse.wst.ws.internal.explorer.platform.uddi.actions; + +import org.eclipse.wst.ws.internal.explorer.platform.actions.*; +import org.eclipse.wst.ws.internal.explorer.platform.constants.*; +import org.eclipse.wst.ws.internal.explorer.platform.perspective.*; + +public class SelectCategoryNodeAction extends SelectNodeAction +{ + public SelectCategoryNodeAction(Controller controller) + { + super(controller,controller.getUDDIPerspective().getCategoryManager()); + } + + // uddi/actions/SelectCategoryNodeAction.jsp?sessionId=...&nodeId=... + public static String getActionLink(String sessionId,int nodeId) + { + StringBuffer actionLink = new StringBuffer("uddi/actions/SelectCategoryNodeActionJSP.jsp?"); + actionLink.append(ActionInputs.SESSIONID).append('=').append(sessionId); + actionLink.append('&').append(ActionInputs.NODEID).append('=').append(nodeId); + return actionLink.toString(); + } + + public final String getActionLinkForHistory() + { + // Do not add this action to the history. + return null; + } + + public final boolean run() + { + int nodeId = Integer.parseInt((String)propertyTable_.get(ActionInputs.NODEID)); + performBaseAction(nodeId); + return true; + } + + public final String getTreeContentVar() + { + return "categoryBrowserWindowContent"; + } + + public final String getTreeContentPage() + { + return null; + } + + public final String getPropertiesContainerVar() + { + return null; + } + + public final String getPropertiesContainerPage() + { + return null; + } + + public final int getPerspectiveId() + { + return ActionInputs.PERSPECTIVE_UDDI; + } +} diff --git a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/uddi/actions/SelectFindToolAction.java b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/uddi/actions/SelectFindToolAction.java new file mode 100644 index 000000000..5afd276b7 --- /dev/null +++ b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/uddi/actions/SelectFindToolAction.java @@ -0,0 +1,83 @@ +/******************************************************************************* + * Copyright (c) 2004 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.wst.ws.internal.explorer.platform.uddi.actions; + +import org.eclipse.wst.ws.internal.explorer.platform.constants.*; +import org.eclipse.wst.ws.internal.explorer.platform.perspective.*; +import org.eclipse.wst.ws.internal.explorer.platform.uddi.constants.*; + +import javax.servlet.http.*; + +public class SelectFindToolAction extends SelectPropertiesToolAction +{ + protected String subQueryKey_; + protected boolean toolLinkChanged_; + + public SelectFindToolAction(Controller controller) + { + super(controller); + subQueryKey_ = null; + toolLinkChanged_ = false; + } + + public boolean processLinkParameters(HttpServletRequest request) + { + boolean result = super.processLinkParameters(request); + subQueryKey_ = request.getParameter(UDDIActionInputs.SUBQUERY_KEY); + return result; + } + + // /uddi/actions/SelectFindToolAction.jsp?nodeId=...&toolId=...<&viewId=...&viewToolId=...>&subQueryKey=...<&isHistory=1> + public static final String getActionLink(int nodeId,int toolId,int viewId,int viewToolId,String subQueryKey,boolean forHistory) + { + StringBuffer actionLink = new StringBuffer("uddi/actions/SelectFindToolActionJSP.jsp?"); + actionLink.append(ActionInputs.NODEID).append('=').append(nodeId); + actionLink.append('&').append(ActionInputs.TOOLID).append('=').append(toolId); + if (viewId != ActionInputs.VIEWID_DEFAULT) + { + actionLink.append('&').append(ActionInputs.VIEWID).append('=').append(viewId); + actionLink.append('&').append(ActionInputs.VIEWTOOLID).append('=').append(viewToolId); + } + actionLink.append('&').append(UDDIActionInputs.SUBQUERY_KEY).append('=').append(subQueryKey); + + if (forHistory) + actionLink.append('&').append(ActionInputs.ISHISTORY).append("=1"); + return actionLink.toString(); + } + + public boolean run() + { + if (!super.run()) + return false; + FormTool formTool = (FormTool)(selectedNode_.getCurrentToolManager().getSelectedTool()); + String currentSubQueryKey = (String)formTool.getProperty(UDDIActionInputs.SUBQUERY_KEY); + if (subQueryKey_ != null && !subQueryKey_.equals(currentSubQueryKey)) + { + toolLinkChanged_ = true; + formTool.setProperty(UDDIActionInputs.SUBQUERY_KEY,subQueryKey_); + } + return true; + } + + public boolean requiresViewSelection() + { + return toolLinkChanged_; + } + + protected String getActionLinkForHistory() + { + int nodeId = selectedNode_.getNodeId(); + int toolId = selectedTool_.getToolId(); + int viewId = selectedNode_.getViewId(); + int viewToolId = selectedNode_.getViewToolId(); + return getActionLink(nodeId,toolId,viewId,viewToolId,subQueryKey_,true); + } +} diff --git a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/uddi/actions/SelectNavigatorNodeAction.java b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/uddi/actions/SelectNavigatorNodeAction.java new file mode 100644 index 000000000..a03472c09 --- /dev/null +++ b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/uddi/actions/SelectNavigatorNodeAction.java @@ -0,0 +1,73 @@ +/******************************************************************************* + * Copyright (c) 2001, 2004 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ + +package org.eclipse.wst.ws.internal.explorer.platform.uddi.actions; + +import org.eclipse.wst.ws.internal.explorer.platform.actions.*; +import org.eclipse.wst.ws.internal.explorer.platform.constants.*; +import org.eclipse.wst.ws.internal.explorer.platform.perspective.*; + +public class SelectNavigatorNodeAction extends SelectNodeAction +{ + public SelectNavigatorNodeAction(Controller controller) + { + super(controller,controller.getUDDIPerspective().getNavigatorManager()); + } + + // uddi/actions/SelectNavigatorNodeAction.jsp?nodeId=...<&isHistory=1> + public static String getActionLink(int nodeId,boolean forHistory) + { + StringBuffer actionLink = new StringBuffer("uddi/actions/SelectNavigatorNodeActionJSP.jsp?"); + actionLink.append(ActionInputs.NODEID).append('=').append(nodeId); + if (forHistory) + actionLink.append('&').append(ActionInputs.ISHISTORY).append("=1"); + return actionLink.toString(); + } + + public String getActionLinkForHistory() + { + ToolManager toolManager = selectedNode_.getToolManager(); + Tool selectedTool = toolManager.getSelectedTool(); + int nodeId = selectedNode_.getNodeId(); + int toolId = selectedTool.getToolId(); + int viewId = selectedNode_.getViewId(); + int viewToolId = selectedNode_.getViewToolId(); + if (selectedTool.getToolType() != ToolTypes.ACTION) + return selectedTool.getSelectToolActionHref(true); + else + return getActionLink(nodeId,true); + } + + public final String getTreeContentVar() + { + return "navigatorContent"; + } + + public final String getTreeContentPage() + { + return "uddi/navigator_content.jsp"; + } + + public final String getPropertiesContainerVar() + { + return "propertiesContainer"; + } + + public final String getPropertiesContainerPage() + { + return "uddi/properties_container.jsp"; + } + + public final int getPerspectiveId() + { + return ActionInputs.PERSPECTIVE_UDDI; + } +} diff --git a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/uddi/actions/SelectPropertiesToolAction.java b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/uddi/actions/SelectPropertiesToolAction.java new file mode 100644 index 000000000..388995c4c --- /dev/null +++ b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/uddi/actions/SelectPropertiesToolAction.java @@ -0,0 +1,83 @@ +/******************************************************************************* + * Copyright (c) 2004 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.wst.ws.internal.explorer.platform.uddi.actions; + +import org.eclipse.wst.ws.internal.explorer.platform.actions.*; +import org.eclipse.wst.ws.internal.explorer.platform.constants.*; +import org.eclipse.wst.ws.internal.explorer.platform.perspective.*; + +public class SelectPropertiesToolAction extends SelectNodeToolAction +{ + public SelectPropertiesToolAction(Controller controller) + { + super(controller, controller.getUDDIPerspective().getNavigatorManager()); + } + + // /uddi/actions/SelectPropertiesToolAction.jsp?nodeId=...&toolId=...<&viewId=...&viewToolId=...><&isHistory=1> + public static final String getActionLink(int nodeId,int toolId,int viewId,int viewToolId,boolean forHistory) + { + StringBuffer actionLink = new StringBuffer("uddi/actions/SelectPropertiesToolActionJSP.jsp?"); + actionLink.append(ActionInputs.NODEID).append('=').append(nodeId); + actionLink.append('&').append(ActionInputs.TOOLID).append('=').append(toolId); + if (viewId != ActionInputs.VIEWID_DEFAULT) + { + actionLink.append('&').append(ActionInputs.VIEWID).append('=').append(viewId); + actionLink.append('&').append(ActionInputs.VIEWTOOLID).append('=').append(viewToolId); + } + if (forHistory) + actionLink.append('&').append(ActionInputs.ISHISTORY).append("=1"); + return actionLink.toString(); + } + + protected String getActionLinkForHistory() + { + int nodeId = selectedNode_.getNodeId(); + int toolId = selectedTool_.getToolId(); + int viewId = selectedNode_.getViewId(); + int viewToolId = selectedNode_.getViewToolId(); + return getActionLink(nodeId,toolId,viewId,viewToolId,true); + } + + public final String getTreeContentVar() + { + return "navigatorContent"; + } + + public final String getTreeContentPage() + { + return "uddi/navigator_content.jsp"; + } + + public final String getPropertiesContainerVar() + { + return "propertiesContainer"; + } + + public final String getPropertiesContainerPage() + { + return "uddi/properties_container.jsp"; + } + + public final String getPropertiesContentVar() + { + return "propertiesContent"; + } + + public final String getPropertiesContentPage() + { + return "uddi/properties_content.jsp"; + } + + public final int getPerspectiveId() + { + return ActionInputs.PERSPECTIVE_UDDI; + } +}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/uddi/actions/SelectSubQueryItemAction.java b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/uddi/actions/SelectSubQueryItemAction.java new file mode 100644 index 000000000..0d9f2f06a --- /dev/null +++ b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/uddi/actions/SelectSubQueryItemAction.java @@ -0,0 +1,226 @@ +/******************************************************************************* + * Copyright (c) 2004 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.wst.ws.internal.explorer.platform.uddi.actions; + +import org.eclipse.wst.ws.internal.explorer.platform.constants.*; +import org.eclipse.wst.ws.internal.explorer.platform.datamodel.*; +import org.eclipse.wst.ws.internal.explorer.platform.perspective.*; +import org.eclipse.wst.ws.internal.explorer.platform.uddi.constants.*; +import org.eclipse.wst.ws.internal.explorer.platform.uddi.perspective.*; + +import org.uddi4j.datatype.business.BusinessEntity; +import org.uddi4j.datatype.service.BusinessService; +import org.uddi4j.datatype.tmodel.TModel; + +import javax.servlet.http.*; + +import java.util.*; + +public class SelectSubQueryItemAction extends SelectPropertiesToolAction +{ + private boolean requiresTreeViewRefresh_; + private boolean requiresViewSelection_; + private boolean newUUIDQueryCreated_; + private String itemName_; + public SelectSubQueryItemAction(Controller controller) + { + super(controller); + requiresTreeViewRefresh_ = false; + requiresViewSelection_ = false; + newUUIDQueryCreated_ = false; + itemName_ = null; + } + + // /uddi/actions/SelectSubQueryItemAction.jsp?nodeId=...&toolId=...<&viewId=...>&subQueryKey=...&subQueryListKey=...&subQueryListItemId=...&queryItem=...<&isHistory=1> + public static final String getActionLink(int nodeId,int toolId,int viewId,String subQueryKey,String subQueryListKey,int subQueryListItemId,int queryItem,boolean forHistory) + { + StringBuffer actionLink = new StringBuffer("uddi/actions/SelectSubQueryItemActionJSP.jsp?"); + actionLink.append(ActionInputs.NODEID).append('=').append(nodeId); + actionLink.append('&').append(ActionInputs.TOOLID).append('=').append(toolId); + if (viewId != ActionInputs.VIEWID_DEFAULT) + actionLink.append('&').append(ActionInputs.VIEWID).append('=').append(viewId); + actionLink.append('&').append(UDDIActionInputs.SUBQUERY_KEY).append('=').append(subQueryKey); + actionLink.append('&').append(UDDIActionInputs.SUBQUERY_LIST_KEY).append('=').append(subQueryListKey); + actionLink.append('&').append(UDDIActionInputs.SUBQUERY_LIST_ITEMID).append('=').append(subQueryListItemId); + actionLink.append('&').append(UDDIActionInputs.QUERY_ITEM).append('=').append(queryItem); + + if (forHistory) + actionLink.append('&').append(ActionInputs.ISHISTORY).append("=1"); + return actionLink.toString(); + } + + public boolean processLinkParameters(HttpServletRequest request) + { + boolean result = super.processLinkParameters(request); + String subQueryKey = request.getParameter(UDDIActionInputs.SUBQUERY_KEY); + String subQueryListKey = request.getParameter(UDDIActionInputs.SUBQUERY_LIST_KEY); + String subQueryListItemId = request.getParameter(UDDIActionInputs.SUBQUERY_LIST_ITEMID); + String queryItemString = request.getParameter(UDDIActionInputs.QUERY_ITEM); + + if (subQueryKey != null) + propertyTable_.put(UDDIActionInputs.SUBQUERY_KEY,subQueryKey); + + if (subQueryListKey != null) + propertyTable_.put(UDDIActionInputs.SUBQUERY_LIST_KEY,subQueryListKey); + + if (subQueryListItemId != null) + propertyTable_.put(UDDIActionInputs.SUBQUERY_LIST_ITEMID,subQueryListItemId); + + if (queryItemString != null) + propertyTable_.put(UDDIActionInputs.QUERY_ITEM,queryItemString); + return result; + } + + private final boolean findByUUID() + { + Node currentNode = nodeManager_.getSelectedNode(); + FormTool formTool = (FormTool)(currentNode.getCurrentToolManager().getSelectedTool()); + FormToolPropertiesInterface formToolPI = ((MultipleFormToolPropertiesInterface)formTool).getFormToolProperties((String)propertyTable_.get(UDDIActionInputs.SUBQUERY_KEY)); + Vector list = (Vector)formToolPI.getProperty((String)propertyTable_.get(UDDIActionInputs.SUBQUERY_LIST_KEY)); + ListElement listElement = (ListElement)list.elementAt(Integer.parseInt((String)propertyTable_.get(UDDIActionInputs.SUBQUERY_LIST_ITEMID))); + int queryItem = Integer.parseInt((String)propertyTable_.get(UDDIActionInputs.QUERY_ITEM)); + FindAction findAction = null; + String uuidKey = null; + String uuidKeyValue = null; + switch (queryItem) + { + case UDDIActionInputs.QUERY_ITEM_BUSINESSES: + findAction = new RegFindBusinessUUIDAction(controller_); + uuidKey = UDDIActionInputs.QUERY_INPUT_UUID_BUSINESS_KEY; + BusinessEntity sp = (BusinessEntity)listElement.getObject(); + uuidKeyValue = sp.getBusinessKey(); + itemName_ = sp.getDefaultNameString(); + break; + case UDDIActionInputs.QUERY_ITEM_SERVICES: + findAction = new RegFindServiceUUIDAction(controller_); + uuidKey = UDDIActionInputs.QUERY_INPUT_UUID_SERVICE_KEY; + BusinessService bs = (BusinessService)listElement.getObject(); + uuidKeyValue = bs.getServiceKey(); + itemName_ = bs.getDefaultNameString(); + break; + case UDDIActionInputs.QUERY_ITEM_SERVICE_INTERFACES: + default: + findAction = new RegFindServiceInterfaceUUIDAction(controller_); + uuidKey = UDDIActionInputs.QUERY_INPUT_UUID_SERVICE_INTERFACE_KEY; + TModel tModel = (TModel)listElement.getObject(); + uuidKeyValue = tModel.getTModelKey(); + itemName_ = tModel.getNameString(); + } + Hashtable propertyTable = findAction.getPropertyTable(); + propertyTable.put(UDDIActionInputs.QUERY_NAME,uuidKeyValue); + propertyTable.put(uuidKey,uuidKeyValue); + boolean result = findAction.run(); + if (result) + { + Node itemNode = nodeManager_.getSelectedNode(); + int nodeId = itemNode.getNodeId(); + int toolId = itemNode.getToolManager().getSelectedToolId(); + int viewId = ActionInputs.VIEWID_DEFAULT; + int viewToolId = ActionInputs.VIEWTOOLID_DEFAULT; + propertyTable_.put(ActionInputs.NODEID,String.valueOf(nodeId)); + propertyTable_.put(ActionInputs.TOOLID,String.valueOf(toolId)); + propertyTable_.put(ActionInputs.VIEWID,String.valueOf(viewId)); + propertyTable_.put(ActionInputs.VIEWTOOLID,String.valueOf(viewToolId)); + super.run(); + requiresTreeViewRefresh_ = true; + requiresViewSelection_ = true; + newUUIDQueryCreated_ = true; + listElement.setTargetViewToolInfo(nodeId,toolId,viewId); + return true; + } + else + { + // The item is no longer in the registry. + return false; + } + } + + public final String getItemName() + { + return itemName_; + } + + public boolean run() + { + // Given the nodeId, toolId and viewId, check if the node or view is stale. + int nodeId = Integer.parseInt((String)propertyTable_.get(ActionInputs.NODEID)); + int toolId = Integer.parseInt((String)propertyTable_.get(ActionInputs.TOOLID)); + int viewId = ActionInputs.VIEWID_DEFAULT; + try + { + viewId = Integer.parseInt((String)propertyTable_.get(ActionInputs.VIEWID)); + } + catch (NumberFormatException e) + { + } + int viewToolId = 0; + if (!isStaleNode(nodeId)) + { + // Enusre the node is visible. + requiresTreeViewRefresh_ = makeNodeVisible(nodeManager_.getNode(nodeId)); + + Node node = nodeManager_.getNode(nodeId); + if (viewId != ActionInputs.VIEWID_DEFAULT) + { + ViewTool viewTool = (ViewTool)(node.getToolManager().getTool(toolId)); + ToolManager elementToolManager = viewTool.getToolManager(viewId); + if (elementToolManager != null) + viewToolId = elementToolManager.getSelectedToolId(); + else + { + // Stale view + return findByUUID(); + } + } + propertyTable_.put(ActionInputs.VIEWTOOLID,String.valueOf(viewToolId)); + return super.run(); + } + else + { + // Stale node + return findByUUID(); + } + } + + protected String getActionLinkForHistory() + { + int nodeId = selectedNode_.getNodeId(); + int toolId = selectedTool_.getToolId(); + int viewId = selectedNode_.getViewId(); + int viewToolId = selectedNode_.getViewToolId(); + return SelectPropertiesToolAction.getActionLink(nodeId,toolId,viewId,viewToolId,true); + } + + public boolean requiresTreeViewRefresh() + { + return super.requiresTreeViewRefresh()|requiresTreeViewRefresh_; + } + + public boolean requiresViewSelection() + { + return super.requiresViewSelection()|requiresViewSelection_; + } + + public boolean requiresStatusUpdate() + { + return newUUIDQueryCreated_; + } + + public final String getStatusContentVar() + { + return "statusContent"; + } + + public final String getStatusContentPage() + { + return "uddi/status_content.jsp"; + } +} diff --git a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/uddi/actions/ServiceGetBusinessAction.java b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/uddi/actions/ServiceGetBusinessAction.java new file mode 100644 index 000000000..9b0987f8c --- /dev/null +++ b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/uddi/actions/ServiceGetBusinessAction.java @@ -0,0 +1,74 @@ +/******************************************************************************* + * Copyright (c) 2001, 2004 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ + +package org.eclipse.wst.ws.internal.explorer.platform.uddi.actions; + +import org.eclipse.wst.ws.internal.explorer.platform.actions.*; +import org.eclipse.wst.ws.internal.explorer.platform.constants.*; +import org.eclipse.wst.ws.internal.explorer.platform.perspective.*; +import org.eclipse.wst.ws.internal.explorer.platform.uddi.constants.*; +import org.eclipse.wst.ws.internal.explorer.platform.uddi.datamodel.*; +import org.eclipse.wst.ws.internal.explorer.platform.uddi.perspective.*; + +import org.uddi4j.datatype.service.*; + +import java.util.*; + +public class ServiceGetBusinessAction extends NodeAction +{ + private ServiceNode serviceNode_; + public ServiceGetBusinessAction(Controller controller) + { + super(controller,controller.getUDDIPerspective().getNavigatorManager()); + serviceNode_ = null; + } + + // uddi/actions/ServiceGetBusinessActionJSP.jsp?nodeId=... + public static String getActionLink(int nodeId) + { + StringBuffer actionLink = new StringBuffer("uddi/actions/ServiceGetBusinessActionJSP.jsp?"); + actionLink.append(ActionInputs.NODEID).append('=').append(nodeId); + return actionLink.toString(); + } + + public final boolean validateService() + { + int serviceNodeId = Integer.parseInt((String)propertyTable_.get(ActionInputs.NODEID)); + serviceNode_ = (ServiceNode)nodeManager_.getNode(serviceNodeId); + ServiceElement serviceElement = (ServiceElement)serviceNode_.getTreeElement(); + RegFindServiceUUIDAction verifyAction = new RegFindServiceUUIDAction(controller_); + Hashtable propertyTable = verifyAction.getPropertyTable(); + propertyTable.put(UDDIActionInputs.QUERY_INPUT_OVERRIDE_ADD_QUERY_NODE,Boolean.TRUE); + propertyTable.put(UDDIActionInputs.QUERY_INPUT_UUID_SERVICE_KEY,serviceElement.getBusinessService().getServiceKey()); + boolean result = verifyAction.run(); + if (result) + propertyTable_.put(UDDIActionInputs.LATEST_OBJECT,propertyTable.get(UDDIActionInputs.LATEST_OBJECT)); + return result; + } + + public final String getActionLinkForHistory() + { + return null; + } + + public final boolean run() + { + UDDIPerspective uddiPerspective = controller_.getUDDIPerspective(); + BusinessService bs = (BusinessService)propertyTable_.get(UDDIActionInputs.LATEST_OBJECT); + + RegFindBusinessUUIDAction action = new RegFindBusinessUUIDAction(controller_); + Hashtable propertyTable = action.getPropertyTable(); + propertyTable.put(UDDIActionInputs.QUERY_NAME,uddiPerspective.getMessage("NODE_NAME_SERVICE_BUSINESS",serviceNode_.getNodeName())); + propertyTable.put(UDDIActionInputs.QUERY_INPUT_UUID_BUSINESS_KEY,bs.getBusinessKey()); + + return action.run(); + } +} diff --git a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/uddi/actions/ServiceGetServiceInterfacesAction.java b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/uddi/actions/ServiceGetServiceInterfacesAction.java new file mode 100644 index 000000000..22ced4ccb --- /dev/null +++ b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/uddi/actions/ServiceGetServiceInterfacesAction.java @@ -0,0 +1,78 @@ +/******************************************************************************* + * Copyright (c) 2001, 2004 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ + +package org.eclipse.wst.ws.internal.explorer.platform.uddi.actions; + +import org.eclipse.wst.ws.internal.explorer.platform.constants.*; +import org.eclipse.wst.ws.internal.explorer.platform.datamodel.*; +import org.eclipse.wst.ws.internal.explorer.platform.perspective.*; +import org.eclipse.wst.ws.internal.explorer.platform.uddi.constants.*; +import org.eclipse.wst.ws.internal.explorer.platform.uddi.datamodel.*; +import org.eclipse.wst.ws.internal.explorer.platform.uddi.perspective.*; + +import org.uddi4j.datatype.service.*; + +import java.util.*; + +public class ServiceGetServiceInterfacesAction extends UDDINodeAction +{ + private ServiceNode serviceNode_; + public ServiceGetServiceInterfacesAction(Controller controller) + { + super(controller); + serviceNode_ = null; + } + + // uddi/actions/ServiceGetServiceInterfacesActionJSP.jsp?nodeId=... + public static String getActionLink(int nodeId) + { + StringBuffer actionLink = new StringBuffer("uddi/actions/ServiceGetServiceInterfacesActionJSP.jsp?"); + actionLink.append(ActionInputs.NODEID).append('=').append(nodeId); + return actionLink.toString(); + } + + public final boolean validateService() + { + int serviceNodeId = Integer.parseInt((String)propertyTable_.get(ActionInputs.NODEID)); + serviceNode_ = (ServiceNode)nodeManager_.getNode(serviceNodeId); + ServiceElement serviceElement = (ServiceElement)serviceNode_.getTreeElement(); + RegFindServiceUUIDAction verifyAction = new RegFindServiceUUIDAction(controller_); + Hashtable propertyTable = verifyAction.getPropertyTable(); + propertyTable.put(UDDIActionInputs.QUERY_INPUT_OVERRIDE_ADD_QUERY_NODE,Boolean.TRUE); + propertyTable.put(UDDIActionInputs.QUERY_INPUT_UUID_SERVICE_KEY,serviceElement.getBusinessService().getServiceKey()); + boolean result = verifyAction.run(); + if (result) + propertyTable_.put(UDDIActionInputs.LATEST_OBJECT,propertyTable.get(UDDIActionInputs.LATEST_OBJECT)); + return result; + } + + public final String getActionLinkForHistory() + { + return null; + } + + public final boolean run() + { + UDDIPerspective uddiPerspective = controller_.getUDDIPerspective(); + BusinessService bs = (BusinessService)propertyTable_.get(UDDIActionInputs.LATEST_OBJECT); + RegFindServiceInterfacesAdvancedAction action = new RegFindServiceInterfacesAdvancedAction(controller_); + Hashtable propertyTable = action.getPropertyTable(); + propertyTable.put(UDDIActionInputs.QUERY_NAME,uddiPerspective.getMessage("NODE_NAME_SERVICE_SERVICE_INTERFACES",serviceNode_.getNodeName())); + propertyTable.put(UDDIActionInputs.QUERY_INPUT_ADVANCED_SERVICE_INTERFACE_USE_SERVICE,Boolean.TRUE); + ListElement serviceListElement = new ListElement(bs); + serviceListElement.setTargetViewToolInfo(serviceNode_.getNodeId(),serviceNode_.getToolManager().getSelectedToolId(),serviceNode_.getViewId()); + Vector serviceListVector = new Vector(); + serviceListVector.addElement(serviceListElement); + propertyTable.put(UDDIActionInputs.QUERY_INPUT_ADVANCED_SERVICE_INTERFACE_SERVICE,serviceListVector); + propertyTable.put(UDDIActionInputs.QUERY_INPUT_ADVANCED_SERVICE_INTERFACE_BUSINESS_SERVICE,bs); + return action.run(); + } +} diff --git a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/uddi/actions/ServiceInterfaceGetBusinessesAction.java b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/uddi/actions/ServiceInterfaceGetBusinessesAction.java new file mode 100644 index 000000000..8187288a7 --- /dev/null +++ b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/uddi/actions/ServiceInterfaceGetBusinessesAction.java @@ -0,0 +1,85 @@ +/******************************************************************************* + * Copyright (c) 2001, 2004 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ + +package org.eclipse.wst.ws.internal.explorer.platform.uddi.actions; + +import org.eclipse.wst.ws.internal.explorer.platform.constants.*; +import org.eclipse.wst.ws.internal.explorer.platform.datamodel.*; +import org.eclipse.wst.ws.internal.explorer.platform.perspective.*; +import org.eclipse.wst.ws.internal.explorer.platform.uddi.constants.*; +import org.eclipse.wst.ws.internal.explorer.platform.uddi.datamodel.*; +import org.eclipse.wst.ws.internal.explorer.platform.uddi.perspective.*; + +import org.uddi4j.datatype.tmodel.*; +import org.uddi4j.util.*; + +import java.util.*; + +public class ServiceInterfaceGetBusinessesAction extends UDDINodeAction +{ + private ServiceInterfaceNode siNode_; + public ServiceInterfaceGetBusinessesAction(Controller controller) + { + super(controller); + siNode_ = null; + } + + // uddi/actions/ServiceInterfacGetBusinessesActionJSP.jsp?nodeId=... + public static String getActionLink(int nodeId) + { + StringBuffer actionLink = new StringBuffer("uddi/actions/ServiceInterfaceGetBusinessesActionJSP.jsp?"); + actionLink.append(ActionInputs.NODEID).append('=').append(nodeId); + return actionLink.toString(); + } + + public final boolean validateServiceInterface() + { + int siNodeId = Integer.parseInt((String)propertyTable_.get(ActionInputs.NODEID)); + siNode_ = (ServiceInterfaceNode)nodeManager_.getNode(siNodeId); + ServiceInterfaceElement siElement = (ServiceInterfaceElement)siNode_.getTreeElement(); + RegFindServiceInterfaceUUIDAction verifyAction = new RegFindServiceInterfaceUUIDAction(controller_); + Hashtable propertyTable = verifyAction.getPropertyTable(); + propertyTable.put(UDDIActionInputs.QUERY_INPUT_OVERRIDE_ADD_QUERY_NODE,Boolean.TRUE); + propertyTable.put(UDDIActionInputs.QUERY_INPUT_UUID_SERVICE_INTERFACE_KEY,siElement.getTModel().getTModelKey()); + boolean result = verifyAction.run(); + if (result) + propertyTable_.put(UDDIActionInputs.LATEST_OBJECT,propertyTable.get(UDDIActionInputs.LATEST_OBJECT)); + return result; + } + + public final String getActionLinkForHistory() + { + return null; + } + + public final boolean run() + { + UDDIPerspective uddiPerspective = controller_.getUDDIPerspective(); + TModel tModel = (TModel)propertyTable_.get(UDDIActionInputs.LATEST_OBJECT); + + RegFindBusinessesAdvancedAction action = new RegFindBusinessesAdvancedAction(controller_); + Hashtable propertyTable = action.getPropertyTable(); + propertyTable.put(UDDIActionInputs.QUERY_NAME,uddiPerspective.getMessage("NODE_NAME_SI_BUSINESSES",siNode_.getNodeName())); + + ListElement siListElement = new ListElement(tModel); + siListElement.setTargetViewToolInfo(siNode_.getNodeId(),siNode_.getToolManager().getSelectedToolId(),siNode_.getViewId()); + Vector siListVector = new Vector(); + siListVector.addElement(siListElement); + propertyTable.put(UDDIActionInputs.QUERY_INPUT_ADVANCED_BUSINESS_SERVICE_INTERFACES,siListVector); + + Vector tModelKeyStringVector = new Vector(); + tModelKeyStringVector.addElement(tModel.getTModelKey()); + TModelBag tModelBag = new TModelBag(tModelKeyStringVector); + propertyTable.put(UDDIActionInputs.QUERY_INPUT_ADVANCED_BUSINESS_TMODELBAG,tModelBag); + + return action.run(); + } +} diff --git a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/uddi/actions/ServiceInterfaceGetServicesAction.java b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/uddi/actions/ServiceInterfaceGetServicesAction.java new file mode 100644 index 000000000..52cbeea5e --- /dev/null +++ b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/uddi/actions/ServiceInterfaceGetServicesAction.java @@ -0,0 +1,85 @@ +/******************************************************************************* + * Copyright (c) 2001, 2004 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ + +package org.eclipse.wst.ws.internal.explorer.platform.uddi.actions; + +import org.eclipse.wst.ws.internal.explorer.platform.constants.*; +import org.eclipse.wst.ws.internal.explorer.platform.datamodel.*; +import org.eclipse.wst.ws.internal.explorer.platform.perspective.*; +import org.eclipse.wst.ws.internal.explorer.platform.uddi.constants.*; +import org.eclipse.wst.ws.internal.explorer.platform.uddi.datamodel.*; +import org.eclipse.wst.ws.internal.explorer.platform.uddi.perspective.*; + +import org.uddi4j.datatype.tmodel.*; +import org.uddi4j.util.*; + +import java.util.*; + +public class ServiceInterfaceGetServicesAction extends UDDINodeAction +{ + private ServiceInterfaceNode siNode_; + public ServiceInterfaceGetServicesAction(Controller controller) + { + super(controller); + siNode_ = null; + } + + // uddi/actions/ServiceInterfacGetServicesActionJSP.jsp?nodeId=... + public static String getActionLink(int nodeId) + { + StringBuffer actionLink = new StringBuffer("uddi/actions/ServiceInterfaceGetServicesActionJSP.jsp?"); + actionLink.append(ActionInputs.NODEID).append('=').append(nodeId); + return actionLink.toString(); + } + + public final boolean validateServiceInterface() + { + int siNodeId = Integer.parseInt((String)propertyTable_.get(ActionInputs.NODEID)); + siNode_ = (ServiceInterfaceNode)nodeManager_.getNode(siNodeId); + ServiceInterfaceElement siElement = (ServiceInterfaceElement)siNode_.getTreeElement(); + RegFindServiceInterfaceUUIDAction verifyAction = new RegFindServiceInterfaceUUIDAction(controller_); + Hashtable propertyTable = verifyAction.getPropertyTable(); + propertyTable.put(UDDIActionInputs.QUERY_INPUT_OVERRIDE_ADD_QUERY_NODE,Boolean.TRUE); + propertyTable.put(UDDIActionInputs.QUERY_INPUT_UUID_SERVICE_INTERFACE_KEY,siElement.getTModel().getTModelKey()); + boolean result = verifyAction.run(); + if (result) + propertyTable_.put(UDDIActionInputs.LATEST_OBJECT,propertyTable.get(UDDIActionInputs.LATEST_OBJECT)); + return result; + } + + public final String getActionLinkForHistory() + { + return null; + } + + public final boolean run() + { + UDDIPerspective uddiPerspective = controller_.getUDDIPerspective(); + TModel tModel = (TModel)propertyTable_.get(UDDIActionInputs.LATEST_OBJECT); + + RegFindServicesAdvancedAction action = new RegFindServicesAdvancedAction(controller_); + Hashtable propertyTable = action.getPropertyTable(); + propertyTable.put(UDDIActionInputs.QUERY_NAME,uddiPerspective.getMessage("NODE_NAME_SI_SERVICES",siNode_.getNodeName())); + + ListElement siListElement = new ListElement(tModel); + siListElement.setTargetViewToolInfo(siNode_.getNodeId(),siNode_.getToolManager().getSelectedToolId(),siNode_.getViewId()); + Vector siListVector = new Vector(); + siListVector.addElement(siListElement); + propertyTable.put(UDDIActionInputs.QUERY_INPUT_ADVANCED_SERVICE_SERVICE_INTERFACES,siListVector); + + Vector tModelKeyStringVector = new Vector(); + tModelKeyStringVector.addElement(tModel.getTModelKey()); + TModelBag tModelBag = new TModelBag(tModelKeyStringVector); + propertyTable.put(UDDIActionInputs.QUERY_INPUT_ADVANCED_SERVICE_TMODELBAG,tModelBag); + + return action.run(); + } +} diff --git a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/uddi/actions/ShowPublisherAssertionsAction.java b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/uddi/actions/ShowPublisherAssertionsAction.java new file mode 100644 index 000000000..886bc99bf --- /dev/null +++ b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/uddi/actions/ShowPublisherAssertionsAction.java @@ -0,0 +1,408 @@ +/******************************************************************************* + * Copyright (c) 2001, 2004 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ + +package org.eclipse.wst.ws.internal.explorer.platform.uddi.actions; + +import org.eclipse.wst.ws.internal.explorer.platform.datamodel.*; +import org.eclipse.wst.ws.internal.explorer.platform.perspective.*; +import org.eclipse.wst.ws.internal.explorer.platform.uddi.constants.*; +import org.eclipse.wst.ws.internal.explorer.platform.uddi.datamodel.*; +import org.eclipse.wst.ws.internal.explorer.platform.uddi.perspective.*; +import org.eclipse.wst.ws.internal.explorer.platform.util.*; + +import org.uddi4j.UDDIException; +import org.uddi4j.transport.TransportException; +import org.uddi4j.util.*; +import org.uddi4j.response.*; +import org.uddi4j.datatype.business.BusinessEntity; +import org.uddi4j.client.UDDIProxy; + +import java.util.*; +import java.net.*; + +public class ShowPublisherAssertionsAction extends CommonPublisherAssertionsAction +{ + + protected String subQueryKey_; + protected boolean isSubQueryGet_; + protected boolean subQueryInitiated_; + protected String newSubQuery_; + protected String newSubQueryItem_; + + public ShowPublisherAssertionsAction(Controller controller) + { + super(controller); + + subQueryKey_ = null; + isSubQueryGet_ = false; + subQueryInitiated_ = false; + } + + protected final boolean processParsedResults(MultipartFormDataParser parser) throws MultipartFormDataException + { + if (registryNode_ == null) + return false; + + // ids from uddiObjects_table + String[] selectedBusIds = parser.getParameterValues(UDDIActionInputs.PUBLISHER_ASSERTIONS_SELECTED_BUS_ID); + if (selectedBusIds != null && selectedBusIds.length > 0) + propertyTable_.put(UDDIActionInputs.PUBLISHER_ASSERTIONS_SELECTED_BUS_ID, selectedBusIds); + + newSubQuery_ = parser.getParameter(UDDIActionInputs.NEW_SUBQUERY_INITIATED); + String isSubQueryGetString = parser.getParameter(UDDIActionInputs.SUBQUERY_GET); + newSubQueryItem_ = parser.getParameter(UDDIActionInputs.NEW_SUBQUERY_QUERY_ITEM); + subQueryKey_ = parser.getParameter(UDDIActionInputs.SUBQUERY_KEY); + + // Validate the data. + UDDIPerspective uddiPerspective = controller_.getUDDIPerspective(); + FormTool formTool = getSelectedFormTool(); + FormToolPropertiesInterface formToolPI = ((MultipleFormToolPropertiesInterface)formTool).getFormToolProperties(subQueryKey_); + formToolPI.clearErrors(); + + if (newSubQuery_ != null && newSubQuery_.length() > 0) + subQueryInitiated_ = true; + else + subQueryInitiated_ = false; + + if (isSubQueryGetString != null) + isSubQueryGet_ = Boolean.valueOf(isSubQueryGetString).booleanValue(); + + // if not yet logged in, validate the parameters needed to log in + // NOTE: This action does NOT require the user to be logged in. + if (!isLoggedIn_) { + String publishURL = parser.getParameter(UDDIActionInputs.QUERY_INPUT_ADVANCED_PUBLISH_URL); + String userID = parser.getParameter(UDDIActionInputs.QUERY_INPUT_ADVANCED_USERID); + String password = parser.getParameter(UDDIActionInputs.QUERY_INPUT_ADVANCED_PASSWORD); + + if (publishURL != null) + { + propertyTable_.put(UDDIActionInputs.QUERY_INPUT_ADVANCED_PUBLISH_URL,publishURL); + formTool.setProperty(UDDIActionInputs.QUERY_INPUT_ADVANCED_PUBLISH_URL,publishURL); + } + + if (userID != null) + { + propertyTable_.put(UDDIActionInputs.QUERY_INPUT_ADVANCED_USERID,userID); + formTool.setProperty(UDDIActionInputs.QUERY_INPUT_ADVANCED_USERID,userID); + } + + if (password != null) + { + propertyTable_.put(UDDIActionInputs.QUERY_INPUT_ADVANCED_PASSWORD,password); + formTool.setProperty(UDDIActionInputs.QUERY_INPUT_ADVANCED_PASSWORD,password); + } + } + + return true; + } + + public final boolean isSubQueryInitiated() + { + return subQueryInitiated_; + } + + public final boolean isSubQueryGet() + { + return isSubQueryGet_; + } + + public final String getSubQueryKey() + { + return subQueryKey_; + } + + public final String getNewSubQuery() + { + return newSubQuery_; + } + + public final String getNewSubQueryItem() + { + return newSubQueryItem_; + } + + public boolean run() + { + // Synchronize client view and server model (uddiObject_table.jsp) + synchronizeUDDIObjectTable(); + + if (registryNode_ == null) + return false; + + RegistryElement registryElement = (RegistryElement)registryNode_.getTreeElement(); + UDDIPerspective uddiPerspective = controller_.getUDDIPerspective(); + MessageQueue messageQueue = uddiPerspective.getMessageQueue(); + NodeManager navigatorManager = uddiPerspective.getNavigatorManager(); + Node selectedNode = navigatorManager.getSelectedNode(); + TreeElement selectedElement = selectedNode.getTreeElement(); + + if (!(selectedElement instanceof BusinessElement)) + return false; + + // if not yet logged in, log in first + if (!isLoggedIn_) { + String publishURL = (String)propertyTable_.get(UDDIActionInputs.QUERY_INPUT_ADVANCED_PUBLISH_URL); + String userID = (String)propertyTable_.get(UDDIActionInputs.QUERY_INPUT_ADVANCED_USERID); + String password = (String)propertyTable_.get(UDDIActionInputs.QUERY_INPUT_ADVANCED_PASSWORD); + + try { + if (Validator.validateURL(publishURL) && + Validator.validateString(userID) && + password != null) { + registryElement.performLogin(publishURL, userID, password); + isLoggedIn_ = registryElement.isLoggedIn(); + } + } + catch (TransportException te) { + messageQueue.addMessage(controller_.getMessage("MSG_ERROR_UNEXPECTED")); + messageQueue.addMessage("TransportException"); + messageQueue.addMessage(te.getMessage()); + return false; + } + catch (UDDIException uddie) { + messageQueue.addMessage(controller_.getMessage("MSG_ERROR_UNEXPECTED")); + messageQueue.addMessage("UDDIException"); + messageQueue.addMessage(uddie.toString()); + return false; + } + catch (MalformedURLException me) { + messageQueue.addMessage(controller_.getMessage("MSG_ERROR_UNEXPECTED")); + messageQueue.addMessage("MalformedURLException"); + messageQueue.addMessage(me.getMessage()); + return false; + } + } + + // show all assertion iff is logged in and business is owned + // else show only completed ones + BusinessElement busElement = (BusinessElement)selectedElement; + if (isLoggedIn_ && isBusinessOwned(busElement)) + return showPublisherAssertionsForOwnedBus(busElement); + else + return showPublisherAssertionsForNonOwnedBus(busElement); + } + + private boolean showPublisherAssertionsForOwnedBus(BusinessElement busElement) { + UDDIPerspective uddiPerspective = controller_.getUDDIPerspective(); + MessageQueue messageQueue = uddiPerspective.getMessageQueue(); + + // try to get a list of all publisher assertion based on the current registry's authToken + ListManager listManager = new ListManager(); + FormTool formTool = getSelectedFormTool(); + FormToolPropertiesInterface formToolPI = ((MultipleFormToolPropertiesInterface)formTool).getFormToolProperties(subQueryKey_); + formToolPI.removeProperty(UDDIActionInputs.QUERY_INPUT_EXISTING_PUBLISHER_ASSERTIONS); + Vector queryInputVector = new Vector(); + RegistryElement registryElement = (RegistryElement)registryNode_.getTreeElement(); + String userID = registryElement.getUserId(); + String cred = registryElement.getCred(); + + // show all publisher assertions + UDDIProxy proxy = ((RegistryElement)registryNode_.getTreeElement()).getProxy(); + AssertionStatusReport assertionReport; + try { + assertionReport = proxy.get_assertionStatusReport(registryElement.getAuthInfoString(), (CompletionStatus)null); + } + catch (UDDIException uddie) { + messageQueue.addMessage(controller_.getMessage("MSG_ERROR_UNEXPECTED")); + messageQueue.addMessage("UDDIException"); + DispositionReport report = uddie.getDispositionReport(); + Vector reportErrInfo = report.getResultVector(); + for (int i = 0; i < reportErrInfo.size(); i++) { + messageQueue.addMessage(((Result) reportErrInfo.get(i)).getErrInfo().getText()); + } + return false; + } + catch (Exception e) { + messageQueue.addMessage(controller_.getMessage("MSG_ERROR_UNEXPECTED")); + messageQueue.addMessage("Exception"); + messageQueue.addMessage(e.getMessage()); + return false; + } + Vector assertionVector = assertionReport.getAssertionStatusItemVector(); + Vector otherBusinessKeys = new Vector(); + Vector pubAssertionElements = new Vector(); + + for (int i = 0; i < assertionVector.size(); i++) { + AssertionStatusItem assertionItem = (AssertionStatusItem)assertionVector.elementAt(i); + // determine the from/to business keys + String fromKey = assertionItem.getFromKey().getText(); + String toKey = assertionItem.getToKey().getText(); + String owningBusinessKey = busElement.getBusinessEntity().getBusinessKey(); + // ignore this assertion if neither the from key nor the to key equals to this business's key + if (!owningBusinessKey.equals(fromKey) && !owningBusinessKey.equals(toKey)) + continue; + String otherBusinessKey = ((owningBusinessKey.equals(fromKey)) ? toKey : fromKey); + // retrieve the information of the "other business" + otherBusinessKeys.add(otherBusinessKey); + + // retrieve the status of the publisher assertion + String status = assertionItem.getCompletionStatus().getText(); + KeyedReference keyedRef = assertionItem.getKeyedReference(); + PublisherAssertionElement pubAssertionElement = new PublisherAssertionElement( + fromKey, + toKey, + owningBusinessKey, + null, + -1, + status, + keyedRef); + pubAssertionElements.add(pubAssertionElement); + } + if (otherBusinessKeys.size() > 0) { + Vector busEntities; + try { + busEntities = proxy.get_businessDetail(otherBusinessKeys).getBusinessEntityVector(); + } + catch (Exception ex) { + busEntities = new Vector(); + if (otherBusinessKeys.size() > 1) { + for (int j = 0; j < otherBusinessKeys.size(); j++) { + try { + busEntities.add(proxy.get_businessDetail((String)otherBusinessKeys.get(j)).getBusinessEntityVector().get(0)); + } + catch (Exception exception) { + pubAssertionElements.remove(j); + } + } + } + else + pubAssertionElements.remove(0); + } + for (int j = 0; j < busEntities.size(); j++) { + BusinessEntity be = (BusinessEntity)busEntities.get(j); + PublisherAssertionElement pubAssertionElement = (PublisherAssertionElement)pubAssertionElements.get(j); + ListElement le = new ListElement(be); + queryInputVector.add(le); + int subQueryItemId = queryInputVector.indexOf(le); + pubAssertionElement.setServiceProvider(le); + pubAssertionElement.setSubQueryItemId(subQueryItemId); + listManager.add(new ListElement(pubAssertionElement)); + } + } + busElement.setPublisherAssertions(listManager); + formToolPI.setProperty(UDDIActionInputs.QUERY_INPUT_EXISTING_PUBLISHER_ASSERTIONS, queryInputVector); + messageQueue.addMessage(uddiPerspective.getMessage("MSG_INFO_PUBLISHER_ASSERTIONS_REFRESHED")); + return true; + } + + private boolean showPublisherAssertionsForNonOwnedBus(BusinessElement busElement) { + UDDIPerspective uddiPerspective = controller_.getUDDIPerspective(); + MessageQueue messageQueue = uddiPerspective.getMessageQueue(); + + // try to get a list of publisher assertions based on the business key + ListManager listManager = new ListManager(); + FormTool formTool = getSelectedFormTool(); + FormToolPropertiesInterface formToolPI = ((MultipleFormToolPropertiesInterface)formTool).getFormToolProperties(subQueryKey_); + formToolPI.removeProperty(UDDIActionInputs.QUERY_INPUT_EXISTING_PUBLISHER_ASSERTIONS); + Vector queryInputVector = new Vector(); + UDDIProxy proxy = ((RegistryElement)registryNode_.getTreeElement()).getProxy(); + RelatedBusinessesList relatedBusList; + try { + relatedBusList = proxy.find_relatedBusinesses(busElement.getBusinessEntity().getBusinessKey(), + (KeyedReference)null, + (FindQualifiers)null); + } + catch (UDDIException uddie) { + messageQueue.addMessage(controller_.getMessage("MSG_ERROR_UNEXPECTED")); + messageQueue.addMessage("UDDIException"); + DispositionReport report = uddie.getDispositionReport(); + Vector reportErrInfo = report.getResultVector(); + for (int i = 0; i < reportErrInfo.size(); i++) { + messageQueue.addMessage(((Result) reportErrInfo.get(i)).getErrInfo().getText()); + } + return false; + } + catch (Exception e) { + messageQueue.addMessage(controller_.getMessage("MSG_ERROR_UNEXPECTED")); + messageQueue.addMessage("Exception"); + messageQueue.addMessage(e.getMessage()); + return false; + } + Vector relatedBusVector = relatedBusList.getRelatedBusinessInfos().getRelatedBusinessInfoVector(); + Vector otherBusinessKeys = new Vector(); + Vector pubAssertionElements = new Vector(); + for (int i = 0; i < relatedBusVector.size(); i++) { + RelatedBusinessInfo relatedBusInfo = (RelatedBusinessInfo)relatedBusVector.elementAt(i); + // determine the from/to business keys + String fromKey; + String toKey; + String owningBusinessKey; + ListElement sp; + if (relatedBusInfo.getDefaultSharedRelationships().getDirection().equals(SharedRelationships.DIRECTION_FROMKEY)) { + fromKey = busElement.getBusinessEntity().getBusinessKey(); + toKey = relatedBusInfo.getBusinessKey(); + owningBusinessKey = fromKey; + otherBusinessKeys.add(toKey); + } + else { + fromKey = relatedBusInfo.getBusinessKey(); + toKey = busElement.getBusinessEntity().getBusinessKey(); + owningBusinessKey = toKey; + otherBusinessKeys.add(fromKey); + } + + Vector keyedRefVector = relatedBusInfo.getDefaultSharedRelationships().getKeyedReferenceVector(); + PublisherAssertionElement[] pubAssertionElementArray = new PublisherAssertionElement[keyedRefVector.size()]; + for (int k = 0; k < keyedRefVector.size(); k++) { + // retrieve the status of the publisher assertion + String status = CompletionStatus.COMPLETE; + KeyedReference keyedRef = (KeyedReference)keyedRefVector.elementAt(k); + PublisherAssertionElement pubAssertionElement = new PublisherAssertionElement( + fromKey, + toKey, + owningBusinessKey, + null, + -1, + status, + keyedRef); + pubAssertionElementArray[k] = pubAssertionElement; + } + pubAssertionElements.add(pubAssertionElementArray); + } + if (otherBusinessKeys.size() > 0) { + Vector busEntities; + try { + busEntities = proxy.get_businessDetail(otherBusinessKeys).getBusinessEntityVector(); + } + catch (Exception ex) { + busEntities = new Vector(); + if (otherBusinessKeys.size() > 1) { + for (int j = 0; j < otherBusinessKeys.size(); j++) { + try { + busEntities.add(proxy.get_businessDetail((String)otherBusinessKeys.get(j)).getBusinessEntityVector().get(0)); + } + catch (Exception exception) { + pubAssertionElements.remove(j); + } + } + } + else + pubAssertionElements.remove(0); + } + for (int j = 0; j < busEntities.size(); j++) { + BusinessEntity be = (BusinessEntity)busEntities.get(j); + ListElement le = new ListElement(be); + queryInputVector.add(le); + int subQueryItemId = queryInputVector.indexOf(le); + PublisherAssertionElement[] pubAssertionElementArray = (PublisherAssertionElement[])pubAssertionElements.get(j); + for (int k = 0; k < pubAssertionElementArray.length; k++) { + pubAssertionElementArray[k].setServiceProvider(le); + pubAssertionElementArray[k].setSubQueryItemId(subQueryItemId); + listManager.add(new ListElement(pubAssertionElementArray[k])); + } + } + } + busElement.setPublisherAssertions(listManager); + formToolPI.setProperty(UDDIActionInputs.QUERY_INPUT_EXISTING_PUBLISHER_ASSERTIONS, queryInputVector); + messageQueue.addMessage(uddiPerspective.getMessage("MSG_INFO_PUBLISHER_ASSERTIONS_REFRESHED")); + return true; + } +} diff --git a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/uddi/actions/SwitchPerspectiveFromUDDIAction.java b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/uddi/actions/SwitchPerspectiveFromUDDIAction.java new file mode 100644 index 000000000..8a142b386 --- /dev/null +++ b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/uddi/actions/SwitchPerspectiveFromUDDIAction.java @@ -0,0 +1,65 @@ +/******************************************************************************* + * Copyright (c) 2001, 2004 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ + +package org.eclipse.wst.ws.internal.explorer.platform.uddi.actions; + +import org.eclipse.wst.ws.internal.explorer.platform.actions.*; +import org.eclipse.wst.ws.internal.explorer.platform.constants.*; +import org.eclipse.wst.ws.internal.explorer.platform.perspective.*; +import org.eclipse.wst.ws.internal.explorer.platform.uddi.constants.*; +import org.eclipse.wst.ws.internal.explorer.platform.uddi.perspective.*; +import org.eclipse.wst.ws.internal.explorer.platform.util.*; + +public final class SwitchPerspectiveFromUDDIAction extends ShowPerspectiveAction +{ + public SwitchPerspectiveFromUDDIAction(Controller controller) + { + super(controller); + } + + protected boolean processParsedResults(MultipartFormDataParser parser) throws MultipartFormDataException + { + String perspectiveContentFramesetCols = parser.getParameter(UDDIActionInputs.FRAMESET_COLS_PERSPECTIVE_CONTENT); + String actionsContainerFramesetRows = parser.getParameter(UDDIActionInputs.FRAMESET_ROWS_ACTIONS_CONTAINER); + if (perspectiveContentFramesetCols != null && actionsContainerFramesetRows != null) + { + propertyTable_.put(UDDIActionInputs.FRAMESET_COLS_PERSPECTIVE_CONTENT,perspectiveContentFramesetCols); + propertyTable_.put(UDDIActionInputs.FRAMESET_ROWS_ACTIONS_CONTAINER,actionsContainerFramesetRows); + return true; + } + return false; + } + + public final boolean run() + { + String perspectiveContentFramesetCols = (String)propertyTable_.get(UDDIActionInputs.FRAMESET_COLS_PERSPECTIVE_CONTENT); + String actionsContainerFramesetRows = (String)propertyTable_.get(UDDIActionInputs.FRAMESET_ROWS_ACTIONS_CONTAINER); + + // Save the frameset sizes iff no frame is maximized. + UDDIPerspective uddiPerspective = controller_.getUDDIPerspective(); + if (!perspectiveContentFramesetCols.startsWith("100%") && !perspectiveContentFramesetCols.endsWith("100%")) + uddiPerspective.setPerspectiveContentFramesetCols(perspectiveContentFramesetCols); + + if (!actionsContainerFramesetRows.startsWith("100%") && !actionsContainerFramesetRows.endsWith("100%")) + uddiPerspective.setActionsContainerFramesetRows(actionsContainerFramesetRows); + + return super.run(); + } + + public static final String getFormActionLink(int targetPerspectiveId,boolean forHistory) + { + StringBuffer formLink = new StringBuffer("uddi/actions/SwitchPerspectiveFromUDDIActionJSP.jsp?"); + formLink.append(ActionInputs.PERSPECTIVE).append('=').append(targetPerspectiveId); + if (forHistory) + formLink.append('&').append(ActionInputs.ISHISTORY).append("=1"); + return formLink.toString(); + } +} diff --git a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/uddi/actions/ToggleCategoryNodeAction.java b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/uddi/actions/ToggleCategoryNodeAction.java new file mode 100644 index 000000000..43272da62 --- /dev/null +++ b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/uddi/actions/ToggleCategoryNodeAction.java @@ -0,0 +1,79 @@ +/******************************************************************************* + * Copyright (c) 2001, 2004 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ + +package org.eclipse.wst.ws.internal.explorer.platform.uddi.actions; + +import org.eclipse.wst.ws.internal.explorer.platform.actions.*; +import org.eclipse.wst.ws.internal.explorer.platform.constants.*; +import org.eclipse.wst.ws.internal.explorer.platform.perspective.*; +import org.eclipse.wst.ws.internal.explorer.platform.uddi.perspective.*; + +public class ToggleCategoryNodeAction extends ToggleNodeAction +{ + public ToggleCategoryNodeAction(Controller controller) + { + super(controller,controller.getUDDIPerspective().getCategoryManager()); + } + + // uddi/actions/ToggleNavigatorNodeAction.jsp?sId=...&nodeId=...&open=... + public static final String getActionLink(String sessionId,int nodeId,boolean open) + { + StringBuffer actionLink = new StringBuffer("uddi/actions/ToggleCategoryNodeActionJSP.jsp?"); + actionLink.append(ActionInputs.SESSIONID).append('=').append(sessionId); + actionLink.append('&').append(ActionInputs.NODEID).append('=').append(nodeId); + actionLink.append('&').append(ActionInputs.OPEN).append('=').append(open?ActionInputs.OPEN_NODE:ActionInputs.CLOSE_NODE); + return actionLink.toString(); + } + + public final boolean run() + { + int nodeId = Integer.parseInt((String)propertyTable_.get(ActionInputs.NODEID)); + performBaseAction(nodeId); + return true; + } + + public final String getActionLinkForHistory() + { + return null; + } + + public final String getTreeContentVar() + { + return "categoryBrowserWindowContent"; + } + + public final String getTreeContentPage() + { + UDDIPerspective uddiPerspective = controller_.getUDDIPerspective(); + return OpenCategoryBrowserAction.getCategoryContentPage(controller_.getSessionId(),uddiPerspective.getCategoryTModelKey()); + } + + public final String getTreeContainerPage() + { + UDDIPerspective uddiPerspective = controller_.getUDDIPerspective(); + return OpenCategoryBrowserAction.getActionLink(controller_.getSessionId(),uddiPerspective.getCategoryTModelKey()); + } + + public final String getPropertiesContainerVar() + { + return null; + } + + public final String getPropertiesContainerPage() + { + return null; + } + + public final int getPerspectiveId() + { + return ActionInputs.PERSPECTIVE_UDDI; + } +} diff --git a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/uddi/actions/ToggleNavigatorNodeAction.java b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/uddi/actions/ToggleNavigatorNodeAction.java new file mode 100644 index 000000000..a0fccac81 --- /dev/null +++ b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/uddi/actions/ToggleNavigatorNodeAction.java @@ -0,0 +1,74 @@ +/******************************************************************************* + * Copyright (c) 2001, 2004 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ + +package org.eclipse.wst.ws.internal.explorer.platform.uddi.actions; + +import org.eclipse.wst.ws.internal.explorer.platform.actions.*; +import org.eclipse.wst.ws.internal.explorer.platform.constants.*; +import org.eclipse.wst.ws.internal.explorer.platform.perspective.*; + +public class ToggleNavigatorNodeAction extends ToggleNodeAction +{ + public ToggleNavigatorNodeAction(Controller controller) + { + super(controller,controller.getUDDIPerspective().getNavigatorManager()); + } + + // uddi/actions/ToggleNavigatorNodeAction.jsp?nodeId=...&open=... + public static String getActionLink(int nodeId,boolean open) + { + StringBuffer actionLink = new StringBuffer("uddi/actions/ToggleNavigatorNodeActionJSP.jsp?"); + actionLink.append(ActionInputs.NODEID).append('=').append(nodeId); + actionLink.append('&').append(ActionInputs.OPEN).append('=').append(open?ActionInputs.OPEN_NODE:ActionInputs.CLOSE_NODE); + return actionLink.toString(); + } + + // This should be called only to select the toggled node when, at the time of + // the collapse event, a descendant node was selected. + public final String getActionLinkForHistory() + { + ToolManager toolManager = toggledNode_.getToolManager(); + Tool selectedTool = toolManager.getSelectedTool(); + int nodeId = toggledNode_.getNodeId(); + int toolId = selectedTool.getToolId(); + int viewId = toggledNode_.getViewId(); + int viewToolId = toggledNode_.getViewToolId(); + if (selectedTool.getToolType() != ToolTypes.ACTION) + return SelectPropertiesToolAction.getActionLink(nodeId,toolId,viewId,viewToolId,true); + else + return SelectNavigatorNodeAction.getActionLink(nodeId,true); + } + + public final String getTreeContentVar() + { + return "navigatorContent"; + } + + public final String getTreeContentPage() + { + return "uddi/navigator_content.jsp"; + } + + public final String getPropertiesContainerVar() + { + return "propertiesContainer"; + } + + public final String getPropertiesContainerPage() + { + return "uddi/properties_container.jsp"; + } + + public final int getPerspectiveId() + { + return ActionInputs.PERSPECTIVE_UDDI; + } +} diff --git a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/uddi/actions/TransferSubQueryResultsAction.java b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/uddi/actions/TransferSubQueryResultsAction.java new file mode 100644 index 000000000..46b313493 --- /dev/null +++ b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/uddi/actions/TransferSubQueryResultsAction.java @@ -0,0 +1,136 @@ +/******************************************************************************* + * Copyright (c) 2001, 2004 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ + +package org.eclipse.wst.ws.internal.explorer.platform.uddi.actions; + +import org.eclipse.wst.ws.internal.explorer.platform.constants.*; +import org.eclipse.wst.ws.internal.explorer.platform.datamodel.*; +import org.eclipse.wst.ws.internal.explorer.platform.perspective.*; +import org.eclipse.wst.ws.internal.explorer.platform.uddi.constants.*; +import org.eclipse.wst.ws.internal.explorer.platform.uddi.datamodel.*; +import org.eclipse.wst.ws.internal.explorer.platform.uddi.perspective.*; +import org.eclipse.wst.ws.internal.explorer.platform.util.*; + +import java.util.*; + +public class TransferSubQueryResultsAction extends UDDIPropertiesFormAction +{ + private Node targetNode_; + public TransferSubQueryResultsAction(Controller controller) + { + super(controller); + targetNode_ = null; + } + + protected final boolean processParsedResults(MultipartFormDataParser parser) throws MultipartFormDataException + { + String[] selectedNodeIds = parser.getParameterValues(ActionInputs.NODEID); + // The client Javascript enforces the rule that at least one item was selected before the form can be submitted. + propertyTable_.put(UDDIActionInputs.SELECTED_NODEIDS,selectedNodeIds); + return true; + } + + public static final String getActionLinkForReturn() + { + StringBuffer actionLink = new StringBuffer("uddi/actions/TransferSubQueryResultsActionJSP.jsp?"); + actionLink.append(UDDIActionInputs.SHOW_RESULTS_TARGET).append("=1"); + return actionLink.toString(); + } + + public final void enableShowResultsTarget() + { + // This should only be called if the user clicks on the target link on the query results page. Insert a zero element + // array so that no results are transferred but the jump back to the correct query and its info occurs. + propertyTable_.put(UDDIActionInputs.SELECTED_NODEIDS,new String[0]); + } + + public final boolean run() + { + // Transfer the results in this Query node into the property expected by the originating node. + UDDIPerspective uddiPerspective = controller_.getUDDIPerspective(); + MessageQueue messageQueue = uddiPerspective.getMessageQueue(); + + String[] selectedNodeIds = (String[])propertyTable_.get(UDDIActionInputs.SELECTED_NODEIDS); + Node currentNode = getSelectedNavigatorNode(); + TreeElement currentElement = currentNode.getTreeElement(); + SubQueryTransferTarget target = (SubQueryTransferTarget)(currentElement.getPropertyAsObject(UDDIModelConstants.SUBQUERY_TRANSFER_TARGET)); + String subQueryKey = target.getSubQueryKey(); + String targetQueryKey; + + int lastSeparatorPos = subQueryKey.lastIndexOf(':'); + if (lastSeparatorPos == -1) + targetQueryKey = ""; + else + targetQueryKey = subQueryKey.substring(0,lastSeparatorPos); + + String targetProperty = subQueryKey.substring(lastSeparatorPos+1,subQueryKey.length()); + FormTool targetFormTool = target.getTargetFormTool(); + FormToolPropertiesInterface subQueryFormToolPI = ((MultipleFormToolPropertiesInterface)targetFormTool).getFormToolProperties(subQueryKey); + FormToolPropertiesInterface targetQueryFormToolPI = ((MultipleFormToolPropertiesInterface)targetFormTool).getFormToolProperties(targetQueryKey); + Vector targetList = (Vector)targetQueryFormToolPI.getProperty(targetProperty); + if (targetList == null) + targetList = new Vector(); + + NodeManager nodeManager = currentNode.getNodeManager(); + for (int i=0;i<selectedNodeIds.length;i++) + { + int selectedNodeId = Integer.parseInt(selectedNodeIds[i]); + Node selectedNode = nodeManager.getNode(selectedNodeId); + TreeElement treeElement = selectedNode.getTreeElement(); + Object object; + if (treeElement instanceof BusinessElement) + object = ((BusinessElement)treeElement).getBusinessEntity(); + else if (treeElement instanceof ServiceElement) + object = ((ServiceElement)treeElement).getBusinessService(); + else + { + // Service interface + object = ((ServiceInterfaceElement)treeElement).getTModel(); + } + ListElement targetListElement = new ListElement(object); + targetListElement.setTargetViewToolInfo(selectedNodeId,selectedNode.getToolManager().getSelectedToolId(),selectedNode.getViewId()); + if (targetProperty.equals(UDDIActionInputs.QUERY_INPUT_SIMPLE_SERVICE_BUSINESS) || targetProperty.equals(UDDIActionInputs.QUERY_INPUT_ADVANCED_SERVICE_BUSINESS) || targetProperty.equals(UDDIActionInputs.QUERY_INPUT_ADVANCED_SERVICE_INTERFACE_SERVICE)) + { + // Clear the manager so a replacement occurs. + targetList.removeAllElements(); + } + targetList.addElement(targetListElement); + } + targetQueryFormToolPI.setProperty(targetProperty,targetList); + Hashtable savedParentQueryProperties = target.getParentQueryData(); + Enumeration e = savedParentQueryProperties.keys(); + while (e.hasMoreElements()) + { + String key = (String)e.nextElement(); + targetQueryFormToolPI.setProperty(key,savedParentQueryProperties.get(key)); + } + + // Select the node and the datastructure which is the target of the subquery. + int targetNodeId = target.getNodeId(); + int targetToolId = target.getToolId(); + int targetViewId = target.getViewId(); + int targetViewToolId = target.getViewToolId(); + nodeManager.setSelectedNodeId(targetNodeId); + targetNode_ = nodeManager.getSelectedNode(); + targetNode_.getToolManager().setSelectedToolId(targetToolId); + targetNode_.setViewId(targetViewId); + if (targetViewId != ActionInputs.VIEWID_DEFAULT) + targetNode_.getViewToolManager().setSelectedToolId(targetViewToolId); + targetFormTool.setProperty(UDDIActionInputs.SUBQUERY_KEY,targetQueryKey); + addToHistory(ActionInputs.PERSPECTIVE_UDDI,SelectFindToolAction.getActionLink(targetNodeId,targetToolId,targetViewId,targetViewToolId,targetQueryKey,true)); + return true; + } + + public final Node getTargetNode() + { + return targetNode_; + } +} diff --git a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/uddi/actions/TransferToAddCategoryDataAction.java b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/uddi/actions/TransferToAddCategoryDataAction.java new file mode 100644 index 000000000..566b0b800 --- /dev/null +++ b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/uddi/actions/TransferToAddCategoryDataAction.java @@ -0,0 +1,43 @@ +/******************************************************************************* + * Copyright (c) 2001, 2004 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ + +package org.eclipse.wst.ws.internal.explorer.platform.uddi.actions; + +import org.eclipse.wst.ws.internal.explorer.platform.actions.*; +import org.eclipse.wst.ws.internal.explorer.platform.constants.*; +import org.eclipse.wst.ws.internal.explorer.platform.uddi.constants.*; + +import javax.servlet.http.*; + +public class TransferToAddCategoryDataAction extends Action +{ + public TransferToAddCategoryDataAction() + { + } + + // uddi/actions/TransferToAddCategoryDataActionJSP.jsp?sessionId=...&categoryTModelKey=... + public static final String getActionLink(String sessionId,String categoryTModelKey) + { + StringBuffer actionLink = new StringBuffer("uddi/actions/TransferToAddCategoryDataActionJSP.jsp?"); + actionLink.append(ActionInputs.SESSIONID).append('=').append(sessionId).append('&').append(UDDIActionInputs.CATEGORY_TMODEL_KEY).append('=').append(categoryTModelKey); + return actionLink.toString(); + } + + public final boolean populatePropertyTable(HttpServletRequest request) + { + return true; + } + + public final boolean run() + { + return true; + } +} diff --git a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/uddi/actions/UDDIAddToWSDLPerspectiveAction.java b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/uddi/actions/UDDIAddToWSDLPerspectiveAction.java new file mode 100644 index 000000000..7ee647917 --- /dev/null +++ b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/uddi/actions/UDDIAddToWSDLPerspectiveAction.java @@ -0,0 +1,131 @@ +/******************************************************************************* + * Copyright (c) 2001, 2004 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ + +package org.eclipse.wst.ws.internal.explorer.platform.uddi.actions; + +import org.eclipse.wst.ws.internal.explorer.platform.actions.*; +import org.eclipse.wst.ws.internal.explorer.platform.constants.*; +import org.eclipse.wst.ws.internal.explorer.platform.datamodel.*; +import org.eclipse.wst.ws.internal.explorer.platform.perspective.*; +import org.eclipse.wst.ws.internal.explorer.platform.uddi.datamodel.*; +import org.eclipse.wst.ws.internal.explorer.platform.uddi.perspective.*; +import org.eclipse.wst.ws.internal.explorer.platform.uddi.util.Uddi4jHelper; +import org.eclipse.wst.ws.internal.explorer.platform.wsdl.actions.*; + +import org.uddi4j.datatype.service.BusinessService; + +import javax.servlet.http.*; +import javax.wsdl.Definition; +import javax.wsdl.WSDLException; + +import java.util.*; +import java.net.*; +import java.io.*; + +public class UDDIAddToWSDLPerspectiveAction extends LinkAction +{ + public UDDIAddToWSDLPerspectiveAction(Controller controller) + { + super(controller); + } + + public static final String getActionLink(int nodeId,int toolId,int viewId,int viewToolId) + { + StringBuffer actionLink = new StringBuffer("uddi/actions/UDDIAddToWSDLPerspectiveActionJSP.jsp?"); + actionLink.append(ActionInputs.NODEID); + actionLink.append('='); + actionLink.append(nodeId); + actionLink.append('&'); + actionLink.append(ActionInputs.TOOLID); + actionLink.append('='); + actionLink.append(toolId); + actionLink.append('&'); + actionLink.append(ActionInputs.VIEWID); + actionLink.append('='); + actionLink.append(viewId); + actionLink.append('&'); + actionLink.append(ActionInputs.VIEWTOOLID); + actionLink.append('='); + actionLink.append(viewToolId); + return actionLink.toString(); + } + + protected boolean processLinkParameters(HttpServletRequest request) + { + String nodeIdString = request.getParameter(ActionInputs.NODEID); + // Perform data validation. + try + { + int nodeId = Integer.parseInt(nodeIdString); + } + catch (NumberFormatException e) + { + // Validation failed! + return false; + } + propertyTable_.put(ActionInputs.NODEID,nodeIdString); + return true; + } + + public boolean run() + { + int nodeId = Integer.parseInt((String)propertyTable_.get(ActionInputs.NODEID)); + UDDIPerspective uddiPerspective = controller_.getUDDIPerspective(); + MessageQueue messageQueue = uddiPerspective.getMessageQueue(); + NodeManager nodeManager = uddiPerspective.getNavigatorManager(); + Node node = nodeManager.getNode(nodeId); + TreeElement element = node.getTreeElement(); + if (element instanceof ServiceElement) + { + ServiceElement serviceElement = (ServiceElement)element; + BusinessService bs = serviceElement.getBusinessService(); + Uddi4jHelper uddi4jHelper = new Uddi4jHelper(); + String wsdlURL = uddi4jHelper.getWSDL(bs, serviceElement.getRegistryElement().getProxy()); + if (wsdlURL == null) + { + try + { + Definition def = uddi4jHelper.getWSDLDefinition(wsdlURL); + File tempFile = File.createTempFile("temp",".wsdl"); + UDDIImportWSDLToFileSystemAction action = new UDDIImportWSDLToFileSystemAction(controller_); + action.writeWSDLDefinition(new FileOutputStream(tempFile),def); + wsdlURL = tempFile.toURL().toString(); + } + catch (WSDLException e) + { + wsdlURL = null; + } + catch (MalformedURLException e) + { + wsdlURL = null; + } + catch (IOException e) + { + wsdlURL = null; + } + } + + if (wsdlURL != null) + { + OpenWSDLAction openWSDLAction = new OpenWSDLAction(controller_); + Hashtable propertyTable = openWSDLAction.getPropertyTable(); + propertyTable.put(ActionInputs.QUERY_INPUT_WSDL_URL,wsdlURL); + boolean actionResult = openWSDLAction.run(); + if (actionResult) { + messageQueue.addMessage(uddiPerspective.getMessage("MSG_INFO_WSDL_ADDED_TO_WSDL_PERSPECTIVE",wsdlURL)); + return true; + } + } + } + messageQueue.addMessage(uddiPerspective.getMessage("MSG_ERROR_WSDL_NOT_ADDED_TO_WSDL_PERSPECTIVE")); + return false; + } +} diff --git a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/uddi/actions/UDDIImportWSDLToFileSystemAction.java b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/uddi/actions/UDDIImportWSDLToFileSystemAction.java new file mode 100644 index 000000000..f0b281f16 --- /dev/null +++ b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/uddi/actions/UDDIImportWSDLToFileSystemAction.java @@ -0,0 +1,112 @@ +/******************************************************************************* + * Copyright (c) 2001, 2004 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ + +package org.eclipse.wst.ws.internal.explorer.platform.uddi.actions; + +import org.eclipse.wst.ws.internal.explorer.platform.actions.*; +import org.eclipse.wst.ws.internal.explorer.platform.constants.*; +import org.eclipse.wst.ws.internal.explorer.platform.datamodel.*; +import org.eclipse.wst.ws.internal.explorer.platform.perspective.*; +import org.eclipse.wst.ws.internal.explorer.platform.uddi.datamodel.*; +import org.eclipse.wst.ws.internal.explorer.platform.uddi.util.Uddi4jHelper; + +import java.io.*; +import javax.wsdl.Definition; + +import org.uddi4j.datatype.service.BusinessService; +import org.uddi4j.datatype.tmodel.TModel; + +public class UDDIImportWSDLToFileSystemAction extends ImportToFileSystemAction +{ + private NodeManager nodeManager_; + private Definition def_; + private String defaultWSDLFileName_; + + public UDDIImportWSDLToFileSystemAction(Controller controller) + { + super(controller); + nodeManager_ = controller.getUDDIPerspective().getNavigatorManager(); + def_ = null; + defaultWSDLFileName_ = "temp.wsdl"; + } + + public static final String getActionLink(int nodeId,int toolId,int viewId,int viewToolId) + { + return ImportToFileSystemAction.getActionLink(nodeId,toolId,viewId,viewToolId,"uddi/actions/UDDIImportWSDLToFileSystemActionJSP.jsp"); + } + + public final boolean write(OutputStream os) + { + return writeWSDLDefinition(os,def_); + } + + public final String getDefaultFileName() + { + return defaultWSDLFileName_; + } + + public final boolean run() + { + MessageQueue messageQueue = controller_.getUDDIPerspective().getMessageQueue(); + int nodeId = Integer.parseInt((String)propertyTable_.get(ActionInputs.NODEID)); + Node node = nodeManager_.getNode(nodeId); + Uddi4jHelper uddi4jHelper = new Uddi4jHelper(); + String wsdlUrl = null; + if (node != null) + { + TreeElement element = node.getTreeElement(); + if (element instanceof ServiceElement) + { + ServiceElement serviceElement = (ServiceElement)element; + BusinessService bs = serviceElement.getBusinessService(); + wsdlUrl = uddi4jHelper.getWSDL(bs, serviceElement.getRegistryElement().getProxy()); + } + else if (element instanceof ServiceInterfaceElement) + { + TModel tModel = ((ServiceInterfaceElement)element).getTModel(); + wsdlUrl = uddi4jHelper.getWSDL(tModel); + } + } + if (wsdlUrl != null) + { + try + { + def_ = uddi4jHelper.getWSDLDefinition(wsdlUrl); + if (def_ != null) + { + String wsdlPathname; + int index = wsdlUrl.indexOf('/'); + if (index != -1) + wsdlPathname = wsdlUrl.substring(index+1, wsdlUrl.length()); + else + wsdlPathname = wsdlUrl; + defaultWSDLFileName_ = WSDLFileNameHelper.getWSDLFileName(wsdlPathname); + } + return true; + } + catch (Throwable t) + { + messageQueue.addMessage(controller_.getMessage("MSG_ERROR_RETRIEVING_WSDL_DOC")); + } + } + return false; + } + + public final String getStatusContentVar() + { + return controller_.getUDDIPerspective().getStatusContentVar(); + } + + public final String getStatusContentPage() + { + return controller_.getUDDIPerspective().getStatusContentPage(); + } +} diff --git a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/uddi/actions/UDDIImportWSDLToWorkbenchAction.java b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/uddi/actions/UDDIImportWSDLToWorkbenchAction.java new file mode 100644 index 000000000..083435a37 --- /dev/null +++ b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/uddi/actions/UDDIImportWSDLToWorkbenchAction.java @@ -0,0 +1,56 @@ +/******************************************************************************* + * Copyright (c) 2001, 2004 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ + +package org.eclipse.wst.ws.internal.explorer.platform.uddi.actions; + +import org.eclipse.wst.ws.internal.explorer.platform.actions.*; +import org.eclipse.wst.ws.internal.explorer.platform.constants.*; +import org.eclipse.wst.ws.internal.explorer.platform.perspective.*; +import org.eclipse.wst.ws.internal.explorer.platform.uddi.perspective.*; + +import java.util.Hashtable; + +public class UDDIImportWSDLToWorkbenchAction extends ImportToWorkbenchAction +{ + public UDDIImportWSDLToWorkbenchAction(Controller controller) + { + super(controller); + } + + public FormTool getSelectedFormTool() + { + UDDIPerspective uddiPerspective = controller_.getUDDIPerspective(); + return (FormTool)uddiPerspective.getNavigatorManager().getSelectedNode().getCurrentToolManager().getSelectedTool(); + } + + public ImportToFileSystemAction newImportToFileSystemAction() { + UDDIImportWSDLToFileSystemAction action = new UDDIImportWSDLToFileSystemAction(controller_); + Hashtable table = action.getPropertyTable(); + + UDDIPerspective uddiPerspective = controller_.getUDDIPerspective(); + NodeManager nodeManager = uddiPerspective.getNavigatorManager(); + Node selectedNode = nodeManager.getSelectedNode(); + + table.put(ActionInputs.NODEID, String.valueOf(selectedNode.getNodeId())); + + return action; + } + + public final String getStatusContentVar() + { + return controller_.getUDDIPerspective().getStatusContentVar(); + } + + public final String getStatusContentPage() + { + return controller_.getUDDIPerspective().getStatusContentPage(); + } +} diff --git a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/uddi/actions/UDDILaunchWebServiceWizardAction.java b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/uddi/actions/UDDILaunchWebServiceWizardAction.java new file mode 100644 index 000000000..b290772f8 --- /dev/null +++ b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/uddi/actions/UDDILaunchWebServiceWizardAction.java @@ -0,0 +1,89 @@ +/******************************************************************************* + * Copyright (c) 2001, 2004 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ + +package org.eclipse.wst.ws.internal.explorer.platform.uddi.actions; + +import org.eclipse.wst.ws.internal.explorer.platform.actions.*; +import org.eclipse.wst.ws.internal.explorer.platform.datamodel.*; +import org.eclipse.wst.ws.internal.explorer.platform.perspective.*; +import org.eclipse.wst.ws.internal.explorer.platform.uddi.datamodel.*; +import org.eclipse.wst.ws.internal.explorer.platform.uddi.perspective.*; +import org.eclipse.wst.ws.internal.explorer.platform.uddi.util.Uddi4jHelper; + +import org.uddi4j.datatype.service.BusinessService; +import org.uddi4j.datatype.tmodel.TModel; + +import java.io.*; +import javax.wsdl.Definition; + +public class UDDILaunchWebServiceWizardAction extends LaunchWebServiceWizardAction +{ + public UDDILaunchWebServiceWizardAction(Controller controller) + { + super(controller); + } + + public FormTool getSelectedFormTool() + { + UDDIPerspective uddiPerspective = controller_.getUDDIPerspective(); + return (FormTool)uddiPerspective.getNavigatorManager().getSelectedNode().getCurrentToolManager().getSelectedTool(); + } + + public boolean run() + { + UDDIPerspective uddiPerspective = controller_.getUDDIPerspective(); + MessageQueue messageQueue = uddiPerspective.getMessageQueue(); + NodeManager nodeManager = uddiPerspective.getNavigatorManager(); + Node node = nodeManager.getSelectedNode(); + TreeElement element = node.getTreeElement(); + Uddi4jHelper uddi4jHelper = new Uddi4jHelper(); + String wsdlUrl = null; + if (element instanceof ServiceElement) + { + ServiceElement serviceElement = (ServiceElement)element; + BusinessService bs = serviceElement.getBusinessService(); + wsdlUrl = uddi4jHelper.getWSDL(bs, serviceElement.getRegistryElement().getProxy()); + } + else if (element instanceof ServiceInterfaceElement) + { + TModel tModel = ((ServiceInterfaceElement)element).getTModel(); + wsdlUrl = uddi4jHelper.getWSDL(tModel); + } + + try + { + if (wsdlUrl != null) + { + Definition def = uddi4jHelper.getWSDLDefinition(wsdlUrl); + File tempFile = File.createTempFile("temp",".wsdl"); + UDDIImportWSDLToFileSystemAction action = new UDDIImportWSDLToFileSystemAction(controller_); + action.writeWSDLDefinition(new FileOutputStream(tempFile),def); + wsdlUrl = tempFile.toURL().toString(); + return launchWizard(wsdlUrl); + } + } + catch (Throwable t) + { + messageQueue.addMessage(controller_.getMessage("MSG_ERROR_RETRIEVING_WSDL_DOC")); + } + return false; + } + + public final String getStatusContentVar() + { + return controller_.getUDDIPerspective().getStatusContentVar(); + } + + public final String getStatusContentPage() + { + return controller_.getUDDIPerspective().getStatusContentPage(); + } +} diff --git a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/uddi/actions/UDDINodeAction.java b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/uddi/actions/UDDINodeAction.java new file mode 100644 index 000000000..d21e58239 --- /dev/null +++ b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/uddi/actions/UDDINodeAction.java @@ -0,0 +1,38 @@ +/******************************************************************************* + * Copyright (c) 2001, 2004 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ + +package org.eclipse.wst.ws.internal.explorer.platform.uddi.actions; + +import org.eclipse.wst.ws.internal.explorer.platform.actions.*; +import org.eclipse.wst.ws.internal.explorer.platform.perspective.*; +import org.eclipse.wst.ws.internal.explorer.platform.uddi.perspective.*; + +public abstract class UDDINodeAction extends NodeAction +{ + protected RegistryNode regNode_; + public UDDINodeAction(Controller controller) + { + super(controller,controller.getUDDIPerspective().getNavigatorManager()); + regNode_ = getRegistryNode(); + } + + public final Node getSelectedNavigatorNode() + { + Node selectedNavigatorNode = nodeManager_.getSelectedNode(); + return selectedNavigatorNode; + } + + public final RegistryNode getRegistryNode() + { + UDDIMainNode uddiMainNode = (UDDIMainNode)nodeManager_.getRootNode(); + return uddiMainNode.getRegistryNode(getSelectedNavigatorNode()); + } +} diff --git a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/uddi/actions/UDDIPropertiesFormAction.java b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/uddi/actions/UDDIPropertiesFormAction.java new file mode 100644 index 000000000..4dd19b6bf --- /dev/null +++ b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/uddi/actions/UDDIPropertiesFormAction.java @@ -0,0 +1,47 @@ +/******************************************************************************* + * Copyright (c) 2001, 2004 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ + +package org.eclipse.wst.ws.internal.explorer.platform.uddi.actions; + +import org.eclipse.wst.ws.internal.explorer.platform.actions.*; +import org.eclipse.wst.ws.internal.explorer.platform.perspective.*; +import org.eclipse.wst.ws.internal.explorer.platform.uddi.perspective.*; + +public abstract class UDDIPropertiesFormAction extends FormAction +{ + protected NodeManager navigatorManager_; + public UDDIPropertiesFormAction(Controller controller) + { + super(controller); + navigatorManager_ = controller.getUDDIPerspective().getNavigatorManager(); + } + + public final Node getSelectedNavigatorNode() + { + return navigatorManager_.getSelectedNode(); + } + + public final FormTool getSelectedFormTool() + { + return (FormTool)(getSelectedNavigatorNode().getCurrentToolManager().getSelectedTool()); + } + + public final RegistryNode getRegistryNode() + { + return getRegistryNode(getSelectedNavigatorNode()); + } + + public final RegistryNode getRegistryNode(Node registryChildNode) + { + UDDIMainNode uddiMainNode = (UDDIMainNode)navigatorManager_.getRootNode(); + return uddiMainNode.getRegistryNode(registryChildNode); + } +} diff --git a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/uddi/actions/UnpublishAction.java b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/uddi/actions/UnpublishAction.java new file mode 100644 index 000000000..b3cca2804 --- /dev/null +++ b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/uddi/actions/UnpublishAction.java @@ -0,0 +1,157 @@ +/******************************************************************************* + * Copyright (c) 2001, 2004 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ + +package org.eclipse.wst.ws.internal.explorer.platform.uddi.actions; + +import org.eclipse.wst.ws.internal.explorer.platform.datamodel.*; +import org.eclipse.wst.ws.internal.explorer.platform.perspective.*; +import org.eclipse.wst.ws.internal.explorer.platform.uddi.constants.*; +import org.eclipse.wst.ws.internal.explorer.platform.uddi.datamodel.*; +import org.eclipse.wst.ws.internal.explorer.platform.uddi.perspective.*; +import org.eclipse.wst.ws.internal.explorer.platform.util.*; + +import org.uddi4j.transport.TransportException; +import org.uddi4j.response.*; +import org.uddi4j.*; +import org.uddi4j.client.UDDIProxy; + +import java.net.*; + +public class UnpublishAction extends UDDIPropertiesFormAction +{ + protected RegistryNode registryNode_; + protected boolean isLoggedIn_; + + public UnpublishAction(Controller controller) + { + super(controller); + registryNode_ = getRegistryNode(); + } + + protected final boolean processParsedResults(MultipartFormDataParser parser) throws MultipartFormDataException + { + RegistryElement regElement = (RegistryElement)registryNode_.getTreeElement(); + UDDIPerspective uddiPerspective = controller_.getUDDIPerspective(); + MessageQueue messageQueue = uddiPerspective.getMessageQueue(); + FormTool formTool = getSelectedFormTool(); + + // if not yet logged in, validate the parameters needed to log in + if (!regElement.isLoggedIn()) + { + String publishURL = parser.getParameter(UDDIActionInputs.QUERY_INPUT_ADVANCED_PUBLISH_URL); + String userId = parser.getParameter(UDDIActionInputs.QUERY_INPUT_ADVANCED_USERID); + String password = parser.getParameter(UDDIActionInputs.QUERY_INPUT_ADVANCED_PASSWORD); + + boolean inputsValid = true; + if (publishURL != null) + propertyTable_.put(UDDIActionInputs.QUERY_INPUT_ADVANCED_PUBLISH_URL, publishURL); + + if (!Validator.validateURL(publishURL)) + { + formTool.flagError(UDDIActionInputs.QUERY_INPUT_ADVANCED_PUBLISH_URL); + inputsValid = false; + messageQueue.addMessage(uddiPerspective.getMessage("MSG_ERROR_INVALID_PUBLISH_URL")); + } + + if (userId != null) + propertyTable_.put(UDDIActionInputs.QUERY_INPUT_ADVANCED_USERID,userId); + + if (!Validator.validateString(userId)) + { + formTool.flagError(UDDIActionInputs.QUERY_INPUT_ADVANCED_USERID); + inputsValid = false; + messageQueue.addMessage(uddiPerspective.getMessage("MSG_ERROR_INVALID_USERID")); + } + + propertyTable_.put(UDDIActionInputs.QUERY_INPUT_ADVANCED_PASSWORD, password); + + formTool.updatePropertyTable(propertyTable_); + + return inputsValid; + } + + return true; + } + + public boolean run() + { + RegistryElement registryElement = (RegistryElement)registryNode_.getTreeElement(); + UDDIPerspective uddiPerspective = controller_.getUDDIPerspective(); + MessageQueue messageQueue = uddiPerspective.getMessageQueue(); + NodeManager navigatorManager = uddiPerspective.getNavigatorManager(); + Node selectedNode = navigatorManager.getSelectedNode(); + TreeElement selectedElement = selectedNode.getTreeElement(); + + try + { + if (!registryElement.isLoggedIn()) + { + // if not yet logged in, log in first + String publishURL = (String)propertyTable_.get(UDDIActionInputs.QUERY_INPUT_ADVANCED_PUBLISH_URL); + String userId = (String)propertyTable_.get(UDDIActionInputs.QUERY_INPUT_ADVANCED_USERID); + String password = (String)propertyTable_.get(UDDIActionInputs.QUERY_INPUT_ADVANCED_PASSWORD); + + registryElement.performLogin(publishURL,userId,password); + } + + String selectedElementKey = selectedElement.getKey(); + String unpublishTypeMessageKey = null; + UDDIProxy proxy = registryElement.getProxy(); + String authInfo = registryElement.getAuthInfoString(); + DispositionReport dr = null; + if (selectedElement instanceof BusinessElement) + { + unpublishTypeMessageKey = "MSG_INFO_BUSINESS_UNPUBLISHED"; + dr = proxy.delete_business(authInfo,selectedElementKey); + } + else if (selectedElement instanceof ServiceElement) + { + unpublishTypeMessageKey = "MSG_INFO_SERVICE_UNPUBLISHED"; + dr = proxy.delete_service(authInfo,selectedElementKey); + } + else if (selectedElement instanceof ServiceInterfaceElement) + { + unpublishTypeMessageKey = "MSG_INFO_SERVICE_INTERFACE_UNPUBLISHED"; + dr = proxy.delete_tModel(authInfo,selectedElementKey); + } + if (!dr.success()) + throw new Exception(dr.toString()); + else + { + selectedElement.disconnectAll(); + messageQueue.addMessage(uddiPerspective.getMessage(unpublishTypeMessageKey,selectedElement.getName())); + return true; + } + } + catch (TransportException e) + { + handleUnexpectedException(uddiPerspective,messageQueue,"TransportException",e); + return false; + } + catch (UDDIException e) + { + messageQueue.addMessage(uddiPerspective.getController().getMessage("MSG_ERROR_UNEXPECTED")); + messageQueue.addMessage("UDDIException"); + messageQueue.addMessage(e.toString()); + return false; + } + catch (MalformedURLException e) + { + handleUnexpectedException(uddiPerspective,messageQueue,"MalformedURLException",e); + return false; + } + catch (Exception e) + { + handleUnexpectedException(uddiPerspective, messageQueue, "Exception", e); + return false; + } + } +} diff --git a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/uddi/actions/UpdateAction.java b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/uddi/actions/UpdateAction.java new file mode 100644 index 000000000..2bfbb9958 --- /dev/null +++ b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/uddi/actions/UpdateAction.java @@ -0,0 +1,170 @@ +/******************************************************************************* + * Copyright (c) 2004 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.wst.ws.internal.explorer.platform.uddi.actions; + +import org.eclipse.wst.ws.internal.explorer.platform.constants.*; +import org.eclipse.wst.ws.internal.explorer.platform.datamodel.*; +import org.eclipse.wst.ws.internal.explorer.platform.engine.transformer.ITransformer; +import org.eclipse.wst.ws.internal.explorer.platform.engine.transformer.MultipartFormDataParserTransformer; +import org.eclipse.wst.ws.internal.explorer.platform.perspective.*; +import org.eclipse.wst.ws.internal.explorer.platform.uddi.constants.*; +import org.eclipse.wst.ws.internal.explorer.platform.uddi.datamodel.*; +import org.eclipse.wst.ws.internal.explorer.platform.uddi.perspective.*; +import org.eclipse.wst.ws.internal.explorer.platform.util.*; + +import org.uddi4j.datatype.business.BusinessEntity; +import org.uddi4j.datatype.service.BusinessService; +import org.uddi4j.datatype.tmodel.TModel; + +import java.util.*; + +public abstract class UpdateAction extends UDDIPropertiesFormAction +{ + protected RegistryNode regNode_; + private boolean requiresAuthentication_; + public UpdateAction(Controller controller,boolean requiresAuthentication) + { + super(controller); + regNode_ = getRegistryNode(); + requiresAuthentication_ = requiresAuthentication; + } + + protected abstract boolean processOthers(MultipartFormDataParser parser,FormToolPropertiesInterface formToolPI) throws MultipartFormDataException; + + protected final boolean processParsedResults(MultipartFormDataParser parser) throws MultipartFormDataException + { + // Setup for MultipartFormDataParserTransformer + propertyTable_.put(ActionInputs.MULTIPART_FORM_DATA_PARSER, parser); + + UDDIPerspective uddiPerspective = controller_.getUDDIPerspective(); + MessageQueue messageQueue = uddiPerspective.getMessageQueue(); + FormTool formTool = getSelectedFormTool(); + FormToolPropertiesInterface formToolPI = formTool; + formToolPI.clearErrors(); + boolean inputsValid = processOthers(parser,formToolPI); + for (int i=0;i<removedProperties_.size();i++) + formToolPI.removeProperty(removedProperties_.elementAt(i)); + formToolPI.updatePropertyTable(propertyTable_); + + String publishURL = parser.getParameter(UDDIActionInputs.QUERY_INPUT_ADVANCED_PUBLISH_URL); + String userId = parser.getParameter(UDDIActionInputs.QUERY_INPUT_ADVANCED_USERID); + String password = parser.getParameter(UDDIActionInputs.QUERY_INPUT_ADVANCED_PASSWORD); + RegistryElement regElement = (RegistryElement)regNode_.getTreeElement(); + + boolean validateAuthentication = !regElement.isLoggedIn() & requiresAuthentication_; + + if (publishURL != null) + { + propertyTable_.put(UDDIActionInputs.QUERY_INPUT_ADVANCED_PUBLISH_URL,publishURL); + formTool.setProperty(UDDIActionInputs.QUERY_INPUT_ADVANCED_PUBLISH_URL,publishURL); + } + + if (validateAuthentication && !Validator.validateString(publishURL)) + { + inputsValid = false; + formTool.flagError(UDDIActionInputs.QUERY_INPUT_ADVANCED_PUBLISH_URL); + messageQueue.addMessage(uddiPerspective.getMessage("MSG_ERROR_INVALID_PUBLISH_URL")); + } + + if (userId != null) + { + propertyTable_.put(UDDIActionInputs.QUERY_INPUT_ADVANCED_USERID,userId); + formTool.setProperty(UDDIActionInputs.QUERY_INPUT_ADVANCED_USERID,userId); + } + + if (validateAuthentication && !Validator.validateString(userId)) + { + inputsValid = false; + formTool.flagError(UDDIActionInputs.QUERY_INPUT_ADVANCED_USERID); + messageQueue.addMessage(uddiPerspective.getMessage("MSG_ERROR_INVALID_USERID")); + } + + if (password != null) + { + propertyTable_.put(UDDIActionInputs.QUERY_INPUT_ADVANCED_PASSWORD,password); + formTool.setProperty(UDDIActionInputs.QUERY_INPUT_ADVANCED_PASSWORD,password); + } + + return inputsValid; + } + + public abstract boolean refreshFromRegistry(); + + protected final void refreshNode(BusinessEntity be) + { + Node node = getSelectedNavigatorNode(); + Node parentNode = node.getParent(); + TreeElement element = node.getTreeElement(); + element.disconnectAll(); + BusinessElement newBusinessElement = new BusinessElement(be,regNode_.getTreeElement().getModel()); + connectElements(parentNode,newBusinessElement); + } + + protected final void refreshNode(BusinessService bs) + { + Node node = getSelectedNavigatorNode(); + Node parentNode = node.getParent(); + TreeElement element = node.getTreeElement(); + element.disconnectAll(); + ServiceElement newServiceElement = new ServiceElement(bs,regNode_.getTreeElement().getModel()); + connectElements(parentNode,newServiceElement); + } + + protected final void refreshNode(TModel tModel) + { + Node node = getSelectedNavigatorNode(); + Node parentNode = node.getParent(); + TreeElement element = node.getTreeElement(); + element.disconnectAll(); + ServiceInterfaceElement newServiceInterfaceElement = new ServiceInterfaceElement(tModel,regNode_.getTreeElement().getModel()); + connectElements(parentNode,newServiceInterfaceElement); + } + + private final void connectElements(Node parentNode,TreeElement newElement) + { + TreeElement parentElement = parentNode.getTreeElement(); + String rel = null; + if (parentNode instanceof PublishedItemsNode) + rel = UDDIModelConstants.REL_PUBLISHED_ITEMS; + else + { + // QueryNode + rel = UDDIModelConstants.REL_QUERY_RESULTS; + } + parentElement.connect(newElement,rel,ModelConstants.REL_OWNER); + Node newNode = parentNode.getChildNode(newElement); + int newNodeId = newNode.getNodeId(); + NodeManager nodeManager = parentNode.getNodeManager(); + nodeManager.setSelectedNodeId(newNodeId); + ToolManager toolManager = newNode.getToolManager(); + Tool selectedTool = toolManager.getSelectedTool(); + addToHistory(ActionInputs.PERSPECTIVE_UDDI,selectedTool.getSelectToolActionHref(true)); + } + + protected final void reindexListElementVector(Vector v) + { + for (int i=0;i<v.size();i++) + { + ListElement listElement = (ListElement)v.elementAt(i); + listElement.setViewId(i); + // targetViewId determines whether or not a successfully validated list element remains in edit state. + } + } + + public ITransformer[] getTransformers() + { + ITransformer[] parentTransformers = super.getTransformers(); + ITransformer[] transformers = new ITransformer[parentTransformers.length + 1]; + System.arraycopy(parentTransformers, 0, transformers, 0, parentTransformers.length); + transformers[transformers.length - 1] = new MultipartFormDataParserTransformer(controller_); + return transformers; + } +}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/uddi/actions/UpdateBusinessAction.java b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/uddi/actions/UpdateBusinessAction.java new file mode 100644 index 000000000..b4db6d92a --- /dev/null +++ b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/uddi/actions/UpdateBusinessAction.java @@ -0,0 +1,401 @@ +/******************************************************************************* + * Copyright (c) 2001, 2004 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ + +package org.eclipse.wst.ws.internal.explorer.platform.uddi.actions; + +import org.eclipse.wst.ws.internal.explorer.platform.datamodel.*; +import org.eclipse.wst.ws.internal.explorer.platform.perspective.*; +import org.eclipse.wst.ws.internal.explorer.platform.uddi.constants.*; +import org.eclipse.wst.ws.internal.explorer.platform.uddi.datamodel.*; +import org.eclipse.wst.ws.internal.explorer.platform.uddi.perspective.*; +import org.eclipse.wst.ws.internal.explorer.platform.util.*; + +import org.uddi4j.UDDIException; +import org.uddi4j.client.UDDIProxy; +import org.uddi4j.transport.TransportException; +import org.uddi4j.datatype.business.BusinessEntity; +import org.uddi4j.datatype.*; +import org.uddi4j.util.*; + +import java.util.*; +import java.net.*; + +public class UpdateBusinessAction extends UpdateAction +{ + private boolean isUpdate_; + public UpdateBusinessAction(Controller controller) + { + super(controller,true); + isUpdate_ = true; + } + + protected boolean processOthers(MultipartFormDataParser parser,FormToolPropertiesInterface formToolPI) throws MultipartFormDataException + { + String uuidKey = parser.getParameter(UDDIActionInputs.QUERY_INPUT_UUID_BUSINESS_KEY); + String[] discoveryURLModifiedStates = parser.getParameterValues(UDDIActionInputs.DISCOVERYURL_MODIFIED); + String[] discoveryURLViewIds = parser.getParameterValues(UDDIActionInputs.DISCOVERYURL_VIEWID); + String[] discoveryURLs = parser.getParameterValues(UDDIActionInputs.QUERY_INPUT_ADVANCED_DISCOVERYURL); + String[] nameModifiedStates = parser.getParameterValues(UDDIActionInputs.NAME_MODIFIED); + String[] nameViewIds = parser.getParameterValues(UDDIActionInputs.NAME_VIEWID); + String[] nameLanguages = parser.getParameterValues(UDDIActionInputs.QUERY_INPUT_ADVANCED_NAME_LANGUAGE); + String[] names = parser.getParameterValues(UDDIActionInputs.QUERY_INPUT_ADVANCED_NAME); + String[] descriptionModifiedStates = parser.getParameterValues(UDDIActionInputs.DESCRIPTION_MODIFIED); + String[] descriptionViewIds = parser.getParameterValues(UDDIActionInputs.DESCRIPTION_VIEWID); + String[] descriptionLanguages = parser.getParameterValues(UDDIActionInputs.QUERY_INPUT_ADVANCED_DESCRIPTION_LANGUAGE); + String[] descriptions = parser.getParameterValues(UDDIActionInputs.QUERY_INPUT_ADVANCED_DESCRIPTION); + String[] idModifiedStates = parser.getParameterValues(UDDIActionInputs.IDENTIFIER_MODIFIED); + String[] idViewIds = parser.getParameterValues(UDDIActionInputs.IDENTIFIER_VIEWID); + String[] idTypes = parser.getParameterValues(UDDIActionInputs.QUERY_INPUT_ADVANCED_IDENTIFIER_TYPE); + String[] idKeyNames = parser.getParameterValues(UDDIActionInputs.QUERY_INPUT_ADVANCED_IDENTIFIER_KEY_NAME); + String[] idKeyValues = parser.getParameterValues(UDDIActionInputs.QUERY_INPUT_ADVANCED_IDENTIFIER_KEY_VALUE); + String[] catModifiedStates = parser.getParameterValues(UDDIActionInputs.CATEGORY_MODIFIED); + String[] catViewIds = parser.getParameterValues(UDDIActionInputs.CATEGORY_VIEWID); + String[] catTypes = parser.getParameterValues(UDDIActionInputs.QUERY_INPUT_ADVANCED_CATEGORY_TYPE); + String[] catKeyNames = parser.getParameterValues(UDDIActionInputs.QUERY_INPUT_ADVANCED_CATEGORY_KEY_NAME); + String[] catKeyValues = parser.getParameterValues(UDDIActionInputs.QUERY_INPUT_ADVANCED_CATEGORY_KEY_VALUE); + + boolean inputsValid = true; + UDDIPerspective uddiPerspective = controller_.getUDDIPerspective(); + MessageQueue messageQueue = uddiPerspective.getMessageQueue(); + + if (uuidKey != null) + propertyTable_.put(UDDIActionInputs.QUERY_INPUT_UUID_BUSINESS_KEY,uuidKey); + + + if (discoveryURLModifiedStates != null && discoveryURLViewIds != null && discoveryURLs != null) + { + Vector oldDiscoveryURLListElementVector = (Vector)formToolPI.getProperty(UDDIActionInputs.QUERY_INPUT_ADVANCED_BUSINESS_DISCOVERYURLS); + Vector newDiscoveryURLListElementVector = new Vector(); + String[] parameters = new String[2]; + parameters[0] = uddiPerspective.getMessage("FORM_LABEL_DISCOVERYURL"); + for (int i=0;i<discoveryURLs.length;i++) + { + parameters[1] = String.valueOf(i+1); + DiscoveryURL discoveryURL = new DiscoveryURL(discoveryURLs[i],""); + if (!Validator.validateURL(discoveryURLs[i])) + { + inputsValid = false; + formToolPI.flagRowError(UDDIActionInputs.QUERY_INPUT_ADVANCED_BUSINESS_DISCOVERYURLS,i); + messageQueue.addMessage(uddiPerspective.getMessage("MSG_ERROR_ROW_INVALID_TEXT",parameters)); + } + + int discoveryURLViewId = Integer.parseInt(discoveryURLViewIds[i]); + boolean isModified = Boolean.valueOf(discoveryURLModifiedStates[i]).booleanValue(); + + if (discoveryURLViewId == -1 || isModified) + newDiscoveryURLListElementVector.addElement(new ListElement(discoveryURL)); + else + newDiscoveryURLListElementVector.addElement(oldDiscoveryURLListElementVector.elementAt(discoveryURLViewId)); + } + reindexListElementVector(newDiscoveryURLListElementVector); + propertyTable_.put(UDDIActionInputs.QUERY_INPUT_ADVANCED_BUSINESS_DISCOVERYURLS,newDiscoveryURLListElementVector); + } + else + removeProperty(UDDIActionInputs.QUERY_INPUT_ADVANCED_BUSINESS_DISCOVERYURLS); + + Hashtable languageHash = new Hashtable(); + if (nameModifiedStates != null && nameViewIds != null && nameLanguages != null && names != null) + { + Vector oldNameListElementVector = (Vector)formToolPI.getProperty(UDDIActionInputs.QUERY_INPUT_ADVANCED_BUSINESS_NAMES); + Vector newNameListElementVector = new Vector(); + // UDDI's save API (Appendix C of the UDDI V2 Programmers API Specification) requires the following: + // 1) Only the first row can have a blank language. + // 2) Only 1 name per language. + String[] parameters = new String[2]; + parameters[0] = uddiPerspective.getMessage("FORM_LABEL_NAME"); + for (int i=0;i<names.length;i++) + { + parameters[1] = String.valueOf(i+1); + Name uddi4jName; + if (nameLanguages[i].length() > 0) + uddi4jName = new Name(names[i],nameLanguages[i]); + else + { + uddi4jName = new Name(names[i]); + if (i != 0) + { + inputsValid = false; + formToolPI.flagRowError(UDDIActionInputs.QUERY_INPUT_ADVANCED_BUSINESS_NAMES,i); + messageQueue.addMessage(uddiPerspective.getMessage("MSG_ERROR_ROW_BLANK_LANGUAGE",parameters)); + } + } + if (languageHash.get(nameLanguages[i]) != null) + { + inputsValid = false; + formToolPI.flagRowError(UDDIActionInputs.QUERY_INPUT_ADVANCED_BUSINESS_NAMES,i); + messageQueue.addMessage(uddiPerspective.getMessage("MSG_ERROR_ROW_DUPLICATE_LANGUAGE",parameters)); + } + else + languageHash.put(nameLanguages[i],Boolean.TRUE); + if (!Validator.validateString(names[i])) + { + inputsValid = false; + formToolPI.flagRowError(UDDIActionInputs.QUERY_INPUT_ADVANCED_BUSINESS_NAMES,i); + messageQueue.addMessage(uddiPerspective.getMessage("MSG_ERROR_ROW_INVALID_TEXT",parameters)); + } + + int nameViewId = Integer.parseInt(nameViewIds[i]); + boolean isModified = Boolean.valueOf(nameModifiedStates[i]).booleanValue(); + + if (nameViewId == -1 || isModified) + newNameListElementVector.addElement(new ListElement(uddi4jName)); + else + newNameListElementVector.addElement(oldNameListElementVector.elementAt(nameViewId)); + } + reindexListElementVector(newNameListElementVector); + propertyTable_.put(UDDIActionInputs.QUERY_INPUT_ADVANCED_BUSINESS_NAMES,newNameListElementVector); + } + else + { + removeProperty(UDDIActionInputs.QUERY_INPUT_ADVANCED_BUSINESS_NAMES); + inputsValid = false; + formToolPI.flagError(UDDIActionInputs.QUERY_INPUT_ADVANCED_BUSINESS_NAMES); + messageQueue.addMessage(uddiPerspective.getMessage("MSG_ERROR_NO_NAMES")); + } + + if (descriptionModifiedStates != null && descriptionViewIds != null && descriptionLanguages != null && descriptions != null) + { + Vector oldDescriptionListElementVector = (Vector)formToolPI.getProperty(UDDIActionInputs.QUERY_INPUT_ADVANCED_BUSINESS_DESCRIPTIONS); + Vector newDescriptionListElementVector = new Vector(); + String[] parameters = new String[2]; + parameters[0] = uddiPerspective.getMessage("FORM_LABEL_DESCRIPTION"); + languageHash.clear(); + for (int i=0;i<descriptions.length;i++) + { + parameters[1] = String.valueOf(i+1); + Description uddi4jDescription; + if (descriptionLanguages[i].length() > 0) + uddi4jDescription = new Description(descriptions[i],descriptionLanguages[i]); + else + { + uddi4jDescription = new Description(descriptions[i]); + if (i != 0) + { + inputsValid = false; + formToolPI.flagRowError(UDDIActionInputs.QUERY_INPUT_ADVANCED_BUSINESS_DESCRIPTIONS,i); + messageQueue.addMessage(uddiPerspective.getMessage("MSG_ERROR_ROW_BLANK_LANGUAGE",parameters)); + } + } + if (languageHash.get(descriptionLanguages[i]) != null) + { + inputsValid = false; + formToolPI.flagRowError(UDDIActionInputs.QUERY_INPUT_ADVANCED_BUSINESS_DESCRIPTIONS,i); + messageQueue.addMessage(uddiPerspective.getMessage("MSG_ERROR_ROW_DUPLICATE_LANGUAGE",parameters)); + } + else + languageHash.put(descriptionLanguages[i],Boolean.TRUE); + if (!Validator.validateString(descriptions[i])) + { + inputsValid = false; + formToolPI.flagRowError(UDDIActionInputs.QUERY_INPUT_ADVANCED_BUSINESS_DESCRIPTIONS,i); + messageQueue.addMessage(uddiPerspective.getMessage("MSG_ERROR_ROW_INVALID_TEXT",parameters)); + } + + int descriptionViewId = Integer.parseInt(descriptionViewIds[i]); + boolean isModified = Boolean.valueOf(descriptionModifiedStates[i]).booleanValue(); + + if (descriptionViewId == -1 || isModified) + newDescriptionListElementVector.addElement(new ListElement(uddi4jDescription)); + else + newDescriptionListElementVector.addElement(oldDescriptionListElementVector.elementAt(descriptionViewId)); + } + reindexListElementVector(newDescriptionListElementVector); + propertyTable_.put(UDDIActionInputs.QUERY_INPUT_ADVANCED_BUSINESS_DESCRIPTIONS,newDescriptionListElementVector); + } + else + removeProperty(UDDIActionInputs.QUERY_INPUT_ADVANCED_BUSINESS_DESCRIPTIONS); + + if (idModifiedStates != null && idViewIds != null && idTypes != null && idKeyNames != null && idKeyValues != null) + { + Vector oldIdListElementVector = (Vector)formToolPI.getProperty(UDDIActionInputs.QUERY_INPUT_ADVANCED_BUSINESS_IDENTIFIERS); + Vector newIdListElementVector = new Vector(); + for (int i=0;i<idKeyNames.length;i++) + { + KeyedReference kr = new KeyedReference(idKeyNames[i],idKeyValues[i],idTypes[i]); + int idViewId = Integer.parseInt(idViewIds[i]); + boolean isModified = Boolean.valueOf(idModifiedStates[i]).booleanValue(); + if (idViewId == -1 || isModified) + newIdListElementVector.addElement(new ListElement(kr)); + else + newIdListElementVector.addElement(oldIdListElementVector.elementAt(idViewId)); + } + reindexListElementVector(newIdListElementVector); + propertyTable_.put(UDDIActionInputs.QUERY_INPUT_ADVANCED_BUSINESS_IDENTIFIERS,newIdListElementVector); + } + else + removeProperty(UDDIActionInputs.QUERY_INPUT_ADVANCED_BUSINESS_IDENTIFIERS); + + if (catModifiedStates != null && catViewIds != null && catTypes != null && catKeyNames != null && catKeyValues != null) + { + Vector oldCatListElementVector = (Vector)formToolPI.getProperty(UDDIActionInputs.QUERY_INPUT_ADVANCED_BUSINESS_CATEGORIES); + Vector newCatListElementVector = new Vector(); + for (int i=0;i<catTypes.length;i++) + { + KeyedReference kr = new KeyedReference(catKeyNames[i],catKeyValues[i],catTypes[i]); + int catViewId = Integer.parseInt(catViewIds[i]); + boolean isModified = Boolean.valueOf(catModifiedStates[i]).booleanValue(); + if (catViewId == -1 || isModified) + newCatListElementVector.addElement(new ListElement(kr)); + else + newCatListElementVector.addElement(oldCatListElementVector.elementAt(catViewId)); + } + reindexListElementVector(newCatListElementVector); + propertyTable_.put(UDDIActionInputs.QUERY_INPUT_ADVANCED_BUSINESS_CATEGORIES,newCatListElementVector); + } + else + removeProperty(UDDIActionInputs.QUERY_INPUT_ADVANCED_BUSINESS_CATEGORIES); + return inputsValid; + } + + public final boolean refreshFromRegistry() + { + UDDIPerspective uddiPerspective = controller_.getUDDIPerspective(); + MessageQueue messageQueue = uddiPerspective.getMessageQueue(); + try + { + String uuidKey = (String)propertyTable_.get(UDDIActionInputs.QUERY_INPUT_UUID_BUSINESS_KEY); + RegistryElement regElement = (RegistryElement)regNode_.getTreeElement(); + UDDIProxy proxy = regElement.getProxy(); + Vector beVector = proxy.get_businessDetail(uuidKey).getBusinessEntityVector(); + BusinessEntity be; + if (beVector.size() > 0) + be = (BusinessEntity)beVector.get(0); + else + be = null; + if (be != null) + { + propertyTable_.put(UDDIActionInputs.LATEST_OBJECT,be); + return true; + } + } + catch (TransportException e) + { + // Feedback via Javascript popups. + } + catch (UDDIException e) + { + // Feedback via Javascript popups. + } + isUpdate_ = false; + return false; + } + + public final boolean run() + { + UDDIPerspective uddiPerspective = controller_.getUDDIPerspective(); + MessageQueue messageQueue = uddiPerspective.getMessageQueue(); + try + { + BusinessEntity be = (BusinessEntity)propertyTable_.get(UDDIActionInputs.LATEST_OBJECT); + String publishURL = (String)propertyTable_.get(UDDIActionInputs.QUERY_INPUT_ADVANCED_PUBLISH_URL); + String userId = (String)propertyTable_.get(UDDIActionInputs.QUERY_INPUT_ADVANCED_USERID); + String password = (String)propertyTable_.get(UDDIActionInputs.QUERY_INPUT_ADVANCED_PASSWORD); + Vector discoveryURLListElementVector = (Vector)propertyTable_.get(UDDIActionInputs.QUERY_INPUT_ADVANCED_BUSINESS_DISCOVERYURLS); + Vector nameListElementVector = (Vector)propertyTable_.get(UDDIActionInputs.QUERY_INPUT_ADVANCED_BUSINESS_NAMES); + Vector descriptionListElementVector = (Vector)propertyTable_.get(UDDIActionInputs.QUERY_INPUT_ADVANCED_BUSINESS_DESCRIPTIONS); + Vector idListElementVector = (Vector)propertyTable_.get(UDDIActionInputs.QUERY_INPUT_ADVANCED_BUSINESS_IDENTIFIERS); + Vector catListElementVector = (Vector)propertyTable_.get(UDDIActionInputs.QUERY_INPUT_ADVANCED_BUSINESS_CATEGORIES); + + Vector discoveryURLVector = new Vector(); + if (discoveryURLListElementVector != null) + { + for (int i=0;i<discoveryURLListElementVector.size();i++) + { + ListElement listElement = (ListElement)discoveryURLListElementVector.elementAt(i); + DiscoveryURL discoveryURL = (DiscoveryURL)listElement.getObject(); + discoveryURLVector.addElement(discoveryURL); + } + } + + Vector nameVector = new Vector(); + for (int i=0;i<nameListElementVector.size();i++) + { + ListElement listElement = (ListElement)nameListElementVector.elementAt(i); + Name name = (Name)listElement.getObject(); + nameVector.addElement(name); + } + + Vector descriptionVector = null; + if (descriptionListElementVector != null) + { + descriptionVector = new Vector(); + for (int i=0;i<descriptionListElementVector.size();i++) + { + ListElement listElement = (ListElement)descriptionListElementVector.elementAt(i); + Description description = (Description)listElement.getObject(); + descriptionVector.addElement(description); + } + } + + IdentifierBag idBag = null; + if (idListElementVector != null) + { + idBag = new IdentifierBag(); + for (int i=0;i<idListElementVector.size();i++) + { + ListElement listElement = (ListElement)idListElementVector.elementAt(i); + KeyedReference kr = (KeyedReference)listElement.getObject(); + idBag.add(kr); + } + } + + CategoryBag catBag = null; + if (catListElementVector != null) + { + catBag = new CategoryBag(); + for (int i=0;i<catListElementVector.size();i++) + { + ListElement listElement = (ListElement)catListElementVector.elementAt(i); + KeyedReference kr = (KeyedReference)listElement.getObject(); + catBag.add(kr); + } + } + + if (discoveryURLVector.size() > 0) + be.setDiscoveryURLs(new DiscoveryURLs(discoveryURLVector)); + else + be.setDiscoveryURLs(null); + be.setNameVector(nameVector); + be.setDescriptionVector(descriptionVector); + be.setIdentifierBag(idBag); + be.setCategoryBag(catBag); + + RegistryElement regElement = (RegistryElement)regNode_.getTreeElement(); + if (!regElement.isLoggedIn()) + regElement.performLogin(publishURL,userId,password); + UDDIProxy proxy = regElement.getProxy(); + Vector beVector = new Vector(); + beVector.add(be); + be = (BusinessEntity)proxy.save_business(regElement.getAuthInfoString(), beVector).getBusinessEntityVector().get(0); + refreshNode(be); + if (isUpdate_) + messageQueue.addMessage(uddiPerspective.getMessage("MSG_INFO_BUSINESS_UPDATED",be.getDefaultNameString())); + else + messageQueue.addMessage(uddiPerspective.getMessage("MSG_INFO_BUSINESS_PUBLISHED",be.getDefaultNameString())); + return true; + } + catch (TransportException e) + { + handleUnexpectedException(uddiPerspective,messageQueue,"TransportException",e); + } + catch (UDDIException e) + { + messageQueue.addMessage(uddiPerspective.getController().getMessage("MSG_ERROR_UNEXPECTED")); + messageQueue.addMessage("UDDIException"); + messageQueue.addMessage(e.toString()); + } + catch (MalformedURLException e) + { + handleUnexpectedException(uddiPerspective,messageQueue,"MalformedURLException",e); + } + return false; + } +} diff --git a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/uddi/actions/UpdateRegistryAction.java b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/uddi/actions/UpdateRegistryAction.java new file mode 100644 index 000000000..acc9a12f2 --- /dev/null +++ b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/uddi/actions/UpdateRegistryAction.java @@ -0,0 +1,122 @@ +/******************************************************************************* + * Copyright (c) 2004 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.wst.ws.internal.explorer.platform.uddi.actions; + +import org.eclipse.wst.ws.internal.explorer.platform.perspective.*; +import org.eclipse.wst.ws.internal.explorer.platform.uddi.constants.*; +import org.eclipse.wst.ws.internal.explorer.platform.uddi.datamodel.*; +import org.eclipse.wst.ws.internal.explorer.platform.uddi.perspective.*; +import org.eclipse.wst.ws.internal.explorer.platform.util.*; + +import java.text.*; +import java.io.*; + +public class UpdateRegistryAction extends UpdateAction +{ + public UpdateRegistryAction(Controller controller) + { + super(controller,false); + } + + protected boolean processOthers(MultipartFormDataParser parser,FormToolPropertiesInterface formToolPI) throws MultipartFormDataException + { + String nameModifiedState = parser.getParameter(UDDIActionInputs.NAME_MODIFIED); + String name = parser.getParameter(UDDIActionInputs.QUERY_INPUT_ADVANCED_REGISTRY_NAME); + String[] userDefinedCategoryTModelKeys = parser.getParameterValues(UDDIActionInputs.CATEGORY_TMODEL_KEY); + String[] userDefinedCategoryData = parser.getParameterValues(UDDIActionInputs.CATEGORY_FILENAME); + + boolean inputsValid = true; + UDDIPerspective uddiPerspective = controller_.getUDDIPerspective(); + MessageQueue messageQueue = uddiPerspective.getMessageQueue(); + + if (nameModifiedState != null && name != null) + { + boolean isModified = Boolean.valueOf(nameModifiedState).booleanValue(); + String newName; + if (isModified) + newName = name; + else + newName = (String)formToolPI.getProperty(UDDIActionInputs.QUERY_INPUT_ADVANCED_REGISTRY_NAME); + propertyTable_.put(UDDIActionInputs.QUERY_INPUT_ADVANCED_REGISTRY_NAME,newName); + if (!Validator.validateString(name)) + { + inputsValid = false; + formToolPI.flagError(UDDIActionInputs.QUERY_INPUT_ADVANCED_REGISTRY_NAME); + messageQueue.addMessage(uddiPerspective.getMessage("MSG_ERROR_INVALID_NAME")); + } + } + else + removeProperty(UDDIActionInputs.QUERY_INPUT_ADVANCED_REGISTRY_NAME); + + if (userDefinedCategoryTModelKeys != null && userDefinedCategoryData != null) + { + RegistryElement regElement = (RegistryElement)regNode_.getTreeElement(); + for (int i=0;i<userDefinedCategoryTModelKeys.length;i++) + { + CategoryModel userDefinedCategory = regElement.getUserDefinedCategory(userDefinedCategoryTModelKeys[i]); +// TODO: Move UDDIPreferenceContext down to org.eclipse.wst.ws +// UDDIPreferenceContext context = WebServicePlugin.getInstance().getUDDIPreferenceContext(); +// userDefinedCategory.setColumnDelimiter(context.getUddiCatDataColumnDelimiter()); +// userDefinedCategory.setStringDelimiter(context.getUddiCatDataStringDelimiter()); + userDefinedCategory.setColumnDelimiter("#"); + userDefinedCategory.setStringDelimiter("\""); + String displayName = userDefinedCategory.getDisplayName(); + if (userDefinedCategoryData[i] == null || userDefinedCategoryData[i].length() < 1) + { + inputsValid = false; + messageQueue.addMessage(uddiPerspective.getMessage("MSG_ERROR_INVALID_USER_DEFINED_CATEGORY_DATA_FILE",displayName)); + formToolPI.flagRowError(UDDIActionInputs.USER_DEFINED_CATEGORIES,userDefinedCategoryTModelKeys[i]); + } + else + { + byte rc = userDefinedCategory.loadData(new BufferedReader(new StringReader(userDefinedCategoryData[i]))); + switch (rc) + { + case CategoryModel.OPERATION_SUCCESSFUL: + messageQueue.addMessage(uddiPerspective.getMessage("MSG_INFO_USER_DEFINED_CATEGORY_DATA_LOADED",displayName)); + break; + case CategoryModel.ERROR_FILE: + inputsValid = false; + ParseException pe = (ParseException)userDefinedCategory.getErrorException(); + String[] args1 = {String.valueOf(pe.getErrorOffset()),displayName,pe.getMessage(),userDefinedCategory.getCategoryKey()}; + messageQueue.addMessage(uddiPerspective.getMessage("MSG_ERROR_INVALID_USER_DEFINED_CATEGORY_DATA_FILE_FORMAT",args1)); + formToolPI.flagRowError(UDDIActionInputs.USER_DEFINED_CATEGORIES,userDefinedCategoryTModelKeys[i]); + break; + case CategoryModel.ERROR_CATEGORY_KEY: + default: + inputsValid = false; + String[] args2 = {displayName,userDefinedCategory.getErrorException().getMessage(),userDefinedCategory.getCategoryKey()}; + messageQueue.addMessage(uddiPerspective.getMessage("MSG_ERROR_INVALID_USER_DEFINED_CATEGORY_DATA_FILE_KEY",args2)); + formToolPI.flagRowError(UDDIActionInputs.USER_DEFINED_CATEGORIES,userDefinedCategoryTModelKeys[i]); + } + } + } + } + return inputsValid; + } + + public final boolean refreshFromRegistry() + { + return true; + } + + public final boolean run() + { + UDDIPerspective uddiPerspective = controller_.getUDDIPerspective(); + MessageQueue messageQueue = uddiPerspective.getMessageQueue(); + String name = (String)propertyTable_.get(UDDIActionInputs.QUERY_INPUT_ADVANCED_REGISTRY_NAME); + RegistryElement regElement = (RegistryElement)regNode_.getTreeElement(); + regElement.setName(name); + regNode_.getTreeElement().setName(name); + messageQueue.addMessage(uddiPerspective.getMessage("MSG_INFO_REGISTRY_UPDATED",name)); + return true; + } +}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/uddi/actions/UpdateServiceAction.java b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/uddi/actions/UpdateServiceAction.java new file mode 100644 index 000000000..309b18f32 --- /dev/null +++ b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/uddi/actions/UpdateServiceAction.java @@ -0,0 +1,483 @@ +/******************************************************************************* + * Copyright (c) 2001, 2004 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ + +package org.eclipse.wst.ws.internal.explorer.platform.uddi.actions; + +import org.eclipse.wst.ws.internal.explorer.platform.datamodel.*; +import org.eclipse.wst.ws.internal.explorer.platform.perspective.*; +import org.eclipse.wst.ws.internal.explorer.platform.uddi.constants.*; +import org.eclipse.wst.ws.internal.explorer.platform.uddi.datamodel.*; +import org.eclipse.wst.ws.internal.explorer.platform.uddi.perspective.*; +import org.eclipse.wst.ws.internal.explorer.platform.uddi.util.Uddi4jHelper; +import org.eclipse.wst.ws.internal.explorer.platform.util.*; + +import org.uddi4j.client.UDDIProxy; +import org.uddi4j.datatype.service.BusinessService; +import org.uddi4j.datatype.business.BusinessEntity; +import org.uddi4j.datatype.tmodel.TModel; +import org.uddi4j.datatype.*; +import org.uddi4j.response.*; +import org.uddi4j.transport.TransportException; +import org.uddi4j.util.*; +import org.uddi4j.UDDIException; + +import javax.wsdl.Definition; +import javax.wsdl.WSDLException; +import java.util.*; +import java.net.*; + +public class UpdateServiceAction extends UpdateAction +{ + private boolean isUpdate_; + public UpdateServiceAction(Controller controller) + { + super(controller,true); + isUpdate_ = true; + } + + protected boolean processOthers(MultipartFormDataParser parser,FormToolPropertiesInterface formToolPI) throws MultipartFormDataException + { + String uuidBusinessKey = parser.getParameter(UDDIActionInputs.QUERY_INPUT_UUID_BUSINESS_KEY); + String uuidServiceKey = parser.getParameter(UDDIActionInputs.QUERY_INPUT_UUID_SERVICE_KEY); + String wsdlURLModifiedState = parser.getParameter(UDDIActionInputs.WSDL_URL_MODIFIED); + String wsdlURL = parser.getParameter(UDDIActionInputs.QUERY_INPUT_ADVANCED_SERVICE_WSDL_URL); + String[] nameModifiedStates = parser.getParameterValues(UDDIActionInputs.NAME_MODIFIED); + String[] nameViewIds = parser.getParameterValues(UDDIActionInputs.NAME_VIEWID); + String[] nameLanguages = parser.getParameterValues(UDDIActionInputs.QUERY_INPUT_ADVANCED_NAME_LANGUAGE); + String[] names = parser.getParameterValues(UDDIActionInputs.QUERY_INPUT_ADVANCED_NAME); + String[] descriptionModifiedStates = parser.getParameterValues(UDDIActionInputs.DESCRIPTION_MODIFIED); + String[] descriptionViewIds = parser.getParameterValues(UDDIActionInputs.DESCRIPTION_VIEWID); + String[] descriptionLanguages = parser.getParameterValues(UDDIActionInputs.QUERY_INPUT_ADVANCED_DESCRIPTION_LANGUAGE); + String[] descriptions = parser.getParameterValues(UDDIActionInputs.QUERY_INPUT_ADVANCED_DESCRIPTION); + String[] catModifiedStates = parser.getParameterValues(UDDIActionInputs.CATEGORY_MODIFIED); + String[] catViewIds = parser.getParameterValues(UDDIActionInputs.CATEGORY_VIEWID); + String[] catTypes = parser.getParameterValues(UDDIActionInputs.QUERY_INPUT_ADVANCED_CATEGORY_TYPE); + String[] catKeyNames = parser.getParameterValues(UDDIActionInputs.QUERY_INPUT_ADVANCED_CATEGORY_KEY_NAME); + String[] catKeyValues = parser.getParameterValues(UDDIActionInputs.QUERY_INPUT_ADVANCED_CATEGORY_KEY_VALUE); + + boolean inputsValid = true; + UDDIPerspective uddiPerspective = controller_.getUDDIPerspective(); + MessageQueue messageQueue = uddiPerspective.getMessageQueue(); + + if (uuidBusinessKey != null) + propertyTable_.put(UDDIActionInputs.QUERY_INPUT_UUID_BUSINESS_KEY,uuidBusinessKey); + + if (uuidServiceKey != null) + propertyTable_.put(UDDIActionInputs.QUERY_INPUT_UUID_SERVICE_KEY,uuidServiceKey); + + if (wsdlURLModifiedState != null && wsdlURL != null) + { + ListElement wsdlURLListElement = (ListElement)formToolPI.getProperty(UDDIActionInputs.QUERY_INPUT_ADVANCED_SERVICE_WSDL_URL); + boolean isModified = Boolean.valueOf(wsdlURLModifiedState).booleanValue(); + if (isModified) + wsdlURLListElement = new ListElement(wsdlURL); + else + wsdlURL = (String)wsdlURLListElement.getObject(); + propertyTable_.put(UDDIActionInputs.QUERY_INPUT_ADVANCED_SERVICE_WSDL_URL,wsdlURLListElement); + if (!Validator.validateURL(wsdlURL)) + { + inputsValid = false; + formToolPI.flagError(UDDIActionInputs.QUERY_INPUT_ADVANCED_SERVICE_WSDL_URL); + messageQueue.addMessage(uddiPerspective.getMessage("MSG_ERROR_INVALID_WSDL_URL")); + } + } + else + removeProperty(UDDIActionInputs.QUERY_INPUT_ADVANCED_SERVICE_WSDL_URL); + + Hashtable languageHash = new Hashtable(); + if (nameModifiedStates != null && nameViewIds != null && nameLanguages != null && names != null) + { + Vector oldNameListElementVector = (Vector)formToolPI.getProperty(UDDIActionInputs.QUERY_INPUT_ADVANCED_SERVICE_NAMES); + Vector newNameListElementVector = new Vector(); + // UDDI's save API (Appendix C of the UDDI V2 Programmers API Specification) requires the following: + // 1) Only the first row can have a blank language. + // 2) Only 1 name per language. + String[] parameters = new String[2]; + parameters[0] = uddiPerspective.getMessage("FORM_LABEL_NAME"); + for (int i=0;i<names.length;i++) + { + parameters[1] = String.valueOf(i+1); + Name uddi4jName; + if (nameLanguages[i].length() > 0) + uddi4jName = new Name(names[i],nameLanguages[i]); + else + { + uddi4jName = new Name(names[i]); + if (i != 0) + { + inputsValid = false; + formToolPI.flagRowError(UDDIActionInputs.QUERY_INPUT_ADVANCED_SERVICE_NAMES,i); + messageQueue.addMessage(uddiPerspective.getMessage("MSG_ERROR_ROW_BLANK_LANGUAGE",parameters)); + } + } + if (languageHash.get(nameLanguages[i]) != null) + { + inputsValid = false; + formToolPI.flagRowError(UDDIActionInputs.QUERY_INPUT_ADVANCED_SERVICE_NAMES,i); + messageQueue.addMessage(uddiPerspective.getMessage("MSG_ERROR_ROW_DUPLICATE_LANGUAGE",parameters)); + } + else + languageHash.put(nameLanguages[i],Boolean.TRUE); + if (!Validator.validateString(names[i])) + { + inputsValid = false; + formToolPI.flagRowError(UDDIActionInputs.QUERY_INPUT_ADVANCED_SERVICE_NAMES,i); + messageQueue.addMessage(uddiPerspective.getMessage("MSG_ERROR_ROW_INVALID_TEXT",parameters)); + } + + int nameViewId = Integer.parseInt(nameViewIds[i]); + boolean isModified = Boolean.valueOf(nameModifiedStates[i]).booleanValue(); + + if (nameViewId == -1 || isModified) + newNameListElementVector.addElement(new ListElement(uddi4jName)); + else + newNameListElementVector.addElement(oldNameListElementVector.elementAt(nameViewId)); + } + reindexListElementVector(newNameListElementVector); + propertyTable_.put(UDDIActionInputs.QUERY_INPUT_ADVANCED_SERVICE_NAMES,newNameListElementVector); + } + else + { + removeProperty(UDDIActionInputs.QUERY_INPUT_ADVANCED_SERVICE_NAMES); + inputsValid = false; + formToolPI.flagError(UDDIActionInputs.QUERY_INPUT_ADVANCED_SERVICE_NAMES); + messageQueue.addMessage(uddiPerspective.getMessage("MSG_ERROR_NO_NAMES")); + } + + if (descriptionModifiedStates != null && descriptionViewIds != null && descriptionLanguages != null && descriptions != null) + { + Vector oldDescriptionListElementVector = (Vector)formToolPI.getProperty(UDDIActionInputs.QUERY_INPUT_ADVANCED_SERVICE_DESCRIPTIONS); + Vector newDescriptionListElementVector = new Vector(); + String[] parameters = new String[2]; + parameters[0] = uddiPerspective.getMessage("FORM_LABEL_DESCRIPTION"); + languageHash.clear(); + for (int i=0;i<descriptions.length;i++) + { + parameters[1] = String.valueOf(i+1); + Description uddi4jDescription; + if (descriptionLanguages[i].length() > 0) + uddi4jDescription = new Description(descriptions[i],descriptionLanguages[i]); + else + { + uddi4jDescription = new Description(descriptions[i]); + if (i != 0) + { + inputsValid = false; + formToolPI.flagRowError(UDDIActionInputs.QUERY_INPUT_ADVANCED_SERVICE_DESCRIPTIONS,i); + messageQueue.addMessage(uddiPerspective.getMessage("MSG_ERROR_ROW_BLANK_LANGUAGE",parameters)); + } + } + if (languageHash.get(descriptionLanguages[i]) != null) + { + inputsValid = false; + formToolPI.flagRowError(UDDIActionInputs.QUERY_INPUT_ADVANCED_SERVICE_DESCRIPTIONS,i); + messageQueue.addMessage(uddiPerspective.getMessage("MSG_ERROR_ROW_DUPLICATE_LANGUAGE",parameters)); + } + else + languageHash.put(descriptionLanguages[i],Boolean.TRUE); + if (!Validator.validateString(descriptions[i])) + { + inputsValid = false; + formToolPI.flagRowError(UDDIActionInputs.QUERY_INPUT_ADVANCED_SERVICE_DESCRIPTIONS,i); + messageQueue.addMessage(uddiPerspective.getMessage("MSG_ERROR_ROW_INVALID_TEXT",parameters)); + } + + int descriptionViewId = Integer.parseInt(descriptionViewIds[i]); + boolean isModified = Boolean.valueOf(descriptionModifiedStates[i]).booleanValue(); + + if (descriptionViewId == -1 || isModified) + newDescriptionListElementVector.addElement(new ListElement(uddi4jDescription)); + else + newDescriptionListElementVector.addElement(oldDescriptionListElementVector.elementAt(descriptionViewId)); + } + reindexListElementVector(newDescriptionListElementVector); + propertyTable_.put(UDDIActionInputs.QUERY_INPUT_ADVANCED_SERVICE_DESCRIPTIONS,newDescriptionListElementVector); + } + else + removeProperty(UDDIActionInputs.QUERY_INPUT_ADVANCED_SERVICE_DESCRIPTIONS); + + if (catModifiedStates != null && catViewIds != null && catTypes != null && catKeyNames != null && catKeyValues != null) + { + Vector oldCatListElementVector = (Vector)formToolPI.getProperty(UDDIActionInputs.QUERY_INPUT_ADVANCED_SERVICE_CATEGORIES); + Vector newCatListElementVector = new Vector(); + for (int i=0;i<catTypes.length;i++) + { + KeyedReference kr = new KeyedReference(catKeyNames[i],catKeyValues[i],catTypes[i]); + int catViewId = Integer.parseInt(catViewIds[i]); + boolean isModified = Boolean.valueOf(catModifiedStates[i]).booleanValue(); + if (catViewId == -1 || isModified) + newCatListElementVector.addElement(new ListElement(kr)); + else + newCatListElementVector.addElement(oldCatListElementVector.elementAt(catViewId)); + } + reindexListElementVector(newCatListElementVector); + propertyTable_.put(UDDIActionInputs.QUERY_INPUT_ADVANCED_SERVICE_CATEGORIES,newCatListElementVector); + } + else + removeProperty(UDDIActionInputs.QUERY_INPUT_ADVANCED_SERVICE_CATEGORIES); + return inputsValid; + } + + public final boolean refreshBusinessFromRegistry() + { + UDDIPerspective uddiPerspective = controller_.getUDDIPerspective(); + MessageQueue messageQueue = uddiPerspective.getMessageQueue(); + try + { + String uuidBusinessKey = (String)propertyTable_.get(UDDIActionInputs.QUERY_INPUT_UUID_BUSINESS_KEY); + RegistryElement regElement = (RegistryElement)regNode_.getTreeElement(); + UDDIProxy proxy = regElement.getProxy(); + Vector beVector = proxy.get_businessDetail(uuidBusinessKey).getBusinessEntityVector(); + BusinessEntity be; + if (beVector.size() > 0) + be = (BusinessEntity)beVector.get(0); + else + be = null; + if (be != null) + { + propertyTable_.put(UDDIActionInputs.LATEST_BUSINESS,be); + return true; + } + } + catch (TransportException e) + { + // Feedback via Javascript popups. + } + catch (UDDIException e) + { + // Feedback via Javascript popups. + } + return false; + } + + public final boolean refreshFromRegistry() + { + UDDIPerspective uddiPerspective = controller_.getUDDIPerspective(); + try + { + String uuidServiceKey = (String)propertyTable_.get(UDDIActionInputs.QUERY_INPUT_UUID_SERVICE_KEY); + RegistryElement regElement = (RegistryElement)regNode_.getTreeElement(); + UDDIProxy proxy = regElement.getProxy(); + ServiceDetail serviceDetail = proxy.get_serviceDetail(uuidServiceKey); + Vector businessServiceVector = serviceDetail.getBusinessServiceVector(); + if (businessServiceVector.size() > 0) + { + propertyTable_.put(UDDIActionInputs.LATEST_OBJECT,businessServiceVector.elementAt(0)); + return true; + } + } + catch (UDDIException e) + { + // Feedback via Javascript popups. + } + catch (TransportException e) + { + // Feedback via Javascript popups. + } + isUpdate_ = false; + return false; + } + + public final RegPublishTool setupRegPublishTool() + { + // Prepare for re-publishing a now-stale service whose business has also been eliminated. + RegPublishTool regPublishTool = regNode_.getRegPublishTool(); + regPublishTool.setProperty(UDDIActionInputs.SUBQUERY_KEY,""); + regPublishTool.setProperty(UDDIActionInputs.QUERY_ITEM,String.valueOf(UDDIActionInputs.QUERY_ITEM_SERVICES)); + regPublishTool.setProperty(UDDIActionInputs.QUERY_STYLE_SERVICES,String.valueOf(UDDIActionInputs.QUERY_STYLE_ADVANCED)); + + regPublishTool.setProperty(UDDIActionInputs.QUERY_INPUT_ADVANCED_SERVICE_WSDL_URL,propertyTable_.get(UDDIActionInputs.QUERY_INPUT_ADVANCED_SERVICE_WSDL_URL)); + + Vector nameListElementVector = (Vector)propertyTable_.get(UDDIActionInputs.QUERY_INPUT_ADVANCED_SERVICE_NAMES); + Vector descriptionListElementVector = (Vector)propertyTable_.get(UDDIActionInputs.QUERY_INPUT_ADVANCED_SERVICE_DESCRIPTIONS); + Vector catListElementVector = (Vector)propertyTable_.get(UDDIActionInputs.QUERY_INPUT_ADVANCED_SERVICE_CATEGORIES); + + Vector nameVector = new Vector(); + for (int i=0;i<nameListElementVector.size();i++) + { + ListElement listElement = (ListElement)nameListElementVector.elementAt(i); + Name name = (Name)listElement.getObject(); + nameVector.addElement(name); + } + + Vector descriptionVector = null; + if (descriptionListElementVector != null) + { + descriptionVector = new Vector(); + for (int i=0;i<descriptionListElementVector.size();i++) + { + ListElement listElement = (ListElement)descriptionListElementVector.elementAt(i); + Description description = (Description)listElement.getObject(); + descriptionVector.addElement(description); + } + } + else + regPublishTool.removeProperty(UDDIActionInputs.QUERY_INPUT_ADVANCED_SERVICE_DESCRIPTIONS); + + CategoryBag catBag = null; + if (catListElementVector != null) + { + catBag = new CategoryBag(); + for (int i=0;i<catListElementVector.size();i++) + { + ListElement listElement = (ListElement)catListElementVector.elementAt(i); + KeyedReference kr = (KeyedReference)listElement.getObject(); + catBag.add(kr); + } + } + else + regPublishTool.removeProperty(UDDIActionInputs.QUERY_INPUT_ADVANCED_SERVICE_CATEGORIES); + + regPublishTool.setProperty(UDDIActionInputs.QUERY_INPUT_ADVANCED_SERVICE_NAMES,nameVector); + if (descriptionVector != null) + regPublishTool.setProperty(UDDIActionInputs.QUERY_INPUT_ADVANCED_SERVICE_DESCRIPTIONS,descriptionVector); + if (catBag != null) + regPublishTool.setProperty(UDDIActionInputs.QUERY_INPUT_ADVANCED_SERVICE_CATEGORIES,catBag); + return regPublishTool; + } + + public final boolean run() + { + UDDIPerspective uddiPerspective = controller_.getUDDIPerspective(); + MessageQueue messageQueue = uddiPerspective.getMessageQueue(); + RegistryElement regElement = (RegistryElement)regNode_.getTreeElement(); + try + { + BusinessEntity be = (BusinessEntity)propertyTable_.get(UDDIActionInputs.LATEST_BUSINESS); + String publishURL = (String)propertyTable_.get(UDDIActionInputs.QUERY_INPUT_ADVANCED_PUBLISH_URL); + String userId = (String)propertyTable_.get(UDDIActionInputs.QUERY_INPUT_ADVANCED_USERID); + String password = (String)propertyTable_.get(UDDIActionInputs.QUERY_INPUT_ADVANCED_PASSWORD); + String uuidServiceKey = (String)propertyTable_.get(UDDIActionInputs.QUERY_INPUT_UUID_SERVICE_KEY); + ListElement wsdlURLListElement = (ListElement)propertyTable_.get(UDDIActionInputs.QUERY_INPUT_ADVANCED_SERVICE_WSDL_URL); + Vector nameListElementVector = (Vector)propertyTable_.get(UDDIActionInputs.QUERY_INPUT_ADVANCED_SERVICE_NAMES); + Vector descriptionListElementVector = (Vector)propertyTable_.get(UDDIActionInputs.QUERY_INPUT_ADVANCED_SERVICE_DESCRIPTIONS); + Vector catListElementVector = (Vector)propertyTable_.get(UDDIActionInputs.QUERY_INPUT_ADVANCED_SERVICE_CATEGORIES); + + String wsdlURL = (String)wsdlURLListElement.getObject(); + + Vector nameVector = new Vector(); + for (int i=0;i<nameListElementVector.size();i++) + { + ListElement listElement = (ListElement)nameListElementVector.elementAt(i); + Name name = (Name)listElement.getObject(); + nameVector.addElement(name); + } + + Vector descriptionVector = null; + if (descriptionListElementVector != null) + { + descriptionVector = new Vector(); + for (int i=0;i<descriptionListElementVector.size();i++) + { + ListElement listElement = (ListElement)descriptionListElementVector.elementAt(i); + Description description = (Description)listElement.getObject(); + descriptionVector.addElement(description); + } + } + + CategoryBag catBag = null; + if (catListElementVector != null) + { + catBag = new CategoryBag(); + for (int i=0;i<catListElementVector.size();i++) + { + ListElement listElement = (ListElement)catListElementVector.elementAt(i); + KeyedReference kr = (KeyedReference)listElement.getObject(); + catBag.add(kr); + } + } + + if (!regElement.isLoggedIn()) + regElement.performLogin(publishURL,userId,password); + UDDIProxy proxy = regElement.getProxy(); + + // Note: The JSP will prevent this routine from executing if be is null. + Uddi4jHelper uddi4jHelper = new Uddi4jHelper(); + Definition def = uddi4jHelper.getWSDLDefinition(wsdlURL); + + // Publish/update the service interfaces first. + RegPublishServiceInterfaceSimpleAction regPublishSIAction = new RegPublishServiceInterfaceSimpleAction(controller_); + int currentNodeId = getSelectedNavigatorNode().getNodeId(); + NodeManager nodeManager = regNode_.getNodeManager(); + + Hashtable tModelsTable = new Hashtable(); + TModel[] tModels = null; + if (uddi4jHelper.isMonolithicWSDL(def)) + { + tModels = new TModel[1]; + tModels[0] = uddi4jHelper.newTModel(wsdlURL, def); + } + else + { + String[] imports = uddi4jHelper.getImports(def, wsdlURL); + tModels = new TModel[imports.length]; + for (int i = 0; i < tModels.length; i++) + tModels[i] = uddi4jHelper.newTModel(imports[i]); + } + + if (tModels != null) + { + for (int i=0;i<tModels.length;i++) + { + boolean inputsValid = regPublishSIAction.populatePropertyTable(uddi4jHelper.getWSDL(tModels[i]), tModels[i]); + if (inputsValid) + { + regPublishSIAction.run(); + Object savedTModel = regPublishSIAction.getPropertyTable().get(UDDIActionInputs.QUERY_OUTPUT_SAVED_TMODEL); + if (savedTModel != null) + { + tModelsTable.put(((TModel)savedTModel).getNameString(), savedTModel); + } + // Reselect the current node. + nodeManager.setSelectedNodeId(currentNodeId); + } + } + } + + BusinessService busService = uddi4jHelper.newBusinessService(wsdlURL, def, tModelsTable); + if (isUpdate_) + busService.setServiceKey(uuidServiceKey); + busService.setBusinessKey(be.getBusinessKey()); + busService.setNameVector(nameVector); + busService.setDescriptionVector(descriptionVector); + busService.setCategoryBag(catBag); + regElement.handlePreInvocation(busService); + Vector bsVector = new Vector(); + bsVector.add(busService); + busService = (BusinessService)proxy.save_service(regElement.getAuthInfoString(), bsVector).getBusinessServiceVector().get(0); + refreshNode(busService); + if (isUpdate_) + messageQueue.addMessage(uddiPerspective.getMessage("MSG_INFO_SERVICE_UPDATED",busService.getDefaultNameString())); + else + messageQueue.addMessage(uddiPerspective.getMessage("MSG_INFO_SERVICE_PUBLISHED",busService.getDefaultNameString())); + return true; + } + catch (WSDLException e) + { + handleUnexpectedException(uddiPerspective,messageQueue,"WSDLException",e); + } + catch (TransportException e) + { + handleUnexpectedException(uddiPerspective,messageQueue,"TransportException",e); + } + catch (UDDIException e) + { + messageQueue.addMessage(uddiPerspective.getController().getMessage("MSG_ERROR_UNEXPECTED")); + messageQueue.addMessage("UDDIException"); + messageQueue.addMessage(e.toString()); + } + catch (MalformedURLException e) + { + handleUnexpectedException(uddiPerspective,messageQueue,"MalformedURLException",e); + } + return false; + } +} diff --git a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/uddi/actions/UpdateServiceInterfaceAction.java b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/uddi/actions/UpdateServiceInterfaceAction.java new file mode 100644 index 000000000..d8040278e --- /dev/null +++ b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/uddi/actions/UpdateServiceInterfaceAction.java @@ -0,0 +1,331 @@ +/******************************************************************************* + * Copyright (c) 2001, 2004 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ + +package org.eclipse.wst.ws.internal.explorer.platform.uddi.actions; + +import org.eclipse.wst.ws.internal.explorer.platform.datamodel.*; +import org.eclipse.wst.ws.internal.explorer.platform.perspective.*; +import org.eclipse.wst.ws.internal.explorer.platform.uddi.constants.*; +import org.eclipse.wst.ws.internal.explorer.platform.uddi.datamodel.*; +import org.eclipse.wst.ws.internal.explorer.platform.uddi.perspective.*; +import org.eclipse.wst.ws.internal.explorer.platform.uddi.util.Uddi4jHelper; +import org.eclipse.wst.ws.internal.explorer.platform.util.*; + +import org.uddi4j.client.UDDIProxy; +import org.uddi4j.datatype.tmodel.TModel; +import org.uddi4j.datatype.*; +import org.uddi4j.transport.TransportException; +import org.uddi4j.response.*; +import org.uddi4j.util.*; +import org.uddi4j.UDDIException; + +import javax.wsdl.WSDLException; +import java.util.*; +import java.net.*; + +public class UpdateServiceInterfaceAction extends UpdateAction +{ + private boolean isUpdate_; + public UpdateServiceInterfaceAction(Controller controller) + { + super(controller,true); + isUpdate_ = true; + } + + protected boolean processOthers(MultipartFormDataParser parser,FormToolPropertiesInterface formToolPI) throws MultipartFormDataException + { + String uuidKey = parser.getParameter(UDDIActionInputs.QUERY_INPUT_UUID_SERVICE_INTERFACE_KEY); + String wsdlURLModifiedState = parser.getParameter(UDDIActionInputs.WSDL_URL_MODIFIED); + String wsdlURL = parser.getParameter(UDDIActionInputs.QUERY_INPUT_ADVANCED_SERVICE_INTERFACE_WSDL_URL); + String nameModifiedState = parser.getParameter(UDDIActionInputs.NAME_MODIFIED); + String name = parser.getParameter(UDDIActionInputs.QUERY_INPUT_ADVANCED_SERVICE_INTERFACE_NAME); + String[] descriptionModifiedStates = parser.getParameterValues(UDDIActionInputs.DESCRIPTION_MODIFIED); + String[] descriptionViewIds = parser.getParameterValues(UDDIActionInputs.DESCRIPTION_VIEWID); + String[] descriptionLanguages = parser.getParameterValues(UDDIActionInputs.QUERY_INPUT_ADVANCED_DESCRIPTION_LANGUAGE); + String[] descriptions = parser.getParameterValues(UDDIActionInputs.QUERY_INPUT_ADVANCED_DESCRIPTION); + String[] idModifiedStates = parser.getParameterValues(UDDIActionInputs.IDENTIFIER_MODIFIED); + String[] idViewIds = parser.getParameterValues(UDDIActionInputs.IDENTIFIER_VIEWID); + String[] idTypes = parser.getParameterValues(UDDIActionInputs.QUERY_INPUT_ADVANCED_IDENTIFIER_TYPE); + String[] idKeyNames = parser.getParameterValues(UDDIActionInputs.QUERY_INPUT_ADVANCED_IDENTIFIER_KEY_NAME); + String[] idKeyValues = parser.getParameterValues(UDDIActionInputs.QUERY_INPUT_ADVANCED_IDENTIFIER_KEY_VALUE); + String[] catModifiedStates = parser.getParameterValues(UDDIActionInputs.CATEGORY_MODIFIED); + String[] catViewIds = parser.getParameterValues(UDDIActionInputs.CATEGORY_VIEWID); + String[] catTypes = parser.getParameterValues(UDDIActionInputs.QUERY_INPUT_ADVANCED_CATEGORY_TYPE); + String[] catKeyNames = parser.getParameterValues(UDDIActionInputs.QUERY_INPUT_ADVANCED_CATEGORY_KEY_NAME); + String[] catKeyValues = parser.getParameterValues(UDDIActionInputs.QUERY_INPUT_ADVANCED_CATEGORY_KEY_VALUE); + + boolean inputsValid = true; + UDDIPerspective uddiPerspective = controller_.getUDDIPerspective(); + MessageQueue messageQueue = uddiPerspective.getMessageQueue(); + + if (uuidKey != null) + propertyTable_.put(UDDIActionInputs.QUERY_INPUT_UUID_SERVICE_INTERFACE_KEY,uuidKey); + + if (wsdlURLModifiedState != null && wsdlURL != null) + { + ListElement wsdlURLListElement = (ListElement)formToolPI.getProperty(UDDIActionInputs.QUERY_INPUT_ADVANCED_SERVICE_INTERFACE_WSDL_URL); + boolean isModified = Boolean.valueOf(wsdlURLModifiedState).booleanValue(); + if (isModified) + wsdlURLListElement = new ListElement(wsdlURL); + else + wsdlURL = (String)wsdlURLListElement.getObject(); + propertyTable_.put(UDDIActionInputs.QUERY_INPUT_ADVANCED_SERVICE_INTERFACE_WSDL_URL,wsdlURLListElement); + if (!Validator.validateURL(wsdlURL)) + { + inputsValid = false; + formToolPI.flagError(UDDIActionInputs.QUERY_INPUT_ADVANCED_SERVICE_INTERFACE_WSDL_URL); + messageQueue.addMessage(uddiPerspective.getMessage("MSG_ERROR_INVALID_WSDL_URL")); + } + } + else + removeProperty(UDDIActionInputs.QUERY_INPUT_ADVANCED_SERVICE_INTERFACE_WSDL_URL); + + if (nameModifiedState != null && name != null) + { + ListElement nameListElement = (ListElement)formToolPI.getProperty(UDDIActionInputs.QUERY_INPUT_ADVANCED_SERVICE_INTERFACE_NAME); + boolean isModified = Boolean.valueOf(nameModifiedState).booleanValue(); + if (isModified) + nameListElement = new ListElement(name); + else + name = (String)nameListElement.getObject(); + propertyTable_.put(UDDIActionInputs.QUERY_INPUT_ADVANCED_SERVICE_INTERFACE_NAME,nameListElement); + if (!Validator.validateString(name)) + { + inputsValid = false; + formToolPI.flagError(UDDIActionInputs.QUERY_INPUT_ADVANCED_SERVICE_INTERFACE_NAME); + messageQueue.addMessage(uddiPerspective.getMessage("MSG_ERROR_INVALID_NAME")); + } + } + else + removeProperty(UDDIActionInputs.QUERY_INPUT_ADVANCED_SERVICE_INTERFACE_NAME); + + Hashtable languageHash = new Hashtable(); + if (descriptionModifiedStates != null && descriptionViewIds != null && descriptionLanguages != null && descriptions != null) + { + Vector oldDescriptionListElementVector = (Vector)formToolPI.getProperty(UDDIActionInputs.QUERY_INPUT_ADVANCED_SERVICE_INTERFACE_DESCRIPTIONS); + Vector newDescriptionListElementVector = new Vector(); + String[] parameters = new String[2]; + parameters[0] = uddiPerspective.getMessage("FORM_LABEL_DESCRIPTION"); + languageHash.clear(); + for (int i=0;i<descriptions.length;i++) + { + parameters[1] = String.valueOf(i+1); + Description uddi4jDescription; + if (descriptionLanguages[i].length() > 0) + uddi4jDescription = new Description(descriptions[i],descriptionLanguages[i]); + else + { + uddi4jDescription = new Description(descriptions[i]); + if (i != 0) + { + inputsValid = false; + formToolPI.flagRowError(UDDIActionInputs.QUERY_INPUT_ADVANCED_SERVICE_INTERFACE_DESCRIPTIONS,i); + messageQueue.addMessage(uddiPerspective.getMessage("MSG_ERROR_ROW_BLANK_LANGUAGE",parameters)); + } + } + if (languageHash.get(descriptionLanguages[i]) != null) + { + inputsValid = false; + formToolPI.flagRowError(UDDIActionInputs.QUERY_INPUT_ADVANCED_SERVICE_INTERFACE_DESCRIPTIONS,i); + messageQueue.addMessage(uddiPerspective.getMessage("MSG_ERROR_ROW_DUPLICATE_LANGUAGE",parameters)); + } + else + languageHash.put(descriptionLanguages[i],Boolean.TRUE); + if (!Validator.validateString(descriptions[i])) + { + inputsValid = false; + formToolPI.flagRowError(UDDIActionInputs.QUERY_INPUT_ADVANCED_SERVICE_INTERFACE_DESCRIPTIONS,i); + messageQueue.addMessage(uddiPerspective.getMessage("MSG_ERROR_ROW_INVALID_TEXT",parameters)); + } + + int descriptionViewId = Integer.parseInt(descriptionViewIds[i]); + boolean isModified = Boolean.valueOf(descriptionModifiedStates[i]).booleanValue(); + + if (descriptionViewId == -1 || isModified) + newDescriptionListElementVector.addElement(new ListElement(uddi4jDescription)); + else + newDescriptionListElementVector.addElement(oldDescriptionListElementVector.elementAt(descriptionViewId)); + } + reindexListElementVector(newDescriptionListElementVector); + propertyTable_.put(UDDIActionInputs.QUERY_INPUT_ADVANCED_SERVICE_INTERFACE_DESCRIPTIONS,newDescriptionListElementVector); + } + else + removeProperty(UDDIActionInputs.QUERY_INPUT_ADVANCED_SERVICE_INTERFACE_DESCRIPTIONS); + + if (idModifiedStates != null && idViewIds != null && idTypes != null && idKeyNames != null && idKeyValues != null) + { + Vector oldIdListElementVector = (Vector)formToolPI.getProperty(UDDIActionInputs.QUERY_INPUT_ADVANCED_SERVICE_INTERFACE_IDENTIFIERS); + Vector newIdListElementVector = new Vector(); + for (int i=0;i<idKeyNames.length;i++) + { + KeyedReference kr = new KeyedReference(idKeyNames[i],idKeyValues[i],idTypes[i]); + int idViewId = Integer.parseInt(idViewIds[i]); + boolean isModified = Boolean.valueOf(idModifiedStates[i]).booleanValue(); + if (idViewId == -1 || isModified) + newIdListElementVector.addElement(new ListElement(kr)); + else + newIdListElementVector.addElement(oldIdListElementVector.elementAt(idViewId)); + } + reindexListElementVector(newIdListElementVector); + propertyTable_.put(UDDIActionInputs.QUERY_INPUT_ADVANCED_SERVICE_INTERFACE_IDENTIFIERS,newIdListElementVector); + } + else + removeProperty(UDDIActionInputs.QUERY_INPUT_ADVANCED_SERVICE_INTERFACE_IDENTIFIERS); + + if (catModifiedStates != null && catViewIds != null && catTypes != null && catKeyNames != null && catKeyValues != null) + { + Vector oldCatListElementVector = (Vector)formToolPI.getProperty(UDDIActionInputs.QUERY_INPUT_ADVANCED_SERVICE_INTERFACE_CATEGORIES); + Vector newCatListElementVector = new Vector(); + for (int i=0;i<catTypes.length;i++) + { + KeyedReference kr = new KeyedReference(catKeyNames[i],catKeyValues[i],catTypes[i]); + int catViewId = Integer.parseInt(catViewIds[i]); + boolean isModified = Boolean.valueOf(catModifiedStates[i]).booleanValue(); + if (catViewId == -1 || isModified) + newCatListElementVector.addElement(new ListElement(kr)); + else + newCatListElementVector.addElement(oldCatListElementVector.elementAt(catViewId)); + } + reindexListElementVector(newCatListElementVector); + propertyTable_.put(UDDIActionInputs.QUERY_INPUT_ADVANCED_SERVICE_INTERFACE_CATEGORIES,newCatListElementVector); + } + else + removeProperty(UDDIActionInputs.QUERY_INPUT_ADVANCED_SERVICE_INTERFACE_CATEGORIES); + return inputsValid; + } + + public final boolean refreshFromRegistry() + { + UDDIPerspective uddiPerspective = controller_.getUDDIPerspective(); + try + { + String uuidKey = (String)propertyTable_.get(UDDIActionInputs.QUERY_INPUT_UUID_SERVICE_INTERFACE_KEY); + RegistryElement regElement = (RegistryElement)regNode_.getTreeElement(); + UDDIProxy proxy = regElement.getProxy(); + TModelDetail tModelDetail = proxy.get_tModelDetail(uuidKey); + Vector tModelVector = tModelDetail.getTModelVector(); + if (tModelVector.size() > 0) + { + propertyTable_.put(UDDIActionInputs.LATEST_OBJECT,tModelVector.elementAt(0)); + return true; + } + } + catch (UDDIException e) + { + // Feedback via Javascript popups. + } + catch (TransportException e) + { + // Feedback via Javascript popups. + } + isUpdate_ = false; + return false; + } + + public final boolean run() + { + UDDIPerspective uddiPerspective = controller_.getUDDIPerspective(); + MessageQueue messageQueue = uddiPerspective.getMessageQueue(); + try + { + String uuidKey = (String)propertyTable_.get(UDDIActionInputs.QUERY_INPUT_UUID_SERVICE_INTERFACE_KEY); + String publishURL = (String)propertyTable_.get(UDDIActionInputs.QUERY_INPUT_ADVANCED_PUBLISH_URL); + String userId = (String)propertyTable_.get(UDDIActionInputs.QUERY_INPUT_ADVANCED_USERID); + String password = (String)propertyTable_.get(UDDIActionInputs.QUERY_INPUT_ADVANCED_PASSWORD); + ListElement wsdlURLListElement = (ListElement)propertyTable_.get(UDDIActionInputs.QUERY_INPUT_ADVANCED_SERVICE_INTERFACE_WSDL_URL); + ListElement nameListElement = (ListElement)propertyTable_.get(UDDIActionInputs.QUERY_INPUT_ADVANCED_SERVICE_INTERFACE_NAME); + Vector descriptionListElementVector = (Vector)propertyTable_.get(UDDIActionInputs.QUERY_INPUT_ADVANCED_SERVICE_INTERFACE_DESCRIPTIONS); + Vector idListElementVector = (Vector)propertyTable_.get(UDDIActionInputs.QUERY_INPUT_ADVANCED_SERVICE_INTERFACE_IDENTIFIERS); + Vector catListElementVector = (Vector)propertyTable_.get(UDDIActionInputs.QUERY_INPUT_ADVANCED_SERVICE_INTERFACE_CATEGORIES); + + String wsdlURL = (String)wsdlURLListElement.getObject(); + + String name = (String)nameListElement.getObject(); + + Vector descriptionVector = null; + if (descriptionListElementVector != null) + { + descriptionVector = new Vector(); + for (int i=0;i<descriptionListElementVector.size();i++) + { + ListElement listElement = (ListElement)descriptionListElementVector.elementAt(i); + Description description = (Description)listElement.getObject(); + descriptionVector.addElement(description); + } + } + + IdentifierBag idBag = null; + if (idListElementVector != null) + { + idBag = new IdentifierBag(); + for (int i=0;i<idListElementVector.size();i++) + { + ListElement listElement = (ListElement)idListElementVector.elementAt(i); + KeyedReference kr = (KeyedReference)listElement.getObject(); + idBag.add(kr); + } + } + + CategoryBag catBag = null; + if (catListElementVector != null) + { + catBag = new CategoryBag(); + for (int i=0;i<catListElementVector.size();i++) + { + ListElement listElement = (ListElement)catListElementVector.elementAt(i); + KeyedReference kr = (KeyedReference)listElement.getObject(); + catBag.add(kr); + } + } + + TModel tModel = (new Uddi4jHelper()).newTModel(wsdlURL); + if (isUpdate_) + tModel.setTModelKey(uuidKey); + tModel.setName(name); + tModel.setDescriptionVector(descriptionVector); + tModel.setIdentifierBag(idBag); + tModel.setCategoryBag(catBag); + + RegistryElement regElement = (RegistryElement)regNode_.getTreeElement(); + if (!regElement.isLoggedIn()) + regElement.performLogin(publishURL,userId,password); + UDDIProxy proxy = regElement.getProxy(); + Vector tModelVector = new Vector(); + tModelVector.add(tModel); + tModel = (TModel)proxy.save_tModel(regElement.getAuthInfoString(), tModelVector).getTModelVector().get(0); + refreshNode(tModel); + if (isUpdate_) + messageQueue.addMessage(uddiPerspective.getMessage("MSG_INFO_SERVICE_INTERFACE_UPDATED",tModel.getNameString())); + else + messageQueue.addMessage(uddiPerspective.getMessage("MSG_INFO_SERVICE_INTERFACE_PUBLISHED",tModel.getNameString())); + return true; + } + catch (WSDLException e) + { + handleUnexpectedException(uddiPerspective,messageQueue,"WSDLException",e); + } + catch (TransportException e) + { + handleUnexpectedException(uddiPerspective,messageQueue,"TransportException",e); + } + catch (UDDIException e) + { + messageQueue.addMessage(uddiPerspective.getController().getMessage("MSG_ERROR_UNEXPECTED")); + messageQueue.addMessage("UDDIException"); + messageQueue.addMessage(e.toString()); + } + catch (MalformedURLException e) + { + handleUnexpectedException(uddiPerspective,messageQueue,"MalformedURLException",e); + } + return false; + } +} |