com.metamatrix.query.resolver.command
Class XMLQueryResolver

java.lang.Object
  extended by com.metamatrix.query.resolver.command.XMLQueryResolver
All Implemented Interfaces:
CommandResolver

public class XMLQueryResolver
extends java.lang.Object
implements CommandResolver


Constructor Summary
XMLQueryResolver()
           
 
Method Summary
static java.util.Collection collectValidCriteriaElements(GroupSymbol group, QueryMetadataInterface metadata)
          Collect all fully-qualified valid elements.
 void resolveCommand(Command command, boolean useMetadataCommands, TempMetadataAdapter metadata, AnalysisRecord analysis, boolean resolveNullLiterals)
          Resolve the command using the metadata.
static void resolveXMLCriteria(Criteria criteria, GroupContext externalGroups, java.util.Collection validElements, QueryMetadataInterface metadata)
           Resolve the criteria specified on the XML query.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XMLQueryResolver

public XMLQueryResolver()
Method Detail

resolveCommand

public void resolveCommand(Command command,
                           boolean useMetadataCommands,
                           TempMetadataAdapter metadata,
                           AnalysisRecord analysis,
                           boolean resolveNullLiterals)
                    throws QueryMetadataException,
                           QueryResolverException,
                           MetaMatrixComponentException
Description copied from interface: CommandResolver
Resolve the command using the metadata.

Specified by:
resolveCommand in interface CommandResolver
Parameters:
command - The command to resolve
useMetadataCommands - true if the resolver should use metadata commands to completely resolve
metadata - Metadata
resolveNullLiterals - true if the resolver should consider replacing null literals with more appropriate types
Throws:
QueryMetadataException - If there is a metadata problem
QueryResolverException - If the query cannot be resolved
MetaMatrixComponentException - If there is an internal error
See Also:
com.metamatrix.query.resolver.CommandResolver#resolveCommand(com.metamatrix.query.sql.lang.Command, java.util.Collection, TempMetadataAdapter, AnalysisRecord, boolean)

collectValidCriteriaElements

public static java.util.Collection collectValidCriteriaElements(GroupSymbol group,
                                                                QueryMetadataInterface metadata)
                                                         throws QueryMetadataException,
                                                                MetaMatrixComponentException,
                                                                QueryResolverException
Collect all fully-qualified valid elements. These can then be used to validate elements used in the query. It's easier to look up the valid elements because the user is allow to used any partially-qualified name, which makes the logic for doing lookups essentially impossible with the existing metadata interface.

Parameters:
group - Document group
metadata - Metadata interface
Returns:
Collection of ElementSymbol for each possible valid element
Throws:
QueryMetadataException
MetaMatrixComponentException
QueryResolverException

resolveXMLCriteria

public static void resolveXMLCriteria(Criteria criteria,
                                      GroupContext externalGroups,
                                      java.util.Collection validElements,
                                      QueryMetadataInterface metadata)
                               throws QueryMetadataException,
                                      MetaMatrixComponentException,
                                      QueryResolverException

Resolve the criteria specified on the XML query. The elements specified on the criteria should be present on one of the mapping node objects passed to this method, or else be an element on a temporary table at the root of the document model (if a temp table exists there).

A QueryResolverException will be thrown under the following circumstances:

  1. the elements of the XML criteria cannot be resolved
  2. the "@" attribute prefix is used to specify that the node is an attribute, but a document node is found that is an element
  3. an element is supplied in the criteria and is ambiguous (multiple document nodes and/or root temp table elements exist which have that name)

If an element is supplied in the criteria and is ambiguous (multiple document nodes and/or root temp table elements of that name exist)

Parameters:
criteria - The criteria object that should be resolved
group - The group on the query.
metadata - QueryMetadataInterface the metadata(for resolving criteria on temp groups)
Throws:
QueryResolverException - if any of the above fail conditions are met
QueryMetadataException
MetaMatrixComponentException


Copyright © 2009. All Rights Reserved.