Statistics
| Revision:

gvsig-projects-pool / org.gvsig.vcsgis / trunk / org.gvsig.vcsgis / org.gvsig.vcsgis.lib / org.gvsig.vcsgis.lib.api / src / main / java / org / gvsig / vcsgis / lib / VCSGisManager.java @ 3315

History | View | Annotate | Download (10.4 KB)

1
package org.gvsig.vcsgis.lib;
2

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

    
26
import java.io.File;
27
import java.net.URL;
28
import java.util.Map;
29
import org.gvsig.fmap.dal.feature.FeatureStore;
30
import org.gvsig.fmap.dal.store.jdbc.JDBCServerExplorerParameters;
31
import org.gvsig.fmap.dal.store.jdbc2.JDBCServerExplorer;
32
import org.gvsig.tools.dynobject.DynObjectValueItem;
33
import org.gvsig.tools.task.SimpleTaskStatus;
34
import org.gvsig.vcsgis.lib.repository.VCSGisRepository;
35
import org.gvsig.vcsgis.lib.server.VCSGisServerController;
36
import org.gvsig.vcsgis.lib.workspace.VCSGisWorkspace;
37
import org.gvsig.vcsgis.lib.workspace.VCSGisWorkspaceDescriptor;
38

    
39

    
40
/**
41
 * @author gvSIG Teamn
42
 *
43
 */
44
public interface VCSGisManager {
45

    
46
    public static final int ERR_OK = 0;
47
    public static final int ERR_NO_ERROR = ERR_OK;
48
    public static final int ERR_DBFILE_IS_NULL = 1;
49
    public static final int ERR_WSEXPLORER_IS_NULL = 2;
50
    public static final int ERR_CANT_OPEN_WORKSPACE = 3;
51
    public static final int ERR_CANT_OPEN_WORKSPACE_SERVEREXPLORER = 4;
52
    public static final int ERR_STORE_NOT_IN_VERSION_CONTROL = 5;
53
    public static final int ERR_LABEL_IS_NULL = 6;
54
    public static final int ERR_CANT_EXECUTE_REQUEST = 7;
55
    public static final int ERR_CANT_BUILD_REQUEST_RESPONSE = 8;
56
    public static final int ERR_CANT_BUILD_REQUEST = 9;
57
    public static final int ERR_CANT_HANDLE_REQUEST = 10;
58
    public static final int ERR_CANT_INITIALIZE_REPOSITORY = 11;
59
    public static final int ERR_CANT_CONSUME_RESPONSE = 12;
60
    public static final int ERR_INVALID_DATA = 13;
61
    public static final int ERR_INVALID_REPOSITORY = 14;
62
    public static final int ERR_INVALID_REVISION = 15;
63
    public static final int ERR_INVALID_REVISION_FOR_ENTITY = 16;
64
    public static final int ERR_CANCELLED_BY_USER = 17;
65
    public static final int ERR_CANT_ADD_LAYER = 18;
66
    public static final int ERR_CANT_AUTHENTICATE_USER = 19;
67
    public static final int ERR_INVALID_AUTHENTICATION_TOKEN = 20;
68
    public static final int ERR_USER_NOT_AUTHORIZED = 21;
69
    public static final int ERR_AUTHENTICATION_EXPIRED = 22;
70
    public static final int ERR_INVALID_USERCODE = 23;
71

    
72
    public static final int ERR_CANT_RETRIEVE_USERS = 30;
73
    public static final int ERR_CANT_RETRIEVE_TOPOLOGYPLANS = 31;
74
    
75
    public static final int ERR_CANT_CREATE_TABLE = 100;
76
    public static final int ERR_CANT_CREATE_TABLE_CONFIG = 110;
77
    public static final int ERR_CANT_CREATE_TABLE_ENTITIES = 120;
78
    public static final int ERR_CANT_CREATE_TABLE_CHANGES = 130;
79
    
80
    public static final int ERR_ENTITY_ALREADY_EXISTS = 200;
81
    public static final int ERR_ENTITY_NOT_HAS_VCSGISCODE = 210;
82
    public static final int ERR_CANT_OPEN_ENTITIES = 220;
83
    public static final int ERR_CANT_INSERT_ENTITIES = 230;
84
    public static final int ERR_ENTITY_NOT_EXISTS = 240;
85
    public static final int ERR_CANT_RETRIEVE_ENTITIES = 250;
86
    public static final int ERR_CANT_ADD_ENTITY_WITHOUT_PRIMARY_KEY = 260;
87
    public static final int ERR_CANT_ADD_TABLE = 270;
88
    public static final int ERR_CANT_REMOVE_ENTITY = 280;
89
    
90
    public static final int ERR_CANT_OPEN_CHANGES = 300;
91
    public static final int ERR_CANT_INSERT_CHANGE = 310;
92
    public static final int ERR_CANT_ADD_CHANGE = 320;
93
    public static final int ERR_CANT_REMOVE_CHANGES = 330;
94

    
95
    public static final int ERR_CANT_OPEN_STORE = 400;
96
    public static final int ERR_CANT_RETRIEVE_SOURCE_FEATURES = 410;
97
    public static final int ERR_CANT_INSERT_FEATURES = 420;
98

    
99
    public static final int ERR_CANT_COMMIT = 500;
100
    public static final int ERR_CANT_COMMIT_WORKSPACE_OUTDATED = 510;
101
    public static final int ERR_CANT_COMMIT_WITH_FEATURE_CODE_BLANK = 520;
102

    
103
    public static final int ERR_CANT_CHECKOUT = 600;
104
    
105
    public static final int ERR_CANT_REVERT = 700;
106
    
107
    public static final int ERR_CANT_UPDATE_ENTITIES = 70;
108

    
109
    public static final int ERR_CANT_UPDATE = 80;
110
    public static final int ERR_CANT_PREPARE_UPDATE = 81;
111
    public static final int ERR_UPDATE_NEED_MERGE = 82;
112
    public static final int ERR_CANT_UPDATE_CLEAN = 83;
113
    public static final int ERR_CANT_MERGE = 84;
114
    
115
    public static final int STATE_UNKNOWN = 0; 
116
    public static final int STATE_LOCAL_UNMODIFIED = 1;
117
    public static final int STATE_LOCAL_NEW = 2;
118
    public static final int STATE_LOCAL_MODIFIED = 4;
119
    public static final int STATE_LOCAL_OUTDATED = 6;
120
    public static final int STATE_LOCAL_OUTDATED_AND_MODIFIED = 8;
121
    public static final int STATE_CONFLICT = 16;
122
    public static final int STATE_REPOSITORY_NEW = 32;
123
    public static final int STATE_REPOSITORY_MODIFIED = STATE_LOCAL_OUTDATED;
124
    
125

    
126
    public static final int OP_UNKNOWN = -1;
127
    public static final int OP_DELETE = 0;
128
    public static final int OP_UPDATE = 1;
129
    public static final int OP_INSERT = 2;
130

    
131
    public static final int OP_ADD_ENTITY = 3;
132

    
133
    public static final int TOPOLOGYPLAN_UNKNOWN = 0;
134
    public static final int TOPOLOGYPLAN_PASSED = 1;
135
    public static final int TOPOLOGYPLAN_NOTPASSED = 2;
136
    
137
    public static final int TOPOLOGYPLAN_MODE_RECOMMENDED = 0;
138
    public static final int TOPOLOGYPLAN_MODE_MANDATORY = 1;
139
    
140
    public static final String DEFAULT_DATA_TABLE = "VCSGIS_DATA";
141
    public static final String FEATURECODE_FIELD_NAME = "VCSGISCODE";
142

    
143

    
144
    /**
145
     * Initializes a workspace in the indicated database with the indicated 
146
     * label and associates it with the indicated repository.
147
     * 
148
     * It fails if a workspace is already created in that database.
149
     * 
150
     * A code will be assigned to the workspace automatically.
151
     * 
152
     * @param database in which to initialize the workspace.
153
     * @param repository to associate the workspace with.
154
     * @param label repository to associate the workspace with.
155
     * @param status
156
     * @return a error code.
157
     */
158
    public int initWorkspace(JDBCServerExplorer database, VCSGisRepository repository, String label, SimpleTaskStatus status);
159

    
160
    /**
161
     * Initializes a workspace in the H2 database associated with the 
162
     * indicated file with the indicated label and associating it with 
163
     * the indicated repository.
164
     * 
165
     * It fails if a workspace is already created in that database.
166
     * 
167
     * A code will be assigned to the workspace automatically.
168
     * 
169
     * @param dbfile file associated with database H2 in which to initialize the workspace.
170
     * @param repository to associate the workspace with.
171
     * @param label repository to associate the workspace with.
172
     * @param status
173
     * @return a error code.
174
     */
175
    public int initWorkspace(File dbfile, VCSGisRepository repository, String label, SimpleTaskStatus status);
176

    
177
    public VCSGisWorkspace openWorkspace(JDBCServerExplorer workspace);
178
    
179
    public VCSGisWorkspace openWorkspace(File wsfile);
180

    
181
    /**
182
     * Return a Map with the workspace descriptors registered in this manager.
183
     * 
184
     * The Map is indexed by the code of the workspace.
185
     * 
186
     * If the manager has not any workspace registered, return a empty Map.
187
     * 
188
     * @return the Map with the registered workspace descriptors.
189
     */
190
    public Map<String, VCSGisWorkspaceDescriptor> getWorkspaces();
191
    
192
    /**
193
     * Register a VCSGis-workspace in this manager.
194
     * 
195
     * @param workspace to register
196
     */
197
    public void registerWorkspace(VCSGisWorkspace workspace);
198

    
199
    /**
200
     * Deregister the VCSGis-workspace of this manager.
201
     * 
202
     * @param workspace to deregister
203
     */
204
    public void deregisterWorkspace(VCSGisWorkspace workspace);
205
    public void deregisterWorkspace(String workspaceCode);
206

    
207
    /**
208
     * Replace the current registered workspaces by the indicaded as the Map
209
     * of parameters in this manager.
210
     * 
211
     * If descriptors is null, remove al registered workspaces in this manager.
212
     * 
213
     * This method is designed to support the persistence of this manager's workspaces.
214
     * 
215
     * @param descriptors 
216
     */
217
    public void restoreWorkspaces(Map<String, VCSGisWorkspaceDescriptor> descriptors);
218
    
219
    /**
220
     * Returns the workspace associated with the store.
221
     * 
222
     * If the store is not associated with any registered workspace, it returns null.
223
     * 
224
     * The method can add properties to the store to optimize future invocations.
225
     * 
226
     * @param store
227
     * 
228
     * @return the workspace of the store or null.
229
     */
230
    public VCSGisWorkspace getWorkspace(FeatureStore store);
231
    
232
    /**
233
     * Return true if the file is a database of H2 that contains a VCSGis-workspace,
234
     * otherwise return false.
235
     * 
236
     * @param dbfile
237
     * @return 
238
     */
239
    public boolean isWorkspace(File dbfile);
240
    
241
    /**
242
     * Return true if the explorer parameters reference a database that contains a VCSGis-workspace,
243
     * otherwise return false.
244
     * 
245
     * @param params
246
     * @return 
247
     */
248
    public boolean isWorkspace(JDBCServerExplorerParameters params);
249

    
250
    public VCSGisWorkspaceDescriptor getWorkspaceDescriptor(String code);
251

    
252
    public int initRepository(JDBCServerExplorerParameters repositoryParameters, SimpleTaskStatus status);
253
    
254
    public VCSGisRepository openRepository(JDBCServerExplorerParameters repositoryParameters);
255
    
256
    public VCSGisRepository openRepository(URL repository);
257
    
258
    public VCSGisServerController createServerController(VCSGisRepository repository);
259

    
260
    public void setCodeGenerator(VCSGisCodeGenerator generator);
261
    
262
    public VCSGisCodeGenerator getCodeGenerator();
263
    
264
    public String getErrorMessage(int errcode);
265
    
266
    public void setUserIdentificationRequester(VCSGisUserIdentificationRequester userIdentificationRequester);
267
}