org.exolab.castor.mapping.loader

Class AbstractMappingLoader2

Implemented Interfaces:
MappingLoader
Known Direct Subclasses:
AbstractMappingLoader

public abstract class AbstractMappingLoader2
extends java.lang.Object
implements MappingLoader

Constructor Summary

AbstractMappingLoader2(ClassLoader loader)

Method Summary

protected void
addDescriptor(ClassDescriptor descriptor)
Adds a class descriptor.
void
clear()
Iterator
descriptorIterator()
ClassLoader
getClassLoader()
ClassDescriptor
getDescriptor(String classname)
boolean
isAllowRedefinition()
Is the ability to allow redefinitions enabled or disabled?
void
loadMapping(MappingRoot mapping, Object param)
Loads the mapping from the specified mapping object if not loaded previously.
protected abstract void
loadMappingInternal(MappingRoot mapping, Object param)
Loads the mapping from the specified mapping object.
void
setAllowRedefinitions(boolean allow)
Enables or disables the ability to allow the redefinition of class mappings.
void
setClassLoader(ClassLoader loader)

Constructor Details

AbstractMappingLoader2

public AbstractMappingLoader2(ClassLoader loader)

Method Details

addDescriptor

protected final void addDescriptor(ClassDescriptor descriptor)
            throws MappingException
Adds a class descriptor. Will throw a mapping exception if a descriptor for this class already exists.
Parameters:
descriptor - The descriptor to add.
Throws:
MappingException - A descriptor for this class already exists.

clear

public final void clear()
Specified by:
clear in interface MappingLoader

descriptorIterator

public final Iterator descriptorIterator()
Specified by:
descriptorIterator in interface MappingLoader
See Also:
{@inheritDoc}

getClassLoader

public final ClassLoader getClassLoader()
Specified by:
getClassLoader in interface MappingLoader
See Also:
{@inheritDoc}

getDescriptor

public final ClassDescriptor getDescriptor(String classname)
Specified by:
getDescriptor in interface MappingLoader
See Also:
{@inheritDoc}

isAllowRedefinition

public final boolean isAllowRedefinition()
Is the ability to allow redefinitions enabled or disabled?
Returns:
A boolean that when true enables redefinitions.

loadMapping

public final void loadMapping(MappingRoot mapping,
                              Object param)
            throws MappingException
Loads the mapping from the specified mapping object if not loaded previously.
Parameters:
mapping - The mapping information.
param - Arbitrary parameter that can be used by subclasses.
Throws:
MappingException - The mapping file is invalid.

loadMappingInternal

protected abstract void loadMappingInternal(MappingRoot mapping,
                                            Object param)
            throws MappingException
Loads the mapping from the specified mapping object. Calls AbstractMappingLoader2 to create each descriptor and addDescriptor(ClassDescriptor) to store it. Also loads all the included mapping files.
Parameters:
mapping - The mapping information.
param - Arbitrary parameter that can be used by subclasses.
Throws:
MappingException - The mapping file is invalid.

setAllowRedefinitions

public final void setAllowRedefinitions(boolean allow)
Enables or disables the ability to allow the redefinition of class mappings.
Parameters:
allow - A boolean that when true enables redefinitions.

setClassLoader

public final void setClassLoader(ClassLoader loader)
Specified by:
setClassLoader in interface MappingLoader
See Also:
{@inheritDoc}

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