Class StandardsRegistry

java.lang.Object
org.dlese.dpc.schemedit.standards.StandardsRegistry

public class StandardsRegistry extends Object
Class to manage potentially many ASN standards documents, refered to using AsnDocKey instances.

Keys identify a standards Document uniquely, and we load each document, making no attempt to identify versions that may supercede other versions of the same standards doc.

The StandardsRegistry contains AsnDocInfo instances to represent each loaded Standards Doc. The hierarchical structure of each ASN Document is represented as an StandardsDocument instance. The registry makes use of a TreeCache to cache StandardTrees and loads them when needed, so that many standards documents can be managed.

Author:
Jonathan Ostwald
  • Method Details

    • getInstance

      public static StandardsRegistry getInstance()
      Gets the singleton StandardsRegistry instance
      Returns:
      a StandardsRegistry instance
    • load

      public List load(String standardsDirectory) throws Exception
      Load all xml documents found by traversing the specified standardsDirectory recursively
      Parameters:
      standardsDirectory - a directory containing standards Documents
      Returns:
      A list of AsnDocInfo instances representing loaded docs
      Throws:
      Exception - NOT YET DOCUMENTED
    • register

      public AsnDocInfo register(String path) throws Exception
      Register a Standards Document located at specified path
      Parameters:
      path - filepath of xml document to be loaded
      Returns:
      DocInfo for loaded doc
      Throws:
      Exception - if unable to register document.
    • getRejectedDocs

      public List getRejectedDocs()
      Gets the rejectedDocs attribute of the StandardsRegistry object
      Returns:
      The rejectedDocs value
    • instantiateStandardsDocument

      protected AsnStandardsDocument instantiateStandardsDocument(String key) throws Exception
      Create a AsnStandardsDocument by reading the standards file indicated by provided key.
      Parameters:
      key - NOT YET DOCUMENTED
      Returns:
      NOT YET DOCUMENTED
      Throws:
      Exception - NOT YET DOCUMENTED
    • getKey

      public String getKey(String docId)
      Gets the key (e.g., "NSES.Science.1995.D10001D0") corresponding to provided Asn Identifier (i.e, purl) for that Standards Doc.
      Parameters:
      docId - full ASN Id for a standards Document
      Returns:
      the key used by the registry for this document
    • getKeys

      public Set getKeys()
      Gets the keys attribute of the StandardsRegistry object
      Returns:
      The keys value
    • getAsnDocByPath

      public AsnDocInfo getAsnDocByPath(String path)
      Gets the asnDocByPath attribute of the StandardsRegistry object
      Parameters:
      path - NOT YET DOCUMENTED
      Returns:
      The asnDocByPath value
    • getDocInfo

      public AsnDocInfo getDocInfo(String key)
      Gets the docInfo attribute of the StandardsRegistry object
      Parameters:
      key - key of form "author.topic.year"
      Returns:
      The docInfo value
    • getStandardsDocument

      public AsnStandardsDocument getStandardsDocument(String key)
      Gets the standardsTree associated with the provided key
      Parameters:
      key - NOT YET DOCUMENTED
      Returns:
      The standardsTree value
    • getStandardsDocumentForDocId

      public AsnStandardsDocument getStandardsDocumentForDocId(String docId)
      Gets the standardsTree corresponding to the ASN Document having the ASN identifier (purl)
      Parameters:
      docId - ASN Purl Id
      Returns:
      The standardsTree for that id
    • getStandardsNode

      public AsnStandardsNode getStandardsNode(String asnId)
      Gets the standardsNode having the provided AsnID
      Parameters:
      asnId - an ASN identifier (purl)
      Returns:
      The standardsNode value
    • getStandard

      public AsnStandard getStandard(String asnId)
    • matchKey

      public String matchKey(String key)
      Find a key for a registered standards doc that matches provided key (which may contain wildcards)
      Parameters:
      key - key to match againsted registred doc
      Returns:
      key of matching registered doc
    • matchKey

      public String matchKey(org.dlese.dpc.schemedit.standards.StandardsRegistry.DocMatchKey docMatchKey)
      Find a key for a registered standards doc that matches provided DocKeyMatch instance.
      Parameters:
      docMatchKey - pattern to match against
      Returns:
      matched key
    • getDocInfos

      public List getDocInfos()
      Return the AsnDocInfo's for registered standards documents
      Returns:
      The asnDocuments value
    • compareWithCatDocs

      public void compareWithCatDocs()
    • main

      public static void main(String[] args) throws Exception
      The main program for the StandardsRegistry class
      Parameters:
      args - The command line arguments
      Throws:
      Exception - NOT YET DOCUMENTED
    • setDebug

      public static void setDebug(boolean bool)
      Sets the debug attribute of the StandardsRegistry class
      Parameters:
      bool - The new debug value
    • report

      public void report()
      Debugging utility