com.gigaspaces.converter.pojo
Class Configuration

java.lang.Object
  extended by com.gigaspaces.converter.pojo.Configuration
All Implemented Interfaces:
Serializable

public class Configuration
extends Object
implements Serializable

See Also:
Serialized Form

Nested Class Summary
 class Configuration.MapHolder
          This inner class is holding the indication if the all gs xml files have been loaded and the externalEntryMap which holds the POJODescriptor for POJO's.
 
Constructor Summary
Configuration()
          Empty constructor
 
Method Summary
 Configuration addClass(Class persistentClass)
          Read a mapping from an application resource, using a convention.
 Configuration addClass(String persistentClass)
          Read a mapping from an application resource, using a convention.
 Configuration addDirectory(File dir)
          Read all mapping documents from a directory tree.
 Configuration addFile(File xmlFile)
          Read mappings from a particular XML file
 Configuration addInputStream(InputStream xmlInputStream)
          Read mappings from an InputStream
 Configuration addJar(File jar)
          Read all mappings from a jar file
 Configuration addResource(String path)
          Read mappings from an application resource trying different class loaders.
 Configuration addURL(URL url)
          Read mappings from a URL
 Configuration addXML(String xml)
          Read mappings from a String
 com.gigaspaces.converter.pojo.Mappings createMappings()
          Create a new Mappings to add class and collection mappings to.
 Map<Object,Configuration.MapHolder> getClassLoaderMapHolders()
           
 Map<String,com.gigaspaces.converter.pojo.POJODescription> getExternalEntryMap()
          Get the external entry map
 com.gigaspaces.converter.pojo.POJODescription getPOJODescription(String persistentClass)
          Read a mapping from an application resource, using a convention.
 List<com.gigaspaces.converter.pojo.POJODescription> getPOJODescriptionList(InputStream xmlInputStream)
          Read mappings from an InputStream
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Configuration

public Configuration()
Empty constructor

Method Detail

addFile

public Configuration addFile(File xmlFile)
                      throws ConversionException
Read mappings from a particular XML file

Parameters:
xmlFile - a path to a file
Throws:
ConversionException

addXML

public Configuration addXML(String xml)
                     throws ConversionException
Read mappings from a String

Parameters:
xml - an XML string
Throws:
ConversionException

addURL

public Configuration addURL(URL url)
                     throws ConversionException
Read mappings from a URL

Parameters:
url -
Throws:
ConversionException

createMappings

public com.gigaspaces.converter.pojo.Mappings createMappings()
Create a new Mappings to add class and collection mappings to.


addResource

public Configuration addResource(String path)
                          throws ConversionException
Read mappings from an application resource trying different class loaders. This method will try to load the resource first from the thread context class loader and then from the class loader that loaded gigaSpace.

Throws:
ConversionException

addClass

public Configuration addClass(Class persistentClass)
                       throws ConversionException
Read a mapping from an application resource, using a convention. The class foo.bar.Foo is mapped by the file foo/bar/Foo.gs.xml.

Parameters:
persistentClass - the mapped class
Throws:
ConversionException

addClass

public Configuration addClass(String persistentClass)
                       throws ConversionException
Read a mapping from an application resource, using a convention. The class foo.bar.Foo is mapped by the file foo/bar/Foo.gs.xml.

Parameters:
persistentClass - the mapped class name.
Throws:
ConversionException

getPOJODescription

public com.gigaspaces.converter.pojo.POJODescription getPOJODescription(String persistentClass)
                                                                 throws ConversionException
Read a mapping from an application resource, using a convention. The class foo.bar.Foo is mapped by the file foo/bar/Foo.gs.xml.

Parameters:
persistentClass - the mapped class name.
Throws:
ConversionException

addInputStream

public Configuration addInputStream(InputStream xmlInputStream)
                             throws ConversionException
Read mappings from an InputStream

Parameters:
xmlInputStream - an InputStream containing XML
Throws:
ConversionException

getPOJODescriptionList

public List<com.gigaspaces.converter.pojo.POJODescription> getPOJODescriptionList(InputStream xmlInputStream)
                                                                           throws ConversionException
Read mappings from an InputStream

Parameters:
xmlInputStream - an InputStream containing XML
Throws:
ConversionException

addJar

public Configuration addJar(File jar)
                     throws ConversionException
Read all mappings from a jar file

Parameters:
jar - a jar file
Throws:
ConversionException

addDirectory

public Configuration addDirectory(File dir)
                           throws ConversionException
Read all mapping documents from a directory tree. Assume that any file named *.gs.xml is a mapping document.

Parameters:
dir - a directory
Throws:
ConversionException

getExternalEntryMap

public Map<String,com.gigaspaces.converter.pojo.POJODescription> getExternalEntryMap()
Get the external entry map

Returns:
the external entry map.

getClassLoaderMapHolders

public Map<Object,Configuration.MapHolder> getClassLoaderMapHolders()