com.gigaspaces.converter.pojo
Class ConverterHelper

java.lang.Object
  extended by com.gigaspaces.converter.pojo.ConverterHelper
Direct Known Subclasses:
Pojo2ExternalEntryConverter

public class ConverterHelper
extends Object

A helper convertor class, used to get gs.xml files from different resources


Constructor Summary
ConverterHelper()
          Empty Constructor
ConverterHelper(boolean isInvokePropSet)
          Constructor
 
Method Summary
 void afterPropertiesSet()
          Initialize the Convertor for the given or the default location.
 Configuration getConfiguration()
          Get the configuration
static File getFile(URL resourceUrl)
          Resolve the given resource URL to a java.io.File, i.e. to a file in the file system.
 InputStream getInputStream(String path)
          This implementation opens an InputStream for the given class path resource.
 URL getURL(String path)
          This implementation returns a URL for the underlying class path resource.
 void setMappingDirectoryLocations(String[] mappingDirectoryLocations)
          Set locations of directories that contain GigaSpaces mapping resources, like "WEB-INF/mappings".
 void setMappingJarLocations(String[] mappingJarLocations)
          Set locations of jar files that contain GigaSpaces mapping resources, like "WEB-INF/lib/example.gs.jar".
 void setMappingResources(String[] mappingResources)
          Set GigaSpaces mapping resources to be found in the class path, like "example.gs.xml" or "mypackage/example.gs.xml".
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConverterHelper

public ConverterHelper()
Empty Constructor


ConverterHelper

public ConverterHelper(boolean isInvokePropSet)
Constructor

Parameters:
isInvokePropSet - indicate if to invoke the method afterProertiesSet() after setMapping..() methods
Method Detail

setMappingResources

public void setMappingResources(String[] mappingResources)
                         throws IOException
Set GigaSpaces mapping resources to be found in the class path, like "example.gs.xml" or "mypackage/example.gs.xml". Analogous to mapping entries in a GigaSpaces XML config file. Alternative to the more generic setMappingLocations method.

Can be used to add to mappings from a GigaSpaces XML config file, or to specify all mappings locally.

Parameters:
mappingResources -
Throws:
IOException

setMappingJarLocations

public void setMappingJarLocations(String[] mappingJarLocations)
                            throws FileNotFoundException,
                                   IOException
Set locations of jar files that contain GigaSpaces mapping resources, like "WEB-INF/lib/example.gs.jar".

Can be used to add to mappings from a GigaSpaces XML config file, or to specify all mappings locally.

Parameters:
mappingJarLocations -
Throws:
IOException
FileNotFoundException

setMappingDirectoryLocations

public void setMappingDirectoryLocations(String[] mappingDirectoryLocations)
                                  throws IOException
Set locations of directories that contain GigaSpaces mapping resources, like "WEB-INF/mappings".

Can be used to add to mappings from a GigaSpaces XML config file, or to specify all mappings locally.

Parameters:
org.GigaSpaces.cfg.Configuration#addDirectory(java.io.File) -
Throws:
IOException
FileNotFoundException

getFile

public static File getFile(URL resourceUrl)
                    throws FileNotFoundException
Resolve the given resource URL to a java.io.File, i.e. to a file in the file system.

Parameters:
resourceUrl - the resource URL to resolve
description - a description of the original resource that the URL was created for (for example, a class path location)
Returns:
a corresponding File object
Throws:
FileNotFoundException - if the URL cannot be resolved to a file in the file system

getURL

public URL getURL(String path)
           throws IOException
This implementation returns a URL for the underlying class path resource.

Throws:
IOException
See Also:
ClassLoader.getResource(String), Class.getResource(String)

getInputStream

public InputStream getInputStream(String path)
                           throws IOException
This implementation opens an InputStream for the given class path resource.

Parameters:
path -
Returns:
is
Throws:
IOException

afterPropertiesSet

public void afterPropertiesSet()
                        throws Exception
Initialize the Convertor for the given or the default location.

Throws:
Exception
ConversionException - in case of GigaSpaces initialization errors

getConfiguration

public Configuration getConfiguration()
Get the configuration

Returns:
configuration