AdamBien / marina

Headlands Data Injector

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

marina

Headlands Data Injector

installation

<dependency>
  <groupId>com.airhacks</groupId>
  <artifactId>marina</artifactId>
  <version>0.0.1</version>
</dependency>

description

marina is a client for the RESTful interface of the headlands project.

The values are injected from the specified cache with the @CacheEntry qualifier:

An headlands instance running on host "headlands" on port "8080" is asked for the value of the key "msg" from the cache "configuration":

    @Inject
    @CacheEntry(host = "headlands", port = 8080, cache = "configuration", key = "msg")
    Instance<String> dynamicMessage;

An headlands instance running on host "headlands" on port "8080" is asked for the value of the key "notexisting" from the cache "configuration". In case the key is not found, the default value "doesnotexist" is returned.

    @Inject
    @CacheEntry(host = "headlands", port = 8080, cache = "configuration", key = "notexisting", defaultValue = "doesnotexist")
    String notexistingWithDefault;

An headlands instance running on host "headlands" on port "8080" is asked for the cache "configuration" abstracted as Function<String,String>. The call Function#apply(key) will return the current value from the cache.

    @Inject
    @CacheEntry(host = "headlands", port = 8080, cache = "configuration")
    Function<String, String> configurationCache;

About

Headlands Data Injector

License:Apache License 2.0


Languages

Language:Java 86.7%Language:HTML 13.3%