atg.endeca.index.schema
Class SchemaExporter

java.lang.Object
  extended by atg.nucleus.logging.VariableArgumentApplicationLoggingImpl
      extended by atg.nucleus.GenericService
          extended by atg.endeca.index.LocaledExporter
              extended by atg.endeca.index.schema.SchemaExporter
All Implemented Interfaces:
Indexable, atg.naming.AbsoluteNameable, NameContextBindingListener, NameContextElement, atg.naming.NameContextParentable, NameResolver, AdminableService, atg.nucleus.Configured, ApplicationLogging, atg.nucleus.logging.ApplicationLoggingSender, atg.nucleus.logging.TraceApplicationLogging, VariableArgumentApplicationLogging, ComponentNameResolver, Service, ServiceListener, java.util.EventListener

public class SchemaExporter
extends LocaledExporter

This class uploads an Endeca schema data into a RecordStore using a RecordStoreDocumentSubmitter. It introspects the specified IndexingOutputConfig to generate its base schema, and then layers on any additional changes form the XML file specfied by the supplementalSchemaRecords property.

The schema is represented by a Records object that holds a Record-based representation of the schema, which is then uploaded via a RecordStoreDocumentSubmitter.

This class supports merging in supplemental/override information via the supplementalSchemaRecords property.

Created: November 16 2011


Nested Class Summary
 
Nested classes/interfaces inherited from class atg.endeca.index.LocaledExporter
LocaledExporter.MinimalBulkLoaderResults, LocaledExporter.MinimalIncrementalLoaderResults
 
Field Summary
 java.lang.String ATTRIBUTE_NAME
          The name of property that names the RECORDs we use to represent the schema.
static java.lang.String CLASS_VERSION
          Class version string from source code control system.
 
Fields inherited from class atg.nucleus.GenericService
SERVICE_INFO_KEY
 
Fields inherited from interface atg.nucleus.logging.TraceApplicationLogging
DEFAULT_LOG_TRACE_STATUS
 
Fields inherited from interface atg.nucleus.logging.ApplicationLogging
DEFAULT_LOG_DEBUG_STATUS, DEFAULT_LOG_ERROR_STATUS, DEFAULT_LOG_INFO_STATUS, DEFAULT_LOG_WARNING_STATUS
 
Constructor Summary
SchemaExporter()
           
 
Method Summary
protected  void addBaselineSchemaRecords(Records pRecords, java.util.Locale pLocale, boolean pAddMeta)
          Add the baseline schema records to the specified records object.
 void addSchemaRecordsForProperties(java.util.List<atg.repository.search.indexing.specifier.OutputProperty> pOutputProperties, Records pRecords, java.util.Locale pLocale, boolean pAddMeta)
          Add the records that represent the passed in output properties the specified Records object.
 void addSchemaRecordsForProperties(java.util.List<atg.repository.search.indexing.specifier.OutputProperty> pOutputProperties, Records pRecords, java.util.Locale pLocale, boolean pAddMeta, boolean pAddGenerative)
          Add the records that represent the passed in output properties the specified Records object.
 Records createBaselineSchemaRecords(java.util.Locale pLocale)
          Create a baseline set of schema records for the specified locale.
 Records createEmptyRecords()
          Create an empty Records object with ATTRIBUTE_NAME already set as the name property.
protected  Records createExportRecords(EndecaContext pContext, java.util.Locale pLocale)
          Create the export records for the specified locale.
 Records createMergedSchemaRecords(java.util.Locale pLocale)
          Return the complete, merged schema records.
 java.lang.String generateDebugBaselineSchemaAsXML()
          Return the baseline (pre-supplemental merge) schema generated from the IndexingOutputConfig as XML.
 java.lang.String generateDebugMergedSchemaAsXML()
          Return an XML represetation of the merged schema XML.
 java.lang.String generateDebugSupplementalSchemaAsXML()
          Return an XML represetation of the supplemental schema XML.
protected  java.lang.String getDimensionNameForProperty(atg.repository.search.indexing.specifier.OutputProperty pProperty)
          Return the dimension name for the specified property.
 DimensionNameProvider[] getDimensionNameProviders()
          Returns property dimensionNameProviders.
protected  java.lang.String getEndecaDataTypeForProperty(atg.repository.search.indexing.specifier.OutputProperty pProperty)
          Return the endeca data type for the specified property.
 MetaPropertiesHelper getMetaPropertiesHelper()
          Return MetaPropertisHelper
 java.lang.String[] getPropertiesNamesToIgnore()
          Returns property propertiesNamesToIgnore.
 java.util.Map<java.lang.String,java.lang.String> getPropertyNameToDimensionName()
          Returns property propertyNameToDimensionName.
 atg.xml.XMLFile getSupplementalSchemaRecords()
          Returns property supplementalSchemaRecords.
 boolean isAddNewSupplementalRecords()
          Returns property addNewSupplementalRecords.
protected  boolean isEndecaDimensionProperty(atg.repository.search.indexing.specifier.OutputProperty pProperty)
          Return whether the specified property is an Endeca dimension property.
 boolean isSkipPropertiesWithGenerativePropertyAccessors()
          Returns property skipPropertiesWithGenerativePropertyAccessors.
protected  boolean isTextSearchable(atg.repository.search.indexing.specifier.OutputProperty pProperty)
          Return whether the specified property should be text searchable (full text indexed).
 void mergeSupplementalIntoSchemaRecords(Records pRecords, boolean pAddNewRecords)
          Merge any supplement schema information from the supplementalSchemaRecords property into the specified records.
 Records parseSupplementalRecords()
          Parse supplemental records as specified by the supplementalSchemaRecords property.
 void setAddNewSupplementalRecords(boolean pAddNewSupplementalRecords)
          Sets property addNewSupplementalRecords.
 void setDimensionNameProviders(DimensionNameProvider[] pDimensionNameProviders)
          Sets property dimensionNameProviders.
 void setMetaPropertiesHelper(MetaPropertiesHelper pMetaPropertiesHelper)
          Sets MetaPropertiesHelper
 void setPropertiesNamesToIgnore(java.lang.String[] pPropertiesNamesToIgnore)
          Sets property propertiesNamesToIgnore.
 void setPropertyNameToDimensionName(java.util.Map<java.lang.String,java.lang.String> pPropertyNameToDimensionName)
          Sets property propertyNameToDimensionName.
 void setSkipPropertiesWithGenerativePropertyAccessors(boolean pSkipPropertiesWithGenerativePropertyAccessors)
          Sets property skipPropertiesWithGenerativePropertyAccessors.
 void setSupplementalSchemaRecords(atg.xml.XMLFile pSupplementalSchemaRecords)
          Sets property supplementalSchemaRecords.
 boolean shouldIgnoreProperty(java.lang.String pPropertyName)
          Whether we should ignore the specified property name when generating records.
 
Methods inherited from class atg.endeca.index.LocaledExporter
cancel, createAdminServlet, createContext, createExportRecordsAsXML, createExportRecordsForLocale, doStartService, export, export, exportRecords, getDefaultLanguageForRecordStores, getDocumentSubmitter, getExportRecordsForDefaultLocale, getIndexingOutputConfig, getIndexingOutputConfigPaths, getLocales, initContext, isNeededForIncremental, isSupportsStatusCounts, mayNeedCleanup, performBaselineUpdate, performPartialUpdate, postIndexingCleanup, restoreDynamoRequestLocale, setDefaultLanguageForRecordStores, setDocumentSubmitter, setDynamoRequestLocale, setIndexingOutputConfig, setLocales
 
Methods inherited from class atg.nucleus.GenericService
addLogListener, doStopService, getAbsoluteName, getAdminServlet, getAdminServletOutputStreamEncoding, getLoggingForVlogging, getLogListenerCount, getLogListeners, getName, getNameContext, getNucleus, getRoot, getServiceConfiguration, getServiceInfo, isAdminServletUseServletOutputStream, isLoggingDebug, isLoggingError, isLoggingInfo, isLoggingTrace, isLoggingWarning, isRunning, logDebug, logDebug, logDebug, logError, logError, logError, logInfo, logInfo, logInfo, logTrace, logTrace, logTrace, logWarning, logWarning, logWarning, nameContextElementBound, nameContextElementUnbound, removeLogListener, reResolveThis, resolveName, resolveName, resolveName, resolveName, sendLogEvent, setAdminServletOutputStreamEncoding, setAdminServletUseServletOutputStream, setLoggingDebug, setLoggingError, setLoggingInfo, setLoggingTrace, setLoggingWarning, setNucleus, setServiceInfo, startService, stopService
 
Methods inherited from class atg.nucleus.logging.VariableArgumentApplicationLoggingImpl
vlogDebug, vlogDebug, vlogDebug, vlogDebug, vlogDebugTrace, vlogError, vlogError, vlogError, vlogError, vlogInfo, vlogInfo, vlogInfo, vlogInfo, vlogTrace, vlogTrace, vlogTrace, vlogTrace, vlogWarning, vlogWarning, vlogWarning, vlogWarning
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CLASS_VERSION

public static final java.lang.String CLASS_VERSION
Class version string from source code control system.

See Also:
Constant Field Values

ATTRIBUTE_NAME

public final java.lang.String ATTRIBUTE_NAME
The name of property that names the RECORDs we use to represent the schema.

See Also:
Constant Field Values
Constructor Detail

SchemaExporter

public SchemaExporter()
Method Detail

setSupplementalSchemaRecords

public void setSupplementalSchemaRecords(atg.xml.XMLFile pSupplementalSchemaRecords)
Sets property supplementalSchemaRecords. An XMLFile that allows one to supplement the auto-generated information.


getSupplementalSchemaRecords

public atg.xml.XMLFile getSupplementalSchemaRecords()
Returns property supplementalSchemaRecords. An XMLFile that allows one to supplement the auto-generated information.


setDimensionNameProviders

public void setDimensionNameProviders(DimensionNameProvider[] pDimensionNameProviders)
Sets property dimensionNameProviders. A set of DimensionNameProviders who can override the default dimension name for a dimension property.


getDimensionNameProviders

public DimensionNameProvider[] getDimensionNameProviders()
Returns property dimensionNameProviders. A set of DimensionNameProviders who can override the default dimension name for a dimension property.


getMetaPropertiesHelper

public MetaPropertiesHelper getMetaPropertiesHelper()
Return MetaPropertisHelper

Returns:
MetaPropertiesHelper

setMetaPropertiesHelper

public void setMetaPropertiesHelper(MetaPropertiesHelper pMetaPropertiesHelper)
Sets MetaPropertiesHelper

Parameters:
pMetaPropertiesHelper - MetaPropertiesHelper

setPropertyNameToDimensionName

public void setPropertyNameToDimensionName(java.util.Map<java.lang.String,java.lang.String> pPropertyNameToDimensionName)
Sets property propertyNameToDimensionName. Map from an output property name to a dimension name. Consulted if none of the DimensionNameProviders provide a mapping.


getPropertyNameToDimensionName

public java.util.Map<java.lang.String,java.lang.String> getPropertyNameToDimensionName()
Returns property propertyNameToDimensionName. Map from an output property name to a source dimension name. Consulted if none of the DimensionNameProviders provide a mapping.


setAddNewSupplementalRecords

public void setAddNewSupplementalRecords(boolean pAddNewSupplementalRecords)
Sets property addNewSupplementalRecords. Whether to add records that only exist in the supplemental data.


isAddNewSupplementalRecords

public boolean isAddNewSupplementalRecords()
Returns property addNewSupplementalRecords. Whether to add records that only exist in the supplemental data.


setSkipPropertiesWithGenerativePropertyAccessors

public void setSkipPropertiesWithGenerativePropertyAccessors(boolean pSkipPropertiesWithGenerativePropertyAccessors)
Sets property skipPropertiesWithGenerativePropertyAccessors. Whether to ignore properties that specify generative property accessor, since those typically generate properties with dynamic names.


isSkipPropertiesWithGenerativePropertyAccessors

public boolean isSkipPropertiesWithGenerativePropertyAccessors()
Returns property skipPropertiesWithGenerativePropertyAccessors. Whether to ignore properties that specify generative property accessor, since those typically generate properties with dynamic names.


setPropertiesNamesToIgnore

public void setPropertiesNamesToIgnore(java.lang.String[] pPropertiesNamesToIgnore)
Sets property propertiesNamesToIgnore. Property names that we should ignore when generating.


getPropertiesNamesToIgnore

public java.lang.String[] getPropertiesNamesToIgnore()
Returns property propertiesNamesToIgnore. Property names that we should ignore.


shouldIgnoreProperty

public boolean shouldIgnoreProperty(java.lang.String pPropertyName)
Whether we should ignore the specified property name when generating records.


createExportRecords

protected Records createExportRecords(EndecaContext pContext,
                                      java.util.Locale pLocale)
Create the export records for the specified locale.

Specified by:
createExportRecords in class LocaledExporter
Parameters:
pContext - the current indexing context.
pLocale - to locale for which to generate records.
Returns:
the generated set of records.

generateDebugBaselineSchemaAsXML

public java.lang.String generateDebugBaselineSchemaAsXML()
                                                  throws java.io.IOException,
                                                         atg.repository.search.indexing.XMLWriterException
Return the baseline (pre-supplemental merge) schema generated from the IndexingOutputConfig as XML.

Returns:
the XML representation.
Throws:
java.io.IOException
atg.repository.search.indexing.XMLWriterException

createEmptyRecords

public Records createEmptyRecords()
Create an empty Records object with ATTRIBUTE_NAME already set as the name property.


createMergedSchemaRecords

public Records createMergedSchemaRecords(java.util.Locale pLocale)
Return the complete, merged schema records.


createBaselineSchemaRecords

public Records createBaselineSchemaRecords(java.util.Locale pLocale)
Create a baseline set of schema records for the specified locale.

Parameters:
pLocale - the locale in which to export the schema records.

mergeSupplementalIntoSchemaRecords

public void mergeSupplementalIntoSchemaRecords(Records pRecords,
                                               boolean pAddNewRecords)
Merge any supplement schema information from the supplementalSchemaRecords property into the specified records.

Parameters:
pRecords - the records to merge the supplemental records into.
pAddNewRecords - whether to add new records if no corresponding supplemental record exists.

addBaselineSchemaRecords

protected void addBaselineSchemaRecords(Records pRecords,
                                        java.util.Locale pLocale,
                                        boolean pAddMeta)
Add the baseline schema records to the specified records object.

Parameters:
pRecords - the Records object to add records to.
pLocale - the current locale.
pAddMeta - true specifies that records for meta properties should be added, and false specifies that records for text properties should be added.

addSchemaRecordsForProperties

public void addSchemaRecordsForProperties(java.util.List<atg.repository.search.indexing.specifier.OutputProperty> pOutputProperties,
                                          Records pRecords,
                                          java.util.Locale pLocale,
                                          boolean pAddMeta)
Add the records that represent the passed in output properties the specified Records object.

Parameters:
pOutputProperties - the output properties to add records for.
pRecords - the Records object to add records to.
pLocale - the current Locale
pAddMeta - true specifies that records for meta properties should be added, and false specifies that records for text properties should be added.

addSchemaRecordsForProperties

public void addSchemaRecordsForProperties(java.util.List<atg.repository.search.indexing.specifier.OutputProperty> pOutputProperties,
                                          Records pRecords,
                                          java.util.Locale pLocale,
                                          boolean pAddMeta,
                                          boolean pAddGenerative)
Add the records that represent the passed in output properties the specified Records object.

Parameters:
pOutputProperties - the output properties to add records for.
pRecords - the Records object to add records to.
pLocale - the current Locale
pAddMeta - true specifies that records for meta properties should be added, and false specifies that records for text properties should be added.
pAddGenerative - whether to force adding of generative properties. if false, than isSkipPropertiesWithGenerativePropertyAccessors() will be honored.

getDimensionNameForProperty

protected java.lang.String getDimensionNameForProperty(atg.repository.search.indexing.specifier.OutputProperty pProperty)
Return the dimension name for the specified property. Consults dimensionNameProviders and the propertyNameToDimensionName map. Defaults to output name of the property if not overridden.

Parameters:
pProperty - the property whose dimension name to return.

isEndecaDimensionProperty

protected boolean isEndecaDimensionProperty(atg.repository.search.indexing.specifier.OutputProperty pProperty)
Return whether the specified property is an Endeca dimension property. If no explicit 'store-as-dimension' attribute is defined, return true if the property is "storeAsDocset", "storeAsCollection", or "storeAsMetaIndex."

Returns:
true if the property is an Endeca dimension property.

isTextSearchable

protected boolean isTextSearchable(atg.repository.search.indexing.specifier.OutputProperty pProperty)
Return whether the specified property should be text searchable (full text indexed). Returns true if the property is explicitly marked as text searchable, the property is a text property, or has had a text property merged into it. If a property is explicitly set as not text searchable, returns false despite it is a text property or has a text property merged into it.

Parameters:
pProperty - the property to example to determine whether it should be text searchable.
Returns:
true if pProperty should be text searchable, false otherwise.

getEndecaDataTypeForProperty

protected java.lang.String getEndecaDataTypeForProperty(atg.repository.search.indexing.specifier.OutputProperty pProperty)
Return the endeca data type for the specified property.

Parameters:
pProperty - the output property whose endeca data type should be returned.

generateDebugSupplementalSchemaAsXML

public java.lang.String generateDebugSupplementalSchemaAsXML()
Return an XML represetation of the supplemental schema XML. This does not include any baseline data from the IndexingOutputConfig.


generateDebugMergedSchemaAsXML

public java.lang.String generateDebugMergedSchemaAsXML()
Return an XML represetation of the merged schema XML.


parseSupplementalRecords

public Records parseSupplementalRecords()
Parse supplemental records as specified by the supplementalSchemaRecords property.

Returns:
a Records object containing supplemental records, null if supplementalSchemaRecords is null.