/**
   * Creates a new parameters panel with a list of input fields matching the {@link Param}s for the
   * factory related to the {@code DataStoreInfo} that's the model of the provided {@code Form}.
   *
   * @param componentId the id for this component instance
   * @param storeEditForm the form being build by the calling class, whose model is the {@link
   *     DataStoreInfo} being edited
   */
  public DefaultDataStoreEditPanel(final String componentId, final Form storeEditForm) {
    super(componentId, storeEditForm);

    final IModel model = storeEditForm.getModel();
    final DataStoreInfo info = (DataStoreInfo) model.getObject();
    final Catalog catalog = getCatalog();
    final ResourcePool resourcePool = catalog.getResourcePool();
    DataAccessFactory dsFactory;
    try {
      dsFactory = resourcePool.getDataStoreFactory(info);
    } catch (IOException e) {
      throw new RuntimeException(e);
    }

    final Map<String, ParamInfo> paramsMetadata = new LinkedHashMap<String, ParamInfo>();

    {
      final boolean isNew = null == info.getId();
      final Param[] dsParams = dsFactory.getParametersInfo();
      for (Param p : dsParams) {
        ParamInfo paramInfo = new ParamInfo(p);
        // hide the repository params, the resource pool will inject it transparently
        if (!Repository.class.equals(paramInfo.getBinding())) {
          paramsMetadata.put(p.key, paramInfo);
          if (isNew && !p.isDeprecated()) {
            applyParamDefault(paramInfo, info);
          }
        }
      }
    }

    final List<String> keys = new ArrayList<String>(paramsMetadata.keySet());
    final IModel paramsModel = new PropertyModel(model, "connectionParameters");

    ListView paramsList =
        new ListView("parameters", keys) {
          private static final long serialVersionUID = 1L;

          @Override
          protected void populateItem(ListItem item) {
            String paramName = item.getDefaultModelObjectAsString();
            ParamInfo paramMetadata = paramsMetadata.get(paramName);

            Component inputComponent;
            inputComponent = getInputComponent("parameterPanel", paramsModel, paramMetadata);

            String description = paramMetadata.getTitle();
            if (description != null) {
              inputComponent.add(new SimpleAttributeModifier("title", description));
            }
            item.add(inputComponent);
          }
        };
    // needed for form components not to loose state
    paramsList.setReuseItems(true);

    add(paramsList);
  }