You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Chandra Kalirasa <ck...@seatoncorp.com> on 2012/09/14 17:16:45 UTC

Data Transform to Bean

Hi:
I am new to camel.   

I have text files (.txt)  which contains Employee info.  I need to map employee info fields  into Beans. Is there any mapping/data transform to bean in Camel? Please advise.

Thank you,
Chandra

Sample text file:

EMPLOYEE_NUM|FIRST_NAM|LAST_NAM|EMAIL|WORK_PHONE_NUM|DEPT_CD|ACTIVE|ROLE|SSN|BUS_UNIT_CD                
112011|shiv|Pewee|shiv.pewee@yahoo.com||610000 Employee Relations|N|R|123-62-4874|IT           
123212|red|Nore|abby.norman@google.com||610000 Employee Relations|N|R|123-98-7953|HR         
357533|dade|kkekee|ada.keke@google.com|7077-359-6452|610 Employee Relations|N|R|308-25-7297|SHIPING        
134944|Penn|Russe|penn.russe@google.com||610 Employee Relations|Y|R|123-37-9350|IT  
111155|Alb|Lasillase|ad@yahoo.com|180-693-2428|530  Administration|N|H|150-97-1265|IT
1111661|ed|Xasillase|exandria.casils@google.com|180-693-2428|543 Administration|N|R|230-97-1265|IT




RE: Data Transform to Bean

Posted by santoshjoshi <sa...@gmail.com>.
Hi chandra 

I have created an example at 

https://github.com/santoshjoshi/camel-bindy-example
https://github.com/santoshjoshi/camel-bindy-example 

Please have a look at that .

regards
Santosh Joshi
Chandra Kalirasa wrote
> 
> Hi Santosh,
> Thanks for the prompt response.
> 
> Do I need to convert the text file (*.txt) into String before I map into
> bean? Because these are not CSV files.
> 
>   context.addRoutes(new RouteBuilder() {
>             public void configure() {
>             
> from("file://inputdir?noop=true&fileName=employee_feed.txt").convertBodyTo(String.class)
>                 )
> 
>             }
>         });
> 
> Thanks
> Chandra
> 
> 
> -----Original Message-----
> From: santoshjoshi [mailto:santoshjoshi2003@]
> Sent: Friday, September 14, 2012 12:37 PM
> To: users@.apache
> Subject: Re: Data Transform to Bean
> 
> Hi Chandra,
> 
> You can use Camel Bindy Component.  http://camel.apache.org/bindy.html
> http://camel.apache.org/bindy.html
> 
> Regards
> Santosh Joshi
> 
> 
> Chandra Kalirasa wrote
>>
>> Hi:
>> I am new to camel.
>>
>> I have text files (.txt)  which contains Employee info.  I need to map
>> employee info fields  into Beans. Is there any mapping/data transform to
>> bean in Camel? Please advise.
>>
>> Thank you,
>> Chandra
>>
>> Sample text file:
>>
>> EMPLOYEE_NUM|FIRST_NAM|LAST_NAM|EMAIL|WORK_PHONE_NUM|DEPT_CD|ACTIVE|ROLE|SSN|BUS_UNIT_CD
>> 112011|shiv|Pewee|shiv.pewee@||610000 Employee
>> Relations|N|R|123-62-4874|IT
>> 123212|red|Nore|abby.norman@||610000 Employee
>> Relations|N|R|123-98-7953|HR
>> 357533|dade|kkekee|ada.keke@|7077-359-6452|610 Employee
>> Relations|N|R|308-25-7297|SHIPING
>> 134944|Penn|Russe|penn.russe@||610 Employee Relations|Y|R|123-37-9350|IT
>> 111155|Alb|Lasillase|ad@|180-693-2428|530
>> Administration|N|H|150-97-1265|IT
>> 1111661|ed|Xasillase|exandria.casils@|180-693-2428|543
>> Administration|N|R|230-97-1265|IT
>>
> 
> 
> 
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/Processing-large-files-in-Camel-tp5719376p5719388.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
> 




--
View this message in context: http://camel.465427.n5.nabble.com/Processing-large-files-in-Camel-tp5719376p5719394.html
Sent from the Camel - Users mailing list archive at Nabble.com.

RE: Data Transform to Bean

Posted by Chandra Kalirasa <ck...@seatoncorp.com>.
Hi Santosh, 
Thanks for the prompt response.

Do I need to convert the text file (*.txt) into String before I map into bean? Because these are not CSV files. 

  context.addRoutes(new RouteBuilder() {
            public void configure() {
            	from("file://inputdir?noop=true&fileName=employee_feed.txt").convertBodyTo(String.class)
                )         
             
            }
        });

Thanks
Chandra


-----Original Message-----
From: santoshjoshi [mailto:santoshjoshi2003@gmail.com] 
Sent: Friday, September 14, 2012 12:37 PM
To: users@camel.apache.org
Subject: Re: Data Transform to Bean

Hi Chandra,

You can use Camel Bindy Component.  http://camel.apache.org/bindy.html
http://camel.apache.org/bindy.html 

Regards
Santosh Joshi


Chandra Kalirasa wrote
> 
> Hi:
> I am new to camel.
> 
> I have text files (.txt)  which contains Employee info.  I need to map
> employee info fields  into Beans. Is there any mapping/data transform to
> bean in Camel? Please advise.
> 
> Thank you,
> Chandra
> 
> Sample text file:
> 
> EMPLOYEE_NUM|FIRST_NAM|LAST_NAM|EMAIL|WORK_PHONE_NUM|DEPT_CD|ACTIVE|ROLE|SSN|BUS_UNIT_CD
> 112011|shiv|Pewee|shiv.pewee@||610000 Employee
> Relations|N|R|123-62-4874|IT
> 123212|red|Nore|abby.norman@||610000 Employee Relations|N|R|123-98-7953|HR
> 357533|dade|kkekee|ada.keke@|7077-359-6452|610 Employee
> Relations|N|R|308-25-7297|SHIPING
> 134944|Penn|Russe|penn.russe@||610 Employee Relations|Y|R|123-37-9350|IT
> 111155|Alb|Lasillase|ad@|180-693-2428|530 
> Administration|N|H|150-97-1265|IT
> 1111661|ed|Xasillase|exandria.casils@|180-693-2428|543
> Administration|N|R|230-97-1265|IT
> 



--
View this message in context: http://camel.465427.n5.nabble.com/Processing-large-files-in-Camel-tp5719376p5719388.html
Sent from the Camel - Users mailing list archive at Nabble.com.




Re: Data Transform to Bean

Posted by santoshjoshi <sa...@gmail.com>.
Hi Chandra,

You can use Camel Bindy Component.  http://camel.apache.org/bindy.html
http://camel.apache.org/bindy.html 

Regards
Santosh Joshi


Chandra Kalirasa wrote
> 
> Hi:
> I am new to camel.
> 
> I have text files (.txt)  which contains Employee info.  I need to map
> employee info fields  into Beans. Is there any mapping/data transform to
> bean in Camel? Please advise.
> 
> Thank you,
> Chandra
> 
> Sample text file:
> 
> EMPLOYEE_NUM|FIRST_NAM|LAST_NAM|EMAIL|WORK_PHONE_NUM|DEPT_CD|ACTIVE|ROLE|SSN|BUS_UNIT_CD
> 112011|shiv|Pewee|shiv.pewee@||610000 Employee
> Relations|N|R|123-62-4874|IT
> 123212|red|Nore|abby.norman@||610000 Employee Relations|N|R|123-98-7953|HR
> 357533|dade|kkekee|ada.keke@|7077-359-6452|610 Employee
> Relations|N|R|308-25-7297|SHIPING
> 134944|Penn|Russe|penn.russe@||610 Employee Relations|Y|R|123-37-9350|IT
> 111155|Alb|Lasillase|ad@|180-693-2428|530 
> Administration|N|H|150-97-1265|IT
> 1111661|ed|Xasillase|exandria.casils@|180-693-2428|543
> Administration|N|R|230-97-1265|IT
> 



--
View this message in context: http://camel.465427.n5.nabble.com/Processing-large-files-in-Camel-tp5719376p5719388.html
Sent from the Camel - Users mailing list archive at Nabble.com.