/**
   * Add a dynamic endpoint to the list of dynamic endpoints.
   *
   * @param endpointId identifier of dynamic {@link EndpointDefinition} to chose as the underlying
   *     {@link EndpointDefinition}
   * @param name name to set
   * @param dataType data type to set
   * @param metaData meta data to set
   * @param identifier identifier of the endpoint
   * @param parentGroup name of parent input group, <code>null</code> for using default group or
   *     none
   * @param checkIfDeclared perform check if dynamic endpoint is declared
   * @return {@link EndpointDescription} object created and added or <code>null</code> if the name
   *     already exists
   * @throws IllegalArgumentException if dynamic endpoint description with given name already exists
   *     or new name is invalid
   */
  public EndpointDescription addDynamicEndpointDescription(
      String endpointId,
      String name,
      DataType dataType,
      Map<String, String> metaData,
      String identifier,
      String parentGroup,
      boolean checkIfDeclared)
      throws IllegalArgumentException {

    if (checkIfDeclared
        && (!isDynamicEndpointDefinitionDeclared(endpointId) || !isValidEndpointName(name))) {
      String message;
      if (!isDynamicEndpointDefinitionDeclared(endpointId)) {
        message = StringUtils.format(NO_DYNAMIC_ENDPOINT_DEFINITION_WITH_ID_S_DECLARED, endpointId);
      } else {
        message = MESSAGE_DESIRED_ENDPOINT_NAME_ALREADY_EXISTS + name;
      }
      throw new IllegalArgumentException(message);
    }

    EndpointDescription desc =
        new EndpointDescription(
            endpointDefinitionsProvider.getDynamicEndpointDefinition(endpointId), identifier);

    desc.setName(name);
    desc.setDynamicEndpointIdentifier(endpointId);
    desc.setDataType(dataType);
    for (String key : metaData.keySet()) {
      desc.setMetaDataValue(key, metaData.get(key));
    }
    if (parentGroup != null) { // default (if there is one) should not be used as explicit
      // parent group is given
      desc.setParentGroupName(parentGroup);
    }
    dynamicEndpointDescriptions.put(name, desc);

    firePropertyChange(
        PROPERTY_ENDPOINT, new EndpointChange(EndpointChange.Type.Added, desc, null));

    return desc;
  }
 private boolean isDynamicEndpointDefinitionDeclared(String endpointId) {
   return endpointDefinitionsProvider.getDynamicEndpointDefinition(endpointId) != null;
 }
 /**
  * @param id identifier of {@link EndpointDefinition} to get
  * @return {@link EndpointDefinition} with given id
  */
 public EndpointDefinition getDynamicEndpointDefinition(String id) {
   return endpointDefinitionsProvider.getDynamicEndpointDefinition(id);
 }