TICDSDocumentRegistrationOperation Class Reference
Inherits from | TICDSOperation : NSOperation |
Declared in | TICDSDocumentRegistrationOperation.h |
Overview
The TICDSDocumentRegistrationOperation
class describes a generic operation used by the TICoreDataSync
framework to register a document for future synchronization.
The operation carries out the following tasks:
- Subclass checks whether the
documentIdentifier
directory exists on the remote.- If not, ask the document sync manager whether to continue registering this document, and if not, bail, otherwise:
- Subclass creates the
documentIdentifier
directory on the remote, along with the general directory hierarchy. - Subclass saves the
documentInfo.plist
file at the root of the document hierarchy, encrypting it if necessary. - Continue by creating hierarchy for this client to synchronize this document.
- Subclass creates the
- If document has been registered before, subclass checks whether this client has synchronized this document before.
- If so, registration is complete.
- If not, continue by creating client’s directories for this document.
- If not, ask the document sync manager whether to continue registering this document, and if not, bail, otherwise:
- Subclass checks whether the client’s directory exists inside
SyncChanges
.- If so, registration is complete.
- If not, continue by creating client’s directories for this document.
- Subclass creates a directory for this client in this document’s
SyncChanges
andSyncCommands
directories.
Operations are typically created automatically by the relevant sync manager.
You must use one of the subclasses of TICDSDocumentRegistrationOperation
.
Tasks
Designated Initializer
-
– initWithDelegate:
Initialize a document registration operation using a delegate that supports the
TICDSDocumentRegistrationOperationDelegate
protocol.
Methods Overridden by Subclasses
-
– checkWhetherRemoteDocumentDirectoryExists
Check whether a remote directory exists for this document.
-
– checkWhetherRemoteDocumentWasDeleted
Check whether the document was previously deleted (i.e., whether an
identifier.plist
file exists in theDeletedDocuments
directory. -
– createRemoteDocumentDirectoryStructure
Create remote document directory structure.
-
– saveRemoteDocumentInfoPlistFromDictionary:
Save the dictionary to a
documentInfo.plist
file in this document’s directory. -
– saveIntegrityKey:
Save a file with the integrity key as its name to this document’s
IntegrityKey
directory. -
– fetchListOfIdentifiersOfAllRegisteredClientsForThisApplication
Fetch a list of all clients registered to synchronize with this application.
-
– addDeviceInfoPlistToDocumentDeletedClientsForClientWithIdentifier:
Copy the specified client’s
deviceInfo.plist
file into theDeletedClients
directory for this document, but name the copied file using the client’s identifier (identifier.plist
). -
– deleteDocumentInfoPlistFromDeletedDocumentsDirectory
Delete the
identifier.plist
file for this document from theDeletedDocuments
directory. -
– checkWhetherClientDirectoryExistsInRemoteDocumentSyncChangesDirectory
Check whether a directory exists for this client inside the document’s
SyncChanges
directory. -
– fetchRemoteIntegrityKey
Fetch the integrity key for this document.
-
– checkWhetherClientWasDeletedFromRemoteDocument
Check whether this client has previously been deleted from synchronizing with this document.
-
– deleteClientIdentifierFileFromDeletedClientsDirectory
Delete the client’s file from the document’s
DeletedClients
directory. -
– createClientDirectoriesInRemoteDocumentDirectories
Create directories for this client inside the
SyncChanges
andSyncCommands
directories for this client.
Callbacks
-
– discoveredStatusOfRemoteDocumentDirectory:
Indicate the status of the remote document directory.
-
– discoveredDeletionStatusOfRemoteDocument:
Indicate whether the document was previously deleted.
-
– createdRemoteDocumentDirectoryStructureWithSuccess:
Indicate whether the creation of the remote document directory structure was successful.
-
– savedRemoteDocumentInfoPlistWithSuccess:
Indicate whether the
documentInfo.plist
file was saved successfully. -
– savedIntegrityKeyWithSuccess:
Indicate whether the integrity key file was saved successfully.
-
– fetchedListOfIdentifiersOfAllRegisteredClientsForThisApplication:
Pass back the assembled
NSArray
of client identifiers registered to synchronize with the application. -
– addedDeviceInfoPlistToDocumentDeletedClientsForClientWithIdentifier:withSuccess:
Indicate whether the
deviceInfo.plist
file was copied asidentifier.plist
to theDeletedClients
directory for this document. -
– deletedDocumentInfoPlistFromDeletedDocumentsDirectoryWithSuccess:
Indicate whether the
identifier.plist
file for this document was removed from theDeletedDocuments
directory. -
– discoveredStatusOfClientDirectoryInRemoteDocumentSyncChangesDirectory:
Indicate the status of this client’s directory inside the remote document
SyncChanges
directory. -
– fetchedRemoteIntegrityKey:
Pass back the remote integrity key for this document.
-
– discoveredDeletionStatusOfClient:
Indicate whether the client has been deleted from synchronizing with this document.
-
– deletedClientIdentifierFileFromDeletedClientsDirectoryWithSuccess:
Indicate whether the client’s file in the document’s
RecentSyncs
directory was deleted successfully. -
– createdClientDirectoriesInRemoteDocumentDirectoriesWithSuccess:
Indicate whether the creation of the client directories was successful.
Properties
-
paused
Used to indicate whether the operation is currently paused awaiting input from the operation delegate, or in turn the document sync manager delegate.
property -
documentWasDeleted
Used to indicate whether the reason a document doesn’t exist is because it was deleted.
property -
shouldCreateDocumentFileStructure
Used by the
propertyTICDSDocumentSyncManager
to indicate whether to create the remote document file structure after finding out it doesn’t exist. -
clientHasPreviouslySynchronizedThisDocument
Used to keep track of whether the document has previously been synchronized by this client.
property -
documentIdentifier
The document identifier.
property -
documentDescription
The document description (typically a filename).
property -
clientDescription
The client description.
property -
documentUserInfo
The user info.
property -
integrityKey
The integrity key provided either by the client to check existing data matches integrity, or set during registration for new documents.
property
Properties
clientDescription
The client description.
@property (retain) NSString *clientDescription
Declared In
TICDSDocumentRegistrationOperation.h
clientHasPreviouslySynchronizedThisDocument
Used to keep track of whether the document has previously been synchronized by this client.
@property (assign) BOOL clientHasPreviouslySynchronizedThisDocument
Declared In
TICDSDocumentRegistrationOperation.h
documentDescription
The document description (typically a filename).
@property (retain) NSString *documentDescription
Declared In
TICDSDocumentRegistrationOperation.h
documentIdentifier
The document identifier.
@property (retain) NSString *documentIdentifier
Declared In
TICDSDocumentRegistrationOperation.h
documentUserInfo
The user info.
@property (retain) NSDictionary *documentUserInfo
Declared In
TICDSDocumentRegistrationOperation.h
documentWasDeleted
Used to indicate whether the reason a document doesn’t exist is because it was deleted.
@property (assign) BOOL documentWasDeleted
Declared In
TICDSDocumentRegistrationOperation.h
integrityKey
The integrity key provided either by the client to check existing data matches integrity, or set during registration for new documents.
@property (retain) NSString *integrityKey
Declared In
TICDSDocumentRegistrationOperation.h
paused
Used to indicate whether the operation is currently paused awaiting input from the operation delegate, or in turn the document sync manager delegate.
@property (assign, getter=isPaused) BOOL paused
Declared In
TICDSDocumentRegistrationOperation.h
shouldCreateDocumentFileStructure
Used by the TICDSDocumentSyncManager
to indicate whether to create the remote document file structure after finding out it doesn’t exist.
@property (assign) BOOL shouldCreateDocumentFileStructure
Declared In
TICDSDocumentRegistrationOperation.h
Instance Methods
addDeviceInfoPlistToDocumentDeletedClientsForClientWithIdentifier:
Copy the specified client’s deviceInfo.plist
file into the DeletedClients
directory for this document, but name the copied file using the client’s identifier (identifier.plist
).
- (void)addDeviceInfoPlistToDocumentDeletedClientsForClientWithIdentifier:(NSString *)anIdentifier
Parameters
- anIdentifier
The identifier of the client.
Discussion
This method must call `` to indicate whether the file was copied successfully.
Declared In
TICDSDocumentRegistrationOperation.h
addedDeviceInfoPlistToDocumentDeletedClientsForClientWithIdentifier:withSuccess:
Indicate whether the deviceInfo.plist
file was copied as identifier.plist
to the DeletedClients
directory for this document.
- (void)addedDeviceInfoPlistToDocumentDeletedClientsForClientWithIdentifier:(NSString *)anIdentifier withSuccess:(BOOL)success
Parameters
- success
YES
if the file was copied, otherwiseNO
.
Discussion
If not, call setError:
first, then specify NO
for success
.
Declared In
TICDSDocumentRegistrationOperation.h
checkWhetherClientDirectoryExistsInRemoteDocumentSyncChangesDirectory
Check whether a directory exists for this client inside the document’s SyncChanges
directory.
- (void)checkWhetherClientDirectoryExistsInRemoteDocumentSyncChangesDirectory
Discussion
This method must call discoveredStatusOfClientDirectoryInRemoteDocumentSyncChangesDirectory:
to indicate the status.
Declared In
TICDSDocumentRegistrationOperation.h
checkWhetherClientWasDeletedFromRemoteDocument
Check whether this client has previously been deleted from synchronizing with this document.
- (void)checkWhetherClientWasDeletedFromRemoteDocument
Discussion
This method must call discoveredDeletionStatusOfClient:
to indicate the status.
Declared In
TICDSDocumentRegistrationOperation.h
checkWhetherRemoteDocumentDirectoryExists
Check whether a remote directory exists for this document.
- (void)checkWhetherRemoteDocumentDirectoryExists
Discussion
This method must call discoveredStatusOfRemoteDocumentDirectory:
to indicate the status.
Declared In
TICDSDocumentRegistrationOperation.h
checkWhetherRemoteDocumentWasDeleted
Check whether the document was previously deleted (i.e., whether an identifier.plist
file exists in the DeletedDocuments
directory.
- (void)checkWhetherRemoteDocumentWasDeleted
Discussion
This method must call discoveredDeletionStatusOfRemoteDocument:
to indicate the status.
Declared In
TICDSDocumentRegistrationOperation.h
createClientDirectoriesInRemoteDocumentDirectories
Create directories for this client inside the SyncChanges
and SyncCommands
directories for this client.
- (void)createClientDirectoriesInRemoteDocumentDirectories
Discussion
This method must call createdClientDirectoriesInRemoteDocumentDirectoriesWithSuccess:
to indicate whether the creation was successful.
Declared In
TICDSDocumentRegistrationOperation.h
createRemoteDocumentDirectoryStructure
Create remote document directory structure.
- (void)createRemoteDocumentDirectoryStructure
Discussion
This method must call createdRemoteDocumentDirectoryStructureWithSuccess:
to indicate whether the creation was successful.
Declared In
TICDSDocumentRegistrationOperation.h
createdClientDirectoriesInRemoteDocumentDirectoriesWithSuccess:
Indicate whether the creation of the client directories was successful.
- (void)createdClientDirectoriesInRemoteDocumentDirectoriesWithSuccess:(BOOL)success
Parameters
- success
YES
if the directory structure was created, otherwiseNO
.
Discussion
If not, call setError:
first, then specify NO
for success
.
Declared In
TICDSDocumentRegistrationOperation.h
createdRemoteDocumentDirectoryStructureWithSuccess:
Indicate whether the creation of the remote document directory structure was successful.
- (void)createdRemoteDocumentDirectoryStructureWithSuccess:(BOOL)success
Parameters
- success
YES
if the directory structure was created, otherwiseNO
.
Discussion
If not, call setError:
first, then specify NO
for success
.
Declared In
TICDSDocumentRegistrationOperation.h
deleteClientIdentifierFileFromDeletedClientsDirectory
Delete the client’s file from the document’s DeletedClients
directory.
- (void)deleteClientIdentifierFileFromDeletedClientsDirectory
Discussion
This method must call blah:
when finished.
Declared In
TICDSDocumentRegistrationOperation.h
deleteDocumentInfoPlistFromDeletedDocumentsDirectory
Delete the identifier.plist
file for this document from the DeletedDocuments
directory.
- (void)deleteDocumentInfoPlistFromDeletedDocumentsDirectory
Discussion
This method must call deletedDocumentInfoPlistFromDeletedDocumentsDirectoryWithSuccess:
to indicate whether the deletion was successful.
Declared In
TICDSDocumentRegistrationOperation.h
deletedClientIdentifierFileFromDeletedClientsDirectoryWithSuccess:
Indicate whether the client’s file in the document’s RecentSyncs
directory was deleted successfully.
- (void)deletedClientIdentifierFileFromDeletedClientsDirectoryWithSuccess:(BOOL)success
Parameters
- success
YES
if theidentifier.plist
file was deleted, otherwiseNO
.
Discussion
If not, call setError:
first, then specify NO
for success
.
Declared In
TICDSDocumentRegistrationOperation.h
deletedDocumentInfoPlistFromDeletedDocumentsDirectoryWithSuccess:
Indicate whether the identifier.plist
file for this document was removed from the DeletedDocuments
directory.
- (void)deletedDocumentInfoPlistFromDeletedDocumentsDirectoryWithSuccess:(BOOL)success
Parameters
- success
YES
if theidentifier.plist
file was deleted, otherwiseNO
.
Discussion
If not, call setError:
first, then specify NO
for success
.
Declared In
TICDSDocumentRegistrationOperation.h
discoveredDeletionStatusOfClient:
Indicate whether the client has been deleted from synchronizing with this document.
- (void)discoveredDeletionStatusOfClient:(TICDSRemoteFileStructureDeletionResponseType)status
Parameters
- status
The deletion status: deleted, not deleted, or error (see
TICDSTypesAndEnums.h
for possible values).
Discussion
If an error occurred, call setError:
first, then specify TICDSRemoteFileStructureDeletionResponseTypeError
for status
.
Declared In
TICDSDocumentRegistrationOperation.h
discoveredDeletionStatusOfRemoteDocument:
Indicate whether the document was previously deleted.
- (void)discoveredDeletionStatusOfRemoteDocument:(TICDSRemoteFileStructureDeletionResponseType)status
Parameters
- status
The status of the directory: was not deleted, was deleted, or error (see
TICDSTypesAndEnums.h
for possible values).
Discussion
If an error occurred, call setError:
first, then specify TICDSRemoteFileStructureDeletionResponseTypeError
for status
.
Declared In
TICDSDocumentRegistrationOperation.h
discoveredStatusOfClientDirectoryInRemoteDocumentSyncChangesDirectory:
Indicate the status of this client’s directory inside the remote document SyncChanges
directory.
- (void)discoveredStatusOfClientDirectoryInRemoteDocumentSyncChangesDirectory:(TICDSRemoteFileStructureExistsResponseType)status
Parameters
- status
The status of the directory: does exist, does not exist, or error (see
TICDSTypesAndEnums.h
for possible values).
Discussion
If an error occurred, call setError:
first, then specify TICDSRemoteFileStructureExistsResponseTypeError
for status
.
Declared In
TICDSDocumentRegistrationOperation.h
discoveredStatusOfRemoteDocumentDirectory:
Indicate the status of the remote document directory.
- (void)discoveredStatusOfRemoteDocumentDirectory:(TICDSRemoteFileStructureExistsResponseType)status
Parameters
- status
The status of the directory: does exist, does not exist, or error (see
TICDSTypesAndEnums.h
for possible values).
Discussion
If an error occurred, call setError:
first, then specify TICDSRemoteFileStructureExistsResponseTypeError
for status
.
Declared In
TICDSDocumentRegistrationOperation.h
fetchListOfIdentifiersOfAllRegisteredClientsForThisApplication
Fetch a list of all clients registered to synchronize with this application.
- (void)fetchListOfIdentifiersOfAllRegisteredClientsForThisApplication
Discussion
This list is used to add identifiers to this document’s DeletedClients
directory so that if those clients try to sync, they’ll realize the document has previously been deleted.
This method must call `` when finished.
Declared In
TICDSDocumentRegistrationOperation.h
fetchRemoteIntegrityKey
Fetch the integrity key for this document.
- (void)fetchRemoteIntegrityKey
Discussion
This method must call fetchedRemoteIntegrityKey:
to provide the key.
Declared In
TICDSDocumentRegistrationOperation.h
fetchedListOfIdentifiersOfAllRegisteredClientsForThisApplication:
Pass back the assembled NSArray
of client identifiers registered to synchronize with the application.
- (void)fetchedListOfIdentifiersOfAllRegisteredClientsForThisApplication:(NSArray *)anArray
Parameters
- anArray
The array of client identifiers, or
nil
if an error occurred.
Discussion
If an error occurred, call setError:
first, then specify nil
for anArray
.
Declared In
TICDSDocumentRegistrationOperation.h
fetchedRemoteIntegrityKey:
Pass back the remote integrity key for this document.
- (void)fetchedRemoteIntegrityKey:(NSString *)aKey
Parameters
- aKey
The remote integrity key, or
nil
if an error occurred.
Discussion
If an error occurred, call setError:
first, then specify nil
for aKey
.
Declared In
TICDSDocumentRegistrationOperation.h
initWithDelegate:
Initialize a document registration operation using a delegate that supports the TICDSDocumentRegistrationOperationDelegate
protocol.
- (id)initWithDelegate:(NSObject<TICDSDocumentRegistrationOperationDelegate> *)aDelegate
Parameters
- aDelegate
The delegate to use for this operation.
Return Value
An initialized document registration operation.
Declared In
TICDSDocumentRegistrationOperation.h
saveIntegrityKey:
Save a file with the integrity key as its name to this document’s IntegrityKey
directory.
- (void)saveIntegrityKey:(NSString *)aKey
Parameters
- aKey
The integrity key to save.
Discussion
This method must call savedIntegrityKeyWithSuccess:
to indicate whether the save was successful.
Declared In
TICDSDocumentRegistrationOperation.h
saveRemoteDocumentInfoPlistFromDictionary:
Save the dictionary to a documentInfo.plist
file in this document’s directory.
- (void)saveRemoteDocumentInfoPlistFromDictionary:(NSDictionary *)aDictionary
Parameters
- aDictionary
The dictionary to save as the
documentInfo.plist
.
Discussion
This method must call savedRemoteDocumentInfoPlistWithSuccess:
to indicate whether the save was successful.
Declared In
TICDSDocumentRegistrationOperation.h
savedIntegrityKeyWithSuccess:
Indicate whether the integrity key file was saved successfully.
- (void)savedIntegrityKeyWithSuccess:(BOOL)success
Parameters
- success
YES
if the integrity key file was saved, otherwiseNO
.
Discussion
If not, call setError:
first, then specify NO
for success
.
Declared In
TICDSDocumentRegistrationOperation.h
savedRemoteDocumentInfoPlistWithSuccess:
Indicate whether the documentInfo.plist
file was saved successfully.
- (void)savedRemoteDocumentInfoPlistWithSuccess:(BOOL)success
Parameters
- success
YES
if thedocumentInfo.plist
file was saved, otherwiseNO
.
Discussion
If not, call setError:
first, then specify NO
for success
.
Declared In
TICDSDocumentRegistrationOperation.h