org.knopflerfish.util.metatype
public class OCD extends java.lang.Object implements ObjectClassDefinition
ObjectClassDefinition interface.ALL, OPTIONAL, REQUIRED| Constructor and Description |
|---|
OCD(java.lang.String id,
java.lang.String name,
java.lang.String desc,
java.util.Dictionary<java.lang.String,?> props)
Creates an OCD with attribute definitions from an existing dictionary.
|
OCD(java.lang.String id,
java.lang.String name,
java.lang.String desc,
java.net.URL sourceURL)
Create a new, empty
ObjectClassDefinition. |
| Modifier and Type | Method and Description |
|---|---|
void |
add(AD attr,
int filter)
Add an attribute definition
|
void |
addIcon(int size,
java.lang.String url) |
AttributeDefinition[] |
getAttributeDefinitions(int filter)
Return the attribute definitions for this object class.
|
java.lang.String |
getDescription()
Get description of OCD.
|
java.io.InputStream |
getIcon(int size)
This code handles multiple icon sizes but the specification currently only
allows on size.
|
java.lang.String |
getID()
Return the id of this object class.
|
int |
getMaxInstances()
Get maximum number of instances.
|
java.lang.String |
getName()
Return the name of this object class.
|
void |
setIconURL(java.lang.String url)
Set URL to icon
|
java.lang.String |
toString() |
public OCD(java.lang.String id, java.lang.String name, java.lang.String desc, java.net.URL sourceURL)
ObjectClassDefinition.id - unique ID of the definition.name - human-readable name of the definition. If set to null,
use id as name.desc - human-readable description of the definitionjava.lang.IllegalArgumentException - if id is public OCD(java.lang.String id, java.lang.String name, java.lang.String desc, java.util.Dictionary<java.lang.String,?> props)
id - unique ID of the definition.name - human-readable name of the definition. If set to null,
use id as name.desc - human-readable description of the definitionprops - set of key value pairs used for attribute definitions. all entries
in props will be set as REQUIRED attributes.java.lang.IllegalArgumentException - if id is public void add(AD attr, int filter)
attr - definition to addfilter - either OPTIONAL or REQUIREDIllegalargumentexception - if filter is not OPTIONAL or REQUIREDpublic AttributeDefinition[] getAttributeDefinitions(int filter)
ObjectClassDefinition
Return a set of attributes. The filter parameter can distinguish between
ALL,REQUIRED or the OPTIONAL attributes.
getAttributeDefinitions in interface ObjectClassDefinitionfilter - ALL,REQUIRED,OPTIONALnull if no
attributes are selectedpublic java.lang.String getDescription()
getDescription in interface ObjectClassDefinitionpublic java.io.InputStream getIcon(int size)
throws java.io.IOException
getIcon in interface ObjectClassDefinitionsize - Size of icon requested, if size is 0 return largest icon.nulljava.io.IOException - If the InputStream cannot be returned.public int getMaxInstances()
public void setIconURL(java.lang.String url)
public void addIcon(int size,
java.lang.String url)
public java.lang.String getID()
ObjectClassDefinition
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.
getID in interface ObjectClassDefinitionpublic java.lang.String getName()
ObjectClassDefinitiongetName in interface ObjectClassDefinitionpublic java.lang.String toString()
toString in class java.lang.Object