org.gvsig.tools.dynobject.impl
Class DefaultDynObjectManager

java.lang.Object
  extended by org.gvsig.tools.dynobject.impl.DefaultDynObjectManager
All Implemented Interfaces:
DynObjectManager

public class DefaultDynObjectManager
extends Object
implements DynObjectManager

Default DynObjectManager implementation.

Version:
$Id$
Author:
gvSIG Team

Field Summary
 
Fields inherited from interface org.gvsig.tools.dynobject.DynObjectManager
NULLCODE
 
Constructor Summary
DefaultDynObjectManager()
           
 
Method Summary
 void add(DynClass dynClass)
          Añade la dynClass a la lista de clases registradas.
 DynClass add(String name)
          Create and add to the manager a class with the name passed as parameter in the default namespace.
 DynClass add(String name, String description)
          Create and add to the manager a class with the name passed as parameter in the default namespace.
 void consolide()
          Actualiza todas las DynClasses registradas para reflejar la herencia de forma adecuada.
 DynClass createDynClass(String name, String description)
          Create a instance of DynClass with the name and description Indicated as parameters.
 DynClass createDynClass(String namespace, String name, String description)
          Create a instance of DynClass with the name and description Indicated as parameters.
 DynClassName createDynClassName(String name)
          Creates a DynClassName with a DynClass name or fullname
 DynClassName createDynClassName(String namespace, String name)
          Creates a DynClassName with a DynClass name and its namespace.
 DynObject createDynObject(DynStruct dynClass)
          Create a new DynObject associated to the DynStruct or DynClass passed as parameter.
 DynObject createDynObject(String dynClassName)
          Crea un nuevo objeto asociandole como clase base la indicada que tiene el nombre indicado.
 DynObject createDynObject(String dynClassName, String namespace)
          Crea un nuevo objeto asociandole como clase base la indicada que tiene el nombre indicado.
 DynObjectPagingHelper createDynObjectPagingHelper(DynObjectSet set)
          Creates a new DynObjectPagingHelper to page the data of a DynObjectSet.
 DynObjectPagingHelper createDynObjectPagingHelper(DynObjectSet set, int pageSize)
          Creates a new DynObjectPagingHelper to page the data of a DynObjectSet.
 DynClass get(DynClass[] superClasses)
           
 DynClass get(String theName)
          Obtiene la clase asociado al nombre indicado.
 DynClass get(String namespace, String name)
          Obtiene el la clase asociado al nombre indicado dentro del namespace pedido.
 int getCount()
          Return the count of registered DynClass.
 Class getDefaultClassOfType(int type)
           
 DynMethod getDynMethod(Class theClass, int code)
           
 DynMethod getDynMethod(DynClass dynClass, int code)
           
 DynMethod getDynMethod(DynObject dynObject, int code)
          Obtain the method for the indicated code of the dynObject.
 DynMethod getDynMethod(int code)
           
 DynMethod getDynMethod(Object obj, int code)
           
 int getDynMethodCode(Class theClass, String methodName)
           
 int getDynMethodCode(DynClass dynClass, String methodName)
           
static DefaultDynObjectManager getManager()
           
 List getNames()
          Return the list of names of all registered DynClass.
 boolean has(String name)
          Comprueba si esta registrada una clase.
 boolean has(String namespace, String name)
          Comprueba si esta registrada una clase.
 Map importDynClassDefinitions(InputStream resource, ClassLoader loader)
          Load the classes defined in the resource.
 Map importDynClassDefinitions(InputStream resource, ClassLoader loader, String defaultNamespace)
          Load the classes defined in the resource and return a Map with its.
 Map importDynClassDefinitions(org.xmlpull.v1.XmlPullParser parser, ClassLoader loader, String defaultNamespace)
          Load the classes defined in the resource.
 Object invokeDynMethod(Object self, int code, DynObject context)
          Invoke the method of the indicated code for the object self, with parameters in context.
 Iterator iterator()
          Return an iterator over all registered DynClass.
 Iterator iterator(String nameSpace)
          Return an iterator over all registered DynClass with the same namespace.
 int registerDynMethod(Class theClass, DynMethod dynMethod)
          Register the method in the class.
 int registerDynMethod(DynClass dynClass, DynMethod dynMethod)
          Register the method in the dynClass.
 void remove(DynStruct dynClass)
           
 void validate(DynObject object)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultDynObjectManager

public DefaultDynObjectManager()
Method Detail

getManager

public static DefaultDynObjectManager getManager()

createDynClass

public DynClass createDynClass(String name,
                               String description)
Description copied from interface: DynObjectManager
Create a instance of DynClass with the name and description Indicated as parameters.

Specified by:
createDynClass in interface DynObjectManager
Parameters:
name - , the name used for DynClass name.
description - , the description associated to the new DynClass.
Returns:
the DynClass created.

createDynClass

public DynClass createDynClass(String namespace,
                               String name,
                               String description)
Description copied from interface: DynObjectManager
Create a instance of DynClass with the name and description Indicated as parameters.

Specified by:
createDynClass in interface DynObjectManager
Parameters:
namespace - , the namespace used for the new DynClass.
name - , the name used for the new DynClass.
description - , the description associated to the new DynClass.
Returns:
the DynClass created.

add

public void add(DynClass dynClass)
Description copied from interface: DynObjectManager
Añade la dynClass a la lista de clases registradas. Falla lanzando una excepcion si ya existe una clase registrada con ese nombre en ese namespace.

Specified by:
add in interface DynObjectManager

add

public DynClass add(String name,
                    String description)
Description copied from interface: DynObjectManager
Create and add to the manager a class with the name passed as parameter in the default namespace.

Specified by:
add in interface DynObjectManager
Returns:
the new class created.

add

public DynClass add(String name)
Description copied from interface: DynObjectManager
Create and add to the manager a class with the name passed as parameter in the default namespace.

Specified by:
add in interface DynObjectManager
Returns:
the new class created.

remove

public void remove(DynStruct dynClass)
Specified by:
remove in interface DynObjectManager

get

public DynClass get(String theName)
Description copied from interface: DynObjectManager
Obtiene la clase asociado al nombre indicado. Si se indica un nombre con namespace la buscara en ese namespace. if not se usara el namespace por defecto.

Specified by:
get in interface DynObjectManager
Parameters:
theName - , nombre de la clase que queremos obtener.
Returns:
la clase requerida.

get

public DynClass get(String namespace,
                    String name)
Description copied from interface: DynObjectManager
Obtiene el la clase asociado al nombre indicado dentro del namespace pedido.

Specified by:
get in interface DynObjectManager
name - , nombre de la clase que queremos obtener.
Returns:
la clase requerida.

get

public DynClass get(DynClass[] superClasses)

getCount

public int getCount()
Description copied from interface: DynObjectManager
Return the count of registered DynClass.

Specified by:
getCount in interface DynObjectManager
Returns:
count of DynClass

getNames

public List getNames()
Description copied from interface: DynObjectManager
Return the list of names of all registered DynClass.

Specified by:
getNames in interface DynObjectManager
Returns:
list of DynClass names.

has

public boolean has(String name)
Description copied from interface: DynObjectManager
Comprueba si esta registrada una clase.

Specified by:
has in interface DynObjectManager
Returns:
true si la clase "name" esta registrada, false si no.

has

public boolean has(String namespace,
                   String name)
Description copied from interface: DynObjectManager
Comprueba si esta registrada una clase.

Specified by:
has in interface DynObjectManager
Returns:
true si la clase "name" esta registrada, false si no.

iterator

public Iterator iterator()
Description copied from interface: DynObjectManager
Return an iterator over all registered DynClass.

Specified by:
iterator in interface DynObjectManager
Returns:
the iterator.

createDynObject

public DynObject createDynObject(String dynClassName)
Description copied from interface: DynObjectManager
Crea un nuevo objeto asociandole como clase base la indicada que tiene el nombre indicado.

Specified by:
createDynObject in interface DynObjectManager
Returns:
el nuevo DynObject

createDynObject

public DynObject createDynObject(String dynClassName,
                                 String namespace)
Description copied from interface: DynObjectManager
Crea un nuevo objeto asociandole como clase base la indicada que tiene el nombre indicado.

Specified by:
createDynObject in interface DynObjectManager
Returns:
el nuevo DynObject

createDynObject

public DynObject createDynObject(DynStruct dynClass)
Description copied from interface: DynObjectManager
Create a new DynObject associated to the DynStruct or DynClass passed as parameter.

Specified by:
createDynObject in interface DynObjectManager
Parameters:
dynClass - or dynClass to use for create the dynObject
Returns:
the new DynObject

consolide

public void consolide()
Description copied from interface: DynObjectManager
Actualiza todas las DynClasses registradas para reflejar la herencia de forma adecuada.

Specified by:
consolide in interface DynObjectManager

registerDynMethod

public int registerDynMethod(DynClass dynClass,
                             DynMethod dynMethod)
Description copied from interface: DynObjectManager
Register the method in the dynClass.

Specified by:
registerDynMethod in interface DynObjectManager
Parameters:
dynClass - class over the method is registred
dynMethod - method to registry
Returns:
unique code of method

registerDynMethod

public int registerDynMethod(Class theClass,
                             DynMethod dynMethod)
Description copied from interface: DynObjectManager
Register the method in the class.

Specified by:
registerDynMethod in interface DynObjectManager
Parameters:
theClass - class over the method is registred
dynMethod - method to registry
Returns:
unique code of method

invokeDynMethod

public Object invokeDynMethod(Object self,
                              int code,
                              DynObject context)
                       throws DynMethodException
Description copied from interface: DynObjectManager
Invoke the method of the indicated code for the object self, with parameters in context.

Specified by:
invokeDynMethod in interface DynObjectManager
Parameters:
self - object over the method is invoked
code - code for the method to invoke
context - paramters of method
Returns:
return value for the method
Throws:
DynMethodException

getDynMethodCode

public int getDynMethodCode(DynClass dynClass,
                            String methodName)
                     throws DynMethodException
Throws:
DynMethodException

getDynMethodCode

public int getDynMethodCode(Class theClass,
                            String methodName)
                     throws DynMethodException
Throws:
DynMethodException

getDynMethod

public DynMethod getDynMethod(int code)
                       throws DynMethodException
Specified by:
getDynMethod in interface DynObjectManager
Throws:
DynMethodException

getDynMethod

public DynMethod getDynMethod(Object obj,
                              int code)
                       throws DynMethodException
Specified by:
getDynMethod in interface DynObjectManager
Throws:
DynMethodException

getDynMethod

public DynMethod getDynMethod(Class theClass,
                              int code)
                       throws DynMethodException
Specified by:
getDynMethod in interface DynObjectManager
Throws:
DynMethodException

getDynMethod

public DynMethod getDynMethod(DynClass dynClass,
                              int code)
                       throws DynMethodException
Specified by:
getDynMethod in interface DynObjectManager
Throws:
DynMethodException

getDynMethod

public DynMethod getDynMethod(DynObject dynObject,
                              int code)
                       throws DynMethodException
Description copied from interface: DynObjectManager
Obtain the method for the indicated code of the dynObject.

Specified by:
getDynMethod in interface DynObjectManager
code - code of the requeted method
Returns:
the required DynMethod
Throws:
DynMethodException

validate

public void validate(DynObject object)
Specified by:
validate in interface DynObjectManager

getDefaultClassOfType

public Class getDefaultClassOfType(int type)
Specified by:
getDefaultClassOfType in interface DynObjectManager

importDynClassDefinitions

public Map importDynClassDefinitions(InputStream resource,
                                     ClassLoader loader)
                              throws org.xmlpull.v1.XmlPullParserException,
                                     IOException
Description copied from interface: DynObjectManager
Load the classes defined in the resource. When the class do not specify a namespace this is set to null. The classes do not be registered in the manager.

Specified by:
importDynClassDefinitions in interface DynObjectManager
Parameters:
resource - , XML with the definition of dynamic classes.
loader - , loader used to load classes used in "classOfValue" in the resource.
Returns:
The Map of loaded dynamic classes
Throws:
org.xmlpull.v1.XmlPullParserException
IOException

importDynClassDefinitions

public Map importDynClassDefinitions(org.xmlpull.v1.XmlPullParser parser,
                                     ClassLoader loader,
                                     String defaultNamespace)
                              throws org.xmlpull.v1.XmlPullParserException,
                                     IOException
Description copied from interface: DynObjectManager
Load the classes defined in the resource. When the class do not specify a namespace this is set to null. The classes do not be registered in the manager.

Specified by:
importDynClassDefinitions in interface DynObjectManager
Parameters:
parser - , XML parser used in the definition of dynamic classes.
loader - , loader used to load classes used in "classOfValue" in the resource.
defaultNamespace - , namespace used in classes that do not specify a namespace in the resource.
Returns:
The Map of loaded dynamic classes
Throws:
org.xmlpull.v1.XmlPullParserException
IOException

importDynClassDefinitions

public Map importDynClassDefinitions(InputStream resource,
                                     ClassLoader loader,
                                     String defaultNamespace)
                              throws org.xmlpull.v1.XmlPullParserException,
                                     IOException
Description copied from interface: DynObjectManager
Load the classes defined in the resource and return a Map with its. The classes do not be registered in the manager.

Specified by:
importDynClassDefinitions in interface DynObjectManager
Parameters:
resource - , XML with the definition of dynamic classes.
loader - , loader used to load classes used in "classOfValue" in the resource.
defaultNamespace - , namespace used in classes that do not specify a namespace in the resource.
Returns:
The Map of loaded dynamic classes
Throws:
org.xmlpull.v1.XmlPullParserException
IOException

createDynObjectPagingHelper

public DynObjectPagingHelper createDynObjectPagingHelper(DynObjectSet set)
                                                  throws BaseException
Description copied from interface: DynObjectManager
Creates a new DynObjectPagingHelper to page the data of a DynObjectSet.

Specified by:
createDynObjectPagingHelper in interface DynObjectManager
Parameters:
set - to page the data of
Returns:
a DynObjectPagingHelper
Throws:
BaseException - if there is an error creating the paging helper, usually because of an error getting the data of the DynObjectSet

createDynObjectPagingHelper

public DynObjectPagingHelper createDynObjectPagingHelper(DynObjectSet set,
                                                         int pageSize)
                                                  throws BaseException
Description copied from interface: DynObjectManager
Creates a new DynObjectPagingHelper to page the data of a DynObjectSet.

Specified by:
createDynObjectPagingHelper in interface DynObjectManager
Parameters:
set - to page the data of
pageSize - the size of the page to load using the helper
Returns:
a DynObjectPagingHelper
Throws:
BaseException - if there is an error creating the paging helper, usually because of an error getting the data of the DynObjectSet

createDynClassName

public DynClassName createDynClassName(String namespace,
                                       String name)
Description copied from interface: DynObjectManager
Creates a DynClassName with a DynClass name and its namespace.

Specified by:
createDynClassName in interface DynObjectManager
Parameters:
namespace - where the DynClass belongs to
name - of the DynClass
Returns:
a new DynClassName

createDynClassName

public DynClassName createDynClassName(String name)
Description copied from interface: DynObjectManager
Creates a DynClassName with a DynClass name or fullname

Specified by:
createDynClassName in interface DynObjectManager
Parameters:
name - of the DynClass. It might be a simple name or a composed full name (namespace and name)
Returns:
a new DynClassName

iterator

public Iterator iterator(String nameSpace)
Description copied from interface: DynObjectManager
Return an iterator over all registered DynClass with the same namespace.

Specified by:
iterator in interface DynObjectManager
Returns:
the iterator.


Copyright © 2004-2011 gvSIG. All Rights Reserved.