CPP Device Virtualization API Reference for Oracle Internet of Things Cloud Service Client Software Library. Release 21.1.1.0.0-3. E92477-09
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Pages
iotdcl::StorageObject Class Reference
+ Inheritance diagram for iotdcl::StorageObject:

Public Member Functions

virtual ~StorageObject ()
 Destructor.
 
virtual const std::string & getName () const
 Get the the name of this object in the storage cloud. More...
 
virtual const std::string & getType () const
 Get the mime-type of the content. More...
 
virtual const std::string & getEncoding () const
 Get the compression scheme of the content. More...
 
virtual long getLength () const
 Get the length of the content in bytes. More...
 
virtual time_t getDate () const
 Get the date and time the content was created or last modified in cloud storage. More...
 
virtual SyncStatus getSyncStatus () const
 Get the status of whether or not the content is in sync with the storage cloud. More...
 
virtual const std::string & getInputPath () const
 Get the input path. More...
 
virtual void setInputPath (const std::string &inputPath) throw (GeneralException, std::invalid_argument)
 Set the input path for uploading content to the storage cloud. More...
 
virtual const std::string & getOutputPath () const
 Get the output path. More...
 
virtual void setOutputPath (const std::string &outputPath) throw (GeneralException, std::invalid_argument)
 Set the output path for downloading content from the storage cloud. More...
 
virtual void setCustomMetadata (const std::string &key, const std::string &value) throw (std::invalid_argument)
 Sets the metadata for the StorageObject. More...
 
virtual void sync () throw (GeneralException, std::invalid_argument)
 Notify the library to sync content with the storage cloud. More...
 
virtual void setOnSync (const SyncCallback *callback)
 Set a iotdcl::SyncCallback that is invoked when the content referred to by this StorageObject is synchronized. More...
 
virtual const std::string & getURI ()
 Get the URI value. More...
 
- Public Member Functions inherited from iotdcl::ExternalObject
virtual ~ExternalObject ()
 Destructor.
 
 ExternalObject (const std::string &uri)
 Create an iotdcl::ExternalObject. More...
 
virtual const std::string & getURI () const
 Get the URI value. More...
 

Protected Member Functions

void setVirtualDevice (VirtualDevice *vd)
 
iotcs_storage_object_handle c_handler () const
 

Protected Attributes

VirtualDevicevd
 
std::string * name
 
std::string * outPath
 
std::string * inPath
 
std::string * type
 
std::string * encoding
 
friend VirtualDevice
 
friend Alert
 
friend Data
 
- Protected Attributes inherited from iotdcl::ExternalObject
std::string * uri
 
iotcs_storage_object_handle storage_object_handle
 

Member Function Documentation

virtual time_t iotdcl::StorageObject::getDate ( ) const
virtual

Get the date and time the content was created or last modified in cloud storage.

This may be NULL if the content has not been uploaded. The date and time stamp format is ISO 8601.

Returns
The date the content was last modified in cloud storage, or NULL if the content has not been uploaded.
virtual const std::string& iotdcl::StorageObject::getEncoding ( ) const
virtual

Get the compression scheme of the content.

Returns
the compression scheme of the content, or empty string if the content is not compressed
virtual const std::string& iotdcl::StorageObject::getInputPath ( ) const
virtual

Get the input path.

Returns
the input path, or empty string if not set
virtual long iotdcl::StorageObject::getLength ( ) const
virtual

Get the length of the content in bytes.

This is the number of bytes required to upload or download the content.

Returns
The length of the content, or -1 if unknown
virtual const std::string& iotdcl::StorageObject::getName ( ) const
virtual

Get the the name of this object in the storage cloud.

Returns
the name of this object in the storage cloud
virtual const std::string& iotdcl::StorageObject::getOutputPath ( ) const
virtual

Get the output path.

Returns
the output path, or empty string if not set
virtual SyncStatus iotdcl::StorageObject::getSyncStatus ( ) const
virtual

Get the status of whether or not the content is in sync with the storage cloud.

Returns
the status of whether or not the content is in sync with the storage cloud.
virtual const std::string& iotdcl::StorageObject::getType ( ) const
virtual

Get the mime-type of the content.

See IANA Media Types.

Returns
The mime-type of the content
virtual const std::string& iotdcl::StorageObject::getURI ( )
virtual

Get the URI value.

Returns
the URI
virtual void iotdcl::StorageObject::setCustomMetadata ( const std::string &  key,
const std::string &  value 
)
throw (std::invalid_argument
)
virtual

Sets the metadata for the StorageObject.

All metdata will be added to Storage Cloud Service as custom metadata with the "X-Object-Meta-KeyName" header.

Parameters
keyThe metadata key
valueThe metadata value
Exceptions
std::invalid_argumentif the key or value is empty
std::invalid_argumentif the key or value is
NULL
Returns
IOTCS_RESULT_OK if succeeds.
virtual void iotdcl::StorageObject::setInputPath ( const std::string &  inputPath)
throw (GeneralException,
std::invalid_argument
)
virtual

Set the input path for uploading content to the storage cloud.

The implementation allows for either the input path to be set, or the output path to be set, but not both. If the inputPath parameter is not empty, the output path will empty If the inputPath parameter is not empty and does not equal the current input path, the sync status will be reset to SyncStatus::NOT_IN_SYNC}. This method will throw an std::invalid_argument if StorageObject::getSyncStatus() sync status is SyncStatus::SYNC_PENDING},

Parameters
inputPaththe path from which to read the content for upload
Exceptions
iotdcl::GeneralExceptionif the output path cannot be written
std::invalid_argumentif called when sync status is iotdcl::SyncStatus::SYNC_PENDING
virtual void iotdcl::StorageObject::setOnSync ( const SyncCallback callback)
virtual

Set a iotdcl::SyncCallback that is invoked when the content referred to by this StorageObject is synchronized.

Parameters
callbacka callback to invoke when there is an error setting a value, if NULL, the existing syncCallback will be removed
virtual void iotdcl::StorageObject::setOutputPath ( const std::string &  outputPath)
throw (GeneralException,
std::invalid_argument
)
virtual

Set the output path for downloading content from the storage cloud.

The implementation allows for either the output path to be set, or the input path to be set, but not both. If the outputPath parameter is not empty, the input path will be set to empty. If the outputPath parameter is not empty and does not equal the current output path, the sync status will be reset to iotdcl::SyncStatus::NOT_IN_SYNC. This method will throw an std::invalid_argument if the StorageObject.getSyncStatus() sync status is iotdcl::SyncStatus::SYNC_PENDING,

Parameters
outputPaththe path to which the content will be downloaded. If the path does not already exist, it will be created.
Exceptions
iotdcl::GeneralExceptionif the output path cannot be written
std::invalid_argumentif called when sync status is iotdcl::SyncStatus::SYNC_PENDING
virtual void iotdcl::StorageObject::sync ( )
throw (GeneralException,
std::invalid_argument
)
virtual

Notify the library to sync content with the storage cloud.

The direction of the sync, upload or download, depends on whether the setInputPath(std::string) input path or the setOutputPath(std::string) output path} has been set. This method does not start any uploads or downloads if getSyncStatus() sync status is other than iotdcl::SyncStatus::NOT_IN_SYNC.

This is a non-blocking call. The sync is performed on a separate thread. The status of the sync can be monitored by setting a iotdcl::SyncCallback on this StorageObject.

If the input path cannot be read, or the output path cannot be written, an iotdcl::GeneralException is thrown. Any I/O exceptions during the background sync are reported through the iotdcl::ErrorCallback error syncCallback} of the virtual device.

Exceptions
std::invalid_argumentif both input path and output path are empty

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