Search in sources :

Example 1 with StepCoreModule

use of com.tyndalehouse.step.core.guice.StepCoreModule in project step by STEPBible.

the class StepServletConfig method getInjector.

@Override
protected Injector getInjector() {
    if (injector == null) {
        synchronized (this) {
            ServletModule servletModule = new ServletModule() {

                @Override
                protected void configureServlets() {
                    serve("/" + ExternalPoweredByFilter.EXTERNAL_PREFIX + "*").with(FrontController.class);
                    serve("/rest/*").with(FrontController.class);
                    serve("/commentary_images/*").with(ImageController.class);
                    serve("/search*").with(SearchPageController.class);
                    serve("/index.jsp").with(IndexRedirect.class);
                    serve("/").with(SearchPageController.class);
                    serve("/international/interactive.js").with(InternationalJsonController.class);
                    serve("/international/*").with(InternationalJsonController.class);
                    serve("/config.jsp").with(SetupPageController.class);
                    // if (Boolean.getBoolean("metrics.enabled")) {
                    // serve("/metrics/*").with(AdminServlet.class);
                    // }
                    serve("/sitemap_version*").with(SiteMapController.class);
                    serve("/SITEMAP_version*").with(SiteMapController.class);
                    // filters
                    filter("/index.jsp", "/").through(SetupRedirectFilter.class);
                    filter("*_escaped_fragment_*", "/").through(HashBangFragmentFilter.class);
                    filter("/external/*").through(ExternalPoweredByFilter.class);
                }
            };
            // if (Boolean.getBoolean("metrics.enabled")) {
            // this.injector = Guice.createInjector(new StepCoreModule(), new StepWebModule(),
            // new InstrumentationModule(), servletModule);
            // } else {
            this.injector = Guice.createInjector(new StepCoreModule(), new StepWebModule(), servletModule);
        // }
        }
    }
    return this.injector;
}
Also used : StepCoreModule(com.tyndalehouse.step.core.guice.StepCoreModule) ServletModule(com.google.inject.servlet.ServletModule)

Example 2 with StepCoreModule

use of com.tyndalehouse.step.core.guice.StepCoreModule in project step by STEPBible.

the class IndexModule method main.

/**
 * main method
 *
 * @param args list of arguments
 */
public static void main(final String[] args) {
    CWProject.instance().setFrontendName("step");
    Injector injector = Guice.createInjector(new StepCoreModule(), new Module() {

        @Override
        public void configure(final Binder binder) {
            binder.bind(ClientSession.class).toProvider(new Provider<ClientSession>() {

                @Override
                public ClientSession get() {
                    // TODO Auto-generated method stub
                    return null;
                }
            });
        }
    });
    final JSwordModuleService instance = injector.getInstance(JSwordModuleService.class);
    ConfigEntry.setConfigValueInterceptor(injector.getInstance(ConfigValueInterceptor.class));
    System.out.println("Indexing " + args[0]);
    instance.index(args[0]);
    System.out.println("Finished indexing " + args[0]);
}
Also used : JSwordModuleService(com.tyndalehouse.step.core.service.jsword.JSwordModuleService) ConfigValueInterceptor(org.crosswire.jsword.book.sword.ConfigValueInterceptor) StepCoreModule(com.tyndalehouse.step.core.guice.StepCoreModule) Module(com.google.inject.Module) StepCoreModule(com.tyndalehouse.step.core.guice.StepCoreModule)

Example 3 with StepCoreModule

use of com.tyndalehouse.step.core.guice.StepCoreModule in project step by STEPBible.

the class IndexAll method main.

/**
 * main method
 *
 * @param args list of arguments
 */
public static void main(final String[] args) {
    final BibleInformationService instance = Guice.createInjector(new StepCoreModule(), new Module() {

        @Override
        public void configure(final Binder binder) {
            binder.bind(ClientSession.class).toProvider(new Provider<ClientSession>() {

                @Override
                public ClientSession get() {
                    // TODO Auto-generated method stub
                    return null;
                }
            });
        }
    }).getInstance(BibleInformationService.class);
    instance.indexAll();
}
Also used : Binder(com.google.inject.Binder) BibleInformationService(com.tyndalehouse.step.core.service.BibleInformationService) ClientSession(com.tyndalehouse.step.core.models.ClientSession) StepCoreModule(com.tyndalehouse.step.core.guice.StepCoreModule) Module(com.google.inject.Module) StepCoreModule(com.tyndalehouse.step.core.guice.StepCoreModule)

Aggregations

StepCoreModule (com.tyndalehouse.step.core.guice.StepCoreModule)3 Module (com.google.inject.Module)2 Binder (com.google.inject.Binder)1 ServletModule (com.google.inject.servlet.ServletModule)1 ClientSession (com.tyndalehouse.step.core.models.ClientSession)1 BibleInformationService (com.tyndalehouse.step.core.service.BibleInformationService)1 JSwordModuleService (com.tyndalehouse.step.core.service.jsword.JSwordModuleService)1 ConfigValueInterceptor (org.crosswire.jsword.book.sword.ConfigValueInterceptor)1