TICDSApplicationRegistrationOperation Class Reference
Inherits from | TICDSOperation : NSOperation |
Declared in | TICDSApplicationRegistrationOperation.h |
Overview
The TICDSApplicationRegistrationOperation
class describes a generic operation used by the TICoreDataSync
framework to register an application for future synchronization of documents.
The operation carries out the following tasks:
Subclass checks whether the
appIdentifier
directory exists on the remote.If not, blitz any existing keychain items, then ask the application sync manager whether to use encryption (get a password, if so), then:
Subclass creates the
appIdentifier
directory on the remote, and general file structure (directories only).Subclass saves the
ReadMe.txt
file at the root.If encryption is enabled, create the
FZACryptor
and set its password.If encryption is enabled, subclass saves the generated salt file in the remote
Encryption
directory.If encryption is enabled, subclass saves a suitable file for password testing in the remote
Encryption
directory.Continue by creating the client’s directory (main step 3) inside
ClientDevices
.
If app has been registered before, subclass checks whether the salt file exists on the remote, and
shouldUseEncryption
is set accordingly, then:Subclass checks whether the client’s directory exists inside
ClientDevices
.If not, any existing keychain items are blitzed, then:
If encryption is disabled, continue by creating the client’s directory (main step 3) inside
ClientDevices
.If encryption is enabled, subclass downloads the salt file and sets the
saltData
operation property.The application sync manager is asked for the password.
The
FZACryptor
is configured with password and salt, and the test file is downloaded.
If the directory exists, and encryption is disabled, then operation is complete.
If app has been registered before, subclass checks whether the salt file exists on the remote.
If not, encryption is disabled, so continue by checking whether the client has registered before.
If salt file exists, encryption is enabled, so check whether the
FZACryptor
has a password and salt.If not, subclass downloads the salt, the application sync manager is asked to get the password from the user, then the
FZACryptor
is configured.Once downloaded, or if
FZACryptor
already has the password, continue by subclass checking whether the client’s directory exists insideClientDevices
.
Subclass checks whether the client’s directory exists inside
ClientDevices
.If not, subclass creates client’s directory inside
ClientDevices
, then:documentInfo.plist
is created, and encrypted, if necessary.Subclass uploads the
documentInfo.plist
file to the remote.
Operations are typically created automatically by the relevant sync manager.
You must use one of the subclasses of TICDSApplicationRegistrationOperation
.
Tasks
Designated Initializer
-
– initWithDelegate:
Initialize an application registration operation using a delegate that supports the
TICDSApplicationRegistrationOperationDelegate
protocol.
Methods Overridden by Subclasses
-
– checkWhetherRemoteGlobalAppDirectoryExists
Check whether a directory exists for this application.
-
– createRemoteGlobalAppDirectoryStructure
Create global application directory structure.
-
– copyReadMeTxtFileToRootOfGlobalAppDirectoryFromPath:
Copy the
ReadMe.txt
file from the bundle to the root of this application’s remote directory. -
– checkWhetherSaltFileExists
Check whether the
salt.ticdsync
file exists at the root of the application’s remote directory. -
– fetchSaltData
Fetch the data from the
salt.ticdsync
file. -
– saveSaltDataToRemote:
Save the salt data to a
salt.ticdsync
file at the root of the application’s remote directory. -
– savePasswordTestData:
Save the test data to a
test.ticdsync
file in theEncryption
directory at the root of the application’s remote directory. -
– fetchPasswordTestData
Fetch the test data from the
test.ticdsync
file in theEncryption
directory. -
– checkWhetherRemoteClientDeviceDirectoryExists
Check whether the client’s directory already exists in
ClientDevices
. -
– createRemoteClientDeviceDirectory
Create the client’s directory in
ClientDevices
. -
– saveRemoteClientDeviceInfoPlistFromDictionary:
Save the dictionary to a
deviceInfo.plist
file in this client’s directory inside theClientDevices
directory.
Callbacks
-
– discoveredStatusOfRemoteGlobalAppDirectory:
Indicate the status of the global application directory.
-
– createdRemoteGlobalAppDirectoryStructureWithSuccess:
Indicate whether the creation of the global app directory structure was successful.
-
– copiedReadMeTxtFileToRootOfGlobalAppDirectoryWithSuccess:
Indicate whether the
ReadMe.txt
file was copied from the bundle. -
– discoveredStatusOfSaltFile:
Indicate the status of the
salt.ticdsync
file. -
– fetchedSaltData:
Provide the data from the
salt.ticdsync
file. -
– savedSaltDataToRootOfGlobalAppDirectoryWithSuccess:
Indicate whether the salt data was saved successfully.
-
– savedPasswordTestDataWithSuccess:
Indicate whether the test data was saved successfuly.
-
– fetchedPasswordTestData:
Provide the test data from the
test.ticdsync
file. -
– createdRemoteClientDeviceDirectoryWithSuccess:
Indicate whether the client’s directory was created successful in
ClientDevices
. -
– savedRemoteClientDeviceInfoPlistWithSuccess:
Indicate whether the
deviceInfo.plist
file was saved successfully.
Properties
-
appIdentifier
The application identifier.
property -
clientDescription
The client description.
property -
applicationUserInfo
The user info.
property -
paused
Used to indicate whether the operation is currently paused awaiting input from the operation delegate, or in turn the application sync manager delegate.
property -
password
The password to use for encryption at initial global app registration, if
propertyshouldUseEncryption
isYES
. -
saltData
The cached salt data, set only after fetching from the remote.
property -
shouldCreateClientDirectory
Used mid-operation to indicate whether the client directory needs to be created after configuring encryption.
property
Properties
appIdentifier
The application identifier.
@property (nonatomic, retain) NSString *appIdentifier
Declared In
TICDSApplicationRegistrationOperation.h
applicationUserInfo
The user info.
@property (nonatomic, retain) NSDictionary *applicationUserInfo
Declared In
TICDSApplicationRegistrationOperation.h
clientDescription
The client description.
@property (nonatomic, retain) NSString *clientDescription
Declared In
TICDSApplicationRegistrationOperation.h
password
The password to use for encryption at initial global app registration, if shouldUseEncryption
is YES
.
@property (retain) NSString *password
Declared In
TICDSApplicationRegistrationOperation.h
paused
Used to indicate whether the operation is currently paused awaiting input from the operation delegate, or in turn the application sync manager delegate.
@property (assign, getter=isPaused) BOOL paused
Declared In
TICDSApplicationRegistrationOperation.h
Instance Methods
checkWhetherRemoteClientDeviceDirectoryExists
Check whether the client’s directory already exists in ClientDevices
.
- (void)checkWhetherRemoteClientDeviceDirectoryExists
Discussion
This method must call discoveredStatusOfRemoteClientDeviceDirectory:
to indicate the status.
Declared In
TICDSApplicationRegistrationOperation.h
checkWhetherRemoteGlobalAppDirectoryExists
Check whether a directory exists for this application.
- (void)checkWhetherRemoteGlobalAppDirectoryExists
Discussion
This method must call discoveredStatusOfGlobalAppDirectory:
to indicate the status.
Declared In
TICDSApplicationRegistrationOperation.h
checkWhetherSaltFileExists
Check whether the salt.ticdsync
file exists at the root of the application’s remote directory.
- (void)checkWhetherSaltFileExists
Discussion
This method must call discoveredStatusOfSaltFile:
to indicate the status.
Declared In
TICDSApplicationRegistrationOperation.h
copiedReadMeTxtFileToRootOfGlobalAppDirectoryWithSuccess:
Indicate whether the ReadMe.txt
file was copied from the bundle.
- (void)copiedReadMeTxtFileToRootOfGlobalAppDirectoryWithSuccess:(BOOL)success
Parameters
- success
YES
if theReadMe.txt
file was copied, otherwiseNO
.
Discussion
If not, call setError:
first, then specify NO
for success
.
Declared In
TICDSApplicationRegistrationOperation.h
copyReadMeTxtFileToRootOfGlobalAppDirectoryFromPath:
Copy the ReadMe.txt
file from the bundle to the root of this application’s remote directory.
- (void)copyReadMeTxtFileToRootOfGlobalAppDirectoryFromPath:(NSString *)aPath
Parameters
- aPath
The local path to the
ReadMe.txt
file.
Discussion
This method must call copiedReadMeTxtFileToRootOfGlobalAppDirectoryWithSuccess:
to indicate whether the copy was successful.
Declared In
TICDSApplicationRegistrationOperation.h
createRemoteClientDeviceDirectory
Create the client’s directory in ClientDevices
.
- (void)createRemoteClientDeviceDirectory
Discussion
This method must call createdRemoteClientDeviceDirectoryWithSuccess:
to indicate whether the creation was successful.
Declared In
TICDSApplicationRegistrationOperation.h
createRemoteGlobalAppDirectoryStructure
Create global application directory structure.
- (void)createRemoteGlobalAppDirectoryStructure
Discussion
This method must call createdGlobalAppDirectoryStructureWithSuccess:
to indicate whether the creation was successful.
Declared In
TICDSApplicationRegistrationOperation.h
createdRemoteClientDeviceDirectoryWithSuccess:
Indicate whether the client’s directory was created successful in ClientDevices
.
- (void)createdRemoteClientDeviceDirectoryWithSuccess:(BOOL)success
Parameters
- success
YES
if the client’s directory was created, otherwiseNO
.
Discussion
If not, call setError:
first, then specify NO
for success
.
Declared In
TICDSApplicationRegistrationOperation.h
createdRemoteGlobalAppDirectoryStructureWithSuccess:
Indicate whether the creation of the global app directory structure was successful.
- (void)createdRemoteGlobalAppDirectoryStructureWithSuccess:(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
TICDSApplicationRegistrationOperation.h
discoveredStatusOfRemoteGlobalAppDirectory:
Indicate the status of the global application directory.
- (void)discoveredStatusOfRemoteGlobalAppDirectory:(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
TICDSApplicationRegistrationOperation.h
discoveredStatusOfSaltFile:
Indicate the status of the salt.ticdsync
file.
- (void)discoveredStatusOfSaltFile:(TICDSRemoteFileStructureExistsResponseType)status
Parameters
- status
The status of the file: 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
TICDSApplicationRegistrationOperation.h
fetchPasswordTestData
Fetch the test data from the test.ticdsync
file in the Encryption
directory.
- (void)fetchPasswordTestData
Discussion
This method must call fetchedPasswordTestData:
when done.
Declared In
TICDSApplicationRegistrationOperation.h
fetchSaltData
Fetch the data from the salt.ticdsync
file.
- (void)fetchSaltData
Discussion
This method must call `` when the data has been fetched.
Declared In
TICDSApplicationRegistrationOperation.h
fetchedPasswordTestData:
Provide the test data from the test.ticdsync
file.
- (void)fetchedPasswordTestData:(NSData *)testData
Parameters
- testData
The
NSData
contents of thetest.ticdsync
file, ornil
if an error occurred.
Discussion
If an error occurred, call setError:
first, then specify nil
for testData
.
Declared In
TICDSApplicationRegistrationOperation.h
fetchedSaltData:
Provide the data from the salt.ticdsync
file.
- (void)fetchedSaltData:(NSData *)saltData
Parameters
- saltData
The
NSData
contents of thesalt.ticdsync
file, ornil
if an error occurred.
Discussion
If an error occurred, call setError:
first, then specify nil
for saltData
.
Declared In
TICDSApplicationRegistrationOperation.h
initWithDelegate:
Initialize an application registration operation using a delegate that supports the TICDSApplicationRegistrationOperationDelegate
protocol.
- (id)initWithDelegate:(NSObject<TICDSApplicationRegistrationOperationDelegate> *)aDelegate
Parameters
- aDelegate
The delegate to use for this operation.
Return Value
An initialized document registration operation.
Declared In
TICDSApplicationRegistrationOperation.h
savePasswordTestData:
Save the test data to a test.ticdsync
file in the Encryption
directory at the root of the application’s remote directory.
- (void)savePasswordTestData:(NSData *)testData
Parameters
- testData
The data to be saved.
Discussion
This method must call savedTestDataWithSuccess:
to indicate whether the save was successful.
Declared In
TICDSApplicationRegistrationOperation.h
saveRemoteClientDeviceInfoPlistFromDictionary:
Save the dictionary to a deviceInfo.plist
file in this client’s directory inside the ClientDevices
directory.
- (void)saveRemoteClientDeviceInfoPlistFromDictionary:(NSDictionary *)aDictionary
Parameters
- aDictionary
The dictionary to save as the
deviceInfo.plist
.
Discussion
This method must call savedRemoteClientDeviceInfoPlistWithSuccess:
to indicate whether the save was successful.
Declared In
TICDSApplicationRegistrationOperation.h
saveSaltDataToRemote:
Save the salt data to a salt.ticdsync
file at the root of the application’s remote directory.
- (void)saveSaltDataToRemote:(NSData *)saltData
Parameters
- saltData
The data to be saved.
Discussion
This method must call savedSaltDataToRootOfGlobalAppDirectoryWithSuccess:
to indicate whether the save was successful.
Declared In
TICDSApplicationRegistrationOperation.h
savedPasswordTestDataWithSuccess:
Indicate whether the test data was saved successfuly.
- (void)savedPasswordTestDataWithSuccess:(BOOL)success
Parameters
- success
YES
if thetest.ticdsync
file was saved, otherwiseNO
.
Discussion
If not, call setError:
first, then specify NO
for success
.
Declared In
TICDSApplicationRegistrationOperation.h
savedRemoteClientDeviceInfoPlistWithSuccess:
Indicate whether the deviceInfo.plist
file was saved successfully.
- (void)savedRemoteClientDeviceInfoPlistWithSuccess:(BOOL)success
Parameters
- success
YES
if thedeviceInfo.plist
file was saved, otherwiseNO
.
Discussion
If not, call setError:
first, then specify NO
for success
.
Declared In
TICDSApplicationRegistrationOperation.h
savedSaltDataToRootOfGlobalAppDirectoryWithSuccess:
Indicate whether the salt data was saved successfully.
- (void)savedSaltDataToRootOfGlobalAppDirectoryWithSuccess:(BOOL)success
Parameters
- success
YES
if thesalt.ticdsync
file was saved, otherwiseNO
.
Discussion
If not, call setError:
first, then specify NO
for success
.
Declared In
TICDSApplicationRegistrationOperation.h