|
XBRLAPIA Java API for XBRL |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.xbrlapi.loader.LoaderImpl
public class LoaderImpl
Implementation of the XBRL API Loader interface that validates using a pool of preparsed XML Schemas for XBRL documents.
| Field Summary | |
|---|---|
static int |
BIG_PRIME
|
static String |
GRAMMAR_POOL
Property identifier: grammar pool. |
static String |
SYMBOL_TABLE
Property identifier: symbol table. |
| Constructor Summary | |
|---|---|
LoaderImpl(Store store,
XLinkProcessor xlinkProcessor,
EntityResolver entityResolver)
|
|
LoaderImpl(Store store,
XLinkProcessor xlinkProcessor,
EntityResolver entityResolver,
List<URI> uris)
|
|
| Method Summary | |
|---|---|
void |
add(Fragment fragment,
ElementState state)
Push a new fragment onto the stack of fragments that are being built by the loader. |
void |
cancelInterrupt()
Cancels a request for an interrupt. |
void |
discover()
Begin the XBRL DTS discovery process with the URIs that are already in the loading/discovery queue. |
void |
discover(List<URI> startingURIs)
Begin the XBRL DTS discovery process with the specified URIs given in the provided list. |
void |
discover(String uri)
Trigger the discovery process given a single URI. |
void |
discover(URI uri)
Trigger the discovery process given a single URI. |
void |
discover(URI uri,
String xml)
Perform a discovery starting with an XML document that is represented as a string. |
void |
discoverNext()
Parses the next document in the queue of documents to be discovered. |
boolean |
equals(Object obj)
|
Document |
getBuilderDOM()
|
Cache |
getCache()
|
String |
getCurrentFragmentId()
Returns the current fragment index (the one before the next fragment index) |
List<URI> |
getDocumentsStillToAnalyse()
|
URI |
getDocumentURI()
Get the URI for the document being parsed. |
EntityResolver |
getEntityResolver()
Return the entity resolver being used by the loader. |
Fragment |
getFragment()
|
History |
getHistory()
|
String |
getNextFragmentId()
Also increments the fragment index as a side-effect. |
Store |
getStore()
Get the data store used by a loader. |
XLinkProcessor |
getXlinkProcessor()
Get the XLink processor |
int |
hashCode()
|
boolean |
hasHistory()
|
void |
incrementFragmentId()
|
boolean |
isBuildingAFragment()
|
boolean |
isDiscovering()
|
protected void |
markDocumentAsExplored(URI uri)
Flag the document as being explored. |
protected void |
parse(URI uri)
Parse an XML Document supplied as a URI. |
protected void |
parse(URI uri,
InputSource inputSource,
ContentHandler contentHandler)
Parse the supplied input source. |
protected void |
parse(URI uri,
String xml)
Parse an XML Document supplied as a string the next part of the DTS. |
void |
replaceCurrentFragment(Fragment replacement)
This is particularly useful when you can only fully determine the fragment type by reading in the complex element content of the data corresponding to the fragment. |
void |
requestInterrupt()
Interrupts the loading process once the current document discovery has been completed. |
void |
setCache(Cache cache)
This method specifies a cache to use when loading data into the data store. |
void |
setEntityResolver(EntityResolver resolver)
Set the resolver for the resolution of entities found during the loading and XLink processing. |
void |
setHistory(History newHistory)
|
void |
setSchemaLocationAttributeUsage(boolean useThem)
|
protected void |
setStartingURIs(List<URI> uris)
Set the starting points for DTSImpl discovery using a linked list |
void |
stashURI(URI uri)
Stash a URI to await loading into DTS. |
void |
stashURIs(List<URI> uris)
|
void |
storeDocumentsToAnalyse()
Stores the stubs for the documents still to be analysed in the data store being used by the loader. |
void |
updateState(ElementState state)
If a fragment is completed, remove the fragment from the stack being maintained by the loader, store it in the data store and make the necessary update to the stack of child counts for the fragments. |
boolean |
useSchemaLocationAttributes()
The default behaviour is to ignore the content of XML Schema instance schemaLocation attributes. |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final String SYMBOL_TABLE
public static final String GRAMMAR_POOL
public static final int BIG_PRIME
| Constructor Detail |
|---|
public LoaderImpl(Store store,
XLinkProcessor xlinkProcessor,
EntityResolver entityResolver)
throws XBRLException
store - The data store to hold the DTSxlinkProcessor - The XLink processor to use for link resolution
XBRLException - if the loader cannot be instantiated.
public LoaderImpl(Store store,
XLinkProcessor xlinkProcessor,
EntityResolver entityResolver,
List<URI> uris)
throws XBRLException
store - The data store to hold the DTSxlinkProcessor - The XLink processor to use for link resolutionentityResolver - The entity resolver to use for resources being loaded.uris - The array of URIs for loading.
XBRLException - if the loader cannot be instantiated.| Method Detail |
|---|
public void requestInterrupt()
Loader
requestInterrupt in interface LoaderLoader.requestInterrupt()public void cancelInterrupt()
Loader
cancelInterrupt in interface LoaderLoader.cancelInterrupt()public void setCache(Cache cache)
Loader
setCache in interface Loadercache - The cache to use in the loader.Loader.setCache(Cache)
public Cache getCache()
throws XBRLException
getCache in interface LoaderXBRLException - if the cache is null.Loader.getCache()
public Document getBuilderDOM()
throws XBRLException
getBuilderDOM in interface LoaderXBRLExceptionLoader.getBuilderDOM()public boolean isDiscovering()
isDiscovering in interface LoaderLoader.isDiscovering()public Store getStore()
getStore in interface Loaderpublic URI getDocumentURI()
getDocumentURI in interface Loaderpublic XLinkProcessor getXlinkProcessor()
Loader
getXlinkProcessor in interface LoaderLoader.getXlinkProcessor()
public void updateState(ElementState state)
throws XBRLException
Loader
updateState in interface Loaderstate - The element state for the element currently being parsed.
XBRLExceptionLoader.updateState(ElementState)
public Fragment getFragment()
throws XBRLException
getFragment in interface LoaderXBRLExceptionLoader.getFragment()
public void replaceCurrentFragment(Fragment replacement)
throws XBRLException
Loader
replaceCurrentFragment in interface Loaderreplacement - the fragment to replace the current fragment being build with.
XBRLException - if there is no current fragment.Loader.replaceCurrentFragment(Fragment)public boolean isBuildingAFragment()
isBuildingAFragment in interface LoaderLoader.isBuildingAFragment()
public void add(Fragment fragment,
ElementState state)
throws XBRLException
Loader
add in interface Loaderfragment - The fragment to be added to the stack of fragments
being built by the loader.state - The state of the element that is the root of the fragment.
XBRLExceptionLoader.add(Fragment, ElementState)
public void discover(List<URI> startingURIs)
throws XBRLException
Loader
discover in interface LoaderstartingURIs - The starting point URIs for the DTS
discovery process
Trigger the discovery process given the starting URIs.
XBRLException - if the input list contains objects
other than java.net.URIs.Loader.discover(List)
public void discover(URI uri)
throws XBRLException
Loader
discover in interface Loaderuri - The URI to discover.
XBRLExceptionLoader.discover(URI)
public void discover(String uri)
throws XBRLException
Loader
discover in interface Loaderuri - The URI to discover.
XBRLExceptionLoader.discover(String)public List<URI> getDocumentsStillToAnalyse()
getDocumentsStillToAnalyse in interface LoaderLoader.getDocumentsStillToAnalyse()
public void discover()
throws XBRLException
Loader
discover in interface LoaderXBRLException - if the discovery process fails.Loader.discover()
public void discoverNext()
throws XBRLException
Loader
discoverNext in interface LoaderXBRLException - if the discovery process fails.Loader.discoverNext()
public void discover(URI uri,
String xml)
throws XBRLException
discover in interface Loaderuri - The URI to be used for the document that is supplied as a
string. This URI MUST be an absolute URI.xml - The string representation of the XML document to be parsed.
XBRLException - if the discovery process fails or if the supplied URI is not
absolute or is not a valid URI syntax or the loader does not
have a cache.protected void markDocumentAsExplored(URI uri)
XBRLException
protected void parse(URI uri)
throws XBRLException,
SAXException,
IOException
uri - The URI of the document to parse.
XBRLException - IOException ParserConfigurationException SAXException
ParserConfigurationException
SAXException
IOException
protected void parse(URI uri,
String xml)
throws XBRLException,
SAXException,
IOException
uri - The URI to associate with the supplied XML.xml - The XML document as a string.
XBRLException - IOException SAXException ParserConfigurationException
SAXException
IOException
protected void setStartingURIs(List<URI> uris)
throws XBRLException
uris - A list of starting point document URIs for DTSImpl discovery
XBRLException
public void stashURI(URI uri)
throws XBRLException
Loader
stashURI in interface Loaderuri - The absolute URI to be stashed (any relative
URI gets resolved against the Base URI before stashing.
XBRLException - if the URI cannot be stored for
later exploration or if the URI is not absolute.Loader.stashURI(URI)
public void stashURIs(List<URI> uris)
throws XBRLException
stashURIs in interface Loaderuris - The list of URIs to be stashed.
XBRLExceptionLoader.stashURIs(List)public void setEntityResolver(EntityResolver resolver)
setEntityResolver in interface Loaderresolver - An entity resolver implementation or null if you want to use
a default entity resolver (without any caching facilities)
public String getNextFragmentId()
throws XBRLException
Loader
getNextFragmentId in interface LoaderXBRLExceptionpublic String getCurrentFragmentId()
Loader
getCurrentFragmentId in interface Loaderpublic void incrementFragmentId()
public EntityResolver getEntityResolver()
getEntityResolver in interface Loaderpublic boolean useSchemaLocationAttributes()
Loader
useSchemaLocationAttributes in interface LoaderLoader.useSchemaLocationAttributes()public void setSchemaLocationAttributeUsage(boolean useThem)
setSchemaLocationAttributeUsage in interface LoaderuseThem - must be set to true if you want to discover documents identified
in XML Schema instance schemaLocation attributes and false otherwise.Loader.setSchemaLocationAttributeUsage(boolean)
public void storeDocumentsToAnalyse()
throws XBRLException
Loader
storeDocumentsToAnalyse in interface LoaderXBRLExceptionLoader.storeDocumentsToAnalyse()public int hashCode()
hashCode in class ObjectObject.hashCode()public boolean equals(Object obj)
equals in class ObjectObject.equals(java.lang.Object)public void setHistory(History newHistory)
setHistory in interface LoadernewHistory - The history recording system
to use for all new documents being loaded.
If this is null then the history is set to a
naive history that just logs the historic
information.Loader.setHistory(History)public History getHistory()
getHistory in interface LoaderLoader.getHistory()public boolean hasHistory()
hasHistory in interface LoaderLoader.hasHistory()
protected void parse(URI uri,
InputSource inputSource,
ContentHandler contentHandler)
throws XBRLException,
SAXException,
IOException
uri - The URI to be associated with the supplied input source.inputSource - The input source to parse.contentHandler - The content handler to use for SAX parsing.
XBRLException - SAXException IOException
SAXException
IOException
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||