org.compass.gps.device.jdbc
Class ResultSetResourceMappingResolver

java.lang.Object
  extended by org.compass.gps.device.jdbc.ResultSetResourceMappingResolver
All Implemented Interfaces:
InputStreamMappingResolver

public class ResultSetResourceMappingResolver
extends Object
implements InputStreamMappingResolver

A Compass::Core MappingResolver, which can generate compass mappings (Resource mapping) ResultSetToResourceMapping.

Other relevant mapping settings can be set as well, such as subIndex, all, allMetaData, and the allTermVector.

The required property is the ResultSetToResourceMapping, and the DataSource.

Using the mapping builder helps automatically generate compass mapping files (Resource mappings) based on the configuration of the ResultSetToResourceMapping or one of it's sub classes (like TableToResourceMapping).

Author:
kimchy

Constructor Summary
ResultSetResourceMappingResolver()
          Creates a new mapping builder.
ResultSetResourceMappingResolver(ResultSetToResourceMapping mapping, DataSource dataSource)
          Creates a new mapping builder, using the mapping and the data source.
 
Method Summary
 String getAllMetaData()
          Returns the all meta data name that will be used in the compass mapping.
 Property.TermVector getAllTermVector()
          Returns the term vector setting for the all property.
 DataSource getDataSource()
          Returns the jdbc data source.
 ResultSetToResourceMapping getMapping()
          Returns the mapping that will be used to generate the compass mapping definitions.
 InputStream getMappingAsInputStream()
          Generates the compass mapping definitions.
 String getName()
          Returns the name of the mapping builder.
 String getSubIndex()
          Returns the subIndex that the Resource (alias) will be mapped to.
 boolean isAll()
          Returns the all option of the compass mapping (if the all property will be saved or not).
 void setAll(boolean all)
          Sets the all option of the compass mapping (if the all property will be saved or not).
 void setAllMetaData(String allMetaData)
          Sets the all meta data name that will be used in the compass mapping.
 void setAllTermVector(Property.TermVector allTermVector)
          Sets the term vector setting for the all property.
 void setAllTermVectorString(String allTermVector)
          Sets the term vector setting (as a parsable string) for the all property.
 void setDataSource(DataSource dataSource)
          Sets the jdbc data source.
 void setMapping(ResultSetToResourceMapping mapping)
          Sets the mapping that will be used to generate the compass mapping definitions.
 void setSubIndex(String subIndex)
          Sets the subIndex that the Resource (alias) will be mapped to.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ResultSetResourceMappingResolver

public ResultSetResourceMappingResolver()
Creates a new mapping builder. Must set the setMapping(ResultSetToResourceMapping), and the setDataSource(DataSource).


ResultSetResourceMappingResolver

public ResultSetResourceMappingResolver(ResultSetToResourceMapping mapping,
                                        DataSource dataSource)
Creates a new mapping builder, using the mapping and the data source.

Parameters:
mapping - The mapping that will be used to generate compass mapping definition.
Method Detail

getName

public String getName()
Description copied from interface: InputStreamMappingResolver
Returns the name of the mapping builder. For example, for compass-core-mapping it should end with ".cpm.xml".

Specified by:
getName in interface InputStreamMappingResolver

getMappingAsInputStream

public InputStream getMappingAsInputStream()
                                    throws CompassException
Generates the compass mapping definitions.

Specified by:
getMappingAsInputStream in interface InputStreamMappingResolver
Returns:
InputStream that has the mapping definitions.
Throws:
CompassException

getMapping

public ResultSetToResourceMapping getMapping()
Returns the mapping that will be used to generate the compass mapping definitions.


setMapping

public void setMapping(ResultSetToResourceMapping mapping)
Sets the mapping that will be used to generate the compass mapping definitions.


getSubIndex

public String getSubIndex()
Returns the subIndex that the Resource (alias) will be mapped to. Optional - null value means no subIndex part in the compass mapping definition.


setSubIndex

public void setSubIndex(String subIndex)
Sets the subIndex that the Resource (alias) will be mapped to. Optional - null value means no subIndex part in the compass mapping definition.


isAll

public boolean isAll()
Returns the all option of the compass mapping (if the all property will be saved or not). Optional, defaults to true.


setAll

public void setAll(boolean all)
Sets the all option of the compass mapping (if the all property will be saved or not). Optional, defaults to true.


getAllMetaData

public String getAllMetaData()
Returns the all meta data name that will be used in the compass mapping. Optional, defaults to not be added to the compass mapping definitions.


setAllMetaData

public void setAllMetaData(String allMetaData)
Sets the all meta data name that will be used in the compass mapping. Optional, defaults to not be added to the compass mapping definitions.


getAllTermVector

public Property.TermVector getAllTermVector()
Returns the term vector setting for the all property. Optional, defaults to not be added to the compass mapping definitions.


setAllTermVector

public void setAllTermVector(Property.TermVector allTermVector)
Sets the term vector setting for the all property. Optional, defaults to not be added to the compass mapping definitions.


setAllTermVectorString

public void setAllTermVectorString(String allTermVector)
Sets the term vector setting (as a parsable string) for the all property. Optional, defaults to not be added to the compass mapping definitions.


getDataSource

public DataSource getDataSource()
Returns the jdbc data source.


setDataSource

public void setDataSource(DataSource dataSource)
Sets the jdbc data source.



Copyright (c) 2004-2008 The Compass Project.