Class TestEngine

  • All Implemented Interfaces:
    ITranslationEngine

    public class TestEngine
    extends TranslationEngine
    Test translation engine for stand-alone Java application from command line without proxy.
    Author:
    Christopher Mindus
    • Constructor Detail

      • TestEngine

        public TestEngine​(ITranslator... translators)
        Constructor.
        Parameters:
        translators - The translators.
    • Method Detail

      • newTranslationQueue

        protected TranslationQueue newTranslationQueue​(java.lang.String sourceLanguageCode,
                                                       java.lang.String targetLanguageCode,
                                                       ITranslator translator)
        Creates a new TranslationQueue instance.
        Specified by:
        newTranslationQueue in class TranslationEngine
        Parameters:
        sourceLanguageCode - The source language code, null for auto-detect.
        targetLanguageCode - The target language code.
        translator - The translator.
      • getTranslator

        public ITranslator getTranslator​(java.lang.String sourceLanguageCode,
                                         java.lang.String targetLanguageCode)
        Gets the translator to use for a particular language combination.
        Parameters:
        sourceLanguageCode - The source language code, null for automatic detection.
        targetLanguageCode - The target language code.
        Returns:
        The translator, null for not found or not configured.
      • getReadyState

        public java.lang.String getReadyState()
        Gets the ready state of this translation engine.
        Returns:
        OK = null.
      • isLanguageHandled

        public boolean isLanguageHandled​(java.lang.String languageCode)
        Verifies if a Language Code is handled by this translator.
        Parameters:
        languageCode - The language code.
        Returns:
        true if supported, false if not.
      • getProxy

        public java.net.Proxy getProxy​(java.net.URL url)
        Gets a proxy to use for an URL.
        Parameters:
        url - The URL.
        Returns:
        The Proxy to use.
      • configureProxy

        public void configureProxy​(java.net.HttpURLConnection urlConnection)
        Configures a Http(s)URLConnection for proxy information.
        Parameters:
        urlConnection - The HttpURLConnection or HttpsURLConnection.