Kaydet (Commit) cc506f01 authored tarafından Andreas Bille's avatar Andreas Bille

#104432# Changed to proxyconfig helper class

üst 7c6b58e4
...@@ -2,9 +2,9 @@ ...@@ -2,9 +2,9 @@
* *
* $RCSfile: ftpcontent.cxx,v $ * $RCSfile: ftpcontent.cxx,v $
* *
* $Revision: 1.16 $ * $Revision: 1.17 $
* *
* last change: $Author: abi $ $Date: 2002-10-25 08:53:17 $ * last change: $Author: abi $ $Date: 2002-10-29 12:43:13 $
* *
* The Contents of this file are made available subject to the terms of * The Contents of this file are made available subject to the terms of
* either of the following licenses * either of the following licenses
...@@ -317,6 +317,7 @@ enum ACTION { NOACTION, ...@@ -317,6 +317,7 @@ enum ACTION { NOACTION,
THROWINTERACTIVECONNECT, THROWINTERACTIVECONNECT,
THROWRESOLVENAME, THROWRESOLVENAME,
THROWQUOTE, THROWQUOTE,
THROWNOFILE,
THROWGENERAL }; THROWGENERAL };
...@@ -428,6 +429,19 @@ Any SAL_CALL FTPContent::execute( ...@@ -428,6 +429,19 @@ Any SAL_CALL FTPContent::execute(
ucbhelper::cancelCommandExecution( ucbhelper::cancelCommandExecution(
aRet, aRet,
Environment); Environment);
} else if(action == THROWNOFILE) {
Sequence<Any> seq(1);
PropertyValue value;
value.Name =
rtl::OUString::createFromAscii("Uri");
value.Handle = -1;
value.Value <<= m_aFTPURL.ident(false,false);
value.State = PropertyState_DIRECT_VALUE;
seq[0] <<= value;
ucbhelper::cancelCommandExecution(
IOErrorCode_NO_FILE,
seq,
Environment);
} else if(action == THROWQUOTE || } else if(action == THROWQUOTE ||
action == THROWGENERAL) { action == THROWGENERAL) {
ucbhelper::cancelCommandExecution( ucbhelper::cancelCommandExecution(
...@@ -580,6 +594,8 @@ Any SAL_CALL FTPContent::execute( ...@@ -580,6 +594,8 @@ Any SAL_CALL FTPContent::execute(
action = THROWACCESSDENIED; action = THROWACCESSDENIED;
else if(e.code() == CURLE_FTP_QUOTE_ERROR) else if(e.code() == CURLE_FTP_QUOTE_ERROR)
action = THROWQUOTE; action = THROWQUOTE;
else if(e.code() == CURLE_FTP_COULDNT_RETR_FILE)
action = THROWNOFILE;
else else
// nothing known about the course of the error // nothing known about the course of the error
action = THROWGENERAL; action = THROWGENERAL;
...@@ -647,7 +663,7 @@ FTPContent::getParent( ) ...@@ -647,7 +663,7 @@ FTPContent::getParent( )
throw (RuntimeException) throw (RuntimeException)
{ {
Reference<XContentIdentifier> Reference<XContentIdentifier>
xIdent(new FTPContentIdentifier(m_aFTPURL.parent(),m_pFCP)); xIdent(new FTPContentIdentifier(m_aFTPURL.parent(false)));
Reference<XContent> xContent(m_xProvider->queryContent(xIdent)); Reference<XContent> xContent(m_xProvider->queryContent(xIdent));
return Reference<XInterface>(xContent,UNO_QUERY); return Reference<XInterface>(xContent,UNO_QUERY);
} }
...@@ -861,7 +877,11 @@ Sequence<Any> FTPContent::setPropertyValues( ...@@ -861,7 +877,11 @@ Sequence<Any> FTPContent::setPropertyValues(
} }
} }
if(evt.getLength()) if(evt.getLength()) {
// title has changed
notifyPropertiesChange(evt); notifyPropertiesChange(evt);
exchange(new FTPContentIdentifier(m_aFTPURL.ident(false,false)));
}
return ret; return ret;
} }
...@@ -2,9 +2,9 @@ ...@@ -2,9 +2,9 @@
* *
* $RCSfile: ftpcontentidentifier.cxx,v $ * $RCSfile: ftpcontentidentifier.cxx,v $
* *
* $Revision: 1.5 $ * $Revision: 1.6 $
* *
* last change: $Author: abi $ $Date: 2002-10-15 09:21:16 $ * last change: $Author: abi $ $Date: 2002-10-29 12:43:13 $
* *
* The Contents of this file are made available subject to the terms of * The Contents of this file are made available subject to the terms of
* either of the following licenses * either of the following licenses
...@@ -70,13 +70,13 @@ ...@@ -70,13 +70,13 @@
using namespace ftp; using namespace ftp;
using namespace com::sun::star::uno; using namespace com::sun::star::uno;
using namespace com::sun::star::ucb; using namespace com::sun::star::ucb;
using namespace com::sun::star::lang;
FTPContentIdentifier::FTPContentIdentifier( FTPContentIdentifier::FTPContentIdentifier(
const rtl::OUString& aIdent, const rtl::OUString& ident
FTPContentProvider* pFCP
) )
: m_pURL(aIdent,pFCP) : m_ident(ident)
{ {
} }
...@@ -96,40 +96,79 @@ FTPContentIdentifier::queryInterface( ...@@ -96,40 +96,79 @@ FTPContentIdentifier::queryInterface(
{ {
Any aRet = Any aRet =
::cppu::queryInterface(rType, ::cppu::queryInterface(rType,
SAL_STATIC_CAST(XTypeProvider*,this),
SAL_STATIC_CAST(XContentIdentifier*,this)); SAL_STATIC_CAST(XContentIdentifier*,this));
return aRet.hasValue() ? aRet : OWeakObject::queryInterface( rType ); return aRet.hasValue() ? aRet : OWeakObject::queryInterface( rType );
} }
void SAL_CALL FTPContentIdentifier::acquire( void ) throw() { void SAL_CALL FTPContentIdentifier::acquire( void ) throw() {
OWeakObject::acquire(); OWeakObject::acquire();
} }
void SAL_CALL FTPContentIdentifier::release( void ) throw() { void SAL_CALL FTPContentIdentifier::release( void ) throw() {
OWeakObject::release(); OWeakObject::release();
} }
::rtl::OUString SAL_CALL Sequence<sal_Int8> SAL_CALL
FTPContentIdentifier::getImplementationId()
throw(RuntimeException)
{
static cppu::OImplementationId* pId = NULL;
if(!pId)
{
osl::Guard< osl::Mutex > aGuard( osl::Mutex::getGlobalMutex() );
if ( !pId )
{
static cppu::OImplementationId id( sal_False );
pId = &id;
}
}
return (*pId).getImplementationId();
}
Sequence<Type> SAL_CALL
FTPContentIdentifier::getTypes(
void )
throw(RuntimeException)
{
static cppu::OTypeCollection* pCollection = NULL;
if ( !pCollection ) {
osl::Guard< osl::Mutex > aGuard( osl::Mutex::getGlobalMutex() );
if ( !pCollection )
{
static cppu::OTypeCollection collection(
getCppuType(
static_cast<Reference<XTypeProvider>*>(0)),
getCppuType(
static_cast<Reference<XContentIdentifier>*>(0)));
pCollection = &collection;
}
}
return (*pCollection).getTypes();
}
rtl::OUString SAL_CALL
FTPContentIdentifier::getContentIdentifier( FTPContentIdentifier::getContentIdentifier(
) )
throw ( throw (
::com::sun::star::uno::RuntimeException com::sun::star::uno::RuntimeException
) )
{ {
return m_pURL.ident(false,false); return m_ident;
} }
::rtl::OUString SAL_CALL rtl::OUString SAL_CALL
FTPContentIdentifier::getContentProviderScheme( FTPContentIdentifier::getContentProviderScheme(
) )
throw ( throw (
::com::sun::star::uno::RuntimeException com::sun::star::uno::RuntimeException
) )
{ {
return rtl::OUString::createFromAscii("ftp"); return rtl::OUString::createFromAscii("ftp");
......
...@@ -2,9 +2,9 @@ ...@@ -2,9 +2,9 @@
* *
* $RCSfile: ftpcontentidentifier.hxx,v $ * $RCSfile: ftpcontentidentifier.hxx,v $
* *
* $Revision: 1.4 $ * $Revision: 1.5 $
* *
* last change: $Author: abi $ $Date: 2002-10-15 09:21:16 $ * last change: $Author: abi $ $Date: 2002-10-29 12:43:13 $
* *
* The Contents of this file are made available subject to the terms of * The Contents of this file are made available subject to the terms of
* either of the following licenses * either of the following licenses
...@@ -73,12 +73,12 @@ ...@@ -73,12 +73,12 @@
#include <cppuhelper/weak.hxx> #include <cppuhelper/weak.hxx>
#include <cppuhelper/queryinterface.hxx> #include <cppuhelper/queryinterface.hxx>
#include <com/sun/star/ucb/XContentIdentifier.hpp> #include <com/sun/star/ucb/XContentIdentifier.hpp>
#include <com/sun/star/io/XOutputStream.hpp> #include <com/sun/star/lang/XTypeProvider.hpp>
#include "ftpdirp.hxx" #include "ftpdirp.hxx"
#include "ftpurl.hxx" #include "ftpurl.hxx"
namespace ftp { namespace ftp {
...@@ -87,12 +87,12 @@ namespace ftp { ...@@ -87,12 +87,12 @@ namespace ftp {
class FTPContentIdentifier class FTPContentIdentifier
: public cppu::OWeakObject, : public cppu::OWeakObject,
public com::sun::star::lang::XTypeProvider,
public com::sun::star::ucb::XContentIdentifier public com::sun::star::ucb::XContentIdentifier
{ {
public: public:
FTPContentIdentifier(const rtl::OUString& ident, FTPContentIdentifier(const rtl::OUString& ident);
FTPContentProvider* pFCP = 0);
~FTPContentIdentifier(); ~FTPContentIdentifier();
...@@ -106,6 +106,23 @@ namespace ftp { ...@@ -106,6 +106,23 @@ namespace ftp {
virtual void SAL_CALL release( void ) throw(); virtual void SAL_CALL release( void ) throw();
// XTypeProvider
virtual
com::sun::star::uno::Sequence<com::sun::star::uno::Type> SAL_CALL
getTypes(
)
throw(
com::sun::star::uno::RuntimeException
);
virtual com::sun::star::uno::Sequence<sal_Int8> SAL_CALL
getImplementationId(
)
throw(
com::sun::star::uno::RuntimeException
);
// XContentIdentifier // XContentIdentifier
...@@ -113,7 +130,7 @@ namespace ftp { ...@@ -113,7 +130,7 @@ namespace ftp {
getContentIdentifier( getContentIdentifier(
) )
throw ( throw (
::com::sun::star::uno::RuntimeException com::sun::star::uno::RuntimeException
); );
virtual ::rtl::OUString SAL_CALL virtual ::rtl::OUString SAL_CALL
...@@ -126,7 +143,7 @@ namespace ftp { ...@@ -126,7 +143,7 @@ namespace ftp {
private: private:
FTPURL m_pURL; rtl::OUString m_ident;
}; };
} }
......
...@@ -2,9 +2,9 @@ ...@@ -2,9 +2,9 @@
* *
* $RCSfile: ftpcontentprovider.cxx,v $ * $RCSfile: ftpcontentprovider.cxx,v $
* *
* $Revision: 1.7 $ * $Revision: 1.8 $
* *
* last change: $Author: abi $ $Date: 2002-10-23 08:00:05 $ * last change: $Author: abi $ $Date: 2002-10-29 12:43:13 $
* *
* The Contents of this file are made available subject to the terms of * The Contents of this file are made available subject to the terms of
* either of the following licenses * either of the following licenses
...@@ -93,7 +93,8 @@ using namespace com::sun::star::beans; ...@@ -93,7 +93,8 @@ using namespace com::sun::star::beans;
FTPContentProvider::FTPContentProvider(const Reference< XMultiServiceFactory >& rSMgr) FTPContentProvider::FTPContentProvider(const Reference< XMultiServiceFactory >& rSMgr)
: ::ucb::ContentProviderImplHelper(rSMgr), : ::ucb::ContentProviderImplHelper(rSMgr),
m_ftpLoaderThread(NULL) m_ftpLoaderThread(0),
m_pProxyDecider(0)
{ {
} }
...@@ -102,6 +103,7 @@ FTPContentProvider::FTPContentProvider(const Reference< XMultiServiceFactory >& ...@@ -102,6 +103,7 @@ FTPContentProvider::FTPContentProvider(const Reference< XMultiServiceFactory >&
FTPContentProvider::~FTPContentProvider() FTPContentProvider::~FTPContentProvider()
{ {
delete m_ftpLoaderThread; delete m_ftpLoaderThread;
delete m_pProxyDecider;
} }
//========================================================================= //=========================================================================
...@@ -110,13 +112,10 @@ FTPContentProvider::~FTPContentProvider() ...@@ -110,13 +112,10 @@ FTPContentProvider::~FTPContentProvider()
// //
//========================================================================= //=========================================================================
XINTERFACE_IMPL_6(FTPContentProvider, XINTERFACE_IMPL_3(FTPContentProvider,
XTypeProvider, XTypeProvider,
XServiceInfo, XServiceInfo,
XContentProvider, XContentProvider)
XComponent,
XEventListener,
XContainerListener);
//========================================================================= //=========================================================================
// //
...@@ -124,13 +123,10 @@ XINTERFACE_IMPL_6(FTPContentProvider, ...@@ -124,13 +123,10 @@ XINTERFACE_IMPL_6(FTPContentProvider,
// //
//========================================================================= //=========================================================================
XTYPEPROVIDER_IMPL_6(FTPContentProvider, XTYPEPROVIDER_IMPL_3(FTPContentProvider,
XTypeProvider, XTypeProvider,
XServiceInfo, XServiceInfo,
XContentProvider, XContentProvider)
XComponent,
XEventListener,
XContainerListener);
//========================================================================= //=========================================================================
// //
...@@ -177,10 +173,15 @@ FTPContentProvider::queryContent( ...@@ -177,10 +173,15 @@ FTPContentProvider::queryContent(
{ {
// Initialize // Initialize
osl::MutexGuard aGuard( m_aMutex ); osl::MutexGuard aGuard( m_aMutex );
if(!m_ftpLoaderThread) if(!m_ftpLoaderThread || !m_pProxyDecider)
{ {
try {
init(); init();
if(!m_ftpLoaderThread) } catch( ... ) {
throw RuntimeException();
}
if(!m_ftpLoaderThread || !m_pProxyDecider)
throw RuntimeException(); throw RuntimeException();
} }
} }
...@@ -188,7 +189,11 @@ FTPContentProvider::queryContent( ...@@ -188,7 +189,11 @@ FTPContentProvider::queryContent(
try { try {
FTPURL aURL(xCanonicId->getContentIdentifier(), FTPURL aURL(xCanonicId->getContentIdentifier(),
this); this);
if(!ShouldUseFtpProxy(aURL))
if(!m_pProxyDecider->shouldUseProxy(
rtl::OUString::createFromAscii("ftp"),
aURL.host(),
aURL.port().toInt32()))
xContent = new FTPContent(m_xSMgr,this,xCanonicId,aURL); xContent = new FTPContent(m_xSMgr,this,xCanonicId,aURL);
else { else {
Reference<XContentProvider> Reference<XContentProvider>
...@@ -208,134 +213,10 @@ FTPContentProvider::queryContent( ...@@ -208,134 +213,10 @@ FTPContentProvider::queryContent(
// from inetoptions
enum ProxyType { NONE, AUTOMATIC, MANUAL };
bool FTPContentProvider::ShouldUseFtpProxy(const FTPURL& aURL) const
{
// Check URL.
if(m_eType == NONE)
return false;
if(! m_aFtpProxy.getLength())
return false;
if(m_aNoProxyList.getLength())
{
// Setup Endpoint.
rtl::OUString host(aURL.host());
if(!host.getLength())
return false;
osl::SocketAddr aAddr(host,21); // port does not matter here
host = aAddr.getHostname().toAsciiLowerCase();
sal_Int32 port = aURL.port().toInt32();
// Match NoProxyList.
sal_Int32 nIndex = 0;
do {
rtl::OUString aDomain =
m_aNoProxyList.getToken(0,';',nIndex).toAsciiLowerCase();
rtl::OUString aPort;
sal_Int32 i(aDomain.indexOf(':',0));
if(i != -1) {
aPort = aDomain.copy(1+i);
aDomain = aDomain.copy(0,i).trim();
}
if(!aDomain.getLength())
continue;
if(host == aDomain)
if(aPort.getLength() == 0 || port == aPort.toInt32())
return false;
else
return true;
i = host.lastIndexOf(aDomain);
if(i!=-1 &&
// i == 0 not possible here anymore!
// really last part of string of the string?:
host.getLength() == i+aDomain.getLength() &&
// ensure not to match "xy.z" on "x.z" or ".x.z"
(aDomain.getStr()[0] == '.' || host.getStr()[i-1] == '.') &&
// does the port match?
(aPort.getLength() == 0 || port == aPort.toInt32()))
return false;
}
while ( nIndex != -1 );
}
return true;
}
void SAL_CALL
FTPContentProvider::elementReplaced(const ContainerEvent& Event)
throw(RuntimeException)
{
rtl::OUString accessor;
Event.Accessor >>= accessor;
if(accessor.compareToAscii("ooInetFTPProxyName") == 0) {
rtl::OUString replacedElement,element;
if((Event.ReplacedElement >>= replacedElement) &&
(Event.Element >>= element) )
{
osl::MutexGuard aGuard(m_aMutex);
m_aFtpProxy = element;
}
} else if(accessor.compareToAscii("ooInetNoProxy") == 0) {
rtl::OUString replacedElement,element;
if((Event.ReplacedElement >>= replacedElement) &&
(Event.Element >>= element))
{
osl::MutexGuard aGuard(m_aMutex);
m_aNoProxyList = element;
}
}
else if(accessor.compareToAscii("ooInetProxyType") == 0) {
sal_Int32 replacedElement,element;
if((Event.ReplacedElement >>= replacedElement) &&
(Event.Element >>= element))
{
osl::MutexGuard aGuard(m_aMutex);
m_eType = element;
}
}
}
void FTPContentProvider::init() { void FTPContentProvider::init() {
m_ftpLoaderThread = new FTPLoaderThread(); m_ftpLoaderThread = new FTPLoaderThread();
m_pProxyDecider = new ucbhelper::InternetProxyDecider(m_xSMgr);
Reference< XMultiServiceFactory > sProvider( getConfiguration());
Reference< XHierarchicalNameAccess > xHierAccess(
getHierAccess(sProvider,"org.openoffice.Inet"));
m_aFtpProxy = getKey(xHierAccess,
"Settings/ooInetFTPProxyName");
m_aNoProxyList = getKey(xHierAccess,
"Settings/ooInetNoProxy");
m_eType = getIntKey(xHierAccess,
"Settings/ooInetProxyType");
try
{
// add as configuration change listener for the proxy settings
Reference<XNameAccess> xAccess(xHierAccess,UNO_QUERY);
Any aAny =
xAccess->getByName(rtl::OUString::createFromAscii("Settings"));
aAny >>= m_xContainer;
if(m_xContainer.is())
m_xContainer->addContainerListener(this);
}
catch(const com::sun::star::uno::Exception& )
{
}
} }
...@@ -401,154 +282,28 @@ bool FTPContentProvider::setHost( ...@@ -401,154 +282,28 @@ bool FTPContentProvider::setHost(
} }
Reference<XMultiServiceFactory>
FTPContentProvider::getConfiguration() const
{
Reference< XMultiServiceFactory > sProvider;
if(m_xSMgr.is())
{
Any aAny;
aAny <<= rtl::OUString::createFromAscii( "plugin" );
PropertyValue aProp(
rtl::OUString::createFromAscii( "servertype" ),
-1,
aAny,
PropertyState_DIRECT_VALUE );
Sequence<Any> seq(1);
seq[0] <<= aProp;
try
{
rtl::OUString sProviderService =
rtl::OUString::createFromAscii(
"com.sun.star.configuration.ConfigurationProvider" );
sProvider =
Reference<XMultiServiceFactory>(
m_xSMgr->createInstanceWithArguments(
sProviderService,seq ),
UNO_QUERY );
}
catch( const com::sun::star::uno::Exception& )
{
OSL_ENSURE( sProvider.is(),"cant instantiate configuration" );
}
}
return sProvider;
}
Reference<XHierarchicalNameAccess>
FTPContentProvider::getHierAccess(
const Reference<XMultiServiceFactory >& sProvider,
const char* file ) const
{
Reference<XHierarchicalNameAccess>
xHierAccess;
if( sProvider.is() )
{
Sequence<Any> seq(1);
rtl::OUString sReaderService =
rtl::OUString::createFromAscii(
"com.sun.star.configuration.ConfigurationAccess" );
seq[0] <<= rtl::OUString::createFromAscii(file);
try
{
xHierAccess =
Reference<
XHierarchicalNameAccess >(
sProvider->createInstanceWithArguments(
sReaderService,seq ),
UNO_QUERY );
}
catch( const Exception& )
{
}
}
return xHierAccess;
}
rtl::OUString
FTPContentProvider::getKey(
const Reference<XHierarchicalNameAccess>& xHierAccess,
const char* key ) const
{
rtl::OUString val;
if( xHierAccess.is() )
{
Any aAny;
try
{
aAny =
xHierAccess->getByHierarchicalName(
rtl::OUString::createFromAscii(key));
}
catch( const NoSuchElementException& )
{
}
aAny >>= val;
}
return val;
}
sal_Int32
FTPContentProvider::getIntKey(
const Reference<XHierarchicalNameAccess>& xHierAccess,
const char* key ) const
{
sal_Int32 val = 0;
if( xHierAccess.is() )
{
Any aAny;
try
{
aAny =
xHierAccess->getByHierarchicalName(
rtl::OUString::createFromAscii(key));
}
catch( const NoSuchElementException& )
{
}
aAny >>= val;
}
return val;
}
Reference<XContentProvider> Reference<XContentProvider>
FTPContentProvider::getHttpProvider() FTPContentProvider::getHttpProvider()
throw(RuntimeException) throw(RuntimeException)
{ {
osl::MutexGuard aGuard(m_aMutex); // used for access to ftp-proxy
if (!m_xManager.is()) ucb::ContentBroker *pBroker = ucb::ContentBroker::get();
{
if (!m_xManager.is()) if(pBroker) {
{ Reference<XContentProviderManager > xManager(
ucb::ContentBroker * pBroker = ucb::ContentBroker::get(); pBroker->getContentProviderManagerInterface());
if (pBroker)
{ if(xManager.is())
m_xManager = pBroker->getContentProviderManagerInterface(); return
if (!m_xManager.is()) xManager->queryContentProvider(
rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("http:")));
else
throw RuntimeException( throw RuntimeException(
rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
"bad ucb::ContentBroker")), "bad ucb::ContentBroker")),
*this); *this);
} } else
if (!m_xManager.is())
return 0; return 0;
}
}
return m_xManager->
queryContentProvider(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
"http:")));
//TODO! input ok?
} }
...@@ -2,9 +2,9 @@ ...@@ -2,9 +2,9 @@
* *
* $RCSfile: ftpcontentprovider.hxx,v $ * $RCSfile: ftpcontentprovider.hxx,v $
* *
* $Revision: 1.6 $ * $Revision: 1.7 $
* *
* last change: $Author: abi $ $Date: 2002-10-23 08:00:07 $ * last change: $Author: abi $ $Date: 2002-10-29 12:43:14 $
* *
* The Contents of this file are made available subject to the terms of * The Contents of this file are made available subject to the terms of
* either of the following licenses * either of the following licenses
...@@ -65,6 +65,7 @@ ...@@ -65,6 +65,7 @@
#include <vector> #include <vector>
#include <osl/mutex.hxx> #include <osl/mutex.hxx>
#include <ucbhelper/macros.hxx> #include <ucbhelper/macros.hxx>
#include <ucbhelper/proxydecider.hxx>
#include <ucbhelper/providerhelper.hxx> #include <ucbhelper/providerhelper.hxx>
#include <com/sun/star/container/XHierarchicalNameAccess.hpp> #include <com/sun/star/container/XHierarchicalNameAccess.hpp>
#include <com/sun/star/beans/PropertyValue.hpp> #include <com/sun/star/beans/PropertyValue.hpp>
...@@ -100,8 +101,7 @@ namespace ftp { ...@@ -100,8 +101,7 @@ namespace ftp {
class FTPContentProvider: class FTPContentProvider:
public ::ucb::ContentProviderImplHelper, public ::ucb::ContentProviderImplHelper,
public ::com::sun::star::container::XContainerListener, // public ::com::sun::star::lang::XComponent,
public ::com::sun::star::lang::XComponent,
public FTPHandleProvider public FTPHandleProvider
{ {
public: public:
...@@ -125,62 +125,7 @@ namespace ftp { ...@@ -125,62 +125,7 @@ namespace ftp {
throw( com::sun::star::ucb::IllegalIdentifierException, throw( com::sun::star::ucb::IllegalIdentifierException,
com::sun::star::uno::RuntimeException ); com::sun::star::uno::RuntimeException );
// XComponent // FTPHandleProvider.
virtual void SAL_CALL
dispose( )
throw (::com::sun::star::uno::RuntimeException)
{
if(m_xContainer.is())
{
m_xContainer->removeContainerListener(this);
m_xContainer =
com::sun::star::uno::Reference<
com::sun::star::container::XContainer>(0);
}
}
virtual void SAL_CALL
addEventListener(
const ::com::sun::star::uno::Reference<
::com::sun::star::lang::XEventListener >& xListener )
throw (::com::sun::star::uno::RuntimeException) { }
virtual void SAL_CALL
removeEventListener(
const ::com::sun::star::uno::Reference<
::com::sun::star::lang::XEventListener >& aListener )
throw (::com::sun::star::uno::RuntimeException) { }
// XConainerListener ( deriver from XEventListener )
virtual void SAL_CALL
disposing( const ::com::sun::star::lang::EventObject& Source )
throw (::com::sun::star::uno::RuntimeException)
{
m_xContainer =
com::sun::star::uno::Reference<
com::sun::star::container::XContainer>(0);
}
virtual void SAL_CALL
elementInserted(
const ::com::sun::star::container::ContainerEvent& Event )
throw (::com::sun::star::uno::RuntimeException) { }
virtual void SAL_CALL
elementRemoved(
const ::com::sun::star::container::ContainerEvent& Event )
throw (::com::sun::star::uno::RuntimeException) { }
virtual void SAL_CALL
elementReplaced(
const ::com::sun::star::container::ContainerEvent& Event )
throw (::com::sun::star::uno::RuntimeException);
/** FTPHandleProvider.
*/
virtual CURL* handle(); virtual CURL* handle();
...@@ -209,51 +154,15 @@ namespace ftp { ...@@ -209,51 +154,15 @@ namespace ftp {
osl::Mutex m_aMutex; osl::Mutex m_aMutex;
FTPLoaderThread *m_ftpLoaderThread; FTPLoaderThread *m_ftpLoaderThread;
ucbhelper::InternetProxyDecider *m_pProxyDecider;
sal_Int32 m_eType;
rtl::OUString m_aFtpProxy;
rtl::OUString m_aNoProxyList;
// used for access to ftp-proxy
com::sun::star::uno::Reference<
com::sun::star::ucb::XContentProviderManager > m_xManager;
com::sun::star::uno::Reference<
com::sun::star::container::XContainer> m_xContainer;
std::vector<ServerInfo> m_ServerInfo; std::vector<ServerInfo> m_ServerInfo;
void init(); void init();
com::sun::star::uno::Reference<
com::sun::star::lang::XMultiServiceFactory >
getConfiguration() const;
com::sun::star::uno::Reference<
com::sun::star::container::XHierarchicalNameAccess >
getHierAccess(
const com::sun::star::uno::Reference<
com::sun::star::lang::XMultiServiceFactory >& sProvider,
const char* file ) const;
rtl::OUString
getKey(
const com::sun::star::uno::Reference<
com::sun::star::container::XHierarchicalNameAccess >& xHierAccess,
const char* key) const;
sal_Int32
getIntKey(
const com::sun::star::uno::Reference<
com::sun::star::container::XHierarchicalNameAccess >& xHierAccess,
const char* key) const;
com::sun::star::uno::Reference<com::sun::star::ucb::XContentProvider> com::sun::star::uno::Reference<com::sun::star::ucb::XContentProvider>
getHttpProvider() getHttpProvider()
throw(com::sun::star::uno::RuntimeException); throw(com::sun::star::uno::RuntimeException);
bool ShouldUseFtpProxy(const FTPURL& aURL) const;
}; // end class FTPContentProvider }; // end class FTPContentProvider
} // end namespace ftp } // end namespace ftp
......
...@@ -2,9 +2,9 @@ ...@@ -2,9 +2,9 @@
* *
* $RCSfile: ftpurl.cxx,v $ * $RCSfile: ftpurl.cxx,v $
* *
* $Revision: 1.12 $ * $Revision: 1.13 $
* *
* last change: $Author: abi $ $Date: 2002-10-25 12:09:11 $ * last change: $Author: abi $ $Date: 2002-10-29 12:43:14 $
* *
* The Contents of this file are made available subject to the terms of * The Contents of this file are made available subject to the terms of
* either of the following licenses * either of the following licenses
...@@ -460,6 +460,9 @@ extern "C" int no_func(void *client, char *prompt, char* ...@@ -460,6 +460,9 @@ extern "C" int no_func(void *client, char *prompt, char*
FILE* FTPURL::open() FILE* FTPURL::open()
throw(curl_exception) throw(curl_exception)
{ {
if(!m_aPathSegmentVec.size())
throw curl_exception(CURLE_FTP_COULDNT_RETR_FILE);
CURL *curl = m_pFCP->handle(); CURL *curl = m_pFCP->handle();
SET_CONTROL_CONTAINER; SET_CONTROL_CONTAINER;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment