Skip to main content
summaryrefslogtreecommitdiffstats
blob: 299eecdacf127b9c46246ae2e95d30bc9df6c775 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
/*******************************************************************************
 * Copyright (c) 2001, 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 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());
  }
}

Back to the top