KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > osgi > service > metatype > ObjectClassDefinition


1 /*
2  * $Header: /cvshome/build/org.osgi.service.metatype/src/org/osgi/service/metatype/ObjectClassDefinition.java,v 1.11 2006/06/16 16:31:23 hargrave Exp $
3  *
4  * Copyright (c) OSGi Alliance (2001, 2006). All Rights Reserved.
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  */

18 package org.osgi.service.metatype;
19
20 import java.io.IOException JavaDoc;
21 import java.io.InputStream JavaDoc;
22
23 /**
24  * Description for the data type information of an objectclass.
25  *
26  * @version $Revision: 1.11 $
27  */

28 public interface ObjectClassDefinition {
29     /**
30      * Argument for <code>getAttributeDefinitions(int)</code>.
31      * <p>
32      * <code>REQUIRED</code> indicates that only the required definitions are
33      * returned. The value is 1.
34      */

35     public static final int REQUIRED = 1;
36     /**
37      * Argument for <code>getAttributeDefinitions(int)</code>.
38      * <p>
39      * <code>OPTIONAL</code> indicates that only the optional definitions are
40      * returned. The value is 2.
41      */

42     public static final int OPTIONAL = 2;
43     /**
44      * Argument for <code>getAttributeDefinitions(int)</code>.
45      * <p>
46      * <code>ALL</code> indicates that all the definitions are returned. The value
47      * is -1.
48      */

49     public static final int ALL = 0xFFFFFFFF;
50
51     /**
52      * Return the name of this object class.
53      *
54      * The name may be localized.
55      *
56      * @return The name of this object class.
57      */

58     public String JavaDoc getName();
59
60     /**
61      * Return the id of this object class.
62      *
63      * <p>
64      * <code>ObjectDefintion</code> objects share a global namespace in the
65      * registry. They share this aspect with LDAP/X.500 attributes. In these
66      * standards the OSI Object Identifier (OID) is used to uniquely identify
67      * object classes. If such an OID exists, (which can be requested at several
68      * standard organisations and many companies already have a node in the
69      * tree) it can be returned here. Otherwise, a unique id should be returned
70      * which can be a java class name (reverse domain name) or generated with a
71      * GUID algorithm. Note that all LDAP defined object classes already have an
72      * OID associated. It is strongly advised to define the object classes from
73      * existing LDAP schemes which will give the OID for free. Many such schemes
74      * exist ranging from postal addresses to DHCP parameters.
75      *
76      * @return The id of this object class.
77      */

78     public String JavaDoc getID();
79
80     /**
81      * Return a description of this object class.
82      *
83      * The description may be localized.
84      *
85      * @return The description of this object class.
86      */

87     public String JavaDoc getDescription();
88
89     /**
90      * Return the attribute definitions for this object class.
91      *
92      * <p>
93      * Return a set of attributes. The filter parameter can distinguish between
94      * <code>ALL</code>,<code>REQUIRED</code> or the <code>OPTIONAL</code>
95      * attributes.
96      *
97      * @param filter <code>ALL</code>,<code>REQUIRED</code>,<code>OPTIONAL</code>
98      * @return An array of attribute definitions or <code>null</code> if no
99      * attributes are selected
100      */

101     public AttributeDefinition[] getAttributeDefinitions(int filter);
102
103     /**
104      * Return an <code>InputStream</code> object that can be used to create an
105      * icon from.
106      *
107      * <p>
108      * Indicate the size and return an <code>InputStream</code> object containing
109      * an icon. The returned icon maybe larger or smaller than the indicated
110      * size.
111      *
112      * <p>
113      * The icon may depend on the localization.
114      *
115      * @param size Requested size of an icon, e.g. a 16x16 pixels icon then size =
116      * 16
117      * @return An InputStream representing an icon or <code>null</code>
118      * @throws IOException If the <code>InputStream</code> cannot be returned.
119      */

120     public InputStream JavaDoc getIcon(int size) throws IOException JavaDoc;
121 }
122
Popular Tags