Skip to content

Instantly share code, notes, and snippets.

View matzew's full-sized avatar
💩
hacking hacking hacking!

Matthias Wessendorf matzew

💩
hacking hacking hacking!
  • Red Hat
  • Emsdetten, Germany
View GitHub Profile
@matzew
matzew / gist:3426019
Created August 22, 2012 14:12
properties on pipe object
/**
* AGPipe represents a server connection. An object of this class is responsible to
* communicate with the server and perfoms read/write operations.
*/
@protocol AGPipe <NSObject>
/**
* Returns the type of the underlying 'pipe implementation'
*/
@property (nonatomic, readonly) NSString* type;
@matzew
matzew / gist:3436023
Created August 23, 2012 12:01
iOS read..
...
// get access to the 'projects' pipe..
...
// query all records, by invoking the read function on the actual pipe/connection:
[projectPipe read:^(id responseObject) {
// get's invoked when the response returns....
// do something with the data.... or just log it to the console.....
NSLog(@"Projects: %@", responseObject);
} failure:^(NSError *error) {
@matzew
matzew / gist:3437960
Created August 23, 2012 15:54
Reading from a pipe

A QUICK sample/snippet on reading from a pipe.....

The API

...
/**
 * Reads all the data from the underlying server connection.
 *
  • @param success A block object to be executed when the request operation finishes successfully.
@matzew
matzew / gist:3438453
Created August 23, 2012 16:37
The pipe protocol
/*
* JBoss, Home of Professional Open Source
* Copyright 2012, Red Hat, Inc., and individual contributors
* by the @authors tag. See the copyright.txt in the distribution for a
* full listing of individual contributors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
@matzew
matzew / gist:3508647
Created August 29, 2012 08:41
Read data from app and hand it over to the app
...
// get access to the projects pipe
projectsPipe = [todoPipeline get:@"projects"];
...
__block id dataStructure = nil;
[projectsPipe read:^(id responseObject) {
// store the received data inside of
// the running application:
var baseURL = "http://todo-aerogear.rhcloud.com/todo-server/";
var endpoint = "tasks";
console.log(baseURL+endpoint);
@matzew
matzew / gist:3636354
Created September 5, 2012 13:13
BaseURL and service endpoint

We need to separate the 'base URL' and the service endpoint, when creating new pipes / a new pipeline...

Proposed API

/**
 * A factory method to instantiate the AGPipeline, which
 * contains a RESTful pipe.
 *
 * @param name the name of the first AGPipe object
  • @param baseURL the URL of the server
@matzew
matzew / gist:3637736
Created September 5, 2012 14:48
BaseURL and service endpoint discussion

We need to separate the 'base URL' and the service endpoint, when creating new pipes / a new pipeline...

Creating a Pipeline with a pipe

Proposed API

/**
 * A factory method to instantiate the AGPipeline, which
 * contains a RESTful pipe.
@matzew
matzew / gist:3756911
Created September 20, 2012 16:27
AGStore protocol
/**
* AGStore represents an abstraction layer for a storage system.
*/
@protocol AGStore <NSObject>
/**
* Reads all the data from the underlying storage system.
*
* @param success A block object to be executed when the operation finishes successfully.
* This block has no return value and takes one argument: A collection, containing all stored
@matzew
matzew / gist:3757190
Created September 20, 2012 17:23
AGDataManager
/**
* AGDataManager manages different AGStore implementations. It is basically a
* factory that hides the concrete instanciation of a specific AGStore implementation.
* The class offers simple APIs to add, remove or get access to a 'data store'.
*
* NOTE: Right now, there is NO automatic data sync. This is up to the user.
*/
@interface AGDataManager : NSObject