Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: baadcea217bffb8986c03070cf7ad06f87b72b3a (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
/*
 * Copyright (c) OSGi Alliance (2001, 2018). All Rights Reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.osgi.service.metatype;

import java.io.IOException;
import java.io.InputStream;

import org.osgi.annotation.versioning.ConsumerType;

/**
 * Description for the data type information of an objectclass.
 * 
 * @ThreadSafe
 * @author $Id$
 */
@ConsumerType
public interface ObjectClassDefinition {
	/**
	 * Argument for {@code getAttributeDefinitions(int)}.
	 * <p>
	 * {@code REQUIRED} indicates that only the required definitions are
	 * returned. The value is 1.
	 */
	public static final int	REQUIRED	= 1;
	/**
	 * Argument for {@code getAttributeDefinitions(int)}.
	 * <p>
	 * {@code OPTIONAL} indicates that only the optional definitions are
	 * returned. The value is 2.
	 */
	public static final int	OPTIONAL	= 2;
	/**
	 * Argument for {@code getAttributeDefinitions(int)}.
	 * <p>
	 * {@code ALL} indicates that all the definitions are returned. The value is
	 * -1.
	 */
	public static final int	ALL			= 0xFFFFFFFF;

	/**
	 * Return the name of this object class.
	 * 
	 * The name may be localized.
	 * 
	 * @return The name of this object class.
	 */
	public String getName();

	/**
	 * Return the id of this object class.
	 * <p>
	 * {@code ObjectDefintion} objects share a global namespace in the registry.
	 * They share this aspect with LDAP/X.500 attributes. In these standards the
	 * OSI Object Identifier (OID) is used to uniquely identify object classes.
	 * If such an OID exists, (which can be requested at several standard
	 * organizations and many companies already have a node in the tree) it can
	 * be returned here. Otherwise, a unique id should be returned which can be
	 * a Java class name (reverse domain name) or generated with a GUID
	 * algorithm. Note that all LDAP defined object classes already have an OID
	 * associated. It is strongly advised to define the object classes from
	 * existing LDAP schemes which will give the OID for free. Many such schemes
	 * exist ranging from postal addresses to DHCP parameters.
	 * 
	 * @return The id of this object class.
	 */
	public String getID();

	/**
	 * Return a description of this object class.
	 * 
	 * The description may be localized.
	 * 
	 * @return The description of this object class.
	 */
	public String getDescription();

	/**
	 * Return the attribute definitions for this object class.
	 * 
	 * <p>
	 * Return a set of attributes. The filter parameter can distinguish between
	 * {@code ALL},{@code REQUIRED} or the {@code OPTIONAL} attributes.
	 * 
	 * @param filter {@code ALL},{@code REQUIRED},{@code OPTIONAL}
	 * @return An array of attribute definitions or {@code null} if no
	 *         attributes are selected
	 */
	public AttributeDefinition[] getAttributeDefinitions(int filter);

	/**
	 * Return an {@code InputStream} object that can be used to create an icon
	 * from.
	 * 
	 * <p>
	 * Indicate the size and return an {@code InputStream} object containing an
	 * icon. The returned icon maybe larger or smaller than the indicated size.
	 * 
	 * <p>
	 * The icon may depend on the localization.
	 * 
	 * @param size Requested size of an icon. For example, a 16x16 pixel icon
	 *        has a size of 16
	 * @return An InputStream representing an icon or {@code null}
	 * @throws IOException If the {@code InputStream} cannot be returned.
	 */
	public InputStream getIcon(int size) throws IOException;
}

Back to the top