Beispiel #1
0
  /**
   * Make sure that the endpoints created by the factory has a name
   *
   * @param epConfig OMElement containing the endpoint configuration.
   * @param anonymousEndpoint false if the endpoint has a name. true otherwise.
   * @param properties bag of properties to pass in any information to the factory
   * @return Endpoint implementation for the given configuration.
   */
  private Endpoint createEndpointWithName(
      OMElement epConfig, boolean anonymousEndpoint, Properties properties) {

    Endpoint ep = createEndpoint(epConfig, anonymousEndpoint, properties);
    OMElement descriptionElem = epConfig.getFirstChildWithName(DESCRIPTION_Q);
    if (descriptionElem != null) {
      ep.setDescription(descriptionElem.getText());
    }

    // if the endpoint doesn't have a name we will generate a unique name.
    if (anonymousEndpoint && ep.getName() == null) {
      String uuid = UIDGenerator.generateUID();
      uuid = uuid.replace(':', '_');
      ep.setName(ENDPOINT_NAME_PREFIX + uuid);
      if (ep instanceof AbstractEndpoint) {
        ((AbstractEndpoint) ep).setAnonymous(true);
      }
    }

    OMAttribute onFaultAtt = epConfig.getAttribute(ON_FAULT_Q);
    if (onFaultAtt != null) {
      ep.setErrorHandler(onFaultAtt.getAttributeValue());
    }
    return ep;
  }