Overview   Class List   Class Hierarchy   Class Members   Functions & Constants   Defines   Header Files  

uima::ResourceManager Class Reference

List of all members.

Detailed Description

The class ResourceManager is used to manage the UIMACPP resources.

The class ResourceManager is a singleton. For example, there can only be one instance of the class per process. The first argument cpszInstance defines the instance name of this instance.

The second argument cpszProductPrefix is optional and defines the product prefix. Both arguments are no longer used.

     foo(const TCHAR * cpszInstance)
     {
        // first create an instance of the UIMACPP resource manager
        ResourceManager & rclUimaResourceMgr = ResourceManager::createInstance(cpszInstance);

        if(rclUimaResourceMgr.getLastErrorId() != UIMA_ERR_NONE)
           {
              ErrorMessage clMessage( rclUimaResourceMgr.getLastErrorId() );
              cout << clMessage << endl;
           }
     }
The single instance of ResourceManager is deleted automatically.


Static Functions

util::Filename const * getStreamHandlerForURIScheme (std::string uriScheme)
 Look up the streamhandler dll that supports the URI scheme.
void registerLogger (Logger *)
 Register Logger.
void unregisterLogger (Logger *)
 unregister this logger.
std::vector< Logger * > & getLoggers ()
ResourceManagercreateInstance (const TCHAR *cpszInstance, const TCHAR *cpszProductPrefix=0)
 Returns a pointer to the singleton instance of ResourceManager for this process and passes the instance key to it.
ResourceManagergetInstance (void)
 Returns a pointer to the singleton instance of ResourceManager for this process.
bool hasInstance (void)
 Return TRUE, if the resource manager has been initialized.
void deleteInstance (void)
 Deletes the resource manager instance.
icu::UnicodeString resolveFilename (icu::UnicodeString const &filename, icu::UnicodeString const &lastFilename)

Public Member Functions

Properties
TyErrorId getLastErrorId (void) const
 Returns the last error that occurred.
const util::LocationgetLocationWork (void) const
 Returns the location used for storing temporary work files.
const util::LocationgetLocationData (void) const
 Returns the location used for storing data files.
bool isSchemaAvailable (void)
 Returns the location used to find the schema definition file used for schema validation when parsing descriptors.
TCHAR const * getSchemaInfo (void)
void enableSchemaValidation (bool aEnable)
bool doSchemaValidation (void)
LogStream::EnEntryType getLoggingLevel ()
 get the current logging level
void setLoggingLevel (LogStream::EnEntryType level)
 set the current minimum logging level
void setupJavaLogging (void *jniEnv)
 store handle to java env and handle to java log method
bool isJavaLoggingEnabled ()
 true is java logging is setup
uima::LogFacilitygetLogger ()
 returns handle to the framework logger
util::DllProcLoaderFilerequestAnnotatorFile (const util::Filename &crclFilename)
 Returns an AnnotatorFile from the pool of AnnotatorFiles with the specified filename.
ResourceABase const * getResource (uima::Language const &crLang, ResourceFactoryABase const &crFactory, ErrorInfo &)
 Convenience function.
ResourceABase const * getResource (icu::UnicodeString const &crKey, ResourceFactoryABase const &crFactory, ErrorInfo &)
 Main method to create/access resources.
void registerFactory (icu::UnicodeString const &crKind, ResourceFactoryABase &crFactory)
 Register a factory for a given kind of ressource.
void deRegisterFactory (icu::UnicodeString const &crKind, ResourceFactoryABase &crFactory)
 Deregister a factory for a given kind of ressource.
ResourceABase const * getResource (icu::UnicodeString const &crKey, icu::UnicodeString const &crKind, ErrorInfo &)
 get or create a ressource of a given kind and key using a factory registered earlier using registerFactory
Miscellaneous
void setNewLocationWork (const util::Location &crclLocation)
 Sets a new location to store temporary work files.
void setNewLocationData (const util::Location &crclLocation)
 Sets a new location to store data files.

Static Public Member Functions

bool createFilenameForLanguage (Language &rclLanguage, const TCHAR *cpszExtension, bool bUseAlternateTerritories, const util::Location &crclDirToUse, util::Filename &rclFilename)
 Creates a filename for a resource file based on the specified language and the specified filename extension.


Member Function Documentation

bool uima::ResourceManager::createFilenameForLanguage Language rclLanguage,
const TCHAR cpszExtension,
bool  bUseAlternateTerritories,
const util::Location crclDirToUse,
util::Filename rclFilename
[static]
 

Creates a filename for a resource file based on the specified language and the specified filename extension.

Returns TRUE, if a file with this filename exists.

Example: language is "en-us" and extension is ".tsw" filename will be en-us.tsw

If bUseAlternateTerritories is enabled, another attempt is made, only using the language name without the territory.

Example: language is "en" and the extension is ".tsw". The filename could also be en-uk.tsw

TyErrorId uima::ResourceManager::getLastErrorId void   )  const [inline]
 

Returns the last error that occurred.

const util::Location& uima::ResourceManager::getLocationWork void   )  const
 

Returns the location used for storing temporary work files.

const util::Location& uima::ResourceManager::getLocationData void   )  const
 

Returns the location used for storing data files.

bool uima::ResourceManager::isSchemaAvailable void   ) 
 

Returns the location used to find the schema definition file used for schema validation when parsing descriptors.

TCHAR const* uima::ResourceManager::getSchemaInfo void   ) 
 

void uima::ResourceManager::enableSchemaValidation bool  aEnable  ) 
 

bool uima::ResourceManager::doSchemaValidation void   ) 
 

LogStream::EnEntryType uima::ResourceManager::getLoggingLevel  ) 
 

get the current logging level

void uima::ResourceManager::setLoggingLevel LogStream::EnEntryType  level  ) 
 

set the current minimum logging level

void uima::ResourceManager::setupJavaLogging void *  jniEnv  ) 
 

store handle to java env and handle to java log method

bool uima::ResourceManager::isJavaLoggingEnabled  ) 
 

true is java logging is setup

uima::LogFacility& uima::ResourceManager::getLogger  ) 
 

returns handle to the framework logger

util::DllProcLoaderFile* uima::ResourceManager::requestAnnotatorFile const util::Filename crclFilename  ) 
 

Returns an AnnotatorFile from the pool of AnnotatorFiles with the specified filename.

ResourceABase const* uima::ResourceManager::getResource uima::Language const &  crLang,
ResourceFactoryABase const &  crFactory,
ErrorInfo
 

Convenience function.

Extracts the string from crLang and calls getResource().

ResourceABase const* uima::ResourceManager::getResource icu::UnicodeString const &  crKey,
ResourceFactoryABase const &  crFactory,
ErrorInfo
 

Main method to create/access resources.

If a resource with the same key and kind as the factory already exists, it is returned, otherwise a new one is created.

void uima::ResourceManager::registerFactory icu::UnicodeString const &  crKind,
ResourceFactoryABase crFactory
 

Register a factory for a given kind of ressource.

Only after registering a factory for a kind a resource can be acquired using the getResource() overload below

void uima::ResourceManager::deRegisterFactory icu::UnicodeString const &  crKind,
ResourceFactoryABase crFactory
 

Deregister a factory for a given kind of ressource.

ResourceABase const* uima::ResourceManager::getResource icu::UnicodeString const &  crKey,
icu::UnicodeString const &  crKind,
ErrorInfo
 

get or create a ressource of a given kind and key using a factory registered earlier using registerFactory

void uima::ResourceManager::setNewLocationWork const util::Location crclLocation  ) 
 

Sets a new location to store temporary work files.

void uima::ResourceManager::setNewLocationData const util::Location crclLocation  ) 
 

Sets a new location to store data files.

ResourceManager& uima::ResourceManager::createInstance const TCHAR cpszInstance,
const TCHAR cpszProductPrefix = 0
[static]
 

Returns a pointer to the singleton instance of ResourceManager for this process and passes the instance key to it.

Note: This function must be called before any calls to static method ResourceManager::getInstance()/0.

ResourceManager& uima::ResourceManager::getInstance void   )  [static]
 

Returns a pointer to the singleton instance of ResourceManager for this process.

bool uima::ResourceManager::hasInstance void   )  [static]
 

Return TRUE, if the resource manager has been initialized.

void uima::ResourceManager::deleteInstance void   )  [static]
 

Deletes the resource manager instance.

util::Filename const* uima::ResourceManager::getStreamHandlerForURIScheme std::string  uriScheme  ) 
 

Look up the streamhandler dll that supports the URI scheme.

Parameters:
uriScheme - eg file, sdo.
Returns:
valid pointer to a dll file or NULL if URI scheme is unknown.

icu::UnicodeString uima::ResourceManager::resolveFilename icu::UnicodeString const &  filename,
icu::UnicodeString const &  lastFilename
[static]
 

void uima::ResourceManager::registerLogger Logger  ) 
 

Register Logger.

Caller owns the logger instance.

void uima::ResourceManager::unregisterLogger Logger  ) 
 

unregister this logger.

Caller owns logger instance.

std::vector<Logger*>& uima::ResourceManager::getLoggers  ) 
 


The documentation for this class was generated from the following file:
Generated on Mon Oct 1 16:04:13 2012 for UIMACPP API by  doxygen 1.3.9.1