|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object atg.nucleus.logging.VariableArgumentApplicationLoggingImpl atg.nucleus.GenericService atg.nucleus.TimedOperationService atg.repository.search.indexing.config.SearchConfigurationXMLGenerator
public class SearchConfigurationXMLGenerator
The SearchConfigurationXMLGenerator class (in the atg.repository.search.indexing.refinement package) is a Nucleus service that takes a searchConfig repository item and creates search-config XML. This XML uses the schema defined by ATG Search. The generator creates a W3C DOM object and uses Java's built in XML classes to create the XML stream from DOM Document. This can also be changed by setting the "transformer" property, or subclassing and extending the "transformToXML" method. This class is registered as a Nucleus component in DAF at /atg/search/repository/SearchConfigurationXMLGenerator This component has 'searchConfigurationRuleParser' property of type SearchConfigurationRuleParser and 'searchConfigurationMerger' property of type SearchConfigurationMerger. The XMLGenerator calls the parseRules method in the searchConfigurationRuleParser to get the list of rule objects for both the customer segment and the base searchConfig, and then calls the searchConfigurationMerger methods to create a merged list. After that XML is generated according to search-config XML schema using the merged rules and thesaurus and the ranking data in the searchConfig item. When base and segment ranking data exists, segment ranking data (as a block) should overwrite the base ones. This applies to ranking data only. These are wholesale, you use base or you use segment-based ranking data.
Field Summary | |
---|---|
static java.lang.String |
CLASS_VERSION
Class version string |
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 | |
---|---|
SearchConfigurationXMLGenerator()
|
Method Summary | |
---|---|
protected void |
addTextElement(java.lang.String pText,
java.lang.String pTagName,
org.w3c.dom.Element pParent,
org.w3c.dom.Document pDocument)
Creates element with the text node inside |
protected void |
createConditionElement(java.util.Stack pCondition,
org.w3c.dom.Element pParent,
org.w3c.dom.Document pDocument)
Creates sub-elements of <expression> element. |
protected org.w3c.dom.Document |
createDocument()
|
protected void |
createPatternElement(atg.repository.search.config.SearchRulePattern pPattern,
org.w3c.dom.Element pRule,
org.w3c.dom.Document pDocument)
Creates pattern element |
protected void |
createRuleElement(atg.repository.search.config.SearchRule pRule,
org.w3c.dom.Element pRules,
org.w3c.dom.Document pDocument)
Creates rule element |
protected void |
createSynsetElement(RepositoryItem pSynset,
org.w3c.dom.Element pTerms,
org.w3c.dom.Document pDocument)
Creates synset element |
protected void |
createTermElement(java.lang.String pReciprocal,
java.lang.String pTerm,
org.w3c.dom.Element pSynset,
org.w3c.dom.Document pDocument)
creates pTerm element |
void |
dump(org.w3c.dom.Document doc)
Diagnostic method to write out generated xml to the file system. |
org.w3c.dom.Document |
generateSearchConfigDoc(RepositoryItem pCurrentSearchConfig,
RepositoryItem pBaseSearchConfig,
java.lang.String pRankConfigName)
Generates search config XML into the DOM document |
void |
generateSearchConfigXML(RepositoryItem pCurrentSearchConfig,
RepositoryItem pBaseSearchConfig,
java.io.OutputStream pOut)
Generates search config XML into a DOM document and writes it out |
void |
generateSearchConfigXML(RepositoryItem pCurrentSearchConfig,
RepositoryItem pBaseSearchConfig,
java.io.OutputStream pOut,
java.lang.String pRankConfigName)
Generates search config XML into a DOM document and writes it out |
void |
generateSearchConfigXML(RepositoryItem pCurrentSearchConfig,
RepositoryItem pBaseSearchConfig,
java.io.Writer pWriter)
Generates search config XML into a DOM document and writes it out |
java.lang.String |
getApplicationName()
Get the String application name used to query the repository for the search config items to generate xml for. |
java.lang.String |
getDateFormat()
Gets the String Format of dates used in date ranking properties. |
java.lang.String |
getDefaultLanguage()
Gets the default language attribute to use for the search config xml |
java.lang.String |
getDefaultRankingMethod()
Default ranking method name to use if the search config repository item rankingMethod property is null. |
javax.xml.parsers.DocumentBuilder |
getDocumentBuilder()
|
java.lang.String |
getDumpPath()
Full String path name to the directory to use if dumpFiles is true. |
protected java.lang.String |
getLanguageFromLocale(java.lang.String pLocale)
Returns Search Engine language by locale string |
atg.repository.search.config.SearchConfigurationMerger |
getMerger()
Gets the SearchConfigurationMerger to merge rules from the base search config item. |
java.lang.String |
getOverrideRankingMethod()
Defaults to null but if set then forces the xml generator to use this String for the ranking method and ignores any setting from the search config repository item. |
atg.repository.search.config.SearchConfigurationRuleParser |
getParser()
Gets the SearchConfigurationRuleParser to parse out the rules from a search config item. |
SearchConfigurationPropertyManager |
getSearchConfigurationPropertyManager()
Gets the property manager for the search config repository assets. |
java.util.TimeZone |
getTimeZone()
Returns time zone for the property weighting date conversion |
javax.xml.transform.Transformer |
getTransformer()
Gets the XML Transformer that will generate the XML stream from a DOM tree. |
boolean |
isDumpFiles()
Returns true if this component should also write out all xml to the file system. |
void |
setApplicationName(java.lang.String pApplicationName)
Set the String application name used to query the repository for the search config items to generate xml for. |
void |
setDateFormat(java.lang.String pDateFormat)
Sets the String Format of dates used in date ranking properties. |
void |
setDefaultLanguage(java.lang.String pDefaultLanguage)
Sets the default language attribute to use for the search config xml |
void |
setDefaultRankingMethod(java.lang.String pDefaultRankingMethod)
Default ranking method name to use if the search config repository item rankingMethod property is null. |
void |
setDocumentBuilder(javax.xml.parsers.DocumentBuilder pDocumentBuilder)
Sets the document builder that will be used to create DOM documents. |
void |
setDumpFiles(boolean pDumpFiles)
Sets whether this component should also write out all xml to the file system. |
void |
setDumpPath(java.lang.String pDumpPath)
Full String path name to the directory to use if dumpFiles is true. |
void |
setMerger(atg.repository.search.config.SearchConfigurationMerger pMerger)
Sets the SearchConfigurationMerger to merge rules from the base search config item. |
void |
setOverrideRankingMethod(java.lang.String pOverrideRankingMethod)
Defaults to null but if set then forces the xml generator to use this String for the ranking method and ignores any setting from the search config repository item. |
void |
setParser(atg.repository.search.config.SearchConfigurationRuleParser pParser)
Sets the SearchConfigurationRuleParser to parse out the rules from a search config item. |
void |
setSearchConfigurationPropertyManager(SearchConfigurationPropertyManager pSearchConfigurationPropertyManager)
Sets the property manager for the search config repository assets. |
void |
setTimeZone(java.util.TimeZone pTimeZone)
Sets time zone for the property weighting date conversion |
void |
setTransformer(javax.xml.transform.Transformer pTransformer)
Sets the XML Transformer that will generate the XML stream from a DOM tree. |
protected void |
transformToXML(org.w3c.dom.Document pDocument,
java.io.OutputStream pOut)
Transform a DOM Document object to an XML output stream. |
protected void |
transformToXML(org.w3c.dom.Document pDocument,
javax.xml.transform.stream.StreamResult pResult)
Transform a DOM Document object to an XML output stream. |
protected void |
transformToXML(org.w3c.dom.Document pDocument,
java.io.Writer pWriter)
Transform a DOM Document object to an XML output stream. |
Methods inherited from class atg.nucleus.TimedOperationService |
---|
getAverageRequestHandlingTime, getHandledRequestCount, getRequestStartTime, getTotalRequestHandlingTime, isKeepingStatistics, notifyHandledRequest, resetStatistics, setKeepingStatistics |
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 |
---|
public static java.lang.String CLASS_VERSION
Constructor Detail |
---|
public SearchConfigurationXMLGenerator()
Method Detail |
---|
public java.lang.String getApplicationName()
public void setApplicationName(java.lang.String pApplicationName)
pApplicationName
- String application name, e.g. 'merchandising'public java.lang.String getDefaultLanguage()
public void setDefaultLanguage(java.lang.String pDefaultLanguage)
pDefaultLanguage
- String default languagepublic SearchConfigurationPropertyManager getSearchConfigurationPropertyManager()
public void setSearchConfigurationPropertyManager(SearchConfigurationPropertyManager pSearchConfigurationPropertyManager)
pSearchConfigurationPropertyManager
- SearchConfigurationPropertyManager to usepublic atg.repository.search.config.SearchConfigurationRuleParser getParser()
public void setParser(atg.repository.search.config.SearchConfigurationRuleParser pParser)
pParser
- SearchConfigurationRuleParser to usepublic atg.repository.search.config.SearchConfigurationMerger getMerger()
public void setMerger(atg.repository.search.config.SearchConfigurationMerger pMerger)
pMerger
- SearchConfigurationMerger to use.public boolean isDumpFiles()
public void setDumpFiles(boolean pDumpFiles)
pDumpFiles
- boolean, if true this component will also write out all xml to the file system.public java.lang.String getDumpPath()
public void setDumpPath(java.lang.String pDumpPath)
pDumpPath
- String path name to the directory to use if dumpFiles is truepublic java.lang.String getDateFormat()
public void setDateFormat(java.lang.String pDateFormat)
pDateFormat
- String Format of dates used in date ranking properties.public java.util.TimeZone getTimeZone()
public void setTimeZone(java.util.TimeZone pTimeZone)
pTimeZone
- time zone for the property weighting date conversionpublic void setOverrideRankingMethod(java.lang.String pOverrideRankingMethod)
pOverrideRankingMethod
- String to set rankingMethod topublic java.lang.String getOverrideRankingMethod()
public void setDefaultRankingMethod(java.lang.String pDefaultRankingMethod)
pDefaultRankingMethod
- String default ranking method to use, defaults to 'compute'public java.lang.String getDefaultRankingMethod()
public javax.xml.transform.Transformer getTransformer()
public void setTransformer(javax.xml.transform.Transformer pTransformer)
pTransformer
- XML Transformerpublic void setDocumentBuilder(javax.xml.parsers.DocumentBuilder pDocumentBuilder)
pDocumentBuilder
- DOM document builderpublic javax.xml.parsers.DocumentBuilder getDocumentBuilder()
protected org.w3c.dom.Document createDocument()
protected void addTextElement(java.lang.String pText, java.lang.String pTagName, org.w3c.dom.Element pParent, org.w3c.dom.Document pDocument)
pText
- text for the nodepTagName
- tag's namepParent
- parent DOM elementpDocument
- DOM documentprotected void createPatternElement(atg.repository.search.config.SearchRulePattern pPattern, org.w3c.dom.Element pRule, org.w3c.dom.Document pDocument)
pPattern
- SearchRulePatternpRule
- parent elementpDocument
- DOM documentprotected void createConditionElement(java.util.Stack pCondition, org.w3c.dom.Element pParent, org.w3c.dom.Document pDocument)
pCondition
- condition stack, one element popped each callpParent
- parent elementpDocument
- DOM documentprotected void createRuleElement(atg.repository.search.config.SearchRule pRule, org.w3c.dom.Element pRules, org.w3c.dom.Document pDocument)
pRule
- SearchRulepRules
- parent elementpDocument
- DOM documentprotected void createSynsetElement(RepositoryItem pSynset, org.w3c.dom.Element pTerms, org.w3c.dom.Document pDocument)
pSynset
- synset repository itempTerms
- parent elementpDocument
- DOM documentprotected void createTermElement(java.lang.String pReciprocal, java.lang.String pTerm, org.w3c.dom.Element pSynset, org.w3c.dom.Document pDocument)
pReciprocal
- "true" for reciprocal synsetpTerm
- termpSynset
- parent elementpDocument
- DOM documentprotected void transformToXML(org.w3c.dom.Document pDocument, javax.xml.transform.stream.StreamResult pResult)
pDocument
- DOM document to transformpResult
- stream resultprotected void transformToXML(org.w3c.dom.Document pDocument, java.io.OutputStream pOut)
pDocument
- DOM document to transformpOut
- output streamprotected void transformToXML(org.w3c.dom.Document pDocument, java.io.Writer pWriter)
pDocument
- DOM document to transformpWriter
- output writerprotected java.lang.String getLanguageFromLocale(java.lang.String pLocale)
pLocale
- locale string
public org.w3c.dom.Document generateSearchConfigDoc(RepositoryItem pCurrentSearchConfig, RepositoryItem pBaseSearchConfig, java.lang.String pRankConfigName)
pCurrentSearchConfig
- search config for the current visitorpBaseSearchConfig
- base search config for the visitor's localepRankConfigName
- Name to use for this generated rank config xml or null to use the id of the search config
public void generateSearchConfigXML(RepositoryItem pCurrentSearchConfig, RepositoryItem pBaseSearchConfig, java.io.OutputStream pOut)
pCurrentSearchConfig
- search config for the current visitorpBaseSearchConfig
- base search config for the visitor's localepOut
- OutputStream to write topublic void generateSearchConfigXML(RepositoryItem pCurrentSearchConfig, RepositoryItem pBaseSearchConfig, java.io.OutputStream pOut, java.lang.String pRankConfigName)
pCurrentSearchConfig
- search config for the current visitorpBaseSearchConfig
- base search config for the visitor's localepOut
- OutputStream to write topRankConfigName
- Name to use for this generated rank config xml or null to use the id of the search configpublic void generateSearchConfigXML(RepositoryItem pCurrentSearchConfig, RepositoryItem pBaseSearchConfig, java.io.Writer pWriter)
pCurrentSearchConfig
- search config for the current visitorpBaseSearchConfig
- base search config for the visitor's localepWriter
- Writer to write topublic void dump(org.w3c.dom.Document doc)
doc
- XML Document to write out.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |