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 .
22 module com
{ module sun
{ module star
{ module embed
{
24 /** This interface represents main storage functionality.
26 published
interface XStorage
29 /** allows to get list of child elements and to check if an element with a
30 specified name exists in a storage.
33 It is also possible to use this interface to get read access to
35 com::sun::star::container::XNameAccess::getByName()
36 call. But the recommended way is to use XStorage
37 interface for this purpose.
40 interface ::com
::sun
::star
::container
::XNameAccess
;
42 /** allows to control and track lifetime of the storage.
45 In case a storage is disposed any call to its methods should result
46 in com::sun::star::lang::DisposedException.
49 interface ::com
::sun
::star
::lang
::XComponent
;
53 /** allows to copy current storage to another one
56 The destination storage contents are overwritten.
57 After the successful copying the target storage is automatically
58 committed if it implements transacted access.
62 a destination storage this storage must be copied to.
64 @throws ::com::sun::star::embed::InvalidStorageException
65 this storage is in invalid state for any reason
67 @throws ::com::sun::star::lang::IllegalArgumentException
68 an illegal argument is provided
70 @throws ::com::sun::star::io::IOException
71 in case of io errors during copying
73 @throws ::com::sun::star::embed::StorageWrappedTargetException
74 wraps other exception acquired during copying
76 void copyToStorage
( [in] XStorage xDest
)
77 raises
( ::com
::sun
::star
::embed
::InvalidStorageException
,
78 ::com
::sun
::star
::lang
::IllegalArgumentException
,
79 ::com
::sun
::star
::io
::IOException
,
80 ::com
::sun
::star
::embed
::StorageWrappedTargetException
);
82 /** allows to get access to a child stream of the storage.
85 In case the stream is open in readonly mode the
86 com::sun::star::io::XStream::getOutputStream()
87 method will return an empty reference.
91 the name of the substream that should be open
94 a mode the stream should be open in,
95 can be a combination of ElementModes values
97 @throws ::com::sun::star::embed::InvalidStorageException
98 this storage is in invalid state for any reason
100 @throws ::com::sun::star::lang::IllegalArgumentException
101 one of provided arguments is illegal
103 @throws ::com::sun::star::packages::WrongPasswordException
104 the provided password is wrong
106 @throws ::com::sun::star::io::IOException
107 in case of io errors during stream opening
109 @throws ::com::sun::star::embed::StorageWrappedTargetException
110 wraps other exceptions
112 ::com
::sun
::star
::io
::XStream openStreamElement
(
113 [in] string sStreamName
,
114 [in] long nOpenMode
)
115 raises
( ::com
::sun
::star
::embed
::InvalidStorageException
,
116 ::com
::sun
::star
::lang
::IllegalArgumentException
,
117 ::com
::sun
::star
::packages
::WrongPasswordException
,
118 ::com
::sun
::star
::io
::IOException
,
119 ::com
::sun
::star
::embed
::StorageWrappedTargetException
);
121 /** allows to get access to a child encrypted stream with password.
124 If storage does not allow any encryption this method will always throw
125 com::sun::star::packages::NoEncryptionException.
129 In case the stream is open in readonly mode the
130 com::sun::star::io::XStream::getOutputStream()
131 method will return an empty reference.
135 the name of the substream that should be open
138 a mode the stream should be open in,
139 can be a combination of ElementModes values
142 this parameter allows to specify a reading password for the
143 stream, the password must be a correct one, otherwise an
144 exception will be thrown
146 @throws ::com::sun::star::embed::InvalidStorageException
147 this storage is in invalid state for any reason
149 @throws ::com::sun::star::lang::IllegalArgumentException
150 one of provided arguments is illegal
152 @throws ::com::sun::star::packages::NoEncryptionException
153 the stream is not encrypted
155 @throws ::com::sun::star::packages::WrongPasswordException
156 the provided password is wrong
158 @throws ::com::sun::star::io::IOException
159 in case of io errors during stream opening
161 @throws ::com::sun::star::embed::StorageWrappedTargetException
162 wraps other exceptions
164 ::com
::sun
::star
::io
::XStream openEncryptedStreamElement
(
165 [in] string sStreamName
,
167 [in] string sPassword
)
168 raises
( ::com
::sun
::star
::embed
::InvalidStorageException
,
169 ::com
::sun
::star
::lang
::IllegalArgumentException
,
170 ::com
::sun
::star
::packages
::NoEncryptionException
,
171 ::com
::sun
::star
::packages
::WrongPasswordException
,
172 ::com
::sun
::star
::io
::IOException
,
173 ::com
::sun
::star
::embed
::StorageWrappedTargetException
);
175 /** allows to get access to a child storage.
178 The opened substorage must support specified in "nOpenMode" access
179 modes. It can support "read" mode in addition. But any child element
180 can support one of those modes only in case this mode is supported by
185 the name of the storage that should be open
188 a mode the storage should be open in
190 @throws ::com::sun::star::embed::InvalidStorageException
191 this storage is in invalid state for any reason
193 @throws ::com::sun::star::lang::IllegalArgumentException
194 one of provided arguments is illegal
196 @throws ::com::sun::star::io::IOException
197 in case of io errors during stream opening
199 @throws ::com::sun::star::embed::StorageWrappedTargetException
200 wraps other exceptions
203 XStorage openStorageElement
( [in] string sStorName
,
204 [in] long nOpenMode
)
205 raises
( ::com
::sun
::star
::embed
::InvalidStorageException
,
206 ::com
::sun
::star
::lang
::IllegalArgumentException
,
207 ::com
::sun
::star
::io
::IOException
,
208 ::com
::sun
::star
::embed
::StorageWrappedTargetException
);
210 /** allows to get readonly copy of a child stream of the storage.
213 The stream is open in readonly mode so the
214 com::sun::star::io::XStream::getOutputStream()
215 method will return an empty reference.
219 the name of the substream that should be copied
221 @throws ::com::sun::star::embed::InvalidStorageException
222 this storage is in invalid state for any reason
224 @throws ::com::sun::star::lang::IllegalArgumentException
225 one of provided arguments is illegal
227 @throws ::com::sun::star::packages::WrongPasswordException
228 the provided password is wrong
230 @throws ::com::sun::star::io::IOException
231 in case of io errors during stream opening
233 @throws ::com::sun::star::embed::StorageWrappedTargetException
234 wraps other exceptions
236 ::com
::sun
::star
::io
::XStream cloneStreamElement
( [in] string sStreamName
)
237 raises
( ::com
::sun
::star
::embed
::InvalidStorageException
,
238 ::com
::sun
::star
::lang
::IllegalArgumentException
,
239 ::com
::sun
::star
::packages
::WrongPasswordException
,
240 ::com
::sun
::star
::io
::IOException
,
241 ::com
::sun
::star
::embed
::StorageWrappedTargetException
);
243 /** allows to get readonly copy of a child encrypted stream with password.
246 If storage does not allow any encryption this method will always throw
247 com::sun::star::packages::NoEncryptionException.
251 The stream is open in readonly mode so the
252 com::sun::star::io::XStream::getOutputStream()
253 method will return an empty reference.
257 This method allows to specify reading password for the child stream
262 the name of the substream that should be copied
265 this parameter allows to specify a reading password for the
266 stream, the password must be a correct one, otherwise an
267 exception will be thrown
269 @throws ::com::sun::star::embed::InvalidStorageException
270 this storage is in invalid state for any reason
272 @throws ::com::sun::star::lang::IllegalArgumentException
273 one of provided arguments is illegal
275 @throws ::com::sun::star::packages::NoEncryptionException
276 the stream is not encrypted
278 @throws ::com::sun::star::packages::WrongPasswordException
279 the provided password is wrong
281 @throws ::com::sun::star::io::IOException
282 in case of io errors during stream opening
284 @throws ::com::sun::star::embed::StorageWrappedTargetException
285 wraps other exceptions
287 ::com
::sun
::star
::io
::XStream cloneEncryptedStreamElement
(
288 [in] string sStreamName
,
289 [in] string sPassword
)
290 raises
( ::com
::sun
::star
::embed
::InvalidStorageException
,
291 ::com
::sun
::star
::lang
::IllegalArgumentException
,
292 ::com
::sun
::star
::packages
::NoEncryptionException
,
293 ::com
::sun
::star
::packages
::WrongPasswordException
,
294 ::com
::sun
::star
::io
::IOException
,
295 ::com
::sun
::star
::embed
::StorageWrappedTargetException
);
297 /** allows to get copy of this storage at the state of its last commit.
300 This method makes sense only for services implementations that allow
301 transaction in the storage.
304 @param xTargetStorage
305 the target storage that will be filled in with copy.
307 @throws ::com::sun::star::embed::InvalidStorageException
308 this storage is in invalid state for any reason
310 @throws ::com::sun::star::lang::IllegalArgumentException
311 one of provided arguments is illegal
313 @throws ::com::sun::star::io::IOException
314 in case of io errors during copying
316 @throws ::com::sun::star::embed::StorageWrappedTargetException
317 wraps other exceptions
320 void copyLastCommitTo
( [in] XStorage xTargetStorage
)
321 raises
( ::com
::sun
::star
::embed
::InvalidStorageException
,
322 ::com
::sun
::star
::lang
::IllegalArgumentException
,
323 ::com
::sun
::star
::io
::IOException
,
324 ::com
::sun
::star
::embed
::StorageWrappedTargetException
);
326 /** allows to get copy of a child storage at the state of its last commit.
329 This method makes sense only for services implementations that allow
330 transaction in the storage.
334 the name of the storage that should be copied
336 @param xTargetStorage
337 the target storage that will be filled in with copy
339 @throws ::com::sun::star::embed::InvalidStorageException
340 this storage is in invalid state for any reason
342 @throws ::com::sun::star::lang::IllegalArgumentException
343 one of provided arguments is illegal
345 @throws ::com::sun::star::io::IOException
346 in case of io errors during copying
348 @throws ::com::sun::star::embed::StorageWrappedTargetException
349 wraps other exceptions
352 void copyStorageElementLastCommitTo
(
353 [in] string sStorName
,
354 [in] XStorage xTargetStorage
)
355 raises
( ::com
::sun
::star
::embed
::InvalidStorageException
,
356 ::com
::sun
::star
::lang
::IllegalArgumentException
,
357 ::com
::sun
::star
::io
::IOException
,
358 ::com
::sun
::star
::embed
::StorageWrappedTargetException
);
360 /** allows to check if an element is a child stream with specified name.
363 In case there is no child element with such name an exception will be
368 the name of the element to check
371 `TRUE` in case the element is a stream
372 `FALSE` - the element is a storage
374 @throws ::com::sun::star::container::NoSuchElementException
375 there is no element with such name
377 @throws ::com::sun::star::lang::IllegalArgumentException
378 an illegal argument is provided
380 @throws ::com::sun::star::embed::InvalidStorageException
381 this storage is in invalid state for any reason
384 boolean isStreamElement
( [in] string sElementName
)
385 raises
( ::com
::sun
::star
::container
::NoSuchElementException
,
386 ::com
::sun
::star
::lang
::IllegalArgumentException
,
387 ::com
::sun
::star
::embed
::InvalidStorageException
);
390 /** allows to check if an element is a child storage with specified name.
393 In case there is no child element with such name an exception will be
398 the name of the element to check
401 `TRUE` in case the element is a storage
402 `FALSE` - the element is a stream
404 @throws ::com::sun::star::container::NoSuchElementException
405 there is no element with such name
407 @throws ::com::sun::star::lang::IllegalArgumentException
408 an illegal argument is provided
410 @throws ::com::sun::star::embed::InvalidStorageException
411 this storage is in invalid state for any reason
414 boolean isStorageElement
( [in] string sElementName
)
415 raises
( ::com
::sun
::star
::container
::NoSuchElementException
,
416 ::com
::sun
::star
::lang
::IllegalArgumentException
,
417 ::com
::sun
::star
::embed
::InvalidStorageException
);
419 /** removes an element from a storage.
422 the name of the element to remove
424 @throws ::com::sun::star::embed::InvalidStorageException
425 this storage is in invalid state for any reason
427 @throws ::com::sun::star::lang::IllegalArgumentException
428 an illegal argument is provided
430 @throws ::com::sun::star::container::NoSuchElementException
431 there is no element with such name
433 @throws ::com::sun::star::io::IOException
434 in case of io errors during removing
436 @throws ::com::sun::star::embed::StorageWrappedTargetException
437 wraps other exceptions
440 void removeElement
( [in] string sElementName
)
441 raises
( ::com
::sun
::star
::embed
::InvalidStorageException
,
442 ::com
::sun
::star
::lang
::IllegalArgumentException
,
443 ::com
::sun
::star
::container
::NoSuchElementException
,
444 ::com
::sun
::star
::io
::IOException
,
445 ::com
::sun
::star
::embed
::StorageWrappedTargetException
);
447 /** renames an element in a storage.
450 the old name of the element to rename
453 the new name of the element to rename
455 @throws ::com::sun::star::embed::InvalidStorageException
456 this storage is in invalid state for any reason
458 @throws ::com::sun::star::lang::IllegalArgumentException
459 an illegal argument is provided
461 @throws ::com::sun::star::container::NoSuchElementException
462 there is no element with old name in this storage
464 @throws ::com::sun::star::container::ElementExistException
465 an element with new name already exists in this storage
467 @throws ::com::sun::star::io::IOException
468 in case of io errors during renaming
470 @throws ::com::sun::star::embed::StorageWrappedTargetException
471 wraps other exceptions
474 void renameElement
( [in] string sElementName
, [in] string sNewName
)
475 raises
( ::com
::sun
::star
::embed
::InvalidStorageException
,
476 ::com
::sun
::star
::lang
::IllegalArgumentException
,
477 ::com
::sun
::star
::container
::NoSuchElementException
,
478 ::com
::sun
::star
::container
::ElementExistException
,
479 ::com
::sun
::star
::io
::IOException
,
480 ::com
::sun
::star
::embed
::StorageWrappedTargetException
);
482 /** allows to copy an entry from one storage to another.
485 If target element supports transacted mode it must be committed by this
486 method after successful copying.
490 the name of the element in this storage
493 a destination storage
496 the name of the result element in destination storage
498 @throws ::com::sun::star::embed::InvalidStorageException
499 this storage is in invalid state for any reason
501 @throws ::com::sun::star::container::NoSuchElementException
502 there is no specified source element in this storage
504 @throws ::com::sun::star::container::ElementExistException
505 an element with specified destination name already exists in destination storage
507 @throws ::com::sun::star::io::IOException
508 in case of io errors during copying
510 @throws ::com::sun::star::embed::StorageWrappedTargetException
511 wraps other exceptions
515 [in] string sElementName
,
517 [in] string sNewName
)
518 raises
( ::com
::sun
::star
::embed
::InvalidStorageException
,
519 ::com
::sun
::star
::lang
::IllegalArgumentException
,
520 ::com
::sun
::star
::container
::NoSuchElementException
,
521 ::com
::sun
::star
::container
::ElementExistException
,
522 ::com
::sun
::star
::io
::IOException
,
523 ::com
::sun
::star
::embed
::StorageWrappedTargetException
);
525 /** allows to move an entry from one storage to another.
528 If target element supports transacted mode it must be committed by this
529 method after successful moving.
533 the name of the element in this storage
536 a destination storage
539 the name of the result element in destination storage
541 @throws ::com::sun::star::embed::InvalidStorageException
542 this storage is in invalid state for any reason
544 @throws ::com::sun::star::container::NoSuchElementException
545 there is no specified source element in this storage
547 @throws ::com::sun::star::container::ElementExistException
548 an element with specified destination name already exists in destination storage
550 @throws ::com::sun::star::io::IOException
551 in case of io errors during moving
553 @throws ::com::sun::star::embed::StorageWrappedTargetException
554 wraps other exceptions
558 [in] string sElementName
,
560 [in] string sNewName
)
561 raises
( ::com
::sun
::star
::embed
::InvalidStorageException
,
562 ::com
::sun
::star
::lang
::IllegalArgumentException
,
563 ::com
::sun
::star
::container
::NoSuchElementException
,
564 ::com
::sun
::star
::container
::ElementExistException
,
565 ::com
::sun
::star
::io
::IOException
,
566 ::com
::sun
::star
::embed
::StorageWrappedTargetException
);
573 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */