Пример #1
0
 /**
  * Return gateway property key perf.monitor.expected.errors value
  *
  * @return String gateway property value
  */
 private static boolean isAllowSSNQuery() {
   boolean result = false;
   try {
     // Use CONNECT utility class to access gateway.properties
     String allowString =
         PropertyAccessor.getProperty(NhincConstants.GATEWAY_PROPERTY_FILE, ALLOW_SSN_QUERY);
     if (allowString != null && allowString.equalsIgnoreCase("true")) {
       result = true;
     }
   } catch (PropertyAccessException pae) {
     log.error(
         "Error: Failed to retrieve "
             + ALLOW_SSN_QUERY
             + " from property file: "
             + NhincConstants.GATEWAY_PROPERTY_FILE);
     log.error(pae.getMessage());
   } catch (NumberFormatException nfe) {
     log.error(
         "Error: Failed to convert "
             + ALLOW_SSN_QUERY
             + " from property file: "
             + NhincConstants.GATEWAY_PROPERTY_FILE);
     log.error(nfe.getMessage());
   }
   return result;
 }
Пример #2
0
  /**
   * This method loads information from the gateway.properties file that are pertinent to this
   * class.
   */
  private void loadProperties() throws UDDIAccessorException {
    if (!m_bPropsLoaded) {
      try {
        String sValue =
            PropertyAccessor.getProperty(GATEWAY_PROPFILE_NAME, UDDI_INQUIRY_ENDPOINT_URL);
        if ((sValue != null) && (sValue.length() > 0)) {
          m_sUDDIInquiryEndpointURL = sValue;
        }

        sValue = PropertyAccessor.getProperty(GATEWAY_PROPFILE_NAME, UDDI_BUSINESSES_TO_IGNORE);
        if ((sValue != null) && (sValue.length() > 0)) {
          String saBusiness[] = sValue.split(";");
          if ((saBusiness != null) && (saBusiness.length > 0)) {
            for (int i = 0; i < saBusiness.length; i++) {
              m_hBusinessToIgnore.add(saBusiness[i]);
            }
          }
        }

        m_bPropsLoaded = true;

      } catch (Exception e) {
        String sErrorMessage =
            "Failed to retrieve properties from "
                + GATEWAY_PROPFILE_NAME
                + ".properties file.  Error: "
                + e.getMessage();
        log.error(sErrorMessage, e);
        throw new UDDIAccessorException(sErrorMessage, e);
      }

      // If we do not have the endpoint URL, then we have a problem.
      // -------------------------------------------------------------
      if ((m_sUDDIInquiryEndpointURL == null) || (m_sUDDIInquiryEndpointURL.length() <= 0)) {
        log.error(
            "Failed to retrieve property: '"
                + UDDI_INQUIRY_ENDPOINT_URL
                + "' from "
                + GATEWAY_PROPFILE_NAME
                + ".properties file.   UDDI server cannot be accessed.");
      }
    }
  }
 @Override
 public final String getDefaultFileDestination() {
   String defaultFileLoc = null;
   try {
     defaultFileLoc =
         PropertyAccessor.getProperty(
             NhincConstants.GATEWAY_PROPERTY_FILE, NhincConstants.LIFT_FILEDROP);
   } catch (PropertyAccessException ex) {
     log.error(ex.getMessage());
   }
   return defaultFileLoc;
 }
  /**
   * Determine if audit is enabled for the NwHIN interface
   *
   * @return Flag to indicate if audit logging is enabled for this interface
   */
  protected boolean isAuditEnabled(String propertyFile, String propertyName) {
    boolean isEnabled = false;
    try {
      isEnabled = PropertyAccessor.getInstance().getPropertyBoolean(propertyFile, propertyName);
    } catch (PropertyAccessException e) {
      LOG.error(
          "Error: Failed to retrieve " + propertyName + " from property file: " + propertyFile);
      LOG.error(e.getMessage(), e);
    }

    return isEnabled;
  }
 private int getTimeoutFromConfig() {
   int timeout = 0;
   try {
     String sValue = PropertyAccessor.getInstance().getProperty(CONFIG_KEY_TIMEOUT);
     if (NullChecker.isNotNullish(sValue)) {
       timeout = Integer.parseInt(sValue);
     }
   } catch (PropertyAccessException ex) {
     LOG.warn(
         "Error occurred reading property value from config file ("
             + CONFIG_KEY_TIMEOUT
             + ").  Exception: "
             + ex.toString());
   } catch (NumberFormatException nfe) {
     LOG.warn(
         "Error occurred converting property value: "
             + CONFIG_KEY_TIMEOUT
             + ".  Exception: "
             + nfe.toString());
   }
   return timeout;
 }
 static {
   context =
       new FileSystemXmlApplicationContext(
           PropertyAccessor.getPropertyFileLocation() + CONFIG_FILE_NAME);
 }