net.ontopia.topicmaps.db2tm
Class RelationMapping

java.lang.Object
  extended by org.xml.sax.helpers.DefaultHandler
      extended by net.ontopia.xml.SAXTracker
          extended by net.ontopia.topicmaps.db2tm.RelationMapping
All Implemented Interfaces:
org.xml.sax.ContentHandler, org.xml.sax.DTDHandler, org.xml.sax.EntityResolver, org.xml.sax.ErrorHandler

public class RelationMapping
extends SAXTracker

INTERNAL: DB2TM relation mapping definition. Container for a set of relations, entities and fields. The mapping can be instatiated by calling the static read() methods, which will read its defintion from an XML file.


Field Summary
protected  java.io.File baseDirectory
           
protected  java.lang.String commitMode
           
protected  ExpressionVirtualColumn curecol
           
protected  Entity curent
           
protected  Field curfield
           
protected  Relation currel
           
protected  Changelog cursync
           
protected  ValueIF curvcol
           
protected  java.util.Map datasources
           
protected  java.util.Map iprefixes
           
protected  java.lang.String name
           
protected  org.xml.sax.XMLReader reader
           
protected  java.util.Map<java.lang.String,Relation> relations
           
 
Fields inherited from class net.ontopia.xml.SAXTracker
content, keepContentsOf, locator, openElements
 
Method Summary
protected  void addAttribute(org.xml.sax.helpers.AttributeListImpl atts, java.lang.String name, java.lang.String type, java.lang.String value)
           
protected  void addAttribute(org.xml.sax.helpers.AttributeListImpl atts, java.lang.String name, java.lang.String type, java.lang.String[] values)
           
 void addDataSource(java.lang.String id, DataSourceIF datasource)
           
 void addRelation(Relation relation)
           
 void close()
           
 void compile()
           
 void endElement(java.lang.String nsuri, java.lang.String lname, java.lang.String qname)
           
 java.io.File getBaseDirectory()
           
 java.lang.String getCommitMode()
           
 DataSourceIF getDataSource(java.lang.String id)
           
 java.util.Collection getDataSources()
           
 java.lang.String getName()
           
 Prefix getPrefix(java.lang.String prefix)
           
 java.lang.String getQueryDeclarations()
           
 Relation getRelation(java.lang.String name)
           
 java.util.Collection<Relation> getRelations()
           
protected static org.xml.sax.InputSource getRelaxNGSchema()
           
protected  java.lang.String getValue(org.xml.sax.Attributes attrs, java.lang.String name)
           
protected  java.lang.String getValue(org.xml.sax.Attributes attrs, java.lang.String name, java.lang.String _default)
           
protected  java.lang.String[] getValues(org.xml.sax.Attributes attrs, java.lang.String name)
           
protected  java.lang.String[] getValues(org.xml.sax.Attributes attrs, java.lang.String plural, java.lang.String singular)
           
protected  void outputEntities(Relation rel, org.xml.sax.DocumentHandler dh)
           
protected  void outputField(Field field, org.xml.sax.DocumentHandler dh)
           
protected  void outputFields(Entity entity, org.xml.sax.DocumentHandler dh)
           
static RelationMapping read(java.io.File file)
           
static RelationMapping read(java.io.InputStream istream, java.io.File basedir)
           
static RelationMapping readFromClasspath(java.lang.String resource)
           
 void setBaseDirectory(java.io.File baseDirectory)
           
 void startElement(java.lang.String nsuri, java.lang.String lname, java.lang.String qname, org.xml.sax.Attributes attrs)
           
 java.lang.String toString()
           
protected  void write(org.xml.sax.DocumentHandler dh)
           
 void write(java.io.Writer writer)
           
 void write(java.io.Writer writer, java.lang.String encoding)
           
 
Methods inherited from class net.ontopia.xml.SAXTracker
characters, isParent, keepContentsOf, setDocumentLocator
 
Methods inherited from class org.xml.sax.helpers.DefaultHandler
endDocument, endPrefixMapping, error, fatalError, ignorableWhitespace, notationDecl, processingInstruction, resolveEntity, skippedEntity, startDocument, startPrefixMapping, unparsedEntityDecl, warning
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

reader

protected org.xml.sax.XMLReader reader

name

protected java.lang.String name

commitMode

protected java.lang.String commitMode

baseDirectory

protected java.io.File baseDirectory

datasources

protected java.util.Map datasources

relations

protected java.util.Map<java.lang.String,Relation> relations

iprefixes

protected java.util.Map iprefixes

currel

protected Relation currel

curent

protected Entity curent

curfield

protected Field curfield

curvcol

protected ValueIF curvcol

cursync

protected Changelog cursync

curecol

protected ExpressionVirtualColumn curecol
Method Detail

compile

public void compile()

close

public void close()

getRelaxNGSchema

protected static org.xml.sax.InputSource getRelaxNGSchema()
                                                   throws java.io.IOException
Throws:
java.io.IOException

getBaseDirectory

public java.io.File getBaseDirectory()

setBaseDirectory

public void setBaseDirectory(java.io.File baseDirectory)

getName

public java.lang.String getName()

getCommitMode

public java.lang.String getCommitMode()

getDataSources

public java.util.Collection getDataSources()

getDataSource

public DataSourceIF getDataSource(java.lang.String id)

addDataSource

public void addDataSource(java.lang.String id,
                          DataSourceIF datasource)

getRelations

public java.util.Collection<Relation> getRelations()

getRelation

public Relation getRelation(java.lang.String name)

addRelation

public void addRelation(Relation relation)

getPrefix

public Prefix getPrefix(java.lang.String prefix)

getQueryDeclarations

public java.lang.String getQueryDeclarations()

read

public static RelationMapping read(java.io.File file)
                            throws java.io.IOException
Throws:
java.io.IOException

readFromClasspath

public static RelationMapping readFromClasspath(java.lang.String resource)
                                         throws java.io.IOException
Throws:
java.io.IOException

read

public static RelationMapping read(java.io.InputStream istream,
                                   java.io.File basedir)
                            throws java.io.IOException
Throws:
java.io.IOException

startElement

public void startElement(java.lang.String nsuri,
                         java.lang.String lname,
                         java.lang.String qname,
                         org.xml.sax.Attributes attrs)
                  throws org.xml.sax.SAXException
Specified by:
startElement in interface org.xml.sax.ContentHandler
Overrides:
startElement in class SAXTracker
Throws:
org.xml.sax.SAXException

endElement

public void endElement(java.lang.String nsuri,
                       java.lang.String lname,
                       java.lang.String qname)
                throws org.xml.sax.SAXException
Specified by:
endElement in interface org.xml.sax.ContentHandler
Overrides:
endElement in class SAXTracker
Throws:
org.xml.sax.SAXException

getValue

protected java.lang.String getValue(org.xml.sax.Attributes attrs,
                                    java.lang.String name)

getValue

protected java.lang.String getValue(org.xml.sax.Attributes attrs,
                                    java.lang.String name,
                                    java.lang.String _default)

getValues

protected java.lang.String[] getValues(org.xml.sax.Attributes attrs,
                                       java.lang.String name)

getValues

protected java.lang.String[] getValues(org.xml.sax.Attributes attrs,
                                       java.lang.String plural,
                                       java.lang.String singular)

addAttribute

protected void addAttribute(org.xml.sax.helpers.AttributeListImpl atts,
                            java.lang.String name,
                            java.lang.String type,
                            java.lang.String value)

addAttribute

protected void addAttribute(org.xml.sax.helpers.AttributeListImpl atts,
                            java.lang.String name,
                            java.lang.String type,
                            java.lang.String[] values)

write

public void write(java.io.Writer writer)
           throws org.xml.sax.SAXException
Throws:
org.xml.sax.SAXException

write

public void write(java.io.Writer writer,
                  java.lang.String encoding)
           throws org.xml.sax.SAXException
Throws:
org.xml.sax.SAXException

write

protected void write(org.xml.sax.DocumentHandler dh)
              throws org.xml.sax.SAXException
Throws:
org.xml.sax.SAXException

outputEntities

protected void outputEntities(Relation rel,
                              org.xml.sax.DocumentHandler dh)
                       throws org.xml.sax.SAXException
Throws:
org.xml.sax.SAXException

outputFields

protected void outputFields(Entity entity,
                            org.xml.sax.DocumentHandler dh)
                     throws org.xml.sax.SAXException
Throws:
org.xml.sax.SAXException

outputField

protected void outputField(Field field,
                           org.xml.sax.DocumentHandler dh)
                    throws org.xml.sax.SAXException
Throws:
org.xml.sax.SAXException

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object


Copyright © 2000-2012 Ontopia.