Framework Professional Edition Package


org.mbs.services.metatype
Interface AttributeDefinitionEx

All Superinterfaces:
AttributeDefinition

public interface AttributeDefinitionEx
extends AttributeDefinition

This interface extends AttributeDefinition in order to provide means, not defined by standard metatype API.

Since:
$Date: 2005/07/27 08:47:39 $
Author:
Stoyan Zoubev

Field Summary
static int DICTIONARY
          The DICTIONARY type.
static java.lang.String HIDDEN
          This constant defines a key for attribute extension properties.
static java.lang.String MAXIMUM
          This constant defines a key for attribute extension properties.
static java.lang.String MINIMUM
          This constant defines a key for attribute extension properties.
static java.lang.String READ_ONLY
          This constant defines a key for attribute extension properties.
static java.lang.String STEP
          This constant defines a key for attribute extension properties.
 
Fields inherited from interface org.osgi.service.metatype.AttributeDefinition
BIGDECIMAL, BIGINTEGER, BOOLEAN, BYTE, CHARACTER, DOUBLE, FLOAT, INTEGER, LONG, SHORT, STRING
 
Method Summary
 java.lang.String[] getDefaultValue()
          Return a default for this attribute.
 java.lang.String getModifier(java.lang.String key)
          Returns the value associated with the given key concerning this attribute.
 java.lang.String[] getModifierKeys()
          Returns a set of modifier keys for this attribute definition.
 java.util.Dictionary getProperties()
          Returns the additional properties, contained in the configuration xml meta data by the key tag.
 int getType(java.lang.String key)
          Returns the type of the object corresponding to the specified key when this object is kept as dictionary.
 java.lang.String[] validate(java.lang.String[] values)
          Validates the specified value argument as if a value for the key argument.
 
Methods inherited from interface org.osgi.service.metatype.AttributeDefinition
getCardinality, getDescription, getID, getName, getOptionLabels, getOptionValues, getType, validate
 

Field Detail

DICTIONARY

static final int DICTIONARY
The DICTIONARY type. Attributes of this type should be stored as java.util.Dictionary objects, where keys are Strings and values are of the single types definied by the standard metatype API. The method getCardinality() value MUST always return 0.

See Also:
Constant Field Values

MINIMUM

static final java.lang.String MINIMUM
This constant defines a key for attribute extension properties. The property key is "minValue" and the property value should be a string representation of the minimum value acceptable for the attribute.

See Also:
Constant Field Values

MAXIMUM

static final java.lang.String MAXIMUM
This constant defines a key for attribute extension properties. The property key is "maxValue" and the property value should be a string representation of the maximum value acceptable for the attribute.

See Also:
Constant Field Values

STEP

static final java.lang.String STEP
This constant defines a key for attribute extension properties. The property key is "stepValue" and the property value should be a string representation of the value that is acceptable for increment/decrement operations over the attribute.

See Also:
Constant Field Values

HIDDEN

static final java.lang.String HIDDEN
This constant defines a key for attribute extension properties. The property key is "hidden" and the property value should be a string. If the property value is equal, ignoring case, to the string "true", then any visual attribute editors must not display the attibute value. This property is useful for passwords.

See Also:
Constant Field Values

READ_ONLY

static final java.lang.String READ_ONLY
This constant defines a key for attribute extension properties. The property key is "readOnly" and the property value should be a string. If the property value is equal, ignoring case, to the string "true", then any visual attribute editors must not allow means to directly alter the attibute value.

See Also:
Constant Field Values
Method Detail

getProperties

java.util.Dictionary getProperties()
Returns the additional properties, contained in the configuration xml meta data by the key tag. It usually holds info about min and max values of an attribute.

Returns:
properties of an attribute or null if no tag key.

getType

int getType(java.lang.String key)
Returns the type of the object corresponding to the specified key when this object is kept as dictionary. See DICTIONARY. For available keys see getDefaultValue().

Parameters:
key - The key of the object whose type is requested.
Returns:
The type of the object which must be kept within the dictionary when this attribute extension is of type DICTIONARY. -1 will be returned if this object is not of type DICTIONARY, such key is not present or syntax is not known.

validate

java.lang.String[] validate(java.lang.String[] values)
Validates the specified value argument as if a value for the key argument. Applicable when this object is of type DICTIONARY or of non 0 cardinality.

Parameters:
values - array of String with even length where representing a dictionary where keys are on even an values are on odd positions.
Returns:
null if no errors detected. If erros detected than: 1) If cardinality of this object is not 0, the returned array must be of the same length as the values argument length. Error at index i respects to value at the same index. 2) Attribute IS of type DICTIONARY. If passed values argument is not of even length IllegalArgumentException will be thrown, otherwise String array of even length is constructed and value at even positions are keys & the corresponding error is on next position. 3) When object IS NOT of type DICTIONARY - IllegalArgumentException will be thrown.
Throws:
java.lang.IllegalArgumentException - is thrown if method is not used as expected.

getDefaultValue

java.lang.String[] getDefaultValue()
Return a default for this attribute. The return value follows one of the following rules: 1) When this object is of type DICTIONARY array MUST be of even length containing key at position i*2 and the default value for this key at position i*2+1. When specified(non null) the default value must be convertable to object according to the type, as obtained from getType(String), for the corresponding key. Default value can also be null with the meaning the key presence is optional within the dictionary. 2) The object must be of the appropriate type as defined by the cardinality and getType(String). The returned array is a list of String objects that can be converted to the appropriate type. The cardinality of the return array must follow the absolute cardinality of this type. E.g. if the cardinality = 0, the array must contain 1 element. If the cardinality is 1, it must contain 0 or 1 elements. If it is -5, it must contain from 0 to max 5 elements. Note that the special case of a 0 cardinality, meaning a single value, does not allow arrays or vectors of 0 elements.

Specified by:
getDefaultValue in interface AttributeDefinition
Returns:
Return a default value or null if no default exists.

getModifierKeys

java.lang.String[] getModifierKeys()
Returns a set of modifier keys for this attribute definition. Modifiers are Prosyst extensions of the AttributeDefinition interface and are used for the needs of the ConfigurationAdmin Service.

Returns:
a set of modifier keys as an array of Strings.

getModifier

java.lang.String getModifier(java.lang.String key)
Returns the value associated with the given key concerning this attribute.

Parameters:
key - name of the modifier
Returns:
The value associated to the key. When not present null is returned.
See Also:
getModifierKeys()

Framework Professional Edition Package


Copyright © 1999-2007 ProSyst Software GmbH. All Rights Reserved