nidas v1.2.3
Public Member Functions | Static Public Member Functions | Protected Attributes | Static Private 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.
 
 ~FsMount ()
 
FsMountoperator= (const FsMount &rhs)
 Assignment.
 
void setDir (const std::string &val)
 Set the mount point directory.
 
const std::string & getDir () const
 
const std::string & getDirExpanded () const
 Get the mount point directory, with environment variables expanded.
 
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.
 
void mount ()
 Synchronous mount request (on return the file system is mounted).
 
void autoMount ()
 Just issue a "mount /dir" command.
 
void mount (FileSet *)
 Asynchronous mount request.
 
void unmount ()
 
void cancel ()
 
void finished ()
 
void fromDOMElement (const xercesc::DOMElement *node)
 
virtual xercesc::DOMElement * toDOMParent (xercesc::DOMElement *parent, bool complete) const
 Create a DOMElement and append it to the parent.
 
virtual xercesc::DOMElement * toDOMElement (xercesc::DOMElement *node, bool complete) const
 Add my content into a DOMElement.
 

Static Public Member Functions

static const XMLChgetNamespaceURI ()
 

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
 

Static Private Attributes

static XMLChnamespaceURI = 0
 

Detailed Description

Filesystem mounter/unmounter.

Constructor & Destructor Documentation

◆ FsMount() [1/2]

FsMount::FsMount ( )

◆ FsMount() [2/2]

FsMount::FsMount ( const FsMount & x)

Copy.

◆ ~FsMount()

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

Member Function Documentation

◆ autoMount()

void FsMount::autoMount ( )

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.

Exceptions
nidas::util::IOException

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

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

◆ cancel()

void FsMount::cancel ( )

◆ finished()

void FsMount::finished ( )

◆ fromDOMElement()

void FsMount::fromDOMElement ( const xercesc::DOMElement * node)
virtual

◆ getDevice()

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

References _device.

Referenced by cancel().

◆ getDeviceExpanded()

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

References _deviceExpanded.

Referenced by mount().

◆ getDir()

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

References _dir.

◆ getDirExpanded()

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

Get the mount point directory, with environment variables expanded.

References _dirExpanded.

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

◆ getNamespaceURI()

static const XMLCh * nidas::core::DOMable::getNamespaceURI ( )
inlinestaticinherited

◆ getOptions()

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

References _options.

Referenced by mount().

◆ getType()

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

References _type.

Referenced by mount().

◆ isMounted()

bool FsMount::isMounted ( )

◆ mount() [1/2]

void FsMount::mount ( )

◆ mount() [2/2]

void FsMount::mount ( FileSet * fset)

Asynchronous mount request.

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

Exceptions
nidas::util::IOException

References _fileset, _worker, _workerLock, cancel(), nidas::core::getSample(), isMounted(), nidas::core::FileSet::mounted(), and nidas::util::Thread::start().

◆ operator=()

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

Assignment.

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

◆ setDevice()

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

◆ setDir()

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::core::getSample().

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

◆ setOptions()

void nidas::core::FsMount::setOptions ( const std::string & val)
inline

References _options, and nidas::core::getSample().

Referenced by fromDOMElement().

◆ setType()

void nidas::core::FsMount::setType ( const std::string & val)
inline

References _type, and nidas::core::getSample().

Referenced by fromDOMElement().

◆ toDOMElement()

xercesc::DOMElement * DOMable::toDOMElement ( xercesc::DOMElement * node,
bool complete ) const
virtualinherited

◆ toDOMParent()

xercesc::DOMElement * DOMable::toDOMParent ( xercesc::DOMElement * parent,
bool complete ) const
virtualinherited

Create a DOMElement and append it to the parent.

Exceptions
xercesc::DOMException

Reimplemented in nidas::core::DSMConfig, nidas::core::DSMSensor, nidas::core::Project, nidas::core::SampleTag, nidas::core::Site, nidas::core::ServerSocket, and nidas::core::Variable.

◆ unmount()

void FsMount::unmount ( )

Member Data Documentation

◆ _device

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

Referenced by getDevice(), and setDevice().

◆ _deviceExpanded

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

Referenced by getDeviceExpanded(), and setDevice().

◆ _deviceMsg

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

Referenced by mount(), and setDevice().

◆ _dir

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

Referenced by getDir(), and setDir().

◆ _dirExpanded

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

Referenced by getDirExpanded(), and setDir().

◆ _dirMsg

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

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

◆ _fileset

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

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

◆ _mountProcess

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

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

◆ _options

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

Referenced by getOptions(), operator=(), and setOptions().

◆ _type

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

Referenced by getType(), operator=(), and setType().

◆ _umountProcess

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

Referenced by cancel(), and unmount().

◆ _worker

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

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

◆ _workerLock

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

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

◆ namespaceURI

XMLCh * DOMable::namespaceURI = 0
staticprivateinherited

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