1
/* Copyright (c) 2006-2008 MetaCarta, Inc., published under the Clear BSD
2
* license. See http://svn.openlayers.org/trunk/openlayers/license.txt for the
3
* full text of the license. */
6
* Class: OpenLayers.Protocol
7
* Abstract vector layer protocol class. Not to be instantiated directly. Use
8
* one of the protocol subclasses instead.
10
OpenLayers.Protocol = OpenLayers.Class({
14
* {<OpenLayers.Format>} The format used by this protocol.
20
* {Object} Any options sent to the constructor.
25
* Property: autoDestroy
26
* {Boolean} The creator of the protocol can set autoDestroy to false
27
* to fully control when the protocol is destroyed. Defaults to
33
* Constructor: OpenLayers.Protocol
34
* Abstract class for vector protocols. Create instances of a subclass.
37
* options - {Object} Optional object whose properties will be set on the
40
initialize: function(options) {
41
options = options || {};
42
OpenLayers.Util.extend(this, options);
43
this.options = options;
48
* Clean up the protocol.
57
* Construct a request for reading new features.
60
* options - {Object} Optional object for configuring the request.
63
* {<OpenLayers.Protocol.Response>} An <OpenLayers.Protocol.Response>
64
* object, the same object will be passed to the callback function passed
65
* if one exists in the options object.
73
* Construct a request for writing newly created features.
76
* features - {Array({<OpenLayers.Feature.Vector>})} or
77
* {<OpenLayers.Feature.Vector>}
78
* options - {Object} Optional object for configuring the request.
81
* {<OpenLayers.Protocol.Response>} An <OpenLayers.Protocol.Response>
82
* object, the same object will be passed to the callback function passed
83
* if one exists in the options object.
90
* Construct a request updating modified features.
93
* features - {Array({<OpenLayers.Feature.Vector>})} or
94
* {<OpenLayers.Feature.Vector>}
95
* options - {Object} Optional object for configuring the request.
98
* {<OpenLayers.Protocol.Response>} An <OpenLayers.Protocol.Response>
99
* object, the same object will be passed to the callback function passed
100
* if one exists in the options object.
107
* Construct a request deleting a removed feature.
110
* feature - {<OpenLayers.Feature.Vector>}
111
* options - {Object} Optional object for configuring the request.
114
* {<OpenLayers.Protocol.Response>} An <OpenLayers.Protocol.Response>
115
* object, the same object will be passed to the callback function passed
116
* if one exists in the options object.
118
"delete": function() {
123
* Go over the features and for each take action
124
* based on the feature state. Possible actions are create,
128
* features - {Array({<OpenLayers.Feature.Vector>})}
129
* options - {Object} Object whose possible keys are "create", "update",
130
* "delete", "callback" and "scope", the values referenced by the
131
* first three are objects as passed to the "create", "update", and
132
* "delete" methods, the value referenced by the "callback" key is
133
* a function which is called when the commit operation is complete
134
* using the scope referenced by the "scope" key.
137
* {Array({<OpenLayers.Protocol.Response>})} An array of
138
* <OpenLayers.Protocol.Response> objects.
143
CLASS_NAME: "OpenLayers.Protocol"
147
* Class: OpenLayers.Protocol.Response
148
* Protocols return Response objects to their users.
150
OpenLayers.Protocol.Response = OpenLayers.Class({
153
* {Number} - OpenLayers.Protocol.Response.SUCCESS or
154
* OpenLayers.Protocol.Response.FAILURE
159
* Property: requestType
160
* {String} The type of request this response corresponds to. Either
161
* "create", "read", "update" or "delete".
167
* {Boolean} - true if this is the last response expected in a commit,
168
* false otherwise, defaults to true.
174
* {Array({<OpenLayers.Feature.Vector>})} or {<OpenLayers.Feature.Vector>}
175
* The features returned in the response by the server.
180
* Property: reqFeatures
181
* {Array({<OpenLayers.Feature.Vector>})} or {<OpenLayers.Feature.Vector>}
182
* The features provided by the user and placed in the request by the
193
* Constructor: OpenLayers.Protocol.Response
196
* options - {Object} Optional object whose properties will be set on the
199
initialize: function(options) {
200
OpenLayers.Util.extend(this, options);
207
* {Boolean} - true on success, false otherwise
209
success: function() {
210
return this.code > 0;
213
CLASS_NAME: "OpenLayers.Protocol.Response"
216
OpenLayers.Protocol.Response.SUCCESS = 1;
217
OpenLayers.Protocol.Response.FAILURE = 0;