@ Override public void postInitModule ( ) throws ModuleInitializationException { super . postInitModule ( ) ; // validate required param: GSEARCH_REST_URL _gSearchRESTURL = getParameter ( GSEARCH_REST_URL ) ; if ( _gSearchRESTURL == null ) { throw new ModuleInitializationException ( "Required parameter, " + GSEARCH_REST_URL + " was not specified" , getRole ( ) ) ; } else { try { new URL ( _gSearchRESTURL ) ; logger . debug ( "Configured GSearch REST URL: " + _gSearchRESTURL ) ; } catch ( MalformedURLException e ) { throw new ModuleInitializationException ( "Malformed URL given " + "for " + GSEARCH_REST_URL + " parameter: " + _gSearchRESTURL , getRole ( ) ) ; } } // validate credentials: if GSEARCH_USERNAME is given, GSEARCH_PASSWORD // should also be. String user = getParameter ( GSEARCH_USERNAME ) ; if ( user != null ) { logger . debug ( "Will authenticate to GSearch service as user: " + user ) ; String pass = getParameter ( GSEARCH_PASSWORD ) ; if ( pass != null ) { _gSearchCredentials = new UsernamePasswordCredentials ( user , pass ) ; } else { throw new ModuleInitializationException ( GSEARCH_PASSWORD + " must be specified because " + GSEARCH_USERNAME + " was specified" , getRole ( ) ) ; } } else { logger . debug ( GSEARCH_USERNAME + " unspecified; will not attempt " + "to authenticate to GSearch service" ) ; } // finally, init the http client we'll use _webClientConfig = getServer ( ) . getWebClientConfig ( ) ; _webClient = new WebClient ( _webClientConfig ) ; }
Performs superclass post - initialization then completes initialization using GSearch - specific parameters .