Statistics
| Revision:

svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.compat.cdc / org.gvsig.fmap.dal / org.gvsig.fmap.dal.api / src / main / java / org / gvsig / fmap / dal / DataServerExplorer.java @ 40435

History | View | Annotate | Download (3.54 KB)

1 40435 jjdelcerro
package org.gvsig.fmap.dal;
2
3
import java.util.List;
4
5
import org.gvsig.fmap.dal.exception.DataException;
6
import org.gvsig.tools.dispose.Disposable;
7
8
/**
9
 * DataServerExplorer is an abstraction for any type of data server. It allows
10
 * connecting to the server and browsing its contents.
11
 *
12
 * More specifically, this interface provides a list of the available data
13
 * stores in a server.
14
 */
15
public interface DataServerExplorer extends Disposable {
16
17
        /**
18
         * Returns the DataServerExplorer's name
19
         *
20
         * @return String containing this DataServerExplorer's name
21
         */
22
        public String getProviderName();
23
24
        /**
25
         * Indicates whether this DataServerExplorer can create a new DataStore in the
26
         * server.
27
         *
28
         * @return true if this DataServerExplorer can be created or false otherwise.
29
         */
30
        public boolean canAdd();
31
32
        /**
33
         * Indicates whether this DataServerExplorer can create a new DataStore in
34
         * the server, given the store name.
35
         *
36
         * @param storeName
37
         *            store name.
38
         *
39
         * @return true if this DataServerExplorer can create a new store or false
40
         *         otherwise.
41
         *
42
         * @throws DataException
43
         */
44
        public boolean canAdd(String storeName)
45
                        throws DataException;
46
47
        /**
48
         * Provides a list of available stores in the server.
49
         *
50
         * @return list of DataStoreParameters
51
         *
52
         * @throws DataException
53
         */
54
        public List list() throws DataException;
55
56
        public static final int MODE_ALL = 0;
57
        public static final int MODE_FEATURE = 1;
58
        public static final int MODE_GEOMETRY = 2;
59
        public static final int MODE_RASTER = 4;
60
61
        /**
62
         * Provides a list of available stores in the server of a type.
63
         *
64
         * @param mode
65
         *            , filter store from a type: {@link #MODE_ALL},
66
         *            {@link #MODE_FEATURE}, {@link #MODE_FEATURE_GEOMETRY},
67
         *            {@link #MODE_RASTER}
68
         *
69
         * @return list of DataStoreParameters
70
         *
71
         * @throws DataException
72
         */
73
        public List list(int mode) throws DataException;
74
75
        /**
76
         * Creates a new DataStore in this server.
77
         *
78
         * @param parameters
79
         *            , an instance of DataStoreParameters from
80
         *            {@link DataServerExplorer#getAddParameters(String)} that
81
         *            describes the new DataStore.
82
         * @param overwrite
83
         *            if the store already exists
84
         *
85
         * @return true if the DataStoreParameters were successfully added, false
86
         *         otherwise.
87
         *
88
         * @throws DataException
89
         */
90
        public boolean add(String provider, NewDataStoreParameters parameters, boolean overwrite)
91
                        throws DataException;
92
93
        /**
94
         * Removes a store from the server given its DataStoreParameters. If the
95
         * store is a file then this method deletes the file, if it is a table in a
96
         * database then this method drops the table, and so on.
97
         *
98
         * @param parameters
99
         * @throws DataException
100
         */
101
        void remove(DataStoreParameters parameters) throws DataException;
102
103
        /**
104
         * Given the store's name, returns its parameters for creation.
105
         *
106
         * @param storeName
107
         *
108
         * @return parameters to create a store
109
         *
110
         * @throws DataException
111
         */
112
        public NewDataStoreParameters getAddParameters(String storeName)
113
                        throws DataException;
114
115
        /**
116
         * Returns this DataServerExplorer parameters
117
         *
118
         * @return an instance of DataServerExplorerParameters containing this
119
         *         DataServerExplorer parameters.
120
         */
121
        public DataServerExplorerParameters getParameters();
122
123
        /**
124
         * Return the list of provider names that this server allow.
125
         *
126
         * @return List of provider names
127
         */
128
        public List getDataStoreProviderNames();
129
130
}