Skip to main content

This CGIT instance is deprecated, and repositories have been moved to Gitlab or Github. See the repository descriptions for specific locations.

summaryrefslogtreecommitdiffstats
blob: 229de46a2cb900326086e2f8531579e36fc6c2ae (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
138
139
140
141
142
143
/*******************************************************************************
 * Copyright (c) 2000, 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.jst.ws.internal.consumption.ui.wizard;

import java.util.StringTokenizer;

import org.eclipse.core.runtime.IConfigurationElement;


/**
* This is the interface for objects that represent a kind of
* Web Service artifact. The primary purpose of a WebServiceType
* object is to manufacture the wizard pages that support the type.
*/
public class WebServiceTypeImpl implements IWebServiceType
{

  // Copyright
  public static final String copyright = "(c) Copyright IBM Corporation 2000, 2002.";

  public IConfigurationElement element_;
  public String typeId_;
  public String typeLabel_;
  public String[] extensionMetadata_;
  public String[] resourceTypeMetadata_;
  public Boolean canFinish_;

  public WebServiceTypeImpl(IConfigurationElement elem)
  {
    super();
    this.element_ = elem; 
  }
  /**
  * Returns the id of this Web Service type.
  * @return id of this Web Service type.
  */
  public String getId ()
  {
    if (typeId_==null)
      typeId_ = element_.getAttribute("id");
    return typeId_;
  }
  /**
  * Returns a short, locale specific name of this Web Service type.
  * @return A short, locale specific name of this Web Service type.
  */
  public String getLabel ()
  {
    if (typeLabel_ == null)
      typeLabel_ = element_.getAttribute("label");
    return typeLabel_;    
  }

  /**
  * Returns a locale specific description of this Web Service type's extension metadata.
  * @return A locale specific description of this Web Service type's extension metadata.
  */
  public String[] getExtensionMetadata ()
  {
    if (extensionMetadata_ ==null)
    {
      StringTokenizer st = new StringTokenizer(element_.getAttribute("extensionMetadata"));
      extensionMetadata_ = new String[st.countTokens()];
      int i=0;
      while (st.hasMoreElements())
      {
        String exten = (String)st.nextToken();
        if (exten!=null)
        {
          extensionMetadata_[i]=exten;
        }
        i++;
      }    
    }
    return this.extensionMetadata_;
  }    

  /**
  * Returns a locale specific description of this Web Service type's resource metadata.
  * @return A locale specific description of this Web Service type's resource metadata.
  */
  public String[] getResourceTypeMetadata ()
  {
    if (resourceTypeMetadata_ == null)
    {
      StringTokenizer st = new StringTokenizer(element_.getAttribute("resourceTypeMetadata"));    
      resourceTypeMetadata_ = new String[st.countTokens()];
      int i=0;
      while (st.hasMoreElements())
      {
        String resourceType = (String)st.nextToken();
        if (resourceType!=null)
        {
          resourceTypeMetadata_[i]=resourceType;
        }
        i++;
      }
    }
    return resourceTypeMetadata_;
  }

  /**
  * Returns true if the plugin.xml contains an attribute of "canFinish" with a value of true.  Otherwise, 
  * false is returned.  Note: if the "canFinish" attribute is not specified true is returned by default.
  * @return Returns whether or not the user can finish on the pages before the web service type pages.
  */
  public boolean getCanFinish()
  {
    if( canFinish_ == null )
    {      
      String canFinishString = element_.getAttribute("canFinish");

      canFinish_ = canFinishString == null ? new Boolean( true ) : Boolean.valueOf( canFinishString );
    }

    return canFinish_.booleanValue();
  }
  
  /**
   * Returns the configuration element associated with
   * this type.
   * 
   * @return org.eclipse.core.runtime.IConfigurationElement
   */
  public IConfigurationElement getConfigurationElement()
  {
    return this.element_; 
  }

  public String getObjectSelectionWidget()
  {
    return element_.getAttribute("objectSelectionWidget");
  }
}

Back to the top