nidas  v1.2-1520
Public Member Functions | Static Public Member Functions | Protected Attributes | List of all members
nidas::core::FsMount Class Reference

Filesystem mounter/unmounter. More...

#include <FsMount.h>

Inheritance diagram for nidas::core::FsMount:
Inheritance graph
[legend]

Public Member Functions

 FsMount ()
 
 FsMount (const FsMount &x)
 Copy. More...
 
 ~FsMount ()
 
FsMountoperator= (const FsMount &rhs)
 Assignment. More...
 
void setDir (const std::string &val)
 Set the mount point directory. More...
 
const std::string & getDir () const
 
const std::string & getDirExpanded () const
 Get the mount point directory, with environment variables expanded. More...
 
void setDevice (const std::string &val)
 
const std::string & getDevice () const
 
const std::string & getDeviceExpanded () const
 
void setType (const std::string &val)
 
const std::string & getType () const
 
void setOptions (const std::string &val)
 
const std::string & getOptions () const
 
bool isMounted ()
 Reads /proc/mount to see if getDir() is mounted. More...
 
void mount () throw (nidas::util::IOException)
 Synchronous mount request (on return the file system is mounted). More...
 
void autoMount () throw (nidas::util::IOException)
 Just issue a "mount /dir" command. More...
 
void mount (FileSet *) throw (nidas::util::IOException)
 Asynchronous mount request. More...
 
void unmount () throw (nidas::util::IOException)
 
void cancel ()
 
void finished ()
 
void fromDOMElement (const xercesc::DOMElement *node) throw (nidas::util::InvalidParameterException)
 Initialize myself from a xercesc::DOMElement. More...
 
virtual xercesc::DOMElement * toDOMParent (xercesc::DOMElement *parent, bool complete) const throw (xercesc::DOMException)
 Create a DOMElement and append it to the parent. More...
 
virtual xercesc::DOMElement * toDOMElement (xercesc::DOMElement *node, bool complete) const throw (xercesc::DOMException)
 Add my content into a DOMElement. More...
 

Static Public Member Functions

static const XMLCh * getNamespaceURI ()
 

Protected Attributes

std::string _dir
 
std::string _dirExpanded
 
std::string _dirMsg
 
std::string _device
 
std::string _deviceExpanded
 
std::string _deviceMsg
 
std::string _type
 
std::string _options
 
FileSet_fileset
 
FsMountWorkerThread_worker
 
nidas::util::Mutex _workerLock
 
nidas::util::Process _mountProcess
 
nidas::util::Process _umountProcess
 

Detailed Description

Filesystem mounter/unmounter.

Constructor & Destructor Documentation

FsMount::FsMount ( )
FsMount::FsMount ( const FsMount x)

Copy.

nidas::core::FsMount::~FsMount ( )
inline

Member Function Documentation

void FsMount::autoMount ( )
throw (nidas::util::IOException
)

Just issue a "mount /dir" command.

If /dir is automounted then it may work, whereas "mount /dev/sdXn -o blahblah /dir" may fail for the user on a server.

References _dirMsg, _mountProcess, getDirExpanded(), ILOG, isMounted(), nidas::util::Process::outStream(), nidas::util::Process::spawn(), nidas::util::trimString(), and nidas::util::Process::wait().

Referenced by nidas::core::FsMountWorkerThread::run().

void FsMount::cancel ( )
void FsMount::finished ( )
void FsMount::fromDOMElement ( const xercesc::DOMElement *  )
throw (nidas::util::InvalidParameterException
)
virtual

Initialize myself from a xercesc::DOMElement.

Implements nidas::core::DOMable.

References nidas::core::XDOMAttr::getName().

const std::string& nidas::core::FsMount::getDevice ( ) const
inline

Referenced by cancel(), and operator=().

const std::string& nidas::core::FsMount::getDeviceExpanded ( ) const
inline

Referenced by mount().

const std::string& nidas::core::FsMount::getDir ( ) const
inline

Referenced by operator=().

const std::string& nidas::core::FsMount::getDirExpanded ( ) const
inline

Get the mount point directory, with environment variables expanded.

Referenced by autoMount(), isMounted(), mount(), and unmount().

static const XMLCh* nidas::core::DOMable::getNamespaceURI ( )
inlinestaticinherited
const std::string& nidas::core::FsMount::getOptions ( ) const
inline

Referenced by mount().

const std::string& nidas::core::FsMount::getType ( ) const
inline

Referenced by mount().

bool FsMount::isMounted ( )

Reads /proc/mount to see if getDir() is mounted.

References getDirExpanded().

Referenced by autoMount(), mount(), nidas::core::FileSet::mounted(), and unmount().

void FsMount::mount ( )
throw (nidas::util::IOException
)
void FsMount::mount ( FileSet fset)
throw (nidas::util::IOException
)

Asynchronous mount request.

finished() method will be called when mount is done. Does not own the FileSet pointer.

References nidas::util::Exception::what().

FsMount & FsMount::operator= ( const FsMount rhs)

Assignment.

References _fileset, _options, _type, _worker, getDevice(), getDir(), setDevice(), and setDir().

void FsMount::setDevice ( const std::string &  val)
void FsMount::setDir ( const std::string &  val)

Set the mount point directory.

It may contain environment variables, e.g.: $DATA, or ${DATA}.

References _dir, _dirExpanded, _dirMsg, and nidas::util::Process::expandEnvVars().

Referenced by operator=().

void nidas::core::FsMount::setOptions ( const std::string &  val)
inline
void nidas::core::FsMount::setType ( const std::string &  val)
inline
xercesc::DOMElement * DOMable::toDOMElement ( xercesc::DOMElement *  node,
bool  complete 
) const
throw (xercesc::DOMException
)
virtualinherited
xercesc::DOMElement * DOMable::toDOMParent ( xercesc::DOMElement *  parent,
bool  complete 
) const
throw (xercesc::DOMException
)
virtualinherited
void FsMount::unmount ( )
throw (nidas::util::IOException
)

Member Data Documentation

std::string nidas::core::FsMount::_device
protected

Referenced by setDevice().

std::string nidas::core::FsMount::_deviceExpanded
protected

Referenced by setDevice().

std::string nidas::core::FsMount::_deviceMsg
protected

Referenced by mount(), and setDevice().

std::string nidas::core::FsMount::_dir
protected

Referenced by setDir().

std::string nidas::core::FsMount::_dirExpanded
protected

Referenced by setDir().

std::string nidas::core::FsMount::_dirMsg
protected

Referenced by autoMount(), mount(), setDir(), and unmount().

FileSet* nidas::core::FsMount::_fileset
protected

Referenced by finished(), and operator=().

nidas::util::Process nidas::core::FsMount::_mountProcess
protected

Referenced by autoMount(), cancel(), and mount().

std::string nidas::core::FsMount::_options
protected

Referenced by operator=().

std::string nidas::core::FsMount::_type
protected

Referenced by operator=().

nidas::util::Process nidas::core::FsMount::_umountProcess
protected

Referenced by cancel(), and unmount().

FsMountWorkerThread* nidas::core::FsMount::_worker
protected

Referenced by cancel(), finished(), and operator=().

nidas::util::Mutex nidas::core::FsMount::_workerLock
protected

Referenced by cancel(), and finished().


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