org.allenai

common

package common

Visibility
  1. Public
  2. All

Type Members

  1. case class ComponentId(name: String, version: Version) extends Product with Serializable

    A specific version of a component in AI2.

    A specific version of a component in AI2. This fully-describes a running system - it contains enough information to re-deploy the version that generated the ComponentId instance.

    name

    a human-readable name of the component

    version

    the version of the component that was running

  2. abstract class Enum[E <: Enum[E]] extends Serializable

    Enumeration implementation that supports automatic Spray JSON serialization as JsString(id).

  3. abstract class EnumCompanion[E <: Enum[E]] extends AnyRef

    Superclass for Enum companion objects providing enum registration and JSON serialization

  4. case class GitVersion(sha1: String, commitDate: Long, repoUrl: Option[String]) extends Product with Serializable

    Represents a git version.

    Represents a git version.

    sha1

    the output of git sha1 in the repository

    commitDate

    commit date in milliseconds

    repoUrl

    the url of the git repo

  5. trait Logging extends AnyRef

    This trait is meant to be mixed into a class to provide logging and logging configuration.

    This trait is meant to be mixed into a class to provide logging and logging configuration.

    The enclosed methods provide a Scala-style logging signature where the message is a block instead of a string. This way the message string is not constructed unless the message will be logged.

  6. trait LoggingWithUncaughtExceptions extends Logging

  7. class SeekableSource extends Iterator[Char]

    A class that provides seekability to an interface similar to scala.io.Source.

    A class that provides seekability to an interface similar to scala.io.Source. This is required because scala.io.Source only provides character offsets, while FileChannel (and other seekable Java interfaces) take byte offsets for seeking. The only limitation is that the file must be either UTF-8 or ISO-8859-1 encoded.

    This also has a getLines() method to iterate over lines. Any reads done on this iterator are reflected in the main Source, and reads on the Source are reflected in the Iterator[String]. The iterator returned by getLines() will create another buffer of bufferSize bytes, so bear this in mind when estimating memory usage.

    Exceptions thrown

    java.lang.IllegalArgumentException if bufferSize is less than 4, or codec is not UTF-8 or ISO-8859-1

  8. class SourceInputStream extends InputStream

    Input stream wrapping a Source object, using the codec to convert characters to bytes.

    Input stream wrapping a Source object, using the codec to convert characters to bytes. Not thread-safe.

  9. case class Version(git: GitVersion, artifactVersion: String, cacheKey: Option[String]) extends Product with Serializable

    Represents the version of this component.

    Represents the version of this component. Should be built with the fromResources method on the companion object.

    git

    the git version (commit information) of the build.

    artifactVersion

    the version of the artifact in the build.

    cacheKey

    a cacheKey of the project. Changes on git commits to src of project and dependency changes.

Value Members

  1. object ComponentId extends Serializable

  2. object Config

    Import to provide enhancements via implicit class conversion for making working with com.typesafe.config.Config more Scala-friendly (no nulls!).

    Import to provide enhancements via implicit class conversion for making working with com.typesafe.config.Config more Scala-friendly (no nulls!).

    Also provides a spray.json.RootJsonFormat[Config].

  3. object FileUtils extends Logging

    Various convenient utilities for reading files and resources.

  4. object GitVersion extends Serializable

  5. object JsonFormats

    Common spray.json.JsonFormats, spray.json.JsonReaders, and spray.json.JsonWriters

  6. object JsonIo

    Helpers for streaming lists of JSON objects to and from disk.

  7. object MathUtils

    Various convenient utilities for math operations.

  8. object ParIterator

  9. object Resource

  10. object ScalaUtils

    Various convenient utilities for Scala constructs.

  11. object StreamClosingIterator

    Creates an Iterator from an InputStream.

    Creates an Iterator from an InputStream. The InputStream is automatically closed once the Iterator has been fully consumed. Example:

    StreamClosingIterator(new FileInputStream("foo.txt"))(Source.fromInputStream(_).getLines())
  12. object StringUtils

  13. object Timing

    Methods for measuring the amount of time a method takes.

  14. object UrlUtil

    Util methods for java.net.URL.

  15. object Version extends Serializable

  16. package immutable

  17. package json

    Utilities for making it easier to work with spray-json for common use cases.

    Utilities for making it easier to work with spray-json for common use cases.

    Usage: (format: OFF)

    import spray.json._
    import org.allenai.common.json._
    
    val json: JsObject = ...
    val packed = json.pack("foo" -> 5) // creates a new JsObject with the added field
    packed[Int]("foo") // returns 5
    packed.get[Int]("foo") // returns Some(5)

    (format: ON)

Ungrouped