Beispiel #1
0
  @Override
  public void run(TruFleetAPIConfiguration configuration, Environment environment)
      throws Exception {

    final DBIFactory factory = new DBIFactory();
    final DBI adminDBI =
        factory.build(environment, configuration.getAdminDatabaseFactory(), "TFAdmin");
    environment.jersey().register(new LoginResource(adminDBI, configuration, environment));
    environment.jersey().register(new ProvisionUserResource(adminDBI, configuration, environment));
    environment.jersey().register(new OrganizationResource(adminDBI, configuration, environment));
    environment.jersey().register(new NotificationResource(adminDBI, configuration, environment));
    environment
        .jersey()
        .register(new GcmRegistrationResource(adminDBI, configuration, environment));

    final ContactEntityDAO contactDAO = new ContactEntityDAO(hibernate.getSessionFactory());
    environment.jersey().register(new ContactResource(contactDAO));
    environment.jersey().register(new ContactsResource(contactDAO));

    final AccountEntityDAO accountEntityDAO = new AccountEntityDAO(hibernate.getSessionFactory());
    environment.jersey().register(new AccountResource(accountEntityDAO));

    final FreightEntityDAO freightEntityDAO = new FreightEntityDAO(hibernate.getSessionFactory());
    environment.jersey().register(new FreightResource(freightEntityDAO));
    environment.jersey().register(new FreightsResource(freightEntityDAO));

    final LinehaulEntityDAO linehaulEntityDAO =
        new LinehaulEntityDAO(hibernate.getSessionFactory());
    environment.jersey().register(new LinehaulResource(linehaulEntityDAO));
    environment.jersey().register(new LinehaulsResource(linehaulEntityDAO));

    final ContainerEntityDAO containerEntityDAO =
        new ContainerEntityDAO(hibernate.getSessionFactory());
    environment.jersey().register(new ContainerResource(containerEntityDAO));

    final OrderEntityDAO orderEntityDAO = new OrderEntityDAO(hibernate.getSessionFactory());
    environment.jersey().register(new OrderResource(orderEntityDAO));

    final RouteEntityDAO routeEntityDAO = new RouteEntityDAO(hibernate.getSessionFactory());
    environment.jersey().register(new RouteResource(routeEntityDAO));

    environment.jersey().register(new ShiroExceptionMapper());
    environment.getApplicationContext().setSessionHandler(new SessionHandler());
    configureCors(environment);
  }
Beispiel #2
0
 public DataSourceFactory getDataSourceFactory(TruFleetAPIConfiguration configuration) {
   return configuration.getTenantDatabaseFactory();
 }
Beispiel #3
0
 @Override
 protected ShiroConfiguration narrow(TruFleetAPIConfiguration configuration) {
   return configuration.getShiro();
 }