Skip to content

Commit

Permalink
refactor: move Settings processor to factory
Browse files Browse the repository at this point in the history
Also move mustaches templates.
Dependency on restx-core will be no more needed to use the
@Settings mechanism.

WIP: test are not yet working
  • Loading branch information
a-peyrard committed Jan 2, 2015
1 parent ffbda71 commit bc13b80
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 21 deletions.
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
restx.annotations.processor.RestxAnnotationProcessor
restx.exceptions.processor.ErrorAnnotationProcessor
restx.config.processor.SettingsAnnotationProcessor
12 changes: 0 additions & 12 deletions restx-core/src/main/java/restx/security/SecurityModule.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import restx.common.RestxConfig;
import restx.config.Settings;
import restx.config.SettingsKey;
import restx.factory.AutoStartable;
Expand Down Expand Up @@ -33,17 +32,6 @@ public String disableBareFilter() {
return "false";
}

// @Settings is not processed as long as this is part of core itself
@Provides
public SecuritySettings securitySettings(final RestxConfig config) {
return new SecuritySettings() {
@Override
public int sessionsLimit() {
return config.getInt("restx.sessions.stats.limit").or(100);
}
};
}

@Provides @Named("Sessions")
public Sessions session(SecuritySettings settings) {
return new Sessions(settings.sessionsLimit());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,10 @@
import com.google.common.base.Strings;
import com.google.common.collect.ImmutableMap;
import com.samskivert.mustache.Template;
import restx.common.Mustaches;
import restx.common.processor.RestxAbstractProcessor;
import restx.config.Settings;
import restx.config.SettingsKey;

import java.util.ArrayList;
import java.util.List;
import java.util.Set;
import javax.annotation.processing.RoundEnvironment;
import javax.annotation.processing.SupportedAnnotationTypes;
import javax.annotation.processing.SupportedOptions;
Expand All @@ -18,9 +17,10 @@
import javax.lang.model.element.TypeElement;
import javax.lang.model.type.DeclaredType;
import javax.lang.model.type.TypeMirror;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
import restx.common.Mustaches;
import restx.common.processor.RestxAbstractProcessor;
import restx.config.Settings;
import restx.config.SettingsKey;

/**
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
restx.factory.processor.FactoryAnnotationProcessor
restx.factory.processor.FactoryAnnotationProcessor
restx.config.processor.SettingsAnnotationProcessor

0 comments on commit bc13b80

Please sign in to comment.