Package br.com.objectos.rio

Source Code of br.com.objectos.rio.RioEtcModule

/*
* Copyright 2013 Objectos, Fábrica de Software LTDA.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
package br.com.objectos.rio;

import br.com.objectos.rio.core.Dev;
import br.com.objectos.rio.core.DevLoader;
import br.com.objectos.rio.core.Devs;
import br.com.objectos.rio.core.DevsLoader;
import br.com.objectos.rio.core.Workstation;
import br.com.objectos.rio.core.WorkstationLoader;
import br.com.objectos.rio.core.Workstations;
import br.com.objectos.rio.core.WorkstationsLoader;
import br.com.objectos.rio.iro.IroDirs;
import br.com.objectos.rio.kdo.KdoDirs;
import br.com.objectos.way.base.io.Directory;
import br.com.objectos.way.etc.AbstractEtcModule;

import com.google.inject.Stage;

/**
* @author marcio.endo@objectos.com.br (Marcio Endo)
*/
public class RioEtcModule extends AbstractEtcModule {

  private final Stage stage;

  public RioEtcModule(Stage stage) {
    this.stage = stage;
  }

  @Override
  protected final void configureEtc() {
    RioDirs dirs = RioDirs.fromStage(stage);
    bind(RioDirs.class).toInstance(dirs);

    UserSettings userSettings = new UserSettings(dirs);
    bind(UserSettings.class).toInstance(userSettings);

    Directory core = userSettings.core();

    etc(Dev.class).atDir(core).loadWith(DevLoader.INSTANCE);
    etc(Devs.class).atDir(core).loadWith(DevsLoader.INSTANCE);
    etc(Jdbc.class).atDir(core).loadWith(JdbcLoader.INSTANCE);
    etc(GDrive.class).atDir(core).loadWith(GDriveLoader.INSTANCE);
    etc(User.class).atDir(core).loadWith(UserLoader.INSTANCE);
    etc(Workstation.class).atDir(core).loadWith(WorkstationLoader.INSTANCE);
    etc(Workstations.class).atDir(core).loadWith(WorkstationsLoader.INSTANCE);

    configureMore(dirs);
  }

  protected void configureMore(RioDirs dirs) {
    bind(KdoDirs.class).toInstance(new KdoDirs(dirs));
    bind(IroDirs.class).toInstance(new IroDirs(dirs));
  }

}
TOP

Related Classes of br.com.objectos.rio.RioEtcModule

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.