Class JDisc

  • All Implemented Interfaces:
    AutoCloseable

    public final class JDisc
    extends Object
    implements AutoCloseable
    A JDisc Container configured from XML.
    Author:
    Tony Vaagenes, Einar M R Rosenvinge, gjoranv
    • Method Detail

      • fromServicesXml

        public static JDisc fromServicesXml​(String xml,
                                            Networking networking)
        Factory method to create a JDisc from an XML String. Note that any components that are referenced in the XML must be present on the classpath. To deploy OSGi bundles in memory, use fromPath(java.nio.file.Path, com.yahoo.application.Networking).
        Parameters:
        xml - the XML configuration to use
        Returns:
        a new JDisc instance
      • fromPath

        public static JDisc fromPath​(Path path,
                                     Networking networking)
        Factory method to create a JDisc from an application package. This method allows deploying OSGi bundles(contained in the components subdirectory). All the OSGi bundles will share the same class loader.
        Parameters:
        path - the reference to the application package to use
        networking - enabled or disabled
        Returns:
        a new JDisc instance
      • fromPath

        public static JDisc fromPath​(Path path,
                                     Networking networking,
                                     com.yahoo.config.model.ConfigModelRepo configModelRepo)
        Create a jDisc instance which is given a config model repo (in which (mock) content clusters can be looked up).
      • search

        public Search search()
        Returns a Search, used to perform search query operations on this container.
        Returns:
        a Search instance
        Throws:
        UnsupportedOperationException - if this JDisc does not have search configured
      • processing

        public Processing processing()
        Returns a Processing, used to do generic asynchronous operations in a request/response API.
        Returns:
        a Processing instance
        Throws:
        UnsupportedOperationException - if this JDisc does not have processing configured
      • components

        public com.yahoo.component.provider.ComponentRegistry<com.yahoo.component.AbstractComponent> components()
        Returns a registry of all components available in this
      • handleRequest

        public Response handleRequest​(Request request)
        Handles the given Request by passing it to the RequestHandler that is bound to the request's URI.
        Parameters:
        request - the request to process
        Returns:
        a response for the given request
      • close

        public void close()
        Closes the current JDisc.
        Specified by:
        close in interface AutoCloseable