Package net.ontopia.topicmaps.db2tm
Class RelationMapping
- java.lang.Object
-
- org.xml.sax.helpers.DefaultHandler
-
- net.ontopia.xml.SAXTracker
-
- net.ontopia.topicmaps.db2tm.RelationMapping
-
- All Implemented Interfaces:
ContentHandler,DTDHandler,EntityResolver,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
Fields Modifier and Type Field Description protected FilebaseDirectoryprotected StringcommitModeprotected ExpressionVirtualColumncurecolprotected Entitycurentprotected Fieldcurfieldprotected Relationcurrelprotected Changelogcursyncprotected ValueIFcurvcolprotected Map<String,DataSourceIF>datasourcesprotected Map<String,Prefix>iprefixesprotected Stringnameprotected XMLReaderreaderprotected Map<String,Relation>relations-
Fields inherited from class net.ontopia.xml.SAXTracker
content, keepContentsOf, locator, openElements
-
-
Method Summary
-
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
-
-
-
-
Field Detail
-
reader
protected XMLReader reader
-
name
protected String name
-
commitMode
protected String commitMode
-
baseDirectory
protected File baseDirectory
-
datasources
protected final Map<String,DataSourceIF> datasources
-
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 InputSource getRelaxNGSchema() throws IOException
- Throws:
IOException
-
getBaseDirectory
public File getBaseDirectory()
-
setBaseDirectory
public void setBaseDirectory(File baseDirectory)
-
getName
public String getName()
-
getCommitMode
public String getCommitMode()
-
getDataSources
public Collection<DataSourceIF> getDataSources()
-
getDataSource
public DataSourceIF getDataSource(String id)
-
addDataSource
public void addDataSource(String id, DataSourceIF datasource)
-
getRelations
public Collection<Relation> getRelations()
-
addRelation
public void addRelation(Relation relation)
-
getQueryDeclarations
public String getQueryDeclarations()
-
read
public static RelationMapping read(File file) throws IOException
- Throws:
IOException
-
readFromClasspath
public static RelationMapping readFromClasspath(String resource) throws IOException
- Throws:
IOException
-
read
public static RelationMapping read(InputStream istream, File basedir) throws IOException
- Throws:
IOException
-
startElement
public void startElement(String nsuri, String lname, String qname, Attributes attrs) throws SAXException
- Specified by:
startElementin interfaceContentHandler- Overrides:
startElementin classSAXTracker- Throws:
SAXException
-
endElement
public void endElement(String nsuri, String lname, String qname) throws SAXException
- Specified by:
endElementin interfaceContentHandler- Overrides:
endElementin classSAXTracker- Throws:
SAXException
-
getValue
protected String getValue(Attributes attrs, String name)
-
getValue
protected String getValue(Attributes attrs, String name, String _default)
-
getValues
protected String[] getValues(Attributes attrs, String name)
-
getValues
protected String[] getValues(Attributes attrs, String plural, String singular)
-
addAttribute
protected void addAttribute(AttributesImpl atts, String name, String type, String value)
-
addAttribute
protected void addAttribute(AttributesImpl atts, String name, String type, String[] values)
-
write
public void write(Writer writer) throws SAXException
- Throws:
SAXException
-
write
public void write(Writer writer, String encoding) throws SAXException
- Throws:
SAXException
-
write
protected void write(ContentHandler dh) throws SAXException
- Throws:
SAXException
-
outputEntities
protected void outputEntities(Relation rel, ContentHandler dh) throws SAXException
- Throws:
SAXException
-
outputFields
protected void outputFields(Entity entity, ContentHandler dh) throws SAXException
- Throws:
SAXException
-
outputField
protected void outputField(Field field, ContentHandler dh) throws SAXException
- Throws:
SAXException
-
-