|
Framework Professional Edition Package |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
public interface MetaTypeUtils
This interface is meant to facilitate applications dealing with metatyping and
OSGi service configurations. As many of them will manage Strings,
instead of real objects, this interface provides some utility method for working
with String representations of objects.
| Field Summary | |
|---|---|
static int |
VALIDATE_ALL
Constant used by validateProperties(String, Dictionary, int). |
static int |
VALIDATE_SINGLE
Constant used by validateProperties(String, Dictionary, int). |
| Method Summary | |
|---|---|
java.util.Dictionary |
convertProperties(java.lang.String pid,
java.util.Dictionary properties)
Converts the given dictionary to one appropriate to be used by the Configuration.update(java.util.Dictionary) method. |
java.lang.String[] |
getTypeAndString(java.lang.Object object)
Returns the class name and the String represetation of an object. |
java.util.Dictionary |
validateProperties(java.lang.String pid,
java.util.Dictionary properties,
int validationType)
This method checks if the the given properties are valid for use by the ConfigurationAdmin (see OSGi ConfigurationAdmin specification) service for the given pid. |
| Field Detail |
|---|
static final int VALIDATE_SINGLE
validateProperties(String, Dictionary, int). Indicates that properties
must be validated by one. No checking for missing required attributes
will be performed.
static final int VALIDATE_ALL
validateProperties(String, Dictionary, int). Indicates that properties
must be validated as a whole. Checking for missing
required attributes will be performed, too.
| Method Detail |
|---|
java.lang.String[] getTypeAndString(java.lang.Object object)
throws java.lang.IllegalArgumentException
String represetation of an object.
See Convertor class for more information about converting objects
to String and the supported object types.
object - The object to be converted to String.
java.lang.IllegalArgumentException - if object is not among the supported types
java.util.Dictionary validateProperties(java.lang.String pid,
java.util.Dictionary properties,
int validationType)
throws java.lang.IllegalArgumentException
String representations of the real objects. These
String representations could be retrieved either as the second
element of the returned by the getTypeAndString(java.lang.Object) method array or by the
Convertor.objectToString(java.lang.Object) method.MetaDataManager is consulted for existence of MetaTypeProvider
with the corresponding pid. If exists, each ObjectClassDefinition.REQUIRED attribute
is checked for presence into the specified dictionary and any of ObjectClassDefinition.ALL
attributes if present is checked for correctness (via AttributeDefinition.validate(java.lang.String) method).
Attribute values and definitions are matched through the equality of
the corresponding keys and the ID returned by the
AttributeDefinition.getID() method.
pid - A non null String, holding the pid of
a configuration.properties - Dictionary holding String reprsentations of the real values.validationType - The validation type. Should be VALIDATE_ALL or
VALIDATE_SINGLE.
null is returned.
java.lang.IllegalArgumentException - if the pid is null, the
parameter properties are null or empty, or the provider not found.
java.util.Dictionary convertProperties(java.lang.String pid,
java.util.Dictionary properties)
throws java.lang.IllegalArgumentException
Configuration.update(java.util.Dictionary) method.
The dictionary MUST contain configuration keys and values. The values
must be the String representation of the real object.
These String representations could be retrieved either as the second
element of the returned by the getTypeAndString(java.lang.Object) method array or by the
Convertor.objectToString(java.lang.Object) method.
pid - A non null String, holding the pid of a configuration.properties - Dictionary containing mapping of
AttributeDefinition IDs to represented as String values.
java.lang.IllegalArgumentException - If the pid is null, the properties are null or empty,
there is no provider found for the specified pid, attribute definition
with id matching some of the passed dictionary keys was not found
or if a dictionary value is not of the syntax the definition requires.
|
Framework Professional Edition Package |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||