sbMetadataJob Class Reference

#include <sbMetadataJob.h>

Inheritance diagram for sbMetadataJob:
[legend]
Collaboration diagram for sbMetadataJob:
[legend]

Public Types

enum  JobType { TYPE_READ = 0, TYPE_WRITE = 1 }
 

Public Member Functions

 sbMetadataJob ()
 
virtual ~sbMetadataJob ()
 
nsresult Init (nsIArray *aMediaItemsArray, nsIStringEnumerator *aRequiredProperties, JobType aJobType)
 
nsresult AppendMediaItems (nsIArray *aMediaItemsArray)
 
nsresult AppendJobItem (sbMetadataJobItem *aJobItem)
 
nsresult OnJobProgress ()
 
nsresult GetQueuedItem (PRBool aMainThreadOnly, sbMetadataJobItem **aJobItem)
 
nsresult PutProcessedItem (sbMetadataJobItem *aJobItem)
 
nsresult GetType (JobType *aJobType)
 
nsresult SetBlocked (PRBool aBlocked)
 
- Public Member Functions inherited from sbIJobProgress
nsIStringEnumerator getErrorMessages ()
 Enumerate all the errors encountered during the job. More...
 
void addJobProgressListener (in sbIJobProgressListener aListener)
 Add a listener to be notified when significant job progress has been made. More...
 
void removeJobProgressListener (in sbIJobProgressListener aListener)
 Remove a previously added listener. More...
 
- Public Member Functions inherited from sbIJobCancelable
void cancel ()
 Attempt to cancel the job Throws NS_ERROR_FAILURE if canceling fails. More...
 
- Public Member Functions inherited from sbIAlbumArtListener
void onChangeFetcher (in sbIAlbumArtFetcher aFetcher)
 onChangeFetcher - Notifies the listener when the fetcher being used has changed. This is used from the sbIAlbumArtFetcherSet component. More...
 
void onTrackResult (in nsIURI aImageLocation, in sbIMediaItem aMediaItem)
 onTrackResult - Notifies the listener when either an image has or has not been found. aImageLocation will be null if the operation failed to get artwork. More...
 
void onAlbumResult (in nsIURI aImageLocation, in nsIArray aMediaItems)
 onAlbumResult - Notifies the listener when either an image has or has not been found for a list of items. aImageLocation will be null if the operation failed to get artwork. More...
 
void onSearchComplete (in nsIArray aMediaItems)
 onSearchComplete - Notifies the listener that the search for artwork has been completed. More...
 

Friends

class sbMediaListBatchCallback
 

Additional Inherited Members

- Public Attributes inherited from sbIJobProgressUI
readonly attribute DOMString crop
 
- Public Attributes inherited from sbIJobProgress
const unsigned short STATUS_FAILED = 0x00
 Constant indicating that the job has completed with errors. More...
 
const unsigned short STATUS_SUCCEEDED = 0x10
 Constant indicating that the job has completed. More...
 
const unsigned short STATUS_RUNNING = 0x20
 Constant indicating that the job is active. More...
 
readonly attribute unsigned short status
 Current status of the job. More...
 
readonly attribute boolean blocked
 If true, progress of job is blocked (e.g., due to locked resource). More...
 
readonly attribute AString statusText
 Localized message describing the status of the job. More...
 
readonly attribute AString titleText
 Localized message describing the type or purpose of the job. More...
 
readonly attribute unsigned long progress
 Number of work units completed. More...
 
readonly attribute unsigned long total
 Total number of work units to be completed May be set to 0 if the job length is indeterminate. More...
 
readonly attribute unsigned long errorCount
 Number of errors that have been encountered. More...
 
- Public Attributes inherited from sbIJobCancelable
readonly attribute boolean canCancel
 True if it is possible to cancel the job. More...
 

Detailed Description

A container of sbMetadataJobItems representing a request to sbFileMetadataService. Provides feedback to the caller via sbIJobProgress, and allows the request to be cancelled via sbIJobCancelable.

Expects job items to be taken from the container, processed, and then returned in a completed state. Responsible for preparing media item properties when writing, and filtering and setting propertes when reading.

All interactions other than GetQueuedItem and PutProcessedItem must be performed on the main thread.

Definition at line 80 of file sbMetadataJob.h.

Member Enumeration Documentation

Enumerator
TYPE_READ 
TYPE_WRITE 

Definition at line 95 of file sbMetadataJob.h.

Constructor & Destructor Documentation

sbMetadataJob::sbMetadataJob ( )
sbMetadataJob::~sbMetadataJob ( )
virtual

Definition at line 149 of file sbMetadataJob.cpp.

Member Function Documentation

nsresult sbMetadataJob::AppendJobItem ( sbMetadataJobItem aJobItem)

Append an existing job item to the queue.

Parameters
aJobItemThe job item to append to the queue.

Definition at line 401 of file sbMetadataJob.cpp.

Here is the call graph for this function:

nsresult sbMetadataJob::AppendMediaItems ( nsIArray *  aMediaItemsArray)

Add additional media items to the job.

Notes:

  • *** MAIN THREAD ONLY ***
  • All media items must be from the same library
Parameters
aMediaItemsArrayArray of sbIMediaItems

Definition at line 253 of file sbMetadataJob.cpp.

Here is the caller graph for this function:

nsresult sbMetadataJob::GetQueuedItem ( PRBool  aMainThreadOnly,
sbMetadataJobItem **  aJobItem 
)

Take a waiting job item for processing. Will prepare job item properties and handler appropriately

May be called off of the main thread.

Parameters
aMainThreadOnlyIf true, will return a job item that needs to be run on the main thread due to implementation details.
aJobItemThe job item to be processed
Returns
NS_ERROR_NOT_AVAILABLE if there are no more items in the queue

Definition at line 515 of file sbMetadataJob.cpp.

Here is the call graph for this function:

nsresult sbMetadataJob::GetType ( JobType aJobType)

TYPE_READ or TYPE_WRITE

Definition at line 1320 of file sbMetadataJob.cpp.

nsresult sbMetadataJob::Init ( nsIArray *  aMediaItemsArray,
nsIStringEnumerator aRequiredProperties,
JobType  aJobType 
)

Initialize the job with the given media items. Called by sbFileMetadataService when a request is received.

Notes:

  • *** MAIN THREAD ONLY ***
  • All media items must be from the same library
Parameters
aMediaItemsArrayArray of sbIMediaItems
aRequiredPropertiesArray of nsStrings for properties to use.
aJobTypeOperation to perform (TYPE_READ or TYPE_WRITE)

Definition at line 166 of file sbMetadataJob.cpp.

Here is the call graph for this function:

nsresult sbMetadataJob::OnJobProgress ( )

Notify listeners of job progress. To be called periodically by the main thread timer in sbFileMetadataService.

Definition at line 1249 of file sbMetadataJob.cpp.

Here is the call graph for this function:

nsresult sbMetadataJob::PutProcessedItem ( sbMetadataJobItem aJobItem)

Give back a job item after processing has been attempted. Records progress and may perform additional processing on the item.

May be called off of the main thread.

Parameters
aJobItemThe job item that has been processed

Definition at line 581 of file sbMetadataJob.cpp.

Here is the caller graph for this function:

nsresult sbMetadataJob::SetBlocked ( PRBool  aBlocked)

Set the job blocked status to the value specified by aBlocked.

Parameters
aBlockedJob blocked status.

Definition at line 1328 of file sbMetadataJob.cpp.

Friends And Related Function Documentation

friend class sbMediaListBatchCallback
friend

Definition at line 85 of file sbMetadataJob.h.


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