|
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. The loader is responsible for managing the DTS discovery process. It manages: 1. the queue of documents to be explored 2. the document discovery process 3. the stack of fragments being built and stored 4. The fragment naming scheme Features of the loader include: 1. The ability to interupt the document discovery process between documents without losing track of the documents remaining to be discovered. Interrupts can be requested and cancelled.
| Constructor Summary | |
|---|---|
LoaderImpl(Store store,
XLinkProcessor xlinkProcessor)
|
|
LoaderImpl(Store store,
XLinkProcessor xlinkProcessor,
List<URI> uris)
|
|
| Method Summary | |
|---|---|
void |
addFragment(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. |
void |
extendChildren()
Add a new node to the vector of children being tracked for the current fragment. |
CacheImpl |
getCache()
|
Vector<Long> |
getChildrenVector()
The children vector contains an item for each element that has been started and that has not yet been ended by the SAX content handler. |
String |
getCurrentFragmentId()
Returns the current fragment index (the one before the next fragment index) |
List<String> |
getDocumentsStillToAnalyse()
|
String |
getDocumentURI()
Get the URI for the document being parsed. |
EntityResolver |
getEntityResolver()
Return the entity resolver being used by the loader. |
Fragment |
getFragment()
Get the fragment that is currently being built by the DTS loader |
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 used by the loader. |
void |
incrementChildren()
Increment the children tracker to show that a new element has been found. |
void |
incrementFragmentId()
|
boolean |
isBuildingAFragment()
|
boolean |
isDiscovering()
|
protected void |
parse(URI uri)
Parse an XML Document supplied as a URI the next part of the DTS. |
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 |
prepareToTrackChildrenForNewFragment()
Add a new child tracking vector to the childrenStack to use for the new fragment that is being built by the loader. |
void |
requestInterrupt()
Interrupts the loading process once the current document discovery has been completed. |
void |
setCache(CacheImpl 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 |
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 |
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, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public LoaderImpl(Store store,
XLinkProcessor xlinkProcessor)
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,
List<URI> uris)
throws XBRLException
store - The data store to hold the DTSxlinkProcessor - The XLink processor to use for link resolutionuris - The array of URIs for loading.
XBRLException - if the loader cannot be instantiated.| Method Detail |
|---|
public void setCache(CacheImpl cache)
Loader
setCache in interface Loadercache - The cache to use in the loaderLoader.setCache(CacheImpl)
public CacheImpl getCache()
throws XBRLException
getCache in interface LoaderXBRLException - if the cache is null.Loader.getCache()public boolean isDiscovering()
isDiscovering in interface LoaderLoader.isDiscovering()public void requestInterrupt()
requestInterrupt in interface Loaderpublic void cancelInterrupt()
Loader
cancelInterrupt in interface LoaderLoader.cancelInterrupt()public Store getStore()
getStore in interface Loaderpublic String getDocumentURI()
getDocumentURI in interface Loaderpublic XLinkProcessor getXlinkProcessor()
getXlinkProcessor in interface Loader
public void prepareToTrackChildrenForNewFragment()
throws XBRLException
prepareToTrackChildrenForNewFragment in interface LoaderXBRLExceptionpublic Vector<Long> getChildrenVector()
getChildrenVector in interface Loaderpublic void incrementChildren()
Loader
incrementChildren in interface LoaderLoader.incrementChildren()
public void extendChildren()
throws XBRLException
extendChildren in interface LoaderXBRLException
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
Loader
getFragment in interface LoaderXBRLException - if the loader is not building any fragments.Loader.getFragment()public boolean isBuildingAFragment()
isBuildingAFragment in interface LoaderLoader.isBuildingAFragment()
public void addFragment(Fragment fragment,
ElementState state)
throws XBRLException
Loader
addFragment 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.addFragment(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<String> 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 parse(URI uri)
throws XBRLException
uri - The URI of the document to parse.
XBRLException
protected void parse(URI uri,
String xml)
throws XBRLException
uri - The URI to associate with the supplied XML.xml - The XML document as a string.
XBRLException
protected void parse(URI uri,
InputSource inputSource,
ContentHandler contentHandler)
throws XBRLException
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
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
stashURI in interface Loaderuri - The absolute URI to be stashed (any relative URI gets resolved
against the Base URI before stashing. TODO put this
functionality at the SAX parse call for the document. TODO
make sure that the fragment after the # is handled for stashed
URIs in the loader.
XBRLException - if the URI cannot be stored for later exploration or if the
URI is not absolutepublic void setEntityResolver(EntityResolver resolver)
setEntityResolver in interface Loaderresolver - An entity resolver implementation
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()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||