/** {@inheritDoc} */
  public SOAPMessage signSoapMessage(SOAPMessage msg, CredentialInfo credentialInfo)
      throws JAXRException {
    try {
      // Check if the server being communicated is a legacy server and property for it is set.
      boolean legacyServer =
          Boolean.valueOf(
                  CommonProperties.getInstance()
                      .getProperty("omar.common.security.legacyServer", "false"))
              .booleanValue();

      // Create XWSProcessor
      XWSSProcessorFactory factory = XWSSProcessorFactory.newInstance();
      XWSSProcessor processor = null;
      if (legacyServer) {
        processor =
            factory.createForSecurityConfiguration(
                getSecurityConfiguration(msg), new SecurityCallbackHandler(credentialInfo));
      } else {

        processor =
            factory.createForSecurityConfiguration(
                getSigningSecurityConfiguration(msg, credentialInfo),
                new SecurityCallbackHandler(credentialInfo));
      }
      ProcessingContext context = new ProcessingContext();

      // msg will be updated in place
      context.setSOAPMessage(msg);
      processor.secureOutboundMessage(context);

      // work around for SOAPMessage.writeTo() inconsistencies
      msg.saveChanges();
    } catch (Exception e) {
      throw new JAXRException(
          CommonResourceBundle.getInstance().getString("message.signSoapMessageFailed"), e);
    }

    return msg;
  }
  public QueryManager getQueryManager() {
    if (qm == null) {
      synchronized (this) {
        if (qm == null) {
          try {
            String pluginClass =
                CommonProperties.getInstance().getProperty(QUERY_MANAGER_CLASS_PROPERTY);

            qm = (QueryManager) createPluginInstance(pluginClass);
          } catch (Exception e) {
            String errmsg =
                "[QueryManager] Cannot instantiate "
                    + "QueryManager plugin. Please check that "
                    + "property '"
                    + QUERY_MANAGER_CLASS_PROPERTY
                    + "' is correctly set in omar-common.properties file.";
            log.error(errmsg, e);
          }
        }
      }
    }

    return qm;
  }