Statistics
| Revision:

svn-gvsig-desktop / branches / v2_0_0_prep / libraries / libFMap_dal / src / org / gvsig / fmap / dal / DataServerExplorer.java @ 25785

History | View | Annotate | Download (3.44 KB)

1
package org.gvsig.fmap.dal;
2

    
3
import java.util.List;
4

    
5
import org.gvsig.fmap.dal.exception.DataException;
6

    
7
/**
8
 * DataServerExplorer is an abstraction for any type of data server. It allows
9
 * connecting to the server and browsing its contents.
10
 *
11
 * More specifically, this interface provides a list of the available data
12
 * stores in a server.
13
 */
14
public interface DataServerExplorer {
15

    
16
        /**
17
         * Returns the DataServerExplorer's name
18
         *
19
         * @return String containing this DataServerExplorer's name
20
         */
21
        public String getName();
22

    
23
        /**
24
         * Indicates whether this DataServerExplorer can create a new DataStore in the
25
         * server.
26
         *
27
         * @return true if this DataServerExplorer can be created or false otherwise.
28
         */
29
        public boolean canAdd();
30

    
31
        /**
32
         * Indicates whether this DataServerExplorer can create a new DataStore in
33
         * the server, given the store name.
34
         *
35
         * @param storeName
36
         *            store name.
37
         *
38
         * @return true if this DataServerExplorer can create a new store or false
39
         *         otherwise.
40
         *
41
         * @throws DataException
42
         */
43
        public boolean canAdd(String storeName)
44
                        throws DataException;
45

    
46
        /**
47
         * Provides a list of available stores in the server.
48
         *
49
         * @return list of DataStoreParameters
50
         *
51
         * @throws DataException
52
         */
53
        public List list() throws DataException;
54

    
55
        public static final int MODE_ALL = 0;
56
        public static final int MODE_FEATURE = 1;
57
        public static final int MODE_FEATURE_GEOMETRY = 2;
58
        public static final int MODE_RASTER = 3;
59

    
60
        /**
61
         * Provides a list of available stores in the server of a type.
62
         * 
63
         * @param mode
64
         *            , filter store from a type: {@link #MODE_ALL},
65
         *            {@link #MODE_FEATURE}, {@link #MODE_FEATURE_GEOMETRY},
66
         *            {@link #MODE_RASTER}
67
         * 
68
         * @return list of DataStoreParameters
69
         * 
70
         * @throws DataException
71
         */
72
        public List list(int mode) throws DataException;
73

    
74
        /**
75
         * Creates new DataStore in this server.
76
         *
77
         * @param parameters
78
         *            , an instance of DataStoreParameters from
79
         *            {@link DataServerExplorer#getAddParameters(String)} that
80
         *            describes the new DataStore.
81
         * @param overwrite
82
         *            if the store already exists
83
         *
84
         * @return true if the DataStoreParameters were successfully added, false
85
         *         otherwise.
86
         *
87
         * @throws DataException
88
         */
89
        public boolean add(NewDataStoreParameters parameters, boolean overwrite)
90
                        throws DataException;
91

    
92
        /**
93
         * Removes a store from the server given its DataStoreParameters. If the
94
         * store is a file then this method deletes the file, if it is a table in a
95
         * database then this method drops the table, and so on.
96
         *
97
         * @param parameters
98
         * @throws DataException
99
         */
100
        void remove(DataStoreParameters parameters) throws DataException;
101

    
102
        /**
103
         * Given the store's name, returns its parameters for creation.
104
         *
105
         * @param storeName
106
         *
107
         * @return parameters to create a store
108
         *
109
         * @throws DataException
110
         */
111
        public NewDataStoreParameters getAddParameters(String storeName)
112
                        throws DataException;
113

    
114
        /**
115
         * Frees the resources used by this DataServerExplorer.
116
         *
117
         * @throws DataException
118
         */
119
        public void dispose() throws DataException;
120

    
121
        /**
122
         * Returns this DataServerExplorer parameters
123
         *
124
         * @return an instance of DataServerExplorerParameters containing this
125
         *         DataServerExplorer parameters.
126
         */
127
        public DataServerExplorerParameters getParameters();
128

    
129
}