|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.exist.dom.SymbolTable
Maintains a global symbol table shared by a database instance. The symbol
table maps namespace URIs and node names to unique, numeric ids. Internally,
the db does not store node QNames in clear text. Instead, it uses the numeric ids
maintained here.
The global SymbolTable singleton can be retrieved from DBBroker.getSymbols().
It is saved into the database file "symbols.dbx".
| Field Summary | |
protected boolean |
changed
set to true if the symbol table needs to be saved |
protected Object2IntHashMap |
defaultMappings
Contains default prefix-to-namespace mappings. |
protected java.io.File |
file
the underlying symbols.dbx file |
protected short |
max
contains the next local name id to be used |
protected QNamePool |
namePool
Temporary name pool to share QName instances during indexing. |
protected Int2ObjectHashMap |
names
Maps int ids to local node names |
protected Int2ObjectHashMap |
namespaces
Maps int ids to namespace URIs |
protected Object2IntHashMap |
nameSymbols
Maps local node names to an integer id |
protected short |
nsMax
contains the next namespace URI id to be used |
protected Object2IntHashMap |
nsSymbols
Maps namespace URIs to an integer id |
| Constructor Summary | |
SymbolTable(java.io.File file)
|
|
| Method Summary | |
java.lang.String[] |
defaultPrefixList()
Returns a list of default prefixes registered. |
java.lang.String |
getDefaultNamespace(java.lang.String prefix)
Returns a namespace URI for the given prefix if there's a default mapping. |
java.io.File |
getFile()
|
java.lang.String |
getName(short id)
Returns the local name registered for the id or null if the name is not known. |
java.lang.String |
getNamespace(short id)
Returns the namespace URI registered for the id or null if the namespace URI is not known. |
short |
getNSSymbol(java.lang.String ns)
Returns a unique id for the specified namespace URI. |
QName |
getQName(short type,
java.lang.String namespaceURI,
java.lang.String localName,
java.lang.String prefix)
Retrieve a shared QName instance from the temporary pool. |
short |
getSymbol(org.w3c.dom.Attr attr)
Return a unique id for the local node name of the specified attribute. |
short |
getSymbol(org.w3c.dom.Element element)
Return a unique id for the local node name of the specified element. |
short |
getSymbol(java.lang.String name)
Returns a unique id for the specified local name. |
boolean |
hasChanged()
Returns true if the symbol table needs to be saved to persistent storage. |
void |
read(VariableByteInput istream)
Read the symbol table. |
void |
write(VariableByteOutputStream ostream)
Write the symbol table to persistent storage. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
protected Object2IntHashMap nameSymbols
protected Int2ObjectHashMap names
protected Object2IntHashMap nsSymbols
protected Int2ObjectHashMap namespaces
protected Object2IntHashMap defaultMappings
protected QNamePool namePool
protected short max
protected short nsMax
protected boolean changed
protected java.io.File file
| Constructor Detail |
public SymbolTable(java.io.File file)
| Method Detail |
public QName getQName(short type,
java.lang.String namespaceURI,
java.lang.String localName,
java.lang.String prefix)
namespaceURI - localName - prefix -
public short getSymbol(org.w3c.dom.Element element)
element -
public short getSymbol(org.w3c.dom.Attr attr)
attr -
public short getSymbol(java.lang.String name)
name -
public short getNSSymbol(java.lang.String ns)
ns -
public java.lang.String getNamespace(short id)
id -
public boolean hasChanged()
public java.lang.String getName(short id)
id -
public java.lang.String getDefaultNamespace(java.lang.String prefix)
prefix -
public java.lang.String[] defaultPrefixList()
public void write(VariableByteOutputStream ostream)
throws java.io.IOException
ostream -
java.io.IOException
public void read(VariableByteInput istream)
throws java.io.IOException
istream -
java.io.IOExceptionpublic java.io.File getFile()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||