org.jafer.util
Class Config

java.lang.Object
  extended by org.jafer.util.Config

public class Config
extends java.lang.Object

Parses XML files used for configuration of client and server and provides static look up methods eg. getRecordSerializer (configured via recordDescriptor.xml), getBib1Message (bib1Messages.xml). Also, has static utility methods eg. isSyntaxEqual, String convertSyntax(int[]), String getValue(Node), Node selectSingleNode(Node node, String xPath), URL getResource(String path).

Version:
1.0
Author:
Antony Corfield; Matthew Dovey; Colin Tatham

Field Summary
private static java.lang.String attributeSetName
           
private static java.util.Hashtable attributeSets
           
private static java.lang.String attributeSetSyntax
           
private static java.util.Hashtable attributeTypeName
           
private static java.util.Hashtable attributeTypeValue
           
static java.lang.String BIB1_ATTRIBUTES_FILE
           
static java.lang.String BIB1_DIAGNOSTICS_FILE
           
private static java.util.Hashtable bib1DiagAddInfo
           
private static java.util.Hashtable bib1DiagMessage
           
private static java.util.Hashtable bib1ToCQLMappings
           
static java.lang.String CHARACTER_SETS_FILE
           
private static Config config
           
static java.lang.String RECORD_DESCRIPTOR_FILE
           
private static java.util.Hashtable recordName
           
private static java.util.Hashtable recordSerializer
           
private static java.util.Hashtable recordSerializerTargetSchema
           
private static java.util.Hashtable recordSyntax
           
private static java.util.Hashtable recordTransformations
           
private static org.w3c.dom.Document recordTransformDocument
           
private static java.util.Hashtable schemaMappings
           
static java.lang.String SEARCH_PROFILES_FILE
           
private static java.util.Hashtable searchProfileName
           
private static java.util.Hashtable searchProfileSyntax
           
static java.lang.String SERVER_CONFIG_FILE
           
static java.lang.String SERVER_DECODE_FILE
           
static java.lang.String SERVER_ENCODE_FILE
           
private static java.util.Vector sourceSchemaNames
           
private static java.util.Vector stylesheetNames
           
private static java.util.Vector targetSchemaNames
           
private static org.apache.xpath.CachedXPathAPI xPathAPI
           
 
Constructor Summary
Config()
           
 
Method Summary
private static void buildBib1AttributeConfig(java.lang.String bib1AttributesFile)
           
private static void buildBib1DiagnosticConfig(java.lang.String bib1DiagnosticsFile)
           
private static void buildBib1ToCQLMappings()
           
private static void buildRecordConfig(java.lang.String recordDescriptorFile)
           
private static void buildSchemaTransforms(org.w3c.dom.Node oidNode)
           
private static void buildSearchProfileConfig(java.lang.String searchProfilesFile)
           
private static void buildSRWSchemaMappings()
           
private static void buildTransformNodes(org.w3c.dom.Node oidNode, org.w3c.dom.Node transformNode, java.util.Vector path, java.util.Hashtable schemaDepth, java.util.Hashtable schemaNodes, java.lang.String fromSchema, boolean fromSerializer)
           
static java.lang.String convertSyntax(int[] syntaxArray)
           
static int[] convertSyntax(java.lang.String syntaxString)
           
static java.lang.String getAttributeSetName()
           
static java.lang.String getAttributeSetSyntax()
           
static java.lang.String getAttributeType(int attributeTypeValue)
           
static int getAttributeType(java.lang.String attributeTypeName)
           
static int getAttributeValue(java.lang.String attributeSetName, java.lang.String attributeTypeName, java.lang.String attributeName)
           
static java.lang.String getBib1Diagnostic(int condition)
           
static java.lang.String getBib1DiagnosticAddInfo(int condition)
           
static org.w3c.dom.Document getCharacterSetsMap()
           
static java.lang.String getRecordNameFromSyntax(java.lang.String syntax)
           
static java.lang.String getRecordSerializer(java.lang.String syntax)
           
static java.lang.String getRecordSerializerTargetSchema(java.lang.String syntax)
           
static java.lang.String getRecordSyntax(java.lang.String schema)
           
static java.lang.String getRecordSyntaxFromName(java.lang.String name)
           
static org.w3c.dom.Document getRecordTransformDocument()
           
static java.lang.String getRelationName(java.lang.String attributeValue)
           
static java.lang.String getRelationSymbol(java.lang.String attributeValue)
           
static java.io.InputStream getResource(java.lang.String path)
           
static java.lang.String getSearchProfileNameFromSyntax(java.lang.String searchProfileSyntax)
           
static java.lang.String getSearchProfileSyntaxFromName(java.lang.String searchProfileName)
           
static java.lang.String getSemanticAttributeName(java.lang.String attributeValue)
          Following methods added temporarily for use in CQL query generation:
static org.w3c.dom.Document getServerConfigDocument()
           
static java.io.InputStream getServerDecode()
           
static java.io.InputStream getServerEncode()
           
private static int getTransforms(boolean fromSerializer, org.w3c.dom.Node transformNode, java.util.Vector transforms)
           
static java.util.Vector getTransforms(boolean fromSerializer, java.lang.String syntax, java.lang.String schema)
           
static java.util.Vector getTransforms(java.lang.String recordSchema, java.lang.String requestedRecordSchema)
           
static java.lang.String getValue(org.w3c.dom.Node node)
           
static boolean isSyntaxEqual(int[] syntaxA, int[] syntaxB)
           
static boolean isSyntaxEqual(java.lang.String syntaxA, java.lang.String syntaxB)
           
private  org.w3c.dom.Document parseDocument(java.lang.String documentPath)
           
static org.w3c.dom.NodeList selectNodeList(org.w3c.dom.Node node, java.lang.String xPath)
           
private static org.w3c.dom.NodeList selectNodeList(org.w3c.dom.Node node, java.lang.String xPath, boolean retry)
           
static org.w3c.dom.Node selectSingleNode(org.w3c.dom.Node node, java.lang.String xPath)
           
private static org.w3c.dom.Node selectSingleNode(org.w3c.dom.Node node, java.lang.String xPath, boolean retry)
           
static java.lang.String translateBib1ToCQLIndex(java.lang.String use)
           
static java.lang.String translateSRWSchemaName(java.lang.String SRWSchemaValue)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

RECORD_DESCRIPTOR_FILE

public static final java.lang.String RECORD_DESCRIPTOR_FILE
See Also:
Constant Field Values

BIB1_ATTRIBUTES_FILE

public static final java.lang.String BIB1_ATTRIBUTES_FILE
See Also:
Constant Field Values

BIB1_DIAGNOSTICS_FILE

public static final java.lang.String BIB1_DIAGNOSTICS_FILE
See Also:
Constant Field Values

SEARCH_PROFILES_FILE

public static final java.lang.String SEARCH_PROFILES_FILE
See Also:
Constant Field Values

CHARACTER_SETS_FILE

public static final java.lang.String CHARACTER_SETS_FILE
See Also:
Constant Field Values

SERVER_CONFIG_FILE

public static final java.lang.String SERVER_CONFIG_FILE
See Also:
Constant Field Values

SERVER_DECODE_FILE

public static final java.lang.String SERVER_DECODE_FILE
See Also:
Constant Field Values

SERVER_ENCODE_FILE

public static final java.lang.String SERVER_ENCODE_FILE
See Also:
Constant Field Values

recordTransformDocument

private static org.w3c.dom.Document recordTransformDocument

recordName

private static java.util.Hashtable recordName

recordSyntax

private static java.util.Hashtable recordSyntax

recordSerializer

private static java.util.Hashtable recordSerializer

recordSerializerTargetSchema

private static java.util.Hashtable recordSerializerTargetSchema

recordTransformations

private static java.util.Hashtable recordTransformations

targetSchemaNames

private static java.util.Vector targetSchemaNames

sourceSchemaNames

private static java.util.Vector sourceSchemaNames

stylesheetNames

private static java.util.Vector stylesheetNames

attributeSets

private static java.util.Hashtable attributeSets

attributeTypeName

private static java.util.Hashtable attributeTypeName

attributeTypeValue

private static java.util.Hashtable attributeTypeValue

searchProfileSyntax

private static java.util.Hashtable searchProfileSyntax

searchProfileName

private static java.util.Hashtable searchProfileName

bib1DiagMessage

private static java.util.Hashtable bib1DiagMessage

bib1DiagAddInfo

private static java.util.Hashtable bib1DiagAddInfo

attributeSetName

private static java.lang.String attributeSetName

attributeSetSyntax

private static java.lang.String attributeSetSyntax

xPathAPI

private static org.apache.xpath.CachedXPathAPI xPathAPI

config

private static Config config

schemaMappings

private static java.util.Hashtable schemaMappings

bib1ToCQLMappings

private static java.util.Hashtable bib1ToCQLMappings
Constructor Detail

Config

public Config()
Method Detail

getResource

public static java.io.InputStream getResource(java.lang.String path)

buildRecordConfig

private static void buildRecordConfig(java.lang.String recordDescriptorFile)
                               throws JaferException
Throws:
JaferException

buildTransformNodes

private static void buildTransformNodes(org.w3c.dom.Node oidNode,
                                        org.w3c.dom.Node transformNode,
                                        java.util.Vector path,
                                        java.util.Hashtable schemaDepth,
                                        java.util.Hashtable schemaNodes,
                                        java.lang.String fromSchema,
                                        boolean fromSerializer)
                                 throws JaferException
Throws:
JaferException

buildSchemaTransforms

private static void buildSchemaTransforms(org.w3c.dom.Node oidNode)
                                   throws JaferException
Throws:
JaferException

getRecordTransformDocument

public static org.w3c.dom.Document getRecordTransformDocument()

getRecordSerializer

public static java.lang.String getRecordSerializer(java.lang.String syntax)
                                            throws JaferException
Throws:
JaferException

getRecordSerializerTargetSchema

public static java.lang.String getRecordSerializerTargetSchema(java.lang.String syntax)
                                                        throws JaferException
Throws:
JaferException

getRecordNameFromSyntax

public static java.lang.String getRecordNameFromSyntax(java.lang.String syntax)
                                                throws JaferException
Throws:
JaferException

getRecordSyntaxFromName

public static java.lang.String getRecordSyntaxFromName(java.lang.String name)
                                                throws JaferException
Throws:
JaferException

isSyntaxEqual

public static boolean isSyntaxEqual(java.lang.String syntaxA,
                                    java.lang.String syntaxB)

isSyntaxEqual

public static boolean isSyntaxEqual(int[] syntaxA,
                                    int[] syntaxB)

convertSyntax

public static int[] convertSyntax(java.lang.String syntaxString)

convertSyntax

public static java.lang.String convertSyntax(int[] syntaxArray)

getRecordSyntax

public static java.lang.String getRecordSyntax(java.lang.String schema)
                                        throws JaferException
Throws:
JaferException

getTransforms

public static java.util.Vector getTransforms(boolean fromSerializer,
                                             java.lang.String syntax,
                                             java.lang.String schema)
                                      throws JaferException
Throws:
JaferException

getTransforms

public static java.util.Vector getTransforms(java.lang.String recordSchema,
                                             java.lang.String requestedRecordSchema)
                                      throws JaferException
Throws:
JaferException

getTransforms

private static int getTransforms(boolean fromSerializer,
                                 org.w3c.dom.Node transformNode,
                                 java.util.Vector transforms)
                          throws JaferException
Throws:
JaferException

buildSRWSchemaMappings

private static void buildSRWSchemaMappings()

translateSRWSchemaName

public static java.lang.String translateSRWSchemaName(java.lang.String SRWSchemaValue)

buildBib1ToCQLMappings

private static void buildBib1ToCQLMappings()

translateBib1ToCQLIndex

public static java.lang.String translateBib1ToCQLIndex(java.lang.String use)

buildBib1AttributeConfig

private static void buildBib1AttributeConfig(java.lang.String bib1AttributesFile)
                                      throws JaferException
Throws:
JaferException

getAttributeSetName

public static java.lang.String getAttributeSetName()

getAttributeSetSyntax

public static java.lang.String getAttributeSetSyntax()

getAttributeValue

public static int getAttributeValue(java.lang.String attributeSetName,
                                    java.lang.String attributeTypeName,
                                    java.lang.String attributeName)
                             throws JaferException
Throws:
JaferException

getSemanticAttributeName

public static java.lang.String getSemanticAttributeName(java.lang.String attributeValue)
                                                 throws JaferException
Following methods added temporarily for use in CQL query generation:

Throws:
JaferException

getRelationSymbol

public static java.lang.String getRelationSymbol(java.lang.String attributeValue)
                                          throws JaferException
Throws:
JaferException

getRelationName

public static java.lang.String getRelationName(java.lang.String attributeValue)
                                        throws JaferException
Throws:
JaferException

getAttributeType

public static int getAttributeType(java.lang.String attributeTypeName)
                            throws JaferException
Throws:
JaferException

getAttributeType

public static java.lang.String getAttributeType(int attributeTypeValue)
                                         throws JaferException
Throws:
JaferException

buildBib1DiagnosticConfig

private static void buildBib1DiagnosticConfig(java.lang.String bib1DiagnosticsFile)
                                       throws JaferException
Throws:
JaferException

buildSearchProfileConfig

private static void buildSearchProfileConfig(java.lang.String searchProfilesFile)
                                      throws JaferException
Throws:
JaferException

getBib1Diagnostic

public static java.lang.String getBib1Diagnostic(int condition)

getBib1DiagnosticAddInfo

public static java.lang.String getBib1DiagnosticAddInfo(int condition)

getSearchProfileSyntaxFromName

public static java.lang.String getSearchProfileSyntaxFromName(java.lang.String searchProfileName)

getSearchProfileNameFromSyntax

public static java.lang.String getSearchProfileNameFromSyntax(java.lang.String searchProfileSyntax)

getCharacterSetsMap

public static org.w3c.dom.Document getCharacterSetsMap()
                                                throws JaferException
Throws:
JaferException

getServerConfigDocument

public static org.w3c.dom.Document getServerConfigDocument()
                                                    throws JaferException
Throws:
JaferException

getServerDecode

public static java.io.InputStream getServerDecode()
                                           throws JaferException
Throws:
JaferException

getServerEncode

public static java.io.InputStream getServerEncode()
                                           throws JaferException
Throws:
JaferException

selectNodeList

public static org.w3c.dom.NodeList selectNodeList(org.w3c.dom.Node node,
                                                  java.lang.String xPath)
                                           throws JaferException
Throws:
JaferException

selectNodeList

private static org.w3c.dom.NodeList selectNodeList(org.w3c.dom.Node node,
                                                   java.lang.String xPath,
                                                   boolean retry)
                                            throws JaferException
Throws:
JaferException

selectSingleNode

public static org.w3c.dom.Node selectSingleNode(org.w3c.dom.Node node,
                                                java.lang.String xPath)
                                         throws JaferException
Throws:
JaferException

selectSingleNode

private static org.w3c.dom.Node selectSingleNode(org.w3c.dom.Node node,
                                                 java.lang.String xPath,
                                                 boolean retry)
                                          throws JaferException
Throws:
JaferException

getValue

public static java.lang.String getValue(org.w3c.dom.Node node)

parseDocument

private org.w3c.dom.Document parseDocument(java.lang.String documentPath)
                                    throws JaferException
Throws:
JaferException