Skip to content

Instantly share code, notes, and snippets.

View danielpassos's full-sized avatar

Daniel Passos danielpassos

View GitHub Profile
#what is my tenant
curl -ivX GET -H "Content-Type: application/json" 'http://jdoe:password@localhost:8080/hawkular/inventory/tenant' | less
#create resource
curl -ivX POST -H "Content-Type: application/json" -d '{"id": "foobar", "resourceTypeId": "URL", "properties": {"url": "http://hawkular.org"}}' 'http://jdoe:password@127.0.0.1:8080/hawkular/inventory/test/resources' | less
#create metric type
curl -ivX POST -H "Content-Type: application/json" -d '{"id":"MetricType", "unit":"BYTE"}' 'http://jdoe:password/127.0.0.1:8080/hawkular/inventory/metricTypes' | less
@matzew
matzew / gist:3838816
Created October 5, 2012 08:51 — forked from kborchers/gist:3833435
FAQ or Wiki or ...
  • What is a pipeline ?

A pipeline represents a set of n connections to a server. The pipeline class offers some simple 'management' APIs to work with containing 'pipe' objects. Basically it allows you to add or remove new connections to the pipeline.

  • What is a pipe ?

A pipe represents one connection to a server. The pipe API is basically an abstraction layer for any server side connection, which all allows you to simply 'read' from, or 'write' to a server connection. However, technical details like RESTful APIs (e.g. HTTP PUT or HTTT GET) are not exposed on the pipeline and pipe APIs. In the future you can have different type of pipe objects (-> connections). The default (and CURRENTLY only supported) type is a REST connection.

Below is an example from our JavaScript lib:

@matzew
matzew / gist:3857191
Created October 9, 2012 07:34 — forked from cvasilak/gist:3851304
FAQ or Wiki or ...
  • What is a pipeline ?

A pipeline represents a set of n connections to a server. The pipeline class offers some simple 'management' APIs to work with containing 'pipe' objects. Basically it allows you to add or remove new connections to the pipeline.

  • What is a pipe ?

A pipe represents one connection to a server. The pipe API is basically an abstraction layer for any server side connection, which all allows you to simply 'read' from, or 'write' to a server connection. However, technical details like RESTful APIs (e.g. HTTP PUT or HTTT GET) are not exposed on the pipeline and pipe APIs. In the future you can have different type of pipe objects (-> connections). The default (and CURRENTLY only supported) type is a REST connection.

Below is an example from our JavaScript lib:

@matzew
matzew / gist:3945727
Created October 24, 2012 12:09
Private versus internal API

Not exposing implementation details

Looking at this pull request and the related discussion:

  • the Pipe interface is the only access that endusers should have to a pipe.
  • the RestAdapter is a HTTP RESTful implementation of the Pipe.
  • Endusers should not be able do do new RestAdapter(...);

Looking at the discussion of the above PR, it's clear that there exposing internal APIs and/or implementation details has PROs and CONS...

@matzew
matzew / gist:3950763
Created October 25, 2012 06:00
AeroGear-iOS 1.0.0.M1

AeroGear-iOS 1.0.0.M1

A little bit more than two months ago the work on the AeroGear-iOS library started. We added an initial (and simple) API to communicate against RESTful endpoints. The functionality contains:

  • HTTP communication
  • data storage
  • Authentication and user enrollment

This little document describes the API in a more detailed way.

@danbev
danbev / gist:4066691
Created November 13, 2012 16:14
CDI vs web.xml configuration

CDI vs web.xml configuration

To help decide which approach is best for our users this gist will show how configuring CORS in AeroGear Controller would be like using CDI and via web.xml

CDI

For a CDI version and the specific case of CORS users will probably need to provide their own configuration settings. The proposed solution for this is for a user to provide a CDI Producer, for example:

public class CorsConfigProducer {
    public @Produces CorsConfiguration getConfiguration() {
        return CorsConfig.create()
 .enableCorsSupport(true)
@mstruk
mstruk / gist:4074544
Created November 14, 2012 20:24
PipeConfig Ergonomics

Currently, when creating a new PipeConfig we use a constructor and specify a rootUrl:

    URL rootUrl = new URL("http://todo-aerogear.rhcloud.com/todo-server");

    Pipeline pipeline = new Pipeline(rootUrl);
    PipeConfig config = new PipeConfig(rootUrl, Project.class);

    Pipe<Project> projects = pipeline.pipe(Project.class, config);
@secondsun
secondsun / gist:4078711
Created November 15, 2012 13:40 — forked from mstruk/gist:4074544
PipeConfig Ergonomics

Currently, when creating a new PipeConfig we use a constructor and specify a rootUrl:

    URL rootUrl = new URL("http://todo-aerogear.rhcloud.com/todo-server");

    Pipeline pipeline = new Pipeline(rootUrl);
    PipeConfig config = new PipeConfig(rootUrl, Project.class);

    Pipe<Project> projects = pipeline.pipe(Project.class, config);
@danbev
danbev / gist:4147473
Created November 26, 2012 10:02
Paging/Querying in AeroGear Controller

Paging/Querying in AeroGear Controller

This document is intended to discuss a solution for AEROGEAR-645 "Add Query/Paging support on RESTful endpoints".
This dev-aerogear mail list thread was used as a starting point to gather requirements and ideas.

Background

Lets just clarify the two concepts that we are dealing with here, Paging and Query.

Paging

Paging deals with limiting the number of results returned from a single request. One "page" can contain a certain number of items as the result of invoking a request, sometimes referred to the size of a page. Let say you want to limit you the number of result returned to 10 items, this could look something like this:

@fnando
fnando / gist:4356057
Created December 21, 2012 21:49
Open screen session and connect to given ssh domain. Usage: $ ./prod example.org
#!/usr/bin/env bash
domain=$1
filename="/tmp/$(echo -n "$domain" | md5)"
read -r -d '' screenrc <<SCREENRC
startup_message off
shell /usr/local/bin/bash
autodetach on
defscrollback 10000