DARemoteDataAdapter Class

From RemObjects Wiki
Jump to: navigation, search

This is a Library topic for Data Abstract for Xcode
This page is generated from external data, please do not update

ProtocolsClassesEnumsImplements

Contents

Overview

The DARemoteDataAdapter class serves as a mediator between DataAbstractService and your client side. DARemoteDataAdapter knows where service resides and how to connect to it. DARemoteDataAdapter performs login if a service requires it. DARemoteDataAdapter can prepare and execute any kind of requests supported by DataAbstractService. Requests can be both - synchronous and asynchronous.

Read more about the Remote Data Adapter at Remote Data Adapter and Data Tables (Xcode).





Below, you can find a simple sample of using DARemoteDataAdapter:

ROMessage *message = [[ROBinMessage alloc] init];
ROHTTPClientChannel *channel = 
   [[ROHTTPClientChannel alloc] initWithTargetUrl:@"http://myserver:8099/bin"];
RORemoteService *dataService =
   [[RORemoteService alloc] initWithMessage:message channel:channel serviceName:@"DataService"];
RORemoteService *loginService = 
   [[RORemoteService alloc] initWithMessage:message channel:channel serviceName:@"LoginService"];
DARemoteDataAdapter *adapter = 
   [[DARemoteDataAdapter alloc] initWithDataService:dataService loginService:loginService];
[channel setDelegate:adapter];

// get table from the server
DADataTable *table = [[adapter getDataTable:@"MyTable"] retain];

// perform some changes in table
...

// apply changes on server
[adapter applyChangesForTable:table];

Tasks

Creating DARemoteDataAdapter

  • init
  • initWithDataService:
  • initWithDataService:loginService:

Login & LogOut

  • loginWithUsername:password:
  • loginWithUsername:password:connectionName:
  • loginWithString:
  • logout

Server calls

  • getSchema

Getting data - synchronous

  • getDataTable:
  • getDataTable:select:where:
  • getDataTables:
  • getDataTables:select:where:


  • getDataTableWithSQL:
  • getDataTable:withSQL:
  • getDataTables:withSQL:

Getting data - asynchronous

  • beginGetDataTable:start:
  • beginGetDataTable:select:where:start:
  • beginGetDataTables:start:
  • beginGetDataTables:select:where:start:
  • beginGetDataTableWithSQL:start:
  • beginGetDataTable:withSQL:start:
  • beginGetDataTables:withSQL:start:

Applying changes - synchronous

  • applyChangesForTable:
  • applyChangesForTables:

Applying changes - asynchronous

  • beginApplyChangesForTable:
  • beginApplyChangesForTable:start:
  • beginApplyChangesForTables:
  • beginApplyChangesForTables:start


Location

DataAbstract/DARemoteDataAdapter.h

  • Ancestry: DADataAdapter | DARemoteDataAdapter | Descendants

Implemented interfaces


Properties

dataService   nonatomic retain

Reference to a data service.



@property (nonatomic, retain) RORemoteService *dataService


dataStreamer   retain

Reference to data streamer. Currently we support DABin2DataStreamer only.



@property (retain) DADataStreamer *dataStreamer


delegate   assign

A delegate that wants to receive notifications of events that happen within the DARemoteDataAdapter, such as receiving a request to login, or any kind of failure.



@property (assign) id<DARemoteDataAdapterDelegate> delegate


loginService   nonatomic retain

Reference to the login service. Optionally, it can be nil if authentication is not required.



@property (nonatomic, retain) RORemoteService *loginService


loginString   copy nonatomic



@property (copy, nonatomic) NSString *loginString


password   copy nonatomic



@property (copy, nonatomic) NSString *password


username   copy nonatomic



@property (copy, nonatomic) NSString *username


Class Methods

adapterWithTargetUrl: (NSString *): id   deprecated



+ (id) adapterWithTargetUrl:(NSString *)url


Parameters:

  • url:


adapterWithTargetURL: (NSURL *): id



+ (id) adapterWithTargetURL:(NSURL *)url


Parameters:

  • url:


adapterWithTargetURL:dataServiceName:



+ (id) adapterWithTargetURL:(NSURL *)url dataServiceName:(NSString *)dataServiceName


Parameters:

  • url:
  • dataServiceName:


adapterWithTargetURL:dataServiceName:loginServiceName:



+ (id) adapterWithTargetURL:(NSURL *)url dataServiceName:(NSString *)dataServiceName loginServiceName:(NSString *)loginServiceName


Parameters:

  • url:
  • dataServiceName:
  • loginServiceName:


Instance Methods

applyChangesForTable:

This method applies changes for the given table synchronously. It extracts a delta from the table, composes and executes the UpdateData method of the DataAbstract service. If there are no changes, the method does nothing. Finally, it processes the incoming delta (if it is returned from the server) and merges changes with the table data. If some of changes failed on the server side, a DAException with the appropriate message will be raised.


- (void) applyChangesForTable:(DADataTable *)dataTable


Parameters:

  • dataTable: reference to DADataTable instance with changes we want to apply.


applyChangesForTables:

This method applies changes for the given tables synchronously. It extracts a delta from the table, composes and executes the UpdateData method of the DataAbstract service. If there are no changes, the method does nothing. Finally, it process the incoming delta (if it is returned from the server) and merges changes with the table data. If some of changes failed on the server side, a DAException with the appropriate message will be raised.


- (void) applyChangesForTables:(NSArray *)dataTables


Parameters:

  • dataTables: array of DADataTables instances with changes we want to apply.


beginApplyChangesForTable:

This method creates and returns an asynchronous request for applying changes for the given table.


- (DAAsyncRequest *) beginApplyChangesForTable:(DADataTable *)dataTable


Parameters:

  • dataTable: Reference to DADataTable instance with changes we want to apply.


beginApplyChangesForTable:start:

This method creates and returns an asynchronous request for applying changes for the given table. It has an additional boolean parameter start that specifies whether the request will be started or not. This allows you to control when to start the execution request.


- (DAAsyncRequest *) beginApplyChangesForTable:(DADataTable *)dataTable start:(BOOL)start


Parameters:

  • dataTable: Reference to the DADataTable instance with changes you want to apply.
  • start: Boolean flag that specifies whether the request willbe started when this method ends or not.


beginApplyChangesForTables:

This method creates and returns an asynchronous request for applying changes for the given tables.


- (DAAsyncRequest *) beginApplyChangesForTables:(NSArray *)dataTables


Parameters:

  • dataTables: array of DADataTable instances with changes we want to apply.


beginApplyChangesForTables:start:

This method creates and returns an asynchronous request for applying changes for the given tables. Using the start parameter, you can specify whether the asynchronous request will be started when the method ends or not.


- (DAAsyncRequest *) beginApplyChangesForTables:(NSArray *)dataTables start:(BOOL)start


Parameters:

  • dataTables: array of DADataTables instances with changes we want to apply.
  • start: boolean flag that specifies, will be request started when this method ends or not.


beginExecuteCommand:withParameters:start:



- (DAAsyncRequest *) beginExecuteCommand:(NSString *)commandName withParameters:(NSDictionary *)params start:(BOOL)start


Parameters:

  • commandName:
  • params:
  • start:


beginExecuteCommand:withParameters:withBlock:



- (DAAsyncRequest *) beginExecuteCommand:(NSString *)commandName withParameters:(NSDictionary *)params withBlock:(void(^)(int,NSDictionary *))block


Parameters:

  • commandName:
  • params:
  • block:


beginExecuteCommandEx:withParameters:start:



- (DAAsyncRequest *) beginExecuteCommandEx:(NSString *)commandName withParameters:(NSDictionary *)params start:(BOOL)start


Parameters:

  • commandName:
  • params:
  • start:


beginExecuteCommandEx:withParameters:withBlock:



- (DAAsyncRequest *) beginExecuteCommandEx:(NSString *)commandName withParameters:(NSDictionary *)params withBlock:(void(^)(int,NSDictionary *))block


Parameters:

  • commandName:
  • params:
  • block:


beginGetDataTable:select:where:start:

This method creates and returns an asynchronous request for obtaining a DADataTable with the given name and with a glance of the given DynamicSelect fields and DynamicWhere clauses, asynchronously.


- (DAAsyncRequest *) beginGetDataTable:(NSString *)tableName select:(NSArray *)fieldList where:(DADynamicWhereClause *)whereClause start:(BOOL)start


Parameters:

  • tableName: The table name for which you want to get data.
  • fieldList: The array of field names for which you want to get data (DA DynamicSelect feature).
  • whereClause: A dynamic where clause.
  • start: A boolean flag that specifies whether the request will be started at the end of this method or not.


beginGetDataTable:select:where:withBlock:



- (DAAsyncRequest *) beginGetDataTable:(NSString *)tableName select:(NSArray *)fieldList where:(DADynamicWhereClause *)whereClause withBlock:(void(^)(DADataTable *))block


Parameters:

  • tableName:
  • fieldList:
  • whereClause:
  • block:


beginGetDataTable:start:

This method creates an asynchronous request for obtaining a DADataTable with the given name.


- (DAAsyncRequest *) beginGetDataTable:(NSString *)tableName start:(BOOL)start


Parameters:

  • tableName: table name for which we want to get data.
  • start: boolean flag that specifies, will be request started at the end of this method or not.


beginGetDataTable:withBlock:



- (DAAsyncRequest *) beginGetDataTable:(NSString *)tableName withBlock:(void(^)(DADataTable *))block


Parameters:

  • tableName:
  • block:


beginGetDataTable:withSQL:start:

This method creates an asynchronous request for obtaining a DADataTable with the given name according to the specified DASQL SELECT statement asynchronously.


- (DAAsyncRequest *) beginGetDataTable:(NSString *)tableName withSQL:(NSString *)sql start:(BOOL)start


Parameters:

  • tableName: The table name for which you want to get data.
  • sql: A DASQL SELECT statement.
  • start: A boolean flag that specifies whether the request will be started at the end of this method or not.


beginGetDataTable:withSQL:withBlock:



- (DAAsyncRequest *) beginGetDataTable:(NSString *)tableName withSQL:(NSString *)sql withBlock:(void(^)(DADataTable *))block


Parameters:

  • tableName:
  • sql:
  • block:


beginGetDataTables:select:where:start:

This method creates an asynchronous request for obtaining an array of DADataTables with the given names with a glance of the given DynamicSelect fields and DynamicWhere clause.


- (DAAsyncRequest *) beginGetDataTables:(NSArray *)tableNames select:(NSArray *)fieldLists where:(NSArray *)whereClauses start:(BOOL)start


Parameters:

  • tableNames: array of the table names we want to obtain.
  • fieldLists: array of array of the fields we want to obtain for each table.
  • whereClauses: array of DynamicWhere clauses for each of table.
  • start: boolean flag that specifies, will be request started at the end of this method or not.


beginGetDataTables:select:where:withBlock:



- (DAAsyncRequest *) beginGetDataTables:(NSArray *)tableNames select:(NSArray *)fieldLists where:(NSArray *)whereClauses withBlock:(void(^)(NSDictionary *))block


Parameters:

  • tableNames:
  • fieldLists:
  • whereClauses:
  • block:


beginGetDataTables:start:

This method creates and returns an asynchronous request for obtaining an array of DADataTables with the given names.


- (DAAsyncRequest *) beginGetDataTables:(NSArray *)tableNames start:(BOOL)start


Parameters:

  • tableNames: The array of table names you want to obtain.
  • start: A boolean flag that specifies whether the request will be started at the end of this method or not.


beginGetDataTables:withBlock:



- (DAAsyncRequest *) beginGetDataTables:(NSArray *)tableNames withBlock:(void(^)(NSDictionary *))block


Parameters:

  • tableNames:
  • block:


beginGetDataTables:withSQL:start:

This method creates and returns an asynchronous request for obtaining an array of DADataTables with the given names and given DASQL SELECT statements.


- (DAAsyncRequest *) beginGetDataTables:(NSArray *)tableNames withSQL:(NSArray *)sqlQueries start:(BOOL)start


Parameters:

  • tableNames: The array of the table names you want to obtain.
  • sqlQueries: DASQL SELECT statements.
  • start: A boolean flag that specifies whether the request will be started at the end of this method or not.


beginGetDataTables:withSQL:withBlock:



- (DAAsyncRequest *) beginGetDataTables:(NSArray *)tableNames withSQL:(NSArray *)sqlQueries withBlock:(void(^)(NSDictionary *))block


Parameters:

  • tableNames:
  • sqlQueries:
  • block:


beginGetDataTableWithSQL:start:

This method creates and returns an asynchronous request for obtaining a DADataTable with the given DASQL SELECT statement. The table will have the default name "data".


- (DAAsyncRequest *) beginGetDataTableWithSQL:(NSString *)sql start:(BOOL)start


Parameters:

  • sql: DASQL SELECT statement.
  • start: A boolean flag that specifies whether the request will be started at the end of this method or not.


beginGetDataTableWithSQL:withBlock:



- (DAAsyncRequest *) beginGetDataTableWithSQL:(NSString *)sql withBlock:(void(^)(DADataTable *))block


Parameters:

  • sql:
  • block:


beginGetSchema



- (DAAsyncRequest *) beginGetSchema


beginGetSchemaWithBlock:



- (DAAsyncRequest *) beginGetSchemaWithBlock:(void(^)(DASchema *))block


Parameters:

  • block:


executeCommand:withParameters:



- (int) executeCommand:(NSString *)commandName withParameters:(NSDictionary *)params


Parameters:

  • commandName:
  • params:


executeCommand:withParameterValuesAndNames:



- (int) executeCommand:(NSString *)commandName withParameterValuesAndNames:(id)value , ... NS_REQUIRES_NIL_TERMINATION


Parameters:

  • commandName:
  • value:


executeCommandEx:withParameters:outputParameters:



- (int) executeCommandEx:(NSString *)commandName withParameters:(NSDictionary *)params outputParameters:(NSDictionary **)outParams


Parameters:

  • commandName:
  • params:
  • outParams:


getDataTable:

This method returns the table with the given name synchronously.


- (DADataTable *) getDataTable:(NSString *)tableName


Parameters:

  • tableName: The table name you want to obtain.


getDataTable:select:where:

This method returns the table with the given name and with a glance of the given DynamicSelect fields and DynamicWhere clause synchronously.


- (DADataTable *) getDataTable:(NSString *)tableName select:(NSArray *)fieldList where:(DADynamicWhereClause *)whereClause


Parameters:

  • tableName: The table name for which you want to get data.
  • fieldList: An array of field names for which you want to get data (DA DynamicSelect feature).
  • whereClause: A dynamic where clause.


getDataTable:withSQL:

Returns the table with the given name according to the given DASQL SELECT statement.


- (DADataTable *) getDataTable:(NSString *)tableName withSQL:(NSString *)sql


Parameters:

  • tableName: Name of the returned table.
  • sql: DASQL SELECT statement.


getDataTables:

This method returns an array of tables according to the given table names.


- (NSDictionary *) getDataTables:(NSArray *)tableNames


Parameters:

  • tableNames: An array of the table names you want to obtain.


getDataTables:select:where:

This method returns an array of tables with the given names and with a glance of the given DynamicSelect fields and DynamicWhere clause synchronously.


- (NSDictionary *) getDataTables:(NSArray *)tableNames select:(NSArray *)fieldLists where:(NSArray *)whereClauses


Parameters:

  • tableNames: The array of table names for which you want to get data.
  • fieldLists: An array of field names for which you want to get data (DA DynamicSelect feature).
  • whereClauses: An array of dynamic where clause.


getDataTables:withSQL:

This method returns an array of tables with the given names and according to the given DASQL SELECT statements.


- (NSDictionary *) getDataTables:(NSArray *)tableNames withSQL:(NSArray *)sqlQueries


Parameters:

  • tableNames: The array of table names you want to obtain.
  • sqlQueries: DASQL SELECT statements.


getDataTableWithSQL:

This method returns the table with the given DASQL SELECT statement.


- (DADataTable *) getDataTableWithSQL:(NSString *)sql


Parameters:

  • sql: DASQL SELECT statement.


getSchema

This method returns a DASchema for the Data Abstract service.


- (DASchema *) getSchema


init

Returns an initialized instance of the DARemoteDataAdapter.


- (id) init


initWithDataService:

Returns an instance of the DARemoteDataAdapter initialized with the given service.


- (id) initWithDataService:(RORemoteService *)dataService


Parameters:

  • dataService: Reference to the service that provides data.


initWithDataService:loginService:

Returns an instance of the DARemoteDataAdapter initialized with the given data and login services.


- (id) initWithDataService:(RORemoteService *)dataService loginService:(RORemoteService *)loginService


Parameters:

  • dataService: Reference to the data service.
  • loginService: Reference to the login service.


initWithTargetUrl: (NSString *): id   deprecated



- (id) initWithTargetUrl:(NSString *)url


Parameters:

  • url:


initWithTargetURL: (NSURL *): id



- (id) initWithTargetURL:(NSURL *)url


Parameters:

  • url:


initWithTargetURL:dataServiceName:



- (id) initWithTargetURL:(NSURL *)url dataServiceName:(NSString *)dataServiceName


Parameters:

  • url:
  • dataServiceName:


initWithTargetURL:dataServiceName:loginServiceName:



- (id) initWithTargetURL:(NSURL *)url dataServiceName:(NSString *)dataServiceName loginServiceName:(NSString *)loginServiceName


Parameters:

  • url:
  • dataServiceName:
  • loginServiceName:


login



- (BOOL) login


loginWithString:

This methods tries to login with the given connection string. It invokes the LoginEx method of the BaseLoginService of the DataAbstract server.


- (BOOL) loginWithString:(NSString *)aConnectionString


Parameters:

  • aConnectionString: Connection string.


loginWithUsername:password:

This methods tries to login with the given user name and password.


- (BOOL) loginWithUsername:(NSString *)userName password:(NSString *)password


Parameters:

  • userName: Login
  • password: Password


loginWithUsername:password:connectionName:

This methods tries to login with the given user name, password and connection name. Used for cases when the server side service has multiple connections.


- (BOOL) loginWithUsername:(NSString *)userName password:(NSString *)password connectionName:(NSString *)connectionName


Parameters:

  • userName: Login
  • password: Password
  • connectionName: Connection name


logout

This method performs the log out.


- (void) logout


Descendants


See Also


Product: RemObjects Data Abstract
Available Editions: Data Abstract for .NET, Delphi and Xcode

GlossaryArticlesFeaturesLibrarySamples

Personal tools
Namespaces

Variants
Actions
Navigation
products
platforms
special
Toolbox