org.castor.cpa.util
Class JDOClassDescriptorResolverImpl

java.lang.Object
  extended by org.castor.cpa.util.JDOClassDescriptorResolverImpl
All Implemented Interfaces:
JDOClassDescriptorResolver, ClassDescriptorResolver

public class JDOClassDescriptorResolverImpl
extends java.lang.Object
implements JDOClassDescriptorResolver

JDO-specific ClassDescriptorResolver instance that provides functionality to find or "resolve" ClassDescriptors from a given class (name).

See Also:
JDOClassDescriptorResolver

Field Summary
protected  java.util.List<java.lang.Class<?>> _classes
          List of manually added domain Classes.
protected  java.util.List<java.lang.String> _packages
          List of manually added package names.
 
Constructor Summary
JDOClassDescriptorResolverImpl()
          Creates an instance of this class, with no classed manually added.
 
Method Summary
 void addClass(java.lang.Class domainClass)
          Adds a given Class instance manually, so that it can be loaded from the file system.
 void addPackage(java.lang.String packageName)
          Adds a given package name manually, so that class descriptors can be loaded from this package (from the file system).
 java.util.Iterator<ClassDescriptor> descriptorIterator()
          Returns an iterator over all the known descriptors in the original order they have been added.
 java.lang.ClassLoader getClassLoader()
          Returns the ClassLoader instance as used internally.
 MappingLoader getMappingLoader()
          
Note: This method will be removed soon (kv).
 void registerDescriptor(java.lang.Class type, ClassDescriptor classDescriptor)
          Registers a ClassDescriptor with the descriptor cache.
 ClassDescriptor resolve(java.lang.Class type)
          Returns the ClassDescriptor for the given class using the following strategy.

Lookup the class descriptor cache Call ClassResolutionByMappingLoader command Call ClassResolutionByFile command
 ClassDescriptor resolve(java.lang.String type)
          Returns the ClassDescriptor for the given class.
 void setMappingLoader(MappingLoader mappingLoader)
          Sets the mapping loader for this ClassDescriptorResolver
Note: This method will be removed soon (kv).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_classes

protected java.util.List<java.lang.Class<?>> _classes
List of manually added domain Classes.


_packages

protected java.util.List<java.lang.String> _packages
List of manually added package names.

Constructor Detail

JDOClassDescriptorResolverImpl

public JDOClassDescriptorResolverImpl()
Creates an instance of this class, with no classed manually added.

Method Detail

resolve

public ClassDescriptor resolve(java.lang.String type)
                        throws ResolverException
Returns the ClassDescriptor for the given class.

Specified by:
resolve in interface JDOClassDescriptorResolver
Parameters:
type - the class name to find the ClassDescriptor for
Returns:
the ClassDescriptor for the given class
Throws:
ResolverException - Indicates that the given Class cannot be resolved.

resolve

public ClassDescriptor resolve(java.lang.Class type)
                        throws ResolverException
Returns the ClassDescriptor for the given class using the following strategy.

Specified by:
resolve in interface ClassDescriptorResolver
Parameters:
type - the Class to find the ClassDescriptor for
Returns:
the ClassDescriptor for the given class, null if not found
Throws:
ResolverException - Indicates that the given Class cannot be resolved.

registerDescriptor

public void registerDescriptor(java.lang.Class type,
                               ClassDescriptor classDescriptor)
Registers a ClassDescriptor with the descriptor cache.

Specified by:
registerDescriptor in interface JDOClassDescriptorResolver
Parameters:
type - Type of the class described by the ClassDescriptor to register.
classDescriptor - The ClassDescriptor to register with the cache.

getMappingLoader

public MappingLoader getMappingLoader()

Note: This method will be removed soon (kv).

Specified by:
getMappingLoader in interface ClassDescriptorResolver

setMappingLoader

public void setMappingLoader(MappingLoader mappingLoader)
Sets the mapping loader for this ClassDescriptorResolver
Note: This method will be removed soon (kv).

Specified by:
setMappingLoader in interface ClassDescriptorResolver

addClass

public void addClass(java.lang.Class domainClass)
Adds a given Class instance manually, so that it can be loaded from the file system.

Specified by:
addClass in interface JDOClassDescriptorResolver
Parameters:
domainClass - A given Class instance.

addPackage

public void addPackage(java.lang.String packageName)
Adds a given package name manually, so that class descriptors can be loaded from this package (from the file system).

Specified by:
addPackage in interface JDOClassDescriptorResolver
Parameters:
packageName - A given package name.

descriptorIterator

public java.util.Iterator<ClassDescriptor> descriptorIterator()
Returns an iterator over all the known descriptors in the original order they have been added. Each element is of type ClassDescriptor.

Specified by:
descriptorIterator in interface JDOClassDescriptorResolver
Returns:
an Iterator over all the known JDO class descriptors.

getClassLoader

public java.lang.ClassLoader getClassLoader()
Returns the ClassLoader instance as used internally.

Specified by:
getClassLoader in interface JDOClassDescriptorResolver
Returns:
The ClassLoader instance used internally.


Intalio Inc. (C) 1999-2008. All rights reserved http://www.intalio.com