Statistics
| Revision:

gvsig-projects-pool / org.gvsig.online / trunk / org.gvsig.online / org.gvsig.online.lib / org.gvsig.online.lib.api / src / main / java / org / gvsig / online / lib / api / OnlineManager.java @ 9512

History | View | Annotate | Download (8.24 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.online.lib.api;
25

    
26
import java.io.File;
27
import java.io.IOException;
28
import java.net.URL;
29
import java.util.Map;
30
import org.gvsig.fmap.dal.feature.FeatureStore;
31
import org.gvsig.fmap.dal.store.jdbc.JDBCServerExplorerParameters;
32
import org.gvsig.fmap.dal.store.jdbc2.JDBCServerExplorer;
33
import org.gvsig.tools.task.SimpleTaskStatus;
34
import org.gvsig.online.lib.api.workingcopy.OnlineWorkingcopy;
35
import org.gvsig.online.lib.api.workingcopy.OnlineWorkingcopyDescriptor;
36
import org.gvsig.online.lib.api.workingcopy.WorkingArea;
37

    
38
/**
39
 *
40
 * @author jjdelcerro
41
 */
42
public interface OnlineManager {
43

    
44
    public static final int ONLINECODELEN = 60;
45
    
46
    public static final String FEATURECODE_FIELD_NAME = "ogc_fid";
47
    public static final String FEATUREMODIFIEDBY_FIELD_NAME = "modified_by";
48
    public static final String FEATURELASTMODIFICATION_FIELD_NAME = "last_modification";
49
    public static final String FEATUREDATE_FIELD_NAME = "feat_date_gvol";
50
    public static final String FEATUREVERSION_FIELD_NAME = "feat_version_gvol";
51
    
52
    public static final int STATE_UNKNOWN = 0; 
53
    public static final int STATE_LOCAL_UNMODIFIED = 1;
54
    public static final int STATE_LOCAL_NEW = 2;
55
    public static final int STATE_LOCAL_MODIFIED = 4;
56
    public static final int STATE_LOCAL_OUTDATED = 6;
57
    public static final int STATE_LOCAL_OUTDATED_AND_MODIFIED = 8;
58
    public static final int STATE_CONFLICT = 16;
59
    public static final int STATE_REMOTE_NEW = 32;
60
    public static final int STATE_NOT_IN_LOCAL_OR_REMOTE = 64;
61
    public static final int STATE_DISCONNECTED = 128;
62
    public static final int STATE_CORRUPT = 256;
63
    public static final int STATE_REMOTE_MODIFIED = STATE_LOCAL_OUTDATED;
64
    public static final int STATE_LOG = 512;
65
    
66
    
67
    public static final int ERR_OK = 0;
68
    public static final int ERR_NO_ERROR = ERR_OK;
69
    public static final int ERR_DBFILE_IS_NULL = 1;
70
    public static final int ERR_WSEXPLORER_IS_NULL = 2;
71
    public static final int ERR_CANT_OPEN_WORKSPACE = 3;
72
    public static final int ERR_CANT_OPEN_WORKSPACE_SERVEREXPLORER = 4;
73
    public static final int ERR_STORE_NOT_IN_WORKINGCOPY = 5;
74
    public static final int ERR_LABEL_IS_NULL = 6;
75
    
76
    public static final int ERR_PROJECT_REQUIRED = 7;
77
    public static final int ERR_WORKINGAREA_REQUIRED = 8;
78
    
79
    public static final int ERR_CANCELLED_BY_USER = 17;
80
    public static final int ERR_CANT_ADD_LAYER = 18;
81

    
82
    public static final int ERR_CANT_AUTHENTICATE_USER = 19;
83
    public static final int ERR_INVALID_AUTHENTICATION_TOKEN = 20;
84
    public static final int ERR_USER_NOT_AUTHORIZED = 21;
85
    public static final int ERR_AUTHENTICATION_EXPIRED = 22;
86
    public static final int ERR_INVALID_USERCODE = 23;
87
    
88
    public static final int ERR_EXCEPTION = 25;
89
    
90
    public static final int ERR_INVALID_RECORDCODE = 34;
91
    public static final int ERR_DATA_RECORD_NOT_FOUND = 35;
92
    
93
    public static final int ERR_INVALID_ENTITY = 36;
94
    
95
    public static final int ERR_WORKINGCOPY_REQUIRED = 37;
96

    
97
    public static final int ERR_CANT_UPDATE = 80;
98
    public static final int ERR_CANT_PREPARE_UPDATE = 81;
99
    public static final int ERR_UPDATE_NEED_MERGE = 82;
100
    public static final int ERR_CANT_UPDATE_CLEAN = 83;
101
    public static final int ERR_CANT_MERGE = 84;
102
    public static final int ERR_CANNOT_UPDATE_TABLE_THAT_NOT_EXIST = 85;
103
    
104
    public static final int ERR_CANT_CREATE_TABLE = 100;
105
    public static final int ERR_CANT_CREATE_TABLE_CONFIG = 110;
106
    public static final int ERR_CANT_CREATE_TABLE_ENTITIES = 120;
107
    public static final int ERR_CANT_CREATE_TABLE_CHANGES = 130;
108

    
109
    public static final int ERR_ENTITY_ALREADY_EXISTS = 200;
110
    public static final int ERR_ENTITY_NOT_HAS_FEATURECODE = 210;
111
    public static final int ERR_CANT_OPEN_ENTITIES = 220;
112
    public static final int ERR_CANT_INSERT_ENTITIES = 230;
113
    public static final int ERR_ENTITY_NOT_EXISTS = 240;
114
    public static final int ERR_CANT_RETRIEVE_ENTITIES = 250;
115
    public static final int ERR_CANT_ADD_ENTITY_WITHOUT_PRIMARY_KEY = 260;
116
    public static final int ERR_CANT_ADD_TABLE = 270;
117
    public static final int ERR_CANT_REMOVE_ENTITY = 280;
118
    
119
    public static final int ERR_CANT_OPEN_CHANGES = 300;
120
    public static final int ERR_CANT_INSERT_CHANGE = 310;
121
    public static final int ERR_CANT_ADD_CHANGE = 320;
122
    public static final int ERR_CANT_REMOVE_CHANGES = 330;
123

    
124
    public static final int ERR_CANT_OPEN_STORE = 400;
125
    public static final int ERR_CANT_RETRIEVE_SOURCE_FEATURES = 410;
126
    public static final int ERR_CANT_INSERT_FEATURES = 420;
127
    
128
    public static final int ERR_CANT_REVERT = 700;
129
    
130
    public static final int ERR_SYNCHRONIZE = 800;
131
    public static final int ERR_OFFLINE = 10001;
132
    
133
    // workspace operations
134
    public static final int OP_UNKNOWN = -1;
135
    public static final int OP_DELETE = 0;
136
    public static final int OP_UPDATE = 1;
137
    public static final int OP_INSERT = 2;
138
//    public static final int OP_ADD_ENTITY = 3;
139
    public static final int OP_IGNORE = 4;
140

    
141
    public static final String TAG_ONLINE_LABEL = "online.label";
142
    public static final String TAG_ONLINE_DATAMODEL = "online.datamodel";
143
    public static final String TAG_ONLINE_FIELDFORLABEL = "online.fieldforlabel";
144
    public static final String TAG_ONLINE_TABLENAME = "online.storename";
145
    
146
        
147
    public String getErrorMessage(int errcode);
148
    
149
    public void setUserIdentificationRequester(OnlineUserIdentificationRequester userIdentificationRequester);
150
    
151
    public OnlineUserIdentificationRequester getUserIdentificationRequester();  
152
    
153
    public OnlineWorkingcopyDescriptor getWorkingcopyDescriptor(String code);
154
    
155
    public OnlineSite connectSite(URL site) throws IOException;
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 Site.It fails if a workspace is already created in that database.
161
     * 
162
     * A code will be assigned to the workspace automatically.
163
     * 
164
     * @param dbfile file associated with database H2 in which to initialize the workspace.
165
     * @param project
166
     * @param label repository to associate the workspace with.
167
     * @param status
168
     * @return a error code.
169
     */
170
    public int initWorkingcopy(File dbfile, OnlineProject project, String label, SimpleTaskStatus status);
171
    
172
    public int initWorkingcopy(JDBCServerExplorer wsexplorer, OnlineProject project, String label, SimpleTaskStatus status);
173

    
174
    public OnlineWorkingcopy openWorkingcopy(File wsfile);
175

    
176
    void deregisterWorkingcopy(File dbfile);
177

    
178
    void deregisterWorkingcopy(OnlineWorkingcopy workingcopy);
179

    
180
    void deregisterWorkingcopy(String workingcopyCode);
181

    
182
    OnlineWorkingcopy getWorkingcopy(FeatureStore store);
183

    
184
    Map<String, OnlineWorkingcopyDescriptor> getWorkingcopy();
185

    
186
    boolean isWorkingcopy(File dbfile);
187

    
188
    boolean isWorkingcopy(JDBCServerExplorerParameters params);
189

    
190
    OnlineWorkingcopy openWorkingcopy(File wsfile, String label);
191

    
192
    OnlineWorkingcopy openWorkingcopy(JDBCServerExplorer wsexplorer);
193

    
194
    OnlineWorkingcopy openWorkingcopy(JDBCServerExplorer wsexplorer, String label);
195

    
196
    void registerWorkingcopy(OnlineWorkingcopy workingcopy);
197

    
198
    void restoreWorkingcopy(Map<String, OnlineWorkingcopyDescriptor> descriptors);
199
 
200
    public void clean();
201

    
202
    public WorkingArea createWorkingArea();
203
}