Formatted project

Change-Id: I6993ddfab02e06541b4138040280a4777c719562
diff --git a/full/src/main/java/de/ids_mannheim/korap/config/Attributes.java b/full/src/main/java/de/ids_mannheim/korap/config/Attributes.java
index e2e4ed5..dde3291 100644
--- a/full/src/main/java/de/ids_mannheim/korap/config/Attributes.java
+++ b/full/src/main/java/de/ids_mannheim/korap/config/Attributes.java
@@ -4,17 +4,17 @@
 
     public static final String AUTHENTICATION_TIME = "auth_time";
     public static final String DEFAULT_TIME_ZONE = "Europe/Berlin";
-    
+
     public static final String AUTHORIZATION = "Authorization";
     // moved to de.ids_mannheim.korap.config.AuthenticationScheme
-//    public static final String SESSION_AUTHENTICATION = "session_token";
-//    public static final String API_AUTHENTICATION = "api_token";
-//    public static final String OAUTH2_AUTHORIZATION = "bearer";
-//    public static final String BASIC_AUTHENTICATION = "basic";
+    //    public static final String SESSION_AUTHENTICATION = "session_token";
+    //    public static final String API_AUTHENTICATION = "api_token";
+    //    public static final String OAUTH2_AUTHORIZATION = "bearer";
+    //    public static final String BASIC_AUTHENTICATION = "basic";
 
     public static final String LOCATION = "location"; // location of Client: User.INTERN/EXTERN
     public static final String CORPUS_ACCESS = "corpusAccess"; // User.ALL/PUB/FREE.
-    
+
     public static final String CLIENT_ID = "client_id";
     public static final String CLIENT_SECRET = "client_secret";
     public static final String SCOPE = "scope";
@@ -99,7 +99,7 @@
     public static final String TEXT_SIGLE = "textSigle";
 
     public static final String AVAILABILITY = "availability";
-    
+
     public static final String REF_CORPUS = "refCorpus";
     public static final String QUERY = "query";
     public static final String CACHE = "cache";
@@ -147,7 +147,7 @@
     public static final String DEFAULT_FOUNDRY_RELATION = "relation-foundry";
     public static final String DEFAULT_FOUNDRY_MORPHOLOGY = "morphology-foundry";
     public static final String DEFAULT_FOUNDRY_STRUCTURE = "structure-foundry";
-    
+
     /**
      * db column keys
      */
diff --git a/full/src/main/java/de/ids_mannheim/korap/config/BeansFactory.java b/full/src/main/java/de/ids_mannheim/korap/config/BeansFactory.java
index 46d319e..2616870 100644
--- a/full/src/main/java/de/ids_mannheim/korap/config/BeansFactory.java
+++ b/full/src/main/java/de/ids_mannheim/korap/config/BeansFactory.java
@@ -20,33 +20,29 @@
 
     private static ContextHolder beanHolder;
 
-
     //todo: allow this for external plugin systems that are not kustvakt specific
     @Deprecated
     public static void setCustomBeansHolder (ContextHolder holder) {
         beanHolder = holder;
     }
 
-
     public static synchronized ContextHolder getKustvaktContext () {
         return beanHolder;
     }
 
-
     public static synchronized ContextHolder getKustvaktContext (int i) {
         return beanHolder;
     }
 
-
     public static synchronized TypeBeanFactory getTypeFactory () {
         return new TypeBeanFactory();
     }
 
-
     public static int loadClasspathContext (String ... files) {
         ApplicationContext context;
         if (files.length == 0)
-            throw new IllegalArgumentException("Spring XML config file is not specified.");
+            throw new IllegalArgumentException(
+                    "Spring XML config file is not specified.");
         else
             context = new ClassPathXmlApplicationContext(files);
         ContextHolder h = new ContextHolder(context) {};
@@ -55,7 +51,6 @@
         return 0;
     }
 
-
     public static synchronized int addApplicationContext (
             ApplicationContext context) {
         ContextHolder h = new ContextHolder(context) {};
@@ -64,12 +59,10 @@
         return 0;
     }
 
-
     public static synchronized void setKustvaktContext (ContextHolder holder) {
         BeansFactory.beanHolder = holder;
     }
 
-
     public static synchronized int setApplicationContext (
             ApplicationContext context) {
         ContextHolder h = new ContextHolder(context) {};
@@ -77,7 +70,6 @@
         return 0;
     }
 
-
     public static synchronized int loadFileContext (String filepath) {
         ApplicationContext context = new FileSystemXmlApplicationContext(
                 "file:" + filepath);
@@ -86,19 +78,16 @@
         return 0;
     }
 
-
     public static void closeApplication () {
         BeansFactory.beanHolder = null;
     }
 
-
     //todo: set response handler
     @Deprecated
     public static CoreResponseHandler getResponseHandler () {
         return null;
     }
 
-
     public BeansFactory () {}
 
     public static class TypeBeanFactory {
@@ -116,7 +105,6 @@
                             + "'");
         }
 
-
         @Deprecated
         public <T> T getTypedBean (Collection objs, Class type) {
             for (Object o : objs) {
diff --git a/full/src/main/java/de/ids_mannheim/korap/config/ConfigLoader.java b/full/src/main/java/de/ids_mannheim/korap/config/ConfigLoader.java
index 9fcc3bd..a8ec0a0 100644
--- a/full/src/main/java/de/ids_mannheim/korap/config/ConfigLoader.java
+++ b/full/src/main/java/de/ids_mannheim/korap/config/ConfigLoader.java
@@ -16,10 +16,8 @@
 
     private static final Logger jlog = LogManager.getLogger(ConfigLoader.class);
 
-
     private ConfigLoader () {}
 
-
     public static InputStream loadConfigStream (String name) {
         InputStream stream = null;
         try {
@@ -31,25 +29,27 @@
             }
             else {
                 jlog.info("Loading config '" + name + "' from classpath!");
-                stream = ConfigLoader.class.getClassLoader().getResourceAsStream(
-                        name);
+                stream = ConfigLoader.class.getClassLoader()
+                        .getResourceAsStream(name);
             }
         }
         catch (IOException e) {
             // do nothing
         }
         if (stream == null)
-            throw new RuntimeException("Config file '"+name+"' could not be loaded ...");
+            throw new RuntimeException(
+                    "Config file '" + name + "' could not be loaded ...");
         return stream;
     }
 
-
-    public static Properties loadProperties (String name){
+    public static Properties loadProperties (String name) {
         Properties p = new Properties();
         try {
             p.load(loadConfigStream(name));
-        } catch (IOException e) {
-            throw new RuntimeException("Properties from config file '"+name+"' could not be loaded ...");
+        }
+        catch (IOException e) {
+            throw new RuntimeException("Properties from config file '" + name
+                    + "' could not be loaded ...");
         }
         return p;
     }
diff --git a/full/src/main/java/de/ids_mannheim/korap/config/ContextHolder.java b/full/src/main/java/de/ids_mannheim/korap/config/ContextHolder.java
index 7626ec1..3d26bcc 100644
--- a/full/src/main/java/de/ids_mannheim/korap/config/ContextHolder.java
+++ b/full/src/main/java/de/ids_mannheim/korap/config/ContextHolder.java
@@ -27,7 +27,6 @@
     private ApplicationContext context = null;
     private DefaultHandler handler;
 
-
     public ContextHolder (ApplicationContext context) {
         this.handler = new DefaultHandler();
         this.context = context;
@@ -35,7 +34,6 @@
         new CoreResponseHandler();
     }
 
-
     protected <T> T getBean (Class<T> clazz) {
         if (this.context != null) {
             try {
@@ -48,7 +46,6 @@
         return this.handler.getDefault(clazz);
     }
 
-
     protected <T> T getBean (String name) {
         T bean = null;
         if (this.context != null) {
@@ -64,7 +61,6 @@
         return bean;
     }
 
-
     @Deprecated
     public <T extends KustvaktConfiguration> T getConfiguration () {
         return (T) getBean(KUSTVAKT_CONFIG);
diff --git a/full/src/main/java/de/ids_mannheim/korap/config/DefaultHandler.java b/full/src/main/java/de/ids_mannheim/korap/config/DefaultHandler.java
index 982985f..df7be47 100644
--- a/full/src/main/java/de/ids_mannheim/korap/config/DefaultHandler.java
+++ b/full/src/main/java/de/ids_mannheim/korap/config/DefaultHandler.java
@@ -12,13 +12,11 @@
 
     private Map<String, Object> defaults;
 
-
     public DefaultHandler () {
         this.defaults = new HashMap<>();
         loadClasses();
     }
 
-
     private void loadClasses () {
         Set<Class<?>> cls = KustvaktClassLoader
                 .loadFromAnnotation(Configurable.class);
@@ -34,12 +32,10 @@
         }
     }
 
-
     public Object getDefault (String name) {
         return this.defaults.get(name);
     }
 
-
     public <T> T getDefault (Class<T> tClass) {
         for (Object o : this.defaults.values()) {
             if (o.getClass().equals(tClass))
@@ -48,12 +44,10 @@
         return null;
     }
 
-
     public void remove (String name) {
         this.defaults.remove(name);
     }
 
-
     @Override
     public String toString () {
         return defaults.toString();
diff --git a/full/src/main/java/de/ids_mannheim/korap/config/FullConfiguration.java b/full/src/main/java/de/ids_mannheim/korap/config/FullConfiguration.java
index a1ba12f..0a904d3 100644
--- a/full/src/main/java/de/ids_mannheim/korap/config/FullConfiguration.java
+++ b/full/src/main/java/de/ids_mannheim/korap/config/FullConfiguration.java
@@ -26,7 +26,7 @@
  */
 
 public class FullConfiguration extends KustvaktConfiguration {
-    public static Logger jlog = LogManager.getLogger(FullConfiguration.class);    
+    public static Logger jlog = LogManager.getLogger(FullConfiguration.class);
     // mail configuration
     private boolean isMailEnabled;
     private String testEmail;
@@ -63,19 +63,19 @@
     private int refreshTokenLongExpiry;
     private int refreshTokenExpiry;
     private int authorizationCodeExpiry;
-    
+
     private int maxNumberOfUserQueries;
-    
+
     private URL issuer;
 
     private String namedVCPath;
-    
+
     private boolean createInitialSuperClient;
 
     public FullConfiguration (Properties properties) throws Exception {
         super(properties);
     }
-    
+
     public FullConfiguration () {
         super();
     }
@@ -97,23 +97,24 @@
         setOAuth2Configuration(properties);
 
         setNamedVCPath(properties.getProperty("krill.namedVC", ""));
-        
-//        Cache cache = CacheManager.newInstance().getCache("named_vc");
-//        CacheConfiguration config = cache.getCacheConfiguration();
-//        config.setMaxBytesLocalHeap(properties.getProperty("cache.max.bytes.local.heap", "256m"));
-//        config.setMaxBytesLocalDisk(properties.getProperty("cache.max.bytes.local.disk", "2G"));
-//        jlog.info("max local heap:"+config.getMaxBytesLocalHeapAsString());
-//        jlog.info("max local disk:"+config.getMaxBytesLocalDiskAsString());
-        
+
+        //        Cache cache = CacheManager.newInstance().getCache("named_vc");
+        //        CacheConfiguration config = cache.getCacheConfiguration();
+        //        config.setMaxBytesLocalHeap(properties.getProperty("cache.max.bytes.local.heap", "256m"));
+        //        config.setMaxBytesLocalDisk(properties.getProperty("cache.max.bytes.local.disk", "2G"));
+        //        jlog.info("max local heap:"+config.getMaxBytesLocalHeapAsString());
+        //        jlog.info("max local disk:"+config.getMaxBytesLocalDiskAsString());
+
         setMaxNumberOfUserQueries(Integer.parseInt(
                 properties.getProperty("max.user.persistent.queries", "20")));
     }
 
-    private void setSecurityConfiguration (Properties properties) throws MalformedURLException {
+    private void setSecurityConfiguration (Properties properties)
+            throws MalformedURLException {
         setSecureHashAlgorithm(Enum.valueOf(EncryptionIface.Encryption.class,
                 properties.getProperty("security.secure.hash.algorithm",
                         "BCRYPT")));
-        
+
         String issuerStr = properties.getProperty("security.jwt.issuer",
                 "https://korap.ids-mannheim.de");
 
@@ -129,8 +130,8 @@
                         "oauth2.password.authentication", "TEST")));
         setNativeClientHost(properties.getProperty("oauth2.native.client.host",
                 "korap.ids-mannheim.de"));
-        setCreateInitialSuperClient(Boolean.valueOf(
-                properties.getProperty("oauth2.initial.super.client", "false")));
+        setCreateInitialSuperClient(Boolean.valueOf(properties
+                .getProperty("oauth2.initial.super.client", "false")));
 
         setMaxAuthenticationAttempts(Integer
                 .parseInt(properties.getProperty("oauth2.max.attempts", "1")));
@@ -146,11 +147,11 @@
                 properties.getProperty("oauth2.refresh.token.expiry", "90D"));
         authorizationCodeExpiry = TimeUtils.convertTimeToSeconds(properties
                 .getProperty("oauth2.authorization.code.expiry", "10M"));
-        
-        setAccessTokenLongExpiry(TimeUtils.convertTimeToSeconds(
-                properties.getProperty("oauth2.access.token.long.expiry", "365D")));
-        setRefreshTokenLongExpiry(TimeUtils.convertTimeToSeconds(
-                properties.getProperty("oauth2.refresh.token.long.expiry", "365D")));
+
+        setAccessTokenLongExpiry(TimeUtils.convertTimeToSeconds(properties
+                .getProperty("oauth2.access.token.long.expiry", "365D")));
+        setRefreshTokenLongExpiry(TimeUtils.convertTimeToSeconds(properties
+                .getProperty("oauth2.refresh.token.long.expiry", "365D")));
     }
 
     private void setMailConfiguration (Properties properties) {
@@ -476,7 +477,7 @@
     public boolean createInitialSuperClient () {
         return createInitialSuperClient;
     }
-    
+
     public void setCreateInitialSuperClient (boolean initialSuperClient) {
         this.createInitialSuperClient = initialSuperClient;
     }
@@ -488,5 +489,5 @@
     public void setMaxNumberOfUserQueries (int maxNumberOfUserQueries) {
         this.maxNumberOfUserQueries = maxNumberOfUserQueries;
     }
-    
+
 }
diff --git a/full/src/main/java/de/ids_mannheim/korap/config/JWTSigner.java b/full/src/main/java/de/ids_mannheim/korap/config/JWTSigner.java
index 63ec65e..d8f3341 100644
--- a/full/src/main/java/de/ids_mannheim/korap/config/JWTSigner.java
+++ b/full/src/main/java/de/ids_mannheim/korap/config/JWTSigner.java
@@ -40,13 +40,12 @@
 
     private static Logger jlog = LogManager.getLogger(JWTSigner.class);
     public static boolean DEBUG = false;
-    
+
     private URL issuer;
     private JWSSigner signer;
     private JWSVerifier verifier;
     private final int defaultttl;
 
-
     public JWTSigner (final byte[] secret, URL issuer, final int defaulttl)
             throws JOSEException {
         this.issuer = issuer;
@@ -55,18 +54,15 @@
         this.defaultttl = defaulttl;
     }
 
-
     public JWTSigner (final byte[] secret, String issuer)
             throws MalformedURLException, JOSEException {
         this(secret, new URL(issuer), 72 * 60 * 60);
     }
 
-
     public SignedJWT createJWT (User user, Map<String, Object> attr) {
         return signContent(user, attr, defaultttl);
     }
 
-
     public SignedJWT signContent (User user, Map<String, Object> attr,
             int ttl) {
         String scopes;
@@ -91,11 +87,12 @@
         csBuilder.expirationTime(TimeUtils.getNow().plusSeconds(ttl).toDate());
         csBuilder.claim(Attributes.AUTHENTICATION_TIME,
                 attr.get(Attributes.AUTHENTICATION_TIME));
-        
+
         JWTClaimsSet jwtClaimsSet = csBuilder.build();
-        if (DEBUG) jlog.debug(jwtClaimsSet.getClaim(Attributes.AUTHENTICATION_TIME));
-        SignedJWT signedJWT =
-                new SignedJWT(new JWSHeader(JWSAlgorithm.HS256), jwtClaimsSet);
+        if (DEBUG)
+            jlog.debug(jwtClaimsSet.getClaim(Attributes.AUTHENTICATION_TIME));
+        SignedJWT signedJWT = new SignedJWT(new JWSHeader(JWSAlgorithm.HS256),
+                jwtClaimsSet);
         try {
             signedJWT.sign(signer);
         }
@@ -105,7 +102,6 @@
         return signedJWT;
     }
 
-
     /**
      * @param username
      * @param json
@@ -115,14 +111,16 @@
             String json, int ttl) {
         Builder cs = new JWTClaimsSet.Builder();
         cs.subject(username);
-        if (!json.isEmpty()) cs.claim("data", json);
+        if (!json.isEmpty())
+            cs.claim("data", json);
         cs.expirationTime(TimeUtils.getNow().plusSeconds(ttl).toDate());
         cs.issuer(this.issuer.toString());
 
-        if (!userclient.isEmpty()) cs.claim("userip", userclient);
+        if (!userclient.isEmpty())
+            cs.claim("userip", userclient);
 
-        SignedJWT signedJWT =
-                new SignedJWT(new JWSHeader(JWSAlgorithm.HS256), cs.build());
+        SignedJWT signedJWT = new SignedJWT(new JWSHeader(JWSAlgorithm.HS256),
+                cs.build());
         try {
             signedJWT.sign(signer);
         }
@@ -132,24 +130,20 @@
         return signedJWT;
     }
 
-
     public SignedJWT signContent (String username, String userclient,
             String json) {
         return signContent(username, userclient, json, defaultttl);
     }
 
-
     public SignedJWT createSignedToken (String username) {
         return createSignedToken(username, defaultttl);
     }
 
-
     // add client info
     public SignedJWT createSignedToken (String username, int ttl) {
         return signContent(username, "", "", ttl);
     }
 
-
     public SignedJWT verifyToken (String token) throws KustvaktException {
         SignedJWT client;
         try {
@@ -171,7 +165,6 @@
         return client;
     }
 
-
     // does not care about expiration times
     public String retrieveContent (String signedContent)
             throws KustvaktException {
@@ -188,7 +181,6 @@
         }
     }
 
-
     public TokenContext getTokenContext (String idtoken)
             throws ParseException, JOSEException, KustvaktException {
         SignedJWT signedJWT = verifyToken(idtoken);
@@ -202,10 +194,10 @@
         c.setExpirationTime(
                 signedJWT.getJWTClaimsSet().getExpirationTime().getTime());
 
-        Instant instant = Instant.ofEpochMilli((long) signedJWT.getJWTClaimsSet()
-                .getClaim(Attributes.AUTHENTICATION_TIME));
-        ZonedDateTime zonedAuthTime = ZonedDateTime.ofInstant(
-                instant, ZoneId.of(Attributes.DEFAULT_TIME_ZONE));
+        Instant instant = Instant.ofEpochMilli((long) signedJWT
+                .getJWTClaimsSet().getClaim(Attributes.AUTHENTICATION_TIME));
+        ZonedDateTime zonedAuthTime = ZonedDateTime.ofInstant(instant,
+                ZoneId.of(Attributes.DEFAULT_TIME_ZONE));
         c.setAuthenticationTime(zonedAuthTime);
         c.setToken(idtoken);
         c.addParams(signedJWT.getJWTClaimsSet().getClaims());
diff --git a/full/src/main/java/de/ids_mannheim/korap/config/KustvaktCacheable.java b/full/src/main/java/de/ids_mannheim/korap/config/KustvaktCacheable.java
index a66486f..c8971ea 100644
--- a/full/src/main/java/de/ids_mannheim/korap/config/KustvaktCacheable.java
+++ b/full/src/main/java/de/ids_mannheim/korap/config/KustvaktCacheable.java
@@ -23,37 +23,33 @@
     private String prefix;
     private String name;
 
-    public KustvaktCacheable(String cache_name, String prefix) {
+    public KustvaktCacheable (String cache_name, String prefix) {
         init();
-        if(!enabled())
+        if (!enabled())
             createDefaultFileCache(cache_name);
         this.prefix = prefix;
         this.name = cache_name;
     }
-    
+
     public KustvaktCacheable () {
         // TODO Auto-generated constructor stub
     }
 
-    private static Cache getCache(String name) {
+    private static Cache getCache (String name) {
         return CacheManager.getInstance().getCache(name);
     }
 
-
-    private void createDefaultFileCache(String name) {
-        Cache default_cache = new Cache(
-                new CacheConfiguration(name, 20000)
-                        .memoryStoreEvictionPolicy(MemoryStoreEvictionPolicy.LFU)
-                        .eternal(false)
-                        .timeToLiveSeconds(15000)
-                        .timeToIdleSeconds(5000)
-                        .diskExpiryThreadIntervalSeconds(0)
-                        .persistence(new PersistenceConfiguration().strategy(PersistenceConfiguration.Strategy.LOCALTEMPSWAP)));
+    private void createDefaultFileCache (String name) {
+        Cache default_cache = new Cache(new CacheConfiguration(name, 20000)
+                .memoryStoreEvictionPolicy(MemoryStoreEvictionPolicy.LFU)
+                .eternal(false).timeToLiveSeconds(15000).timeToIdleSeconds(5000)
+                .diskExpiryThreadIntervalSeconds(0)
+                .persistence(new PersistenceConfiguration().strategy(
+                        PersistenceConfiguration.Strategy.LOCALTEMPSWAP)));
         if (!CacheManager.getInstance().cacheExists(name))
             CacheManager.getInstance().addCache(default_cache);
     }
 
-
     public void init () {
         if (!loaded) {
             if (ServiceInfo.getInfo().getCacheable()) {
@@ -61,62 +57,62 @@
                 InputStream in = ConfigLoader.loadConfigStream(file);
                 CacheManager.newInstance(in);
                 loaded = true;
-            } else {
+            }
+            else {
                 CacheManager.create();
             }
         }
     }
 
-    public boolean hasCacheEntry(Object key) {
+    public boolean hasCacheEntry (Object key) {
         return getCache(this.name).isKeyInCache(createKey(key.toString()));
     }
 
-
-    public boolean enabled() {
+    public boolean enabled () {
         // check that caching is enabled
         return ServiceInfo.getInfo().getCacheable();
     }
 
-    public Object getCacheValue(Object key) {
+    public Object getCacheValue (Object key) {
         Element e = getCache(this.name).get(createKey(key.toString()));
-        if (e!= null)
+        if (e != null)
             return e.getObjectValue();
         return null;
     }
 
-    public long getCacheCreationTime(Object key) {
+    public long getCacheCreationTime (Object key) {
         Element e = getCache(this.name).get(createKey(key.toString()));
-        if (e!= null)
+        if (e != null)
             return e.getCreationTime();
         return -1;
     }
 
-    public void storeInCache(Object key, Object value) {
+    public void storeInCache (Object key, Object value) {
         getCache(this.name).put(new Element(createKey(key.toString()), value));
     }
 
-    public void removeCacheEntry(Object key) {
+    public void removeCacheEntry (Object key) {
         getCache(this.name).remove(createKey(key.toString()));
     }
 
-    public void clearCache() {
+    public void clearCache () {
         Cache c = getCache(this.name);
         if (enabled()) {
             c.removeAll();
-//            c.clearStatistics();
-            
+            //            c.clearStatistics();
+
         }
     }
 
-    private String createKey(String input) {
-        return StringUtils.toSHAHash(this.prefix+ "@" + input);
+    private String createKey (String input) {
+        return StringUtils.toSHAHash(this.prefix + "@" + input);
     }
-    
+
     public Map<Object, Element> getAllCacheElements () {
         Cache cache = getCache(name);
         return cache.getAll(cache.getKeysWithExpiryCheck());
     }
-    
+
     public List getKeysWithExpiryCheck () {
         Cache cache = getCache(name);
         return cache.getKeysWithExpiryCheck();
diff --git a/full/src/main/java/de/ids_mannheim/korap/config/KustvaktClassLoader.java b/full/src/main/java/de/ids_mannheim/korap/config/KustvaktClassLoader.java
index 83100bc..860d373 100644
--- a/full/src/main/java/de/ids_mannheim/korap/config/KustvaktClassLoader.java
+++ b/full/src/main/java/de/ids_mannheim/korap/config/KustvaktClassLoader.java
@@ -16,10 +16,8 @@
     private static final Reflections reflections = new Reflections(
             "de.ids_mannheim.korap");
 
-
     private KustvaktClassLoader () {}
 
-
     /**
      * loads interface implementations in current classpath
      * 
@@ -31,13 +29,11 @@
         return reflections.getSubTypesOf(iface);
     }
 
-
     public static Set<Class<?>> loadFromAnnotation (
             Class<? extends Annotation> annotation) {
         return reflections.getTypesAnnotatedWith(annotation);
     }
 
-
     public static <T> Class<? extends T> getTypeClass (Class type,
             Class<T> iface) {
         Set<Class<? extends T>> c = KustvaktClassLoader.loadSubTypes(iface);
diff --git a/full/src/main/java/de/ids_mannheim/korap/config/KustvaktConfiguration.java b/full/src/main/java/de/ids_mannheim/korap/config/KustvaktConfiguration.java
index 40073b8..b838073 100644
--- a/full/src/main/java/de/ids_mannheim/korap/config/KustvaktConfiguration.java
+++ b/full/src/main/java/de/ids_mannheim/korap/config/KustvaktConfiguration.java
@@ -22,11 +22,12 @@
 import lombok.Setter;
 
 /**
- * Describes configuration for Kustvakt by importing properties 
- * from kustvakt.conf file and setting default values if they are 
- * not configured.  
+ * Describes configuration for Kustvakt by importing properties
+ * from kustvakt.conf file and setting default values if they are
+ * not configured.
  * 
- * MH: if configuration class is extended, loadSubTypes method should be
+ * MH: if configuration class is extended, loadSubTypes method should
+ * be
  * overriden
  * 
  * @author hanl
@@ -41,7 +42,7 @@
     public static final String DATA_FOLDER = "data";
 
     private String vcInCaching;
-    
+
     private String indexDir;
     private int port;
     // todo: make exclusive so that the containg languages can really
@@ -94,7 +95,7 @@
     // deprec?!
     private final BACKENDS DEFAULT_ENGINE = BACKENDS.LUCENE;
     private String networkEndpointURL;
-    
+
     // license patterns
     protected Pattern publicLicensePattern;
     protected Pattern freeLicensePattern;
@@ -107,28 +108,28 @@
     // EM: metadata restriction
     // another variable might be needed to define which metadata fields are restricted 
     private boolean isMetadataRestricted = false;
-    
+
     // EM: Maybe needed when we support pipe registration
     @Deprecated
     public static Map<String, String> pipes = new HashMap<>();
-    
+
     public KustvaktConfiguration (Properties properties) throws Exception {
         load(properties);
-//        readPipesFile("pipes");
+        //        readPipesFile("pipes");
         KrillProperties.setProp(properties);
     }
 
     public KustvaktConfiguration () {}
-    
+
     public void loadBasicProperties (Properties properties) {
         port = Integer.valueOf(properties.getProperty("server.port", "8095"));
         baseURL = properties.getProperty("kustvakt.base.url", "/api/*");
-        setSecureRandomAlgorithm(properties
-                .getProperty("security.secure.random.algorithm", ""));
+        setSecureRandomAlgorithm(
+                properties.getProperty("security.secure.random.algorithm", ""));
         setMessageDigestAlgorithm(
                 properties.getProperty("security.md.algorithm", "MD5"));
     }
-    
+
     /**
      * loading of the properties and mapping to parameter variables
      * 
@@ -139,23 +140,26 @@
     protected void load (Properties properties) throws Exception {
         loadBasicProperties(properties);
 
-        apiWelcomeMessage = properties.getProperty("api.welcome.message", "Welcome to KorAP API!");
+        apiWelcomeMessage = properties.getProperty("api.welcome.message",
+                "Welcome to KorAP API!");
         currentVersion = properties.getProperty("current.api.version", "v1.0");
 
-        String supportedVersions =
-                properties.getProperty("supported.api.versions", "");
-        
+        String supportedVersions = properties
+                .getProperty("supported.api.versions", "");
+
         this.supportedVersions = new HashSet<>();
-        if (!supportedVersions.isEmpty()){
-            List<String> versionArray = Arrays.asList(supportedVersions.split(" "));
+        if (!supportedVersions.isEmpty()) {
+            List<String> versionArray = Arrays
+                    .asList(supportedVersions.split(" "));
             this.supportedVersions.addAll(versionArray);
         }
         this.supportedVersions.add(currentVersion);
 
         maxhits = Integer.valueOf(properties.getProperty("maxhits", "50000"));
-        returnhits = Integer.valueOf(properties.getProperty("returnhits", "50000"));
+        returnhits = Integer
+                .valueOf(properties.getProperty("returnhits", "50000"));
         indexDir = properties.getProperty("krill.indexDir", "");
-        
+
         // server options
         serverHost = String
                 .valueOf(properties.getProperty("server.host", "localhost"));
@@ -165,18 +169,19 @@
         for (String querylang : qls)
             queryLanguages.add(querylang.trim().toUpperCase());
 
-        default_const =
-                properties.getProperty("default.foundry.constituent", "corenlp");
-        default_dep =
-                properties.getProperty("default.foundry.dependency", "malt");
+        default_const = properties.getProperty("default.foundry.constituent",
+                "corenlp");
+        default_dep = properties.getProperty("default.foundry.dependency",
+                "malt");
         default_lemma = properties.getProperty("default.foundry.lemma", "tt");
-        default_morphology = properties.getProperty("default.foundry.morphology", "marmot");
-        default_pos =
-                properties.getProperty("default.foundry.partOfSpeech", "tt");
-        default_orthography =
-                properties.getProperty("default.foundry.orthography", "opennlp");
-        defaultStructureFoundry =
-                properties.getProperty("default.foundry.structure", "base");
+        default_morphology = properties
+                .getProperty("default.foundry.morphology", "marmot");
+        default_pos = properties.getProperty("default.foundry.partOfSpeech",
+                "tt");
+        default_orthography = properties
+                .getProperty("default.foundry.orthography", "opennlp");
+        defaultStructureFoundry = properties
+                .getProperty("default.foundry.structure", "base");
 
         // security configuration
         inactiveTime = TimeUtils.convertTimeToSeconds(
@@ -196,8 +201,8 @@
         validationEmaillength = Integer.valueOf(properties
                 .getProperty("security.validation.emailLength", "40"));
 
-        sharedSecret =
-                properties.getProperty("security.sharedSecret", "").getBytes();
+        sharedSecret = properties.getProperty("security.sharedSecret", "")
+                .getBytes();
 
         longTokenTTL = TimeUtils.convertTimeToSeconds(
                 properties.getProperty("security.longTokenTTL", "100D"));
@@ -205,12 +210,11 @@
                 properties.getProperty("security.tokenTTL", "72H"));
         shortTokenTTL = TimeUtils.convertTimeToSeconds(
                 properties.getProperty("security.shortTokenTTL", "3H"));
-        
+
         // network endpoint
-        networkEndpointURL =
-                properties.getProperty("network.endpoint.url", "");
+        networkEndpointURL = properties.getProperty("network.endpoint.url", "");
     }
-    
+
     @Deprecated
     public void readPipesFile (String filename) throws IOException {
         File file = new File(filename);
@@ -219,19 +223,18 @@
                     new InputStreamReader(new FileInputStream(file)));
 
             String line = null;
-            while( (line=br.readLine())!=null ){
+            while ((line = br.readLine()) != null) {
                 String[] parts = line.split("\t");
-                if (parts.length !=2){
+                if (parts.length != 2) {
                     continue;
                 }
-                else{
+                else {
                     pipes.put(parts[0], parts[1]);
                 }
             }
             br.close();
         }
     }
-    
 
     /**
      * set properties
diff --git a/full/src/main/java/de/ids_mannheim/korap/config/NamedVCLoader.java b/full/src/main/java/de/ids_mannheim/korap/config/NamedVCLoader.java
index f16acbf..fda0ee8 100644
--- a/full/src/main/java/de/ids_mannheim/korap/config/NamedVCLoader.java
+++ b/full/src/main/java/de/ids_mannheim/korap/config/NamedVCLoader.java
@@ -33,7 +33,8 @@
  * <p>
  * All predefined VC are set as SYSTEM VC. The filenames are used as
  * VC names. Acceptable file extensions are .jsonld.gz or .jsonld. The
- * VC should be located at the folder indicated by <em>krill.namedVC</em>
+ * VC should be located at the folder indicated by
+ * <em>krill.namedVC</em>
  * specified in kustvakt.conf.
  * </p>
  * 
@@ -41,7 +42,7 @@
  *
  */
 @Component
-public class NamedVCLoader implements Runnable{
+public class NamedVCLoader implements Runnable {
     @Autowired
     private FullConfiguration config;
     @Autowired
@@ -58,12 +59,13 @@
             loadVCToCache();
         }
         catch (IOException | QueryException e) {
-//            e.printStackTrace();
+            //            e.printStackTrace();
             throw new RuntimeException(e.getMessage(), e.getCause());
         }
     }
-    
-    /** Used for testing 
+
+    /**
+     * Used for testing
      * 
      * @param filename
      * @param filePath
@@ -77,18 +79,18 @@
         InputStream is = NamedVCLoader.class.getResourceAsStream(filePath);
         String json = IOUtils.toString(is, "utf-8");
         if (json != null) {
-            cacheVC(filename,json);
-            vcService.storeQuery("system",filename, ResourceType.SYSTEM,
+            cacheVC(filename, json);
+            vcService.storeQuery("system", filename, ResourceType.SYSTEM,
                     QueryType.VIRTUAL_CORPUS, json, null, null, null, true,
                     "system", null, null);
         }
     }
 
-    public void loadVCToCache ()
-            throws IOException, QueryException {
+    public void loadVCToCache () throws IOException, QueryException {
 
         String dir = config.getNamedVCPath();
-        if (dir.isEmpty()) return;
+        if (dir.isEmpty())
+            return;
 
         File d = new File(dir);
         if (!d.isDirectory()) {
@@ -96,7 +98,7 @@
         }
 
         jlog.info(Arrays.toString(d.list()));
-        
+
         for (File file : d.listFiles()) {
             if (!file.exists()) {
                 throw new IOException("File " + file + " is not found.");
@@ -107,14 +109,13 @@
             filename = strArr[0];
             String json = strArr[1];
             if (json != null) {
-                cacheVC(filename,json);
+                cacheVC(filename, json);
                 storeVCinDB(filename, json);
             }
         }
     }
 
-    private String[] readFile (File file, String filename)
-            throws IOException {
+    private String[] readFile (File file, String filename) throws IOException {
         String json = null;
         long start = System.currentTimeMillis();
         if (filename.endsWith(".jsonld")) {
@@ -123,8 +124,8 @@
         }
         else if (filename.endsWith(".jsonld.gz")) {
             filename = filename.substring(0, filename.length() - 10);
-            GZIPInputStream gzipInputStream =
-                    new GZIPInputStream(new FileInputStream(file));
+            GZIPInputStream gzipInputStream = new GZIPInputStream(
+                    new FileInputStream(file));
             ByteArrayOutputStream bos = new ByteArrayOutputStream(512);
             bos.write(gzipInputStream);
             json = bos.toString("utf-8");
@@ -161,7 +162,7 @@
         else {
             jlog.info("Storing {} in cache ", vcId);
         }
-        
+
         long start, end;
         start = System.currentTimeMillis();
         VirtualCorpusCache.store(vcId, searchKrill.getIndex());
@@ -169,8 +170,9 @@
         jlog.info("Duration : {}", (end - start));
         config.setVcInCaching("");
     }
-    
-    /** Stores the VC if it doesn't exist in the database. 
+
+    /**
+     * Stores the VC if it doesn't exist in the database.
      * 
      * @param vcId
      * @param koralQuery
@@ -196,6 +198,6 @@
                 throw new RuntimeException(e);
             }
         }
-        
+
     }
 }
diff --git a/full/src/main/java/de/ids_mannheim/korap/config/ParamFields.java b/full/src/main/java/de/ids_mannheim/korap/config/ParamFields.java
index 2d9a255..621bffb 100644
--- a/full/src/main/java/de/ids_mannheim/korap/config/ParamFields.java
+++ b/full/src/main/java/de/ids_mannheim/korap/config/ParamFields.java
@@ -16,17 +16,14 @@
         this.put(param.getClass().getName(), param);
     }
 
-
     public <T extends Param> T get (Class<T> cl) {
         return (T) this.get(cl.getName());
     }
 
-
     public <T extends Param> T remove (Class<T> cl) {
         return (T) this.remove(cl.getName());
     }
 
-
     public void addAll (Collection<Param> params) {
         for (Param p : params)
             super.put(p.getClass().getName(), p);
diff --git a/full/src/main/java/de/ids_mannheim/korap/config/QueryBuilderUtil.java b/full/src/main/java/de/ids_mannheim/korap/config/QueryBuilderUtil.java
index bc21668..fb838b1 100644
--- a/full/src/main/java/de/ids_mannheim/korap/config/QueryBuilderUtil.java
+++ b/full/src/main/java/de/ids_mannheim/korap/config/QueryBuilderUtil.java
@@ -9,7 +9,8 @@
 public class QueryBuilderUtil {
 
     public static MetaQueryBuilder defaultMetaBuilder (Integer pageIndex,
-            Integer pageInteger, Integer pageLength, String ctx, Boolean cutoff) {
+            Integer pageInteger, Integer pageLength, String ctx,
+            Boolean cutoff) {
         MetaQueryBuilder meta = new MetaQueryBuilder();
         meta.addEntry("startIndex", pageIndex)
                 .addEntry("startPage", pageInteger)
diff --git a/full/src/main/java/de/ids_mannheim/korap/config/Scopes.java b/full/src/main/java/de/ids_mannheim/korap/config/Scopes.java
index 161d5f6..295cb4d 100644
--- a/full/src/main/java/de/ids_mannheim/korap/config/Scopes.java
+++ b/full/src/main/java/de/ids_mannheim/korap/config/Scopes.java
@@ -28,7 +28,6 @@
     private static final Enum[] SERVICE_DEFAULTS = { Scope.account,
             Scope.preferences, Scope.search, Scope.queries };
 
-
     public static Scopes getProfileScopes (Userdata values) {
         Scopes r = new Scopes();
         for (String key : profile) {
@@ -39,7 +38,6 @@
         return r;
     }
 
-
     /**
      * expects space separated values
      * 
@@ -54,7 +52,6 @@
         return s.toArray(new Scope[s.size()]);
     }
 
-
     public static Scopes mapScopes (String scopes, Userdata details) {
         Scopes m = new Scopes();
         if (scopes != null && !scopes.isEmpty()) {
@@ -73,19 +70,16 @@
 
     private Map<String, Object> values;
 
-
     private Scopes () {
         this.values = new HashMap<>();
     }
 
-
     public String toEntity () throws KustvaktException {
         if (this.values.isEmpty())
             return "";
         return JsonUtils.toJSON(this.values);
     }
 
-
     public Map<String, Object> toMap () {
         return new HashMap<>(this.values);
     }
diff --git a/full/src/main/java/de/ids_mannheim/korap/config/URIParam.java b/full/src/main/java/de/ids_mannheim/korap/config/URIParam.java
index 9fd7911..9cba8b6 100644
--- a/full/src/main/java/de/ids_mannheim/korap/config/URIParam.java
+++ b/full/src/main/java/de/ids_mannheim/korap/config/URIParam.java
@@ -12,13 +12,11 @@
     private final String uriFragment;
     private final Long uriExpiration;
 
-
     public URIParam (String uri, Long expire) {
         this.uriFragment = uri;
         this.uriExpiration = expire;
     }
 
-
     @Override
     public boolean hasValues () {
         return this.uriFragment != null && !this.uriFragment.isEmpty()