org.teiid.metadata.index
Class SimpleIndexUtil

java.lang.Object
  extended by org.teiid.metadata.index.SimpleIndexUtil

public class SimpleIndexUtil
extends java.lang.Object

IndexUtil


Nested Class Summary
static interface SimpleIndexUtil.ProgressMonitor
           
 
Field Summary
static boolean CASE_SENSITIVE_INDEX_FILE_NAMES
           
 
Constructor Summary
SimpleIndexUtil()
           
 
Method Summary
static org.teiid.internal.core.index.Index[] getIndexes(java.lang.String indexName, IndexMetadataStore selector)
          Return an array of indexes given a indexName.
static java.lang.String getIndexFileNameForRecordType(char recordType)
          Return the name of the index file to use for the specified record type, applies only for sever and vdb index files.
static java.lang.String getIndexFilePath(java.lang.String indexDirectoryPath, java.lang.String indexFileName)
           
static java.lang.String getPrefixPattern(char recordType, java.lang.String uuid)
          Return the prefix match string that could be used to exactly match a fully qualified entity name in an index record.
static java.lang.String getRecordTypeForIndexFileName(java.lang.String indexName)
          Return the name of the index file to use for the specified record type, applies only for sever and vdb index files.
static boolean indexFileExists(java.io.File indexFile)
          Return true if the specifed index file exists on the file system otherwise return false.
static boolean indexFileExists(java.lang.String indexFilePath)
          Return true if the specifed index file exists on the file system otherwise return false.
static boolean isIndexFile(java.io.File indexFile)
          Return true if the specifed index file represents a index file on the file system otherwise return false.
static boolean isIndexFile(java.lang.String indexFileName)
          Return true if the specifed index file represents a index file on the file system otherwise return false.
static boolean isModelIndex(java.lang.String indexFileName)
          Return true if the specifed index file represents a known index file on the file system otherwise return false.
static IEntryResult[] queryIndex(org.teiid.internal.core.index.Index[] indexes, char[] pattern, boolean isPrefix, boolean returnFirstMatch)
          Return all index file records that match the specified record prefix or pattern.
static IEntryResult[] queryIndex(org.teiid.internal.core.index.Index[] indexes, char[] pattern, char fieldDelimiter)
          Return all index file records that match the specified record pattern.
static IEntryResult[] queryIndex(SimpleIndexUtil.ProgressMonitor monitor, org.teiid.internal.core.index.Index[] indexes, char[] pattern, boolean isPrefix, boolean returnFirstMatch)
          Return all index file records that match the specified record prefix or pattern.
static IEntryResult[] queryIndex(SimpleIndexUtil.ProgressMonitor monitor, org.teiid.internal.core.index.Index[] indexes, char[] pattern, boolean isPrefix, boolean isCaseSensitive, boolean returnFirstMatch)
          Return all index file records that match the specified record prefix or pattern.
static IEntryResult[] queryIndex(SimpleIndexUtil.ProgressMonitor monitor, org.teiid.internal.core.index.Index[] indexes, java.util.Collection patterns, boolean isPrefix, boolean isCaseSensitive, boolean returnFirstMatch)
          Return all index file records that match the specified record prefix or pattern.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CASE_SENSITIVE_INDEX_FILE_NAMES

public static final boolean CASE_SENSITIVE_INDEX_FILE_NAMES
See Also:
Constant Field Values
Constructor Detail

SimpleIndexUtil

public SimpleIndexUtil()
Method Detail

getIndexFilePath

public static java.lang.String getIndexFilePath(java.lang.String indexDirectoryPath,
                                                java.lang.String indexFileName)

queryIndex

public static IEntryResult[] queryIndex(org.teiid.internal.core.index.Index[] indexes,
                                        char[] pattern,
                                        char fieldDelimiter)
                                 throws MetaMatrixCoreException
Return all index file records that match the specified record pattern. The pattern can be constructed from any combination of characters including the multiple character wildcard '*' and single character wildcard '?'. The field delimiter is used to tokenize both the pattern and the index record so that individual fields can be matched. The method assumes that the first occurrence of the delimiter in the record alligns with the first occurrence in the pattern. Any wildcard characters in the pattern cannot represent a delimiter character.

Parameters:
indexes - the array of MtkIndex instances to query
pattern -
fieldDelimiter -
Returns:
results
Throws:
QueryMetadataException
MetaMatrixCoreException

queryIndex

public static IEntryResult[] queryIndex(org.teiid.internal.core.index.Index[] indexes,
                                        char[] pattern,
                                        boolean isPrefix,
                                        boolean returnFirstMatch)
                                 throws MetaMatrixCoreException
Return all index file records that match the specified record prefix or pattern. The pattern can be constructed from any combination of characters including the multiple character wildcard '*' and single character wildcard '?'. The prefix may be constructed from any combination of characters excluding the wildcard characters. The prefix specifies a fixed number of characters that the index record must start with.

Parameters:
indexes - the array of MtkIndex instances to query
pattern -
Returns:
results
Throws:
MetamatrixCoreException
MetaMatrixCoreException

queryIndex

public static IEntryResult[] queryIndex(SimpleIndexUtil.ProgressMonitor monitor,
                                        org.teiid.internal.core.index.Index[] indexes,
                                        char[] pattern,
                                        boolean isPrefix,
                                        boolean returnFirstMatch)
                                 throws MetaMatrixCoreException
Return all index file records that match the specified record prefix or pattern. The pattern can be constructed from any combination of characters including the multiple character wildcard '*' and single character wildcard '?'. The prefix may be constructed from any combination of characters excluding the wildcard characters. The prefix specifies a fixed number of characters that the index record must start with.

Parameters:
monitor - an optional ProgressMonitor
indexes - the array of MtkIndex instances to query
pattern -
Returns:
results
Throws:
MetamatrixCoreException
MetaMatrixCoreException

queryIndex

public static IEntryResult[] queryIndex(SimpleIndexUtil.ProgressMonitor monitor,
                                        org.teiid.internal.core.index.Index[] indexes,
                                        char[] pattern,
                                        boolean isPrefix,
                                        boolean isCaseSensitive,
                                        boolean returnFirstMatch)
                                 throws MetaMatrixCoreException
Return all index file records that match the specified record prefix or pattern. The pattern can be constructed from any combination of characters including the multiple character wildcard '*' and single character wildcard '?'. The prefix may be constructed from any combination of characters excluding the wildcard characters. The prefix specifies a fixed number of characters that the index record must start with.

Parameters:
monitor - an optional ProgressMonitor
indexes - the array of MtkIndex instances to query
pattern -
Returns:
results
Throws:
MetamatrixCoreException
MetaMatrixCoreException

queryIndex

public static IEntryResult[] queryIndex(SimpleIndexUtil.ProgressMonitor monitor,
                                        org.teiid.internal.core.index.Index[] indexes,
                                        java.util.Collection patterns,
                                        boolean isPrefix,
                                        boolean isCaseSensitive,
                                        boolean returnFirstMatch)
                                 throws MetaMatrixCoreException
Return all index file records that match the specified record prefix or pattern. The pattern can be constructed from any combination of characters including the multiple character wildcard '*' and single character wildcard '?'. The prefix may be constructed from any combination of characters excluding the wildcard characters. The prefix specifies a fixed number of characters that the index record must start with.

Parameters:
monitor - an optional ProgressMonitor
indexes - the array of MtkIndex instances to query
pattern -
Returns:
results
Throws:
MetamatrixCoreException
MetaMatrixCoreException

indexFileExists

public static boolean indexFileExists(java.lang.String indexFilePath)
Return true if the specifed index file exists on the file system otherwise return false.


indexFileExists

public static boolean indexFileExists(java.io.File indexFile)
Return true if the specifed index file exists on the file system otherwise return false.


isModelIndex

public static boolean isModelIndex(java.lang.String indexFileName)
Return true if the specifed index file represents a known index file on the file system otherwise return false.


isIndexFile

public static boolean isIndexFile(java.lang.String indexFileName)
Return true if the specifed index file represents a index file on the file system otherwise return false.


isIndexFile

public static boolean isIndexFile(java.io.File indexFile)
Return true if the specifed index file represents a index file on the file system otherwise return false.


getIndexes

public static org.teiid.internal.core.index.Index[] getIndexes(java.lang.String indexName,
                                                               IndexMetadataStore selector)
Return an array of indexes given a indexName.

Parameters:
indexName - The shortName of the index file
selector - The indexSelector to lookup indexes
Returns:
An array of indexes, may be duplicates depending on index selector.
Throws:
MetamatrixCoreException - If there is an error looking up indexes
Since:
4.2

getIndexFileNameForRecordType

public static java.lang.String getIndexFileNameForRecordType(char recordType)
Return the name of the index file to use for the specified record type, applies only for sever and vdb index files.

Parameters:
recordType -
Returns:

getRecordTypeForIndexFileName

public static java.lang.String getRecordTypeForIndexFileName(java.lang.String indexName)
Return the name of the index file to use for the specified record type, applies only for sever and vdb index files.

Parameters:
recordType -
Returns:

getPrefixPattern

public static java.lang.String getPrefixPattern(char recordType,
                                                java.lang.String uuid)
Return the prefix match string that could be used to exactly match a fully qualified entity name in an index record. All index records contain a header portion of the form: recordType|name|

Parameters:
name - The fully qualified name for which the prefix match string is to be constructed.
Returns:
The pattern match string of the form: recordType|name|


Copyright © 2009. All Rights Reserved.