Playing media from asterisk manager interface

Hi,
I am developing an application using Asterisk manager interface(asterisk-java) which handles the calls from different users.
I need to play a specific file to a particular channel.The file i have put in /var/lib/asterisk/sounds folder. Now i have to pass the file name to dial plan from my application using asterisk-java api’s. But i am not able to find any api supporting this feature.
Please suggest some solution to pass the file name to dialplan to play it.
Your help will be highly appreciated.
Thank you,
Prashant

I have found that we can do this by using AGI(asterisk-java).
But i don’t know how to use it with AMI. My application queries database for a particular music file name and then it has to be used to send to dialplan.
I have to deploy my application on jboss.I have no idea on how to configure AGI for jboss.Can i club it with my AMI application.
Any suggestion?

Set the name of the file (without the extension) as a channel variable, then redirect the channel to dialplan code that issues playback. Obviously the dialplan will have to dispose of the call after the play back.

Note, it is more helpful if you say what the real application is and why you are constrained to use things like JBOSS. Otherwise it sounds like a homework question.