lsst.pex.policy
13.0-1-g47a359c+4
|
A Policy file in the installation directory of an LSST product, referred to using a URN. More...
#include <UrnPolicyFile.h>
Public Member Functions | |
UrnPolicyFile (const std::string &urn, bool strictUrn=false, bool strictLoads=true) | |
Construct a new policy file reference from a URN. More... | |
![]() | |
DefaultPolicyFile (const char *const productName, const std::string &filepath, const std::string &repos="", bool strict=true) | |
define a default policy file More... | |
virtual boost::filesystem::path | getInstallPath (const char *const productName) |
return the file path to the installation directory of a given named product. More... | |
const boost::filesystem::path & | getRepositoryPath () const |
return the full file path to the repository directory where this file will found. More... | |
virtual void | load (Policy &policy) const |
load the data from this Policy source into a Policy object. More... | |
![]() | |
PolicyFile (const SupportedFormats::Ptr &fmts=defaultFormats) | |
create a "null" Policy file that points to an unspecified file. More... | |
const std::string | getPath () const |
return the file path as a string More... | |
bool | exists () const |
return true if the file exists. More... | |
virtual const std::string & | getFormatName () |
return the name of the format that the data is stored in. More... | |
const std::string & | getFormatName () const |
PolicyFile (const std::string &filepath, const SupportedFormats::Ptr &fmts=defaultFormats) | |
create a Policy file that points a file with given path. More... | |
PolicyFile (const char *filepath, const SupportedFormats::Ptr &fmts=defaultFormats) | |
create a Policy file that points a file with given path. More... | |
PolicyFile (const boost::filesystem::path &filepath, const SupportedFormats::Ptr &fmts=defaultFormats) | |
create a Policy file that points a file with given path. More... | |
PolicyFile (const std::string &filepath, const PolicyParserFactory::Ptr &parserFactory) | |
create a Policy file that points a file with given path. More... | |
PolicyFile (const boost::filesystem::path &filepath, const PolicyParserFactory::Ptr &parserFactory) | |
create a Policy file that points a file with given path. More... | |
PolicyFile (const std::string &filepath, const boost::filesystem::path &reposDir, const SupportedFormats::Ptr &fmts=defaultFormats) | |
create a Policy file that points a file with given path in a policy file repository. More... | |
PolicyFile (const boost::filesystem::path &filepath, const boost::filesystem::path &reposDir, const SupportedFormats::Ptr &fmts=defaultFormats) | |
create a Policy file that points a file with given path in a policy file repository. More... | |
PolicyFile (const std::string &filepath, const boost::filesystem::path &reposDir, const PolicyParserFactory::Ptr &parserFactory) | |
create a Policy file that points a file with given path in a policy file repository. More... | |
PolicyFile (const boost::filesystem::path &filepath, const boost::filesystem::path &reposDir, const PolicyParserFactory::Ptr &parserFactory) | |
create a Policy file that points a file with given path in a policy file repository. More... | |
virtual void | load (Policy &policy) |
load the data from this Policy source into a Policy object More... | |
![]() | |
PolicySource (SupportedFormats::Ptr fmts=defaultFormats) | |
create a Policy file that points a file with given path. More... | |
virtual | ~PolicySource () |
destroy the source More... | |
Static Public Member Functions | |
static std::string | productNameFromUrn (const std::string &urn, bool strictUrn=false) |
Extract the product name from a URN. More... | |
static std::string | filePathFromUrn (const std::string &urn, bool strictUrn=false) |
Extract the local file path from a URN. More... | |
static std::string | reposFromUrn (const std::string &urn, bool strictUrn=false) |
Extract the repository name from a URN, or "" if none. More... | |
static bool | looksLikeUrn (const std::string &s, bool strict=false) |
Does s look like a URN? That is, does it start with URN_PREFIX or URN_PREFIX_ABBREV? More... | |
![]() | |
static boost::filesystem::path | installPathFor (const char *const productName) |
return the file path to the installation directory of a given named product. More... | |
Static Public Attributes | |
static const std::string | URN_PREFIX |
The prefix that a Policy URN starts with. More... | |
static const std::string | URN_PREFIX_ABBREV |
The prefix that a Policy URN starts with. More... | |
![]() | |
static const std::string | EXT_PAF |
static const std::string | EXT_XML |
the PAF file extension, ".paf" More... | |
static const boost::regex | SPACE_RE |
the XML file extension, ".xml" More... | |
static const boost::regex | COMMENT |
reg-exp for an empty line More... | |
static const boost::regex | CONTENTID |
reg-exp for the start of a comment More... | |
![]() | |
static SupportedFormats::Ptr | defaultFormats |
returns true if the given string containing a content identifier indicates that it contains dictionary data. More... | |
Additional Inherited Members | |
![]() | |
boost::filesystem::path | _file |
the path to the underlying policy file More... | |
![]() | |
SupportedFormats::Ptr | _formats |
A Policy file in the installation directory of an LSST product, referred to using a URN.
For use of URN references in PAF-formatted policy files, see Policy Authoring Format.
The syntax is urn:eupspkg:[PRODUCT_NAME][:REPOSITORY]:PATH, although "urn:eupspkg:" may optionally be abbreviated with "@". PRODUCT_NAME is the name of an LSST product (see DefaultPolicyFile for more details on LSST product installation dirs), and REPOSITORY is a subdirectory, which other references within the Policy will be relative to (see Policy for more details on repositories).
For example:
Caveat: Only supports Dictionary's "DictionaryFile" directive if the value is prefixed like a normal URN reference with "@urn:eupspkg:" or "@@".
Definition at line 68 of file UrnPolicyFile.h.
|
inlineexplicit |
Construct a new policy file reference from a URN.
Basically, the only required element is a colon, separating the product directory from the local path.
urn | The URN of the policy file. A prefix such as "urn:eupspkg:" or "@" is optional. |
strictUrn | if true, the URN must strictly begin with "@urn:eupspkg:" or "urn:eupspkg:". |
strictLoads | if true (default), load() will throw an exception if it encounters recoverable parsing errors in the underlying file (or any of the files it references). Otherwise, the loaded Policy will be incomplete. This is identical to the strict argument to Policy's loadPolicyFiles(). |
Definition at line 85 of file UrnPolicyFile.h.
|
static |
Extract the local file path from a URN.
For example,
|
static |
Does s
look like a URN? That is, does it start with URN_PREFIX or URN_PREFIX_ABBREV?
s | the string to be tested |
strict | if false, "@" will be accepted as a substitute for "urn:eupspkg:"; if true, urn:eupspkg must be present. |
|
static |
Extract the product name from a URN.
For example,
|
static |
Extract the repository name from a URN, or "" if none.
For example,
|
static |
The prefix that a Policy URN starts with.
May be abbreviated as "@".
Definition at line 125 of file UrnPolicyFile.h.
|
static |
The prefix that a Policy URN starts with.
May be abbreviated as "@".
Definition at line 126 of file UrnPolicyFile.h.