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.
Method Summary |
protected void |
addAttribute(org.xml.sax.helpers.AttributeListImpl atts,
String name,
String type,
String value)
|
protected void |
addAttribute(org.xml.sax.helpers.AttributeListImpl atts,
String name,
String type,
String[] values)
|
void |
addDataSource(String id,
DataSourceIF datasource)
|
void |
addRelation(Relation relation)
|
void |
close()
|
void |
compile()
|
void |
endElement(String nsuri,
String lname,
String qname)
|
File |
getBaseDirectory()
|
String |
getCommitMode()
|
DataSourceIF |
getDataSource(String id)
|
Collection |
getDataSources()
|
String |
getName()
|
Prefix |
getPrefix(String prefix)
|
String |
getQueryDeclarations()
|
Relation |
getRelation(String name)
|
Collection<Relation> |
getRelations()
|
protected static InputSource |
getRelaxNGSchema()
|
protected String |
getValue(Attributes attrs,
String name)
|
protected String |
getValue(Attributes attrs,
String name,
String _default)
|
protected String[] |
getValues(Attributes attrs,
String name)
|
protected String[] |
getValues(Attributes attrs,
String plural,
String singular)
|
protected void |
outputEntities(Relation rel,
DocumentHandler dh)
|
protected void |
outputField(Field field,
DocumentHandler dh)
|
protected void |
outputFields(Entity entity,
DocumentHandler dh)
|
static RelationMapping |
read(File file)
|
static RelationMapping |
read(InputStream istream,
File basedir)
|
static RelationMapping |
readFromClasspath(String resource)
|
void |
setBaseDirectory(File baseDirectory)
|
void |
startElement(String nsuri,
String lname,
String qname,
Attributes attrs)
|
String |
toString()
|
protected void |
write(DocumentHandler dh)
|
void |
write(Writer writer)
|
void |
write(Writer writer,
String encoding)
|
Methods inherited from class org.xml.sax.helpers.DefaultHandler |
endDocument, endPrefixMapping, error, fatalError, ignorableWhitespace, notationDecl, processingInstruction, resolveEntity, skippedEntity, startDocument, startPrefixMapping, unparsedEntityDecl, warning |
reader
protected XMLReader reader
name
protected String name
commitMode
protected String commitMode
baseDirectory
protected File baseDirectory
datasources
protected Map datasources
relations
protected Map<String,Relation> relations
iprefixes
protected 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
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 getDataSources()
getDataSource
public DataSourceIF getDataSource(String id)
addDataSource
public void addDataSource(String id,
DataSourceIF datasource)
getRelations
public Collection<Relation> getRelations()
getRelation
public Relation getRelation(String name)
addRelation
public void addRelation(Relation relation)
getPrefix
public Prefix getPrefix(String prefix)
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:
startElement
in interface ContentHandler
- Overrides:
startElement
in class SAXTracker
- Throws:
SAXException
endElement
public void endElement(String nsuri,
String lname,
String qname)
throws SAXException
- Specified by:
endElement
in interface ContentHandler
- Overrides:
endElement
in class SAXTracker
- 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(org.xml.sax.helpers.AttributeListImpl atts,
String name,
String type,
String value)
addAttribute
protected void addAttribute(org.xml.sax.helpers.AttributeListImpl 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(DocumentHandler dh)
throws SAXException
- Throws:
SAXException
outputEntities
protected void outputEntities(Relation rel,
DocumentHandler dh)
throws SAXException
- Throws:
SAXException
outputFields
protected void outputFields(Entity entity,
DocumentHandler dh)
throws SAXException
- Throws:
SAXException
outputField
protected void outputField(Field field,
DocumentHandler dh)
throws SAXException
- Throws:
SAXException
toString
public String toString()
- Overrides:
toString
in class Object
Copyright © 2000-2012 Ontopia.