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 @ 9515
History | View | Annotate | Download (8.92 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 javax.json.JsonObject; |
31 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
32 |
import org.gvsig.fmap.dal.store.jdbc.JDBCServerExplorerParameters; |
33 |
import org.gvsig.fmap.dal.store.jdbc2.JDBCServerExplorer; |
34 |
import org.gvsig.online.lib.api.OnlineUserIdentificationRequester.OnlineUserIdentificationRequesterConfig; |
35 |
import org.gvsig.online.lib.api.OnlineUserIdentificationRequester.OnlineUserIdentificationRequesterFactory; |
36 |
import org.gvsig.tools.task.SimpleTaskStatus; |
37 |
import org.gvsig.online.lib.api.workingcopy.OnlineWorkingcopy; |
38 |
import org.gvsig.online.lib.api.workingcopy.OnlineWorkingcopyDescriptor; |
39 |
import org.gvsig.online.lib.api.workingcopy.WorkingArea; |
40 |
|
41 |
/**
|
42 |
*
|
43 |
* @author jjdelcerro
|
44 |
*/
|
45 |
public interface OnlineManager { |
46 |
|
47 |
public static final int ONLINECODELEN = 60; |
48 |
|
49 |
public static final String AUTH_MODE_ONLINE = "gvSIG Online"; |
50 |
|
51 |
public static final String FEATURECODE_FIELD_NAME = "ogc_fid"; |
52 |
public static final String FEATUREMODIFIEDBY_FIELD_NAME = "modified_by"; |
53 |
public static final String FEATURELASTMODIFICATION_FIELD_NAME = "last_modification"; |
54 |
public static final String FEATUREDATE_FIELD_NAME = "feat_date_gvol"; |
55 |
public static final String FEATUREVERSION_FIELD_NAME = "feat_version_gvol"; |
56 |
|
57 |
public static final int STATE_UNKNOWN = 0; |
58 |
public static final int STATE_LOCAL_UNMODIFIED = 1; |
59 |
public static final int STATE_LOCAL_NEW = 2; |
60 |
public static final int STATE_LOCAL_MODIFIED = 4; |
61 |
public static final int STATE_LOCAL_OUTDATED = 6; |
62 |
public static final int STATE_LOCAL_OUTDATED_AND_MODIFIED = 8; |
63 |
public static final int STATE_CONFLICT = 16; |
64 |
public static final int STATE_REMOTE_NEW = 32; |
65 |
public static final int STATE_NOT_IN_LOCAL_OR_REMOTE = 64; |
66 |
public static final int STATE_DISCONNECTED = 128; |
67 |
public static final int STATE_CORRUPT = 256; |
68 |
public static final int STATE_REMOTE_MODIFIED = STATE_LOCAL_OUTDATED; |
69 |
public static final int STATE_LOG = 512; |
70 |
|
71 |
|
72 |
public static final int ERR_OK = 0; |
73 |
public static final int ERR_NO_ERROR = ERR_OK; |
74 |
public static final int ERR_DBFILE_IS_NULL = 1; |
75 |
public static final int ERR_WSEXPLORER_IS_NULL = 2; |
76 |
public static final int ERR_CANT_OPEN_WORKSPACE = 3; |
77 |
public static final int ERR_CANT_OPEN_WORKSPACE_SERVEREXPLORER = 4; |
78 |
public static final int ERR_STORE_NOT_IN_WORKINGCOPY = 5; |
79 |
public static final int ERR_LABEL_IS_NULL = 6; |
80 |
|
81 |
public static final int ERR_PROJECT_REQUIRED = 7; |
82 |
public static final int ERR_WORKINGAREA_REQUIRED = 8; |
83 |
|
84 |
public static final int ERR_CANCELLED_BY_USER = 17; |
85 |
public static final int ERR_CANT_ADD_LAYER = 18; |
86 |
|
87 |
public static final int ERR_CANT_AUTHENTICATE_USER = 19; |
88 |
public static final int ERR_INVALID_AUTHENTICATION_TOKEN = 20; |
89 |
public static final int ERR_USER_NOT_AUTHORIZED = 21; |
90 |
public static final int ERR_AUTHENTICATION_EXPIRED = 22; |
91 |
public static final int ERR_INVALID_USERCODE = 23; |
92 |
|
93 |
public static final int ERR_EXCEPTION = 25; |
94 |
|
95 |
public static final int ERR_INVALID_RECORDCODE = 34; |
96 |
public static final int ERR_DATA_RECORD_NOT_FOUND = 35; |
97 |
|
98 |
public static final int ERR_INVALID_ENTITY = 36; |
99 |
|
100 |
public static final int ERR_WORKINGCOPY_REQUIRED = 37; |
101 |
|
102 |
public static final int ERR_CANT_UPDATE = 80; |
103 |
public static final int ERR_CANT_PREPARE_UPDATE = 81; |
104 |
public static final int ERR_UPDATE_NEED_MERGE = 82; |
105 |
public static final int ERR_CANT_UPDATE_CLEAN = 83; |
106 |
public static final int ERR_CANT_MERGE = 84; |
107 |
public static final int ERR_CANNOT_UPDATE_TABLE_THAT_NOT_EXIST = 85; |
108 |
|
109 |
public static final int ERR_CANT_CREATE_TABLE = 100; |
110 |
public static final int ERR_CANT_CREATE_TABLE_CONFIG = 110; |
111 |
public static final int ERR_CANT_CREATE_TABLE_ENTITIES = 120; |
112 |
public static final int ERR_CANT_CREATE_TABLE_CHANGES = 130; |
113 |
|
114 |
public static final int ERR_ENTITY_ALREADY_EXISTS = 200; |
115 |
public static final int ERR_ENTITY_NOT_HAS_FEATURECODE = 210; |
116 |
public static final int ERR_CANT_OPEN_ENTITIES = 220; |
117 |
public static final int ERR_CANT_INSERT_ENTITIES = 230; |
118 |
public static final int ERR_ENTITY_NOT_EXISTS = 240; |
119 |
public static final int ERR_CANT_RETRIEVE_ENTITIES = 250; |
120 |
public static final int ERR_CANT_ADD_ENTITY_WITHOUT_PRIMARY_KEY = 260; |
121 |
public static final int ERR_CANT_ADD_TABLE = 270; |
122 |
public static final int ERR_CANT_REMOVE_ENTITY = 280; |
123 |
|
124 |
public static final int ERR_CANT_OPEN_CHANGES = 300; |
125 |
public static final int ERR_CANT_INSERT_CHANGE = 310; |
126 |
public static final int ERR_CANT_ADD_CHANGE = 320; |
127 |
public static final int ERR_CANT_REMOVE_CHANGES = 330; |
128 |
|
129 |
public static final int ERR_CANT_OPEN_STORE = 400; |
130 |
public static final int ERR_CANT_RETRIEVE_SOURCE_FEATURES = 410; |
131 |
public static final int ERR_CANT_INSERT_FEATURES = 420; |
132 |
|
133 |
public static final int ERR_CANT_REVERT = 700; |
134 |
|
135 |
public static final int ERR_SYNCHRONIZE = 800; |
136 |
public static final int ERR_OFFLINE = 10001; |
137 |
|
138 |
// workspace operations
|
139 |
public static final int OP_UNKNOWN = -1; |
140 |
public static final int OP_DELETE = 0; |
141 |
public static final int OP_UPDATE = 1; |
142 |
public static final int OP_INSERT = 2; |
143 |
// public static final int OP_ADD_ENTITY = 3;
|
144 |
public static final int OP_IGNORE = 4; |
145 |
|
146 |
public static final String TAG_ONLINE_LABEL = "online.label"; |
147 |
public static final String TAG_ONLINE_DATAMODEL = "online.datamodel"; |
148 |
public static final String TAG_ONLINE_FIELDFORLABEL = "online.fieldforlabel"; |
149 |
public static final String TAG_ONLINE_TABLENAME = "online.storename"; |
150 |
|
151 |
|
152 |
public String getErrorMessage(int errcode); |
153 |
|
154 |
public void addUserIdentificationRequester(OnlineUserIdentificationRequesterFactory factory); |
155 |
|
156 |
public OnlineUserIdentificationRequesterFactory getUserIdentificationRequester(String mode); |
157 |
|
158 |
public OnlineUserIdentificationRequesterConfig getUserIdentificationRequester(JsonObject uirc);
|
159 |
|
160 |
public Iterable<OnlineUserIdentificationRequesterFactory> getUserIdentificationRequesters(); |
161 |
|
162 |
public OnlineWorkingcopyDescriptor getWorkingcopyDescriptor(String code); |
163 |
|
164 |
public OnlineSite connectSite(OnlineUserIdentificationRequesterConfig userIdentificationRequesterConfig, URL site) throws IOException; |
165 |
|
166 |
/**
|
167 |
* Initializes a workspace in the H2 database associated with the
|
168 |
* indicated file with the indicated label and associating it with
|
169 |
* the indicated Site.It fails if a workspace is already created in that database.
|
170 |
*
|
171 |
* A code will be assigned to the workspace automatically.
|
172 |
*
|
173 |
* @param dbfile file associated with database H2 in which to initialize the workspace.
|
174 |
* @param project
|
175 |
* @param label repository to associate the workspace with.
|
176 |
* @param status
|
177 |
* @return a error code.
|
178 |
*/
|
179 |
public int initWorkingcopy(File dbfile, OnlineProject project, String label, SimpleTaskStatus status); |
180 |
|
181 |
public int initWorkingcopy(JDBCServerExplorer wsexplorer, OnlineProject project, String label, SimpleTaskStatus status); |
182 |
|
183 |
public OnlineWorkingcopy openWorkingcopy(File wsfile); |
184 |
|
185 |
void deregisterWorkingcopy(File dbfile); |
186 |
|
187 |
void deregisterWorkingcopy(OnlineWorkingcopy workingcopy);
|
188 |
|
189 |
void deregisterWorkingcopy(String workingcopyCode); |
190 |
|
191 |
OnlineWorkingcopy getWorkingcopy(FeatureStore store); |
192 |
|
193 |
Map<String, OnlineWorkingcopyDescriptor> getWorkingcopy(); |
194 |
|
195 |
boolean isWorkingcopy(File dbfile); |
196 |
|
197 |
boolean isWorkingcopy(JDBCServerExplorerParameters params);
|
198 |
|
199 |
OnlineWorkingcopy openWorkingcopy(File wsfile, String label); |
200 |
|
201 |
OnlineWorkingcopy openWorkingcopy(JDBCServerExplorer wsexplorer); |
202 |
|
203 |
OnlineWorkingcopy openWorkingcopy(JDBCServerExplorer wsexplorer, String label);
|
204 |
|
205 |
void registerWorkingcopy(OnlineWorkingcopy workingcopy);
|
206 |
|
207 |
void restoreWorkingcopy(Map<String, OnlineWorkingcopyDescriptor> descriptors); |
208 |
|
209 |
public void clean(); |
210 |
|
211 |
public String authenticate(String urlbase, String username, String password); |
212 |
|
213 |
|
214 |
public WorkingArea createWorkingArea();
|
215 |
|
216 |
} |