## org.plovr
Class CompilationServer

    java.lang.Object
      org.plovr.CompilationServer

All Implemented Interfaces:
  Runnable

    public final class CompilationServer

extends Object
implements Runnable

Constructor Summary
`CompilationServer(String listenAddress, int port)`

Method Summary
`boolean` `containsConfigWithId(String id)`
`Iterable<Config>` `getAllConfigs()`
`Config` `getConfigById(String id)`
`String` `getExportsAsExternsFor(Config config)`
`Compilation` `getLastCompilation(Config config)`
`String` `getServerForExchange(com.sun.net.httpserver.HttpExchange exchange)` Returns the server name using an incoming request to this CompilationServer.
`SourceMap` `getSourceMapFor(Config config)`
`void` `recordCompilation(Config config, Compilation compilation)` Records the last compilation for the config.
`void` `registerConfig(Config config)`
`void` `run()`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### CompilationServer

    public CompilationServer(String listenAddress,
                             int port)

Method Detail

### registerConfig

    public void registerConfig(Config config)

### run

    public void run()

  Specified by:
    `run` in interface `Runnable`

### containsConfigWithId

    public boolean containsConfigWithId(String id)

### getConfigById

    public Config getConfigById(String id)

### getAllConfigs

    public Iterable<Config> getAllConfigs()

### recordCompilation

    public void recordCompilation(Config config,
                                  Compilation compilation)

  Records the last compilation for the config.

### getLastCompilation

    public Compilation getLastCompilation(Config config)

  Returns:
    the last recorded compilation for the specified config

### getSourceMapFor

    public SourceMap getSourceMapFor(Config config)

### getExportsAsExternsFor

    public String getExportsAsExternsFor(Config config)

### getServerForExchange

    public String getServerForExchange(com.sun.net.httpserver.HttpExchange exchange)

  Returns the server name using an incoming request to this CompilationServer. Unfortunately, HttpExchange does not appear to have a getServerName() method like ServletRequest does, so this method must use a heuristic. If the hostname is not specified in the config file, and it cannot be determined from the referrer, then it is assumed to be localhost.

  Parameters:
    `exchange` -
  Returns:
    the server scheme, name, and port, such as "http://localhost:9810/"