RPM Updation & Keeping User Change files during removal

Hi All,

I have a RPM for an Java based application. Currently it works fine.

But recently I want to implement that when newer packages gets installed over the older one, the rpm should only update the older files with the newer one (I know this could be done by rpm -Uvh xxx.rpm), but it should not update any such file changed by the user (say a config file).

Also, during rpm removal process it should only remove only those files which were got installed during installation time, not any files which were added after post-installation process.
Current for this I have "postun" script which removes everything, but I want to keep the user added files as it is.

Can I achieve by any rpm commands or by other means.

thanks.