LSSTApplications  10.0+286,10.0+36,10.0+46,10.0-2-g4f67435,10.1+152,10.1+37,11.0,11.0+1,11.0-1-g47edd16,11.0-1-g60db491,11.0-1-g7418c06,11.0-2-g04d2804,11.0-2-g68503cd,11.0-2-g818369d,11.0-2-gb8b8ce7
LSSTDataManagementBasePackage
Public Member Functions | Static Public Member Functions | Private Attributes | List of all members
lsst::pex::policy::UrnPolicyFile Class Reference

A Policy file in the installation directory of an LSST product, referred to using a URN. More...

#include <UrnPolicyFile.h>

Inheritance diagram for lsst::pex::policy::UrnPolicyFile:
lsst::pex::policy::DefaultPolicyFile lsst::pex::policy::PolicyFile lsst::pex::policy::PolicySource lsst::daf::base::Persistable lsst::daf::base::Citizen

Public Member Functions

 UrnPolicyFile (const std::string &urn, bool strictUrn=false, bool strictLoads=true)
 
- Public Member Functions inherited from lsst::pex::policy::DefaultPolicyFile
 DefaultPolicyFile (const char *const productName, const std::string &filepath, const std::string &repos="", bool strict=true)
 
virtual boost::filesystem::path getInstallPath (const char *const productName)
 
const boost::filesystem::path & getRepositoryPath () const
 
virtual void load (Policy &policy) const
 
- Public Member Functions inherited from lsst::pex::policy::PolicyFile
 PolicyFile (const SupportedFormats::Ptr &fmts=defaultFormats)
 
const std::string getPath () const
 
bool exists () const
 
virtual const std::string & getFormatName ()
 
const std::string & getFormatName () const
 
 PolicyFile (const std::string &filepath, const SupportedFormats::Ptr &fmts=defaultFormats)
 
 PolicyFile (const char *filepath, const SupportedFormats::Ptr &fmts=defaultFormats)
 
 PolicyFile (const boost::filesystem::path &filepath, const SupportedFormats::Ptr &fmts=defaultFormats)
 
 PolicyFile (const std::string &filepath, const PolicyParserFactory::Ptr &parserFactory)
 
 PolicyFile (const boost::filesystem::path &filepath, const PolicyParserFactory::Ptr &parserFactory)
 
 PolicyFile (const std::string &filepath, const boost::filesystem::path &reposDir, const SupportedFormats::Ptr &fmts=defaultFormats)
 
 PolicyFile (const boost::filesystem::path &filepath, const boost::filesystem::path &reposDir, const SupportedFormats::Ptr &fmts=defaultFormats)
 
 PolicyFile (const std::string &filepath, const boost::filesystem::path &reposDir, const PolicyParserFactory::Ptr &parserFactory)
 
 PolicyFile (const boost::filesystem::path &filepath, const boost::filesystem::path &reposDir, const PolicyParserFactory::Ptr &parserFactory)
 
virtual void load (Policy &policy)
 
- Public Member Functions inherited from lsst::pex::policy::PolicySource
 PolicySource (SupportedFormats::Ptr fmts=defaultFormats)
 
virtual ~PolicySource ()
 
- Public Member Functions inherited from lsst::daf::base::Citizen
 Citizen (const std::type_info &)
 
 Citizen (Citizen const &)
 
 ~Citizen ()
 
Citizenoperator= (Citizen const &)
 
std::string repr () const
 Return a string representation of a Citizen. More...
 
void markPersistent (void)
 Mark a Citizen as persistent and not destroyed until process end. More...
 
memId getId () const
 Return the Citizen's ID. More...
 
- Public Member Functions inherited from lsst::daf::base::Persistable
 Persistable (void)
 
virtual ~Persistable (void)
 
template<class Archive >
void serialize (Archive &, unsigned int const)
 

Static Public Member Functions

static std::string productNameFromUrn (const std::string &urn, bool strictUrn=false)
 
static std::string filePathFromUrn (const std::string &urn, bool strictUrn=false)
 
static std::string reposFromUrn (const std::string &urn, bool strictUrn=false)
 
static bool looksLikeUrn (const std::string &s, bool strict=false)
 
- Static Public Member Functions inherited from lsst::pex::policy::DefaultPolicyFile
static boost::filesystem::path installPathFor (const char *const productName)
 
- Static Public Member Functions inherited from lsst::daf::base::Citizen
static bool hasBeenCorrupted ()
 Check all allocated blocks for corruption. More...
 
static memId getNextMemId ()
 Return the memId of the next object to be allocated. More...
 
static int init ()
 Called once when the memory system is being initialised. More...
 
static int census (int, memId startingMemId=0)
 How many active Citizens are there? More...
 
static void census (std::ostream &stream, memId startingMemId=0)
 Print a list of all active Citizens to stream, sorted by ID. More...
 
static const std::vector
< const Citizen * > * 
census ()
 Return a (newly allocated) std::vector of active Citizens sorted by ID. More...
 
static memId setNewCallbackId (memId id)
 Call the NewCallback when block is allocated. More...
 
static memId setDeleteCallbackId (memId id)
 Call the current DeleteCallback when block is deleted. More...
 
static memNewCallback setNewCallback (memNewCallback func)
 Set the NewCallback function. More...
 
static memCallback setDeleteCallback (memCallback func)
 Set the DeleteCallback function. More...
 
static memCallback setCorruptionCallback (memCallback func)
 Set the CorruptionCallback function. More...
 

Static Public Attributes

static const std::string URN_PREFIX
 
static const std::string URN_PREFIX_ABBREV
 
- Static Public Attributes inherited from lsst::pex::policy::PolicyFile
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 Public Attributes inherited from lsst::pex::policy::PolicySource
static SupportedFormats::Ptr defaultFormats
 

Private Attributes

const std::string _urn
 

Additional Inherited Members

- Public Types inherited from lsst::daf::base::Citizen
enum  { magicSentinel = 0xdeadbeef }
 
typedef unsigned long memId
 Type of the block's ID. More...
 
typedef memId(* memNewCallback )(const memId cid)
 A function used to register a callback. More...
 
typedef memId(* memCallback )(const Citizen *ptr)
 
- Public Types inherited from lsst::daf::base::Persistable
typedef boost::shared_ptr
< Persistable
Ptr
 
- Protected Attributes inherited from lsst::pex::policy::PolicyFile
boost::filesystem::path _file
 
- Protected Attributes inherited from lsst::pex::policy::PolicySource
SupportedFormats::Ptr _formats
 

Detailed Description

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.

Constructor & Destructor Documentation

lsst::pex::policy::UrnPolicyFile::UrnPolicyFile ( const std::string &  urn,
bool  strictUrn = false,
bool  strictLoads = true 
)
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.

Parameters
urnThe URN of the policy file. A prefix such as "urn:eupspkg:" or "@" is optional.
strictUrnif true, the URN must strictly begin with "@urn:eupspkg:" or "urn:eupspkg:".
strictLoadsif 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.

88  : DefaultPolicyFile(productNameFromUrn(urn, strictUrn).c_str(),
89  filePathFromUrn(urn, strictUrn),
90  reposFromUrn(urn, strictUrn),
91  strictLoads),
92  _urn(urn) {}
DefaultPolicyFile(const char *const productName, const std::string &filepath, const std::string &repos="", bool strict=true)
static std::string productNameFromUrn(const std::string &urn, bool strictUrn=false)
static std::string reposFromUrn(const std::string &urn, bool strictUrn=false)
static std::string filePathFromUrn(const std::string &urn, bool strictUrn=false)

Member Function Documentation

static std::string lsst::pex::policy::UrnPolicyFile::filePathFromUrn ( const std::string &  urn,
bool  strictUrn = false 
)
static

Extract the local file path from a URN. For example,

  • "@urn:eupspkg:product:repos:PATH/TO/FILE.PAF"
  • "@@product:repos:PATH/TO/FILE.PAF"
  • "@product:PATH/TO/FILE.PAF"
static bool lsst::pex::policy::UrnPolicyFile::looksLikeUrn ( const std::string &  s,
bool  strict = false 
)
static

Does s look like a URN? That is, does it start with URN_PREFIX or URN_PREFIX_ABBREV?

Parameters
sthe string to be tested
strictif false, "@" will be accepted as a substitute for "urn:eupspkg:"; if true, urn:eupspkg must be present.
static std::string lsst::pex::policy::UrnPolicyFile::productNameFromUrn ( const std::string &  urn,
bool  strictUrn = false 
)
static

Extract the product name from a URN. For example,

  • @urn:eupspkg:PRODUCT:repos:path/to/file.paf
  • @@PRODUCT:repos:path/to/file.paf
  • @PRODUCT:path/to/file.paf
static std::string lsst::pex::policy::UrnPolicyFile::reposFromUrn ( const std::string &  urn,
bool  strictUrn = false 
)
static

Extract the repository name from a URN, or "" if none. For example,

  • "@urn:eupspkg:product:REPOS:path/to/file.paf"
  • "@@product:REPOS:path/to/file.paf"
  • "@product:path/to/file.paf" – no repository, returns ""

Member Data Documentation

const std::string lsst::pex::policy::UrnPolicyFile::_urn
private

Definition at line 140 of file UrnPolicyFile.h.

const std::string lsst::pex::policy::UrnPolicyFile::URN_PREFIX
static

The prefix that a Policy URN starts with. May be abbreviated as "@".

Definition at line 125 of file UrnPolicyFile.h.

const std::string lsst::pex::policy::UrnPolicyFile::URN_PREFIX_ABBREV
static

The prefix that a Policy URN starts with. May be abbreviated as "@".

Definition at line 126 of file UrnPolicyFile.h.


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