incubator-ooo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a.@apache.org
Subject svn commit: r1292832 [1/4] - /incubator/ooo/trunk/main/ucb/source/ucp/webdav/
Date Thu, 23 Feb 2012 15:52:47 GMT
Author: af
Date: Thu Feb 23 15:52:46 2012
New Revision: 1292832

URL: http://svn.apache.org/viewvc?rev=1292832&view=rev
Log:
118569: Second part of commit.

Added:
    incubator/ooo/trunk/main/ucb/source/ucp/webdav/AprEnv.cxx
    incubator/ooo/trunk/main/ucb/source/ucp/webdav/AprEnv.hxx
    incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfCallbacks.cxx
    incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfCallbacks.hxx
    incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfCopyReqProcImpl.cxx
    incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfCopyReqProcImpl.hxx
    incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfDeleteReqProcImpl.cxx
    incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfDeleteReqProcImpl.hxx
    incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfGetReqProcImpl.cxx
    incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfGetReqProcImpl.hxx
    incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfHeadReqProcImpl.cxx
    incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfHeadReqProcImpl.hxx
    incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfInputStream.cxx
    incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfInputStream.hxx
    incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfLockStore.cxx
    incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfLockStore.hxx
    incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfMkColReqProcImpl.cxx
    incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfMkColReqProcImpl.hxx
    incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfMoveReqProcImpl.cxx
    incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfMoveReqProcImpl.hxx
    incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfPostReqProcImpl.cxx
    incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfPostReqProcImpl.hxx
    incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfPropFindReqProcImpl.cxx
    incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfPropFindReqProcImpl.hxx
    incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfPropPatchReqProcImpl.cxx
    incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfPropPatchReqProcImpl.hxx
    incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfPutReqProcImpl.cxx
    incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfPutReqProcImpl.hxx
    incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfRequestProcessor.cxx
    incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfRequestProcessor.hxx
    incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfRequestProcessorImpl.cxx
    incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfRequestProcessorImpl.hxx
    incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfRequestProcessorImplFac.cxx
    incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfRequestProcessorImplFac.hxx
    incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfSession.cxx
    incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfSession.hxx
    incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfTypes.hxx
    incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfUri.cxx
    incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfUri.hxx
    incubator/ooo/trunk/main/ucb/source/ucp/webdav/webdavresponseparser.cxx
    incubator/ooo/trunk/main/ucb/source/ucp/webdav/webdavresponseparser.hxx

Added: incubator/ooo/trunk/main/ucb/source/ucp/webdav/AprEnv.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/ucb/source/ucp/webdav/AprEnv.cxx?rev=1292832&view=auto
==============================================================================
--- incubator/ooo/trunk/main/ucb/source/ucp/webdav/AprEnv.cxx (added)
+++ incubator/ooo/trunk/main/ucb/source/ucp/webdav/AprEnv.cxx Thu Feb 23 15:52:46 2012
@@ -0,0 +1,58 @@
+/**************************************************************
+ * 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * 
+ *************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_ucb.hxx"
+
+#include <AprEnv.hxx>
+
+namespace apr_environment
+{
+
+AprEnv::AprEnv()
+    : mpAprPool( 0 )
+{
+    apr_initialize();
+
+    apr_pool_create(&mpAprPool, NULL);
+}
+
+AprEnv::~AprEnv()
+{
+    apr_pool_destroy(mpAprPool);
+
+    apr_terminate();
+}
+
+/* static */
+AprEnv* AprEnv::getAprEnv()
+{
+    static AprEnv rAprEnv;
+
+    return &rAprEnv;
+}
+
+apr_pool_t* AprEnv::getAprPool()
+{
+    return mpAprPool;
+}
+
+} // namespace apr_environment

Added: incubator/ooo/trunk/main/ucb/source/ucp/webdav/AprEnv.hxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/ucb/source/ucp/webdav/AprEnv.hxx?rev=1292832&view=auto
==============================================================================
--- incubator/ooo/trunk/main/ucb/source/ucp/webdav/AprEnv.hxx (added)
+++ incubator/ooo/trunk/main/ucb/source/ucp/webdav/AprEnv.hxx Thu Feb 23 15:52:46 2012
@@ -0,0 +1,50 @@
+/**************************************************************
+ * 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * 
+ *************************************************************/
+
+
+#ifndef INCLUDED_APRENV_HXX
+#define INCLUDED_APRENV_HXX
+
+#include <apr/apr_pools.h>
+
+namespace apr_environment
+{
+
+// singleton class providing environment for APR libraries
+class AprEnv
+{
+    public:
+        ~AprEnv();
+
+        static AprEnv* getAprEnv();
+
+        apr_pool_t* getAprPool();
+
+    private:
+        apr_pool_t* mpAprPool;
+
+        AprEnv();
+
+};
+
+} // namespace apr_environment
+
+#endif // INCLUDED_APRENV_HXX

Added: incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfCallbacks.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfCallbacks.cxx?rev=1292832&view=auto
==============================================================================
--- incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfCallbacks.cxx (added)
+++ incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfCallbacks.cxx Thu Feb 23 15:52:46 2012
@@ -0,0 +1,113 @@
+/**************************************************************
+ * 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * 
+ *************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_ucb.hxx"
+
+#include <SerfCallbacks.hxx>
+
+#include <SerfSession.hxx>
+#include <SerfRequestProcessor.hxx>
+
+using namespace http_dav_ucp;
+
+extern "C" apr_status_t Serf_ConnectSetup( apr_socket_t *skt,
+                                           serf_bucket_t **read_bkt,
+                                           serf_bucket_t **write_bkt,
+                                           void *setup_baton,
+                                           apr_pool_t *pool )
+{
+    SerfSession* pSerfSession = static_cast< SerfSession* >( setup_baton );
+    return pSerfSession->setupSerfConnection( skt,
+                                              read_bkt,
+                                              write_bkt,
+                                              pool );
+}
+
+extern "C" apr_status_t Serf_Credentials( char **username, 
+                                          char **password,
+                                          serf_request_t *request,
+                                          void *baton,
+                                          int code, 
+                                          const char *authn_type,
+                                          const char *realm,
+                                          apr_pool_t *pool )
+{
+    SerfRequestProcessor* pReqProc = static_cast< SerfRequestProcessor* >( baton );
+    return pReqProc->provideSerfCredentials( username, 
+                                             password,
+                                             request,
+                                             code,
+                                             authn_type,
+                                             realm,
+                                             pool );
+}
+
+extern "C" apr_status_t Serf_CertificationValidation( void *data,
+                                                      int failures,
+                                                      const serf_ssl_certificate_t *cert )
+{
+    SerfSession* pSerfSession = static_cast< SerfSession* >( data );
+    return pSerfSession->verifySerfCertificate( failures, 
+                                                cert );
+}
+
+extern "C" apr_status_t Serf_SetupRequest( serf_request_t *request,
+                                           void *setup_baton,
+                                           serf_bucket_t **req_bkt,
+                                           serf_response_acceptor_t *acceptor,
+                                           void **acceptor_baton,
+                                           serf_response_handler_t *handler,
+                                           void **handler_baton,
+                                           apr_pool_t * pool )
+{
+    SerfRequestProcessor* pReqProc = static_cast< SerfRequestProcessor* >( setup_baton );
+    return pReqProc->setupSerfRequest( request, 
+                                       req_bkt,
+                                       acceptor,
+                                       acceptor_baton,
+                                       handler,
+                                       handler_baton,
+                                       pool );
+}
+
+extern "C" serf_bucket_t* Serf_AcceptResponse( serf_request_t *request,
+                                               serf_bucket_t *stream,
+                                               void *acceptor_baton,
+                                               apr_pool_t *pool )
+{
+    SerfRequestProcessor* pReqProc = static_cast< SerfRequestProcessor* >( acceptor_baton );
+    return pReqProc->acceptSerfResponse( request,
+                                         stream,
+                                         pool );
+}
+
+extern "C" apr_status_t Serf_HandleResponse( serf_request_t *request,
+                                             serf_bucket_t *response,
+                                             void *handler_baton,
+                                             apr_pool_t *pool )
+{
+    SerfRequestProcessor* pReqProc = static_cast< SerfRequestProcessor* >( handler_baton );
+    return pReqProc->handleSerfResponse( request,
+                                         response,
+                                         pool );
+}
+

Added: incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfCallbacks.hxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfCallbacks.hxx?rev=1292832&view=auto
==============================================================================
--- incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfCallbacks.hxx (added)
+++ incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfCallbacks.hxx Thu Feb 23 15:52:46 2012
@@ -0,0 +1,66 @@
+/**************************************************************
+ * 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * 
+ *************************************************************/
+
+
+#ifndef INCLUDED_CALLBACKS_HXX
+#define INCLUDED_CALLBACKS_HXX
+
+#include <serf.h>
+
+extern "C" apr_status_t Serf_ConnectSetup( apr_socket_t *skt,
+                                           serf_bucket_t **read_bkt,
+                                           serf_bucket_t **write_bkt,
+                                           void *setup_baton,
+                                           apr_pool_t *pool );
+
+extern "C" apr_status_t Serf_Credentials( char **username, 
+                                          char **password,
+                                          serf_request_t *request,
+                                          void *baton,
+                                          int code, 
+                                          const char *authn_type,
+                                          const char *realm,
+                                          apr_pool_t *pool );
+
+extern "C" apr_status_t Serf_CertificationValidation( void *data,
+                                                      int failures,
+                                                      const serf_ssl_certificate_t *cert );
+
+extern "C" apr_status_t Serf_SetupRequest( serf_request_t *request,
+                                           void *setup_baton,
+                                           serf_bucket_t **req_bkt,
+                                           serf_response_acceptor_t *acceptor,
+                                           void **acceptor_baton,
+                                           serf_response_handler_t *handler,
+                                           void **handler_baton,
+                                           apr_pool_t * pool );
+
+extern "C" serf_bucket_t* Serf_AcceptResponse( serf_request_t *request,
+                                               serf_bucket_t *stream,
+                                               void *acceptor_baton,
+                                               apr_pool_t *pool );
+
+extern "C" apr_status_t Serf_HandleResponse( serf_request_t *request,
+                                             serf_bucket_t *response,
+                                             void *handler_baton,
+                                             apr_pool_t *pool );
+
+#endif // INCLUDED_CALLBACKS_HXX

Added: incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfCopyReqProcImpl.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfCopyReqProcImpl.cxx?rev=1292832&view=auto
==============================================================================
--- incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfCopyReqProcImpl.cxx (added)
+++ incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfCopyReqProcImpl.cxx Thu Feb 23 15:52:46 2012
@@ -0,0 +1,110 @@
+/**************************************************************
+ * 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * 
+ *************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_ucb.hxx"
+
+#include <SerfCopyReqProcImpl.hxx>
+
+#include <serf.h>
+
+namespace http_dav_ucp
+{
+
+SerfCopyReqProcImpl::SerfCopyReqProcImpl( const char* inSourcePath,
+                                          const char* inDestinationPath,
+                                          const bool inOverwrite )
+    : SerfRequestProcessorImpl( inSourcePath )
+    , mDestPathStr( inDestinationPath )
+    , mbOverwrite( inOverwrite )
+{
+}
+
+SerfCopyReqProcImpl::~SerfCopyReqProcImpl()
+{
+}
+
+serf_bucket_t * SerfCopyReqProcImpl::createSerfRequestBucket( serf_request_t * inSerfRequest )
+{
+    serf_bucket_alloc_t* pSerfBucketAlloc = serf_request_get_alloc( inSerfRequest );
+
+    // create serf request
+    serf_bucket_t *req_bkt = serf_request_bucket_request_create( inSerfRequest, 
+                                                                 "COPY",
+                                                                 getPathStr(),
+                                                                 0,
+                                                                 serf_request_get_alloc( inSerfRequest ) );
+
+    // TODO - correct headers
+    // set request header fields
+    serf_bucket_t* hdrs_bkt = serf_bucket_request_get_headers( req_bkt );
+    serf_bucket_headers_setn( hdrs_bkt, "User-Agent", "www.openoffice.org/ucb/" );
+    serf_bucket_headers_setn( hdrs_bkt, "Accept-Encoding", "gzip");
+    
+    // COPY specific header fields
+    serf_bucket_headers_setn( hdrs_bkt, "Destination", mDestPathStr );
+    if ( mbOverwrite )
+    {
+        serf_bucket_headers_setn( hdrs_bkt, "Overwrite", "T" );
+    }
+    else
+    {
+        serf_bucket_headers_setn( hdrs_bkt, "Overwrite", "F" );
+    }
+
+    return req_bkt;
+}
+
+
+bool SerfCopyReqProcImpl::processSerfResponseBucket( serf_request_t * /*inSerfRequest*/,
+                                                       serf_bucket_t * inSerfResponseBucket,
+                                                       apr_pool_t * /*inAprPool*/,
+                                                       apr_status_t & outStatus )
+{
+    const char* data;
+    apr_size_t len;
+
+    while (1) {
+        outStatus = serf_bucket_read(inSerfResponseBucket, 8096, &data, &len);
+        if (SERF_BUCKET_READ_ERROR(outStatus))
+        {
+            return true;
+        }
+
+        /* are we done yet? */
+        if (APR_STATUS_IS_EOF(outStatus)) 
+        {
+            outStatus = APR_EOF;
+            return true;
+        }
+
+        /* have we drained the response so far? */
+        if ( APR_STATUS_IS_EAGAIN( outStatus ) )
+        {
+            return false;
+        }
+    }
+
+    /* NOTREACHED */
+    return true;
+}
+
+} // namespace http_dav_ucp

Added: incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfCopyReqProcImpl.hxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfCopyReqProcImpl.hxx?rev=1292832&view=auto
==============================================================================
--- incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfCopyReqProcImpl.hxx (added)
+++ incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfCopyReqProcImpl.hxx Thu Feb 23 15:52:46 2012
@@ -0,0 +1,55 @@
+/**************************************************************
+ * 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * 
+ *************************************************************/
+
+#ifndef INCLUDED_SERFCOPYREQPROCIMPL_HXX
+#define INCLUDED_SERFCOPYREQPROCIMPL_HXX
+
+#include <SerfRequestProcessorImpl.hxx>
+
+namespace http_dav_ucp
+{
+
+class SerfCopyReqProcImpl : public SerfRequestProcessorImpl
+{
+public:
+    SerfCopyReqProcImpl( const char* inSourcePath,
+                         const char* inDestinationPath,
+                         const bool inOverwrite );
+
+    virtual ~SerfCopyReqProcImpl();
+
+    virtual
+    serf_bucket_t * createSerfRequestBucket( serf_request_t * inSerfRequest );
+
+    virtual
+    bool processSerfResponseBucket( serf_request_t * inSerfRequest,
+                                    serf_bucket_t * inSerfResponseBucket,
+                                    apr_pool_t * inAprPool,
+                                    apr_status_t & outStatus );
+
+private:
+    const char* mDestPathStr;
+    const bool mbOverwrite;
+};
+
+} // namespace http_dav_ucp
+
+#endif // INCLUDED_SERFCOPYREQPROCIMPL_HXX

Added: incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfDeleteReqProcImpl.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfDeleteReqProcImpl.cxx?rev=1292832&view=auto
==============================================================================
--- incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfDeleteReqProcImpl.cxx (added)
+++ incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfDeleteReqProcImpl.cxx Thu Feb 23 15:52:46 2012
@@ -0,0 +1,95 @@
+/**************************************************************
+ * 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * 
+ *************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_ucb.hxx"
+
+#include <SerfDeleteReqProcImpl.hxx>
+
+#include <serf.h>
+
+namespace http_dav_ucp
+{
+
+SerfDeleteReqProcImpl::SerfDeleteReqProcImpl( const char* inPath )
+    : SerfRequestProcessorImpl( inPath )
+{
+}
+
+SerfDeleteReqProcImpl::~SerfDeleteReqProcImpl()
+{
+}
+
+serf_bucket_t * SerfDeleteReqProcImpl::createSerfRequestBucket( serf_request_t * inSerfRequest )
+{
+    serf_bucket_alloc_t* pSerfBucketAlloc = serf_request_get_alloc( inSerfRequest );
+
+    // create serf request
+    serf_bucket_t *req_bkt = serf_request_bucket_request_create( inSerfRequest, 
+                                                                 "DELETE",
+                                                                 getPathStr(),
+                                                                 0,
+                                                                 serf_request_get_alloc( inSerfRequest ) );
+
+    // TODO - correct headers
+    // set request header fields
+    serf_bucket_t* hdrs_bkt = serf_bucket_request_get_headers( req_bkt );
+    serf_bucket_headers_setn( hdrs_bkt, "User-Agent", "www.openoffice.org/ucb/" );
+    serf_bucket_headers_setn( hdrs_bkt, "Accept-Encoding", "gzip");
+
+    return req_bkt;
+}
+
+
+bool SerfDeleteReqProcImpl::processSerfResponseBucket( serf_request_t * /*inSerfRequest*/,
+                                                       serf_bucket_t * inSerfResponseBucket,
+                                                       apr_pool_t * /*inAprPool*/,
+                                                       apr_status_t & outStatus )
+{
+    const char* data;
+    apr_size_t len;
+
+    while (1) {
+        outStatus = serf_bucket_read(inSerfResponseBucket, 8096, &data, &len);
+        if (SERF_BUCKET_READ_ERROR(outStatus))
+        {
+            return true;
+        }
+
+        /* are we done yet? */
+        if (APR_STATUS_IS_EOF(outStatus)) 
+        {
+            outStatus = APR_EOF;
+            return true;
+        }
+
+        /* have we drained the response so far? */
+        if ( APR_STATUS_IS_EAGAIN( outStatus ) )
+        {
+            return false;
+        }
+    }
+
+    /* NOTREACHED */
+    return true;
+}
+
+} // namespace http_dav_ucp

Added: incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfDeleteReqProcImpl.hxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfDeleteReqProcImpl.hxx?rev=1292832&view=auto
==============================================================================
--- incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfDeleteReqProcImpl.hxx (added)
+++ incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfDeleteReqProcImpl.hxx Thu Feb 23 15:52:46 2012
@@ -0,0 +1,50 @@
+/**************************************************************
+ * 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * 
+ *************************************************************/
+
+#ifndef INCLUDED_SERFDELETEREQPROCIMPL_HXX
+#define INCLUDED_SERFDELETEREQPROCIMPL_HXX
+
+#include <SerfRequestProcessorImpl.hxx>
+
+namespace http_dav_ucp
+{
+
+class SerfDeleteReqProcImpl : public SerfRequestProcessorImpl
+{
+public:
+    SerfDeleteReqProcImpl( const char* inPath );
+
+    virtual ~SerfDeleteReqProcImpl();
+
+    virtual
+    serf_bucket_t * createSerfRequestBucket( serf_request_t * inSerfRequest );
+
+    virtual
+    bool processSerfResponseBucket( serf_request_t * inSerfRequest,
+                                    serf_bucket_t * inSerfResponseBucket,
+                                    apr_pool_t * inAprPool,
+                                    apr_status_t & outStatus );
+
+};
+
+} // namespace http_dav_ucp
+
+#endif // INCLUDED_SERFDELETEREQPROCIMPL_HXX

Added: incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfGetReqProcImpl.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfGetReqProcImpl.cxx?rev=1292832&view=auto
==============================================================================
--- incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfGetReqProcImpl.cxx (added)
+++ incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfGetReqProcImpl.cxx Thu Feb 23 15:52:46 2012
@@ -0,0 +1,215 @@
+/**************************************************************
+ * 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * 
+ *************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_ucb.hxx"
+
+#include <SerfGetReqProcImpl.hxx>
+
+using namespace com::sun::star;
+
+namespace http_dav_ucp
+{
+
+SerfGetReqProcImpl::SerfGetReqProcImpl( const char* inPath,
+                                        const com::sun::star::uno::Reference< SerfInputStream > & xioInStrm )
+    : SerfRequestProcessorImpl( inPath )
+    , xInputStream( xioInStrm )
+    , xOutputStream()
+    , mpHeaderNames( 0 )
+    , mpResource( 0 )
+{
+}
+
+SerfGetReqProcImpl::SerfGetReqProcImpl( const char* inPath,
+                                        const com::sun::star::uno::Reference< SerfInputStream > & xioInStrm,
+                                        const std::vector< ::rtl::OUString > & inHeaderNames,
+                                        DAVResource & ioResource )
+    : SerfRequestProcessorImpl( inPath )
+    , xInputStream( xioInStrm )
+    , xOutputStream()
+    , mpHeaderNames( &inHeaderNames )
+    , mpResource( &ioResource )
+{
+}
+
+SerfGetReqProcImpl::SerfGetReqProcImpl( const char* inPath,
+                                        const com::sun::star::uno::Reference< com::sun::star::io::XOutputStream > & xioOutStrm )
+    : SerfRequestProcessorImpl( inPath )
+    , xInputStream()
+    , xOutputStream( xioOutStrm )
+    , mpHeaderNames( 0 )
+    , mpResource( 0 )
+{
+}
+
+SerfGetReqProcImpl::SerfGetReqProcImpl( const char* inPath,
+                                        const com::sun::star::uno::Reference< com::sun::star::io::XOutputStream > & xioOutStrm,
+                                        const std::vector< ::rtl::OUString > & inHeaderNames,
+                                        DAVResource & ioResource )
+    : SerfRequestProcessorImpl( inPath )
+    , xInputStream()
+    , xOutputStream( xioOutStrm )
+    , mpHeaderNames( &inHeaderNames )
+    , mpResource( &ioResource )
+{
+}
+
+SerfGetReqProcImpl::~SerfGetReqProcImpl()
+{
+}
+
+serf_bucket_t * SerfGetReqProcImpl::createSerfRequestBucket( serf_request_t * inSerfRequest )
+{
+    serf_bucket_alloc_t* pSerfBucketAlloc = serf_request_get_alloc( inSerfRequest );
+
+    // create serf request
+    serf_bucket_t *req_bkt = serf_request_bucket_request_create( inSerfRequest, 
+                                                                 "GET",
+                                                                 getPathStr(),
+                                                                 0,
+                                                                 serf_request_get_alloc( inSerfRequest ) );
+
+    // TODO - correct headers
+    // set request header fields
+    serf_bucket_t* hdrs_bkt = serf_bucket_request_get_headers( req_bkt );
+    serf_bucket_headers_setn( hdrs_bkt, "User-Agent", "www.openoffice.org/ucb/" );
+    serf_bucket_headers_setn( hdrs_bkt, "Accept-Encoding", "gzip");
+
+    return req_bkt;
+}
+
+namespace
+{
+    apr_status_t Serf_ProcessResponseHeader( void* inUserData,
+                                             const char* inHeaderName,
+                                             const char* inHeaderValue )
+    {
+        SerfGetReqProcImpl* pReqProcImpl = static_cast< SerfGetReqProcImpl* >( inUserData );
+        pReqProcImpl->processSingleResponseHeader( inHeaderName,
+                                                   inHeaderValue );
+
+        return APR_SUCCESS;
+    }
+} // end of anonymous namespace
+
+bool SerfGetReqProcImpl::processSerfResponseBucket( serf_request_t * /*inSerfRequest*/,
+                                                    serf_bucket_t * inSerfResponseBucket,
+                                                    apr_pool_t * /*inAprPool*/,
+                                                    apr_status_t & outStatus )
+{
+    const char* data;
+    apr_size_t len;
+
+    while (1) {
+        outStatus = serf_bucket_read(inSerfResponseBucket, 8096, &data, &len);
+        if (SERF_BUCKET_READ_ERROR(outStatus))
+        {
+            return true;
+        }
+
+        if ( len > 0 )
+        {
+            if ( xInputStream.is() )
+            {
+                xInputStream->AddToStream( data, len );
+            }
+            else if ( xOutputStream.is() )
+            {
+                const uno::Sequence< sal_Int8 > aDataSeq( (sal_Int8 *)data, len );
+                xOutputStream->writeBytes( aDataSeq );
+            }
+        }
+
+        /* are we done yet? */
+        if (APR_STATUS_IS_EOF(outStatus)) 
+        {
+            // read response header, if requested
+            if ( mpHeaderNames != 0 && mpResource != 0 )
+            {
+                serf_bucket_t* SerfHeaderBucket = serf_bucket_response_get_headers( inSerfResponseBucket );
+                if ( SerfHeaderBucket != 0 )
+                {
+                    serf_bucket_headers_do( SerfHeaderBucket, 
+                                            Serf_ProcessResponseHeader,
+                                            this );
+                }
+            }
+
+            outStatus = APR_EOF;
+            return true;
+        }
+
+        /* have we drained the response so far? */
+        if ( APR_STATUS_IS_EAGAIN( outStatus ) )
+        {
+            return false;
+        }
+    }
+
+    /* NOTREACHED */
+    return true;
+}
+
+void SerfGetReqProcImpl::processSingleResponseHeader( const char* inHeaderName,
+                                                      const char* inHeaderValue )
+{
+    rtl::OUString aHeaderName( rtl::OUString::createFromAscii( inHeaderName ) );
+
+    bool bStoreHeaderField = false;
+
+    if ( mpHeaderNames->size() == 0 )
+    {
+        // store all header fields
+        bStoreHeaderField = true;
+    }
+    else
+    {
+        // store only header fields which are requested
+        std::vector< ::rtl::OUString >::const_iterator it( mpHeaderNames->begin() );
+        const std::vector< ::rtl::OUString >::const_iterator end( mpHeaderNames->end() );
+
+        while ( it != end )
+        {
+            // header names are case insensitive
+            if ( (*it).equalsIgnoreAsciiCase( aHeaderName ) )
+            {
+                bStoreHeaderField = true;
+                break;
+            }
+            else
+            {
+                ++it;
+            }
+        }
+    }
+
+    if ( bStoreHeaderField )
+    {
+        DAVPropertyValue thePropertyValue;
+        thePropertyValue.IsCaseSensitive = false;
+        thePropertyValue.Name = aHeaderName;
+        thePropertyValue.Value <<= rtl::OUString::createFromAscii( inHeaderValue );
+        mpResource->properties.push_back( thePropertyValue );
+    }
+}
+
+} // namespace http_dav_ucp

Added: incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfGetReqProcImpl.hxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfGetReqProcImpl.hxx?rev=1292832&view=auto
==============================================================================
--- incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfGetReqProcImpl.hxx (added)
+++ incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfGetReqProcImpl.hxx Thu Feb 23 15:52:46 2012
@@ -0,0 +1,78 @@
+/**************************************************************
+ * 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * 
+ *************************************************************/
+
+#ifndef INCLUDED_SERFGETREQPROCIMPL_HXX
+#define INCLUDED_SERFGETREQPROCIMPL_HXX
+
+#include <SerfRequestProcessorImpl.hxx>
+
+#include <vector>
+#include <rtl/ustring.hxx>
+#include <DAVResource.hxx>
+
+#include <SerfInputStream.hxx>
+#include <com/sun/star/io/XOutputStream.hpp>
+
+namespace http_dav_ucp
+{
+
+class SerfGetReqProcImpl : public SerfRequestProcessorImpl
+{
+public:
+    SerfGetReqProcImpl( const char* inPath,
+                        const com::sun::star::uno::Reference< SerfInputStream > & xioInStrm );
+
+    SerfGetReqProcImpl( const char* inPath,
+                        const com::sun::star::uno::Reference< SerfInputStream > & xioInStrm,
+                        const std::vector< ::rtl::OUString > & inHeaderNames,
+                        DAVResource & ioResource );
+
+    SerfGetReqProcImpl( const char* inPath,
+                        const com::sun::star::uno::Reference< com::sun::star::io::XOutputStream > & xioOutStrm );
+
+    SerfGetReqProcImpl( const char* inPath,
+                        const com::sun::star::uno::Reference< com::sun::star::io::XOutputStream > & xioOutStrm,
+                        const std::vector< ::rtl::OUString > & inHeaderNames,
+                        DAVResource & ioResource );
+
+    virtual ~SerfGetReqProcImpl();
+
+    virtual
+    serf_bucket_t * createSerfRequestBucket( serf_request_t * inSerfRequest );
+
+    virtual
+    bool processSerfResponseBucket( serf_request_t * inSerfRequest,
+                                    serf_bucket_t * inSerfResponseBucket,
+                                    apr_pool_t * inAprPool,
+                                    apr_status_t & outStatus );
+
+    void processSingleResponseHeader( const char* inHeaderName,
+                                      const char* inHeaderValue );
+private:
+    com::sun::star::uno::Reference< SerfInputStream > xInputStream;
+    com::sun::star::uno::Reference< com::sun::star::io::XOutputStream > xOutputStream;
+    const std::vector< ::rtl::OUString > * mpHeaderNames;
+    DAVResource* mpResource;
+};
+
+} // namespace http_dav_ucp
+
+#endif // INCLUDED_SERFGETREQPROCIMPL_HXX

Added: incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfHeadReqProcImpl.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfHeadReqProcImpl.cxx?rev=1292832&view=auto
==============================================================================
--- incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfHeadReqProcImpl.cxx (added)
+++ incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfHeadReqProcImpl.cxx Thu Feb 23 15:52:46 2012
@@ -0,0 +1,169 @@
+/**************************************************************
+ * 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * 
+ *************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_ucb.hxx"
+
+#include <SerfHeadReqProcImpl.hxx>
+
+using namespace com::sun::star;
+
+namespace http_dav_ucp
+{
+
+SerfHeadReqProcImpl::SerfHeadReqProcImpl( const char* inPath,
+                                         const std::vector< ::rtl::OUString > & inHeaderNames,
+                                         DAVResource & ioResource )
+    : SerfRequestProcessorImpl( inPath )
+    , mpHeaderNames( &inHeaderNames )
+    , mpResource( &ioResource )
+{
+}
+
+SerfHeadReqProcImpl::~SerfHeadReqProcImpl()
+{
+}
+
+serf_bucket_t * SerfHeadReqProcImpl::createSerfRequestBucket( serf_request_t * inSerfRequest )
+{
+    serf_bucket_alloc_t* pSerfBucketAlloc = serf_request_get_alloc( inSerfRequest );
+
+    // create serf request
+    serf_bucket_t *req_bkt = serf_request_bucket_request_create( inSerfRequest, 
+                                                                 "HEAD",
+                                                                 getPathStr(),
+                                                                 0,
+                                                                 serf_request_get_alloc( inSerfRequest ) );
+
+    // TODO - correct headers
+    // set request header fields
+    serf_bucket_t* hdrs_bkt = serf_bucket_request_get_headers( req_bkt );
+    serf_bucket_headers_setn( hdrs_bkt, "User-Agent", "www.openoffice.org/ucb/" );
+    serf_bucket_headers_setn( hdrs_bkt, "Accept-Encoding", "gzip");
+
+    return req_bkt;
+}
+
+namespace
+{
+    apr_status_t Serf_ProcessResponseHeader( void* inUserData,
+                                             const char* inHeaderName,
+                                             const char* inHeaderValue )
+    {
+        SerfHeadReqProcImpl* pReqProcImpl = static_cast< SerfHeadReqProcImpl* >( inUserData );
+        pReqProcImpl->processSingleResponseHeader( inHeaderName,
+                                                   inHeaderValue );
+
+        return APR_SUCCESS;
+    }
+} // end of anonymous namespace
+
+bool SerfHeadReqProcImpl::processSerfResponseBucket( serf_request_t * /*inSerfRequest*/,
+                                                     serf_bucket_t * inSerfResponseBucket,
+                                                     apr_pool_t * /*inAprPool*/,
+                                                     apr_status_t & outStatus )
+{
+    const char* data;
+    apr_size_t len;
+
+    serf_bucket_t* SerfHeaderBucket = serf_bucket_response_get_headers( inSerfResponseBucket );
+    
+    while ( SerfHeaderBucket )
+    {
+        outStatus = serf_bucket_read(SerfHeaderBucket, 8096, &data, &len);
+        if (SERF_BUCKET_READ_ERROR(outStatus))
+        {
+            return true;
+        }
+
+        /* are we done yet? */
+        if (APR_STATUS_IS_EOF(outStatus)) 
+        {
+            // read response header, if requested
+            if ( mpHeaderNames != 0 && mpResource != 0 )
+            {
+                serf_bucket_t* SerfHeaderBucket = serf_bucket_response_get_headers( inSerfResponseBucket );
+                if ( SerfHeaderBucket != 0 )
+                {
+                    serf_bucket_headers_do( SerfHeaderBucket, 
+                                            Serf_ProcessResponseHeader,
+                                            this );
+                }
+            }
+
+            outStatus = APR_EOF;
+            return true;
+        }
+
+        /* have we drained the response so far? */
+        if ( APR_STATUS_IS_EAGAIN( outStatus ) )
+        {
+            return false;
+        }
+    }
+
+    return true;
+}
+
+void SerfHeadReqProcImpl::processSingleResponseHeader( const char* inHeaderName,
+                                                       const char* inHeaderValue )
+{
+    rtl::OUString aHeaderName( rtl::OUString::createFromAscii( inHeaderName ) );
+
+    bool bStoreHeaderField = false;
+
+    if ( mpHeaderNames->size() == 0 )
+    {
+        // store all header fields
+        bStoreHeaderField = true;
+    }
+    else
+    {
+        // store only header fields which are requested
+        std::vector< ::rtl::OUString >::const_iterator it( mpHeaderNames->begin() );
+        const std::vector< ::rtl::OUString >::const_iterator end( mpHeaderNames->end() );
+
+        while ( it != end )
+        {
+            // header names are case insensitive
+            if ( (*it).equalsIgnoreAsciiCase( aHeaderName ) )
+            {
+                bStoreHeaderField = true;
+                break;
+            }
+            else
+            {
+                ++it;
+            }
+        }
+    }
+
+    if ( bStoreHeaderField )
+    {
+        DAVPropertyValue thePropertyValue;
+        thePropertyValue.IsCaseSensitive = false;
+        thePropertyValue.Name = aHeaderName;
+        thePropertyValue.Value <<= rtl::OUString::createFromAscii( inHeaderValue );
+        mpResource->properties.push_back( thePropertyValue );
+    }
+}
+
+} // namespace http_dav_ucp

Added: incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfHeadReqProcImpl.hxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfHeadReqProcImpl.hxx?rev=1292832&view=auto
==============================================================================
--- incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfHeadReqProcImpl.hxx (added)
+++ incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfHeadReqProcImpl.hxx Thu Feb 23 15:52:46 2012
@@ -0,0 +1,64 @@
+/**************************************************************
+ * 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * 
+ *************************************************************/
+
+#ifndef INCLUDED_SERFHEADREQPROCIMPL_HXX
+#define INCLUDED_SERFHEADREQPROCIMPL_HXX
+
+#include <SerfRequestProcessorImpl.hxx>
+
+#include <vector>
+#include <rtl/ustring.hxx>
+#include <DAVResource.hxx>
+
+#include <SerfInputStream.hxx>
+#include <com/sun/star/io/XOutputStream.hpp>
+
+namespace http_dav_ucp
+{
+
+class SerfHeadReqProcImpl : public SerfRequestProcessorImpl
+{
+public:
+    SerfHeadReqProcImpl( const char* inPath,
+                         const std::vector< ::rtl::OUString > & inHeaderNames,
+                         DAVResource & ioResource );
+
+    virtual ~SerfHeadReqProcImpl();
+
+    virtual
+    serf_bucket_t * createSerfRequestBucket( serf_request_t * inSerfRequest );
+
+    virtual
+    bool processSerfResponseBucket( serf_request_t * inSerfRequest,
+                                    serf_bucket_t * inSerfResponseBucket,
+                                    apr_pool_t * inAprPool,
+                                    apr_status_t & outStatus );
+
+    void processSingleResponseHeader( const char* inHeaderName,
+                                      const char* inHeaderValue );
+private:
+    const std::vector< ::rtl::OUString > * mpHeaderNames;
+    DAVResource* mpResource;
+};
+
+} // namespace http_dav_ucp
+
+#endif // INCLUDED_SERFHEADREQPROCIMPL_HXX

Added: incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfInputStream.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfInputStream.cxx?rev=1292832&view=auto
==============================================================================
--- incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfInputStream.cxx (added)
+++ incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfInputStream.cxx Thu Feb 23 15:52:46 2012
@@ -0,0 +1,191 @@
+/**************************************************************
+ * 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * 
+ *************************************************************/
+
+
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_ucb.hxx"
+#include "SerfInputStream.hxx"
+#include <rtl/memory.h>
+
+using namespace cppu;
+using namespace rtl;
+using namespace com::sun::star::io;
+using namespace com::sun::star::uno;
+using namespace http_dav_ucp;
+
+
+// -------------------------------------------------------------------
+// Constructor
+// -------------------------------------------------------------------
+SerfInputStream::SerfInputStream( void )
+: mLen( 0 ),
+  mPos( 0 )
+{
+}
+
+// -------------------------------------------------------------------
+// Destructor
+// -------------------------------------------------------------------
+SerfInputStream::~SerfInputStream( void )
+{
+}
+
+// -------------------------------------------------------------------
+// AddToStream
+// Allows the caller to add some data to the "end" of the stream
+// -------------------------------------------------------------------
+void SerfInputStream::AddToStream( const char * inBuf, sal_Int32 inLen )
+{
+    mInputBuffer.realloc( sal::static_int_cast<sal_Int32>(mLen) + inLen );
+    rtl_copyMemory( mInputBuffer.getArray() + mLen, inBuf, inLen );
+	mLen += inLen;
+}
+
+// -------------------------------------------------------------------
+// queryInterface
+// -------------------------------------------------------------------
+Any SerfInputStream::queryInterface( const Type &type )
+						throw( RuntimeException )
+{
+	Any aRet = ::cppu::queryInterface( type,
+									   static_cast< XInputStream * >( this ),
+									   static_cast< XSeekable * >( this ) );
+	return aRet.hasValue() ? aRet : OWeakObject::queryInterface( type );
+}
+
+// -------------------------------------------------------------------
+// readBytes
+// "Reads" the specified number of bytes from the stream
+// -------------------------------------------------------------------
+sal_Int32 SAL_CALL SerfInputStream::readBytes(
+  ::com::sun::star::uno::Sequence< sal_Int8 >& aData, sal_Int32 nBytesToRead )
+		throw( ::com::sun::star::io::NotConnectedException,
+			   ::com::sun::star::io::BufferSizeExceededException,
+			   ::com::sun::star::io::IOException,
+			   ::com::sun::star::uno::RuntimeException )
+{
+	// Work out how much we're actually going to write
+	sal_Int32 theBytes2Read = nBytesToRead;
+	sal_Int32 theBytesLeft  = sal::static_int_cast<sal_Int32>(mLen - mPos);
+	if ( theBytes2Read > theBytesLeft )
+		theBytes2Read = theBytesLeft;
+
+	// Realloc buffer.
+	aData.realloc( theBytes2Read );
+
+	// Write the data
+	rtl_copyMemory(
+		aData.getArray(), mInputBuffer.getConstArray() + mPos, theBytes2Read );
+
+	// Update our stream position for next time
+	mPos += theBytes2Read;
+
+    return theBytes2Read;
+}
+
+// -------------------------------------------------------------------
+// readSomeBytes
+// -------------------------------------------------------------------
+sal_Int32 SAL_CALL SerfInputStream::readSomeBytes(
+ ::com::sun::star::uno::Sequence< sal_Int8 >& aData, sal_Int32 nMaxBytesToRead )
+        throw( ::com::sun::star::io::NotConnectedException,
+               ::com::sun::star::io::BufferSizeExceededException,
+               ::com::sun::star::io::IOException,
+               ::com::sun::star::uno::RuntimeException )
+{
+	// Warning: What should this be doing ?
+	return readBytes( aData, nMaxBytesToRead );
+}
+
+// -------------------------------------------------------------------
+// skipBytes
+// Moves the current stream position forward
+// -------------------------------------------------------------------
+void SAL_CALL SerfInputStream::skipBytes( sal_Int32 nBytesToSkip )
+        throw( ::com::sun::star::io::NotConnectedException,
+               ::com::sun::star::io::BufferSizeExceededException,
+               ::com::sun::star::io::IOException,
+               ::com::sun::star::uno::RuntimeException )
+{
+	mPos += nBytesToSkip;
+	if ( mPos >= mLen )
+		mPos = mLen;
+}
+
+// -------------------------------------------------------------------
+// available
+// Returns the number of unread bytes currently remaining on the stream
+// -------------------------------------------------------------------
+sal_Int32 SAL_CALL SerfInputStream::available(  )
+        throw( ::com::sun::star::io::NotConnectedException,
+               ::com::sun::star::io::IOException,
+               ::com::sun::star::uno::RuntimeException )
+{
+	return sal::static_int_cast<sal_Int32>(mLen - mPos);
+}
+
+// -------------------------------------------------------------------
+// closeInput
+// -------------------------------------------------------------------
+void SAL_CALL SerfInputStream::closeInput( void )
+ 		throw( ::com::sun::star::io::NotConnectedException,
+       		   ::com::sun::star::io::IOException,
+       		   ::com::sun::star::uno::RuntimeException )
+{
+}
+
+// -------------------------------------------------------------------
+// seek
+// -------------------------------------------------------------------
+void SAL_CALL SerfInputStream::seek( sal_Int64 location )
+		throw( ::com::sun::star::lang::IllegalArgumentException,
+			   ::com::sun::star::io::IOException,
+			   ::com::sun::star::uno::RuntimeException )
+{
+	if ( location < 0 )
+		throw ::com::sun::star::lang::IllegalArgumentException();
+
+    if ( location <= mLen )
+		mPos = location;
+	else
+        throw ::com::sun::star::lang::IllegalArgumentException();
+}
+
+// -------------------------------------------------------------------
+// getPosition
+// -------------------------------------------------------------------
+sal_Int64 SAL_CALL SerfInputStream::getPosition()
+		throw( ::com::sun::star::io::IOException,
+			   ::com::sun::star::uno::RuntimeException )
+{
+	return mPos;
+}
+
+// -------------------------------------------------------------------
+// getLength
+// -------------------------------------------------------------------
+sal_Int64 SAL_CALL SerfInputStream::getLength()
+		throw( ::com::sun::star::io::IOException,
+			   ::com::sun::star::uno::RuntimeException )
+{
+	return mLen;
+}

Added: incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfInputStream.hxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfInputStream.hxx?rev=1292832&view=auto
==============================================================================
--- incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfInputStream.hxx (added)
+++ incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfInputStream.hxx Thu Feb 23 15:52:46 2012
@@ -0,0 +1,121 @@
+/**************************************************************
+ * 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * 
+ *************************************************************/
+
+
+#ifndef INCLUDED_NEONINPUTSTREAM_HXX
+#define INCLUDED_NEONINPUTSTREAM_HXX
+
+#include <sal/types.h>
+#include <rtl/ustring.hxx>
+#include <cppuhelper/weak.hxx>
+#include <com/sun/star/io/XInputStream.hpp>
+#include <com/sun/star/io/XSeekable.hpp>
+
+
+namespace http_dav_ucp
+{
+
+// -------------------------------------------------------------------
+// SerfInputStream
+// A simple XInputStream implementation provided specifically for use
+// by the DAVSession::GET method.
+// -------------------------------------------------------------------
+class SerfInputStream : public ::com::sun::star::io::XInputStream,
+						public ::com::sun::star::io::XSeekable,
+						public ::cppu::OWeakObject
+{
+	private:
+		com::sun::star::uno::Sequence< sal_Int8 > mInputBuffer;
+		sal_Int64 mLen;
+		sal_Int64 mPos;
+
+	public:
+				 SerfInputStream( void );
+		virtual ~SerfInputStream();
+
+		// Add some data to the end of the stream
+		void AddToStream( const char * inBuf, sal_Int32 inLen );
+
+	// XInterface
+	virtual com::sun::star::uno::Any SAL_CALL queryInterface(
+										const ::com::sun::star::uno::Type & type )
+							throw( ::com::sun::star::uno::RuntimeException );
+
+	virtual void SAL_CALL acquire( void )
+							throw ()
+								{ OWeakObject::acquire(); }
+
+	virtual void SAL_CALL release( void )
+							throw()
+								{ OWeakObject::release(); }
+
+
+	// XInputStream
+	virtual sal_Int32 SAL_CALL readBytes(
+	  		::com::sun::star::uno::Sequence< sal_Int8 > & aData,
+			sal_Int32 nBytesToRead )
+				throw( ::com::sun::star::io::NotConnectedException,
+			   		   ::com::sun::star::io::BufferSizeExceededException,
+			   		   ::com::sun::star::io::IOException,
+			   		   ::com::sun::star::uno::RuntimeException );
+
+	virtual sal_Int32 SAL_CALL readSomeBytes(
+    		::com::sun::star::uno::Sequence< sal_Int8 > & aData,
+			sal_Int32 nMaxBytesToRead )
+        		throw( ::com::sun::star::io::NotConnectedException,
+               		   ::com::sun::star::io::BufferSizeExceededException,
+               		   ::com::sun::star::io::IOException,
+               		   ::com::sun::star::uno::RuntimeException );
+
+	virtual void SAL_CALL skipBytes( sal_Int32 nBytesToSkip )
+        		throw( ::com::sun::star::io::NotConnectedException,
+               		   ::com::sun::star::io::BufferSizeExceededException,
+               		   ::com::sun::star::io::IOException,
+               		   ::com::sun::star::uno::RuntimeException );
+
+	virtual sal_Int32 SAL_CALL available( void )
+        		throw( ::com::sun::star::io::NotConnectedException,
+               		   ::com::sun::star::io::IOException,
+               		   ::com::sun::star::uno::RuntimeException );
+
+	virtual void SAL_CALL closeInput( void )
+        		throw( ::com::sun::star::io::NotConnectedException,
+               		   ::com::sun::star::io::IOException,
+               		   ::com::sun::star::uno::RuntimeException );
+
+	// XSeekable
+	virtual void SAL_CALL seek(	sal_Int64 location )
+		throw( ::com::sun::star::lang::IllegalArgumentException,
+			   ::com::sun::star::io::IOException,
+			   ::com::sun::star::uno::RuntimeException );
+
+	virtual sal_Int64 SAL_CALL getPosition()
+		throw( ::com::sun::star::io::IOException,
+			   ::com::sun::star::uno::RuntimeException );
+
+	virtual sal_Int64 SAL_CALL getLength()
+		throw( ::com::sun::star::io::IOException,
+			   ::com::sun::star::uno::RuntimeException );
+};
+
+} // namespace http_dav_ucp
+
+#endif // INCLUDED_NEONINPUTSTREAM_HXX

Added: incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfLockStore.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfLockStore.cxx?rev=1292832&view=auto
==============================================================================
--- incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfLockStore.cxx (added)
+++ incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfLockStore.cxx Thu Feb 23 15:52:46 2012
@@ -0,0 +1,241 @@
+/**************************************************************
+ * 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * 
+ *************************************************************/
+
+
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_ucb.hxx"
+
+#include <ne_locks.h>
+#include <ne_uri.h>
+#include "rtl/ustring.hxx"
+#include "osl/time.h"
+#include "osl/thread.hxx"
+#include "SerfSession.hxx"
+#include "SerfLockStore.hxx"
+
+using namespace http_dav_ucp;
+
+namespace http_dav_ucp {
+
+class TickerThread : public osl::Thread
+{
+    bool m_bFinish;
+    SerfLockStore & m_rLockStore;
+
+public:
+
+    TickerThread( SerfLockStore & rLockStore )
+    : osl::Thread(), m_bFinish( false ), m_rLockStore( rLockStore ) {}
+
+    void finish() { m_bFinish = true; }
+
+protected:
+
+    virtual void SAL_CALL run();
+};
+
+} // namespace http_dav_ucp
+
+// -------------------------------------------------------------------
+void TickerThread::run()
+{
+    OSL_TRACE( "TickerThread: start." );
+
+    // we have to go through the loop more often to be able to finish ~quickly
+    const int nNth = 25;
+
+    int nCount = nNth;
+    while ( !m_bFinish )
+    {
+        if ( nCount-- <= 0 )
+        {
+            m_rLockStore.refreshLocks();
+            nCount = nNth;
+        }
+
+        TimeValue aTV;
+        aTV.Seconds = 0;
+        aTV.Nanosec = 1000000000 / nNth;
+        wait( aTV );
+    }
+
+    OSL_TRACE( "TickerThread: stop." );
+}
+
+// -------------------------------------------------------------------
+SerfLockStore::SerfLockStore()
+    : m_pSerfLockStore( ne_lockstore_create() ),
+      m_pTickerThread( 0 )
+{
+    OSL_ENSURE( m_pSerfLockStore, "Unable to create neon lock store!" );
+}
+
+// -------------------------------------------------------------------
+SerfLockStore::~SerfLockStore()
+{
+    stopTicker();
+
+    // release active locks, if any.
+    OSL_ENSURE( m_aLockInfoMap.size() == 0,
+                "SerfLockStore::~SerfLockStore - Releasing active locks!" );
+
+    LockInfoMap::const_iterator it( m_aLockInfoMap.begin() );
+    const LockInfoMap::const_iterator end( m_aLockInfoMap.end() );
+    while ( it != end )
+    {
+        SerfLock * pLock = (*it).first;
+        (*it).second.xSession->UNLOCK( pLock );
+
+        ne_lockstore_remove( m_pSerfLockStore, pLock );
+        ne_lock_destroy( pLock );
+
+        ++it;
+    }
+
+    ne_lockstore_destroy( m_pSerfLockStore );
+}
+
+// -------------------------------------------------------------------
+void SerfLockStore::startTicker()
+{
+    osl::MutexGuard aGuard( m_aMutex );
+
+    if ( !m_pTickerThread )
+    {
+        m_pTickerThread = new TickerThread( *this );
+        m_pTickerThread->create();
+    }
+}
+
+// -------------------------------------------------------------------
+void SerfLockStore::stopTicker()
+{
+    osl::MutexGuard aGuard( m_aMutex );
+
+    if ( m_pTickerThread )
+    {
+        m_pTickerThread->finish();
+        m_pTickerThread->join();
+        delete m_pTickerThread;
+        m_pTickerThread = 0;
+    }
+}
+
+// -------------------------------------------------------------------
+void SerfLockStore::registerSession( HttpSession * pHttpSession )
+{
+    osl::MutexGuard aGuard( m_aMutex );
+
+    ne_lockstore_register( m_pSerfLockStore, pHttpSession );
+}
+
+// -------------------------------------------------------------------
+SerfLock * SerfLockStore::findByUri( rtl::OUString const & rUri )
+{
+    osl::MutexGuard aGuard( m_aMutex );
+
+    ne_uri aUri;
+    ne_uri_parse( rtl::OUStringToOString(
+        rUri, RTL_TEXTENCODING_UTF8 ).getStr(), &aUri );
+    return ne_lockstore_findbyuri( m_pSerfLockStore, &aUri );
+}
+
+// -------------------------------------------------------------------
+void SerfLockStore::addLock( SerfLock * pLock,
+                             rtl::Reference< SerfSession > const & xSession,
+                             sal_Int32 nLastChanceToSendRefreshRequest )
+{
+    osl::MutexGuard aGuard( m_aMutex );
+
+    ne_lockstore_add( m_pSerfLockStore, pLock );
+    m_aLockInfoMap[ pLock ]
+        = LockInfo( xSession, nLastChanceToSendRefreshRequest );
+
+    startTicker();
+}
+
+// -------------------------------------------------------------------
+void SerfLockStore::updateLock( SerfLock * pLock,
+                                sal_Int32 nLastChanceToSendRefreshRequest )
+{
+    osl::MutexGuard aGuard( m_aMutex );
+
+    LockInfoMap::iterator it( m_aLockInfoMap.find( pLock ) );
+    OSL_ENSURE( it != m_aLockInfoMap.end(),
+                "SerfLockStore::updateLock: lock not found!" );
+
+    if ( it != m_aLockInfoMap.end() )
+    {
+        (*it).second.nLastChanceToSendRefreshRequest
+            = nLastChanceToSendRefreshRequest;
+    }
+}
+
+// -------------------------------------------------------------------
+void SerfLockStore::removeLock( SerfLock * pLock )
+{
+    osl::MutexGuard aGuard( m_aMutex );
+
+    m_aLockInfoMap.erase( pLock );
+    ne_lockstore_remove( m_pSerfLockStore, pLock );
+
+    if ( m_aLockInfoMap.size() == 0 )
+        stopTicker();
+}
+
+// -------------------------------------------------------------------
+void SerfLockStore::refreshLocks()
+{
+    osl::MutexGuard aGuard( m_aMutex );
+
+    LockInfoMap::iterator it( m_aLockInfoMap.begin() );
+    const LockInfoMap::const_iterator end( m_aLockInfoMap.end() );
+    while ( it != end )
+    {
+        LockInfo & rInfo = (*it).second;
+        if ( rInfo.nLastChanceToSendRefreshRequest != -1 )
+        {
+            // 30 seconds or less remaining until lock expires?
+            TimeValue t1;
+            osl_getSystemTime( &t1 );
+            if ( rInfo.nLastChanceToSendRefreshRequest - 30
+                     <= sal_Int32( t1.Seconds ) )
+            {
+                // refresh the lock.
+                sal_Int32 nlastChanceToSendRefreshRequest = -1;
+                if ( rInfo.xSession->LOCK(
+                         (*it).first,
+                         /* out param */ nlastChanceToSendRefreshRequest ) )
+                {
+                    rInfo.nLastChanceToSendRefreshRequest
+                        = nlastChanceToSendRefreshRequest;
+                }
+                else
+                {
+                    // refresh failed. stop auto-refresh.
+                    rInfo.nLastChanceToSendRefreshRequest = -1;
+                }
+            }
+        }
+        ++it;
+    }
+}

Added: incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfLockStore.hxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfLockStore.hxx?rev=1292832&view=auto
==============================================================================
--- incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfLockStore.hxx (added)
+++ incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfLockStore.hxx Thu Feb 23 15:52:46 2012
@@ -0,0 +1,97 @@
+/**************************************************************
+ * 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * 
+ *************************************************************/
+
+
+#ifndef INCLUDED_SERFLOCKSTORE_HXX
+#define INCLUDED_SERFLOCKSTORE_HXX
+
+#include <map>
+#include "osl/mutex.hxx"
+#include "rtl/ref.hxx"
+#include "SerfTypes.hxx"
+
+namespace http_dav_ucp
+{
+
+class TickerThread;
+class SerfSession;
+
+struct ltptr
+{
+    bool operator()( const SerfLock * p1, const SerfLock * p2 ) const
+    {
+        return p1 < p2;
+    }
+};
+
+typedef struct _LockInfo
+{
+    rtl::Reference< SerfSession > xSession;
+    sal_Int32 nLastChanceToSendRefreshRequest;
+
+    _LockInfo()
+        : nLastChanceToSendRefreshRequest( -1 ) {}
+
+    _LockInfo( rtl::Reference< SerfSession > const & _xSession,
+              sal_Int32 _nLastChanceToSendRefreshRequest )
+    : xSession( _xSession ),
+      nLastChanceToSendRefreshRequest( _nLastChanceToSendRefreshRequest ) {}
+
+} LockInfo;
+
+typedef std::map< SerfLock *, LockInfo, ltptr > LockInfoMap;
+
+class SerfLockStore
+{
+    osl::Mutex         m_aMutex;
+//    ne_lock_store    * m_pSerfLockStore;
+    TickerThread     * m_pTickerThread;
+    LockInfoMap        m_aLockInfoMap;
+
+public:
+    SerfLockStore();
+    ~SerfLockStore();
+
+    void registerSession( HttpSession * pHttpSession );
+
+    SerfLock * findByUri( rtl::OUString const & rUri );
+
+    void addLock( SerfLock * pLock,
+                  rtl::Reference< SerfSession > const & xSession,
+                  // time in seconds since Jan 1 1970
+                  // -1: infinite lock, no refresh
+                  sal_Int32 nLastChanceToSendRefreshRequest );
+
+    void updateLock( SerfLock * pLock,
+                     sal_Int32 nLastChanceToSendRefreshRequest );
+
+    void removeLock( SerfLock * pLock );
+
+    void refreshLocks();
+
+private:
+    void startTicker();
+    void stopTicker();
+};
+
+} // namespace http_dav_ucp
+
+#endif // INCLUDED_SERFLOCKSTORE_HXX

Added: incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfMkColReqProcImpl.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfMkColReqProcImpl.cxx?rev=1292832&view=auto
==============================================================================
--- incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfMkColReqProcImpl.cxx (added)
+++ incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfMkColReqProcImpl.cxx Thu Feb 23 15:52:46 2012
@@ -0,0 +1,95 @@
+/**************************************************************
+ * 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * 
+ *************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_ucb.hxx"
+
+#include <SerfMkColReqProcImpl.hxx>
+
+#include <serf.h>
+
+namespace http_dav_ucp
+{
+
+SerfMkColReqProcImpl::SerfMkColReqProcImpl( const char* inPath )
+    : SerfRequestProcessorImpl( inPath )
+{
+}
+
+SerfMkColReqProcImpl::~SerfMkColReqProcImpl()
+{
+}
+
+serf_bucket_t * SerfMkColReqProcImpl::createSerfRequestBucket( serf_request_t * inSerfRequest )
+{
+    serf_bucket_alloc_t* pSerfBucketAlloc = serf_request_get_alloc( inSerfRequest );
+
+    // create serf request
+    serf_bucket_t *req_bkt = serf_request_bucket_request_create( inSerfRequest, 
+                                                                 "MKCOL",
+                                                                 getPathStr(),
+                                                                 0,
+                                                                 serf_request_get_alloc( inSerfRequest ) );
+
+    // TODO - correct headers
+    // set request header fields
+    serf_bucket_t* hdrs_bkt = serf_bucket_request_get_headers( req_bkt );
+    serf_bucket_headers_setn( hdrs_bkt, "User-Agent", "www.openoffice.org/ucb/" );
+    serf_bucket_headers_setn( hdrs_bkt, "Accept-Encoding", "gzip");
+
+    return req_bkt;
+}
+
+
+bool SerfMkColReqProcImpl::processSerfResponseBucket( serf_request_t * /*inSerfRequest*/,
+                                                       serf_bucket_t * inSerfResponseBucket,
+                                                       apr_pool_t * /*inAprPool*/,
+                                                       apr_status_t & outStatus )
+{
+    const char* data;
+    apr_size_t len;
+
+    while (1) {
+        outStatus = serf_bucket_read(inSerfResponseBucket, 8096, &data, &len);
+        if (SERF_BUCKET_READ_ERROR(outStatus))
+        {
+            return true;
+        }
+
+        /* are we done yet? */
+        if (APR_STATUS_IS_EOF(outStatus)) 
+        {
+            outStatus = APR_EOF;
+            return true;
+        }
+
+        /* have we drained the response so far? */
+        if ( APR_STATUS_IS_EAGAIN( outStatus ) )
+        {
+            return false;
+        }
+    }
+
+    /* NOTREACHED */
+    return true;
+}
+
+} // namespace http_dav_ucp

Added: incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfMkColReqProcImpl.hxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfMkColReqProcImpl.hxx?rev=1292832&view=auto
==============================================================================
--- incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfMkColReqProcImpl.hxx (added)
+++ incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfMkColReqProcImpl.hxx Thu Feb 23 15:52:46 2012
@@ -0,0 +1,50 @@
+/**************************************************************
+ * 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * 
+ *************************************************************/
+
+#ifndef INCLUDED_SERFMKCOLREQPROCIMPL_HXX
+#define INCLUDED_SERFMKCOLREQPROCIMPL_HXX
+
+#include <SerfRequestProcessorImpl.hxx>
+
+namespace http_dav_ucp
+{
+
+class SerfMkColReqProcImpl : public SerfRequestProcessorImpl
+{
+public:
+    SerfMkColReqProcImpl( const char* inPath );
+
+    virtual ~SerfMkColReqProcImpl();
+
+    virtual
+    serf_bucket_t * createSerfRequestBucket( serf_request_t * inSerfRequest );
+
+    virtual
+    bool processSerfResponseBucket( serf_request_t * inSerfRequest,
+                                    serf_bucket_t * inSerfResponseBucket,
+                                    apr_pool_t * inAprPool,
+                                    apr_status_t & outStatus );
+
+};
+
+} // namespace http_dav_ucp
+
+#endif // INCLUDED_SERFMKCOLREQPROCIMPL_HXX

Added: incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfMoveReqProcImpl.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfMoveReqProcImpl.cxx?rev=1292832&view=auto
==============================================================================
--- incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfMoveReqProcImpl.cxx (added)
+++ incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfMoveReqProcImpl.cxx Thu Feb 23 15:52:46 2012
@@ -0,0 +1,110 @@
+/**************************************************************
+ * 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * 
+ *************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_ucb.hxx"
+
+#include <SerfMoveReqProcImpl.hxx>
+
+#include <serf.h>
+
+namespace http_dav_ucp
+{
+
+SerfMoveReqProcImpl::SerfMoveReqProcImpl( const char* inSourcePath,
+                                          const char* inDestinationPath,
+                                          const bool inOverwrite )
+    : SerfRequestProcessorImpl( inSourcePath )
+    , mDestPathStr( inDestinationPath )
+    , mbOverwrite( inOverwrite )
+{
+}
+
+SerfMoveReqProcImpl::~SerfMoveReqProcImpl()
+{
+}
+
+serf_bucket_t * SerfMoveReqProcImpl::createSerfRequestBucket( serf_request_t * inSerfRequest )
+{
+    serf_bucket_alloc_t* pSerfBucketAlloc = serf_request_get_alloc( inSerfRequest );
+
+    // create serf request
+    serf_bucket_t *req_bkt = serf_request_bucket_request_create( inSerfRequest, 
+                                                                 "MOVE",
+                                                                 getPathStr(),
+                                                                 0,
+                                                                 serf_request_get_alloc( inSerfRequest ) );
+
+    // TODO - correct headers
+    // set request header fields
+    serf_bucket_t* hdrs_bkt = serf_bucket_request_get_headers( req_bkt );
+    serf_bucket_headers_setn( hdrs_bkt, "User-Agent", "www.openoffice.org/ucb/" );
+    serf_bucket_headers_setn( hdrs_bkt, "Accept-Encoding", "gzip");
+    
+    // MOVE specific header fields
+    serf_bucket_headers_setn( hdrs_bkt, "Destination", mDestPathStr );
+    if ( mbOverwrite )
+    {
+        serf_bucket_headers_setn( hdrs_bkt, "Overwrite", "T" );
+    }
+    else
+    {
+        serf_bucket_headers_setn( hdrs_bkt, "Overwrite", "F" );
+    }
+
+    return req_bkt;
+}
+
+
+bool SerfMoveReqProcImpl::processSerfResponseBucket( serf_request_t * /*inSerfRequest*/,
+                                                       serf_bucket_t * inSerfResponseBucket,
+                                                       apr_pool_t * /*inAprPool*/,
+                                                       apr_status_t & outStatus )
+{
+    const char* data;
+    apr_size_t len;
+
+    while (1) {
+        outStatus = serf_bucket_read(inSerfResponseBucket, 8096, &data, &len);
+        if (SERF_BUCKET_READ_ERROR(outStatus))
+        {
+            return true;
+        }
+
+        /* are we done yet? */
+        if (APR_STATUS_IS_EOF(outStatus)) 
+        {
+            outStatus = APR_EOF;
+            return true;
+        }
+
+        /* have we drained the response so far? */
+        if ( APR_STATUS_IS_EAGAIN( outStatus ) )
+        {
+            return false;
+        }
+    }
+
+    /* NOTREACHED */
+    return true;
+}
+
+} // namespace http_dav_ucp

Added: incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfMoveReqProcImpl.hxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfMoveReqProcImpl.hxx?rev=1292832&view=auto
==============================================================================
--- incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfMoveReqProcImpl.hxx (added)
+++ incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfMoveReqProcImpl.hxx Thu Feb 23 15:52:46 2012
@@ -0,0 +1,55 @@
+/**************************************************************
+ * 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * 
+ *************************************************************/
+
+#ifndef INCLUDED_SERFMOVEREQPROCIMPL_HXX
+#define INCLUDED_SERFMOVEREQPROCIMPL_HXX
+
+#include <SerfRequestProcessorImpl.hxx>
+
+namespace http_dav_ucp
+{
+
+class SerfMoveReqProcImpl : public SerfRequestProcessorImpl
+{
+public:
+    SerfMoveReqProcImpl( const char* inSourcePath,
+                         const char* inDestinationPath,
+                         const bool inOverwrite );
+
+    virtual ~SerfMoveReqProcImpl();
+
+    virtual
+    serf_bucket_t * createSerfRequestBucket( serf_request_t * inSerfRequest );
+
+    virtual
+    bool processSerfResponseBucket( serf_request_t * inSerfRequest,
+                                    serf_bucket_t * inSerfResponseBucket,
+                                    apr_pool_t * inAprPool,
+                                    apr_status_t & outStatus );
+
+private:
+    const char* mDestPathStr;
+    const bool mbOverwrite;
+};
+
+} // namespace http_dav_ucp
+
+#endif // INCLUDED_SERFMOVEREQPROCIMPL_HXX



Mime
View raw message