org.norther.tammi.core.rt
Interface VariableRegistry

All Superinterfaces:
Loader, ObjectFactory<Variable>
All Known Subinterfaces:
ReferableVariableRegistryMBean
All Known Implementing Classes:
ReferableVariableRegistry

public interface VariableRegistry
extends ObjectFactory<Variable>, Loader

An interface to variable registries.

Version:
$Id: VariableRegistry.java,v 1.37 2010-02-24 09:24:11 cvsimp Exp $
Author:
Ilkka Priha

Method Summary
 void clearAllTypes()
          Clears registered attributes of all variable types.
 Introspector createIntrospector()
          Creates a variable introspector for this registry.
 Variable createVariable(String type)
          Creates a new variable instance of the specified type.
 Class<?> defineVariableClass(String className, Class<?>... ifaces)
          Defines a new variable of the named class.
 Class<?> defineVariableClass(String className, Class<?> superClass, Class<?>... ifaces)
          Defines a new variable of the named class extending the specified super class.
 Collection<? extends VariableAttributeInfo> getAttributeInfo(String type)
          Gets the registered attributes of the specified variable type.
 VariableAttributeInfo getAttributeInfo(String type, String name)
          Gets the registered named attribute of the specified variable type.
 List<VariableAttributeInfo> getAttributeList(String type)
          Gets the registered attribute list of cloned and modifiable attributes of the specified variable type.
 VariableAttributeInfo getAttributeNode(VariableAttributeInfo info, String... pattern)
          Gets a non-recursive attribute info node.
 List<VariableAttributeInfo> getAttributeTree(VariableAttributeInfo info, String... pattern)
          Gets a tree of recursive attribute infos, the original one at the index 0 and the non-recursive one at the last index.
 String getDefaultBaseClassName()
          Gets the default base class name applied to defined variable classes.
 String getDefaultVariableClassName()
          Gets the default variable class name applied to virtual variable types.
 VariableInfo getVariableInfo(String type)
          Gets the registered variable info of the specified variable type.
 boolean isLocalizedVariables()
          Checks whether variables in this registry are localized.
 boolean isTypeRegistered(String type)
          Checks whether the specified variable type is registered.
 void removeAttributeInfo(String type)
          Removes registered attributes of the specified variable type.
 void setAttributeInfo(String className)
          Sets the registered attributes of the named variable class.
 void setAttributeInfo(String type, Collection<? extends VariableAttributeInfo> attributes)
          Sets the registered attributes of the specified variable type.
 void setAttributeInfo(String type, Collection<? extends VariableAttributeInfo> attributes, Descriptor descriptor)
          Sets the registered attributes and descriptor of the specified variable type.
 void setAttributeInfo(String type, String className, Collection<? extends VariableAttributeInfo> attributes)
          Sets the registered attributes and class name of the specified variable type.
 void setAttributeInfo(String type, String className, Collection<? extends VariableAttributeInfo> attributes, Descriptor descriptor)
          Sets the registered attributes, class name and descriptor of the specified variable type.
 void setAttributeInfo(String type, String className, String description, Collection<? extends VariableAttributeInfo> attributes)
          Sets the registered attributes, class name and description of the specified variable type.
 void setAttributeInfo(String type, String className, String description, Collection<? extends VariableAttributeInfo> attributes, Descriptor descriptor)
          Sets the registered attributes, class name, description and descriptor of the specified variable type.
 void setDefaultBaseClassName(String className)
          Sets the default base class name applied to defined variable classes.
 void setDefaultVariableClassName(String className)
          Sets the default variable class name applied to virtual variable types.
 void setLocalizedVariables(boolean flag)
          Sets whether variables in this registry are localized.
 void setVariableInfo(String type, VariableInfo info)
          Sets the registered variable info of the specified variable type.
 Set<String> typeSet()
          Returns a read-only set of registered variable types.
 Set<String> typeSet(String prefix)
          Returns a set of registered variable types with the given prefix.
 
Methods inherited from interface org.norther.tammi.core.base.ObjectFactory
getInstance, getInstance, getInstance, getInstance, isLoaderSupported
 
Methods inherited from interface org.norther.tammi.core.base.Loader
addURL, defineClass, defineSubclass, defineSubclass, getResource, getResourceAsStream, getResources, getURLs, isClassDefined, loadClass
 

Method Detail

getDefaultBaseClassName

String getDefaultBaseClassName()
Gets the default base class name applied to defined variable classes.

Returns:
the default base class name.

setDefaultBaseClassName

void setDefaultBaseClassName(String className)
Sets the default base class name applied to defined variable classes.

Parameters:
className - the default base class name.

getDefaultVariableClassName

String getDefaultVariableClassName()
Gets the default variable class name applied to virtual variable types.

Returns:
the default variable class name.

setDefaultVariableClassName

void setDefaultVariableClassName(String className)
Sets the default variable class name applied to virtual variable types.

Parameters:
className - the default variable class name.

isLocalizedVariables

boolean isLocalizedVariables()
Checks whether variables in this registry are localized.

Returns:
true if localized, otherwise false.

setLocalizedVariables

void setLocalizedVariables(boolean flag)
Sets whether variables in this registry are localized.

Parameters:
flag - true if localized, otherwise false.

isTypeRegistered

boolean isTypeRegistered(String type)
Checks whether the specified variable type is registered.

Parameters:
type - the variable type.
Returns:
true if the type is registered, otherwise false.

getAttributeList

List<VariableAttributeInfo> getAttributeList(String type)
Gets the registered attribute list of cloned and modifiable attributes of the specified variable type. Both the list and the attributes may be modified and re-registered after modifications.

Parameters:
type - the variable type.
Returns:
a list of VariableAttributeInfo instances or null.

getVariableInfo

VariableInfo getVariableInfo(String type)
Gets the registered variable info of the specified variable type.

Parameters:
type - the variable type.
Returns:
an immutable variable info or null.

setVariableInfo

void setVariableInfo(String type,
                     VariableInfo info)
Sets the registered variable info of the specified variable type.

Parameters:
type - the variable type.
info - the variable info or null.

getAttributeInfo

VariableAttributeInfo getAttributeInfo(String type,
                                       String name)
Gets the registered named attribute of the specified variable type.

Parameters:
type - the variable type.
name - the attribute name.
Returns:
an immutable VariableAttributeInfo instance or null.

getAttributeInfo

Collection<? extends VariableAttributeInfo> getAttributeInfo(String type)
Gets the registered attributes of the specified variable type.

Parameters:
type - the variable type.
Returns:
an immutable collection of VariableAttributeInfo instances or null.

setAttributeInfo

void setAttributeInfo(String type,
                      Collection<? extends VariableAttributeInfo> attributes)
Sets the registered attributes of the specified variable type.

Parameters:
type - the variable type.
attributes - a collection of VariableAttributeInfo instances.

setAttributeInfo

void setAttributeInfo(String type,
                      String className,
                      Collection<? extends VariableAttributeInfo> attributes)
Sets the registered attributes and class name of the specified variable type.

The variable class has to implement the Variable interface

If the named variable class is not available, it will be dynamically defined to be a subclass of the default base class.

Parameters:
type - the variable type.
className - the class name.
attributes - a collection of VariableAttributeInfo instances.
Throws:
ClassCastException - if class name is invalid.

setAttributeInfo

void setAttributeInfo(String type,
                      String className,
                      String description,
                      Collection<? extends VariableAttributeInfo> attributes)
Sets the registered attributes, class name and description of the specified variable type.

Parameters:
type - the variable type.
className - the class name.
description - the description.
attributes - a collection of VariableAttributeInfo instances.
Throws:
ClassCastException - if class name is invalid.

setAttributeInfo

void setAttributeInfo(String type,
                      Collection<? extends VariableAttributeInfo> attributes,
                      Descriptor descriptor)
Sets the registered attributes and descriptor of the specified variable type.

Parameters:
type - the variable type.
attributes - a collection of VariableAttributeInfo instances.
descriptor - the variable descriptor.

setAttributeInfo

void setAttributeInfo(String type,
                      String className,
                      Collection<? extends VariableAttributeInfo> attributes,
                      Descriptor descriptor)
Sets the registered attributes, class name and descriptor of the specified variable type.

Parameters:
type - the variable type.
className - the class name.
attributes - a collection of VariableAttributeInfo instances.
descriptor - the variable descriptor.
Throws:
ClassCastException - if class name is invalid.

setAttributeInfo

void setAttributeInfo(String type,
                      String className,
                      String description,
                      Collection<? extends VariableAttributeInfo> attributes,
                      Descriptor descriptor)
Sets the registered attributes, class name, description and descriptor of the specified variable type.

Parameters:
type - the variable type.
className - the class name.
description - the description.
attributes - a collection of VariableAttributeInfo instances.
descriptor - the variable descriptor.
Throws:
ClassCastException - if class name is invalid.

setAttributeInfo

void setAttributeInfo(String className)
Sets the registered attributes of the named variable class.

Parameters:
className - the class name.
Throws:
ClassCastException - if class name is invalid.

removeAttributeInfo

void removeAttributeInfo(String type)
Removes registered attributes of the specified variable type.

Parameters:
type - the variable type.

clearAllTypes

void clearAllTypes()
Clears registered attributes of all variable types.


typeSet

Set<String> typeSet()
Returns a read-only set of registered variable types.

Returns:
a type set.

typeSet

Set<String> typeSet(String prefix)
Returns a set of registered variable types with the given prefix. Types starting with the given prefix followed by any dot separated item are included in the set. The prefix remains in the returned types.

Parameters:
prefix - a prefix.
Returns:
a type set.

defineVariableClass

Class<?> defineVariableClass(String className,
                             Class<?>... ifaces)
                             throws ClassNotFoundException,
                                    ClassFormatError
Defines a new variable of the named class. The defined class extends the default variable implementation.

Parameters:
className - the class name of the variable.
ifaces - optional interfaces.
Returns:
the defined class.
Throws:
ClassNotFoundException - for missing classes.
ClassFormatError - if the class hierarchy is invalid.

defineVariableClass

Class<?> defineVariableClass(String className,
                             Class<?> superClass,
                             Class<?>... ifaces)
                             throws ClassFormatError
Defines a new variable of the named class extending the specified super class. The base class must implement the Variable interface and support the default constructor and the registry constructor with two arguments: MBeanReference registry, String type.

Parameters:
className - the class name of the variable.
superClass - the super class.
ifaces - optional interfaces.
Returns:
the defined class.
Throws:
ClassFormatError - if the class hierarchy is invalid.

createVariable

Variable createVariable(String type)
                        throws ConstructionException
Creates a new variable instance of the specified type.

Parameters:
type - the type of the variable.
Returns:
the variable instance.
Throws:
ConstructionException - if construction fails.

getAttributeNode

VariableAttributeInfo getAttributeNode(VariableAttributeInfo info,
                                       String... pattern)
Gets a non-recursive attribute info node.

Parameters:
info - the recursive attribute info.
pattern - an optional pattern.
Returns:
the non-recursive attribute info.

getAttributeTree

List<VariableAttributeInfo> getAttributeTree(VariableAttributeInfo info,
                                             String... pattern)
Gets a tree of recursive attribute infos, the original one at the index 0 and the non-recursive one at the last index.

Parameters:
info - the recursive attribute info.
pattern - an optional pattern.
Returns:
a tree of attribute infos.

createIntrospector

Introspector createIntrospector()
Creates a variable introspector for this registry.

Returns:
the variable introspector.


Copyright © 2004 The Norther Organization. All rights reserved.