-
Notifications
You must be signed in to change notification settings - Fork 20
/
IResourceService.cs
327 lines (287 loc) · 13.8 KB
/
IResourceService.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
#region Disclaimer / License
// Copyright (C) 2010, Jackie Ng
// https://github.com/jumpinjackie/mapguide-maestro
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
//
#endregion Disclaimer / License
using OSGeo.MapGuide.ObjectModels;
using System.IO;
using ObjCommon = OSGeo.MapGuide.ObjectModels.Common;
namespace OSGeo.MapGuide.MaestroAPI.Services
{
/// <summary>
/// Provides services for accessing resources in a repository
/// </summary>
/// <remarks>
/// Note that <see cref="T:OSGeo.MapGuide.MaestroAPI.IServerConnection"/> provides
/// built-in access to resource and feature services. Using the <see cref="M:OSGeo.MapGuide.MaestroAPI.IServerConnection.GetService"/>
/// method is not necessary
/// </remarks>
public interface IResourceService : IService
{
/// <summary>
/// Raised when a resource is added
/// </summary>
event ResourceEventHandler ResourceAdded;
/// <summary>
/// Raised when a resource is deleted. Note if a folder is deleted, this will
/// only be raised for the folder and not its children. Also note that this is
/// raised on any move operations as the original source is for all intents and
/// purposes, deleted.
/// </summary>
event ResourceEventHandler ResourceDeleted;
/// <summary>
/// Raised when a resource is updated
/// </summary>
event ResourceEventHandler ResourceUpdated;
/// <summary>
/// Gets a listing of resources in this repository. This performs a full listing
/// </summary>
/// <returns></returns>
ObjCommon.ResourceList GetRepositoryResources();
/// <summary>
/// Gets a listing of resources in this repository
/// </summary>
/// <param name="depth"></param>
/// <returns></returns>
ObjCommon.ResourceList GetRepositoryResources(int depth);
/// <summary>
/// Gets a listing of resources in this repository
/// </summary>
/// <param name="startingpoint"></param>
/// <param name="depth"></param>
/// <returns></returns>
ObjCommon.ResourceList GetRepositoryResources(string startingpoint, int depth);
/// <summary>
/// Gets a listing of resources in this repository
/// </summary>
/// <param name="startingpoint"></param>
/// <returns></returns>
ObjCommon.ResourceList GetRepositoryResources(string startingpoint);
/// <summary>
/// Gets a listing of resources in this repository
/// </summary>
/// <param name="startingpoint"></param>
/// <param name="type"></param>
/// <returns></returns>
ObjCommon.ResourceList GetRepositoryResources(string startingpoint, string type);
/// <summary>
/// Gets a listing of resources in this repository
/// </summary>
/// <param name="startingpoint"></param>
/// <param name="type"></param>
/// <param name="depth"></param>
/// <returns></returns>
ObjCommon.ResourceList GetRepositoryResources(string startingpoint, string type, int depth);
/// <summary>
/// Gets a listing of resources in this repository
/// </summary>
/// <param name="startingpoint"></param>
/// <param name="type"></param>
/// <param name="depth"></param>
/// <param name="computeChildren"></param>
/// <returns></returns>
ObjCommon.ResourceList GetRepositoryResources(string startingpoint, string type, int depth, bool computeChildren);
/// <summary>
/// Converts the specified XML stream to a strongly typed object
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="data"></param>
/// <returns></returns>
T DeserializeObject<T>(System.IO.Stream data);
/// <summary>
/// Serializes the specified object to the specified stream
/// </summary>
/// <param name="o"></param>
/// <param name="stream"></param>
void SerializeObject(object o, System.IO.Stream stream);
/// <summary>
/// Gets the stream of the attached data of the specified resource
/// </summary>
/// <param name="resourceID"></param>
/// <param name="dataname"></param>
/// <returns></returns>
System.IO.Stream GetResourceData(string resourceID, string dataname);
/// <summary>
/// Gets the document header of the specified resource
/// </summary>
/// <remarks>This operation does not work with session-based resources.</remarks>
/// <param name="resourceID"></param>
/// <returns></returns>
ObjCommon.ResourceDocumentHeaderType GetResourceHeader(string resourceID);
/// <summary>
/// Gets the folder header of the specified resource
/// </summary>
/// <param name="resourceID"></param>
/// <returns></returns>
ObjCommon.ResourceFolderHeaderType GetFolderHeader(string resourceID);
/// <summary>
/// Gets the raw XML stream of the specified resource id
/// </summary>
/// <param name="resourceID"></param>
/// <returns></returns>
Stream GetResourceXmlData(string resourceID);
/// <summary>
/// Gets a typed resource object from the specified resource id
/// </summary>
/// <param name="resourceID"></param>
/// <returns></returns>
IResource GetResource(string resourceID);
/// <summary>
/// Forces a timestamp update of the specified resource. This is akin to
/// setting the resource's content using its existing content.
/// </summary>
/// <param name="resourceID"></param>
void Touch(string resourceID);
/// <summary>
/// Sets the resource data of a specified resource
/// </summary>
/// <remarks>For the HTTP implementation of this API, the input stream must be seekable</remarks>
/// <param name="resourceid"></param>
/// <param name="dataname"></param>
/// <param name="datatype"></param>
/// <param name="stream"></param>
void SetResourceData(string resourceid, string dataname, ObjCommon.ResourceDataType datatype, System.IO.Stream stream);
/// <summary>
/// Sets the resource data of a specified resource
/// </summary>
/// <remarks>For the HTTP implementation of this API, the input stream must be seekable</remarks>
/// <param name="resourceID"></param>
/// <param name="dataName"></param>
/// <param name="dataType"></param>
/// <param name="stream"></param>
/// <param name="callback"></param>
void SetResourceData(string resourceID, string dataName, ObjCommon.ResourceDataType dataType, System.IO.Stream stream, Utility.StreamCopyProgressDelegate callback);
/// <summary>
/// Sets the raw XML data of the specified resource
/// </summary>
/// <param name="resourceID"></param>
/// <param name="stream"></param>
void SetResourceXmlData(string resourceID, System.IO.Stream stream);
/// <summary>
/// Sets the header for the specified folder
/// </summary>
/// <param name="resourceID"></param>
/// <param name="header"></param>
void SetFolderHeader(string resourceID, ObjCommon.ResourceFolderHeaderType header);
/// <summary>
/// Sets the header for the specified resource
/// </summary>
/// <param name="resourceID"></param>
/// <param name="header"></param>
void SetResourceHeader(string resourceID, ObjCommon.ResourceDocumentHeaderType header);
/// <summary>
/// Updates the repository
/// </summary>
/// <param name="resourceID"></param>
/// <param name="header"></param>
void UpdateRepository(string resourceID, ObjCommon.ResourceFolderHeaderType header);
/// <summary>
/// Deletes the specified attached resource data
/// </summary>
/// <param name="resourceID"></param>
/// <param name="dataname"></param>
void DeleteResourceData(string resourceID, string dataname);
/// <summary>
/// Gets a listing of all resource data attached to the specified resource
/// </summary>
/// <param name="resourceID"></param>
/// <returns></returns>
ObjCommon.ResourceDataList EnumerateResourceData(string resourceID);
/// <summary>
/// Delete the specified resource. For folders, ensure the resource ID has a trailing slash "/"
/// </summary>
/// <param name="resourceID"></param>
void DeleteResource(string resourceID);
/// <summary>
/// Gets a listing of all resources dependent on the specified resource
/// </summary>
/// <param name="resourceID"></param>
/// <returns></returns>
ObjCommon.ResourceReferenceList EnumerateResourceReferences(string resourceID);
/// <summary>
/// Copies the specified resource to the specified path
/// </summary>
/// <param name="oldResourceID"></param>
/// <param name="newResourceID"></param>
/// <param name="overwrite"></param>
void CopyResource(string oldResourceID, string newResourceID, bool overwrite);
/// <summary>
/// Moves the specified resources to the specified path
/// </summary>
/// <param name="oldResourceID"></param>
/// <param name="newResourceID"></param>
/// <param name="overwrite"></param>
void MoveResource(string oldResourceID, string newResourceID, bool overwrite);
/// <summary>
/// Moves the specified resources to the specified path. Any resources referencing this resource
/// are updated to reference the resource's new location
/// </summary>
/// <param name="oldResourceID"></param>
/// <param name="newResourceID"></param>
/// <param name="callback"></param>
/// <param name="progress"></param>
/// <returns></returns>
bool MoveResourceWithReferences(string oldResourceID, string newResourceID, LengthyOperationCallBack callback, LengthyOperationProgressCallBack progress);
/// <summary>
/// Copies the specified folder to the specified path. Any resources referencing this folder
/// are updated to reference the resources's new location
/// </summary>
/// <param name="oldResourceID"></param>
/// <param name="newResourceID"></param>
/// <param name="callback"></param>
/// <param name="progress"></param>
/// <returns></returns>
bool CopyFolderWithReferences(string oldResourceID, string newResourceID, LengthyOperationCallBack callback, LengthyOperationProgressCallBack progress);
/// <summary>
/// Gets whether the specified resource id exists
/// </summary>
/// <param name="resourceID"></param>
/// <returns></returns>
bool ResourceExists(string resourceID);
/// <summary>
/// Saves an object into the repository
/// </summary>
/// <param name="resource"></param>
void SaveResource(IResource resource);
/// <summary>
/// Saves an object into the repository using the specified resource id.
/// </summary>
/// <remarks>
/// The <paramref name="resourceID"/> parameter only instructs this method where to save the resource to. It does
/// not modify the <see cref="P:IResource.ResourceID"/> property of the input resource does not get
/// updated as a result of this operation.
/// </remarks>
/// <param name="resource">The object to save</param>
/// <param name="resourceID">The resourceId to save the object as</param>
void SaveResourceAs(IResource resource, string resourceID);
/// <summary>
/// Enumerates all unmanaged folders, meaning alias'ed folders
/// </summary>
/// <param name="startpath">The path to retrieve the data from</param>
/// <param name="filter">A filter applied to the items</param>
/// <param name="recursive">True if the list should contains recursive results</param>
/// <param name="type">The type of data to return</param>
/// <returns>A list of unmanaged data</returns>
ObjCommon.UnmanagedDataList EnumerateUnmanagedData(string startpath, string filter, bool recursive, UnmanagedDataTypes type);
/// <summary>
/// Upload a MapGuide Package file to the server
/// </summary>
/// <param name="fileName">Name of the file to upload</param>
/// <param name="callback">A callback argument used to display progress. May be null.</param>
void UploadPackage(string fileName, Utility.StreamCopyProgressDelegate callback);
}
}