Skip to main content
summaryrefslogtreecommitdiffstats
blob: bc5853e60a9e6b8268484ba80c84948489c8c58a (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
/*******************************************************************************
 * Copyright (c) 2006 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
 * yyyymmdd bug      Email and other contact information
 * -------- -------- -----------------------------------------------------------
 * 20060317   127456 cbrealey@ca.ibm.com - Chris Brealey
 *******************************************************************************/

package org.eclipse.wst.ws.internal.wsfinder;

import org.eclipse.core.runtime.IConfigurationElement;

/**
 * @author cbrealey
 * A WebServiceCategory represents a defined category of
 * Web service locators plugged into the WebServiceFinder
 * framework. Each category has a non-translatable identifier,
 * an optional non-translatable parent category identifier
 * (absent for root categories), a translatable short label,
 * a translatable long description and an icon.
 * @see WebServiceFinder#getWebServiceCategories() 
 */
public class WebServiceCategory
{
	private static final String ATTRIBUTE_ID = "id"; //$NON-NLS-1$
	private static final String ATTRIBUTE_CATEGORY = "category"; //$NON-NLS-1$
	private static final String ATTRIBUTE_LABEL = "label"; //$NON-NLS-1$
	private static final String ATTRIBUTE_DESCRIPTION = "description"; //$NON-NLS-1$
	private static final String ATTRIBUTE_ICON = "icon"; //$NON-NLS-1$
	
	private IConfigurationElement ice_;
	
	/**
	 * Constructs a new WebServiceCategory for the given
	 * configuration element from the extension registry.
	 * @param ice The configuration element on which this
	 * new WebServiceCategory is based. 
	 */
	public WebServiceCategory ( IConfigurationElement ice )
	{
		ice_ = ice;
	}
	
	/**
	 * Returns the non-translatable identifier of this category.
	 * @return The non-translatable identifier of this category.
	 * This should never be null.
	 */
	public String getId ()
	{
		return ice_.getAttributeAsIs(ATTRIBUTE_ID);
	}
	
	/**
	 * Returns the non-translatable identifier of this category's
	 * immediate parent category, or null if this is a root category
	 * and, as such, has no parent category.
	 * @return The non-translatable identifier of this category's
	 * parent, or null if there is none.
	 */
	public String getParentId ()
	{
		return ice_.getAttributeAsIs(ATTRIBUTE_CATEGORY);
	}
	
	/**
	 * Returns this category's immediate parent WebServiceCategory, or
	 * null if this is a root category and, as such, has no parent category.
	 * @return This category's immediate parent WebServiceCategory, or
	 * null if there is none.
	 */
	public WebServiceCategory getParent ()
	{
		return WebServiceFinder.instance().getWebServiceCategoryById(getParentId());
	}
	
	/**
	 * Returns the internationalized short label of this category,
	 * or null if there is none. Note that user interfaces may
	 * choose to bypass categories that do not have a label.
	 * @return The internationalized short label of this category,
	 * or null if there is none.
	 */
	public String getLabel ()
	{
		return ice_.getAttributeAsIs(ATTRIBUTE_LABEL);
	}
	
	/**
	 * Returns the internationalized description of this category,
	 * or null if there is none.
	 * @return The internationalized description of this category,
	 * or null if there is none.
	 */
	public String getDescription ()
	{
		return ice_.getAttributeAsIs(ATTRIBUTE_DESCRIPTION);
	}
	
	/**
	 * Returns the icon of this category, or null if there is none.
	 * @return The icon of this category, or null if there is none.
	 */
	public String getIcon ()
	{
		return ice_.getAttributeAsIs(ATTRIBUTE_ICON);
	}
}

Back to the top