Purpose:
dkResource is a common abstract class used to represent resources and provides a generic interface to resource object functions. It can represent a simple LOB (large object) or a more complex type defined by the user, such as video stream, audio, large text, and so forth. A resource object consists of a content, usually a LOB (large object), and the meta-data or attributes describing the content. To implement more specific resource types in your application, subclass dkResource. Currently, this class library provides the following subclasses:
Since: Version 8
Class summary:
class DKEXPORT dkResource : public DKDDO, public dkXDO { public: virtual ~dkResource(); virtual const DKPid* getPidObject(); virtual void setPidObject(const DKPid* aPid); virtual dkDataObjectBase& add(); virtual dkDataObjectBase& add(const char* aFullFileName); virtual dkDataObjectBase& retrieve(); virtual dkDataObjectBase& retrieve(const char* aFileName); virtual dkDataObjectBase& update(); virtual dkDataObjectBase& update(const char* aFileName); virtual dkDataObjectBase& del(); virtual dkDataObjectBase& del(DKBoolean flush); virtual dkDataObjectBase& getContentToClientFile(const char* afileName,int fileOption) const =0; virtual dkDataObjectBase& setContentFromClientFile(const char* afileName) =0; virtual dkDataObjectBase& operator= (const dkDataObjectBase& aXDO); virtual dkDataObjectBase& copyData(const dkXDO& adkXDO) = 0; virtual DKBoolean compareData(const dkXDO& adkXDO); virtual void setDatastore(dkDatastore* ds); virtual dkDatastore* getDatastore() const; virtual DKBoolean isContentChanged() const = 0; virtual DKBoolean isSet() const = 0; short protocol() const; virtual long length() const; virtual long size(); virtual dkXDO* cloneSkeleton() = 0; virtual unsigned long getAffiliatedType(); // for ANNOTATION, NOTES, etc virtual void setAffiliatedType(unsigned long affiliatedType); virtual DKString getMimeType(); virtual void setMimeType(const char* mimeType); virtual DKString getContentType(); // e.g: ASCII, JPG, AVI, GIF, etc. virtual void setContentType(const char* contentType); virtual DKString getContent() const = 0; virtual dkDataObjectBase& setContent(const DKString& astring) = 0; virtual void getOption (long option, DKAny& value); virtual void setOption (long option, DKAny& value); virtual long getRank (); virtual void setRank (long aRank); virtual void addExtension(const char* extensionName, dkExtension* extensionObj); virtual void removeExtension(const char* extensionName); virtual const dkExtension* getExtension(const char* extensionName); virtual DKString getClassName(); virtual void setClassName(const char* className); };
Members:
virtual ~dkResource();
Parameters:ds - A datastore object
virtual void setDatastore(dkDatastore* ds);
Returns: the datastore object
virtual dkDatastore* getDatastore();
Returns: A reference to this resource object
virtual dkDataObjectBase& add();
Note: DKUsageError exception is thrown if this method is not implemented.
Parameters:aFullFileName - a fully qualified path and file name, The default is in the current directory
Returns:a reference to this resource object
virtual dkDataObjectBase& add(const char* aFullFileName);
Note: DKUsageError exception is thrown if this method is not implemented.
Returns: a reference to this resource object
virtual dkDataObjectBase& retrieve();
Parameters: aFileName - a fully qualified path and file name, The default is in the current directory
Returns: A reference to this resource object
virtual dkDataObjectBase& retrieve(const char* aFileName);
Note: DKUsageError exception is thrown if this method is not implemented.
Returns: A reference to this resource object
virtual dkDataObjectBase& update();
Parameters: aFileName - a fully qualified path and file name, The default is in the current directory
Returns: A reference to this resource object
virtual dkDataObjectBase& update(const char* aFileName);
Note: DKUsageError exception is thrown if this method is not implemented.
Parameters: aFileName - a fully qualified path and file name, The default is in the current directory
Returns: A reference to this resource object
virtual dkDataObjectBase& update(const char* aFileName);
Note: DKUsageError exception is thrown if this method is not implemented.
Returns:A reference to this resource object
virtual dkDataObjectBase& del();
Note: DKUsageError exception is thrown if this method is not implemented.
Parameters: flush - if true the memory content will be flush, if false and content is not set, the object will be retrieved before delete it. The default is to flush.
Returns:A reference to this resource object
virtual dkDataObjectBase& del(DKBoolean flush);
Note: DKUsageError exception is thrown if this method is not implemented.
Parameters: afileName - a fully qualified path with file name, default is current directory(if no path) fileOption -
Returns:A reference to this resource object
virtual dkDataObjectBase& getContentToClientFile(const char* afileName, int fileOption) const =0;
Parameters: afileName - a fully qualified path with file name, if no path, the default is in the current directory
Returns:A reference to this resource object
virtual dkDataObjectBase& setContentFromClientFile(const char* afileName) =0;
Returns: a copy of the persistent ID object of this object
virtual const DKPid* getPidObject();
Parameters: aPid - a DKPid object
virtual void setPidObject(const DKPid* aPid);
Parameters: aXDO - a resource object
Returns: A reference to this resource object
virtual dkDataObjectBase& operator= (const dkDataObjectBase& aXDO);
Parameters: adkXDO - a resource object
Returns: A reference to this resource object
virtual dkDataObjectBase& copyData(const dkXDO& adkXDO) = 0;
Note: DKUsageError exception is thrown if this method is not implemented.
Parameters: adkXDO - a resource object
Returns:TRUE if content of this object is equal. Otherwise FALSE.
virtual DKBoolean compareData(const dkXDO& adkXDO);
Note: DKUsageError exception is thrown if this method is not implemented.
Returns:TRUE if the content is changed; FALSE otherwise.
virtual DKBoolean isContentChanged() const = 0;
Returns:TRUE if the content is set; FALSE otherwise.
virtual DKBoolean isSet() const = 0;
Returns:The protocol "DK_CM_RESOURCE"
short protocol() const;
Returns:Length of this resource content in memory
virtual long length() const;
Note: DKUsageError exception is thrown if this method is not implemented.
Returns:Length of this resource content in the persistent store
virtual long size();
Note: DKUsageError exception is thrown if this method is not implemented.
Returns:Length of this resource content in the persistent store
virtual long size();
Note: DKUsageError exception is thrown if this method is not implemented.
Returns:The new resource
virtual dkXDO* cloneSkeleton() = 0;
Note: DKUsageError exception is thrown if this method is not implemented.
Returns:The affiliated type for this object, for example: DK_CM_ANNOTATION, DK_CM_NOTE, etc.
virtual unsigned long getAffiliatedType();
Note: DKUsageError exception is thrown if this method is not implemented.
Parameters:affiliatedType - the affiliated type
virtual void setAffiliatedType(unsigned long affiliatedType);
Note: DKUsageError exception is thrown if this method is not implemented.
Returns:The MIME type for this object
virtual DKString getMimeType();
Parameters:mimeType - the MIME type
virtual void setMimeType(const char* mimeType);
Note: DKUsageError exception is thrown if this method is not implemented.
Returns:The content type for this object. If not supported empty string is returned. This is the default.
virtual DKString getContentType();
Parameters:contentType - the content type
virtual void setContentType(const char* contentType);
Note: DKUsageError exception is thrown if this method is not implemented.
Returns:The object content
virtual DKString getContent() const = 0;
Note: DKException exception is thrown if a problem is encountered.
Parameters:astring - the object content
Returns:Return a reference to this resource object
virtual dkDataObjectBase& setContent(const DKString& astring) = 0;
Note: DKException exception is thrown if a problem is encountered.
Parameters:option - a specified option value - object contains the option value
virtual void getOption (long option, DKAny& value);
Note: DKUsageError exception is thrown if this method is not implemented.
Parameters:option - a specified option value - object contains the option value
virtual void getOption (long option, DKAny& value);
Note: DKUsageError exception is thrown if this method is not implemented.
Returns:aRank - a ranking value
virtual long getRank();
Parameters:aRank - a ranking value
virtual void setRank (long aRank);
Parameters:extensionName - the extension name extensionObj - a source extension object
virtual void addExtension(const char* extensionName, dkExtension* extensionObj);
Note: DKUsageError exception is thrown if this method is not implemented.
Parameters:extensionName - the extension name
virtual void removeExtension(const char* extensionName);
Note: DKUsageError exception is thrown if this method is not implemented.
Parameters:extensionName - the extension name
Returns:a dkExtension object
virtual const dkExtension* getExtension(const char* extensionName);
Note: DKUsageError exception is thrown if this method is not implemented.
Returns:A class name
virtual DKString getClassName();
Parameters:className - the class name
virtual void setClassName(const char* className);
(c) Copyright International Business Machines Corporation 1996, 2003. IBM Corp. All rights reserved.