Help with awk/shell script needed!

I have a shell script which reads a file named filelist.txt, containing a list of fully qualified filenames (with complete path), and then does some processing based on the file extension. In order to do the processing, I have to know the file extension, the filename without extension and just the filename_with_extension(excluding the full path)

some sample lines in the filelist.txt looks like this
/home/johndoe/test/a.java
/home/rwilliams/test2/b.xml

My script looks like below (basically I am using awk and relying on "." to give me the extension and filename_without_extension

#!/bin/sh

for cfilename in `cat filelist.txt`
do
file_extension=`echo $cfilename | awk -F\/ '{print $NF}' | awk -F. '{print $NF}'`
export file_extension
filename_wo_ext=`echo $cfilename | awk -F\/ '{print $NF}' | awk -F. '{print $1}'`
export filename_wo_ext
filename_with_ext=$filename.$file_extension
export filename_with_ext
<processing logic>
done

The problem is this script works fine for normal files with names like /home/johndoe/test/a.java
however whenever I encounter files with names like /home/john.doe/test/abcd.efgh.ijkl.mnop.qrst.xml
the script throws up as it relies heavily on the "." character embedded in the name to be the separator between the extension and filename.

Any help will be really appreciated!

1) there are no such things as extensions in UNIX. a period is just part of the filename.

2) This might give you some ideas on how to handle:

for F in /home/johndoe/test/a.java /home/rwilliams/test2/b.xml /home/johndoe/test/a.java /home/john.doe/test/abcd.efgh.ijkl.mnop.qrst.xml
do
echo $F
echo $(basename $F)
echo $(dirname $F)
echo $(basename $F | awk -F. -v OFS=. '{$NF=""; sub("[.]$", ""); print}')
echo $(basename $F | awk -F. '{print $NF}')
done
----------------------------- OUTPUT -----------------------------
/home/johndoe/test/a.java
a.java
/home/johndoe/test
a
java
/home/rwilliams/test2/b.xml
b.xml
/home/rwilliams/test2
b
xml
/home/johndoe/test/a.java
a.java
/home/johndoe/test
a
java
/home/john.doe/test/abcd.efgh.ijkl.mnop.qrst.xml
abcd.efgh.ijkl.mnop.qrst.xml
/home/john.doe/test
abcd.efgh.ijkl.mnop.qrst
xml

thanks Unix-god, the solution you gave works like a charm! though I couldn't figure out some of the intricate regexp embedded inside ;-))

The solution proposed above returns file extension and filename excluding the full path and the extension, ONLY if the format of the filename is something like /home/john.doe/test.java or /home/john.doe/test.test1.test2.test3.java;

However unfortunately whenever it encounters a filename without an extension e.g. /home/john.doe/runjava then the script returns runjava as the file extension instead of returning null as file extension and the filename excluding the full path and the extension is returned as null instead. (kinda it's doing a complete switcheroo)

Is there a way to handle this? because I just realized that there are quite a few executables I have in my filelist.txt without any extensions as such (like /bin/gzip, /usr/local/bin/perl etc.) and my script just craps out when it encounters them. Any help will be really appreciated!