[aerogear-dev] AGPropertyListStorage implementation

Matthias Wessendorf matzew at apache.org
Thu Jan 10 13:19:23 EST 2013


Hi Christos,

nice job!

BTW. I added a bit of your example to the API.md file:

https://github.com/aerogear/aerogear-ios/blob/master/API.md

On Thu, Jan 10, 2013 at 7:10 PM, Douglas Campos <qmx at qmx.me> wrote:
> looks awesome!
>
> +9001
>
> On 10/01/2013, at 15:54, Christos Vasilakis <cvasilak at gmail.com> wrote:
>
>> Hi there,
>>
>> an initial commit of a simple property list based store has been merged. It can be used using the regular store interface just passing a PLIST type during creation.
>>
>> A simple example storing e.g. an otp secret
>>
>> // initalize plist store (if the file does not exist it will be created)
>> AGDataManager* manager = [AGDataManager manager];
>> id<AGStore> plistStore = [manager store:^(id<AGStoreConfig> config) {
>>         [config setName:@"secrets"]; // will be used as the filename for the plist
>>         [config setType:@"PLIST"];
>> }];
>>
>> // the object to save
>> NSDictionary *otp = [NSDictionary dictionaryWithObjectsAndKeys:@"19a01df0281afcdbe", @"otp", @"1", @"id", nil];
>> // save it
>> [plistStore save:otp success:^(id object) {
>>       STAssertNotNil(object, @"object should not be nil");
>>   } failure:^(NSError *error) {
>>       NSLog(@"error: %@", error);
>> }];
>>
>> //... at some later time
>> // initialize store from file
>> id<AGStore> plistStore = [manager store:^(id<AGStoreConfig> config) {
>>         [config setName:@"secrets"];
>>         [config setType:@"PLIST"];
>> }];
>>
>> // read the otp
>> [plistStore read:@"1" success:^(id object) {
>>         NSLog(@"otp secret is: %@", [object objectForKey:@"otp");
>>     } failure:^(NSError *error) {
>>         NSLog(@"error: %@", error);
>> }];
>>
>> Let me know if you have comments/suggestions
>>
>> Thanks
>> Christos
>>
>>
>> On Jan 8, 2013, at 4:38 PM, Christos Vasilakis <cvasilak at gmail.com> wrote:
>>
>>> Hi team,
>>>
>>> fyi,
>>> in order to have some long-term storage of data (for example storing the OTP secret), I am writing a simple PropertyList based implementation of AGStore. It will provide the same interface as the AGStore that is save, read and remove of data and internally will use the Property List mechanism for iOS.  As with all other implementations, a configuration object will be used to passed  in the parameters (e.g. filename of the archive etc.) . A ticket has been opened to track this [1].
>>>
>>> More info as I progress.
>>>
>>> Thanks,
>>> Christos
>>>
>>> [1] https://issues.jboss.org/browse/AEROGEAR-783
>>>
>>>
>>>
>>
>> _______________________________________________
>> aerogear-dev mailing list
>> aerogear-dev at lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/aerogear-dev
>
>
> _______________________________________________
> aerogear-dev mailing list
> aerogear-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/aerogear-dev



-- 
Matthias Wessendorf

blog: http://matthiaswessendorf.wordpress.com/
sessions: http://www.slideshare.net/mwessendorf
twitter: http://twitter.com/mwessendorf



More information about the aerogear-dev mailing list