summaryrefslogtreecommitdiff
path: root/ucb
diff options
context:
space:
mode:
authorAndreas Bille <abi@openoffice.org>2002-06-24 14:17:55 +0000
committerAndreas Bille <abi@openoffice.org>2002-06-24 14:17:55 +0000
commit3823cbc49a23b0e31639af606b74c970a92d1003 (patch)
tree40c0036821db89a08c62bf2b8571d56f0ccf6241 /ucb
parent1c7556bc5eee8b4651353cfa1eab114431d13b2d (diff)
Added support for memorybased inputstream.
To do: Change to file-based inputstream in dependence on some critical buffersize.
Diffstat (limited to 'ucb')
-rw-r--r--ucb/source/ucp/ftp/ftpcontent.cxx95
-rw-r--r--ucb/source/ucp/ftp/ftpinpstr.cxx227
-rw-r--r--ucb/source/ucp/ftp/ftpinpstr.hxx186
-rw-r--r--ucb/source/ucp/ftp/ftploaderthread.cxx67
-rw-r--r--ucb/source/ucp/ftp/ftploaderthread.hxx67
-rw-r--r--ucb/source/ucp/ftp/makefile.mk29
-rw-r--r--ucb/source/ucp/ftp/test.cxx158
7 files changed, 791 insertions, 38 deletions
diff --git a/ucb/source/ucp/ftp/ftpcontent.cxx b/ucb/source/ucp/ftp/ftpcontent.cxx
index 4bc497a22a9c..7fa09380a95b 100644
--- a/ucb/source/ucp/ftp/ftpcontent.cxx
+++ b/ucb/source/ucp/ftp/ftpcontent.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: ftpcontent.cxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: abi $ $Date: 2002-06-20 14:49:20 $
+ * last change: $Author: abi $ $Date: 2002-06-24 15:17:55 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -74,6 +74,9 @@
#ifndef _FTP_FTPLOADERTHREAD_HXX_
#include "ftploaderthread.hxx"
#endif
+#ifndef _FTP_FTPINPSTR_HXX_
+#include "ftpinpstr.hxx"
+#endif
#ifndef __CURL_CURL_H
#include <curl/curl.h>
#endif
@@ -200,9 +203,21 @@ void SAL_CALL FtpContent::abort( sal_Int32 CommandId )
}
-struct XOutputStreamContainer
+struct StreamContainer
{
- Reference<XOutputStream> stream;
+ Reference<XOutputStream> m_out;
+
+ StreamContainer(const Reference<XOutputStream>& out)
+ : m_out(out) { }
+};
+
+
+struct FtpBufferContainer
+{
+ FtpInputStream *m_out;
+
+ FtpBufferContainer(FtpInputStream* out)
+ : m_out(out) { }
};
@@ -210,25 +225,37 @@ struct XOutputStreamContainer
extern "C" {
#endif
- /** Callback for curl_easy_perform();
+ int write2InputStream(void *buffer,size_t size,size_t nmemb,void *stream)
+ {
+ size_t ret = size*nmemb;
+ if(!stream || !ret) // OK, no error if nothing can be written.
+ return ret;
+
+ FtpBufferContainer *p = reinterpret_cast<FtpBufferContainer*>(stream);
+ if(p && p->m_out)
+ p->m_out->append(buffer,ret);
+ return ret;
+ }
+
+
+ /** Callback for curl_easy_perform(),
+ * forwarding the written content to the outputstream.
*/
int write2OutputStream(void *buffer,size_t size,size_t nmemb,void *stream)
{
size_t ret = size*nmemb;
- if(!stream) // OK, no error if nothing can be written.
+ if(!stream || !ret) // OK, no error if nothing can be written.
return ret;
- XOutputStreamContainer *p = static_cast<XOutputStreamContainer*>(stream);
- Sequence<sal_Int8> seq(static_cast<sal_Int8*>(buffer),size*nmemb);
try{
- if(p && p->stream.is())
- p->stream->writeBytes(seq);
+ StreamContainer *p = reinterpret_cast<StreamContainer*>(stream);
+ if(p && p->m_out.is())
+ p->m_out->writeBytes(Sequence<sal_Int8>(static_cast<sal_Int8*>(buffer),
+ size*nmemb));
return ret;
- }
- catch(const Exception&)
- {
+ } catch(const Exception&) {
return 0;
}
}
@@ -248,11 +275,9 @@ Any SAL_CALL FtpContent::execute( const Command& aCommand,
Any aRet;
- if ( aCommand.Name.compareToAscii( "getPropertyValues" ) == 0 )
- {
+ if( aCommand.Name.compareToAscii( "getPropertyValues" ) == 0 ) {
}
- else if ( aCommand.Name.compareToAscii( "open" ) == 0 )
- {
+ else if ( aCommand.Name.compareToAscii( "open" ) == 0 ) {
OpenCommandArgument2 aOpenCommand;
if ( !( aCommand.Argument >>= aOpenCommand ) )
throw IllegalArgumentException();
@@ -269,30 +294,24 @@ Any SAL_CALL FtpContent::execute( const Command& aCommand,
rtl::OUString aOUStr(m_xIdentifier->getContentIdentifier());
rtl::OString aOStr(aOUStr.getStr(),
aOUStr.getLength(),
- RTL_TEXTENCODING_UTF8); // Only ASCII in URLs -> UTF8
+ RTL_TEXTENCODING_UTF8); // Only ASCII in URLs => UTF8 ok
curl_easy_setopt(curl,CURLOPT_URL,aOStr.getStr());
Reference<XActiveDataSink> activeDataSink(aOpenCommand.Sink,UNO_QUERY);
- if(activeDataSink.is())
- throw UnsupportedDataSinkException();;
+ if(activeDataSink.is()) {
+ FtpBufferContainer cont(new FtpInputStream());
+ curl_easy_setopt(curl,CURLOPT_WRITEFUNCTION,write2InputStream);
+ curl_easy_setopt(curl,CURLOPT_WRITEDATA,&cont);
+ curl_easy_perform(curl);
+ activeDataSink->setInputStream(cont.m_out);
+ }
Reference< XOutputStream > xOutputStream(aOpenCommand.Sink,UNO_QUERY);
- if(xOutputStream.is())
- {
- XOutputStreamContainer container;
- container.stream = xOutputStream;
- struct curl_slist *list = curl_slist_append(NULL,"pwd");
- curl_easy_setopt(curl,CURLOPT_QUOTE,list);
- CURLcode code;
-
- code = curl_easy_setopt(curl,CURLOPT_WRITEFUNCTION,write2OutputStream);
- curl_easy_setopt(curl,CURLOPT_WRITEDATA,&container);
-
- code = curl_easy_setopt(curl,CURLOPT_HEADERFUNCTION,write2OutputStream);
- curl_easy_setopt(curl,CURLOPT_WRITEHEADER,&container);
-
+ if(xOutputStream.is()) {
+ StreamContainer cont(xOutputStream);
+ curl_easy_setopt(curl,CURLOPT_WRITEFUNCTION,write2OutputStream);
+ curl_easy_setopt(curl,CURLOPT_WRITEDATA,&cont);
curl_easy_perform(curl);
- curl_slist_free_all(list);
}
}
else
@@ -302,6 +321,12 @@ Any SAL_CALL FtpContent::execute( const Command& aCommand,
}
+// curl_easy_setopt(curl,CURLOPT_HEADERFUNCTION,write2OutputStream);
+// curl_easy_setopt(curl,CURLOPT_WRITEHEADER,&cont);
+
+
+// curl_slist_free_all(list);
+
Sequence<Property> FtpContent::getProperties(const Reference<XCommandEnvironment>& xEnv)
{
diff --git a/ucb/source/ucp/ftp/ftpinpstr.cxx b/ucb/source/ucp/ftp/ftpinpstr.cxx
new file mode 100644
index 000000000000..24b91bec3649
--- /dev/null
+++ b/ucb/source/ucp/ftp/ftpinpstr.cxx
@@ -0,0 +1,227 @@
+/*************************************************************************
+ *
+ * $RCSfile: ftpinpstr.cxx,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: abi $ $Date: 2002-06-24 15:17:55 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+/**************************************************************************
+ TODO
+ **************************************************************************
+
+ *************************************************************************/
+
+#ifndef _FTP_FTPINPSTR_HXX_
+#include "ftpinpstr.hxx"
+#endif
+#ifndef _RTL_ALLOC_H
+#include <rtl/alloc.h>
+#endif
+#ifndef STD_ALGORITHM
+#include <algorithm>
+#define STD_ALGORITHM
+#endif
+
+using namespace ftp;
+using namespace com::sun::star::uno;
+using namespace com::sun::star::lang;
+using namespace com::sun::star::io;
+
+
+
+FtpInputStream::FtpInputStream()
+ : m_nLen(0),
+ m_nWritePos(0),
+ m_nReadPos(0),
+ m_pBuffer(NULL) { }
+
+
+FtpInputStream::~FtpInputStream() {
+ rtl_freeMemory(m_pBuffer);
+}
+
+
+Any SAL_CALL FtpInputStream::queryInterface( const Type& rType ) throw( RuntimeException ) {
+ Any aRet = ::cppu::queryInterface(rType,
+ SAL_STATIC_CAST( XInputStream*,this ),
+ SAL_STATIC_CAST( XSeekable*,this ) );
+
+ return aRet.hasValue() ? aRet : OWeakObject::queryInterface( rType );
+}
+
+
+
+void SAL_CALL FtpInputStream::acquire( void ) throw() {
+ OWeakObject::acquire();
+}
+
+
+
+void SAL_CALL FtpInputStream::release( void ) throw() {
+ OWeakObject::release();
+}
+
+
+
+sal_Int32 SAL_CALL FtpInputStream::readBytes(Sequence< sal_Int8 >& aData,
+ sal_Int32 nBytesToRead)
+ throw(NotConnectedException,
+ BufferSizeExceededException,
+ IOException,
+ RuntimeException) {
+ osl::MutexGuard aGuard( m_aMutex );
+
+ sal_Int32 curr(std::min(nBytesToRead,sal_Int32(m_nWritePos)-sal_Int32(m_nReadPos)));
+
+ if(0 <= curr && aData.getLength() < curr)
+ aData.realloc(curr);
+
+ for(sal_Int32 k = 0; k < curr; ++k )
+ aData[k] = static_cast<sal_Int8*>(m_pBuffer)[m_nReadPos+k];
+
+ m_nReadPos += curr;
+ return curr > 0 ? curr : 0;
+}
+
+
+sal_Int32 SAL_CALL FtpInputStream::readSomeBytes( Sequence< sal_Int8 >& aData,sal_Int32 nMaxBytesToRead )
+ throw( NotConnectedException,
+ BufferSizeExceededException,
+ IOException,
+ RuntimeException)
+{
+ return readBytes(aData,nMaxBytesToRead);
+}
+
+
+
+void SAL_CALL FtpInputStream::skipBytes(sal_Int32 nBytesToSkip)
+ throw(NotConnectedException,
+ BufferSizeExceededException,
+ IOException,
+ RuntimeException) {
+ osl::MutexGuard aGuard( m_aMutex );
+ if(nBytesToSkip < 0)
+ throw IOException();
+ m_nReadPos += nBytesToSkip;
+ if(m_nReadPos > m_nWritePos) // Can't skip behind the end of the current write-position.
+ m_nReadPos = m_nWritePos;
+}
+
+
+
+sal_Int32 SAL_CALL FtpInputStream::available(void)
+ throw(NotConnectedException,
+ IOException,
+ RuntimeException) {
+ osl::MutexGuard aGuard( m_aMutex );
+ return std::max(sal_Int32(m_nWritePos)-sal_Int32(m_nReadPos),sal_Int32(0));
+}
+
+
+
+void SAL_CALL FtpInputStream::closeInput(void)
+ throw(NotConnectedException,
+ IOException,
+ RuntimeException) {
+}
+
+
+
+void SAL_CALL FtpInputStream::seek(sal_Int64 location)
+ throw( IllegalArgumentException,
+ IOException,
+ RuntimeException ) {
+ osl::MutexGuard aGuard( m_aMutex );
+ if(location < 0)
+ throw IllegalArgumentException();
+
+ m_nReadPos = sal_uInt32(location);
+ if(m_nReadPos > m_nWritePos) // Can't seek behind the end of the current write-position.
+ m_nReadPos = m_nWritePos;
+}
+
+
+
+sal_Int64 SAL_CALL FtpInputStream::getPosition( void ) throw( IOException,
+ RuntimeException ) {
+ osl::MutexGuard aGuard( m_aMutex );
+ return sal_Int64(m_nReadPos);
+}
+
+
+
+sal_Int64 SAL_CALL FtpInputStream::getLength( void ) throw(
+ IOException,RuntimeException) {
+ osl::MutexGuard aGuard( m_aMutex );
+ return sal_Int64(m_nWritePos);
+}
+
+
+void FtpInputStream::append(const void* pBuffer,sal_uInt32 nLen) throw() {
+ osl::MutexGuard aGuard( m_aMutex );
+ sal_uInt32 tmp(nLen + m_nWritePos);
+ if(m_nLen < tmp) { // enlarge in steps of multiples of 1K
+ do {
+ m_nLen+=1024;
+ } while(m_nLen < tmp);
+ m_pBuffer = rtl_reallocateMemory(m_pBuffer,m_nLen);
+ }
+
+ rtl_copyMemory(static_cast<sal_Int8*>(m_pBuffer)+m_nWritePos,pBuffer,nLen);
+ m_nWritePos = tmp;
+}
diff --git a/ucb/source/ucp/ftp/ftpinpstr.hxx b/ucb/source/ucp/ftp/ftpinpstr.hxx
new file mode 100644
index 000000000000..7111bde54f61
--- /dev/null
+++ b/ucb/source/ucp/ftp/ftpinpstr.hxx
@@ -0,0 +1,186 @@
+/*************************************************************************
+ *
+ * $RCSfile: ftpinpstr.hxx,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: abi $ $Date: 2002-06-24 15:17:55 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+/**************************************************************************
+ TODO
+ **************************************************************************
+
+ *************************************************************************/
+
+#ifndef _FTP_FTPINPSTR_HXX_
+#define _FTP_FTPINPSTR_HXX_
+
+#ifndef _CPPUHELPER_WEAK_HXX_
+#include <cppuhelper/weak.hxx>
+#endif
+#ifndef _CPPUHELPER_QUERYINTERFACE_HXX_
+#include <cppuhelper/queryinterface.hxx>
+#endif
+#ifndef _COM_SUN_STAR_IO_XINPUTSTREAM_HPP_
+#include <com/sun/star/io/XInputStream.hpp>
+#endif
+#ifndef _COM_SUN_STAR_IO_XSEEKABLE_HPP_
+#include <com/sun/star/io/XSeekable.hpp>
+#endif
+
+namespace ftp {
+
+
+ /** Implements a seekable InputStream
+ * working on a buffer.
+ */
+
+ namespace css = com::sun::star;
+
+
+ class FtpInputStream
+ : public cppu::OWeakObject,
+ public com::sun::star::io::XInputStream,
+ public com::sun::star::io::XSeekable
+ {
+ public:
+
+ FtpInputStream();
+
+ ~FtpInputStream();
+
+ virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type& rType)
+ throw(css::uno::RuntimeException);
+
+ virtual void SAL_CALL acquire(void) throw();
+
+ virtual void SAL_CALL release(void) throw();
+
+ virtual sal_Int32 SAL_CALL
+ readBytes(css::uno::Sequence< sal_Int8 >& aData,
+ sal_Int32 nBytesToRead)
+ throw( css::io::NotConnectedException,
+ css::io::BufferSizeExceededException,
+ css::io::IOException,
+ css::uno::RuntimeException);
+
+ virtual sal_Int32 SAL_CALL
+ readSomeBytes(css::uno::Sequence< sal_Int8 >& aData,
+ sal_Int32 nMaxBytesToRead )
+ throw( css::io::NotConnectedException,
+ css::io::BufferSizeExceededException,
+ css::io::IOException,
+ css::uno::RuntimeException);
+
+ virtual void SAL_CALL
+ skipBytes(sal_Int32 nBytesToSkip)
+ throw(css::io::NotConnectedException,
+ css::io::BufferSizeExceededException,
+ css::io::IOException,
+ css::uno::RuntimeException );
+
+ virtual sal_Int32 SAL_CALL
+ available(void)
+ throw(css::io::NotConnectedException,
+ css::io::IOException,
+ css::uno::RuntimeException );
+
+ virtual void SAL_CALL
+ closeInput(void)
+ throw(css::io::NotConnectedException,
+ css::io::IOException,
+ css::uno::RuntimeException);
+
+
+ /** XSeekable
+ */
+
+ virtual void SAL_CALL
+ seek(sal_Int64 location)
+ throw(css::lang::IllegalArgumentException,
+ css::io::IOException,
+ css::uno::RuntimeException);
+
+
+ virtual sal_Int64 SAL_CALL
+ getPosition(void)
+ throw(css::io::IOException,
+ css::uno::RuntimeException);
+
+
+ virtual sal_Int64 SAL_CALL
+ getLength(void)
+ throw(css::io::IOException,
+ css::uno::RuntimeException);
+
+
+ /** appends the content of *pBuffer.
+ */
+
+ void append(const void* pBuffer,sal_uInt32 nLen) throw();
+
+ private:
+
+ osl::Mutex m_aMutex;
+
+ sal_uInt32 m_nLen,m_nWritePos,m_nReadPos;
+ void* m_pBuffer;
+ };
+
+
+}
+
+#endif
diff --git a/ucb/source/ucp/ftp/ftploaderthread.cxx b/ucb/source/ucp/ftp/ftploaderthread.cxx
index fb97f893efb4..764ed1233875 100644
--- a/ucb/source/ucp/ftp/ftploaderthread.cxx
+++ b/ucb/source/ucp/ftp/ftploaderthread.cxx
@@ -1,3 +1,70 @@
+/*************************************************************************
+ *
+ * $RCSfile: ftploaderthread.cxx,v $
+ *
+ * $Revision: 1.3 $
+ *
+ * last change: $Author: abi $ $Date: 2002-06-24 15:17:55 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+/**************************************************************************
+ TODO
+ **************************************************************************
+
+ *************************************************************************/
+
#ifndef _FTP_FTPLOADERTHREAD_HXX_
#include "ftploaderthread.hxx"
#endif
diff --git a/ucb/source/ucp/ftp/ftploaderthread.hxx b/ucb/source/ucp/ftp/ftploaderthread.hxx
index 464c31fd2a35..d873d63218fc 100644
--- a/ucb/source/ucp/ftp/ftploaderthread.hxx
+++ b/ucb/source/ucp/ftp/ftploaderthread.hxx
@@ -1,3 +1,70 @@
+/*************************************************************************
+ *
+ * $RCSfile: ftploaderthread.hxx,v $
+ *
+ * $Revision: 1.3 $
+ *
+ * last change: $Author: abi $ $Date: 2002-06-24 15:17:55 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+/**************************************************************************
+ TODO
+ **************************************************************************
+
+ *************************************************************************/
+
#ifndef _FTP_FTPLOADERTHREAD_HXX_
#define _FTP_FTPLOADERTHREAD_HXX_
diff --git a/ucb/source/ucp/ftp/makefile.mk b/ucb/source/ucp/ftp/makefile.mk
index fd190e40b7a9..aa6c5302ce56 100644
--- a/ucb/source/ucp/ftp/makefile.mk
+++ b/ucb/source/ucp/ftp/makefile.mk
@@ -2,9 +2,9 @@
#
# $RCSfile: makefile.mk,v $
#
-# $Revision: 1.1 $
+# $Revision: 1.2 $
#
-# last change: $Author: abi $ $Date: 2002-06-07 15:31:00 $
+# last change: $Author: abi $ $Date: 2002-06-24 15:17:55 $
#
# The Contents of this file are made available subject to the terms of
# either of the following licenses
@@ -80,7 +80,8 @@ SLOFILES=\
$(SLO)$/ftpservices.obj \
$(SLO)$/ftpcontentprovider.obj \
$(SLO)$/ftpcontent.obj \
- $(SLO)$/ftploaderthread.obj
+ $(SLO)$/ftploaderthread.obj \
+ $(SLO)$/ftpinpstr.obj
LIB1TARGET=$(SLB)$/_$(TARGET).lib
LIB1OBJFILES=$(SLOFILES)
@@ -106,6 +107,28 @@ SHL1LIBS= \
$(LIB1TARGET) \
$(SOLARLIBDIR)$/libcurl.lib
+
+APP1TARGET=ftptest
+APP1OBJS=\
+ $(OBJ)$/test.obj
+
+.IF "$(COMPHELPERLIB)"==""
+.IF "$(GUI)" == "UNX"
+COMPHELPERLIB=-licomphelp2
+.ENDIF # unx
+.IF "$(GUI)"=="WNT"
+COMPHELPERLIB=icomphelp2.lib
+.ENDIF # wnt
+.ENDIF
+
+APP1STDLIBS=\
+ $(CPPULIB) \
+ $(CPPUHELPERLIB) \
+ $(SALLIB) \
+ $(COMPHELPERLIB)
+
+APP1DEF= $(MISC)\$(APP1TARGET).def
+
# Make symbol renaming match library name for Mac OS X
.IF "$(OS)"=="MACOSX"
SYMBOLPREFIX=$(TARGET)$(UCPFTP_MAJOR)
diff --git a/ucb/source/ucp/ftp/test.cxx b/ucb/source/ucp/ftp/test.cxx
new file mode 100644
index 000000000000..a77fba834c4a
--- /dev/null
+++ b/ucb/source/ucp/ftp/test.cxx
@@ -0,0 +1,158 @@
+/*************************************************************************
+ *
+ * $RCSfile: test.cxx,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: abi $ $Date: 2002-06-24 15:17:55 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+/**************************************************************************
+ TODO
+ **************************************************************************
+
+ *************************************************************************/
+
+#ifndef _OSL_PROCESS_H_
+#include <osl/process.h>
+#endif
+#ifndef _OSL_FILE_HXX_
+#include <osl/file.hxx>
+#endif
+#ifndef _RTL_BOOTSTRAP_HXX_
+#include <rtl/bootstrap.hxx>
+#endif
+#ifndef _RTL_USTRING_HXX_
+#include <rtl/ustring.hxx>
+#endif
+#ifndef _CPPUHELPER_SERVICEFACTORY_HXX_
+#include <cppuhelper/servicefactory.hxx>
+#endif
+#ifndef _COMPHELPER_PROCESSFACTORY_HXX_
+#include <comphelper/processfactory.hxx>
+#endif
+#ifndef _COMPHELPER_REGPATHHELPER_HXX_
+#include <comphelper/regpathhelper.hxx>
+#endif
+#ifndef _COM_SUN_STAR_LANG_XCOMPONENT_HPP_
+#include <com/sun/star/lang/XComponent.hpp>
+#endif
+#ifndef _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP_
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#endif
+
+
+using namespace rtl;
+using namespace com::sun::star::uno;
+using namespace com::sun::star::lang;
+
+
+int main(int argc,char* argv[])
+{
+ Reference< XMultiServiceFactory > xFac;
+ Reference< XComponent > xComponent;
+
+ try
+ {
+ OUString workDir;
+ osl_getProcessWorkingDir(&workDir.pData);
+ OUString dir;
+ osl::FileBase::getSystemPathFromFileURL(workDir,
+ dir);
+ OString oDir(dir.getStr(),
+ dir.getLength(),
+ RTL_TEXTENCODING_UTF8);
+ fprintf(stdout,"\nworking directory: %s",oDir.getStr());
+
+ OUString systemRegistryPath;
+ Bootstrap::get(OUString::createFromAscii("SystemRegistryPath"),
+ systemRegistryPath,
+ comphelper::getPathToSystemRegistry());
+ OString path(systemRegistryPath.getStr(),
+ systemRegistryPath.getLength(),
+ RTL_TEXTENCODING_UTF8);
+ fprintf(stdout,"\nsystem registry path: %s\n",path.getStr());
+
+ xFac = cppu::createRegistryServiceFactory( systemRegistryPath,
+ OUString(),
+ true);
+ if(!xFac.is())
+ {
+ fprintf(stderr,"\ncould not create ServiceFactory");
+ return 1;
+ }
+
+ comphelper::setProcessServiceFactory(xFac);
+ xComponent = Reference< XComponent >(xFac,UNO_QUERY);
+ if(!xComponent.is())
+ {
+ fprintf(stderr,"\nERROR: could not set processServiceFactory");
+ fprintf(stderr,"\nERROR: P0-bug to ABI\n");
+ return 1;
+ }
+
+ int anyerr = 0;
+
+ xComponent->dispose();
+ return anyerr;
+ }
+ catch ( const Exception& e)
+ {
+ fprintf(stderr,"\nERROR: any other error");
+ fprintf(stderr,"\nERROR: P0-bug to ABI\n");
+ return 1;
+ }
+ return 0;
+}