apex-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Munagala Ramanath <...@datatorrent.com>
Subject Re: Need help to initialize a list from properties.xml
Date Mon, 07 Nov 2016 14:36:38 GMT
Try changing *setFieldInfo* to* setFieldInfoItem*

Ram

On Mon, Nov 7, 2016 at 4:23 AM, Hitesh Kapoor <hitesh@datatorrent.com>
wrote:

> Hi All,
>
>
> Currently in JdbcPOJOInsertOuput operator we cannot configure JdbcFieldInfo
> via properties.xml and the user has to do the necessary coding in his
> application.
> To start solving this issue I followed the steps mentioned on
> http://docs.datatorrent.com/application_packages/#operator-properties
>
> And added the following code in AbstractJdbcPOJOOutputOperator (just for
> learning/testing)
>
> public void setFieldInfo(int index, String value)
>   {
>     LOG.info("In setting field info");
>     JdbcFieldInfo jvalue = new JdbcFieldInfo();
>     StringTokenizer st = new StringTokenizer(value);
>     jvalue.setColumnName(st.nextToken());
>     jvalue.setPojoFieldExpression(st.nextToken());
>     jvalue.setType(FieldInfo.SupportType.valueOf(st.nextToken()));
>     jvalue.setSqlType(Integer.parseInt(st.nextToken()));
>
>     final int need = index - fieldInfos.size() + 1;
>     for (int i = 0; i < need; i++) {
>       fieldInfos.add(null);
>     }
>     fieldInfos.set(index, jvalue);
>   }
>
> In my corresponding application I added the following lines in
> properties.xml:
> <property>
>     <name>dt.operator.jdbcOutput.fieldInfo[0]</name>
>     <value>customerPhone customerPhone STRING 0</value>
>   </property>
> //Added similar properties for remaining field infos.
>
>
> The issue I am facing is that setFieldInfo() is not being called. Am I
> missing something?
>
> Regards,
> Hitesh
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message