public Object getAttribute(String name,
Configuration modeConf,
Map objectModel) throws ConfigurationException {
if (!this.initialized) {
this.lazy_initialize();
}
if (this.defaultInput == null) {
if (getLogger().isWarnEnabled())
getLogger().warn("No input module given. FAILING");
return null;
}
// obtain correct configuration objects
// default vs dynamic
Configuration mConf = this.memberConf;
Configuration inputConfig = null;
String inputName=null;
if (modeConf!=null) {
mConf = modeConf.getChild("member");
inputName = modeConf.getChild("input-module").getAttribute("name",null);
if (inputName != null) {
inputConfig = modeConf.getChild("input-module");
}
}
// read necessary parameters
// name is used only if parameter name contains '*'
// in that case it replaces '*' otherwise it is
// ignored
String jType = mConf.getAttribute("type","string");
String pName = mConf.getAttribute("name");
int index = pName.indexOf("*");
if (index >-1) {
String prefix = (index > 0 ? pName.substring(0,index) : null);
String suffix = (index < (pName.length() -1) ? pName.substring(index+1,pName.length()) : null);
pName = prefix+name+suffix;
}
getLogger().debug("jType "+jType);
Object[] values = getValues(pName, objectModel,
this.input, this.defaultInput, this.inputConf,
null, inputName, inputConfig);
Object[] objects = null;
if (values != null) {
objects = new Object[values.length];
for (int i = 0; i< values.length; i++) {
Object value = values[i];
objects[i] = JDBCTypeConversions.convert(value, jType);
}
}
return objects;
}
|