File Adapter :How to create a File To File Any Text Using Mediator:
Hi all, today i post a content regarding to how to create File Adapter and how to read and write a file from Source directory to target directory.
At the Starting of the Project Create two folders at any directory, (eg:ReadFileFolder, WriteFileFolder), They acts as Source Folder & Target Folder.
Open JDeveloper, Create New Project
At the Starting of the Project Create two folders at any directory, (eg:ReadFileFolder, WriteFileFolder), They acts as Source Folder & Target Folder.
Open JDeveloper, Create New Project
In New Gallery Window Select SOA Project & give proper project name & click on finish
Soure Creation:
In composite window at left side at exposed references, right click and select insert button and in list select FileAdapter (or) in component window directly select FileAdapter.
In FileAdapter Configuration Wizard window select Next button
In Service Name give proper Name.(eg: ReadFile or SelectFile) & Click on Next
In Adapters Interface Window Select "Define from operaion and schema" radio button
In Operation Types Select Read File. & click on next
In File Filtering Window Select File Wildcards radio button, & give Proper Name in Include Files with Name Pattern(like text files &more eg; *.txt--it supports text files, or *.* it supports any file format )
In this window we define polling frequency which means after how many seconds or minutes our file adapter will poll for new files.Also, if you want your file adapter not to read all the files as they are written on the server, use the minimum file age option.Click next.
In Messages window Check Native format translation is not required(Schema is Opaque) & click on Next button and finally select finish button.
Target Creation:
In Composite Window at left hand side External Reference, Right Click & select File Adapter

In Service Name give proper Name.(eg: WriteFile) & Click on Next,

Now you copy one text file and place this text file in source folder, depending on polling Frequecy it moves from source to destination folder.
Target Creation:
In Composite Window at left hand side External Reference, Right Click & select File Adapter

In FileAdapter Configuration Wizard window select Next button
In Service Name give proper Name.(eg: WriteFile) & Click on Next,
click on next. In Operation window Select Write File &click on Next
it Show you File Configuration Window Select directory physical Path & Directory location where you want to Move/copy file Target Folder. In File Naming Convention give output_%SEQ%.txt(if you want target folder text means give text or other file format)
it Show you File Configuration Window Select directory physical Path & Directory location where you want to Move/copy file Target Folder. In File Naming Convention give output_%SEQ%.txt(if you want target folder text means give text or other file format)
In Messages window Check Native format translation is not required(Schema is Opaque) & click on Next button and finally select finish button.
After Completion of Creating source &Target Adapter, At the middle place of Composite Window, Right Click and select Mediator

It displays Creat Mediator Window

Give Proper Mediator name.
Now give connections to source File Adapter to Mediator & Mediator to Target File Adapter.

Now give Transformation From Source Adapter to Target Adapter. Double click on Mediator.

In this Mediator window Select transformation icon
Save the Project & deploy itAfter Completion of Creating source &Target Adapter, At the middle place of Composite Window, Right Click and select Mediator

It displays Creat Mediator Window
Give Proper Mediator name.
Now give connections to source File Adapter to Mediator & Mediator to Target File Adapter.
Now give Transformation From Source Adapter to Target Adapter. Double click on Mediator.

In this Mediator window Select transformation icon
Now you copy one text file and place this text file in source folder, depending on polling Frequecy it moves from source to destination folder.
No comments:
Post a Comment