Class Box

  • All Implemented Interfaces:
    Closeable, AutoCloseable

    public class Box
    extends Object
    implements Closeable
    The principal API into the Box system. Start with a configuration file.
     Box box = newBox(config).build();
     

    Or configure Box programmatically with the builder.

     Box box = newBuilder()...build();
     
    Author:
    Charles Draper
    • Method Detail

      • newBox

        public static Box newBox​(com.fasterxml.jackson.databind.JsonNode config)
        Creates a new Box from the supplied configuration.
        Parameters:
        config - the config to use
        Returns:
        the new Box builder
      • newBuilder

        public static Box.Builder newBuilder()
        Creates a new builder.
        Returns:
        the new Box builder
      • getPrincipalSource

        public Source getPrincipalSource()
        Returns the principal source.
        Returns:
        the principal source
      • getHealth

        public BoxHealth getHealth()
        Returns a snapshot of the health of the Box system.
        Returns:
        the health of Box
      • getSource

        public Source getSource​(String sourceName)
        Returns the registered source denoted by the name.

        IMPORTANT: Once a source is registered it should not be modified.

        Parameters:
        sourceName - the name of the source
        Returns:
        the registered source
      • getSources

        public Map<String,​Source> getSources()
        Returns a list of the registered sources.

        IMPORTANT: Once a source is registered it should not be modified.

        Returns:
        the list of registered sources
      • getSourceNames

        public List<String> getSourceNames()
        Returns a list of names of the registered sources.
        Returns:
        list of source names
      • verifySource

        public String verifySource​(String sourceName)
        Verifies the existence of the source and returns it's name. Throws exception if source is not recognized.
        Parameters:
        sourceName - the source to verify
        Returns:
        the sourceName
        Throws:
        IllegalArgumentException - if source is not recognized
      • close

        public void close()
        Closes this Box instance and shutdowns down all internal scheduling and executors.
        Specified by:
        close in interface AutoCloseable
        Specified by:
        close in interface Closeable