Package com.google.devtools.moe.client

Source Code of com.google.devtools.moe.client.AppContext

// Copyright 2011 The MOE Authors All Rights Reserved.

package com.google.devtools.moe.client;

import com.google.common.base.Preconditions;
import com.google.devtools.moe.client.project.FileReadingProjectContextFactory;
import com.google.devtools.moe.client.project.ProjectContextFactory;

/**
* Context of stuff any MOE app should expect.
*
* @author dbentley@google.com (Daniel Bentley)
*/
public class AppContext {

  public static AppContext RUN;

  public ProjectContextFactory contextFactory;

  public Ui ui;

  public CommandRunner cmd;

  public FileSystem fileSystem;

  public AppContext(
      ProjectContextFactory contextFactory, Ui ui, CommandRunner cmd, FileSystem fileSystem) {
    this.contextFactory = contextFactory;
    this.ui = ui;
    this.cmd = cmd;
    this.fileSystem = fileSystem;
  }

  public static void init() {
    Preconditions.checkState(RUN == null, "RUN already set.");
    RUN = new AppContext(
        new FileReadingProjectContextFactory(),
        new SystemUi(),
        new SystemCommandRunner(),
        new SystemFileSystem());
  }

}
TOP

Related Classes of com.google.devtools.moe.client.AppContext

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.