diff options
Diffstat (limited to 'bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/favorites/datamodel')
17 files changed, 0 insertions, 1516 deletions
diff --git a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/favorites/datamodel/FavoritesElement.java b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/favorites/datamodel/FavoritesElement.java deleted file mode 100644 index 07102a268..000000000 --- a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/favorites/datamodel/FavoritesElement.java +++ /dev/null @@ -1,36 +0,0 @@ -/******************************************************************************* - * 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.favorites.datamodel; - -import java.util.Enumeration; -import org.eclipse.wst.ws.internal.datamodel.Model; -import org.eclipse.wst.ws.internal.explorer.platform.constants.ModelConstants; -import org.eclipse.wst.ws.internal.explorer.platform.datamodel.TreeElement; - -/** -* The data model element that represents -* a WSIL document -*/ -public class FavoritesElement extends TreeElement { - - public FavoritesElement(String name, Model model) { - super(name, model); - } - - public FavoritesFolderElement getParentFolderElement() { - Enumeration e = getElements(ModelConstants.REL_OWNER); - if (!e.hasMoreElements()) - return null; - else - return (FavoritesFolderElement)e.nextElement(); - } -} diff --git a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/favorites/datamodel/FavoritesFolderElement.java b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/favorites/datamodel/FavoritesFolderElement.java deleted file mode 100644 index 2e637d3d8..000000000 --- a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/favorites/datamodel/FavoritesFolderElement.java +++ /dev/null @@ -1,49 +0,0 @@ -/******************************************************************************* - * 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.favorites.datamodel; - -import java.util.Enumeration; -import java.util.Hashtable; -import org.eclipse.wst.ws.internal.datamodel.Model; -import org.eclipse.wst.ws.internal.explorer.platform.datamodel.TreeElement; -import org.eclipse.wst.ws.internal.explorer.platform.perspective.NodeManager; - -/** -* The data model element that represents -* a WSIL document -*/ -public abstract class FavoritesFolderElement extends TreeElement -{ - protected NodeManager nodeManager_; - - public FavoritesFolderElement(String name, Model model, NodeManager nodeManager) { - super(name, model); - nodeManager_ = nodeManager; - } - - protected FavoritesMainElement getFavoritesMainElement() { - return (FavoritesMainElement)nodeManager_.getRootNode().getTreeElement(); - } - - public abstract void init(FavoritesMainElement favMainElement); - - public abstract boolean removeFavoriteByNodeID(int nodeID,String pluginMetadataDirectory); - - public abstract boolean removeAllFavorites(String pluginMetadataDirectory); - - public abstract boolean addFavorite(Hashtable table); - - public abstract boolean favoriteExists(Hashtable table); - - public abstract Enumeration getAllFavorites(); - -} diff --git a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/favorites/datamodel/FavoritesMainElement.java b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/favorites/datamodel/FavoritesMainElement.java deleted file mode 100644 index daeb65688..000000000 --- a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/favorites/datamodel/FavoritesMainElement.java +++ /dev/null @@ -1,137 +0,0 @@ -/******************************************************************************* - * 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.favorites.datamodel; - -import org.apache.wsil.Link; -import org.apache.wsil.Service; -import org.eclipse.wst.ws.internal.datamodel.Model; -import org.eclipse.wst.ws.internal.explorer.favorites.FavoritesRegistryTypeWSE; -import org.eclipse.wst.ws.internal.explorer.platform.datamodel.TreeElement; -import org.eclipse.wst.ws.internal.explorer.platform.favorites.constants.FavoritesModelConstants; -import org.eclipse.wst.ws.internal.explorer.platform.favorites.perspective.FavoritesPerspective; -import org.eclipse.wst.ws.internal.explorer.platform.perspective.Controller; - -/** -* The data model element that represents -* a WSIL document -*/ -public class FavoritesMainElement extends TreeElement -{ - private Controller controller_; - private FavoritesRegistryTypeWSE favRegistry_; - - public FavoritesMainElement(String name, Model model, Controller controller) - { - super(name, model); - controller_ = controller; - favRegistry_ = new FavoritesRegistryTypeWSE( - controller.getDefaultFavoritesLocation(), - controller.getServletEngineStateLocation() - ); - } - - public boolean restoreFavoritesDefault() - { - favRegistry_.restoreFavoritesDefault(); - return saveFavorites(); - } - - public boolean saveFavorites() - { - try - { - favRegistry_.save(); - return true; - } - catch (Throwable t) - { - FavoritesPerspective favPerspective = controller_.getFavoritesPerspective(); - favPerspective.getMessageQueue().addMessage(favPerspective.getMessage("MSG_ERROR_SAVE_FAVORITES_WSIL", favRegistry_.getWriteLocation())); - return false; - } - } - - public Link addUDDIRegistry(String registryName, String inquiryAPI, String publishAPI, String registrationURL) - { - return favRegistry_.addUDDIRegistry(registryName, inquiryAPI, publishAPI, registrationURL); - } - - public Link addUDDIBusiness(String businessName, String inquiryAPI, String businessKey) - { - return favRegistry_.addUDDIBusiness(businessName, inquiryAPI, businessKey); - } - - public Service addUDDIService(String serviceName, String inquiryAPI, String serviceKey) - { - return favRegistry_.addUDDIService(serviceName, inquiryAPI, serviceKey); - } - - public Service addUDDIServiceInterface(String serIntName, String inquiryAPI, String serIntKey) - { - return favRegistry_.addUDDIServiceInterface(serIntName, inquiryAPI, serIntKey); - } - - public Service addWSDLService(String url) - { - return favRegistry_.addWSDLService(url); - } - - public Link addWSILLink(String url) - { - return favRegistry_.addWSILLink(url); - } - - public boolean removeService(Service service) { - favRegistry_.removeService(service); - return true; - } - - public boolean removeLink(Link link) { - favRegistry_.removeLink(link); - return true; - } - - public Link[] loadUDDIRegistries() - { - return favRegistry_.loadUDDIRegistries(); - } - - public Link[] loadUDDIBusinesses() - { - return favRegistry_.loadUDDIBusinesses(); - } - - public Service[] loadUDDIServices() - { - return favRegistry_.loadUDDIServices(); - } - - public Service[] loadUDDIServiceInterfaces() - { - return favRegistry_.loadUDDIServiceInterfaces(); - } - - public Service[] loadWSDLServices() - { - return favRegistry_.loadWSDLServices(); - } - - public Link[] loadWSILs() - { - return favRegistry_.loadWSILs(); - } - - public final FavoritesUDDIRegistryFolderElement getFavoritesUDDIRegistryFolderElement() - { - return (FavoritesUDDIRegistryFolderElement)(getElements(FavoritesModelConstants.REL_UDDI_REGISTRY_FOLDER_NODE).nextElement()); - } -} diff --git a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/favorites/datamodel/FavoritesUDDIBusinessElement.java b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/favorites/datamodel/FavoritesUDDIBusinessElement.java deleted file mode 100644 index e9a148e08..000000000 --- a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/favorites/datamodel/FavoritesUDDIBusinessElement.java +++ /dev/null @@ -1,47 +0,0 @@ -/******************************************************************************* - * 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.favorites.datamodel; - -import org.apache.wsil.Link; -import org.eclipse.wst.ws.internal.datamodel.Model; -import org.eclipse.wst.ws.internal.parser.favorites.FavoritesUDDIBusiness; - -public class FavoritesUDDIBusinessElement extends FavoritesElement { - - private FavoritesUDDIBusiness uddiBusiness_; - - public FavoritesUDDIBusinessElement(String name, Model model, Link link) { - super(name, model); - uddiBusiness_ = new FavoritesUDDIBusiness(); - uddiBusiness_.setLink(link); - } - - public Link getLink() { - return uddiBusiness_.getLink(); - } - - public String getName() { - return uddiBusiness_.getName(); - } - - public String getInquiryURL() { - return uddiBusiness_.getInquiryURL(); - } - - public String getBusinessKey() { - return uddiBusiness_.getBusinessKey(); - } - - public String toString() { - return getName(); - } -} diff --git a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/favorites/datamodel/FavoritesUDDIBusinessFolderElement.java b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/favorites/datamodel/FavoritesUDDIBusinessFolderElement.java deleted file mode 100644 index 903ec86fb..000000000 --- a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/favorites/datamodel/FavoritesUDDIBusinessFolderElement.java +++ /dev/null @@ -1,117 +0,0 @@ -/******************************************************************************* - * 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.favorites.datamodel; - -import java.util.Enumeration; -import java.util.Hashtable; -import org.apache.wsil.Link; -import org.eclipse.wst.ws.internal.datamodel.Model; -import org.eclipse.wst.ws.internal.explorer.platform.constants.ModelConstants; -import org.eclipse.wst.ws.internal.explorer.platform.datamodel.TreeElement; -import org.eclipse.wst.ws.internal.explorer.platform.favorites.constants.FavoritesModelConstants; -import org.eclipse.wst.ws.internal.explorer.platform.perspective.Node; -import org.eclipse.wst.ws.internal.explorer.platform.perspective.NodeManager; - -/** -* The data model element that represents -* a WSIL document -*/ -public class FavoritesUDDIBusinessFolderElement extends FavoritesFolderElement -{ - public FavoritesUDDIBusinessFolderElement(String name, Model model, NodeManager nodeManager) { - super(name, model, nodeManager); - } - - public void init(FavoritesMainElement favMainElement) { - Link[] links = favMainElement.loadUDDIBusinesses(); - for (int i = 0; i < links.length; i++) { - Link link = links[i]; - FavoritesUDDIBusinessElement favUDDIBusinessElement = new FavoritesUDDIBusinessElement((link.getAbstracts())[0].getText(), getModel(), link); - connect(favUDDIBusinessElement, FavoritesModelConstants.REL_UDDI_BUSINESS_NODE, ModelConstants.REL_OWNER); - } - } - - public boolean addFavorite(Hashtable table) { - String businessName = (String)table.get(FavoritesModelConstants.PROP_UDDI_BUSINESS_NAME); - String inquiryAPI = (String)table.get(FavoritesModelConstants.PROP_UDDI_BUSINESS_INQUIRY_API); - String businessKey = (String)table.get(FavoritesModelConstants.PROP_UDDI_BUSINESS_KEY); - if (businessName == null || inquiryAPI == null || businessKey == null) - return false; - FavoritesUDDIBusinessElement e = getFavorite(inquiryAPI, businessKey); - if (e != null) - removeFavorite(e); - FavoritesMainElement favMainElement = getFavoritesMainElement(); - Link link = favMainElement.addUDDIBusiness(businessName, inquiryAPI, businessKey); - boolean saved = favMainElement.saveFavorites(); - if (saved) { - FavoritesUDDIBusinessElement favUDDIBusinessElement = new FavoritesUDDIBusinessElement(businessName, getModel(), link); - connect(favUDDIBusinessElement, FavoritesModelConstants.REL_UDDI_BUSINESS_NODE, ModelConstants.REL_OWNER); - } - return saved; - } - - public boolean favoriteExists(Hashtable table) { - String inquiryAPI = (String)table.get(FavoritesModelConstants.PROP_UDDI_BUSINESS_INQUIRY_API); - String businessKey = (String)table.get(FavoritesModelConstants.PROP_UDDI_BUSINESS_KEY); - if (inquiryAPI == null || businessKey == null) - return false; - return (getFavorite(inquiryAPI, businessKey) != null); - } - - public boolean removeFavoriteByNodeID(int nodeID,String pluginMetadataDirectory) { - Node selectedNode = nodeManager_.getNode(nodeID); - TreeElement selectedElement = selectedNode.getTreeElement(); - FavoritesMainElement favMainElement = getFavoritesMainElement(); - if (selectedElement instanceof FavoritesUDDIBusinessElement) - return (removeFavorite((FavoritesUDDIBusinessElement)selectedElement) && favMainElement.saveFavorites()); - else - return false; - } - - private boolean removeFavorite(FavoritesUDDIBusinessElement element) { - Link link = element.getLink(); - FavoritesMainElement favMainElement = getFavoritesMainElement(); - if (favMainElement.removeLink(link)) { - element.disconnectAll(); - return true; - } - else - return false; - } - - public boolean removeAllFavorites(String pluginMetadataDirectory) { - FavoritesMainElement favMainElement = getFavoritesMainElement(); - Enumeration e = getAllFavorites(); - while(e.hasMoreElements()) { - FavoritesUDDIBusinessElement favUDDIBusinessElement = (FavoritesUDDIBusinessElement)e.nextElement(); - Link link = favUDDIBusinessElement.getLink(); - favMainElement.removeLink(link); - } - disconnectRel(FavoritesModelConstants.REL_UDDI_BUSINESS_NODE); - return favMainElement.saveFavorites(); - } - - public Enumeration getAllFavorites() { - return getElements(FavoritesModelConstants.REL_UDDI_BUSINESS_NODE); - } - - private FavoritesUDDIBusinessElement getFavorite(String inquiryAPI, String businessKey) { - Enumeration e = getAllFavorites(); - while (e.hasMoreElements()) { - FavoritesUDDIBusinessElement busElement = (FavoritesUDDIBusinessElement)e.nextElement(); - if (inquiryAPI.equals(busElement.getInquiryURL()) && - businessKey.equals(busElement.getBusinessKey())) - return busElement; - } - return null; - } -} diff --git a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/favorites/datamodel/FavoritesUDDIRegistryElement.java b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/favorites/datamodel/FavoritesUDDIRegistryElement.java deleted file mode 100644 index 00a339723..000000000 --- a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/favorites/datamodel/FavoritesUDDIRegistryElement.java +++ /dev/null @@ -1,58 +0,0 @@ -/******************************************************************************* - * 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.favorites.datamodel; - -import org.apache.wsil.Link; -import org.eclipse.wst.ws.internal.datamodel.Model; -import org.eclipse.wst.ws.internal.parser.favorites.FavoritesUDDIRegistry; -import org.eclipse.wst.ws.internal.parser.favorites.IFavoritesUDDIRegistry; - -public class FavoritesUDDIRegistryElement extends FavoritesElement { - - private FavoritesUDDIRegistry uddiReg_; - - public FavoritesUDDIRegistryElement(String name, Model model, Link link) { - super(name, model); - uddiReg_ = new FavoritesUDDIRegistry(); - uddiReg_.setLink(link); - } - - public Link getLink() { - return uddiReg_.getLink(); - } - - public String getName() { - return uddiReg_.getName(); - } - - public String getInquiryURL() { - return uddiReg_.getInquiryURL(); - } - - public String getPublishURL() { - return uddiReg_.getPublishURL(); - } - - public String getRegistrationURL() { - return uddiReg_.getRegistrationURL(); - } - - public String toString() { - return getName(); - } - - public IFavoritesUDDIRegistry getIFavoritesUDDIRegistryInterface() - { - return uddiReg_; - } -} - diff --git a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/favorites/datamodel/FavoritesUDDIRegistryFolderElement.java b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/favorites/datamodel/FavoritesUDDIRegistryFolderElement.java deleted file mode 100644 index c8c5b118d..000000000 --- a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/favorites/datamodel/FavoritesUDDIRegistryFolderElement.java +++ /dev/null @@ -1,192 +0,0 @@ -/******************************************************************************* - * 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.favorites.datamodel; - -import java.io.File; -import java.util.Enumeration; -import java.util.Hashtable; -import org.apache.wsil.Link; -import org.eclipse.wst.ws.internal.datamodel.Model; -import org.eclipse.wst.ws.internal.explorer.platform.constants.ModelConstants; -import org.eclipse.wst.ws.internal.explorer.platform.datamodel.TreeElement; -import org.eclipse.wst.ws.internal.explorer.platform.favorites.constants.FavoritesModelConstants; -import org.eclipse.wst.ws.internal.explorer.platform.perspective.Node; -import org.eclipse.wst.ws.internal.explorer.platform.perspective.NodeManager; -import org.eclipse.wst.ws.internal.explorer.platform.uddi.datamodel.CategoryModel; -import org.eclipse.wst.ws.internal.explorer.platform.util.URLUtils; - -/** -* The data model element that represents -* a WSIL document -*/ -public class FavoritesUDDIRegistryFolderElement extends FavoritesFolderElement -{ - public FavoritesUDDIRegistryFolderElement(String name, Model model, NodeManager nodeManager) { - super(name, model, nodeManager); - } - - public void init(FavoritesMainElement favMainElement) { - Link[] links = favMainElement.loadUDDIRegistries(); - for (int i = 0; i < links.length; i++) { - Link link = links[i]; - FavoritesUDDIRegistryElement favUDDIRegsitryElement = new FavoritesUDDIRegistryElement((link.getAbstracts())[0].getText(), getModel(), link); - connect(favUDDIRegsitryElement, FavoritesModelConstants.REL_UDDI_REGISTRY_NODE, ModelConstants.REL_OWNER); - } - } - - public boolean addFavorite(Hashtable table) { - String registryName = (String)table.get(FavoritesModelConstants.PROP_UDDI_REGISTRY_NAME); - String inquiryAPI = (String)table.get(FavoritesModelConstants.PROP_UDDI_REGISTRY_INQUIRY_API); - String publishAPI = (String)table.get(FavoritesModelConstants.PROP_UDDI_REGISTRY_PUBLISH_API); - String registrationURL = (String)table.get(FavoritesModelConstants.PROP_UDDI_REGISTRY_REGISTRATION_URL); - Enumeration userDefinedCategories = (Enumeration)table.get(FavoritesModelConstants.PROP_UDDI_REGISTRY_CATEGORIES_ENUM); - // Save the category data first and undo if necessary. - if (userDefinedCategories != null) - { - String pluginMetadataDirectory = (String)table.get(FavoritesModelConstants.PROP_PLUGIN_METADATA_DIRECTORY); - StringBuffer directoryBuffer = new StringBuffer(); - formCategoriesDirectory(directoryBuffer,pluginMetadataDirectory,registryName); - File categoriesDirectoryFile = new File(directoryBuffer.toString()); - categoriesDirectoryFile.mkdirs(); - StringBuffer categoryFileName = new StringBuffer(); - while (userDefinedCategories.hasMoreElements()) - { - CategoryModel categoryModel = (CategoryModel)userDefinedCategories.nextElement(); - categoryFileName.setLength(0); - String encodedCategoryKey = URLUtils.encode(categoryModel.getCategoryKey()); - categoryFileName.append(categoriesDirectoryFile.getAbsolutePath()).append(File.separatorChar).append(encodedCategoryKey).append(".txt"); - byte rc = categoryModel.saveData(categoryFileName.toString()); - if (rc != CategoryModel.OPERATION_SUCCESSFUL) - { - // Delete the category file if it exists. - File categoryFile = new File(categoryFileName.toString()); - if (categoryFile.exists()) - categoryFile.delete(); - } - } - cleanupCategoryDirectories(categoriesDirectoryFile); - } - if (registryName == null || inquiryAPI == null || publishAPI == null) - return false; - FavoritesUDDIRegistryElement e = getFavorite(registryName); - if (e != null) - removeFavorite(e); - FavoritesMainElement favMainElement = getFavoritesMainElement(); - Link link = favMainElement.addUDDIRegistry(registryName, inquiryAPI, publishAPI, registrationURL); - boolean saved = favMainElement.saveFavorites(); - if (saved) { - FavoritesUDDIRegistryElement favUDDIRegsitryElement = new FavoritesUDDIRegistryElement(registryName, getModel(), link); - connect(favUDDIRegsitryElement, FavoritesModelConstants.REL_UDDI_REGISTRY_NODE, ModelConstants.REL_OWNER); - } - return saved; - } - - public static final void formCategoriesDirectory(StringBuffer categoriesDirectory,String pluginMetadataDirectory,String registryName) - { - // <metadata>/uddi/<registryId>/categories - String encodedRegistryName = URLUtils.encode(registryName); - categoriesDirectory.append(pluginMetadataDirectory).append("uddi").append(File.separatorChar).append(encodedRegistryName).append(File.separatorChar).append("categories"); - } - - private final void clearRegistryMetadata(String pluginMetadataDirectory,String registryName) - { - StringBuffer categoriesDirectory = new StringBuffer(); - formCategoriesDirectory(categoriesDirectory,pluginMetadataDirectory,registryName); - File categoriesDirectoryFile = new File(categoriesDirectory.toString()); - File[] categoryFiles = categoriesDirectoryFile.listFiles(); - if (categoryFiles != null) - { - for (int i=0;i<categoryFiles.length;i++) - categoryFiles[i].delete(); - } - cleanupCategoryDirectories(categoriesDirectoryFile); - } - - private final void cleanupCategoryDirectories(File categoriesDirectoryFile) - { - // Delete the categories subdirectory if it is empty. - String[] fileList; - fileList = categoriesDirectoryFile.list(); - if (fileList == null || fileList.length == 0) - categoriesDirectoryFile.delete(); - // Delete the <registryId> subdirectory if it is empty. - File registryIdDirectoryFile = categoriesDirectoryFile.getParentFile(); - fileList = registryIdDirectoryFile.list(); - if (fileList == null || fileList.length == 0) - registryIdDirectoryFile.delete(); - // Delete the uddi subdirectory if it is empty. - File uddiDirectoryFile = registryIdDirectoryFile.getParentFile(); - fileList = uddiDirectoryFile.list(); - if (fileList == null || fileList.length == 0) - uddiDirectoryFile.delete(); - } - - public boolean favoriteExists(Hashtable table) { - String registryName = (String)table.get(FavoritesModelConstants.PROP_UDDI_REGISTRY_NAME); - if (registryName == null) - return false; - return (getFavorite(registryName) != null); - } - - public boolean removeFavoriteByNodeID(int nodeID,String pluginMetadataDirectory) { - Node selectedNode = nodeManager_.getNode(nodeID); - TreeElement selectedElement = selectedNode.getTreeElement(); - FavoritesMainElement favMainElement = getFavoritesMainElement(); - if (selectedElement instanceof FavoritesUDDIRegistryElement) - { - clearRegistryMetadata(pluginMetadataDirectory,selectedElement.getName()); - boolean rc = removeFavorite((FavoritesUDDIRegistryElement)selectedElement); - rc = rc && favMainElement.saveFavorites(); - return rc; - } - else - return false; - } - - private boolean removeFavorite(FavoritesUDDIRegistryElement element) { - Link link = ((FavoritesUDDIRegistryElement)element).getLink(); - FavoritesMainElement favMainElement = getFavoritesMainElement(); - if (favMainElement.removeLink(link)) { - element.disconnectAll(); - return true; - } - else - return false; - } - - public boolean removeAllFavorites(String pluginMetadataDirectory) { - FavoritesMainElement favMainElement = getFavoritesMainElement(); - Enumeration e = getAllFavorites(); - while(e.hasMoreElements()) { - FavoritesUDDIRegistryElement favUDDIRegistryElement = (FavoritesUDDIRegistryElement)e.nextElement(); - clearRegistryMetadata(pluginMetadataDirectory,favUDDIRegistryElement.getName()); - Link link = favUDDIRegistryElement.getLink(); - favMainElement.removeLink(link); - } - disconnectRel(FavoritesModelConstants.REL_UDDI_REGISTRY_NODE); - return favMainElement.saveFavorites(); - } - - public Enumeration getAllFavorites() { - return getElements(FavoritesModelConstants.REL_UDDI_REGISTRY_NODE); - } - - private FavoritesUDDIRegistryElement getFavorite(String registryName) { - Enumeration e = getAllFavorites(); - while (e.hasMoreElements()) { - FavoritesUDDIRegistryElement regElement = (FavoritesUDDIRegistryElement)e.nextElement(); - if (registryName.equals(regElement.getName())) - return regElement; - } - return null; - } -} diff --git a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/favorites/datamodel/FavoritesUDDIServiceElement.java b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/favorites/datamodel/FavoritesUDDIServiceElement.java deleted file mode 100644 index 2a86ed19b..000000000 --- a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/favorites/datamodel/FavoritesUDDIServiceElement.java +++ /dev/null @@ -1,47 +0,0 @@ -/******************************************************************************* - * 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.favorites.datamodel; - -import org.apache.wsil.Service; -import org.eclipse.wst.ws.internal.datamodel.Model; -import org.eclipse.wst.ws.internal.parser.favorites.FavoritesUDDIService; - -public class FavoritesUDDIServiceElement extends FavoritesElement { - - private FavoritesUDDIService uddiService_; - - public FavoritesUDDIServiceElement(String name, Model model, Service service) { - super(name, model); - uddiService_ = new FavoritesUDDIService(); - uddiService_.setService(service); - } - - public Service getService() { - return uddiService_.getService(); - } - - public String getName() { - return uddiService_.getName(); - } - - public String getInquiryURL() { - return uddiService_.getInquiryURL(); - } - - public String getServiceKey() { - return uddiService_.getServiceKey(); - } - - public String toString() { - return getName(); - } -} diff --git a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/favorites/datamodel/FavoritesUDDIServiceFolderElement.java b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/favorites/datamodel/FavoritesUDDIServiceFolderElement.java deleted file mode 100644 index 0b8597651..000000000 --- a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/favorites/datamodel/FavoritesUDDIServiceFolderElement.java +++ /dev/null @@ -1,118 +0,0 @@ -/******************************************************************************* - * 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.favorites.datamodel; - -import java.util.Enumeration; -import java.util.Hashtable; -import org.apache.wsil.Service; -import org.eclipse.wst.ws.internal.datamodel.Model; -import org.eclipse.wst.ws.internal.explorer.platform.constants.ModelConstants; -import org.eclipse.wst.ws.internal.explorer.platform.datamodel.TreeElement; -import org.eclipse.wst.ws.internal.explorer.platform.favorites.constants.FavoritesModelConstants; -import org.eclipse.wst.ws.internal.explorer.platform.perspective.Node; -import org.eclipse.wst.ws.internal.explorer.platform.perspective.NodeManager; - -/** -* The data model element that represents -* a WSIL document -*/ -public class FavoritesUDDIServiceFolderElement extends FavoritesFolderElement -{ - - public FavoritesUDDIServiceFolderElement(String name, Model model, NodeManager nodeManager) { - super(name, model, nodeManager); - } - - public void init(FavoritesMainElement favMainElement) { - Service[] services = favMainElement.loadUDDIServices(); - for (int i = 0; i < services.length; i++) { - Service service = services[i]; - FavoritesUDDIServiceElement favUDDIServiceElement = new FavoritesUDDIServiceElement((service.getServiceNames())[0].getText(), getModel(), service); - connect(favUDDIServiceElement, FavoritesModelConstants.REL_UDDI_SERVICE_NODE, ModelConstants.REL_OWNER); - } - } - - public boolean addFavorite(Hashtable table) { - String serviceName = (String)table.get(FavoritesModelConstants.PROP_UDDI_SERVICE_NAME); - String inquiryAPI = (String)table.get(FavoritesModelConstants.PROP_UDDI_SERVICE_INQUIRY_API); - String serviceKey = (String)table.get(FavoritesModelConstants.PROP_UDDI_SERVICE_KEY); - if (serviceName == null || inquiryAPI == null || serviceKey == null) - return false; - FavoritesUDDIServiceElement e = getFavorite(inquiryAPI, serviceKey); - if (e != null) - removeFavorite(e); - FavoritesMainElement favMainElement = getFavoritesMainElement(); - Service service = favMainElement.addUDDIService(serviceName, inquiryAPI, serviceKey); - boolean saved = favMainElement.saveFavorites(); - if (saved) { - FavoritesUDDIServiceElement favUDDIServiceElement = new FavoritesUDDIServiceElement(serviceName, getModel(), service); - connect(favUDDIServiceElement, FavoritesModelConstants.REL_UDDI_SERVICE_NODE, ModelConstants.REL_OWNER); - } - return saved; - } - - public boolean favoriteExists(Hashtable table) { - String inquiryAPI = (String)table.get(FavoritesModelConstants.PROP_UDDI_SERVICE_INQUIRY_API); - String serviceKey = (String)table.get(FavoritesModelConstants.PROP_UDDI_SERVICE_KEY); - if (inquiryAPI == null || serviceKey == null) - return false; - return (getFavorite(inquiryAPI, serviceKey) != null); - } - - public boolean removeFavoriteByNodeID(int nodeID,String pluginMetadataDirectory) { - Node selectedNode = nodeManager_.getNode(nodeID); - TreeElement selectedElement = selectedNode.getTreeElement(); - FavoritesMainElement favMainElement = getFavoritesMainElement(); - if (selectedElement instanceof FavoritesUDDIServiceElement) - return (removeFavorite((FavoritesUDDIServiceElement)selectedElement) && favMainElement.saveFavorites()); - else - return false; - } - - private boolean removeFavorite(FavoritesUDDIServiceElement element) { - Service service = ((FavoritesUDDIServiceElement)element).getService(); - FavoritesMainElement favMainElement = getFavoritesMainElement(); - if (favMainElement.removeService(service)) { - element.disconnectAll(); - return true; - } - else - return false; - } - - public boolean removeAllFavorites(String pluginMetadataDirectory) { - FavoritesMainElement favMainElement = getFavoritesMainElement(); - Enumeration e = getAllFavorites(); - while(e.hasMoreElements()) { - FavoritesUDDIServiceElement favUDDIServiceElement = (FavoritesUDDIServiceElement)e.nextElement(); - Service service = favUDDIServiceElement.getService(); - favMainElement.removeService(service); - } - disconnectRel(FavoritesModelConstants.REL_UDDI_SERVICE_NODE); - return favMainElement.saveFavorites(); - } - - public Enumeration getAllFavorites() { - return getElements(FavoritesModelConstants.REL_UDDI_SERVICE_NODE); - } - - private FavoritesUDDIServiceElement getFavorite(String inquiryAPI, String serviceKey) { - Enumeration e = getAllFavorites(); - while (e.hasMoreElements()) { - FavoritesUDDIServiceElement serElement = (FavoritesUDDIServiceElement)e.nextElement(); - if (inquiryAPI.equals(serElement.getInquiryURL()) && - serviceKey.equals(serElement.getServiceKey())) - return serElement; - } - return null; - } -} diff --git a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/favorites/datamodel/FavoritesUDDIServiceInterfaceElement.java b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/favorites/datamodel/FavoritesUDDIServiceInterfaceElement.java deleted file mode 100644 index 81e8beb8d..000000000 --- a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/favorites/datamodel/FavoritesUDDIServiceInterfaceElement.java +++ /dev/null @@ -1,47 +0,0 @@ -/******************************************************************************* - * 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.favorites.datamodel; - -import org.apache.wsil.Service; -import org.eclipse.wst.ws.internal.datamodel.Model; -import org.eclipse.wst.ws.internal.parser.favorites.FavoritesUDDIServiceInterface; - -public class FavoritesUDDIServiceInterfaceElement extends FavoritesElement { - - private FavoritesUDDIServiceInterface uddiSerInt_; - - public FavoritesUDDIServiceInterfaceElement(String name, Model model, Service service) { - super(name, model); - uddiSerInt_ = new FavoritesUDDIServiceInterface(); - uddiSerInt_.setService(service); - } - - public Service getService() { - return uddiSerInt_.getService(); - } - - public String getName() { - return uddiSerInt_.getName(); - } - - public String getInquiryURL() { - return uddiSerInt_.getInquiryURL(); - } - - public String getServiceInterfaceKey() { - return uddiSerInt_.getServiceInterfaceKey(); - } - - public String toString() { - return getName(); - } -} diff --git a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/favorites/datamodel/FavoritesUDDIServiceInterfaceFolderElement.java b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/favorites/datamodel/FavoritesUDDIServiceInterfaceFolderElement.java deleted file mode 100644 index dee62cb36..000000000 --- a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/favorites/datamodel/FavoritesUDDIServiceInterfaceFolderElement.java +++ /dev/null @@ -1,118 +0,0 @@ -/******************************************************************************* - * 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.favorites.datamodel; - -import java.util.Enumeration; -import java.util.Hashtable; -import org.apache.wsil.Service; -import org.eclipse.wst.ws.internal.datamodel.Model; -import org.eclipse.wst.ws.internal.explorer.platform.constants.ModelConstants; -import org.eclipse.wst.ws.internal.explorer.platform.datamodel.TreeElement; -import org.eclipse.wst.ws.internal.explorer.platform.favorites.constants.FavoritesModelConstants; -import org.eclipse.wst.ws.internal.explorer.platform.perspective.Node; -import org.eclipse.wst.ws.internal.explorer.platform.perspective.NodeManager; - -/** -* The data model element that represents -* a WSIL document -*/ -public class FavoritesUDDIServiceInterfaceFolderElement extends FavoritesFolderElement -{ - - public FavoritesUDDIServiceInterfaceFolderElement(String name, Model model, NodeManager nodeManager) { - super(name, model, nodeManager); - } - - public void init(FavoritesMainElement favMainElement) { - Service[] services = favMainElement.loadUDDIServiceInterfaces(); - for (int i = 0; i < services.length; i++) { - Service service = services[i]; - FavoritesUDDIServiceInterfaceElement favUDDISerIntElement = new FavoritesUDDIServiceInterfaceElement((service.getServiceNames())[0].getText(), getModel(), service); - connect(favUDDISerIntElement, FavoritesModelConstants.REL_UDDI_SERVICE_INTERFACE_NODE, ModelConstants.REL_OWNER); - } - } - - public boolean addFavorite(Hashtable table) { - String serIntName = (String)table.get(FavoritesModelConstants.PROP_UDDI_SERVICE_INTERFACE_NAME); - String inquiryAPI = (String)table.get(FavoritesModelConstants.PROP_UDDI_SERVICE_INTERFACE_INQUIRY_API); - String serIntKey = (String)table.get(FavoritesModelConstants.PROP_UDDI_SERVICE_INTERFACE_KEY); - if (serIntName == null || inquiryAPI == null || serIntKey == null) - return false; - FavoritesUDDIServiceInterfaceElement e = getFavorite(inquiryAPI, serIntKey); - if (e != null) - removeFavorite(e); - FavoritesMainElement favMainElement = getFavoritesMainElement(); - Service service = favMainElement.addUDDIServiceInterface(serIntName, inquiryAPI, serIntKey); - boolean saved = favMainElement.saveFavorites(); - if (saved) { - FavoritesUDDIServiceInterfaceElement favUDDISerIntElement = new FavoritesUDDIServiceInterfaceElement(serIntName, getModel(), service); - connect(favUDDISerIntElement, FavoritesModelConstants.REL_UDDI_SERVICE_INTERFACE_NODE, ModelConstants.REL_OWNER); - } - return saved; - } - - public boolean favoriteExists(Hashtable table) { - String inquiryAPI = (String)table.get(FavoritesModelConstants.PROP_UDDI_SERVICE_INTERFACE_INQUIRY_API); - String serIntKey = (String)table.get(FavoritesModelConstants.PROP_UDDI_SERVICE_INTERFACE_KEY); - if (inquiryAPI == null || serIntKey == null) - return false; - return (getFavorite(inquiryAPI, serIntKey) != null); - } - - public boolean removeFavoriteByNodeID(int nodeID,String pluginMetadataDirectory) { - Node selectedNode = nodeManager_.getNode(nodeID); - TreeElement selectedElement = selectedNode.getTreeElement(); - FavoritesMainElement favMainElement = getFavoritesMainElement(); - if (selectedElement instanceof FavoritesUDDIServiceInterfaceElement) - return (removeFavorite((FavoritesUDDIServiceInterfaceElement)selectedElement) && favMainElement.saveFavorites()); - else - return false; - } - - private boolean removeFavorite(FavoritesUDDIServiceInterfaceElement element) { - Service service = ((FavoritesUDDIServiceInterfaceElement)element).getService(); - FavoritesMainElement favMainElement = getFavoritesMainElement(); - if (favMainElement.removeService(service)) { - element.disconnectAll(); - return true; - } - else - return false; - } - - public boolean removeAllFavorites(String pluginMetadataDirectory) { - FavoritesMainElement favMainElement = getFavoritesMainElement(); - Enumeration e = getAllFavorites(); - while(e.hasMoreElements()) { - FavoritesUDDIServiceInterfaceElement favUDDISerIntElement = (FavoritesUDDIServiceInterfaceElement)e.nextElement(); - Service service = favUDDISerIntElement.getService(); - favMainElement.removeService(service); - } - disconnectRel(FavoritesModelConstants.REL_UDDI_SERVICE_INTERFACE_NODE); - return favMainElement.saveFavorites(); - } - - public Enumeration getAllFavorites() { - return getElements(FavoritesModelConstants.REL_UDDI_SERVICE_INTERFACE_NODE); - } - - private FavoritesUDDIServiceInterfaceElement getFavorite(String inquiryAPI, String serIntKey) { - Enumeration e = getAllFavorites(); - while (e.hasMoreElements()) { - FavoritesUDDIServiceInterfaceElement serIntElement = (FavoritesUDDIServiceInterfaceElement)e.nextElement(); - if (inquiryAPI.equals(serIntElement.getInquiryURL()) && - serIntKey.equals(serIntElement.getServiceInterfaceKey())) - return serIntElement; - } - return null; - } -} diff --git a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/favorites/datamodel/FavoritesUserDefUDDIRegistryElement.java b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/favorites/datamodel/FavoritesUserDefUDDIRegistryElement.java deleted file mode 100644 index 19df57778..000000000 --- a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/favorites/datamodel/FavoritesUserDefUDDIRegistryElement.java +++ /dev/null @@ -1,141 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005 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.favorites.datamodel; - -import java.util.List; - -import org.eclipse.wst.ws.internal.datamodel.Model; -import org.eclipse.wst.ws.internal.model.v10.taxonomy.Taxonomy; - -public class FavoritesUserDefUDDIRegistryElement extends FavoritesElement -{ - private List names; - private List descs; - private String version; - private String defaultLogin; - private String defaultPassword; - private String inquiryURL; - private String publishURL; - private String secureInquiryURL; - private String securePublishURL; - private Taxonomy[] taxonomies; - - public String getDefaultLogin() - { - return defaultLogin; - } - - public void setDefaultLogin(String defaultLogin) - { - this.defaultLogin = defaultLogin; - } - - public String getDefaultPassword() - { - return defaultPassword; - } - - public void setDefaultPassword(String defaultPassword) - { - this.defaultPassword = defaultPassword; - } - - public Taxonomy[] getTaxonomies() - { - return taxonomies; - } - - public void setTaxonomies(Taxonomy[] taxonomies) - { - this.taxonomies = taxonomies; - } - - public FavoritesUserDefUDDIRegistryElement(String name, Model model) - { - super(name, model); - } - - public List getDescs() - { - return descs; - } - - public void setDescs(List descs) - { - this.descs = descs; - } - - public String getInquiryURL() - { - return inquiryURL; - } - - public void setInquiryURL(String inquiryURL) - { - this.inquiryURL = inquiryURL; - } - - public List getNames() - { - return names; - } - - public void setNames(List names) - { - this.names = names; - } - - public String getPublishURL() - { - return publishURL; - } - - public void setPublishURL(String publishURL) - { - this.publishURL = publishURL; - } - - public String getSecureInquiryURL() - { - return secureInquiryURL; - } - - public void setSecureInquiryURL(String secureInquiryURL) - { - this.secureInquiryURL = secureInquiryURL; - } - - public String getSecurePublishURL() - { - return securePublishURL; - } - - public void setSecurePublishURL(String securePublishURL) - { - this.securePublishURL = securePublishURL; - } - - public String getVersion() - { - return version; - } - - public void setVersion(String version) - { - this.version = version; - } - - public String toString() - { - return getName(); - } -} diff --git a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/favorites/datamodel/FavoritesUserDefUDDIRegistryFolderElement.java b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/favorites/datamodel/FavoritesUserDefUDDIRegistryFolderElement.java deleted file mode 100644 index 98d9b698f..000000000 --- a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/favorites/datamodel/FavoritesUserDefUDDIRegistryFolderElement.java +++ /dev/null @@ -1,112 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005 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.favorites.datamodel; - -import java.util.Enumeration; -import java.util.Hashtable; -import java.util.List; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.wst.ws.internal.datamodel.Model; -import org.eclipse.wst.ws.internal.explorer.platform.constants.ModelConstants; -import org.eclipse.wst.ws.internal.explorer.platform.favorites.constants.FavoritesModelConstants; -import org.eclipse.wst.ws.internal.explorer.platform.perspective.NodeManager; -import org.eclipse.wst.ws.internal.model.v10.registry.Name; -import org.eclipse.wst.ws.internal.model.v10.registry.Registry; -import org.eclipse.wst.ws.internal.model.v10.taxonomy.Taxonomy; -import org.eclipse.wst.ws.internal.model.v10.uddiregistry.UDDIRegistry; -import org.eclipse.wst.ws.internal.registry.IRegistryManager; -import org.eclipse.wst.ws.internal.registry.RegistryService; -import org.eclipse.wst.ws.internal.registry.UDDIRegistryService; - -/** - * The data model element that represents a WSIL document - */ -public class FavoritesUserDefUDDIRegistryFolderElement extends FavoritesFolderElement -{ - public FavoritesUserDefUDDIRegistryFolderElement(String name, Model model, NodeManager nodeManager) - { - super(name, model, nodeManager); - } - - public void init(FavoritesMainElement favMainElement) - { - refresh(); - } - - public void refresh(){ - disconnectRel(FavoritesModelConstants.REL_USER_DEF_UDDI_REGISTRY_NODE); - RegistryService regService = RegistryService.instance(); - IRegistryManager regManager = regService.getDefaultRegistryManager(); - try - { - String[] regURIs = regManager.getRegistryURIs(); - for (int i = 0; i < regURIs.length; i++) - { - Registry reg = regManager.loadRegistry(regURIs[i]); - if (reg instanceof UDDIRegistry) - { - UDDIRegistry uddiReg = (UDDIRegistry)reg; - List names = uddiReg.getName(); - String displayName = names != null && !names.isEmpty() ? ((Name)names.get(0)).getValue() : ""; - FavoritesUserDefUDDIRegistryElement favUserDefUDDIRegElement = new FavoritesUserDefUDDIRegistryElement(displayName, getModel()); - favUserDefUDDIRegElement.setNames(names); - favUserDefUDDIRegElement.setDescs(uddiReg.getDescription()); - favUserDefUDDIRegElement.setVersion(uddiReg.getVersion()); - favUserDefUDDIRegElement.setDefaultLogin(uddiReg.getDefaultLogin()); - favUserDefUDDIRegElement.setDefaultPassword(uddiReg.getDefaultPassword()); - favUserDefUDDIRegElement.setInquiryURL(uddiReg.getDiscoveryURL()); - favUserDefUDDIRegElement.setPublishURL(uddiReg.getPublicationURL()); - favUserDefUDDIRegElement.setSecureInquiryURL(uddiReg.getSecuredDiscoveryURL()); - favUserDefUDDIRegElement.setSecurePublishURL(uddiReg.getSecuredPublicationURL()); - Taxonomy[] taxonomies = regManager.loadTaxonomies(UDDIRegistryService.instance().getTaxonomyURIs(uddiReg)); - favUserDefUDDIRegElement.setTaxonomies(taxonomies); - connect(favUserDefUDDIRegElement, FavoritesModelConstants.REL_USER_DEF_UDDI_REGISTRY_NODE, ModelConstants.REL_OWNER); - } - } - } - catch (CoreException ce) - { - // TODO: Better error reporting - ce.printStackTrace(); - } - } - - - public boolean addFavorite(Hashtable table) - { - // do nothing - return true; - } - - public boolean favoriteExists(Hashtable table) - { - // do nothing - return true; - } - - public boolean removeFavoriteByNodeID(int nodeID, String pluginMetadataDirectory) - { - // do nothing - return true; - } - - public boolean removeAllFavorites(String pluginMetadataDirectory) - { - // do nothing - return true; - } - - public Enumeration getAllFavorites() - { - return getElements(FavoritesModelConstants.REL_USER_DEF_UDDI_REGISTRY_NODE); - } -} diff --git a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/favorites/datamodel/FavoritesWSDLServiceElement.java b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/favorites/datamodel/FavoritesWSDLServiceElement.java deleted file mode 100644 index b842ff6f8..000000000 --- a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/favorites/datamodel/FavoritesWSDLServiceElement.java +++ /dev/null @@ -1,39 +0,0 @@ -/******************************************************************************* - * 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.favorites.datamodel; - -import org.apache.wsil.Service; -import org.eclipse.wst.ws.internal.datamodel.Model; -import org.eclipse.wst.ws.internal.parser.favorites.FavoritesWSDL; - -public class FavoritesWSDLServiceElement extends FavoritesElement { - - private FavoritesWSDL wsdl_; - - public FavoritesWSDLServiceElement(String name, Model model, Service service) { - super(name, model); - wsdl_ = new FavoritesWSDL(); - wsdl_.setService(service); - } - - public Service getService() { - return wsdl_.getService(); - } - - public String getWsdlUrl() { - return wsdl_.getWsdlUrl(); - } - - public String toString() { - return getWsdlUrl(); - } -} diff --git a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/favorites/datamodel/FavoritesWSDLServiceFolderElement.java b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/favorites/datamodel/FavoritesWSDLServiceFolderElement.java deleted file mode 100644 index 0e95e3e67..000000000 --- a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/favorites/datamodel/FavoritesWSDLServiceFolderElement.java +++ /dev/null @@ -1,110 +0,0 @@ -/******************************************************************************* - * 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.favorites.datamodel; - -import java.util.Enumeration; -import java.util.Hashtable; -import org.apache.wsil.Service; -import org.eclipse.wst.ws.internal.datamodel.Model; -import org.eclipse.wst.ws.internal.explorer.platform.constants.ModelConstants; -import org.eclipse.wst.ws.internal.explorer.platform.datamodel.TreeElement; -import org.eclipse.wst.ws.internal.explorer.platform.favorites.constants.FavoritesModelConstants; -import org.eclipse.wst.ws.internal.explorer.platform.perspective.Node; -import org.eclipse.wst.ws.internal.explorer.platform.perspective.NodeManager; - -public class FavoritesWSDLServiceFolderElement extends FavoritesFolderElement -{ - - public FavoritesWSDLServiceFolderElement(String name, Model model, NodeManager nodeManager) { - super(name, model, nodeManager); - } - - public void init(FavoritesMainElement favMainElement) { - Service[] services = favMainElement.loadWSDLServices(); - for (int i = 0; i < services.length; i++) { - Service service = services[i]; - FavoritesWSDLServiceElement favWSDLServiceElement = new FavoritesWSDLServiceElement((service.getDescriptions())[0].getLocation(), getModel(), service); - connect(favWSDLServiceElement, FavoritesModelConstants.REL_WSDL_SERVICE_NODE, ModelConstants.REL_OWNER); - } - } - - public boolean addFavorite(Hashtable table) { - String wsdlURL = (String)table.get(FavoritesModelConstants.PROP_WSDL_URL); - if (wsdlURL == null) - return false; - FavoritesWSDLServiceElement e = getFavorite(wsdlURL); - if (e != null) - removeFavorite(e); - FavoritesMainElement favMainElement = getFavoritesMainElement(); - Service service = favMainElement.addWSDLService(wsdlURL); - boolean saved = favMainElement.saveFavorites(); - if (saved) { - FavoritesWSDLServiceElement favWSDLServiceElement = new FavoritesWSDLServiceElement(wsdlURL, getModel(), service); - connect(favWSDLServiceElement, FavoritesModelConstants.REL_WSDL_SERVICE_NODE, ModelConstants.REL_OWNER); - } - return saved; - } - - public boolean favoriteExists(Hashtable table) { - String wsdlURL = (String)table.get(FavoritesModelConstants.PROP_WSDL_URL); - if (wsdlURL == null) - return false; - return (getFavorite(wsdlURL) != null); - } - - public boolean removeFavoriteByNodeID(int nodeID,String pluginMetadataDirectory) { - Node selectedNode = nodeManager_.getNode(nodeID); - TreeElement selectedElement = selectedNode.getTreeElement(); - FavoritesMainElement favMainElement = getFavoritesMainElement(); - if (selectedElement instanceof FavoritesWSDLServiceElement) - return (removeFavorite((FavoritesWSDLServiceElement)selectedElement) && favMainElement.saveFavorites()); - else - return false; - } - - private boolean removeFavorite(FavoritesWSDLServiceElement element) { - Service service = ((FavoritesWSDLServiceElement)element).getService(); - FavoritesMainElement favMainElement = getFavoritesMainElement(); - if (favMainElement.removeService(service)) { - element.disconnectAll(); - return true; - } - else - return false; - } - - public boolean removeAllFavorites(String pluginMetadataDirectory) { - FavoritesMainElement favMainElement = getFavoritesMainElement(); - Enumeration e = getAllFavorites(); - while(e.hasMoreElements()) { - FavoritesWSDLServiceElement favWSDLServiceElement = (FavoritesWSDLServiceElement)e.nextElement(); - Service service = favWSDLServiceElement.getService(); - favMainElement.removeService(service); - } - disconnectRel(FavoritesModelConstants.REL_WSDL_SERVICE_NODE); - return favMainElement.saveFavorites(); - } - - public Enumeration getAllFavorites() { - return getElements(FavoritesModelConstants.REL_WSDL_SERVICE_NODE); - } - - private FavoritesWSDLServiceElement getFavorite(String wsdlUrl) { - Enumeration e = getAllFavorites(); - while (e.hasMoreElements()) { - FavoritesWSDLServiceElement wsdlElement = (FavoritesWSDLServiceElement)e.nextElement(); - if (wsdlUrl.equals(wsdlElement.getWsdlUrl())) - return wsdlElement; - } - return null; - } -} diff --git a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/favorites/datamodel/FavoritesWSILElement.java b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/favorites/datamodel/FavoritesWSILElement.java deleted file mode 100644 index fb5d38dff..000000000 --- a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/favorites/datamodel/FavoritesWSILElement.java +++ /dev/null @@ -1,39 +0,0 @@ -/******************************************************************************* - * 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.favorites.datamodel; - -import org.apache.wsil.Link; -import org.eclipse.wst.ws.internal.datamodel.Model; -import org.eclipse.wst.ws.internal.parser.favorites.FavoritesWSIL; - -public class FavoritesWSILElement extends FavoritesElement { - - private FavoritesWSIL wsil_; - - public FavoritesWSILElement(String name, Model model, Link link) { - super(name, model); - wsil_ = new FavoritesWSIL(); - wsil_.setLink(link); - } - - public Link getLink() { - return wsil_.getLink(); - } - - public String getWsilUrl() { - return wsil_.getWsilUrl(); - } - - public String toString() { - return getWsilUrl(); - } -} diff --git a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/favorites/datamodel/FavoritesWSILFolderElement.java b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/favorites/datamodel/FavoritesWSILFolderElement.java deleted file mode 100644 index f6fb2c12f..000000000 --- a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/favorites/datamodel/FavoritesWSILFolderElement.java +++ /dev/null @@ -1,109 +0,0 @@ -/******************************************************************************* - * 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.favorites.datamodel; - -import java.util.Enumeration; -import java.util.Hashtable; -import org.apache.wsil.Link; -import org.eclipse.wst.ws.internal.datamodel.Model; -import org.eclipse.wst.ws.internal.explorer.platform.constants.ModelConstants; -import org.eclipse.wst.ws.internal.explorer.platform.datamodel.TreeElement; -import org.eclipse.wst.ws.internal.explorer.platform.favorites.constants.FavoritesModelConstants; -import org.eclipse.wst.ws.internal.explorer.platform.perspective.Node; -import org.eclipse.wst.ws.internal.explorer.platform.perspective.NodeManager; - -public class FavoritesWSILFolderElement extends FavoritesFolderElement { - - public FavoritesWSILFolderElement(String name, Model model, NodeManager nodeManager) { - super(name, model, nodeManager); - } - - public void init(FavoritesMainElement favMainElement) { - Link[] links = favMainElement.loadWSILs(); - for (int i = 0; i < links.length; i++) { - Link link = links[i]; - FavoritesWSILElement favWSILElement = new FavoritesWSILElement(link.getLocation(), getModel(), link); - connect(favWSILElement, FavoritesModelConstants.REL_WSIL_NODE, ModelConstants.REL_OWNER); - } - } - - public boolean addFavorite(Hashtable table) { - String wsilURL = (String)table.get(FavoritesModelConstants.PROP_WSIL_URL); - if (wsilURL == null) - return false; - FavoritesWSILElement e = getFavorite(wsilURL); - if (e != null) - removeFavorite(e); - FavoritesMainElement favMainElement = getFavoritesMainElement(); - Link link = favMainElement.addWSILLink(wsilURL); - boolean saved = favMainElement.saveFavorites(); - if (saved) { - FavoritesWSILElement favWSILElement = new FavoritesWSILElement(wsilURL, getModel(), link); - connect(favWSILElement, FavoritesModelConstants.REL_WSIL_NODE, ModelConstants.REL_OWNER); - } - return saved; - } - - public boolean favoriteExists(Hashtable table) { - String wsilURL = (String)table.get(FavoritesModelConstants.PROP_WSIL_URL); - if (wsilURL == null) - return false; - return (getFavorite(wsilURL) != null); - } - - public boolean removeFavoriteByNodeID(int nodeID,String pluginMetadataDirectory) { - Node selectedNode = nodeManager_.getNode(nodeID); - TreeElement selectedElement = selectedNode.getTreeElement(); - FavoritesMainElement favMainElement = getFavoritesMainElement(); - if (selectedElement instanceof FavoritesWSILElement) - return (removeFavorite((FavoritesWSILElement)selectedElement) && favMainElement.saveFavorites()); - else - return false; - } - - private boolean removeFavorite(FavoritesWSILElement element) { - Link link = element.getLink(); - FavoritesMainElement favMainElement = getFavoritesMainElement(); - if (favMainElement.removeLink(link)) { - element.disconnectAll(); - return true; - } - else - return false; - } - - public boolean removeAllFavorites(String pluginMetadataDirectory) { - FavoritesMainElement favMainElement = getFavoritesMainElement(); - Enumeration e = getAllFavorites(); - while(e.hasMoreElements()) { - FavoritesWSILElement favWSILElement = (FavoritesWSILElement)e.nextElement(); - Link link = favWSILElement.getLink(); - favMainElement.removeLink(link); - } - disconnectRel(FavoritesModelConstants.REL_WSIL_NODE); - return favMainElement.saveFavorites(); - } - - public Enumeration getAllFavorites() { - return getElements(FavoritesModelConstants.REL_WSIL_NODE); - } - - private FavoritesWSILElement getFavorite(String wsilUrl) { - Enumeration e = getAllFavorites(); - while (e.hasMoreElements()) { - FavoritesWSILElement wsilElement = (FavoritesWSILElement)e.nextElement(); - if (wsilUrl.equals(wsilElement.getWsilUrl())) - return wsilElement; - } - return null; - } -} |