org.LexGrid.LexBIG.Impl.loaders
Class BaseLoader

java.lang.Object
  extended by org.LexGrid.LexBIG.Impl.Extensions.AbstractExtendable
      extended by org.LexGrid.LexBIG.Impl.loaders.BaseLoader
All Implemented Interfaces:
java.io.Serializable, Extendable, Loader, StatusReporter
Direct Known Subclasses:
AbstractSpringBatchLoader, ClaMLLoaderImpl, HL7LoaderImpl, LexGridMultiLoaderImpl, MetaDataLoaderImpl, MrmapRRFLoader, OBOLoaderImpl, OWLLoaderImpl, RadLexProtegeFramesLoaderImpl, SemNetLoaderImpl, TextLoaderImpl

public abstract class BaseLoader
extends AbstractExtendable
implements Loader

Common loader code.

Version:
subversion $Revision: $ checked in on $Date: $
Author:
Dan Armbrust, Jesse Erdmann, Craig Stancl
See Also:
Serialized Form

Nested Class Summary
protected  class BaseLoader.DoConversion
           
 
Field Summary
static java.lang.String ASYNC_OPTION
           
static java.lang.String FAIL_ON_ERROR_OPTION
           
protected  boolean inUse
           
static java.lang.String LOADER_POST_PROCESSOR_OPTION
           
static java.lang.String LOADER_PREFERENCE_FILE_OPTION
           
static java.lang.String MANIFEST_FILE_OPTION
           
static java.lang.String SUPPLEMENT_OPTION
           
 
Constructor Summary
BaseLoader()
           
 
Method Summary
 void addBooleanOptionValue(java.lang.String optionName, java.lang.Boolean value)
           
protected  void baseLoad(boolean async)
           
protected  void buildRootNode(AbsoluteCodingSchemeVersionReference reference, java.util.List<java.lang.String> associationNames, java.lang.String relationContainerName, LexEvsDatabaseOperations.RootOrTail rootOrTail, LexEvsDatabaseOperations.TraverseAssociations traverse)
          Build root (or tail) nodes.
 void clearLog()
          Clears any associated log entries.
protected  URNVersionPair[] constructVersionPairsFromCodingSchemes(java.lang.Object... loadedObject)
           
protected  CachingMessageDirectorIF createCachingMessageDirectorIF()
           
protected  CodingSchemeInserter createDefaultInserter()
           
protected  CodingSchemeInserter createDefaultInserter(CodingScheme codingScheme)
           
protected abstract  OptionHolder declareAllowedOptions(OptionHolder holder)
           
protected  boolean doesOptionExist(java.util.List<? extends BaseOption<?>> options, java.lang.String optionName)
           
protected  void doIndex(AbsoluteCodingSchemeVersionReference[] references)
           
protected abstract  URNVersionPair[] doLoad()
           
protected  void doPostProcessing(OptionHolder options, AbsoluteCodingSchemeVersionReference[] references)
           
protected  void doTransitiveAndIndex(AbsoluteCodingSchemeVersionReference[] references)
           
protected  void doTransitiveTable(AbsoluteCodingSchemeVersionReference[] references)
           
protected  AbsoluteCodingSchemeVersionReference getAbsoluteCodingSchemeVersionReferenceFromOptionString(java.lang.String optionString)
           
 CodingSchemeManifest getCodingSchemeManifest()
          Get the CodingSchemeManifest that would be used to modify the ontology content.
 java.net.URI getCodingSchemeManifestURI()
          Get the URI of the codingSchemeManifest that would be used to modify the ontology content.
 AbsoluteCodingSchemeVersionReference[] getCodingSchemeReferences()
          Returns absolute references for coding schemes loaded or used by the most recent operation; empty if not applicable.
 java.lang.String getDescription()
          Return a description of the extension.
 LoaderPreferences getLoaderPreferences()
          Returns the current LoaderPreferences object.
 LogEntry[] getLog(LogLevel level)
          Returns log entries for the current or most recent load operation that match a particular status; null if no operation has been attempted.
protected  LgLoggerIF getLogger()
           
 ManifestUtil getManifestUtil()
           
 CachingMessageDirectorIF getMessageDirector()
           
 java.lang.String getName()
          Return the name assigned to this service extension.
 OntologyFormat getOntologyFormat()
          Return the ontology format the loader can handle
 OptionHolder getOptions()
           
protected  LoaderPostProcessor getPostProcessor(java.lang.String postProcessorName)
           
 java.lang.String getProvider()
          Return an identifier for the extension provider.
 java.net.URI getResourceUri()
           
 LoadStatus getStatus()
          Returns status of the current or most recent load or validate operation; null if no operation has been attempted.
 java.lang.String getStringFromURI(java.net.URI uri)
           
 java.lang.String getVersion()
          Return version information about the extension.
 boolean isDoApplyPostLoadManifest()
           
 boolean isDoComputeTransitiveClosure()
           
 boolean isDoIndexing()
           
 boolean isDoRegister()
           
 boolean isDoRemoveOnFailure()
           
 boolean isInUse()
           
 void load(java.net.URI resource)
           
protected  void lock(URNVersionPair lockInfo)
           
protected  void persistCodingSchemeToDatabase(CodingScheme codingScheme)
           
protected  void persistCodingSchemeToDatabase(CodingSchemeInserter inserter, CodingScheme codingScheme)
           
 void register()
           
protected  void register(URNVersionPair[] loadedCodingSchemes)
           
protected  void setCachingMessageDirectorIF(CachingMessageDirectorIF md)
           
 void setCodingSchemeManifest(CodingSchemeManifest codingSchemeManifest)
          Set the CodingSchemeManifest that would be used to modify the ontology content.
 void setCodingSchemeManifestURI(java.net.URI codingSchemeManifestURI)
          Set the URI of the codingSchemeManifest that would be used to modify the ontology content.
 void setCodingSchemeReferences(AbsoluteCodingSchemeVersionReference[] codingSchemeReferences)
           
 void setDoApplyPostLoadManifest(boolean doApplyPostLoadManifest)
           
 void setDoComputeTransitiveClosure(boolean doComputeTransitiveClosure)
           
 void setDoIndexing(boolean doIndexing)
           
 void setDoRegister(boolean doRegister)
           
 void setDoRemoveOnFailure(boolean doRemoveOnFailure)
           
protected  void setInUse()
           
 void setLoaderPreferences(LoaderPreferences loaderPreferences)
          Sets the Loader's LoaderPreferences.
 void setLoaderPreferences(java.net.URI loaderPreferences)
          Sets the Loader's LoaderPreferences.
 void setManifestUtil(ManifestUtil manifestUtil)
           
 void setOptions(OptionHolder options)
           
 void setResourceUri(java.net.URI resourceUri)
           
 void setStatus(LoadStatus status)
           
protected  void unlock(URNVersionPair lockInfo)
           
protected  AbsoluteCodingSchemeVersionReference[] urnVersionPairToAbsoluteCodingSchemeVersionReference(URNVersionPair[] versionPairs)
           
 
Methods inherited from class org.LexGrid.LexBIG.Impl.Extensions.AbstractExtendable
buildExtensionDescription, getExtensionDescription
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOADER_POST_PROCESSOR_OPTION

public static java.lang.String LOADER_POST_PROCESSOR_OPTION

SUPPLEMENT_OPTION

public static java.lang.String SUPPLEMENT_OPTION

MANIFEST_FILE_OPTION

public static java.lang.String MANIFEST_FILE_OPTION

LOADER_PREFERENCE_FILE_OPTION

public static java.lang.String LOADER_PREFERENCE_FILE_OPTION

ASYNC_OPTION

public static java.lang.String ASYNC_OPTION

FAIL_ON_ERROR_OPTION

public static java.lang.String FAIL_ON_ERROR_OPTION

inUse

protected boolean inUse
Constructor Detail

BaseLoader

public BaseLoader()
Method Detail

baseLoad

protected void baseLoad(boolean async)
                 throws LBInvocationException
Throws:
LBInvocationException

createCachingMessageDirectorIF

protected CachingMessageDirectorIF createCachingMessageDirectorIF()

isInUse

public boolean isInUse()

setManifestUtil

public void setManifestUtil(ManifestUtil manifestUtil)

setCodingSchemeReferences

public void setCodingSchemeReferences(AbsoluteCodingSchemeVersionReference[] codingSchemeReferences)

getLogger

protected LgLoggerIF getLogger()

setInUse

protected void setInUse()
                 throws LBInvocationException
Throws:
LBInvocationException

urnVersionPairToAbsoluteCodingSchemeVersionReference

protected AbsoluteCodingSchemeVersionReference[] urnVersionPairToAbsoluteCodingSchemeVersionReference(URNVersionPair[] versionPairs)

getAbsoluteCodingSchemeVersionReferenceFromOptionString

protected AbsoluteCodingSchemeVersionReference getAbsoluteCodingSchemeVersionReferenceFromOptionString(java.lang.String optionString)
                                                                                                throws LBParameterException,
                                                                                                       LBInvocationException
Throws:
LBParameterException
LBInvocationException

doPostProcessing

protected void doPostProcessing(OptionHolder options,
                                AbsoluteCodingSchemeVersionReference[] references)
                         throws LBParameterException
Throws:
LBParameterException

doTransitiveAndIndex

protected void doTransitiveAndIndex(AbsoluteCodingSchemeVersionReference[] references)
                             throws java.lang.Exception
Throws:
java.lang.Exception

buildRootNode

protected void buildRootNode(AbsoluteCodingSchemeVersionReference reference,
                             java.util.List<java.lang.String> associationNames,
                             java.lang.String relationContainerName,
                             LexEvsDatabaseOperations.RootOrTail rootOrTail,
                             LexEvsDatabaseOperations.TraverseAssociations traverse)
                      throws java.lang.Exception
Build root (or tail) nodes.

Parameters:
codingSchemes -
associations -
sci -
root - - true for root nodes, false for tail nodes.
Throws:
java.lang.Exception

doIndex

protected void doIndex(AbsoluteCodingSchemeVersionReference[] references)
                throws java.lang.Exception
Throws:
java.lang.Exception

doTransitiveTable

protected void doTransitiveTable(AbsoluteCodingSchemeVersionReference[] references)
                          throws java.lang.Exception
Throws:
java.lang.Exception

register

protected void register(URNVersionPair[] loadedCodingSchemes)
                 throws java.lang.Exception
Throws:
java.lang.Exception

persistCodingSchemeToDatabase

protected void persistCodingSchemeToDatabase(CodingScheme codingScheme)
                                      throws CodingSchemeAlreadyLoadedException
Throws:
CodingSchemeAlreadyLoadedException

persistCodingSchemeToDatabase

protected void persistCodingSchemeToDatabase(CodingSchemeInserter inserter,
                                             CodingScheme codingScheme)
                                      throws CodingSchemeAlreadyLoadedException
Throws:
CodingSchemeAlreadyLoadedException

createDefaultInserter

protected CodingSchemeInserter createDefaultInserter()

createDefaultInserter

protected CodingSchemeInserter createDefaultInserter(CodingScheme codingScheme)

getStatus

public LoadStatus getStatus()
Description copied from interface: Loader
Returns status of the current or most recent load or validate operation; null if no operation has been attempted.

Specified by:
getStatus in interface Loader
Specified by:
getStatus in interface StatusReporter

setStatus

public void setStatus(LoadStatus status)

getLog

public LogEntry[] getLog(LogLevel level)
Description copied from interface: Loader
Returns log entries for the current or most recent load operation that match a particular status; null if no operation has been attempted.

Specified by:
getLog in interface Loader
Specified by:
getLog in interface StatusReporter

clearLog

public void clearLog()
Description copied from interface: Loader
Clears any associated log entries.

Specified by:
clearLog in interface Loader

getName

public java.lang.String getName()
Description copied from interface: Extendable
Return the name assigned to this service extension. This name must be unique within context of the installed node and is used to register and lookup the extension through a LexBIGService.

Specified by:
getName in interface Extendable
Overrides:
getName in class AbstractExtendable

getDescription

public java.lang.String getDescription()
Description copied from interface: Extendable
Return a description of the extension.

Specified by:
getDescription in interface Extendable
Overrides:
getDescription in class AbstractExtendable

getVersion

public java.lang.String getVersion()
Description copied from interface: Extendable
Return version information about the extension.

Specified by:
getVersion in interface Extendable
Overrides:
getVersion in class AbstractExtendable

getProvider

public java.lang.String getProvider()
Description copied from interface: Extendable
Return an identifier for the extension provider.

Specified by:
getProvider in interface Extendable
Overrides:
getProvider in class AbstractExtendable

lock

protected void lock(URNVersionPair lockInfo)
             throws LBInvocationException,
                    LBParameterException
Throws:
LBInvocationException
LBParameterException

unlock

protected void unlock(URNVersionPair lockInfo)
               throws LBInvocationException,
                      LBParameterException
Throws:
LBInvocationException
LBParameterException

getStringFromURI

public java.lang.String getStringFromURI(java.net.URI uri)
                                  throws LBParameterException
Throws:
LBParameterException

setCodingSchemeManifest

public void setCodingSchemeManifest(CodingSchemeManifest codingSchemeManifest)
Set the CodingSchemeManifest that would be used to modify the ontology content. Once the ontology is loaded from the source, the manifest would then be applied to modify the loaded content.

Specified by:
setCodingSchemeManifest in interface Loader
Parameters:
csm -

getCodingSchemeManifest

public CodingSchemeManifest getCodingSchemeManifest()
Get the CodingSchemeManifest that would be used to modify the ontology content. Once the ontology is loaded from the source, the manifest would then be applied to modify the loaded content.

Specified by:
getCodingSchemeManifest in interface Loader
Parameters:
csm -

setCodingSchemeManifestURI

public void setCodingSchemeManifestURI(java.net.URI codingSchemeManifestURI)
Set the URI of the codingSchemeManifest that would be used to modify the ontology content. The codingSchemeManifest object is set using the content pointed by the URI. Once the ontology is loaded from the source, the manifest would then be applied to modify the loaded content.

Specified by:
setCodingSchemeManifestURI in interface Loader
Parameters:
csm -

getCodingSchemeManifestURI

public java.net.URI getCodingSchemeManifestURI()
Get the URI of the codingSchemeManifest that would be used to modify the ontology content. Once the ontology is loaded from the source, the manifest would then be applied to modify the loaded content.

Specified by:
getCodingSchemeManifestURI in interface Loader
Parameters:
csm -

getLoaderPreferences

public LoaderPreferences getLoaderPreferences()
Returns the current LoaderPreferences object.

Specified by:
getLoaderPreferences in interface Loader
Returns:
The current LoaderPreferences

setLoaderPreferences

public void setLoaderPreferences(LoaderPreferences loaderPreferences)
                          throws LBParameterException
Sets the Loader's LoaderPreferences.

Specified by:
setLoaderPreferences in interface Loader
Parameters:
loaderPreferences - The LoaderPreference object to be loaded. It is recommended that all subclasses override and check if the LoaderPreferences object is valid for the particular loader.
Throws:
LBParameterException

setLoaderPreferences

public void setLoaderPreferences(java.net.URI loaderPreferences)
                          throws LBParameterException
Sets the Loader's LoaderPreferences.

Specified by:
setLoaderPreferences in interface Loader
Parameters:
loaderPreferences - The LoaderPreference XML URI to be loaded.
Throws:
LBParameterException

doLoad

protected abstract URNVersionPair[] doLoad()
                                    throws java.lang.Exception
Throws:
java.lang.Exception

load

public void load(java.net.URI resource)
Specified by:
load in interface Loader

doesOptionExist

protected boolean doesOptionExist(java.util.List<? extends BaseOption<?>> options,
                                  java.lang.String optionName)

declareAllowedOptions

protected abstract OptionHolder declareAllowedOptions(OptionHolder holder)

register

public void register()
              throws LBParameterException,
                     LBException
Throws:
LBParameterException
LBException

constructVersionPairsFromCodingSchemes

protected URNVersionPair[] constructVersionPairsFromCodingSchemes(java.lang.Object... loadedObject)

getPostProcessor

protected LoaderPostProcessor getPostProcessor(java.lang.String postProcessorName)
                                        throws LBParameterException
Throws:
LBParameterException

addBooleanOptionValue

public void addBooleanOptionValue(java.lang.String optionName,
                                  java.lang.Boolean value)

getCodingSchemeReferences

public AbsoluteCodingSchemeVersionReference[] getCodingSchemeReferences()
Description copied from interface: Loader
Returns absolute references for coding schemes loaded or used by the most recent operation; empty if not applicable.

Specified by:
getCodingSchemeReferences in interface Loader

getOptions

public OptionHolder getOptions()
Specified by:
getOptions in interface Loader

setOptions

public void setOptions(OptionHolder options)

getResourceUri

public java.net.URI getResourceUri()

setResourceUri

public void setResourceUri(java.net.URI resourceUri)

isDoIndexing

public boolean isDoIndexing()

setDoIndexing

public void setDoIndexing(boolean doIndexing)

isDoComputeTransitiveClosure

public boolean isDoComputeTransitiveClosure()

setDoComputeTransitiveClosure

public void setDoComputeTransitiveClosure(boolean doComputeTransitiveClosure)

isDoRegister

public boolean isDoRegister()

setDoRegister

public void setDoRegister(boolean doRegister)

isDoApplyPostLoadManifest

public boolean isDoApplyPostLoadManifest()

setDoApplyPostLoadManifest

public void setDoApplyPostLoadManifest(boolean doApplyPostLoadManifest)

getMessageDirector

public CachingMessageDirectorIF getMessageDirector()

setCachingMessageDirectorIF

protected void setCachingMessageDirectorIF(CachingMessageDirectorIF md)

getManifestUtil

public ManifestUtil getManifestUtil()

setDoRemoveOnFailure

public void setDoRemoveOnFailure(boolean doRemoveOnFailure)

isDoRemoveOnFailure

public boolean isDoRemoveOnFailure()

getOntologyFormat

public OntologyFormat getOntologyFormat()
Description copied from interface: Loader
Return the ontology format the loader can handle

Specified by:
getOntologyFormat in interface Loader

Copyright: (c) 2004-2006 Mayo Foundation for Medical Education and Research (MFMER). All rights reserved. MAYO, MAYO CLINIC, and the triple-shield Mayo logo are trademarks and service marks of MFMER.