1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
19 #ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_HSQLDB_HSTORAGEMAP_HXX
20 #define INCLUDED_CONNECTIVITY_SOURCE_INC_HSQLDB_HSTORAGEMAP_HXX
22 #include <sal/config.h>
27 #include <com/sun/star/embed/XStorage.hpp>
28 #include <com/sun/star/embed/XTransactionListener.hpp>
29 #include <com/sun/star/io/XStream.hpp>
30 #include <com/sun/star/io/XOutputStream.hpp>
31 #include <com/sun/star/io/XInputStream.hpp>
32 #include <com/sun/star/io/XSeekable.hpp>
34 #include <uno/environment.hxx>
36 namespace connectivity
43 css::uno::Reference
< css::io::XStream
> m_xStream
;
44 css::uno::Reference
< css::io::XSeekable
> m_xSeek
;
45 css::uno::Reference
< css::io::XOutputStream
> m_xOutputStream
;
46 css::uno::Reference
< css::io::XInputStream
> m_xInputStream
;
48 StreamHelper(const css::uno::Reference
< css::io::XStream
>& _xStream
);
51 css::uno::Reference
< css::io::XInputStream
> const & getInputStream();
52 css::uno::Reference
< css::io::XOutputStream
> const & getOutputStream();
53 css::uno::Reference
< css::io::XSeekable
> const & getSeek();
57 typedef std::map
< OUString
, std::shared_ptr
<StreamHelper
> > TStreamMap
;
60 css::uno::Reference
<css::embed::XStorage
> storage
;
61 css::uno::Environment storageEnvironment
;
65 css::uno::Reference
<css::embed::XStorage
> mapStorage() const;
68 typedef std::map
<OUString
, StorageData
> TStorages
;
69 /** contains all storages so far accessed.
71 class StorageContainer
74 static OUString
registerStorage(const css::uno::Reference
< css::embed::XStorage
>& _xStorage
,const OUString
& _sURL
);
75 static TStorages::mapped_type
getRegisteredStorage(const OUString
& _sKey
);
76 static OUString
getRegisteredKey(const css::uno::Reference
< css::embed::XStorage
>& _xStorage
);
77 static void revokeStorage(const OUString
& _sKey
,const css::uno::Reference
< css::embed::XTransactionListener
>& _xListener
);
79 static TStreamMap::mapped_type
registerStream(JNIEnv
* env
,jstring name
, jstring key
,sal_Int32 _nMode
);
80 static void revokeStream(JNIEnv
* env
,jstring name
, jstring key
);
81 static TStreamMap::mapped_type
getRegisteredStream( JNIEnv
* env
, jstring name
, jstring key
);
83 static OUString
jstring2ustring(JNIEnv
* env
, jstring jstr
);
84 static OUString
removeURLPrefix(const OUString
& _sURL
,const OUString
& _sFileURL
);
85 static OUString
removeOldURLPrefix(const OUString
& _sURL
);
86 static void throwJavaException(const css::uno::Exception
& _aException
,JNIEnv
* env
);
92 } // namespace connectivity
95 #endif // INCLUDED_CONNECTIVITY_SOURCE_INC_HSQLDB_HSTORAGEMAP_HXX
97 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */