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

History | View | Annotate | Download (8.83 KB)

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

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

    
37

    
38
/**
39
 * @author gvSIG Teamn
40
 *
41
 */
42
public interface VCSGisManager {
43

    
44
    public static final int ERR_OK = 0;
45
    public static final int ERR_NO_ERROR = ERR_OK;
46
    public static final int ERR_DBFILE_IS_NULL = 1;
47
    public static final int ERR_WSEXPLORER_IS_NULL = 2;
48
    public static final int ERR_CANT_OPEN_WORKSPACE = 3;
49
    public static final int ERR_CANT_OPEN_WORKSPACE_SERVEREXPLORER = 4;
50
    public static final int ERR_STORE_NOT_IN_VERSION_CONTROL = 5;
51
    public static final int ERR_LABEL_IS_NULL = 6;
52
    public static final int ERR_CANT_EXECUTE_REQUEST = 7;
53
    public static final int ERR_CANT_BUILD_REQUEST_RESPONSE = 8;
54
    public static final int ERR_CANT_BUILD_REQUEST = 9;
55
    public static final int ERR_CANT_HANDLE_REQUEST = 10;
56
    public static final int ERR_CANT_INITIALIZE_REPOSITORY = 11;
57
    public static final int ERR_CANT_CONSUME_RESPONSE = 12;
58
    public static final int ERR_INVALID_DATA = 13;
59
    public static final int ERR_INVALID_REPOSITORY = 14;
60

    
61
    public static final int ERR_CANT_CREATE_TABLE = 90;
62
    public static final int ERR_CANT_CREATE_TABLE_CONFIG = 91;
63
    public static final int ERR_CANT_CREATE_TABLE_ENTITIES = 92;
64
    public static final int ERR_CANT_CREATE_TABLE_CHANGES = 93;
65
    
66
    public static final int ERR_ENTITY_ALREADY_EXISTS = 20;
67
    public static final int ERR_ENTITY_NOT_HAS_VCSGISCODE = 21;
68
    public static final int ERR_CANT_OPEN_ENTITIES = 22;
69
    public static final int ERR_CANT_INSERT_ENTITIES = 23;
70
    public static final int ERR_ENTITY_NOT_EXISTS = 24;
71
    public static final int ERR_CANT_RETRIEVE_ENTITIES = 25;
72
    public static final int ERR_CANT_ADD_ENTITY_WITHOUT_PRIMARY_KEY = 26;
73
    
74
    public static final int ERR_CANT_OPEN_CHANGES = 30;
75
    public static final int ERR_CANT_INSERT_CHANGE = 31;
76
    public static final int ERR_CANT_ADD_CHANGE = 32;
77

    
78
    public static final int ERR_CANT_OPEN_STORE = 40;
79
    public static final int ERR_CANT_RETRIEVE_SOURCE_FEATURES = 41;
80
    public static final int ERR_CANT_INSERT_FEATURES = 42;
81

    
82
    public static final int ERR_CANT_COMMIT = 50;
83
    public static final int ERR_CANT_COMMIT_WORKSPACE_OUTDATED = 51;
84
    public static final int ERR_CANT_COMMIT_WITH_FEATURE_CODE_BLANK = 52;
85

    
86
    public static final int ERR_CANT_CHECKOUT = 60;
87
    
88
    public static final int ERR_CANT_UPDATE_ENTITIES = 70;
89

    
90
    public static final int ERR_CANT_UPDATE = 80;
91
    public static final int ERR_CANT_PREPARE_UPDATE = 81;
92
    public static final int ERR_UPDATE_NEED_MERGE = 82;
93
    public static final int ERR_CANT_UPDATE_CLEAN = 83;
94
    
95
    public static final int STATE_UNMODIFIED = 0;                //BLACK
96
    public static final int STATE_NEW = 1;                       //GREEN
97
    public static final int STATE_MODIFIED = 2;                  //BLUE
98
    public static final int STATE_OUTDATED = 4;                  //BOLD BLACK
99
    public static final int STATE_OUTDATED_AND_MODIFIED = 6;     //RED
100
    public static final int STATE_CONFLICT = 8;                  //RED
101

    
102
    public static final int OP_UNKNOWN = -1;
103
    public static final int OP_DELETE = 0;
104
    public static final int OP_UPDATE = 1;
105
    public static final int OP_INSERT = 2;
106

    
107
    public static final int OP_ADD_ENTITY = 3;
108

    
109
    public static final String DEFAULT_DATA_TABLE = "VCSGIS_DATA";
110
    public static final String FEATURECODE_FIELD_NAME = "VCSGISCODE";
111

    
112

    
113
    /**
114
     * Initializes a workspace in the indicated database with the indicated 
115
     * label and associates it with the indicated repository.
116
     * 
117
     * It fails if a workspace is already created in that database.
118
     * 
119
     * A code will be assigned to the workspace automatically.
120
     * 
121
     * @param database in which to initialize the workspace.
122
     * @param repository to associate the workspace with.
123
     * @param label repository to associate the workspace with.
124
     * @param status
125
     * @return a error code.
126
     */
127
    public int initWorkspace(JDBCServerExplorer database, VCSGisRepository repository, String label, SimpleTaskStatus status);
128

    
129
    /**
130
     * Initializes a workspace in the H2 database associated with the 
131
     * indicated file with the indicated label and associating it with 
132
     * the indicated repository.
133
     * 
134
     * It fails if a workspace is already created in that database.
135
     * 
136
     * A code will be assigned to the workspace automatically.
137
     * 
138
     * @param dbfile file associated with database H2 in which to initialize the workspace.
139
     * @param repository to associate the workspace with.
140
     * @param label repository to associate the workspace with.
141
     * @param status
142
     * @return a error code.
143
     */
144
    public int initWorkspace(File dbfile, VCSGisRepository repository, String label, SimpleTaskStatus status);
145

    
146
    public VCSGisWorkspace openWorkspace(JDBCServerExplorer workspace);
147
    
148
    public VCSGisWorkspace openWorkspace(File wsfile);
149

    
150
    /**
151
     * Return a Map with the workspace descriptors registered in this manager.
152
     * 
153
     * The Map is indexed by the code of the workspace.
154
     * 
155
     * If the manager has not any workspace registered, return a empty Map.
156
     * 
157
     * @return the Map with the registered workspace descriptors.
158
     */
159
    public Map<String, VCSGisWorkspaceDescriptor> getWorkspaces();
160
    
161
    /**
162
     * Register a VCSGis-workspace in this manager.
163
     * 
164
     * @param workspace to register
165
     */
166
    public void registerWorkspace(VCSGisWorkspace workspace);
167

    
168
    /**
169
     * Deregister the VCSGis-workspace of this manager.
170
     * 
171
     * @param workspace to deregister
172
     */
173
    public void deregisterWorkspace(VCSGisWorkspace workspace);
174

    
175
    /**
176
     * Replace the current registered workspaces by the indicaded as the Map
177
     * of parameters in this manager.
178
     * 
179
     * If descriptors is null, remove al registered workspaces in this manager.
180
     * 
181
     * This method is designed to support the persistence of this manager's workspaces.
182
     * 
183
     * @param descriptors 
184
     */
185
    public void restoreWorkspaces(Map<String, VCSGisWorkspaceDescriptor> descriptors);
186
    
187
    /**
188
     * Returns the workspace associated with the store.
189
     * 
190
     * If the store is not associated with any registered workspace, it returns null.
191
     * 
192
     * The method can add properties to the store to optimize future invocations.
193
     * 
194
     * @param store
195
     * 
196
     * @return the workspace of the store or null.
197
     */
198
    public VCSGisWorkspace getWorkspace(FeatureStore store);
199
    
200
    /**
201
     * Return true if the file is a database of H2 that contains a VCSGis-workspace,
202
     * otherwise return false.
203
     * 
204
     * @param dbfile
205
     * @return 
206
     */
207
    public boolean isWorkspace(File dbfile);
208
    
209
    /**
210
     * Return true if the explorer parameters reference a database that contains a VCSGis-workspace,
211
     * otherwise return false.
212
     * 
213
     * @param params
214
     * @return 
215
     */
216
    public boolean isWorkspace(JDBCServerExplorerParameters params);
217

    
218
    public VCSGisWorkspaceDescriptor getWorkspaceDescriptor(String code);
219

    
220
    public int initRepository(JDBCServerExplorerParameters repositoryParameters, SimpleTaskStatus status);
221
    
222
    public VCSGisRepository openRepository(JDBCServerExplorerParameters repositoryParameters);
223
    
224
    public VCSGisRepository openRepository(URL repository);
225
    
226
    public VCSGisServerController createServerController(VCSGisRepository repository);
227

    
228
    public void setCodeGenerator(VCSGisCodeGenerator generator);
229
    
230
    public VCSGisCodeGenerator getCodeGenerator();
231
}