Class JDisc

  • All Implemented Interfaces:
    java.lang.AutoCloseable

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

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void close()
      Closes the current JDisc.
      com.yahoo.component.provider.ComponentRegistry<com.yahoo.component.AbstractComponent> components()
      Returns a registry of all components available in this
      DocumentProcessing documentProcessing()
      Returns a DocumentProcessing, used to process objects of type Document, DocumentRemove and DocumentUpdate.
      static JDisc fromPath​(java.nio.file.Path path, Networking networking)
      Factory method to create a JDisc from an application package.
      static JDisc fromPath​(java.nio.file.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).
      static JDisc fromServicesXml​(java.lang.String xml, Networking networking)
      Factory method to create a JDisc from an XML String.
      Response handleRequest​(Request request)
      Handles the given Request by passing it to the RequestHandler that is bound to the request's URI.
      Processing processing()
      Returns a Processing, used to do generic asynchronous operations in a request/response API.
      Search search()
      Returns a Search, used to perform search query operations on this container.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • fromServicesXml

        public static JDisc fromServicesXml​(java.lang.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​(java.nio.file.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​(java.nio.file.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:
        java.lang.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:
        java.lang.UnsupportedOperationException - if this JDisc does not have processing configured
      • documentProcessing

        public DocumentProcessing documentProcessing()
        Returns a DocumentProcessing, used to process objects of type Document, DocumentRemove and DocumentUpdate.
        Returns:
        a DocumentProcessing instance
        Throws:
        java.lang.UnsupportedOperationException - if this JDisc does not have document 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 java.lang.AutoCloseable