summaryrefslogtreecommitdiff
path: root/ucb
diff options
context:
space:
mode:
authorCédric Bosdonnat <cedric.bosdonnat.ooo@free.fr>2011-10-01 15:54:09 +0200
committerCédric Bosdonnat <cedric.bosdonnat.ooo@free.fr>2011-10-01 16:04:47 +0200
commit14a03abcd32800b52e900c405673c5b864e994a6 (patch)
treefb68f96bdac222ac316de5379f9ddda8eb4b89d6 /ucb
parenta43730b4dfce70ee02996f808525cbd4e197e899 (diff)
CMIS UCP: get the document content stream
Diffstat (limited to 'ucb')
-rw-r--r--ucb/source/ucp/cmis/cmis_content.cxx192
-rw-r--r--ucb/source/ucp/cmis/cmis_content.hxx4
-rw-r--r--ucb/source/ucp/cmis/cmis_url.cxx94
-rw-r--r--ucb/source/ucp/cmis/cmis_url.hxx56
-rw-r--r--ucb/source/ucp/cmis/makefile.mk4
-rw-r--r--ucb/source/ucp/ftp/ftpcfunc.cxx1
-rw-r--r--ucb/source/ucp/ftp/ftpcontent.cxx6
-rw-r--r--ucb/source/ucp/ftp/ftpinpstr.cxx208
-rw-r--r--ucb/source/ucp/ftp/ftpinpstr.hxx154
-rw-r--r--ucb/source/ucp/ftp/ftpurl.cxx1
-rw-r--r--ucb/source/ucp/ftp/makefile.mk1
-rw-r--r--ucb/source/ucp/gio/gio_content.cxx1
12 files changed, 320 insertions, 402 deletions
diff --git a/ucb/source/ucp/cmis/cmis_content.cxx b/ucb/source/ucp/cmis/cmis_content.cxx
index 31f49a943abc..d72041e5e9b6 100644
--- a/ucb/source/ucp/cmis/cmis_content.cxx
+++ b/ucb/source/ucp/cmis/cmis_content.cxx
@@ -31,18 +31,29 @@
#include <com/sun/star/beans/PropertyAttribute.hpp>
#include <com/sun/star/beans/PropertyValue.hpp>
#include <com/sun/star/beans/XPropertySetInfo.hpp>
+#include <com/sun/star/io/XActiveDataSink.hpp>
#include <com/sun/star/ucb/ContentInfoAttribute.hpp>
#include <com/sun/star/ucb/InsertCommandArgument.hpp>
+#include <com/sun/star/ucb/OpenMode.hpp>
+#include <com/sun/star/ucb/UnsupportedDataSinkException.hpp>
+#include <com/sun/star/ucb/UnsupportedOpenModeException.hpp>
#include <com/sun/star/ucb/XCommandInfo.hpp>
+#include <com/sun/star/ucb/XDynamicResultSet.hpp>
+
+#include <libcmis/document.hxx>
#include <ucbhelper/cancelcommandexecution.hxx>
#include <ucbhelper/contentidentifier.hxx>
+#include <ucbhelper/fd_inputstream.hxx>
#include <ucbhelper/propertyvalueset.hxx>
#include "cmis_content.hxx"
#include "cmis_provider.hxx"
+#include "cmis_url.hxx"
+
using namespace com::sun::star;
+using namespace std;
namespace cmis
{
@@ -50,12 +61,20 @@ namespace cmis
ContentProvider *pProvider, const uno::Reference< ucb::XContentIdentifier >& Identifier)
throw ( ucb::ContentCreationException )
: ContentImplHelper( rxSMgr, pProvider, Identifier ),
- m_pProvider( pProvider )
+ m_pProvider( pProvider ),
+ m_pSession( NULL )
{
#if OSL_DEBUG_LEVEL > 1
- fprintf(stderr, "TODO - New Content ('%s')\n", rtl::OUStringToOString(m_xIdentifier->getContentIdentifier(), RTL_TEXTENCODING_UTF8).getStr());
+ fprintf(stderr, "New Content ('%s')\n", rtl::OUStringToOString(m_xIdentifier->getContentIdentifier(), RTL_TEXTENCODING_UTF8).getStr());
#endif
- // TODO Implement me
+ // Split the URL into bits
+ cmis::URL url( m_xIdentifier->getContentIdentifier() );
+
+ // Initiate a CMIS session
+ m_pSession = libcmis::SessionFactory::createSession( url.getSessionParams( ) );
+
+ // Get the content Object
+ m_pObject = m_pSession->getObject( url.getObjectId() );
}
Content::Content( const uno::Reference< lang::XMultiServiceFactory >& rxSMgr, ContentProvider *pProvider,
@@ -63,7 +82,8 @@ namespace cmis
sal_Bool /*bIsFolder*/)
throw ( ucb::ContentCreationException )
: ContentImplHelper( rxSMgr, pProvider, Identifier ),
- m_pProvider( pProvider )
+ m_pProvider( pProvider ),
+ m_pSession( NULL )
{
#if OSL_DEBUG_LEVEL > 1
fprintf(stderr, "TODO - Create Content ('%s')\n", rtl::OUStringToOString(m_xIdentifier->getContentIdentifier(), RTL_TEXTENCODING_UTF8).getStr());
@@ -73,21 +93,12 @@ namespace cmis
Content::~Content()
{
-#if OSL_DEBUG_LEVEL > 1
- fprintf( stderr, "TODO - cmis::Content::~Content()\n" );
-#endif
- // TODO Implement me
+ delete m_pSession;
}
bool Content::isFolder(const uno::Reference< ucb::XCommandEnvironment >& /*xEnv*/)
{
- bool bRet = false;
-#if OSL_DEBUG_LEVEL > 1
- fprintf( stderr, "TODO - cmis::Content::isFolder()\n" );
-#endif
- // TODO Implement me
-
- return bRet;
+ return m_pObject->getBaseType( ) == "cmis::folder";
}
uno::Any Content::getBadArgExcept()
@@ -98,17 +109,75 @@ namespace cmis
}
uno::Reference< sdbc::XRow > Content::getPropertyValues(
- const uno::Sequence< beans::Property >& /*rProperties*/,
+ const uno::Sequence< beans::Property >& rProperties,
const uno::Reference< ucb::XCommandEnvironment >& /*xEnv*/ )
{
- uno::Reference< sdbc::XRow > rRow;
-
#if OSL_DEBUG_LEVEL > 1
fprintf( stderr, "TODO - cmis::Content::getPropertyValues()\n" );
#endif
- // TODO Implement me
+ rtl::Reference< ::ucbhelper::PropertyValueSet > xRow = new ::ucbhelper::PropertyValueSet( m_xSMgr );
- return rRow;
+ sal_Int32 nProps;
+ const beans::Property* pProps;
+
+ nProps = rProperties.getLength();
+ pProps = rProperties.getConstArray();
+
+ for( sal_Int32 n = 0; n < nProps; ++n )
+ {
+ const beans::Property& rProp = pProps[ n ];
+
+ if (rProp.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "IsDocument" ) ) )
+ {
+ if ( m_pObject->getBaseType( ) == "cmis:document" )
+ xRow->appendBoolean( rProp, true );
+ else
+ xRow->appendVoid( rProp );
+ }
+ else if (rProp.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "IsFolder" ) ) )
+ {
+ if( m_pObject->getBaseType( ) == "cmis:folder" )
+ xRow->appendBoolean( rProp, true );
+ else
+ xRow->appendVoid( rProp );
+ }
+ else if (rProp.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Title" ) ) )
+ {
+ xRow->appendString( rProp, rtl::OUString::createFromAscii( m_pObject->getName().c_str() ) );
+ }
+ else if (rProp.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "IsReadOnly" ) ) )
+ {
+ // TODO Fix this value
+ xRow->appendBoolean( rProp, sal_True );
+ }
+ else if (rProp.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "DateCreated" ) ) )
+ {
+ // TODO Fix this value
+ xRow->appendVoid( rProp );
+ }
+ else if (rProp.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "DateModified" ) ) )
+ {
+ // TODO Fix this value
+ xRow->appendVoid( rProp );
+ }
+ else if (rProp.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Size" ) ) )
+ {
+ libcmis::Document* document = dynamic_cast< libcmis::Document* >( m_pObject.get( ) );
+ if ( NULL != document )
+ xRow->appendLong( rProp, document->getContentLength() );
+ else
+ xRow->appendVoid( rProp );
+ }
+#if OSL_DEBUG_LEVEL > 1
+ else
+ {
+ fprintf( stderr, "Looking for unsupported property %s\n",
+ rtl::OUStringToOString( rProp.Name, RTL_TEXTENCODING_UTF8 ).getStr( ) );
+ }
+#endif
+ }
+
+ return uno::Reference< sdbc::XRow >( xRow.get() );
}
void Content::queryChildren( ContentRefList& /*rChildren*/ )
@@ -119,16 +188,62 @@ namespace cmis
// TODO Implement me
}
- uno::Any Content::open(const ucb::OpenCommandArgument2 & /*rArg*/,
- const uno::Reference< ucb::XCommandEnvironment > & /*xEnv*/ )
+ uno::Any Content::open(const ucb::OpenCommandArgument2 & rOpenCommand,
+ const uno::Reference< ucb::XCommandEnvironment > & xEnv )
throw( uno::Exception )
{
+ bool bIsFolder = isFolder( xEnv );
+
+ // TODO Handle the case of the non-existing file
+
uno::Any aRet;
+ sal_Bool bOpenFolder = (
+ ( rOpenCommand.Mode == ucb::OpenMode::ALL ) ||
+ ( rOpenCommand.Mode == ucb::OpenMode::FOLDERS ) ||
+ ( rOpenCommand.Mode == ucb::OpenMode::DOCUMENTS )
+ );
+
+ if ( bOpenFolder && bIsFolder )
+ {
#if OSL_DEBUG_LEVEL > 1
- fprintf( stderr, "TODO - cmis::Content::open()\n" );
+ fprintf( stderr, "TODO - cmis::Content::open() - Folder case\n" );
#endif
- // TODO Implement me
+ // TODO Implement the folder case
+ }
+ else if ( rOpenCommand.Sink.is() )
+ {
+ if (
+ ( rOpenCommand.Mode == ucb::OpenMode::DOCUMENT_SHARE_DENY_NONE ) ||
+ ( rOpenCommand.Mode == ucb::OpenMode::DOCUMENT_SHARE_DENY_WRITE )
+ )
+ {
+ ucbhelper::cancelCommandExecution(
+ uno::makeAny ( ucb::UnsupportedOpenModeException
+ ( rtl::OUString(), static_cast< cppu::OWeakObject * >( this ),
+ sal_Int16( rOpenCommand.Mode ) ) ),
+ xEnv );
+ }
+
+ if ( !feedSink( rOpenCommand.Sink, xEnv ) )
+ {
+ // Note: rOpenCommand.Sink may contain an XStream
+ // implementation. Support for this type of
+ // sink is optional...
+#if OSL_DEBUG_LEVEL > 1
+ fprintf( stderr, "Failed to load data from '%s'\n",
+ rtl::OUStringToOString( m_xIdentifier->getContentIdentifier(), RTL_TEXTENCODING_UTF8 ).getStr() );
+#endif
+
+ ucbhelper::cancelCommandExecution(
+ uno::makeAny (ucb::UnsupportedDataSinkException
+ ( rtl::OUString(), static_cast< cppu::OWeakObject * >( this ),
+ rOpenCommand.Sink ) ),
+ xEnv );
+ }
+ }
+ else
+ fprintf( stderr, "Open falling through ..." );
return aRet;
}
@@ -190,16 +305,31 @@ namespace cmis
return aRet;
}
- sal_Bool Content::feedSink( uno::Reference< uno::XInterface> /*aSink*/,
+ sal_Bool Content::feedSink( uno::Reference< uno::XInterface> xSink,
const uno::Reference< ucb::XCommandEnvironment >& /*xEnv*/ )
{
- sal_Bool bRet = sal_False;
-#if OSL_DEBUG_LEVEL > 1
- fprintf( stderr, "TODO - cmis::Content::feedSink()\n" );
-#endif
- // TODO Implement me
+ if ( !xSink.is() )
+ return sal_False;
- return bRet;
+ uno::Reference< io::XOutputStream > xOut = uno::Reference< io::XOutputStream >(xSink, uno::UNO_QUERY );
+ uno::Reference< io::XActiveDataSink > xDataSink = uno::Reference< io::XActiveDataSink >(xSink, uno::UNO_QUERY );
+
+ if ( !xOut.is() && !xDataSink.is() )
+ return sal_False;
+
+ libcmis::Document* document = dynamic_cast< libcmis::Document* >( m_pObject.get() );
+ FILE* fd = document->getContent( );
+
+ uno::Reference< io::XInputStream > xIn = new ucbhelper::FdInputStream( fd );
+ if( !xIn.is( ) )
+ return sal_False;
+
+ if ( xDataSink.is() )
+ xDataSink->setInputStream( xIn );
+ else if ( xOut.is() )
+ copyData( xIn, xOut );
+
+ return sal_True;
}
sal_Bool Content::exchangeIdentity( const uno::Reference< ucb::XContentIdentifier >& /*xNewId*/ )
diff --git a/ucb/source/ucp/cmis/cmis_content.hxx b/ucb/source/ucp/cmis/cmis_content.hxx
index 20171a606155..ef7503a0dfbe 100644
--- a/ucb/source/ucp/cmis/cmis_content.hxx
+++ b/ucb/source/ucp/cmis/cmis_content.hxx
@@ -66,7 +66,9 @@ class ContentProperties;
class Content : public ::ucbhelper::ContentImplHelper, public com::sun::star::ucb::XContentCreator
{
private:
- ContentProvider *m_pProvider;
+ ContentProvider* m_pProvider;
+ libcmis::Session* m_pSession;
+ libcmis::CmisObjectPtr m_pObject;
bool isFolder(const com::sun::star::uno::Reference< com::sun::star::ucb::XCommandEnvironment >& xEnv);
diff --git a/ucb/source/ucp/cmis/cmis_url.cxx b/ucb/source/ucp/cmis/cmis_url.cxx
new file mode 100644
index 000000000000..2942d8c144e1
--- /dev/null
+++ b/ucb/source/ucp/cmis/cmis_url.cxx
@@ -0,0 +1,94 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * Version: MPL 1.1 / GPLv3+ / LGPLv3+
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License or as specified alternatively below. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * Major Contributor(s):
+ * [ Copyright (C) 2011 SUSE <cbosdonnat@suse.com> (initial developer) ]
+ *
+ * All Rights Reserved.
+ *
+ * For minor contributions see the git repository.
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 3 or later (the "GPLv3+"), or
+ * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
+ * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
+ * instead of those above.
+ */
+
+#include <libcmis/session-factory.hxx>
+#include <tools/urlobj.hxx>
+
+#include "cmis_url.hxx"
+
+using namespace std;
+
+#define OUSTR_TO_STDSTR(s) string( rtl::OUStringToOString( s, RTL_TEXTENCODING_UTF8 ).getStr() )
+
+
+namespace cmis
+{
+ URL::URL( rtl::OUString const & urlStr )
+ {
+ INetURLObject url( urlStr );
+
+ string bindingUrl( "http://" );
+ bindingUrl += OUSTR_TO_STDSTR( url.GetHostPort( ) );
+ bindingUrl += OUSTR_TO_STDSTR( url.GetURLPath( ) );
+ m_sBindingUrl = bindingUrl;
+
+ // Split the query into bits and locate the repo-id key
+ rtl::OUString query = url.GetParam( );
+ while ( query.getLength() > 0 )
+ {
+ sal_Int32 nPos = query.indexOfAsciiL( "&", 1 );
+ rtl::OUString segment;
+ if ( nPos > 0 )
+ {
+ segment = query.copy( 0, nPos );
+ query = query.copy( nPos + 1 );
+ }
+ else
+ {
+ segment = query;
+ query = rtl::OUString();
+ }
+
+ sal_Int32 nEqPos = segment.indexOfAsciiL( "=", 1 );
+ string key = OUSTR_TO_STDSTR( segment.copy( 0, nEqPos ) );
+ string value = OUSTR_TO_STDSTR( segment.copy( nEqPos +1 ) );
+
+ if ( key == "repo-id" )
+ m_sRepositoryId = value;
+ else
+ m_aQuery[key] = value;
+ }
+
+ }
+
+ map< int, string > URL::getSessionParams( )
+ {
+ map< int, string > params;
+ params[ATOMPUB_URL] = m_sBindingUrl;
+ params[REPOSITORY_ID] = m_sRepositoryId;
+
+ return params;
+ }
+
+ string URL::getObjectId( )
+ {
+ return m_aQuery["id"];
+ }
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/ucb/source/ucp/cmis/cmis_url.hxx b/ucb/source/ucp/cmis/cmis_url.hxx
new file mode 100644
index 000000000000..1859102fa59e
--- /dev/null
+++ b/ucb/source/ucp/cmis/cmis_url.hxx
@@ -0,0 +1,56 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * Version: MPL 1.1 / GPLv3+ / LGPLv3+
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License or as specified alternatively below. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * Major Contributor(s):
+ * [ Copyright (C) 2011 SUSE <cbosdonnat@suse.com> (initial developer) ]
+ *
+ * All Rights Reserved.
+ *
+ * For minor contributions see the git repository.
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 3 or later (the "GPLv3+"), or
+ * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
+ * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
+ * instead of those above.
+ */
+#ifndef CMIS_URL_HXX
+#define CMIS_URL_HXX
+
+#include <map>
+#include <string>
+
+#include <rtl/ustring.hxx>
+
+namespace cmis
+{
+ class URL
+ {
+ private:
+ std::string m_sBindingUrl;
+ std::string m_sRepositoryId;
+
+ std::map< std::string, std::string > m_aQuery;
+
+ public:
+ URL( rtl::OUString const & urlStr );
+
+ std::map< int, std::string > getSessionParams( );
+ std::string getObjectId( );
+ };
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/ucb/source/ucp/cmis/makefile.mk b/ucb/source/ucp/cmis/makefile.mk
index d30a116e45c0..43b7c438ff30 100644
--- a/ucb/source/ucp/cmis/makefile.mk
+++ b/ucb/source/ucp/cmis/makefile.mk
@@ -41,7 +41,8 @@ NO_BSYMBOLIC=TRUE
DLLPRE =
SLOFILES=$(SLO)$/cmis_provider.obj\
- $(SLO)$/cmis_content.obj
+ $(SLO)$/cmis_content.obj \
+ $(SLO)$/cmis_url.obj
SHL1TARGET=$(TARGET)$(UCPCMIS_MAJOR).uno
SHL1DEF=$(MISC)$/$(SHL1TARGET).def
@@ -53,6 +54,7 @@ SHL1STDLIBS=\
$(SALLIB) \
$(SALHELPERLIB) \
$(UCBHELPERLIB) \
+ $(TOOLSLIB) \
$(CMISLIB)
SHL1VERSIONMAP=$(SOLARENV)/src/component.map
diff --git a/ucb/source/ucp/ftp/ftpcfunc.cxx b/ucb/source/ucp/ftp/ftpcfunc.cxx
index 8df90ecd087c..16373e277278 100644
--- a/ucb/source/ucp/ftp/ftpcfunc.cxx
+++ b/ucb/source/ucp/ftp/ftpcfunc.cxx
@@ -37,7 +37,6 @@
#include <string.h>
#include "ftpcontentidentifier.hxx"
-#include "ftpinpstr.hxx"
#include <stdio.h>
using namespace ftp;
diff --git a/ucb/source/ucp/ftp/ftpcontent.cxx b/ucb/source/ucp/ftp/ftpcontent.cxx
index f0edeea018ee..46d663a5de2e 100644
--- a/ucb/source/ucp/ftp/ftpcontent.cxx
+++ b/ucb/source/ucp/ftp/ftpcontent.cxx
@@ -41,7 +41,6 @@
#include "ftpresultsetI.hxx"
#include "ftpcontent.hxx"
#include "ftpcontentprovider.hxx"
-#include "ftpinpstr.hxx"
#include "ftpdirp.hxx"
#include "ftpcontentidentifier.hxx"
#include "ftpcfunc.hxx"
@@ -55,6 +54,7 @@
#include <curl/easy.h>
#include <ucbhelper/cancelcommandexecution.hxx>
#include <ucbhelper/contentidentifier.hxx>
+#include <ucbhelper/fd_inputstream.hxx>
#include <ucbhelper/propertyvalueset.hxx>
#include <ucbhelper/contentidentifier.hxx>
#include <ucbhelper/cancelcommandexecution.hxx>
@@ -505,11 +505,11 @@ Any SAL_CALL FTPContent::execute(
if(xActiveDataSink.is()) {
xActiveDataSink->setInputStream(
- new FTPInputStream(m_aFTPURL.open()));
+ new ucbhelper::FdInputStream(m_aFTPURL.open()));
}
else if(xOutputStream.is()) {
Reference<XInputStream> xStream(
- new FTPInputStream(m_aFTPURL.open()));
+ new ucbhelper::FdInputStream(m_aFTPURL.open()));
Sequence<sal_Int8> byte_seq(4096);
sal_Int32 n = 1000; // value does not matter here
for (;;) {
diff --git a/ucb/source/ucp/ftp/ftpinpstr.cxx b/ucb/source/ucp/ftp/ftpinpstr.cxx
deleted file mode 100644
index bb7d1a150c23..000000000000
--- a/ucb/source/ucp/ftp/ftpinpstr.cxx
+++ /dev/null
@@ -1,208 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org 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 version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_ucb.hxx"
-
-/**************************************************************************
- TODO
- **************************************************************************
-
- *************************************************************************/
-#include "ftpinpstr.hxx"
-#include <rtl/alloc.h>
-#ifndef STD_ALGORITHM
-#include <algorithm>
-#define STD_ALGORITHM
-#endif
-#include <stdio.h>
-
-using namespace ftp;
-using namespace com::sun::star::uno;
-using namespace com::sun::star::lang;
-using namespace com::sun::star::io;
-
-
-FTPInputStream::FTPInputStream(FILE* tmpfl)
- : m_tmpfl(tmpfl ? tmpfl : tmpfile())
-{
- fseek(m_tmpfl,0,SEEK_END);
- long pos = ftell(m_tmpfl);
- rewind(m_tmpfl);
- m_nLength = sal_Int64(pos);
-}
-
-
-
-FTPInputStream::~FTPInputStream()
-{
- if ( 0 != m_tmpfl)
- fclose(m_tmpfl);
-}
-
-
-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);
-
- if(0 <= nBytesToRead && aData.getLength() < nBytesToRead)
- aData.realloc(nBytesToRead);
-
- size_t nWanted = static_cast<size_t>(nBytesToRead);
- size_t nRead = fread(aData.getArray(), 1, nWanted, m_tmpfl);
- if (nRead != nWanted && ferror(m_tmpfl))
- throw IOException();
-
- return static_cast<sal_Int32>(nRead);
-}
-
-
-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(!m_tmpfl)
- throw IOException();
-
- fseek(m_tmpfl,long(nBytesToSkip),SEEK_CUR);
-}
-
-
-
-sal_Int32 SAL_CALL FTPInputStream::available(void)
- throw(NotConnectedException,
- IOException,
- RuntimeException)
-{
- return sal::static_int_cast<sal_Int32>(m_nLength - getPosition());
-}
-
-
-
-void SAL_CALL FTPInputStream::closeInput(void)
- throw(NotConnectedException,
- IOException,
- RuntimeException)
-{
- osl::MutexGuard aGuard(m_aMutex);
- if(m_tmpfl)
- fclose(m_tmpfl),m_tmpfl = 0;
-}
-
-
-
-void SAL_CALL FTPInputStream::seek(sal_Int64 location)
- throw( IllegalArgumentException,
- IOException,
- RuntimeException )
-{
- osl::MutexGuard aGuard(m_aMutex);
- if(!m_tmpfl)
- throw IOException();
-
- fseek(m_tmpfl,long(location),SEEK_SET);
-}
-
-
-
-sal_Int64 SAL_CALL
-FTPInputStream::getPosition(
- void )
- throw( IOException,
- RuntimeException )
-{
- osl::MutexGuard aGuard(m_aMutex);
- if(!m_tmpfl)
- throw IOException();
-
-// fpos_t pos;
-// fgetpos(m_tmpfl,&pos);
- long pos;
- pos = ftell(m_tmpfl);
- return sal_Int64(pos);
-}
-
-
-
-sal_Int64 SAL_CALL FTPInputStream::getLength(
- void
-) throw(
- IOException,RuntimeException
-)
-{
- return m_nLength;
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/ucb/source/ucp/ftp/ftpinpstr.hxx b/ucb/source/ucp/ftp/ftpinpstr.hxx
deleted file mode 100644
index 96e8e999a93d..000000000000
--- a/ucb/source/ucp/ftp/ftpinpstr.hxx
+++ /dev/null
@@ -1,154 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org 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 version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-/**************************************************************************
- TODO
- **************************************************************************
-
- *************************************************************************/
-
-#ifndef _FTP_FTPINPSTR_HXX_
-#define _FTP_FTPINPSTR_HXX_
-
-
-#include <rtl/ustring.hxx>
-#include <osl/mutex.hxx>
-#include <cppuhelper/weak.hxx>
-#include <cppuhelper/queryinterface.hxx>
-#include <com/sun/star/io/XInputStream.hpp>
-#include <com/sun/star/io/XSeekable.hpp>
-#include <stdio.h>
-
-
-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:
-
- /** Defines the storage kind found
- * on which the inputstream acts.
- */
-
- FTPInputStream(FILE* tmpfl = 0);
-
- ~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);
-
- // additional
-
-// void append(const void* pBuffer,size_t size,size_t nmemb);
-
- private:
-
- osl::Mutex m_aMutex;
- FILE* m_tmpfl;
- sal_Int64 m_nLength;
- };
-
-
-}
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/ucb/source/ucp/ftp/ftpurl.cxx b/ucb/source/ucp/ftp/ftpurl.cxx
index c022e584ac4a..93eeb2f05a9e 100644
--- a/ucb/source/ucp/ftp/ftpurl.cxx
+++ b/ucb/source/ucp/ftp/ftpurl.cxx
@@ -43,7 +43,6 @@
#include "ftpstrcont.hxx"
#include "ftpurl.hxx"
#include "ftphandleprovider.hxx"
-#include "ftpinpstr.hxx"
#include "ftpcfunc.hxx"
#include "ftpcontainer.hxx"
diff --git a/ucb/source/ucp/ftp/makefile.mk b/ucb/source/ucp/ftp/makefile.mk
index 8c30a59807d9..944b179c2514 100644
--- a/ucb/source/ucp/ftp/makefile.mk
+++ b/ucb/source/ucp/ftp/makefile.mk
@@ -54,7 +54,6 @@ SLOFILES1=\
$(SLO)$/ftpresultsetbase.obj \
$(SLO)$/ftpresultsetI.obj \
$(SLO)$/ftploaderthread.obj \
- $(SLO)$/ftpinpstr.obj \
$(SLO)$/ftpdirp.obj \
$(SLO)$/ftpcfunc.obj \
$(SLO)$/ftpurl.obj \
diff --git a/ucb/source/ucp/gio/gio_content.cxx b/ucb/source/ucp/gio/gio_content.cxx
index e10a69d34f39..fab393ee9547 100644
--- a/ucb/source/ucp/gio/gio_content.cxx
+++ b/ucb/source/ucp/gio/gio_content.cxx
@@ -65,7 +65,6 @@
#include <com/sun/star/ucb/UnsupportedDataSinkException.hpp>
#include <com/sun/star/ucb/UnsupportedNameClashException.hpp>
#include <com/sun/star/ucb/UnsupportedOpenModeException.hpp>
-#include <com/sun/star/ucb/UnsupportedOpenModeException.hpp>
#include <com/sun/star/ucb/NameClashException.hpp>
#include <com/sun/star/ucb/XDynamicResultSet.hpp>
#include <com/sun/star/ucb/XContentCreator.hpp>