de.julielab.xmlData.config.FieldConfigurationManager Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of costosys Show documentation
Show all versions of costosys Show documentation
A utility for managing documents stored in a PostgreSQL database. The documents are imported into a
PostgreSQL DB as full texts with the goal to be able to retrieve the documents by their PubMedID efficiently.
For more sophisticated tasks, a user configuration file can be delivered which can take control of the table
schema to use, the PostgreSQL schema to use and the actual database server to connect to as well as the concrete
database.
/**
* FieldConfigurationManager.java
*
* Copyright (c) 2013, JULIE Lab.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
*
* Author: faessler
*
* Current version: 1.0
* Since version: 1.0
*
* Creation date: 01.02.2013
**/
/**
*
*/
package de.julielab.xmlData.config;
import java.util.HashMap;
import java.util.List;
import org.apache.commons.lang3.StringUtils;
/**
*
* This class is essentially a HashMap.
*
*
* It maps table schema names defined in the default or user provided
* configuration to the {@link FieldConfig} objects modeling these schemas. This
* class adds some minor validity checks to the default map methods.
*
*
* @author faessler
*
*/
public class FieldConfigurationManager extends HashMap {
/**
*
*/
private static final long serialVersionUID = -6516109594561720970L;
/*
* (non-Javadoc)
*
* @see java.util.HashMap#get(java.lang.Object)
*/
@Override
public FieldConfig get(Object key) {
if (null == key || StringUtils.isBlank(key.toString()))
throw new TableSchemaDoesNotExistException(
"The name of the table schema to fetch was null.");
FieldConfig fieldConfig = super.get(key);
if (null == fieldConfig) {
throw new TableSchemaDoesNotExistException("The requested table schema definition \"" + key
+ "\" is not defined in the default configuration or the user provided configuration.");
}
return fieldConfig;
}
}