Exemplo n.º 1
0
  @PostConstruct
  public void postConstruct() throws MissingConfigurationContextException {
    logger.info("Pz2Service PostConstruct of " + this);
    stateMgr = new StateManager();
    pzreq = new Pazpar2Commands();
    pzresp = new Responses();
    errors = new ErrorCentral();
    pzresp.setErrorHelper(errors.getHelper());

    logger.debug("Pz2Service PostConstruct: Configurator is " + configurator);
    logger.debug(Utils.objectId(this) + " will instantiate a Pz2Client next.");
    pz2Client = new Pz2Client();
    spClient = new ServiceProxyClient();
    stateMgr.addStateListener(this);
    try {
      configureClient(pz2Client, configurator);
      configureClient(spClient, configurator);
      this.configure(configurator);
    } catch (MissingConfigurationContextException mcc) {
      logger.info("No configuration context available at this point");
      logger.debug("Configuration invoked from a Servlet filter before application start?");
      throw mcc;
    } catch (ConfigurationException e) {
      logger.warn("There was a problem configuring the Pz2Service and/or clients (\"pz2\")");
      e.printStackTrace();
    }
  }
Exemplo n.º 2
0
 /**
  * Configures the selected search client using the selected configuration reader.
  *
  * <p>The configuration reader is select deploy-time - by configuration in the application's
  * beans.xml.
  *
  * @param client search client to use
  * @param configReader the selected configuration mechanism
  * @throws MissingConfigurationContextException if this object is injected before there is a Faces
  *     context for example in a Servlet filter.
  */
 public void configureClient(SearchClient client, ConfigurationReader configReader)
     throws MissingConfigurationContextException {
   logger.debug(Utils.objectId(this) + " will configure search client for the session");
   try {
     client.configure(configReader);
   } catch (MissingConfigurationContextException mcce) {
     logger.info("No Faces context is available to the configurator at this time of invocation");
     throw mcce;
   } catch (ConfigurationException e) {
     logger.debug("Pz2Service adding configuration error");
     errors.addConfigurationError(
         new ConfigurationError("Search Client", "Configuration", e.getMessage()));
   }
   logger.info(configReader.document());
   pzresp.getSp().resetAuthAndBeyond(true);
 }