On Sun, Aug 24, 2008 at 12:41 PM, Mobinor <[EMAIL PROTECTED]> wrote: > As part of embedding Apache Mina FTP server, we need access to the stream > from the ftp connection from within our application. > > We have decided to implement our own STORE command, and then catching the > data stream from the DataConnection. > > Our issue is that the DataConnection only offers an outputstream( > transferFromClient(OutputStream out)). I have looked at the implementation > of the interface (org.apache.ftpserver.IODataConnection), and see there the > is a private method getDataInputStream. We would really like to get access > to this method from the DataConnection interface, or a similar method to get > direct access to the inputstream.
Yes, the reasoning behind the design of the interface is that I would like to do a MINA based implementation of the data connection. That would mean that we would not have an input stream at all. That means that even if we made getDataInputStream (or similar) public, you would be dependent on the internal implementation, would that be sufficient for you? Be aware that if we do get around to making a MINA based data connection and it turns out to work better than the current implementation, we're likely to drop IoDataConnection. Could you also describe why you need direct access to the input stream rather than providing an output stream for the data connection to read from? /niklas Thanks Niklas I must admit that I have not studied the implementation of MINA ftp in detail, so I will rather describe our need. Our intent is to store a file as a blob directly in a database, not using the file system. A very quick implementation is this one line code: Hibernate.createBlob(inputstream) This requires access to the data as an inputstream. To get access to the stream we have created our own STOR command, and we then have to convert the outputstream to an inputstream to be able to use the Hibernate util. With the current implementation of the IODataConnection it seams very simple to get access to the inputstream. If you intent to change the design this might be another case. If so, please evaluate our need and implement a proper solution. Store data directly into a database will be a very important usage of an embedded MINA ftp server. Please tell if you have better ways of using MINAftp for storing files directly into a database. Tore
