summaryrefslogtreecommitdiff
path: root/android/source/src/java/org/libreoffice/storage/IDocumentProvider.java
blob: 2b0460a8ee6ebd6cdea448435f18e493f09e8372 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
/* -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
 * This file is part of the LibreOffice project.
 *
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 */

package org.libreoffice.storage;

import java.net.URI;

/**
 * Represents a Document Provider, an object able to provide documents from a
 * certain source (e.g. local documents, DropBox, Google Docs).
 */
public interface IDocumentProvider {

    /**
     * Provides the content root element for the Document Provider.
     *
     * @return Content root element.
     * @throws RuntimeException in case of error.
     */
    IFile getRootDirectory();

    /**
     * Transforms some URI into the IFile object that represents that content.
     *
     * @param uri
     *            URI pointing to some content object that has been previously
     *            retrieved with IFile.getUri().
     * @return IFile object pointing to the content represented by uri.
     * @throws RuntimeException in case of error.
     */
    IFile createFromUri(URI uri);

    /**
     * Get internationalized name for this provider. This name is intended to be
     * shown in the UI.
     *
     * @return string resource pointing to the provider name.
     */
    int getNameResource();

    /**
     * Provides the unique ID for a document provider instance in a program.
     *
     * This ID should be set when the instance is built. It could be used to
     * tell two instances of the same document provider apart, e. g. two
     * instances of OwnCloudProvider pointing to different servers.
     *
     * @return Unique ID for a document provider instance.
     */
    int getId();

    /**
     * Checks if the Document Provider is available or not.
     *
     * @return A boolean value based on provider availability.
     */
    boolean checkProviderAvailability();
}