Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/unistra/gspore
https://github.com/unistra/gspore
Last synced: 10 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/unistra/gspore
- Owner: unistra
- Created: 2014-04-22T09:46:50.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2016-10-19T09:02:47.000Z (about 8 years ago)
- Last Synced: 2024-04-16T02:00:02.527Z (7 months ago)
- Language: Groovy
- Size: 21.6 MB
- Stars: 5
- Watchers: 21
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
gspore
======>Gspore is intended on being used as a .jar which is
>sufficient to allow java or groovy application that include it to consume SPORE implementing webservices.>It allows the consuming app to instanciate
>spore clients on the basis of api descriptions and to use them.
>Clients are generated with a set of class methods that matches the set of functionalities described in the api description, all of which are indeed callable, and send actual HTTP requests constructed according to the
specification.>The raw features of the spore client and it's
>dynamically generated methods can be customized by the middlewares,
>which are specific workflow rewriters that are added on client scope,
>but can be enabled in a conditional fashion(e.g add authentication element on client scope).>The standard use of gspore should be something like
1. Generate a client through api descritpion
2. Create and enable, conditionaly or not, Middlewares
3. Make requests>To summarize, the workflow processes through the following steps:
1. feed() function is given the api description, and returns either
errors or a Spore.
2. In the second case, the Spore either returns errors or it adds itself one class method for each method registered in the api description Json under the entry "methods".
3. By that point, basic HTTP request can be issued, and Middlewares can be enabled.
4. If Middlewares were enabled, the method calls are intercepted and passed through each middleware, in enablement order, being potentially rewritten in the process.
5. Unless the request was canceled, response structuring elements of the request go through each optional middleware post-processing callback in reverse enablement order.
6. If no middleware prevented it from doing so, the request is actually sent.
7. A response is returned to the client.Install
-------* git clone https://github.com/unistra/gspore.git
* cd gspore
* mvn installSPORE CLIENT
------------###sample groovy syntax :
>*//Create or get client*
>**Spore spore = getClient("Client","/pathToMyJson/test.json")**
>*//Enable Middleware, from hard-coded class or by generating a modified at runtime Middleware*
>**spore.enable(spore.Middleware,[
"processRequest":{localArgs->
localArgs["spore.headers"]=["k":"v"]}, payload:["entry":["subEntry":'value']]
])**>*//same thing, with a boolean returning closure to specify wether or not
the Middleware should be enabled*>**spore.enableIf(spore.Middleware,[payload:["entry":["subEntry":'value']]){args->
args['name']=="retrieve_page"
}**>*//call method*
>**spore.methodNameFoundInTheJson([arg1:"test",arg2:2,id:"unid"])**
###sample java syntax :
>*//Create or get client*
>**Spore spore = getClient("Client","/pathToMyJson/test.json");**
>*//Instanciate Middleware from hard-coded class*>**JContentTypeSetter j = new JContentTypeSetter();**
>*//enable Middleware conditionnaly or not*
>**spore.enable(j.getClass(), args);**
>**Map args0 = new HashMap();**
>*//call method*
>**spore.invokeMethod("methodNameFoundInTheJson",args0)**