@Override public Module module() { return binder -> BQCoreModule.extend(binder).setProperties(properties); }
@Override public void configure(Binder binder) { BQCoreModule.extend(binder) .initAllExtensions() .addValueObjectsDescriptors(createValueObjectsDescriptorsMap()) .addOption(createConfigOption()) .addCommand(HelpConfigCommand.class); // bind instances binder.bind(BootLogger.class).toInstance(Objects.requireNonNull(bootLogger)); binder.bind(ShutdownManager.class).toInstance(Objects.requireNonNull(shutdownManager)); binder.bind(String[].class).annotatedWith(Args.class).toInstance(Objects.requireNonNull(args)); // too much code to create config factory.. extracting it in a provider // class... binder.bind(ConfigurationFactory.class).toProvider(JsonNodeConfigurationFactoryProvider.class).in(Singleton.class); }
@Override public void configure(Binder binder) { BQCoreModule.extend(binder) .addCommand(ServerCommand.class); binder.bind(HttpHandler.class) .annotatedWith(RootHandler.class) .to(DefaultHandler.class) .in(Singleton.class); }
/** * @param binder DI binder passed to the Module that invokes this method. * @return {@link MapBinder} for values emulating environment variables. * @see EnvironmentVariables * @since 0.17 * @deprecated since 0.22 use {@link #extend(Binder)} to get an extender object, and * then call {@link BQCoreModuleExtender#setVar(String, String)}. */ @Deprecated public static MapBinder<String, String> contributeVariables(Binder binder) { return extend(binder).contributeVariables(); }
/** * @param binder DI binder passed to the Module that invokes this method. * @return {@link Multibinder} for Bootique options. * @since 0.12 * @deprecated since 0.22 use {@link #extend(Binder)} to get an extender object, and * then call {@link BQCoreModuleExtender#addOption(OptionMetadata)}. */ @Deprecated public static Multibinder<OptionMetadata> contributeOptions(Binder binder) { return extend(binder).contributeOptions(); }
/** Create an extended from the given binder. * * @param binder the injection binder. * @return the variable declarator. */ public static VariableDecls extend(Binder binder) { return new VariableDecls(io.bootique.BQCoreModule.extend(binder)); }
/** * @param binder DI binder passed to the Module that invokes this method. * @return {@link Multibinder} for Bootique commands. * @since 0.12 * @deprecated since 0.22 use {@link #extend(Binder)} to get an extender object, and * then call {@link BQCoreModuleExtender#addCommand(Class)}. */ @Deprecated public static Multibinder<Command> contributeCommands(Binder binder) { return extend(binder).contributeCommands(); }
/** * @param binder DI binder passed to the Module that invokes this method. * @return {@link MapBinder} for Bootique properties. * @see EnvironmentProperties * @since 0.12 * @deprecated since 0.22 use {@link #extend(Binder)} to get an extender object, and * then call {@link BQCoreModuleExtender#setProperty(String, String)}. */ @Deprecated public static MapBinder<String, String> contributeProperties(Binder binder) { return extend(binder).contributeProperties(); }
/** * Initializes optional default command that will be executed if no explicit command is matched. * * @param binder DI binder passed to the Module that invokes this method. * @param command an instance of the default command. * @since 0.20 * @deprecated since 0.22 use {@link #extend(Binder)} to get an extender object, and * then call {@link BQCoreModuleExtender#setDefaultCommand(Command)}. */ @Deprecated public static void setDefaultCommand(Binder binder, Command command) { extend(binder).setDefaultCommand(command); }
/** * Binds an optional application description used in help messages, etc. * * @param description optional application description used in help messages, etc. * @param binder DI binder passed to the Module that invokes this method. * @since 0.20 * @deprecated since 0.22 use {@link #extend(Binder)} to get an extender object, and * then call {@link BQCoreModuleExtender#setApplicationDescription(String)}. */ @Deprecated public static void setApplicationDescription(Binder binder, String description) { extend(binder).setApplicationDescription(description); }
/** * Initializes optional default command that will be executed if no explicit command is matched. * * @param binder DI binder passed to the Module that invokes this method. * @param commandType a class of the default command. * @since 0.20 * @deprecated since 0.22 use {@link #extend(Binder)} to get an extender object, and * then call {@link BQCoreModuleExtender#setDefaultCommand(Class)}. */ @Deprecated public static void setDefaultCommand(Binder binder, Class<? extends Command> commandType) { extend(binder).setDefaultCommand(commandType); }
@Override protected void configure() { // Name of the application. bind(String.class).annotatedWith(DefaultApplicationName.class).toInstance(Constants.PROGRAM_NAME); // Short description of the application. extend(binder()).setApplicationDescription(Messages.SarlcApplicationModule_0); // Long description of the application. bind(String.class).annotatedWith(ApplicationDetailedDescription.class).toProvider(LongDescriptionProvider.class).in(Singleton.class); // Synopsis of the application's arguments. bind(String.class).annotatedWith(ApplicationArgumentSynopsis.class).toInstance(Messages.SarlcApplicationModule_1); }
@Override protected void configure() { extend(binder()).addCommand(ExtraLanguageListCommand.class); }
@Override protected void configure() { extend(binder()).setDefaultCommand(CompilerCommand.class); }
@Override protected void configure() { extend(binder()).addCommand(VersionCommand.class); }
@Override public void configure(Binder binder) { // suppress Tomcat PooledConnection logger. It logs some absolutely benign stuff as WARN // per https://github.com/bootique/bootique-jdbc/issues/25 // it only works partially, namely when SLF intercepts JUL (e.g. under bootique-logback and such). // TODO: submit a patch to Tomcat to reduce this log level down... BQCoreModule.extend(binder) .setLogLevel(org.apache.tomcat.jdbc.pool.PooledConnection.class.getName(), Level.OFF); JdbcModule.extend(binder).addFactoryType(TomcatManagedDataSourceFactory.class); } }
@Override public void configure(Binder binder) { BQCoreModule.extend(binder).addCommand(EngineCommand.class); VertxModule.extend(binder).initAllExtensions(); }
@Override public BQRuntime createRuntime() { module(binder -> BQCoreModule.extend(binder).setDefaultCommand(ServerCommand.class)); return super.createRuntime(); } }
@Override protected void configure() { extend(binder()) .addOption(OptionMetadata.builder( CompilerCommand.PROGRESS_OPTION_NAME, Messages.CompilerCommandModule_0) .configPath(ProgressBarConfig.ENABLE) .defaultValue(Boolean.TRUE.toString()) .build()); extend(binder()).addCommand(CompilerCommand.class); binder().bindListener(new BindingMatcher(), new LoggerProvisionListener( binder().getProvider(ProgressBarConfig.class))); }
@Override protected void configure() { // Binding a dummy class to trigger eager init of Log4j as // @Provides below can not be invoked eagerly. binder().bind(LogInitTrigger.class).asEagerSingleton(); VariableDecls.extend(binder()).declareVar(LEVEL); extend(binder()).addOption(OptionMetadata.builder( "log", //$NON-NLS-1$ Locale.getString("LOG_OPT", Level.getLabels())) //$NON-NLS-1$ .configPath(LEVEL) .valueRequired(Locale.getString("LEVEL")) //$NON-NLS-1$ .build()); }