Middleware systems have received significant attention for supporting distributed heterogeneous information systems. A few research groups study both the deployment of application specific functionality into middleware systems. and query optimization based on reduction of data movement. Such extensions relieve system administrators and developers from tedious tasks on manual installation, consistency and maintenance of user specific codes. In this paper, we present the design and implementation details of a middleware system, which aims to enhance query optimization based on data movement by involving the data flow from the system to the client side. It is also aimed to provide an efficient code-shipping model for automatic code deployment by using a simple data type model. In order to support portability and efficient dynamic loading capability, the project was implemented using Java and XML.