ARC SDK
Public Member Functions | Protected Member Functions | Protected Attributes | Static Protected Attributes
Arc::JobDescriptionParserPlugin Class Referenceabstract

Abstract plugin class for different parsers. More...

#include <arc/compute/JobDescriptionParserPlugin.h>

Inheritance diagram for Arc::JobDescriptionParserPlugin:

Public Member Functions

virtual JobDescriptionParserPluginResult Parse (const std::string &source, std::list< JobDescription > &jobdescs, const std::string &language="", const std::string &dialect="") const =0
 Parse string into JobDescription objects. More...
 
virtual JobDescriptionParserPluginResult Assemble (const JobDescription &job, std::string &output, const std::string &language, const std::string &dialect="") const =0
 Assemble job description into string. More...
 
virtual JobDescriptionParserPluginResult UnParse (const JobDescription &job, std::string &output, const std::string &language, const std::string &dialect="") const
 [DEPRECATED] Assemble job description into string More...
 
const std::list< std::string > & GetSupportedLanguages () const
 Get supported job description languages. More...
 
bool IsLanguageSupported (const std::string &language) const
 Check if language is supported. More...
 
const std::string & GetError (void)
 [DEPRECATED] Get parsing error More...
 

Protected Member Functions

 JobDescriptionParserPlugin (PluginArgument *parg)
 
std::string & SourceLanguage (JobDescription &j) const
 [DEPRECATED] Get reference to sourceLanguage member More...
 

Protected Attributes

std::list< std::string > supportedLanguages
 List of supported job description languages. More...
 
std::string error
 [DEPRECATED] Parsing error More...
 

Static Protected Attributes

static Logger logger
 

Detailed Description

Abstract plugin class for different parsers.

The JobDescriptionParserPlugin class is abstract which provide an interface for job description parsers. A job description parser should inherit this class and overwrite the JobDescriptionParserPlugin::Parse and JobDescriptionParserPlugin::UnParse methods. The inheriating class should add the job description languages that it supports to the 'supportedLanguages' member, formatted according to the GLUE2 JobDescription_t type (GFD-R-P.147). The created job description parser will then be available to the JobDescription::Parse, JobDescription::ParseFromFile and JobDescription::Assemble methods, adding the ability to parse and assemble job descriptions in the specified languages.

Using the methods in JobDescription class for parsing job descriptions is recommended, however it is also possible to use parser plugins directly, which can be done by loading them using the JobDescriptionParserPluginLoader class.

Since this class inheriates from the Plugin class, inheriating classes should be compiled as a loadable module. See xxx for information on creating loadable modules for ARC.

Member Function Documentation

◆ Assemble()

virtual JobDescriptionParserPluginResult Arc::JobDescriptionParserPlugin::Assemble ( const JobDescription job,
std::string &  output,
const std::string &  language,
const std::string &  dialect = "" 
) const
pure virtual

Assemble job description into string.

Since
Added in 5.1.0

◆ GetError()

const std::string& Arc::JobDescriptionParserPlugin::GetError ( void  )
inline

[DEPRECATED] Get parsing error

Deprecated:
Deprecated as of 5.1.0 - expected to be removed in 6.0.0.

◆ GetSupportedLanguages()

const std::list<std::string>& Arc::JobDescriptionParserPlugin::GetSupportedLanguages ( ) const
inline

Get supported job description languages.

Returns
A list of job description languages supported by this parser is returned.

◆ IsLanguageSupported()

bool Arc::JobDescriptionParserPlugin::IsLanguageSupported ( const std::string &  language) const
inline

Check if language is supported.

Parameters
languagea string formatted according to the GLUE2 JobDescription_t type (GFD-R-P.147), e.g. nordugrid:xrsl.
Returns
true is returned if specified language is supported.

◆ Parse()

virtual JobDescriptionParserPluginResult Arc::JobDescriptionParserPlugin::Parse ( const std::string &  source,
std::list< JobDescription > &  jobdescs,
const std::string &  language = "",
const std::string &  dialect = "" 
) const
pure virtual

Parse string into JobDescription objects.

Parses the string argument source into JobDescription objects. If the language argument is specified the method will only parse the string if it supports that language - a JobDescriptionParserPluginResult object with status WrongLanguage is returned if language is not supported. Similar for the dialect argument, if specified, string is only parsed if that dialect is known by parser. If the language argument is not specified an attempt at parsing source using any of the supported languages is tried. If parsing is successful the generated JobDescription objects is appended to the jobdescs argument. If parsing is unsuccessful the jobdescs argument is untouched, and details of the failure is returned.

Inheriating classes must extend this method. The extended method should parse the source argument string into a JobDescription object, possibly into multiple objects. Some languages can contain multiple alternative views, in such cases alternatives should be added using the JobDescription::AddAlternative method. Only if parsing is successful should the generated JobDescription objects be added to the jobdescs argument. Note: The only allowed modification of the jobdescs list is adding elements. If the language argument is specified parsing should only be initiated if the specified language is among the supported ones, if that is not the case WrongLanguage should be returned. If the language argument For some languages different dialects exist (e.g. user- and GM- side xRSL), and if the dialect argument is specified the parsing must strictly conform to that dialect. If the dialect is unknown WrongLanguage should be returned.

Parameters
sourceshould contain a representation of job description as a string.
jobdescsa reference to a list of JobDescription object which parsed job descriptions should be appended to.
languageif specified parse in specified language (if not supported WrongLanguage is returned).
dialectif specified parsing conforms strictly to specified dialect.
Returns
A JobDescriptionParserPluginResult is returned indicating outcome of parsing.
See also
JobDescriptionParserPlugin::Assemble
JobDescriptionParserPluginResult

◆ SourceLanguage()

std::string& Arc::JobDescriptionParserPlugin::SourceLanguage ( JobDescription j) const
protected

[DEPRECATED] Get reference to sourceLanguage member

Deprecated:
Deprecated as of 5.1.0 - expected to be removed in 6.0.0.

◆ UnParse()

virtual JobDescriptionParserPluginResult Arc::JobDescriptionParserPlugin::UnParse ( const JobDescription job,
std::string &  output,
const std::string &  language,
const std::string &  dialect = "" 
) const
inlinevirtual

[DEPRECATED] Assemble job description into string

Deprecated:
Deprecated as of 5.1.0, use the JobDescriptionParserPlugin::Assemble method instead - expected to be removed in 6.0.0.

Field Documentation

◆ error

std::string Arc::JobDescriptionParserPlugin::error
mutableprotected

[DEPRECATED] Parsing error

Deprecated:
Deprecated as of 5.1.0 - expected to be removed in 6.0.0.

◆ supportedLanguages

std::list<std::string> Arc::JobDescriptionParserPlugin::supportedLanguages
protected

List of supported job description languages.

Inheriating classes should add languages supported to this list in the constructor.


The documentation for this class was generated from the following file: