Michael E. Rodriguez | 86f57b0 | 2006-03-29 21:05:08 +0000 | [diff] [blame] | 1 | /* |
Richard S. Hall | 8df9ab1 | 2009-07-24 17:06:37 +0000 | [diff] [blame^] | 2 | * Copyright (c) OSGi Alliance (2001, 2008). All Rights Reserved. |
Michael E. Rodriguez | 86f57b0 | 2006-03-29 21:05:08 +0000 | [diff] [blame] | 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | package org.osgi.service.metatype; |
| 17 | |
| 18 | import java.io.IOException; |
| 19 | import java.io.InputStream; |
| 20 | |
| 21 | /** |
| 22 | * Description for the data type information of an objectclass. |
| 23 | * |
Richard S. Hall | 8df9ab1 | 2009-07-24 17:06:37 +0000 | [diff] [blame^] | 24 | * @version $Revision: 5673 $ |
Michael E. Rodriguez | 86f57b0 | 2006-03-29 21:05:08 +0000 | [diff] [blame] | 25 | */ |
| 26 | public interface ObjectClassDefinition { |
| 27 | /** |
| 28 | * Argument for <code>getAttributeDefinitions(int)</code>. |
| 29 | * <p> |
| 30 | * <code>REQUIRED</code> indicates that only the required definitions are |
| 31 | * returned. The value is 1. |
| 32 | */ |
| 33 | public static final int REQUIRED = 1; |
| 34 | /** |
| 35 | * Argument for <code>getAttributeDefinitions(int)</code>. |
| 36 | * <p> |
| 37 | * <code>OPTIONAL</code> indicates that only the optional definitions are |
| 38 | * returned. The value is 2. |
| 39 | */ |
| 40 | public static final int OPTIONAL = 2; |
| 41 | /** |
| 42 | * Argument for <code>getAttributeDefinitions(int)</code>. |
| 43 | * <p> |
| 44 | * <code>ALL</code> indicates that all the definitions are returned. The value |
| 45 | * is -1. |
| 46 | */ |
| 47 | public static final int ALL = 0xFFFFFFFF; |
| 48 | |
| 49 | /** |
| 50 | * Return the name of this object class. |
| 51 | * |
| 52 | * The name may be localized. |
| 53 | * |
| 54 | * @return The name of this object class. |
| 55 | */ |
| 56 | public String getName(); |
| 57 | |
| 58 | /** |
| 59 | * Return the id of this object class. |
| 60 | * |
| 61 | * <p> |
| 62 | * <code>ObjectDefintion</code> objects share a global namespace in the |
| 63 | * registry. They share this aspect with LDAP/X.500 attributes. In these |
| 64 | * standards the OSI Object Identifier (OID) is used to uniquely identify |
| 65 | * object classes. If such an OID exists, (which can be requested at several |
| 66 | * standard organisations and many companies already have a node in the |
| 67 | * tree) it can be returned here. Otherwise, a unique id should be returned |
| 68 | * which can be a java class name (reverse domain name) or generated with a |
| 69 | * GUID algorithm. Note that all LDAP defined object classes already have an |
| 70 | * OID associated. It is strongly advised to define the object classes from |
| 71 | * existing LDAP schemes which will give the OID for free. Many such schemes |
| 72 | * exist ranging from postal addresses to DHCP parameters. |
| 73 | * |
| 74 | * @return The id of this object class. |
| 75 | */ |
| 76 | public String getID(); |
| 77 | |
| 78 | /** |
| 79 | * Return a description of this object class. |
| 80 | * |
| 81 | * The description may be localized. |
| 82 | * |
| 83 | * @return The description of this object class. |
| 84 | */ |
| 85 | public String getDescription(); |
| 86 | |
| 87 | /** |
| 88 | * Return the attribute definitions for this object class. |
| 89 | * |
| 90 | * <p> |
| 91 | * Return a set of attributes. The filter parameter can distinguish between |
| 92 | * <code>ALL</code>,<code>REQUIRED</code> or the <code>OPTIONAL</code> |
| 93 | * attributes. |
| 94 | * |
| 95 | * @param filter <code>ALL</code>,<code>REQUIRED</code>,<code>OPTIONAL</code> |
| 96 | * @return An array of attribute definitions or <code>null</code> if no |
| 97 | * attributes are selected |
| 98 | */ |
| 99 | public AttributeDefinition[] getAttributeDefinitions(int filter); |
| 100 | |
| 101 | /** |
| 102 | * Return an <code>InputStream</code> object that can be used to create an |
| 103 | * icon from. |
| 104 | * |
| 105 | * <p> |
| 106 | * Indicate the size and return an <code>InputStream</code> object containing |
| 107 | * an icon. The returned icon maybe larger or smaller than the indicated |
| 108 | * size. |
| 109 | * |
| 110 | * <p> |
| 111 | * The icon may depend on the localization. |
| 112 | * |
| 113 | * @param size Requested size of an icon, e.g. a 16x16 pixels icon then size = |
| 114 | * 16 |
| 115 | * @return An InputStream representing an icon or <code>null</code> |
| 116 | * @throws IOException If the <code>InputStream</code> cannot be returned. |
| 117 | */ |
| 118 | public InputStream getIcon(int size) throws IOException; |
| 119 | } |