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 @ 40559

History | View | Annotate | Download (4.5 KB)

1
/**
2
 * gvSIG. Desktop Geographic Information System.
3
 *
4
 * Copyright (C) 2007-2013 gvSIG Association.
5
 *
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 3
9
 * of the License, or (at your option) any later version.
10
 *
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
 * MA  02110-1301, USA.
20
 *
21
 * For any additional information, do not hesitate to contact us
22
 * at info AT gvsig.com, or visit our website www.gvsig.com.
23
 */
24
package org.gvsig.fmap.dal;
25

    
26
import java.util.List;
27

    
28
import org.gvsig.fmap.dal.exception.DataException;
29
import org.gvsig.tools.dispose.Disposable;
30

    
31
/**
32
 * DataServerExplorer is an abstraction for any type of data server. It allows
33
 * connecting to the server and browsing its contents.
34
 *
35
 * More specifically, this interface provides a list of the available data
36
 * stores in a server.
37
 */
38
public interface DataServerExplorer extends Disposable {
39

    
40
        /**
41
         * Returns the DataServerExplorer's name
42
         *
43
         * @return String containing this DataServerExplorer's name
44
         */
45
        public String getProviderName();
46

    
47
        /**
48
         * Indicates whether this DataServerExplorer can create a new DataStore in the
49
         * server.
50
         *
51
         * @return true if this DataServerExplorer can be created or false otherwise.
52
         */
53
        public boolean canAdd();
54

    
55
        /**
56
         * Indicates whether this DataServerExplorer can create a new DataStore in
57
         * the server, given the store name.
58
         *
59
         * @param storeName
60
         *            store name.
61
         *
62
         * @return true if this DataServerExplorer can create a new store or false
63
         *         otherwise.
64
         *
65
         * @throws DataException
66
         */
67
        public boolean canAdd(String storeName)
68
                        throws DataException;
69

    
70
        /**
71
         * Provides a list of available stores in the server.
72
         *
73
         * @return list of DataStoreParameters
74
         *
75
         * @throws DataException
76
         */
77
        public List list() throws DataException;
78

    
79
        public static final int MODE_ALL = 0;
80
        public static final int MODE_FEATURE = 1;
81
        public static final int MODE_GEOMETRY = 2;
82
        public static final int MODE_RASTER = 4;
83

    
84
        /**
85
         * Provides a list of available stores in the server of a type.
86
         * 
87
         * @param mode
88
         *            , filter store from a type: {@link #MODE_ALL},
89
         *            {@link #MODE_FEATURE}, {@link #MODE_FEATURE_GEOMETRY},
90
         *            {@link #MODE_RASTER}
91
         * 
92
         * @return list of DataStoreParameters
93
         * 
94
         * @throws DataException
95
         */
96
        public List list(int mode) throws DataException;
97

    
98
        /**
99
         * Creates a new DataStore in this server.
100
         *
101
         * @param parameters
102
         *            , an instance of DataStoreParameters from
103
         *            {@link DataServerExplorer#getAddParameters(String)} that
104
         *            describes the new DataStore.
105
         * @param overwrite
106
         *            if the store already exists
107
         *
108
         * @return true if the DataStoreParameters were successfully added, false
109
         *         otherwise.
110
         *
111
         * @throws DataException
112
         */
113
        public boolean add(String provider, NewDataStoreParameters parameters, boolean overwrite)
114
                        throws DataException;
115

    
116
        /**
117
         * Removes a store from the server given its DataStoreParameters. If the
118
         * store is a file then this method deletes the file, if it is a table in a
119
         * database then this method drops the table, and so on.
120
         *
121
         * @param parameters
122
         * @throws DataException
123
         */
124
        void remove(DataStoreParameters parameters) throws DataException;
125

    
126
        /**
127
         * Given the store's name, returns its parameters for creation.
128
         *
129
         * @param storeName
130
         *
131
         * @return parameters to create a store
132
         *
133
         * @throws DataException
134
         */
135
        public NewDataStoreParameters getAddParameters(String storeName)
136
                        throws DataException;
137

    
138
        /**
139
         * Returns this DataServerExplorer parameters
140
         *
141
         * @return an instance of DataServerExplorerParameters containing this
142
         *         DataServerExplorer parameters.
143
         */
144
        public DataServerExplorerParameters getParameters();
145

    
146
        /**
147
         * Return the list of provider names that this server allow.
148
         *  
149
         * @return List of provider names
150
         */
151
        public List getDataStoreProviderNames();
152

    
153
}