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

History | View | Annotate | Download (10.3 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_CREATE_TABLE = 100;
73
    public static final int ERR_CANT_CREATE_TABLE_CONFIG = 110;
74
    public static final int ERR_CANT_CREATE_TABLE_ENTITIES = 120;
75
    public static final int ERR_CANT_CREATE_TABLE_CHANGES = 130;
76
    
77
    public static final int ERR_ENTITY_ALREADY_EXISTS = 200;
78
    public static final int ERR_ENTITY_NOT_HAS_VCSGISCODE = 210;
79
    public static final int ERR_CANT_OPEN_ENTITIES = 220;
80
    public static final int ERR_CANT_INSERT_ENTITIES = 230;
81
    public static final int ERR_ENTITY_NOT_EXISTS = 240;
82
    public static final int ERR_CANT_RETRIEVE_ENTITIES = 250;
83
    public static final int ERR_CANT_ADD_ENTITY_WITHOUT_PRIMARY_KEY = 260;
84
    public static final int ERR_CANT_ADD_TABLE = 270;
85
    public static final int ERR_CANT_REMOVE_ENTITY = 280;
86
    
87
    public static final int ERR_CANT_OPEN_CHANGES = 300;
88
    public static final int ERR_CANT_INSERT_CHANGE = 310;
89
    public static final int ERR_CANT_ADD_CHANGE = 320;
90
    public static final int ERR_CANT_REMOVE_CHANGES = 330;
91

    
92
    public static final int ERR_CANT_OPEN_STORE = 400;
93
    public static final int ERR_CANT_RETRIEVE_SOURCE_FEATURES = 410;
94
    public static final int ERR_CANT_INSERT_FEATURES = 420;
95

    
96
    public static final int ERR_CANT_COMMIT = 500;
97
    public static final int ERR_CANT_COMMIT_WORKSPACE_OUTDATED = 510;
98
    public static final int ERR_CANT_COMMIT_WITH_FEATURE_CODE_BLANK = 520;
99

    
100
    public static final int ERR_CANT_CHECKOUT = 600;
101
    
102
    public static final int ERR_CANT_REVERT = 700;
103
    
104
    public static final int ERR_CANT_UPDATE_ENTITIES = 70;
105

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

    
123
    public static final int OP_UNKNOWN = -1;
124
    public static final int OP_DELETE = 0;
125
    public static final int OP_UPDATE = 1;
126
    public static final int OP_INSERT = 2;
127

    
128
    public static final int OP_ADD_ENTITY = 3;
129

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

    
140

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

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

    
174
    public VCSGisWorkspace openWorkspace(JDBCServerExplorer workspace);
175
    
176
    public VCSGisWorkspace openWorkspace(File wsfile);
177

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

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

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

    
247
    public VCSGisWorkspaceDescriptor getWorkspaceDescriptor(String code);
248

    
249
    public int initRepository(JDBCServerExplorerParameters repositoryParameters, SimpleTaskStatus status);
250
    
251
    public VCSGisRepository openRepository(JDBCServerExplorerParameters repositoryParameters);
252
    
253
    public VCSGisRepository openRepository(URL repository);
254
    
255
    public VCSGisServerController createServerController(VCSGisRepository repository);
256

    
257
    public void setCodeGenerator(VCSGisCodeGenerator generator);
258
    
259
    public VCSGisCodeGenerator getCodeGenerator();
260
    
261
    public String getErrorMessage(int errcode);
262
    
263
    public void setUserIdentificationRequester(VCSGisUserIdentificationRequester userIdentificationRequester);
264
}