* {@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);
paramsMetadata.put(p.key, paramInfo);
if (isNew) {
// set default value
Serializable defValue;
if ("namespace".equals(paramInfo.getName())) {
defValue = catalog.getDefaultNamespace().getURI();
} else if (URL.class == paramInfo.getBinding()) {
defValue = "file:data/example.extension";
} else {
defValue = paramInfo.getValue();
}
info.getConnectionParameters().put(paramInfo.getName(), defValue);
}
}
}
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