Skip to content

ronmamo/dropwizard-bundler

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

##Dropwizard-Bundler##

Build Status


Dropwizard-Bundler is a set of Dropwizard extensions, which provides

  • Guice support and auto discovery of modules, bundles, resources and more (1)
  • Auto Rest support and Swagger for @Redis and @Elastic annotated model classes - (1 2)
  • Auto persist based on model usage - (1)

###KickStart### For a kickstart introduction, take a look at the ImdbSample, and BundlerImdbAppExampleTest

To see it in action:

####WalkThrough ImdbSample####

Given a data model class, such as:

public class ImdbInfo {
    @Id public String imdbID;
    public String Title;
    public Integer Year;
    public String Director;
    ...
}

Adding @Redis/@Elastic on top:

@Redis
@Elastic
public class ImdbInfo {
    @Id public String imdbID;
    public String Title;
    public Integer Year;
    public String Director;
    ...
}

Enables you to use RedisClient/ElasticClient for basic peristence:

@Inject RedisClient redisClient;
@Inject ElasticClient elasticClient;

...
  redisClient.put(imdbInfo);
  elasticClient.put(imdbInfo);
  
  redisClient.get(ImdbInfo.class, "id1");
...

#####RefModel#####

RedisClient also provides getByProperty:

  List<ImdbInfo> list = 
      redisClient.getByProperty(ImdbInfo.class, RefModel.ImdbInfo.Title.name(), "Pulp Fiction");

Where RefModel is an auto generated class, representing model class properties - and can be addressed statically

//generated ...
public interface RefModel {
    @RefPackage("my.app.model...")
    public enum ImdbInfo { imdbID, Title, Year, Director, Plot }
}

The properties that are actually used in the code, generated into RefScheme class:

//generated ...
public interface RefScheme {
    @RefPackage("my.app.model...")
    public enum ImdbInfo { Title, Director } //only title and director
}

And each property is used as an index when persisting - for Redis as keys (1), and for Elastic as mapping (2)

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published