com.mindtree.techworks.insight.preferences.xmlpersistence
Class XMLPreferenceDataReader

java.lang.Object
  extended by org.xml.sax.helpers.DefaultHandler
      extended by com.mindtree.techworks.insight.preferences.xmlpersistence.XMLPreferenceDataReader
All Implemented Interfaces:
PreferenceXMLNameConstants, org.xml.sax.ContentHandler, org.xml.sax.DTDHandler, org.xml.sax.EntityResolver, org.xml.sax.ErrorHandler

public class XMLPreferenceDataReader
extends org.xml.sax.helpers.DefaultHandler
implements PreferenceXMLNameConstants

Reads data from the XML Preference store and populates the preference objects into the Data Cache. This class is a specialization of Default Handler. This class reads XML data for the following Schema

 <?xml version="1.0" encoding="UTF-8"?>
    <!-- edited with XMLSPY v5 rel. 4 U (http://www.xmlspy.com) by Bindul Bhowmik (GALILEO INTERNATIONAL) -->
    <xs:schema targetNamespace="http://mindtree.com/logging/insight/Preferences" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:preferences="http://mindtree.com/logging/insight/Preferences" elementFormDefault="qualified" attributeFormDefault="unqualified" version="1.0">
        <!-- Root element -->
        <xs:element name="InsightPreferences">
                 <xs:annotation>
                        <xs:documentation>Stores all the preferences for Insight. All preferences are to be configured in an XML file conforming to this XSD, this Schema will also define the storage of the preference values in a user's system.</xs:documentation>
                </xs:annotation>
                <xs:complexType>
                        <xs:sequence>
                                <xs:element name="preference" type="preferences:Preference" minOccurs="0" maxOccurs="unbounded">
                                        <xs:annotation>
                                                <xs:documentation>See documentation with Preference</xs:documentation>
                                        </xs:annotation>
                                </xs:element>
                        </xs:sequence>
                </xs:complexType>
        </xs:element>
        <!-- ComplexType representing a particular Preference -->
        <xs:complexType name="Preference">
                <xs:annotation>
                        <xs:documentation>Correspons to a particular Preference, which in turn will have a list of preference attributes</xs:documentation>
                </xs:annotation>
                <xs:sequence>
                        <xs:element name="preferenceAttribute" type="preferences:PreferenceAttribute" maxOccurs="unbounded">
                                <xs:annotation>
                                        <xs:documentation>See documentation with PreferenceAttribute</xs:documentation>
                                </xs:annotation>
                        </xs:element>
                </xs:sequence>
                <xs:attribute name="id" use="required">
                        <xs:annotation>
                                <xs:documentation>The ID of the Preference Attribute. Each attribute will be uniquely identified by a combination of the Preference ID and the Preference Attribute ID</xs:documentation>
                        </xs:annotation>
                        <xs:simpleType>
                                <xs:restriction base="xs:string">
                                        <xs:whiteSpace value="collapse"/>
                                        <xs:minLength value="3"/>
                                </xs:restriction>
                        </xs:simpleType>
                </xs:attribute>
                <xs:attribute name="name" use="required">
                        <xs:annotation>
                                <xs:documentation>The Display name of the Preference Attribute</xs:documentation>
                        </xs:annotation>
                        <xs:simpleType>
                                <xs:restriction base="xs:string">
                                        <xs:minLength value="5"/>
                                        <xs:whiteSpace value="collapse"/>
                                </xs:restriction>
                        </xs:simpleType>
                </xs:attribute>
        </xs:complexType>
        <!-- Complex type representing a PreferenceAttribute -->
        <xs:complexType name="PreferenceAttribute">
                <xs:annotation>
                        <xs:documentation>A Preference Attribute is a particular value within a Preference. It is uniquely identified by the id of this element.</xs:documentation>
                </xs:annotation>
                <xs:sequence>
                        <xs:element name="defaultValue" type="xs:string" minOccurs="0">
                                <xs:annotation>
                                        <xs:documentation>The value to be supplied when no value is set.</xs:documentation>
                                </xs:annotation>
                        </xs:element>
                        <xs:element name="value" type="xs:string" minOccurs="0">
                                <xs:annotation>
                                        <xs:documentation>The value of the attribute. The value if set for transient attributes will be ignored, and will not be stored back.</xs:documentation>
                                </xs:annotation>
                        </xs:element>
                        <xs:element name="type" default="TEXT">
                                <xs:annotation>
                                        <xs:documentation>The type of the attribute, as of version 1.0 only two types are supported, TEXT and LIST</xs:documentation>
                                </xs:annotation>
                                <xs:simpleType>
                                        <xs:restriction base="xs:string">
                                                <xs:enumeration value="TEXT"/>
                                                <xs:enumeration value="LIST"/>
                                        </xs:restriction>
                                </xs:simpleType>
                        </xs:element>
                        <xs:element name="persistant" type="xs:boolean" default="true">
                                <xs:annotation>
                                        <xs:documentation>Indicates whether a particular preference attribute value will persist across instances of the application</xs:documentation>
                                </xs:annotation>
                        </xs:element>
                        <xs:element name="userModifiable" type="xs:string" default="true">
                                <xs:annotation>
                                        <xs:documentation>Identifies whether the user can modify this attribute using the GUI.</xs:documentation>
                                </xs:annotation>
                        </xs:element>
                </xs:sequence>
                <xs:attribute name="id" use="required">
                        <xs:annotation>
                                <xs:documentation>The ID of the Preference Attribute. Each attribute will be uniquely identified by a combination of the Preference ID and the Preference Attribute ID</xs:documentation>
                        </xs:annotation>
                        <xs:simpleType>
                                <xs:restriction base="xs:string">
                                        <xs:whiteSpace value="collapse"/>
                                        <xs:minLength value="3"/>
                                </xs:restriction>
                        </xs:simpleType>
                </xs:attribute>
                <xs:attribute name="name" use="required">
                        <xs:annotation>
                                <xs:documentation>The Display name of the Preference Attribute</xs:documentation>
                        </xs:annotation>
                        <xs:simpleType>
                                <xs:restriction base="xs:string">
                                        <xs:minLength value="5"/>
                                        <xs:whiteSpace value="collapse"/>
                                </xs:restriction>
                        </xs:simpleType>
                </xs:attribute>
        </xs:complexType>
        <!-- A specialization of the Preference Attribute to have a list of values -->
        <xs:complexType name="ListPreferenceAttribute">
                <xs:annotation>
                        <xs:documentation>A specialized form of attribute where a list of possible values or options are provided.</xs:documentation>
                </xs:annotation>
                <xs:complexContent>
                        <xs:extension base="preferences:PreferenceAttribute">
                                <xs:sequence>
                                        <xs:element name="options">
                                                <xs:annotation>
                                                        <xs:documentation>The various optoins from which the value of the preference attribute this list is part of can be derived</xs:documentation>
                                                </xs:annotation>
                                                <xs:complexType>
                                                        <xs:sequence>
                                                                <xs:element name="option" type="xs:string" maxOccurs="unbounded">
                                                                        <xs:annotation>
                                                                                <xs:documentation>A particular option. See documentation for options.</xs:documentation>
                                                                        </xs:annotation>
                                                                </xs:element>
                                                        </xs:sequence>
                                                </xs:complexType>
                                        </xs:element>
                                </xs:sequence>
                        </xs:extension>
                </xs:complexContent>
        </xs:complexType>
    </xs:schema>
    
   
  
 

Version:
$Revision: 161 $ $Date: 2008-04-04 22:48:39 -0600 (Fri, 04 Apr 2008) $
Author:
Bindul Bhowmik

Field Summary
 
Fields inherited from interface com.mindtree.techworks.insight.preferences.xmlpersistence.PreferenceXMLNameConstants
DEFAULT_NAMESPACE, TRUE, XMLNAME_INSIGHT_PREFERENCE, XMLNAME_LIST_PREFERENCE_ATTRIBUTE, XMLNAME_PREF_ATT_DEFAULT_VALUE, XMLNAME_PREF_ATT_ENCRYPTED, XMLNAME_PREF_ATT_OPTION_VAL, XMLNAME_PREF_ATT_OPTIONS, XMLNAME_PREF_ATT_PERSISTANT, XMLNAME_PREF_ATT_TYPE, XMLNAME_PREF_ATT_USER_MOD, XMLNAME_PREF_ATT_VALUE, XMLNAME_PREFERENCE, XMLNAME_PREFERENCE_ATT_ID, XMLNAME_PREFERENCE_ATT_NAME, XMLNAME_PREFERENCE_ATTRIBUTE, XMLNAME_PREFERENCE_DISPLAY_CLASS, XMLNAME_PREFERENCE_ID, XMLNAME_PREFERENCE_ISAGGREGATED, XMLNAME_PREFERENCE_ISUSERMOD, XMLNAME_PREFERENCE_NAME, XMLNAME_XSI_TYPE, XSI_NAMESPACE
 
Constructor Summary
XMLPreferenceDataReader()
          Default constructor
 
Method Summary
 void characters(char[] ch, int start, int length)
           
 void endElement(java.lang.String uri, java.lang.String localName, java.lang.String qName)
           
 void startElement(java.lang.String uri, java.lang.String localName, java.lang.String qName, org.xml.sax.Attributes attributes)
           
 
Methods inherited from class org.xml.sax.helpers.DefaultHandler
endDocument, endPrefixMapping, error, fatalError, ignorableWhitespace, notationDecl, processingInstruction, resolveEntity, setDocumentLocator, skippedEntity, startDocument, startPrefixMapping, unparsedEntityDecl, warning
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XMLPreferenceDataReader

public XMLPreferenceDataReader()
Default constructor

Method Detail

endElement

public void endElement(java.lang.String uri,
                       java.lang.String localName,
                       java.lang.String qName)
                throws org.xml.sax.SAXException
Specified by:
endElement in interface org.xml.sax.ContentHandler
Overrides:
endElement in class org.xml.sax.helpers.DefaultHandler
Throws:
org.xml.sax.SAXException
See Also:
ContentHandler.endElement(java.lang.String, java.lang.String, java.lang.String)

startElement

public void startElement(java.lang.String uri,
                         java.lang.String localName,
                         java.lang.String qName,
                         org.xml.sax.Attributes attributes)
                  throws org.xml.sax.SAXException
Specified by:
startElement in interface org.xml.sax.ContentHandler
Overrides:
startElement in class org.xml.sax.helpers.DefaultHandler
Throws:
org.xml.sax.SAXException
See Also:
ContentHandler.startElement(java.lang.String, java.lang.String, java.lang.String, org.xml.sax.Attributes)

characters

public void characters(char[] ch,
                       int start,
                       int length)
                throws org.xml.sax.SAXException
Specified by:
characters in interface org.xml.sax.ContentHandler
Overrides:
characters in class org.xml.sax.helpers.DefaultHandler
Throws:
org.xml.sax.SAXException
See Also:
ContentHandler.characters(char[], int, int)


Copyright © 2003-2008 MindTree Consulting Ltd.. All Rights Reserved.